@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;600;700;800&display=swap');

:root {
    /* --- Apple UI System Colors --- */
    --accent: #5856d6;       /* Apple Indigo */
    --accent-glow: rgba(88, 86, 214, 0.2);
    --secondary: #007aff;    /* Apple Blue */
    --secondary-glow: rgba(0, 122, 255, 0.15);
    
    --success: #34c759;      /* Apple Green */
    --error: #ff3b30;        /* Apple Red */
    
    /* --- Light Theme (Apple Frosted Glass) --- */
    --bg-main: #f5f5f7;      /* Apple Light Gray background */
    --bg-surface: rgba(255, 255, 255, 0.7); /* Translucent */
    --bg-glass: rgba(255, 255, 255, 0.65);
    --text-primary: #1d1d1f; /* Apple Dark Charcoal */
    --text-secondary: #86868b; /* Apple Gray */
    --text-tertiary: #aeaeb2;
    --border: rgba(0, 0, 0, 0.06);
    
    --shadow-soft: 0 20px 40px rgba(0, 0, 0, 0.04);
    --shadow-neon: 0 10px 30px rgba(88, 86, 214, 0.08);
    
    /* Global Radius System (Apple squircle feel) */
    --radius-xl: 22px;
    --radius-lg: 14px;
    --radius-md: 10px;
}

[data-theme="dark"] {
    /* --- Dark Theme (Apple Space Gray / Dark Glass) --- */
    --bg-main: #000000;      /* Pure black for OLED depth */
    --bg-surface: rgba(28, 28, 30, 0.7); /* Translucent */
    --bg-glass: rgba(28, 28, 30, 0.6);
    --text-primary: #f5f5f7; /* Apple Off-White */
    --text-secondary: #86868b; /* Apple Gray */
    --text-tertiary: #636366;
    --border: rgba(255, 255, 255, 0.08);
    
    --shadow-soft: 0 20px 50px rgba(0, 0, 0, 0.5);
    --shadow-neon: 0 10px 30px rgba(0, 122, 255, 0.08);
    
    --accent: #5e5ce6;      /* Apple Dark Indigo */
    --secondary: #0a84ff;   /* Apple Dark Blue */
    --accent-glow: rgba(94, 92, 230, 0.25);
}

/* --- Base Reset & Typography --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* --- Hide Scrollbar (all browsers) while keeping scroll functional --- */
* {
    scrollbar-width: none;        /* Firefox */
    -ms-overflow-style: none;     /* IE / Edge */
}

*::-webkit-scrollbar {
    display: none;                /* Chrome / Safari / Opera */
}

body {
    background-color: var(--bg-main);
    color: var(--text-primary);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", Helvetica, Arial, sans-serif;
    line-height: 1.5;
    letter-spacing: -0.011em;
    transition: background-color 0.4s ease, color 0.4s ease;
    overflow-x: hidden;
    position: relative;
    min-height: 100vh;
}

/* --- Ambient Glow Background Blobs --- */
.ambient-glow {
    position: fixed;
    border-radius: 50%;
    filter: blur(130px);
    z-index: -1;
    opacity: 0.28;
    pointer-events: none;
    transition: all 0.8s ease;
}

.glow-1 {
    width: 600px;
    height: 600px;
    background: radial-gradient(circle, var(--accent) 0%, transparent 70%);
    top: -15%;
    left: -10%;
}

.glow-2 {
    width: 700px;
    height: 700px;
    background: radial-gradient(circle, var(--secondary) 0%, transparent 70%);
    bottom: -15%;
    right: -10%;
}

.glow-3 {
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, #ff2d55 0%, transparent 70%); /* Apple Pink */
    top: 30%;
    left: 50%;
    opacity: 0.15;
}

[data-theme="dark"] .ambient-glow {
    opacity: 0.22;
}

