:root {
  --purple: #1b1530;
  --teal: #38e1c6;
  --teal-d: #17867b;
  --brass: #e8b04b;
  --brass-d: #6e4718;
  --magenta: #ff5fa2;
  --parch: #f4ead7;
  --navy: #121a3f;
  --navy-2: #1b2450;
  --ink: #0b0919;
  --shadow: #050310;
  --gutter: 16px;
  --font-ui: 'Tiny5', ui-monospace, monospace;
  --font-mark: 'Press Start 2P', ui-monospace, monospace;
  color-scheme: dark;
}


/* ---------- crisp type scale
   Tiny5 and Press Start 2P are drawn on an 8-units-per-em pixel grid, so they
   are only perfectly sharp when each font pixel is a whole number of screen
   pixels, and centred text stays on whole pixels: so only 8/16/24/32/40/48px.
   Small labels use Tiny5 at 16px rather than tiny Press Start 2P. */
:root {
  --ui-xs: 16px; --ui-s: 16px; --ui-m: 24px; --ui-l: 24px; --ui-xl: 32px;
  --mark-s: 8px; --mark-m: 16px; --mark-l: 24px; --mark-xl: 32px;
}

@media (min-width: 520px) { :root { --mark-xl: 40px; } }
@media (min-width: 760px) { :root { --ui-xl: 48px; --mark-xl: 48px; } .year-counter.long { font-size: var(--ui-xl); } }
.wordmark.small { font-size: var(--mark-s); }

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--ink);
  color: var(--parch);
  font-family: var(--font-ui);
  font-size: var(--ui-s);
  line-height: 1.25;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-font-smoothing: none;
  /* pixel fonts have one weight: never smear them with fake bold */
  font-synthesis: none;
}
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 3px solid var(--magenta); outline-offset: 2px; }
/* headings get focus programmatically on screen change; no ring for that */
[tabindex="-1"]:focus, [tabindex="-1"]:focus-visible { outline: none; }

/* ---------- the pixel stage */
#stage {
  position: fixed; top: 0; left: 0;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  z-index: 0;
}

