:root {
    --bg-color: #E2EFE7;
    --app-bg: #FAFAFA;
    --text-main: #2D3748;
    --text-muted: #A0AEC0;
    --text-light: #FFFFFF;

    --primary: #10AC84;
    --secondary: #0ABDE3;
    --warning: #FECA57;
    --accent: #5F27CD;

    --card-shadow: 0 10px 20px rgba(0, 0, 0, 0.05), 0 6px 6px rgba(0, 0, 0, 0.04);
    --btn-shadow: 0 4px 14px 0 rgba(16, 172, 132, 0.39);

    --radius-md: 16px;
    --radius-lg: 24px;
    --radius-xl: 32px;
}

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

/* Global Loader */
.global-loader {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: #F8FAFC;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    transition: opacity 0.5s ease, visibility 0.5s;
}

.global-loader.hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-spinner {
    width: 50px;
    height: 50px;
    border: 5px solid #E2E8F0;
    border-top-color: #00B074;
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin-bottom: 16px;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loader-text {
    font-size: 1.1rem;
    font-weight: 700;
    color: #475569;
}

body {
    font-family: 'Nunito', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-main);
    display: flex;
    justify-content: center;
    min-height: 100vh;
}

.app-container {
    width: 100%;
    max-width: 480px;
    background-color: var(--app-bg);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    position: relative;
    overflow-x: hidden;
    box-shadow: 0 0 40px rgba(0, 0, 0, 0.05);
}

.hidden {
    display: none !important;
}

/* Quiz Header */
#quiz-header {
    display: flex;
    align-items: center;
    padding: 20px;
    background-color: #FFF;
    gap: 16px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.03);
    z-index: 10;
}

.icon-btn {
    background: none;
    border: none;
    color: var(--text-main);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 12px;
    width: 48px;
    height: 48px;
    border-radius: 50%;
    background-color: #F7FAFC;
    transition: background-color 0.2s;
}

#progress-container {
    flex-grow: 1;
    height: 8px;
    background-color: #EDF2F7;
    border-radius: 4px;
    overflow: hidden;
}

#progress-bar {
    height: 100%;
    background-color: var(--primary);
    width: 0%;
    transition: width 0.3s ease;
    border-radius: 4px;
}

#score-display {
    font-weight: 800;
    color: #FFF;
    font-size: 1.05rem;
    background-color: var(--primary);
    padding: 6px 16px;
    border-radius: 999px;
    box-shadow: 0 2px 8px rgba(16, 172, 132, 0.3);
    white-space: nowrap;
}

#global-score-container {
    background: linear-gradient(to bottom, #60a5fa 0%, #3b82f6 50%, #2563eb 100%);
    border: 3px solid #1e3a8a;
    border-radius: 34px;
    box-shadow: 
        0 5px 0 #1e3a8a, 
        inset 0 3px 5px rgba(255, 255, 255, 0.7), 
        inset 0 -3px 5px rgba(0, 0, 0, 0.2), 
        0 6px 8px rgba(0, 0, 0, 0.3);
    padding: 5px 16px;
    height: 40px;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin-left: auto;
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s, box-shadow 0.1s;
}

#global-score-container:hover {
    filter: brightness(1.1);
}

#global-score-container:active {
    transform: translateY(3px);
    box-shadow: 
        0 2px 0 #1e3a8a, 
        inset 0 3px 5px rgba(255, 255, 255, 0.7), 
        inset 0 -3px 5px rgba(0, 0, 0, 0.2), 
        0 3px 4px rgba(0, 0, 0, 0.3);
}

.score-star-icon {
    width: 22px;
    height: 22px;
    filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.5));
    animation: star-float 2s ease-in-out infinite;
}

@keyframes star-float {
    0% { transform: translateY(0) scale(1); }
    50% { transform: translateY(-2px) scale(1.08); }
    100% { transform: translateY(0) scale(1); }
}

.score-text-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.global-score-label {
    display: none; /* Hide text for a cleaner icon-only button look */
}

