@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@500;600;700&family=Plus+Jakarta+Sans:wght@400;500;600;700&display=swap');

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

button:focus,
button:focus-visible,
a:focus,
a:focus-visible,
input:focus,
input:focus-visible,
textarea:focus,
textarea:focus-visible,
select:focus,
select:focus-visible {
    outline: none;
    -webkit-tap-highlight-color: transparent;
}

:root {
    --bg: #0a0e1a;
    --surface: #111827;
    --surface-2: #1a2234;
    --line: #1e293b;
    --border: rgba(34, 211, 238, 0.12);
    --text: #f1f5f9;
    --text-muted: #64748b;
    --text-light: #94a3b8;
    --cyan: #22d3ee;
    --violet: #a78bfa;
    --green: #34d399;
    --amber: #fbbf24;
    --red: #f87171;
    --grad: linear-gradient(135deg, #22d3ee 0%, #a78bfa 100%);
    --grad-text: linear-gradient(90deg, #22d3ee 0%, #818cf8 55%, #c084fc 100%);
    --h: 64px;

    /* Backward compatibility for old class rules / inline styles */
    --primary-color: var(--cyan);
    --secondary-color: var(--violet);
    --success-color: var(--green);
    --warning-color: var(--amber);
    --danger-color: var(--red);
    --dark-bg: var(--bg);
    --dark-bg-secondary: var(--surface);
    --dark-bg-tertiary: var(--surface-2);
    --glass-color: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(148, 163, 184, 0.24);
    --text-primary: var(--text);
    --text-secondary: var(--text-light);
    --transition: all 0.25s ease;
}

[data-en] {
    display: none;
}

body.lang-en [data-vi] {
    display: none;
}

body.lang-en [data-en] {
    display: inline;
}

body.light-theme {
    --bg: #e5ebf2;
    --surface: #f0f4f9;
    --surface-2: #e4ebf3;
    --line: #c5cfdb;
    --border: rgba(8, 145, 178, 0.12);
    --text: #243547;
    --text-muted: #5c6e83;
    --text-light: #67798f;
    --cyan: #0b6f87;
    --violet: #5a62c8;
    --green: #0f8663;
    --amber: #a66f12;
    --red: #bf4444;
    --grad: linear-gradient(135deg, #0b6f87 0%, #5a62c8 100%);
    --grad-text: linear-gradient(90deg, #0b6f87 0%, #4a55b0 55%, #5a62c8 100%);
    --glass-color: rgba(255, 255, 255, 0.68);
    --glass-border: rgba(8, 145, 178, 0.14);
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.65;
    min-height: 100vh;
    min-height: 100dvh;
    height: 100dvh;
    overflow-x: hidden;
    transition: background 0.35s, color 0.35s;
}

body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(ellipse 70% 55% at 100% 5%, rgba(34, 211, 238, 0.07) 0%, transparent 55%),
        radial-gradient(ellipse 50% 45% at 0% 95%, rgba(167, 139, 250, 0.06) 0%, transparent 55%);
}

body.light-theme::before {
    background:
        radial-gradient(ellipse 70% 55% at 100% 5%, rgba(8, 145, 178, 0.035) 0%, transparent 55%),
        radial-gradient(ellipse 50% 45% at 0% 95%, rgba(124, 58, 237, 0.03) 0%, transparent 55%);
}

a {
    color: var(--cyan);
    text-decoration: none;
}

a:hover {
    color: var(--violet);
}

h1,
h2,
h3,
h4 {
    font-family: 'Space Grotesk', sans-serif;
    letter-spacing: -0.3px;
    color: var(--text);
    margin-bottom: 0.8rem;
}

p {
    color: var(--text-light);
}

.container {
    width: min(1200px, 100% - 2rem);
    margin: 0 auto;
}

body.has-topbar {
    padding-top: calc(var(--h) + 16px);
}

.glassmorphism {
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    border: 1px solid var(--glass-border);
    box-shadow: 0 12px 28px rgba(0, 0, 0, 0.16), inset 0 1px 0 rgba(255, 255, 255, 0.03);
    backdrop-filter: blur(14px);
    border-radius: 16px;
}

/* Shared topbar/footer */
.site-topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: var(--h);
    z-index: 1000;
    background: rgba(10, 14, 26, 0.9);
    border-bottom: 1px solid var(--line);
    backdrop-filter: blur(20px);
}

body.light-theme .site-topbar {
    background: rgba(230, 237, 246, 0.9);
}

.site-topbar-inner {
    width: min(1240px, 100%);
    margin: 0 auto;
    padding: 0 7%;
    min-height: var(--h);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.8rem;
}

.site-brand {
    font-family: 'Space Grotesk', sans-serif;
    font-size: 1.1rem;
    font-weight: 700;
}

.site-brand span {
    background: var(--grad-text);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.site-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: wrap;
}

.site-nav a {
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 600;
    padding: 0.35rem 0.7rem;
    border-radius: 8px;
}

.site-nav a:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--cyan) 12%, transparent);
}

.site-topbar-actions {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    flex-shrink: 0;
}

.account-menu {
    position: relative;
    display: inline-flex;
}

.account-menu-btn {
    border: 1px solid color-mix(in srgb, var(--cyan) 72%, white);
    border-radius: 10px;
    background: linear-gradient(135deg,
            color-mix(in srgb, var(--cyan) 86%, white) 0%,
            color-mix(in srgb, var(--violet) 58%, var(--cyan)) 100%);
    color: #04121f;
    text-shadow: 0 1px 0 rgba(255, 255, 255, 0.4);
    font-weight: 800;
    min-height: 42px;
    padding: 0.5rem 0.8rem;
    cursor: pointer;
    box-shadow:
        0 8px 22px color-mix(in srgb, var(--cyan) 40%, transparent),
        inset 0 1px 0 rgba(255, 255, 255, 0.35);
}

