/* Public question pages (/q/<web id>/), the list (/q/) and the 404. Colors and type from
   /tokens-v2.css. Light only, like the app. Raised = tappable: options are keycaps until
   answered, then everything goes flat. Picked-and-wrong is apricot, never red. */

* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* .after and friends set display; hidden must still win */
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; display: flex; flex-direction: column;
  background: var(--gp-bg); color: var(--gp-text);
  font: 400 16px/1.6 var(--gp-font-text);
}
a { color: var(--gp-label); }
h1, h2, p { margin: 0; }

.qtop {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 10px 16px; border-bottom: 1px solid var(--gp-rule-soft); background: var(--gp-surface);
}
.qtop__brand { display: flex; align-items: center; gap: 8px; color: var(--gp-text); text-decoration: none; font: 700 15px var(--gp-font-display); }
.qtop__brand img { border-radius: 6px; }
.qtop__app { font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; }
/* The question's band, next to the logo. A label, not a link. */
.qtop__band { margin-right: auto; padding: 2px 10px; border-radius: 999px; background: var(--gp-select-tint); color: var(--gp-label); font: 600 13px var(--gp-font-display); white-space: nowrap; }

.q { width: 100%; max-width: 640px; margin: 0 auto; padding: 24px 16px 40px; flex: 1; }
.q__h1 { display: flex; flex-direction: column; gap: 4px; font-weight: 400; }
.q__eyebrow { font: 600 12px var(--gp-font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--gp-brand); }
.q__title { display: block; font-size: 22px; font-weight: 700; line-height: 1.35; }
.q__lede { margin-top: 8px; color: var(--gp-text-2); }
.q__body { margin-top: 20px; display: flex; flex-direction: column; gap: 16px; }
.q__stim, .q__items { display: flex; flex-direction: column; gap: 16px; }
.q__stim:empty { display: none; }
.q__items { gap: 24px; }
.q__intro { color: var(--gp-text-2); font-size: 15px; }
.q__img { width: 100%; max-height: 420px; object-fit: contain; border-radius: var(--gp-radius-card); background: var(--gp-surface); border: 1px solid var(--gp-rule-soft); }
.q__passage { padding: 16px; border-radius: var(--gp-radius-card); background: var(--gp-surface); border: 1px solid var(--gp-rule-soft); line-height: var(--gp-lh-reading, 1.9); font-size: 17px; }
.q__passage p + p { margin-top: .6em; }

.gap { display: inline-block; min-width: 3.2em; padding: 0 4px; border-bottom: 2px solid var(--gp-label); color: var(--gp-label); font-weight: 700; text-align: center; }
.gap.is-filled { border-bottom-color: var(--gp-correct); color: var(--gp-correct); background: var(--gp-correct-tint); border-radius: 4px 4px 0 0; }

/* the one player, like the app's AudioPlayerBar: recording → questions → heard-only options.
   One framed box; the bar has no thumb (it can't be dragged). */
.player {
  display: flex; align-items: center; gap: 12px; padding: 6px 16px 6px 8px;
  border-radius: var(--gp-radius-card); background: var(--gp-surface); border: 1px solid var(--gp-rule-soft);
}
.play {
  flex: none; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%;
  border: 0; background: var(--gp-label); color: var(--gp-white); cursor: pointer; padding: 0 0 0 3px;
}
.play.is-playing { padding: 0; }
.play__i { width: 0; height: 0; border-style: solid; border-width: 7px 0 7px 11px; border-color: transparent transparent transparent currentColor; }
.play.is-playing .play__i { width: 11px; height: 14px; border: 0; border-left: 4px solid; border-right: 4px solid; }
.player__track { flex: 1; height: 6px; border-radius: 3px; background: var(--gp-rule); overflow: hidden; }
.player__track i { display: block; height: 100%; width: 0; border-radius: 3px; background: var(--gp-label); }
.player__time { flex: none; font: 600 14px var(--gp-font-text); font-variant-numeric: tabular-nums; color: var(--gp-text-muted); }
.player__time b { color: var(--gp-text); font-weight: 600; }

.item { display: flex; flex-direction: column; gap: 10px; }
.item__stem { font-size: 17px; font-weight: 700; line-height: 1.5; }
.item__n { display: inline-grid; place-items: center; width: 24px; height: 24px; margin-right: 8px; border-radius: 50%; background: var(--gp-text); color: var(--gp-white); font: 600 13px var(--gp-font-display); vertical-align: 2px; }
.opts { display: flex; flex-direction: column; gap: 8px; }