/* --- Centered Layout Wrapper --- */
.main-wrapper {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.max-w-5xl {
    max-width: 1000px;
}

.max-w-4xl {
    max-width: 850px;
}

/* --- Sticky Top Header (Transparent, Seamless) --- */
.sticky-quiz-header {
    background: transparent;
    position: sticky;
    top: 0;
    z-index: 100;
    padding: 1.5rem 0;
    transition: all 0.3s ease;
}

.brand-link {
    display: flex;
    align-items: center;
}

.header-right {
    gap: 1rem;
}

.header-logo {
    height: 80px;
    object-fit: contain;
}

[data-theme="dark"] .header-logo {
    filter: invert(1) hue-rotate(180deg) brightness(1.4) contrast(1.1);
}

/* Theme Toggle Button (Apple Glassmorphic Style) */
.btn-theme-toggle {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    color: var(--text-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03);
}

.btn-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.9);
    border-color: rgba(0, 0, 0, 0.15);
    transform: translateY(-2px);
}

[data-theme="dark"] .btn-theme-toggle:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.2);
}

/* --- Apple Frosted Glass Card --- */
.generation-card {
    background: var(--bg-glass) !important;
    backdrop-filter: blur(35px) saturate(190%);
    -webkit-backdrop-filter: blur(35px) saturate(190%);
    border: 1px solid var(--border) !important;
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-soft) !important;
    transition: all 0.4s ease;
}

.text-primary-gradient {
    background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.text-secondary-custom {
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

/* SEO subtitle — visible to users and search engines */
.seo-desc {
    color: var(--text-secondary);
    font-size: 0.88rem;
    line-height: 1.5;
    margin-top: 0.1rem;
}

/* Apple Segmented Controls Tabs */
.custom-tabs {
    background: rgba(120, 120, 128, 0.08);
    border-radius: 12px;
    padding: 3px;
    border: none;
}

[data-theme="dark"] .custom-tabs {
    background: rgba(120, 120, 128, 0.18);
}

.custom-tabs .nav-link {
    color: var(--text-primary);
    font-weight: 600;
    font-size: 0.9rem;
    border: none !important;
    background: transparent;
    border-radius: 9px;
    padding: 0.5rem 1rem;
    transition: all 0.2s ease;
}

.custom-tabs .nav-link.active {
    background: #ffffff !important;
    color: #000000 !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12), 0 3px 1px rgba(0, 0, 0, 0.04) !important;
}

[data-theme="dark"] .custom-tabs .nav-link.active {
    background: rgba(255, 255, 255, 0.22) !important;
    color: #ffffff !important;
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.4) !important;
}

/* --- Drag & Drop Upload Zone --- */
.upload-zone {
    border: 1px dashed var(--border);
    border-radius: var(--radius-lg);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    text-align: center;
    position: relative;
    overflow: hidden;
    background: rgba(0, 0, 0, 0.015);
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

[data-theme="dark"] .upload-zone {
    background: rgba(255, 255, 255, 0.015);
}

.upload-zone:hover {
    background: rgba(0, 0, 0, 0.03);
    border-color: var(--accent);
}

[data-theme="dark"] .upload-zone:hover {
    background: rgba(255, 255, 255, 0.03);
}

.upload-icon {
    font-size: 2.2rem;
    color: var(--accent);
    transition: transform 0.3s ease;
}

.upload-zone:hover .upload-icon {
    transform: translateY(-4px);
}

/* Custom Text Area */
.text-area-custom {
    background: rgba(120, 120, 128, 0.05) !important;
    border: 1px solid transparent !important;
    border-radius: var(--radius-lg) !important;
    color: var(--text-primary) !important;
    padding: 1.1rem !important;
    font-size: 0.95rem;
    transition: all 0.3s ease !important;
}

[data-theme="dark"] .text-area-custom {
    background: rgba(255, 255, 255, 0.05) !important;
}

.text-area-custom:focus {
    background: var(--bg-surface) !important;
    border-color: var(--accent) !important;
    box-shadow: 0 0 0 4px rgba(88, 86, 214, 0.15) !important;
    outline: none !important;
}

/* --- Apple Slider/Stepper Component --- */
.q-stepper {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(120, 120, 128, 0.05);
    border: none;
    padding: 0.65rem 1rem;
    border-radius: var(--radius-lg);
}

[data-theme="dark"] .q-stepper {
    background: rgba(255, 255, 255, 0.05);
}

.q-stepper-btn {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: none;
    background: var(--bg-surface);
    color: var(--text-primary);
    font-size: 1.1rem;
    font-weight: 600;
    cursor: pointer;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
}

.q-stepper-btn:hover {
    background: var(--accent);
    color: #ffffff;
}

.q-stepper-track {
    flex: 1;
    height: 5px;
    background: rgba(0, 0, 0, 0.06);
    border-radius: 3px;
    position: relative;
    cursor: pointer;
}

[data-theme="dark"] .q-stepper-track {
    background: rgba(255, 255, 255, 0.1);
}

.q-stepper-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 3px;
    position: absolute;
    top: 0;
    left: 0;
}

.q-count-badge {
    background: var(--accent);
    color: #ffffff;
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.2rem 0.6rem;
    border-radius: 12px;
    box-shadow: 0 2px 8px var(--accent-glow);
}

/* --- Apple Segments/Pills for Difficulty --- */
.difficulty-pills {
    display: flex;
    gap: 0.5rem;
    background: rgba(120, 120, 128, 0.05);
    padding: 4px;
    border-radius: 12px;
}

[data-theme="dark"] .difficulty-pills {
    background: rgba(255, 255, 255, 0.05);
}

.diff-pill {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    padding: 0.65rem 0.5rem;
    border: none;
    background: transparent;
    color: var(--text-primary);
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.25s ease;
}

.diff-pill:hover {
    background: rgba(0, 0, 0, 0.02);
}

[data-theme="dark"] .diff-pill:hover {
    background: rgba(255, 255, 255, 0.02);
}

.diff-pill.active {
    background: #ffffff !important;
    color: #000000 !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.1) !important;
}

[data-theme="dark"] .diff-pill.active {
    background: rgba(255, 255, 255, 0.2) !important;
    color: #ffffff !important;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3) !important;
}

.diff-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-secondary);
    transition: background 0.3s ease;
}

