/* SHARP design system: forged steel on graphite, with ember as the single accent. */
:root {
  --bg: #1150d8;
  --bg-2: #0a2c86;
  --surface: #0b2779;
  --surface-2: #1c4fd0;
  --line: #2f62e6;
  --line-strong: #7fa4ff;
  --text: #ffffff;
  --muted: #c9d8ff;
  --steel: #e6eeff;
  --ember: #ffd60a;
  --ember-deep: #c9a500;
  --ember-ink: #0a1c57;
  --green: #3ddc57;
  --green-deep: #1f9a36;
  --ok: #6df58a;
  --ok-bg: #0c5c2e;
  --bad: #ff8576;
  --bad-bg: #7d1c2b;
  --gold: #ffd60a;
  --navy: #0a1c57;
  --radius: 14px;
  --title: "Luckiest Guy", "Rubik", "Arial Black", system-ui, sans-serif;
  --display: "Rubik", "Arial Black", system-ui, sans-serif;
  --body: "Rubik", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --shadow: 0 10px 30px rgba(3, 12, 50, .45);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 400 17px/1.5 var(--body); min-height: 100dvh;
}
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.05; margin: 0 0 .4em; letter-spacing: .01em; text-transform: uppercase; }
h1 { font-size: clamp(2.4rem, 7vw, 4.4rem); }
h2 { font-size: clamp(1.6rem, 4vw, 2.2rem); }
h3 { font-size: 1.25rem; letter-spacing: .04em; }
p { margin: 0 0 1em; }
a { color: var(--ember); text-underline-offset: 3px; }
a:hover { color: #fff1a3; }
:focus-visible { outline: 3px solid var(--ember); outline-offset: 2px; border-radius: 6px; }
.muted { color: var(--muted); }
.small { font-size: .88rem; }
.center { text-align: center; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ember); color: var(--ember-ink); padding: 8px 14px; border-radius: 6px; z-index: 100; }
.skip:focus { left: 8px; }
.boot { padding: 48px 16px; text-align: center; color: var(--muted); }
[hidden] { display: none !important; }