.account-menu-btn:hover {
    border-color: color-mix(in srgb, var(--cyan) 90%, white);
    filter: brightness(1.05);
    box-shadow:
        0 10px 26px color-mix(in srgb, var(--cyan) 50%, transparent),
        inset 0 1px 0 rgba(255, 255, 255, 0.45);
}

body.light-theme .account-menu-btn {
    border-color: color-mix(in srgb, var(--cyan) 50%, #7aa2d6);
    background: linear-gradient(135deg,
            color-mix(in srgb, var(--cyan) 30%, white) 0%,
            color-mix(in srgb, var(--violet) 20%, white) 100%);
    color: #1c3048;
    text-shadow: none;
    box-shadow:
        0 6px 14px rgba(11, 111, 135, 0.16),
        inset 0 1px 0 rgba(255, 255, 255, 0.55);
}

/* ==================== Quick Mobile / Accessibility Fixes ==================== */
:root {
    --bp-sm: 640px;
    --bp-md: 1024px;
}

/* Ensure minimum tap targets and consistent padding */
button,
.btn,
.site-nav a,
.account-menu-btn {
    min-height: 44px;
    min-width: 44px;
    padding: 0.5rem 0.8rem;
    touch-action: manipulation;
}

/* Visible focus for keyboard users */
button:focus,
.btn:focus,
.site-nav a:focus,
.account-menu-btn:focus,
a:focus {
    outline: none;
}

/* Mirror hover to focus/active for accessibility (don't override hover visuals) */
.site-nav a:hover,
.site-nav a:focus,
.site-nav a:active,
.account-menu-btn:hover,
.account-menu-btn:focus,
.account-menu-btn:active,
button:hover,
button:focus,
button:active {
    filter: brightness(1.02);
}

/* Reduce topbar height on small screens to avoid crowding */
@media (max-width: 640px) {
    :root {
        --h: 48px;
    }

    .site-topbar-inner {
        padding: 0 4%;
    }

    body.has-topbar {
        padding-top: calc(var(--h) + 10px);
    }

    .site-nav a {
        font-size: 0.9rem;
        padding: 0.4rem 0.6rem;
    }

    .account-menu-btn {
        min-height: 40px;
        padding: 0.4rem 0.6rem;
    }
}

/* Soften hard min-widths on small screens */
@media (max-width: 760px) {
    [class*="-btn"] {
        min-width: unset;
    }
}

/* Small helper to improve contrast of focus outlines in light theme */

/* End quick fixes */

body.light-theme .account-menu-btn:hover {
    border-color: color-mix(in srgb, var(--cyan) 65%, #6a8fc2);
    filter: brightness(1.02);
    box-shadow:
        0 8px 16px rgba(11, 111, 135, 0.2),
        inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.account-menu-list {
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    min-width: 180px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.24);
    padding: 0.3rem;
    display: none;
    z-index: 1200;
}

.account-menu.is-open .account-menu-list {
    display: block;
}

.account-menu-item {
    display: block;
    width: 100%;
    border: none;
    background: transparent;
    color: var(--text);
    text-align: left;
    padding: 0.55rem 0.65rem;
    border-radius: 8px;
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
}

.account-menu-item:hover {
    background: color-mix(in srgb, var(--cyan) 12%, var(--surface-2));
}

.theme-toggle {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: transparent;
    color: var(--text);
    cursor: pointer;
}

.theme-toggle:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}



.site-footer {
    margin-top: 2.2rem;
    border-top: 1px solid var(--line);
    background: rgba(10, 14, 26, 0.52);
}

body.light-theme .site-footer {
    background: rgba(224, 232, 242, 0.7);
}

.site-footer-inner {
    width: min(1240px, 100%);
    margin: 0 auto;
    padding: 1rem 7%;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.9rem;
    flex-wrap: wrap;
}

.site-footer p {
    margin: 0;
    font-size: 0.82rem;
    color: var(--text-muted);
}

body.light-theme .site-footer p a {
    color: #0b6f87 !important;
    text-shadow: none !important;
}

body.light-theme .site-footer p a:hover {
    color: #4a55b0 !important;
}

.year-glow {
    color: var(--cyan);
    font-weight: 700;
    text-shadow: 0 0 8px color-mix(in srgb, var(--cyan) 70%, transparent);
}

.footer-nav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.95rem;
}

.footer-nav a {
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    text-decoration: none;
    transition: color 0.2s;
}

.footer-nav a:hover {
    color: var(--cyan);
}

/* Buttons */
.btn-start,
.btn-login,
.btn-logout,
.btn-admin,
.btn-select,
.btn-start-quiz,
.btn-next,
.btn-prev,
.btn-submit,
.btn-back,
.btn-import,
.btn-close,
.btn-restart,
.btn-back-dashboard {
    border: 1px solid transparent;
    border-radius: 10px;
    padding: 0.7rem 1.15rem;
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
}

.btn-start,
.btn-login,
.btn-select,
.btn-start-quiz,
.btn-next,
.btn-submit,
.btn-import,
.btn-restart {
    background: var(--grad);
    color: #081018;
    box-shadow: 0 4px 20px rgba(34, 211, 238, 0.2);
}

body.light-theme .btn-start,
body.light-theme .btn-login,
body.light-theme .btn-select,
body.light-theme .btn-start-quiz,
body.light-theme .btn-next,
body.light-theme .btn-submit,
body.light-theme .btn-import,
body.light-theme .btn-restart {
    color: #f8fafc;
    box-shadow: 0 4px 18px rgba(90, 98, 200, 0.16);
}

.btn-back,
.btn-prev,
.btn-back-dashboard,
.btn-close {
    background: transparent;
    border-color: var(--line);
    color: var(--text-light);
}

.btn-logout {
    background: color-mix(in srgb, var(--red) 22%, transparent);
    border-color: color-mix(in srgb, var(--red) 35%, transparent);
    color: var(--red);
}

.btn-admin {
    background: color-mix(in srgb, var(--amber) 20%, transparent);
    border-color: color-mix(in srgb, var(--amber) 35%, transparent);
    color: var(--amber);
}