.diff-pill.active .diff-dot {
    background: var(--accent);
}

/* --- Apple Buttons --- */
.btn-premium {
    background: linear-gradient(135deg, var(--accent) 0%, var(--secondary) 100%);
    color: #ffffff !important;
    border: none;
    border-radius: 12px;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    text-decoration: none;
    box-shadow: 0 4px 16px var(--accent-glow);
}

.btn-premium:hover {
    transform: translateY(-1.5px);
    box-shadow: 0 8px 24px var(--accent-glow);
}

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

.btn-new-session {
    font-size: 0.85rem;
    border-radius: 20px !important;
    line-height: 1;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    padding-top: 0.5rem !important;
    padding-bottom: 0.5rem !important;
}

/* --- Assessment Playground --- */
.playground-header {
    background: var(--bg-glass);
    backdrop-filter: blur(30px);
    -webkit-backdrop-filter: blur(30px);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl) !important;
    box-shadow: var(--shadow-soft);
}

.progress-container {
    height: 6px;
    background: rgba(120, 120, 128, 0.08);
    border-radius: 3px;
    overflow: hidden;
}

.progress-bar {
    height: 100%;
    background: var(--accent);
    width: 0%;
    transition: width 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* Question Cards */
.question-card {
    background: var(--bg-glass);
    backdrop-filter: blur(30px) saturate(180%);
    -webkit-backdrop-filter: blur(30px) saturate(180%);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 2.2rem;
    margin-bottom: 2.2rem;
    box-shadow: var(--shadow-soft);
    position: relative;
    overflow: hidden;
    animation: fadeInUp 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

.question-badge {
    background: rgba(88, 86, 214, 0.08);
    color: var(--accent);
    padding: 0.3rem 0.75rem;
    border-radius: 8px;
    font-size: 0.8rem;
    font-weight: 700;
}

.question-title {
    font-size: 1.35rem;
    font-weight: 700;
    line-height: 1.4;
    color: var(--text-primary);
    letter-spacing: -0.015em;
}

/* Option Cards (Segment-controlled layout style) */
.option-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.8rem;
    margin-top: 1.25rem;
}

.option-pill {
    background: rgba(120, 120, 128, 0.05);
    border: 1px solid transparent;
    border-radius: var(--radius-lg);
    padding: 1rem 1.4rem;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 1rem;
    transition: all 0.2s ease;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
}

.option-pill:hover {
    background: rgba(120, 120, 128, 0.1);
}

.option-pill.active {
    background: var(--bg-surface);
    border-color: var(--accent);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.03), 0 2px 4px var(--accent-glow);
}

