/* Yahtzee Daily — a printed-page look: warm paper, ink, one oxblood accent. */

:root {
  --paper: #f5f0e6;
  --paper-raised: #fbf8f1;
  --paper-sunk: #ece5d6;
  --ink: #221e19;
  --ink-soft: #4a433a;
  --muted: #857a6c;
  --faint: #b5aa99;
  --rule: #d8cebd;
  --rule-strong: #221e19;
  --accent: #8a2c22;
  --accent-soft: #f0dcd4;
  --gold: #b3811f;
  --good: #3f6b3a;
  --pip: #221e19;
  --shadow: #d8cebd;
  --backdrop: rgba(34, 30, 25, 0.38);

  --serif: 'Newsreader', 'Iowan Old Style', 'Palatino Linotype', Palatino, Georgia, serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --die: 60px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1a1815;
    --paper-raised: #23201c;
    --paper-sunk: #13110f;
    --ink: #ece4d5;
    --ink-soft: #cfc5b4;
    --muted: #978b7a;
    --faint: #5f574c;
    --rule: #3a342c;
    --rule-strong: #ece4d5;
    --accent: #d98a74;
    --accent-soft: #3b2520;
    --gold: #e3b95e;
    --good: #93b784;
    --pip: #ece4d5;
    --shadow: #0d0c0a;
    --backdrop: rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.45;
  font-optical-sizing: auto;
  font-variant-numeric: lining-nums tabular-nums;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

button { font: inherit; color: inherit; }
a { color: var(--accent); text-underline-offset: 2px; }

.smallcaps {
  font-size: 0.72em;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-weight: 600;
}

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

/* ---------- Masthead ---------- */

.masthead {
  padding: 18px 16px 0;
  border-bottom: 1px solid var(--rule);
}

.masthead-inner {
  max-width: 980px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.masthead-inner > :last-child { justify-self: end; }

.title-block { text-align: center; }

h1 {
  margin: 0;
  font-size: clamp(28px, 6vw, 40px);
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.05;
}

h1 em { font-weight: 400; }

.edition {
  margin: 6px 0 0;
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.text-button {
  background: none;
  border: none;
  padding: 8px 4px;
  cursor: pointer;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-soft);
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.text-button:hover { color: var(--accent); border-bottom-color: currentColor; }

.progress {
  list-style: none;
  margin: 16px auto 0;
  padding: 0 0 14px;
  display: flex;
  justify-content: center;
  gap: 6px;
  max-width: 980px;
}

.progress li {
  width: 18px;
  height: 4px;
  background: var(--rule);
  border-radius: 1px;
  transition: background-color 0.4s var(--ease), transform 0.4s var(--ease);
}

.progress li.done { background: var(--ink); }
.progress li.current { background: var(--accent); transform: scaleY(1.5); }

/* ---------- Layout ---------- */

.layout {
  flex: 1;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 24px 16px 32px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 420px);
  gap: 48px;
  align-items: start;
}

.table {
  position: sticky;
  top: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: 8px;
}

/* ---------- Round heading ---------- */

.round-heading { text-align: center; margin-bottom: 20px; }

.round-label {
  margin: 0;
  font-size: 30px;
  font-weight: 500;
  line-height: 1.1;
}

.round-label .smallcaps { font-size: 13px; color: var(--muted); vertical-align: middle; margin-right: 4px; }
.round-label .of { font-size: 16px; font-style: italic; color: var(--muted); }

#round-numeral { display: inline-block; min-width: 1.5ch; }

.rolls {
  margin: 8px 0 0;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
  min-height: 21px;
}

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

.roll-pips span {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--ink-soft);
  transition: background-color 0.25s;
}

.roll-pips span.used { background: var(--ink-soft); }

/* ---------- Dice tray ---------- */

.tray {
  position: relative;
  width: 100%;
  padding: 26px 0 30px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin-bottom: 24px;
}

.dice {
  display: flex;
  justify-content: center;
  gap: 14px;
  transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
}

.dice.away { opacity: 0; transform: translateY(8px); }

.die {
  position: relative;
  width: var(--die);
  height: var(--die);
  border: 1.5px solid var(--ink);
  border-radius: 11px;
  background: var(--paper-raised);
  box-shadow: 0 3px 0 var(--shadow);
  cursor: pointer;
  display: grid;
  grid-template: repeat(3, 1fr) / repeat(3, 1fr);
  padding: calc(var(--die) * 0.16);
  transition: transform 0.22s var(--ease), box-shadow 0.22s var(--ease), border-color 0.2s, background-color 0.2s;
  -webkit-tap-highlight-color: transparent;
}

.die:disabled { cursor: default; }
.die:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
.die:not(:disabled):hover { transform: translateY(-2px); box-shadow: 0 5px 0 var(--shadow); }

.die.blank { border-style: dashed; border-color: var(--faint); box-shadow: none; background: transparent; }

.die .pip {
  width: 72%;
  height: 72%;
  margin: auto;
  border-radius: 50%;
  background: var(--pip);
  opacity: 0;
  transform: scale(0.4);
  transition: opacity 0.12s, transform 0.12s;
}

.die[data-face="1"] .p5,
.die[data-face="2"] .p1, .die[data-face="2"] .p9,
.die[data-face="3"] .p1, .die[data-face="3"] .p5, .die[data-face="3"] .p9,
.die[data-face="4"] :is(.p1, .p3, .p7, .p9),
.die[data-face="5"] :is(.p1, .p3, .p5, .p7, .p9),
.die[data-face="6"] :is(.p1, .p3, .p4, .p6, .p7, .p9) { opacity: 1; transform: scale(1); }

.die.held {
  transform: translateY(-10px);
  border-color: var(--accent);
  box-shadow: 0 13px 0 -3px var(--accent-soft);
}

.die.held .pip { background: var(--accent); }
.die.held:not(:disabled):hover { transform: translateY(-12px); }

.die::after {
  content: 'held';
  position: absolute;
  left: 50%;
  bottom: -28px;
  transform: translate(-50%, -4px);
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent);
  opacity: 0;
  transition: opacity 0.2s, transform 0.2s var(--ease);
  pointer-events: none;
}

