/* Student survey styles (loaded only by index.html, after app.css). Tokens/base come from app.css.
   Local, survey-only tokens are prefixed --sv-. Contrast notes (measured in-browser, see report):
   --sv-edge is the >= 3:1 boundary colour for interactive controls (app.css --line is decorative only). */
:root {
  --sv-edge: var(--line-strong); /* >= 3:1 on --card and --bg (app.css): borders of chips, pills, tracks */
  --sv-tint: color-mix(in srgb, var(--accent-soft) 45%, var(--card));
  --sv-track: #dde4ef;
  --sv-cw: 3rem;                /* chip width (wide layout) */
  --sv-gap: .4rem;
  --sv-numw: calc(5 * var(--sv-cw) + 4 * var(--sv-gap));
  --sv-xw: 4.2rem;              /* room reserved for the N/A chip */
  --sv-rcol: calc(var(--sv-numw) + var(--sv-xw));
  /* weight segments: every colour >= 3:1 against the card */
  --seg0: #0b2545; --seg1: #3d6cb0; --seg2: #9a6f1f; --seg3: #2f8579; --seg4: #7d58a8; --seg5: #b5473a; --seg6: #587a2f; --seg7: #6b6b6b;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --sv-track: #1d3052;
    --seg0: #7fa9ee; --seg1: #d9b062; --seg2: #6fd3a0; --seg3: #c3a2ea; --seg4: #f0907f; --seg5: #9ec26b; --seg6: #5fd0e0; --seg7: #b4b4b4;
  }
}
:root[data-theme="dark"] {
  --sv-track: #1d3052;
  --seg0: #7fa9ee; --seg1: #d9b062; --seg2: #6fd3a0; --seg3: #c3a2ea; --seg4: #f0907f; --seg5: #9ec26b; --seg6: #5fd0e0; --seg7: #b4b4b4;
}

/* ---- progress header (tunes the shared .progress/.bar) ---- */
.progress { padding-top: .9rem; }
.progress .meta { font-size: .85rem; font-weight: 500; flex-wrap: wrap; row-gap: 0; }
.progress .bar { height: 8px; background: var(--sv-track); box-shadow: inset 0 0 0 1px var(--sv-edge); }
.progress .bar > i { background: var(--brass); border-radius: 99px; }

/* ---- generic step typography ---- */
fieldset { border: 0; margin: 0; padding: 0; min-width: 0; }
.step h1 { margin-bottom: .6rem; }
.step .lead { max-width: 62ch; }
.block { margin-top: 1.25rem; }
.block:first-of-type { margin-top: 1rem; }
.block > h2 { font-size: 1.1rem; padding-bottom: .35rem; margin-bottom: .35rem; border-bottom: 2px solid var(--brass); display: inline-block; padding-right: 1.5rem; }
.block > p.muted { margin-bottom: .5rem; }

/* ---- rating rows ---- */
.scale-key {
  display: flex; justify-content: space-between; gap: 1rem; font-size: .8rem; font-weight: 600; color: var(--muted);
  margin: .35rem 0 0; padding: .6rem 0 .45rem; max-width: 24rem; line-height: 1.25;
  position: sticky; top: 0; z-index: 4; background: var(--card); border-bottom: 1px solid var(--line);
}
.scale-key span:last-child { text-align: right; }
.card.step > .scale-key { margin-right: 1.07rem; } /* line up with rows inside .ocard (its padding + border) */

.row { display: grid; grid-template-columns: minmax(0, 1fr); gap: .4rem; padding: .85rem 0 .7rem; border-top: 1px solid var(--line); align-items: center; }
.scale-key + .row { border-top: 0; }
.row legend { padding: 0; float: left; width: 100%; } .row legend + * { clear: both; }
.row .stmt { font-weight: 500; line-height: 1.35; }
.row .ends { display: block; font-size: .78rem; color: var(--muted); font-weight: 400; margin-top: .1rem; }
.chips { display: flex; gap: var(--sv-gap); align-items: center; flex-wrap: wrap; }

