/* Heißl – newspaper look: serif display type, square corners, rules instead of cards. */

:root {
  --bg: #FBFBF9;
  --ink: #17202A;
  --muted: #5E6873;
  --rule: #D5DADE;
  --track: #E6E9EC;
  --faint: #A3ACB4;
  --scrim: rgba(23, 32, 42, 0.45);
  --hot: #E8452C;
  --warm: #F2A516;
  --mild: #2FA89A;
  --cold: #3B82C4;
  --serif: ui-serif, "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1418;
    --ink: #EDF2F5;
    --muted: #9AA6B0;
    --rule: #2C3640;
    --track: #222B33;
    --faint: #5C6873;
    --scrim: rgba(0, 0, 0, 0.6);
    --hot: #FF6A50;
    --warm: #F7B940;
    --mild: #43C4B3;
    --cold: #5EA3E6;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.4;
  -webkit-tap-highlight-color: transparent;
}

main {
  max-width: 30rem;
  margin: 0 auto;
  padding: max(14px, env(safe-area-inset-top)) 20px calc(28px + env(safe-area-inset-bottom));
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

h1, h2 { margin: 0; }

a { color: inherit; }

:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* Small uppercase labels */
.label, .kicker, .thead, .stat-label, .best-head, .lc-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}

/* -- buttons -------------------------------------------------------------- */

.btn {
  font-family: inherit;
  border-radius: 0;
  cursor: pointer;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-height: 44px;
}
.btn:disabled { opacity: 0.45; cursor: default; }
.btn-solid { border: none; background: var(--ink); color: var(--bg); font-size: 14px; padding: 0 20px; }
.btn-outline { border: 1.5px solid var(--ink); background: transparent; color: var(--ink); font-size: 14px; padding: 0 14px; }
.btn-small { font-size: 13px; }
.btn-text {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  padding: 0 8px;
  text-decoration: underline;
  text-underline-offset: 4px;
}
.btn-big { height: 50px; font-size: 14px; letter-spacing: 0.08em; }

/* -- masthead + nav --------------------------------------------------------- */

.masthead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 3px solid var(--ink);
}
.masthead h1 {
  font-family: var(--serif);
  font-size: 40px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 0.9;
}
.masthead-meta {
  text-align: right;
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.masthead-no { font-weight: 700; color: var(--ink); letter-spacing: 0.06em; text-transform: uppercase; }

.nav { display: flex; justify-content: space-between; border-bottom: 1px solid var(--rule); }
.nav-link {
  min-height: 44px;
  display: flex;
  align-items: center;
  padding: 0;
  border: none;
  background: none;
  color: var(--ink);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
}

.banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  margin-top: 12px;
  background: var(--ink);
  color: var(--bg);
}
.banner-label { font-size: 12px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; }
.banner-link {
  min-height: 44px;
  margin: -6px 0;
  display: flex;
  align-items: center;
  color: var(--bg);
  font-size: 13px;
  font-weight: 600;
  text-underline-offset: 3px;
}

/* -- input -------------------------------------------------------------- */

.guess-form { display: flex; align-items: flex-end; gap: 12px; margin-top: 22px; }
.guess-form input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 2px;
  border: none;
  border-bottom: 2px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font-family: var(--serif);
  font-size: 22px;
  outline: none;
}
.guess-form input::placeholder { color: var(--muted); opacity: 1; }
.guess-form .btn { height: 48px; font-size: 15px; }