.die.held::after { opacity: 1; transform: translate(-50%, 0); }

.die.rolling { animation: tumble 0.5s var(--ease) infinite; }
.die.rolling .pip { transition: none; }
.die.settle { animation: settle 0.36s var(--ease); }

@keyframes tumble {
  0%   { transform: translate(0, 0) rotate(0deg); }
  25%  { transform: translate(-3px, -9px) rotate(-14deg); }
  50%  { transform: translate(2px, -3px) rotate(9deg); }
  75%  { transform: translate(-1px, -7px) rotate(-5deg); }
  100% { transform: translate(0, 0) rotate(0deg); }
}

@keyframes settle {
  0%   { transform: translateY(-6px) rotate(4deg); }
  60%  { transform: translateY(1px) rotate(-1deg); }
  100% { transform: none; }
}

/* ---------- Yahtzee celebration ---------- */

.sparkles { position: absolute; inset: 0; pointer-events: none; z-index: 2; }

.spark {
  position: absolute;
  width: var(--size);
  height: var(--size);
  margin: calc(var(--size) / -2) 0 0 calc(var(--size) / -2);
  background: var(--gold);
  clip-path: polygon(50% 0, 60% 40%, 100% 50%, 60% 60%, 50% 100%, 40% 60%, 0 50%, 40% 40%);
  opacity: 0;
  animation: twinkle var(--dur) var(--delay) var(--ease) both;
}

.spark.alt { background: var(--accent); }

@keyframes twinkle {
  0% { opacity: 0; transform: translateY(0) rotate(0deg) scale(0); }
  35% { opacity: 1; transform: translateY(calc(var(--drift) * 0.4)) rotate(70deg) scale(1); }
  60% { opacity: 0.85; transform: translateY(calc(var(--drift) * 0.7)) rotate(110deg) scale(0.7); }
  100% { opacity: 0; transform: translateY(var(--drift)) rotate(180deg) scale(0); }
}

.flourish {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  margin: 0;
  line-height: 22px;
  text-align: center;
  font-style: italic;
  font-size: 20px;
  font-weight: 600;
  color: var(--gold);
  pointer-events: none;
  opacity: 0;
}

.flourish.show { animation: flourish 2s var(--ease) both; }
.tray.celebrating .die::after { opacity: 0; }

@keyframes flourish {
  0% { opacity: 0; transform: translateY(6px); letter-spacing: 0; }
  20% { opacity: 1; transform: none; letter-spacing: 0.06em; }
  75% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-4px); letter-spacing: 0.1em; }
}

.die.gleam { animation: gleam 0.9s calc(var(--i) * 70ms) var(--ease) both; }
.die.gleam .pip { animation: pip-gleam 1.6s calc(var(--i) * 70ms) ease both; }

@keyframes gleam {
  0% { transform: none; }
  30% { transform: translateY(-9px) rotate(-3deg); border-color: var(--gold); }
  60% { transform: translateY(1px); border-color: var(--gold); }
  100% { transform: none; }
}

@keyframes pip-gleam {
  0%, 100% { background: var(--pip); }
  25%, 70% { background: var(--gold); }
}

