/* styles.css — class-based, RTL-safe styling for eTutor (team-i18n).
 *
 * Replaces the former inline styles in app.jsx so the layout can mirror under
 * dir="rtl" (ar/he/fa/ur). Directional spacing/alignment uses CSS *logical*
 * properties (margin-inline, padding-inline, inset-inline, text-align:start/end)
 * which flip automatically with the document direction. Genuinely dynamic values
 * (computed colors, bar widths, animation) remain inline in JSX — they are
 * direction-neutral and cannot break RTL.
 */

/* ── palette ─────────────────────────────────────────────────────────────── */
:root {
  --bg: #0d1117; --panel: #161b22; --panel2: #1c232c; --line: #2b333f;
  --ink: #e6edf3; --mute: #8b97a6; --faint: #5b6675;
  --teal: #54f2b2; --amber: #ffb454; --crimson: #ff5d6c; --blue: #6cb6ff; --gold: #e3b341;
}

/* ── base ────────────────────────────────────────────────────────────────── */
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: 'IBM Plex Mono', monospace; }
* { box-sizing: border-box; }
.nr { font-family: 'Newsreader', Georgia, serif; }
button, input, select, textarea { font-family: inherit; }

/* Script-aware fonts so CJK / Arabic / Devanagari render with coverage. */
:lang(zh) { font-family: 'Noto Sans SC', 'IBM Plex Mono', sans-serif; }
:lang(ja) { font-family: 'Noto Sans JP', 'IBM Plex Mono', sans-serif; }
:lang(ko) { font-family: 'Noto Sans KR', 'IBM Plex Mono', sans-serif; }
:lang(hi) { font-family: 'Noto Sans Devanagari', 'IBM Plex Mono', sans-serif; }
:lang(ar), :lang(he), :lang(fa), :lang(ur) { font-family: 'Noto Sans Arabic', 'IBM Plex Mono', sans-serif; }

.scroll::-webkit-scrollbar { width: 8px; height: 8px; }
.scroll::-webkit-scrollbar-thumb { background: var(--line); border-radius: 8px; }
input[type=range] { -webkit-appearance: none; height: 4px; border-radius: 4px; background: var(--line); outline: none; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: var(--teal); cursor: pointer; border: 2px solid var(--bg); }
@keyframes flick { 0%, 100% { opacity: 1; } 50% { opacity: .82; } }

/* ── color/utility helpers ───────────────────────────────────────────────── */
.t-mute { color: var(--mute); } .t-faint { color: var(--faint); } .t-ink { color: var(--ink); }
.t-teal { color: var(--teal); } .t-amber { color: var(--amber); } .t-blue { color: var(--blue); } .t-crimson { color: var(--crimson); }
.app { min-height: 100vh; }
.loading { padding: 40px; color: var(--faint); }
.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.stack { display: grid; gap: 8px; }
.row { display: flex; align-items: center; gap: 10px; }
.row-wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.grow { flex: 1; }
.spacer { flex: 1; }
.muted-note { color: var(--faint); font-size: 11px; }

/* ── buttons ─────────────────────────────────────────────────────────────── */
.btn { background: var(--panel2); color: var(--ink); border: none; border-radius: 6px; padding: 7px 11px; font-size: 12.5px; cursor: pointer; }
.btn:disabled { opacity: .6; cursor: default; }
.btn-primary { background: var(--teal); color: var(--bg); font-weight: 600; }
.btn-warn { background: var(--amber); color: var(--bg); }
.btn-reset { background: var(--line); color: var(--ink); }
.btn-muted { background: var(--panel2); color: var(--mute); }
.btn-danger { background: var(--panel2); color: var(--crimson); }
.btn-clear { background: var(--panel); color: var(--faint); border: 1px solid var(--line); }
.btn-ai { background: var(--panel2); color: var(--teal); border: 1px solid var(--line); font-size: 12px; }
.btn-replace { background: var(--crimson); color: var(--bg); inline-size: 100%; margin-block-start: 4px; }
.btn-outline { border: 1px solid var(--line); }
.btn-block { inline-size: 100%; }
.btn-bold { font-weight: 600; }
.btn-start { text-align: start; }
.btn-tiny { font-size: 11px; padding: 3px 8px; }

