/* =====================================================================
   mobile.css — phone scrolling, video controls and general touch comfort.
   Load it LAST (after motion.css):
       <link rel="stylesheet" href="/css/mobile.css">
   Delete that <link> to switch it off. Desktop is untouched (everything
   here sits inside phone/tablet media queries, except the range-input
   touch rules which only matter for fingers).
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. SCROLLING — one page, one scroll, no traps
   --------------------------------------------------------------------- */
@media (max-width: 1023px), (pointer: coarse) {

    /* Smooth-scroll on a phone just makes the page feel like it lags behind
       your finger. Native, instant momentum scrolling is what you want. */
    html, body, #workspace-view-scroll, .overflow-y-auto, .overflow-x-auto, .overflow-auto {
        scroll-behavior: auto !important;
    }

    /* motion.css set overscroll-behavior: contain on every scrolling box, which
       stops the page from taking over when a small box reaches its end — the
       "stuck" feeling. Let the gesture hand over to the page again. */
    html { overscroll-behavior-y: auto !important; }
    #workspace-view-scroll, .overflow-y-auto, .overflow-x-auto, .overflow-auto {
        overscroll-behavior: auto !important;
    }
    /* …but a popup should never scroll the page behind it */
    .modal-root > div, .glass-modal { overscroll-behavior: contain !important; }

    /* The portal content is the page itself. The inner scroller used to be a
       second scroll area inside the page. */
    #portal-section > main.glass-main-panel { overflow: visible !important; }
    #workspace-view-scroll {
        overflow: visible !important;
        padding: 12px 10px calc(28px + env(safe-area-inset-bottom)) !important;
    }

    /* Lists that were capped to 180-380px with their own scrollbar: with a
       finger these are traps (you start a swipe on one and the page won't
       move). On a phone they just flow down the page. */
    #feedback-list, #video-sessions-list, #bookmarks-list-container,
    #admin-lectures-list, #vidpriv-codes-list, #admin-students-list,
    #liked-users-list, #stats-lectures-breakdown {
        max-height: none !important;
        overflow: visible !important;
    }

    /* Always-on will-change keeps every tab as a giant GPU layer. */
    .view-panel { will-change: auto !important; backface-visibility: visible !important; }

    /* Backgrounds that are repainted on every scroll frame */
    body, .light-theme body, .light-theme #login-section { background-attachment: scroll !important; }
    [class*="backdrop-blur"] { -webkit-backdrop-filter: none !important; backdrop-filter: none !important; }

    /* Cards must not be a tap/scroll handler of their own */
    .glass-card, .glass-panel { touch-action: pan-y; }
    .m-pressed { transition: transform .1s ease-out !important; }

    /* Chat, AI board and the room list are real scroll areas — keep them
       scrollable but let them pass the gesture on at the ends. */
    #chat-messages-list, #chat-room-list, #ai-chat-board { -webkit-overflow-scrolling: touch; overscroll-behavior: auto; }
}

/* ---------------------------------------------------------------------
   2. NAVIGATION — only the tab pills stay on screen, not the whole header
   --------------------------------------------------------------------- */
@media (max-width: 767px) {
    /* The old sticky <aside> (profile + AI button + tabs) took ~130px of every
       screen while scrolling. Let its two parts be separate blocks so only
       the tab pills stick. */
    .glass-sidebar {
        display: contents !important;
        position: static !important;
    }
    .glass-sidebar > div:first-child {
        background: var(--bg-panel, rgba(14, 18, 36, .9));
        border: 1px solid var(--border-glass, rgba(255, 255, 255, .09));
        border-radius: 16px;
        margin: 0 !important;
    }
    .glass-sidebar > nav {
        position: sticky !important;
        top: max(6px, env(safe-area-inset-top));
        z-index: 60;
        background: #0b1020 !important;
        border: 1px solid rgba(255, 255, 255, .1);
        border-radius: 16px;
        box-shadow: 0 8px 22px -8px rgba(0, 0, 0, .6);
        margin: 0 !important;
        -webkit-overflow-scrolling: touch;
        touch-action: pan-x pan-y;
    }
    .light-theme .glass-sidebar > nav { background: #ffffff !important; border-color: #cbd5e1; box-shadow: 0 8px 22px -10px rgba(15, 23, 42, .25); }
    .light-theme .glass-sidebar > div:first-child { background: #fff; border-color: #cbd5e1; }
    .glass-sidebar > nav .nav-btn { min-height: 44px; }
}

/* ---------------------------------------------------------------------
   3. READABLE + TAPPABLE on phones
   --------------------------------------------------------------------- */
@media (max-width: 767px) {
    /* iOS zooms the whole page when you tap an input smaller than 16px,
       and then you have to pinch back out. 16px stops that. */
    input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]),
    select, textarea { font-size: 16px !important; }

    /* The old rules shrank body text to 11-12px. Back to comfortable. */
    p { font-size: 14px !important; line-height: 1.6 !important; }
    [class*="text-[8px]"], [class*="text-[9px]"], [class*="text-[10px]"] { font-size: 11px !important; }
    [class*="text-[11px]"], .text-xs { font-size: 12.5px !important; }
    .text-sm { font-size: 14px !important; }

    /* Fat-finger targets */
    button, [role="button"], select, .interactive-btn { min-height: 44px; }
    .nav-btn { font-size: 12px !important; padding: 10px 14px !important; }
    #toast-container { left: 10px !important; right: 10px !important; bottom: calc(12px + env(safe-area-inset-bottom)) !important; }

    /* Sheets/modals use the real visible height (address bar aware) */
    .modal-root > div, .glass-modal { max-height: 92dvh !important; padding-bottom: calc(18px + env(safe-area-inset-bottom)); }

    /* Nothing may push the page sideways */
    #portal-section, #portal-section > main, #workspace-view-scroll, .view-panel { max-width: 100vw; }
    img, video, iframe, canvas, svg { max-width: 100%; }
    table { display: block; overflow-x: auto; -webkit-overflow-scrolling: touch; }
    pre, code { overflow-x: auto; max-width: 100%; }

    /* Voice-assistant button must not sit on top of the content you read */
    #va-mic-btn.va-fab { bottom: calc(18px + env(safe-area-inset-bottom)) !important; right: 14px !important; width: 52px !important; height: 52px !important; }

    /* Tutoring / chat fixed-height boxes: use the screen, not a fixed vh */
    .h-\[68vh\] { height: calc(100dvh - 190px) !important; min-height: 420px; }
    .h-\[calc\(100vh-12rem\)\] { height: calc(100dvh - 12rem) !important; }
}