.die.held.gleam .pip { animation-name: pip-gleam-held; }
.die.held.gleam { animation-name: gleam-held; }

@keyframes gleam-held {
  0%, 100% { transform: translateY(-10px); }
  30% { transform: translateY(-19px) rotate(-3deg); border-color: var(--gold); }
  60% { transform: translateY(-9px); }
}

@keyframes pip-gleam-held {
  0%, 100% { background: var(--accent); }
  25%, 70% { background: var(--gold); }
}

/* ---------- Interlude between rounds ---------- */

.interlude {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  background: var(--paper);
}

.interlude-kicker { color: var(--muted); font-size: 12px; }
.interlude-numeral { font-size: 52px; line-height: 1; font-weight: 400; font-style: italic; margin: 4px 0 8px; }
.interlude-rule { width: 64px; height: 1px; background: var(--ink); transform: scaleX(0); }

.interlude.show { animation: interlude-fade 1.25s var(--ease) forwards; }
.interlude.show .interlude-numeral { animation: rise 1.25s var(--ease) forwards; }
.interlude.show .interlude-kicker { animation: rise 1.25s 0.05s var(--ease) both; }
.interlude.show .interlude-rule { animation: draw 1.25s var(--ease) forwards; }

@keyframes interlude-fade {
  0% { opacity: 0; }
  18% { opacity: 1; }
  78% { opacity: 1; }
  100% { opacity: 0; }
}

@keyframes rise {
  0% { transform: translateY(10px); opacity: 0; }
  30% { transform: none; opacity: 1; }
  80% { transform: none; opacity: 1; }
  100% { transform: translateY(-6px); opacity: 0; }
}

@keyframes draw {
  0%, 15% { transform: scaleX(0); }
  50%, 100% { transform: scaleX(1); }
}

/* ---------- Roll button ---------- */

.roll-button {
  min-width: 220px;
  height: 50px;
  padding: 0 28px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background: var(--ink);
  color: var(--paper);
  font-size: 14px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.1s;
}

.roll-button:hover:not(:disabled) { background: var(--accent); border-color: var(--accent); }
.roll-button:active:not(:disabled) { transform: translateY(1px); }
.roll-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.roll-button:disabled { background: transparent; color: var(--muted); border-color: var(--rule); cursor: default; }

.hint {
  margin: 14px 0 0;
  font-style: italic;
  color: var(--muted);
  font-size: 15px;
  text-align: center;
  min-height: 22px;
}

/* ---------- Scorecard ---------- */

.card {
  background: var(--paper-raised);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 20px 24px 22px;
  box-shadow: 0 1px 0 var(--rule), 4px 4px 0 var(--paper-sunk);
}

.card-section + .card-section { margin-top: 20px; }

.section-title {
  margin: 0 0 2px;
  padding-bottom: 6px;
  border-bottom: 3px double var(--rule-strong);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent);
}

.row {
  display: flex;
  justify-content: space-between;
  align-items: center; /* not baseline: an empty value cell has no baseline and grows the row */
  gap: 12px;
  width: 100%;
  min-height: 38px;
  padding: 7px 6px;
  border: none;
  border-bottom: 1px solid var(--rule);
  background: transparent;
  text-align: left;
  position: relative;
}

button.row { cursor: default; }
button.row.available { cursor: pointer; }
button.row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }

.row-name { font-size: 17px; line-height: 24px; position: relative; }
.row-hint { font-size: 13px; font-style: italic; color: var(--muted); margin-left: 6px; }

.row-value {
  min-width: 3ch;
  min-height: 24px;
  line-height: 24px;
  text-align: right;
  font-size: 18px;
  font-weight: 600;
}

.row .potential { font-weight: 400; font-style: italic; color: var(--muted); }
.row .potential.zero { color: var(--faint); }
.row.forbidden .row-name { color: var(--faint); }

button.row.available {
  transition: background-color 0.15s;
}

button.row.available:hover,
button.row.available:focus-visible { background: var(--accent-soft); }
button.row.available:hover .potential,
button.row.available:focus-visible .potential { color: var(--accent); font-weight: 600; }

.row.filled .row-name { color: var(--ink-soft); }
.row.filled .row-hint { display: none; }

/* A small ledger tick in the margin marks a box as used. */
.row.filled:not(.scratched) .row-name::before {
  content: '';
  position: absolute;
  left: -13px;
  top: 50%;
  width: 4px;
  height: 9px;
  border: solid var(--accent);
  border-width: 0 1.6px 1.6px 0;
  transform: translateY(-65%) rotate(40deg);
}

