/* Mobile and Sidebar Optimizations */
:root {
    --bg-dark: #070d1e;
    --bg-darker: #040814;
    --primary: #0ea5e9;
    --primary-glow: #38bdf8;
    --secondary: #0284c7;
    --accent: #f59e0b;
    --text-main: #f8fafc;
    --text-muted: #94a3b8;
    --glass-bg: rgba(30, 41, 59, 0.7);
    --glass-border: rgba(255, 255, 255, 0.1);
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--bg-dark);
    color: var(--text-main);
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
    padding-bottom: env(safe-area-inset-bottom);
}

/* Dynamic Backgrounds */
.background-glob,
.background-glob-2 {
    position: fixed;
    border-radius: 50%;
    filter: blur(100px);
    z-index: -1;
    opacity: 0.4;
    animation: floating 20s infinite ease-in-out;
}

.background-glob {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--primary), transparent);
    top: -100px;
    left: -100px;
}

.background-glob-2 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--secondary), transparent);
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

@keyframes floating {

    0%,
    100% {
        transform: translate(0, 0);
    }

    50% {
        transform: translate(30px, 50px);
    }
}

/* Glassmorphism Utilities */
.glass {
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    box-shadow: var(--card-shadow);
}

/* Typography */
h1 {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 4.5rem;
    line-height: 1.1;
    margin-bottom: 1.5rem;
    letter-spacing: -2px;
}

.animate-text-gradient {
    background: linear-gradient(to right, #818cf8, #c084fc, #f472b6);
    -webkit-background-clip: text;
    background-clip: text;
    color: transparent;
    background-size: 200% auto;
    animation: gradientText 5s linear infinite;
}

@keyframes gradientText {
    to {
        background-position: 200% center;
    }
}

.hero-subtitle {
    font-size: 1.25rem;
    color: var(--text-muted);
    max-width: 600px;
    line-height: 1.6;
    margin-bottom: 2.5rem;
}

/* Navigation */
.navbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.5rem 5%;
    position: sticky;
    top: 0;
    z-index: 1000;
}

.logo {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -1px;
}

.logo span {
    color: var(--primary-glow);
}

.nav-links {
    display: flex;
    gap: 3rem;
    list-style: none;
}

.nav-links a {
    color: var(--text-main);
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
}

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

/* Buttons */
.btn-primary,
.btn-secondary,
.btn-large {
    text-decoration: none;
    padding: 0.8rem 1.8rem;
    border-radius: 50px;
    font-weight: 600;
    transition: all 0.3s;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
}

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

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

.btn-large {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    padding: 1rem 2.5rem;
    font-size: 1.1rem;
    color: white;
}

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

.btn-secondary {
    background: transparent;
    border: 1px solid var(--glass-border);
    color: var(--text-main);
}

.btn-secondary:active {
    background: rgba(255, 255, 255, 0.1);
}

/* Hero Section */
.hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4rem 5% 8rem 5%;
    gap: 2rem;
}

.hero-content {
    flex: 1;
}

.hero-actions {
    display: flex;
    gap: 1rem;
    margin-bottom: 3rem;
}

.stats-container {
    display: inline-flex;
    gap: 3rem;
    padding: 1.5rem 3rem;
    border-radius: 20px;
}

.stat-item {
    text-align: center;
}

.stat-item .count {
    display: block;
    font-size: 1.8rem;
    font-weight: 800;
}