button:hover:not(:disabled),
.btn-start:hover,
.btn-login:hover,
.btn-select:hover,
.btn-start-quiz:hover,
.btn-next:hover,
.btn-submit:hover,
.btn-import:hover,
.btn-restart:hover,
.btn-back:hover,
.btn-prev:hover,
.btn-back-dashboard:hover,
.btn-close:hover {
    transform: translateY(-2px);
    filter: brightness(1.04);
}

button:disabled {
    opacity: 0.55;
    cursor: not-allowed;
    transform: none;
}

/* Landing */
.landing-page {
    min-height: calc(100vh - 170px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem 0 1rem;
}

.landing-content {
    text-align: center;
    width: 100%;
}

.landing-content h1 {
    font-size: clamp(2.3rem, 6.5vw, 4rem);
    background: var(--grad-text);
    background-clip: text;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    color: var(--text-muted);
    font-size: 1.05rem;
    margin-bottom: 2rem;
}

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

.feature-card {
    padding: 1.25rem;
    border: 1px solid var(--line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface) 85%, transparent);
    transition: border-color 0.22s, transform 0.22s;
}

.feature-card:hover {
    border-color: color-mix(in srgb, var(--cyan) 35%, var(--line));
    transform: translateY(-3px);
}

.feature-card h3 {
    color: var(--cyan);
    font-size: 1rem;
}

.tech-stack {
    margin: 2rem 0;
}

.tech-items {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.55rem;
}

.tech-badge {
    border: 1px solid color-mix(in srgb, var(--cyan) 34%, var(--line));
    border-radius: 999px;
    padding: 0.36rem 0.8rem;
    font-size: 0.8rem;
    color: var(--cyan);
    background: color-mix(in srgb, var(--cyan) 10%, transparent);
}

.btn-start {
    padding: 0.85rem 1.8rem;
}

/* Forms */
.login-page {
    min-height: calc(100vh - 170px);
    display: flex;
    align-items: center;
    justify-content: center;
}

.login-card {
    width: min(460px, 100%);
    padding: 2rem;
}

.login-header {
    text-align: center;
    margin-bottom: 1.25rem;
}

.login-header h1 {
    margin-bottom: 0.25rem;
}

.login-form {
    display: grid;
    gap: 1rem;
}

.form-group {
    display: grid;
    gap: 0.45rem;
}

.form-group label {
    color: var(--text-light);
    font-size: 0.86rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.form-group input,
.form-group select,
.form-group textarea,
.form-control,
.textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: color-mix(in srgb, var(--surface-2) 70%, transparent);
    color: var(--text);
    padding: 0.72rem 0.85rem;
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus,
.form-control:focus,
.textarea:focus {
    outline: none;
    border-color: color-mix(in srgb, var(--cyan) 60%, var(--line));
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--cyan) 15%, transparent);
}

.password-field-wrap {
    position: relative;
    display: flex;
    align-items: center;
    width: 100%;
}

.password-field-wrap input {
    padding-right: 2.8rem;
    min-height: 44px;
}

.password-field-wrap input::-ms-reveal,
.password-field-wrap input::-ms-clear {
    display: none;
}

.password-peek {
    position: absolute;
    top: 50%;
    right: 0.4rem;
    transform: translateY(-50%);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--cyan);
    cursor: pointer;
    user-select: none;
    touch-action: none;
    padding: 0.3rem 0.6rem;
    transition: color 0.2s, background-color 0.2s;
    letter-spacing: 0.02em;
}

.password-peek:focus,
.password-peek:focus-visible,
.password-peek:active {
    outline: none;
    box-shadow: none;
}

.password-peek:hover,
.password-peek:hover:not(:disabled) {
    transform: translateY(-50%);
    filter: none;
    color: var(--cyan);
    background: transparent;
}

.password-peek.is-active,
.password-peek.is-active:hover,
.password-peek.is-active:hover:not(:disabled) {
    color: var(--text-light);
    background: transparent;
}

.btn-unlock-login {
    width: 100%;
    margin: 0.2rem 0 0.35rem;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.62rem 0.9rem;
    font-weight: 700;
    background: transparent;
    color: var(--text-light);
    cursor: pointer;
}

.btn-unlock-login:hover {
    border-color: var(--cyan);
    color: var(--cyan);
}

.error-message {
    min-height: 1.2rem;
    color: var(--red);
    font-weight: 600;
    font-size: 0.85rem;
}

.back-link {
    text-align: center;
    margin-top: 0.9rem;
    font-size: 0.84rem;
}

/* Dashboard + Admin */
.dashboard-page,
.admin-page,
.quiz-page {
    padding: 0.35rem 0 1rem;
}

