/* Quiz page: poster band, stage card, result. The quiz swatch appears only in
   the band, the progress fill and the result card (plus the stage's state tiles). */

/* ---------- Poster band ---------- */
.band {
  position: relative; overflow: hidden; isolation: isolate;
  height: 160px;
  background-color: var(--field); background-image: var(--grain);
  color: var(--on);
}
@media (min-width: 720px) { .band { height: 220px; } }
.band__media { position: absolute; top: 0; right: 0; bottom: 0; width: 36%; overflow: hidden; }
@media (min-width: 720px) { .band__media { width: 44%; } }
.band__photo {
  position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover;
  filter: var(--duo); /* inline SVG duotone: deep shadows to light highlights */
}
.band__art svg {
  position: absolute; top: 0; left: 50%; transform: translateX(-50%);
  height: 151.5%; width: auto; max-width: none; aspect-ratio: 4 / 5;
}
.band .art-field { display: none; }
.band__in { position: relative; z-index: 1; height: 100%; padding-top: 14px; }
@media (min-width: 720px) { .band__in { padding-top: 24px; } }
.band__top { display: flex; align-items: center; justify-content: space-between; gap: var(--s2); min-height: 44px; }
.band__chips { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0; padding: 0; height: 26px; overflow: hidden; min-width: 0; }
.band__btns { display: flex; gap: var(--s2); flex: none; }
/* Light ring keeps the button edge at 3:1 or better over any part of the duotone photo */
.band__btns .btn { box-shadow: 0 0 0 2px var(--light); }
.band__btns .btn:focus-visible { box-shadow: 0 0 0 2px var(--wall); }
.band__btns .btn .lbl { display: none; }
@media (min-width: 720px) {
  .band__btns .btn { width: auto; padding: 0 18px 0 14px; }
  .band__btns .btn .lbl { display: inline; }
}
.band__titlewrap { container-type: inline-size; width: 62%; margin-top: 8px; }
@media (min-width: 720px) { .band__titlewrap { width: 52%; margin-top: 12px; } }
.band__title {
  font-size: min(calc(100cqi / var(--em) * 0.985), 72px);
  font-weight: 900; font-stretch: var(--wdth); letter-spacing: -0.01em;
  line-height: 0.9; text-transform: uppercase; white-space: nowrap;
  padding-top: 0.06em;
}
@media (max-width: 379px) { .band__chips .chip--cat { display: none; } }

/* ---------- Stage card ---------- */
.stage-wrap { position: relative; z-index: 2; margin-top: -48px; }
.stage-card {
  background: var(--surface); border-radius: var(--r-card);
  padding: var(--s4); margin-inline: auto; width: 100%; max-width: 720px;
}
@media (min-width: 720px) { .stage-card { padding: var(--s5); } }
.stage-card--wide { max-width: 1040px; }

.toprow { display: flex; align-items: center; gap: var(--s3); min-height: 56px; flex-wrap: wrap; }
.toprow__stats { display: flex; align-items: center; gap: var(--s4) var(--s5); flex: 1 1 auto; min-width: 0; }
.stat { display: grid; gap: 2px; min-width: 0; }
.stat.is-unused { visibility: hidden; }
.stat__label { font-size: 12px; color: var(--ink-2); line-height: 1.2; }
.stat__value { font-size: 20px; font-weight: 700; font-stretch: 100%; line-height: 1.2; font-variant-numeric: tabular-nums; white-space: nowrap; }
.stat--progress { flex: 1 1 120px; max-width: 220px; }
.bar { display: block; height: 4px; border-radius: 2px; background: var(--surface-2); overflow: hidden; margin-top: 4px; }
.bar__fill { display: block; height: 100%; width: 0; background: var(--field); transition: width var(--t) var(--ease); }
.toprow__actions { display: flex; gap: var(--s2); margin-left: auto; }
.toprow__actions .btn .lbl { display: none; }
@media (min-width: 560px) { .toprow__actions .btn { width: auto; padding: 0 16px 0 12px; } .toprow__actions .btn .lbl { display: inline; } }
.toprow__note { flex-basis: 100%; font-size: 14px; color: var(--ink-2); }

.variants { margin-top: var(--s3); }
.variants .seg span { min-width: 64px; }

.stage { position: relative; margin: var(--s5) auto 0; }
/* Declared stage sizes reserve their height before the quiz mounts, so nothing shifts.
   Boards fit inside: narrow 380 by 600, square up to 560 by 560, wide 960 by 480. */
.stage--narrow { max-width: 380px; min-height: 600px; }
.stage--square { width: min(100%, 560px); aspect-ratio: 1; }
.stage--wide { max-width: 960px; min-height: 480px; }
.stage__skeleton { width: 100%; height: 100%; position: absolute; inset: 0; }
.stage.is-mounted .stage__skeleton { display: none; }