.stat-item .label {
    font-size: 0.9rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* Hero Visual & Cards */
.hero-visual {
    flex: 1;
    position: relative;
    height: 500px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-stack {
    position: relative;
    width: 320px;
    height: 400px;
}

.mock-card {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 24px;
    padding: 2rem;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    transition: all 0.5s ease;
}

.card-1 {
    transform: rotate(-5deg) translate(-20px, -10px);
    z-index: 3;
    background: linear-gradient(145deg, rgba(30, 41, 59, 0.9), rgba(15, 23, 42, 0.9));
}

.card-2 {
    transform: rotate(5deg) translate(20px, -10px);
    z-index: 2;
    opacity: 0.8;
}

.card-3 {
    transform: rotate(15deg) translate(40px, -20px);
    z-index: 1;
    opacity: 0.6;
}

.card-1:hover {
    transform: rotate(0) scale(1.05);
    z-index: 10;
}

.card-icon {
    font-size: 3rem;
    margin-bottom: auto;
    background: rgba(255, 255, 255, 0.1);
    width: 80px;
    height: 80px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 20px;
    color: var(--accent);
}

.progress-bar {
    height: 6px;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 10px;
    margin-top: 1rem;
    overflow: hidden;
}

.fill {
    height: 100%;
    background: var(--accent);
}

/* Topics Grid */
.topics-section {
    padding: 4rem 5%;
}

.section-header {
    text-align: center;
    margin-bottom: 4rem;
}

.section-header h2 {
    font-size: 2.5rem;
    margin-bottom: 1rem;
}

.section-header p {
    color: var(--text-muted);
}

.topic-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
}

.topic-card {
    border-radius: 20px;
    padding: 2rem;
    transition: transform 0.3s;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.topic-card:active {
    transform: scale(0.98);
}

.topic-card i {
    font-size: 2.5rem;
    color: var(--primary);
    margin-bottom: 1.5rem;
    display: block;
}

.topic-card h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.topic-card p {
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-bottom: 1.5rem;
}

.topic-card .card-meta {
    display: flex;
    justify-content: space-between;
    font-size: 0.85rem;
    color: var(--text-muted);
    border-top: 1px solid var(--glass-border);
    padding-top: 1rem;
}

/* Flashcard App Interface - Fullscreen Stage & Drawer */
.app-layout {
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: calc(100vh - 80px);
    padding: 1rem 2rem 2.5rem 2rem;
    width: 100%;
}

.sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 340px;
    height: 100vh;
    background: rgba(15, 23, 42, 0.96);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border-right: 1px solid var(--glass-border);
    box-shadow: 15px 0 50px rgba(0, 0, 0, 0.7);
    z-index: 3500;
    padding: 1.5rem;
    overflow-y: auto;
    transform: translateX(-100%);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.sidebar.open {
    transform: translateX(0);
}

.sidebar-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(2, 6, 23, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    z-index: 3400;
}

.sidebar-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.6rem;
    cursor: pointer;
    line-height: 1;
    padding: 2px 6px;
    border-radius: 6px;
    transition: all 0.2s;
}

.sidebar-close-btn:hover {
    color: white;
    background: rgba(255, 255, 255, 0.1);
}

.topic-group-title {
    font-size: 0.85rem;
    color: var(--primary-glow);
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 1.5rem 0 0.5rem 0;
    font-weight: 700;
}

.subtopic-item {
    padding: 0.8rem 1rem;
    margin-bottom: 0.2rem;
    border-radius: 8px;
    cursor: pointer;
    font-size: 0.95rem;
    color: var(--text-muted);
    transition: all 0.2s;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.subtopic-item:hover {
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-main);
    padding-left: 1.2rem;
}

.subtopic-item.active {
    background: rgba(99, 102, 241, 0.1);
    color: var(--primary-glow);
    border-left: 2px solid var(--primary);
}

.subtopic-badge {
    background: rgba(255, 255, 255, 0.1);
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
}

/* Mobile Toggle Button (Sidebar) */
.mobile-sidebar-toggle {
    display: none;
}

.main-stage {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    max-width: 1000px;
    margin: 0 auto;
}

.scene {
    width: 100%;
    max-width: 950px;
    height: 480px;
    perspective: 1000px;
}

.card {
    width: 100%;
    height: 100%;
    position: relative;
    transition: transform 0.6s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    transform-style: preserve-3d;
    cursor: pointer;
}

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

.card-face {
    position: absolute;
    width: 100%;
    height: 100%;
    backface-visibility: hidden;
    border-radius: 30px;
    padding: 3rem;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    background: rgba(30, 41, 59, 0.9);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
}

.card-face-back {
    transform: rotateY(180deg);
    background: linear-gradient(135deg, #1e1b4b, #312e81);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: center;
    padding: 3rem 2.5rem 2rem 2.5rem;
}

.card-face-back .card-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    margin: 1.2rem 0;
}

.card-content h2 {
    font-size: 2.2rem;
    margin-bottom: 1rem;
    color: var(--text-main);
}

.card-content p {
    font-size: 1.2rem;
    line-height: 1.6;
    color: #cbd5e1;
}

.card-label {
    position: absolute;
    top: 1.5rem;
    left: 1.5rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.75rem;
    color: var(--text-muted);
    opacity: 0.7;
}

.card-hint {
    position: absolute;
    bottom: 1.5rem;
    font-size: 0.85rem;
    color: var(--text-muted);
    opacity: 0.6;
}

.controls {
    margin-top: 2rem;
    display: flex;
    gap: 1.5rem;
    align-items: center;
}

.control-btn {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, 0.05);
    color: white;
    font-size: 1.5rem;
    cursor: pointer;
    transition: all 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
    -webkit-tap-highlight-color: transparent;
}

