@import url('https://fonts.googleapis.com/css2?family=Baloo+2:wght@400;500;600;700;800&family=Inter:wght@400;600;700&family=Mukta:wght@400;600;700;800&family=Nunito:wght@400;700;800&display=swap');

:root {
    --primary: #4A90E2; /* Bright Blue */
    --primary-light: #e6f0fa;
    --primary-dark: #357ABD;
    --secondary: #FF9F43; /* Bright Orange */
    --secondary-light: #fff0e0;
    --secondary-dark: #e08020;
    --bg-color: #f4f9fd;
    --card-bg: #ffffff;
    --text-main: #1e293b;
    --text-muted: #475569;
    --success: #10AC84; /* Audio Active Color */
    --success-light: #e0f6ef;
    --radius-sm: 8px;
    --radius-md: 12px;
    --radius-lg: 20px;
    --shadow-sm: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-md: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
    --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --font-heading: 'Nunito', sans-serif;
    --font-body: 'Inter', sans-serif;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: var(--font-body);
    background-color: var(--bg-color);
    color: var(--text-main);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    overflow-x: hidden;
}

h1, h2, h3, h4 {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--text-main);
}

a {
    text-decoration: none;
    color: inherit;
}

button {
    cursor: pointer;
    font-family: var(--font-heading);
    border: none;
    background: none;
    outline: none;
}

/* ================= HEADER ================= */
.app-header {
    background-color: #ffffff;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.logo-icon {
    font-size: 2rem;
    background: var(--primary-light);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-md);
    color: var(--primary);
}

.logo-text h1 {
    font-size: 1.5rem;
    color: var(--primary-dark);
    line-height: 1.2;
    font-family: var(--font-heading);
}

.logo-text .tagline {
    display: none;
}

.mobile-menu-btn {
    display: none;
    color: var(--text-main);
    padding: 0.5rem;
}

.main-nav {
    display: flex;
    align-items: center;
    gap: 2rem;
}

.main-nav ul {
    list-style: none;
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.main-nav a {
    font-weight: 600;
    font-size: 1rem;
    color: var(--text-muted);
    transition: var(--transition);
    padding: 0.5rem 0;
    position: relative;
}

.main-nav a:hover, .main-nav a.active {
    color: var(--primary);
}

.main-nav a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background-color: var(--primary);
    border-radius: 3px;
}

/* Dropdowns */
.nav-dropdown {
    position: relative;
    display: inline-block;
}

.dropdown-content {
    display: none;
    position: absolute;
    background-color: #ffffff;
    min-width: 220px;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1);
    z-index: 200;
    border-radius: var(--radius-md);
    top: 100%;
    left: 0;
    padding: 0.5rem 0;
    border: 1px solid var(--primary-light);
}

.nav-dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    color: var(--text-main);
    padding: 0.75rem 1.25rem !important;
    text-decoration: none;
    display: block;
    font-size: 0.95rem;
    white-space: normal;
}

.dropdown-content a:hover {
    background-color: var(--primary-light);
    color: var(--primary) !important;
}
.dropdown-content a::after {
    display: none;
}

.header-actions {
    display: flex;
    align-items: center;
    gap: 1.5rem;
}

.lang-toggle {
    background: #fef0e6;
    color: var(--secondary-dark);
    padding: 0.5rem 1.25rem;
    border-radius: 30px;
    font-weight: 700;
    font-size: 0.9rem;
    display: flex;
    gap: 0.5rem;
    align-items: center;
    border: 1px solid rgba(224, 128, 32, 0.2);
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}

.lang-toggle:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.lang-toggle span {
    opacity: 0.5;
    transition: var(--transition);
}

.lang-toggle span.active {
    opacity: 1;
}

/* ================= SEARCH BAR ================= */
.search-compact {
    display: flex;
    align-items: center;
    position: relative;
}

.search-compact input {
    width: 0;
    padding: 0;
    border: none;
    background: transparent;
    transition: width 0.3s ease, padding 0.3s ease;
    outline: none;
    font-size: 0.95rem;
    color: var(--text-main);
}

.search-compact.expanded input {
    width: 200px;
    padding: 0.5rem 1rem;
    background: var(--bg-color);
    border-radius: 20px;
    margin-right: 0.5rem;
    border: 1px solid var(--secondary-light);
}

.search-compact.expanded input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px var(--primary-light);
}