/* Pause: covers the stage in the swatch light tone (surface-2 in dark) */
.pause-panel {
  position: absolute; inset: -8px; z-index: 3; border-radius: 12px;
  display: grid; align-content: start; justify-items: center; gap: var(--s4); text-align: center; padding: clamp(48px, 12vh, 120px) var(--s5) var(--s5);
  background: var(--light); color: var(--deep);
}
.pause-panel p { font-size: 20px; font-weight: 700; font-stretch: 108%; }
:root[data-theme="dark"] .pause-panel { background: var(--surface-2); color: var(--ink); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .pause-panel { background: var(--surface-2); color: var(--ink); } }

/* Shell states rendered in the stage */
.stage-msg { display: grid; justify-items: start; gap: var(--s3); padding: var(--s5) 0; }
.stage-msg h2 { font-size: 22px; }
.stage-msg p { color: var(--ink-2); max-width: 46ch; }
.finished { display: grid; gap: var(--s4); }
.finished__summary { display: flex; flex-wrap: wrap; align-items: center; gap: var(--s3) var(--s4); padding-bottom: var(--s4); border-bottom: 1px solid var(--line); }
.finished__summary h2 { font-size: 20px; flex-basis: 100%; }

/* ---------- Feedback states (stage and result dialog only) ---------- */
.state { --st: var(--state-absent); position: relative; background: var(--st); color: #FFFFFF; }
.state--correct { --st: var(--state-correct); }
.state--partial { --st: var(--state-partial); }
.state--wrong { --st: var(--state-wrong); }
.state--absent { --st: var(--state-absent); }
/* Non-color cues: check, hatch, cross, dotted inset */
.state--partial { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='8' height='8'%3E%3Cpath d='M-2 2l4-4M0 8l8-8M6 10l4-4' stroke='%23fff' stroke-opacity='.28' stroke-width='1.5'/%3E%3C/svg%3E"); }
.state--absent { box-shadow: inset 0 0 0 3px var(--st), inset 0 0 0 4.5px rgba(255, 255, 255, .55); }
.state .cue { position: absolute; top: 4px; right: 4px; width: 14px; height: 14px; stroke-width: 3; }

.specimen { margin-top: var(--s6); padding-top: var(--s5); border-top: 1px dashed var(--line-strong); }
.specimen h2 { font-size: 16px; }
.specimen > p { font-size: 14px; color: var(--ink-2); margin-top: 2px; }
.tiles { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--s3); list-style: none; margin: var(--s4) 0 0; padding: 0; }
.tiles li { display: grid; justify-items: center; gap: 6px; font-size: 13px; text-align: center; line-height: 1.25; }
.tile { width: 56px; height: 56px; border-radius: 6px; display: grid; place-items: center; font-weight: 800; font-size: 28px; font-stretch: 112.5%; }

/* ---------- Below the stage ---------- */
.below { display: grid; gap: var(--s7); margin-top: var(--s7); }
.about-row { display: grid; gap: var(--s6); align-items: start; }
@media (min-width: 1280px) { .about-row { grid-template-columns: minmax(0, 1fr) 300px; } }
.about h2, .more h2 { font-size: 22px; margin-bottom: var(--s3); }
.about p { max-width: 62ch; }
.about ol { padding-left: 1.25em; max-width: 62ch; margin: var(--s3) 0 0; }
.about ol li + li { margin-top: 6px; }
.more .shelf__row { margin-top: var(--s4); }
@media (min-width: 720px) { .more .shelf__row { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (min-width: 1024px) { .more .shelf__row { grid-template-columns: repeat(3, minmax(0, 300px)); } }

/* ---------- Result dialog ---------- */
.result__img { width: min(100%, 300px); aspect-ratio: 4 / 5; height: auto; margin: 0 auto var(--s4); border-radius: var(--r-poster); background: var(--field); }
.result h2 { font-size: 24px; }
.result__compare { margin-top: 6px; color: var(--ink-2); }
.result .dlg__actions .btn { flex: 1 1 auto; }
.result__next { display: flex; align-items: center; gap: var(--s2); min-height: 44px; font-variant-numeric: tabular-nums; }

/* Tries distribution: bars in the field color, values as text */
.dist { list-style: none; padding: 0; margin: var(--s4) 0 0; display: grid; gap: 6px; }
.dist li { display: grid; grid-template-columns: 16px 1fr; align-items: center; gap: var(--s2); font-variant-numeric: tabular-nums; font-size: 14px; }
.dist .dist__bar { display: flex; align-items: center; gap: var(--s2); }
.dist .dist__bar i { display: block; height: 20px; min-width: 4px; border-radius: 3px; background: var(--field); }