.control-btn:active {
    transform: scale(0.9);
    background: var(--primary);
}

.progress-indicator {
    position: static;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-muted);
    white-space: nowrap;
}

/* Footer */
.glass-footer {
    padding: 2rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.9rem;
    margin-top: auto;
}

@media (max-width: 768px) {
    h1 {
        font-size: 2.8rem;
    }

    .navbar {
        padding: 1rem 5%;
    }

    .nav-links {
        display: none;
    }

    .hero {
        flex-direction: column;
        padding: 2rem 5% 4rem 5%;
        text-align: center;
    }

    .hero-actions {
        justify-content: center;
        flex-wrap: wrap;
    }

    .stats-container {
        width: 100%;
        padding: 1rem;
        gap: 1rem;
        justify-content: space-around;
        flex-wrap: wrap;
    }

    .hero-visual {
        display: none;
    }

    /* Hide complex visual on mobile */

    .app-layout {
        padding: 0 0 2rem 0;
        /* Remove side padding on mobile for max width */
        width: 100%;
        overflow-x: hidden;
    }

    .main-stage {
        padding: 0 1rem;
        width: 100%;
    }

    /* Taller card on mobile */
    .scene {
        height: 65vh;
        /* Occupy significant vertical space of viewport */
        max-height: 650px;
    }

    .card-face {
        padding: 1.5rem;
        width: 100%;
    }

    .card-content h2 {
        font-size: 1.6rem;
    }

    .card-content p {
        font-size: 1.1rem;
    }

    .controls {
        gap: 1.5rem;
        margin-top: 1.5rem;
        width: 100%;
        justify-content: center;
    }

    .control-btn {
        width: 55px;
        height: 55px;
        font-size: 1.3rem;
    }
}

/* Premium Footer Styles */
.site-footer {
    background: var(--bg-darker);
    border-top: 1px solid var(--glass-border);
    padding: 4rem 5% 2rem 5%;
    margin-top: auto;
    position: relative;
    z-index: 10;
}

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

.footer-col h3 {
    font-size: 1.2rem;
    margin-bottom: 1.5rem;
    color: var(--text-main);
}

.footer-col p {
    color: var(--text-muted);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}

.footer-links {
    list-style: none;
}

.footer-links li {
    margin-bottom: 0.8rem;
}

.footer-links a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color 0.3s;
}

.footer-links a:hover {
    color: var(--primary-glow);
    padding-left: 5px;
}

.social-links {
    display: flex;
    gap: 1rem;
}

.social-btn {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-main);
    text-decoration: none;
    transition: all 0.3s;
}

.social-btn:hover {
    background: var(--primary);
    transform: translateY(-3px);
}

.footer-bottom {
    text-align: center;
    padding-top: 2rem;
    border-top: 1px solid rgba(255, 255, 255, 0.05);
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* Logo Link Reset */
.logo-link {
    text-decoration: none;
    color: inherit;
    display: flex;
    align-items: center;
}

/* ==========================================================================
   New Enhancements: Spotlight Search, SRS Grading Tray, Badges & Audio
   ========================================================================== */

/* Keyboard Tags */
kbd {
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 4px;
    padding: 2px 6px;
    font-size: 0.75rem;
    font-family: inherit;
    font-weight: 600;
    color: var(--text-main);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Nav Search Button */
.nav-search-btn {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    padding: 0.55rem 1.2rem;
    border-radius: 50px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.25s ease;
}

.nav-search-btn:hover {
    background: rgba(255, 255, 255, 0.1);
    color: var(--text-main);
    border-color: rgba(99, 102, 241, 0.4);
    transform: translateY(-1px);
}

.nav-search-btn .search-kbd {
    display: flex;
    gap: 3px;
}

.nav-controls {
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.icon-toggle-btn {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.icon-toggle-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-glow);
    transform: scale(1.05);
}

/* Hero Badge */
.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 1rem;
    border-radius: 50px;
    background: rgba(99, 102, 241, 0.15);
    border: 1px solid rgba(99, 102, 241, 0.3);
    color: var(--primary-glow);
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: 1.2rem;
}

/* Study Toolbar - Centered Arena */
.study-toolbar {
    width: 100%;
    max-width: 950px;
    display: flex;
    flex-direction: column;
    padding: 0.85rem 1.4rem;
    border-radius: 16px;
    margin-bottom: 1.5rem;
    gap: 0.85rem;
    position: relative;
}

.toolbar-header-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    gap: 1.2rem;
}