.option-indicator {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--text-secondary);
    background: var(--bg-surface);
    transition: all 0.2s ease;
}

.option-pill.active .option-indicator {
    border-color: var(--accent);
    background: var(--accent);
    color: #ffffff;
}

/* Correct / Incorrect Highlights (Submissions) */
.option-pill.correct-option {
    border-color: var(--success) !important;
    background: rgba(52, 199, 89, 0.08) !important;
    color: var(--success) !important;
}

.option-pill.correct-option .option-indicator {
    background: var(--success) !important;
    border-color: var(--success) !important;
    color: #ffffff !important;
}

.option-pill.incorrect-option {
    border-color: var(--error) !important;
    background: rgba(255, 59, 48, 0.08) !important;
    color: var(--error) !important;
}

.option-pill.incorrect-option .option-indicator {
    background: var(--error) !important;
    border-color: var(--error) !important;
    color: #ffffff !important;
}

/* Hint Button and Content */
.btn-hint-toggle {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0;
}

.btn-hint-toggle:hover {
    color: var(--secondary);
    transform: translateY(-1px);
}

.hint-box {
    margin-top: 1rem;
    padding: 1.2rem 1.5rem;
    background: rgba(88, 86, 214, 0.04);
    border: 1px solid rgba(88, 86, 214, 0.08);
    border-radius: var(--radius-lg);
    font-size: 0.95rem;
    color: var(--text-secondary);
    line-height: 1.6;
    animation: fadeInUp 0.4s cubic-bezier(0.25, 0.8, 0.25, 1) forwards;
}

[data-theme="dark"] .hint-box {
    background: rgba(255, 255, 255, 0.02);
    border-color: rgba(255, 255, 255, 0.06);
    color: #d1d1d6; /* High contrast text for dark mode */
}

.hint-box p {
    margin-bottom: 0.8rem;
}

.hint-box p:last-child {
    margin-bottom: 0;
}

.hint-box strong {
    color: var(--accent);
    font-weight: 600;
}

/* Explanation Cards */
.explanation-card {
    background: rgba(52, 199, 89, 0.02);
    border: 1px solid rgba(52, 199, 89, 0.2);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    margin-top: 1.25rem;
    font-size: 0.95rem;
    animation: fadeInUp 0.4s ease forwards;
}

/* --- Card-scoped Loader Overlay --- */
.loader-overlay {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.45);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
    border-radius: var(--radius-xl);
}

[data-theme="dark"] .loader-overlay {
    background: rgba(15, 15, 20, 0.55);
}

.loader-overlay.active {
    opacity: 1;
    visibility: visible;
}

.loader-content {
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2rem;
}

.ai-loader-ring {
    height: 60px;
    width: 60px;
    border-radius: 50%;
    border: 3px solid rgba(88, 86, 214, 0.1);
    border-top-color: var(--accent);
    border-bottom-color: var(--secondary);
    animation: rotate 1s linear infinite;
}

/* Network Connection Badge */
.network-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    font-weight: 700;
    padding: 0.4rem 0.8rem;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--bg-surface);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.network-badge.online {
    color: var(--success);
}

.network-badge.offline {
    color: var(--error);
}

/* --- Custom Glassmorphic Modal --- */
.custom-modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 20000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.custom-modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.custom-modal-box {
    background: var(--bg-surface);
    backdrop-filter: blur(40px) saturate(180%);
    -webkit-backdrop-filter: blur(40px) saturate(180%);
    border: 1px solid var(--border);
    border-radius: var(--radius-xl);
    padding: 1.8rem;
    width: 90%;
    max-width: 400px;
    box-shadow: var(--shadow-soft);
    text-align: left;
    transform: scale(0.92);
    transition: transform 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
}

