/* Prevent scrolling */
html, body {
    margin: 0;
    padding: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    position: fixed;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --primary-color: #4c51bf;
    --primary-dark: #434190;
    --text-dark: #2d3748;
    --text-light: #718096;
    --success: #48bb78;
    --error: #e53e3e;
    --warning: #ecc94b;
}

html {
    font-size: 16px;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0;
    padding: 0;
    background-size: cover !important;
    background-position: center !important;
    background-repeat: no-repeat !important;
    background-attachment: fixed !important;
    transition: background-image 0.5s ease-in-out;
}

.container {
    background: rgba(255, 250, 244, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 20px;
    padding: 2rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    width: 95%;
    max-width: 800px;
    max-height: 95vh;
    text-align: center;
    position: relative;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

/* Sound Control */
#sound-control {
    position: fixed;
    bottom: 4.5rem;
    right: 1rem;
    z-index: 100;
}

.control-group {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    padding: 0.4rem;
    border-radius: 50px;
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

#sound-control .icon-btn,
.voice-toggle {
    width: 32px;
    height: 32px;
}

#sound-control .icon-btn {
    background: rgba(255, 255, 255, 0.15);
    border: none;
    border-radius: 50%;
    color: white;
    font-size: 1rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.voice-toggle {
    position: relative;
}

.toggle-label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: #e53e3e;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1rem;
    transition: all 0.3s ease;
}

.toggle-input:checked + .toggle-label {
    background: #48bb78;
}

.toggle-label:hover,
#sound-control .icon-btn:hover {
    transform: translateY(-2px);
    filter: brightness(1.2);
}

@media (max-width: 480px) {
    #sound-control {
        bottom: 3.5rem;
        right: 0.8rem;
    }

    .control-group {
        padding: 0.3rem;
        gap: 0.4rem;
    }

    #sound-control .icon-btn,
    .voice-toggle,
    .toggle-label {
        width: 28px;
        height: 28px;
        font-size: 0.9rem;
    }
}

/* Landscape Mode */
@media (max-height: 480px) and (orientation: landscape) {
    #sound-control {
        bottom: 4rem;
        right: 1.5rem;
    }
    
    .control-group {
        transform: scale(0.85);
    }
}

/* Logo */
.logo {
    margin-bottom: 5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}

.logo img {
    width: 40px;
    height: 40px;
    border-radius: 20px;
    object-fit: cover;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.logo + h1 {
    color: var(--text-dark);
    margin-bottom: 2rem;
    font-size: 2rem;
    font-weight: 600;
}

@media (max-width: 480px) {
    .logo img {
        width: 100px;
        height: 100px;
    }
    
    .logo + h1 {
        font-size: 1.8rem;
    }
}

h2 {
    color: var(--text-dark);
    margin-bottom: 1.5rem;
    font-size: clamp(1.5rem, 4vw, 2rem);
}

.btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    font-size: clamp(0.9rem, 3vw, 1.1rem);
    cursor: pointer;
    transition: transform 0.2s, background 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn i {
    font-size: 1.2rem;
}

.btn:hover {
    background: var(--primary-dark);
    transform: translateY(-2px);
}

.hidden {
    display: none !important;
}

/* Game Screen Styles */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1.5rem;
    font-size: clamp(0.9rem, 2.5vw, 1.2rem);
    flex-wrap: wrap;
    gap: 0.8rem;
    padding: 0.5rem;
    background: rgba(247, 250, 252, 0.8);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
    border-radius: 12px;
}

.score, .timer, .level-display {
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
    min-width: 120px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.sound-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
}

.sound-toggle .icon-btn {
    background: white;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
    border: 2px solid var(--primary-color);
}

/* Game Controls */
.game-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 0 1rem;
    flex-wrap: wrap;
}

.control-btn {
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-weight: bold;
    min-width: 150px;
    justify-content: center;
}

.control-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.control-btn i {
    font-size: 1.1rem;
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    .header {
        padding: 0.8rem;
        gap: 1rem;
        flex-wrap: wrap;
    }

    .icon-btn {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }

    .sound-toggle {
        top: 0.8rem;
        right: 0.8rem;
    }

    .score, .timer, .level-display {
        padding: 0.4rem 0.8rem;
        min-width: 100px;
        font-size: 0.9rem;
    }

    .game-controls {
        flex-direction: column;
        align-items: center;
        gap: 0.8rem;
    }

    .control-btn,
    .button-group button {
        width: 100%;
        max-width: 300px;
    }
    
    .button-group {
        flex-direction: column;
        align-items: center;
    }
}