.toolbar-left {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    min-width: 0;
    flex: 1 1 auto;
}

.toggle-sidebar-btn {
    padding: 0.45rem 1rem;
    font-size: 0.85rem;
    border-radius: 20px;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid var(--glass-border);
    color: var(--text-main);
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
    flex-shrink: 0;
}

.toggle-sidebar-btn:hover {
    background: rgba(99, 102, 241, 0.2);
    border-color: var(--primary);
    color: var(--primary-glow);
    transform: translateY(-1px);
}

.topic-breadcrumbs {
    font-size: 0.92rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    min-width: 0;
}

.topic-breadcrumbs strong {
    color: var(--text-main);
}

.study-filters {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.6rem;
    flex-shrink: 0;
    flex-wrap: wrap;
    width: 100%;
}

.filter-pill {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid transparent;
    color: var(--text-muted);
    padding: 0.42rem 0.95rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    white-space: nowrap !important;
    flex-shrink: 0;
}

.filter-badge {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 1px 7px;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--text-main);
    display: inline-block;
    line-height: 1.4;
    vertical-align: middle;
}

.filter-pill.active .filter-badge {
    background: rgba(255, 255, 255, 0.28);
    color: white;
}

.filter-pill:hover {
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.1);
}

.filter-pill.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary-glow);
    box-shadow: 0 2px 10px rgba(99, 102, 241, 0.4);
}

.toolbar-right {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-shrink: 0;
}

.fullscreen-btn {
    width: 38px;
    height: 38px;
    font-size: 0.9rem;
}

/* Flashcard Face Refinements */
.card-top-bar {
    position: absolute;
    top: 1.2rem;
    left: 1.5rem;
    right: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    z-index: 5;
}

.card-top-bar .card-label {
    position: static;
    font-size: 0.8rem;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.card-actions {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.card-star-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.25rem;
    cursor: pointer;
    transition: all 0.2s;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.card-star-btn:hover {
    color: #fbbf24;
    transform: scale(1.15);
}

.card-star-btn.starred {
    color: #fbbf24;
}

/* Card Status Badges */
.card-status-badge {
    font-size: 0.7rem;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    display: inline-flex;
    align-items: center;
    gap: 4px;
}

.badge-unseen {
    background: rgba(148, 163, 184, 0.15);
    color: #94a3b8;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.badge-learning {
    background: rgba(245, 158, 11, 0.15);
    color: #fbbf24;
    border: 1px solid rgba(245, 158, 11, 0.3);
}

.badge-mastered {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.card-question-text {
    font-size: 1.8rem;
    font-weight: 600;
    line-height: 1.4;
    color: var(--text-main);
    max-height: 250px;
    overflow-y: auto;
    padding: 0.5rem;
}

.card-answer-text {
    font-size: 1.25rem;
    line-height: 1.6;
    color: #e2e8f0;
    max-height: 220px;
    overflow-y: auto;
    padding: 0.5rem;
}

.card-footer-hint {
    position: absolute;
    bottom: 1rem;
    left: 0;
    right: 0;
    display: flex;
    justify-content: center;
}

.hint-pill {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid rgba(255, 255, 255, 0.08);
    padding: 0.3rem 0.8rem;
    border-radius: 20px;
    font-size: 0.75rem;
    color: var(--text-muted);
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

/* Active Recall / SRS Grading Tray */
.grading-tray {
    margin-top: 1.5rem;
    margin-bottom: 0.5rem;
    padding: 1.1rem 1.6rem;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 20px;
    width: 100%;
    max-width: 520px;
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    z-index: 10;
}

.grading-prompt {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.2px;
    font-weight: 700;
}

.grading-buttons {
    display: flex;
    gap: 0.8rem;
    width: 100%;
    max-width: 480px;
    justify-content: center;
}

.grade-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.72rem 1.2rem;
    border-radius: 12px;
    font-weight: 700;
    font-size: 0.92rem;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid transparent;
}

.grade-btn kbd {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.2);
}

.btn-again {
    background: rgba(239, 68, 68, 0.18);
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.35);
}

.btn-again:hover,
.btn-again:active {
    background: #ef4444;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(239, 68, 68, 0.4);
}

.btn-good {
    background: rgba(245, 158, 11, 0.18);
    color: #fde68a;
    border-color: rgba(245, 158, 11, 0.35);
}

.btn-good:hover,
.btn-good:active {
    background: #f59e0b;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(245, 158, 11, 0.4);
}

.btn-easy {
    background: rgba(16, 185, 129, 0.18);
    color: #a7f3d0;
    border-color: rgba(16, 185, 129, 0.35);
}

.btn-easy:hover,
.btn-easy:active {
    background: #10b981;
    color: white;
    transform: translateY(-2px);
    box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

/* Progress Pill Button in Top Bar */
.progress-pill-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.38rem 0.85rem;
    border-radius: 20px;
    background: rgba(16, 185, 129, 0.15);
    border: 1px solid rgba(16, 185, 129, 0.35);
    color: #34d399;
    font-size: 0.82rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    white-space: nowrap;
}

.progress-pill-btn:hover {
    background: rgba(16, 185, 129, 0.25);
    transform: translateY(-1px);
    box-shadow: 0 2px 10px rgba(16, 185, 129, 0.3);
}

.progress-wrapper {
    display: none; /* Replaced by top bar button to prevent hindering mobile viewing */
}

/* Progress Wrapper */
.progress-wrapper {
    width: 100%;
    max-width: 450px;
    margin-top: 1.5rem;
}

.progress-bar-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.4rem;
    font-weight: 500;
}