.custom-modal-overlay.active .custom-modal-box {
    transform: scale(1);
}

.btn-modal {
    padding: 0.6rem 1.25rem;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    font-weight: 600;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-modal-cancel {
    background: rgba(120, 120, 128, 0.1);
    color: var(--text-primary);
}

.btn-modal-cancel:hover {
    background: rgba(120, 120, 128, 0.2);
}

.btn-modal-ok {
    background: var(--error);
    color: #ffffff;
}

.btn-modal-ok:hover {
    background: #e02b20;
    box-shadow: 0 4px 12px rgba(255, 59, 48, 0.25);
}

/* --- Animations --- */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(15px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@keyframes pulse {
    0%, 100% {
        transform: scale(0.95);
        filter: drop-shadow(0 0 10px rgba(88, 86, 214, 0.2));
    }
    50% {
        transform: scale(1.05);
        filter: drop-shadow(0 0 25px var(--accent-glow));
    }
}

@keyframes rotate {
    to {
        transform: rotate(360deg);
    }
}

/* =========================================================
   RESPONSIVE — Tablet (≤ 768px)
   ========================================================= */
@media (max-width: 768px) {

    /* --- Header --- */
    .sticky-quiz-header {
        padding: 0.75rem 0;
    }

    .header-logo {
        height: 56px;
    }

    .header-container {
        padding-left: 1rem !important;
        padding-right: 1rem !important;
    }

    .header-right {
        gap: 0.4rem;
    }

    /* Hide + button on home page in mobile — only show during active quiz */
    body:has(#home-content:not(.d-none)) #new-session-btn {
        display: none !important;
    }

    .btn-new-session {
        font-size: 0.8rem;
        padding: 0.45rem 0.9rem !important;
    }

    /* --- Home Page --- */
    #home-content {
        padding: 1.25rem !important;
    }

    .generation-card {
        padding: 1.5rem !important;
        border-radius: 18px !important;
    }

    /* collapse two-column form into single column */
    .row.g-5 {
        gap: 1.5rem !important;
    }

    /* --- Upload Zone --- */
    .upload-zone {
        padding: 2rem 1rem !important;
    }

    .upload-icon {
        font-size: 1.8rem;
    }

    /* --- Textarea --- */
    .text-area-custom {
        rows: 5;
        font-size: 0.9rem !important;
    }

    /* --- Stepper --- */
    .q-stepper {
        padding: 0.55rem 0.75rem;
        gap: 0.75rem;
    }

    /* --- Difficulty Pills --- */
    .diff-pill {
        font-size: 0.82rem;
        padding: 0.55rem 0.35rem;
    }

    /* --- Generate Button --- */
    #generate-quiz-btn {
        padding: 0.85rem !important;
        font-size: 0.9rem;
    }

    /* --- Quiz Playground --- */
    #quiz-content {
        padding: 1rem !important;
    }

    .quiz-playground {
        padding: 0;
    }

    .playground-header {
        padding: 1.25rem !important;
        margin-bottom: 1.5rem !important;
        border-radius: 16px !important;
    }

    .playground-header h2 {
        font-size: 1.4rem !important;
    }

    /* --- Question Cards --- */
    .question-card {
        padding: 1.25rem;
        margin-bottom: 1.25rem;
        border-radius: 16px;
    }

    .question-title {
        font-size: 1.05rem;
    }

    .question-badge {
        font-size: 0.72rem;
    }

    /* --- Option Pills --- */
    .option-pill {
        padding: 0.8rem 1rem;
        font-size: 0.88rem;
        gap: 0.75rem;
    }

    .option-indicator {
        width: 22px;
        height: 22px;
        font-size: 0.7rem;
        flex-shrink: 0;
    }

    /* --- Hint Box --- */
    .hint-box {
        padding: 1rem 1.1rem;
        font-size: 0.88rem;
    }

    /* --- Submit Button: flows naturally after last question on mobile --- */
    .sticky-bottom-action {
        position: static;
        background: transparent;
        padding: 0.5rem 0 1.5rem;
        margin-top: 2rem !important;
        z-index: auto;
    }

    #submit-quiz-btn {
        padding: 0.9rem !important;
        font-size: 0.95rem;
    }

    /* --- Results Summary Card --- */
    #results-summary .row {
        flex-direction: column;
    }

    #results-summary .col-md-5,
    #results-summary .col-md-7 {
        padding: 1.5rem !important;
    }

    #results-summary .display-1 {
        font-size: 3rem !important;
    }

    /* --- Custom Confirm Modal --- */
    .custom-modal-box {
        padding: 1.4rem;
        border-radius: 18px;
    }

    /* --- Ambient Glows (reduce on mobile for perf) --- */
    .glow-1,
    .glow-2 {
        width: 300px;
        height: 300px;
        filter: blur(80px);
    }

    .glow-3 {
        display: none;
    }
}

