/* Restrained, editorial look: serif headlines and figures, hairline rules, square corners, one muted accent. */
:root {
  --bg: #07090c;
  --surface: rgba(13, 16, 20, 0.94);
  --border: rgba(255, 255, 255, 0.1);
  --rule: rgba(255, 255, 255, 0.16);
  --ink: #ecebe7;
  --ink-2: #b9b8b2;
  --muted: #85847f;
  --accent: #c9d7e4;
  --accent-ink: #07090c;
  --good: #c9d7e4;
  --miss: #d7a58f;
  /* same steel-blue ramp as app.js (0% -> 100%) */
  --ramp: linear-gradient(90deg, #355f8a, #43709c, #5784ae, #749dc1, #9dbbd6, #d2e0ec);
  --none: #4a4f56;
  --radius: 3px;
  --gutter: 16px;
  --serif: "Iowan Old Style", "Charter", "Georgia", "Times New Roman", serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-family: var(--sans);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--ink); overflow: hidden; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }

#globe { position: fixed; inset: 0; }

.muted { color: var(--muted); }
.small { font-size: 0.82rem; }
a { color: var(--ink-2); text-underline-offset: 2px; }
.label {
  margin: 0 0 6px; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--muted); font-weight: 600;
}

button { font: inherit; color: inherit; cursor: pointer; }
.primary {
  background: var(--accent); color: var(--accent-ink); border: 0; border-radius: var(--radius);
  padding: 0.6rem 1.1rem; font-weight: 600; font-size: 0.9rem; letter-spacing: 0.01em;
}
.primary:hover { background: #fff; }
.link { background: none; border: 0; padding: 0; color: var(--ink-2); text-decoration: underline; text-underline-offset: 2px; }

.top {
  position: fixed; top: 0; left: 0; right: 0; z-index: 3;
  display: flex; align-items: center; gap: 12px; padding: 12px var(--gutter);
  border-bottom: 1px solid var(--border); background: linear-gradient(var(--bg), rgba(7, 9, 12, 0));
  pointer-events: none;
}
.top > * { pointer-events: auto; }
.brand { display: flex; align-items: baseline; gap: 12px; white-space: nowrap; }
.wordmark {
  font-family: var(--serif); font-size: 1.15rem; font-weight: 700; letter-spacing: 0.01em;
}
.dateline { font-size: 0.75rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }

/* Small white search box, centered at the top. */
.search {
  position: absolute; left: 50%; transform: translateX(-50%); top: 9px;
  width: min(280px, 40vw);
}
.search input {
  width: 100%; height: 32px; padding: 0 0.75rem; border-radius: var(--radius); font: inherit; font-size: 14px;
  color: #15171a; background: #f3f2ee; border: 1px solid #f3f2ee;
}
.search input::placeholder { color: #75746f; }
.search input:focus { outline: 2px solid var(--accent); outline-offset: 1px; background: #fff; }
.search ul {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; min-width: 260px; margin: 0; padding: 4px 0;
  list-style: none; background: #fff; color: #15171a; border-radius: var(--radius);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45); max-height: 50vh; overflow: auto;
}
.search li { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; padding: 0.45rem 0.75rem; cursor: pointer; font-size: 14px; }
.search li[aria-selected="true"], .search li:hover { background: #e9edf2; }
.search li .note { color: #75746f; font-size: 0.72rem; letter-spacing: 0.04em; white-space: nowrap; }

.card, .panel {
  position: fixed; z-index: 2; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}

.card {
  left: 50%; transform: translateX(-50%); bottom: 48px;
  width: min(580px, calc(100vw - 2 * var(--gutter))); padding: 22px 24px;
  max-height: calc(100vh - 120px); overflow: auto;
}
.card h1 {
  font-family: var(--serif); font-weight: 600; font-size: 1.45rem; line-height: 1.3; margin: 0 0 18px;
}
.options { display: grid; gap: 0; border-top: 1px solid var(--border); }
.options button {
  display: flex; align-items: baseline; gap: 14px; text-align: left; padding: 0.8rem 0.4rem;
  background: none; border: 0; border-bottom: 1px solid var(--border); border-radius: 0;
}
.options button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.05); }
.options button:disabled { cursor: default; opacity: 0.55; }
.key { font-size: 0.75rem; font-weight: 600; color: var(--muted); width: 1em; }

.verdict { font-family: var(--serif); font-size: 1.5rem; font-weight: 600; margin: 0 0 6px; }
.verdict::before {
  content: ""; display: inline-block; width: 8px; height: 8px; margin: 0 10px 3px 0;
  background: currentColor; vertical-align: middle;
}
.verdict.ok { color: var(--good); }
.verdict.no { color: var(--miss); }
.answer-line { margin: 14px 0 6px; padding-top: 12px; border-top: 1px solid var(--border); }
.answer-line .label { display: inline; margin-right: 8px; }
#explanation { font-family: var(--serif); font-size: 1.05rem; line-height: 1.55; color: var(--ink-2); margin: 0 0 18px; }

/* After answering the card shrinks to a corner so the globe is visible. */
.card.mini {
  left: var(--gutter); transform: none; bottom: auto; top: 64px;
  width: min(360px, calc(100vw - 2 * var(--gutter))); padding: 12px 14px;
}
#mini-q { font-family: var(--serif); margin: 10px 0 4px; }

.panel {
  right: var(--gutter); top: 64px; width: 300px; padding: 16px 18px;
  max-height: calc(100vh - 110px); overflow: auto;
}
#panel-kind {
  margin: 0 0 4px; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; font-weight: 600;
}
.panel h2 { font-family: var(--serif); font-weight: 600; margin: 0 0 6px; font-size: 1.35rem; }
.panel .rate {
  font-family: var(--serif); font-size: 2.6rem; font-weight: 500; margin: 0; line-height: 1;
  font-variant-numeric: tabular-nums lining-nums;
}
.test-note {
  margin: 0 0 12px; padding: 8px 10px; font-size: 0.8rem; line-height: 1.4;
  color: var(--ink); border: 1px solid var(--rule); border-left: 3px solid var(--miss);
}
.sel-rate p { margin: 0; }
#panel-sub { margin-top: 4px; }
.panel hr { border: 0; border-top: 1px solid var(--rule); margin: 14px 0; }
.mine { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 0; }
.mine li {
  display: flex; justify-content: space-between; gap: 8px; padding: 6px 0;
  border-bottom: 1px solid var(--border); font-size: 0.9rem;
}
.mine li span:first-child { color: var(--ink-2); }
.mine li span:last-child { font-variant-numeric: tabular-nums; font-weight: 600; }
.legend { margin-bottom: 14px; }
.ramp { height: 6px; background: var(--ramp); }
.ticks { display: flex; justify-content: space-between; margin-top: 3px; font-variant-numeric: tabular-nums; }
.none-key { display: flex; align-items: center; gap: 6px; margin: 6px 0 0; }
.swatch { width: 10px; height: 10px; border: 1px solid var(--rule); }
.swatch.none { background: var(--none); }
.actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
#countdown { flex-basis: 100%; margin-top: 4px; font-variant-numeric: tabular-nums; }
.hint { margin: 8px 0 0; }

.foot {
  position: fixed; bottom: 10px; left: 0; right: 0; text-align: center; z-index: 1;
  font-size: 0.75rem;
}

@media (max-width: 720px) {
  .card { bottom: 40px; padding: 18px 18px; }
  .card h1 { font-size: 1.3rem; }
  .card.mini { top: 56px; left: var(--gutter); right: var(--gutter); width: auto; }
  .panel {
    left: var(--gutter); right: var(--gutter); top: auto; bottom: 34px; width: auto;
    max-height: 42vh; padding: 12px 14px;
  }
  .sel { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; }
  .sel-rate { text-align: right; }
  .panel h2 { font-size: 1.15rem; margin: 0; }
  .panel .rate { font-size: 2rem; }
  .panel hr { margin: 10px 0; }
  .mine { grid-template-columns: repeat(3, auto); justify-content: space-between; margin-bottom: 10px; }
  .mine li { flex-direction: column; gap: 0; padding: 0; border: 0; font-size: 0.82rem; }
  .mine li span:first-child { color: var(--muted); }
  .legend { margin-bottom: 10px; display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: end; }
  .legend .label { grid-column: 1 / -1; }
  .legend .ramp { grid-column: 1; }
  .legend .ticks { grid-column: 1; grid-row: 3; }
  .none-key { grid-column: 2; grid-row: 2 / 4; margin: 0; }
  .hint { display: none; }
  .test-note { margin-bottom: 8px; padding: 6px 8px; font-size: 0.75rem; }
  #countdown { flex-basis: auto; margin: 0 0 0 auto; }
  .search { position: relative; left: auto; top: auto; transform: none; width: auto; flex: 1; margin-left: auto; }
  .search input { font-size: 16px; } /* below 16px iOS zooms the page on focus */
  .search ul { min-width: 0; }
  .dateline { display: none; }
}

/* Text pages (privacy). */
body.doc { overflow: auto; }
.doc-top {
  display: flex; justify-content: space-between; align-items: baseline; gap: 12px;
  padding: 14px var(--gutter); border-bottom: 1px solid var(--border);
}
.doc-top .wordmark { color: var(--ink); text-decoration: none; }
.doc-body { max-width: 680px; margin: 0 auto; padding: 36px var(--gutter) 64px; line-height: 1.6; }
.doc-body h1 { font-family: var(--serif); font-weight: 600; font-size: 2rem; line-height: 1.2; margin: 0 0 14px; }
.doc-body h2 {
  font-family: var(--serif); font-weight: 600; font-size: 1.25rem; margin: 36px 0 8px;
  padding-top: 14px; border-top: 1px solid var(--border);
}
.doc-body p, .doc-body li { color: var(--ink-2); }
.doc-body strong { color: var(--ink); }
.doc-body ul { padding-left: 1.2rem; }
.doc-body li { margin-bottom: 6px; }
.lede { font-family: var(--serif); font-size: 1.2rem; line-height: 1.5; }
.doc-body table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.doc-body th {
  text-align: left; font-size: 0.7rem; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
  padding: 6px 12px 6px 0; border-bottom: 1px solid var(--rule);
}
.doc-body td { vertical-align: top; padding: 9px 12px 9px 0; border-bottom: 1px solid var(--border); color: var(--ink-2); }
.doc-body td:first-child { color: var(--ink); width: 55%; }
.doc-body code { font-size: 0.85em; background: rgba(255, 255, 255, 0.06); padding: 1px 5px; border-radius: 2px; word-break: break-all; }
.updated { margin-top: 40px; }
@media (max-width: 720px) {
  .doc-body h1 { font-size: 1.6rem; }
  .doc-body td:first-child { width: 50%; }
}