/* 1-5 ramp marker colours, exposed to chip + picked label */
.row:has(input[value="1"]:checked) { --ramp: var(--s1); }
.row:has(input[value="2"]:checked) { --ramp: var(--s2); }
.row:has(input[value="3"]:checked) { --ramp: var(--s3); }
.row:has(input[value="4"]:checked) { --ramp: var(--s4); }
.row:has(input[value="5"]:checked) { --ramp: var(--s5); }

.chip { position: relative; display: inline-block; }
.chip input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.chip .num {
  position: relative; display: grid; place-items: center; min-width: 2.75rem; width: var(--sv-cw); height: 2.9rem; padding: 0 .4rem;
  border: 1.5px solid var(--sv-edge); border-radius: 11px; font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums;
  background: var(--card); color: var(--ink); transition: background-color .12s, border-color .12s, transform .12s;
}
@media (hover: hover) { .chip:hover .num { border-color: var(--accent); background: var(--accent-soft); } }
.chip input:active + .num { transform: scale(.96); }
.chip input:checked + .num, .chip:hover input:checked + .num {
  background: var(--accent); color: var(--accent-ink); border-color: var(--accent); box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--accent);
}
/* selected: thin ramp-coloured bar (never the only cue: fill polarity + check badge + text label carry the meaning) */
.chip:not(.x) input:checked + .num::before {
  content: ""; position: absolute; left: 22%; right: 22%; bottom: 5px; height: 4px; border-radius: 2px;
  background: var(--ramp, var(--accent-ink)); box-shadow: 0 0 0 1px var(--accent-ink);
}
.chip:not(.x) input:checked + .num::after {
  content: "✓"; position: absolute; top: -7px; right: -5px; width: 17px; height: 17px; border-radius: 50%; display: grid; place-items: center;
  font-size: 11px; line-height: 1; font-weight: 800; background: var(--card); color: var(--accent); border: 1.5px solid var(--accent);
}
.chip input:focus-visible + .num { outline: 3px solid var(--focus); outline-offset: 5px; }

/* N/A and "not enough chance to judge": visibly secondary */
.chip.x .num { width: auto; min-width: 2.75rem; padding: 0 .65rem; font-size: .8rem; font-weight: 600; line-height: 1.15; text-align: center; color: var(--muted); background: transparent; border: 1.5px dashed var(--sv-edge); }
.chip.x input:checked + .num { background: var(--muted); border: 1.5px solid var(--muted); color: var(--card); box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--muted); }
.chip.x input:checked + .num::before { content: "✓"; margin-right: .3em; font-weight: 800; }
@media (hover: hover) { .chip.x:hover .num { background: var(--accent-soft); color: var(--ink); } }

.picked { font-size: .85rem; min-height: 1.35em; font-weight: 700; color: var(--ink); line-height: 1.35; }
.picked:not(:empty) { padding-left: .55rem; border-left: 4px solid var(--ramp, var(--muted)); }