/* =========================================================
   RESPONSIVE — Mobile (≤ 480px)
   ========================================================= */
@media (max-width: 480px) {

    /* --- Header --- */
    .header-logo {
        height: 46px;
    }

    .btn-theme-toggle {
        width: 38px;
        height: 38px;
        font-size: 0.85rem;
    }

    .btn-new-session {
        width: 38px;
        height: 38px;
        padding: 0 !important;
        border-radius: 50% !important;
        font-size: 0.95rem;
        gap: 0;
        /* Override btn-premium gradient with theme-toggle glass style */
        background: var(--bg-surface) !important;
        backdrop-filter: blur(20px) !important;
        -webkit-backdrop-filter: blur(20px) !important;
        border: 1px solid var(--border) !important;
        color: var(--text-primary) !important;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.03) !important;
    }

    .btn-new-session:hover {
        background: rgba(255, 255, 255, 0.9) !important;
        border-color: rgba(0, 0, 0, 0.15) !important;
        transform: translateY(-2px);
    }

    [data-theme="dark"] .btn-new-session:hover {
        background: rgba(255, 255, 255, 0.1) !important;
        border-color: rgba(255, 255, 255, 0.2) !important;
    }

    .btn-session-text {
        display: none;
    }

    /* --- Generation Card --- */
    .generation-card {
        padding: 1.1rem !important;
        border-radius: 16px !important;
    }

    .generation-card h3 {
        font-size: 1.15rem;
    }

    /* --- Tabs --- */
    .custom-tabs .nav-link {
        font-size: 0.8rem;
        padding: 0.45rem 0.5rem;
    }

    /* --- Upload Zone --- */
    .upload-zone {
        padding: 1.5rem 0.75rem !important;
    }

    .upload-icon {
        font-size: 1.5rem;
        margin-bottom: 0.5rem !important;
    }

    #file-upload-placeholder h6 {
        font-size: 0.9rem;
    }

    /* --- Stepper --- */
    .q-stepper-btn {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }

    /* --- Difficulty Dots --- */
    .diff-dot {
        display: none;
    }

    .diff-pill {
        font-size: 0.78rem;
    }

    /* --- Quiz Playground --- */
    .playground-header h2 {
        font-size: 1.2rem !important;
    }

    .playground-header {
        padding: 1rem !important;
    }

    /* --- Question Cards --- */
    .question-card {
        padding: 1rem;
        border-radius: 14px;
    }

    .question-title {
        font-size: 0.98rem;
        letter-spacing: -0.01em;
    }

    /* --- Option Pills --- */
    .option-pill {
        padding: 0.7rem 0.85rem;
        font-size: 0.84rem;
        border-radius: 10px;
    }

    /* --- Hint Button --- */
    .btn-hint-toggle {
        font-size: 0.85rem;
    }

    /* --- Progress text --- */
    #progress-text,
    #question-counter {
        font-size: 0.78rem;
    }

    /* --- Modal --- */
    .custom-modal-box {
        width: 95%;
        padding: 1.2rem;
    }

    .btn-modal {
        font-size: 0.82rem;
        padding: 0.5rem 1rem;
    }
}