/* ------- design tokens ------- */
:root {
  --bg: #0b0c10;
  --panel: #15171d;
  --panel-2: #1d2128;
  --line: #2a2f3a;
  --line-2: #353b48;
  --text: #f0a35a;         /* orange — high contrast on dark */
  --text-strong: #ffc483;
  --muted: #a37854;
  --muted-2: #6b5238;
  --accent: #f0a35a;
  --accent-2: #ffd9a8;
  --good: #5dd39e;
  --warn: #f5b86b;
  --bad:  #f06c7a;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 1px 0 rgba(255,255,255,0.02) inset, 0 8px 24px rgba(0,0,0,0.25);
}
* { box-sizing: border-box; }
html, body {
  background:
    radial-gradient(900px 600px at 90% -10%, rgba(122,162,255,0.07), transparent 60%),
    radial-gradient(700px 500px at -10% 10%, rgba(74,210,197,0.05), transparent 60%),
    var(--bg);
  color: var(--text); margin: 0;
  font-family: "Heebo", -apple-system, "SF Pro Text", "Segoe UI", "Helvetica Neue", sans-serif;
  font-size: 16px;
  line-height: 1.5;
  min-height: 100lvh;   /* large-viewport height — layout as if URL bar is gone */
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
.muted { color: var(--muted); }
.muted.small { font-size: 12px; }
.warn-text { color: var(--warn); }
.good-text { color: var(--good); }

/* ------- nav ------- */
.topnav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 24px;
  padding-top: max(14px, env(safe-area-inset-top));
  border-bottom: 1px solid var(--line);
  background: rgba(11,12,16,0.85);
  backdrop-filter: saturate(140%) blur(8px);
  position: sticky; top: 0; z-index: 10;
}
.topnav .brand {
  display: inline-flex; flex-direction: column;
  align-items: flex-end; line-height: 1;
  color: var(--text); text-decoration: none;
}
.brand-eyebrow {
  font-size: 9px;
  letter-spacing: 2.4px;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 3px;
}
.brand-name {
  font-size: 19px;
  letter-spacing: 3px;
  font-weight: 800;
  color: var(--text-strong);
}
.topnav-right { display: flex; gap: 14px; align-items: center; min-width: 0; }
.topnav-right .muted {
  max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.topnav-user { text-decoration: none; cursor: pointer; }
.topnav-user:hover { color: var(--text-strong); }
.home-trend {
  margin-top: 28px;
  padding: 18px 20px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.home-trend-head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 12px;
}
.home-trend-head h2 { margin: 0; font-size: 17px; }
.home-trend-chart { display: flex; flex-direction: column; gap: 8px; }
.home-trend-svg {
  width: 100%; height: 180px; display: block;
}
.home-trend-legend {
  display: flex; gap: 18px; justify-content: flex-end;
  font-size: 12px; color: var(--muted);
}
.trend-leg { display: inline-flex; align-items: center; gap: 6px; }
.trend-leg .dot {
  display: inline-block; width: 8px; height: 8px; border-radius: 50%;
}
.trend-leg .break-sym {
  display: inline-block; color: rgba(255,255,255,0.55);
  font-weight: 700; margin-inline-end: 2px;
}
.home-trend-tip {
  position: absolute; pointer-events: none; z-index: 5;
  display: block;
  padding: 8px 12px; border-radius: 8px;
  background: rgba(11,12,16,0.96); border: 1px solid var(--line);
  font-size: 12px; color: var(--text);
  white-space: nowrap;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  min-width: 160px;
}
.home-trend-tip[hidden] { display: none; }
.home-trend-tip .tip-header {
  font-size: 11px; color: var(--muted);
  padding-bottom: 4px; margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}
.home-trend-tip .tip-day { font-variant-numeric: tabular-nums; letter-spacing: 0.5px; }
.home-trend-tip .tip-line {
  display: grid; grid-template-columns: 10px 56px 32px 56px;
  gap: 8px; align-items: center;
  padding: 2px 0;
}
.home-trend-tip .tip-dot {
  width: 8px; height: 8px; border-radius: 50%; display: inline-block;
}
.home-trend-tip .tip-group { color: var(--text-strong); }
.home-trend-tip .tip-score {
  font-variant-numeric: tabular-nums; font-weight: 700; text-align: end;
}
.home-trend-tip .tip-n {
  color: var(--muted); font-variant-numeric: tabular-nums; text-align: end;
}
.trend-point { cursor: crosshair; }

/* ------- info-tip (CSS-only hover/focus explainer) ------- */
.info-tip {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; margin-inline-start: 6px;
  border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel-2); color: var(--muted);
  font-size: 11px; font-weight: 700; line-height: 1;
  cursor: help; vertical-align: middle;
  transition: border-color .12s, color .12s, background .12s;
}
.info-tip:hover, .info-tip:focus {
  border-color: rgba(240,163,90,0.6);
  color: var(--text-strong); background: rgba(240,163,90,0.1);
  outline: none;
}
.info-tip .info-tip-body {
  position: absolute; bottom: calc(100% + 8px); right: 50%;
  transform: translateX(50%);
  width: 240px; max-width: 80vw;
  padding: 10px 12px; border-radius: 8px;
  background: rgba(11,12,16,0.97); border: 1px solid var(--line);
  color: var(--text); font-size: 12px; font-weight: 400; line-height: 1.5;
  white-space: normal; text-align: start;
  box-shadow: 0 6px 18px rgba(0,0,0,0.45);
  opacity: 0; pointer-events: none;
  transition: opacity .12s;
  z-index: 30;
}
.info-tip:hover .info-tip-body, .info-tip:focus .info-tip-body {
  opacity: 1; pointer-events: auto;
}