/* Landscape Mode */
@media (max-height: 480px) and (orientation: landscape) {
    .header {
        margin-bottom: 0.8rem;
        padding: 0.3rem;
    }

    .game-controls {
        flex-direction: row;
        margin-top: 1rem;
    }

    .control-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

.game-area {
    background: transparent;
    margin: 1rem 0;
    position: relative;
    height: auto;
    max-height: calc(95vh - 200px);
    overflow-y: auto;
}

#animal-image {
    width: min(280px, 80vw);
    height: min(280px, 80vw);
    margin: 0 auto 1rem;
    border-radius: 15px;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    position: relative;
}

#play-animal-sound {
    position: absolute;
    bottom: 1rem;
    right: 1rem;
    background: rgba(255, 255, 255, 0.9);
    border-radius: 50%;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

#options-container {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    gap: 0.8rem;
    margin-top: 1rem;
    padding: 0 0.5rem;
}

.option-btn {
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.6rem;
    border-radius: 8px;
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
    will-change: transform, background-color;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 80px;
    gap: 0.3rem;
}

.option-btn .spelling {
    font-size: clamp(0.9rem, 2.5vw, 1.1rem);
    font-weight: bold;
    color: var(--primary-color);
    letter-spacing: 2px;
}

.option-btn .animal-name {
    font-size: clamp(0.8rem, 2.5vw, 1rem);
    color: var(--text-dark);
}

.option-btn .english-name {
    font-size: clamp(0.7rem, 2vw, 0.85rem);
    color: var(--text-light);
}

.option-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.option-btn:hover .spelling,
.option-btn:hover .animal-name,
.option-btn:hover .english-name {
    color: white;
}

.correct {
    background: var(--success) !important;
    border-color: var(--success) !important;
}

.correct .spelling,
.correct .animal-name,
.correct .english-name {
    color: white !important;
}

.wrong {
    background: var(--error) !important;
    border-color: var(--error) !important;
}

.wrong .spelling,
.wrong .animal-name,
.wrong .english-name {
    color: white !important;
}

/* Game Over Screen */
#game-over {
    text-align: center;
    padding: 1rem;
}

.score-display {
    margin: 1.5rem 0;
}

.score-display i {
    font-size: clamp(2rem, 6vw, 3rem);
    color: var(--warning);
    margin-bottom: 1rem;
}

#final-score {
    font-size: clamp(2rem, 6vw, 2.5rem);
    color: var(--primary-color);
    font-weight: bold;
    display: block;
}

/* Game Selection */
.game-selection {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 2rem;
}

.game-choice {
    width: 100%;
    max-width: 300px;
    margin: 0 auto;
    justify-content: center;
    font-size: 1.2rem;
}

/* Number Game Styles */
.number-box {
    width: min(350px, 90vw);
    height: min(350px, 90vw);
    margin: 0 auto 1.5rem;
    border-radius: 25px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-5px);
    transition: transform 0.3s ease;
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-dark) 100%);
}

.number-text {
    font-size: clamp(8rem, 25vw, 15rem);
    font-weight: bold;
    color: white;
    text-shadow: 4px 4px 8px rgba(0, 0, 0, 0.3);
    line-height: 1;
}

/* Game Menu Styles */
.game-menu {
    text-align: center;
    margin-bottom: 2rem;
}

.game-menu h2 {
    color: var(--primary-color);
    margin-bottom: 1rem;
}

.game-menu-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