.opt {
  display: flex; align-items: center; gap: 12px; width: 100%; min-height: var(--gp-opt-min-h, 48px);
  padding: 10px 14px; text-align: left; cursor: pointer;
  border: 1.5px solid var(--gp-rule-strong, var(--gp-rule)); border-bottom-width: 4px; border-radius: var(--gp-radius-opt, 16px);
  background: var(--gp-surface); color: var(--gp-text); font: 500 16px/1.5 var(--gp-font-text);
}
.opt:hover { background: var(--gp-select-tint); }
.opt:active { transform: translateY(2px); border-bottom-width: 2px; }
.opt__k {
  flex: none; width: var(--gp-opt-key, 28px); height: var(--gp-opt-key, 28px); display: grid; place-items: center;
  border-radius: 50%; border: 1.5px solid var(--gp-rule-strong, var(--gp-rule)); font: 600 14px var(--gp-font-display);
}
/* Picture options: squares, all in one row; the explanations wrap under the row. */
.opts--img { flex-direction: row; flex-wrap: wrap; gap: 10px; }
.opts--img .opt { position: relative; flex: 1 1 0; min-width: 0; aspect-ratio: 1; padding: 6px; }
.opts--img .opt__k { position: absolute; top: 6px; left: 6px; background: var(--gp-surface); }
.opt__img { width: 100%; height: 100%; object-fit: contain; border-radius: 8px; }
.opts--img .x { order: 1; flex-basis: 100%; margin: 0 4px; }
.opts--img .x::before { content: attr(data-k); float: left; margin-right: 8px; font: 700 14px/1.6 var(--gp-font-display); color: var(--gp-text-muted); }
.opt__t--heard { color: var(--gp-text-muted); font-size: 14px; }

.opt.is-flat { cursor: default; border-bottom-width: 1.5px; transform: none; background: var(--gp-surface); }
.opt.is-right { border-color: var(--gp-correct); background: var(--gp-correct-tint); }
.opt.is-right .opt__k { border-color: var(--gp-correct); background: var(--gp-correct); color: var(--gp-white); }
.opt.is-wrong { border-color: var(--gp-near); background: var(--gp-near-tint); }
.opt.is-wrong .opt__k { border-color: var(--gp-near); background: var(--gp-near); color: var(--gp-white); }

.x { margin: -2px 4px 4px; font-size: 14.5px; color: var(--gp-text-body, var(--gp-text)); }
.x__en { margin-top: 2px; color: var(--gp-text-muted); font-family: var(--gp-font-latin); font-size: 14px; }

.verdict { font-weight: 700; }
.verdict.is-right { color: var(--gp-correct); }
.verdict.is-wrong { color: var(--gp-near); }

.script { padding: 12px 16px; border-radius: var(--gp-radius-card); background: var(--gp-surface); border: 1px solid var(--gp-rule-soft); font-size: 15px; }
.script summary { cursor: pointer; font-weight: 700; font-family: var(--gp-font-text); }
.script p { margin-top: 6px; }

.after { margin-top: 24px; display: flex; flex-direction: column; gap: 12px; }
.btn {
  height: var(--gp-btn-h, 52px); border: 0; border-bottom: 4px solid var(--gp-blue-900); border-radius: var(--gp-radius-btn, 14px);
  background: var(--gp-label); color: var(--gp-white); font: 700 16px var(--gp-font-text); cursor: pointer;
}
.btn:active { transform: translateY(2px); border-bottom-width: 2px; }
.appcard {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; text-decoration: none; color: var(--gp-text);
  border: 1.5px dashed var(--gp-rule-strong, var(--gp-rule)); border-radius: var(--gp-radius-card);
}
.appcard img { flex: none; border-radius: 10px; }
.appcard span { font-size: 14px; color: var(--gp-text-2); }
.appcard b { display: block; color: var(--gp-label); font-size: 15px; }