/* wide: statement left, chips + readout in a fixed right column so endpoint labels line up */
@media (min-width: 641px) {
  .row { grid-template-columns: minmax(0, 1fr) var(--sv-rcol); column-gap: 1.25rem; row-gap: .2rem; padding: .7rem 0 .55rem; }
  .row legend { grid-column: 1; grid-row: 1 / span 2; align-self: center; padding-right: .5rem; }
  .chips { grid-column: 2; grid-row: 1; flex-wrap: nowrap; }
  .picked { grid-column: 2; grid-row: 2; }
  .scale-key { max-width: none; width: fit-content; min-width: var(--sv-rcol); margin-left: auto; padding-right: var(--sv-xw); box-sizing: border-box; }
  .scale-key span { white-space: nowrap; }
  .card.step > .scale-key { margin-right: 1.07rem; }
}
/* narrow: statement, then a full-width 5-up chip strip; readout and N/A share the line beneath */
@media (max-width: 640px) {
  .row { grid-template-columns: repeat(10, minmax(0, 1fr)); column-gap: var(--sv-gap); row-gap: .4rem; max-width: 100%; }
  .row legend { grid-column: 1 / -1; margin-bottom: .2rem; }
  .chips { display: contents; }
  .chip:not(.x) { grid-column: span 2; min-width: 0; }
  .chip .num { width: 100%; min-width: 0; height: 2.9rem; }
  .chip.x .num { width: 100%; min-height: 2.75rem; height: 100%; }
  .chip.x { grid-row: 3; align-self: stretch; }
  .chips > .chip.x:nth-child(6) { grid-column: 8 / span 3; }
  .picked { grid-row: 3; grid-column: 1 / span 7; align-self: center; }
  /* two extras (outcomes): N/A and "not enough chance" side by side, readout below */
  .chips > .chip.x:nth-child(6):nth-last-child(2) { grid-column: 1 / span 3; }
  .chips > .chip.x:nth-child(7) { grid-column: 4 / span 7; }
  .row:has(.chip.x:nth-child(7)) .picked { grid-row: 4; grid-column: 1 / -1; }
  .scale-key { max-width: none; }
  .scale-key span { max-width: 50%; }
  .card.step > .scale-key { margin-right: 1.07rem; }
}
@media (max-width: 380px) {
  :root { --sv-gap: .28rem; }
  .card.step { padding-left: .75rem; padding-right: .75rem; }
  .card.step .ocard { padding-left: .5rem; padding-right: .5rem; border-left-width: 3px; }
  .chip .num { font-size: 1rem; border-radius: 10px; }
  .chip.x .num { padding: 0 .35rem; font-size: .75rem; }
}

@media (max-width: 380px) { .ocard [id^="more_"]:not([hidden]) { padding-left: 0; border-left: 0; } }
@media (max-width: 340px) { /* 320px phones, even with a classic scrollbar: keep every chip >= 44px wide */
  :root { --sv-gap: .25rem; }
  main { padding-left: 12px; padding-right: 12px; }
  .card.step { padding-left: .6rem; padding-right: .6rem; }
}

/* ---- choices (pills) ---- */
fieldset.q { margin: 1.25rem 0; }
fieldset.q legend, .q > legend { font-weight: 600; padding: 0; line-height: 1.35; }
.q .muted.small { margin-top: .15rem; }
.q .cnt { font-weight: 600; color: var(--ink); }
.q + .q { margin-top: 1.25rem; }
.opts { display: flex; flex-wrap: wrap; gap: .5rem; margin-top: .6rem; }
.opt { position: relative; max-width: 100%; }
.opt input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.opt span {
  display: inline-flex; align-items: center; gap: .55rem; padding: .5rem .95rem .5rem .75rem; min-height: 44px; max-width: 100%;
  border: 1.5px solid var(--sv-edge); border-radius: 14px; background: var(--card); line-height: 1.3; transition: background-color .12s, border-color .12s;
}
.opt span::before { /* radio / checkbox indicator; glyphs survive forced-colors */
  content: ""; flex: none; box-sizing: border-box; width: 1.2rem; height: 1.2rem; display: grid; place-items: center;
  border: 2px solid var(--sv-edge); border-radius: 50%; font-size: .8rem; font-weight: 800; line-height: 1; color: var(--accent);
}
.opt:has(input[type=checkbox]) span::before { border-radius: 5px; }
.opt input:checked + span::before { border-color: var(--accent); }
.opt input[type=radio]:checked + span::before { content: "●"; font-size: .6rem; }
.opt input[type=checkbox]:checked + span::before { content: "✓"; }
@media (hover: hover) { .opt:hover input:not(:disabled):not(:checked) + span { border-color: var(--accent); background: var(--accent-soft); } }
.opt input:checked + span { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; box-shadow: inset 0 0 0 1px var(--accent); }
.opt input:disabled + span { border-style: dashed; color: var(--muted); background: transparent; cursor: not-allowed; opacity: .75; }
.opt input:disabled { cursor: not-allowed; }
.opt input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 3px; }