/* ---------------------------------------------------------------------
   4. VIDEO PLAYER — big, high-contrast, finger-sized controls
   --------------------------------------------------------------------- */

/* Sliders: the finger scrolls the slider, never the page */
.vc-range { touch-action: none; }

@media (hover: none), (max-width: 767px) {
    /* the seek thumb is always visible on touch (there is no hover) */
    .vc-seek::-webkit-slider-thumb { opacity: 1 !important; width: 20px; height: 20px; margin-top: -7.5px !important;
        box-shadow: 0 0 0 5px rgba(129, 140, 248, .5), 0 2px 8px rgba(0, 0, 0, .6); }
    .vc-seek::-moz-range-thumb { opacity: 1 !important; width: 20px; height: 20px; }
    .vc-range::-webkit-slider-runnable-track { height: 6px; }
    .vc-seekwrap { height: 36px; }
    .vc-seek { height: 36px; }
    .vc-seekwrap::before, .vc-buf { height: 6px; margin-top: -3px; }
}

@media (max-width: 767px) {
    #video-theater { overflow: hidden; }

    .vc-bar {
        left: 4px; right: 4px; bottom: 4px;
        padding: 0 10px 6px;
        border-radius: 16px;
        /* solid enough to read on any picture, no blur cost */
        background: rgba(6, 10, 22, .88);
        -webkit-backdrop-filter: none; backdrop-filter: none;
        border: 1px solid rgba(255, 255, 255, .16);
    }
    .vc-row { gap: 2px; flex-wrap: nowrap; }
    .vc-btn { min-width: 42px; height: 42px; padding: 0 6px; color: #fff; font-size: 13px; }
    .vc-btn svg { width: 24px; height: 24px; stroke-width: 2.4; filter: drop-shadow(0 1px 2px rgba(0, 0, 0, .7)); }
    .vc-main { width: 50px; min-width: 50px; height: 50px; margin-right: 2px; }
    .vc-main svg { width: 26px; height: 26px; }
    .vc-time { font-size: 12px; padding: 0 4px; color: #fff; font-weight: 800; }

    /* Phones already have a hardware volume rocker */
    .vc-vol { display: none !important; }

    .vc-speed-btn { background: rgba(255, 255, 255, .16); min-width: 48px; font-size: 13px; }
    #vc-quality-wrap { display: none !important; }

    /* Speed menu: big rows that open upward from the bar */
    .vc-menu { bottom: 54px; min-width: 100px; padding: 6px; background: rgba(6, 10, 22, .98); }
    .vc-menu button { padding: 0 14px; min-height: 44px; font-size: 15px; display: flex; align-items: center; }

    .vc-tip { bottom: 40px; font-size: 13px; padding: 5px 9px; }
    .vc-top { padding: 10px 12px 26px; }
    .vc-title { font-size: 13px; }

    .vc-skip { width: 92px; height: 92px; margin-top: -46px; }
    .vc-skip span { font-size: 13px; }

    #vc-native-fs { width: 46px; height: 46px; top: 8px; right: 8px; background: rgba(6, 10, 22, .78); }
    #vc-native-fs svg { width: 24px; height: 24px; }
}

/* very narrow phones: drop the skip buttons (double-tap on the picture still skips) */
@media (max-width: 359px) {
    #vc-back, #vc-fwd { display: none; }
}

/* landscape phone: the video uses the full height instead of a thin strip */
@media (max-width: 950px) and (orientation: landscape) and (max-height: 520px) {
    #video-theater:not(:fullscreen):not(.vc-pseudo-fs) {
        width: min(100%, calc((100dvh - 16px) * 16 / 9)) !important;
        margin-left: auto; margin-right: auto;
    }
    .vc-bar { padding-bottom: 2px; }
    .vc-btn { height: 38px; }
    .vc-main { height: 44px; min-width: 44px; width: 44px; }
}

/* fullscreen on a phone: sit clear of the notch / home bar */
#video-theater:fullscreen .vc-bar, #video-theater.vc-pseudo-fs .vc-bar {
    left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
}

