/* Setup screen (the invigilator): main#setup.setup on index.html. Components come from tokens.css;
   every rule here is scoped to .setup so the exam and answer-sheet screens on the same page are untouched. */
.setup .skip { position: absolute; left: 12px; top: -60px; z-index: 100; padding: 10px 14px; background: var(--ink); color: var(--ink-on); border-radius: var(--r-2); font-weight: 700; }
.setup .skip:focus { top: 10px; }

.setup .wrap { max-width: 1280px; margin: 0 auto; padding: 0 var(--s-6); }
.setup .page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-6); padding: var(--s-6) 0 var(--s-6); }
.setup .page-head h1 { font-size: var(--t-30); font-weight: 750; font-stretch: 92%; letter-spacing: -.015em; line-height: 1.2; }
.setup .page-head h1 .hi { font-weight: 600; color: var(--saffron); margin-left: .3em; font-size: .86em; }
.setup .page-head .lead { color: var(--ink-2); margin-top: 6px; max-width: 60ch; }
.setup .carry { display: flex; align-items: center; gap: 10px; padding: 8px 8px 8px 14px; background: var(--paper-card); border: 1px solid var(--rule-strong); border-radius: var(--r-pill); font-size: var(--t-13); color: var(--ink-2); white-space: nowrap; }
.setup .carry .ico { color: var(--saffron); flex: none; }

.setup .setup-grid { display: grid; grid-template-columns: minmax(0, 1fr) 404px; gap: var(--s-6); align-items: start; padding-bottom: var(--s-12); }
.setup .steps { display: grid; gap: var(--s-4); min-width: 0; }
.setup .step-card { padding: var(--s-6); display: grid; gap: var(--s-5); min-width: 0; }
.setup .step-card > .body { display: grid; gap: var(--s-4); padding-left: calc(1.4em * 30 / 16 + var(--s-4)); min-width: 0; }
.setup .step-card .row { display: grid; gap: var(--s-4); grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); align-items: start; }
.setup .row-name { grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr) !important; align-items: end !important; }
.setup .row-time { grid-template-columns: 1fr 1.25fr 1.6fr !important; }
.setup .field { min-width: 0; }

.setup .req { display: inline-flex; align-items: center; height: 20px; padding: 0 7px; border-radius: var(--r-pill); font-size: 11.5px; font-weight: 700; background: var(--ink); color: var(--ink-on); letter-spacing: .03em; }
.setup .last-hint { display: flex; align-items: center; gap: 8px; color: var(--ink-3); font-size: var(--t-13); }
.setup .last-hint .ico { width: 16px; height: 16px; flex: none; }