/* assignment status: three equal choices, each with its own tint on selection */
.opts:has(input[data-t="astatus"]) .opt { flex: 1 1 11rem; }
.opts:has(input[data-t="astatus"]) .opt span { width: 100%; height: 100%; }
.opt input[value="done"]:checked + span { background: var(--ok-soft); border-color: var(--ok); box-shadow: inset 0 0 0 1px var(--ok); }
.opt input[value="done"]:checked + span::before { border-color: var(--ok); color: var(--ok); }
.opt input[value="partial"]:checked + span { background: var(--warn-soft); border-color: var(--warn); box-shadow: inset 0 0 0 1px var(--warn); }
.opt input[value="partial"]:checked + span::before { border-color: var(--warn); color: var(--warn); }
@media (max-width: 640px) { .opts:has(input[data-t="astatus"]) .opt { flex-basis: 100%; } }

/* ---- weights ---- */
#wbox { margin-top: 1rem; }
#wbox.muted { opacity: .7; }
.wrow {
  --seg: var(--seg0);
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .1rem 1rem; align-items: center; padding: .65rem 0 .4rem; border-top: 1px solid var(--line);
}
.wrow:nth-of-type(8n+1) { --seg: var(--seg0); } .wrow:nth-of-type(8n+2) { --seg: var(--seg1); } .wrow:nth-of-type(8n+3) { --seg: var(--seg2); } .wrow:nth-of-type(8n+4) { --seg: var(--seg3); }
.wrow:nth-of-type(8n+5) { --seg: var(--seg4); } .wrow:nth-of-type(8n+6) { --seg: var(--seg5); } .wrow:nth-of-type(8n+7) { --seg: var(--seg6); } .wrow:nth-of-type(8n+8) { --seg: var(--seg7); }
.wrow label { font-weight: 500; display: flex; align-items: center; gap: .6rem; line-height: 1.3; }
.wrow label::before { content: ""; flex: none; width: .8rem; height: .8rem; border-radius: 3px; background: var(--seg); box-shadow: 0 0 0 1px var(--sv-edge); }
.wrow output { text-align: right; font-weight: 700; font-size: 1.15rem; font-variant-numeric: tabular-nums; min-width: 3.4rem; }
.wrow input[type=range] {
  grid-column: 1 / -1; width: 100%; margin: 0; height: 2.75rem; background: transparent; cursor: pointer; touch-action: pan-y;
  -webkit-appearance: none; appearance: none; accent-color: var(--seg);
}
.wrow input[type=range]::-webkit-slider-runnable-track { height: 10px; border-radius: 99px; background: var(--sv-track); border: 1px solid var(--sv-edge); }
.wrow input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none; width: 28px; height: 28px; margin-top: -9px; border-radius: 50%; background: var(--seg);
  border: 3px solid var(--card); box-shadow: 0 0 0 1.5px var(--sv-edge), 0 2px 6px rgba(0, 0, 0, .25);
}
.wrow input[type=range]::-moz-range-track { height: 10px; border-radius: 99px; background: var(--sv-track); border: 1px solid var(--sv-edge); box-sizing: border-box; }
.wrow input[type=range]::-moz-range-thumb { width: 22px; height: 22px; border-radius: 50%; background: var(--seg); border: 3px solid var(--card); box-shadow: 0 0 0 1.5px var(--sv-edge), 0 2px 6px rgba(0, 0, 0, .25); }
.wrow input[type=range]:focus-visible { outline-offset: 0; border-radius: 10px; }
.wrow input[type=range]:focus-visible::-webkit-slider-thumb { outline: 3px solid var(--focus); outline-offset: 2px; }
.wrow input[type=range]:focus-visible::-moz-range-thumb { outline: 3px solid var(--focus); outline-offset: 2px; }
.wrow input[type=range]:disabled { cursor: not-allowed; opacity: .55; }
@media (pointer: coarse) {
  .wrow input[type=range] { height: 3rem; }
  .wrow input[type=range]::-webkit-slider-thumb { width: 36px; height: 36px; margin-top: -13px; }
  .wrow input[type=range]::-moz-range-thumb { width: 30px; height: 30px; }
}
@media (min-width: 700px) {
  .wrow { grid-template-columns: minmax(9rem, 17rem) minmax(0, 1fr) 4rem; gap: 0 1.25rem; padding: .3rem 0; }
  .wrow label { grid-column: 1; grid-row: 1; } .wrow input[type=range] { grid-column: 2; grid-row: 1; }
  .wrow output { grid-column: 3; grid-row: 1; }
}
.stack { display: flex; height: 22px; border-radius: 11px; overflow: hidden; background: var(--sv-track); box-shadow: inset 0 0 0 1.5px var(--sv-edge); margin: 1rem 0 .4rem; }
.stack i { display: block; height: 100%; min-width: 0; box-shadow: inset -2px 0 0 var(--card); transition: width .35s cubic-bezier(.2, .8, .2, 1); }
.seg-0 { background: var(--seg0); } .seg-1 { background: var(--seg1); } .seg-2 { background: var(--seg2); } .seg-3 { background: var(--seg3); }
.seg-4 { background: var(--seg4); } .seg-5 { background: var(--seg5); } .seg-6 { background: var(--seg6); } .seg-7 { background: var(--seg7); }
.total { display: flex; justify-content: space-between; align-items: baseline; font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.total span:last-child { font-size: 1.25rem; }
.total.bad { color: var(--err); }
.total.bad span:first-child::before { content: "⚠ "; }
.btnrow { display: flex; gap: .6rem; flex-wrap: wrap; margin-top: 1rem; align-items: center; }
.btnrow .btn.small, .review .btn.small, [data-act="more"] { min-height: 44px; padding: .45rem 1rem; }
.btn[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent); font-weight: 700; }
.btnrow .btn:not(.small) { min-width: 13rem; }
@media (max-width: 640px) { .btnrow .btn:not(.small) { flex: 1 1 100%; } }