.message {
  margin: 10px 0 0;
  font-family: var(--serif);
  font-size: 15px;
  font-style: italic;
  color: var(--muted);
}
.message:empty { display: none; }
.message.shake { animation: shake 0.35s; }
@keyframes shake {
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.intro {
  margin: 26px 0 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.45;
  font-style: italic;
  color: var(--muted);
}

/* -- temperature ------------------------------------------------------------- */

.dot { display: inline-block; flex: none; width: 10px; height: 10px; }
.t-hot { background: var(--hot); }
.t-warm { background: var(--warm); }
.t-mild { background: var(--mild); }
.t-cold { background: var(--cold); }

/* -- last guess ---------------------------------------------------------------- */

.last { margin-top: 26px; display: flex; flex-direction: column; gap: 14px; }
.last-main { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.last-left { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.last-word {
  font-family: var(--serif);
  font-size: 48px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 0.95;
  overflow-wrap: anywhere;
}
.last-temp { display: flex; align-items: center; gap: 7px; font-size: 14px; font-weight: 600; }
.last-right { text-align: right; flex: none; }
.last-rank {
  font-family: var(--serif);
  font-size: 64px;
  font-weight: 700;
  line-height: 0.85;
  font-variant-numeric: tabular-nums;
}
.last-right .label { margin-top: 6px; }

.scale { display: flex; flex-direction: column; gap: 4px; }
.segs { display: flex; gap: 2px; height: 8px; }
.segs > div { height: 100%; flex-basis: 0; opacity: 0.3; }
.segs > div.on { opacity: 1; }
.marker-row { position: relative; height: 10px; }
.marker {
  position: absolute;
  top: 0;
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-bottom: 9px solid var(--ink);
  transform: translateX(-50%);
}
.seg-labels { display: flex; gap: 2px; font-size: 11px; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.seg-labels > div { flex-basis: 0; min-width: 0; overflow: hidden; white-space: nowrap; }

/* -- counter + give up --------------------------------------------------------- */

.counter-row {
  margin-top: 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 6px 0;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.counter { font-size: 15px; font-variant-numeric: tabular-nums; }
.counter strong { font-weight: 700; }
.counter .sep { color: var(--muted); }
.counter-actions { display: flex; align-items: center; gap: 6px; }

.confirm {
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 14px 0 16px;
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--rule);
}
.confirm-title { font-family: var(--serif); font-size: 22px; font-weight: 700; outline: none; }
.confirm-text { font-family: var(--serif); font-size: 16px; line-height: 1.45; color: var(--muted); }
.confirm-buttons { display: flex; gap: 8px; }
.confirm-buttons .btn { flex: 1; height: 46px; }

/* -- guess table --------------------------------------------------------------- */

.table { margin-top: 22px; display: flex; flex-direction: column; }
.thead, .guesses li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 52px;
  column-gap: 12px;
}
.thead { padding-bottom: 6px; border-bottom: 2px solid var(--ink); }
.num { text-align: right; }
.guesses { list-style: none; margin: 0; padding: 0; }
.guesses li { align-items: center; min-height: 46px; border-bottom: 1px solid var(--rule); }
.gw { display: flex; align-items: baseline; gap: 6px; min-width: 0; }
.gw-word {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tag { font-size: 10px; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); }
.guesses li.is-hint .gw-word { font-style: italic; }
.guesses li.is-latest .gw-word { font-weight: 700; }
.bar { height: 6px; background: var(--track); }
.bar > i { display: block; height: 100%; }
.gr { text-align: right; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }
.guesses li.flash { animation: flash 1.2s; }
@keyframes flash {
  0%, 40% { background: var(--track); }
}

/* -- typing (keyboard open on touch devices): see ZTippen ------------------------- */

.last-compact, .best-head { display: none; }

body.typing main { padding-top: 6px; }
body.typing .masthead,
body.typing .nav,
body.typing .banner,
body.typing .intro,
body.typing .last,
body.typing .counter-row,
body.typing .confirm,
body.typing .thead,
body.typing .love,
body.typing .tag-latest { display: none !important; }
body.typing .guess-form { margin-top: 0; }
body.typing .guess-form input { height: 46px; }
body.typing .guess-form .btn { height: 44px; padding: 0 18px; font-size: 14px; }
body.typing .last-compact.has { display: flex; }
body.typing .best-head.has { display: flex; }
body.typing .table { margin-top: 0; }
body.typing .guesses li { grid-template-columns: minmax(0, 1fr) 96px 44px; min-height: 40px; }
body.typing .gw-word { font-size: 18px; }
body.typing .bar { height: 5px; }
body.typing .gr { font-size: 15px; }

.last-compact { margin-top: 10px; flex-direction: column; }
.lc-row { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.lc-label { font-size: 10px; }
.lc-word { font-family: var(--serif); font-size: 21px; font-weight: 700; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-temp { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.lc-temp .dot { width: 8px; height: 8px; }
.lc-spacer { flex: 1; }
.lc-rank { font-family: var(--serif); font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.lc-scale { position: relative; }
.lc-scale .segs { height: 4px; }
.lc-marker { position: absolute; top: -4px; width: 2px; height: 12px; background: var(--ink); transform: translateX(-1px); }
.best-head {
  justify-content: space-between;
  padding: 8px 0 6px;
  border-bottom: 1px solid var(--rule);
  font-size: 10px;
}

/* -- result (solved / given up) ---------------------------------------------- */

.result-head { position: relative; margin-top: 22px; display: flex; flex-direction: column; gap: 10px; }
.result-head.solved { margin-top: 18px; padding-top: 54px; }
.kicker { letter-spacing: 0.16em; }
.result-pre { font-family: var(--serif); font-size: 19px; font-style: italic; color: var(--muted); }
.result-word {
  position: relative;
  font-family: var(--serif);
  font-size: 80px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 0.9;
  overflow-wrap: anywhere;
}
.result-text {
  margin: 4px 0 0;
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.4;
  text-wrap: pretty;
}
.result-head.solved .result-text { font-size: 19px; font-style: italic; }
.confetti { position: absolute; inset: 0; pointer-events: none; }
/* Pieces start on the word's centre and burst to (--to-x, --to-y). The end
   state is the base style, so reduced motion simply shows them settled. */
.confetti i {
  position: absolute;
  display: block;
  translate: var(--to-x) var(--to-y);
  rotate: var(--rot);
  opacity: var(--end-opacity, 1);
  animation: burst 1.3s cubic-bezier(0.15, 0.8, 0.3, 1) backwards;
}
@keyframes burst {
  from { opacity: 0; translate: 0 0; rotate: 0deg; scale: 0.3; }
  15% { opacity: 1; scale: 1; }
}
@media (prefers-reduced-motion: reduce) {
  .confetti i, .message.shake, .guesses li.flash { animation: none; }
}

.stat-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}
.stat { display: flex; flex-direction: column; gap: 2px; padding: 12px 0; }
.stat + .stat { padding-left: 14px; border-left: 1px solid var(--rule); }
.stat-num { font-family: var(--serif); font-size: 30px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stat-label { font-size: 10px; }
.stat-row-small { margin-top: 24px; }
.stat-row-big { border-top: 2px solid var(--ink); }
.stat-row-big .stat { padding: 16px 0 14px; gap: 4px; }
.stat-row-big .stat + .stat { padding-left: 16px; }
.stat-row-big .stat-num { font-size: 40px; line-height: 1; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--ink);
}
.section-head h2 { font-family: var(--serif); font-size: 20px; font-weight: 700; }
.section-head span { font-size: 11px; color: var(--muted); }

.share { margin-top: 24px; display: flex; flex-direction: column; gap: 10px; }
.share-text {
  margin: 0;
  padding: 12px 14px;
  border: 1px solid var(--rule);
  font-family: inherit;
  font-size: 15px;
  line-height: 1.55;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.share .btn { height: 48px; letter-spacing: 0.08em; }

.top-section { margin-top: 28px; display: flex; flex-direction: column; }
.top {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-flow: column;
  column-gap: 20px;
}
.top li { display: flex; align-items: center; gap: 8px; min-height: 38px; min-width: 0; border-bottom: 1px solid var(--rule); }
.top-rank { min-width: 22px; font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.top .dot { width: 7px; height: 7px; }
.top-word {
  flex: 1;
  min-width: 0;
  font-family: var(--serif);
  font-size: 17px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.top li.mine .top-word { font-weight: 700; }
.top li.tipped .top-word { font-weight: 700; font-style: italic; }
.top-mark { font-size: 12px; font-weight: 700; color: var(--muted); }

.cta {
  margin-top: 26px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 6px 2px;
  border-top: 3px solid var(--ink);
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
}
.cta-text { display: flex; flex-direction: column; gap: 2px; }
.cta-title { font-family: var(--serif); font-size: 19px; font-weight: 700; }
.cta-sub { font-size: 13px; color: var(--muted); }
.cta-go { flex: none; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }

.tomorrow { margin: 26px 0 0; text-align: center; font-family: var(--serif); font-size: 16px; font-style: italic; }

.love { margin-top: 26px; text-align: center; font-size: 13px; color: var(--muted); }
#view-game:not([hidden]):has(#result:not([hidden]) #tomorrow:not([hidden])) ~ .love { margin-top: 6px; }

/* -- archive ---------------------------------------------------------------- */

#view-archive { margin-top: -8px; }
.back {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
}
.archive-intro {
  margin: 12px 0 0;
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.45;
  font-style: italic;
  color: var(--muted);
}
.tabs { margin-top: 16px; display: flex; gap: 22px; border-bottom: 1px solid var(--rule); }
.tab {
  min-height: 44px;
  padding: 0;
  margin-bottom: -1px;
  border: none;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  font-family: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}
.tab[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tab-count { font-weight: 500; color: var(--muted); }

.month {
  margin-top: 18px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--ink);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.arow {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  column-gap: 12px;
  align-items: center;
  min-height: 64px;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  text-decoration: none;
}
.arow-no {
  font-family: var(--serif);
  font-size: 30px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--faint);
}
.arow-mid { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.arow-date { font-size: 15px; font-weight: 600; }
.arow-status { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); }
.arow-status .dot { width: 7px; height: 7px; }
.arow-cta { font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.arow.playable .arow-no, .arow.playable .arow-cta { color: var(--ink); }
.st-won { background: var(--mild); }
.st-lost { background: var(--faint); }
.st-started { background: var(--hot); }
.st-open { background: transparent; }
.archive-empty { margin: 18px 0 0; font-family: var(--serif); font-style: italic; color: var(--muted); }

/* -- bottom sheets ----------------------------------------------------------- */

.sheet {
  position: fixed;
  inset: auto 0 0 0;
  width: 100%;
  max-width: 30rem;
  max-height: calc(100dvh - 44px);
  margin: 0 auto;
  padding: 0;
  border: none;
  border-top: 3px solid var(--ink);
  border-radius: 0;
  background: var(--bg);
  color: var(--ink);
  overflow: auto;
}
.sheet::backdrop { background: var(--scrim); }
.sheet-tall { height: calc(100dvh - 44px); }
.sheet-body {
  min-height: 100%;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 14px 22px calc(28px + env(safe-area-inset-bottom));
}
#stats-sheet .sheet-body { gap: 14px; padding-bottom: calc(34px + env(safe-area-inset-bottom)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; }
.sheet-head h2 { outline: none; font-family: var(--serif); font-size: 32px; font-weight: 700; letter-spacing: -0.02em; }
.close {
  width: 44px;
  height: 44px;
  margin-right: -10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
}
.sheet-lead { margin: 0; font-family: var(--serif); font-size: 18px; line-height: 1.5; text-wrap: pretty; }
.sheet-note { margin: 0; font-family: var(--serif); font-size: 16px; line-height: 1.5; color: var(--muted); text-wrap: pretty; }
.sheet-fine { margin: 0; font-family: var(--serif); font-size: 15px; font-style: italic; color: var(--muted); }
.sheet-spacer { flex: 1; }

.example { display: flex; flex-direction: column; }
.example-head {
  display: flex;
  justify-content: space-between;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--ink);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
}
.example-rows { list-style: none; margin: 0; padding: 0; }
.example-rows li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px 52px;
  column-gap: 12px;
  align-items: center;
  min-height: 40px;
  border-bottom: 1px solid var(--rule);
}
.example-rows .ew { font-family: var(--serif); font-size: 18px; }
.example-rows .bar { height: 5px; }
.example-rows .gr { font-size: 15px; }

.legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: 20px;
}
.legend li { display: flex; align-items: center; gap: 8px; min-height: 34px; border-bottom: 1px solid var(--rule); }
.legend .dot { width: 9px; height: 9px; }
.legend b { font-size: 15px; }
.legend span { font-size: 13px; color: var(--muted); }