.search-icon-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    transition: color 0.3s, transform 0.3s;
}

.search-icon-btn:hover {
    color: var(--primary);
    transform: scale(1.1);
}

/* ================= MAIN LAYOUT ================= */
#app-content {
    flex: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem 1rem;
    width: 100%;
}

.page-section {
    display: none;
    animation: fadeIn 0.4s ease-in-out;
}

.page-section.active {
    display: block;
}

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

/* ================= BUTTONS ================= */
.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 50px;
    font-weight: 700;
    font-size: 1.1rem;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    box-shadow: var(--shadow-sm);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.btn:active {
    transform: translateY(0);
}

@keyframes pulse {
    0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 159, 67, 0.7); }
    70% { transform: scale(1.05); box-shadow: 0 0 0 15px rgba(255, 159, 67, 0); }
    100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(255, 159, 67, 0); }
}

.pulse-animation {
    animation: pulse 2s infinite;
}

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

.btn-primary:hover {
    background-color: var(--primary-dark);
}

.btn-secondary {
    background-color: var(--secondary);
    color: white;
}

.btn-secondary:hover {
    background-color: var(--secondary-dark);
}

.btn-audio {
    background-color: var(--secondary-light);
    color: var(--secondary-dark);
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: var(--transition);
}

.btn-audio:hover {
    background-color: var(--secondary);
    color: white;
    transform: scale(1.1);
}

/* ================= CARDS ================= */
.card {
    background: var(--card-bg);
    border-radius: var(--radius-md);
    padding: 1.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    border: 2px solid transparent;
}

.card:hover {
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
    transform: translateY(-4px);
}

.interactive-card {
    position: relative;
    overflow: hidden;
    border: 2px solid transparent;
}
.interactive-card:hover {
    border-color: var(--visual-cue, var(--primary));
    box-shadow: 0 10px 20px rgba(0,0,0,0.1);
}
.card-badge {
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: var(--visual-cue, var(--primary));
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 700;
}

/* ================= HOME HERO ================= */
.welcome-banner {
    text-align: center;
    padding: 4rem 2rem;
    background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
    border-radius: var(--radius-lg);
    margin-bottom: 3rem;
    color: #ffffff;
    box-shadow: var(--shadow-lg);
    position: relative;
    overflow: hidden;
}

.welcome-banner::after {
    content: '';
    position: absolute;
    top: -50%;
    left: -50%;
    width: 200%;
    height: 200%;
    background: radial-gradient(circle, rgba(255,255,255,0.1) 0%, transparent 60%);
    pointer-events: none;
}

.welcome-banner-title {
    font-family: 'Baloo 2', 'Mukta', sans-serif;
    font-size: 4rem;
    font-weight: 800;
    color: #ffffff;
    margin-bottom: 0.5rem;
    line-height: 1.2;
    text-shadow: 2px 4px 10px rgba(0, 0, 0, 0.2);
}

.welcome-banner-subtitle {
    font-family: 'Baloo 2', var(--font-heading);
    font-size: 1.5rem;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.9);
    margin-bottom: 2rem;
    letter-spacing: 0.5px;
}

.welcome-banner-intro {
    font-family: 'Baloo 2', var(--font-body);
    font-size: 1.25rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.95);
    margin-bottom: 2.5rem;
    max-width: 800px;
    margin-inline: auto;
    line-height: 1.8;
}

.hero-buttons {
    display: flex;
    gap: 1.5rem;
    justify-content: center;
    flex-wrap: wrap;
    position: relative;
    z-index: 2;
}

/* Dashboard Split Screen Layout */
.split-screen {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    margin-bottom: 3rem;
}

@media (max-width: 768px) {
    .split-screen {
        grid-template-columns: 1fr;
    }
}

.devanagari-display {
    font-size: 4rem;
    color: var(--primary-dark);
    text-align: center;
    margin: 2rem 0;
    text-shadow: 2px 2px 0px var(--primary-light);
}

/* Comic Grid */
.comic-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
    background: white;
    padding: 1rem;
    border-radius: var(--radius-md);
    border: 4px solid var(--text-main);
    box-shadow: 8px 8px 0px var(--secondary-light);
}

.comic-panel {
    border: 2px solid var(--text-main);
    border-radius: 4px;
    overflow: hidden;
    aspect-ratio: 1;
    position: relative;
}