/* 02 paper */
.setup .paper-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: var(--t-14); color: var(--ink-2); }
.setup .paper-meta:empty { display: none; }
.setup .paper-meta b { color: var(--ink); font-weight: 700; }
.setup .paper-meta .dotsep { width: 4px; height: 4px; border-radius: 50%; background: var(--rule-strong); }
.setup .paper-preview { border: 1px solid var(--rule); border-radius: var(--r-2); background: var(--paper-sunk); counter-reset: q; overflow: hidden; }
.setup .paper-preview li { counter-increment: q; display: grid; grid-template-columns: 34px minmax(0, 1fr) auto; gap: 10px; align-items: baseline; padding: 9px 14px; border-top: 1px solid var(--rule); font-size: var(--t-14); line-height: 1.6; }
.setup .paper-preview li:first-child { border-top: 0; }
.setup .paper-preview li::before { content: "Q" counter(q); font-weight: 750; color: var(--saffron); font-size: var(--t-13); font-variant-numeric: tabular-nums; }
.setup .paper-preview .q-t { min-width: 0; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.setup .paper-preview .marks { font-size: var(--t-12); font-weight: 700; color: var(--ink-2); background: var(--paper-card); border: 1px solid var(--rule-strong); border-radius: var(--r-pill); padding: 1px 8px; white-space: nowrap; }
.setup .paper-preview li.more { counter-increment: none; display: block; padding: 4px 8px; }
.setup .paper-preview li.more::before { content: none; }
.setup .setup-links { font-size: var(--t-13); color: var(--ink-3); display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.setup .setup-links a { font-weight: 650; }
.setup .from-paper { margin-top: 2px; }
.setup .total-line { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: var(--t-14); color: var(--ink-2); padding: 10px 14px; background: var(--paper-sunk); border-radius: var(--r-2); border: 1px solid var(--rule); }
.setup .total-line b { color: var(--ink); font-variant-numeric: tabular-nums; }
.setup .total-line .ico { color: var(--saffron); }

/* 03 answer mode */
.setup .q-ask { font-weight: 700; font-size: var(--t-16); }
.setup .q-ask .hi { font-weight: 600; margin-left: .3em; }
.setup .howto-keys { border-top: 1px dashed var(--rule-strong); padding-top: var(--s-3); }
.setup .howto-keys > summary { font-weight: 650; font-size: var(--t-14); color: var(--ink-2); min-height: 32px; gap: 8px; }
.setup .howto-keys > summary .chev { width: 18px; height: 18px; }
.setup .howto-keys ul { display: grid; gap: 8px; margin-top: var(--s-3); padding-left: 0; font-size: var(--t-14); color: var(--ink-2); }
.setup .howto-keys li { display: grid; grid-template-columns: 22px 1fr; gap: 8px; }
.setup .howto-keys li .ico { color: var(--saffron); margin-top: 3px; width: 18px; height: 18px; }
.setup .native-select { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* 04 check with the student */
.setup .checks { display: grid; gap: 0; border: 1px solid var(--rule); border-radius: var(--r-2); overflow: hidden; background: var(--paper-raise); }
.setup .check { display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; gap: 4px var(--s-4); padding: var(--s-4); border-top: 1px solid var(--rule); align-items: start; }
.setup .check:first-child { border-top: 0; }
.setup .check .n { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 750; font-size: var(--t-13); border: 1.5px solid var(--field-line); color: var(--ink-2); }
.setup .check[data-done] .n { background: var(--ok); border-color: var(--ok); color: var(--paper-card); }
.setup .check[data-warn] .n { background: var(--warn-tint); border-color: var(--warn); color: var(--warn); font-weight: 800; }
.setup .check[data-done] .n .ico { width: 16px; height: 16px; }
.setup .check .c-title { font-weight: 700; line-height: 1.45; }
.setup .check .c-title .hi { font-weight: 600; margin-left: .3em; }
.setup .check .ck-body { grid-column: 2 / -1; display: grid; gap: 10px; color: var(--ink-2); font-size: var(--t-14); min-width: 0; }
.setup .check .c-act { grid-row: 1; grid-column: 3; justify-self: end; }
.setup .ask-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.setup .ask-row .q { font-weight: 650; color: var(--ink); margin-right: 4px; }
.setup .check .hint { display: flex; align-items: center; gap: 6px; }
.setup .check .hint .ico { width: 16px; height: 16px; flex: none; }
.setup #meter .meter-zones, .setup .meter-scale { grid-template-columns: 16.7% 50% 33.3%; }   /* -60..-50 / -50..-20 / -20..0 dB */
.setup .meter-floor::after { content: ""; position: absolute; left: 50%; top: -5px; width: 9px; height: 9px; margin-left: -4.5px; border-radius: 50%; background: var(--ink); }
.setup .meter { overflow: visible; }
.setup .meter-fill { border-radius: var(--r-pill); }
.setup .mic-heard { padding: 10px 14px; border-radius: var(--r-2); background: var(--paper-sunk); border-left: 4px solid var(--ok); color: var(--ink); font-size: var(--t-16); overflow-wrap: anywhere; }
.setup .mic-heard .lbl { display: block; font-size: var(--t-12); font-weight: 700; color: var(--ink-3); line-height: 1.4; }
.setup .mic-heard .lbl:lang(en) { text-transform: uppercase; letter-spacing: .08em; }
.setup .mic-status { font-size: var(--t-13); color: var(--ink-3); display: flex; align-items: flex-start; gap: 6px; }
.setup .mic-status:empty { display: none; }
.setup .mic-status .ico { color: var(--ok); width: 16px; height: 16px; flex: none; margin-top: 2px; }
.setup .mic-status[data-tone="bad"] { color: var(--bad); font-weight: 600; }
.setup .mic-status[data-tone="bad"] .ico { color: var(--bad); }

/* options */
.setup .options { padding: 0; }
.setup .options > summary { padding: var(--s-5) var(--s-6); }
.setup .options > summary > span:first-child { display: grid; min-width: 0; }
.setup .options > summary .o-t { font-weight: 700; }
.setup .options > summary .o-t .hi { font-weight: 600; margin-left: .3em; }
.setup .options > summary .o-sum { color: var(--ink-3); font-size: var(--t-13); margin-top: 2px; }
.setup .options > summary .chev { margin-left: auto; width: 22px; height: 22px; color: var(--ink-2); flex: none; }
.setup .options .o-body { padding: 0 var(--s-6) var(--s-6); display: grid; gap: var(--s-5); border-top: 1px solid var(--rule); padding-top: var(--s-5); }
.setup .o-group { display: grid; gap: var(--s-3); min-width: 0; }
.setup .o-group h3 { font-size: var(--t-14); font-weight: 700; }
.setup .o-group h3 .hi { font-weight: 600; margin-left: .3em; }
.setup .screen-preview { margin: 0; padding: 14px 18px; border-radius: var(--r-2); border: 1.5px solid var(--x-card-line); background: var(--x-bg); color: var(--x-fg); font-size: 22px; line-height: 1.6; overflow-wrap: anywhere; }
.setup .screen-preview .pv-q { display: block; font-size: .62em; font-weight: 700; color: var(--x-strong); opacity: .9; }
.setup .screen-preview .pv-t { font-weight: 600; }
.setup .pv-cap { font-size: var(--t-12); color: var(--ink-3); }

/* ready card */
.setup .ready { position: sticky; top: 12px; display: grid; gap: var(--s-4); min-width: 0; }
.setup .ready-card { overflow: visible; min-width: 0; }
.setup .ready-head { border-radius: var(--r-3) var(--r-3) 0 0; overflow: hidden; padding: var(--s-4) var(--s-6) var(--s-3); background: var(--paper-card); border-bottom: 1px solid var(--rule); position: relative; }
.setup .ready-head::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 4px; background: var(--ok); }
.setup .ready-card[data-ready="wait"] .ready-head::before { background: repeating-linear-gradient(-45deg, var(--marigold) 0 10px, transparent 10px 18px); }
.setup .ready-card[data-ready="warn"] .ready-head::before { background: var(--marigold); }
.setup .ready-card[data-ready="bad"] .ready-head::before { background: var(--bad); }
.setup .ready-head .big { display: flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 750; font-stretch: 94%; letter-spacing: -.01em; margin-top: 4px; line-height: 1.3; }
.setup .ready-head .big .ico { color: var(--ok); width: 28px; height: 28px; flex: none; }
.setup .ready-card[data-ready="wait"] .ready-head .big .ico, .setup .ready-card[data-ready="warn"] .ready-head .big .ico { color: var(--warn); }
.setup .ready-card[data-ready="bad"] .ready-head .big .ico { color: var(--bad); }
.setup .ready-body { padding: var(--s-2) var(--s-6) var(--s-5); display: grid; gap: var(--s-4); min-width: 0; }
.setup .ready .pill { padding: 6px 0; }
.setup .ready .pill .txt { font-size: var(--t-14); }
.setup .ready .pill .dot { width: 20px; height: 20px; }
.setup .sum-lines { display: grid; gap: 2px; font-size: var(--t-14); color: var(--ink-2); padding: 10px 12px; background: var(--paper-sunk); border-radius: var(--r-2); border: 1px solid var(--rule); overflow-wrap: anywhere; }
.setup .sum-lines .who { font-size: var(--t-16); color: var(--ink); }
.setup .sum-lines b { color: var(--ink); }
.setup .sum-lines .need b { color: var(--warn); }
.setup .su-roll { color: var(--ink-3); font-weight: 500; white-space: nowrap; }
.setup .sum-lines .tag { height: 20px; vertical-align: 1px; }
.setup .sec-t { margin-bottom: 6px !important; }
.setup .next { counter-reset: n; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0; border: 1px solid var(--rule); border-radius: var(--r-2); overflow: hidden; background: var(--paper-sunk); }
.setup .next li { counter-increment: n; padding: 8px 8px 9px; display: grid; gap: 2px; align-content: start; font-size: 12px; line-height: 1.35; color: var(--ink-2); border-left: 1px solid var(--rule); }
.setup .next li:first-child { border-left: 0; }
.setup .next li .ico { width: 18px; height: 18px; color: var(--saffron); }
.setup .next li b { color: var(--ink); font-size: 13px; display: block; }
.setup .next li b::before { content: counter(n) " "; color: var(--ink-3); font-weight: 700; }
.setup .next li kbd { font-size: 11px; }
.setup #ready-why { font-size: var(--t-13); }
.setup .start-dock { display: grid; gap: 8px; position: sticky; bottom: 0; z-index: 2; background: var(--paper-card); padding: 6px 0 8px; margin: 0; min-width: 0; }
.setup .start-dock .dock-sum { display: none; }
.setup .start-btn { white-space: normal; text-align: center; line-height: 1.25; display: inline-flex; align-items: center; justify-content: center; gap: 10px; width: 100%; }
.setup .start-btn .ico { width: 22px; height: 22px; flex: none; }
.setup .start-btn[disabled] { --b-bg: var(--paper-sunk); --b-fg: var(--ink-2); --b-line: var(--rule-strong); font-size: 16px; cursor: not-allowed; }
.setup .keys { font-size: 12.5px; color: var(--ink-3); display: flex; align-items: center; gap: 8px; justify-content: center; text-align: center; }
.setup .sysdetails { border-top: 1px solid var(--rule); }
.setup .sysdetails > summary { padding: 12px var(--s-6); font-size: var(--t-13); font-weight: 650; color: var(--ink-2); }
.setup .sysdetails > summary .chev { margin-left: auto; width: 18px; height: 18px; }
.setup .engine-info { padding: 0 var(--s-6) var(--s-4); font-family: var(--mono); font-size: 12.5px; color: var(--ink-3); line-height: 1.7; overflow-wrap: anywhere; }
.setup .engine-info .err { color: var(--bad); }

.setup .recent { padding: var(--s-5) var(--s-6); display: grid; gap: var(--s-3); min-width: 0; }
.setup .recent-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 10px; }
.setup .recent-head a { white-space: nowrap; font-size: var(--t-13); font-weight: 650; }
.setup .recent-head h2 { font-size: var(--t-16); font-weight: 750; }
.setup .recent-head h2 .hi { font-weight: 600; margin-left: .3em; }
.setup .recent ul { display: grid; }
.setup .recent li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0 10px; padding: 10px 0; border-top: 1px dashed var(--rule); align-items: center; }
.setup .recent li .who { font-weight: 650; font-size: var(--t-14); overflow-wrap: anywhere; }
.setup .recent li .what { color: var(--ink-3); font-size: var(--t-13); grid-column: 1; overflow-wrap: anywhere; }
.setup .recent li .btn { grid-row: 1 / span 2; grid-column: 2; }
.setup .last-sheet { font-size: var(--t-13); color: var(--ink-3); padding: 0 var(--s-2); }