#global-score-display {
    font-weight: 900;
    color: white;
    font-size: 1.25rem;
    line-height: 1;
    text-shadow: 0 2px 0 #1e3a8a, 0 3px 3px rgba(0, 0, 0, 0.4);
    letter-spacing: 1px;
    padding-bottom: 2px;
}

.score-pulse-active {
    animation: score-glow 2s infinite alternate;
}

@keyframes score-glow {
    0% { filter: brightness(1); }
    100% { filter: brightness(1.15); }
}

/* Main Content Area */
main {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    position: relative;
}

.screen {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

/* Home/Subject Screen Headers */
.home-header {
    padding: 16px 16px 0 16px;
    background-color: #FFF;
    border-bottom-left-radius: var(--radius-lg);
    border-bottom-right-radius: var(--radius-lg);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.02);
    margin-bottom: 16px;
    padding-bottom: 16px;
}

.home-header h2 {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 4px;
}

.subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Home Body & Subject Cards */
.home-body {
    padding: 0 16px 16px 16px;
}

.subject-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
    padding-top: 20px; /* Give space for pop-out images */
}

.subject-card {
    border-radius: 28px;
    padding: 16px;
    color: white;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    text-align: left;
    border: none;
    font-family: inherit;
    width: 100%;
    aspect-ratio: 1 / 1;
    position: relative;
    overflow: visible !important;
}

.subject-card:active {
    transform: scale(0.96);
}

.card-icon-container {
    position: absolute;
    bottom: 55px; /* Rest just above the text */
    top: -25px; /* Pop out of the top */
    left: 0;
    right: 0;
    width: 100%; /* Fit exactly to the card width */
    display: flex;
    align-items: flex-end; /* Align image to bottom */
    justify-content: flex-end; /* Align image to the right side */
    pointer-events: none;
}

.card-icon-container svg, .card-icon-container img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: bottom right; /* Anchor image flush to the right edge */
    filter: drop-shadow(0 8px 16px rgba(0,0,0,0.15));
}