/* ---- shell ---- */
.topbar { position: sticky; top: 0; z-index: 20; background: rgba(8, 28, 100, .96); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.topbar-in { max-width: 1120px; margin: 0 auto; padding: 10px 16px; display: flex; align-items: center; gap: 18px; }
.logo { display: inline-flex; align-items: center; gap: 8px; font: 700 1.7rem/1 var(--display); letter-spacing: .14em; color: var(--text); text-decoration: none; }
.logo svg { width: 26px; height: 26px; }
.logo:hover { color: var(--text); }
.nav { display: flex; gap: 4px; margin-left: 8px; }
.nav a, .tabbar a { color: var(--muted); text-decoration: none; font: 600 1.02rem var(--display); letter-spacing: .08em; text-transform: uppercase; padding: 8px 12px; border-radius: 8px; }
.nav a:hover { color: var(--text); background: var(--surface); }
.nav a[aria-current="page"], .tabbar a[aria-current="page"] { color: var(--ember); }
.topbar .spacer { flex: 1; }
.userchip { display: inline-flex; align-items: center; gap: 8px; color: var(--text); text-decoration: none; padding: 4px 10px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.userchip:hover { border-color: var(--line-strong); color: var(--text); }
.userchip b { font-weight: 600; max-width: 14ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.userchip .rating { color: var(--steel); font: 600 .95rem var(--display); letter-spacing: .05em; }
.tabbar { display: none; }
main { max-width: 1120px; margin: 0 auto; padding: 24px 16px 96px; }
main.narrow { max-width: 520px; }
main.mid { max-width: 820px; }
.footer { max-width: 1120px; margin: 0 auto; padding: 0 16px 110px; color: var(--muted); font-size: .85rem; display: flex; gap: 16px; flex-wrap: wrap; }
.footer a { color: var(--muted); }

.notice { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 8px 14px; font-size: .92rem; text-align: center; }
.notice-dev { background: #ffe98a; color: #3d2f00; border-bottom: 1px solid #ffd60a; }
.notice-net { background: var(--bad-bg); color: #ffe3de; border-bottom: 1px solid #ff8576; }
.notice-live { background: var(--ember); color: var(--ember-ink); font-weight: 600; }
.notice-live a { color: var(--ember-ink); }

@media (max-width: 760px) {
  .nav { display: none; }
  .tabbar { display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; background: rgba(8, 28, 100, .98); border-top: 1px solid var(--line); padding: 6px 6px calc(6px + env(safe-area-inset-bottom)); }
  .tabbar a { text-align: center; padding: 10px 2px; font-size: .78rem; letter-spacing: .04em; }
  .userchip b { display: none; }
}

/* ---- buttons, forms ---- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 20px;
  font: 700 1.1rem var(--display); letter-spacing: .08em; text-transform: uppercase; text-decoration: none; cursor: pointer;
  border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--text);
  transition: transform .08s ease, background .15s ease, border-color .15s ease;
}
.btn:hover { background: #2a61ea; color: var(--text); }
.btn:active { transform: translateY(1px); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--ember); border-color: var(--ember); color: var(--ember-ink); }
.btn-primary:hover { background: #ffe564; color: var(--ember-ink); }
.btn-ghost { background: transparent; }
.btn-danger { border-color: #ff8576; color: #ffd3cc; background: transparent; }
.btn-lg { min-height: 58px; font-size: 1.35rem; padding: 12px 28px; }
.btn-sm { min-height: 36px; font-size: .95rem; padding: 6px 12px; }
.btn-block { width: 100%; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.row-end { justify-content: flex-end; }
.stack > * + * { margin-top: 16px; }
.row-center { justify-content: center; }
.spacer { flex: 1; }
.grow { flex: 1; min-width: 180px; }
.section-sm { margin: 12px 0; }
.opt-row { margin-bottom: 8px; flex-wrap: nowrap; }
.opt-row input[type="radio"] { width: 22px; height: 22px; flex: none; accent-color: var(--ember); }
.option.static { cursor: default; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; min-width: 0; }
legend { padding: 0; }

.field { display: block; margin-bottom: 16px; }
.field > span { display: block; font-weight: 600; margin-bottom: 6px; }
.field small { display: block; color: var(--muted); margin-top: 4px; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; font: inherit; color: var(--text);
  background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: 8px;
}
textarea { min-height: 96px; resize: vertical; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--ember); outline-offset: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; }
.check input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--ember); }
.form-error { background: var(--bad-bg); border: 1px solid #ff8576; color: #ffe3de; padding: 10px 12px; border-radius: 8px; margin-bottom: 16px; }
.form-ok { background: var(--ok-bg); border: 1px solid #3ddc57; color: #dcffe6; padding: 10px 12px; border-radius: 8px; margin-bottom: 16px; }

/* ---- surfaces ---- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; }
.card-flat { background: var(--bg-2); }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.section { margin-top: 36px; }
.section > h2 { margin-bottom: 14px; }
.eyebrow { font: 600 .95rem var(--display); letter-spacing: .18em; text-transform: uppercase; color: var(--ember); margin-bottom: 8px; }
.empty { border: 1px dashed var(--line-strong); border-radius: var(--radius); padding: 24px; color: var(--muted); text-align: center; }
.pill { display: inline-block; padding: 2px 10px; border-radius: 999px; font: 600 .82rem var(--display); letter-spacing: .08em; text-transform: uppercase; border: 1px solid var(--line-strong); color: var(--steel); white-space: nowrap; }
.pill-ok { border-color: #3ddc57; color: var(--ok); background: var(--ok-bg); }
.pill-bad { border-color: #ff8576; color: #ffd3cc; background: var(--bad-bg); }
.pill-warn { border-color: #ffd60a; color: #3d2f00; background: #ffe98a; }
.pill-ember { border-color: var(--ember-deep); color: var(--ember); }
.stat { display: flex; flex-direction: column; }
.stat b { font: 700 2.2rem/1 var(--display); letter-spacing: .02em; }
.stat span { color: var(--muted); font-size: .9rem; }
.stats { display: flex; gap: 28px; flex-wrap: wrap; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); vertical-align: top; }
th { font: 600 .88rem var(--display); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); background: var(--bg-2); white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tr.me td { background: rgba(255, 214, 10, .16); }

.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-2); border: 1px solid var(--line-strong); display: inline-grid; place-items: center; flex: none; color: var(--steel); }
.avatar svg { width: 60%; height: 60%; }
.avatar-lg { width: 72px; height: 72px; }
.avatar-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 10px; }
.avatar-pick label { cursor: pointer; display: grid; place-items: center; padding: 8px; border-radius: 10px; border: 2px solid transparent; }
.avatar-pick input { position: absolute; opacity: 0; }
.avatar-pick input:checked + .avatar { border-color: var(--ember); color: var(--ember); }
.avatar-pick input:focus-visible + .avatar { outline: 3px solid var(--ember); outline-offset: 2px; }
.who { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
a.who:hover b { text-decoration: underline; }

.bar { height: 10px; border-radius: 999px; background: var(--bg-2); border: 1px solid var(--line); overflow: hidden; }
.bar > i { display: block; height: 100%; width: 0; background: var(--steel); border-radius: 999px; transition: width .25s ease; }
.bar-ember > i { background: var(--ember); }

.tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--line); margin-bottom: 20px; }
.tabs a { padding: 10px 14px; color: var(--muted); text-decoration: none; font: 600 1rem var(--display); letter-spacing: .08em; text-transform: uppercase; border-bottom: 3px solid transparent; }
.tabs a[aria-current="page"] { color: var(--text); border-bottom-color: var(--ember); }

.toast { position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); background: var(--surface-2); border: 1px solid var(--line-strong); padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); z-index: 50; max-width: calc(100vw - 32px); }

/* ---- home ---- */
.hero { display: grid; grid-template-columns: 1.15fr .85fr; gap: 24px; align-items: center; padding: 28px 0 8px; }
.hero p.lead { font-size: 1.2rem; color: var(--steel); max-width: 44ch; }
.hero-art { display: flex; justify-content: center; align-items: flex-end; gap: 0; min-height: 220px; }
.verse { border-left: 3px solid var(--ember); padding: 4px 0 4px 14px; color: var(--steel); font-style: italic; max-width: 46ch; }
.verse cite { display: block; font-style: normal; color: var(--muted); font-size: .88rem; margin-top: 4px; }
.play-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.play-card { display: flex; flex-direction: column; gap: 10px; }
.play-card .btn { margin-top: auto; }
.steps { counter-reset: step; display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); padding: 0; margin: 0; list-style: none; }
.steps li { counter-increment: step; border-top: 2px solid var(--line-strong); padding-top: 12px; }
.steps li::before { content: counter(step, decimal-leading-zero); font: 700 1.6rem var(--display); color: var(--ember); display: block; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } .hero-art { min-height: 150px; order: -1; } }

/* ---- scope picker ---- */
.books { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.chip { min-height: 44px; padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.chip:hover:not([disabled]) { border-color: var(--steel); }
.chip[aria-pressed="true"] { border-color: var(--ember); background: rgba(255, 214, 10, .2); }
.chip[disabled] { opacity: .4; cursor: not-allowed; }
.chapters { display: grid; grid-template-columns: repeat(auto-fill, minmax(52px, 1fr)); gap: 8px; }
.chapters .chip { text-align: center; padding: 8px 4px; font-variant-numeric: tabular-nums; }
details.more { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; }
details.more summary { cursor: pointer; color: var(--muted); }
details.more ul { columns: 3 140px; padding-left: 18px; color: var(--muted); margin: 12px 0 0; }

/* ---- game ---- */
.game { max-width: 760px; margin: 0 auto; }
.game-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.game-head .scope { font: 700 1.3rem var(--display); letter-spacing: .08em; text-transform: uppercase; }
.clock { font: 700 1.5rem var(--display); font-variant-numeric: tabular-nums; color: var(--steel); min-width: 4ch; text-align: right; }
.pips { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin-bottom: 16px; }
.pips i { height: 8px; border-radius: 4px; background: var(--surface-2); border: 1px solid var(--line); }
.pips i.done { background: var(--steel); border-color: var(--steel); }
.pips i.ok { background: var(--ok); border-color: var(--ok); }
.pips i.bad { background: var(--bad); border-color: var(--bad); }
.pips i.now { border-color: var(--ember); background: rgba(255, 214, 10, .55); }
.qcard { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.qnum { font: 600 .95rem var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.qtext { font-size: clamp(1.25rem, 3.6vw, 1.6rem); line-height: 1.3; font-weight: 500; margin: 6px 0 18px; }
.options { display: grid; gap: 10px; }
.option {
  display: grid; grid-template-columns: 40px 1fr; gap: 12px; align-items: center; width: 100%; min-height: 60px; padding: 10px 14px;
  text-align: left; font: 500 1.08rem/1.3 var(--body); color: var(--text); cursor: pointer;
  background: var(--bg-2); border: 2px solid var(--line-strong); border-radius: 10px;
}
.option .key { width: 36px; height: 36px; border-radius: 8px; display: grid; place-items: center; font: 700 1.1rem var(--display); background: var(--surface-2); color: var(--steel); }
.option:hover:not([disabled]) { border-color: var(--steel); }
.option[aria-checked="true"] { border-color: var(--ember); background: rgba(255, 214, 10, .2); }
.option[aria-checked="true"] .key { background: var(--ember); color: var(--ember-ink); }
.option[disabled] { cursor: default; }
.option.is-correct { border-color: var(--ok); background: var(--ok-bg); }
.option.is-correct .key { background: var(--ok); color: #04260f; }
.option.is-wrong { border-color: var(--bad); background: var(--bad-bg); }
.option.is-wrong .key { background: var(--bad); color: #3b0a0a; }
.option .mark { grid-column: 2; font-size: .88rem; color: var(--muted); }
.game-actions { display: flex; gap: 12px; align-items: center; justify-content: space-between; margin-top: 16px; min-height: 58px; }
.hint { color: var(--muted); font-size: .9rem; }
.slot { min-height: 52px; margin-bottom: 12px; display: flex; align-items: center; }
.warn { width: 100%; background: var(--bad-bg); border: 1px solid #ff8576; color: #ffe9e5; border-radius: 10px; padding: 10px 14px; font-weight: 600; display: flex; justify-content: space-between; gap: 12px; }
.warn b { font: 700 1.3rem var(--display); font-variant-numeric: tabular-nums; }
.feedback { font-weight: 600; }
.feedback.ok { color: var(--ok); }
.feedback.bad { color: #ffd3cc; }

.versus { display: grid; grid-template-columns: 1fr auto 1fr; gap: 12px; align-items: center; margin-bottom: 14px; }
.side { display: grid; grid-template-columns: auto 1fr; gap: 10px; align-items: center; min-width: 0; }
.side.right { grid-template-columns: 1fr auto; text-align: right; }
.side .meta { min-width: 0; }
.side .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.side .sub { font-size: .85rem; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.side.right .sub { justify-content: flex-end; }
.side .bar { margin-top: 6px; }
.vs { font: 700 1.2rem var(--display); color: var(--muted); letter-spacing: .1em; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--ok); display: inline-block; }
.dot.off { background: var(--bad); }

.prep { text-align: center; padding: 20px 0; }
.prep .scope-big { font: 700 clamp(2.4rem, 9vw, 4rem)/1 var(--display); text-transform: uppercase; letter-spacing: .03em; margin: 6px 0 4px; }
.prep .count { font: 700 5rem/1 var(--display); color: var(--ember); font-variant-numeric: tabular-nums; min-height: 5rem; }
.duel { display: flex; justify-content: center; align-items: flex-end; }

.result { text-align: center; padding: 8px 0 20px; }
.result h1 { margin-bottom: 4px; }
.result.win h1 { color: var(--ember); }
.result.loss h1 { color: var(--steel); }
.delta { font: 700 1.6rem var(--display); }
.delta.up { color: var(--ok); }
.delta.down { color: #ffd3cc; }
.scoreline { display: grid; grid-template-columns: 1fr auto 1fr; gap: 16px; align-items: center; margin: 18px auto; max-width: 520px; }
.scoreline .n { font: 700 3.4rem/1 var(--display); }
.scoreline .t { color: var(--muted); font-variant-numeric: tabular-nums; }
.badge { display: flex; gap: 12px; align-items: center; padding: 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg-2); }
.badge .medal { width: 44px; height: 44px; flex: none; border-radius: 50%; display: grid; place-items: center; background: #0a1c57; border: 2px solid var(--gold); color: var(--gold); }
.badge .medal svg { width: 24px; height: 24px; }
.badge.locked { opacity: .5; }
.badge.locked .medal { background: var(--surface-2); border-color: var(--line-strong); color: var(--muted); }
.badge.new { border-color: var(--gold); animation: badge-in .6s ease both; }
.review { display: grid; gap: 14px; }
.review-item { border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; background: var(--surface); }
.review-item h3 { text-transform: none; font-family: var(--body); font-weight: 600; font-size: 1.08rem; letter-spacing: 0; line-height: 1.35; }
.review-item .options { margin: 10px 0; }
.review-item .option { min-height: 44px; padding: 6px 10px; font-size: 1rem; }
.review-item .option .key { width: 28px; height: 28px; font-size: .95rem; }
.explain { border-left: 3px solid var(--line-strong); padding-left: 12px; color: var(--steel); }
.refs { font-weight: 600; color: var(--text); }

/* ---- smith characters ---- */
.smith { width: 132px; height: 132px; flex: none; display: block; }
.smith-sm { width: 64px; height: 64px; }
.flip { transform: scaleX(-1); }
.smith .arm, .smith .head, .smith .sparks, .smith .glint { transform-box: view-box; }
.smith .arm { transform-origin: 44px 60px; }
.smith .sparks, .smith .glint { opacity: 0; }
.smith[data-mood="idle"] .arm { animation: stroke 2.4s ease-in-out infinite; }
.smith[data-mood="work"] .arm { animation: stroke .7s ease-in-out infinite; }
.smith[data-mood="work"] .sparks { animation: sparks .7s linear infinite; }
.smith[data-mood="strike"] .arm { animation: stroke .45s ease-in-out 1; }
.smith[data-mood="strike"] .sparks, .smith[data-mood="hit"] .sparks { animation: sparks .5s ease-out 1; }
.smith[data-mood="hit"] .arm { animation: stroke .4s ease-in-out 2; }
.smith[data-mood="miss"] .arm { animation: dull .5s ease-in-out 1; }
.smith[data-mood="win"] .arm { transform: rotate(-58deg); transition: transform .5s cubic-bezier(.2, 1.4, .4, 1); }
.smith[data-mood="win"] .glint { animation: glint 1.6s ease-in-out infinite; }
.smith[data-mood="lose"] .arm { transform: rotate(16deg) translateY(4px); transition: transform .6s ease; }
.smith[data-mood="lose"] .head { transform: translateY(4px); transition: transform .6s ease; }
@keyframes stroke { 0%, 100% { transform: translateX(0); } 50% { transform: translateX(-9px); } }
@keyframes dull { 0%, 100% { transform: translateX(0) rotate(0); } 30% { transform: translateX(-5px) rotate(3deg); } 60% { transform: translateX(2px) rotate(-2deg); } }
@keyframes sparks { 0% { opacity: 0; transform: translate(0, 0) scale(.6); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(5px, -7px) scale(1.25); } }
@keyframes glint { 0%, 100% { opacity: .15; } 50% { opacity: 1; } }
@keyframes badge-in { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ---- reduced motion: system setting or the in-app switch ---- */
html[data-motion="reduced"] *, html[data-motion="reduced"] *::before, html[data-motion="reduced"] *::after {
  animation: none !important; transition: none !important; scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}

/* ---- admin ---- */
.filters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; align-items: end; }
.filters .field { margin: 0; }
.qrow-prompt { max-width: 46ch; }
.qrow-prompt a { color: var(--text); text-decoration: none; }
.qrow-prompt a:hover { text-decoration: underline; }
.split { display: grid; grid-template-columns: 1.2fr .8fr; gap: 20px; align-items: start; }
@media (max-width: 900px) { .split { grid-template-columns: 1fr; } }
.cov-ch { display: flex; flex-wrap: wrap; gap: 6px; }
pre.code { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 12px; overflow-x: auto; font-size: .85rem; white-space: pre-wrap; word-break: break-word; }
.history { list-style: none; padding: 0; margin: 0; }
.history li { padding: 8px 0; border-bottom: 1px solid var(--line); font-size: .92rem; }

@media (max-width: 520px) {
  body { font-size: 16px; }
  main { padding: 16px 12px 96px; }
  .qcard { padding: 16px; }
  .card { padding: 16px; }
  .smith { width: 104px; height: 104px; }
  .smith-sm { width: 48px; height: 48px; }
  .versus { gap: 6px; }
  .scoreline .n { font-size: 2.6rem; }
  .game-actions { flex-direction: column-reverse; align-items: stretch; }
  .game-actions .btn { width: 100%; }
}

/* ================= Key-art theme: sky blue, grass green, sun yellow ================= */
body { background: linear-gradient(180deg, #1a66ea 0, #1150d8 340px, #0c3cb4 100%) fixed; font-weight: 400; }
h1, h2, h3 { font-family: var(--display); font-weight: 900; letter-spacing: .01em; }
h3 { font-weight: 800; }
.title { font-family: var(--title); font-weight: 400; letter-spacing: .02em; line-height: .9; text-shadow: 0 5px 0 var(--navy); }
/* Wonky cartoon lettering: each letter sits at its own height, tilt and size. */
.wonk { display: inline-flex; align-items: baseline; }
.wonk b { display: inline-block; font-weight: 400; }
.eyebrow { font-weight: 800; }
.logo { font: 400 1.9rem/1 var(--title); letter-spacing: .06em; text-shadow: 0 3px 0 var(--navy); }
.topbar { border-bottom: 3px solid var(--navy); }
.nav a, .tabbar a, .tabs a { font-weight: 800; color: #dbe6ff; }
.nav a:hover { background: rgba(255, 255, 255, .12); color: #fff; }
.tabbar { border-top: 3px solid var(--navy); }
.card, .qcard, .review-item, .table-wrap { border: 2px solid var(--line); box-shadow: 0 6px 0 rgba(4, 16, 60, .45); }
.card-flat { background: var(--bg-2); }
th { background: var(--bg-2); color: var(--muted); font-weight: 700; }
.btn { font-weight: 800; border: 2px solid var(--navy); background: #fff; color: var(--navy); border-radius: 12px; box-shadow: 0 5px 0 var(--navy); }
.btn:hover { background: #e8efff; color: var(--navy); }
.btn:active { transform: translateY(4px); box-shadow: 0 1px 0 var(--navy); }
.btn-primary { background: var(--ember); border-color: var(--navy); color: var(--navy); }
.btn-primary:hover { background: #ffe564; color: var(--navy); }
.btn-green { background: var(--green); color: var(--navy); }
.btn-green:hover { background: #63ea78; }
.btn-ghost { background: rgba(255, 255, 255, .1); color: #fff; border-color: rgba(255, 255, 255, .55); box-shadow: none; }
.btn-ghost:hover { background: rgba(255, 255, 255, .2); color: #fff; }
.btn-danger { background: var(--bad-bg); color: #fff; border-color: var(--bad); box-shadow: none; }
.btn-sm { box-shadow: 0 3px 0 var(--navy); }
.btn-ghost.btn-sm, .btn-danger.btn-sm { box-shadow: none; }
.pill { font-weight: 800; background: rgba(255, 255, 255, .1); }
.pill-warn { background: #ffe98a; }
.notice-dev { font-weight: 500; border-bottom: 3px solid var(--navy); }
.notice-live { border-bottom: 3px solid var(--navy); }
.userchip { background: #fff; color: var(--navy); border: 2px solid var(--navy); }
.userchip:hover { color: var(--navy); border-color: var(--navy); background: #e8efff; }
.userchip .rating { color: #1150d8; font-weight: 800; }
.avatar { background: var(--ember); color: var(--navy); border: 2px solid var(--navy); }
.avatar-pick .avatar { background: var(--surface-2); color: #fff; border-color: var(--line-strong); }
.avatar-pick input:checked + .avatar { background: var(--ember); color: var(--navy); border-color: #fff; }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], select, textarea { background: #fff; color: var(--navy); border: 2px solid var(--navy); }
select option { color: var(--navy); }
.stat b { font-weight: 900; color: var(--ember); }
.bar { height: 12px; background: var(--bg-2); border: 2px solid var(--navy); }
.bar > i { background: var(--green); }
.bar-ember > i { background: var(--ember); }
.chip { background: #fff; color: var(--navy); border: 2px solid var(--navy); font-weight: 600; box-shadow: 0 3px 0 var(--navy); }
.chip[aria-pressed="true"] { background: var(--ember); border-color: var(--navy); }
.chip[disabled] { box-shadow: none; opacity: .38; }
.steps li { border-top: 4px solid var(--green); }
.steps li::before { font-weight: 900; color: var(--ember); }
.verse { border-left: 5px solid var(--ember); font-size: 1.15rem; color: #fff; }

/* hero key art */
.hero { position: relative; display: block; padding: 0; min-height: 540px; border-radius: 22px; overflow: hidden; border: 3px solid var(--navy); box-shadow: 0 8px 0 rgba(4, 16, 60, .5); background: #3fb6ff; }
.hero-art { position: absolute; inset: 0; min-height: 0; display: block; }
.scene { width: 100%; height: 100%; display: block; }
.hero-copy { position: relative; min-height: 540px; max-width: 600px; padding: 36px; display: flex; flex-direction: column; justify-content: flex-end; background: linear-gradient(90deg, rgba(6, 22, 84, .88) 0, rgba(6, 22, 84, .62) 62%, rgba(6, 22, 84, 0) 100%); }
.hero-copy .title { font-size: clamp(4.6rem, 13vw, 9rem); margin: 0 0 6px; }
.hero-copy .tag { font: 900 clamp(1.5rem, 3.6vw, 2.2rem)/1.05 var(--display); text-transform: uppercase; color: var(--ember); margin-bottom: 12px; text-shadow: 0 3px 0 var(--navy); }
.hero p.lead { color: #fff; font-size: 1.15rem; }
@media (max-width: 760px) {
  .hero { min-height: 0; }
  .hero-art { position: relative; height: 250px; order: 0; }
  .hero-copy { min-height: 0; max-width: none; padding: 20px; background: #0a2470; }
}

/* game */
.game-head .scope, .prep .scope-big { font-weight: 900; }
.clock { font-weight: 900; color: #fff; }
.clock.center { text-align: center; }
.qcard { background: #fff; color: var(--navy); border: 3px solid var(--navy); box-shadow: 0 7px 0 var(--navy); }
.qcard .qnum { color: #1150d8; font-weight: 800; }
.qtext { font-weight: 600; }
.qtext:focus { outline: none; }
.option { background: #eef4ff; color: var(--navy); border: 2px solid var(--navy); box-shadow: 0 4px 0 var(--navy); font-weight: 600; }
.option .key { background: #1150d8; color: #fff; font-weight: 900; }
.option:hover:not([disabled]) { background: #dbe8ff; border-color: var(--navy); }
.option[aria-checked="true"] { background: var(--ember); border-color: var(--navy); }
.option[aria-checked="true"] .key { background: var(--navy); color: var(--ember); }
.option.is-correct { background: #baf5c6; border-color: #0c7a32; }
.option.is-correct .key { background: #0c7a32; color: #fff; }
.option.is-wrong { background: #ffd0c9; border-color: #b3261e; }
.option.is-wrong .key { background: #b3261e; color: #fff; }
.option .mark { color: #33407a; font-weight: 700; }
.option.static { box-shadow: none; }
.qcard .muted, .qcard .explain { color: #33407a; }
.qcard .refs { color: var(--navy); }
.review-item .explain { border-left-color: var(--green); color: #fff; }
.pips i { height: 10px; border: 2px solid var(--navy); background: var(--bg-2); }
.pips i.done { background: #9fc0ff; border-color: var(--navy); }
.pips i.ok { background: var(--green); border-color: var(--navy); }
.pips i.bad { background: #ff6b5a; border-color: var(--navy); }
.pips i.now { background: var(--ember); border-color: var(--navy); }
.prep .count { font-weight: 900; text-shadow: 0 5px 0 var(--navy); }
.vs { font-weight: 900; color: var(--ember); }
.result h1 { font-family: var(--title); font-weight: 400; font-size: clamp(3.4rem, 12vw, 6.5rem); text-shadow: 0 5px 0 var(--navy); }
.result.win h1 { color: var(--ember); }
.result.loss h1 { color: #dbe6ff; }
.delta, .scoreline .n { font-weight: 900; }
.delta.up { color: var(--ok); }
.badge { background: var(--bg-2); border: 2px solid var(--line); }
.badge .medal { background: var(--ember); border-color: var(--navy); color: var(--navy); }
.badge.locked .medal { background: var(--surface-2); color: var(--muted); border-color: var(--line-strong); }
.warn { border-width: 2px; }
.toast { background: var(--navy); border: 2px solid #fff; color: #fff; }

/* figures */
.smith { width: 150px; height: 170px; overflow: visible; }
.smith-sm { width: 62px; height: 72px; }
.smith .arm, .smith .head, .smith .sparks, .smith .glint, .smith .swordarm { transform-box: view-box; }
.smith .swordarm { transform-origin: 73px 77px; }
.smith[data-mood="win"] .arm, .smith[data-mood="lose"] .arm { transform: none; transition: none; }
.smith[data-mood="win"] .swordarm { transform: rotate(-30deg); transition: transform .5s cubic-bezier(.2, 1.4, .4, 1); }
.smith[data-mood="lose"] .swordarm { transform: rotate(48deg); transition: transform .6s ease; }
@keyframes stroke { 0%, 100% { transform: translate(0, 0); } 50% { transform: translate(15px, -19px); } }
@keyframes dull { 0%, 100% { transform: translate(0, 0); } 30% { transform: translate(-4px, 5px); } 60% { transform: translate(3px, -3px); } }
@keyframes sparks { 0% { opacity: 0; transform: translate(0, 0); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(9px, -11px); } }
@media (max-width: 520px) { .smith { width: 112px; height: 128px; } .smith-sm { width: 44px; height: 52px; } }

/* small screens: keep the match header on one line and give the question the full screen */
.game-head > div:first-child { min-width: 0; }
.clock { flex: none; }
@media (max-width: 520px) {
  .side .sub { font-size: .74rem; gap: 4px; white-space: nowrap; }
  .side .name .muted { display: none; }
  .slot { min-height: 46px; margin-bottom: 8px; }
}
@media (max-width: 760px) {
  body:has(#stage .qcard) .tabbar, body:has(.pips) .tabbar { display: none; }
  body:has(#stage .qcard) main, body:has(.pips) main { padding-bottom: 24px; }
  body:has(#stage .qcard) .footer, body:has(.pips) .footer { display: none; }
}

/* victory and defeat poses use only translation, so they behave the same at every size */
.smith[data-mood="win"] .swordarm { transform: translate(0, -12px); transition: transform .4s cubic-bezier(.2, 1.6, .4, 1); }
.smith[data-mood="win"] .arm { transform: translate(0, -12px); transition: transform .4s cubic-bezier(.2, 1.6, .4, 1); }
.smith[data-mood="win"] { animation: cheer 1.1s ease-in-out infinite; }
.smith[data-mood="win"] .sparks { animation: sparks 1.1s linear infinite; }
.smith[data-mood="lose"] .swordarm, .smith[data-mood="lose"] .arm { transform: translate(0, 9px); transition: transform .6s ease; }
.smith[data-mood="lose"] .head { transform: translate(0, 6px); }
.smith[data-mood="lose"] { filter: saturate(.45) brightness(.9); }
.flip[data-mood="win"] { animation-name: cheer-flip; }
@keyframes cheer { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-9px); } }
@keyframes cheer-flip { 0%, 100% { transform: scaleX(-1) translateY(0); } 50% { transform: scaleX(-1) translateY(-9px); } }
.scoreline .who { flex-wrap: wrap; justify-content: center; }

/* ---- rating tiers ---- */
.tier { display: inline-block; padding: 3px 11px; border-radius: 999px; border: 2px solid var(--navy); font: 800 .78rem var(--display); letter-spacing: .08em; text-transform: uppercase; color: var(--navy); white-space: nowrap; vertical-align: middle; }
.tier i { font-style: normal; font-weight: 600; opacity: .75; letter-spacing: 0; }
.tier-bronze { background: #e0984e; }
.tier-iron { background: #9fb0c4; }
.tier-steel { background: #7fd0ff; }
.tier-silver { background: #f1f6fa; }
.tier-gold { background: #ffd60a; }
.tier-double-edged { background: linear-gradient(100deg, #ffd60a, #3ddc57); }
.stat .tier { margin-top: 6px; }
.tier-ladder { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 18px; }

/* ---- win streak ---- */
.streak { display: inline-block; padding: 3px 11px; border-radius: 999px; border: 2px solid var(--navy); background: #ff7a1a; color: #fff; font: 800 .78rem var(--display); letter-spacing: .06em; text-transform: uppercase; white-space: nowrap; vertical-align: middle; }
.stat .streak { margin-top: 6px; }
.on-streak { color: var(--gold); text-shadow: 0 2px 0 var(--navy); animation: streak-pop .5s ease both; }
@keyframes streak-pop { 0% { transform: scale(.8); } 60% { transform: scale(1.12); } 100% { transform: scale(1); } }

/* ---- Bible reader ---- */
.scripture { max-width: 68ch; font-size: 1.12rem; line-height: 1.75; margin: 16px 0; }
.scripture p { margin: 0 0 .7em; }
.scripture sup { color: var(--gold); font-weight: 800; font-size: .7em; margin-right: 2px; }
.reader-nav { flex-wrap: wrap; gap: 10px; }

/* ---- friend challenge ---- */
.challenge-link { width: 100%; padding: 12px 14px; border-radius: 12px; border: 2px solid var(--navy); background: #fff; color: #0a1c57; font: 700 1rem var(--body); text-align: center; }
.row-center { justify-content: center; }
ul.left { text-align: left; }

/* ---- friends ---- */
.friend-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.friend-row { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: 14px; background: rgba(255, 255, 255, .08); border: 2px solid var(--navy); }
.friend-who { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
.friend-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.btn-sm { padding: 6px 12px; font-size: .85rem; }
.online { color: #7dee5e; font-weight: 700; font-size: .85rem; white-space: nowrap; }

.count { display: inline-block; min-width: 1.4em; padding: 0 .35em; border-radius: 999px; background: #ff3b30; color: #fff; font: 800 .72em var(--body); letter-spacing: 0; text-align: center; vertical-align: middle; }
.notice-friend { background: #3ddc57; color: #062a10; font-weight: 600; border-bottom: 3px solid var(--navy); }
.notice-friend a { color: #062a10; }
.friend-ctl { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 8px; }

/* ---- challenge popup and online count ---- */
.invite-modal { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; padding: 16px; background: rgba(4, 16, 60, .72); }
.invite-card { width: min(420px, 100%); background: #1150d8; border: 3px solid var(--navy); border-radius: 22px; padding: 22px 20px; text-align: center; box-shadow: 0 10px 0 var(--navy); animation: badge-in .35s ease both; }
.invite-card h2 { margin: 6px 0; }
.online-now { margin: 14px 0 0; font-weight: 800; color: #dbe6ff; }
.online-now .dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: #3ddc57; margin-right: 6px; box-shadow: 0 0 0 3px rgba(61, 220, 87, .25); }