/* =====================================================================
   5. PHONE PERFORMANCE — stop paying for effects nobody can see
   ===================================================================== */
@media (max-width: 1023px), (pointer: coarse) {

    /* Looping decorative animations keep the GPU busy forever.
       (loading spinners and the voice assistant are NOT in this list) */
    .animate-pulse, .animate-ping, .animate-bounce, .gentle-float, .empty-state-float,
    .premium-glow, .premium-glow::before, .xp-shine, #dashboard-xp-progress-bar::after,
    .nav-btn::before, .nav-btn::after, .glass-card::before, .glass-card::after,
    .glass-panel::before, .glass-panel::after, .glass-sidebar::before, .glass-sidebar::after,
    #profile-avatar, #login-logo, .marquee-container > *, .text-shimmer, .border-shimmer,
    #dashboard-leaderboard-grid > div::after {
        animation: none !important;
    }
    body::before, body::after, .bg-blob-indigo, .bg-blob-cyan, .bg-blob-purple, .bg-blob-rose, .bg-blob-teal {
        animation: none !important; display: none !important;
    }
    #fluid-canvas, #cursor-particles, #custom-cursor, .touch-ripple { display: none !important; }

    /* Big soft shadows are re-rasterised while scrolling. Flat, cheap edge instead. */
    html:not(.zz):not(.zzz) .glass-card, html:not(.zz):not(.zzz) .glass-panel,
    html:not(.zz):not(.zzz) .glass-modal, html:not(.zz):not(.zzz) .glass-main-panel,
    html:not(.zz):not(.zzz) .glass-header, [class*="shadow-"] {
        box-shadow: 0 1px 0 rgba(255, 255, 255, .06) inset !important;
    }
    .glass-sidebar > nav { box-shadow: 0 2px 8px rgba(0, 0, 0, .35) !important; }
    [class*="drop-shadow"], [style*="text-shadow"] { filter: none; }

    /* "transition: all" makes the browser watch every property of every element */
    .glass-card, .glass-panel, .nav-btn, button, a, input, select, textarea {
        transition-property: background-color, border-color, color, opacity, transform !important;
        transition-duration: .15s !important;
    }
    .glass-card:hover, .glass-panel:hover, .nav-btn:hover { transform: none !important; }

    /* Let the browser skip layout/paint for rows that are off screen */
    @supports (content-visibility: auto) {
        #feed-stream > div, #materials-grid > div, #video-sessions-list > div, #feedback-list > div,
        #admin-students-list > div, #admin-lectures-list > div, #tutoring-list > div,
        #dashboard-leaderboard-grid > div {
            content-visibility: auto; contain-intrinsic-size: auto 96px;
        }
    }
    /* Scroll-reveal is JS-disabled on phones, make sure nothing stays invisible */
    .m-reveal { opacity: 1 !important; transform: none !important; }
    /* A short fade is the only tab-switch motion left */
    .m-enter > * { animation: none !important; }
    .view-panel { animation-duration: .18s !important; }
}

/* =====================================================================
   6. SESSIONS PLAYLIST — easy to read
   ===================================================================== */
#video-sessions-list { display: flex; flex-direction: column; gap: 10px; }
#video-sessions-list .vs-row { align-items: center; padding: 14px !important; border-radius: 16px; }
#video-sessions-list .vs-title { white-space: normal !important; overflow: visible !important; text-overflow: clip !important; max-width: none !important; width: auto !important;
    font-size: 15px !important; line-height: 1.35; color: #fff; display: block; }
#video-sessions-list .vs-meta { font-size: 12px !important; line-height: 1.45; color: #a9b4c8; text-transform: none; letter-spacing: .01em; }
.light-theme #video-sessions-list .vs-title { color: #0f172a; }
.light-theme #video-sessions-list .vs-meta { color: #475569; }

@media (max-width: 767px) {
    /* Title gets the whole width; Enter-code / Request buttons drop to their own row */
    #video-sessions-list .vs-row { flex-wrap: wrap; align-items: flex-start; gap: 12px; }
    #video-sessions-list .vs-main { flex: 1 1 100%; align-items: flex-start; }
    #video-sessions-list .vs-title { font-size: 16px !important; }
    #video-sessions-list .vs-meta { font-size: 13px !important; }
    #video-sessions-list .vs-main > div:first-child { padding: 10px !important; }
    #video-sessions-list .vs-main > div:first-child svg { width: 18px; height: 18px; }
    #video-sessions-list .vs-actions { flex: 1 1 100%; flex-wrap: wrap; justify-content: flex-start; }
    #video-sessions-list .vs-actions button { min-height: 44px; padding: 0 16px !important; font-size: 13px !important; border-radius: 12px; }
    #video-sessions-list .vs-actions span { font-size: 11px !important; }
    #videos-count-badge { font-size: 12px !important; }
}