.dashboard-header,
.admin-header,
.quiz-header {
    padding: 1rem 1.1rem;
    margin-bottom: 1rem;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.header-right {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.user-info {
    color: var(--text);
    font-weight: 700;
    font-size: 1.02rem;
}

.dashboard-content,
.admin-content,
.quiz-content {
    padding: 0.6rem 0;
}

.subjects-grid,
.quiz-list,
.quiz-management {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 1rem;
    margin-top: 0.9rem;
}

.subject-card,
.quiz-card,
.quiz-manage-card,
.stat-card,
.question-card,
.import-section,
.chart-container,
.quiz-stats {
    border: 1px solid var(--line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    transition: border-color 0.2s, transform 0.2s;
}

.subject-card,
.quiz-card,
.quiz-manage-card {
    padding: 1rem;
}

.subject-card:hover,
.quiz-card:hover,
.quiz-manage-card:hover,
.stat-card:hover {
    border-color: color-mix(in srgb, var(--cyan) 40%, var(--line));
    transform: translateY(-2px);
}

.subject-card h3,
.quiz-card h4,

.indicator.is-disabled {
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none;
}

body.quiz-no-back .btn-prev {
    display: none;
}

.section h2 {
    color: var(--cyan);
}

.quiz-desc,
.quiz-time,
.help-text,
.quiz-stats,
.stat-label {
    color: var(--text-light);
}

.empty-state {
    grid-column: 1 / -1;
    text-align: center;
    color: var(--text-muted);
    padding: 1.4rem 1rem;
    border: 1px dashed var(--line);
    border-radius: 12px;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.8rem;
}

.stat-card {
    padding: 1rem;
    text-align: center;
}

.stat-value {
    color: var(--cyan);
    font-size: 1.7rem;
    font-weight: 700;
    margin-top: 0.22rem;
}

.chart-container {
    min-height: 300px;
    padding: 0.85rem;
}

.section {
    margin-bottom: 1.8rem;
}

.import-section {
    padding: 1rem;
}

.textarea {
    min-height: 260px;
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}

.btn-import {
    width: 100%;
    margin-top: 0.6rem;
}

.quiz-stats {
    padding: 1rem;
}

.quiz-stats h3 {
    margin: 0 0 0.8rem;
}

/* Quiz */
.quiz-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.8rem;
    flex-wrap: nowrap;
}

.quiz-header-left {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    flex: 1;
    min-width: 0;
}

.quiz-header-right {
    display: flex;
    align-items: stretch;
    gap: 0.6rem;
    flex-shrink: 0;
}

.quiz-header-left h2 {
    margin: 0;
    line-height: 1.4;
    word-break: break-word;
}

.timer {
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 0.55rem 0.85rem;
    background: color-mix(in srgb, var(--surface-2) 68%, transparent);
    font-weight: 700;
    min-width: 210px;
    max-width: 280px;
    display: grid;
    gap: 0.35rem;
}

.timer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
}

.timer-progress-track {
    width: 100%;
    height: 6px;
    border-radius: 999px;
    overflow: hidden;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface) 65%, transparent);
}

.timer-progress-fill {
    height: 100%;
    width: 100%;
    background: color-mix(in srgb, var(--green) 70%, var(--cyan));
    transition: width 0.35s ease, background 0.35s ease;
}

.timer-value {
    color: var(--cyan);
    font-size: 1.15rem;
    font-family: 'Space Grotesk', monospace;
}

.timer.timer-warning .timer-value {
    color: var(--amber);
}

.timer.timer-warning .timer-progress-fill {
    background: color-mix(in srgb, var(--amber) 72%, #f97316);
}

.timer.timer-critical .timer-value {
    color: var(--red);
    animation: timer-pulse 0.75s ease-in-out infinite;
}

.timer.timer-critical .timer-progress-fill {
    background: color-mix(in srgb, var(--red) 78%, #ef4444);
}

@keyframes timer-pulse {

    0%,
    100% {
        opacity: 1;
    }

    50% {
        opacity: 0.6;
    }
}

.progress-container {
    margin: 0.9rem 0 0.75rem;
}

.progress-bar {
    border-radius: 999px;
    background: color-mix(in srgb, var(--surface-2) 80%, transparent);
    overflow: hidden;
    border: 1px solid var(--line);
    height: 8px;
}

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

.progress-text {
    text-align: center;
    margin-top: 0.35rem;
    color: var(--text-light);
    font-size: 0.88rem;
}

.swiper {
    margin: 0.35rem 0 0.75rem;
}

.swiper-slide {
    display: flex;
    justify-content: center;
    align-items: center;
}

.question-card {
    width: min(900px, 100%);
    padding: 1.5rem;
}

.question-card h3 {
    color: var(--text);
    margin-bottom: 1rem;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.answers {
    display: grid;
    gap: 0.65rem;
}

.answers.grid-mode {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 0.8rem;
    align-items: stretch;
}

.answer-option {
    position: relative;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.85rem 2.8rem 0.85rem 0.85rem;
    border: 1px solid color-mix(in srgb, var(--line) 80%, white 10%);
    border-radius: 11px;
    background: var(--surface-2);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    transition: border-color 0.2s, transform 0.2s, opacity 0.2s, background 0.2s, box-shadow 0.2s;
}

.answer-option:hover {
    border-color: var(--cyan);
    box-shadow: 0 4px 12px color-mix(in srgb, var(--cyan) 15%, transparent);
    transform: translateX(2px);
}

.answer-option input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.answer-option.is-selected {
    border-color: var(--cyan);
    background: color-mix(in srgb, var(--cyan) 15%, var(--surface-2));
    box-shadow: 0 4px 12px color-mix(in srgb, var(--cyan) 25%, transparent);
}

.answer-status-badge {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    width: 1.7rem;
    height: 1.7rem;
    border-radius: 999px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 0.92rem;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0;
}

.answer-option.is-correct {
    border-color: var(--green);
    background: color-mix(in srgb, var(--green) 15%, var(--surface-2));
    box-shadow: 0 4px 12px color-mix(in srgb, var(--green) 25%, transparent);
}

.answer-option.is-correct .answer-status-badge {
    display: flex;
    background: color-mix(in srgb, var(--green) 90%, #0f172a);
}

.answer-option.is-wrong {
    border-color: var(--red);
    background: color-mix(in srgb, var(--red) 15%, var(--surface-2));
    box-shadow: 0 4px 12px color-mix(in srgb, var(--red) 25%, transparent);
}

.answer-option.is-wrong .answer-status-badge {
    display: flex;
    background: color-mix(in srgb, var(--red) 90%, #0f172a);
}

.option-prefix {
    font-weight: 700;
    font-size: 1.05rem;
    color: var(--cyan);
}

.quiz-inline-image {
    display: block;
    width: min(100%, 560px);
    margin-top: 0.55rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-2) 60%, transparent);
    object-fit: contain;
}

.answers.grid-mode .answer-option {
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
    text-align: left;
    padding: 0.9rem 2.6rem 0.9rem 0.55rem;
    aspect-ratio: auto;
    height: 100%;
    gap: 0.4rem;
}

.answers.grid-mode .answer-status-badge {
    top: 0.42rem;
    right: 0.42rem;
}

.answers.grid-mode .answer-option input[type="radio"] {
    margin: 0;
}

.answers.grid-mode .option-text {
    display: block;
    width: 100%;
    max-height: none;
    overflow: visible;
    word-break: break-word;
}

.option-text {
    color: var(--text);
    font-weight: 500;
    font-size: 1.05rem;
    line-height: 1.5;
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.question-card h3 code,
.option-text code {
    white-space: normal;
    overflow-wrap: anywhere;
    word-break: break-all;
}

.quiz-image-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    border: 1px solid color-mix(in srgb, var(--cyan) 48%, var(--line));
    border-radius: 999px;
    background: color-mix(in srgb, var(--cyan) 14%, var(--surface-2));
    color: var(--cyan);
    font-weight: 700;
    font-size: 0.85rem;
    padding: 0.3rem 0.75rem;
    margin-left: 0.3rem;
    cursor: pointer;
}

.quiz-image-button:hover {
    background: color-mix(in srgb, var(--cyan) 20%, var(--surface-2));
    border-color: color-mix(in srgb, var(--cyan) 62%, var(--line));
}

.quiz-image-viewer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7, 10, 20, 0.74);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10060;
    padding: 1rem;
}

.quiz-image-viewer-overlay.is-open {
    display: flex;
}

.quiz-image-viewer {
    width: min(1100px, 95vw);
    max-height: 92vh;
    border-radius: 16px;
    border: 1px solid color-mix(in srgb, var(--line) 72%, rgba(255, 255, 255, 0.12));
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: 0 24px 50px rgba(0, 0, 0, 0.35);
    display: grid;
    grid-template-rows: auto minmax(0, 1fr) auto;
    overflow: hidden;
}

.quiz-image-viewer-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.8rem 1rem;
    border-bottom: 1px solid var(--line);
}

