/* Student exam screen. Three zones that never hide the present:
     status bar (state · question rail · timer)  /  reading column (scrolls, newest line in view)
     "Now" tray (pending sentence / Kalam caption / instruction)  /  one-key bar  /  invigilator strip
   Every exam size is em from --fs, which is the chosen size capped by the viewport. */
/* While the exam screen shows, the page is exactly one viewport: nothing scrolls but the reading column. */
html:has(#exam:not([hidden])), body:has(> #exam:not([hidden])) { height: 100%; overflow: hidden; }
body:has(> #exam:not([hidden])) { display: flex; flex-direction: column; background: #000; }
body:has(> #exam[data-theme="light"]:not([hidden])) { background: #fff; }
body:has(> #exam:not([hidden])) > #exam { flex: 1 1 auto; min-height: 0; height: auto; }

.exam {
  --fs: clamp(24px, min(5.6vw, 7.4vh), var(--exam-size));
  --lab: max(18px, calc(var(--fs) * .5));      /* labels: never under 18px */
  position: relative;
  height: 100vh; height: 100dvh;
  display: grid;
  /* the Now tray (row 4) takes what it needs up to all the room left, so the key and the strip never move */
  grid-template-rows: auto auto minmax(0, 1fr) minmax(0, auto) auto auto;
  grid-template-columns: minmax(0, 1fr);   /* long words or labels never widen the screen */
  background: var(--x-bg); color: var(--x-fg);
  font-size: var(--fs);
  line-height: 1.6;
  overflow: hidden;
}
.exam:focus { outline: none; }
.exam :focus-visible { outline: 4px solid var(--x-strong); outline-offset: 3px; }
.exam .en { font-size: var(--lab); font-weight: 750; text-transform: uppercase; letter-spacing: .07em; line-height: 1.25; }

/* ---------------------------------------------------------------- status bar */
.exam-top {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center;
  gap: calc(var(--fs) * .6); padding: calc(var(--fs) * .5) calc(var(--fs) * .7) calc(var(--fs) * .4);
}
.badge {
  display: grid; grid-template-columns: auto auto; align-items: center; justify-content: start;
  column-gap: calc(var(--fs) * .38);
  min-height: calc(var(--fs) * 2.15);
  padding: calc(var(--fs) * .12) calc(var(--fs) * .55) calc(var(--fs) * .12) calc(var(--fs) * .14);
  border-radius: calc(var(--fs) * .4);
  border: max(4px, calc(var(--fs) * .1)) solid var(--st);
  color: var(--st);
  background: transparent;
}
.badge::before {   /* icon tile: shape is per state, so it reads without colour */
  content: ""; grid-row: 1 / span 2; width: calc(var(--fs) * 1.6); height: calc(var(--fs) * 1.6);
  border-radius: calc(var(--fs) * .28);
  background-color: var(--st);
  -webkit-mask-image: var(--b-ico), linear-gradient(#000 0 0); mask-image: var(--b-ico), linear-gradient(#000 0 0);
  -webkit-mask-size: 66%, 100%; mask-size: 66%, 100%;
  -webkit-mask-position: center; mask-position: center;
  -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
  -webkit-mask-composite: xor; mask-composite: exclude;
}
.badge .bh { font-size: calc(var(--fs) * .95); font-weight: 800; line-height: 1.25; white-space: nowrap; }
.badge .be { grid-column: 2; font-size: var(--lab); font-weight: 750; letter-spacing: .08em; text-transform: uppercase; line-height: 1.2; white-space: nowrap; }

/* per-state shape + pattern (solid = her turn, outline = Kalam's turn, dashed = her think-pause) */
.badge[data-state="LISTENING"], .badge[data-state="PRACTICE"] { background: var(--st); color: var(--st-ink); }
.badge[data-state="LISTENING"]::before, .badge[data-state="PRACTICE"]::before { background-color: var(--st-ink); }
.badge[data-state="CONFIRMING"], .badge[data-state="CONFIRM_ACTION"] {
  color: var(--st-ink);
  background: var(--st);
  box-shadow: inset 0 0 0 0 transparent;
}
.badge[data-state="CONFIRMING"]::before, .badge[data-state="CONFIRM_ACTION"]::before {
  background: repeating-linear-gradient(-45deg, var(--st-ink) 0 7px, transparent 7px 14px);
  -webkit-mask: none; mask: none; border: 3px solid var(--st-ink);
  box-shadow: inset 0 0 0 calc(var(--fs) * .16) var(--st);
}
.badge[data-state="CONFIRMING"] .bh::after, .badge[data-state="CONFIRM_ACTION"] .bh::after { content: ""; }
.badge[data-state="THINKING"] { border-style: dashed; }
.badge[data-state="WORKING"] { border-style: dotted; }
.badge[data-state="CALIBRATING"] { border-style: double; border-width: max(6px, calc(var(--fs) * .16)); }
.badge[data-state="LISTENING"]   { --b-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Crect x='9' y='2.8' width='6' height='11.4' rx='3' fill='black'/%3E%3Cpath d='M5.4 11a6.6 6.6 0 0 0 13.2 0M12 17.6V21'/%3E%3C/svg%3E"); }
.badge[data-state="PRACTICE"]    { --b-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Crect x='9' y='2.8' width='6' height='11.4' rx='3' fill='black'/%3E%3Cpath d='M5.4 11a6.6 6.6 0 0 0 13.2 0M12 17.6V21'/%3E%3C/svg%3E"); }
.badge[data-state="SPEAKING"]    { --b-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M4 4.5h16a1 1 0 0 1 1 1v10a1 1 0 0 1-1 1h-9l-5 4v-4H4a1 1 0 0 1-1-1v-10a1 1 0 0 1 1-1z'/%3E%3C/svg%3E"); }
.badge[data-state="THINKING"]    { --b-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Crect x='5.5' y='4' width='4.6' height='16' rx='1.3'/%3E%3Crect x='13.9' y='4' width='4.6' height='16' rx='1.3'/%3E%3C/svg%3E"); }
.badge[data-state="WORKING"]     { --b-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M6 2.5h12v2.2c0 3.4-3.8 5-3.8 7.3s3.8 3.9 3.8 7.3v2.2H6v-2.2c0-3.4 3.8-5 3.8-7.3S6 8.1 6 4.7z'/%3E%3C/svg%3E"); }
.badge[data-state="PAUSED"]      { --b-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M8 10V7.5a4 4 0 0 1 8 0V10h1.5a1.5 1.5 0 0 1 1.5 1.5v8a1.5 1.5 0 0 1-1.5 1.5h-11A1.5 1.5 0 0 1 5 19.5v-8A1.5 1.5 0 0 1 6.5 10zm2.3 0h3.4V7.5a1.7 1.7 0 0 0-3.4 0z'/%3E%3C/svg%3E"); }
.badge[data-state="CALIBRATING"] { --b-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black' stroke='black' stroke-width='2.3' stroke-linecap='round'%3E%3Cpath d='M3 9v6h4l5.5 4.5v-15L7 9z'/%3E%3Cpath d='M16 9.5l5 5M21 9.5l-5 5' fill='none'/%3E%3C/svg%3E"); }
.badge[data-state="FINISHED"]    { --b-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.6l4.4 4.4L19 7.4'/%3E%3C/svg%3E"); }

/* question rail */
.progress { display: grid; justify-items: center; gap: 4px; min-width: 0; }
.qrail { display: flex; gap: calc(var(--fs) * .45); align-items: flex-start; }
.qrail li { display: grid; justify-items: center; gap: 2px; }
.qrail .n {
  width: calc(var(--fs) * 1.25); height: calc(var(--fs) * 1.25); border-radius: 50%;
  display: grid; place-items: center; font-size: calc(var(--fs) * .62); font-weight: 800; line-height: 1;
  border: 3px dashed var(--x-muted); color: var(--x-muted); font-variant-numeric: tabular-nums;
}
.qrail li[data-q="done"] .n { background: var(--x-fg); border: 3px solid var(--x-fg); color: var(--x-bg); }
.qrail li[data-q="done"] .n::after { content: ""; width: 60%; height: 60%; background: var(--x-bg); -webkit-mask: var(--ico-tick) center / contain no-repeat; mask: var(--ico-tick) center / contain no-repeat; }
.qrail li[data-q="done"] .n b { display: none; }
.qrail li[data-q="now"] .n { border: max(5px, calc(var(--fs) * .14)) solid var(--x-strong); color: var(--x-strong); }
.qrail .m { font-size: max(16px, calc(var(--fs) * .4)); color: var(--x-muted); font-weight: 600; line-height: 1.3; white-space: nowrap; }
.qrail li[data-q="now"] .m { color: var(--x-strong); font-weight: 750; }
.rail-note { font-size: max(17px, calc(var(--fs) * .44)); color: var(--x-muted); font-weight: 600; line-height: 1.3; white-space: nowrap; }
.exam { --ico-tick: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.6l4.4 4.4L19 7.4'/%3E%3C/svg%3E"); }

/* timer */
.timer-wrap { display: grid; justify-items: end; gap: 4px; }
.timer {
  font-size: clamp(56px, 9.6vh, 88px); font-weight: 750; font-stretch: 88%; line-height: 1;
  font-variant-numeric: tabular-nums; letter-spacing: -.01em; color: var(--x-strong);
}
.timer.stopped { color: var(--x-muted); }
.timer.low { color: var(--st-paused); }
.timer-note {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: max(18px, calc(var(--fs) * .46)); font-weight: 650; color: var(--x-muted); line-height: 1.3; white-space: nowrap;
}
.timer-note::before { content: ""; width: 1.1em; height: 1.1em; background: currentColor; -webkit-mask: var(--tn-ico, var(--ico-clock)) center / contain no-repeat; mask: var(--tn-ico, var(--ico-clock)) center / contain no-repeat; }
.exam { --ico-clock: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9.3'/%3E%3Cpath d='M12 7v5.2l3.4 2.1'/%3E%3C/svg%3E");
        --ico-clock-off: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.4'%3E%3Ccircle cx='12' cy='12' r='9.3'/%3E%3Crect x='8.6' y='8.6' width='6.8' height='6.8' rx='.8' fill='black'/%3E%3C/svg%3E"); }
.timer-note[data-t="stopped"] { --tn-ico: var(--ico-clock-off); }
.timer-note[data-t="warn"] { color: var(--x-bg); background: var(--st-confirm); padding: 3px 12px 3px 8px; border-radius: 999px; font-weight: 800; }
.timer-note[data-t="low"]  { color: var(--x-bg); background: var(--st-paused); padding: 3px 12px 3px 8px; border-radius: 999px; font-weight: 800; }
.timer-note[data-t="extra"] { color: var(--x-bg); background: var(--st-think); padding: 3px 12px 3px 8px; border-radius: 999px; font-weight: 800; }

/* noise: a reserved slot inside the status bar (no reflow), amber "attention" */
.noise {
  grid-column: 1 / -1; justify-self: start;
  display: inline-flex; align-items: center; gap: 10px; padding: 4px 14px 4px 10px; border-radius: 999px;
  border: 3px solid var(--st-confirm); color: var(--st-confirm); font-weight: 750; font-size: var(--lab); line-height: 1.35;
}
.noise::before { content: ""; width: 1.2em; height: 1.2em; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.3' stroke-linecap='round'%3E%3Crect x='9' y='2.8' width='6' height='11.4' rx='3'/%3E%3Cpath d='M5.4 11a6.6 6.6 0 0 0 13.2 0M12 17.6V21M2 6l2 1M2 12h2.2M22 6l-2 1M22 12h-2.2'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.3' stroke-linecap='round'%3E%3Crect x='9' y='2.8' width='6' height='11.4' rx='3'/%3E%3Cpath d='M5.4 11a6.6 6.6 0 0 0 13.2 0M12 17.6V21M2 6l2 1M2 12h2.2M22 6l-2 1M22 12h-2.2'/%3E%3C/svg%3E") center / contain no-repeat; }

/* the state rule: a full-width band that carries the state's colour + pattern for a 2 m glance */
.state-rule { height: max(10px, calc(var(--fs) * .28)); background: var(--st); }
.exam:has(#badge[data-state="CONFIRMING"]) .state-rule,
.exam:has(#badge[data-state="CONFIRM_ACTION"]) .state-rule { background: repeating-linear-gradient(-45deg, var(--st) 0 16px, transparent 16px 30px); }
.exam:has(#badge[data-state="THINKING"]) .state-rule { background: repeating-linear-gradient(90deg, var(--st) 0 36px, transparent 36px 52px); }
.exam:has(#badge[data-state="WORKING"]) .state-rule { background: radial-gradient(circle, var(--st) 0 4px, transparent 4.5px) 0 50% / 18px 100% repeat-x; }
.exam:has(#badge[data-state="SPEAKING"]) .state-rule { background: linear-gradient(var(--st) 0 0) top / 100% 35% no-repeat, linear-gradient(var(--st) 0 0) bottom / 100% 35% no-repeat; }

/* ---------------------------------------------------------------- reading column */
.reading {
  container: reading / size;
  overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin;
  padding: 0 calc(var(--fs) * .7) calc(var(--fs) * .4);
  display: flex; flex-direction: column; gap: calc(var(--fs) * .45);
}
.reading > * { flex: none; }
.reading::before { content: ""; display: block; height: calc(var(--fs) * .1); flex: none; }
.question { box-shadow: 0 calc(var(--fs) * -.6) 0 calc(var(--fs) * .1) var(--x-bg); }
/* older lines scroll up under the card: fade them out instead of a hard cut through the letters */
.question::after { content: ""; position: absolute; left: -3px; right: -3px; top: calc(100% + 3px); height: calc(var(--fs) * .55); background: linear-gradient(var(--x-bg), transparent); pointer-events: none; }
.question {
  position: sticky; top: 0; z-index: 2;
  border: 3px solid var(--x-card-line); border-radius: calc(var(--fs) * .4);
  background: var(--x-card); padding: calc(var(--fs) * .35) calc(var(--fs) * .55) calc(var(--fs) * .4);
}
.qnum { font-size: max(20px, calc(var(--fs) * .56)); font-weight: 800; color: var(--x-muted); line-height: 1.4; letter-spacing: .01em; }
.qtext { font-size: 1em; font-weight: 650; line-height: 1.6; color: var(--x-fg); margin: 0; }
/* once she has answer lines, the question folds to two lines so the answer stays in view */
.reading:has(#saved li) .qtext { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.ans-label { font-size: var(--lab); font-weight: 800; color: var(--x-muted); line-height: 1.3; display: flex; align-items: baseline; gap: .6em; }
.reading:not(:has(#saved li)) .ans-label { display: none; }
.saved { counter-reset: ln; display: grid; gap: calc(var(--fs) * .1); margin: 0; }
.saved li { counter-increment: ln; display: grid; grid-template-columns: calc(var(--fs) * 1.1) minmax(0, 1fr); column-gap: calc(var(--fs) * .35); align-items: baseline; line-height: 1.6; font-weight: 450; }
.saved li::before { content: counter(ln); font-size: max(18px, calc(var(--fs) * .62)); font-weight: 800; color: var(--x-muted); text-align: right; font-variant-numeric: tabular-nums; }
.saved .ts { display: none; }   /* times live on the answer sheet; kept in the DOM for app.js */
.saved .t { grid-column: 2; }
u.unsure { text-decoration: underline; text-decoration-color: var(--x-unsure); text-decoration-thickness: max(3px, .08em); text-underline-offset: .32em; text-decoration-skip-ink: none; }

/* ---------------------------------------------------------------- the Now tray */
.now { padding: 0 calc(var(--fs) * .7) calc(var(--fs) * .4); display: grid; align-content: start; gap: calc(var(--fs) * .3); min-height: 0; overflow-y: auto; scrollbar-width: thin; }
.now:not(:has(> :not([hidden]))) { display: none; }
.pending {
  margin: 0; padding: calc(var(--fs) * .3) calc(var(--fs) * .5) calc(var(--fs) * .35);
  border: max(3px, calc(var(--fs) * .09)) dashed var(--x-pend); border-radius: calc(var(--fs) * .4);
  background: var(--x-pend-bg); color: var(--x-pend);
  font-size: 1.08em; line-height: 1.55; font-weight: 500;
}
.exam .tag { all: unset; }
.exam .tag [lang="hi"], .ans-label [lang="hi"] { font-size: 1.14em; }
.pending .tag, .saying .tag, .heard .tag {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 0 .5em;
  font-size: max(18px, calc(var(--fs) * .46)); font-weight: 800; line-height: 1.4; margin-bottom: .15em;
}
.pending .tag .en, .saying .tag .en, .heard .tag .en { font-size: 1em; }
.pending .hint2 { display: block; font-size: max(18px, calc(var(--fs) * .46)); font-weight: 650; color: var(--x-fg); margin-top: .2em; line-height: 1.4; }
.saying {
  margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: calc(var(--fs) * .3); align-items: start;
  color: var(--x-fg); font-size: .82em; line-height: 1.55;
  border-left: max(5px, calc(var(--fs) * .14)) solid var(--st-speak); padding: calc(var(--fs) * .1) 0 calc(var(--fs) * .1) calc(var(--fs) * .4);
}
.saying .tag { grid-column: 1 / -1; color: var(--st-speak); }
.heard { margin: 0; color: var(--x-muted); font-size: .7em; }
.now-idle {
  margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: calc(var(--fs) * .45);
  padding: calc(var(--fs) * .25) calc(var(--fs) * .1);
  color: var(--x-fg);
}
.now-idle .ring { width: calc(var(--fs) * 1.7); height: calc(var(--fs) * 1.7); border-radius: 50%; display: grid; place-items: center;
  border: 3px solid var(--st); box-shadow: 0 0 0 calc(var(--fs) * .06 + var(--lvl, .3) * var(--fs) * .3) color-mix(in srgb, var(--st) 35%, transparent); }
.now-idle .ring::after { content: ""; width: 58%; height: 58%; background: var(--st); -webkit-mask: var(--b-ico-n) center / contain no-repeat; mask: var(--b-ico-n) center / contain no-repeat; }
.now-idle .say { font-size: .95em; font-weight: 700; line-height: 1.35; }
.now-idle .say .en { display: block; color: var(--x-muted); }
.exam { --b-ico-n: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2.2' stroke-linecap='round'%3E%3Crect x='9' y='2.8' width='6' height='11.4' rx='3' fill='black'/%3E%3Cpath d='M5.4 11a6.6 6.6 0 0 0 13.2 0M12 17.6V21'/%3E%3C/svg%3E"); }
.exam:has(#badge[data-state="THINKING"]) { --b-ico-n: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Crect x='5.5' y='4' width='4.6' height='16' rx='1.3'/%3E%3Crect x='13.9' y='4' width='4.6' height='16' rx='1.3'/%3E%3C/svg%3E"); }
.exam:has(#badge[data-state="CALIBRATING"]) { --b-ico-n: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black' stroke='black' stroke-width='2.3' stroke-linecap='round'%3E%3Cpath d='M3 9v6h4l5.5 4.5v-15L7 9z'/%3E%3Cpath d='M16 9.5l5 5M21 9.5l-5 5' fill='none'/%3E%3C/svg%3E"); }
.exam:has(#badge[data-state="WORKING"]) { --b-ico-n: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='black'%3E%3Cpath d='M6 2.5h12v2.2c0 3.4-3.8 5-3.8 7.3s3.8 3.9 3.8 7.3v2.2H6v-2.2c0-3.4 3.8-5 3.8-7.3S6 8.1 6 4.7z'/%3E%3C/svg%3E"); }
.now-idle .say { display: none; }
.exam:has(#badge[data-state="LISTENING"]) .now-idle .for-listen,
.exam:has(#badge[data-state="THINKING"]) .now-idle .for-think,
.exam:has(#badge[data-state="CALIBRATING"]) .now-idle .for-calib,
.exam:has(#badge[data-state="WORKING"]) .now-idle .for-work { display: block; }
.exam:has(#badge[data-state="CALIBRATING"]) .now-idle .ring, .exam:has(#badge[data-state="WORKING"]) .now-idle .ring { box-shadow: none; border-style: dotted; }
.exam:not(:has(#badge[data-state="LISTENING"])):not(:has(#badge[data-state="THINKING"])):not(:has(#badge[data-state="CALIBRATING"])):not(:has(#badge[data-state="WORKING"])) .now-idle,
.exam:has(#pending:not([hidden])) .now-idle, .exam:has(#saying:not([hidden])) .now-idle { display: none; }

/* ---------------------------------------------------------------- the one key: three gesture cells */
.turn-btn {
  margin: 0 calc(var(--fs) * .7) calc(var(--fs) * .3);
  display: grid; grid-template-columns: 1fr 1fr 1.25fr; gap: 0;
  padding: 0; overflow: hidden;
  border: max(4px, calc(var(--fs) * .11)) solid var(--st); border-radius: calc(var(--fs) * .45);
  background: var(--x-bg); color: var(--x-fg);
  font: inherit; cursor: pointer;
  touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none;
}
.turn-btn .cell {
  position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); align-items: center; column-gap: calc(var(--fs) * .3);
  padding: calc(var(--fs) * .25) calc(var(--fs) * .45); text-align: left; min-height: calc(var(--fs) * 2.2);
  border-left: 3px solid var(--x-rule);
}
.turn-btn .cell[data-g="tap"] { border-left: 0; }
.turn-btn .g { grid-row: 1 / span 3; display: grid; justify-items: center; gap: 4px; }
.turn-btn .g i { display: block; width: calc(var(--fs) * 1.05); height: calc(var(--fs) * .7); background: currentColor; -webkit-mask: var(--g-ico) center / contain no-repeat; mask: var(--g-ico) center / contain no-repeat; }
.turn-btn .g span { font-size: max(16px, calc(var(--fs) * .36)); font-weight: 800; letter-spacing: .06em; text-transform: uppercase; line-height: 1.1; white-space: nowrap; }
.turn-btn .cell[data-g="tap"]  { --g-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 24' fill='black'%3E%3Ccircle cx='18' cy='12' r='7'/%3E%3C/svg%3E"); }
.turn-btn .cell[data-g="dtap"] { --g-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 24' fill='black'%3E%3Ccircle cx='9' cy='12' r='6.5'/%3E%3Ccircle cx='27' cy='12' r='6.5'/%3E%3C/svg%3E"); }
.turn-btn .cell[data-g="hold"] { --g-ico: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 36 24' fill='black'%3E%3Crect x='1' y='5' width='34' height='14' rx='7'/%3E%3C/svg%3E"); }
.turn-btn .v { font-size: calc(var(--fs) * .84); font-weight: 800; line-height: 1.3; }
.turn-btn .v-en { font-size: var(--lab); font-weight: 750; letter-spacing: .05em; text-transform: uppercase; line-height: 1.3; color: var(--x-muted); }
.turn-btn .cell[data-on] { background: var(--st); color: var(--st-ink); }
.turn-btn .cell[data-on] .v-en { color: var(--st-ink); }
.turn-btn .cell[data-off] { color: var(--x-muted); }
.turn-btn .cell[data-off] .v { font-weight: 600; }
.turn-btn .cell[data-off] .g i { opacity: .7; }
.turn-btn .fill {
  position: absolute; left: 0; right: 0; bottom: 0; height: max(10px, calc(var(--fs) * .3));
  background: var(--st-ink); transform: scaleX(var(--p, 0)); transform-origin: left;
}
.turn-btn[data-mode="holding"] .fill { --p: 1; transition: transform var(--hold-ms, 1000ms) linear; }
.turn-btn[data-mode="off"] { cursor: default; grid-template-columns: 1fr; }
.turn-btn[data-mode="off"] .cell:not([data-g="tap"]) { display: none; }
.turn-btn[data-mode="off"] .cell { justify-content: center; grid-template-columns: auto auto; }
.turn-btn[data-mode="off"] .g { display: none; }
.turn-btn:active, .turn-btn.pressed { filter: brightness(1.12); }
.turn-btn .flash { position: absolute; inset: 0; display: grid; place-items: center; background: var(--st); color: var(--st-ink); font-weight: 800; font-size: .9em; }

/* ---------------------------------------------------------------- invigilator strip (fixed staff tokens) */
.exam-foot {
  display: flex; align-items: center; gap: 18px; min-height: 52px;
  padding: 6px calc(var(--fs) * .7);
  background: var(--stf-bg); color: var(--stf-fg); border-top: 1px solid var(--stf-line);
  font-size: 15px; line-height: 1.35; font-family: var(--font);
}
.exam-foot .who { display: flex; align-items: center; gap: 8px; min-width: 0; white-space: nowrap; }
.exam-foot .who b { font-weight: 750; }
.exam-foot .who .ico { width: 18px; height: 18px; color: var(--stf-muted); }
.exam-foot .muted { color: var(--stf-muted); }
.exam-foot .sep { width: 1px; height: 22px; background: var(--stf-line); flex: none; }
.session-label { display: inline-flex; align-items: center; gap: 7px; font-weight: 700; white-space: nowrap; padding: 4px 12px 4px 8px; border-radius: 999px; border: 1px solid var(--stf-line); }
.session-label[data-tone="ok"] { color: var(--stf-ok); }
.session-label[data-tone="bad"] { color: #1a0000; background: var(--stf-bad); border-color: var(--stf-bad); }
.session-label .ico { width: 17px; height: 17px; }
.micmini { display: inline-flex; align-items: flex-end; gap: 3px; height: 20px; }
.micmini i { width: 4px; border-radius: 2px; background: var(--stf-muted); }
.micmini i[data-on] { background: var(--stf-ok); }
.exam-foot .key-hint { color: var(--stf-muted); white-space: nowrap; }
.exam-foot kbd { background: transparent; color: var(--stf-fg); border-color: var(--stf-line); }
.exam-foot .spacer { flex: 1; }
.pause-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; padding: 0 16px; border-radius: 10px; border: 1.5px solid var(--stf-fg); background: transparent; color: var(--stf-fg); font: inherit; font-weight: 750; cursor: pointer; }
.pause-btn:hover { background: color-mix(in srgb, var(--stf-fg) 12%, transparent); }
.pause-btn kbd { font-size: 12px; }
@media (pointer: coarse) { .exam-foot .key-hint, .pause-btn kbd { display: none; } }

/* ---------------------------------------------------------------- pause console (staff tokens) */
.overlay { position: absolute; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgba(4, 6, 18, .78); }
.console {
  width: min(720px, 100%); max-height: calc(100% - 16px); overflow: auto;
  background: var(--paper-card); color: var(--ink); border-radius: 18px; box-shadow: var(--shadow-3);
  font-size: 16px; line-height: 1.5; border-top: 6px solid var(--marigold);
}
.console[data-fault] { border-top-color: var(--bad); }
.c-head { display: grid; grid-template-columns: auto 1fr; gap: 2px 16px; align-items: center; padding: 22px 26px 16px; }
.c-head .c-ico { grid-row: 1 / span 2; width: 52px; height: 52px; border-radius: 14px; display: grid; place-items: center; background: var(--marigold-tint); color: var(--saffron); }
.console[data-fault] .c-head .c-ico { background: var(--bad-tint); color: var(--bad); }
.c-head .c-ico .ico { width: 28px; height: 28px; }
.overlay-title { font-size: 28px; font-weight: 800; line-height: 1.25; margin: 0; }
.overlay-title .en-t { font-size: 15px; font-weight: 800; letter-spacing: .09em; color: var(--ink-3); margin-left: 6px; }
.c-head p#paused-msg { color: var(--ink-2); margin: 0; }
.facts { display: grid; grid-template-columns: repeat(4, 1fr); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); background: var(--paper-sunk); }
.facts div { padding: 14px 18px; border-left: 1px solid var(--rule); }
.facts div:first-child { border-left: 0; }
.facts dt { font-size: 12.5px; font-weight: 700; color: var(--ink-3); text-transform: uppercase; letter-spacing: .07em; }
.facts dd { margin: 2px 0 0; font-size: 24px; font-weight: 750; font-variant-numeric: tabular-nums; line-height: 1.25; }
.facts dd small { display: block; font-size: 13px; font-weight: 600; color: var(--ink-3); }
.c-body { padding: 18px 26px 22px; display: grid; gap: 16px; }
.waiting { padding: 12px 14px; border-radius: 10px; border: 1.5px dashed var(--warn); background: var(--warn-tint); font-size: 15px; }
.waiting b { font-weight: 750; }
.waiting q { quotes: "“" "”"; font-size: 17px; }
.reasons { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.reasons .lbl { font-weight: 700; font-size: 14px; margin-right: 4px; }
.reasons .lbl span { font-weight: 500; color: var(--ink-3); }
.rchip { position: relative; display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; border: 1.5px solid var(--field-line); font-weight: 650; font-size: 14px; cursor: pointer; background: var(--paper-raise); }
.rchip input { position: absolute; opacity: 0; inset: 0; cursor: pointer; margin: 0; }
.rchip:has(input:checked) { background: var(--ink); color: var(--ink-on); border-color: var(--ink); }
.rchip:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.overlay-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.overlay-actions .btn-xl { width: auto; flex: 1 1 260px; }
.resume-hint { font-size: 13px; color: var(--ink-3); width: 100%; }
.end-confirm { border: 1.5px solid var(--bad); border-radius: 12px; padding: 14px 16px; background: var(--bad-tint); display: grid; gap: 10px; }
.end-confirm h3 { font-size: 17px; font-weight: 800; }
.end-confirm ul { display: grid; gap: 4px; font-size: 15px; }
.end-confirm li { display: flex; gap: 8px; align-items: flex-start; }
.end-confirm li .ico { margin-top: 3px; width: 18px; height: 18px; flex: none; }
.end-confirm li.keep .ico { color: var(--ok); }
.end-confirm li.lose .ico { color: var(--bad); }
.steps-fix { display: grid; gap: 8px; counter-reset: s; font-size: 15px; }
.steps-fix li { counter-increment: s; display: grid; grid-template-columns: 28px 1fr; gap: 10px; }
.steps-fix li::before { content: counter(s); width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--ink-on); display: grid; place-items: center; font-weight: 800; font-size: 13px; }

.debug {   /* ?debug=1 only: the machine trail, a developer overlay */
  position: absolute; right: 12px; top: 30%; z-index: 40; width: min(460px, calc(100% - 24px)); max-height: 38vh; overflow: auto;
  margin: 0; padding: 10px; background: rgba(20, 20, 20, .92); border: 1px solid #444; border-radius: 8px;
  color: #9fe; font: 12px/1.4 var(--mono); white-space: pre-wrap; pointer-events: none;
}

/* ---------------------------------------------------------------- real-app additions */
/* English exams: one language, so the English line is the main one (no small caps). */
.exam[data-lang="en"] .now-idle .say [lang="hi"], .exam[data-lang="en"] .ans-label [lang="hi"] { display: none; }
.exam[data-lang="en"] .now-idle .say .en { display: block; color: var(--x-fg); font-size: 1em; text-transform: none; letter-spacing: 0; font-weight: 700; }
.exam[data-lang="en"] .badge .bh { font-size: calc(var(--fs) * .9); }
.badge[data-state="FINISHED"] { border-style: solid; }
.badge[data-state="SETUP"]::before { -webkit-mask: none; mask: none; background: none; width: 0; }

/* rail: "…" when a long paper shows a window of questions */
.qrail li[data-q="more"] .n { border: 0; color: var(--x-muted); width: auto; }
.progress { overflow: hidden; max-width: 100%; }
.rail-note { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }

.timer-note:empty { display: none; }

/* Now tray text runs */
.pending .pt { display: block; }
.saying .st { grid-column: 1 / -1; }
.heard .st { display: block; }
.heard .tag { color: var(--x-muted); }

/* one key: a single wide cell while the key means nothing (off) or practice speaks for itself */
.turn-btn { position: relative; }
.turn-btn[data-mode="off"], .turn-btn[data-mode="practice"] { grid-template-columns: 1fr; }
.turn-btn[data-mode="practice"] .cell { justify-content: center; grid-template-columns: auto auto; }
.turn-btn[data-mode="practice"] .g { display: none; }
.turn-btn[data-mode="practice"] { cursor: default; }
.turn-btn:disabled { opacity: 1; }
.turn-btn[data-mode="holding-yes"] .fill { --p: 1; transition: transform var(--hold-ms, 1000ms) linear; }
.turn-btn .v-en:empty { display: none; }
.turn-btn .flash { gap: .4em; grid-auto-flow: column; justify-content: center; z-index: 2; }
.turn-btn .flash::before { content: ""; width: 1.1em; height: 1.1em; background: currentColor; -webkit-mask: var(--ico-tick) center / contain no-repeat; mask: var(--ico-tick) center / contain no-repeat; }
.turn-btn .flash[hidden] { display: none; }

/* invigilator strip: long names and paper titles shorten, never push Pause off */
.exam-foot { min-width: 0; }
.exam-foot .who { flex: 0 1 auto; overflow: hidden; }
.exam-foot .who b, .exam-foot .paper-name { overflow: hidden; text-overflow: ellipsis; }
.exam-foot .paper-name { display: block; max-width: 34ch; }
.exam-foot .session-label, .exam-foot .pause-btn, .exam-foot .micmini { flex: none; }
.session-label[data-tone="warn"] { color: #1a1200; background: var(--stf-warn); border-color: var(--stf-warn); }
.session-label[data-tone="wait"] { color: var(--stf-muted); }
.micmini i:nth-child(1) { height: 5px; } .micmini i:nth-child(2) { height: 8px; } .micmini i:nth-child(3) { height: 11px; }
.micmini i:nth-child(4) { height: 14px; } .micmini i:nth-child(5) { height: 18px; }
.foot-flash { flex: none; font-weight: 750; padding: 4px 12px; border-radius: 999px; background: var(--stf-warn); color: #1a1200; white-space: nowrap; }
.exam-foot .ico { display: inline-block; }
@media (max-width: 1420px) { .exam-foot .kh-more { display: none; } }
@media (max-width: 1100px) { .exam-foot .key-hint { display: none; } }
@media (max-width: 760px) {
  .exam-foot { flex-wrap: wrap; gap: 8px 12px; }
  .exam-foot .sep, .exam-foot .micmini, .exam-foot .spacer { display: none; }
  .exam-top { grid-template-columns: auto 1fr; }
  .exam-top .progress { grid-column: 1 / -1; grid-row: 2; }
  .exam-top .timer-wrap { grid-column: 2; grid-row: 1; }
  .facts { grid-template-columns: repeat(2, 1fr); }
  .timer { font-size: clamp(40px, 13vw, 64px); }
  .badge .bh { font-size: calc(var(--fs) * .85); }
  .turn-btn .cell { grid-template-columns: minmax(0, 1fr); justify-items: center; text-align: center; padding: 8px 4px; row-gap: 2px; }
  .turn-btn .g { grid-row: auto; grid-auto-flow: column; align-items: center; gap: 6px; }
  .turn-btn .g i { width: 22px; height: 14px; }
  .turn-btn .v { font-size: calc(var(--fs) * .78); }
  .turn-btn .v-en { font-size: 13px; letter-spacing: .03em; }
  .facts div:nth-child(3) { border-left: 0; }
}

/* pause console */
.console .resume-hint kbd { font-size: 11px; }
.console .reasons[hidden], .console .end-confirm[hidden], .console .overlay-actions[hidden] { display: none; }
.reasons { border: 0; padding: 0; margin: 0; min-width: 0; }
.reasons .lbl { float: left; padding: 0; }
.waiting q { quotes: "“" "”" "‘" "’"; }

/* A short reading column (big text + a long sentence waiting for "sahi hai"): the question folds
   to one line, then out of the way, instead of showing half a card. */
@container reading (max-height: 6.4em) {
  .question .qnum, .ans-label { display: none; }
  .question { padding-block: calc(var(--fs) * .12); box-shadow: none; }
  .reading .qtext { display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 1; overflow: hidden; line-height: 1.45; }
}
@container reading (max-height: 3.6em) { .question { display: none; } }
/* Less than one line of room (huge text + a long sentence waiting): show no half-cut line at all. */
@container reading (max-height: 1.7em) { .saved { visibility: hidden; } }

@media (prefers-reduced-motion: reduce) {
  .turn-btn[data-mode="holding"] .fill { transition: transform var(--hold-ms, 1000ms) steps(4, end) !important; }
  .now-idle .ring { box-shadow: none !important; }
  .turn-btn[data-mode="holding-yes"] .fill { transition: transform var(--hold-ms, 1000ms) steps(4, end) !important; }
}