.comic-panel img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* ================= SECTIONS GRID ================= */
.section-title {
    text-align: center;
    margin-bottom: 2rem;
    font-size: 2rem;
    color: var(--primary-dark);
}

.grid-2 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

/* ================= DAILY MINI ================= */
.daily-card {
    background: var(--card-bg);
    border-left: 6px solid var(--primary);
}

.daily-title {
    color: var(--text-muted);
    font-size: 0.9rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 700;
    margin-bottom: 0.5rem;
}

.daily-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
}

.sanskrit-text {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary-dark);
    font-family: var(--font-heading);
}

.translation-text {
    font-size: 1.1rem;
    color: var(--text-main);
}

/* ================= LESSON CARDS ================= */
.lesson-level {
    margin-bottom: 3rem;
}

.lesson-level h3 {
    font-size: 1.5rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 2px dashed var(--primary-light);
    color: var(--secondary-dark);
}

.lesson-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem;
    background: var(--card-bg);
    border-radius: var(--radius-sm);
    margin-bottom: 0.5rem;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
}
.lesson-item:hover {
    background: var(--secondary-light);
}

.lesson-content {
    display: flex;
    flex-direction: column;
}

/* ================= CONVERSATIONS ================= */
.conversation-bubble {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.bubble-icon {
    font-size: 2rem;
    background: var(--primary-light);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.bubble-text {
    background: var(--card-bg);
    padding: 1rem 1.5rem;
    border-radius: 20px;
    border-top-left-radius: 4px;
    box-shadow: var(--shadow-sm);
    position: relative;
    flex: 1;
}

.conversation-bubble.child .bubble-icon {
    background: var(--secondary-light);
}

.conversation-bubble.child .bubble-text {
    background: var(--secondary-light);
}

/* ================= PRACTICE ================= */
.quiz-card {
    max-width: 600px;
    margin: 0 auto;
    text-align: center;
}

.quiz-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    margin-top: 1.5rem;
}

.quiz-option {
    padding: 1rem;
    border: 2px solid var(--secondary-light);
    border-radius: var(--radius-md);
    background: white;
    font-size: 1.1rem;
    font-weight: 600;
    transition: var(--transition);
}

.quiz-option:hover {
    background: var(--secondary-light);
    border-color: var(--secondary);
}

.quiz-option.correct {
    background: var(--success-light);
    border-color: var(--success);
    color: var(--success);
}

.quiz-option.wrong {
    background: #fee2e2;
    border-color: #ef4444;
    color: #ef4444;
}

.feedback-msg {
    margin-top: 1rem;
    font-weight: 700;
    font-size: 1.2rem;
    min-height: 1.8rem;
}

/* ================= FOOTER ================= */
.app-footer {
    background: var(--card-bg);
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    border-top: 1px solid var(--secondary-light);
    margin-top: auto;
}

/* ================= ACCORDION (FOLDERS) ================= */
.accordion-item {
    margin-bottom: 1rem;
    background: var(--card-bg);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    overflow: hidden;
    transition: var(--transition);
}

.accordion-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem;
    cursor: pointer;
    background: var(--card-bg);
    user-select: none;
    transition: var(--transition);
}

.accordion-header:hover {
    background: var(--secondary-light);
}

.accordion-title {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary-dark);
    font-family: var(--font-heading);
}

.accordion-icon {
    font-size: 1.5rem;
    transition: transform 0.3s ease;
    color: var(--primary);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease-out, padding 0.4s ease-out;
    background: var(--bg-color);
}

.accordion-item.active .accordion-content {
    max-height: 50000px; /* extremely large to fit massive word lists */
    padding: 1.5rem;
    transition: max-height 0.5s ease-in, padding 0.3s ease-in;
}

.accordion-item.active .accordion-icon {
    transform: rotate(180deg);
}

.lessons-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 1.5rem;
}

.lesson-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card-bg);
    padding: 1.25rem;
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--secondary-light);
    transition: var(--transition);
}

.lesson-item:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary-light);
}