/* ---- outcome + assignment cards ---- */
.ocard { border: 1px solid var(--line); border-left: 4px solid var(--accent); border-radius: 12px; padding: .95rem 1rem 1rem; margin: 1rem 0; background: var(--sv-tint); }
.ocard h2, .ocard h3 { font-family: var(--font); font-size: 1.02rem; font-weight: 650; line-height: 1.35; margin-bottom: .25rem; }
.ocard .n { color: var(--brass); font-weight: 700; font-size: .75rem; letter-spacing: .1em; text-transform: uppercase; margin-bottom: .15rem; }
.mq { font-size: .95rem; font-weight: 600; margin: 1rem 0 0; line-height: 1.35; }
.ocard .row { border-top: 0; padding-top: .45rem; }
.ocard .orows .row legend .muted { display: none; } /* short label duplicates .mq; the .sr text stays as the accessible name */
.ocard .orows .row legend { height: 0; }
.ocard .orows .chips { grid-column: auto; grid-row: auto; }
.ocard .orows .picked { grid-column: auto; grid-row: auto; }
@media (min-width: 641px) {
  .ocard .orows .row { grid-template-columns: minmax(0, 1fr); }
  .ocard .orows .chips { flex-wrap: wrap; }
}
@media (max-width: 640px) {
  .ocard .orows .picked { grid-row: 3; grid-column: 1 / span 7; }
  .ocard .orows .row:has(.chip.x:nth-child(7)) .picked { grid-row: 4; grid-column: 1 / -1; }
}
.chk { display: flex; gap: .7rem; align-items: center; margin-top: .6rem; font-size: .92rem; min-height: 44px; cursor: pointer; line-height: 1.35; }
.chk input { flex: none; width: 1.4rem; height: 1.4rem; accent-color: var(--accent); margin: 0; }
.ocomment { margin-top: .8rem; padding-top: .7rem; border-top: 1px dashed var(--sv-edge); }
.seg3 { display: flex; gap: .4rem; flex-wrap: wrap; }

