/* All India Mock — web player. Tokens copied from the app (slgs-flutter app_palette.dart, light theme). */
:root {
  --brand: #0048D0;
  --brand-dark: #003AA8;
  --brand-soft: #EAF1FF;
  --ink: #0A0D14;
  --ink2: #3C4257;
  --muted: #7D8398;          /* decorative only (rings, icons) */
  --muted-text: #646A7F;     /* text: #7D8398 is 3.8:1 on white, below 4.5:1, so text uses this */
  --surface: #FFFFFF;
  --surface2: #F6F7FA;
  --surface3: #EDEFF4;
  --scaffold: #F8F9FC;
  --border: #E6E8EE;
  --border-strong: #D2D6E0;
  --green: #34C759;
  --orange: #FF9500;
  --red: #FF3B30;
  --danger-text: #C62828;
  --r10: 10px; --r12: 12px; --r16: 16px; --r20: 20px;
  --pw: 380px;               /* palette width, set by the drag handle */
  --qs: 1;                   /* question text scale (Tt button) */
  color-scheme: light;
}
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--scaffold); color: var(--ink);
  font-family: 'Jost', system-ui, -apple-system, 'Segoe UI', sans-serif;
  font-size: 16px; line-height: 1.5;
  min-height: 100vh; min-height: 100dvh;
  display: flex; flex-direction: column;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
a { color: var(--brand); }
a:hover { color: var(--brand-dark); }
h1, h2 { margin: 0; font-weight: 700; line-height: 1.15; }
h1:focus { outline: none; }
p { margin: 0; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 3px solid var(--brand); outline-offset: 2px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: #fff; padding: 8px 12px; z-index: 100; }
.skip:focus { left: 8px; }
.tabnum { font-variant-numeric: tabular-nums; }
.muted { color: var(--muted-text); }
.small { font-size: 14px; }
.strong { font-weight: 700; color: var(--ink); font-size: 16px; }
.lead { font-size: 17px; line-height: 1.55; color: var(--ink2); }
.flex1 { flex: 1 1 auto; min-width: 0; }
.err { color: var(--danger-text); font-size: 15px; min-height: 0; }
.err:empty { display: none; }
.center-text { text-align: center; }
.row-gap { display: flex; gap: 12px; flex-wrap: wrap; }
.row-gap.end { justify-content: flex-end; }
.center-row { justify-content: center; }

/* ---------- top bar (non-player screens) ---------- */
.bar {
  height: 60px; padding: 0 24px; background: var(--surface); border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex: none;
}
.logo { width: 36px; height: 36px; border-radius: 9px; flex: none; }
.bar-title { font-weight: 700; font-size: 19px; flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-right { font-size: 15px; color: var(--muted-text); text-align: right; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
body.in-player .bar { display: none; }

main { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
main:focus { outline: none; }
.screen { flex: 1 1 auto; padding: 32px 24px; }
.screen.center { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; }

/* ---------- shared pieces ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r20); }
.chip { align-self: flex-start; padding: 6px 14px; border-radius: 999px; background: var(--surface3); color: var(--brand); font-weight: 700; font-size: 15px; }
.chip.warn { background: #FFF3E0; color: #9A5B00; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 48px; padding: 12px 22px; border-radius: var(--r16); border: 1px solid transparent;
  font-weight: 600; font-size: 17px; text-decoration: none; cursor: pointer;
}
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); color: #fff; }
.btn.secondary { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn.secondary:hover { background: var(--surface2); color: var(--ink); }
.btn.big { width: 100%; font-size: 18px; padding: 15px 18px; }
.btn:disabled { background: var(--surface3); color: var(--muted-text); cursor: not-allowed; border-color: transparent; }
.btn-logo { width: 26px; height: 26px; border-radius: 6px; }
.linkbtn { background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--brand); text-decoration: underline; cursor: pointer; font-size: 15px; }
.linkbtn:disabled { color: var(--muted-text); text-decoration: none; cursor: default; }
.iconbtn { min-width: 44px; min-height: 44px; border: 0; background: transparent; display: inline-flex; align-items: center; justify-content: center; border-radius: var(--r12); cursor: pointer; }
.iconbtn:hover { background: var(--surface2); }
.iconbtn.boxed { border: 1px solid var(--border); background: var(--surface); }
.card-note { border-top: 1px solid var(--border); padding-top: 14px; font-size: 14px; line-height: 1.5; color: var(--muted-text); }
.spinner { width: 36px; height: 36px; border-radius: 50%; border: 4px solid var(--surface3); border-top-color: var(--brand); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } }

/* ---------- message screen ---------- */
.msg-card { max-width: 620px; width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r20); padding: 36px; display: flex; flex-direction: column; gap: 16px; }
.msg-card h1 { font-size: 30px; }
.msg-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--surface3); display: flex; align-items: center; justify-content: center; }
.msg-icon img { width: 40px; height: 40px; border-radius: 9px; }

/* ---------- 2 · main ---------- */
.main-grid { max-width: 1200px; margin: 0 auto; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 48px; align-items: center; padding: 24px 48px; min-height: 100%; }
.main-intro { display: flex; flex-direction: column; gap: 18px; }
.main-intro h1 { font-size: 44px; line-height: 1.1; }
.ticks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 16px; color: var(--ink2); }
.ticks li { display: flex; gap: 10px; align-items: flex-start; }
.ticks svg { flex: none; margin-top: 3px; }
.notice { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r16); padding: 16px 20px; display: flex; flex-direction: column; gap: 2px; }
.notice-k { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; color: var(--muted-text); }
.notice-v { font-size: 30px; font-weight: 700; color: var(--brand); }
.code-card { padding: 32px; display: flex; flex-direction: column; gap: 18px; }
.code-card h2 { font-size: 24px; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-size: 15px; font-weight: 600; }
#otp {
  font: inherit; font-size: 24px; font-weight: 600; letter-spacing: 0.35em; padding: 14px 16px; min-height: 56px;
  border-radius: var(--r12); border: 1px solid var(--border-strong); background: var(--surface2); color: var(--ink); width: 100%;
}
#otp:focus { outline: 3px solid var(--brand); outline-offset: 1px; background: #fff; }
#otp[aria-invalid="true"] { border-color: var(--danger-text); }
.code-foot { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 15px; }