.lesson-content {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.lesson-card-image {
    background: #ffecb3;
    border: 3px solid #2e7d32;
    border-radius: 12px;
    padding: 1rem;
    text-align: center;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    transition: transform 0.2s;
    display: flex;
    flex-direction: column;
    align-items: center;
    position: relative;
    cursor: pointer;
}

.lesson-card-image:hover {
    transform: translateY(-4px);
    box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

.lesson-card-image img {
    max-width: 100%;
    height: 120px;
    object-fit: contain;
    margin-bottom: 0.5rem;
}

.lesson-card-image .sanskrit-text {
    color: #2e7d32;
    font-size: 1.8rem;
    font-weight: 800;
    margin-bottom: 0.1rem;
}

.lesson-card-image .pronunciation-text {
    color: #2e7d32;
    font-size: 1rem;
    font-weight: 500;
    border-bottom: 2px solid #2e7d32;
    padding-bottom: 0.4rem;
    margin-bottom: 0.5rem;
    width: 80%;
}

.lesson-card-image .translation-text {
    color: #555;
    font-weight: 600;
    font-size: 0.9rem;
}


/* ================= RESPONSIVE ================= */
@media (max-width: 768px) {
    .header-container {
        flex-wrap: wrap;
    }
    
    .mobile-menu-btn {
        display: block;
    }

    .main-nav {
        width: 100%;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 1rem;
        padding-top: 1rem;
        border-top: 1px solid var(--secondary-light);
        margin-top: 1rem;
    }

    .main-nav.show {
        display: flex;
    }

    .main-nav ul {
        flex-direction: column;
        gap: 0.5rem;
    }

    .main-nav a {
        display: block;
        padding: 0.75rem;
        background: var(--bg-color);
        border-radius: var(--radius-sm);
    }
    
    .welcome-banner-title {
        font-size: 2.2rem;
    }
    .welcome-banner-subtitle {
        font-size: 1.2rem;
    }
    .welcome-banner-intro {
        font-size: 1.1rem;
    }
    
    .conversation-bubble {
        flex-direction: column;
    }
    .conversation-bubble.child {
        align-items: flex-start;
    }
    .conversation-bubble .bubble-icon {
        width: 40px;
        height: 40px;
        font-size: 1.5rem;
    }
}

/* ================= NEW GAME STYLES ================= */
.game-selection-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin-bottom: 2rem;
}

.game-type-card {
    background: var(--card-bg);
    border: 2px solid var(--secondary-light);
    border-radius: var(--radius-md);
    padding: 2rem 1rem;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
}

.game-type-card:hover, .game-type-card.selected {
    border-color: var(--primary);
    background: var(--primary-light);
    transform: translateY(-4px);
}

.game-type-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
}

.level-selector {
    margin-bottom: 2rem;
    text-align: center;
}

.level-select-dropdown {
    padding: 0.75rem 1rem;
    font-size: 1.1rem;
    border-radius: var(--radius-md);
    border: 2px solid var(--primary-light);
    background: white;
    font-family: var(--font-body);
    color: var(--text-main);
    outline: none;
    min-width: 250px;
}

/* Matching Game */
.matching-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2rem;
    max-width: 800px;
    margin: 0 auto;
}

.matching-column {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.match-item {
    padding: 1rem;
    border: 2px solid var(--secondary-light);
    border-radius: var(--radius-md);
    background: white;
    cursor: pointer;
    text-align: center;
    font-size: 1.1rem;
    font-weight: 600;
    transition: var(--transition);
    user-select: none;
}

.match-item:hover {
    background: var(--secondary-light);
}

.match-item.selected {
    background: var(--primary-light);
    border-color: var(--primary);
    transform: scale(1.02);
}

.match-item.matched {
    background: var(--success-light);
    border-color: var(--success);
    color: var(--success);
    pointer-events: none;
    opacity: 0.7;
}

/* Sentence Game */
.sentence-container {
    max-width: 800px;
    margin: 0 auto;
    text-align: center;
}

.sentence-target {
    min-height: 80px;
    border: 2px dashed var(--secondary);
    border-radius: var(--radius-md);
    padding: 1rem;
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    justify-content: center;
    align-items: center;
    background: var(--card-bg);
}

.word-bank {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    justify-content: center;
    margin-bottom: 2rem;
}

.sentence-word {
    padding: 0.75rem 1.5rem;
    background: white;
    border: 2px solid var(--primary-light);
    border-radius: 30px;
    font-size: 1.2rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    color: var(--primary-dark);
}

.sentence-word:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
    border-color: var(--primary);
}

.sentence-word.used {
    opacity: 0.3;
    pointer-events: none;
    transform: none;
    box-shadow: none;
}

.sentence-meaning {
    font-size: 1.2rem;
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-style: italic;
}