/* "Rate in more detail" disclosure */
[data-act="more"] { display: flex; align-items: center; justify-content: space-between; gap: .75rem; width: 100%; margin-top: .75rem !important; border-style: dashed; text-align: left; }
@media (min-width: 641px) { [data-act="more"] { width: auto; justify-content: flex-start; } }
[data-act="more"]::after { content: ""; flex: none; width: .55rem; height: .55rem; border-right: 2.5px solid currentColor; border-bottom: 2.5px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform .15s; }
[data-act="more"][aria-expanded="true"]::after { transform: translateY(1px) rotate(-135deg); }
[id^="more_"]:not([hidden]) { margin-top: .5rem; padding-left: .85rem; border-left: 3px solid var(--sv-edge); }

/* ---- review list ---- */
.review { padding: 0; margin: .75rem 0; border-bottom: 1px solid var(--line); }
.review li { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: .5rem 0; min-height: 3.4rem; border-top: 1px solid var(--line); list-style: none; font-weight: 500; line-height: 1.3; }
.review li .btn { white-space: nowrap; font-variant-numeric: tabular-nums; }
#submitErr:empty { display: none; }

/* ---- welcome / privacy panel ---- */
.step > ul.tick { background: var(--sv-tint); border: 1px solid var(--line); border-radius: 12px; padding: .9rem 1rem .9rem; margin: .6rem 0 1rem; }
.step > ul.tick li { padding-left: 1.9rem; margin: .55rem 0; line-height: 1.45; }
.step > ul.tick li::before { top: .05em; width: 1.3rem; height: 1.3rem; display: grid; place-items: center; border-radius: 50%; background: var(--ok-soft); font-size: .8rem; left: 0; }
.step > h2 { margin-top: 1.25rem; }
.step details { border: 1px solid var(--line); border-radius: 12px; padding: 0 1rem; margin: .75rem 0 1.1rem; }
.step details > summary { min-height: 44px; display: flex; align-items: center; }
.step details[open] { padding-bottom: .2rem; }
.step details[open] > summary { border-bottom: 1px solid var(--line); margin-bottom: .6rem; }
.step .alert .btnrow { margin-top: .6rem; }
.step .q { margin: 1rem 0; }

/* ---- text answers ---- */
.q > label.fld { font-size: 1rem; line-height: 1.35; margin-bottom: .4rem; }
textarea { border-color: var(--sv-edge); line-height: 1.45; scroll-margin-bottom: 8rem; }
input[type=text] { border-color: var(--sv-edge); scroll-margin-bottom: 8rem; }
textarea:focus, input[type=text]:focus { border-color: var(--focus); }

/* ---- thank-you / closed card ---- */
.thanks, .card.step:has(> h1:first-child + p.lead + p.muted):not(:has([data-act="recheck"])) { text-align: center; padding: 2rem 1.25rem 2.25rem; }
.thanks > h1::before, .card.step:has(> h1:first-child + p.lead + p.muted):not(:has([data-act="recheck"])) > h1::before {
  content: "✓"; display: grid; place-items: center; width: 3.5rem; height: 3.5rem; margin: 0 auto 1rem; border-radius: 50%;
  background: var(--ok-soft); color: var(--ok); border: 2px solid var(--ok); font-family: var(--font); font-size: 1.7rem; font-weight: 800;
}
.thanks .lead, .card.step:has(> h1:first-child + p.lead + p.muted):not(:has([data-act="recheck"])) .lead { margin-left: auto; margin-right: auto; }