.card-text-container {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.card-title {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1.2;
}

/* Layout specifically for Subject Screen cards */
.subject-screen-card {
    justify-content: flex-start; /* Push text to the top */
}

.subject-screen-card .card-text-container {
    position: relative;
    z-index: 2; /* Keep text above image */
}

.subject-screen-card .card-icon-container {
    top: 35px; /* Push down from top */
    bottom: 0; /* Anchor perfectly to bottom edge */
    left: 20px; /* Push from left */
    right: 0; /* Anchor perfectly to right edge */
    width: auto; 
    height: auto;
    align-items: flex-end;
    justify-content: flex-end;
}

.subject-screen-card .card-icon-container svg, 
.subject-screen-card .card-icon-container img {
    object-position: bottom right; /* Pin graphic to bottom-right corner */
}

.card-subtitle {
    font-size: 0.95rem;
    font-weight: 600;
    opacity: 0.85;
    line-height: 1;
}

/* Colorful Gradients & Shadows */
.bg-gradient-1 {
    background: linear-gradient(135deg, #FF6B6B, #EE5253);
    box-shadow: 0 10px 24px rgba(238, 82, 83, 0.4);
}

.bg-gradient-2 {
    background: linear-gradient(135deg, #48DBFB, #0ABDE3);
    box-shadow: 0 10px 24px rgba(10, 189, 227, 0.4);
}

.bg-gradient-3 {
    background: linear-gradient(135deg, #1DD1A1, #10AC84);
    box-shadow: 0 10px 24px rgba(16, 172, 132, 0.4);
}

.bg-gradient-4 {
    background: linear-gradient(135deg, #FF9F43, #FECA57);
    box-shadow: 0 10px 24px rgba(254, 202, 87, 0.4);
}

.bg-gradient-5 {
    background: linear-gradient(135deg, #5F27CD, #341F97);
    box-shadow: 0 10px 24px rgba(52, 31, 151, 0.4);
}

/* Quiz Screen */
#quiz-screen {
    padding: 24px;
    transition: background-color 0.4s ease;
}

.question-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
}

.badge {
    background-color: #E6FFFA;
    color: #319795;
    padding: 4px 12px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 700;
}

.question-counter {
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.9rem;
}

.question-card {
    background-color: #FFF;
    border-radius: var(--radius-xl);
    padding: 24px 24px;
    box-shadow: var(--card-shadow);
    margin-bottom: 32px;
    text-align: center;
    min-height: 100px;
    display: flex;
    align-items: flex-start;
    justify-content: center;
}

#question-text {
    font-size: 1.65rem;
    font-weight: 900;
    line-height: 1.5;
    color: #1A202C;
    width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.options-container {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.option-btn {
    background-color: #FFF;
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    padding: 16px 24px;
    font-size: 1.8rem;
    line-height: 1.6;
    font-weight: 700;
    color: var(--text-main);
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
    font-family: inherit;
    position: relative;
    width: 100%;
    overflow-wrap: anywhere;
    word-break: break-word;
}

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

.option-btn.correct {
    border-color: var(--primary);
    background-color: var(--primary);
    color: white;
}

.option-btn.wrong {
    border-color: #F56565;
    background-color: #F56565;
    color: white;
}

/* Custom Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.modal.hidden {
    display: none;
}

.modal-content {
    background: #fff;
    padding: 24px;
    border-radius: var(--radius-lg);
    width: 90%;
    max-width: 320px;
    text-align: center;
    box-shadow: var(--card-shadow);
}

.modal-content h3 {
    margin-top: 0;
    margin-bottom: 12px;
    color: var(--text-main);
}

/* Toast Notifications */
#toast-container {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
    width: 90%;
    max-width: 400px;
}

.toast {
    background: #fff;
    color: var(--text-main);
    padding: 16px 20px;
    border-radius: 12px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    gap: 12px;
    transform: translateY(-20px);
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.68, -0.55, 0.265, 1.55);
    font-weight: 600;
    border-left: 4px solid var(--primary);
}

.toast.show {
    transform: translateY(0);
    opacity: 1;
}

.toast.error {
    border-left-color: #E53E3E;
}

.toast-icon {
    font-size: 1.2rem;
}

.modal-content p {
    color: var(--text-muted);
    margin-bottom: 24px;
    font-weight: 600;
}

.modal-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}

.modal-actions button {
    flex: 1;
    padding: 12px;
    font-size: 1rem;
    border-radius: var(--radius-md);
}

/* Result Screen */
#result-screen {
    padding: 24px;
    justify-content: center;
}

.result-card {
    background-color: #FFF;
    border-radius: var(--radius-xl);
    padding: 48px 24px;
    box-shadow: var(--card-shadow);
    text-align: center;
    margin-bottom: 32px;
    position: relative;
    overflow: hidden;
}

.result-card::before {
    content: '';
    position: absolute;
    top: -40px;
    right: -40px;
    width: 150px;
    height: 150px;
    background: linear-gradient(135deg, #4ADE80, #22C55E);
    border-radius: 50%;
    opacity: 0.1;
}

.result-header h2 {
    color: var(--text-main);
    margin-bottom: 8px;
    font-size: 2rem;
    font-weight: 800;
}

#result-subtitle {
    color: var(--text-muted);
    font-weight: 700;
    font-size: 1.1rem;
    margin-bottom: 32px;
}

.score-circle {
    width: 180px;
    height: 180px;
    border-radius: 50%;
    background: linear-gradient(135deg, #FFD700, #FFA500);
    margin: 0 auto 32px auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #FFF;
    border: 12px solid #FFF3CD;
    box-shadow: 0 10px 25px rgba(255, 165, 0, 0.3);
}

#final-score {
    font-size: 5rem;
    font-weight: 900;
    line-height: 1;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.total-text {
    font-size: 1.2rem;
    font-weight: 800;
    color: rgba(255, 255, 255, 0.9);
}

#result-message {
    font-size: 1.3rem;
    font-weight: 800;
    color: var(--text-main);
}

.result-actions {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.primary-btn,
.secondary-btn {
    padding: 20px 24px;
    border-radius: var(--radius-lg);
    font-size: 1.1rem;
    font-weight: 800;
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
}

.primary-btn {
    background-color: var(--primary);
    color: white;
    box-shadow: var(--btn-shadow);
}

.primary-btn:active {
    transform: translateY(2px);
    box-shadow: 0 2px 8px 0 rgba(72, 187, 120, 0.39);
}

.secondary-btn {
    background-color: #FFF;
    color: var(--text-main);
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.03);
}

.secondary-btn:active {
    background-color: #F7FAFC;
}

/* WhatsApp FAB */
#whatsapp-fab-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    pointer-events: none;
}