/* ------- Full Test composites (general / V-heavy / Q-heavy) ------- */
.ft-composites {
  margin: 18px 0 24px;
  padding: 18px 20px 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-card);
}
.ft-composite-row {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.ft-composite-stat { text-align: center; }
.ft-composite-num {
  font-size: 36px; font-weight: 700; color: var(--text-strong);
  font-variant-numeric: tabular-nums; line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ft-composite-label {
  margin-top: 8px; font-size: 13px; color: var(--muted);
}
.ft-subj-row {
  display: flex; justify-content: center; gap: 28px;
  margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line);
  flex-wrap: wrap;
}
.ft-subj { display: inline-flex; flex-direction: column; align-items: center; gap: 2px; }
.ft-subj-name { font-size: 12px; color: var(--muted); }
.ft-subj-val { font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--text); }
.ft-summary-note { margin-top: 10px; text-align: center; }
.ft-composite-raw {
  margin-top: 4px; font-size: 11px; letter-spacing: 0.3px;
  color: #a23a4a; font-variant-numeric: tabular-nums;   /* bordeaux baseline */
}
.ft-composite-raw.equal { color: #a23a4a; }
.ft-composite-raw sup { font-size: 8px; vertical-align: super; opacity: 0.7; }
.ft-subj-raw {
  font-size: 10px; color: #a23a4a;
  font-variant-numeric: tabular-nums; margin-top: 1px;
}
.ft-subj-raw.equal { color: #a23a4a; }
.ft-raw-foot { color: #a23a4a; }
.ft-secd-raw {
  display: block; font-size: 10px; color: var(--muted-2);
  font-variant-numeric: tabular-nums; letter-spacing: 0.2px;
  margin-top: 1px;
}
@media (max-width: 540px) {
  .ft-composite-num { font-size: 28px; }
  .ft-composite-row { gap: 6px; }
  .ft-subj-row { gap: 16px; }
}
.admin-users-table { display: grid; gap: 4px; }
.admin-users-head, .admin-users-row {
  display: grid;
  grid-template-columns: 1.4fr 0.9fr 1.0fr 0.55fr 0.55fr 0.75fr 1.7fr;
  gap: 12px; align-items: center;
  padding: 8px 4px;
  font-size: 13px;
}
.admin-users-head {
  font-size: 11px; letter-spacing: 0.5px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 4px;
  white-space: nowrap;
}
.admin-users-row { border-bottom: 1px solid rgba(255,255,255,0.04); }
.admin-users-row:last-child { border-bottom: 0; }
.admin-users-row.is-admin .name { color: var(--text-strong); }
.admin-users-row .name { font-weight: 600; }
.admin-users-row .num { text-align: end; }
.admin-users-head .num { text-align: end; }
.tabnum { font-variant-numeric: tabular-nums; }
@media (max-width: 720px) {
  .admin-users-head { display: none; }
  .admin-users-row {
    grid-template-columns: 0.8fr 1.2fr;
    gap: 6px 12px;
    padding: 10px 4px;
    border-bottom: 1px solid var(--line);
  }
  /* Row 1: name spans both columns */
  .admin-users-row .name { grid-column: 1 / -1; }
  /* Row 2: נרשם on the right; פעיל on the left */
  .admin-users-row > span:nth-child(2) { grid-column: 1; text-align: right; }
  .admin-users-row > span:nth-child(2)::before { content: "נרשם · "; opacity: 0.5; }
  .admin-users-row > span:nth-child(3) { grid-column: 2; text-align: right; }
  .admin-users-row > span:nth-child(3)::before { content: "פעיל · "; opacity: 0.5; }
  /* Row 3: questions on the right (under נרשם); rounds on the left (under פעיל) */
  .admin-users-row > span:nth-child(4) { grid-column: 1; text-align: right; }
  .admin-users-row > span:nth-child(4)::before { content: "שאלות · "; opacity: 0.5; }
  .admin-users-row > span:nth-child(5) { grid-column: 2; text-align: right; }
  .admin-users-row > span:nth-child(5)::before { content: "סבבים · "; opacity: 0.5; }
  /* Row 4: last score on the right (under questions); V/Q/E breakdown on the left (under rounds) */
  .admin-users-row > span:nth-child(6) { grid-column: 1; text-align: right; }
  .admin-users-row > span:nth-child(6)::before { content: "ציון אחרון · "; opacity: 0.5; }
  .admin-users-row > span:nth-child(7) {
    grid-column: 2; text-align: right;
    font-size: 11px; line-height: 1.35;
  }
  .admin-users-row > span:nth-child(7)::before { content: "מילולי / כמותי / אנגלית · "; opacity: 0.5; }
}
.success {
  background: rgba(93,211,158,0.1); border: 1px solid rgba(93,211,158,0.3);
  color: #c2efd5; padding: 10px 14px; border-radius: 10px;
  font-size: 14px; margin-bottom: 14px;
}
.topnav-right .admin-badge {
  display: inline-block; margin-inline-start: 6px;
  padding: 1px 7px; border-radius: 999px;
  font-size: 10px; letter-spacing: 1.5px; font-weight: 700;
  background: rgba(240,163,90,0.12);
  border: 1px solid rgba(240,163,90,0.35);
  color: var(--text-strong);
  vertical-align: 2px;
}
@media (max-width: 520px) {
  .topnav { padding: 12px 14px; }
  .topnav-right { gap: 10px; }
  .topnav-right .muted { max-width: 42vw; font-size: 13px; }
  .topnav-right .admin-badge {
    font-size: 9px; letter-spacing: 1px; padding: 1px 5px; margin-inline-start: 4px;
  }
  .brand-eyebrow { font-size: 8px; letter-spacing: 2px; }
  .brand-name { font-size: 17px; letter-spacing: 2.5px; }
}
@media (max-width: 340px) {
  .topnav-right .admin-badge { display: none; }
}
.link { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
.topnav-right .link {
  padding: 10px 10px; min-width: 44px; min-height: 44px;
  text-align: center; line-height: 1; border-radius: 8px;
  transition: background .15s, color .15s;
}
.topnav-right .link:hover { background: rgba(240,163,90,0.08); color: var(--text-strong); }

/* ------- page shell ------- */
.page { max-width: 760px; margin: 28px auto 80px; padding: 0 20px; }
body:has(.runner) .page { padding-bottom: 0; }
.hero { margin: 8px 0 20px; }
.hero h1 { font-size: 28px; margin: 0 0 6px; letter-spacing: -0.3px; }
.hero p { margin: 0; color: var(--muted); font-size: 15px; }
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.coverage {
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 6px 12px; border-radius: 999px;
  background: rgba(240,163,90,0.10);
  border: 1px solid rgba(240,163,90,0.30);
  white-space: nowrap;
  font: inherit; cursor: pointer;
  color: var(--text-strong);
  -webkit-tap-highlight-color: transparent;
  transition: background .15s;
}
.coverage:hover, .coverage:focus-visible { background: rgba(240,163,90,0.18); outline: none; }
.coverage.coverage-expanded { background: rgba(240,163,90,0.22); }
.coverage-pct { font-size: 18px; font-weight: 700; color: var(--text-strong); letter-spacing: 0.3px; font-variant-numeric: tabular-nums; }
.coverage.coverage-expanded .coverage-pct { font-size: 14px; font-weight: 600; color: var(--text); letter-spacing: 0; }
.back { display: inline-block; margin-bottom: 8px; color: var(--muted); font-size: 13px; }
.back:hover { color: var(--text); }

/* ------- cards & mode grid ------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: var(--shadow-card);
  margin-bottom: 18px;
}
.card.narrow { max-width: 380px; margin: 80px auto 0; }
h1 { font-size: 24px; margin: 0 0 14px; letter-spacing: -0.2px; }
h2 { font-size: 17px; margin: 0 0 12px; color: var(--text); font-weight: 600; }
.group-title { font-size: 13px; color: var(--muted); margin: 18px 0 8px; font-weight: 500; }

.mode-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 640px) { .mode-grid { grid-template-columns: repeat(3, 1fr); } }
.mode {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 22px 20px;
  display: block; color: var(--text);
  transition: transform .15s, border-color .15s;
  box-shadow: var(--shadow-card);
}
.mode:hover { transform: translateY(-2px); border-color: var(--line-2); }
.mode.primary {
  background:
    radial-gradient(140% 100% at 100% 0%, rgba(122,162,255,0.25), transparent 50%),
    linear-gradient(135deg, #1a2440, #18283b);
  border-color: #2c3a64;
}
.mode.disabled { opacity: 0.5; pointer-events: none; }
.mode h3 { margin: 0 0 4px; font-size: 17px; font-weight: 600; }
.mode p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

/* ------- forms ------- */
form label { display: block; margin-bottom: 14px; }
form label > span { display: block; font-size: 13px; color: var(--muted); margin-bottom: 4px; }
form input[type="text"], form input[type="password"], form input:not([type]) {
  width: 100%; padding: 11px 14px; font: inherit; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 10px;
}
form input:focus { outline: 2px solid var(--accent); outline-offset: 0; border-color: transparent; }

button.primary {
  width: 100%; padding: 12px 18px; font: inherit; color: #16110a; font-weight: 700;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border: 0; border-radius: 12px; cursor: pointer;
  transition: transform .1s, filter .15s, box-shadow .15s;
  box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 6px 18px rgba(240,163,90,0.18);
}
button.primary:hover { filter: brightness(1.05); box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 8px 22px rgba(240,163,90,0.28); }
button.primary:active { transform: translateY(1px); }
button.primary:disabled {
  background: var(--panel-2); color: var(--muted-2); cursor: not-allowed;
  border: 1px solid var(--line); font-weight: 500;
  box-shadow: none;
}
.primary.big, a.primary.big {
  display: inline-block; width: 100%; text-align: center; padding: 14px 18px;
  font-size: 16px; font-weight: 700; border-radius: 14px; color: #16110a;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  text-decoration: none; cursor: pointer; border: 0;
  box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 6px 18px rgba(240,163,90,0.18);
  transition: filter .15s, box-shadow .15s;
}
.primary.big:hover, a.primary.big:hover { filter: brightness(1.05); box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 8px 22px rgba(240,163,90,0.28); }

.error {
  background: rgba(240,108,122,0.1); border: 1px solid rgba(240,108,122,0.3);
  color: #f8c7cc; padding: 10px 14px; border-radius: 10px;
  font-size: 14px; margin-bottom: 14px;
}

/* ------- chips ------- */
.setup section { margin-bottom: 26px; }
.setup.compact { display: grid; gap: 14px; }
.hero.compact { margin: 8px 0 12px; }
.hero.compact h1 { font-size: 22px; margin-bottom: 0; }
.setup.compact .row {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 12px;
  align-items: start;
  margin-bottom: 0;
}
.setup.compact .row.no-label { grid-template-columns: 1fr; }
.setup.compact .row-split {
  display: grid;
  grid-template-columns: 1.3fr 1fr;
  gap: 20px;
  align-items: start;
}
.setup.compact .row-split-cell {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 12px;
  align-items: start;
}
@media (max-width: 540px) {
  .setup.compact .row-split { grid-template-columns: 1fr; gap: 14px; }
}
.setup.compact .row-label {
  font-size: 12px; color: var(--muted); padding-top: 10px;
  text-align: end;
}
.setup.compact .chip { padding: 6px 12px; font-size: 13px; }
.setup.compact .opts { display: flex; gap: 10px; flex-wrap: wrap; }
.setup.compact .opt {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 13px; margin: 0;
  background: var(--panel-2); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.setup.compact .opt input { width: 14px; height: 14px; accent-color: var(--accent); }
.chip-row {
  display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 4px;
}
.chip {
  position: relative;
  display: inline-flex; align-items: baseline; gap: 6px;
  padding: 9px 14px;
  border-radius: 999px;
  background: var(--panel);
  border: 1px solid var(--line);
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  transition: background .12s, border-color .12s;
}
.chip:hover { border-color: var(--line-2); }
.chip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.chip small { color: var(--muted); font-size: 11px; }
.chip:has(input:checked), .chip.on {
  background: rgba(240,163,90,0.16);
  border-color: rgba(240,163,90,0.65);
  color: var(--text-strong);
  box-shadow: 0 0 0 1px rgba(240,163,90,0.25) inset;
}
.chip:has(input:checked) small { color: rgba(255,196,131,0.7); }
.chip.review:has(input:checked) {
  background: rgba(245,184,107,0.16);
  border-color: rgba(245,184,107,0.55);
  color: #f8d6a8;
}

.check {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line);
  margin-bottom: 8px; cursor: pointer;
}
.check input { accent-color: var(--accent); width: 18px; height: 18px; }
.check span { font-size: 14px; }

/* ------- runner ------- */
/* Sticky bottom footer with fixed 4-answer grid + actions.
   Question area gets bottom padding equal to footer height so it never hides
   underneath the controls. */
.runner { max-width: 680px; margin: 0 auto; padding-bottom: 220px; }

/* Runner page: previously tried locking document scroll to keep iOS
   Safari URL bar collapsed. That broke the fixed-footer layout (answer
   buttons offscreen, no way to dismiss the bar in landscape). Reverted
   — runner uses the default sticky-top + fixed-bottom layout. URL bar
   show/hide follows iOS gesture as usual. */
.runner-top { margin-bottom: 12px; }
.q-scroll { /* no special layout — flows in document */ }
.runner-foot {
  position: fixed;
  left: 0; right: 0; bottom: 0;
  background: linear-gradient(180deg, transparent 0%, var(--bg) 24%, var(--bg) 100%);
  padding: 18px 20px 16px;
  padding-bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 5;
}
.runner-foot > .answers,
.runner-foot > .runner-actions,
.runner-foot > .kbd-hint {
  max-width: 680px;
  margin-left: auto;
  margin-right: auto;
}
.kbd-hint {
  text-align: center;
  margin: 8px auto 0;
  font-size: 11px;
  letter-spacing: 0.2px;
}

/* "000" damage-armed button — appears IN-PLACE over the zero-slots row
   once all three zeros are filled. A second tap (or Enter) confirms. */
.damage-toast {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center; justify-content: center;
  font: inherit; font-size: 12px; font-weight: 700;
  letter-spacing: 0.5px;
  color: var(--bad);
  background: rgba(240,108,122,0.15);
  border: 1px solid rgba(240,108,122,0.7);
  border-radius: 8px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s, transform .08s;
}
.damage-toast:hover,
.damage-toast:focus-visible { background: rgba(240,108,122,0.25); outline: none; }
.damage-toast:active { transform: scale(0.97); }
body.damage-armed .zero-block .zero-content { visibility: hidden; }
body.damage-armed .damage-toast { display: flex; }
.progress-line {
  display: flex; justify-content: space-between; align-items: center;
  font-size: 13px; color: var(--muted); margin-bottom: 8px;
  gap: 12px;
}
.counter { font-weight: 500; color: var(--text); }
.badge {
  display: inline-block; padding: 3px 10px; border-radius: 999px;
  background: var(--panel-2); border: 1px solid var(--line);
  font-size: 12px; color: var(--text);
}
.pbar { height: 3px; background: var(--panel-2); border-radius: 999px; overflow: hidden; margin-bottom: 8px; }
.pbar > div { height: 100%; background: var(--accent); transition: width .25s; }

/* Time-track: hidden-budget timer. Fills from 0 to ~100% at 1.5× budget;
   color stages from green to dark-red as the user crosses thresholds. */
.time-track {
  height: 6px;
  background: var(--panel-2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 6px;
}
.time-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  transition: width .25s linear, background-color .8s linear;
  background-color: oklch(0.7 0.18 145);     /* green (default) */
}
.time-fill[data-stage="warn"] { background-color: oklch(0.82 0.15 90); }   /* yellow */
.time-fill[data-stage="late"] { background-color: oklch(0.68 0.22 30); }   /* red */
.time-fill[data-stage="crit"] { background-color: oklch(0.48 0.18 25); }   /* dark red */

.passage {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px; margin-bottom: 12px;
}
.passage summary {
  cursor: pointer; color: var(--muted); font-size: 13px; margin-bottom: 8px;
  list-style: none;
}
.passage summary::-webkit-details-marker { display: none; }
.passage summary::before { content: '▾ '; }
.passage[open] summary::before { content: '▴ '; }
.passage img { width: 100%; background: #fff; border-radius: 10px; display: block; }

.q-stage {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 10px;
  box-shadow: var(--shadow-card);
  position: relative;
}
.q-img { width: 100%; background: #fff; border-radius: 12px; display: block; }

/* Opaque mask that physically covers NITE's printed Q-number on the PNG
   and replaces it with the sprint-sequence number. Sits ON the image.
   Hebrew Qs: NITE's number is at top-right (where Hebrew text begins).
   English Qs: it's at top-left. */
.q-overlay {
  position: absolute;
  top: 18px;
  right: 18px;
  background: white;
  color: var(--accent);
  font-weight: 800;
  font-size: 18px;
  width: 56px; height: 38px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 4px;
  border: 2px solid var(--accent);
}
.runner.ltr .q-overlay { right: auto; left: 18px; }

/* NITE-style answer "bubbles": rounded ovals, dark-graphite fill when selected
   (mimicking a marked answer sheet). Layout still 2x2 grid; each cell is an
   oval the user can tap. */
.answers {
  display: grid; gap: 12px; margin: 14px 0 12px;
  grid-template-columns: 1fr 1fr;
}
.ans {
  position: relative;
  padding: 16px 14px; font: inherit; font-weight: 700; font-size: 22px;
  color: var(--text); background: var(--panel);
  border: 2px solid var(--line); border-radius: 999px;
  cursor: pointer; min-height: 56px;
  transition: transform .08s, background .12s, border-color .12s, color .12s, box-shadow .12s;
  font-variant-numeric: tabular-nums;
}
.ans:hover {
  background: var(--panel-2); border-color: rgba(240,163,90,0.4);
  color: var(--text-strong);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.35), 0 0 0 1px rgba(240,163,90,0.12) inset;
}
.ans:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 3px;
}
.ans.sel {
  /* "Filled bubble" — graphite ink look, the digit still visible inside. */
  background:
    radial-gradient(120% 120% at 30% 30%, #2a2f3a 0%, #14171c 70%, #0b0e13 100%);
  border-color: #0b0e13;
  color: #e8edf5;
  box-shadow:
    inset 0 0 0 4px rgba(0,0,0,0.35),
    inset 0 0 12px rgba(0,0,0,0.55),
    0 2px 6px rgba(0,0,0,0.45);
  text-shadow: 0 1px 2px rgba(0,0,0,0.55);
}
.ans:active { transform: scale(0.96); }

/* Mobile portrait: shrink answer pad + tighten the fixed-bottom footer. */
@media (max-width: 720px) {
  .answers { gap: 8px; margin: 6px 0; }
  .ans {
    padding: 6px 10px; font-size: 17px; min-height: 36px;
    border-width: 1.5px;
  }
  .runner-foot { padding: 8px 12px 10px; }
  .runner-actions { gap: 6px; }
  .runner-actions .skip { padding: 4px 2px; font-size: 13px; }
  .kbd-hint { font-size: 11px; margin-top: 4px; }
  /* Trim the top chrome on phones so the question PNG starts higher. */
  .runner-top { margin-bottom: 6px; }
  .runner .progress-line { margin-bottom: 4px; font-size: 12px; gap: 8px; }
  .runner .pbar { height: 4px; }
  .runner .time-track { height: 3px; margin-top: 4px; }
  .page { margin-top: 10px; margin-bottom: 12px; }
}
/* Any short landscape viewport (phone in landscape, regardless of width).
   Collapse to 1×4 row of narrow pills + tight footer. */
@media (orientation: landscape) and (max-height: 540px) {
  .answers { grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 2px 0; }
  .ans { padding: 4px 6px; font-size: 15px; min-height: 28px; }
  .runner-foot { padding: 4px 10px 6px; }
  .kbd-hint { display: none; }
  /* Aggressive top-chrome trim — the question PNG owns the viewport.
     Brand stays in full ("UNDERSTAIRS PSYCHOS") but laid out inline so
     the whole string fits on a single short row. */
  .topnav { padding: 4px 12px; }
  .topnav .brand {
    flex-direction: row; gap: 6px; align-items: baseline;
    direction: ltr;   /* keep UNDERSTAIRS first, PSYCHOS second */
  }
  .topnav .brand-eyebrow {
    display: inline; font-size: 9px; letter-spacing: 1.4px; margin-bottom: 0;
  }
  .topnav .brand-name { font-size: 12px; letter-spacing: 1.5px; }
  .runner-top { margin-bottom: 2px; }
  .runner .progress-line { margin-bottom: 2px; font-size: 11px; }
  .runner .pbar { height: 3px; }
  .runner .time-track { height: 2px; margin-top: 2px; }
  .runner { padding-bottom: 110px; }
  .page { margin: 6px auto 0; }
}

.runner-actions {
  display: flex; gap: 10px; align-items: center;
}
.runner-actions .primary { flex: 1; }
.runner-actions .skip { color: var(--muted); padding: 8px 4px; flex-shrink: 0; }
.runner-actions .skip:hover { color: var(--text); }
.zero-block {
  position: relative;
  display: flex; flex-direction: column; align-items: center;
  gap: 4px; flex-shrink: 0; margin-inline-start: 6px;
  cursor: pointer; user-select: none; -webkit-tap-highlight-color: transparent;
  /* Mobile-friendly tap target — buttons start at 24px tall, the whole
     block is at least 44px tappable with the label included. */
  padding: 6px 8px; border-radius: 8px;
}
.zero-content {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}
.zero-block:active { background: rgba(240,108,122,0.08); }
body.damage-armed .zero-block { background: rgba(240,108,122,0.12); }
.zero-slots { display: flex; gap: 3px; }
.zero-slot {
  width: 18px; height: 24px;
  border: 1px dashed rgba(240,108,122,0.4);
  border-radius: 4px;
  background: transparent;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px;
  color: transparent;
  transition: color .15s, border-color .15s, background .15s;
}
.zero-slot.on {
  color: var(--bad);
  border-style: solid;
  border-color: rgba(240,108,122,0.7);
  background: rgba(240,108,122,0.1);
}
.zero-slot.on::before { content: '0'; }
.zero-label {
  font-style: italic;
  font-size: 9px;
  color: var(--bad);
  text-align: center;
  line-height: 1.2;
  letter-spacing: 0.2px;
  opacity: 0.85;
}

.runner.ltr .progress-line, .runner.ltr .meta, .runner.ltr .runner-actions { direction: ltr; }
.runner.ltr .answers { direction: ltr; }

/* ------- result ------- */
.score-block { text-align: center; margin: 24px 0 28px; }
.score-main {
  font-size: 88px; font-weight: 700; letter-spacing: -2px;
  font-variant-numeric: tabular-nums; line-height: 1;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.score-sub { color: var(--muted); font-size: 14px; margin-top: 8px; }
.score-scale {
  display: flex; align-items: center; gap: 8px;
  max-width: 280px; margin: 14px auto 0;
  font-size: 11px; color: var(--muted-2);
  font-variant-numeric: tabular-nums; letter-spacing: 0.5px;
}
.score-scale-end { flex-shrink: 0; min-width: 22px; }
.score-scale-rail {
  position: relative; flex: 1; height: 4px;
  background: var(--panel-2); border-radius: 999px;
  border: 1px solid var(--line);
}
.score-scale-tick {
  position: absolute; top: 50%;
  width: 10px; height: 10px;
  background: var(--accent); border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 0 2px var(--bg), 0 0 8px rgba(240,163,90,0.5);
}

.weak-list { list-style: none; padding: 0; margin: 0; }
.weak-list li {
  display: grid; grid-template-columns: 1.2fr 2fr auto; gap: 12px;
  align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line);
}
.weak-list li:last-child { border-bottom: 0; }
.weak-list .label { font-size: 14px; }
.weak-list .ratio { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13px; }
.weak-list .bar {
  display: block; height: 8px; background: var(--panel-2);
  border-radius: 999px; overflow: hidden;
}
.weak-list .bar-fill { display: block; height: 100%; }
.weak-list .bar-fill.good { background: var(--good); }
.weak-list .bar-fill.mid { background: var(--warn); }
.weak-list .bar-fill.bad { background: var(--bad); }

.result-actions { display: grid; gap: 10px; margin-top: 18px; }
.result-actions .link { display: block; text-align: center; padding: 4px; }

/* ------- home sub-tiles ------- */
.sub-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px; margin-top: 16px;
}
@media (min-width: 640px) {
  .sub-grid { grid-template-columns: repeat(3, 1fr); }
}
.sub-tile {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px;
  display: flex; align-items: center; gap: 10px;
  color: var(--text); transition: border-color .12s, transform .1s;
}
.sub-tile:hover { border-color: var(--line-2); transform: translateY(-1px); }
.sub-icon { font-size: 20px; }
.sub-text { font-size: 14px; }

/* ------- callout (review banner) ------- */
.callout {
  display: flex; justify-content: space-between; align-items: center;
  background:
    radial-gradient(120% 100% at 100% 0%, rgba(245,184,107,0.18), transparent 60%),
    var(--panel);
  border: 1px solid rgba(245,184,107,0.35);
  border-radius: var(--radius); padding: 14px 18px;
  margin-bottom: 16px;
  color: var(--text);
}
.callout .arrow { color: var(--warn); font-size: 18px; }
.callout.positive {
  background:
    radial-gradient(120% 100% at 100% 0%, rgba(122,162,255,0.18), transparent 60%),
    var(--panel);
  border-color: rgba(122,162,255,0.4);
}
.callout-title { font-weight: 600; margin-bottom: 2px; }
.inline-form { margin: 0; }
.inline-form button { min-width: 140px; padding: 10px 16px; }

/* ------- profile skill list ------- */
.skill-head {
  display: grid; grid-template-columns: 1.4fr 2fr 56px 80px;
  gap: 20px; align-items: center;
  padding: 6px 0 10px;
  font-size: 11px; letter-spacing: 1px; text-transform: uppercase;
  border-bottom: 1px solid var(--line); margin-bottom: 4px;
}
.skill-head-label { font-size: 11px; }
.skill-head-bar {}
.skill-head-elo { text-align: end; font-size: 11px; }
.skill-head-att { text-align: end; font-size: 11px; }
.skill-list { list-style: none; padding: 0; margin: 0 0 6px; }
.skill-list li {
  display: grid; grid-template-columns: 1.4fr 2fr 56px 80px;
  gap: 20px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
}
.skill-list li:last-child { border-bottom: 0; }
.skill-list .label { font-size: 14px; }
.skill-list .bar {
  position: relative;
  height: 8px; background: var(--panel-2); border-radius: 999px; overflow: hidden;
}
.skill-list .bar::after {
  /* Midline tick = NITE-rank 100 (the calibration anchor on the 50–150 scale). */
  content: ""; position: absolute; top: 0; bottom: 0; left: 50%;
  width: 1px; background: rgba(255,255,255,0.18); pointer-events: none;
}
.skill-list .bar-fill { display: block; height: 100%; }
.skill-list .bar-fill.good { background: var(--good); }
.skill-list .bar-fill.mid { background: var(--accent); }
.skill-list .bar-fill.bad { background: var(--bad); }
.skill-list .elo { font-variant-numeric: tabular-nums; font-weight: 600; text-align: end; }
.skill-list .att { font-size: 13px; font-variant-numeric: tabular-nums; text-align: end; color: var(--muted); }

/* ------- sprint history list ------- */
/* Columns mirror .skill-list so the score column lines up with the
   per-subtype rank column above it (1.4fr 2fr 56px 80px). */
.sprint-list { list-style: none; padding: 0; margin: 0; }
.sprint-list li { border-bottom: 1px solid var(--line); }
.sprint-list li:last-child { border-bottom: 0; }
.sprint-list .sprint-link {
  display: grid;
  grid-template-columns: 92px 1fr 60px 70px 14px;
  gap: 16px; align-items: center;
  padding: 10px 6px;
  color: inherit; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
  transition: background .12s;
}
.sprint-list .topic { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sprint-list .sprint-link:hover,
.sprint-list .sprint-link:focus-visible {
  background: rgba(240,163,90,0.06);
  outline: none;
}
.sprint-list .when { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.sprint-list .topic { font-size: 14px; color: var(--text); }
.sprint-list .score { font-weight: 600; font-variant-numeric: tabular-nums; color: var(--accent); text-align: end; }
.sprint-list .small { text-align: end; }
.sprint-list .chevron { color: var(--muted); font-size: 16px; text-align: center; }

/* Mobile PDF modal (pdf.js viewer) */
.pdf-modal {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(11,12,16,0.96);
  padding: max(12px, env(safe-area-inset-top)) 8px
           max(12px, env(safe-area-inset-bottom)) 8px;
}
.pdf-modal[hidden] { display: none; }
.pdf-modal iframe {
  width: 100%; height: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #1e1e1e;
}
.pdf-close {
  position: absolute;
  top: calc(8px + env(safe-area-inset-top));
  inset-inline-end: 12px;
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--text-strong);
  font-size: 24px; font-weight: 700; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(0,0,0,0.5);
  z-index: 1001;
}


/* ------- review due list ------- */
.due-list { list-style: none; padding: 0; margin: 0; }
.due-list li {
  display: flex; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--line);
}
.due-list li:last-child { border-bottom: 0; }
/* Specificity bump: .due-list li sets display:flex, so we need
   .due-list .due-row-li to win. */
.due-list .due-row-li {
  display: grid; grid-template-columns: 1fr 110px auto;
  gap: 18px; align-items: center;
  padding: 10px 0; border-bottom: 1px solid var(--line);
  justify-content: initial;
}
.due-list .due-row-li:last-child { border-bottom: 0; }
.due-list .due-row-li .due-label { font-size: 14px; }
/* RTL row, but make the count cell a fixed-width sub-grid where the
   number sits in a 40-px right-aligned column and "שאלות" follows. */
.due-list .due-row-li .due-count {
  font-size: 13px; font-variant-numeric: tabular-nums;
  display: inline-grid; grid-template-columns: 40px auto;
  gap: 6px; align-items: baseline; justify-self: end;
}
.due-list .due-row-li .due-count-num { text-align: end; }
.due-list .due-row-li .due-count-word { text-align: start; }
.due-cta {
  font: inherit; font-size: 13px; font-weight: 600; color: var(--accent);
  background: transparent; border: 1px solid rgba(240,163,90,0.35);
  border-radius: 999px; padding: 6px 14px; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.due-cta:hover {
  background: rgba(240,163,90,0.1);
  border-color: rgba(240,163,90,0.6);
  color: var(--text-strong);
}

/* ------- post-sprint walkthrough ------- */
.walkthrough { display: grid; gap: 18px; }
.walk-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--radius-lg); padding: 16px;
  box-shadow: var(--shadow-card);
}
.walk-card.miss { border-color: rgba(240,108,122,0.35); }
.walk-card.ok   { border-color: rgba(93,211,158,0.25); }
.walk-head { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.walk-no {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--panel-2); display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 12px; color: var(--muted);
}
.walk-pill {
  margin-inline-start: auto;
  padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600;
}
.walk-pill.ok { background: rgba(93,211,158,0.18); color: #95e8bf; }
.walk-pill.miss { background: rgba(240,108,122,0.18); color: #f5b3bb; }
.walk-q { position: relative; margin-bottom: 12px; }
.walk-q .q-img { width: 100%; background: #fff; border-radius: 10px; display: block; }
.walk-q .q-overlay {
  position: absolute; top: 8px; right: 8px;
  background: white; color: var(--accent);
  width: 50px; height: 34px; border-radius: 4px;
  border: 2px solid var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 16px;
}
.walk-card.ltr .walk-q .q-overlay { right: auto; left: 8px; }

.walk-pill.skip { background: var(--panel-2); color: var(--muted); }

.walk-meta {
  display: flex; gap: 8px; align-items: center;
  margin: 10px 0 4px;
}
.walk-source {
  font-size: 12px; color: var(--muted);
  margin: 4px 0 14px;
  letter-spacing: 0.2px;
}
.walk-source a { color: var(--accent); text-decoration: none; }
.walk-source a:hover { text-decoration: underline; }
/* Fixed two-cell layout: chosen-wrong on right, correct on left.
   Direction locked to RTL so it doesn't flip on English Qs. */
.walk-verdict {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; align-items: center;
}
.walk-verdict > div {
  padding: 8px 14px;
  display: flex; gap: 10px; align-items: baseline;
}
.walk-verdict .hidden { visibility: hidden; }
/* Chosen-wrong: red frame on the right (RTL = first item) */
.verdict-chosen {
  background: rgba(240,108,122,0.12);
  border: 1px solid rgba(240,108,122,0.5);
  border-radius: 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.verdict-chosen .vlabel { color: #f5b3bb; font-size: 14px; }
.verdict-chosen .vlabel strong { font-size: 17px; font-weight: 700; }
.verdict-chosen .vtime  { color: rgba(245,179,187,0.7); font-size: 11px; }
.verdict-chosen .vnum   { color: #f5b3bb; font-size: 20px; font-weight: 700; }
/* Correct answer (after wrong) — calm, no frame */
.verdict-correct { background: transparent; border: 0; }
.verdict-correct .vlabel { color: var(--muted); font-size: 13px; }
.verdict-correct .vnum   { color: var(--text); font-size: 20px; font-weight: 700; }
/* Correct answer ALONE (got it right) — green frame mirroring the red one */
.verdict-correct.framed {
  background: rgba(93,211,158,0.12);
  border: 1px solid rgba(93,211,158,0.5);
  border-radius: 10px;
  display: flex; flex-direction: column; gap: 2px;
}
.verdict-correct.framed .vlabel { color: #95e8bf; font-size: 14px; }
.verdict-correct.framed .vlabel strong { font-size: 17px; font-weight: 700; color: #c4f5dc; }
.verdict-correct.framed .vtime  { color: rgba(149,232,191,0.7); font-size: 11px; }
.verdict-correct.framed .vnum   { color: #c4f5dc; font-size: 20px; font-weight: 700; }

/* ── Compete mode ─────────────────────────────────────────────────────── */
.join-card {
  margin: 28px auto 0; max-width: 540px;
  background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px; padding: 22px 22px; text-align: center;
}
.join-card h3 { margin: 0 0 14px; font-size: 18px; color: var(--text); font-weight: 600; }
.join-form { display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.join-form input {
  width: 100%; box-sizing: border-box; font-family: monospace; font-size: 38px;
  letter-spacing: 12px; text-align: center; text-transform: uppercase;
  padding: 18px 16px; background: rgba(0,0,0,0.3); color: var(--accent);
  border: 1px solid rgba(255,255,255,0.18); border-radius: 12px;
}
.join-form input::placeholder { color: rgba(255,255,255,0.25); letter-spacing: 4px; font-size: 18px; }
.join-form button { font-size: 17px; padding: 14px 22px; }
.lobby { max-width: 480px; margin: 0 auto; text-align: center; }
.room-code { margin: 18px 0; }
.room-code-label { color: var(--muted); font-size: 13px; }
.room-code-value {
  font-family: monospace; font-size: 42px; letter-spacing: 8px;
  color: var(--accent); margin: 6px 0; user-select: all;
}
.lobby-meta { color: var(--muted); font-size: 14px; margin: 14px 0; }
.lobby-meta span { margin: 0 6px; }
.lobby-players {
  list-style: none; padding: 0; margin: 18px auto; max-width: 320px;
  text-align: right;
}
.lobby-players li {
  padding: 10px 14px; background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08); border-radius: 10px;
  margin: 6px 0; display: flex; justify-content: space-between; align-items: center;
}
.badge.tiny { font-size: 10px; padding: 2px 6px; }
.lobby-actions { margin-top: 24px; }

/* Leaderboard */
.leaderboard { max-width: 520px; margin: 16px auto; }
.lb-row {
  display: grid; grid-template-columns: 50px 1fr auto auto;
  align-items: center; gap: 12px; padding: 14px 16px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08); border-radius: 12px;
  margin: 8px 0;
}
.lb-row.winner { border-color: rgba(255,193,89,0.6); background: rgba(255,193,89,0.06); }
.lb-row.pending { opacity: 0.6; }
.lb-rank { font-size: 24px; font-weight: 700; text-align: center; }
.lb-name { font-size: 17px; font-weight: 500; }
.lb-stat { font-size: 15px; text-align: left; direction: ltr; }
.lb-stat strong { font-size: 22px; color: var(--accent); }
.result-actions { text-align: center; margin: 24px 0; }
.result-actions a { margin: 0 6px; }
.link.tiny { font-size: 12px; }

/* Two-row topic picker: subtypes row dims when mode != specific */
.subtypes-row.dimmed { opacity: 0.4; pointer-events: none; }
.subtypes-row.dimmed input { cursor: not-allowed; }
.subtype-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 18px;
  align-items: start;
}
.subtype-col { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.subtype-col-head {
  font-size: 12px; letter-spacing: 0.5px; font-weight: 700;
  color: var(--muted); text-transform: none;
  text-align: center;
  padding-bottom: 4px; margin-bottom: 2px;
  border-bottom: 1px solid var(--line);
}
.subtype-col .chip {
  background: rgba(255,255,255,0.04);
  width: 100%;
  min-height: 56px;
  align-items: center;
  justify-content: center;
  text-align: center;
}
.subtype-col .chip > span:first-of-type { display: block; line-height: 1.2; }
.subtype-col .chip input[type=checkbox]:checked ~ span { color: var(--accent); }
@media (max-width: 640px) {
  .subtype-grid { gap: 8px; }
  .subtype-col { gap: 4px; }
  .subtype-col-head { font-size: 11px; padding-bottom: 3px; }
  .subtype-col .chip { padding: 8px 6px; font-size: 12px; }
  .subtype-col .chip span { white-space: normal; line-height: 1.2; }
}
.chip-multi .chip { background: rgba(255,255,255,0.04); }
.chip-multi .chip input:checked + span {
  /* checkbox-style chip stays brighter when ticked */
}
.chip input[type=checkbox]:checked ~ span { color: var(--accent); }
.chip input[type=checkbox]:checked { /* still hidden */ }

.row-content { min-width: 0; }
.flag-legend { margin: 6px 2px 0; font-size: 12px; }

/* Full Test picker */
.ft-picker { display: block; margin-top: 8px; }
.ft-group { font-size: 14px; color: var(--muted); margin: 18px 0 8px; font-weight: 500; }
.ft-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px; grid-auto-rows: 78px;
}
.ft-card {
  position: relative; padding: 14px;
  display: flex; flex-direction: column; justify-content: center;
  cursor: pointer;
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  transition: border-color .12s, background .12s;
  box-sizing: border-box; height: 100%;
}
a.ft-card { text-decoration: none; color: inherit; }
.ft-card input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.ft-card:has(input:checked) {
  border-color: rgba(240,163,90,0.55);
  background: rgba(240,163,90,0.06);
  box-shadow: 0 0 0 1px rgba(240,163,90,0.15) inset;
}
.ft-title { display: block; font-weight: 600; font-size: 15px; color: var(--text); }
.ft-sub { display: block; font-size: 12px; margin-top: 2px; }
#ft-start { margin-top: 22px; }

/* Full Test result */
.ft-summary {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px;
  margin: 16px 0 24px;
}
.ft-summary-stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px; text-align: center;
}
.ft-summary-num {
  font-size: 28px; font-weight: 700; color: var(--accent);
  font-family: monospace; letter-spacing: -1px;
}
.ft-summary-label { font-size: 12px; margin-top: 4px; }

.ft-sections { max-width: 520px; margin: 8px auto; }
.ft-sec-row {
  display: grid; grid-template-columns: 1fr 60px 70px 50px;
  align-items: center; gap: 8px; padding: 12px 14px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.06); border-radius: 10px;
  margin: 6px 0;
}
.ft-sec-label { font-weight: 500; font-size: 14px; line-height: 1.3; }
.ft-sec-correct { font-size: 13px; color: var(--muted); text-align: center; }
.ft-sec-score { text-align: center; }
.ft-sec-score strong { font-size: 19px; color: var(--accent); }

/* Live partner-progress strip inside the compete runner. */
.partner-strip {
  margin-top: 8px;
  display: flex; flex-direction: column; gap: 4px;
  font-size: 12px;
}
.partner-row {
  display: grid;
  grid-template-columns: 1fr 90px 50px;
  align-items: center; gap: 8px;
  padding: 4px 8px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 8px;
}
.partner-row.done { border-color: rgba(93,211,158,0.45); background: rgba(93,211,158,0.08); }
.partner-name { font-weight: 500; color: var(--muted); }
.partner-row.done .partner-name { color: var(--good); }
.partner-pbar { display: block; height: 4px; background: rgba(255,255,255,0.08); border-radius: 2px; overflow: hidden; }
.partner-pbar > span { display: block; height: 100%; background: var(--accent); transition: width .3s ease; }
.partner-row.done .partner-pbar > span { background: var(--good); }
.partner-stat { font-family: monospace; font-size: 11px; text-align: left; direction: ltr; color: var(--muted); }
.partner-row.done .partner-stat { color: var(--good); font-weight: 600; }

/* Full Test section-level countdown bar. */
.ft-section-bar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 6px 10px;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  font-size: 13px; margin-bottom: 8px;
}
.ft-section-code { color: var(--muted); letter-spacing: 1px; font-weight: 600; font-size: 12px; }
.ft-section-remaining { font-family: monospace; color: var(--accent); font-size: 15px; font-variant-numeric: tabular-nums; }
.ft-section-bar[data-stage="warn"] { border-color: rgba(245,184,107,0.45); }
.ft-section-bar[data-stage="warn"] .ft-section-remaining { color: var(--warn); }
.ft-section-bar[data-stage="crit"] { border-color: rgba(240,108,122,0.45); background: rgba(240,108,122,0.06); }
.ft-section-bar[data-stage="crit"] .ft-section-remaining { color: var(--bad); }

/* ── Essay practice ──────────────────────────────────────────────────── */
.essay-picker { display: block; margin: 14px 0; }
.essay-card {
  position: relative; display: block; cursor: pointer;
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 10px;
}
.essay-card input { position: absolute; opacity: 0; inset: 0; cursor: pointer; }
.essay-card:has(input:checked) {
  border-color: rgba(240,163,90,0.55);
  background: rgba(240,163,90,0.06);
  box-shadow: 0 0 0 1px rgba(240,163,90,0.15) inset;
}
.essay-title { display: block; font-weight: 600; font-size: 16px; margin-bottom: 4px; }
.essay-prompt-preview { display: block; line-height: 1.4; }
.essay-history { display: grid; gap: 6px; margin-top: 12px; }
.essay-hist-row {
  display: flex; justify-content: space-between; padding: 10px 14px;
  background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.06);
  border-radius: 8px; color: var(--text);
}

/* Editor */
.essay-editor { max-width: 760px; margin: 0 auto; }
.essay-top {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 16px 18px; margin-bottom: 14px;
}
.essay-meta {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px;
}
.essay-section-code { color: var(--muted); letter-spacing: 1px; font-weight: 600; font-size: 13px; }
.essay-section-remaining {
  font-family: monospace; color: var(--accent); font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.essay-section-remaining[data-stage="warn"] { color: var(--warn); }
.essay-section-remaining[data-stage="crit"] { color: var(--bad); }
.essay-prompt { font-size: 15px; line-height: 1.6; }
#essay-body {
  width: 100%; min-height: 50vh; box-sizing: border-box;
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px;
  padding: 14px 16px; font: inherit; font-size: 16px;
  line-height: 1.7; resize: vertical;
}
.essay-foot {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 12px;
}
.essay-stats { color: var(--muted); font-size: 13px; }
#essay-submit { width: auto; padding: 10px 22px; }

/* Result */
.essay-overall {
  text-align: center; margin: 18px 0;
}
.essay-overall-num {
  font-size: 56px; font-weight: 700; color: var(--accent);
  font-family: monospace; letter-spacing: -2px;
}
.essay-rubric {
  display: grid; gap: 8px; margin: 16px auto; max-width: 380px;
}
.rubric-row {
  display: grid; grid-template-columns: 1fr auto auto;
  align-items: baseline; gap: 8px; padding: 12px 16px;
  background: rgba(255,255,255,0.04); border-radius: 10px;
}
.rubric-row strong { font-size: 22px; color: var(--accent); font-family: monospace; }
.essay-feedback {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 16px 18px; margin: 18px 0;
}
.essay-feedback h3 { margin: 0 0 8px; font-size: 14px; color: var(--muted); font-weight: 500; }
.essay-feedback p { margin: 0; line-height: 1.6; }
.essay-body-show {
  margin-top: 18px;
}
.essay-body-show summary { cursor: pointer; color: var(--muted); font-size: 14px; }
.essay-body-show pre {
  white-space: pre-wrap; font: inherit; line-height: 1.7;
  background: rgba(0,0,0,0.2); padding: 14px 16px; border-radius: 10px;
  margin-top: 10px;
}

/* Admin: damaged-Qs review */
.dmg-list { display: grid; gap: 14px; margin: 14px 0; }
.dmg-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px; display: grid; gap: 8px;
}
.dmg-meta { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.dmg-count {
  font-size: 11px; padding: 2px 8px; border-radius: 999px;
  background: rgba(240,108,122,0.16); color: #f8c7cc;
  margin-inline-start: auto;
}
.dmg-img {
  width: 100%; max-height: 480px; object-fit: contain;
  background: white; border-radius: 8px;
}
.dmg-actions { display: flex; gap: 12px; flex-wrap: wrap; }
.dmg-actions form button { padding: 4px 8px; }

/* Essay line-count goal indicator */
.essay-stats[data-stage="under"] { color: var(--muted); }
.essay-stats[data-stage="mid"]   { color: var(--warn); }
.essay-stats[data-stage="goal"]  { color: var(--good); font-weight: 600; }
.essay-stats[data-stage="goal"]::after {
  content: " ✓"; color: var(--good);
}
.essay-stats #essay-lines, .essay-stats #essay-words {
  font-family: monospace; font-variant-numeric: tabular-nums;
}
.essay-dot { color: var(--muted); margin: 0 4px; }

.login-note {
  margin-top: 18px;
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.07);
  border-radius: 10px;
  padding: 10px 12px;
}

/* Essay submit pending state */
.essay-submit-pending { display: none; }
.essay-grading #essay-submit {
  background: var(--panel-2); color: var(--muted-2);
  cursor: wait; opacity: 0.95;
}
.essay-grading .essay-submit-label { display: none; }
.essay-grading .essay-submit-pending {
  display: inline-flex; align-items: center; gap: 8px;
}
.essay-grading .essay-submit-pending::before {
  content: ""; display: inline-block; width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.18);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: essay-spin .8s linear infinite;
}
.essay-grading #essay-body { opacity: 0.7; cursor: not-allowed; }
@keyframes essay-spin { to { transform: rotate(360deg); } }

/* Full Test picker: mark already-completed tests.
   Border stays solid + same width so the box doesn't grow visually; the
   dimmed opacity + ✓ prefix are the only signals. */
.ft-card.done {
  opacity: 0.55;
}
.ft-card.done .ft-title { color: var(--muted); }
.ft-card.done .ft-sub::after { content: ""; }
/* Anchor + label render identical box-sizing; force the same baseline */
.ft-card { box-sizing: border-box; }

/* ── Full Test result v2 ──────────────────────────────────────────────── */
.trend-strip {
  margin: 8px 0 18px; padding: 8px;
  background: rgba(0,0,0,0.2); border-radius: 10px;
  overflow-x: auto;
}
.trend-svg { display: block; width: 100%; height: 120px; }

.ft-sections-detail { display: grid; gap: 10px; margin: 10px 0; }
.ft-secd-row {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 12px; padding: 12px 14px;
}
.ft-secd-head {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 6px;
}
.ft-secd-label { font-weight: 600; font-size: 14px; }
.ft-secd-score strong { font-size: 22px; color: var(--accent); font-family: monospace; }
.ft-secd-counts {
  display: flex; align-items: center; flex-wrap: wrap; gap: 10px;
  font-size: 13px; font-variant-numeric: tabular-nums;
}
.cnt-correct { color: var(--good); font-weight: 600; }
.cnt-wrong   { color: var(--bad);  font-weight: 600; }
.cnt-skip    { color: var(--muted); font-weight: 600; }
.ft-secd-bar {
  display: flex; height: 6px; margin-top: 8px;
  background: rgba(255,255,255,0.05); border-radius: 3px; overflow: hidden;
}
.ft-secd-bar > span { display: block; height: 100%; }
.bar-correct { background: var(--good); }
.bar-wrong   { background: var(--bad);  }
.bar-skip    { background: rgba(255,255,255,0.15); }

.ft-essay-card {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 14px; padding: 18px;
}
.ft-essay-overall { text-align: center; margin-bottom: 14px; }
.ft-essay-overall-num {
  display: block; font-size: 44px; font-weight: 700; color: var(--accent);
  font-family: monospace; line-height: 1; letter-spacing: -2px;
}
.ft-essay-rubric { display: grid; gap: 6px; margin-bottom: 14px; }

/* Done full-test cards: large ✓ on the left edge (LTR-left, regardless of
   RTL text direction), absolutely positioned so it doesn't push the title
   and grow the card height. */
.ft-card.done::after {
  content: "✓";
  position: absolute;
  top: 50%; left: 12px; transform: translateY(-50%);
  color: var(--good); font-weight: 800; font-size: 28px;
  line-height: 1;
  text-shadow: 0 0 12px rgba(93,211,158,0.35);
}
.ft-card.done {
  padding-inline-start: 42px;
}

/* Full Test picker: mobile-only warning that the exam is best on desktop */
.mobile-only { display: none; }
@media (max-width: 720px) {
  .mobile-only { display: block; }
}
.ft-warn {
  border: 1px solid rgba(245,184,107,0.45);
  background: rgba(245,184,107,0.08);
  color: var(--text);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 4px 0 18px;
  font-size: 13px; line-height: 1.5;
}
.ft-warn strong { color: var(--warn); }

/* Full Test picker: sticky CTA bar pinned to viewport bottom */
.ft-picker { padding-bottom: 88px; /* room for sticky bar */ }
.ft-sticky-cta {
  position: fixed; bottom: 0; right: 0; left: 0;
  display: flex; gap: 12px; align-items: center;
  padding: 12px 18px;
  background: rgba(11,12,16,0.92);
  border-top: 1px solid var(--line);
  backdrop-filter: saturate(140%) blur(8px);
  z-index: 20;
  padding-bottom: max(12px, env(safe-area-inset-bottom));
}
.ft-cta-label {
  flex: 1; font-size: 14px; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.ft-sticky-cta button { width: auto; padding: 12px 26px; font-size: 16px; flex-shrink: 0; }
@media (max-width: 520px) {
  .ft-picker { padding-bottom: 128px; }
  .ft-sticky-cta {
    flex-direction: column; align-items: stretch;
    gap: 8px; padding: 10px 14px;
  }
  .ft-cta-label { text-align: center; font-size: 13px; }
  .ft-sticky-cta button { width: 100%; padding: 12px 18px; font-size: 15px; }
}

/* Done cards are anchors now; keep them looking like inert tiles */
a.ft-card { text-decoration: none; }
a.ft-card.done:hover { border-style: solid; opacity: 0.85; }

.share-row { display: flex; gap: 18px; justify-content: center; margin: 6px 0; }
.share-row .link { font-size: 13px; }

/* Highlight current user's row in the compete leaderboard */
.lb-row.me {
  outline: 2px solid rgba(122,162,255,0.5);
  outline-offset: -2px;
}

/* Profile trend chart */
.trend-charts { display: grid; gap: 14px; margin-top: 6px; }
.trend-row {
  display: grid; grid-template-columns: 110px 1fr;
  gap: 12px; align-items: center;
}
.trend-label { font-size: 13px; display: flex; align-items: center; gap: 6px; }
.trend-dot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%;
}
.trend-svg {
  width: 100%; height: 32px;
  background: rgba(255,255,255,0.03);
  border-radius: 4px;
}
.trend-empty {
  background: rgba(255,255,255,0.03); border-radius: 4px;
  padding: 6px; text-align: center;
}