/* ---- tablet */
@media (max-width: 1080px) {
  .setup .setup-grid { grid-template-columns: minmax(0, 1fr) 340px; }
  .setup .row-time { grid-template-columns: 1fr 1fr !important; }
  .setup .row-time .field:nth-child(3) { grid-column: 1 / -1; }
}

/* ---- phone: one column; the Start dock becomes a fixed bottom bar */
@media (max-width: 760px) {
  .setup .wrap { padding: 0 var(--s-4); }
  .setup .appbar-in { padding: 10px var(--s-4) 0; gap: var(--s-3); min-height: 56px; flex-wrap: wrap; }
  .setup .appbar .wordmark { font-size: 18px; }
  .setup .appbar .wordmark .hi, .setup .appbar .wordmark .bar { display: none; }
  .setup .appbar .tabs { order: 3; width: calc(100% + 2 * var(--s-4)); overflow-x: auto; margin: 0 calc(-1 * var(--s-4)); padding: 0 var(--s-2); min-height: 44px; border-top: 1px solid var(--rule); scrollbar-width: none; }
  .setup .appbar .tab { font-size: 13.5px; padding: 0 10px; white-space: nowrap; }
  .setup .appbar .tab .hi { display: none; }
  .setup .appbar-end { display: none; }
  .setup .page-head { flex-direction: column; align-items: stretch; padding: var(--s-5) 0 var(--s-4); gap: var(--s-3); }
  .setup .page-head h1 { font-size: 25px; }
  .setup .page-head h1 .hi { display: block; margin: 2px 0 0; font-size: 18px; }
  .setup .carry { white-space: normal; border-radius: var(--r-2); flex-wrap: wrap; }
  .setup .setup-grid { grid-template-columns: minmax(0, 1fr); gap: var(--s-4); padding-bottom: 150px; }
  .setup .step-card { padding: var(--s-4); gap: var(--s-4); }
  .setup .step-card > .body { padding-left: 0; }
  .setup .step .step-d { flex-basis: 100%; }
  .setup .row-name { grid-template-columns: minmax(0, 1fr) !important; }
  .setup .paper-preview li { grid-template-columns: 26px minmax(0, 1fr) auto; padding: 8px 10px; gap: 8px; }
  .setup .check { grid-template-columns: 32px minmax(0, 1fr); padding: var(--s-3); }
  .setup .check .c-act { grid-row: auto; grid-column: 2; justify-self: start; }
  .setup .check .ck-body { grid-column: 1 / -1; }
  .setup .meter-scale span [lang="hi"] { display: none; }
  .setup .options > summary { padding: var(--s-4); }
  .setup .options .o-body { padding: var(--s-4); }
  .setup .ready { position: static; }
  .setup .ready-body { padding: var(--s-3) var(--s-4) var(--s-4); }
  .setup .ready-head { padding: var(--s-4); }
  .setup .next { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .setup .next li:nth-child(3) { border-left: 0; }
  .setup .next li:nth-child(n+3) { border-top: 1px solid var(--rule); }
  .setup .start-dock {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 40;
    padding: 10px var(--s-4) calc(10px + env(safe-area-inset-bottom));
    background: var(--paper-card); border-top: 1px solid var(--rule-strong); box-shadow: var(--shadow-up);
    gap: 6px;
  }
  .setup .start-dock .dock-sum { display: flex; align-items: center; gap: 8px; font-size: var(--t-13); color: var(--ink-2); font-weight: 600; min-width: 0; }
  .setup .start-dock .dock-sum > span:last-child { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
  .setup .start-dock .dock-sum .ico { color: var(--ok); width: 18px; height: 18px; flex: none; }
  .setup .start-dock .dock-sum .ico:not([data-tone="ok"]) { color: var(--warn); }
  .setup .start-dock .dock-sum .ico[data-tone="bad"] { color: var(--bad); }
  .setup .start-dock .keys { display: none; }
  .setup .start-btn { min-height: 54px; font-size: 18px; }
  .setup .recent { padding: var(--s-4); }
  .setup .sysdetails > summary { padding: 12px var(--s-4); }
  .setup .engine-info { padding: 0 var(--s-4) var(--s-4); }
}

/* phone: the Start bar stays one line + the button; the reason is in the Ready card's rows */
@media (max-width: 760px) {
  .setup .start-dock #ready-why { display: none; }
}

/* the exam code of the chosen paper (students say it on the Home screen) */
.code-tag { color: var(--ink-2); }
.code-tag b { color: var(--ink); letter-spacing: .06em; }

/* ---- microphone and speaker (a headset is best: close to her mouth, no echo) */
.devices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3, 12px) var(--s-4, 16px); margin-bottom: var(--s-4, 16px);
  padding: var(--s-4, 16px); border: 1px solid var(--rule); border-radius: 12px; background: var(--paper-sunk); }
.devices .field { margin: 0; min-width: 0; }
.devices label { display: flex; align-items: center; gap: 6px; }
.devices label .ico { width: 16px; height: 16px; background: var(--ink-2); }
.devices select { width: 100%; min-width: 0; text-overflow: ellipsis; }
.dev-hint { grid-column: 1 / -1; margin: 0; display: flex; gap: 8px; align-items: flex-start; color: var(--ink-3); font-size: var(--t-13, 13.5px); line-height: 1.5; }
.dev-hint .ico { width: 18px; height: 18px; flex: none; margin-top: 2px; background: var(--ink-3); }
.dev-hint[data-tone="ok"] { color: var(--ok); } .dev-hint[data-tone="ok"] .ico { background: var(--ok); }
.dev-hint[data-tone="warn"] { color: var(--warn); } .dev-hint[data-tone="warn"] .ico { background: var(--warn); }
@media (max-width: 640px) { .devices { grid-template-columns: 1fr; } }
