* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen', 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue', sans-serif;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 25%, #f093fb 50%, #4facfe 75%, #00f2fe 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

.container {
    width: 100%;
    max-width: 800px;
    position: relative;
}

.screen {
    display: none;
    background: rgba(255, 255, 255, 0.98);
    border-radius: 24px;
    padding: 30px 20px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
    animation: fadeIn 0.5s ease-in;
    text-align: center;
    width: 100%;
}

.screen.active {
    display: block;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Welcome Screen */
.welcome-content {
    padding: 15px 10px;
}

.title {
    font-size: 2.2em;
    color: #667eea;
    margin-bottom: 25px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    animation: bounce 2s infinite;
    font-weight: 700;
    line-height: 1.2;
}

@keyframes bounce {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

.subtitle {
    font-size: 1.3em;
    color: #764ba2;
    margin-bottom: 35px;
    font-weight: 500;
    line-height: 1.4;
}

.btn-start, .btn-continue, .btn-restart {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 45px;
    font-size: 1.15em;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.4);
    font-weight: 600;
    min-height: 56px;
    width: 100%;
    max-width: 320px;
    display: inline-block;
    touch-action: manipulation;
}

.btn-start:hover, .btn-continue:hover, .btn-restart:hover {
    transform: scale(1.05);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.6);
}

.btn-start:active, .btn-continue:active, .btn-restart:active {
    transform: scale(0.98);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

/* Stage Content */
.stage-content {
    padding: 15px 10px;
}

.stage-content h2 {
    color: #667eea;
    margin-bottom: 25px;
    font-size: 1.8em;
    font-weight: 700;
    line-height: 1.3;
}

.stage-instruction {
    font-size: 1.15em;
    color: #555;
    margin-bottom: 35px;
    font-weight: 500;
    line-height: 1.5;
    padding: 0 10px;
}

/* Stage 1: Emoji Puzzle */
.emoji-puzzle {
    display: flex;
    justify-content: center;
    gap: 12px;
    margin: 35px 0;
    flex-wrap: wrap;
    padding: 0 10px;
}

.emoji-slot {
    width: 70px;
    height: 70px;
    min-width: 70px;
    min-height: 70px;
    border: 3px dashed #667eea;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.2em;
    background: #f8f9fa;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
}

.emoji-slot:hover {
    background: #e0e0e0;
    transform: scale(1.1);
}

.emoji-slot:active {
    transform: scale(0.95);
    background: #d0d0d0;
}

.emoji-slot.filled {
    background: #fff;
    border-color: #764ba2;
    border-style: solid;
}

.emoji-options {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin: 35px 0;
    flex-wrap: wrap;
    padding: 0 10px;
}

.emoji-option {
    width: 80px;
    height: 80px;
    min-width: 80px;
    min-height: 80px;
    border: 3px solid #667eea;
    border-radius: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.8em;
    background: white;
    cursor: pointer;
    transition: all 0.3s ease;
    touch-action: manipulation;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.emoji-option:hover {
    transform: scale(1.15) rotate(5deg);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.emoji-option:active {
    transform: scale(0.9);
}

.emoji-option.used {
    opacity: 0.3;
    cursor: not-allowed;
}

.hint {
    color: #999;
    font-size: 1em;
    margin-top: 25px;
    font-style: italic;
    padding: 0 15px;
    line-height: 1.5;
}

/* Stage 2: Memory Match */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    max-width: 100%;
    margin: 35px auto;
    padding: 0 10px;
}

.memory-card {
    aspect-ratio: 1;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2em;
    cursor: pointer;
    transition: all 0.3s ease;
    transform-style: preserve-3d;
    position: relative;
    touch-action: manipulation;
    min-height: 75px;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

.memory-card.flipped {
    background: white;
    transform: rotateY(180deg);
}

.memory-card.matched {
    opacity: 0.5;
    cursor: not-allowed;
}

.memory-card:active {
    transform: scale(0.95);
}

.memory-card .card-front {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

.memory-card .card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: rotateY(180deg);
}

/* Stage 3: Gift Boxes */
.gift-boxes {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 20px;
    max-width: 100%;
    margin: 40px auto;
    padding: 0 15px;
}

.gift-box {
    font-size: 4.5em;
    cursor: pointer;
    transition: all 0.3s ease;
    padding: 25px 20px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
    touch-action: manipulation;
    min-height: 140px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.gift-box:hover {
    transform: scale(1.2) rotate(10deg);
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.4);
}

.gift-box:active {
    transform: scale(0.95);
}

.gift-box.opened {
    animation: openGift 0.5s ease;
}

@keyframes openGift {
    0% { transform: scale(1); }
    50% { transform: scale(1.3) rotate(360deg); }
    100% { transform: scale(1); }
}

/* Stage 4: Riddle */
.riddle-options {
    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 100%;
    width: 100%;
    margin: 35px auto;
    padding: 0 15px;
}

.riddle-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 30px;
    font-size: 1.15em;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-weight: 600;
    min-height: 56px;
    touch-action: manipulation;
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.3);
    width: 100%;
}

.riddle-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.riddle-btn:active {
    transform: scale(0.98);
}

.riddle-btn.correct {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    animation: correctAnswer 0.5s ease;
}

.riddle-btn.wrong {
    background: linear-gradient(135deg, #ee0979 0%, #ff6a00 100%);
    animation: shake 0.5s ease;
}

@keyframes correctAnswer {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-10px); }
    75% { transform: translateX(10px); }
}

/* Stage 5: Speed Test */
.speed-test {
    margin: 40px 0;
    padding: 0 15px;
}

.speed-counter {
    font-size: 1.6em;
    color: #667eea;
    margin-bottom: 35px;
    font-weight: 700;
}