/* ---------- 3 · instructions ---------- */
.ins-grid { max-width: 1180px; margin: 0 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.ins-card { grid-column: span 2; padding: 32px; display: flex; flex-direction: column; gap: 16px; }
.ins-card h1 { font-size: 30px; }
.steps { list-style: none; margin: 0; padding: 0; counter-reset: s; display: flex; flex-direction: column; gap: 12px; font-size: 17px; line-height: 1.5; color: var(--ink2); }
.steps li { counter-increment: s; display: grid; grid-template-columns: 32px 1fr; gap: 12px; }
.steps li::before { content: counter(s); width: 28px; height: 28px; border-radius: 50%; background: var(--surface3); color: var(--brand); font-weight: 700; font-size: 15px; display: flex; align-items: center; justify-content: center; }
.agree { display: flex; gap: 12px; align-items: center; font-size: 16px; font-weight: 600; margin-top: 6px; min-height: 44px; cursor: pointer; }
.agree input { width: 22px; height: 22px; accent-color: var(--brand); flex: none; }
.ins-side { display: flex; flex-direction: column; gap: 16px; }
.total-card { background: var(--brand); color: #fff; border-radius: var(--r20); padding: 28px; display: flex; flex-direction: column; gap: 8px; }
.total-k { font-size: 14px; font-weight: 600; letter-spacing: 0.08em; color: #D6E4FF; }
.total-v { font-weight: 700; font-size: 44px; line-height: 1.1; }
.total-sub { font-size: 15px; color: #E8EFFF; }
.check-card { padding: 24px; display: flex; flex-direction: column; gap: 8px; font-size: 15px; color: var(--ink2); }

/* ---------- 6 · resume ---------- */
.resume-card { width: 100%; max-width: 640px; padding: 36px; display: flex; flex-direction: column; gap: 18px; }
.resume-card h1 { font-size: 34px; }
.stat3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.stat { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r12); padding: 14px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat-k { font-size: 13px; font-weight: 600; letter-spacing: 0.08em; color: var(--muted-text); }
.stat-v { font-weight: 700; font-size: 22px; }

/* ---------- 7 · submitted ---------- */
.sub-wrap { display: flex; flex-direction: column; align-items: center; gap: 22px; max-width: 760px; width: 100%; }
.sub-wrap h1 { font-size: 38px; }
.sub-icon { width: 76px; height: 76px; border-radius: 50%; background: #E6F7EA; display: flex; align-items: center; justify-content: center; }
.sub-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; width: 100%; }
.sub-card { border-radius: var(--r16); padding: 20px; display: flex; flex-direction: column; gap: 6px; }
.sub-v { font-weight: 700; font-size: 20px; }
.stores a { white-space: nowrap; }

/* ================= player ================= */
body.in-player { height: 100vh; height: 100dvh; overflow: hidden; }
.player { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; height: 100%; }
.pbar { height: 60px; padding: 0 16px 0 24px; background: var(--surface); border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 12px; flex: none; }
.p-title { font-weight: 700; font-size: 19px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.net { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink2); white-space: nowrap; }
.net .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); flex: none; }
.net.saving .dot { background: var(--brand); }
.net.offline .dot { background: var(--orange); }
.net.failed .dot { background: var(--red); }
.net.offline, .net.failed { white-space: normal; max-width: 300px; line-height: 1.25; }
.clock { display: flex; align-items: center; gap: 8px; padding: 8px 14px; border-radius: var(--r12); background: var(--surface2); border: 1px solid var(--border); flex: none; }
.clock-t { font-weight: 700; font-size: 18px; }
.clock-s { font-size: 14px; color: var(--muted-text); white-space: nowrap; }
.clock.low { border-color: var(--red); }
.clock.low .clock-t { color: var(--danger-text); }
.tt { font-weight: 700; font-size: 18px; color: var(--brand); }

.pbody { flex: 1 1 auto; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) var(--pw); gap: 24px; padding: 20px 24px; position: relative; }
.player.pal-hidden .pbody { grid-template-columns: minmax(0, 1fr); padding-right: 64px; }
.player.pal-hidden .palette { display: none; }

/* question pane */
.qpane { display: flex; flex-direction: column; gap: 14px; min-width: 0; min-height: 0; position: relative; }
.qpane, .qpane * { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.watermark { position: absolute; inset: 0; pointer-events: none; overflow: hidden; z-index: 2; }
.watermark span { position: absolute; font-weight: 700; font-size: 56px; color: rgba(0, 72, 208, 0.06); transform: rotate(-22deg); white-space: nowrap; }
.qhead { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.qpill { padding: 6px 14px; border-radius: 999px; background: var(--surface3); color: var(--brand); font-weight: 700; font-size: 17px; }
.qof { color: var(--muted-text); font-weight: 500; }
.qsave { font-size: 14px; color: var(--muted-text); }
.qsave.failed { color: var(--danger-text); }
.qsave.offline { color: #9A5B00; }
.keys { color: var(--muted-text); font-size: 14px; }
.qscroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overflow-x: hidden; padding: 2px 4px 8px 2px; }
.qscroll:focus { outline: none; }
.qcontent { display: flex; flex-direction: column; gap: 14px; font-size: calc(19px * var(--qs)); }
.stem p { margin: 0 0 0.6em; line-height: 1.6; }
.stem p:last-child { margin-bottom: 0; }
.stem .m-who { color: #0062CC; font-weight: 600; }
.stem .m-what, .opt .m-what { font-weight: 700; color: #1C1C1E; }
.stem .m-much { color: #A65A00; font-weight: 600; font-style: italic; }
.stem .m-when { color: #1E7A4D; font-weight: 500; font-style: italic; }
.stem .m-test { color: #7B61B8; font-weight: 600; }
.stem .m-rx { color: #B85C3A; font-weight: 600; }
.m-alert { display: inline-block; padding: 0 8px; border-radius: 999px; background: #FDECEC; color: var(--danger-text); font-weight: 700; font-size: 0.9em; line-height: 1.5; }
.fig { margin: 0; }
.fig img { max-width: 100%; max-height: 420px; height: auto; border-radius: var(--r12); border: 1px solid var(--border); background: #fff; cursor: zoom-in; display: block; }
.tbl { display: flex; flex-direction: column; gap: 6px; }
.tbl-title { font-weight: 600; font-size: 0.85em; color: var(--ink2); }
.tbl-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--r12); background: var(--surface); max-width: 100%; }
.tbl table { border-collapse: collapse; width: 100%; font-size: 0.84em; line-height: 1.45; }
.tbl th, .tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); text-align: left; vertical-align: top; }
.tbl th { background: var(--surface2); font-weight: 600; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl td + td, .tbl th + th { border-left: 1px solid var(--border); }
.tbl pre { margin: 0; padding: 12px; white-space: pre-wrap; font: inherit; }
.opts { display: flex; flex-direction: column; gap: 12px; }
.opt {
  text-align: left; font-size: calc(18px * var(--qs)); line-height: 1.45; padding: 16px 18px; min-height: 56px;
  border-radius: var(--r16); border: 1px solid var(--border); background: var(--surface); color: var(--ink);
  display: flex; gap: 16px; align-items: center; cursor: pointer; width: 100%;
}
.opt:hover { border-color: var(--border-strong); background: var(--surface2); }
.opt .ol { font-weight: 700; flex: none; width: 1.1em; }
.opt .ot { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.opt img { max-width: 100%; max-height: 220px; border-radius: 8px; display: block; margin-top: 8px; }
.opt[aria-pressed="true"] { border: 2px solid var(--brand); background: var(--brand-soft); padding: 15px 17px; }
.opt[aria-pressed="true"] .ol { color: var(--brand); }
.guess-tag { font-size: 13px; font-weight: 600; color: var(--ink2); background: var(--surface3); padding: 2px 8px; border-radius: 999px; flex: none; }
.qtools { min-height: 8px; }

.qactions { display: flex; justify-content: center; gap: 56px; padding: 6px 0 2px; flex: none; }
.act { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 13px; color: var(--muted-text); }
.act.next { color: var(--brand); font-weight: 600; }
.actbtn { width: 52px; height: 44px; border-radius: 14px; border: 1px solid var(--border); background: var(--surface); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.actbtn:hover { background: var(--surface2); }
.actbtn:disabled { opacity: 0.45; cursor: default; }
.act.next .actbtn { border: 1.5px solid var(--brand); }
.actbtn[aria-pressed="true"] { background: #FFF3E0; border-color: var(--orange); }
#guess-btn[aria-pressed="true"] { background: var(--surface3); border-color: var(--ink2); }

/* palette */
.palette { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r20); padding: 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; min-height: 0; position: relative; }
.handle { position: absolute; left: -17px; top: 50%; margin-top: -32px; width: 12px; height: 64px; border-radius: 999px; background: var(--border-strong); display: flex; align-items: center; justify-content: center; cursor: col-resize; touch-action: none; }
.handle span { width: 2px; height: 28px; border-radius: 2px; background: var(--muted); }
.handle::after { content: ''; position: absolute; inset: -6px -14px; } /* bigger hit area */
.pal-head { display: flex; align-items: flex-start; gap: 10px; }
.pal-title { font-size: 18px; }
#pal-hide { margin: -8px -8px 0 0; }
.pal-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; margin: 0 -4px; padding: 2px 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(36px, 1fr)); gap: 7px; font-size: 14px; font-weight: 600; }
.cell {
  height: 38px; min-width: 36px; border-radius: var(--r10); display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border); color: var(--muted-text); background: var(--surface); position: relative; cursor: pointer; padding: 0; font-weight: 600;
}
.cell.answered { background: var(--green); border-color: var(--green); color: var(--ink); }
.cell.marked { background: var(--orange); border-color: var(--orange); color: var(--ink); }
.cell.skipped { border-color: var(--red); color: var(--ink); }
.cell.current { outline: 2.5px solid var(--ink); outline-offset: 1.5px; color: var(--ink); }
.cell.marked.has-ans::before { content: ''; position: absolute; left: 4px; bottom: 4px; width: 7px; height: 7px; border-radius: 50%; background: #1E7A4D; border: 1px solid #fff; }
.cell.guess::after { content: '?'; position: absolute; right: -5px; top: -6px; width: 15px; height: 15px; border-radius: 50%; background: var(--ink2); color: #fff; font-size: 10px; line-height: 15px; text-align: center; }
.legend { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; font-size: 13px; color: var(--ink2); padding: 12px; border-radius: 8px; background: var(--surface2); border: 1px solid var(--border); }
.legend div { display: flex; gap: 8px; align-items: center; }
.sw { width: 12px; height: 12px; border-radius: 50%; flex: none; }
.sw.answered { background: var(--green); }
.sw.marked { background: var(--orange); }
.sw.skipped { border: 2px solid var(--red); }
.sw.nv { border: 2px solid var(--border-strong); }
.secs { display: flex; flex-direction: column; gap: 8px; font-size: 14px; }
.sec { display: flex; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: var(--r12); background: var(--surface2); color: var(--muted-text); flex-wrap: wrap; }
.sec b { font-weight: 600; }
.sec.current { background: var(--brand-soft); color: var(--brand); }
.pause-line:empty { display: none; }
.pal-foot { display: flex; flex-direction: column; gap: 12px; flex: none; }
.btn.submit { font-size: 16px; font-weight: 700; padding: 13px 14px; border-radius: var(--r12); background: var(--brand); color: #fff; }
.btn.submit:disabled { background: var(--surface3); color: var(--muted-text); }
.pal-tab { position: absolute; right: 0; top: 50%; transform: translateY(-50%); writing-mode: vertical-rl; padding: 16px 10px; min-width: 44px; border: 1px solid var(--border); border-right: 0; border-radius: var(--r12) 0 0 var(--r12); background: var(--surface); color: var(--brand); font-weight: 600; cursor: pointer; box-shadow: -2px 0 8px rgba(10, 13, 20, 0.06); }

/* paused / connection lost: hide the paper */
.player.paused .qpane, .player.paused .palette, .player.paused .strip-wrap { visibility: hidden; }

/* banner, toast, overlays */
.banner { position: fixed; left: 50%; top: 72px; transform: translateX(-50%); z-index: 40; background: var(--ink); color: #fff; padding: 10px 8px 10px 18px; border-radius: var(--r12); display: flex; align-items: center; gap: 8px; box-shadow: 0 8px 24px rgba(10, 13, 20, 0.2); max-width: calc(100vw - 32px); font-weight: 500; }
.banner .iconbtn { color: #fff; font-size: 22px; }
.banner .iconbtn:hover { background: rgba(255, 255, 255, 0.12); }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%); z-index: 45; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: var(--r12); max-width: calc(100vw - 32px); font-size: 15px; }
.overlay { position: fixed; inset: 0; z-index: 60; background: rgba(248, 249, 252, 0.97); display: flex; align-items: center; justify-content: center; padding: 16px; }
#submit-dlg { background: rgba(10, 13, 20, 0.45); }
.ov-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r20); padding: 32px; max-width: 520px; width: 100%; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; box-shadow: 0 12px 40px rgba(10, 13, 20, 0.12); }
.ov-card.left { align-items: stretch; text-align: left; }
.ov-card h2 { font-size: 24px; }
.sd-counts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.sd-counts div { background: var(--surface2); border: 1px solid var(--border); border-radius: var(--r12); padding: 10px 12px; display: flex; flex-direction: column; }
.sd-counts b { font-size: 22px; }
.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(10, 13, 20, 0.88); display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; padding: 16px; }
.lightbox img { max-width: 100%; max-height: calc(100% - 80px); background: #fff; border-radius: 8px; -webkit-user-select: none; user-select: none; }

.phone-only { display: none !important; }
.scrim { display: none; }

/* ---------- narrower laptops ---------- */
@media (max-width: 1100px) {
  .main-grid { padding: 16px 0; gap: 32px; }
  .main-intro h1 { font-size: 36px; }
  .qactions { gap: 32px; }
  .keys { display: none; }
}
@media (max-width: 900px) {
  .main-grid { grid-template-columns: minmax(0, 1fr); }
  .ins-grid { grid-template-columns: minmax(0, 1fr); }
  .ins-card { grid-column: auto; }
  .net #net-text { display: none; }
  .net.offline #net-text, .net.failed #net-text { display: inline; }
}

/* ---------- phones ---------- */
@media (max-width: 760px) {
  .bar { padding: 0 16px; height: 56px; }
  .bar-title { font-size: 17px; }
  .bar-right { display: none; }
  .logo { width: 32px; height: 32px; border-radius: 8px; }
  .screen { padding: 20px 16px; }
  .main-intro h1 { font-size: 30px; }
  .code-card, .ins-card, .resume-card, .msg-card { padding: 22px; }
  .resume-card h1, .ins-card h1, .msg-card h1 { font-size: 26px; }
  .stat3 { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .stat3 .stat:last-child { grid-column: span 2; }
  .sub-wrap h1 { font-size: 30px; }
  .sub-grid { grid-template-columns: minmax(0, 1fr); }
  .total-v { font-size: 36px; }

  .phone-only { display: flex !important; }
  .laptop-only { display: none !important; }
  .pbar { height: auto; padding: 8px 12px 8px 16px; gap: 8px; }
  .p-title { font-size: 17px; flex: 1 1 auto; }
  .p-title-rest { display: none; }
  .pbar .flex1 { display: none; }
  .clock { padding: 6px 10px; gap: 6px; }
  .clock svg { display: none; }
  .clock-t { font-size: 16px; }
  .clock-s { font-size: 13px; }
  .net { order: 5; }
  .net .dot { width: 10px; height: 10px; }
  .net.offline, .net.failed { position: fixed; left: 8px; right: 8px; top: auto; bottom: 92px; z-index: 30; background: #FFF3E0; color: #6B3F00; border-radius: var(--r12); padding: 10px 14px; max-width: none; font-size: 14px; }
  .tt { padding: 0 6px; font-size: 17px; }
  #fs-btn { display: none; }
  .strip-wrap { flex-direction: column; flex: none; background: var(--scaffold); }
  .strip { display: flex; gap: 8px; overflow-x: auto; padding: 10px 16px 4px; scrollbar-width: none; scroll-padding: 0 16px; }
  .strip::-webkit-scrollbar { display: none; }
  .strip .cell { width: 44px; height: 44px; flex: none; border-radius: var(--r12); font-size: 15px; }
  .strip-counts { display: flex; justify-content: space-around; padding: 8px 16px; font-size: 13px; color: var(--ink2); border-bottom: 1px solid var(--border); }
  .pbody, .player.pal-hidden .pbody { display: flex; padding: 0; gap: 0; }
  .qpane { flex: 1 1 auto; gap: 12px; }
  .qhead { padding: 14px 16px 0; gap: 10px; }
  .qpill { font-size: 16px; padding: 5px 12px; }
  .qscroll { padding: 0 16px 12px; }
  .qcontent { font-size: calc(17px * var(--qs)); }
  .opts { gap: 10px; }
  .opt { font-size: calc(16px * var(--qs)); padding: 14px; gap: 12px; }
  .opt[aria-pressed="true"] { padding: 13px; }
  .watermark span { font-size: 40px; }
  .qactions { background: var(--surface); border-top: 1px solid var(--border); padding: 10px 12px calc(14px + env(safe-area-inset-bottom)); justify-content: space-between; gap: 4px; }
  .act { font-size: 12px; gap: 3px; }
  .act.phone-only { flex-direction: column; }

  /* palette becomes a bottom sheet */
  .player.pal-hidden .palette { display: flex; }
  .palette {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 50; max-height: 82dvh; max-height: 82vh;
    border-radius: 22px 22px 0 0; border-bottom: 0; padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
    transform: translateY(105%); transition: transform 0.22s ease; visibility: hidden;
    box-shadow: 0 -8px 30px rgba(10, 13, 20, 0.15);
  }
  .player.sheet-open .palette { transform: none; visibility: visible; }
  .sheet-grip { justify-content: center; }
  .sheet-grip::before { content: ''; width: 40px; height: 5px; border-radius: 3px; background: var(--border-strong); }
  .grid { grid-template-columns: repeat(auto-fill, minmax(44px, 1fr)); }
  .grid .cell { height: 44px; }
  .scrim { display: block; position: fixed; inset: 0; z-index: 49; background: rgba(10, 13, 20, 0.35); }
  .banner { top: 64px; }
  .toast { bottom: 110px; }
}
@media (max-width: 380px) {
  .p-title { font-size: 15px; }
  .clock-s { display: none; }
  .actbtn { width: 48px; }
}
@media (prefers-reduced-motion: reduce) { .palette { transition: none; } }
@media print { body { display: none !important; } }
