/* Verse Chase: the "Stained glass" look (style C, Ryan's pick of 2026-11-19).
   Deep navy with jewel-colored glass and gold, like a church window. Dark by default;
   a light version (ivory, navy ink, pale glass) for players who choose it. Large text and tap targets. */

@font-face {
  font-family: 'Fraunces';
  font-style: normal;
  font-weight: 600 700; /* one file, weight 600, used for bold headings too (no faked bold) */
  font-display: swap;
  src: url('fonts/Fraunces-600.woff2') format('woff2');
}

/* Dark: the stained-glass look itself, and the default. */
:root {
  --paper: #14213d;
  --card: #1b2b4f;
  --ink: #f6efe0;
  --soft-ink: #c3c9d6;
  --line: #3a4a6e;
  --lead: rgb(233 196 106 / 0.45);
  --accent: #e9c46a;
  --accent-ink: #14213d;
  --accent-soft: rgb(233 196 106 / 0.14);
  --gold: #e9c46a;
  --label: #8ecae6;
  --link: #8ecae6;
  --right: #8fdca6;
  --right-soft: #183d2e;
  --wrong: #ff9e8c;
  --wrong-soft: #4a2230;
  --focus: #8ecae6;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 6px 18px rgb(0 0 0 / 0.22);
  --backdrop: rgb(5 10 25 / 0.65);
  /* The four panes of glass: ruby, emerald, sapphire, amethyst. */
  --glass-0: #6b2737;
  --glass-1: #1f5c4a;
  --glass-2: #2b4c8c;
  --glass-3: #6a4c93;
  --edge-0: #b0506a;
  --edge-1: #3f9a7c;
  --edge-2: #5b84d4;
  --edge-3: #9a7cd0;
  --glass-ink: #f6efe0;
  --serif: 'Fraunces', 'Palatino Linotype', 'Book Antiqua', Palatino, Georgia, serif;
  --quote-serif: 'Palatino Linotype', 'Book Antiqua', Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  --base: 18px;
  color-scheme: dark;
}

/* Light: chosen in Settings, or "Match my device" on a phone set to light. */
:root[data-theme='light'] {
  --paper: #f3eee3;
  --card: #fffcf5;
  --ink: #14213d;
  --soft-ink: #4a5270;
  --line: #d8ccb0;
  --lead: rgb(167 123 18 / 0.45);
  --accent: #14213d;
  --accent-ink: #f6efe0;
  --accent-soft: rgb(20 33 61 / 0.08);
  --gold: #8a6510;
  --label: #23607e;
  --link: #2b4c8c;
  --right: #24663a;
  --right-soft: #e2f1e5;
  --wrong: #a3301f;
  --wrong-soft: #f8e1dc;
  --focus: #2b4c8c;
  --shadow: 0 1px 2px rgb(20 33 61 / 0.08), 0 4px 14px rgb(20 33 61 / 0.07);
  --backdrop: rgb(20 33 61 / 0.45);
  --glass-0: #f4dde2;
  --glass-1: #d9eee6;
  --glass-2: #dbe5f6;
  --glass-3: #e8def4;
  --edge-0: #6b2737;
  --edge-1: #1f5c4a;
  --edge-2: #2b4c8c;
  --edge-3: #6a4c93;
  --glass-ink: #14213d;
  color-scheme: light;
}
@media (prefers-color-scheme: light) {
  :root[data-theme='auto'] {
    --paper: #f3eee3;
    --card: #fffcf5;
    --ink: #14213d;
    --soft-ink: #4a5270;
    --line: #d8ccb0;
    --lead: rgb(167 123 18 / 0.45);
    --accent: #14213d;
    --accent-ink: #f6efe0;
    --accent-soft: rgb(20 33 61 / 0.08);
    --gold: #8a6510;
    --label: #23607e;
    --link: #2b4c8c;
    --right: #24663a;
    --right-soft: #e2f1e5;
    --wrong: #a3301f;
    --wrong-soft: #f8e1dc;
    --focus: #2b4c8c;
    --shadow: 0 1px 2px rgb(20 33 61 / 0.08), 0 4px 14px rgb(20 33 61 / 0.07);
    --backdrop: rgb(20 33 61 / 0.45);
    --glass-0: #f4dde2;
    --glass-1: #d9eee6;
    --glass-2: #dbe5f6;
    --glass-3: #e8def4;
    --edge-0: #6b2737;
    --edge-1: #1f5c4a;
    --edge-2: #2b4c8c;
    --edge-3: #6a4c93;
    --glass-ink: #14213d;
    color-scheme: light;
  }
}
:root[data-text-size='large'] { --base: 21px; }

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { font-size: var(--base); -webkit-text-size-adjust: 100%; background: var(--paper); }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1rem/1.5 var(--sans);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
/* A strip of the four glass colors across the top, with gold leading between the panes. */
body::before {
  content: '';
  display: block;
  height: 7px;
  background: linear-gradient(90deg,
    var(--edge-0) 0 24.5%, var(--gold) 24.5% 25.5%,
    var(--edge-1) 25.5% 49.5%, var(--gold) 49.5% 50.5%,
    var(--edge-2) 50.5% 74.5%, var(--gold) 74.5% 75.5%,
    var(--edge-3) 75.5% 100%);
}
a { color: var(--link); text-underline-offset: 0.15em; }
h1, h2, h3 { font-family: var(--serif); font-weight: 600; line-height: 1.2; margin: 0 0 0.4em; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.15rem; margin-top: 1.2em; }
p { margin: 0 0 0.8em; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; border-radius: 6px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--card); padding: 8px 12px; z-index: 10; }
.skip:focus { left: 8px; }
.muted { color: var(--soft-ink); }
.small { font-size: 0.85rem; }

