/* Insight Check: mobile-first, light and dark themes, no external fonts. */

:root {
  color-scheme: light;
  --bg: #f5efe4;
  --surface: #fffdf8;
  --surface-2: #f0e8da;
  --text: #241d18;
  --muted: #6c6158;
  --border: #ddd1bf;
  --accent: #8e2318;
  --accent-text: #fff8f0;
  --focus: #1f5fbf;
  --parchment: #fbf3e2;
  --parchment-edge: #e5d3b3;
  --sb-red: #7c2014;
  --redact: #2c241e;
  --match: #2e7d3f;
  --match-text: #ffffff;
  --partial: #b98309;
  --partial-text: #1d1503;
  --miss: #a33a2f;
  --miss-text: #ffffff;
  --skip: #6f655b;
  --shadow: 0 1px 2px rgb(60 40 20 / 0.08), 0 4px 16px rgb(60 40 20 / 0.08);
  --radius: 12px;
  --font-ui: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #16120f;
  --surface: #211b17;
  --surface-2: #2b241e;
  --text: #f0e8dd;
  --muted: #b2a597;
  --border: #3d332b;
  --accent: #e0655a;
  --accent-text: #1a0d0a;
  --focus: #7fb0ff;
  --parchment: #261f19;
  --parchment-edge: #4a3b2c;
  --sb-red: #ec8a74;
  --redact: #d9cbb8;
  --match: #2e7d3f;
  --match-text: #ffffff;
  --partial: #d6a21b;
  --partial-text: #1d1503;
  --miss: #b9473b;
  --miss-text: #ffffff;
  --skip: #6f655b;
  --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 4px 18px rgb(0 0 0 / 0.35);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #16120f;
    --surface: #211b17;
    --surface-2: #2b241e;
    --text: #f0e8dd;
    --muted: #b2a597;
    --border: #3d332b;
    --accent: #e0655a;
    --accent-text: #1a0d0a;
    --focus: #7fb0ff;
    --parchment: #261f19;
    --parchment-edge: #4a3b2c;
    --sb-red: #ec8a74;
    --redact: #d9cbb8;
    --match: #2e7d3f;
    --match-text: #ffffff;
    --partial: #d6a21b;
    --partial-text: #1d1503;
    --miss: #b9473b;
    --miss-text: #ffffff;
    --skip: #6f655b;
    --shadow: 0 1px 2px rgb(0 0 0 / 0.4), 0 4px 18px rgb(0 0 0 / 0.35);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
}

a {
  color: var(--accent);
}

button,
input {
  font: inherit;
  color: inherit;
}

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

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

.skip-link {
  position: absolute;
  left: 8px;
  top: -48px;
  z-index: 50;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--accent);
  color: var(--accent-text);
}

.skip-link:focus {
  top: 8px;
}

.muted {
  color: var(--muted);
}

/* ---------- header ---------- */

.site-header {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 16px 4px;
}

.brand {
  text-align: center;
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: clamp(1.5rem, 6vw, 2rem);
  font-weight: 700;
  font-variant: small-caps;
  letter-spacing: 0.04em;
  line-height: 1.1;
}

.brand h1 a {
  color: var(--text);
  text-decoration: none;
}

.puzzle-meta {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.875rem;
}

.header-actions {
  display: flex;
  gap: 4px;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--text);
  cursor: pointer;
}

.icon-btn:hover {
  background: var(--surface-2);
}

.icon-btn svg {
  width: 24px;
  height: 24px;
}

.icon-sun {
  display: none;
}

:root[data-theme="dark"] .icon-sun {
  display: block;
}

:root[data-theme="dark"] .icon-moon {
  display: none;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun {
    display: block;
  }

  :root:not([data-theme="light"]) .icon-moon {
    display: none;
  }
}

/* ---------- tabs ---------- */

.mode-tabs {
  display: flex;
  gap: 6px;
  width: 100%;
  max-width: 720px;
  margin: 8px auto 0;
  padding: 0 16px;
}