.quiz-image-viewer-head h3 {
    margin: 0;
    font-size: 1rem;
}

.quiz-image-viewer-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-2) 72%, transparent);
    color: var(--text);
    cursor: pointer;
}

.quiz-image-viewer-body {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.8rem;
    min-height: 0;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
}

.quiz-image-viewer-body img {
    max-width: 100%;
    max-height: 74vh;
    object-fit: contain;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-2) 66%, transparent);
}

.quiz-image-viewer-caption {
    margin: 0;
    padding: 0.65rem 1rem 0.85rem;
    color: var(--text-light);
    font-size: 0.88rem;
    border-top: 1px solid var(--line);
}

.feedback {
    margin-top: 0.8rem;
    padding: 0.65rem 0.85rem;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 700;
}

.feedback.correct {
    border: 1px solid color-mix(in srgb, var(--green) 40%, transparent);
    background: color-mix(in srgb, var(--green) 18%, transparent);
    color: var(--green);
}

.feedback.incorrect {
    border: 1px solid color-mix(in srgb, var(--red) 40%, transparent);
    background: color-mix(in srgb, var(--red) 18%, transparent);
    color: var(--red);
}

.feedback.warning {
    border: 1px solid color-mix(in srgb, var(--amber) 45%, transparent);
    background: color-mix(in srgb, var(--amber) 16%, transparent);
    color: var(--amber);
}



.quiz-navigation {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.6rem;
    margin-top: 0.9rem;
}

.quiz-navigation .btn-prev,
.quiz-navigation .btn-next,
.quiz-navigation .btn-submit {
    flex: 1;
}

.btn-question-list {
    background: color-mix(in srgb, var(--cyan) 10%, transparent);
    color: var(--cyan);
    border: 1px solid var(--cyan);
    padding: 0.55rem 0.85rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
}

@media (hover: hover) {
    .btn-question-list:hover {
        background: var(--cyan);
        color: #000;
    }
}
.btn-question-list:active {
    background: var(--cyan);
    color: #000;
}

.question-grid-modal {
    width: min(800px, 95vw);
    max-height: 85vh;
    display: flex;
    flex-direction: column;
}

.question-grid-body {
    padding: 1.2rem;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
    gap: 0.8rem;
    scrollbar-width: thin;
    scrollbar-color: color-mix(in srgb, var(--surface-2) 80%, transparent) transparent;
}

.question-grid-body::-webkit-scrollbar {
    width: 6px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: color-mix(in srgb, var(--surface-2) 80%, transparent);
    border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--cyan);
}

.question-grid-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 0.4rem;
    border-radius: 10px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-2) 70%, transparent);
    color: var(--text);
    font-weight: 600;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s;
}

.question-grid-item:hover {
    border-color: var(--cyan);
    background: color-mix(in srgb, var(--cyan) 10%, var(--surface-2));
}

.question-grid-item.answered {
    border-color: color-mix(in srgb, var(--green) 50%, transparent);
    background: color-mix(in srgb, var(--green) 20%, transparent);
    color: var(--green);
}

.question-grid-item.is-flagged {
    border-color: color-mix(in srgb, var(--amber) 50%, transparent);
    background: color-mix(in srgb, var(--amber) 20%, transparent);
    color: var(--amber);
}

.question-grid-item.answered.is-flagged {
    border-color: color-mix(in srgb, var(--amber) 50%, transparent);
    background: linear-gradient(135deg, color-mix(in srgb, var(--green) 20%, transparent), color-mix(in srgb, var(--amber) 20%, transparent));
    color: var(--amber);
}

.question-grid-item.active {
    border-color: var(--cyan);
    background: color-mix(in srgb, var(--cyan) 30%, transparent);
    color: var(--cyan);
    font-weight: 800;
    transform: scale(1.05);
}

.question-grid-item.is-disabled {
    cursor: not-allowed;
    opacity: 0.5;
    pointer-events: none;
}

.quiz-dialog-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7, 10, 20, 0.64);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    padding: 1rem;
}

.quiz-dialog-overlay.is-open {
    display: flex;
}