/* Header: the colon wordmark, VERSE:CHASE */
.top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  max-width: 640px;
  width: 100%;
  margin: 0 auto;
  padding: 14px 16px 6px;
}
.brand { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; }
.brand-name {
  font-family: var(--serif); font-size: 1.7rem; font-weight: 600; letter-spacing: 0.06em; line-height: 1.1;
  text-transform: uppercase; white-space: nowrap;
}
.brand-name .colon { color: var(--gold); padding: 0 0.04em; position: relative; top: -0.06em; }
.tm { font-size: 0.4em; vertical-align: super; margin-left: 3px; font-family: var(--sans); font-weight: 600; color: var(--soft-ink); letter-spacing: 0; }
.brand-sub { font-size: 0.8rem; color: var(--soft-ink); letter-spacing: 0.08em; text-transform: uppercase; }
.tools { display: flex; gap: 4px; }
.tool {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  min-width: 56px; min-height: 52px; padding: 4px 6px;
  background: none; border: 0; border-radius: 10px; color: var(--ink);
  font: 600 0.7rem/1.1 var(--sans); cursor: pointer;
}
.tool:hover { background: var(--accent-soft); }
.tool svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tool svg .fill { fill: currentColor; stroke: none; }

main { flex: 1; width: 100%; max-width: 640px; margin: 0 auto; padding: 4px 16px 24px; }
main:focus { outline: none; }
.dayline { color: var(--soft-ink); font-weight: 600; margin: 4px 0 10px; }
.banner { background: var(--accent-soft); border: 1px solid var(--lead); border-radius: 10px; padding: 10px 14px; font-size: 0.9rem; }
.loading { color: var(--soft-ink); }

/* Round steps */
.steps { list-style: none; display: flex; gap: 6px; padding: 0; margin: 0 0 12px; font-size: 0.8rem; font-weight: 600; }
.steps li { flex: 1; text-align: center; padding: 6px 4px; border-radius: 6px; background: var(--card); border: 1px solid var(--line); color: var(--soft-ink); }
.steps li.past { color: var(--right); border-color: var(--right); }
.steps li.past::before { content: '✓ '; }
.steps li.current { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }

/* Cards: framed with a thin gold line, like the leading around a window */
.card { background: var(--card); border: 1px solid var(--lead); border-radius: 10px; padding: 20px 18px; box-shadow: var(--shadow); margin-bottom: 16px; }
.card:focus { outline: none; }
.round-no { font-size: 0.8rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--label); margin-bottom: 4px; }
.lead { font-size: 1.05rem; }
.hint { color: var(--soft-ink); font-size: 0.9rem; margin-top: 10px; }

/* Buttons */
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.btn {
  min-height: 52px; padding: 12px 22px; border-radius: 8px; border: 2px solid var(--accent);
  font: 700 1rem/1.2 var(--sans); cursor: pointer;
}
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.quiet { background: transparent; color: var(--accent); }
.actions .btn.primary { flex: 1 1 220px; }
.icon-btn { width: 48px; height: 48px; border-radius: 50%; border: 0; background: transparent; color: var(--ink); font-size: 1.2rem; cursor: pointer; }
.icon-btn:hover { background: var(--accent-soft); }