/* Memory Game */
.memory-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 1rem;
    max-width: 800px;
    margin: 0 auto 2rem auto;
    perspective: 1000px;
}

.memory-card {
    background-color: transparent;
    width: 100%;
    aspect-ratio: 1;
    perspective: 1000px;
    cursor: pointer;
}

.memory-card-inner {
    position: relative;
    width: 100%;
    height: 100%;
    text-align: center;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-style: preserve-3d;
    box-shadow: var(--shadow-sm);
    border-radius: var(--radius-md);
}

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

.memory-card.matched .memory-card-inner {
    transform: rotateY(180deg);
}

.memory-card-front, .memory-card-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.5rem;
    border-radius: var(--radius-md);
    font-size: 1.2rem;
    font-weight: 700;
}

.memory-card-front {
    background-color: var(--primary);
    color: white;
    font-size: 2rem;
}

.memory-card-front::after {
    content: '?';
}

.memory-card-back {
    background-color: white;
    color: var(--text-main);
    transform: rotateY(180deg);
    border: 2px solid var(--primary-light);
}

.memory-card.matched .memory-card-back {
    background-color: var(--success-light);
    border-color: var(--success);
    color: var(--success);
}

/* Shabda Tables */
.table-responsive {
    overflow-x: auto;
    border-radius: var(--radius-md);
    border: 1px solid var(--secondary-light);
}

.shabda-table {
    width: 100%;
    border-collapse: collapse;
    background: white;
    text-align: center;
}

.shabda-table th {
    background: var(--primary-light);
    color: var(--primary-dark);
    padding: 1rem;
    font-family: var(--font-heading);
    font-size: 1.1rem;
    border-bottom: 2px solid var(--primary);
}

.shabda-table td {
    padding: 1rem;
    border-bottom: 1px solid var(--secondary-light);
    font-size: 1.2rem;
    font-weight: 600;
}

.shabda-table tbody tr:hover {
    background: var(--secondary-light);
}

.vibhakti-col {
    background: var(--bg-color);
    font-weight: 700 !important;
    color: var(--secondary-dark);
    border-right: 2px solid var(--secondary-light);
}

/* ================= GAME ZONE STYLES ================= */
.devanagari-text {
    font-family: 'Mukta', sans-serif;
}

/* Dashboard */
.gz-dashboard {
    text-align: center;
    margin-bottom: 2rem;
}
.gz-card {
    background: #fff;
    border: 3px solid var(--primary-light);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    transition: transform 0.2s, box-shadow 0.2s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}
.gz-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 12px 24px rgba(0,0,0,0.15);
    border-color: var(--primary);
}
.gz-card-title {
    font-size: 1.5rem;
    font-weight: 800;
    margin-top: 1rem;
    color: var(--primary-dark);
}
.gz-icon {
    font-size: 4rem;
}
.gz-badge {
    background: #FF6B6B;
    color: white;
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    position: absolute;
    top: 1rem;
    right: 1rem;
}