/* ---- status boxes (built on app.css .alert) ---- */
.resume-box, .already-box, .closed-box, .submit-error { line-height: 1.45; }
.resume-box strong, .already-box strong, .closed-box strong, .submit-error strong { display: block; margin-bottom: .15rem; }
.submit-error strong { display: inline; }
.resume-box .btnrow, .closed-box .btnrow { margin-top: .75rem; }
.already-box { margin-bottom: 1rem; }
.code-msg { min-height: 1.4em; margin-top: .35rem; font-weight: 600; line-height: 1.4; }
.code-msg:empty { min-height: 0; margin: 0; }
.q #codeHelp { margin-top: .35rem; }
.expect-list { background: var(--sv-tint); }
#liveAlert { position: absolute; }

/* ---- save-for-later control in the progress header, status banner, inline link buttons ---- */
.later-wrap { display: flex; flex-direction: row-reverse; align-items: center; justify-content: space-between; gap: .75rem; margin-top: .1rem; min-height: 2.25rem; }
.later-btn.btn { border-color: transparent; background: transparent; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; padding: .3rem .4rem; margin: -.15rem -.4rem -.15rem 0; }
.later-btn.btn:hover { background: var(--accent-soft); border-color: transparent; }
.save-state { margin: 0; font-size: .8rem; line-height: 1.3; }
.save-state:empty { display: none; }
.banner { max-width: var(--measure, 860px); margin: 0 auto; padding: 0 var(--gutter, 16px); }
.banner:empty { display: none; }
.banner .alert { margin: .75rem 0 0; }
.linkbtn { font: inherit; font-weight: 600; background: none; border: 0; padding: .55rem .3rem; margin: -.55rem 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; border-radius: 6px; text-align: left; }
.linkbtn:hover { color: var(--accent-hover, var(--accent)); background: var(--accent-soft); }
.kbd-hint { margin-top: 1rem; }
@media (pointer: coarse) { .kbd-hint { display: none; } }

/* review: unanswered list */
.review-missing { border: 1px solid var(--line); border-radius: 12px; padding: 0 1rem; margin: 1rem 0; background: var(--sv-tint); }
.review-missing[open] { padding-bottom: .6rem; }
.review-missing > summary { font-weight: 600; }
.rm-sec { margin-top: .6rem; }
.rm-sec h2, .rm-sec h3 { font-family: var(--font); font-size: .78rem; letter-spacing: .08em; text-transform: uppercase; color: var(--brass); margin: 0 0 .1rem; }
.rm-list { list-style: none; margin: 0; padding: 0; }
.rm-list li { border-top: 1px solid var(--line); }
.rm-list li:first-child { border-top: 0; }
.rm-list .linkbtn { display: block; width: 100%; margin: 0; padding: .65rem .25rem; min-height: 44px; font-weight: 500; line-height: 1.35; }
.later-card .tick { margin-top: 1rem; }

/* ---- sticky bottom navbar ---- */
main { padding-bottom: calc(7.5rem + env(safe-area-inset-bottom)); }
.navbar { background: color-mix(in srgb, var(--bg) 96%, transparent); box-shadow: 0 -6px 18px rgba(11, 37, 69, .08); }
.navbar .in { padding-left: max(16px, env(safe-area-inset-left)); padding-right: max(16px, env(safe-area-inset-right)); gap: .6rem .75rem; }
.navbar .btn { min-width: 6.5rem; }
.navbar .note { font-weight: 600; line-height: 1.3; }
.navbar .note:empty { display: none; }
.navbar .btn[data-act="next"] { min-width: 9.5rem; }
@media (max-width: 640px) {
  .navbar .in { flex-wrap: wrap; }
  .navbar .note { order: -1; flex: 1 0 100%; }
  .navbar .btn[data-act="next"] { flex: 1 1 auto; }
}
/* short viewports (landscape phones, Android keyboards that resize the page): don't pin the bar over the content */
@media (max-height: 480px) { .navbar { position: static; box-shadow: none; } main { padding-bottom: 1rem; } }
/* while typing on a touch device the bar scrolls with the page so the keyboard never hides the field */
@media (pointer: coarse) { body:has(textarea:focus, input[type=text]:focus) .navbar { position: static; box-shadow: none; } body:has(textarea:focus, input[type=text]:focus) main { padding-bottom: 1.5rem; } }

