/* ============ GLOBAL STYLES ============ */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    overflow: hidden;
    height: 100%;
    -webkit-overflow-scrolling: touch;
}

body {
    font-family: 'Arial', sans-serif;
    background: linear-gradient(135deg, #1a472a 0%, #2d5a3d 50%, #0f2818 100%);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #fff;
    padding: 10px;
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
    -webkit-user-select: none;
    user-select: none;
}

.container {
    width: 100%;
    max-width: 500px;
}

.game-wrapper {
    background: rgba(0, 0, 0, 0.3);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}

h1 {
    text-align: center;
    margin-bottom: 20px;
    font-size: 2em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.7);
    color: #ffd700;
}

/* ============ CANVAS STYLES ============ */
#gameCanvas {
    display: block;
    margin: 0 auto;
    background: linear-gradient(to bottom, #1a1a2e 0%, #16213e 100%);
    border: 3px solid #ffd700;
    border-radius: 10px;
    width: 100%;
    height: auto;
    max-width: 500px;
    touch-action: none;
    cursor: none;
}

.controls {
    text-align: center;
    margin-top: 15px;
    font-size: 0.9em;
    color: #ddd;
}

/* ============ MODAL STYLES ============ */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.3s ease;
}

.modal.hidden {
    display: none;
    opacity: 0;
}

.modal-content {
    background: linear-gradient(135deg, #2d5a3d 0%, #1a472a 100%);
    padding: 40px;
    border-radius: 20px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7);
    border: 2px solid #ffd700;
    max-width: 400px;
    width: 90%;
    animation: slideIn 0.3s ease;
}

@keyframes slideIn {
    from {
        transform: translateY(-50px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-content h2 {
    margin-bottom: 20px;
    font-size: 1.8em;
    color: #ffd700;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.5);
}

.modal-content p {
    margin-bottom: 20px;
    font-size: 1.1em;
    line-height: 1.5;
}

input[type="text"] {
    width: 100%;
    padding: 12px;
    margin-bottom: 20px;
    border: 2px solid #ffd700;
    border-radius: 8px;
    font-size: 1em;
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    text-align: center;
}

input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.5);
}

input[type="text"]:focus {
    outline: none;
    box-shadow: 0 0 10px rgba(255, 215, 0, 0.5);
    background: rgba(255, 255, 255, 0.15);
}

/* ============ BUTTON STYLES ============ */
.btn-primary {
    padding: 12px 30px;
    font-size: 1.1em;
    background: linear-gradient(135deg, #ffd700 0%, #ffed4e 100%);
    color: #000;
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(255, 215, 0, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(255, 215, 0, 0.5);
}

.btn-primary:active {
    transform: translateY(0);
}

/* ============ LEVEL COMPLETE STYLES ============ */
.level-complete {
    animation: celebrate 0.5s ease;
}

@keyframes celebrate {
    0% { transform: scale(0.8); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

.gift-container {
    margin: 30px 0;
    perspective: 1000px;
}

.gift {
    display: inline-block;
    animation: bounce 1s ease infinite;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-20px); }
}

.gift-box {
    width: 80px;
    height: 80px;
    background: #ff4444;
    border-radius: 10px;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3em;
    box-shadow: 0 10px 30px rgba(255, 68, 68, 0.4);
    border: 3px solid #cc0000;
}

.gift-top {
    position: absolute;
    top: -15px;
    left: 50%;
    transform: translateX(-50%);
    width: 60px;
    height: 20px;
    background: #00cc44;
    border-radius: 5px;
}

.gift-message {
    font-size: 1.2em;
    margin: 20px 0;
    color: #ffd700;
    font-weight: bold;
    text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5);
}

/* ============ RESPONSIVE DESIGN ============ */
@media (max-width: 480px) {
    .game-wrapper {
        padding: 15px;
    }

    h1 {
        font-size: 1.5em;
        margin-bottom: 15px;
    }

    .modal-content {
        padding: 30px 20px;
        width: 95%;
    }

    .controls {
        font-size: 0.85em;
    }
}

@media (orientation: landscape) {
    body {
        min-height: 100vh;
    }

    #gameCanvas {
        max-height: 90vh;
    }
}

/* ============ ANIMATIONS ============ */
@keyframes pulse {
    0% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0.7); }
    70% { box-shadow: 0 0 0 10px rgba(255, 215, 0, 0); }
    100% { box-shadow: 0 0 0 0 rgba(255, 215, 0, 0); }
}

.pulse {
    animation: pulse 2s infinite;
}