.quiz-dialog {
    width: min(520px, 95vw);
    border-radius: 18px;
    border: 1px solid color-mix(in srgb, var(--line) 60%, rgba(255, 255, 255, 0.12));
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.28);
    padding: 1.2rem 1.2rem 1rem;
    color: var(--text);
}

.quiz-dialog-title {
    margin: 0;
    font-size: 1.05rem;
    font-weight: 700;
}

.quiz-dialog-message {
    margin: 0.85rem 0 1.15rem;
    white-space: pre-line;
    line-height: 1.5;
    color: var(--text-light);
}

.quiz-dialog-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.7rem;
}

.quiz-dialog-btn {
    border: none;
    border-radius: 10px;
    padding: 0.6rem 1rem;
    cursor: pointer;
    font-weight: 700;
}

.quiz-dialog-btn.primary {
    background: linear-gradient(135deg, #37d4ff, #4f7dff);
    color: #04121f;
}

.quiz-dialog-btn.ghost {
    background: color-mix(in srgb, var(--surface-2) 82%, transparent);
    color: var(--text);
    border: 1px solid var(--line);
}

.quiz-dialog-btn.ghost:hover {
    background: color-mix(in srgb, var(--surface-2) 62%, transparent);
}

body.light-theme .quiz-dialog-overlay {
    background: rgba(15, 23, 42, 0.32);
}

.fullscreen-prompt-overlay {
    position: fixed;
    inset: 0;
    background: rgba(7, 10, 20, 0.64);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 10050;
    padding: 1rem;
}

.fullscreen-prompt-overlay.is-open {
    display: flex;
}

.fullscreen-prompt-modal {
    width: min(520px, 95vw);
    border-radius: 18px;
    border: 1px solid color-mix(in srgb, var(--line) 60%, rgba(255, 255, 255, 0.12));
    background: color-mix(in srgb, var(--surface) 94%, transparent);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.28);
    padding: 1.2rem;
    text-align: center;
}

.fullscreen-prompt-title {
    margin: 0 0 0.75rem;
    color: var(--text);
    font-size: 1.05rem;
    font-weight: 700;
}

.fullscreen-prompt-message {
    margin: 0 0 1rem;
    color: var(--text-light);
    line-height: 1.5;
}

.fullscreen-prompt-btn {
    border: none;
    border-radius: 10px;
    padding: 0.7rem 1rem;
    cursor: pointer;
    font-weight: 700;
    background: linear-gradient(135deg, #37d4ff, #4f7dff);
    color: #04121f;
}

body.light-theme .fullscreen-prompt-overlay {
    background: rgba(15, 23, 42, 0.32);
}

/* Admin switches */
.toggle-group {
    margin: 0.5rem 0;
}

.toggle-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-light);
    font-size: 0.86rem;
}

.toggle-switch {
    appearance: none;
    width: 48px;
    height: 28px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: color-mix(in srgb, var(--surface-2) 74%, transparent);
    position: relative;
    cursor: pointer;
}

.toggle-switch::before {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--text);
    transition: transform 0.2s;
}

.toggle-switch:checked {
    background: color-mix(in srgb, var(--green) 36%, transparent);
    border-color: color-mix(in srgb, var(--green) 50%, transparent);
}

.toggle-switch:checked::before {
    transform: translateX(20px);
}

.toggle-slider {
    display: none;
}

/* Loader + helper */
.skeleton-loader {
    min-height: 140px;
    border-radius: 12px;
    border: 1px solid var(--line);
    background: linear-gradient(110deg,
            color-mix(in srgb, var(--surface-2) 65%, transparent) 8%,
            color-mix(in srgb, var(--surface) 80%, transparent) 18%,
            color-mix(in srgb, var(--surface-2) 65%, transparent) 33%);
    background-size: 200% 100%;
    animation: shimmer 1.35s linear infinite;
}

@keyframes shimmer {
    to {
        background-position-x: -200%;
    }
}

.spinner {
    width: 20px;
    height: 20px;
    border: 3px solid color-mix(in srgb, var(--cyan) 24%, transparent);
    border-top-color: var(--cyan);
    border-radius: 999px;
    animation: spin 0.7s linear infinite;
}

.spinner.hidden {
    display: none;
}

.loading-overlay {
    position: fixed;
    inset: 0;
    display: none;
    align-items: center;
    justify-content: center;
    background: rgba(7, 10, 20, 0.62);
    backdrop-filter: blur(2px);
    z-index: 11000;
}

.loading-overlay.is-visible {
    display: flex;
}

.loading-modal {
    width: min(300px, 90vw);
    border: 1px solid var(--line);
    border-radius: 14px;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    box-shadow: 0 22px 44px rgba(0, 0, 0, 0.3);
    padding: 1.2rem;
    display: grid;
    place-items: center;
    gap: 0.55rem;
}

.loading-modal .spinner {
    width: 44px;
    height: 44px;
    border-width: 4px;
}

.loading-modal p {
    margin: 0;
    color: var(--text-light);
    font-size: 0.9rem;
    text-align: center;
}

body.light-theme .loading-overlay {
    background: rgba(28, 37, 49, 0.22);
    backdrop-filter: blur(3px);
}

body.light-theme .loading-modal {
    background: color-mix(in srgb, var(--surface) 96%, white);
    border-color: color-mix(in srgb, var(--line) 82%, white);
    box-shadow: 0 18px 36px rgba(31, 41, 55, 0.14);
}

body.light-theme .loading-modal .spinner {
    border-color: color-mix(in srgb, var(--cyan) 18%, transparent);
    border-top-color: var(--cyan);
}

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

/* Hash helper page */
.hash-output-container {
    margin-top: 1rem;
    display: grid;
    gap: 0.6rem;
}

.hash-output {
    width: 100%;
    min-height: 140px;
    border-radius: 10px;
    border: 1px solid var(--line);
    padding: 0.8rem;
    background: color-mix(in srgb, var(--surface-2) 70%, transparent);
    color: var(--text);
    font-family: 'JetBrains Mono', 'Courier New', monospace;
}