/* toggle group (slot select, view-as) */
.toggle { background: var(--panel2); color: var(--mute); border: 1px solid var(--line); }
.toggle.is-active { background: var(--blue); color: var(--bg); border-color: var(--blue); }
.seg { display: flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg__btn { background: var(--panel2); color: var(--mute); border: none; border-radius: 0; padding: 6px 10px; cursor: pointer; font-size: 12.5px; }
.seg__btn + .seg__btn { border-inline-start: 1px solid var(--line); }
.seg__btn.is-active { background: var(--blue); color: var(--bg); }

/* ── atoms ───────────────────────────────────────────────────────────────── */
.h { font-size: 17px; font-weight: 600; margin-block-end: 12px; }
.h .dim { color: var(--faint); font-weight: 400; font-size: 13px; }
.sub { font-size: 11px; color: var(--mute); text-transform: uppercase; letter-spacing: .08em; margin-block-end: 6px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.card--flush { padding: 0; }
.card-mb-sm { margin-block-end: 12px; }
.span2 { grid-column: span 2; }
.dim { color: var(--faint); font-weight: 400; font-size: 13px; }
.vmid { vertical-align: middle; }
.link { color: var(--blue); cursor: pointer; }
.link--mute { color: var(--mute); cursor: pointer; }
.ok { color: var(--teal); font-size: 12px; margin-block-end: 8px; }
.auth-foot { display: flex; justify-content: space-between; margin-block-start: 10px; font-size: 11.5px; color: var(--faint); }
.pill { font-size: 10.5px; padding: 2px 8px; border-radius: 20px; border: 1px solid var(--line); color: var(--mute); }
.helptext { color: var(--mute); font-size: 12.5px; margin-block-end: 12px; }

.field { inline-size: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); padding: 10px 12px; font-size: 13px; margin-block-end: 12px; }
.select { background: var(--bg); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); padding: 9px 11px; font-size: 13px; }

.err { color: var(--crimson); font-size: 12px; }
.err-box { color: var(--crimson); font-size: 12px; margin-block-end: 12px; border: 1px solid var(--crimson); border-radius: 6px; padding: 8px 10px; }

/* ── meter / gauge ───────────────────────────────────────────────────────── */
.meter { background: var(--panel); border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; }
.meter__label { font-size: 10px; color: var(--mute); text-transform: uppercase; letter-spacing: .06em; }
.meter__value { font-size: 19px; font-weight: 600; }
.meter__unit { font-size: 11px; color: var(--faint); }
.gauge { text-align: end; }
.gauge__label { font-size: 10px; color: var(--mute); letter-spacing: .1em; }
.gauge__value { font-size: 22px; font-weight: 600; }