/* the round: n / 20 across pages, a thin bar beside it */
.q__round { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.q__bar { flex: 1; height: 6px; border-radius: 3px; background: var(--gp-rule-soft); overflow: hidden; }
.q__bar i { display: block; height: 100%; width: 0; background: var(--gp-label); border-radius: 3px; transition: width .3s; }
.q__count { flex: none; font: 600 14px var(--gp-font-display); color: var(--gp-text-2); }
.gap.is-current:not(.is-filled) { background: var(--gp-select-tint); border-radius: 4px 4px 0 0; }


/* start page: three raised tiles, one per band */
.bands { margin-top: 28px; display: flex; flex-direction: column; gap: 12px; }
.band {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px; padding: 18px 20px;
  border: 1.5px solid var(--gp-rule-strong, var(--gp-rule)); border-bottom-width: 5px; border-radius: var(--gp-radius-opt, 16px);
  background: var(--gp-surface); color: var(--gp-text); text-decoration: none;
}
.band:hover { background: var(--gp-select-tint); }
.band:active { transform: translateY(3px); border-bottom-width: 2px; }
.band b { font: 700 22px var(--gp-font-display); }
.band span { color: var(--gp-text-muted); font-size: 14px; }

/* Under a single question (body.is-single, and what crawlers read): the full write-up, a way
   into a round, other questions of the band. In a round none of it shows. */
.is-round .single { display: none; }
.single { width: 100%; max-width: 720px; margin: 0 auto; padding: 0 16px; }
.single__in { display: flex; flex-direction: column; gap: 20px; }

.study { border-radius: var(--gp-radius-opt, 16px); background: var(--gp-surface); border: 1.5px solid var(--gp-rule-soft); }
.study > summary { padding: 14px 16px; cursor: pointer; font-weight: 700; color: var(--gp-label); }
.study[open] > summary { border-bottom: 1px solid var(--gp-rule-soft); }
.study section { padding: 16px; }
.study section + section { border-top: 1px solid var(--gp-rule-soft); }
.study h2 { font: 700 15px var(--gp-font-display); color: var(--gp-text-2); margin-bottom: 10px; }
.study__q + .study__q { margin-top: 16px; }
.study__ask { font-weight: 700; }
.study__ans { margin-top: 4px; color: var(--gp-correct); }
.study ul { margin: 8px 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 8px; font-size: 14.5px; }
.study li > span { display: block; color: var(--gp-text-2); }
.study li > .en { color: var(--gp-text-muted); font-family: var(--gp-font-latin); font-size: 14px; }
.study li.is-right > b { color: var(--gp-correct); }

.vocab { width: 100%; border-collapse: collapse; font-size: 14.5px; }
.vocab th { text-align: left; font: 600 11px var(--gp-font-display); letter-spacing: .04em; text-transform: uppercase; color: var(--gp-text-muted); padding: 0 8px 6px 0; }
.vocab td { padding: 8px 8px 8px 0; border-top: 1px solid var(--gp-rule-soft); vertical-align: top; }
.vocab .w { font-size: 18px; font-weight: 700; white-space: nowrap; }
.vocab .py { display: block; }
.vocab .zy, .vocab small { display: block; color: var(--gp-text-muted); font-size: 12.5px; }
.vocab .ex, .gram .ex { display: block; margin-top: 2px; color: var(--gp-text-2); font-size: 13.5px; }
.vocab .lv { font: 600 12px var(--gp-font-display); color: var(--gp-text-muted); }
.gram b { display: block; }

.start { padding: 20px; border-radius: var(--gp-radius-opt, 16px); background: var(--gp-select-tint); display: flex; flex-direction: column; gap: 8px; }
.start h2 { font: 700 18px var(--gp-font-display); }
.start p { color: var(--gp-text-2); margin-bottom: 6px; }
.start .btn { display: grid; place-items: center; text-decoration: none; }


.q--missing { text-align: center; padding-top: 72px; }
.q--missing .q__lede { margin: 8px auto 28px; }
.q--missing .btn { width: 100%; max-width: 360px; }

.q--done { text-align: center; padding-top: 56px; }
.done__eyebrow { font: 600 12px var(--gp-font-display); letter-spacing: .08em; text-transform: uppercase; color: var(--gp-brand); margin-bottom: 8px; }
.done__tally { display: flex; gap: 12px; justify-content: center; margin: 28px auto; max-width: 360px; }
.done__n { flex: 1; padding: 16px 8px; border-radius: var(--gp-radius-opt, 16px); display: flex; flex-direction: column; gap: 2px; font: 600 14px var(--gp-font-display); }
.done__n b { font-size: 44px; line-height: 1.1; }
.done__n.is-right { background: var(--gp-correct-tint); color: var(--gp-correct); }
.done__n.is-wrong { background: var(--gp-near-tint); color: var(--gp-near); }
.done__t { color: var(--gp-text-2); margin-bottom: 20px; }
.q--done .btn { display: grid; place-items: center; width: 100%; max-width: 360px; margin: 0 auto 12px; text-decoration: none; }
.btn--line { background: var(--gp-surface); color: var(--gp-label); border: 1.5px solid var(--gp-label); border-bottom-width: 4px; }

.qfoot { padding: 20px 16px 32px; text-align: center; font-size: 13px; color: var(--gp-text-muted); }

@media (min-width: 900px) {
  .q { max-width: 720px; padding-top: 40px; }
  .q__title { font-size: 26px; }
  /* Wide screens with a passage or picture: the material on the left (stays put while the
     questions scroll), questions on the right, like the computer-based test. */
  .q:has(.q__passage, .q__img) { max-width: 1160px; }
  .q__body:has(.q__passage, .q__img) { display: grid; grid-template-columns: 1fr 1fr; gap: 32px; align-items: start; }
  .q__body:has(.q__passage, .q__img) .q__stim { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; }
  .q:has(.q__passage, .q__img) .after { max-width: calc(50% - 16px); margin-left: auto; }
}
