/* Guess the Chain: printed road-atlas look. Light only, like paper. */
@font-face { font-family: 'Source Serif 4'; font-style: normal; font-weight: 400; font-display: swap; src: url(/assets/fonts/source-serif-4-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Source Serif 4'; font-style: italic; font-weight: 400; font-display: swap; src: url(/assets/fonts/source-serif-4-latin-400-italic.woff2) format('woff2'); }
@font-face { font-family: 'Source Serif 4'; font-style: normal; font-weight: 600; font-display: swap; src: url(/assets/fonts/source-serif-4-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Source Serif 4'; font-style: normal; font-weight: 700; font-display: swap; src: url(/assets/fonts/source-serif-4-latin-700-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 500; font-display: swap; src: url(/assets/fonts/barlow-condensed-latin-500-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 600; font-display: swap; src: url(/assets/fonts/barlow-condensed-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Barlow Condensed'; font-style: normal; font-weight: 700; font-display: swap; src: url(/assets/fonts/barlow-condensed-latin-700-normal.woff2) format('woff2'); }

:root {
  --paper: #f3ead2;
  --sheet: #fbf6e9;
  --water: #d6e4e6;
  --ink: #2a241c;
  --muted: #6e624f;
  --rule: #2a241c;
  --rule-soft: #c9b993;
  --red: #b3261e;
  --navy: #1f3f7a;
  --green: #3f6b2a;
  --amber: #a66a00;
  --dot-answer: #b3261e;
  --dot-guess: #1f3f7a;
  --b0: #b3261e;
  --b1: #c56a1c;
  --b2: #b28d12;
  --b3: #3f6b2a;
  --serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --label: 'Barlow Condensed', 'Arial Narrow', 'Roboto Condensed', sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  color: var(--ink);
  background-color: var(--paper);
  /* Faint paper grain. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .28 0 0 0 0 .15 0 0 0 .06 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
  font: 400 17px/1.55 var(--serif);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
a { color: var(--navy); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--red); }
h1, h2, h3 { font-family: var(--serif); line-height: 1.15; font-weight: 700; }
h1 { font-size: clamp(30px, 5.4vw, 42px); margin: .5em 0 .25em; letter-spacing: -.01em; }
h2 { font-size: 24px; margin: 1.7em 0 .5em; padding-bottom: 4px; border-bottom: 1px solid var(--rule); }
h3 { font-size: 19px; font-style: italic; font-weight: 600; margin: 1.3em 0 .3em; }
.label, .legend-title, .log-head, .masthead .nav, .facts dt, .states thead th, .stat-grid span, .ad-label {
  font-family: var(--label); text-transform: uppercase; letter-spacing: .09em; font-weight: 600;
}
h2.label { font-size: 15px; border: 0; margin: 0 0 6px; padding: 0; color: var(--muted); }
:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.small { font-size: 14px; color: var(--muted); font-style: italic; }
.skip-link { position: absolute; left: -999px; top: 8px; background: var(--sheet); padding: 8px 12px; z-index: 50; }
.skip-link:focus { left: 8px; }

.wrap { width: 100%; max-width: 780px; margin: 0 auto; padding: 0 16px; flex: 1; }
.wrap.wide { max-width: 1000px; }

/* Masthead: title block of an atlas cover. */
.masthead { max-width: 780px; width: 100%; margin: 0 auto; padding: 14px 16px 0; }
.masthead-inner { display: flex; align-items: center; gap: 12px; padding-bottom: 10px; border-bottom: 3px double var(--rule); }
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; }
.brand:hover { color: var(--ink); }
.logo { width: 38px; height: 40px; flex: none; }
.brand-text { display: flex; flex-direction: column; line-height: 1.05; }
.brand-name { font-weight: 700; font-size: 27px; letter-spacing: .14em; text-transform: uppercase; white-space: nowrap; }
.brand-sub { font-style: italic; font-size: 14px; color: var(--muted); margin-top: 3px; }
.tools { margin-left: auto; display: flex; gap: 2px; }
.icon-btn { background: none; border: 1px solid transparent; color: var(--ink); padding: 6px; cursor: pointer; display: grid; place-items: center; }
.icon-btn:hover { border-color: var(--rule-soft); }
.masthead .nav { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 10px; padding: 7px 0; font-size: 15px; border-bottom: 1px solid var(--rule); }
.masthead .nav a { color: var(--ink); text-decoration: none; }
.masthead .nav a:hover { color: var(--red); }
.masthead .nav a[aria-current="page"] { color: var(--red); }
.masthead .nav span { color: var(--rule-soft); }
@media (max-width: 520px) {
  .brand-name { font-size: 19px; letter-spacing: .07em; }
  .brand-sub { font-size: 12.5px; }
  .logo { width: 32px; height: 34px; }
}

/* Buttons: plain printed boxes. */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-family: var(--label); font-weight: 700; font-size: 17px; letter-spacing: .08em; text-transform: uppercase; line-height: 1;
  padding: 11px 18px; min-height: 44px; border: 1.5px solid var(--ink); border-radius: 2px;
  background: var(--sheet); color: var(--ink); text-decoration: none; cursor: pointer;
}
.btn:hover { background: #fff; color: var(--ink); }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fbf6e9; }
.btn.primary:hover { background: #17325f; color: #fff; }
.btn.ghost { background: transparent; border-color: var(--rule-soft); color: var(--muted); }

/* The map plate. */
.game { padding-top: 6px; }
.plate-head { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 2px 12px; margin: 16px 0 10px; }
.plate-shield svg { width: 54px; height: 57px; display: block; }
.plate-title h1 { margin: 0; font-size: clamp(26px, 5vw, 34px); }
.plate-date { margin: 2px 0 0; font-style: italic; color: var(--muted); }
.plate-question { grid-column: 1 / -1; margin: 6px 0 0; font-size: 18px; }

.plate { margin: 0; border: 3px double var(--rule); background: var(--sheet); padding: 6px; }
.plate-map { position: relative; aspect-ratio: 975 / 610; background: var(--water); }
/* Same box for the base map and the dots so they line up; 2% inset keeps the 975:610 ratio. */
.plate-map .basemap, .plate-map canvas { position: absolute; left: 2%; top: 2%; width: 96%; height: 96%; display: block; }
.plate.loading .plate-map::after {
  content: 'Unfolding the map…'; position: absolute; inset: 0; display: grid; place-items: center;
  font-style: italic; color: var(--muted);
}
.legend {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px 16px;
  border-top: 1px solid var(--rule); margin-top: 6px; padding: 6px 4px 0; font-size: 15px;
}
.legend-title { font-size: 13px; color: var(--muted); }
.legend-item { display: inline-flex; align-items: center; gap: 6px; }
.legend-note { margin-left: auto; font-style: italic; color: var(--muted); font-size: 14px; }
.key { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: none; }
.key-answer { background: var(--dot-answer); }
.key-guess { background: var(--dot-guess); }

/* Clues, set like a map index with dotted leaders. */
.clues { margin: 18px 0 14px; }
.clue-list { margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.clue { display: flex; align-items: baseline; gap: 6px; padding: 3px 0; }
.clue dt { white-space: nowrap; }
.clue::after { content: ''; order: 1; flex: 1; border-bottom: 1.5px dotted var(--rule-soft); transform: translateY(-4px); }
.clue dd { order: 2; margin: 0; white-space: nowrap; }
.clue:not(.open) { color: var(--muted); font-style: italic; }
.clue.open dt { color: var(--muted); }
.clue.open dd { font-weight: 700; }
@media (max-width: 560px) { .clue-list { grid-template-columns: 1fr; } }

/* Guess entry. */
.guess { display: flex; gap: 8px; align-items: stretch; }
.combo { position: relative; flex: 1; min-width: 0; }
#guess-input {
  width: 100%; height: 100%; min-height: 44px; font: inherit; font-size: 18px; color: var(--ink);
  padding: 9px 12px; border: 1.5px solid var(--ink); border-radius: 2px; background: #fffdf6;
}
#guess-input::placeholder { color: #9b8d73; font-style: italic; }
#guess-input:focus { outline: 2px solid var(--navy); outline-offset: 1px; }
.options {
  position: absolute; left: 0; right: 0; top: calc(100% + 3px); z-index: 20; list-style: none; margin: 0; padding: 3px;
  background: #fffdf6; border: 1.5px solid var(--ink); max-height: 320px; overflow-y: auto;
  box-shadow: 3px 3px 0 rgba(42, 36, 28, .15);
}
.options li { padding: 8px 9px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.options li:hover, .options li[aria-selected="true"] { background: var(--paper); }
.opt-type { color: var(--muted); font-style: italic; font-size: 14px; white-space: nowrap; }
@media (max-width: 480px) {
  .guess { flex-wrap: wrap; }
  .combo { flex-basis: 100%; }
  .guess .btn { flex: 1; }
}
.guess-count { color: var(--muted); font-style: italic; font-size: 15px; margin: 6px 0; min-height: 1em; }

/* Guess log, a ruled table. */
.log { margin: 6px 0 10px; border-top: 2px solid var(--rule); }
.log-head, .guess-row {
  display: grid; grid-template-columns: 30px minmax(0, 1.4fr) minmax(0, 1.25fr) 76px minmax(110px, 1fr) 82px;
  align-items: center; gap: 10px;
}
.log-head { font-size: 12.5px; color: var(--muted); padding: 5px 2px; border-bottom: 1px solid var(--rule); }
.guesses { list-style: none; margin: 0; padding: 0; }
.guess-row { padding: 8px 2px; border-bottom: 1px solid var(--rule-soft); font-size: 16px; }
.g-no { font-family: var(--label); font-weight: 700; font-size: 18px; color: var(--muted); text-align: center; }
.g-name { font-weight: 700; overflow-wrap: anywhere; }
.g-cell { font-size: 15px; }
.g-cell b { font-family: var(--label); font-size: 18px; margin-right: 2px; }
.g-type { font-style: italic; }
.g-type.t-same b { color: var(--green); }
.g-type.t-group b { color: var(--amber); }
.g-type.t-none b { color: var(--red); }
.g-size b { color: var(--navy); }
.g-overlap { display: flex; align-items: center; gap: 8px; }
.g-overlap .scale { flex: 1; height: 8px; border: 1px solid var(--ink); background: #fffdf6; position: relative; }
.g-overlap .bar { position: absolute; inset: 0 auto 0 0; width: var(--w); }
.g-overlap.b0 .bar { background: var(--b0); }
.g-overlap.b1 .bar { background: var(--b1); }
.g-overlap.b2 .bar { background: var(--b2); }
.g-overlap.b3 .bar { background: var(--b3); }
.g-overlap .pct { font-family: var(--label); font-weight: 700; font-size: 17px; min-width: 38px; text-align: right; white-space: nowrap; }
.g-show {
  font-family: var(--label); text-transform: uppercase; letter-spacing: .08em; font-weight: 700; font-size: 13px;
  border: 1px solid var(--ink); background: none; color: var(--ink); border-radius: 2px; padding: 5px 8px; cursor: pointer;
}
.g-show[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fbf6e9; }
.guess-row.correct { grid-template-columns: 30px 1fr auto; background: rgba(63, 107, 42, .1); }
.g-win { font-family: var(--label); text-transform: uppercase; letter-spacing: .1em; font-weight: 700; color: var(--green); padding-right: 8px; }
.guess-row.skipped { grid-template-columns: 30px 1fr; color: var(--muted); font-style: italic; }
.guess-row.skipped .g-name { font-weight: 400; }
.g-loading { color: var(--muted); font-style: italic; grid-column: span 4; }
.m-only { display: none; }
@media (max-width: 640px) {
  .m-only { display: inline; }
  .log-head { display: none; }
  .guess-row { grid-template-columns: 26px 1fr auto; gap: 4px 8px; }
  .g-no { grid-row: span 3; align-self: start; }
  .g-name { grid-column: 2; }
  .g-show { grid-column: 3; grid-row: 1; }
  .g-type, .g-size { grid-column: 2 / 4; }
  .g-overlap { grid-column: 2 / 4; }
}

/* Result box. */
.result { margin: 16px 0; padding: 18px 18px 16px; border: 3px double var(--rule); background: var(--sheet); text-align: center; }
.result-title { font-size: 28px; font-weight: 700; font-style: italic; margin: 0 0 4px; }
.result-answer { margin: 0 0 14px; font-size: 18px; }
.result-actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.result-next { margin: 14px 0 0; color: var(--muted); font-style: italic; }
.result-next span { font-style: normal; font-weight: 700; color: var(--ink); font-variant-numeric: tabular-nums; }
.result-streak { margin: 4px 0 0; font-size: 15px; color: var(--muted); }

.below { margin-top: 30px; }
.chip-list { list-style: none; padding: 0; margin: 0; line-height: 1.9; }
.chip-list li { display: inline; }
.chip-list li:not(:last-child)::after { content: ' · '; color: var(--rule-soft); }

/* Dialogs. */
.dialog { border: 3px double var(--rule); padding: 0; border-radius: 0; background: var(--sheet); color: var(--ink); width: min(540px, calc(100vw - 24px)); box-shadow: 6px 6px 0 rgba(42, 36, 28, .2); }
.dialog::backdrop { background: rgba(42, 36, 28, .45); }
.dialog-inner { padding: 18px 22px 16px; position: relative; max-height: calc(100vh - 40px); overflow-y: auto; }
.dialog h2 { margin-top: 0; font-style: italic; }
.dialog-x { position: absolute; right: 10px; top: 8px; border: 0; background: none; font-size: 28px; line-height: 1; color: var(--muted); cursor: pointer; padding: 4px 8px; }
.rules { padding-left: 22px; }
.rules li { margin-bottom: 8px; }
.rules ul { padding-left: 18px; margin-top: 6px; }
.t-same { color: var(--green); font-weight: 700; }
.t-group { color: var(--amber); font-weight: 700; }
.t-none { color: var(--red); font-weight: 700; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); text-align: center; gap: 6px; border-bottom: 1px solid var(--rule); padding-bottom: 10px; }
.stat-grid strong { display: block; font-size: 32px; font-weight: 700; }
.stat-grid span { font-size: 13px; color: var(--muted); }
.dialog h3 { font-style: normal; font-family: var(--label); text-transform: uppercase; letter-spacing: .09em; font-size: 14px; color: var(--muted); }
.dist { list-style: none; padding: 0; margin: 0; display: grid; gap: 4px; }
.dist li { display: grid; grid-template-columns: 18px 1fr; align-items: center; gap: 8px; font-family: var(--label); font-weight: 700; }
.dist-bar { width: var(--w); background: var(--muted); color: #fbf6e9; text-align: right; padding: 1px 7px; font-size: 14px; }
.dist-bar.now { background: var(--navy); }

.toast {
  position: fixed; left: 50%; top: 70px; transform: translate(-50%, -16px); opacity: 0; pointer-events: none;
  background: var(--ink); color: var(--sheet); padding: 9px 16px; border-radius: 2px;
  transition: opacity .2s, transform .2s; z-index: 100; max-width: calc(100vw - 32px); font-style: italic;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* Content pages. */
.lede { font-size: 19px; }
.crumbs { margin-top: 16px; font-family: var(--label); text-transform: uppercase; letter-spacing: .08em; font-size: 14px; color: var(--muted); }
.crumbs a { color: var(--muted); }
.facts { margin: 16px 0; display: grid; grid-template-columns: 1fr 1fr; gap: 0 28px; }
.facts div { display: flex; align-items: baseline; gap: 6px; padding: 3px 0; }
.facts div::after { content: ''; order: 1; flex: 1; border-bottom: 1.5px dotted var(--rule-soft); transform: translateY(-4px); }
.facts dt { font-size: 14px; color: var(--muted); white-space: nowrap; }
.facts dd { order: 2; margin: 0; font-weight: 700; text-align: right; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; } }
.table-wrap { overflow-x: auto; }
table.states { width: 100%; border-collapse: collapse; font-size: 16px; border-top: 2px solid var(--rule); border-bottom: 2px solid var(--rule); }
.states th, .states td { padding: 5px 10px; border-bottom: 1px solid var(--rule-soft); text-align: left; }
.states thead th { font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--rule); }
.states tbody th { font-weight: 600; }
.states tbody tr:nth-child(even) { background: rgba(201, 185, 147, .14); }
.states tr:last-child th, .states tr:last-child td { border-bottom: 0; }
.num { text-align: right !important; font-variant-numeric: tabular-nums; }
.similar { list-style: none; padding: 0; margin: 0; columns: 2 240px; column-gap: 28px; }
.similar li { display: flex; align-items: baseline; gap: 6px; padding: 3px 0; break-inside: avoid; }
.similar li::after { content: ''; order: 1; flex: 1; border-bottom: 1.5px dotted var(--rule-soft); transform: translateY(-4px); }
.similar span { order: 2; color: var(--muted); font-size: 15px; white-space: nowrap; }
.cta { margin: 30px 0; padding: 16px 18px; border: 3px double var(--rule); background: var(--sheet); display: flex; gap: 16px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.cta p { margin: 0; flex: 1 1 280px; }
.source { margin: 24px 0; }
.jump { font-family: var(--label); text-transform: uppercase; letter-spacing: .08em; font-size: 15px; display: flex; flex-wrap: wrap; gap: 4px 16px; }
.dir { list-style: none; padding: 0; margin: 0; columns: 3 220px; column-gap: 28px; }
.dir li { break-inside: avoid; display: flex; align-items: baseline; gap: 6px; padding: 2px 0; }
.dir li::after { content: ''; order: 1; flex: 1; border-bottom: 1.5px dotted var(--rule-soft); transform: translateY(-4px); min-width: 12px; }
.dir a { text-decoration: none; }
.dir a:hover { text-decoration: underline; }
.dir span { order: 2; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.archive { list-style: none; padding: 0; margin: 0; border-top: 2px solid var(--rule); }
.archive a { display: grid; grid-template-columns: 80px 1fr auto; gap: 10px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--rule-soft); text-decoration: none; color: var(--ink); }
.archive a:hover { background: rgba(201, 185, 147, .18); }
.a-num { font-family: var(--label); font-weight: 700; font-size: 18px; }
.a-date { font-style: italic; color: var(--muted); }
.a-status { font-family: var(--label); font-weight: 700; font-size: 17px; }
.a-status.won { color: var(--green); }
.a-status.lost { color: var(--red); }
.a-status.started { color: var(--amber); }

.ad { margin: 26px 0; text-align: center; min-height: 100px; }
.ad-label { display: block; font-size: 11px; color: var(--muted); margin-bottom: 4px; }

.imprint { margin-top: 44px; padding: 16px 0 28px; font-size: 14px; color: var(--muted); }
.imprint .wrap { border-top: 3px double var(--rule); padding-top: 12px; }
.imprint nav { display: flex; flex-wrap: wrap; gap: 4px 18px; margin-bottom: 8px; font-family: var(--label); text-transform: uppercase; letter-spacing: .08em; font-size: 14px; }
.imprint p { margin: 0; font-style: italic; }

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