.menu-btn {
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    font-size: 1.1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.menu-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.menu-btn i {
    font-size: 1.2rem;
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    .number-box {
        width: min(300px, 85vw);
        height: min(300px, 85vw);
        border-radius: 20px;
    }

    .number-text {
        font-size: clamp(6rem, 20vw, 12rem);
    }

    .menu-btn {
        padding: 0.6rem 1.2rem;
        font-size: 1rem;
    }
}

/* Landscape Mode */
@media (max-height: 480px) and (orientation: landscape) {
    .number-box {
        width: min(250px, 50vw);
        height: min(250px, 50vw);
    }

    .number-text {
        font-size: clamp(5rem, 18vw, 10rem);
    }

    .game-menu {
        margin-bottom: 1rem;
    }

    .menu-btn {
        padding: 0.5rem 1rem;
        font-size: 0.9rem;
    }
}

/* Level Selection */
.level-buttons {
    display: flex;
    justify-content: center;
    gap: 0.8rem;
    margin: 1.5rem 0;
    flex-wrap: wrap;
    padding: 0 1rem;
}

.level-btn {
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s;
    font-weight: bold;
    min-width: 120px;
}

.level-btn small {
    font-size: 0.8rem;
    opacity: 0.8;
    display: block;
    margin-top: 0.3rem;
}

.level-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.level-btn.active {
    background: var(--primary-color);
    color: white;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    .options-grid {
        grid-template-columns: 1fr;
        gap: 0.8rem;
        padding: 0 0.5rem;
    }

    .number-option-btn {
        min-height: 60px;
        font-size: clamp(0.9rem, 2.5vw, 1.2rem);
        padding: 0.8rem;
    }

    .level-buttons {
        gap: 0.5rem;
        margin: 1rem 0;
    }

    .level-btn {
        padding: 0.6rem 1rem;
        min-width: 100px;
        font-size: 0.9rem;
    }
}

/* Landscape Mode */
@media (max-height: 480px) and (orientation: landscape) {
    .options-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.6rem;
        margin-top: 1rem;
    }

    .number-option-btn {
        min-height: 50px;
        font-size: 1rem;
        padding: 0.6rem;
    }

    .level-buttons {
        margin: 0.8rem 0;
    }

    .level-btn {
        padding: 0.5rem 0.8rem;
        min-width: 90px;
        font-size: 0.8rem;
    }
}

.options-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 0 1rem;
}

.number-option-btn {
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 1rem;
    border-radius: 10px;
    font-size: clamp(1rem, 3vw, 1.4rem);
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
    will-change: transform, background-color;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: bold;
}

.number-option-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.number-option-btn.correct {
    background: var(--success);
    border-color: var(--success);
    color: white;
}

.number-option-btn.wrong {
    background: var(--error);
    border-color: var(--error);
    color: white;
}

/* Animations */
@keyframes confetti {
    0% {
        transform: translateY(0);
        opacity: 1;
    }
    100% {
        transform: translateY(100vh);
        opacity: 0;
    }
}

@keyframes bounce {
    0%, 100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-20px);
    }
}

@keyframes tada {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
    }
}

/* Animal Animation Icons */
.animal-animation {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 5rem;
    color: var(--primary-color);
    z-index: 1000;
    display: none;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.animal-animation.show {
    display: block;
    animation: bounce 1s ease;
}

/* Confetti Container */
.confetti-container {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 999;
    perspective: 1000px;
    transform: translateZ(0);
    backface-visibility: hidden;
}

.confetti {
    position: absolute;
    width: 15px;
    height: 15px;
    background: var(--primary-color);
    opacity: 1;
    border-radius: 3px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.15);
    transform: translateZ(0);
    will-change: transform, opacity;
}

/* Correct Answer Animation */
.correct {
    animation: tada 1s ease !important;
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    .animal-animation {
        font-size: 4rem;
    }
    .option-btn,
    .number-option-btn,
    .color-option-btn {
        transition: transform 0.15s ease;
    }
    
    .memory-card {
        transition: transform 0.25s ease;
    }
}

/* Landscape Mode */
@media (max-height: 480px) and (orientation: landscape) {
    .animal-animation {
        font-size: 3.5rem;
    }
}

/* Button Group */
.button-group {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    flex-wrap: wrap;
    padding: 0 1rem;
}

.button-group button {
    min-width: 150px;
}

#back-to-menu {
    background: var(--text-dark);
}

#back-to-menu:hover {
    background: var(--text-light);
}

/* Color Game Styles */
.color-box {
    width: min(350px, 90vw);
    height: min(350px, 90vw);
    margin: 0 auto 1.5rem;
    border-radius: 25px;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3);
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: translateY(-5px);
    transition: transform 0.3s ease;
    overflow: hidden;
}

.color-display {
    width: 100%;
    height: 100%;
    animation: colorPulse 2s infinite;
    position: relative;
}