/* ---- motion ---- */
@media (prefers-reduced-motion: reduce) {
  .stack i, .chip .num, .opt span, [data-act="more"]::after { transition: none; }
  .chip input:active + .num { transform: none; }
}

/* ---- forced colours / high contrast: selection must not depend on fill or hue ---- */
@media (forced-colors: active) {
  .chip .num, .opt span { border: 2px solid ButtonText; background: Canvas; color: CanvasText; }
  .chip.x .num { border-style: dashed; }
  .chip input:checked + .num, .chip.x input:checked + .num {
    forced-color-adjust: none; background: Highlight; color: HighlightText; border: 3px solid Highlight; outline: 2px solid CanvasText; outline-offset: 1px; box-shadow: none;
  }
  .chip:not(.x) input:checked + .num::before { background: HighlightText; box-shadow: none; }
  .chip:not(.x) input:checked + .num::after { forced-color-adjust: none; background: Canvas; color: CanvasText; border: 2px solid CanvasText; }
  .opt input:checked + span { forced-color-adjust: none; border: 3px solid Highlight; background: Canvas; color: CanvasText; box-shadow: none; }
  .opt span::before { border-color: ButtonText; }
  .opt input:checked + span::before { border-color: Highlight; color: CanvasText; }
  .opt input:disabled + span { border-style: dashed; color: GrayText; border-color: GrayText; }
  .picked:not(:empty) { border-left: 4px solid CanvasText; }
  .ocard { border: 1px solid CanvasText; border-left-width: 4px; }
  .stack { box-shadow: none; border: 1px solid CanvasText; }
  .stack i { forced-color-adjust: none; box-shadow: inset -2px 0 0 Canvas; }
  .seg-0 { background: CanvasText; } .seg-1 { background: Highlight; } .seg-2 { background: LinkText; } .seg-3 { background: VisitedText; }
  .seg-4 { background: ButtonText; } .seg-5 { background: GrayText; } .seg-6 { background: ActiveText; } .seg-7 { background: Mark; }
  .wrow label::before { forced-color-adjust: none; background: Highlight; border: 1px solid CanvasText; box-shadow: none; }
  .wrow input[type=range]::-webkit-slider-thumb { forced-color-adjust: none; background: Highlight; border-color: Canvas; box-shadow: 0 0 0 2px CanvasText; }
  .wrow input[type=range]::-moz-range-thumb { forced-color-adjust: none; background: Highlight; border-color: Canvas; }
  .wrow input[type=range]::-webkit-slider-runnable-track, .wrow input[type=range]::-moz-range-track { background: Canvas; border: 1px solid CanvasText; }
  .progress .bar { box-shadow: none; border: 1px solid CanvasText; }
  .progress .bar > i { forced-color-adjust: none; background: Highlight; }
  .scale-key { border-bottom-color: CanvasText; }
}

/* Keep keyboard-focused controls clear of the fixed bottom navbar (esp. 320x568). */
html { scroll-padding-bottom: 7.5rem; scroll-padding-top: 5rem; }

/* Narrow phones: keep the title to two lines at most. */
@media (max-width: 420px) {
  .topbar .brand { font-size: .95rem; line-height: 1.25; }
  .topbar .badge { font-size: .65rem; white-space: nowrap; }
}