/* ── top bar ─────────────────────────────────────────────────────────────── */
.topbar { border-block-end: 1px solid var(--line); padding: 14px 22px; display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { font-size: 22px; font-weight: 600; }
.brand--lg { font-size: 28px; margin-block-end: 4px; }
.brand__sub { color: var(--mute); font-size: 13px; }
.topbar__right { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.usermeta { font-size: 12px; color: var(--mute); }

/* ── circuit lab ─────────────────────────────────────────────────────────── */
.lab { background: var(--bg); color: var(--ink); min-height: 100vh; }
.lab__header { border-block-end: 1px solid var(--line); padding: 16px 20px; display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 8px; }
.lab__title { font-size: 24px; font-weight: 600; }
.lab__summary { color: var(--faint); font-size: 12px; margin-block-start: 2px; }
.lab__tasks { padding: 12px 20px; border-block-end: 1px solid var(--line); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.lab__goal { padding: 10px 20px; color: var(--amber); font-size: 13px; border-block-end: 1px solid var(--line); background: var(--panel); }
.task-btn { border: 1px solid var(--line); }
.task-btn.is-active { background: var(--teal); color: var(--bg); font-weight: 600; }
.task-btn.is-done { border-color: var(--teal); }

.lab__grid { display: grid; grid-template-columns: minmax(220px, 1fr) minmax(360px, 2fr) minmax(260px, 1.2fr); gap: 1px; background: var(--line); }
.lab__col { background: var(--bg); padding: 18px; }
.lab__col--flex { display: flex; flex-direction: column; }
.lab__col--assess { min-height: 540px; }
.meter-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-block-start: 12px; }

.range-row { display: flex; align-items: center; gap: 10px; margin-block-end: 16px; }
.range-val { color: var(--amber); inline-size: 54px; text-align: end; }
.range-val--wide { inline-size: 64px; }

.palette-row { display: flex; justify-content: space-between; align-items: center; }
.statusbar { margin-block-start: 12px; padding: 9px 12px; border-radius: 6px; background: var(--panel); font-size: 12.5px; }
.hints { color: var(--mute); font-size: 12px; line-height: 1.5; padding-inline-start: 18px; margin-block-start: 8px; }

.bars { display: grid; gap: 8px; margin-block-end: 14px; }
.bar-head { display: flex; justify-content: space-between; font-size: 12px; margin-block-end: 3px; }
.bar-track { height: 7px; background: var(--panel2); border-radius: 6px; overflow: hidden; }
.bar-fill { height: 100%; transition: width .4s; }

.evidence { flex: 1; overflow-y: auto; border: 1px solid var(--line); border-radius: 6px; background: var(--panel); min-height: 120px; }
.evidence__empty { padding: 14px; color: var(--faint); font-size: 12px; }
.evidence__row { padding: 8px 10px; border-block-end: 1px solid var(--line); display: flex; gap: 8px; font-size: 12px; }
.evidence__verb { inline-size: 78px; flex-shrink: 0; }
.evidence__time { color: var(--faint); font-size: 10px; }
.xapi { background: #0a0d12; border: 1px solid var(--line); border-radius: 6px; padding: 10px; font-size: 10.5px; color: var(--teal); max-height: 150px; overflow: auto; margin-block-end: 10px; }
.footnote { margin-block-start: 10px; font-size: 10.5px; color: var(--faint); line-height: 1.5; }
.between { display: flex; justify-content: space-between; align-items: baseline; }

.schematic { inline-size: 100%; background: #0a0d12; border: 1px solid var(--line); border-radius: 8px; }

/* ── dashboards ──────────────────────────────────────────────────────────── */
.page { padding: 22px; max-width: 1200px; margin-inline: auto; }
.card-mb { margin-block-end: 22px; }
.tutor-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.chip-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 8px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-block-end: 22px; }

/* tutor row */
.tutor-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.tutor-row__main { flex: 1; min-width: 200px; }
.tutor-row__title { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.tutor-row__actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-start; }
/* Per-tutor mini-class controls: visibility segmented control + access-code row. */
.assign-controls { display: flex; flex-direction: column; gap: 2px; margin-inline-end: 4px; }
.access-code { font-family: 'IBM Plex Mono', monospace; font-size: 12.5px; font-weight: 600; letter-spacing: .06em; color: var(--blue); background: rgba(108,182,255,.12); border: 1px solid var(--line); border-radius: 6px; padding: 4px 9px; user-select: all; }
.tutor-name { font-size: 17px; font-weight: 600; }

/* concept catalog */
.legend { display: flex; gap: 12px; flex-wrap: wrap; margin-block-end: 12px; }
.legend__item { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--faint); }
.fit { font-size: 9.5px; font-weight: 600; border: 1px solid currentColor; border-radius: 4px; padding: 1px 5px; letter-spacing: .04em; text-transform: uppercase; flex-shrink: 0; }
.chip { display: flex; align-items: center; gap: 7px; text-align: start; background: var(--bg); border: 1px solid var(--line); border-radius: 6px; color: var(--ink); padding: 7px 9px; font-size: 12px; cursor: pointer; line-height: 1.35; }
.cat { border-block-start: 1px solid var(--line); }
.cat__head { inline-size: 100%; display: flex; justify-content: space-between; align-items: center; gap: 10px; background: transparent; border: none; color: var(--ink); padding: 11px 2px; cursor: pointer; text-align: start; }
.cat__caret { color: var(--teal); margin-inline-end: 8px; }
.cat__name { font-size: 15px; font-weight: 600; }
.cat__count { color: var(--faint); font-size: 11px; margin-inline-start: 8px; }
.cat__body { padding: 0 2px 14px; }
.cat__blurb { color: var(--faint); font-size: 11.5px; margin-block-end: 9px; }
.cat__ai { display: flex; align-items: center; gap: 10px; margin-block-start: 11px; }

/* login */
.login-card { inline-size: 460px; max-inline-size: 100%; }
.provider-link { display: block; text-align: center; text-decoration: none; font-weight: 600; }
.divider { border-block-start: 1px solid var(--line); margin: 4px 0 16px; padding-block-start: 14px; color: var(--faint); font-size: 11px; }
.role-btn { text-align: start; display: flex; justify-content: space-between; align-items: center; border: 1px solid var(--line); }
.role-btn.is-active { background: var(--blue); color: var(--bg); border-color: var(--blue); }

/* admin */
.user-row { display: flex; justify-content: space-between; padding: 10px 16px; border-block-end: 1px solid var(--line); font-size: 12.5px; }
.kv { font-size: 12.5px; }

/* roster modal */
.modal-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 10; }
.modal { inline-size: 640px; max-inline-size: 100%; max-block-size: 80vh; overflow: auto; }
.modal--wide { inline-size: 760px; }
.roster-row { border-block-start: 1px solid var(--line); padding: 10px 0; display: flex; justify-content: space-between; align-items: center; gap: 10px; }

.flex-end { display: flex; justify-content: flex-end; margin-block-end: 8px; }

/* language picker */
.lang-select { background: var(--panel2); color: var(--mute); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-size: 12px; }

/* concept diagram (AI-generated SVG) */
.concept-diagram { margin-block-end: 16px; }
.concept-diagram__svg { background: #0a0d12; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.concept-diagram__svg svg { display: block; width: 100%; height: auto; }

/* difficulty switcher bar (above the lab) */
.difficulty-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 10px 20px; border-block-end: 1px solid var(--line); background: var(--panel); }
.t-crimson { color: var(--crimson); }

/* generation progress panel */
.gen { margin-block-start: 14px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel2); }
.gen__head { display: flex; align-items: center; gap: 10px; margin-block-end: 10px; }
.gen__title { font-size: 13px; color: var(--ink); flex: 1; }
.gen__time { font-size: 12px; color: var(--mute); font-variant-numeric: tabular-nums; }
.gen__bar { height: 6px; background: var(--line); border-radius: 6px; overflow: hidden; margin-block-end: 10px; }
.gen__bar-fill { height: 100%; background: var(--teal); transition: width .5s ease; }
.gen__steps { display: grid; gap: 4px; }
.gen__step { font-size: 12px; color: var(--faint); transition: color .3s; }
.gen__step.is-active { color: var(--teal); }
.gen__step.is-done { color: var(--mute); }
.gen__dot { display: inline-block; inline-size: 14px; }
.spinner { inline-size: 14px; block-size: 14px; border: 2px solid var(--line); border-block-start-color: var(--teal); border-radius: 50%; display: inline-block; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* conceptual study view (fit === stretch: not lab-graded) */
.study { padding: 18px 20px; max-width: 760px; }
.study__list { color: var(--mute); font-size: 13px; line-height: 1.6; padding-inline-start: 18px; margin: 6px 0 18px; }
.study__list b { color: var(--ink); }

/* ===================== landing (STEM Bench — pilot) ===================== */
.landing { max-width: 1040px; margin: 0 auto; padding: 0 20px 60px; }
.landing-nav { display: flex; align-items: center; justify-content: space-between; padding: 18px 0; border-block-end: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
.landing-brand { font-size: 20px; font-weight: 600; letter-spacing: .02em; }
.pilot-badge { font-size: 10px; font-weight: 700; letter-spacing: .12em; color: var(--bg); background: var(--amber); border-radius: 4px; padding: 2px 6px; margin-inline-start: 8px; vertical-align: middle; }
.btn-lg { padding: 11px 20px; font-size: 14px; }

.landing-hero { position: relative; text-align: center; padding: 64px 12px 40px; overflow: hidden; }
/* Full-bleed video background: span the viewport width while content stays in the .landing container. */
.landing-hero__bg { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 100vw; height: 100%; z-index: 0; pointer-events: none; }
.landing-hero__video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
/* Dark scrim (top→bottom fade into page bg) keeps the hero copy readable over the video. */
.landing-hero__scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgba(13,17,23,.30) 0%, rgba(13,17,23,.45) 60%, var(--bg) 100%); }
.landing-hero > *:not(.landing-hero__bg) { position: relative; z-index: 1; }
@media (prefers-reduced-motion: reduce) { .landing-hero__video { display: none; } }
.pilot-tag { display: inline-block; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--amber); border: 1px solid var(--line); border-radius: 999px; padding: 5px 14px; margin-block-end: 22px; }
.landing-title { font-size: 56px; font-weight: 700; line-height: 1.05; margin: 0; background: linear-gradient(90deg, var(--teal), var(--blue)); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.landing-tagline { font-size: 19px; color: var(--ink); margin: 12px 0 18px; }
.landing-lede { max-width: 620px; margin: 0 auto 28px; color: var(--mute); font-size: 14.5px; line-height: 1.65; }

/* animated bench vignettes in the hero (public/landing/*.svg) */
.bench-anim-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; max-width: 920px; margin: 40px auto 14px; }
.bench-anim { margin: 0; border-radius: 14px; overflow: hidden; background: #0a1c2a; border: 1px solid var(--line); box-shadow: 0 10px 30px rgba(0,0,0,.35); transition: transform .25s ease, box-shadow .25s ease; }
.bench-anim:hover { transform: translateY(-4px); box-shadow: 0 16px 40px rgba(0,0,0,.5), 0 0 0 1px var(--anim-accent, var(--teal)); }
.bench-anim__img { display: block; width: 100%; height: auto; }
.bench-anim-caption { color: var(--faint); font-size: 12.5px; max-width: 560px; margin: 0 auto; }
@media (max-width: 720px) { .bench-anim-strip { grid-template-columns: 1fr; max-width: 420px; } }

.landing-section { padding: 34px 0; border-block-start: 1px solid var(--line); }
.feature-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }
.feature-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 18px; }
.feature-card__title { color: var(--teal); font-weight: 600; font-size: 14px; margin-block-end: 8px; }
.feature-card__desc { color: var(--mute); font-size: 13px; line-height: 1.55; }