.speed-btn {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: white;
    border: none;
    padding: 22px 50px;
    font-size: 1.4em;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 20px rgba(245, 87, 108, 0.5);
    font-weight: 700;
    min-height: 70px;
    width: 100%;
    max-width: 100%;
    touch-action: manipulation;
}

.speed-btn:hover {
    transform: scale(1.1);
}

.speed-btn:active {
    transform: scale(0.95);
}

.speed-btn.completed {
    background: linear-gradient(135deg, #11998e 0%, #38ef7d 100%);
    animation: pulse 0.5s ease;
}

@keyframes pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.2); }
}

/* Stage 6: Number Guessing */
.guessing-game {
    margin: 35px 0;
    padding: 0 15px;
}

#guess-input {
    padding: 18px 25px;
    font-size: 1.3em;
    border: 3px solid #667eea;
    border-radius: 50px;
    width: 100%;
    max-width: 280px;
    text-align: center;
    margin-bottom: 25px;
    outline: none;
    font-weight: 600;
    touch-action: manipulation;
    -webkit-appearance: none;
    appearance: none;
}

#guess-input:focus {
    border-color: #764ba2;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.guess-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 18px 45px;
    font-size: 1.2em;
    border-radius: 50px;
    cursor: pointer;
    transition: all 0.3s ease;
    display: block;
    margin: 0 auto 25px;
    font-weight: 600;
    min-height: 56px;
    width: 100%;
    max-width: 280px;
    touch-action: manipulation;
    box-shadow: 0 6px 18px rgba(102, 126, 234, 0.4);
}

.guess-btn:hover {
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(102, 126, 234, 0.4);
}

.guess-btn:active {
    transform: scale(0.98);
}

.guess-feedback {
    font-size: 1.6em;
    font-weight: 700;
    margin: 25px 0;
    min-height: 50px;
    padding: 0 15px;
}

.guess-feedback.too-high {
    color: #f5576c;
    animation: bounceFeedback 0.5s ease;
}

.guess-feedback.too-low {
    color: #4facfe;
    animation: bounceFeedback 0.5s ease;
}

.guess-feedback.correct {
    color: #38ef7d;
    font-size: 2em;
    animation: celebrate 0.8s ease;
}

@keyframes bounceFeedback {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-10px); }
}

@keyframes celebrate {
    0%, 100% { transform: scale(1) rotate(0deg); }
    25% { transform: scale(1.2) rotate(-5deg); }
    75% { transform: scale(1.2) rotate(5deg); }
}

.guess-history {
    margin-top: 25px;
    font-size: 1.05em;
    color: #666;
    padding: 0 15px;
    line-height: 1.6;
}

/* Compliment Screen */
.compliment-content {
    padding: 30px 20px;
}

.compliment-message {
    font-size: 1.7em;
    color: #667eea;
    margin-bottom: 35px;
    line-height: 1.6;
    animation: fadeInUp 0.8s ease;
    font-weight: 600;
    padding: 0 15px;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Final Screen */
.final-content {
    padding: 30px 20px;
}

.final-title {
    font-size: 3em;
    margin-bottom: 25px;
    animation: bounce 2s infinite;
}

.final-message {
    font-size: 2em;
    color: #667eea;
    margin-bottom: 30px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    font-weight: 700;
    line-height: 1.3;
}

.final-text {
    font-size: 1.2em;
    color: #555;
    margin-bottom: 20px;
    line-height: 1.8;
    padding: 0 15px;
    font-weight: 500;
}

/* Responsive Design - Tablet */
@media (min-width: 481px) and (max-width: 768px) {
    .screen {
        padding: 35px 25px;
    }

    .title {
        font-size: 2.5em;
    }

    .subtitle {
        font-size: 1.4em;
    }

    .stage-content h2 {
        font-size: 2em;
    }

    .stage-instruction {
        font-size: 1.25em;
    }

    .emoji-slot {
        width: 75px;
        height: 75px;
        font-size: 2.4em;
    }

    .emoji-option {
        width: 85px;
        height: 85px;
        font-size: 3em;
    }

    .memory-grid {
        gap: 15px;
    }

    .memory-card {
        font-size: 2.5em;
    }

    .gift-box {
        font-size: 5em;
        min-height: 160px;
    }

    .final-title {
        font-size: 3.5em;
    }

    .final-message {
        font-size: 2.3em;
    }

    .final-text {
        font-size: 1.35em;
    }
}

/* Responsive Design - Desktop */
@media (min-width: 769px) {
    .screen {
        padding: 50px 40px;
    }

    .title {
        font-size: 3.5em;
    }

    .subtitle {
        font-size: 1.6em;
    }

    .stage-content h2 {
        font-size: 2.5em;
    }

    .stage-instruction {
        font-size: 1.3em;
    }

    .emoji-slot {
        width: 80px;
        height: 80px;
        font-size: 2.5em;
    }

    .emoji-option {
        width: 90px;
        height: 90px;
        font-size: 3.2em;
    }

    .memory-grid {
        max-width: 550px;
        gap: 18px;
    }

    .memory-card {
        font-size: 2.8em;
    }

    .gift-boxes {
        max-width: 450px;
        gap: 30px;
    }

    .gift-box {
        font-size: 5.5em;
        min-height: 180px;
    }

    .riddle-options {
        max-width: 400px;
    }

    .speed-btn {
        max-width: 400px;
    }

    #guess-input {
        max-width: 320px;
    }

    .guess-btn {
        max-width: 320px;
    }

    .final-title {
        font-size: 4.5em;
    }

    .final-message {
        font-size: 3em;
    }

    .final-text {
        font-size: 1.5em;
    }

    .compliment-message {
        font-size: 2.2em;
    }
}