.btn-copy {
    width: 100%;
}

/* Responsive */
@media (max-width: 980px) {
    body.has-topbar {
        padding-top: 92px;
    }

    .site-topbar {
        height: auto;
    }

    .site-topbar-inner {
        padding: 0.6rem 5%;
        min-height: 0;
        flex-wrap: wrap;
        justify-content: center;
    }

    .site-nav {
        justify-content: center;
    }

    .site-topbar-actions {
        gap: 0.25rem;
    }

    .header-content,
    .header-right,
    .quiz-header {
        justify-content: center;
    }

    .quiz-header-left h2 {
        text-align: center;
    }
}

@media (max-width: 768px) {
    body.quiz-player-page.has-topbar {
        padding-top: 0;
    }

    body.quiz-player-page .site-topbar,
    body.quiz-player-page .site-footer {
        display: none;
    }

    .quiz-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }

    .quiz-header-left, .quiz-header-right {
        width: 100%;
    }

    .quiz-header-right {
        justify-content: space-between;
    }

    .quiz-header-left h2 {
        text-align: left;
    }

    .container {
        width: min(1200px, 100% - 1rem);
    }

    .answers.grid-mode {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .answers.grid-mode .answer-option {
        height: auto;
    }



    h1 {
        font-size: 1.8rem;
    }

    h2 {
        font-size: 1.3rem;
    }

    .features,
    .subjects-grid,
    .quiz-list,
    .quiz-management,
    .stats-grid {
        grid-template-columns: 1fr;
    }

    .login-card,
    .question-card,
    .import-section {
        padding: 1rem;
    }

    .quiz-page {
        display: flex;
        flex-direction: column;
        min-height: calc(100vh - var(--h) - 16px);
    }

    body.quiz-player-page .quiz-page {
        min-height: 100vh;
    min-height: 100dvh;
    height: 100dvh;
        padding-top: 0;
    }

    .quiz-content {
        flex: 1;
        overflow-y: auto;
        padding-bottom: 1rem;
    }

    .quiz-navigation {
        position: relative;
        width: 100%;
        padding: 0;
        margin-top: 0.85rem;
        gap: 0.5rem;
    }

    .btn-prev,
    .btn-next,
    .btn-submit {
        width: 100%;
        flex: 1;
        padding: 0.6rem 0.3rem;
        font-size: 0.85rem;
    }

    .question-indicator {
        margin-bottom: 1.5rem;
    }

    .swiper-slide {
        height: auto !important;
    }
}

html:fullscreen,
html:-webkit-full-screen,
html:-moz-full-screen,
html:-ms-fullscreen {
    overflow-y: auto;
}

html:fullscreen body,
html:-webkit-full-screen body,
html:-moz-full-screen body,
html:-ms-fullscreen body {
    min-height: 100vh;
    min-height: 100dvh;
    height: 100dvh;
    overflow-y: auto;
}

@media (max-width: 480px) {
    .site-footer-inner {
        justify-content: center;
        text-align: center;
        padding: 1rem 5%;
    }

    .timer {
        width: 100%;
        text-align: center;
        justify-content: center;
    }

    .timer-head {
        justify-content: center;
        flex-wrap: wrap;
    }

    .quiz-image-viewer {
        width: 98vw;
        max-height: 90vh;
    }

    .quiz-image-viewer-body {
        padding: 0.6rem;
    }
}

@media print {
    body {
        display: none !important;
    }

    html::after {
        content: "TsByin Exam: Khong duoc phep in hoac luu tru bai thi!";
        display: flex;
        align-items: center;
        justify-content: center;
        height: 100vh;
    height: 100dvh;
        font-size: 2rem;
        font-weight: bold;
        color: red;
    }
}

/* ==================== Report Error Feature ==================== */
.question-title-wrapper {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 0.8rem;
}

.question-title-wrapper h3 {
    margin-bottom: 0;
    flex: 1;
}

.btn-report-error {
    background: color-mix(in srgb, var(--amber) 10%, transparent);
    color: var(--amber);
    border: 1px solid var(--amber);
    padding: 0.55rem 0.85rem;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
}
@media (hover: hover) {
    .btn-report-error:hover {
        background: var(--amber);
        color: #000;
    }
}
.btn-report-error:active {
    background: var(--amber);
    color: #000;
}

.report-error-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(8px);
    z-index: 2000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.report-error-overlay.is-open {
    opacity: 1;
    visibility: visible;
}

.report-error-modal {
    background: color-mix(in srgb, var(--surface) 90%, transparent);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    padding: 1.8rem;
    width: min(90%, 450px);
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.2);
    transform: translateY(20px);
    transition: transform 0.3s;
}

.report-error-overlay.is-open .report-error-modal {
    transform: translateY(0);
}

.report-error-title {
    color: var(--amber);
    margin-bottom: 0.5rem;
}