/* Which Came First?: each event is a pane of glass. Its color goes with the event when it moves
   (set from the day's shuffled starting order in app.js, so it says nothing about the right order). */
.events { list-style: none; padding: 0; margin: 8px 0 0; display: grid; gap: 10px; }
.event {
  --glass: var(--glass-2); --edge: var(--edge-2);
  display: flex; align-items: stretch; gap: 0;
  background: var(--glass); color: var(--glass-ink);
  border: 1px solid var(--lead); border-left: 6px solid var(--edge); border-radius: 8px;
  touch-action: none; user-select: none; -webkit-user-select: none;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
}
.event[data-glass='0'] { --glass: var(--glass-0); --edge: var(--edge-0); }
.event[data-glass='1'] { --glass: var(--glass-1); --edge: var(--edge-1); }
.event[data-glass='2'] { --glass: var(--glass-2); --edge: var(--edge-2); }
.event[data-glass='3'] { --glass: var(--glass-3); --edge: var(--edge-3); }
.events.answered .event { touch-action: auto; user-select: text; -webkit-user-select: text; }
.event .slot {
  flex: 0 0 44px; display: grid; place-items: center;
  font: 600 1.2rem var(--serif); color: var(--gold); border-right: 1px solid var(--lead);
}
.event-main {
  flex: 1; min-height: 64px; padding: 10px 12px; text-align: left;
  background: none; border: 0; color: var(--glass-ink); font: 1rem/1.35 var(--sans); cursor: grab;
}
.event .event-text { display: block; }
.events.answered .event .event-text { padding: 12px; flex: 1; }
.event.tapped { border-color: var(--gold); box-shadow: inset 0 0 0 2px var(--gold); }
.event.tapped .slot { background: var(--gold); color: var(--accent-ink); }
.event.dragging { position: relative; z-index: 2; box-shadow: 0 10px 24px rgb(0 0 0 / 0.3); border-color: var(--gold); cursor: grabbing; transition: none; }
.moves { display: flex; flex-direction: column; border-left: 1px solid var(--lead); }
.move {
  flex: 1; width: 52px; min-height: 32px; border: 0; background: none; color: var(--gold);
  font-size: 0.95rem; cursor: pointer;
}
.move:first-child { border-bottom: 1px solid var(--lead); border-top-right-radius: 7px; }
.move:last-child { border-bottom-right-radius: 7px; }
.move:hover:not(:disabled) { background: rgb(255 255 255 / 0.1); }
.move:disabled { color: var(--glass-ink); opacity: 0.25; cursor: default; }
.event.right { --edge: var(--right); background: var(--right-soft); color: var(--ink); border-color: var(--right); }
.event.wrong { --edge: var(--wrong); background: var(--wrong-soft); color: var(--ink); border-color: var(--wrong); }
.event.right .slot, .event.wrong .slot { color: var(--ink); }
.event .mark { display: block; font-weight: 700; font-size: 0.85rem; margin-top: 2px; }
.event.right .mark { color: var(--right); }
.event.wrong .mark { color: var(--wrong); }

.answer { margin-top: 16px; padding-top: 14px; border-top: 1px dashed var(--lead); }
.answer:focus { outline: none; }
.verdict { font-weight: 700; font-size: 1.1rem; }
.right-order, .recap { padding-left: 0; list-style: none; margin: 0; display: grid; gap: 8px; }
.right-order { counter-reset: n; }
.right-order li { counter-increment: n; padding-left: 2em; position: relative; }
.right-order li::before { content: counter(n) '.'; position: absolute; left: 0.3em; font: 600 1rem var(--serif); color: var(--gold); }
.item-text { display: block; }
.ref { font-weight: 700; font-size: 0.9rem; display: inline-block; padding: 4px 0; min-height: 28px; }