.color-option-btn {
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 1rem;
    border-radius: 10px;
    font-size: clamp(1rem, 3vw, 1.4rem);
    cursor: pointer;
    transition: transform 0.2s ease, background-color 0.2s ease;
    will-change: transform, background-color;
    min-height: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    font-weight: bold;
    position: relative;
    overflow: hidden;
}

.color-option-btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.3), transparent);
    transform: translateX(-100%);
    transition: transform 0.6s ease;
}

.color-option-btn:hover::before {
    transform: translateX(100%);
}

.color-option-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
}

/* Color Animations */
@keyframes colorPulse {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.05);
    }
    100% {
        transform: scale(1);
    }
}

@keyframes colorFade {
    0% {
        opacity: 0;
        transform: scale(0.9);
    }
    100% {
        opacity: 1;
        transform: scale(1);
    }
}

.color-option-btn.correct {
    animation: correctColor 0.6s ease forwards;
}

.color-option-btn.wrong {
    animation: wrongColor 0.6s ease forwards;
}

@keyframes correctColor {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        background: var(--success);
        color: white;
        border-color: var(--success);
    }
    100% {
        transform: scale(1);
        background: var(--success);
        color: white;
        border-color: var(--success);
    }
}

@keyframes wrongColor {
    0% {
        transform: scale(1);
    }
    25% {
        transform: translateX(-10px);
    }
    75% {
        transform: translateX(10px);
    }
    100% {
        transform: scale(1);
        background: var(--error);
        color: white;
        border-color: var(--error);
    }
}

/* Mobile Optimizations for Color Game */
@media (max-width: 480px) {
    .color-box {
        width: min(300px, 85vw);
        height: min(300px, 85vw);
        border-radius: 20px;
    }
    
    .color-option-btn {
        padding: 0.8rem;
        font-size: 1rem;
        min-height: 60px;
    }
}

/* Landscape Mode for Color Game */
@media (max-height: 480px) and (orientation: landscape) {
    .color-box {
        width: min(250px, 50vw);
        height: min(250px, 50vw);
    }
    
    .color-option-btn {
        padding: 0.6rem;
        min-height: 50px;
    }
}

/* Memory Game Styles */
.memory-theme-selection {
    margin: 1.5rem 0;
    text-align: center;
}

.memory-theme-selection h3 {
    color: var(--text-dark);
    margin-bottom: 1rem;
    font-size: clamp(1.2rem, 3vw, 1.5rem);
}

.theme-buttons {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin: 1rem 0;
}

.theme-btn {
    background: white;
    border: 2px solid var(--primary-color);
    color: var(--primary-color);
    padding: 0.8rem 1.5rem;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    min-width: 120px;
}

.theme-btn.active {
    background: var(--primary-color);
    color: white;
}

.theme-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
}

.memory-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin: 1rem auto;
    max-width: 600px;
    padding: 0 1rem;
}

.memory-card {
    aspect-ratio: 1;
    background: white;
    border-radius: 12px;
    cursor: pointer;
    position: relative;
    transform-style: preserve-3d;
    transform: scale(1);
    transition: transform 0.5s;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.memory-card.flipped {
    transform: rotateY(180deg);
}

.memory-card.matched {
    transform: scale(0.95);
    opacity: 0.8;
    border: 2px solid var(--success);
}

.memory-card-front,
.memory-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: clamp(1.5rem, 5vw, 2.5rem);
    border-radius: 12px;
    transition: transform 0.3s ease;
    will-change: transform;
}

.memory-card-front {
    background: linear-gradient(135deg, var(--primary-color), var(--primary-dark));
    color: white;
}

.memory-card-back {
    background: white;
    transform: rotateY(180deg);
    padding: 0.5rem;
}

.memory-card-back img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.memory-card:hover {
    transform: scale(1.05);
}

.memory-card.flipped:hover {
    transform: rotateY(180deg) scale(1.05);
}

.moves {
    background: white;
    padding: 0.5rem 1rem;
    border-radius: 8px;
    font-weight: bold;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex: 1;
    justify-content: center;
    min-width: 120px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

/* Mobile Optimizations for Memory Game */
@media (max-width: 480px) {
    .memory-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
        padding: 0 0.5rem;
    }
    
    .memory-card-front,
    .memory-card-back {
        font-size: clamp(1.2rem, 4vw, 2rem);
    }
}

