:root {
  color-scheme: light;
  --paper: #f7f4e9;
  --ink: #203545;
  --muted: #58636a;
  --line: #c9cbc1;
  --red: #ad351f;
  --green: #287047;
  --red-hover: #90301d;
  --serif: Baskerville, "Iowan Old Style", Georgia, serif;
  background: var(--paper);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0 auto;
  width: min(1040px, 90%);
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font: 16px/1.5 "Helvetica Neue", Arial, sans-serif;
}
main { flex: 1; }
h1, p, ul, ol { margin: 0; }
h1 {
  font: bold italic clamp(40px, 6vw, 68px)/1.05 var(--serif);
  letter-spacing: -.06em;
}
button, input { font: inherit; }
button {
  border: 0;
  padding: 10px 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
}
button:hover, a:hover, summary:hover { color: var(--red); }
button:disabled { opacity: .55; cursor: default; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 4px; }
a { color: inherit; }
nav {
  display: flex;
  gap: 24px;
  align-items: center;
  min-height: 68px;
  border-bottom: 1px solid var(--line);
  font-size: 15px;
}
nav a { padding: 12px 0; text-decoration: none; }
nav a[aria-current="page"] { text-decoration: underline; text-underline-offset: 5px; }
.hero {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 24px;
  padding: clamp(44px, 9vw, 120px) 0;
}
.hero h1 { font-size: clamp(54px, 6.8vw, 86px); }
@media (min-width: 681px) {
  .hero > div { transform: translateY(-20px); }
}
.meta { font: 14px/1.4 "Helvetica Neue", Arial, sans-serif; color: var(--muted); letter-spacing: 0; }
.hero .meta, #result-label { margin-bottom: 12px; }
.deck { margin: 18px 0 26px; max-width: 30ch; font: 24px/1.3 var(--serif); }
.trout { display: block; width: 100%; height: auto; }
.primary {
  padding: 11px 22px;
  border-radius: 3px;
  background: var(--red);
  color: var(--paper);
  font-weight: 600;
}
.primary:hover { background: var(--red-hover); color: var(--paper); }
.page { max-width: 620px; margin: clamp(32px, 6vw, 80px) auto; }
.round-header, .guess-row, .actions { display: flex; align-items: center; gap: 18px; }
.round-header { justify-content: space-between; }
.clock { color: var(--red); font-size: 22px; font-variant-numeric: tabular-nums; }
#clues {
  display: grid;
  gap: 14px;
  margin: 22px 0 28px;
  padding: 0;
  list-style: none;
  font: clamp(24px, 3vw, 34px)/1.2 var(--serif);
}
#guess {
  flex: 1;
  min-width: 0;
  padding: 11px 13px;
  border: 1px solid var(--muted);
  border-radius: 3px;
  background: transparent;
  color: inherit;
  font-size: 18px;
}
#guess:focus {
  outline: none;
  border: 2px solid var(--ink);
  padding: 10px 12px;
}
#guess[data-result="correct"] { border-color: var(--green); }
#guess[data-result="wrong"] { border-color: var(--red); }
#feedback, #share-status { margin-top: 10px; white-space: pre-wrap; }
#guess::placeholder { color: var(--muted); opacity: 1; }
.actions { margin: 24px 0; }
details { border-top: 1px solid var(--line); }
summary { cursor: pointer; padding: 14px 0; }
#review, #days { padding: 0; list-style: none; }
#review li { padding: 5px 0; }
.symbol { display: inline-block; width: 26px; color: var(--muted); }
#days { margin-top: 24px; }
#days li { border-bottom: 1px solid var(--line); }
#days button { width: 100%; display: flex; align-items: center; justify-content: space-between; text-align: left; }
#stats-note { margin-bottom: 12px; }
.totals {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin: 0;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.totals dt, .game-history th { font-size: 14px; font-weight: normal; color: var(--muted); }
.totals dd { margin: 2px 0 0; font: clamp(30px, 6vw, 46px)/1.1 var(--serif); font-variant-numeric: lining-nums tabular-nums; }
.totals small { font-size: .45em; color: var(--muted); }
#stats h2 { margin: 24px 0 8px; font: bold 22px/1.2 var(--serif); }
#score-chart {
  display: grid;
  grid-template-columns: repeat(21, minmax(0, 1fr));
  height: 88px;
  margin: 20px 0 38px;
  padding-top: 12px;
  border-bottom: 1px solid var(--line);
  font: 12px/1.2 "Helvetica Neue", Arial, sans-serif;
  font-variant-numeric: tabular-nums;
}
#score-chart > div { position: relative; text-align: center; }
.score-bar {
  position: absolute;
  bottom: 0;
  inset-inline: 15%;
  background: var(--red);
}
.score-bar[data-count] { min-height: 2px; }
.score-bar::before {
  content: attr(data-count);
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
}
.score-tick { position: absolute; inset: calc(100% + 4px) 0 auto; color: var(--muted); }
.game-history { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.game-history th, .game-history td { padding: 4px 0; text-align: right; }
.game-history th:first-child { text-align: left; }
.game-history tbody th { font-size: inherit; color: var(--ink); }
.game-history a { display: inline-block; padding: 4px 10px 4px 0; text-underline-offset: 3px; }
.game-history tfoot { border-top: 1px solid var(--line); }
.game-history tfoot > tr > * { padding-top: 8px; }
#more-history { font-size: 14px; text-decoration: underline; text-underline-offset: 3px; }
#error { margin-bottom: 20px; color: var(--red); }
footer { padding: 18px 0; color: var(--muted); font-size: 12px; }
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --paper: #152631;
    --ink: #f4eddc;
    --muted: #b4bebb;
    --line: #465760;
    --red: #ff8667;
    --green: #84d6a5;
    --red-hover: #ff9e85;
  }
}
@media (max-width: 680px) {
  nav { min-height: 54px; }
  button { min-height: 44px; min-width: 44px; }
  #game { margin-block: 12px; }
  #clues { gap: 8px; margin: 12px 0 16px; font-size: clamp(21px, 5.5vw, 26px); overflow-wrap: anywhere; }
  .guess-row { gap: 8px; }
  .hero { grid-template-columns: 1fr; gap: 28px; padding: 36px 0 24px; }
  .trout { width: min(85%, 320px); justify-self: center; }
  .deck { font-size: 22px; }
}
