/* Layout: one narrow column, a stack of review cards that grows with each miss, guess slots and input pinned under it. */
:root {
  --bg: #EDF0F5;
  --paper: #FFFFFF;
  --ink: #1A2131;
  --muted: #5B6477;
  --line: #D6DBE4;
  --star: #F2A21B;
  --star-empty: #C9CFDA;
  --hit: #23935F;
  --near: #E07A1F;
  --miss: #D23F37;
  --focus: #3461D6;
  --f-display: "Bricolage Grotesque", "Avenir Next", "Segoe UI", system-ui, sans-serif;
  --f-body: "Atkinson Hyperlegible", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #11141B; --paper: #1B202A; --ink: #E8ECF3; --muted: #99A2B5; --line: #2C3340;
    --star: #F6B23E; --star-empty: #3D4555; --hit: #3DB57D; --near: #F09A45; --miss: #EC5F57; --focus: #7D9CF0;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #11141B; --paper: #1B202A; --ink: #E8ECF3; --muted: #99A2B5; --line: #2C3340;
  --star: #F6B23E; --star-empty: #3D4555; --hit: #3DB57D; --near: #F09A45; --miss: #EC5F57; --focus: #7D9CF0;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 16px; line-height: 1.5;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 24px 48px;
}
.wrap { max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; gap: 20px; }

header { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.brand { display: flex; flex-direction: column; gap: 2px; }
.stars { display: inline-flex; gap: 2px; }
.stars svg { width: 18px; height: 18px; }
.brand .stars svg { width: 22px; height: 22px; }
.star-on { fill: var(--star); }
.star-off { fill: var(--star-empty); }
h1 { font-family: var(--f-display); font-weight: 800; font-size: 44px; line-height: 1; letter-spacing: -0.02em; margin: 4px 0 0; }
.tagline { color: var(--muted); margin: 0; font-size: 15px; }
.meta { font-family: var(--f-mono); font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; text-align: right; }
.meta strong { color: var(--ink); font-weight: 600; }

.clues { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--paper); border: 1px solid var(--line); border-radius: 10px;
  padding: 16px 18px; display: flex; flex-direction: column; gap: 8px;
}
.card.fresh { animation: drop .35s ease-out; }
@keyframes drop { from { transform: translateY(-6px); opacity: .4; } to { transform: none; opacity: 1; } }
.rev-head { display: flex; align-items: center; gap: 10px; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-weight: 700; font-size: 14px; color: #fff;
}
.who { display: flex; flex-direction: column; min-width: 0; }
.who b { font-size: 15px; }
.who span { font-size: 12px; color: var(--muted); font-family: var(--f-mono); }
.rev-line { display: flex; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.rev-text { margin: 0; font-size: 17px; }
.clue-tag {
  font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
}
.hint { border-style: dashed; }
.hint-value { font-family: var(--f-display); font-weight: 800; font-size: 24px; line-height: 1.15; }
.pattern { display: flex; flex-wrap: wrap; gap: 4px 14px; }
.word { display: flex; gap: 3px; }
.tile {
  width: 24px; height: 30px; border-bottom: 2px solid var(--ink);
  display: grid; place-items: end center; font-family: var(--f-mono); font-weight: 600; font-size: 18px; line-height: 1.4;
}
.tile.punct { border-bottom-color: transparent; width: 10px; }
.locked {
  border: 1px dashed var(--line); border-radius: 10px; padding: 12px 18px;
  color: var(--muted); font-size: 14px; display: flex; justify-content: space-between; gap: 10px;
}

.guesses { display: grid; gap: 6px; }
.slot {
  display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: 12px;
  min-height: 42px; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  font-variant-numeric: tabular-nums;
}
.slot.empty { border-style: dashed; }
.slot .g-name { font-weight: 700; min-width: 0; overflow-wrap: anywhere; }
.slot .g-dist { font-family: var(--f-mono); font-size: 14px; }
.slot .g-arrow { font-size: 18px; width: 22px; text-align: center; }
.slot.miss { background: color-mix(in srgb, var(--miss) 12%, var(--paper)); border-color: color-mix(in srgb, var(--miss) 45%, var(--line)); }
.slot.near { background: color-mix(in srgb, var(--near) 14%, var(--paper)); border-color: color-mix(in srgb, var(--near) 50%, var(--line)); }
.slot.hit { background: var(--hit); border-color: var(--hit); color: #fff; }

.guess-form { position: relative; display: flex; gap: 8px; }
.guess-form input {
  flex: 1; min-width: 0; font: inherit; font-size: 17px; padding: 12px 14px;
  border-radius: 8px; border: 1.5px solid var(--line); background: var(--paper); color: var(--ink);
}
.guess-form input:focus { outline: 2px solid var(--focus); outline-offset: 1px; border-color: transparent; }
button {
  font: inherit; font-weight: 700; cursor: pointer; border-radius: 8px; border: none;
  padding: 12px 18px; background: var(--ink); color: var(--bg);
}
button:focus-visible, summary:focus-visible, .arch-btn:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
button:disabled { opacity: .45; cursor: default; }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 5;
  background: var(--paper); border: 1px solid var(--line); border-radius: 8px;
  max-height: 240px; overflow-y: auto; margin: 0; padding: 4px; list-style: none;
  box-shadow: 0 8px 24px rgb(0 0 0 / .14);
}
.suggest li { padding: 8px 10px; border-radius: 6px; cursor: pointer; display: flex; justify-content: space-between; gap: 10px; }
.suggest li span { color: var(--muted); font-size: 13px; }
.suggest li[aria-selected="true"], .suggest li:hover { background: color-mix(in srgb, var(--focus) 14%, var(--paper)); }
.form-note { min-height: 20px; margin: -10px 0 0; font-size: 14px; color: var(--miss); }

.result {
  background: var(--paper); border: 1px solid var(--line); border-radius: 12px; padding: 20px;
  display: flex; flex-direction: column; gap: 12px;
}
.result h2 { font-family: var(--f-display); font-weight: 800; font-size: 30px; line-height: 1.1; margin: 0; text-wrap: balance; }
.result .where { color: var(--muted); margin: -6px 0 0; }
.result p { margin: 0; }
.share-preview {
  font-family: var(--f-mono); font-size: 14px; white-space: pre; background: var(--bg);
  border-radius: 8px; padding: 10px 12px; overflow-x: auto;
}
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.countdown { font-family: var(--f-mono); font-size: 13px; color: var(--muted); }

details { border-top: 1px solid var(--line); padding-top: 14px; }
summary { cursor: pointer; font-weight: 700; }
.archive { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 8px; margin-top: 12px; }
.arch-btn {
  font: inherit; cursor: pointer; padding: 8px 4px; border-radius: 8px; text-align: center;
  border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-family: var(--f-mono); font-size: 13px;
}
.arch-btn.current { border-color: var(--ink); border-width: 2px; }
.arch-btn small { display: block; color: var(--muted); font-size: 11px; }
.how { color: var(--muted); font-size: 14px; margin: 0; }
.how li { margin-bottom: 4px; }
footer { color: var(--muted); font-size: 13px; }
@media (max-width: 420px) {
  h1 { font-size: 36px; }
  .meta { text-align: left; }
  .slot { gap: 8px; padding: 8px 10px; }
}
@media (prefers-reduced-motion: reduce) { .card.fresh { animation: none; } }

/* Page basics the artifact viewer used to provide */
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
[hidden] { display: none !important; }
footer a { color: inherit; }

/* Hint button, stats button and stats dialog */
.locked { align-items: center; }
.hint-btn, .ghost-btn {
  background: var(--paper); color: var(--ink); border: 1px solid var(--line);
  padding: 7px 14px; font-size: 14px; flex: none; display: inline-flex; align-items: center; gap: 6px;
}
.hint-btn:hover, .ghost-btn:hover { border-color: var(--ink); }
.ghost-btn svg { width: 16px; height: 16px; fill: currentColor; }
.head-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
dialog {
  border: 1px solid var(--line); border-radius: 12px; background: var(--paper); color: var(--ink);
  padding: 20px; width: min(420px, calc(100vw - 32px));
}
dialog::backdrop { background: rgb(0 0 0 / .45); }
.dialog-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.dialog-head h2 { font-family: var(--f-display); font-weight: 800; font-size: 26px; margin: 0; }
.close-btn { background: transparent; color: var(--ink); font-size: 26px; line-height: 1; padding: 2px 10px; }
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; text-align: center; margin: 18px 0; }
.stat-grid b { display: block; font-family: var(--f-display); font-weight: 800; font-size: 32px; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-grid span { display: block; font-size: 12px; color: var(--muted); line-height: 1.25; }
.stats-h { font-family: var(--f-mono); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin: 0 0 8px; }
.dist { display: grid; gap: 5px; }
.dist-row { display: grid; grid-template-columns: 14px 1fr; gap: 8px; align-items: center; font-family: var(--f-mono); font-size: 13px; }
.dist-bar {
  background: var(--star-empty); color: var(--ink); border-radius: 4px; padding: 2px 8px;
  text-align: right; font-weight: 600; min-width: 28px; font-variant-numeric: tabular-nums;
}
.dist-bar.today { background: var(--hit); color: #fff; }
.stats-empty { color: var(--muted); font-size: 14px; margin: 14px 0 0; }
@media (max-width: 420px) { .head-right { align-items: flex-start; } }
.slot.hint { border-style: dashed; color: var(--muted); background: color-mix(in srgb, var(--star) 10%, var(--paper)); }

/* Tour link, tip line, footer links */
.visit-link {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--bg);
  color: var(--ink); text-decoration: none; line-height: 1.35;
}
.visit-link:hover { border-color: var(--ink); }
.visit-link:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
.visit-link span:last-child { font-size: 20px; }
.fine { font-size: 12px; color: var(--muted); margin-top: -6px !important; }
.tip-line { font-size: 14px; color: var(--muted); }
.tip-line a { color: var(--ink); font-weight: 700; }
footer p { margin: 0 0 6px; }
.foot-links { display: flex; gap: 16px; }