.keyboard-hints {
    display: flex;
    gap: 0.8rem;
    flex-wrap: wrap;
    justify-content: center;
    margin-top: 1.2rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* Sidebar Indicators */
.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    padding-bottom: 0.6rem;
    border-bottom: 1px solid var(--glass-border);
}

.sidebar-badge {
    font-size: 0.75rem;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(99, 102, 241, 0.2);
    color: var(--primary-glow);
    font-weight: 600;
}

.subtopic-title-wrapper {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
}

.subtopic-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.2);
    flex-shrink: 0;
}

.subtopic-dot.dot-mastered {
    background: #10b981;
    box-shadow: 0 0 6px #10b981;
}

.subtopic-dot.dot-learning {
    background: #f59e0b;
}

.category-stat-badge {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 600;
}

/* Spotlight Search Modal */
.spotlight-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(2, 6, 23, 0.85);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 5000;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    padding-top: 10vh;
}

.spotlight-container {
    width: 90%;
    max-width: 680px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
    overflow: hidden;
    animation: spotlightPop 0.2s ease-out;
}

@keyframes spotlightPop {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.spotlight-header {
    display: flex;
    align-items: center;
    padding: 1.2rem 1.5rem;
    border-bottom: 1px solid var(--glass-border);
    gap: 1rem;
}

.spotlight-header .search-icon {
    font-size: 1.3rem;
    color: var(--primary-glow);
}

.spotlight-header input {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-main);
    font-size: 1.15rem;
    outline: none;
    font-family: inherit;
}

.spotlight-header input::placeholder {
    color: var(--text-muted);
    font-size: 0.95rem;
}

.spotlight-close-btn {
    background: transparent;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    line-height: 1;
}

.spotlight-close-btn:hover {
    color: white;
}

.spotlight-meta {
    display: flex;
    justify-content: space-between;
    padding: 0.6rem 1.5rem;
    background: rgba(0, 0, 0, 0.2);
    font-size: 0.78rem;
    color: var(--text-muted);
    border-bottom: 1px solid var(--glass-border);
}

.spotlight-results {
    max-height: 420px;
    overflow-y: auto;
    padding: 0.8rem;
}

.spotlight-item {
    padding: 1rem 1.2rem;
    border-radius: 12px;
    margin-bottom: 0.5rem;
    cursor: pointer;
    transition: all 0.18s ease;
    border: 1px solid transparent;
}

.spotlight-item:hover,
.spotlight-item.selected {
    background: rgba(99, 102, 241, 0.15);
    border-color: rgba(99, 102, 241, 0.35);
}

.spotlight-item-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.4rem;
}

.spotlight-badge {
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--primary-glow);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.spotlight-card-id {
    font-size: 0.72rem;
    color: var(--text-muted);
}