@media (min-width: 480px) {
    #whatsapp-fab-container {
        right: calc(50% - 240px + 24px);
    }
}

.whatsapp-fab {
    background-color: #25D366;
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: 0 4px 12px rgba(37, 211, 102, 0.4);
    transition: transform 0.3s;
    animation: pulse 2s infinite;
    text-decoration: none;
    pointer-events: auto;
}

.whatsapp-fab:hover {
    transform: scale(1.1);
}

@keyframes pulse {
    0% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.7);
    }

    70% {
        box-shadow: 0 0 0 15px rgba(37, 211, 102, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(37, 211, 102, 0);
    }
}

.fab-ad-card {
    background: white;
    padding: 16px;
    border-radius: 16px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
    margin-bottom: 16px;
    width: 260px;
    position: relative;
    transform-origin: bottom right;
    animation: popIn 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275) forwards;
    animation-delay: 600s;
    opacity: 0;
    transform: scale(0.5) translateY(20px);
    border: 1px solid #E2E8F0;
    visibility: hidden;
}

.fab-ad-card::after {
    content: '';
    position: absolute;
    bottom: -8px;
    right: 22px;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid white;
}

@keyframes popIn {
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
        visibility: visible;
        pointer-events: auto;
    }
}

.fab-ad-close {
    position: absolute;
    top: 10px;
    right: 10px;
    background: #F7FAFC;
    border: none;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    color: #718096;
    cursor: pointer;
    transition: background 0.2s;
}

.fab-ad-close:hover {
    background: #E2E8F0;
}

.fab-ad-card strong {
    display: block;
    color: var(--text-main);
    margin-bottom: 6px;
    font-size: 1.05rem;
    font-weight: 800;
    padding-right: 20px;
}

.fab-ad-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    line-height: 1.4;
    margin: 0;
    font-weight: 600;
}

#ad-text-rotator {
    transition: opacity 0.3s ease;
}

@keyframes attentionPop {
    0% {
        transform: scale(1) translateY(0);
    }

    30% {
        transform: scale(1.06) translateY(-5px);
    }

    100% {
        transform: scale(1) translateY(0);
    }
}

.pop-attention {
    animation: attentionPop 0.4s ease !important;
}

.fade-in-delayed {
    opacity: 0;
    animation: simpleFadeIn 0.5s ease forwards;
    animation-delay: 2.5s;
}

@keyframes simpleFadeIn {
    to {
        opacity: 1;
    }
}

/* Class 1 Games CSS */
#class1-home-screen, 
#class1-games-screen, 
#game-coloring-screen, 
#game-find-screen, 
#game-connect-screen, 
#game-match-screen {
    font-family: 'Baloo Bhaijaan 2', cursive;
}
.class1-letter-btn {
    font-family: 'Baloo Bhaijaan 2', cursive;
    font-size: 5rem;
    font-weight: 800;
    border-radius: 36px;
    padding: 24px;
    width: calc(50% - 8px);
    box-sizing: border-box;
    color: white;
    text-shadow: 0 4px 6px rgba(0,0,0,0.3);
    border: 4px solid rgba(255,255,255,0.4);
    box-shadow: 0 8px 0 rgba(0,0,0,0.15), inset 0 6px 10px rgba(255,255,255,0.4), inset 0 -6px 10px rgba(0,0,0,0.15), 0 12px 20px rgba(0,0,0,0.2) !important;
    transition: transform 0.1s, box-shadow 0.1s;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1;
}