/* Modal Utilities */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 1;
    visibility: visible;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal.hidden {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.modal-content {
    background: var(--surface);
    padding: 2rem;
    border-radius: 16px;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
    transform: translateY(0) scale(1);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    border: 1px solid var(--line);
    position: relative;
    max-width: 90%;
    width: 400px;
    margin: 0 auto;
}

.modal.hidden .modal-content {
    transform: translateY(20px) scale(0.95);
}

.report-error-message {
    color: var(--text-light);
    font-size: 0.9rem;
    margin-bottom: 1.2rem;
}

.report-label {
    display: block;
    color: var(--text);
    font-size: 0.9rem;
    margin-bottom: 0.4rem;
    font-weight: 600;
}

.report-select,
.report-textarea {
    width: 100%;
    background: color-mix(in srgb, var(--surface-2) 60%, transparent);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    padding: 0.6rem;
    font-family: inherit;
    margin-bottom: 1rem;
    transition: border-color 0.2s;
}

/* Custom Dropdown UI */
.custom-dropdown {
    position: relative;
    width: 100%;
    margin-bottom: 1rem;
}
.custom-dropdown-selected {
    background: color-mix(in srgb, var(--surface-2) 60%, transparent);
    border: 1px solid var(--line);
    border-radius: 8px;
    color: var(--text);
    padding: 0.6rem;
    cursor: pointer;
    user-select: none;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: border-color 0.2s;
}
.custom-dropdown-selected:hover {
    border-color: var(--amber);
}
.custom-dropdown-selected::after {
    content: "▼";
    font-size: 0.7rem;
    color: var(--text-light);
}
.custom-dropdown-options {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface-2);
    border: 1px solid var(--line);
    border-radius: 8px;
    z-index: 99;
    margin-top: 4px;
    max-height: 200px;
    overflow-y: auto;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
}
.custom-dropdown-options.show {
    display: block;
}
.custom-dropdown-options div {
    padding: 0.6rem;
    cursor: pointer;
    transition: background 0.2s;
}
.custom-dropdown-options div:hover {
    background: color-mix(in srgb, var(--cyan) 15%, transparent);
    color: var(--cyan);
}

.report-select:focus,
.report-textarea:focus,
.custom-dropdown-selected.open {
    outline: none;
    border-color: var(--amber);
}

.report-textarea {
    resize: vertical;
    min-height: 80px;
}

.report-error-actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.8rem;
    margin-top: 0.5rem;
}

.btn-cancel {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--text-light);
    border-radius: 8px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.2s;
}

.btn-cancel:hover {
    color: var(--text);
    background: color-mix(in srgb, var(--line) 30%, transparent);
}

.btn-submit-report {
    background: var(--amber);
    color: #000;
    border: none;
    border-radius: 8px;
    padding: 0.5rem 1rem;
    cursor: pointer;
    font-weight: 700;
    transition: all 0.2s;
}

.btn-submit-report:hover:not(:disabled) {
    filter: brightness(1.1);
    transform: translateY(-2px);
}

.btn-submit-report:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

body.light-theme .report-error-modal {
    background: color-mix(in srgb, var(--surface) 95%, transparent);
}

body.light-theme .report-select,
body.light-theme .report-textarea,
body.light-theme .custom-dropdown-selected,
body.light-theme .custom-dropdown-options {
    background: color-mix(in srgb, var(--surface-2) 80%, transparent);
}

/* Custom Scrollbar Global */
::-webkit-scrollbar {
    width: 6px;
    height: 6px;
}

::-webkit-scrollbar-track {
    background: rgba(0, 0, 0, 0.1);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.3);
}

* {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.2) rgba(0, 0, 0, 0.1);
}

/* === FINAL MOBILE QUIZ HEADER FIX (single source of truth) === */
@media (max-width:768px){
  body.quiz-player-page .quiz-header{
    display:flex !important;
    flex-direction:row !important;
    align-items:center !important;
    justify-content:space-between !important;
    flex-wrap:nowrap !important;
    gap:.45rem !important;
  }
  body.quiz-player-page .quiz-header-left{
    flex:0 0 auto !important;
    width:auto !important;
    min-width:0 !important;
    margin:0 !important;
    display:flex !important;
    flex-direction:row !important;
    align-items:center !important;
  }
  body.quiz-player-page .quiz-header-right{
    flex:1 1 auto !important;
    width:auto !important;
    min-width:0 !important;
    margin:0 !important;
    display:flex !important;
    flex-direction:row !important;
    align-items:center !important;
    justify-content:flex-end !important;
    flex-wrap:nowrap !important;
    gap:.4rem !important;
  }
  /* An title de giu 1 hang tren mobile */
  body.quiz-player-page .quiz-header-left h2,
  body.quiz-player-page .quiz-header-left #quizTitle{
    display:none !important;
  }
  body.quiz-player-page .btn-back,
  body.quiz-player-page #btnQuestionList{
    flex:0 0 auto !important;
    min-width:auto !important;
    min-height:32px !important;
    margin:0 !important;
    padding:.42rem .54rem !important;
    font-size:.76rem !important;
    line-height:1 !important;
    white-space:nowrap !important;
  }
  body.quiz-player-page .timer{
    flex:0 0 auto !important;
    width:auto !important;
    min-width:82px !important;
    max-width:96px !important;
    margin:0 !important;
    padding:.34rem .42rem !important;
    gap:.2rem !important;
  }
  body.quiz-player-page .timer .timer-label{ display:none !important; }
  body.quiz-player-page .timer .timer-head{
    display:flex !important;
    align-items:center !important;
    justify-content:center !important;
    gap:0 !important;
    flex-wrap:nowrap !important;
  }
  body.quiz-player-page .timer .timer-value{
    font-size:.84rem !important;
    line-height:1 !important;
    font-weight:700 !important;
  }
  body.quiz-player-page .timer .timer-progress-track{ height:4px !important; }
}
@media (max-width:480px){
  body.quiz-player-page .timer{
    width:auto !important;
    min-width:78px !important;
    max-width:90px !important;
    padding:.3rem .38rem !important;
  }
  body.quiz-player-page .btn-back,
  body.quiz-player-page #btnQuestionList,
  body.quiz-player-page #btnHeaderReport {
    padding: .35rem .45rem !important;
    font-size: .72rem !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 0.2rem !important;
    min-height: 28px !important; /* Use min-height instead of fixed height */
  }
  body.quiz-player-page .timer .timer-value{ font-size:.8rem !important; }
}

/* ================== Flag Button ================== */
.btn-flag {
    background: transparent;
    border: 1px solid var(--line);
    color: var(--text-light);
    border-radius: 8px;
    padding: 0.6rem 0.9rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-flag:hover {
    border-color: var(--amber);
    color: var(--amber);
}

.btn-flag.active {
    background: color-mix(in srgb, var(--amber) 20%, transparent);
    border-color: var(--amber);
    color: var(--amber);
}