/* Who Said It? */
.quote { margin: 8px 0 18px; }
.quote blockquote {
  margin: 0; padding: 18px 20px; border-left: 5px solid var(--gold); background: var(--paper); border-radius: 4px 10px 10px 4px;
  font: italic 1.35rem/1.45 var(--quote-serif);
}
.quote blockquote::before { content: '“'; }
.quote blockquote::after { content: '”'; }
.choices { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice {
  min-height: 60px; padding: 10px 12px; border-radius: 8px; border: 1px solid var(--lead);
  background: var(--paper); color: var(--ink); font: 600 1rem/1.25 var(--sans); cursor: pointer;
}
.choice:hover:not(:disabled) { border-color: var(--gold); background: var(--accent-soft); }
.choice:disabled { cursor: default; opacity: 0.7; }
.choice.right { opacity: 1; border: 2px solid var(--right); background: var(--right-soft); color: var(--ink); }
.choice.wrong { opacity: 1; border: 2px solid var(--wrong); background: var(--wrong-soft); color: var(--ink); }
.choice .mark { font-weight: 800; }
.choice.right .mark { color: var(--right); }
.choice.wrong .mark { color: var(--wrong); }
.ref-line { margin: 0; }

/* Result */
.big-score { font: 1.3rem var(--serif); margin: 4px 0 10px; color: var(--soft-ink); }
.big-score strong { font-size: 3.2rem; color: var(--gold); line-height: 1; }
.round-scores { list-style: none; padding: 0; margin: 0 0 14px; display: grid; gap: 6px; }
.round-scores strong { white-space: nowrap; }
.round-scores li { display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; background: var(--paper); border-radius: 8px; }
.share-preview { background: var(--paper); border: 1px dashed var(--lead); border-radius: 8px; padding: 12px 14px; font: 0.95rem/1.5 var(--sans); white-space: pre-wrap; margin: 0; }
.next-set { margin-top: 14px; }
.next-set strong { font-variant-numeric: tabular-nums; }
.recap li { padding: 8px 0; border-bottom: 1px solid var(--line); }
.recap li:last-child { border-bottom: 0; }

.notice { text-align: center; }
.dev-tools { border: 1px dashed var(--line); border-radius: 10px; padding: 10px 14px; margin-top: 8px; }

/* Home: the Cathedral windows menu (Ryan's pick, 2026-11-19; words and states from core/menu.js).
   One tall window per part of the day. The windows keep their jewel colors in both looks,
   like real stained glass against a pale wall. */
.on-home .tools, .on-home .dev-tools { display: none; }
.on-home .top { justify-content: center; text-align: center; }
.on-home .brand { align-items: center; }
.on-home .dayline { text-align: center; }
.to-menu { display: inline-block; padding: 6px 0 2px; font-weight: 700; font-size: 0.9rem; text-decoration: none; }
.to-menu:hover { text-decoration: underline; }
.home { margin-bottom: 16px; }
.windows { list-style: none; padding: 0; margin: 6px 0 14px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; align-items: end; }
.win {
  position: relative; height: 230px; overflow: hidden; color: #f6efe0; text-align: center;
  border: 3px solid #e9c46a; border-radius: 50% 50% 6px 6px / 30% 30% 6px 6px;
  display: flex; flex-direction: column; justify-content: flex-end; align-items: center; gap: 2px; padding: 10px 5px;
}
/* The leading: a center bar, cross bars, and a little light through the top of the glass. */
.win::before {
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(90deg, transparent 49%, rgb(233 196 106 / 0.5) 49% 51%, transparent 51%),
    repeating-linear-gradient(0deg, transparent 0 46px, rgb(233 196 106 / 0.45) 46px 48px),
    radial-gradient(circle at 50% 18%, rgb(255 255 255 / 0.22), transparent 55%);
}
.win > * { position: relative; }
.win[data-part='order'] { background: linear-gradient(170deg, #8a3248, #6b2737); }
.win[data-part='quote'] { background: linear-gradient(170deg, #3b62ad, #2b4c8c); }
.win[data-part='done'] { background: linear-gradient(170deg, #2a6e5a, #1f5c4a); }
.win[data-status='next'] { box-shadow: 0 0 0 4px rgb(233 196 106 / 0.28), 0 0 28px rgb(142 202 230 / 0.45); }
.win[data-status='later'] { opacity: 0.5; }
.win .no { font: 600 1.6rem/1 var(--serif); color: #e9c46a; }
.win .nm { font: 600 0.92rem/1.2 var(--serif); }
.win .st {
  margin-top: 6px; padding: 3px 7px; border-radius: 999px; background: rgb(20 33 61 / 0.8);
  font-size: 0.68rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: #c3c9d6;
}
.win[data-status='done'] .st { color: #8fdca6; }
.win[data-status='next'] .st { color: #e9c46a; }
.btn.go { display: flex; align-items: center; justify-content: center; width: 100%; text-decoration: none; font-size: 1.08rem; }
.home-meta { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 4px 12px; margin: 10px 0 0; color: var(--soft-ink); font-size: 0.9rem; }
.home-meta b { color: var(--ink); }
.home-next { margin: 6px 0 0; }
.plaques { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 14px; }
.plaque {
  display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 10px 12px; text-align: left; cursor: pointer;
  border: 1px solid var(--lead); border-radius: 6px; background: var(--card); color: var(--ink); font: 600 0.95rem/1.2 var(--sans);
}
.plaque:hover { border-color: var(--gold); background: var(--accent-soft); }
.plaque svg { flex: none; width: 22px; height: 22px; fill: none; stroke: var(--gold); stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.plaque svg .fill { fill: var(--gold); stroke: none; }
.live-link {
  display: flex; align-items: center; gap: 10px; margin-top: 14px; padding: 10px 12px;
  border: 1px dashed var(--lead); border-radius: 8px; color: var(--soft-ink); font-size: 0.88rem; text-decoration: none;
}
.live-link b { color: var(--ink); }
.live-link:hover { border-color: var(--gold); }
.live-link .lamp { flex: none; width: 36px; height: 36px; }
.lamp .body { fill: #c98a4a; }
.lamp .shade { fill: #9a6233; }
.lamp .flame { fill: #e9c46a; }
@media (max-width: 360px) {
  .win { height: 205px; }
  .win .nm { font-size: 0.8rem; }
  .plaque { font-size: 0.88rem; padding: 10px 8px; }
}

/* Footer */
.foot { max-width: 640px; width: 100%; margin: 0 auto; padding: 14px 16px 28px; display: flex; flex-wrap: wrap; gap: 6px 10px; justify-content: center; color: var(--soft-ink); font-size: 0.85rem; }

/* Dialogs */
dialog {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 32px); overflow: auto;
  border: 1px solid var(--lead); border-radius: 12px; padding: 20px 20px 22px;
  background: var(--card); color: var(--ink); box-shadow: 0 20px 60px rgb(0 0 0 / 0.4);
}
dialog::backdrop { background: var(--backdrop); }
.dialog-close { float: right; margin: -10px -10px 0 0; }
.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 10px 0; }
.stat-grid div { background: var(--paper); border-radius: 8px; padding: 10px 6px; text-align: center; }
.stat-grid dt { font-size: 0.75rem; color: var(--soft-ink); }
.stat-grid dd { margin: 0; font: 600 1.6rem var(--serif); color: var(--gold); }
.bars { display: grid; gap: 6px; margin-bottom: 10px; }
.bar-row { display: flex; align-items: center; gap: 8px; }
.bar-label { flex: 0 0 4.2em; font-size: 0.85rem; text-align: right; color: var(--soft-ink); }
.bar { background: var(--accent); color: var(--accent-ink); border-radius: 4px; padding: 2px 8px; font-weight: 700; font-size: 0.85rem; text-align: right; min-width: 2em; }
.archive { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.archive a { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px; min-height: 56px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 8px; text-decoration: none; color: var(--ink); background: var(--paper); }
.archive a:hover { border-color: var(--gold); }
.arch-day { font: 600 1rem var(--serif); }
.arch-date { color: var(--soft-ink); font-size: 0.85rem; }
.arch-score { font-weight: 700; font-size: 0.9rem; }
.arch-score.unplayed { color: var(--gold); }
fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 0 0 12px; padding: 8px 14px 10px; }
legend { font-weight: 700; padding: 0 6px; }
.option { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.option input { width: 22px; height: 22px; accent-color: var(--gold); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--ink); color: var(--paper); padding: 12px 18px; border-radius: 10px; font-weight: 600; z-index: 20; max-width: calc(100vw - 32px); }

/* About page */
.page h1 { font-size: 2rem; }
.page .card p:last-child { margin-bottom: 0; }

@media (max-width: 420px) {
  .brand-name { font-size: 1.4rem; }
  .tool { min-width: 48px; font-size: 0.65rem; }
  .card { padding: 16px 14px; }
  .quote blockquote { font-size: 1.2rem; padding: 14px 16px; }
  .choices { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
}

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