.class1-letter-btn:active {
    transform: translateY(6px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.15), inset 0 6px 10px rgba(255,255,255,0.4), inset 0 -6px 10px rgba(0,0,0,0.15), 0 6px 10px rgba(0,0,0,0.2) !important;
}

.game-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
    padding: 16px;
}

.game-card {
    background: #FFF;
    border-radius: 36px;
    padding: 30px 16px;
    text-align: center;
    cursor: pointer;
    transition: transform 0.1s, box-shadow 0.1s;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    border: 4px solid rgba(255,255,255,0.4);
    box-shadow: 0 8px 0 rgba(0,0,0,0.15), inset 0 6px 10px rgba(255,255,255,0.4), inset 0 -6px 10px rgba(0,0,0,0.15), 0 12px 20px rgba(0,0,0,0.2) !important;
}

.game-card:active {
    transform: translateY(6px);
    box-shadow: 0 2px 0 rgba(0,0,0,0.15), inset 0 6px 10px rgba(255,255,255,0.4), inset 0 -6px 10px rgba(0,0,0,0.15), 0 6px 10px rgba(0,0,0,0.2) !important;
}

#prominent-letter-display {
    border-radius: 36px !important;
    border: 4px solid rgba(255,255,255,0.4);
    box-shadow: 0 8px 0 rgba(0,0,0,0.15), inset 0 6px 10px rgba(255,255,255,0.4), inset 0 -6px 10px rgba(0,0,0,0.15), 0 12px 20px rgba(0,0,0,0.2) !important;
}

.game-icon {
    font-size: 3rem;
}

.game-title {
    font-size: 1.1rem;
    font-weight: 800;
    color: var(--text-main);
}

/* Find Letter Grid */
.find-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(6, minmax(0, 1fr));
    gap: 8px;
    padding: 10px;
    padding-bottom: 30px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.find-letter-cell {
    background: white;
    border-radius: var(--radius-md);
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: min(4rem, 8vh);
    font-weight: bold;
    color: var(--text-main);
    box-shadow: 0 4px 0 #E2E8F0, 0 5px 5px rgba(0, 0, 0, 0.1);
    border: 2px solid #E2E8F0;
    cursor: pointer;
    transition: all 0.1s;
    transform: translateY(0);
}

.find-letter-cell:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #E2E8F0, 0 1px 2px rgba(0, 0, 0, 0.1);
}

.find-letter-cell.found {
    background: #22C55E;
    color: white;
    border-color: #16A34A;
    box-shadow: 0 4px 0 #16A34A;
}

.find-letter-cell.wrong {
    background: #EF4444;
    color: white;
    border-color: #DC2626;
    box-shadow: 0 4px 0 #DC2626;
}

/* Match Game Grid */
.match-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: repeat(3, minmax(0, 1fr));
    gap: 10px;
    padding: 10px;
    padding-bottom: 30px;
    perspective: 1000px;
    flex: 1;
    min-height: 0;
    overflow: hidden;
}

.match-card {
    position: relative;
    cursor: pointer;
    transform-style: preserve-3d;
    transition: transform 0.5s;
    aspect-ratio: 1;
    margin: 0 auto;
    width: 100%;
    max-width: 100px;
}

.match-card.flipped {
    transform: rotateY(180deg);
}

.match-card.matched {
    visibility: hidden;
    transition: visibility 0s 0.5s;
}

.match-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: var(--radius-md);
    display: flex;
    justify-content: center;
    align-items: center;
    box-shadow: var(--card-shadow);
}

.match-front {
    background: linear-gradient(135deg, #FF9F43, #FECA57);
    font-size: 2.5rem;
}

.match-back {
    background: white;
    transform: rotateY(180deg);
    font-size: 3rem;
    font-weight: bold;
    color: var(--text-main);
}

/* Connect Game Canvas */
#connect-canvas-container {
    position: relative;
    width: 100%;
    flex: 1;
    background: transparent;
    margin: 16px 0;
    overflow: hidden;
    touch-action: none;
}

