/* Parchment boards on an open-sea background: every block is a paper panel with a double frame and corner rivets.
   Brown ink, red accent, one centered column. The background is our own wave pattern — no franchise art. */
:root {
  --sea-1: #9fd0e6; --sea-2: #d7eef6;
  --paper-bg: #faf9f3; --paper-raise: #fffdf7; --frame: #eadfc2; --ink: #534e41; --ink-strong: #3b372d; --muted: #6f6651;
  --line: #ac9f7e; --line-soft: #ddd3b6;
  --accent: #c8452c; --accent-ink: #ffffff; --flame: #e8590c;
  --red: #b83224; --ok: #2f7d32; --okbg: #dcefd3; --badbg: #f8dcd4;
  --paper: #e8d6ad; --paper-edge: #c9b07a; --poster-ink: #3a2816;
  --ui: "Ubuntu", system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: var(--ui);
  --card-font: Georgia, serif;
  --r: 8px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; color: var(--ink); font: 400 17px/1.55 var(--ui); min-height: 100dvh;
  background-color: var(--sea-2);
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='40' viewBox='0 0 120 40'%3E%3Cpath d='M0 20 Q15 10 30 20 T60 20 T90 20 T120 20' fill='none' stroke='%23ffffff' stroke-opacity='.45' stroke-width='2'/%3E%3C/svg%3E"),
    linear-gradient(180deg, var(--sea-1) 0%, var(--sea-2) 520px);
  background-repeat: repeat, no-repeat;
  background-attachment: scroll;
}
body.playing { overflow: hidden; }
a { color: inherit; text-underline-offset: 3px; }
button { font: inherit; color: inherit; touch-action: manipulation; }
:is(button, a, input, select, textarea, summary):focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.ico { width: 1.15em; height: 1.15em; flex: none; }

/* Paper panel: brown line, light outer frame, rivets in the corners */
.paper, .qcard, .sect, .sheet-in, .play-card {
  position: relative; background: var(--paper-bg); color: var(--ink);
  border: 2px solid var(--ink); border-radius: 10px;
  box-shadow: 0 0 0 5px var(--frame), 0 0 0 7px rgba(83, 78, 65, .55), 0 10px 24px rgba(30, 60, 80, .18);
}
.paper::before, .qcard::before, .sect::before, .play-card::before {
  content: ""; position: absolute; inset: -9px; pointer-events: none;
  background:
    radial-gradient(circle, var(--ink) 0 3px, var(--frame) 3.5px 5px, transparent 5.5px) top left / 14px 14px no-repeat,
    radial-gradient(circle, var(--ink) 0 3px, var(--frame) 3.5px 5px, transparent 5.5px) top right / 14px 14px no-repeat,
    radial-gradient(circle, var(--ink) 0 3px, var(--frame) 3.5px 5px, transparent 5.5px) bottom left / 14px 14px no-repeat,
    radial-gradient(circle, var(--ink) 0 3px, var(--frame) 3.5px 5px, transparent 5.5px) bottom right / 14px 14px no-repeat;
}