.row.just-scored .row-name::before { animation: tick-in 0.45s 0.15s var(--ease) both; }

@keyframes tick-in {
  0% { opacity: 0; transform: translateY(-65%) rotate(40deg) scale(0.2); }
  100% { opacity: 1; transform: translateY(-65%) rotate(40deg) scale(1); }
}

/* A box scored zero is crossed out, as on a paper card; its 0 is written in ink
   like any other score, unlike the faint italic of a potential zero. */
.row.scratched .row-name {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-color: var(--accent);
  text-decoration-thickness: 1.5px;
}

.row.just-scored { animation: row-flash 1.1s var(--ease); }
.row.just-scored .row-value { animation: ink-in 0.5s var(--ease); }

@keyframes row-flash {
  0% { background: var(--accent-soft); }
  100% { background: transparent; }
}

@keyframes ink-in {
  0% { transform: scale(1.5); opacity: 0; filter: blur(2px); }
  100% { transform: none; opacity: 1; filter: none; }
}

.total-row { color: var(--ink-soft); }
.total-row .row-name { font-size: 15px; font-style: italic; }
.total-row .row-value { font-weight: 500; font-size: 16px; }
.total-row .row-value.earned { color: var(--good); font-weight: 600; }

.bump { animation: bump 0.5s var(--ease); display: inline-block; }

@keyframes bump {
  0% { transform: scale(1); }
  40% { transform: scale(1.25); color: var(--accent); }
  100% { transform: scale(1); }
}

.grand-total {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-top: 18px;
  padding: 10px 6px 0;
  border-top: 3px double var(--rule-strong);
}

.grand-total .smallcaps { font-size: 13px; }
#grand-total { font-size: 34px; font-weight: 600; line-height: 1; }

/* ---------- Colophon ---------- */

.colophon {
  text-align: center;
  padding: 16px 16px 28px;
  font-size: 14px;
  font-style: italic;
  color: var(--muted);
}

.colophon p { margin: 0; }

/* ---------- Dialogs ---------- */

dialog.sheet {
  width: min(520px, calc(100vw - 32px));
  max-height: calc(100vh - 48px);
  padding: 32px 32px 28px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper-raised);
  color: var(--ink);
  box-shadow: 6px 6px 0 var(--shadow);
  overflow-y: auto;
}

dialog.sheet:focus { outline: none; }
dialog.sheet[open] { animation: sheet-in 0.4s var(--ease); }
dialog.sheet::backdrop { background: var(--backdrop); animation: fade-in 0.3s ease; }

@keyframes sheet-in {
  0% { opacity: 0; transform: translateY(18px); }
  100% { opacity: 1; transform: none; }
}

@keyframes fade-in { from { opacity: 0; } }

.sheet h2 { margin: 0 0 8px; font-size: 28px; font-weight: 600; line-height: 1.15; }
.sheet h3 {
  margin: 24px 0 6px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
}
.sheet p { margin: 0 0 10px; }
.sheet .lede { font-style: italic; color: var(--ink-soft); font-size: 18px; }
.sheet .small { font-size: 14px; color: var(--muted); margin-top: 18px; }

.close {
  position: absolute;
  top: 12px;
  right: 14px;
  width: 36px;
  height: 36px;
  border: none;
  background: none;
  font-size: 26px;
  line-height: 1;
  color: var(--muted);
  cursor: pointer;
}

.close:hover { color: var(--accent); }

.rules { padding-left: 20px; margin: 16px 0 0; }
.rules li { margin-bottom: 8px; }
.rules li::marker { color: var(--accent); font-style: italic; }

.defs { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; }
.defs dt { font-weight: 600; font-style: italic; }
.defs dd { margin: 0; }

kbd {
  font-family: inherit;
  font-size: 12px;
  padding: 1px 6px;
  border: 1px solid var(--rule);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: var(--paper);
}

/* ---------- Stats ---------- */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 18px 0 8px;
  text-align: center;
}

.stat-grid .num { display: block; font-size: 32px; font-weight: 500; line-height: 1.1; }
.stat-grid .label { display: block; font-size: 12px; color: var(--muted); line-height: 1.25; margin-top: 4px; }

.ledger { width: 100%; border-collapse: collapse; font-size: 15px; margin-top: 8px; }
.ledger th {
  text-align: left;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  padding: 6px 4px;
  border-bottom: 1px solid var(--rule-strong);
}
.ledger td { padding: 6px 4px; border-bottom: 1px solid var(--rule); }
.ledger .n { text-align: right; }
.ledger tr.highlight td { background: var(--accent-soft); }

/* ---------- Results ---------- */