.mode-tabs [role="tab"] {
  flex: 1;
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-bottom-width: 3px;
  border-radius: 10px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.mode-tabs [role="tab"][aria-selected="true"] {
  border-color: var(--accent);
  color: var(--text);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.tab-status {
  font-size: 0.85em;
}

.tab-label {
  white-space: nowrap;
}

/* Narrow screens: icon above label so two or three tabs always fit evenly. */
@media (max-width: 480px) {
  .mode-tabs [role="tab"] {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 6px 4px;
    font-size: 0.9rem;
  }
}

/* ---------- layout ---------- */

main {
  flex: 1;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 12px 16px 24px;
}

main:focus {
  outline: none;
}

.loading,
.notice {
  padding: 32px 0;
  text-align: center;
  color: var(--muted);
}

.archive-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px dashed var(--accent);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 0.95rem;
}

.site-footer {
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  padding: 8px 16px 24px;
  text-align: center;
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer p {
  margin: 4px 0;
}

.link-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--accent);
  text-decoration: underline;
  cursor: pointer;
}

/* ---------- buttons and inputs ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 44px;
  padding: 8px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn:hover {
  background: var(--surface-2);
}

.btn.primary {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--accent-text);
}

.btn.primary:hover {
  filter: brightness(1.08);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.guess-form {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  margin: 14px 0 6px;
}

.guess-form.has-skip {
  grid-template-columns: 1fr auto auto;
}

.combo {
  position: relative;
  min-width: 0;
}

.combo input {
  width: 100%;
  min-height: 48px;
  padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 1rem;
}

.combo input:focus {
  border-color: var(--focus);
  outline: none;
}

.combo input::placeholder {
  color: var(--muted);
}

.listbox {
  position: absolute;
  z-index: 20;
  left: 0;
  right: 0;
  top: calc(100% + 4px);
  max-height: min(320px, 50vh);
  margin: 0;
  padding: 4px;
  overflow-y: auto;
  list-style: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.listbox[hidden] {
  display: none;
}

.listbox li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 10px;
  border-radius: 8px;
  cursor: pointer;
}

.listbox li .sub {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
}

.listbox li[aria-selected="true"],
.listbox li:hover {
  background: var(--surface-2);
}

.listbox li[aria-selected="true"] {
  outline: 2px solid var(--focus);
  outline-offset: -2px;
}

.listbox .empty {
  color: var(--muted);
  cursor: default;
}

.guess-status {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin: 2px 2px 10px;
  color: var(--muted);
  font-size: 0.9rem;
}

.pips {
  display: inline-flex;
  gap: 4px;
}

.pip {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.pip.miss {
  background: var(--miss);
  border-color: var(--miss);
}

.pip.skip {
  background: var(--skip);
  border-color: var(--skip);
}

.pip.match {
  background: var(--match);
  border-color: var(--match);
}

/* ---------- stat block card ---------- */

.statblock {
  position: relative;
  margin: 4px 0 0;
  padding: 14px 16px 16px;
  border: 1px solid var(--parchment-edge);
  border-top: 4px solid var(--sb-red);
  border-bottom: 4px solid var(--sb-red);
  border-radius: 6px;
  background: var(--parchment);
  font-family: var(--font-serif);
  box-shadow: var(--shadow);
}

.sb-name {
  margin: 0;
  color: var(--sb-red);
  font-size: 1.55rem;
  font-variant: small-caps;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.15;
}

.sb-name .unknown {
  letter-spacing: 0.12em;
}

.sb-meta {
  margin: 2px 0 0;
  font-style: italic;
}

.sb-rule {
  height: 3px;
  margin: 10px 0;
  border: 0;
  background: linear-gradient(to right, var(--sb-red), transparent);
}

.sb-line {
  margin: 2px 0;
  overflow-wrap: anywhere;
}

.sb-line b {
  color: var(--sb-red);
}

.sb-pair {
  display: flex;
  flex-wrap: wrap;
  gap: 0 18px;
}

.abilities {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  margin: 4px 0;
}

/* One column definition for the MOD/SAVE headings and every ability row, in rem so the
   smaller heading font can't shift the columns: name, score, modifier, saving throw. */
.ability,
.abilities-head span {
  display: grid;
  grid-template-columns: 2.4rem repeat(3, minmax(0, 1fr));
  column-gap: 2px;
}

.ability {
  align-items: baseline;
  padding: 4px 6px;
  border-radius: 6px;
  background: color-mix(in srgb, var(--parchment-edge) 45%, transparent);
  font-family: var(--font-ui);
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
}

.ability .ab-name {
  font-weight: 700;
  color: var(--sb-red);
  font-variant: small-caps;
  text-transform: lowercase;
  font-size: 1.05em;
}

.ability .ab-score {
  font-weight: 700;
}

.ability .ab-save {
  color: var(--muted);
}