.spotlight-item-front {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-main);
    margin-bottom: 0.3rem;
}

.spotlight-item-back {
    font-size: 0.85rem;
    color: #cbd5e1;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.spotlight-empty {
    padding: 3rem 1.5rem;
    text-align: center;
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Features Showcase Grid */
.features-section {
    padding: 4rem 5%;
}

.features-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 2rem;
}

.feature-card {
    border-radius: 20px;
    padding: 2rem;
    transition: transform 0.3s ease;
}

.feature-card:hover {
    transform: translateY(-5px);
}

.feature-icon {
    font-size: 2.2rem;
    color: var(--accent);
    margin-bottom: 1.2rem;
    background: rgba(6, 182, 212, 0.1);
    width: 60px;
    height: 60px;
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.feature-card h3 {
    font-size: 1.3rem;
    margin-bottom: 0.6rem;
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--text-muted);
    line-height: 1.6;
}

/* Home Topic Cards Mini Progress */
.topic-card-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
}

.topic-card-top i {
    margin-bottom: 0 !important;
}

.topic-percent-pill {
    font-size: 0.75rem;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-muted);
}

.topic-percent-pill.active {
    background: rgba(16, 185, 129, 0.15);
    color: #34d399;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.topic-progress-mini {
    height: 4px;
    width: 100%;
    background: rgba(255, 255, 255, 0.08);
    border-radius: 4px;
    margin-bottom: 1rem;
    overflow: hidden;
}

.topic-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    transition: width 0.4s ease;
}