/* Top */
.top { padding-top: env(safe-area-inset-top); }
.top-in { max-width: 560px; margin: 0 auto; padding: 0 16px; height: 56px; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.brand {
  font: 400 19px/1 var(--display); text-decoration: none; color: var(--paper-raise); letter-spacing: .02em;
  text-shadow: 0 2px 0 var(--ink), 0 -1px 0 var(--ink), 1px 0 0 var(--ink), -1px 0 0 var(--ink);
}
.top-link { font-size: 15px; font-weight: 500; color: var(--ink-strong); }
.streak-pill {
  display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border-radius: 999px;
  background: var(--paper-bg); border: 2px solid var(--ink); color: var(--ink-strong); font-weight: 700; font-variant-numeric: tabular-nums;
}
.streak-pill .ico { color: var(--muted); }
.streak-pill.on .ico { color: var(--flame); }

/* Hero */
.band { padding: 4px 16px 8px; }
.band-in { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 10px; text-align: center; }
h1 {
  font: 400 clamp(30px, 8.6vw, 44px)/1.08 var(--display); margin: 8px 0 0; color: var(--paper-raise); letter-spacing: .01em; text-wrap: balance;
  text-shadow: 0 3px 0 var(--ink), 0 -2px 0 var(--ink), 2px 0 0 var(--ink), -2px 0 0 var(--ink), 2px 2px 0 var(--ink), -2px 2px 0 var(--ink), 2px -2px 0 var(--ink), -2px -2px 0 var(--ink);
}
.lead { margin: 0 auto; color: var(--ink-strong); max-width: 46ch; font-size: 16px; }
.crumbs { font-size: 14px; color: var(--ink-strong); margin-top: 6px; }
.band-cta { display: flex; justify-content: center; align-items: center; gap: 14px; flex-wrap: wrap; margin-top: 6px; }
.band .muted { color: var(--ink-strong); }

/* Daily card */
.qcard { padding: 18px; display: flex; flex-direction: column; gap: 14px; margin: 18px 8px 10px; text-align: left; }
.qcard-head { display: flex; flex-direction: column; align-items: center; gap: 2px; text-align: center; padding-bottom: 12px; border-bottom: 2px dashed var(--line-soft); }
.kicker { font-weight: 700; font-size: 18px; text-transform: uppercase; letter-spacing: .02em; color: var(--ink-strong); }
.qcard .muted { color: var(--muted); }
.daily-q { display: flex; flex-direction: column; gap: 14px; }

.skeleton { display: flex; flex-direction: column; gap: 10px; }
.skeleton span { height: 52px; border-radius: var(--r); background: var(--line-soft); opacity: .7; animation: pulse 1.2s ease-in-out infinite alternate; }
.skeleton span:first-child { height: 26px; width: 80%; }
@keyframes pulse { to { opacity: .3; } }

/* Question + options */
.q { font-size: clamp(19px, 5vw, 22px); font-weight: 700; line-height: 1.3; margin: 0; color: var(--ink-strong); text-wrap: pretty; text-align: center; }
.opts { display: grid; gap: 10px; }
.opt {
  text-align: left; background: var(--paper-raise); border: 2px solid var(--line); border-radius: var(--r);
  min-height: 54px; padding: 11px 12px; cursor: pointer; display: flex; gap: 12px; align-items: center; line-height: 1.35; color: var(--ink-strong);
  transition: border-color .12s, background-color .12s, transform .08s;
}
.opt-l { flex: none; width: 28px; height: 28px; border-radius: 6px; display: grid; place-items: center; font: 700 14px var(--ui); background: var(--frame); color: var(--ink); }
.opt-t { flex: 1; }
.opt .ico { display: none; }
@media (hover: hover) { .opt:hover:not(:disabled) { border-color: var(--ink); background: #fff; } }
.opt:active:not(:disabled) { transform: scale(.985); }
.opt:disabled { cursor: default; }
.opt.pending { border-color: var(--ink); }
.opt.dim { opacity: .55; }
.opt.ok { background: var(--okbg); border-color: var(--ok); opacity: 1; }
.opt.ok .opt-l { background: var(--ok); color: #fff; }
.opt.bad { background: var(--badbg); border-color: var(--red); opacity: 1; }
.opt.bad .opt-l { background: var(--red); color: #fff; }
.opt.ok .ico-ok, .opt.bad .ico-bad { display: block; }
.opt.ok .ico { color: var(--ok); }
.opt.bad .ico { color: var(--red); }

.verdict { display: flex; align-items: center; gap: 8px; font-weight: 700; margin: 0; text-transform: uppercase; letter-spacing: .02em; }
.verdict.ok { color: var(--ok); }
.verdict.bad { color: var(--red); }
.note { margin: 0; color: var(--ink); }
.note b { color: var(--ink-strong); }
.src { margin: 0; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.after { display: flex; flex-direction: column; gap: 10px; }
.after:empty { display: none; }
.daily-done { display: flex; flex-direction: column; gap: 12px; border-top: 2px dashed var(--line-soft); padding-top: 14px; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; }
.stat b { display: block; font: 700 26px/1.1 var(--ui); color: var(--accent); font-variant-numeric: tabular-nums; }
.stat span { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.countdown { font-variant-numeric: tabular-nums; color: var(--ink-strong); }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px;
  font: 700 16px var(--ui); text-transform: uppercase; letter-spacing: .03em;
  border: 2px solid var(--ink); border-radius: var(--r); padding: 10px 20px; cursor: pointer;
  background: var(--accent); color: var(--accent-ink); text-decoration: none;
  box-shadow: 0 3px 0 var(--ink); transition: transform .08s, box-shadow .08s, filter .12s;
}
@media (hover: hover) { .btn:hover { filter: brightness(1.06); } }
.btn:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--ink); }
.btn:disabled { opacity: .45; cursor: progress; }
.btn-ghost { background: var(--paper-raise); color: var(--ink-strong); }
.btn-wide { width: 100%; }
.link { background: none; border: 0; padding: 10px 0; min-height: 44px; color: var(--muted); font-size: 15px; text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* Panels below the hero */
main { display: block; padding-bottom: 8px; }
.sect { max-width: 544px; margin: 26px auto 0; padding: 20px 16px; display: flex; flex-direction: column; gap: 8px; }
@media (max-width: 575px) { .sect { margin-left: 16px; margin-right: 16px; } }
h2 { font: 700 18px/1.25 var(--ui); text-transform: uppercase; letter-spacing: .02em; margin: 0; text-align: center; color: var(--ink-strong); }
.sect > .muted { margin: 0 0 8px; font-size: 15px; text-align: center; }

.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.tile {
  text-align: left; background: var(--paper-raise); border: 2px solid var(--line); border-radius: var(--r);
  padding: 12px; min-height: 74px; cursor: pointer; display: flex; flex-direction: column; justify-content: space-between; gap: 6px; color: var(--ink-strong);
  transition: border-color .12s, transform .08s;
}
@media (hover: hover) { .tile:hover { border-color: var(--ink); background: #fff; } }
.tile:active { transform: scale(.98); }
.tile-t { font-weight: 700; font-size: 16px; line-height: 1.25; }
.tile-n { font-size: 13px; color: var(--muted); }
.tile-all { grid-column: 1 / -1; background: var(--accent); border-color: var(--ink); color: var(--accent-ink); flex-direction: row; align-items: center; min-height: 56px; box-shadow: 0 3px 0 var(--ink); text-transform: uppercase; }
.tile-all .tile-n { color: inherit; opacity: .85; text-transform: none; }
@media (hover: hover) { .tile-all:hover { background: var(--accent); filter: brightness(1.06); } }

.sublist { list-style: none; margin: 0; padding: 0; }
.sublist a { display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 50px; padding: 10px 2px; border-bottom: 2px dashed var(--line-soft); text-decoration: none; font-weight: 500; color: var(--ink-strong); }
.sublist li:last-child a { border-bottom: 0; }
@media (hover: hover) { .sublist a:hover span:first-child { text-decoration: underline; } }
.suggest-cta { align-items: center; text-align: center; }
.suggest-cta .btn { margin-top: 6px; }

.qlist { margin: 0; padding-left: 1.8em; display: flex; flex-direction: column; gap: 16px; }
.qlist li::marker { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 15px; }
.qlist p { margin: 0; }
.qlist-q { font-weight: 500; color: var(--ink-strong); }
.qlist summary { cursor: pointer; font-size: 15px; color: var(--accent); font-weight: 500; min-height: 36px; display: flex; align-items: center; width: max-content; }
.qlist-a { display: flex; flex-direction: column; gap: 4px; padding: 4px 0 0 12px; border-left: 3px solid var(--frame); }
.qlist .ans { font-weight: 700; color: var(--ink-strong); }
.qlist .note { font-size: 15px; }

.foot { max-width: 544px; margin: 32px auto 0; padding: 12px 16px calc(28px + env(safe-area-inset-bottom)); color: var(--ink-strong); font-size: 14px; text-align: center; }
.foot p { margin: 6px 0; }
.links { display: flex; gap: 20px; flex-wrap: wrap; justify-content: center; }
.links a { min-height: 44px; display: inline-flex; align-items: center; font-weight: 500; }

/* Report form */
.report { display: flex; flex-direction: column; gap: 8px; width: 100%; border-top: 2px dashed var(--line-soft); padding-top: 12px; }
.report-title { margin: 0; font-weight: 700; font-size: 15px; }
.form-msg { margin: 0; font-size: 15px; }
.form-msg:empty { display: none; }
.form-msg.ok { color: var(--ok); }
.form-msg.bad { color: var(--red); }

/* Forms */
input, select, textarea { font: inherit; font-size: 16px; color: var(--ink-strong); background: var(--paper-raise); border: 2px solid var(--line); border-radius: var(--r); padding: 10px 12px; width: 100%; min-height: 48px; }
input:focus, select:focus, textarea:focus { border-color: var(--ink); }
textarea { resize: vertical; }
.form { display: flex; flex-direction: column; gap: 18px; }
.form > .muted { margin: 0; text-align: center; }
.field { display: flex; flex-direction: column; gap: 6px; }
.field label { font-weight: 700; font-size: 15px; color: var(--ink-strong); }
.req { color: var(--red); }
.opt-mark { font-weight: 400; color: var(--muted); }
.hint { margin: 0; font-size: 14px; color: var(--muted); }
.err { margin: 0; font-size: 14px; color: var(--red); font-weight: 500; }
[aria-invalid="true"] { border-color: var(--red); }
.wrong3 { display: flex; flex-direction: column; gap: 8px; }
.ts-float { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 80; width: min(320px, 90vw); }

/* Round: full-screen takeover on the same sea */
.play { position: fixed; inset: 0; z-index: 50; background: inherit; background-color: var(--sea-2); overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; }
.play-top { position: sticky; top: 0; z-index: 2; padding: env(safe-area-inset-top) 0 0; background: linear-gradient(var(--sea-1), rgba(159, 208, 230, 0)); }
.play-top-in { max-width: 560px; margin: 0 auto; padding: 4px 12px 4px 6px; display: flex; align-items: center; gap: 8px; min-height: 56px; }
.icon-btn { width: 44px; height: 44px; border: 2px solid var(--ink); background: var(--paper-bg); border-radius: var(--r); display: grid; place-items: center; cursor: pointer; color: var(--ink-strong); }
.icon-btn .ico { width: 22px; height: 22px; }
.pips { list-style: none; margin: 0; padding: 0; display: flex; gap: 4px; flex: 1; }
.pips li { flex: 1; height: 10px; border-radius: 3px; background: var(--paper-bg); border: 1.5px solid var(--ink); }
.pips li.now { background: var(--frame); }
.pips li.hit { background: var(--ok); }
.pips li.miss { background: var(--red); }
.count { font-size: 15px; font-weight: 700; color: var(--ink-strong); font-variant-numeric: tabular-nums; min-width: 48px; text-align: right; }
.play-body {
  flex: none; width: calc(100% - 32px); max-width: 528px; margin: 12px auto 24px; padding: 18px 16px;
  display: flex; flex-direction: column; gap: 16px; align-self: center;
  position: relative; background: var(--paper-bg); border: 2px solid var(--ink); border-radius: 10px;
  box-shadow: 0 0 0 5px var(--frame), 0 0 0 7px rgba(83, 78, 65, .55), 0 10px 24px rgba(30, 60, 80, .18);
}
.play-sub { margin: 0; font-size: 14px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; text-align: center; }
.play-body:focus { outline: none; }

.sheet { position: sticky; bottom: 0; z-index: 2; padding: 10px 16px calc(14px + env(safe-area-inset-bottom)); animation: rise .22s cubic-bezier(.2, .8, .2, 1) both; }
.sheet-in { max-width: 528px; margin: 0 auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.sheet.ok .sheet-in { border-color: var(--ok); }
.sheet.bad .sheet-in { border-color: var(--red); }
.sheet .row .btn { flex: 1; }
@keyframes rise { from { transform: translateY(24px); opacity: 0; } }

/* Result */
.result { display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; padding-top: 6px; }
.r-score { margin: 0; font: 700 46px/1 var(--ui); color: var(--accent); font-variant-numeric: tabular-nums; }
.r-score small { font-size: 22px; color: var(--muted); }
.r-rank { margin: 0; font: 700 22px/1.2 var(--ui); text-transform: uppercase; color: var(--ink-strong); }
.r-line { margin: 0; color: var(--ink); }
.r-grid { margin: 0; font-size: 20px; letter-spacing: 2px; }
.r-actions { display: flex; flex-direction: column; gap: 12px; width: 100%; max-width: 360px; }
.poster {
  margin: 0; width: min(240px, 72vw); background: var(--paper); color: var(--poster-ink);
  padding: 16px 18px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  box-shadow: inset 0 0 0 2px var(--paper-edge), inset 0 0 40px rgba(120, 80, 30, .25), 0 8px 18px rgba(60, 40, 20, .25);
  transform: rotate(-2deg); animation: pin .45s cubic-bezier(.2, 1.4, .4, 1) both;
}
@keyframes pin { from { transform: translateY(-14px) rotate(-6deg); opacity: 0; } }
.p-top { font: 400 21px/1 var(--card-font); text-transform: uppercase; }
.p-photo { width: 100%; aspect-ratio: 4 / 3; border: 2px solid var(--poster-ink); display: grid; place-items: center; background: rgba(58, 40, 22, .08); }
.p-photo span { font: 400 72px/1 var(--card-font); opacity: .55; }
.p-dead { font: 700 11px var(--ui); text-transform: uppercase; letter-spacing: .12em; }
.p-name { font: 400 22px/1.1 var(--card-font); text-align: center; background: transparent; border: 0; border-bottom: 1px dashed var(--paper-edge); border-radius: 0; color: var(--poster-ink); padding: 4px 0; min-height: 40px; text-transform: uppercase; }
.p-name::placeholder { color: var(--poster-ink); opacity: .5; }
.p-bounty { font: 400 22px/1.2 var(--card-font); font-variant-numeric: tabular-nums; white-space: nowrap; }
.p-bounty span { margin: 0 3px; }
.p-marine { font: 700 10px var(--ui); letter-spacing: .06em; white-space: nowrap; text-transform: uppercase; opacity: .75; align-self: flex-end; }
.wrongs { width: 100%; text-align: left; border-top: 2px dashed var(--line-soft); padding-top: 16px; }
.w-title { margin: 0 0 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .02em; text-align: center; color: var(--ink-strong); }
.wrongs ul { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 12px; }
.wrongs li { font-size: 15px; color: var(--muted); }
.wrongs li b { display: block; color: var(--ink-strong); font-weight: 700; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 90; background: var(--ink-strong); color: var(--paper-bg); padding: 10px 16px; border-radius: var(--r); font-size: 15px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* Which kinds of questions a player opts into */
.scopes { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 10px; }
.scopes-l { font-size: 14px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.scope { font: 500 15px var(--ui); min-height: 40px; padding: 6px 14px; border-radius: 999px; border: 2px solid var(--line); background: var(--paper-raise); color: var(--ink-strong); cursor: pointer; }
.scope[aria-checked="true"] { background: var(--ink-strong); border-color: var(--ink-strong); color: var(--paper-bg); }
.scope:disabled { cursor: default; opacity: .85; }
.tag { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 6px; background: var(--frame); color: var(--ink); font-size: 12px; font-weight: 700; vertical-align: 2px; }
.crowd { margin: 0; text-align: center; font-weight: 500; color: var(--ink-strong); }

/* Short phones: keep the question, the marked answers and the sheet on one screen */
@media (max-height: 740px) {
  .play-body { gap: 12px; padding: 14px 14px; margin-top: 6px; }
  .opt { min-height: 48px; padding: 8px 12px; }
  .q { font-size: 18px; }
  .sheet { padding-top: 6px; }
  .sheet-in { padding: 10px 12px; gap: 6px; }
  .sheet .note { font-size: 15px; line-height: 1.4; }
  .sheet .btn { min-height: 44px; }
}