.abilities-head {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 0.65rem;
  color: var(--muted);
  letter-spacing: 0.06em;
}

.abilities-head span {
  padding: 0 6px;
}

.abilities-head span i {
  font-style: normal;
}

@media (max-width: 420px) {
  .abilities,
  .abilities-head {
    grid-template-columns: repeat(2, 1fr);
  }

  .abilities-head span:nth-child(3) {
    display: none;
  }
}

.sb-section-title {
  margin: 12px 0 4px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--sb-red);
  color: var(--sb-red);
  font-size: 1.1rem;
  font-variant: small-caps;
  font-weight: 600;
}

.sb-entry {
  margin: 6px 0;
}

.sb-entry p {
  margin: 0 0 4px;
}

.sb-entry .entry-name {
  font-weight: 700;
  font-style: italic;
}

.locked {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  padding: 8px 10px;
  border: 1px dashed var(--parchment-edge);
  border-radius: 6px;
  color: var(--muted);
  font-family: var(--font-ui);
  font-size: 0.85rem;
}

.locked svg {
  flex: none;
  width: 16px;
  height: 16px;
}

.fresh {
  animation: reveal 0.6s ease-out;
}

@keyframes reveal {
  from {
    background-color: color-mix(in srgb, var(--partial) 35%, transparent);
  }
}

@media (prefers-reduced-motion: reduce) {
  .fresh {
    animation: none;
  }
}

.redact {
  display: inline-block;
  width: 4.5em;
  height: 0.95em;
  vertical-align: -0.1em;
  border-radius: 2px;
  background: var(--redact);
}

/* ---------- guess rows ---------- */