.connect-item {
    position: absolute;
    width: min(80px, 18vw);
    height: min(80px, 18vw);
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3.5rem;
    font-weight: 900;
    cursor: pointer;
    user-select: none;
    color: white;
    text-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
    transition: all 0.15s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 4px solid rgba(255, 255, 255, 0.6);
    z-index: 10;
}

.connect-item:active,
.connect-item.selected {
    transform: translateY(6px) scale(0.95);
    box-shadow: 0 2px 0 rgba(0, 0, 0, 0.1), 0 4px 8px rgba(0, 0, 0, 0.2), inset 0 2px 0 rgba(255, 255, 255, 0.3), inset 0 -1px 0 rgba(0, 0, 0, 0.1) !important;
}

/* Coloring Game Canvas */
#coloring-container {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    padding: 16px;
    touch-action: none;
}

.color-palette {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
    background: white;
    padding: 12px;
    border-radius: var(--radius-lg);
    box-shadow: var(--card-shadow);
}

.color-swatch {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    border: 3px solid transparent;
    transition: transform 0.2s;
}

.color-swatch.active {
    border-color: var(--text-main);
    transform: scale(1.1);
}

/* Result Modal */
#game-result-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    padding: 24px;
    backdrop-filter: blur(4px);
}

.golden-3d-text {
    font-size: 2.5rem;
    font-weight: 900;
    background: linear-gradient(to bottom, #FCEE21, #F39C12);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    text-shadow: 0px 4px 6px rgba(0, 0, 0, 0.3);
    margin: 10px 0;
    display: block;
}

.result-modal {
    background: white;
    border-radius: var(--radius-xl);
    padding: 32px 24px;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    width: 100%;
    max-width: 320px;
    animation: popIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes popIn {
    0% {
        transform: scale(0.8);
        opacity: 0;
    }

    100% {
        transform: scale(1);
        opacity: 1;
    }
}

.result-icon {
    font-size: 5rem;
    margin-bottom: 16px;
}

.result-title {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-main);
    margin-bottom: 8px;
}

.result-message {
    font-size: 1.1rem;
    color: #64748B;
    margin-bottom: 24px;
}

#student-info-overlay {
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(15, 23, 42, 0.7);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 10000;
    opacity: 1;
    transition: opacity 0.3s ease;
}
#student-info-overlay.hidden {
    opacity: 0;
    pointer-events: none;
}
.onboarding-card {
    background: #FFF;
    border-radius: 24px;
    padding: 32px 24px;
    width: 90%;
    max-width: 400px;
    box-shadow: 0 24px 48px rgba(0,0,0,0.2);
    text-align: center;
    transform: translateY(0) scale(1);
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid rgba(255,255,255,0.5);
}
#student-info-overlay.hidden .onboarding-card {
    transform: translateY(30px) scale(0.95);
}
.onboarding-icon {
    font-size: 3.5rem;
    margin-bottom: 16px;
    line-height: 1;
}
.onboarding-title {
    font-size: 1.6rem;
    font-weight: 800;
    color: #1E293B;
    margin-bottom: 8px;
}
.onboarding-subtitle {
    font-size: 0.95rem;
    color: #64748B;
    margin-bottom: 24px;
    line-height: 1.5;
}
.input-group {
    margin-bottom: 16px;
    text-align: left;
}
.input-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 700;
    color: #475569;
    margin-bottom: 8px;
}
.input-group input, .input-group select {
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    border: 2px solid #E2E8F0;
    font-size: 1rem;
    font-family: inherit;
    transition: all 0.2s ease;
    box-sizing: border-box;
    background: #F8FAFC;
    color: #1E293B;
}
.input-group input:focus, .input-group select:focus {
    outline: none;
    border-color: #3B82F6;
    background: #FFF;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}
.onboarding-btn {
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    color: white;
    border: none;
    border-radius: 12px;
    padding: 16px;
    width: 100%;
    font-size: 1.1rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 8px 16px rgba(37, 99, 235, 0.25);
    margin-top: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
}
.onboarding-btn:active {
    transform: scale(0.97);
}
.onboarding-btn:disabled {
    opacity: 0.7;
    cursor: not-allowed;
    transform: none;
}