/* Celebration Overlay */
.celebration-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(2, 6, 23, 0.92);
    backdrop-filter: blur(12px);
    z-index: 4000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.celebration-card {
    max-width: 500px;
    padding: 3rem 2rem;
    text-align: center;
    border-radius: 28px;
    animation: celebrationBounce 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

@keyframes celebrationBounce {
    from {
        opacity: 0;
        transform: scale(0.85);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.celebration-icon {
    font-size: 4rem;
    margin-bottom: 1rem;
}

.celebration-card h2 {
    font-size: 2.2rem;
    margin-bottom: 0.8rem;
}

.celebration-card p {
    color: var(--text-muted);
    font-size: 1.05rem;
    line-height: 1.6;
    margin-bottom: 2rem;
}

.celebration-actions {
    display: flex;
    gap: 1rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Mobile Responsive Additions */
@media (max-width: 768px) {
    .nav-search-btn .search-placeholder {
        display: none;
    }

    .nav-search-btn {
        padding: 0.5rem 0.8rem;
    }

    /* Unbox study toolbar so children participate directly in main-stage flex order */
    .study-toolbar {
        display: contents;
    }

    .toolbar-header-row {
        display: flex;
        justify-content: space-between;
        align-items: center;
        width: 100%;
        padding: 0.6rem 1rem;
        border-radius: 14px;
        background: var(--glass-bg);
        border: 1px solid var(--glass-border);
        margin-bottom: 0.8rem;
        order: 1; /* 1. Top status bar */
    }

    .toolbar-left {
        grid-column: auto;
        justify-self: auto;
        width: auto;
        gap: 0.5rem;
    }

    .toolbar-right {
        grid-column: auto;
        justify-self: auto;
        width: auto;
        gap: 0.6rem;
    }

    /* 2. CARD IS ON TOP IN MOBILE VIEWING */
    .scene {
        order: 2; /* 2. Flashcard on top */
        width: 100%;
        height: 54vh;
        max-height: 480px;
        margin-bottom: 0.8rem;
    }

    /* 3. CONTROLS RIGHT UNDER THE CARD */
    .controls {
        order: 3; /* 3. Navigation controls */
        margin-top: 0.2rem;
        margin-bottom: 0.8rem;
    }

    /* 4. ALL, PRACTICE, AND STARRED MENU PLACED BELOW THE CARD */
    .study-filters {
        grid-column: auto;
        justify-self: auto;
        order: 4; /* 4. Menu below the card */
        width: 100%;
        max-width: 380px;
        display: flex;
        justify-content: center;
        gap: 0.35rem;
        margin-bottom: 0.8rem;
        flex-wrap: nowrap;
    }

    .filter-pill {
        flex: 1;
        justify-content: center;
        font-size: 0.76rem;
        padding: 0.42rem 0.45rem;
        white-space: nowrap !important;
        gap: 0.3rem;
        flex-shrink: 0;
    }

    .filter-badge {
        padding: 1px 5px;
        font-size: 0.68rem;
    }

    /* 5. TOPIC PROGRESS BAR */
    .progress-wrapper {
        order: 5; /* 5. Progress bar */
        margin-top: 0.2rem;
        width: 100%;
        max-width: 360px;
    }

    .card-face-back {
        padding: 1.8rem 1.2rem 1.2rem 1.2rem;
    }

    .card-face-back .card-content {
        margin: 0.6rem 0;
        flex: 1;
    }

    .card-answer-text {
        font-size: 1.15rem;
        line-height: 1.6;
    }

    .grading-tray {
        margin-top: 1rem;
        padding: 0.8rem 1rem;
        border-radius: 16px;
        gap: 0.5rem;
    }

    .grading-buttons {
        gap: 0.4rem;
    }

    .grade-btn {
        padding: 0.55rem 0.6rem;
        font-size: 0.8rem;
    }

    .keyboard-hints {
        display: none; /* Hidden on touch devices */
    }

    .spotlight-container {
        width: 95%;
        margin-top: 10px;
    }
}

/* ==========================================================================
   Immersive App Fullscreen Mode (Cross-Browser & Mobile Support)
   ========================================================================== */
body.app-fullscreen {
    overflow: hidden;
}

body.app-fullscreen header,
body.app-fullscreen .navbar {
    display: none !important;
}

body.app-fullscreen .app-layout {
    min-height: 100vh !important;
    height: 100vh !important;
    padding: 0.6rem 1.5rem 1rem 1.5rem !important;
    justify-content: center;
}

body.app-fullscreen .study-toolbar {
    margin-bottom: 1rem;
}

body.app-fullscreen .scene {
    height: 58vh !important;
    max-height: 560px !important;
}

.fullscreen-btn.active {
    background: rgba(99, 102, 241, 0.35) !important;
    color: #a5b4fc !important;
    border-color: rgba(99, 102, 241, 0.6) !important;
    box-shadow: 0 0 15px rgba(99, 102, 241, 0.35) !important;
}

@media (max-width: 768px) {
    body.app-fullscreen .app-layout {
        padding: 0.5rem 0.8rem 0.8rem 0.8rem !important;
    }

    body.app-fullscreen .scene {
        height: 60vh !important;
        max-height: 500px !important;
    }
}
/* NEET Biology Specific Bio-Glow Enhancements */
.hero-badge {
    background: rgba(16, 185, 129, 0.12);
    border: 1px solid rgba(16, 185, 129, 0.3);
    color: #34d399;
}
.btn-large {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    box-shadow: 0 4px 20px rgba(16, 185, 129, 0.4);
}
.btn-large:hover {
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.6);
}
.tag-badge {
    background: rgba(16, 185, 129, 0.15);
    color: #a7f3d0;
    border: 1px solid rgba(16, 185, 129, 0.3);
}
.topic-card:hover {
    border-color: rgba(16, 185, 129, 0.4);
    box-shadow: 0 10px 30px rgba(16, 185, 129, 0.15);
}
.topic-card-top i {
    color: #34d399;
    text-shadow: 0 0 15px rgba(16, 185, 129, 0.6);
}
.bio-fact {
    background: rgba(16, 185, 129, 0.08);
    border-left: 3px solid #10b981;
    padding: 0.5rem 0.8rem;
    margin: 0.5rem 0;
    border-radius: 4px;
}
.bio-mnemonic {
    background: rgba(245, 158, 11, 0.08);
    border-left: 3px solid #f59e0b;
    padding: 0.5rem 0.8rem;
    margin: 0.5rem 0;
    border-radius: 4px;
    font-size: 0.9rem;
    color: #fde68a;
}


/* ==========================================================================
   Markdown & Rich Card Content Typography
   ========================================================================== */
.card-question-text p,
.card-answer-text p {
    margin-bottom: 0.65rem;
}
.card-question-text p:last-child,
.card-answer-text p:last-child {
    margin-bottom: 0;
}

.card-question-text strong,
.card-answer-text strong {
    font-weight: 700;
    color: #ffffff;
    text-shadow: 0 0 14px rgba(255, 255, 255, 0.25);
}

.card-question-text em,
.card-answer-text em {
    font-style: italic;
    color: #f1f5f9;
}

.card-question-text code,
.card-answer-text code {
    font-family: 'JetBrains Mono', 'Fira Code', Consolas, monospace;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    border-radius: 4px;
    padding: 0.15rem 0.4rem;
    font-size: 0.88em;
    color: #6ee7b7;
}

.card-list {
    text-align: left;
    margin: 0.6rem auto;
    padding-left: 1.5rem;
    display: inline-block;
    max-width: 100%;
}
.card-list li {
    margin-bottom: 0.45rem;
    line-height: 1.5;
}
.card-list li:last-child {
    margin-bottom: 0;
}

.card-quote {
    border-left: 3px solid var(--primary, #10b981);
    background: rgba(255, 255, 255, 0.04);
    padding: 0.5rem 0.8rem;
    margin: 0.6rem 0;
    color: #cbd5e1;
    font-style: italic;
    text-align: left;
    border-radius: 0 6px 6px 0;
}

.card-table-wrapper {
    width: 100%;
    overflow-x: auto;
    margin: 0.75rem 0;
    -webkit-overflow-scrolling: touch;
}
.card-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.92rem;
    background: rgba(15, 23, 42, 0.6);
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.12);
}
.card-table th, .card-table td {
    padding: 0.5rem 0.8rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    text-align: left;
}
.card-table th {
    background: rgba(255, 255, 255, 0.1);
    font-weight: 600;
    color: #f8fafc;
}
.card-table tr:nth-child(even) td {
    background: rgba(255, 255, 255, 0.03);
}

/* Spotlight Search Markdown Support */
.spotlight-item-front strong,
.spotlight-item-back strong {
    font-weight: 700;
    color: #ffffff;
}
.spotlight-item-front em,
.spotlight-item-back em {
    font-style: italic;
    color: #e2e8f0;
}
.spotlight-item-front ul,
.spotlight-item-back ul {
    margin: 0.3rem 0;
    padding-left: 1.2rem;
}
.spotlight-item-front li,
.spotlight-item-back li {
    margin-bottom: 0.2rem;
}

/* ==========================================================================
   Voice Engine & Speech UI Styles
   ========================================================================== */
.speech-control-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.45rem 0.8rem;
    border-radius: 9999px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-main);
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    position: relative;
    user-select: none;
}