.guesses {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guess {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.guess.win {
  border-color: var(--match);
  box-shadow: 0 0 0 1px var(--match);
}

.guess-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  font-weight: 700;
}

.guess-head .guess-sub {
  color: var(--muted);
  font-weight: 400;
  font-size: 0.85rem;
  text-align: right;
}

.guess.skipped {
  color: var(--muted);
  font-style: italic;
}

.chips {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 560px) {
  .chips {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

.chips.spell {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  min-width: 0;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  line-height: 1.25;
}

.chips .chip {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-rows: auto auto;
  column-gap: 6px;
  align-items: center;
}

/* full-strength colour: every chip colour pair is at least 4.5:1 (WCAG AA) */
.chip .chip-title {
  grid-column: 2;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.chip .chip-label {
  grid-column: 2;
  overflow-wrap: anywhere;
}

.chip .chip-icon {
  grid-row: 1 / span 2;
  font-size: 1rem;
  line-height: 1;
}

.chip.match {
  background: var(--match);
  color: var(--match-text);
}

.chip.partial {
  background: var(--partial);
  color: var(--partial-text);
}

.chip.miss {
  background: var(--miss);
  color: var(--miss-text);
}

.legend {
  display: grid;
  gap: 6px;
  margin: 8px 0;
  padding: 0;
  list-style: none;
}

.legend .chip {
  min-width: 5.5em;
}

/* ---------- result ---------- */

.result {
  margin: 14px 0;
  padding: 16px;
  border-radius: var(--radius);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  text-align: center;
}

.result h2 {
  margin: 0 0 4px;
  font-family: var(--font-serif);
  font-size: 1.5rem;
}

/* headings focused by script (for screen readers) are not controls */
.result h2:focus {
  outline: none;
}

.result p {
  margin: 4px 0;
}

.result .answer {
  font-weight: 700;
  color: var(--accent);
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 12px;
}

.countdown {
  font-variant-numeric: tabular-nums;
}

.reveal-title {
  margin: 18px 0 8px;
  font-size: 1rem;
  color: var(--muted);
  text-align: center;
  font-weight: 600;
}

/* ---------- spell card ---------- */

.spell-card {
  padding: 14px 16px;
  border: 1px solid var(--parchment-edge);
  border-left: 4px solid var(--sb-red);
  border-radius: 6px;
  background: var(--parchment);
  font-family: var(--font-serif);
  box-shadow: var(--shadow);
}

.spell-card h3 {
  margin: 0;
  color: var(--sb-red);
  font-size: 1.4rem;
  font-variant: small-caps;
}

.spell-card .spell-header {
  margin: 0 0 8px;
  font-style: italic;
}

.spell-card dl {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 2px 10px;
  margin: 0 0 10px;
  font-family: var(--font-ui);
  font-size: 0.9rem;
}

.spell-card dt {
  font-weight: 700;
}

.spell-card dd {
  margin: 0;
}

.spell-card .desc p {
  margin: 0 0 8px;
}

.hint-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.8rem;
}

.hint-legend span::before {
  content: "";
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 4px;
  border-radius: 2px;
  vertical-align: -1px;
}

.hint-legend .l-match::before {
  background: var(--match);
}

.hint-legend .l-partial::before {
  background: var(--partial);
}

.hint-legend .l-miss::before {
  background: var(--miss);
}

.spell-intro {
  margin: 4px 0 0;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.spell-intro h2 {
  margin: 0 0 4px;
  font-family: var(--font-serif);
  font-size: 1.25rem;
}

.spell-intro p {
  margin: 0;
  color: var(--muted);
}

/* ---------- mimic ---------- */

.chests {
  display: grid;
  gap: 10px;
  margin: 12px 0;
  padding: 0;
  list-style: none;
}

@media (min-width: 560px) {
  .chests {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

.chest {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.chest.revealed.mimic {
  border-color: var(--miss);
}

.chest.revealed.real {
  border-color: var(--match);
}

.chest-head {
  display: flex;
  align-items: center;
  gap: 10px;
}

.chest-art {
  flex: none;
  width: 48px;
  height: 40px;
}

.chest-art .lid,
.chest-art .body {
  fill: #9a6a3c;
  stroke: #4a2f17;
  stroke-width: 2;
}

.chest-art .band {
  fill: #c9a227;
}

.chest-art .lock {
  fill: #e0c15a;
  stroke: #4a2f17;
  stroke-width: 1.5;
}

.chest-art .coin {
  fill: #f2c94c;
  stroke: #a8811b;
  stroke-width: 1.5;
}

.chest-art .teeth {
  fill: none;
  stroke: #fff;
  stroke-width: 2.4;
  stroke-linejoin: round;
}

.chest-art .eye {
  fill: #ffd84a;
  stroke: #3a1a0a;
  stroke-width: 1.5;
}

.chest-art.mimic .lid,
.chest-art.mimic .body {
  fill: #7a3b2e;
}

.statement {
  margin: 0;
  padding: 8px 12px;
  border-left: 3px solid var(--parchment-edge);
  border-radius: 0 8px 8px 0;
  background: var(--parchment);
  font-family: var(--font-serif);
  font-size: 1.05rem;
}

.segmented {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  margin: 0;
  padding: 0;
  border: 0;
}

.segmented input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.segmented label {
  display: grid;
  place-items: center;
  min-height: 44px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-weight: 600;
  cursor: pointer;
}

.segmented label:first-of-type {
  border-radius: 10px 0 0 10px;
}

.segmented label:last-of-type {
  border-radius: 0 10px 10px 0;
}

.segmented input:checked + label {
  color: #fff;
}

.segmented input[value="false"]:checked + label {
  border-color: var(--match);
  background: var(--match);
}

.segmented input[value="true"]:checked + label {
  border-color: var(--miss);
  background: var(--miss);
}

.segmented input:focus-visible + label {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

.chest-verdict {
  margin: 0;
  font-weight: 700;
}

.chest-verdict.mimic {
  color: var(--miss);
}

.chest-verdict.real {
  color: var(--match);
}

.mimic-actions {
  display: flex;
  justify-content: center;
  margin: 4px 0 8px;
}

.mimic-actions .btn {
  min-width: 60%;
}

/* ---------- tester build (Android app only; js/tester.js sets data-build) ---------- */

:root[data-build="tester"] [data-daily-only] {
  display: none !important;
}

/* The app draws edge to edge on Android 15+: keep content clear of the system bars. */
:root[data-build="tester"] .site-header {
  padding-top: calc(12px + env(safe-area-inset-top, 0px));
}

:root[data-build="tester"] .site-footer {
  padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.tester-badge {
  display: inline-block;
  padding: 1px 10px;
  border-radius: 999px;
  background: var(--accent);
  color: var(--accent-text);
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.03em;
}

.tester-note {
  padding: 8px 12px;
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--surface-2);
}

.tester-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 0 0 10px;
  padding: 8px 10px;
  border: 1px dashed var(--border);
  border-radius: var(--radius);
  background: var(--surface);
}

.tester-nav {
  display: flex;
  gap: 6px;
}

.tester-nav .btn {
  min-width: 44px;
  padding: 6px 10px;
}

.list-modes {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 4px 0 8px;
}

.list-modes .btn[aria-pressed="true"] {
  border-color: var(--accent);
  box-shadow: inset 0 -3px 0 var(--accent);
}

.puzzle-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(48px, 1fr));
  gap: 6px;
  max-height: 50vh;
  margin: 10px 0;
  padding: 2px;
  overflow-y: auto;
  list-style: none;
}

.puzzle-grid button {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}

.puzzle-grid button.won {
  border-color: var(--match);
  background: var(--match);
  color: var(--match-text);
}

.puzzle-grid button.lost {
  border-color: var(--miss);
  background: var(--miss);
  color: var(--miss-text);
}

.puzzle-grid button.started {
  border-color: var(--partial);
  background: var(--partial);
  color: var(--partial-text);
}

.puzzle-grid button[aria-current="true"] {
  outline: 3px solid var(--focus);
  outline-offset: 1px;
}

/* ---------- modal dialogs ---------- */

.modal {
  width: min(560px, calc(100vw - 24px));
  max-height: calc(100dvh - 24px);
  overflow-x: hidden;
  overflow-y: auto;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow);
}

.modal::backdrop {
  background: rgb(10 6 3 / 0.55);
}

.modal-body {
  position: relative;
  padding: 20px 20px 22px;
}

.modal h2 {
  margin: 0 0 8px;
  padding-right: 40px;
  font-family: var(--font-serif);
}

.modal h3 {
  margin: 16px 0 4px;
}

.modal-close {
  position: absolute;
  top: 10px;
  right: 10px;
  font-size: 1.1rem;
}

.help-steps {
  margin: 4px 0 8px;
  padding-left: 1.4em;
}

.stats-mode {
  margin: 14px 0 6px;
}

.stats-mode h3 {
  margin: 0 0 8px;
}

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  text-align: center;
}

.stat-tiles div {
  padding: 6px 2px;
  border-radius: 8px;
  background: var(--surface-2);
}

.stat-tiles strong {
  display: block;
  font-size: 1.35rem;
  font-variant-numeric: tabular-nums;
}

.stat-tiles span {
  font-size: 0.72rem;
  color: var(--muted);
}

.dist {
  display: grid;
  gap: 3px;
  margin: 10px 0 0;
  padding: 0;
  list-style: none;
  font-size: 0.85rem;
}

.dist li {
  display: grid;
  grid-template-columns: 1.6em 1fr;
  align-items: center;
  gap: 6px;
}

.dist .bar {
  min-width: 1.8em;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--skip);
  color: #fff;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.dist .bar.today {
  background: var(--match);
}

.countdown-line {
  margin: 16px 0 0;
  text-align: center;
}

.archive-form label {
  display: block;
  margin-bottom: 4px;
  font-weight: 600;
}

.archive-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

@media (max-width: 480px) {
  .archive-grid {
    grid-template-columns: 1fr 1fr;
  }

  .archive-grid > div:last-child {
    grid-column: 1 / -1;
  }
}

.archive-form input,
.archive-form select {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 2px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
}

.archive-info {
  min-height: 1.5em;
  margin: 10px 0;
  font-size: 0.9rem;
}

.archive-form .btn {
  width: 100%;
}

.tie-note {
  margin: 6px 0 0;
  font-size: 0.85rem;
}

/* text for only the daily website / only the Android tester build (js/tester.js, app/build.mjs) */
[data-tester-only] {
  display: none;
}

:root[data-build="tester"] [data-tester-only] {
  display: revert;
}

/* ---------- toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: max(20px, env(safe-area-inset-bottom));
  z-index: 100;
  max-width: calc(100vw - 32px);
  padding: 10px 16px;
  border-radius: 10px;
  background: var(--text);
  color: var(--bg);
  font-weight: 600;
  transform: translate(-50%, 150%);
  opacity: 0;
  transition: transform 0.2s, opacity 0.2s;
  pointer-events: none;
}

.toast.show {
  transform: translate(-50%, 0);
  opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
  .toast {
    transition: none;
  }
}

/* ---------- about page ---------- */

.prose {
  font-size: 1rem;
}

.prose h2 {
  margin: 24px 0 8px;
  font-family: var(--font-serif);
}

.prose blockquote {
  margin: 12px 0;
  padding: 12px 16px;
  border-left: 4px solid var(--accent);
  border-radius: 0 8px 8px 0;
  background: var(--surface);
}