/* ---------- 7. smoothness extras ---------- */
@media (max-width: 1023px), (pointer: coarse) {
    #m-progress { display: none !important; }
    /* leaderboard rows: no glint sweep, no fancy hover */
    #dashboard-leaderboard-grid > div { transition: none !important; }
}
#leaderboard-more-wrap button { min-height: 44px; }

/* =====================================================================
   8. READABILITY — everywhere (phone + desktop)
   The old stylesheet forced every <p>/<span> down to 11–12px with
   !important and a lot of text was grey-on-black. This lifts both.
   ===================================================================== */

/* Dark theme: grey text was ~4:1 contrast. Lift it to comfortable. */
html:not(.light-theme) .text-gray-600 { color: #94a0b4 !important; }
html:not(.light-theme) .text-gray-500 { color: #a3aec2 !important; }
html:not(.light-theme) .text-gray-400 { color: #bcc6d6 !important; }
html:not(.light-theme) .text-gray-300 { color: #d3dae6 !important; }
html:not(.light-theme) .text-slate-500 { color: #a3aec2 !important; }
html:not(.light-theme) .text-slate-400 { color: #bcc6d6 !important; }
html:not(.light-theme) ::placeholder { color: #8a96ab !important; opacity: 1; }
.light-theme .text-gray-500, .light-theme .text-gray-400 { color: #475569 !important; }
.light-theme ::placeholder { color: #64748b !important; opacity: 1; }

/* Tiny sizes were 8–11px. Nothing in the portal should be smaller than 11.5px. */
[class*="text-[8px]"], [class*="text-[9px]"] { font-size: 11.5px !important; }
[class*="text-[10px]"] { font-size: 12px !important; }
[class*="text-[11px]"] { font-size: 12.5px !important; }
.text-xs { font-size: 13px !important; line-height: 1.5 !important; }
body { line-height: 1.6; }

/* tiny ALL-CAPS labels get less letter-spacing so they stay legible */
.uppercase { letter-spacing: .04em !important; }
[class*="tracking-widest"], [class*="tracking-[0."] { letter-spacing: .06em !important; }

/* text that was cut off with "…" can wrap in the lists where the title matters */
#materials-grid .truncate, #tutoring-list .truncate, #admin-students-list .truncate, #admin-lectures-list .truncate,
#bookmarks-list-container .truncate, #feedback-list .truncate, #vidpriv-codes-list .truncate, #feed-stream .truncate {
    white-space: normal !important; overflow: visible !important; text-overflow: clip !important; overflow-wrap: anywhere;
}

@media (max-width: 767px) {
    /* main.css forced span{11px !important}. Give spans back their own size (inherit). */
    span { font-size: inherit !important; }
    [class*="text-[8px]"], [class*="text-[9px]"] { font-size: 11.5px !important; }
    [class*="text-[10px]"] { font-size: 12px !important; }
    [class*="text-[11px]"] { font-size: 12.5px !important; }
    h2, #welcome-message { font-size: 1.25rem !important; line-height: 1.3 !important; }
    h3 { font-size: 1.05rem !important; line-height: 1.35 !important; }
    h4 { font-size: .98rem !important; line-height: 1.4 !important; }
    p, li { line-height: 1.65 !important; }
    label { font-size: 13px; }
    .nav-btn { font-size: 13px !important; }
    #workspace-view-scroll > .view-panel { row-gap: 16px; }
    .glass-card, .glass-panel { padding: 16px !important; }
}

/* =====================================================================
   9. ANIMATIONS — all one-shot, transform/opacity only (GPU-cheap)
   ===================================================================== */
@keyframes mhRise    { from { opacity: 0; transform: translate3d(0, 16px, 0); } to { opacity: 1; transform: none; } }
@keyframes mhPop     { 0% { transform: scale(.94); } 55% { transform: scale(1.025); } 100% { transform: scale(1); } }
@keyframes mhSlideIn { from { opacity: 0; transform: translate3d(-18px, 0, 0); } to { opacity: 1; transform: none; } }
@keyframes mhScrollIn { from { opacity: 0; transform: translate3d(0, 28px, 0) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes mhSheen   { from { transform: translateX(-120%); } to { transform: translateX(260%); } }

@media (prefers-reduced-motion: no-preference) {

    /* tab change: the new screen's blocks rise in one after another (6 max) */
    .m-enter > * { animation: mhRise .42s cubic-bezier(.22, 1, .36, 1) both !important; }
    .m-enter > *:nth-child(1) { animation-delay: .00s !important; }
    .m-enter > *:nth-child(2) { animation-delay: .06s !important; }
    .m-enter > *:nth-child(3) { animation-delay: .12s !important; }
    .m-enter > *:nth-child(4) { animation-delay: .18s !important; }
    .m-enter > *:nth-child(5) { animation-delay: .24s !important; }
    .m-enter > *:nth-child(n+6) { animation-delay: .30s !important; }

    /* press feedback that springs back — pure CSS, no JS on the touch path */
    button:not(:disabled):active, .nav-btn:active, .interactive-btn:active, [onclick]:active {
        transform: scale(.96);
        transition: transform .08s ease-out !important;
    }
    button, .nav-btn, .interactive-btn { transition: transform .28s cubic-bezier(.34, 1.56, .64, 1), background-color .15s, border-color .15s, color .15s, opacity .15s; }

    /* active tab pill pops when you land on it */
    .nav-btn.bg-indigo-600\/15 { animation: mhPop .38s cubic-bezier(.34, 1.56, .64, 1); }

    /* leaderboard rows slide in one after another (first 10) */
    #dashboard-leaderboard-grid > div { animation: mhSlideIn .4s cubic-bezier(.22, 1, .36, 1) both; }
    #dashboard-leaderboard-grid > div:nth-child(2) { animation-delay: .04s; }
    #dashboard-leaderboard-grid > div:nth-child(3) { animation-delay: .08s; }
    #dashboard-leaderboard-grid > div:nth-child(4) { animation-delay: .12s; }
    #dashboard-leaderboard-grid > div:nth-child(5) { animation-delay: .16s; }
    #dashboard-leaderboard-grid > div:nth-child(n+6) { animation-delay: .2s; }

    /* playlist, materials, feed, tutoring rows rise in when rendered */
    #video-sessions-list > div, #materials-grid > div, #feed-stream > div, #tutoring-list > div,
    #feedback-list > div, #admin-students-list > div, #admin-lectures-list > div {
        animation: mhRise .4s cubic-bezier(.22, 1, .36, 1) both;
    }

    /* the "See more" button + toasts */
    #leaderboard-more-wrap button { animation: mhPop .35s cubic-bezier(.34, 1.56, .64, 1) both; }

    /* modal sheets already slide; add a soft fade to the dimmed backdrop */
    .modal-root:not(.hidden) { animation: mBackdrop .2s ease both; }

    /* Scroll-driven reveal: runs on the compositor with ZERO JavaScript.
       (Chrome/Android 115+, Safari 26+. Other browsers simply skip it.) */
    @supports (animation-timeline: view()) {
        .glass-card:not(#video-theater):not(.m-reveal) {
            animation: mhScrollIn linear both !important;
            animation-timeline: view();
            animation-range: entry 0% entry 40%;
        }
    }
}

/* New videos / unlocked badge shimmer once (not forever) */
.vs-row .fa-lock, .vs-row [data-lucide="lock"] { transform-origin: 50% 60%; }

/* Smooth focus ring on inputs instead of a hard jump */
input, textarea, select { transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease; }
input:focus, textarea:focus, select:focus { box-shadow: 0 0 0 3px rgba(129, 140, 248, .35); }
/* ---------------------------------------------------------------------
   5. VIDEO PLAYER FIXES — phones + iPads (auto-hide, full-width bar, fullscreen)
   --------------------------------------------------------------------- */

/* the bar must really hide when idle, even if main.css / hover rules say otherwise */
.vc-bar.vc-hide, .vc-top.vc-hide { opacity: 0 !important; pointer-events: none !important; }

/* never let the control row overflow the bar: it shrinks instead, so the fullscreen button is always visible */
.vc-bar { box-sizing: border-box; max-width: 100%; }
.vc-row { min-width: 0; max-width: 100%; }
.vc-spacer { min-width: 0; }
@media (max-width: 767px) {
    .vc-btn { flex: 0 0 auto; min-width: 36px; padding: 0 4px; }
    .vc-main { flex: 0 0 auto; }
    .vc-time { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 11px; padding: 0 2px; }
    .vc-speed-btn { min-width: 40px; font-size: 12px; }
    #vc-fs { flex: 0 0 auto; }
}
@media (max-width: 400px) {
    #vc-back, #vc-fwd { display: none !important; }
}
/* iPad / any touch screen: no volume slider (no hover, hardware buttons), keeps room for everything else */
@media (hover: none), (pointer: coarse) {
    .vc-vol { display: none !important; }
    .vc-bar { left: 8px; right: 8px; }
    .vc-btn { flex: 0 0 auto; }
    .vc-time { min-width: 0; }
}

/* CSS fullscreen (iPhone): fill the whole screen; ancestors' transforms/filters are neutralised by JS */
.vc-fs-anc {
    transform: none !important; animation: none !important; filter: none !important;
    backdrop-filter: none !important; -webkit-backdrop-filter: none !important;
    perspective: none !important; contain: none !important; will-change: auto !important;
    content-visibility: visible !important; overflow: visible !important; clip-path: none !important;
    /* Every ancestor of the player forms its own stacking context (main is z-10, sidebar is z-20).
       Lift them all above siblings so the sidebar/nav can never paint over the fullscreen video. */
    position: relative; z-index: 2147483000 !important;
}
/* Hide every sibling chrome element while the player is fullscreen */
html.vc-fs-lock .glass-sidebar,
html.vc-fs-lock .glass-sidebar > nav,
html.vc-fs-lock .glass-header,
html.vc-fs-lock header,
html.vc-fs-lock #toast-container,
html.vc-fs-lock #floating-co-assistant-container,
html.vc-fs-lock #va-mic-btn { visibility: hidden !important; pointer-events: none !important; }
html.vc-fs-lock .vc-fs-anc > *:not(.vc-fs-anc):not(#video-theater) { visibility: hidden !important; }
html.vc-fs-lock #video-theater, html.vc-fs-lock #video-theater * { visibility: visible !important; }
html.vc-fs-lock, html.vc-fs-lock body { overflow: hidden !important; }
#video-theater.vc-pseudo-fs {
    position: fixed !important; inset: 0 !important; z-index: 2147483000 !important;
    width: 100vw !important; height: 100vh !important; height: 100dvh !important;
    max-width: none !important; margin: 0 !important; border-radius: 0 !important; background: #000;
}
#video-theater:fullscreen { width: 100vw !important; height: 100vh !important; }
#video-theater.vc-pseudo-fs .vc-bar, #video-theater:fullscreen .vc-bar {
    left: max(10px, env(safe-area-inset-left)); right: max(10px, env(safe-area-inset-right));
    bottom: max(10px, env(safe-area-inset-bottom));
}

/* ---- Eye button in the "Provision Student" password field ----
   It used to be centred with transform: translateY(-50%). On phones the press
   effects (scale on :active, .m-pressed) overwrite that transform, so the
   button jumped out from under your finger and the tap never registered.
   Now it is centred with plain positioning, so nothing can move it. */
.pass-eye-btn {
    position: absolute !important; top: 0 !important; bottom: 0 !important; right: 0 !important;
    width: 44px; min-height: 0 !important; height: auto !important; padding: 0 !important;
    display: flex; align-items: center; justify-content: center;
    color: #9ca3af; background: transparent; border: 0; border-radius: 12px; cursor: pointer;
    touch-action: manipulation; -webkit-tap-highlight-color: transparent; z-index: 2;
    transform: none !important;
}
.pass-eye-btn:hover, .pass-eye-btn:active, .pass-eye-btn.m-pressed { transform: none !important; color: #fff; }
.pass-eye-btn svg { pointer-events: none; }
.light-theme .pass-eye-btn { color: #6b7280; }
.light-theme .pass-eye-btn:hover, .light-theme .pass-eye-btn:active { color: #4f46e5; }


/* =====================================================================
   10. NOTIFICATIONS + PHONE COMFORT (merged from phone.css)
   Kept at the END of this file and with extra :not(#_) weight so later stylesheets (flow/glass/liquid) cannot undo it.
   1. Toasts readable in both themes   2. Notification menu text   3. Phone comfort: no accidental zoom, less wasted space
   ===================================================================== */

/* ---------------------------------------------------------------------
   1. TOASTS
   Cause of the faint text: main.css paints every light-theme <span> dark slate, but a toast body is a dark tinted pill, so the
   words came out dark-on-dark. Each toast now carries its OWN ink + background, picked per theme and per type
   (success = green, error = red, info = indigo), nearly solid so the page behind can never wash it out.
   --------------------------------------------------------------------- */
html body #toast-container > *:not(#_):not(#__):not(#___):not(#____) {
    --tt: 99, 102, 241;                 /* accent (info) */
    --tt-ink: #f1f4ff;                  /* text */
    --tt-ic: 165, 180, 252;             /* icon */
    --tt-bg: rgba(15, 20, 44, .97);
    position: relative; overflow: hidden;
    color: var(--tt-ink) !important;
    background-color: var(--tt-bg) !important;
    background-image: linear-gradient(100deg, rgba(var(--tt), .30), rgba(var(--tt), 0) 70%), linear-gradient(180deg, rgba(255, 255, 255, .10), rgba(255, 255, 255, 0) 55%) !important;
    border: 1px solid rgba(var(--tt), .55) !important;
    box-shadow: inset 0 1px 1px rgba(255, 255, 255, .35), 0 16px 36px -14px rgba(2, 4, 16, .8) !important;
    -webkit-backdrop-filter: none !important; backdrop-filter: none !important;
    max-width: min(420px, calc(100vw - 20px));
}
html body #toast-container > .bg-indigo-950\/90:not(#_):not(#__):not(#___):not(#____) { --tt: 16, 185, 129; --tt-ic: 110, 231, 183; }      /* success */
html body #toast-container > .bg-red-950\/90:not(#_):not(#__):not(#___):not(#____)    { --tt: 244, 63, 94;  --tt-ic: 253, 164, 175; }      /* error */

html.light-theme body #toast-container > *:not(#_):not(#__):not(#___):not(#____) {
    --tt-ink: #1e1b4b; --tt-ic: 79, 70, 229; --tt-bg: rgba(255, 255, 255, .985);
    background-image: linear-gradient(100deg, rgba(var(--tt), .14), rgba(var(--tt), 0) 66%) !important;
    border: 1px solid rgba(var(--tt), .42) !important;
    box-shadow: inset 0 1px 1px #fff, 0 14px 32px -14px rgba(79, 70, 229, .5), 0 3px 8px -3px rgba(30, 27, 75, .18) !important;
}
html.light-theme body #toast-container > .bg-indigo-950\/90:not(#_):not(#__):not(#___):not(#____) { --tt-ink: #064e3b; --tt-ic: 4, 120, 87; }
html.light-theme body #toast-container > .bg-red-950\/90:not(#_):not(#__):not(#___):not(#____)    { --tt-ink: #881337; --tt-ic: 190, 18, 60; }

/* the words and the icon always take the toast's own colours */
html body #toast-container > * > span:not(#_):not(#__):not(#___):not(#____) {
    color: var(--tt-ink) !important; -webkit-text-fill-color: var(--tt-ink) !important;
    font-weight: 700; font-size: 13px !important; line-height: 1.4; text-shadow: none !important;
    overflow-wrap: anywhere;
}
html body #toast-container > * > :is(svg, i):not(#_):not(#__):not(#___):not(#____) {
    color: rgb(var(--tt-ic)) !important; stroke: rgb(var(--tt-ic)) !important; flex: none;
}

/* ---------------------------------------------------------------------
   2. NOTIFICATION MENU (bell dropdown) — same problem, same cure: text follows the panel, not the old slate rule
   --------------------------------------------------------------------- */
html:not(.light-theme) body #ntf-panel:not(#_):not(#__):not(#___):not(#____) { color: #eef1ff; }
html.light-theme body #ntf-panel:not(#_):not(#__):not(#___):not(#____) { color: #1e1b4b; }
html:not(.light-theme) body #ntf-panel :is(p, span, h3, h4, small, time, b, strong, div):not([class*="bg-"]):not([class*="text-indigo"]):not([class*="text-emerald"]):not([class*="text-red"]):not([class*="text-amber"]):not(.ntf-badge):not(#_):not(#__):not(#___) { color: inherit; }
html.light-theme body #ntf-panel :is(p, span, h3, h4, small, time, b, strong, div):not([class*="bg-"]):not([class*="text-indigo"]):not([class*="text-emerald"]):not([class*="text-red"]):not([class*="text-amber"]):not(.ntf-badge):not(#_):not(#__):not(#___) { color: inherit; }
html:not(.light-theme) body #ntf-panel :is(small, time, [class*="text-gray"], [class*="text-slate"]):not(#_):not(#__):not(#___) { color: #aab4ca; }
html.light-theme body #ntf-panel :is(small, time, [class*="text-gray"], [class*="text-slate"]):not(#_):not(#__):not(#___) { color: #475569; }

/* ---------------------------------------------------------------------
   3. PHONES
   --------------------------------------------------------------------- */
@media (max-width: 1023px), (pointer: coarse) {
    /* no accidental double-tap zoom, no 300 ms tap delay, no sideways rubber-band / swipe-back */
    html, body { touch-action: manipulation; overscroll-behavior-x: none; -webkit-tap-highlight-color: transparent; }
    a, button, input, select, textarea, label, [role="button"], [onclick] { touch-action: manipulation; }
    /* long unbroken words (links, file names, IDs) wrap instead of widening the page */
    .view-panel :where(.glass-card, .glass-panel) { overflow-wrap: anywhere; }
    #chat-messages-list, #ai-chat-board, #feed-stream, #feedback-list, #materials-grid, #tutoring-list { overflow-wrap: anywhere; word-break: normal; }
    #ai-chat-board pre, #ai-chat-board code, #feed-stream pre { white-space: pre-wrap; word-break: break-word; max-width: 100%; }
}
@media (max-width: 767px) {
    /* take back the width the nested rounded frames used up */
    #workspace-view-scroll { padding: 10px 8px calc(24px + env(safe-area-inset-bottom)) !important; }
    #portal-section > main.glass-main-panel { border-radius: 22px !important; }
    html body .glass-card:not(#_), html body .glass-panel:not(#_) { padding: 14px !important; }
    html body .dash-cell:not(#_):not(#__):not(#___):not(#____) { padding: 16px !important; }

    /* the top block (profile, tabs, disconnect) was ~230px before any content: tighten it */
    .glass-sidebar > div:last-child { padding: 0 !important; border: 0 !important; }
    .glass-sidebar > div:last-child > button { min-height: 38px !important; padding: 8px 12px !important; font-size: 12.5px !important; border-radius: 14px !important; }
    .glass-sidebar > div:first-child { padding: 8px 10px !important; }
    .glass-sidebar > nav { padding: 6px !important; }

    /* inputs never zoom the page on focus (iOS) and keep a comfortable height */
    input:not([type="range"]):not([type="checkbox"]):not([type="radio"]):not([type="file"]), select, textarea { font-size: 16px !important; }
}

/* ---------------------------------------------------------------------
   PHONE TOP BAR: plain tab title (no pill), round header buttons, one tidy row.
   In a cascade layer so it beats the !important chains in main.css / ios-glass.css / liquid-*.css.
   --------------------------------------------------------------------- */
@layer phone-header {
@media (max-width: 767px) {

  /* ---------- the bar ---------- */
  .glass-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 8px !important;
    box-sizing: border-box !important;
    width: auto !important;
    max-width: 100% !important;
    height: 56px !important;
    min-height: 56px !important;
    padding: 0 10px 0 16px !important;
    margin: 0 0 10px !important;
    overflow: hidden !important;
  }
  html[dir="rtl"] .glass-header { padding: 0 16px 0 10px !important; }

  /* ---------- tab name: plain text, no box ---------- */
  #active-tab-title {
    flex: 1 1 auto !important;
    min-width: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    background: none !important;
    background-image: none !important;
    border: 0 !important;
    border-radius: 0 !important;
    outline: 0 !important;
    box-shadow: none !important;
    -webkit-backdrop-filter: none !important;
    backdrop-filter: none !important;
    font-size: 17px !important;
    font-weight: 800 !important;
    line-height: 1.25 !important;
    letter-spacing: 0 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    text-align: left !important;      /* Arabic titles (dir=auto -> rtl) otherwise jam against the buttons */
  }
  html[dir="rtl"] #active-tab-title { text-align: right !important; }
  .light-theme #active-tab-title { background: none !important; border: 0 !important; box-shadow: none !important; }
  #active-tab-title::before, #active-tab-title::after { content: none !important; display: none !important; }

  /* ---------- action buttons: one tidy row ---------- */
  .glass-header > div {
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  .glass-header button {
    flex: 0 0 auto !important;
    box-sizing: border-box !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 38px !important;
    height: 38px !important;
    min-width: 38px !important;
    min-height: 38px !important;     /* cancels the global `button { min-height: 44px }` that caused the stretching */
    max-width: 38px !important;
    max-height: 38px !important;
    margin: 0 !important;            /* cancels the inline margin on the language button */
    padding: 0 !important;
    border-radius: 50% !important;
    line-height: 1 !important;
  }
  .glass-header button svg,
  .glass-header button i {
    width: 18px !important;
    height: 18px !important;
    flex: none !important;
  }
  .glass-header #lang-toggle,
  .glass-header .lang-toggle-btn {
    font-size: 13px !important;
    font-weight: 800 !important;
  }
  /* keep the notification badge sitting on the bell's corner */
  .glass-header #ntf-bell { position: relative !important; }
}

/* small phones: slightly smaller circles so five buttons still leave room for the title */
@media (max-width: 380px) {
  .glass-header { padding: 0 8px 0 14px !important; gap: 6px !important; }
  html[dir="rtl"] .glass-header { padding: 0 14px 0 8px !important; }
  .glass-header > div { gap: 4px !important; }
  .glass-header button {
    width: 34px !important; height: 34px !important;
    min-width: 34px !important; min-height: 34px !important;
    max-width: 34px !important; max-height: 34px !important;
  }
  .glass-header button svg, .glass-header button i { width: 16px !important; height: 16px !important; }
  #active-tab-title { font-size: 16px !important; }
}

}
/* =====================================================================
   LEADERBOARD ROWS — name never collapses (phones + desktop)
   The name has its own line; title/Admin badges wrap on a row under it; score stays on the side.
   ===================================================================== */
#dashboard-leaderboard-grid .lb-left { flex: 1 1 0%; min-width: 0; }
#dashboard-leaderboard-grid .lb-info { flex: 1 1 0%; min-width: 0; }
#dashboard-leaderboard-grid .lb-name { display: block; overflow-wrap: break-word; word-break: normal; line-height: 1.35; }
#dashboard-leaderboard-grid .lb-badges { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; margin: 3px 0 2px; }
#dashboard-leaderboard-grid .lb-badges > span { margin: 0; white-space: nowrap; flex-shrink: 0; }
#dashboard-leaderboard-grid .lb-meta { overflow-wrap: break-word; word-break: normal; line-height: 1.4; }
#dashboard-leaderboard-grid .lb-score { flex: 0 0 auto; white-space: nowrap; }
#dashboard-leaderboard-grid .lb-score > * { white-space: nowrap; }
@media (max-width: 767px) {
    #dashboard-leaderboard-grid .lb-name { font-size: 13px; }
    #dashboard-leaderboard-grid .lb-meta { font-size: 10px; }
    #dashboard-leaderboard-grid .lb-score > span { font-size: 12px; }
}