.speech-control-btn:hover {
    background: rgba(14, 165, 233, 0.15);
    border-color: rgba(14, 165, 233, 0.4);
    color: #38bdf8;
    transform: translateY(-1px);
}

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

.speech-control-btn.speaking {
    background: rgba(14, 165, 233, 0.25);
    border-color: #38bdf8;
    color: #38bdf8;
    box-shadow: 0 0 16px rgba(14, 165, 233, 0.4);
    animation: speech-pulse 2s infinite;
}

.speech-control-btn.paused {
    background: rgba(245, 158, 11, 0.2);
    border-color: #f59e0b;
    color: #fbbf24;
}

.speech-control-btn.disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Audio Wave Visualizer Bars */
.audio-wave {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    height: 14px;
}

.audio-wave .bar {
    width: 3px;
    height: 6px;
    background: currentColor;
    border-radius: 2px;
    transition: height 0.2s ease;
}

.speech-control-btn.speaking .audio-wave .bar:nth-child(1) {
    animation: wave-bounce 1s infinite ease-in-out 0.1s;
}
.speech-control-btn.speaking .audio-wave .bar:nth-child(2) {
    animation: wave-bounce 1s infinite ease-in-out 0.3s;
}
.speech-control-btn.speaking .audio-wave .bar:nth-child(3) {
    animation: wave-bounce 1s infinite ease-in-out 0.2s;
}

@keyframes wave-bounce {
    0%, 100% { height: 4px; }
    50% { height: 14px; }
}

@keyframes speech-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(14, 165, 233, 0.4);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(14, 165, 233, 0);
    }
}

/* Card-level speech action button */
.card-speech-btn {
    position: absolute;
    bottom: 1.2rem;
    left: 1.5rem;
    z-index: 10;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.4rem 0.75rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    background: rgba(15, 23, 42, 0.6);
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: var(--text-muted);
    cursor: pointer;
    transition: all 0.2s ease;
}

.card-speech-btn:hover {
    color: #38bdf8;
    border-color: rgba(56, 189, 248, 0.4);
    background: rgba(15, 23, 42, 0.85);
}

.card-speech-btn.speaking {
    color: #38bdf8;
    border-color: #38bdf8;
    background: rgba(14, 165, 233, 0.2);
}