.results { text-align: center; }
.results .kicker { font-size: 12px; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); margin-bottom: 4px; }
.results .final { font-size: 76px; font-weight: 500; line-height: 1; margin: 10px 0 2px; }
.results .verdict { font-style: italic; font-size: 22px; color: var(--accent); margin-bottom: 20px; }

.versus {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  margin: 0 0 16px;
}

.versus div { padding: 12px 4px; }
.versus div + div { border-left: 1px solid var(--rule); }
.versus .num { display: block; font-size: 26px; font-weight: 500; }
.versus .label { display: block; font-size: 11px; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }

.measure { margin: 22px 30px 8px; }

.measure-track {
  position: relative;
  height: 2px;
  background: var(--rule);
  margin: 34px 0 30px;
}

.measure-fill {
  position: absolute;
  left: 0;
  top: 0;
  height: 100%;
  background: var(--ink);
  transform-origin: left;
  transform: scaleX(0);
  transition: transform 1.2s var(--ease);
}

.measure-mark {
  position: absolute;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 14px;
  background: var(--ink);
}

.measure-mark span {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 12px;
  letter-spacing: 0.08em;
}

.measure-mark.you { background: var(--accent); height: 20px; width: 3px; }
.measure-mark.you span { bottom: 24px; color: var(--accent); font-weight: 600; }
.measure-mark.par span, .measure-mark.end span { top: 18px; color: var(--muted); font-style: italic; }
.measure-mark.end { background: var(--muted); }

.measure-caption { font-size: 15px; color: var(--ink-soft); font-style: italic; }

.actions { display: flex; gap: 10px; justify-content: center; margin: 20px 0 6px; flex-wrap: wrap; }

.button {
  height: 44px;
  padding: 0 22px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background: transparent;
  font-size: 13px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.button.primary { background: var(--ink); color: var(--paper); }
.button:hover { background: var(--accent); border-color: var(--accent); color: var(--paper-raised); }

dialog.score-confirm { width: min(440px, calc(100vw - 32px)); }
.score-confirm .actions { justify-content: flex-start; }
.score-confirm .button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.countdown { font-size: 14px; color: var(--muted); margin-top: 14px; }
.countdown strong { color: var(--ink); font-weight: 600; }

details.replay { text-align: left; margin-top: 18px; border-top: 1px solid var(--rule); }
details.replay summary {
  cursor: pointer;
  padding: 12px 2px;
  font-size: 12px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--ink-soft);
  list-style: none;
}
details.replay summary::-webkit-details-marker { display: none; }
details.replay summary::before { content: '+'; display: inline-block; width: 18px; color: var(--accent); }
details.replay[open] summary::before { content: '–'; }

.mini-dice { display: inline-flex; gap: 3px; }
.mini-dice span {
  display: inline-grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border: 1px solid var(--ink-soft);
  border-radius: 4px;
  font-size: 12px;
  line-height: 1;
}

/* ---------- Toast ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  transform: translate(-50%, 16px);
  padding: 10px 18px;
  background: var(--ink);
  color: var(--paper);
  border-radius: 6px;
  font-size: 15px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s var(--ease);
  z-index: 10;
}

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

/* ---------- Small screens ---------- */

@media (max-width: 820px) {
  .layout { grid-template-columns: minmax(0, 1fr); gap: 20px; padding-top: 16px; }
  .table { position: static; padding-top: 0; }
  .round-heading { margin-bottom: 12px; }
  .round-label { font-size: 26px; }
  .card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: 26px;
    padding: 14px 14px 16px;
  }
  .card-section + .card-section { margin-top: 0; }
  .grand-total { grid-column: 1 / -1; }
  .row { min-height: 34px; padding: 6px 2px; }
  .row-name { font-size: 15px; }
  .row-value { font-size: 16px; }
  .row-hint { display: none; }
  .total-row .row-name { font-size: 14px; }
}

@media (max-width: 420px) {
  :root { --die: 52px; }
  body { font-size: 16px; }
  .dice { gap: 10px; }
  .tray { padding: 22px 0 28px; }
  .masthead { padding-top: 14px; }
  .edition { font-size: 11px; letter-spacing: 0.08em; }
  .progress { gap: 4px; margin-top: 12px; }
  .progress li { width: 14px; }
  .card { column-gap: 24px; padding: 12px 10px 14px; }
  .row-name { font-size: 14px; }
  .section-title { font-size: 11px; letter-spacing: 0.12em; }
  dialog.sheet { padding: 28px 20px 22px; }
  .results .final { font-size: 64px; }
  .stat-grid .num { font-size: 26px; }
}

@media (max-width: 350px) {
  :root { --die: 46px; }
  .dice { gap: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