/* Pronoun Puzzle */
.pp-split {
    display: flex;
    gap: 2rem;
    margin-bottom: 2rem;
}
@media (max-width: 768px) {
    .pp-split { flex-direction: column; }
}
.pp-zone {
    flex: 1;
    border: 4px dashed;
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    min-height: 200px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
.pp-zone-esha { border-color: #FF9F43; background: #fff3e0; }
.pp-zone-eshah { border-color: #4A90E2; background: #e3f2fd; }
.pp-title {
    font-size: 3rem;
    font-weight: 800;
}
.pp-zone-esha .pp-title { color: #e65100; }
.pp-zone-eshah .pp-title { color: #0d47a1; }
.pp-card {
    background: white;
    padding: 1rem 2rem;
    border-radius: 12px;
    font-size: 1.5rem;
    font-weight: bold;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    cursor: pointer;
    border: 2px solid transparent;
    transition: 0.2s;
}
.pp-card.selected {
    transform: scale(1.1);
    border-color: var(--primary);
    box-shadow: 0 0 0 4px var(--primary-light);
}
.pp-flash-error {
    animation: flashError 0.5s ease;
}
@keyframes flashError {
    0%, 100% { border-color: #ef4444; background: #fee2e2; }
    50% { border-color: #dc2626; background: #fca5a5; }
}
.pp-flash-correct {
    animation: flashCorrect 0.5s ease;
}
@keyframes flashCorrect {
    0%, 100% { border-color: #10AC84; background: #e0f6ef; }
    50% { border-color: #059669; background: #d1fae5; }
}
.pp-card-deck {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    min-height: 80px;
}

/* Vibhakti Train */
.vt-train-track {
    width: 100%;
    overflow: hidden; /* For the departing animation */
    background: #e3f2fd;
    border-bottom: 8px solid #90caf9;
    padding: 2rem 0 1rem 0;
    margin-bottom: 2rem;
    position: relative;
    border-radius: 8px;
}
.vt-train-wrapper {
    display: flex;
    gap: 1rem;
    align-items: center;
    padding: 0 2rem;
    width: max-content;
    transition: transform 2.5s ease-in;
}
.vt-train-wrapper.departing {
    transform: translateX(-100vw) !important;
}
.vt-engine {
    font-size: 4.5rem;
    margin-right: 1rem;
    filter: drop-shadow(4px 4px 0px rgba(0,0,0,0.2));
}
.vt-car {
    min-width: 130px;
    height: 100px;
    border: 4px dashed #607d8b;
    border-radius: 8px;
    background: #eceff1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: relative;
    box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    transition: 0.2s;
}
.vt-car.filled {
    border-style: solid;
    border-color: #10ac84;
    background: #e0f6ef;
}
.vt-car.error {
    border-color: #ef4444 !important;
    background: #fee2e2 !important;
}
.vt-block {
    background: #ffb74d;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    font-weight: bold;
    font-size: 1.4rem;
    color: #e65100;
    box-shadow: 0 4px 0 #f57c00;
}
.vt-word-bank {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
    margin-bottom: 2rem;
    padding: 1.5rem;
    background: #fff3e0;
    border-radius: 12px;
    min-height: 100px;
}
.vt-word {
    background: white;
    border: 3px solid #ffcc80;
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    font-size: 1.3rem;
    cursor: pointer;
    font-weight: bold;
    color: #ef6c00;
    box-shadow: 0 4px 0 #ffe0b2;
    transition: transform 0.1s, border-color 0.2s;
}
.vt-word:active {
    transform: translateY(4px);
    box-shadow: 0 0 0 #ffe0b2;
}
.vt-word.selected {
    border-color: #f57c00;
    background: #ffe0b2;
    transform: scale(1.1) translateY(-4px);
}

/* Shloka Antakshari */
.sa-card {
    background: #f3e5f5;
    border: 3px solid #ce93d8;
    border-radius: 16px;
    padding: 2rem;
    text-align: center;
    max-width: 600px;
    margin: 0 auto 2rem;
}
.sa-verse {
    font-size: 1.8rem;
    color: #4a148c;
    margin-bottom: 2rem;
    line-height: 1.5;
}
.sa-options {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.sa-option {
    background: white;
    padding: 1rem;
    border-radius: 8px;
    border: 2px solid #ba68c8;
    font-size: 1.2rem;
    cursor: pointer;
    transition: 0.2s;
}
.sa-option:hover { background: #f3e5f5; }
.sa-translation {
    margin-top: 2rem;
    padding: 1rem;
    background: white;
    border-radius: 8px;
    border-left: 4px solid #8e24aa;
    font-size: 1.1rem;
    color: #4a148c;
    display: none;
}

/* Action Charades */
.ac-arena {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
}
.ac-flashcard {
    background: #fff8e1;
    border: 4px solid #ffca28;
    border-radius: 24px;
    padding: 4rem 2rem;
    margin-bottom: 2rem;
    position: relative;
}
.ac-verb {
    font-size: 4rem;
    color: #ff8f00;
    font-weight: 800;
}
.ac-timer {
    font-size: 2rem;
    font-weight: bold;
    color: #d32f2f;
    margin-top: 1rem;
}
.ac-translation {
    font-size: 1.5rem;
    color: #5d4037;
    margin-top: 1rem;
    opacity: 0;
    transition: opacity 0.3s;
}
.ac-translation.visible { opacity: 1; }
.ac-score {
    font-size: 1.5rem;
    font-weight: bold;
    color: #1565c0;
    margin-bottom: 1rem;
}

/* ================= LUDO GAME ================= */
.ludo-container {
    display: flex;
    flex-direction: row;
    gap: 2rem;
    background: var(--bg-color);
    border-radius: var(--radius-lg);
    padding: 2rem;
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.05);
}

@media (max-width: 900px) {
    .ludo-container {
        flex-direction: column;
    }
}

.ludo-left {
    flex: 6;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ludo-right {
    flex: 4;
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Authentic Ludo Board CSS */
.ludo-board-wrapper {
    width: 100%;
    max-width: 500px;
    aspect-ratio: 1;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    padding: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

.ludo-board {
    width: 100%;
    height: 100%;
    display: grid;
    grid-template-columns: repeat(15, 1fr);
    grid-template-rows: repeat(15, 1fr);
    gap: 1px;
    background: #ccc; /* Grid lines */
    border: 2px solid #333;
}

.ludo-cell {
    background: white;
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* The 4 Bases */
.ludo-base {
    grid-column: span 6;
    grid-row: span 6;
    padding: 10%;
}
.ludo-base-inner {
    width: 100%;
    height: 100%;
    background: white;
    border-radius: 10px;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 10%;
    padding: 10%;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}
.ludo-base-red { background: #ef4444; grid-column: 1 / 7; grid-row: 1 / 7; }
.ludo-base-red .ludo-base-inner { border: 4px solid #ef4444; }
.ludo-base-green { background: #10ac84; grid-column: 10 / 16; grid-row: 1 / 7; }
.ludo-base-green .ludo-base-inner { border: 4px solid #10ac84; }
.ludo-base-blue { background: #3b82f6; grid-column: 1 / 7; grid-row: 10 / 16; }
.ludo-base-blue .ludo-base-inner { border: 4px solid #3b82f6; }
.ludo-base-yellow { background: #f59e0b; grid-column: 10 / 16; grid-row: 10 / 16; }
.ludo-base-yellow .ludo-base-inner { border: 4px solid #f59e0b; }

/* The Center Home */
.ludo-center {
    grid-column: 7 / 10;
    grid-row: 7 / 10;
    background: conic-gradient(#10ac84 0deg 90deg, #f59e0b 90deg 180deg, #3b82f6 180deg 270deg, #ef4444 270deg 360deg);
}

/* Base starting token slots */
.ludo-token-slot {
    width: 35%;
    height: 35%;
    border-radius: 50%;
    background: rgba(0,0,0,0.1);
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Authentic paths colors */
/* We will apply colors via JS dynamically based on coordinates for simplicity, but here are some helpers */
.ludo-safe-star::after {
    content: "★";
    color: rgba(0,0,0,0.3);
    font-size: 1rem;
}
.ludo-path-red { background: #fca5a5; }
.ludo-path-green { background: #6ee7b7; }
.ludo-path-blue { background: #93c5fd; }
.ludo-path-yellow { background: #fcd34d; }
.ludo-path-start-red { background: #ef4444; }
.ludo-path-start-green { background: #10ac84; }
.ludo-path-start-blue { background: #3b82f6; }
.ludo-path-start-yellow { background: #f59e0b; }


/* Tokens */
.ludo-token {
    width: 80%;
    height: 80%;
    border-radius: 50%;
    box-shadow: 0 4px 6px rgba(0,0,0,0.3), inset 0 2px 4px rgba(255,255,255,0.5);
    border: 2px solid white;
    z-index: 10;
    transition: all 0.4s ease;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 0.6rem;
    font-weight: bold;
    color: white;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.5);
}
.token-red { background: radial-gradient(circle at 30% 30%, #ef4444, #991b1b); }
.token-green { background: radial-gradient(circle at 30% 30%, #10ac84, #065f46); }
.token-blue { background: radial-gradient(circle at 30% 30%, #3b82f6, #1e3a8a); }
.token-yellow { background: radial-gradient(circle at 30% 30%, #f59e0b, #92400e); }
.token-active {
    animation: bounce-token 1s infinite alternate;
    box-shadow: 0 0 15px rgba(255, 255, 255, 0.8), 0 4px 6px rgba(0,0,0,0.3);
}

@keyframes bounce-token {
    0% { transform: translateY(0) scale(1); }
    100% { transform: translateY(-3px) scale(1.1); }
}

/* Neumorphic Dice */
.ludo-dice-container {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
}
.ludo-dice-btn {
    width: 80px;
    height: 80px;
    border-radius: 16px;
    background: linear-gradient(145deg, #ffffff, #e6e6e6);
    box-shadow: 8px 8px 16px #d1d1d1, -8px -8px 16px #ffffff;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--primary-dark);
    cursor: pointer;
    transition: transform 0.1s;
}
.ludo-dice-btn:active {
    box-shadow: inset 8px 8px 16px #d1d1d1, inset -8px -8px 16px #ffffff;
}
.ludo-dice-btn.rolling {
    animation: spin-dice 0.6s linear infinite;
    pointer-events: none;
}
@keyframes spin-dice {
    0% { transform: rotate(0deg) scale(1); }
    50% { transform: rotate(180deg) scale(1.2); }
    100% { transform: rotate(360deg) scale(1); }
}

/* Ludo Question Panel */
.ludo-q-panel {
    background: var(--card-bg);
    padding: 1.5rem;
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.ludo-q-box {
    background: var(--primary-light);
    border: 2px dashed var(--primary);
    padding: 1.5rem;
    border-radius: var(--radius-md);
    text-align: center;
    margin-bottom: 1.5rem;
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-dark);
}

.ludo-options {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    flex-grow: 1;
}

.ludo-option-btn {
    background: #ffffff;
    border: 2px solid var(--secondary-light);
    border-radius: var(--radius-sm);
    padding: 1rem;
    font-size: 1.2rem;
    font-weight: 600;
    color: var(--text-main);
    box-shadow: var(--shadow-sm);
    transition: all 0.2s;
}

.ludo-option-btn:hover {
    border-color: var(--secondary);
    background: var(--secondary-light);
    transform: translateY(-2px);
}

.ludo-option-btn.correct {
    background: var(--success-light);
    border-color: var(--success);
    color: var(--success);
}

.ludo-option-btn.wrong {
    background: #fee2e2;
    border-color: #ef4444;
    color: #ef4444;
    animation: shake 0.4s;
}

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

.ludo-status {
    text-align: center;
    font-size: 1.2rem;
    font-weight: bold;
    margin-bottom: 1rem;
    min-height: 2rem;
}

/* --- Ludo Setup Screen Neumorphic Styles --- */
.ludo-setup-container {
    max-width: 500px;
    margin: 30px auto;
    padding: 30px;
    background: #e0e5ec;
    border-radius: 20px;
    box-shadow: 9px 9px 16px rgb(163,177,198,0.6), -9px -9px 16px rgba(255,255,255, 0.5);
    text-align: center;
    font-family: var(--font-body);
}

.ludo-setup-container h3 {
    margin-bottom: 25px;
    color: var(--primary-dark);
    font-size: 24px;
}

.setup-group {
    margin-bottom: 20px;
    text-align: left;
}

.setup-group label {
    display: block;
    margin-bottom: 10px;
    font-weight: 600;
    color: var(--text-muted);
}

.player-select {
    display: flex;
    justify-content: space-between;
    gap: 10px;
}

.player-btn {
    flex: 1;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: #e0e5ec;
    color: var(--text-main);
    font-weight: 600;
    cursor: pointer;
    box-shadow: 5px 5px 10px #b8bcc2, -5px -5px 10px #ffffff;
    transition: all 0.2s ease;
}

.player-btn:active {
    box-shadow: inset 5px 5px 10px #b8bcc2, inset -5px -5px 10px #ffffff;
}

.player-btn.active {
    box-shadow: inset 5px 5px 10px #b8bcc2, inset -5px -5px 10px #ffffff;
    color: var(--primary);
}

.neumorphic-select {
    width: 100%;
    padding: 12px;
    border: none;
    border-radius: 12px;
    background: #e0e5ec;
    color: var(--text-main);
    font-size: 16px;
    outline: none;
    box-shadow: inset 5px 5px 10px #b8bcc2, inset -5px -5px 10px #ffffff;
    appearance: none;
    cursor: pointer;
}

.start-game-btn {
    width: 100%;
    margin-top: 20px;
    padding: 15px;
    border: none;
    border-radius: 15px;
    background: var(--primary);
    color: white;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    box-shadow: 5px 5px 15px rgba(74, 144, 226, 0.4), -5px -5px 15px rgba(255, 255, 255, 0.8);
    transition: all 0.2s ease;
}

.start-game-btn:active {
    transform: scale(0.98);
    box-shadow: 2px 2px 10px rgba(74, 144, 226, 0.4), -2px -2px 10px rgba(255, 255, 255, 0.8);
}