/* Landscape Mode for Memory Game */
@media (max-height: 480px) and (orientation: landscape) {
    .memory-grid {
        grid-template-columns: repeat(6, 1fr);
        gap: 0.6rem;
        max-width: 800px;
    }
}

/* Memory Card Animations */
@keyframes cardFlip {
    0% {
        transform: rotateY(0);
    }
    100% {
        transform: rotateY(180deg);
    }
}

@keyframes cardMatch {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        border-color: var(--success);
    }
    100% {
        transform: scale(1);
        opacity: 0.8;
        border-color: var(--success);
    }
}

.memory-level-selection {
    margin: 1rem 0;
    text-align: center;
}

.memory-level-selection h3 {
    color: #333;
    margin-bottom: 1rem;
}

.level-buttons {
    display: flex;
    justify-content: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.level-btn {
    padding: 1rem 2rem;
    border: 2px solid #ddd;
    border-radius: 10px;
    background: white;
    color: #333;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.level-btn small {
    display: block;
    font-size: 0.8rem;
    color: #666;
    margin-top: 0.3rem;
}

.level-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.level-btn.active {
    background: #4CAF50;
    color: white;
    border-color: #4CAF50;
}

.level-btn.active small {
    color: rgba(255,255,255,0.8);
}

/* Responsif untuk layar kecil */
@media (max-width: 480px) {
    .level-btn {
        padding: 0.8rem 1.5rem;
        font-size: 1rem;
    }
    
    .level-buttons {
        gap: 0.5rem;
    }
}

.watermark {
    position: fixed;
    top: 1rem;
    right: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    z-index: 1000;
    background: rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 0.4rem;
    border-radius: 50px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.2);
}

.watermark img {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    object-fit: cover;
}

.watermark span {
    color: white;
    font-weight: 500;
    font-size: 1rem;
    padding-right: 0.4rem;
}

@media (max-width: 480px) {
    .watermark {
        top: 0.8rem;
        right: 0.8rem;
        padding: 0.3rem;
        gap: 0.4rem;
    }
    
    .watermark img {
        width: 28px;
        height: 28px;
    }
    
    .watermark span {
        font-size: 0.9rem;
    }
}

.footer {
    position: fixed;
    bottom: 1rem;
    left: 50%;
    transform: translateX(-50%);
    text-align: center;
    z-index: 1000;
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    padding: 0.6rem 1.2rem;
    border-radius: 50px;
    box-shadow: 
        0 4px 15px rgba(0, 0, 0, 0.1),
        inset 0 0 0 1px rgba(255, 255, 255, 0.2);
    transition: all 0.3s ease;
    white-space: nowrap;
}

.footer p {
    color: white;
    font-size: 0.85rem;
    font-weight: 500;
    margin: 0;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
}

.footer span {
    color: rgba(255, 255, 255, 0.9);
    font-weight: 600;
}

@media (max-width: 480px) {
    .footer {
        padding: 0.5rem 0.8rem;
        font-size: 0.7rem;
        max-width: none;
    }
}

.voice-input-btn {
    background: var(--primary-color);
    border: none;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    margin: 1rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.voice-input-btn:hover {
    transform: scale(1.1);
    background: var(--primary-dark);
}

.voice-input-btn.listening {
    animation: pulse 1.5s infinite;
    background: var(--error);
}

@keyframes pulse {
    0% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.4);
    }
    70% {
        transform: scale(1.1);
        box-shadow: 0 0 0 15px rgba(229, 62, 62, 0);
    }
    100% {
        transform: scale(1);
        box-shadow: 0 0 0 0 rgba(229, 62, 62, 0);
    }
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    .voice-input-btn {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

.control-group {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Voice Toggle Switch */
.voice-toggle {
    position: relative;
    width: 45px;
    height: 45px;
}

.toggle-input {
    opacity: 0;
    width: 0;
    height: 0;
    position: absolute;
}

.toggle-label {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.toggle-input:checked + .toggle-label {
    background: var(--success);
}

.toggle-input:checked + .toggle-label i {
    color: white;
}

.toggle-label:hover {
    background: rgba(255, 255, 255, 0.25);
    transform: translateY(-2px);
}

/* Mobile Optimizations */
@media (max-width: 480px) {
    .voice-toggle {
        width: 40px;
        height: 40px;
    }

    .toggle-label {
        font-size: 1.1rem;
    }
} 