.bench-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; margin-block-start: 14px; }
/* Domain tabs on the public landing showcase (Mathematics, Physics, …). */
.bench-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin-block-start: 16px; padding-block-end: 14px; border-block-end: 1px solid var(--line); }
.bench-tab { font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--mute); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 7px 15px; display: inline-flex; align-items: center; gap: 8px; transition: color .15s, border-color .15s, background .15s; }
.bench-tab:hover { color: var(--ink); border-color: var(--faint); }
.bench-tab.is-active { color: var(--bg); background: var(--teal); border-color: var(--teal); }
.bench-tab__count { font-size: 10.5px; font-weight: 600; color: inherit; opacity: .7; background: rgba(127,127,127,.18); border-radius: 999px; padding: 0 7px; }
.bench-tab.is-active .bench-tab__count { background: rgba(0,0,0,.18); opacity: .85; }
.bench-tabpanel { margin-block-start: 4px; }
.bench-sample-note { margin-block-start: 14px; font-size: 11.5px; color: var(--faint); letter-spacing: .02em; }
/* Course grouping on the public landing showcase (Mathematics, Physics, …). */
.bench-cat { margin-block-start: 26px; }
.bench-cat:first-child { margin-block-start: 8px; }
.bench-cat__head { display: flex; align-items: baseline; gap: 10px; padding-block-end: 6px; border-block-end: 1px solid var(--line); }
.bench-cat__name { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: .09em; color: var(--ink, #1a2733); }
.bench-cat__count { font-size: 11px; color: var(--mute); border: 1px solid var(--line); border-radius: 999px; padding: 1px 9px; }
.bench-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px; transition: transform .15s, border-color .15s; }
.bench-card:hover { transform: translateY(-2px); border-color: var(--faint); }
.bench-card__name { font-weight: 600; font-size: 15px; margin-block-end: 6px; }
.bench-card__desc { color: var(--mute); font-size: 12.5px; line-height: 1.5; }
.bench-card--soon { border-style: dashed; background: transparent; }
/* Live bench card: hover lift + two actions (try the example / read the docs). */
.bench-card--live { display: flex; flex-direction: column; }
.bench-card--live .bench-card__desc { flex: 1; }
.bench-card__actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-block-start: 12px; }
.bench-card__btn { font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; background: transparent; border: 1px solid currentColor; border-radius: 7px; padding: 6px 11px; line-height: 1.1; }
.bench-card__btn:hover { filter: brightness(1.15); transform: translateY(-1px); }
.bench-card__link { font: inherit; font-size: 12px; cursor: pointer; background: none; border: none; color: var(--mute); padding: 6px 2px; }
.bench-card__link:hover { color: var(--ink, #1a2733); text-decoration: underline; }

/* Live-example popup: a near-fullscreen overlay holding the real lab in preview mode. */
.bench-demo-overlay { position: fixed; inset: 0; background: rgba(0, 0, 0, .72); display: flex; align-items: center; justify-content: center; padding: 2vh 2vw; z-index: 200; }
.bench-demo-shell { position: relative; inline-size: min(1360px, 96vw); block-size: 94vh; overflow: auto; border-radius: 14px; background: #0a1c2a; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8); }
/* The benchkit Tutor root hard-codes min-height:100vh for full-page use; inside the
   94vh popup shell that guarantees a permanent scrollbar. Pin it to fill the shell
   instead so it only scrolls when the lab content genuinely overflows. */
.bench-demo-shell > div { min-block-size: 100% !important; }
.bench-demo-toolbar { position: fixed; inset-block-start: calc(3vh + 8px); inset-inline-end: calc(3vw + 8px); z-index: 210; display: flex; gap: 8px; align-items: center; }
.bench-demo-close { inline-size: 36px; block-size: 36px; border-radius: 50%; border: 1px solid rgba(180, 200, 220, .4); background: rgba(10, 28, 42, .85); color: #cddce7; font-size: 16px; cursor: pointer; line-height: 1; }
.bench-demo-close:hover { background: rgba(20, 44, 64, .95); }
.bench-demo-msg { padding: 48px 24px; text-align: center; color: #9fb6c6; font-size: 14px; }

/* Bench documentation modal — parchment/gold theme matching the contextual help card
   (contextual-help.js #cx-help-card). Warm cream surface, gold header, brown ink. */
.bench-doc-overlay { position: fixed; inset: 0; background: rgba(20, 14, 4, .5); display: flex; align-items: center; justify-content: center; padding: 4vh 4vw; z-index: 260; }
.bench-doc { inline-size: min(720px, 100%); max-block-size: 90vh; display: flex; flex-direction: column; color: #1d2838; background: linear-gradient(180deg, rgba(255, 255, 255, .96) 0%, rgba(247, 244, 236, .94) 100%), #fbf8ef; border: 1px solid rgba(130, 100, 40, .35); border-radius: 14px; overflow: hidden; box-shadow: 0 28px 60px rgba(8, 14, 28, .55), 0 12px 24px rgba(8, 14, 28, .4), 0 2px 6px rgba(8, 14, 28, .3), inset 0 1px 0 rgba(255, 255, 255, .9), 0 0 0 1px rgba(0, 0, 0, .18); }
.bench-doc__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; padding: 14px 22px; background: linear-gradient(180deg, #c9a84c 0%, #b89638 100%); color: #231708; border-block-end: 1px solid rgba(130, 100, 40, .45); }
.bench-doc__title { font-family: 'Playfair Display', Georgia, serif; font-size: 20px; font-weight: 700; line-height: 1.15; color: #231708; }
.bench-doc__field { font-family: 'IBM Plex Mono', monospace; font-size: 10px; text-transform: uppercase; color: #5e4d24; margin-block-start: 5px; letter-spacing: .12em; }
.bench-doc__close { flex: 0 0 auto; inline-size: 28px; block-size: 26px; border-radius: 7px; border: 1px solid rgba(0, 0, 0, .18); background: rgba(255, 255, 255, .2); color: #231708; font-size: 15px; cursor: pointer; line-height: 1; }
.bench-doc__close:hover { background: rgba(255, 255, 255, .5); }
.bench-doc__body { padding: 14px 22px 22px; overflow: auto; background: linear-gradient(180deg, #fbf8ef 0%, #f5efdc 100%); }
.bench-doc__lede { font-size: 14.5px; line-height: 1.6; color: #3a2f15; margin: 4px 0 6px; }
.bench-doc__h { font-family: 'Playfair Display', Georgia, serif; font-size: 13px; text-transform: uppercase; letter-spacing: .08em; color: #8a7549; margin: 20px 0 8px; font-weight: 700; }
.bench-doc__objlist { margin: 0; padding-inline-start: 18px; }
.bench-doc__objlist li { font-size: 13.5px; line-height: 1.55; margin-block-end: 6px; color: #3a2f15; }
.bench-doc__law { font-size: 14px; font-weight: 600; color: #231708; margin-block-end: 8px; }
.bench-doc__eqs { display: flex; flex-wrap: wrap; gap: 8px; }
.bench-doc__eqs code { font-family: 'IBM Plex Mono', Menlo, monospace; font-size: 12.5px; background: #f4ecd5; border: 1px solid rgba(130, 100, 40, .25); border-radius: 6px; padding: 4px 9px; color: #3a2f15; }
.bench-doc__assume { font-size: 12.5px; color: #6b5c3f; line-height: 1.55; margin-block-start: 8px; }
.bench-doc__cap { font-weight: 600; color: #231708; }
.bench-doc__prog { font-size: 13.5px; line-height: 1.6; color: #3a2f15; margin: 6px 0; }
.bench-doc__chips { display: flex; flex-wrap: wrap; gap: 6px; margin-block-start: 6px; }
.bench-doc__chip { font-size: 11.5px; background: #fff; border: 1px solid rgba(130, 100, 40, .3); border-radius: 14px; padding: 3px 10px; color: #3a2f15; }
.bench-doc__chip--std { font-weight: 700; color: #231708; }

/* Guided learning journey — large in-app popup framing the alwaysAI hosted UI (kin to the
   "Explore concepts" map modal). Sits above the bench-doc modal so it can open over it. */
.learn-overlay { position: fixed; inset: 0; background: rgba(6, 14, 22, .72); display: flex; align-items: center; justify-content: center; padding: 2vh 2vw; z-index: 320; }
.learn-shell { display: flex; flex-direction: column; inline-size: min(1360px, 96vw); block-size: 94vh; border-radius: 14px; overflow: hidden; background: #0a1c2a; box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .8); }
.learn-head { flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 11px 14px; border-block-end: 1px solid rgba(180, 200, 220, .18); background: rgba(13, 49, 74, .55); }
.learn-title { font-size: 14px; font-weight: 600; color: #cddce7; letter-spacing: .02em; }
.learn-actions { display: flex; align-items: center; gap: 8px; }
.learn-close { inline-size: 34px; block-size: 34px; border-radius: 50%; border: 1px solid rgba(180, 200, 220, .4); background: rgba(10, 28, 42, .85); color: #cddce7; font-size: 15px; cursor: pointer; line-height: 1; }
.learn-close:hover { background: rgba(20, 44, 64, .95); }
.learn-body { position: relative; flex: 1; min-height: 0; background: #0a1c2a; }
.learn-loading { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; text-align: center; padding: 24px; color: #9fb6c6; font-size: 13px; pointer-events: none; }
.learn-frame { inline-size: 100%; block-size: 100%; border: none; display: block; }

/* Learn modal — Explore-concept layout: concept list (left) → journey (right). */
.learn-split { flex: 1; min-height: 0; display: grid; grid-template-columns: 248px minmax(0, 1fr); }
.learn-list { overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 6px; border-inline-end: 1px solid rgba(180, 200, 220, .18); background: rgba(13, 49, 74, .35); }
.learn-list__cap { font-size: 10px; text-transform: uppercase; letter-spacing: .08em; color: #7fa0b6; padding: 2px 4px 4px; }
.learn-item { display: flex; align-items: center; gap: 8px; text-align: start; cursor: pointer; border-radius: 9px; padding: 8px 10px; border: 1px solid rgba(180, 200, 220, .22); background: rgba(255, 255, 255, .04); color: #cddce7; font: inherit; font-size: 13px; line-height: 1.3; }
.learn-item:hover { background: rgba(255, 255, 255, .08); }
.learn-item.is-active { border-color: #e3b341; background: rgba(227, 179, 65, .16); }
.learn-item__fit { flex: 0 0 auto; font-size: 9px; text-transform: uppercase; letter-spacing: .04em; color: #0a1c2a; font-weight: 700; border-radius: 5px; padding: 2px 6px; }
.learn-item__label { flex: 1; }
.learn-pane { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.learn-modebar { flex: 0 0 auto; display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-block-end: 1px solid rgba(180, 200, 220, .18); background: rgba(13, 49, 74, .4); }
.learn-modes { display: inline-flex; border: 1px solid rgba(180, 200, 220, .3); border-radius: 8px; overflow: hidden; }
.learn-mode { font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; border: none; background: transparent; color: #9fb6c6; padding: 6px 14px; }
.learn-mode + .learn-mode { border-inline-start: 1px solid rgba(180, 200, 220, .3); }
.learn-mode:hover { color: #cddce7; }
.learn-mode.is-active { background: rgba(214, 73, 47, .85); color: #fff; }
.learn-modebar__concept { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #cddce7; font-size: 13px; font-weight: 600; }
.learn-body--split { flex: 1; }

.landing-footer { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding-block-start: 28px; margin-block-start: 24px; border-block-start: 1px solid var(--line); color: var(--faint); font-size: 12px; flex-wrap: wrap; }
/* Global attribution shown beneath every signed-in view. */
.app-footnote { text-align: center; color: var(--faint); font-size: 11.5px; padding: 22px 16px 28px; margin-block-start: 16px; border-block-start: 1px solid var(--line); }
.landing-back { max-width: 460px; margin: 18px auto -6px; padding: 0 20px; }
@media (max-width: 560px) { .landing-title { font-size: 40px; } }

/* Sortable table of a teacher's custom benches (teacher dashboard "Your bench" card). */
.bench-table { inline-size: 100%; border-collapse: collapse; font-size: 12.5px; margin-block-start: 10px; }
.bench-table th, .bench-table td { text-align: start; padding: 7px 10px; border-block-end: 1px solid var(--line); vertical-align: middle; }
.bench-table thead th { color: var(--mute); text-transform: uppercase; letter-spacing: .06em; font-size: 10.5px; font-weight: 600; cursor: pointer; user-select: none; white-space: nowrap; }
.bench-table thead th:hover { color: var(--ink); }
.bench-table tbody tr { cursor: pointer; }
.bench-table tbody tr:hover { background: var(--panel2); }
.bench-table tbody tr.is-active { background: var(--panel2); box-shadow: inset 3px 0 0 var(--teal); }
.bench-table .num { text-align: end; font-variant-numeric: tabular-nums; }
.bench-table .actions { white-space: nowrap; width: 1%; }
.bench-table .sg-col { min-width: 200px; white-space: nowrap; }
.bench-table .chk { width: 1%; white-space: nowrap; text-align: center; cursor: default; }
.bench-table .chk input { cursor: pointer; }

/* ===========================================================================
   Responsive / mobile pass
   The client has no build step — these are plain media queries layered onto the
   existing class-based styles. The two three-panel "workbench" layouts are
   inline-styled in benchkit.js; they carry .bk-workbench / .bk-explore-split
   hooks and are overridden with !important here because inline styles otherwise
   win the cascade. Spacing uses logical properties so it stays RTL-safe.
   ========================================================================== */

/* Belt-and-braces: never let a stray wide child force horizontal page scroll. */
@media (max-width: 720px) { html, body { overflow-x: hidden; } }

/* ── tablet / small laptop: collapse the three-panel workbenches ─────────── */
@media (max-width: 960px) {
  /* app.jsx circuit lab */
  .lab__grid { grid-template-columns: 1fr; }
  .lab__col--assess { min-height: 0; }

  /* benchkit harness (~70 benches): figure first, then task/hints, then assess */
  .bk-workbench { grid-template-columns: 1fr !important; padding: 14px 14px 48px !important; }
  .bk-workbench > :nth-child(2) { order: -1; }
}

/* ── phone ──────────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .page { padding: 16px 14px; }
  .topbar { padding: 12px 14px; }
  .brand { font-size: 18px; }
  .brand--lg { font-size: 22px; }
  .lab__header, .lab__tasks, .lab__goal, .difficulty-bar { padding-inline: 14px; }
  .lab__title { font-size: 20px; }

  /* dense fixed-column grids → fewer columns */
  .meter-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }

  /* split modals (benchkit "Explore concepts" + the Learn modal) → stack,
     capping the list pane so the content/map below stays reachable */
  .bk-explore-split { grid-template-columns: 1fr !important; grid-template-rows: auto 1fr; }
  .bk-explore-split > :first-child { max-block-size: 40vh; }
  .learn-split { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .learn-list { max-block-size: 38vh; }

  /* modals: less wasted margin, taller; full-bleed shells go edge to edge */
  .modal-overlay, .bench-doc-overlay { padding: 10px; }
  .modal { max-block-size: 92vh; }
  .bench-doc { max-block-size: 94vh; }
  .bench-demo-overlay, .learn-overlay { padding: 0; }
  .bench-demo-shell, .learn-shell { inline-size: 100vw; block-size: 100dvh; border-radius: 0; }
  .bench-demo-toolbar { inset-block-start: 8px; inset-inline-end: 8px; }

  /* wide tables scroll horizontally inside their card instead of the whole page */
  .bench-table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }

  /* tighten the public landing */
  .landing { padding: 0 14px 48px; }
  .landing-hero { padding: 40px 8px 28px; }
  .landing-title { font-size: 38px; }
  .landing-tagline { font-size: 16px; }
  .landing-lede { font-size: 13.5px; }
  .landing-section { padding: 26px 0; }
  .landing-nav { padding: 14px 0; }
}

/* ── small phone ────────────────────────────────────────────────────────── */
@media (max-width: 460px) {
  .meter-grid, .stat-grid { grid-template-columns: 1fr; }
  .landing-title { font-size: 30px; }
  .btn-lg { padding: 9px 14px; font-size: 13px; }
}

/* ── mobile gate ───────────────────────────────────────────────────────────
   Below iPad width the workbench, Learn, Explore and Deep-Learning views don't
   have the room to work well, so we cover the whole app with a single notice
   recommending a larger device. Hidden by default; shown only on phone widths;
   removable via the "Continue anyway" button (adds .mg-dismissed to <body>). */
#mobile-gate { display: none; }
@media (max-width: 767px) {
  #mobile-gate {
    display: flex; position: fixed; inset: 0; z-index: 9999;
    align-items: center; justify-content: center; padding: 28px;
    background: var(--bg); color: var(--ink); text-align: center;
  }
  body.mg-dismissed #mobile-gate { display: none; }
}
.mg-card { max-inline-size: 340px; }
.mg-logo { font-size: 13px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; color: var(--teal); margin-block-end: 22px; }
.mg-title { font-size: 26px; font-weight: 600; line-height: 1.2; margin-block-end: 14px; }
.mg-body { font-size: 14.5px; line-height: 1.65; color: var(--mute); margin: 0 0 26px; }
.mg-dismiss { font: inherit; font-size: 12.5px; cursor: pointer; color: var(--faint); background: transparent; border: 1px solid var(--line); border-radius: 999px; padding: 8px 18px; }
.mg-dismiss:hover { color: var(--ink); border-color: var(--faint); }