/* ---------- world overlay (events, ruler, era tags) */
#world-overlay { position: fixed; inset: 0; z-index: 1; pointer-events: none; overflow: hidden; }
.wo-inner { position: absolute; top: 0; left: 0; right: 0; will-change: transform; }
.event-marker {
  position: absolute; left: 10px;
  font-size: var(--ui-xs); line-height: 1.25;
  max-width: min(44vw, 260px);
  padding: 2px 6px 2px 5px;
  background: rgba(11, 9, 25, .78);
  border-left: 2px solid var(--brass);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.event-marker b { color: var(--brass); font-weight: 700; margin-right: 2px; }
.event-marker.passed { opacity: .78; }
.ruler { position: absolute; top: 0; right: 0; width: 48px; }
.ruler .tick { position: absolute; right: 0; width: 5px; height: 2px; background: rgba(244, 234, 215, .35); }
.ruler .tick.major { width: 12px; background: var(--parch); }
.ruler .tick span {
  position: absolute; right: 15px; top: -6px; white-space: nowrap;
  font-size: var(--ui-xs); color: var(--parch); background: rgba(11, 9, 25, .78); padding: 0 3px;
}
.era-tag {
  position: absolute; left: 0; right: 0; margin: 0 auto; width: fit-content;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 4px 8px; background: rgba(18, 26, 63, .92);
  border: 2px solid var(--parch); box-shadow: 3px 3px 0 var(--shadow);
  opacity: 0; white-space: nowrap;
}
.era-tag.in { animation: tagIn .5s steps(5) forwards; }
.era-name { font-family: var(--font-ui); text-transform: uppercase; font-size: var(--ui-xs); color: var(--teal); letter-spacing: .125em;}
.era-range { font-size: var(--ui-xs); color: var(--parch); }
@keyframes tagIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ---------- screens */
#app { position: fixed; inset: 0; z-index: 2; }
.screen { position: absolute; inset: 0; }

/* ---------- panels & buttons */
.panel {
  background: var(--navy);
  border: 2px solid var(--parch);
  box-shadow: inset 0 0 0 2px var(--navy), inset 0 0 0 4px rgba(244, 234, 215, .7), 4px 4px 0 var(--shadow);
  padding: 16px 18px;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  font-weight: 700; font-size: var(--ui-s);
  padding: 10px 18px; min-height: 44px;
  color: #1d120a; background: var(--brass);
  border: 2px solid #1d120a; border-radius: 0;
  box-shadow: 0 4px 0 var(--brass-d), 4px 4px 0 4px var(--shadow);
  cursor: pointer; position: relative; top: 0;
  transition: none;
}
.btn:hover { filter: brightness(1.08); }
.btn:active, .btn.pressed { top: 4px; box-shadow: 0 0 0 var(--brass-d), 2px 2px 0 2px var(--shadow); }
.btn:disabled { opacity: .55; cursor: default; }
.btn-teal { background: var(--teal); box-shadow: 0 4px 0 var(--teal-d), 4px 4px 0 4px var(--shadow); }
.btn-teal:active { box-shadow: 0 0 0 var(--teal-d), 2px 2px 0 2px var(--shadow); }
.btn-brass { background: var(--brass); }
.btn-danger { background: var(--magenta); box-shadow: 0 4px 0 #8a2a58, 4px 4px 0 4px var(--shadow); }
.btn-small { font-size: var(--ui-s); padding: 6px 12px; min-height: 36px; }
.icon-btn {
  font-family: var(--font-ui); text-transform: uppercase; font-size: var(--ui-xs); line-height: 1;
  min-height: 36px; min-width: 36px; padding: 8px 10px;
  color: var(--parch); background: var(--navy);
  border: 2px solid var(--parch); border-radius: 0;
  box-shadow: 0 3px 0 var(--shadow); cursor: pointer; position: relative; top: 0; letter-spacing: .125em;}
.icon-btn:active { top: 3px; box-shadow: none; }
.icon-btn.small { min-height: 30px; min-width: 30px; padding: 4px 6px; }
.icon-btn[aria-pressed="true"] { background: var(--teal); color: #10231f; }
.link-btn { background: none; border: 0; color: var(--teal); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; padding: 6px; font-size: var(--ui-s); }

.pop { animation: pop .24s steps(4) both; }
@keyframes pop { from { transform: translateY(14px) scale(.96); opacity: 0; } to { transform: none; opacity: 1; } }
.shake { animation: shake .35s steps(6); }
@keyframes shake { 0%, 100% { transform: translateX(0); } 20% { transform: translateX(-6px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(4px); } }

/* ---------- HUD */
.hud {
  position: absolute; top: 0; left: 0; right: 0; z-index: 3;
  display: grid; grid-template-columns: 56px 1fr 56px; align-items: start;
  padding: calc(10px + env(safe-area-inset-top)) 10px 0;
  pointer-events: none;
}
.hud > * { pointer-events: auto; }
.hud-center { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 2px; justify-self: center; }
#screen-play .hud-center, #screen-race .hud-center {
  padding: 5px 14px 6px; min-width: 150px;
  background: rgba(11, 9, 25, .86); border: 2px solid rgba(244, 234, 215, .35); box-shadow: 3px 3px 0 var(--shadow);
}
#screen-play .hud-score { background: rgba(11, 9, 25, .86); padding: 4px 8px; border: 2px solid rgba(244, 234, 215, .35); margin-top: 0; }
.hud-tag { font-family: var(--font-ui); text-transform: uppercase; font-size: var(--ui-xs); color: var(--brass); text-shadow: 2px 2px 0 var(--shadow); letter-spacing: .125em;}
.year-counter {
  font-weight: 700; font-size: var(--ui-xl); line-height: 1;
  color: var(--parch); text-shadow: 3px 3px 0 var(--shadow), -1px -1px 0 var(--shadow);
  font-variant-numeric: tabular-nums; white-space: nowrap;
}
.year-counter.long { font-size: var(--ui-l); padding: 4px 0 2px; }
.hud-era { font-family: var(--font-ui); text-transform: uppercase; font-size: var(--ui-xs); color: var(--teal); text-shadow: 2px 2px 0 var(--shadow); letter-spacing: .125em;}
.hud-score { justify-self: end; font-size: var(--ui-xs); text-shadow: 2px 2px 0 var(--shadow); padding-top: 8px; margin-right: 46px; }
.hud-score b { font-size: var(--ui-m); color: var(--brass); }
.hud-slim { grid-template-columns: 56px 1fr auto; }

/* ---------- dock & cards */
.dock {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; justify-content: center;
  padding: 0 12px calc(12px + env(safe-area-inset-bottom));
}
.dock > .panel { width: 100%; max-width: 470px; }
.pc-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.pc-step { font-family: var(--font-ui); text-transform: uppercase; font-size: var(--ui-xs); color: var(--brass); letter-spacing: .125em;}
.tries { display: flex; gap: 5px; }
.try { width: 12px; height: 12px; background: var(--teal); border: 2px solid #0b3a35; box-shadow: 2px 2px 0 var(--shadow); }
.try.used { background: #3a2a48; border-color: #6d6688; }
.pc-prompt { font-size: var(--ui-m); font-weight: 600; line-height: 1.25; margin: 10px 0 4px; }
.pc-source { font-size: var(--ui-xs); opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pc-house { font-family: var(--font-ui); text-transform: uppercase; font-size: var(--ui-xs); color: var(--house, var(--teal)); margin-top: 8px; letter-spacing: .125em;}
.pc-form { display: flex; gap: 8px; margin-top: 12px; }
.answer {
  flex: 1; min-width: 0; font-size: var(--ui-m); padding: 9px 10px;
  background: var(--ink); color: var(--parch);
  border: 2px solid var(--parch); border-radius: 0;
  box-shadow: inset 3px 3px 0 #000;
}
.answer:focus { outline: none; border-color: var(--teal); box-shadow: inset 3px 3px 0 #000, 0 0 0 2px var(--teal); }
.pc-msg { min-height: 18px; margin-top: 8px; font-size: var(--ui-s); color: var(--magenta); }
.claims { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; font-size: var(--ui-xs); }
.claims-label { opacity: .7; }
.claim { border: 1px solid var(--house); padding: 0 4px; }

.tier-card { border-color: var(--tier); text-align: center; }
.tc-tier { font-family: var(--font-mark); font-size: var(--mark-m); color: var(--tier); text-shadow: 3px 3px 0 var(--shadow); display: flex; justify-content: center; align-items: center; gap: 10px; }
.tc-emoji { font-size: 18px; font-family: system-ui, sans-serif; }
.tc-entry { font-size: var(--ui-l); font-weight: 700; margin-top: 10px; }
.tc-landed { color: var(--teal); font-size: var(--ui-s); margin-top: 2px; }
.tc-verdict { font-size: var(--ui-s); margin: 10px 0 6px; }
.tc-source { font-size: var(--ui-xs); opacity: .65; }
.tc-rare { font-size: var(--ui-xs); color: var(--brass); margin-top: 2px; }
.tier-card .btn { margin-top: 12px; width: 100%; }
.tier-card.paradox { animation: pop .24s steps(4) both, rainbow 1.2s steps(8) infinite; }
@keyframes rainbow {
  0% { border-color: #ff5f5f; } 14% { border-color: #ff9a3c; } 28% { border-color: #ffd84a; } 42% { border-color: #5fd36d; }
  57% { border-color: #38e1c6; } 71% { border-color: #4a7bd8; } 85% { border-color: #b07cff; } 100% { border-color: #ff5fa2; }
}

/* ---------- home */
#screen-home { display: flex; flex-direction: column; }
.home-top { display: flex; justify-content: space-between; padding: calc(12px + env(safe-area-inset-top)) var(--gutter) 0; }
.home-brand { text-align: center; padding: 24px var(--gutter) 0; }
.wordmark {
  font-family: var(--font-mark); font-weight: 400;
  font-size: var(--mark-xl); line-height: 1; margin: 0;
  color: var(--parch);
  text-shadow: 3px 3px 0 var(--magenta), 6px 6px 0 var(--shadow);
}
.wordmark.small { font-size: var(--ui-xs); text-shadow: 2px 2px 0 var(--magenta); }
.home-day { margin-top: 10px; color: var(--brass); font-size: var(--ui-s); text-shadow: 2px 2px 0 var(--shadow); }
.home-tag { margin: 6px auto 0; max-width: 34ch; font-size: var(--ui-s); text-shadow: 2px 2px 0 var(--shadow); }
.home-bottom {
  margin-top: auto; display: flex; flex-direction: column; gap: 12px; align-items: stretch;
  width: 100%; max-width: 470px; align-self: center;
  padding: 0 var(--gutter) calc(14px + env(safe-area-inset-bottom));
}
.btn-start { font-size: var(--ui-m); min-height: 56px; background: var(--teal); box-shadow: 0 5px 0 var(--teal-d), 5px 5px 0 5px var(--shadow); }
.btn-start:active { box-shadow: 0 0 0 var(--teal-d), 2px 2px 0 2px var(--shadow); }
.bob { animation: bob 1.4s steps(2, jump-none) infinite; }
@keyframes bob { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
.home-cards { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mode-tile {
  display: flex; align-items: center; gap: 10px; text-align: left;
  background: var(--navy); border: 2px solid var(--parch);
  box-shadow: inset 0 0 0 2px var(--navy), inset 0 0 0 4px rgba(244, 234, 215, .5), 3px 3px 0 var(--shadow);
  padding: 10px 12px; cursor: pointer; position: relative; top: 0; min-height: 56px;
}
.mode-tile:active { top: 3px; box-shadow: inset 0 0 0 2px var(--navy), inset 0 0 0 4px rgba(244, 234, 215, .5); }
.mt-icon { font-size: var(--ui-m); color: var(--magenta); width: 24px; text-align: center; }
.mt-text { display: flex; flex-direction: column; min-width: 0; }
.mt-text b { font-size: var(--ui-s); }
.mt-text small { font-size: var(--ui-xs); opacity: .72; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.home-stats { display: flex; justify-content: space-between; font-size: var(--ui-xs); padding: 4px 8px; background: rgba(11, 9, 25, .85); border: 2px solid rgba(244, 234, 215, .3); }
.home-stats b { color: var(--brass); font-variant-numeric: tabular-nums; }

/* ---------- finale */
.poster-labels { position: absolute; inset: 0; pointer-events: none; opacity: 0; }
.poster-labels.in { opacity: 1; transition: opacity .3s steps(3); }
.poster-label {
  position: absolute; left: 8px;
  font-size: var(--ui-xs); line-height: 1.25;
  padding: 2px 4px; background: rgba(11, 9, 25, .8); color: var(--parch);
  white-space: nowrap;
}
.finale-panel {
  position: absolute; left: 12px; right: 12px; margin: 0 auto; bottom: calc(12px + env(safe-area-inset-bottom));
  max-width: 470px; text-align: center; z-index: 3;
}
.finale-panel.pop { animation: popF .3s steps(4) 1.4s both; }
@keyframes popF { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.fp-kicker { font-family: var(--font-ui); text-transform: uppercase; font-size: var(--ui-xs); color: var(--brass); letter-spacing: .125em;}
.fp-head { font-size: var(--ui-m); font-weight: 700; line-height: 1.25; margin: 8px 0 6px; }
.emoji-row { font-family: system-ui, 'Apple Color Emoji', 'Segoe UI Emoji', sans-serif; font-size: 22px; letter-spacing: 2px; }
.fp-score { margin: 6px 0; font-size: var(--ui-s); }
.fp-score b { font-size: var(--ui-l); color: var(--teal); }
.fp-sub { margin: 4px 0; font-size: var(--ui-s); }
.percentile { font-size: var(--ui-xs); color: var(--brass); min-height: 0; }
.fp-actions { display: flex; gap: 10px; justify-content: center; margin-top: 12px; flex-wrap: wrap; }
.fp-actions .btn { flex: 1 1 140px; }
.fp-foot { display: flex; justify-content: space-between; align-items: center; margin-top: 10px; font-size: var(--ui-xs); gap: 8px; }
.fp-foot b { color: var(--brass); font-variant-numeric: tabular-nums; }
.race-results { text-align: left; margin: 8px 0; padding-left: 26px; }
.race-results li { margin: 4px 0; border-left: 4px solid var(--house); padding-left: 8px; }
.race-results li span { display: block; font-size: var(--ui-xs); opacity: .8; }
@media (min-width: 760px) {
  #screen-finale .finale-panel { left: auto; right: 28px; top: 50%; bottom: auto; transform: translateY(-50%); width: 400px; }
  #screen-finale .finale-panel.pop { animation-name: popW; }
  @keyframes popW { from { opacity: 0; transform: translateY(calc(-50% + 14px)); } to { opacity: 1; transform: translateY(-50%); } }
  .poster-label { font-size: var(--ui-xs); }
}

/* ---------- Suit Up / Deck Duel (Clockwork Club) */
.suit-title { font-size: var(--ui-s); font-weight: 700; text-shadow: 2px 2px 0 var(--shadow); }
.chips { justify-self: end; display: flex; align-items: center; gap: 6px; font-size: var(--ui-m); padding: 4px 8px; background: var(--navy); border: 2px solid var(--brass); box-shadow: 3px 3px 0 var(--shadow); }
.chips b { color: var(--brass); font-variant-numeric: tabular-nums; }
.chip-icon { width: 12px; height: 12px; background: var(--brass); border: 2px solid var(--brass-d); box-shadow: inset -2px -2px 0 #a8742a; }
.club-ui {
  position: absolute; left: 0; right: 0; top: 44%; bottom: 0;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 0 10px calc(14px + env(safe-area-inset-bottom));
  overflow-y: auto;
}
.dials { display: flex; gap: 10px; }
.dial {
  width: 28px; height: 28px; border-radius: 50%;
  background: #2a1a10; border: 3px solid var(--brass);
  box-shadow: 0 3px 0 var(--brass-d), inset 2px 2px 0 #0008;
  position: relative;
}
.dial::after { content: ''; position: absolute; left: 50%; top: 3px; width: 2px; height: 8px; background: #6e4718; transform: translateX(-50%); }
.dial.lit { background: var(--teal); box-shadow: 0 3px 0 var(--brass-d), 0 0 0 3px rgba(56, 225, 198, .35); animation: dialOn .4s steps(4); }
.dial.lit::after { background: #0e4a44; }
.dial.cracked {
  background:
    linear-gradient(62deg, transparent 44%, var(--parch) 44%, var(--parch) 52%, transparent 52%),
    linear-gradient(-30deg, transparent 46%, var(--parch) 46%, var(--parch) 54%, transparent 54%),
    #3a1a24;
}
@keyframes dialOn { 0% { transform: scale(1.3); } 100% { transform: scale(1); } }
.suit-status { font-size: var(--ui-s); background: rgba(11, 9, 25, .72); padding: 2px 8px; text-align: center; }
.hand { display: flex; justify-content: center; flex-wrap: wrap; max-width: 820px; padding: 18px 10px 4px 30px; margin: auto 0; }

/* pixel-art cards: 27×37 art pixels shown at 2× (3× for Suit Up on big screens) */
.card {
  position: relative; flex: none; width: 54px; height: 74px; padding: 0; border: 0; background: none;
  margin-left: -14px; margin-bottom: 10px; cursor: pointer;
  transform: translateY(calc(var(--arc, 0) * 1px));
  filter: drop-shadow(3px 3px 0 rgba(0, 0, 0, .5));
  transition: transform .12s steps(3), filter .12s steps(3);
}
.card-art { display: block; width: 100%; height: 100%; image-rendering: pixelated; pointer-events: none; }
.card:not(:disabled):hover, .card.lifted {
  transform: translateY(calc(var(--arc, 0) * 1px - 12px)); z-index: 2;
  filter: drop-shadow(4px 8px 0 rgba(0, 0, 0, .45)) drop-shadow(0 0 0 var(--brass));
}
.card:focus-visible { outline: 3px solid var(--brass); outline-offset: 3px; transform: translateY(calc(var(--arc, 0) * 1px - 12px)); z-index: 3; }
.card.used { cursor: default; }
.card.used.idle { opacity: .55; filter: grayscale(.6) drop-shadow(3px 3px 0 rgba(0, 0, 0, .4)); }
.card.just { animation: cardStamp .4s steps(4) both; z-index: 2; }
@keyframes cardStamp {
  0% { transform: translateY(calc(var(--arc, 0) * 1px - 26px)) scale(1.25); }
  60% { transform: translateY(calc(var(--arc, 0) * 1px + 2px)) scale(.96); }
  100% { transform: translateY(calc(var(--arc, 0) * 1px)); }
}
/* dealt from a pile in the middle of the table, one after another */
.hand.deal .card { animation: dealIn .5s steps(6) both; animation-delay: calc(var(--i, 0) * 55ms); }
@keyframes dealIn {
  0% { opacity: 0; transform: translate(calc((6 - var(--i, 0)) * 22px), -90px); }
  20% { opacity: 1; }
  100% { opacity: 1; transform: translateY(calc(var(--arc, 0) * 1px)); }
}
@media (min-width: 760px) and (min-height: 600px) {
  #screen-suit .card { width: 81px; height: 111px; margin-left: -26px; }
}
.card.small { margin: 0; transform: none; }
.card.small:not(:disabled):hover, .card.small:focus-visible { transform: translateY(-4px); }
.card.big { width: 81px; height: 111px; margin: 0; cursor: default; transform: none; }
/* flip: the back shrinks to an edge, the face grows out of it */
.flip3 { animation: flipX .5s steps(8) both; }
.flip3 .flip-back, .flip3 .flip-front { position: absolute; inset: 0; }
.flip3 .flip-back { animation: firstHalf .5s linear both; }
.flip3 .flip-front { animation: secondHalf .5s linear both; }
@keyframes flipX { 0% { transform: scaleX(1); } 50% { transform: scaleX(0); } 100% { transform: scaleX(1); } }
@keyframes firstHalf { 0%, 49% { opacity: 1; } 50%, 100% { opacity: 0; } }
@keyframes secondHalf { 0%, 49% { opacity: 0; } 50%, 100% { opacity: 1; } }
.chips.bump { animation: chipBump .35s steps(3); }
@keyframes chipBump { 0% { transform: scale(1.25); } 100% { transform: none; } }

.q-overlay {
  position: absolute; inset: 0; z-index: 20;
  display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(5, 3, 16, .62);
}
.q-panel { width: 100%; max-width: 480px; max-height: calc(100dvh - 32px); overflow-y: auto; }
.q-head { display: flex; gap: 14px; align-items: center; }
.q-deck { font-family: var(--font-ui); text-transform: uppercase; font-size: var(--ui-xs); color: var(--brass); line-height: 1.5; letter-spacing: .125em;}
.q-house { font-family: var(--font-ui); text-transform: uppercase; font-size: var(--ui-xs); margin-top: 4px; letter-spacing: .125em;}
.q-value { font-size: var(--ui-xs); opacity: .75; margin-top: 4px; }
.q-text { font-size: var(--ui-m); font-weight: 600; line-height: 1.25; margin: 14px 0 10px; }
.q-hint { font-size: var(--ui-xs); color: var(--teal); margin-bottom: 8px; }
.q-options { display: grid; grid-template-columns: 1fr; gap: 8px; }
@media (min-width: 520px) { .q-options { grid-template-columns: 1fr 1fr; } }
.btn-option {
  justify-content: flex-start; text-align: left; font-weight: 500; font-size: var(--ui-s);
  background: var(--navy-2); color: var(--parch); border-color: var(--parch);
  box-shadow: 0 3px 0 #000, 3px 3px 0 3px var(--shadow);
}
.btn-option b { color: var(--brass); margin-right: 4px; }
.btn-option.correct { background: #2e7d3a; }
.btn-option.wrong { background: #8c2a3a; }
.btn-option:disabled { opacity: 1; }
.q-result { min-height: 22px; margin-top: 10px; font-weight: 700; text-align: center; }
.q-result.ok { color: var(--teal); }
.q-result.bad { color: var(--magenta); }
.cashout { text-align: center; width: 100%; max-width: 420px; }
.fly-coin { position: fixed; z-index: 60; width: 10px; height: 10px; margin: -5px 0 0 -5px; background: var(--brass); border: 2px solid var(--brass-d); pointer-events: none; }

/* ---------- Court Night */
#screen-court { overflow-y: auto; }
.court-panel { max-width: 600px; margin: calc(60px + env(safe-area-inset-top)) auto 24px; width: calc(100% - 24px); }
.panel-title { font-family: var(--font-ui); text-transform: uppercase; font-size: var(--ui-xs); color: var(--brass); margin: 4px 0 10px; letter-spacing: .125em;}
.panel-title:not(:first-child) { margin-top: 20px; }
.panel-sub { margin: -4px 0 12px; font-size: var(--ui-s); opacity: .85; }
.houses { display: flex; flex-direction: column; gap: 10px; }
.house-card { border-left: 6px solid var(--house); padding: 8px 0 8px 10px; background: rgba(11, 9, 25, .35); display: flex; flex-direction: column; gap: 6px; }
.house-top { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center; }
.house-dot { width: 14px; height: 14px; background: var(--house); box-shadow: 2px 2px 0 var(--shadow); }
.house-name, .house-players { min-width: 0; padding: 8px; font-size: var(--ui-s); background: var(--ink); border: 2px solid var(--parch); border-radius: 0; }
.house-name:focus, .house-players:focus { outline: none; border-color: var(--house); }
.house-players { font-size: var(--ui-s); margin-left: 22px; margin-right: 38px; border-color: rgba(244, 234, 215, .45); }
.row { margin: 10px 0; display: flex; gap: 8px; flex-wrap: wrap; }
.rules h4 { margin: 10px 0 4px; font-family: var(--font-ui); text-transform: uppercase; font-size: var(--ui-xs); color: var(--brass); letter-spacing: .125em;}
.rules ul { margin: 0; padding-left: 18px; }
.rules li { font-size: var(--ui-s); line-height: 1.25; margin: 3px 0; }
.rules.compact li { font-size: var(--ui-s); opacity: .9; }
.hud-actions { justify-self: end; display: flex; gap: 6px; }
.rules-btn { font-size: var(--ui-xs); }
.mode-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 560px) { .mode-grid { grid-template-columns: 1fr 1fr; } }
.mode-card { border: 2px dashed rgba(244, 234, 215, .45); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.mode-card h3 { margin: 0; font-size: var(--ui-m); color: var(--teal); }
.mode-card .rules { flex: 1; }
.rounds select, .setting select { background: var(--ink); border: 2px solid var(--parch); padding: 4px 6px; border-radius: 0; }

.race-board {
  position: absolute; top: calc(92px + env(safe-area-inset-top)); left: 0; right: 0; z-index: 3;
  display: flex; justify-content: center; flex-wrap: wrap; gap: 6px; padding: 0 56px; pointer-events: none;
}
#screen-duel .race-board { top: calc(56px + env(safe-area-inset-top)); padding: 0 12px; }
.race-chip { display: flex; flex-direction: column; align-items: center; font-size: var(--ui-xs); padding: 3px 8px; background: rgba(18, 26, 63, .9); border: 2px solid var(--house); box-shadow: 2px 2px 0 var(--shadow); }
.race-chip b { color: var(--house); font-size: var(--ui-xs); }
.race-chip.on { background: var(--house); color: #10131f; }
.race-chip.on b { color: #10131f; }
.duel-turn { position: absolute; top: calc(104px + env(safe-area-inset-top)); left: 0; right: 0; text-align: center; padding: 0 12px; }
.duel-turn-name { display: inline-block; color: var(--house); font-size: var(--ui-m); padding: 2px 10px; background: rgba(11, 9, 25, .85); box-shadow: 2px 2px 0 var(--shadow); }
.duel-hint { font-size: var(--ui-xs); margin-top: 4px; opacity: .9; text-shadow: 2px 2px 0 var(--shadow); }
.duel-grid {
  position: absolute; top: calc(160px + env(safe-area-inset-top)); bottom: 0; left: 0; right: 0;
  overflow-y: auto; padding: 0 10px calc(16px + env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 8px; align-items: center;
}
.duel-row { width: 100%; max-width: 780px; background: rgba(11, 9, 25, .55); padding: 6px; border: 2px solid rgba(244, 234, 215, .3); }
.duel-label { font-size: var(--ui-s); font-weight: 700; margin-bottom: 4px; }
.duel-label .red { color: #ff6a74; }
.duel-cards { display: flex; flex-wrap: wrap; gap: 4px; }
.duel-result { position: static; transform: none; left: auto; bottom: auto; }
.duel-result.pop { animation: pop .24s steps(4) both; }

/* ---------- pages */
.page-scroll { position: absolute; top: calc(52px + env(safe-area-inset-top)); bottom: 0; left: 0; right: 0; overflow-y: auto; padding: 8px 12px 24px; }
.page-panel { max-width: 660px; margin: 0 auto; }
.page-title { font-family: var(--font-mark); font-weight: 400; font-size: var(--mark-m); color: var(--teal); margin: 4px 0 14px; line-height: 1.5; }
.page-panel h2 { font-family: var(--font-ui); text-transform: uppercase; font-weight: 400; font-size: var(--ui-xs); color: var(--brass); margin: 22px 0 8px; line-height: 1.5; letter-spacing: .125em;}
.page-panel p, .page-panel li { font-size: var(--ui-s); line-height: 1.5; }
.page-panel ul { padding-left: 20px; }
.sources li { margin: 6px 0; }
.sources small { opacity: .75; }
.sources .sample { color: var(--magenta); opacity: .9; }
.sources.compact li { margin: 2px 0; font-size: var(--ui-s); }
.tier-table { border-collapse: collapse; width: 100%; margin-top: 8px; }
.tier-table th, .tier-table td { text-align: left; padding: 5px 8px; border-bottom: 1px dashed rgba(244, 234, 215, .25); }
.tier-table th { font-size: var(--ui-xs); opacity: .7; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px; }
.stat { border: 2px solid rgba(244, 234, 215, .35); padding: 10px; display: flex; flex-direction: column; }
.stat b { font-size: var(--ui-l); color: var(--teal); }
.stat small { font-size: var(--ui-xs); opacity: .75; }
.bars { display: flex; flex-direction: column; gap: 6px; }
.bar-row { display: grid; grid-template-columns: 90px 1fr 32px; gap: 8px; align-items: center; font-size: var(--ui-s); }
.bar { height: 12px; background: var(--ink); border: 2px solid rgba(244, 234, 215, .35); }
.bar-fill { display: block; height: 100%; }
.bar-n { text-align: right; font-variant-numeric: tabular-nums; }
.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px dashed rgba(244, 234, 215, .25); }
.setting input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--teal); }
.archive { list-style: none; padding: 0 !important; }
.arch-row { display: grid; grid-template-columns: 1fr auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px dashed rgba(244, 234, 215, .25); }
.arch-row small { display: block; font-size: var(--ui-xs); opacity: .7; }
.arch-res { text-align: right; font-family: system-ui, sans-serif; font-size: 13px; }
.center-msg { position: absolute; top: 40%; left: 16px; right: 16px; margin: 0 auto; max-width: 420px; }

/* ---------- menu, modal, toast */
#modals { position: relative; z-index: 100; }
.modal { position: fixed; inset: 0; background: rgba(5, 3, 16, .72); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-box { width: 100%; max-width: 420px; max-height: calc(100dvh - 32px); overflow-y: auto; animation: pop .2s steps(4) both; }
.modal-box h2 { margin-top: 0; }
.menu-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.menu-item { display: block; width: 100%; text-align: left; background: none; border: 0; border-bottom: 1px dashed rgba(244, 234, 215, .25); padding: 10px 4px; cursor: pointer; }
.menu-item:hover { background: var(--navy-2); }
.menu-item b { display: block; font-size: var(--ui-m); }
.menu-item small { font-size: var(--ui-xs); opacity: .7; }
#toast {
  position: fixed; left: 0; right: 0; margin: 0 auto; width: fit-content; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translateY(20px);
  z-index: 200; padding: 8px 14px; background: var(--teal); color: #10231f; font-weight: 700;
  border: 2px solid #10231f; box-shadow: 3px 3px 0 var(--shadow);
  opacity: 0; pointer-events: none; transition: opacity .2s steps(2), transform .2s steps(2);
}
#toast.show { opacity: 1; transform: none; }
.ad-slot { min-height: 60px; border: 2px dashed rgba(244, 234, 215, .3); }

/* ---------- small screens */
@media (max-width: 560px) {
  .hand { max-width: 320px; }
  #screen-play .hud-score { position: absolute; left: 10px; top: calc(54px + env(safe-area-inset-top)); margin: 0; padding: 3px 6px; }
  #screen-play .hud-score b { font-size: var(--ui-s); }
}
@media (max-width: 420px) {
  .pc-prompt { font-size: var(--ui-m); }
  .panel { padding: 14px; }
  .hand { padding-left: 20px; }
  .hud-score { margin-right: 40px; }
}

/* ---------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  html:not([data-motion="full"]) *, html:not([data-motion="full"]) *::before, html:not([data-motion="full"]) *::after {
    animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important;
  }
}
html[data-motion="reduce"] *, html[data-motion="reduce"] *::before, html[data-motion="reduce"] *::after {
  animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important;
}

#screen-race .hud { grid-template-columns: 64px 1fr 64px; }

/* ---------- Court Night: play mode, room lobby, phone controller */
.play-modes { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 8px; }
.play-mode {
  text-align: left; padding: 10px 12px; cursor: pointer; display: flex; flex-direction: column; gap: 4px;
  background: var(--ink); border: 2px solid rgba(244, 234, 215, .4); box-shadow: 3px 3px 0 var(--shadow);
}
.play-mode b { font-size: var(--ui-s); color: var(--parch); }
.play-mode small { font-size: var(--ui-xs); opacity: .8; line-height: 1.25; }
.play-mode.on { border-color: var(--teal); background: #0f3a3a; }
.play-mode.on b { color: var(--teal); }
@media (max-width: 480px) { .play-modes { grid-template-columns: 1fr; } }

.lobby-join { display: grid; grid-template-columns: 1fr auto; gap: 16px; align-items: center; }
.join-steps { margin: 0 0 10px; padding-left: 20px; font-size: var(--ui-s); line-height: 1.5; }
.room-url { display: inline; color: var(--teal); word-break: break-all; }
.room-code-label { font-family: var(--font-ui); text-transform: uppercase; font-size: var(--ui-xs); color: var(--brass); letter-spacing: .125em;}
.room-code { font-family: var(--font-mark); font-size: var(--mark-xl); letter-spacing: .125em; color: var(--parch); text-shadow: 4px 4px 0 var(--magenta), 7px 7px 0 var(--shadow); margin: 8px 0 6px; }
.room-status { font-size: var(--ui-xs); color: var(--teal); min-height: 17px; }
.qr-box canvas.qr { display: block; width: 168px; height: 168px; image-rendering: pixelated; border: 2px solid var(--parch); box-shadow: 4px 4px 0 var(--shadow); }
@media (max-width: 520px) { .lobby-join { grid-template-columns: 1fr; } .qr-box canvas.qr { width: 132px; height: 132px; } }
.lobby-houses { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.lobby-house { border-left: 6px solid var(--house, rgba(244, 234, 215, .4)); background: rgba(11, 9, 25, .4); padding: 8px 10px; }
.lobby-house b { color: var(--house, var(--parch)); font-size: var(--ui-s); }
.lobby-house ul { margin: 4px 0 0; padding-left: 16px; font-size: var(--ui-s); }
.lobby-house small { display: block; opacity: .6; margin-top: 4px; }
.lobby-house .offline { opacity: .5; }
.lobby-rules { margin-top: 2px; }
.lobby-rules summary { cursor: pointer; color: var(--teal); font-size: var(--ui-s); }

.phone-wrap { position: absolute; top: calc(52px + env(safe-area-inset-top)); bottom: 0; left: 0; right: 0; overflow-y: auto; padding: 6px 12px calc(16px + env(safe-area-inset-bottom)); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.phone-board { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; }
.phone-status { font-size: var(--ui-s); color: var(--magenta); text-align: center; background: rgba(11, 9, 25, .8); padding: 0 6px; }
.phone-status:empty { display: none; }
.phone-body { width: 100%; max-width: 480px; }
.phone-card { width: 100%; display: flex; flex-direction: column; gap: 8px; }
.phone-card .btn { width: 100%; }
.phone-card .pc-form .btn { width: auto; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: var(--ui-s); }
.code-input { font-family: var(--font-mark); font-size: var(--mark-l); letter-spacing: .25em; text-transform: uppercase; }
.house-picks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.house-pick { text-align: left; padding: 12px; cursor: pointer; background: var(--ink); border: 2px solid var(--house); border-left-width: 8px; box-shadow: 3px 3px 0 var(--shadow); display: flex; flex-direction: column; gap: 3px; min-height: 64px; }
.house-pick b { color: var(--house); font-size: var(--ui-m); }
.house-pick small { font-size: var(--ui-xs); opacity: .8; }
.house-pick.on { background: var(--house); }
.house-pick.on b, .house-pick.on small { color: #10131f; opacity: 1; }
.wait { font-size: var(--ui-s); opacity: .85; text-align: center; margin: 6px 0; }
.phone-row { max-width: none; }
.phone-row .duel-cards { gap: 6px; }
.phone-card .tier-card, .phone-card.tier-card { text-align: center; }

/* ---------- landing motion */
.score-pop {
  position: absolute; z-index: 4; pointer-events: none;
  transform: translate(-50%, -100%);
  font-family: var(--font-ui); font-size: var(--ui-l); line-height: 1; color: var(--pop);
  padding: 3px 7px 4px; white-space: nowrap;
  background: rgba(11, 9, 25, .92); border: 2px solid var(--pop); box-shadow: 3px 3px 0 var(--shadow);
  animation: scorePop 1.3s steps(13) forwards;
}
@keyframes scorePop {
  0% { opacity: 0; transform: translate(-50%, -60%) scale(.5); }
  12% { opacity: 1; transform: translate(-50%, -100%) scale(1.35); }
  24% { transform: translate(-50%, -110%) scale(1); }
  75% { opacity: 1; transform: translate(-50%, -260%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -320%) scale(.9); }
}
.year-counter.land { animation: yearLand .5s steps(5); }
@keyframes yearLand {
  0% { transform: scale(1.22); color: var(--land); }
  40% { transform: scale(.94); color: var(--land); }
  70% { transform: scale(1.04); }
  100% { transform: scale(1); }
}
/* tier card: lines arrive one after another, the tier name stamps in */
.tier-card.pop > * { animation: cardLine .28s steps(4) both; }
.tier-card.pop > :nth-child(1) { animation-delay: .04s; }
.tier-card.pop > :nth-child(2) { animation-delay: .1s; }
.tier-card.pop > :nth-child(3) { animation-delay: .2s; }
.tier-card.pop > :nth-child(4) { animation-delay: .3s; }
.tier-card.pop > :nth-child(5) { animation-delay: .4s; }
.tier-card.pop > :nth-child(6) { animation-delay: .48s; }
.tier-card.pop > :nth-child(7) { animation-delay: .56s; }
.tier-card.pop > :nth-child(8) { animation-delay: .64s; }
.tier-card.pop .tc-tier { animation: stamp .36s steps(4) both; }
@keyframes cardLine { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes stamp {
  0% { opacity: 0; transform: scale(2.1) rotate(-4deg); }
  60% { opacity: 1; transform: scale(.92) rotate(1deg); }
  100% { opacity: 1; transform: none; }
}
.tc-verdict { min-height: 1.3em; }

/* ---------- finale replay */
#screen-finale .finale-panel.waiting { opacity: 0; pointer-events: none; animation: none; }
#screen-finale .finale-panel.pop.show { animation: popF .32s steps(4) both; }
@media (min-width: 760px) { #screen-finale .finale-panel.pop.show { animation-name: popW; } }
.skip-hint {
  position: absolute; left: 0; right: 0; margin: 0 auto; width: fit-content; bottom: calc(18px + env(safe-area-inset-bottom)); z-index: 4;
  font-family: var(--font-ui); text-transform: uppercase; font-size: var(--ui-xs); color: var(--parch); cursor: pointer;
  background: rgba(11, 9, 25, .85); border: 2px solid rgba(244, 234, 215, .5); padding: 8px 12px;
  animation: hintBlink 1.2s steps(2, jump-none) infinite; letter-spacing: .125em;}
@keyframes hintBlink { 50% { opacity: .55; } }
.emoji-row .emo { display: inline-block; }
.finale-panel.show .emoji-row .emo { animation: emoPop .3s steps(3) both; animation-delay: calc(.25s + var(--i) * .09s); }
@keyframes emoPop { 0% { opacity: 0; transform: translateY(6px) scale(.4); } 70% { opacity: 1; transform: scale(1.25); } 100% { transform: none; } }
.fp-score b { font-variant-numeric: tabular-nums; }
.fp-highlights { display: grid; gap: 4px; margin: 10px 0 4px; text-align: left; border-top: 1px dashed rgba(244, 234, 215, .3); padding-top: 8px; }
.fp-hl { display: flex; justify-content: space-between; gap: 10px; font-size: var(--ui-s); }
.fp-hl span { opacity: .7; }
.fp-hl b { text-align: right; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 759px) {
  .fp-highlights { grid-template-columns: 1.6fr 1fr; gap: 10px; margin: 6px 0 2px; padding-top: 6px; }
  .fp-hl { flex-direction: column; gap: 0; font-size: var(--ui-xs); }
  .fp-hl b { text-align: left; }
  #screen-finale .fp-head { font-size: var(--ui-m); margin: 6px 0 4px; }
}
.finale-panel.show .fp-highlights { animation: cardLine .3s steps(3) .7s both; }


/* ---------- home: animated wordmark, start card, tiles, plaque */
.wordmark .wl {
  display: inline-block;
  animation: wlWave 2.6s steps(2, jump-none) infinite, wlShine 6s steps(1) infinite;
  animation-delay: calc(var(--i) * .13s), calc(1.2s + var(--i) * .07s);
}
.wordmark.intro .wl {
  animation: wlDrop .55s steps(5) both, wlWave 2.6s steps(2, jump-none) infinite, wlShine 6s steps(1) infinite;
  animation-delay: calc(var(--i) * .06s), calc(.8s + var(--i) * .13s), calc(1.2s + var(--i) * .07s);
}
@keyframes wlDrop { 0% { opacity: 0; transform: translateY(-40px); } 70% { opacity: 1; transform: translateY(4px); } 100% { transform: none; } }
@keyframes wlWave { 0%, 100% { transform: none; } 50% { transform: translateY(-3px); } }
@keyframes wlShine { 0%, 3% { color: #fff0b0; text-shadow: 3px 3px 0 var(--brass), 6px 6px 0 var(--shadow); } 4%, 100% { color: var(--parch); } }
.day-pill {
  display: inline-block; font-family: var(--font-ui); text-transform: uppercase; font-size: var(--ui-xs); color: #1d120a;
  background: var(--brass); padding: 4px 6px 3px; box-shadow: 2px 2px 0 var(--shadow); vertical-align: 2px; letter-spacing: .125em;}
.home-tag { min-height: 2.6em; }

.start-card {
  position: relative; top: 0; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 4px 12px;
  text-align: left; cursor: pointer; padding: 10px 14px 12px; color: #10231f;
  background: var(--teal); border: 2px solid #10231f;
  box-shadow: 0 5px 0 var(--teal-d), 5px 5px 0 5px var(--shadow);
}
.start-card:hover { filter: brightness(1.06); }
.start-card:active { top: 5px; box-shadow: 0 0 0 var(--teal-d), 2px 2px 0 2px var(--shadow); }
.start-pod { width: 48px; height: 48px; image-rendering: pixelated; grid-row: span 1; animation: podHover 1.6s steps(2, jump-none) infinite; filter: drop-shadow(2px 2px 0 rgba(0, 0, 0, .35)); }
@keyframes podHover { 0%, 100% { transform: none; } 50% { transform: translateY(-3px); } }
.start-text { display: flex; flex-direction: column; min-width: 0; }
.start-text b { font-size: var(--ui-m); line-height: 1.25; }
.start-text small { font-size: var(--ui-xs); opacity: .85; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.start-arrow { font-size: var(--ui-m); animation: nudge 1.2s steps(2, jump-none) infinite; }
@keyframes nudge { 50% { transform: translateX(4px); } }
.jump-pips { grid-column: 1 / -1; display: flex; gap: 4px; margin-top: 4px; }
.jp { flex: 1; height: 8px; background: rgba(16, 35, 31, .25); border: 2px solid #10231f; }
.jp.done { background: var(--c); }
.jp.next { animation: pipBlink 1s steps(2, jump-none) infinite; }
@keyframes pipBlink { 50% { background: rgba(255, 255, 255, .7); } }

.mt-art { flex: none; display: grid; place-items: center; width: 34px; height: 40px; }
.mt-card { width: 27px; height: 37px; image-rendering: pixelated; filter: drop-shadow(2px 2px 0 var(--shadow)); }
.mt-pods { position: relative; }
.mt-pods img { position: absolute; width: 24px; height: 24px; image-rendering: pixelated; }
.mt-pods img:first-child { left: -2px; top: 4px; }
.mt-pods img:last-child { left: 12px; top: 14px; }
.mode-tile:hover .mt-card { transform: translateY(-3px); }
.mode-tile:hover .mt-pods img:first-child { top: 1px; }

.home-plaque {
  display: grid; grid-template-columns: 96px 1fr 128px; text-align: center; /* fixed outer columns = whole-pixel cells */
  background: rgba(11, 9, 25, .9); border: 2px solid var(--brass-d);
  box-shadow: inset 0 0 0 2px #2a1a10, 3px 3px 0 var(--shadow);
}
.hp { display: flex; flex-direction: column; padding: 6px 4px 5px; }
.hp + .hp { border-left: 2px dashed rgba(232, 176, 75, .3); }
.hp b { font-size: var(--ui-m); color: var(--brass); line-height: 1.25; font-variant-numeric: tabular-nums; }
.hp small { font-size: var(--ui-xs); opacity: .75; }
.home-links { display: flex; justify-content: center; gap: 6px; margin-top: -4px; }
.home-links .link-btn { font-size: var(--ui-s); text-shadow: 2px 2px 0 var(--shadow); }

@media (max-height: 700px) {
  .home-tag { display: none; }
  .home-brand { padding-top: 8px; }
  .home-bottom { gap: 8px; }
  .start-card { padding: 6px 12px 8px; }
  .start-pod { width: 40px; height: 40px; }
}
#screen-home.tight .home-tag { display: none; }
#screen-home.tight .home-brand { padding-top: 8px; }

/* grid items must be allowed to shrink so long status lines ellipsize */
.home-cards > .mode-tile { min-width: 0; overflow: hidden; }
.mode-tile .mt-text { flex: 1; }

/* whole-pixel layout fixes */
small { font-size: var(--ui-xs); }
.club-ui { top: round(44%, 1px); }
.tier-table { table-layout: fixed; }
.tier-table th:nth-child(2), .tier-table td:nth-child(2) { width: 120px; }
.tier-table th:nth-child(3), .tier-table td:nth-child(3) { width: 72px; }
.event-marker { white-space: normal; max-width: min(46vw, 280px); }
.ruler .tick span { top: -10px; }
/* suit symbols come from a system font: give them a whole-pixel box so the text after stays on the grid */
.sym { display: inline-block; width: 1.25em; text-align: left; font-family: system-ui, sans-serif; line-height: 1; }
.duel-label .sym.red, .sym.red { color: #ff6a74; }
/* tile subtitles may take two lines instead of being cut off */
.mode-tile .mt-text small { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* ---------- Suit Up cash-out receipt */
.receipt-wrap { background: rgba(5, 3, 16, .55); }
.receipt {
  position: relative; width: 100%; max-width: 368px; max-height: calc(100dvh - 48px); overflow-y: auto;
  padding: 18px 16px 18px; color: #1b1530; background: #f4ead7;
  border-left: 2px solid #1d120a; border-right: 2px solid #1d120a;
  box-shadow: 4px 4px 0 var(--shadow);
}
/* punched perforation holes along the top and bottom edges */
.receipt::before, .receipt::after {
  content: ''; position: absolute; left: 0; right: 0; height: 6px;
  background: repeating-linear-gradient(90deg, rgba(11, 9, 25, .88) 0 6px, transparent 6px 12px);
}
.receipt::before { top: 0; }
.receipt::after { bottom: 0; }
.rc-close {
  position: absolute; top: 12px; right: 10px; min-width: 32px; min-height: 32px; cursor: pointer;
  font-size: var(--ui-xs); color: #1b1530; background: transparent; border: 2px solid #1b1530;
}
.rc-band {
  display: inline-block; margin: 4px 0 8px; padding: 4px 8px;
  font-size: var(--ui-xs); text-transform: uppercase; letter-spacing: .125em;
  color: #1d120a; background: var(--brass); box-shadow: 2px 2px 0 #a8742a;
}
.rc-title { margin: 2px 0 4px; font-family: var(--font-mark); font-weight: 400; font-size: var(--mark-m); line-height: 1.5; }
.rc-sub { font-size: var(--ui-xs); color: #4a3a5a; }
.rc-lines { list-style: none; margin: 12px 0 0; padding: 0; border-top: 2px dashed #c8b898; }
.rc-line { display: grid; grid-template-columns: 27px 1fr auto; gap: 12px; align-items: center; padding: 6px 0; border-bottom: 2px dashed #c8b898; }
.rc-card { width: 27px; height: 37px; image-rendering: pixelated; }
.rc-what b { display: block; font-size: var(--ui-s); }
.rc-what small { display: block; font-size: var(--ui-xs); color: #5a4a68; }
.rc-delta { font-size: var(--ui-m); }
.rc-line.ok .rc-delta { color: #1e7a3a; }
.rc-line.bad .rc-delta { color: #a02030; }
.rc-total {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-top: 8px; padding-top: 8px; border-top: 6px double #1b1530;
  font-size: var(--ui-m); text-transform: uppercase;
}
.rc-total b { font-size: var(--ui-xl); font-variant-numeric: tabular-nums; }
.rc-meta { margin-top: 4px; font-size: var(--ui-xs); color: #5a4a68; }
.rc-stamp-row { text-align: center; margin: 16px 0 8px; }
.rc-stamp {
  display: inline-block; padding: 8px 12px 6px;
  font-family: var(--font-mark); font-size: var(--mark-m); line-height: 1.5; text-transform: uppercase;
  color: var(--stamp); border: 4px solid var(--stamp);
  box-shadow: inset 0 0 0 2px #f4ead7, inset 0 0 0 4px var(--stamp);
}
.rc-emoji { text-align: center; }
.receipt .fp-actions { margin-top: 12px; }
.rc-foot { margin-top: 10px; text-align: center; font-size: var(--ui-xs); color: #5a4a68; }
.rc-foot b { color: #a8742a; }
.reopen { align-self: center; }

/* the print-out ceremony after the fifth card */
.receipt.print { animation: receiptIn .45s steps(6) both; }
@keyframes receiptIn { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.receipt.print .rc-line { animation: rcLine .24s steps(3) both; animation-delay: calc(.25s + var(--k) * .26s); }
.receipt.print .rc-total { animation: rcLine .24s steps(3) 1.5s both; }
.receipt.print .rc-meta { animation: rcLine .24s steps(3) 1.65s both; }
.receipt.print .rc-stamp { animation: stampHit .4s steps(4) 2.3s both; }
.receipt.print .rc-emoji, .receipt.print .fp-actions, .receipt.print .rc-foot { animation: rcLine .24s steps(3) 2.6s both; }
@keyframes rcLine { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
@keyframes stampHit { 0% { opacity: 0; transform: scale(2.25); } 60% { opacity: 1; transform: scale(.92); } 100% { opacity: 1; transform: none; } }
