:root {
  --paper: #f1e6cf;
  --paper-2: #e9dcc0;
  --verm: #e2513a;
  --teal: #1d5c63;
  --ochre: #d9a03b;
  --plum: #6b3d6e;
  --ink: #22201c;
  --display: 'Big Shoulders Display', 'Oswald', 'Arial Narrow', Impact, sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, Menlo, Consolas, monospace;
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .14 0 0 0 0 .12 0 0 0 0 .1 0 0 0 .14 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  --dots-verm: radial-gradient(circle, rgba(226,81,58,.55) 1.1px, transparent 1.4px);
  --dots-teal: radial-gradient(circle, rgba(29,92,99,.45) 1px, transparent 1.3px);
  --dots-ink: radial-gradient(circle, rgba(34,32,28,.22) 1px, transparent 1.3px);
  --tray-h: 132px;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--paper); color: var(--ink); overflow: hidden; }
body {
  font-family: var(--mono);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  user-select: none; -webkit-user-select: none;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; cursor: pointer; }
kbd {
  font-family: var(--mono); font-size: 10px; font-weight: 600; letter-spacing: .04em;
  border: 1.5px solid currentColor; border-radius: 3px; padding: 0 4px; line-height: 1.5;
}
[hidden] { display: none !important; }

#app {
  position: fixed; inset: 0;
  display: grid; grid-template-rows: auto 1fr auto;
  background: var(--paper) var(--grain);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left);
}

/* ------------------------------------------------------------ HUD */
#hud {
  display: flex; align-items: stretch; gap: 0; padding: 6px 12px 7px;
  border-bottom: 2.5px solid var(--ink);
  box-shadow: 0 2px 0 -0.5px rgba(29,92,99,.55);
  position: relative; z-index: 2; min-height: 56px;
  overflow-x: auto; scrollbar-width: none;
}
#hud::-webkit-scrollbar { display: none; }
.hud-block {
  display: flex; flex-direction: column; justify-content: center; padding: 0 14px;
  border-right: 1.5px dashed rgba(34,32,28,.35); white-space: nowrap; flex: 0 0 auto;
}
.hud-block:last-child { border-right: 0; margin-left: auto; text-align: right; }
.hud-block .lbl { font-size: 10px; font-weight: 600; letter-spacing: .16em; text-transform: uppercase; opacity: .7; }
.hud-block b { font-family: var(--display); font-weight: 900; font-size: 32px; line-height: .95; letter-spacing: .01em; }
.score b { color: var(--ink); text-shadow: 1.5px 1px 0 rgba(226,81,58,.55); min-width: 4ch; }
.speedb b, .timeb b { font-variant-numeric: tabular-nums; }

.ticket {
  position: relative; flex-direction: row; align-items: center; gap: 8px; margin: 0 10px; padding: 2px 16px;
  border: 0; background:
    radial-gradient(circle at 0 50%, var(--paper) 6px, transparent 6.5px),
    radial-gradient(circle at 100% 50%, var(--paper) 6px, transparent 6.5px),
    var(--paper-2);
  outline: 2px solid var(--verm); outline-offset: -5px;
}
.ticket .lbl { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 9px; color: var(--verm); opacity: 1; }
.ticket .tno { font-family: var(--mono); font-weight: 700; font-size: 13px; color: var(--verm); letter-spacing: .08em; }
.ticket b { font-size: 30px; color: var(--verm); }
.ticket.hot { background:
    radial-gradient(circle at 0 50%, var(--paper) 6px, transparent 6.5px),
    radial-gradient(circle at 100% 50%, var(--paper) 6px, transparent 6.5px),
    var(--verm); outline-color: var(--paper); }
.ticket.hot .tno, .ticket.hot b, .ticket.hot .lbl { color: var(--paper); }
.ticket.pulse { animation: tick .35s cubic-bezier(.3,1.6,.5,1); }
@keyframes tick { 0% { transform: scale(1.25) rotate(-3deg); } 100% { transform: none; } }

.holes { display: flex; gap: 5px; margin-top: 4px; }
.holes i { width: 13px; height: 13px; border-radius: 50%; border: 2px solid var(--ink); }
.holes i.on { background: var(--teal); border-color: var(--teal); box-shadow: 1px 1px 0 var(--ink); }
.seats { display: flex; gap: 4px; margin-top: 4px; }
.seat { width: 16px; height: 16px; border-radius: 3px; border: 2px dashed rgba(34,32,28,.5); display: block; }
.seat.full { border: 2px solid var(--ink); background: var(--c); }
.seat.full.late { background: repeating-linear-gradient(45deg, var(--c) 0 3px, var(--paper) 3px 5px); }
.seat.gold { border: 2px solid var(--ink); background: var(--ochre); clip-path: polygon(15% 0, 85% 0, 100% 100%, 0 100%); }
.charges { flex-direction: row; align-items: center; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 2px; font-weight: 700; font-size: 13px; }
.chip svg { width: 22px; height: 22px; }
.chip.zero { opacity: .35; }

/* ------------------------------------------------------------ stage */
#stage { position: relative; min-height: 0; overflow: hidden; }
#board { position: absolute; left: 0; top: 0; display: block; touch-action: none; }
#toast {
  position: absolute; top: 10px; left: 50%; transform: translate(-50%, -30px) rotate(-1.5deg); opacity: 0;
  font-family: var(--display); font-weight: 900; font-size: 22px; letter-spacing: .06em; text-transform: uppercase;
  padding: 4px 14px; background: var(--paper); border: 2.5px solid var(--ink); box-shadow: 3px 3px 0 var(--teal);
  pointer-events: none; transition: transform .25s cubic-bezier(.3,1.5,.5,1), opacity .2s; z-index: 3; white-space: nowrap;
}
#toast.show { transform: translate(-50%, 0) rotate(-1.5deg); opacity: 1; }
#toast[data-ink="verm"] { color: var(--verm); border-color: var(--verm); }
#toast[data-ink="ochre"] { color: var(--ink); background: var(--ochre); }
#toast[data-ink="plum"] { color: var(--plum); border-color: var(--plum); }
#toast[data-ink="teal"] { color: var(--teal); border-color: var(--teal); box-shadow: 3px 3px 0 var(--verm); }

#tip {
  position: absolute; left: 50%; bottom: 12px; transform: translateX(-50%) rotate(-.6deg);
  width: min(520px, calc(100% - 24px)); z-index: 4;
  background: var(--paper); border: 2.5px solid var(--ink); box-shadow: 4px 4px 0 var(--verm);
  padding: 12px 14px 10px; display: flex; gap: 12px; align-items: flex-end;
}
#tip p { margin: 0; font-size: 14px; line-height: 1.45; flex: 1; }
#tip p b { font-family: var(--display); font-weight: 800; font-size: 18px; letter-spacing: .03em; color: var(--verm); }
#tip-skip { border: 0; background: none; text-decoration: underline; font-size: 11px; opacity: .7; padding: 2px; white-space: nowrap; }
#arrow {
  position: fixed; z-index: 30; width: 0; height: 0; pointer-events: none;
  border-left: 12px solid transparent; border-right: 12px solid transparent; border-top: 20px solid var(--verm);
  transform: translate(-50%, -100%); animation: bob .7s ease-in-out infinite alternate;
  filter: drop-shadow(2px 2px 0 var(--ink));
}
#arrow.up { border-top: 0; border-bottom: 20px solid var(--verm); transform: translate(-50%, 0); animation-name: bobup; }
@keyframes bob { to { margin-top: -8px; } }
@keyframes bobup { to { margin-top: 8px; } }

/* ------------------------------------------------------------ tray */
#tray {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  border-top: 2.5px solid var(--ink); box-shadow: 0 -2px 0 -0.5px rgba(226,81,58,.45);
  position: relative; z-index: 2; background: var(--paper) var(--grain);
}
#gauge { display: flex; flex-direction: column; gap: 6px; min-width: 150px; }
#gauge-note { font-weight: 700; font-size: 11px; letter-spacing: .14em; }
#gauge-cells { display: flex; gap: 4px; }
#gauge-cells i { width: 18px; height: 30px; border: 2px solid var(--ink); border-radius: 2px; background: var(--paper); position: relative; }
#gauge-cells i.on { background: var(--teal); box-shadow: inset 0 0 0 2px var(--paper); }
#gauge[data-level="mid"] #gauge-cells i.on { background: var(--ochre); }
#gauge[data-level="low"] #gauge-note { color: var(--verm); animation: blink .4s steps(2) infinite; }
#gauge[data-level="low"] #gauge-cells i { border-color: var(--verm); box-shadow: 0 0 0 3px rgba(226,81,58,.25); }
#gauge[data-level="low"] #gauge-cells { animation: glow .5s ease-in-out infinite alternate; }
#gauge[data-level="full"] #gauge-note { color: var(--teal); }
#gauge[data-level="rev"] #gauge-note { color: var(--plum); }
#gauge[data-level="rev"] #gauge-cells i { background: repeating-linear-gradient(135deg, var(--plum) 0 3px, var(--paper) 3px 6px); }
#gauge.nope { animation: nope .3s; }
@keyframes blink { 50% { opacity: .25; } }
@keyframes glow { to { filter: drop-shadow(0 0 4px rgba(226,81,58,.7)); } }

#hand { display: flex; gap: 10px; align-items: flex-end; position: relative; }
.card {
  width: 88px; height: 108px; padding: 6px 6px 7px; position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between;
  background: var(--paper); border: 2.5px solid var(--ink); border-radius: 8px;
  box-shadow: 3px 3px 0 var(--teal);
  transition: transform .12s, box-shadow .12s, opacity .15s;
  touch-action: manipulation;
}
.card::before { content: ''; position: absolute; inset: 3px; border-radius: 5px; background: var(--dots-ink); background-size: 5px 5px; opacity: .35; pointer-events: none; }
.card:hover, .card.hover { transform: translateY(-5px); box-shadow: 3px 7px 0 var(--teal); }
.card:active { transform: translateY(2px); box-shadow: 1px 1px 0 var(--teal); }
.card .key {
  position: absolute; top: -9px; left: -9px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--ink); color: var(--paper); font-weight: 700; font-size: 13px; display: grid; place-items: center;
  box-shadow: 1.5px 1px 0 var(--verm); z-index: 1;
}
.card svg { width: 62px; height: 62px; position: relative; overflow: visible; }
.card .nm { font-family: var(--display); font-weight: 800; font-size: 15px; letter-spacing: .06em; position: relative; }
.card.dim { opacity: .55; }
.card.slap { animation: slap .32s cubic-bezier(.2,1.4,.4,1); }
.card.nope { animation: nope .3s; }
@keyframes slap {
  0% { transform: translateY(-18px) rotate(-6deg) scale(1.08); box-shadow: 8px 12px 0 var(--teal); }
  45% { transform: translateY(3px) rotate(1deg) scale(.95); box-shadow: 0 0 0 var(--teal); }
  100% { transform: none; }
}
@keyframes nope { 20%, 60% { transform: translateX(-5px); } 40%, 80% { transform: translateX(5px); } }
.tie { stroke: var(--ink); stroke-width: 5; }
.rail { stroke: var(--teal); stroke-width: 4.2; fill: none; stroke-linecap: round; }
.mis .rail { stroke: var(--verm); opacity: .38; transform: translate(1.6px, 1.2px); }
.rail.top { mix-blend-mode: multiply; }
.buffer { fill: var(--verm); stroke: var(--ink); stroke-width: 2; }
.spur { fill: none; stroke: var(--verm); stroke-width: 3; stroke-dasharray: 4 3; }
.x3 { font-family: var(--display); font-weight: 900; font-size: 15px; fill: var(--verm); text-anchor: end; }

.card.special { border-color: var(--verm); box-shadow: 3px 3px 0 var(--ink); }
.card.special::before { background: var(--dots-verm); background-size: 5px 5px; opacity: .45; }
.card.special .key { background: var(--verm); box-shadow: 1.5px 1px 0 var(--ink); }
.card.special .nm { font-size: 13px; color: var(--verm); }
.card.special:not(.charged) { opacity: .4; filter: grayscale(.8); box-shadow: none; transform: none; }
.card.special:not(.charged) .nm { color: var(--ink); }
#next-cards { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: 9px; font-weight: 700; letter-spacing: .12em; margin-left: 2px; }
#next-cards i { width: 34px; height: 34px; border: 1.5px dashed var(--ink); border-radius: 4px; display: grid; place-items: center; }
#next-cards svg { width: 28px; height: 28px; }

#actions { display: flex; gap: 8px; align-items: stretch; }
.act {
  position: relative; width: 74px; min-height: 76px; padding: 6px 4px 5px;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 2px;
  background: var(--paper); border: 2px solid var(--ink); border-radius: 6px;
  font-size: 11px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; overflow: hidden;
  box-shadow: 2px 2px 0 rgba(34,32,28,.85);
}
.act::after {
  content: ''; position: absolute; left: 0; right: 0; bottom: 0; height: calc(var(--cd, 0) * 100%);
  background: repeating-linear-gradient(135deg, rgba(34,32,28,.22) 0 3px, transparent 3px 6px); pointer-events: none;
}
.act:active { transform: translate(1px, 1px); box-shadow: 1px 1px 0 var(--ink); }
.act.ready { border-color: var(--teal); }
.act.active { background: var(--ochre); }
.act.small { width: 60px; }
.act b { font-weight: 700; }
.act kbd { font-size: 9px; opacity: .7; }
.ico { width: 26px; height: 22px; background: center / contain no-repeat; display: block; }
.ico.whistle { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 22'%3E%3Crect x='3' y='8' width='14' height='10' rx='2' fill='%2322201c'/%3E%3Crect x='7' y='4' width='5' height='5' fill='%2322201c'/%3E%3Cpath d='M19 6c3 2 3 8 0 10M22 3c4 4 4 12 0 16' fill='none' stroke='%231d5c63' stroke-width='2'/%3E%3C/svg%3E"); }
.ico.lift { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 22'%3E%3Cpath d='M4 18h18M6 14h14' stroke='%2322201c' stroke-width='3'/%3E%3Cpath d='M13 11V2M8 6l5-5 5 5' fill='none' stroke='%23e2513a' stroke-width='2.5'/%3E%3C/svg%3E"); }
.ico.brake { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 22'%3E%3Cpath d='M8 20L18 4' stroke='%2322201c' stroke-width='3'/%3E%3Ccircle cx='18' cy='4' r='3.5' fill='%23e2513a'/%3E%3Crect x='3' y='18' width='14' height='4' fill='%2322201c'/%3E%3C/svg%3E"); }
.ico.demolish { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 22'%3E%3Cpath d='M6 21L16 7' stroke='%2322201c' stroke-width='3'/%3E%3Cpath d='M11 3l12 7-2 3-12-7z' fill='%23e2513a'/%3E%3C/svg%3E"); }
.ico.redraw { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 22'%3E%3Cpath d='M6 18V9a7 7 0 0 1 14 0v9' fill='none' stroke='%23d9a03b' stroke-width='4'/%3E%3Cpath d='M6 18V9a7 7 0 0 1 14 0v9' fill='none' stroke='%2322201c' stroke-width='1.2'/%3E%3C/svg%3E"); }
.ico.pause { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 26 22'%3E%3Crect x='7' y='3' width='4' height='16' fill='%2322201c'/%3E%3Crect x='15' y='3' width='4' height='16' fill='%2322201c'/%3E%3C/svg%3E"); }

/* ------------------------------------------------------------ overlays */
.overlay {
  position: absolute; inset: 0; z-index: 10; display: grid; place-items: center; padding: 16px;
  background: rgba(241,230,207,.80);
  background-image: var(--dots-ink); background-size: 6px 6px;
  overflow-y: auto;
}
#title { background-color: rgba(241,230,207,.62); }
.poster, .panel {
  position: relative; background: var(--paper) var(--grain); border: 3px solid var(--ink);
  box-shadow: 6px 6px 0 var(--teal), 6px 6px 0 2.5px var(--ink);
  padding: 22px 26px; max-width: 640px; width: 100%;
}
.poster::before {
  content: ''; position: absolute; inset: 8px; border: 1.5px solid var(--ink); pointer-events: none;
}
.kicker { font-size: 11px; letter-spacing: .26em; text-transform: uppercase; font-weight: 600; text-align: center; }
.logo, .end {
  margin: 4px 0 0; text-align: center; font-family: var(--display); font-weight: 900; line-height: .86;
  font-size: clamp(64px, 15vw, 148px); letter-spacing: .01em;
}
.logo span, .end span { display: block; position: relative; isolation: isolate; }
.logo span::before, .end span::before {
  content: attr(data-t); position: absolute; inset: 0; color: var(--teal); transform: translate(3px, 2.5px);
  opacity: .7; z-index: -1;
}
.logo span:first-child { color: var(--ink); }
.logo span:last-child { color: var(--verm); }
.tag { text-align: center; margin: 10px 0 16px; font-size: 15px; font-weight: 500; }
.modes { display: grid; gap: 10px; }
.mode {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border: 2.5px solid var(--ink); background: var(--paper); text-align: left;
  box-shadow: 3px 3px 0 var(--ink); transition: transform .1s, box-shadow .1s;
}
.mode:hover { transform: translate(-2px, -2px); box-shadow: 5px 5px 0 var(--ink); }
.mode:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.mode .mname { font-family: var(--display); font-weight: 900; font-size: 30px; text-transform: uppercase; letter-spacing: .03em; }
.mode .minfo { font-size: 12px; text-align: right; }
.mode.primary { background: var(--verm); color: var(--paper); border-color: var(--ink); }
.mode.primary .mname { text-shadow: 2px 1.5px 0 rgba(34,32,28,.35); }
.mode.ghost { background: transparent; border-style: dashed; box-shadow: none; }
.mode.ghost .mname { font-size: 22px; }
.foot { display: flex; justify-content: space-between; gap: 10px; margin-top: 12px; font-size: 12px; min-height: 1em; }
.keys { margin-top: 12px; padding-top: 10px; border-top: 1.5px dashed rgba(34,32,28,.4); font-size: 11px; text-align: center; line-height: 2; }
.keys kbd { margin: 0 1px; }

.panel { max-width: 380px; }
.panel h2, .depot-head h2 { font-family: var(--display); font-weight: 900; font-size: 40px; margin: 0 0 12px; text-transform: uppercase; letter-spacing: .02em; }
.row { display: flex; justify-content: space-between; align-items: center; gap: 14px; padding: 8px 0; font-weight: 600; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; }
.row input[type=range] { flex: 1; accent-color: var(--verm); }
.row.check { justify-content: flex-start; }
.row.check input { width: 20px; height: 20px; accent-color: var(--teal); }
.btns { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 14px; }
.panel .btns { flex-direction: column; }
.btn {
  padding: 10px 16px; border: 2.5px solid var(--ink); background: var(--paper); font-weight: 700; font-size: 14px;
  letter-spacing: .08em; text-transform: uppercase; box-shadow: 3px 3px 0 var(--ink); display: inline-flex; gap: 10px; align-items: center; justify-content: center;
}
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn.primary { background: var(--teal); color: var(--paper); }
.btn kbd { font-size: 9px; }

.panel.wide { max-width: 760px; }
.depot-head { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; border-bottom: 2px solid var(--ink); margin-bottom: 14px; }
.depot-head h2 { margin: 0; font-size: 34px; }
#depot-no { font-weight: 700; color: var(--verm); letter-spacing: .14em; font-size: 12px; }
.depot-head .sub { margin-left: auto; font-size: 11px; letter-spacing: .1em; text-transform: uppercase; color: var(--teal); font-weight: 700; padding-bottom: 6px; }
#depot-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.upg {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  padding: 16px 10px 14px; background: var(--paper); border: 2.5px solid var(--ink); border-radius: 8px;
  box-shadow: 4px 4px 0 var(--teal); animation: deal .38s cubic-bezier(.2,1.3,.4,1) both; animation-delay: var(--d);
}
.upg:hover { transform: translateY(-5px) rotate(-.8deg); box-shadow: 4px 9px 0 var(--teal); }
.upg .key { position: absolute; top: -10px; left: -10px; width: 26px; height: 26px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-weight: 700; }
.upg .art { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 50%; background: var(--dots-verm); background-size: 5px 5px; }
.upg .art svg { width: 54px; height: 54px; }
.upg .nm { font-family: var(--display); font-weight: 900; font-size: 24px; text-transform: uppercase; line-height: 1; }
.upg .ds { font-size: 12px; line-height: 1.35; }
.upg .have { font-size: 10px; letter-spacing: .1em; text-transform: uppercase; color: var(--teal); font-weight: 700; }
@keyframes deal { from { transform: translateY(40px) rotate(4deg); opacity: 0; } }

/* glyph classes for upgrade icons */
.g-k { fill: var(--ink); } .g-p { fill: var(--paper); } .g-t { fill: var(--teal); } .g-v { fill: var(--verm); }
.g-pl { fill: var(--plum); } .g-ochre-f { fill: var(--ochre); }
.g-o { fill: none; stroke: var(--ink); stroke-width: 2.5; stroke-linejoin: round; }
.g-o2 { fill: none; stroke: var(--ink); stroke-width: 3; stroke-linecap: round; }
.g-o3 { fill: none; stroke: var(--ink); stroke-width: 4; stroke-linecap: round; }
.g-o4 { fill: none; stroke: var(--ink); stroke-width: 9; stroke-linecap: round; }
.g-ochre { fill: none; stroke: var(--ochre); stroke-width: 5; stroke-linecap: round; }
.g-t2 { fill: none; stroke: var(--teal); stroke-width: 3.5; stroke-linecap: round; }
.g-vs { fill: none; stroke: var(--verm); stroke-width: 3; stroke-linecap: round; }
.g-p2 { stroke: var(--paper); stroke-width: 3; }

/* ------------------------------------------------------------ results */
.results { max-width: 780px; }
.end { font-size: clamp(54px, 11vw, 112px); color: var(--verm); }
.end span::before { color: var(--teal); opacity: .55; }
.cause { text-align: center; margin: 8px 0 14px; font-weight: 600; font-size: 14px; }
.res-grid { display: grid; grid-template-columns: 1fr 1.25fr; gap: 18px; align-items: start; }
.bigscore { display: flex; flex-direction: column; border-bottom: 2px solid var(--ink); padding-bottom: 8px; margin-bottom: 8px; }
.bigscore .lbl { font-size: 11px; letter-spacing: .16em; text-transform: uppercase; font-weight: 600; }
.bigscore b { font-family: var(--display); font-weight: 900; font-size: 64px; line-height: .95; text-shadow: 2px 1.5px 0 rgba(226,81,58,.5); }
#res-best { font-size: 12px; min-height: 1.4em; }
.newbest { display: inline-block; background: var(--verm); color: var(--paper); font-weight: 700; letter-spacing: .14em; padding: 2px 8px; transform: rotate(-2deg); }
.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 12px; }
.stats div { display: flex; justify-content: space-between; border-bottom: 1px dashed rgba(34,32,28,.4); padding: 3px 0; font-size: 12px; }
.stats b { font-weight: 700; }
.res-map { margin: 0; }
.res-map canvas { width: 100%; aspect-ratio: 28 / 18; display: block; border: 2px solid var(--ink); background: var(--paper); }
.res-map figcaption { font-size: 10px; letter-spacing: .14em; margin-top: 4px; text-align: right; }
.cards-taken { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }
.tchip { display: inline-flex; align-items: center; gap: 4px; border: 1.5px solid var(--ink); border-radius: 14px; padding: 2px 9px 2px 4px; font-size: 11px; font-weight: 600; }
.tchip svg { width: 20px; height: 20px; }
.none { font-size: 12px; opacity: .7; }

/* ------------------------------------------------------------ end-of-line stamp */
#endstamp {
  position: absolute; left: 50%; top: 42%; z-index: 9; pointer-events: none; text-align: center;
  transform: translate(-50%, -50%) rotate(-8deg) scale(2.4); opacity: 0;
  border: 5px solid var(--verm); padding: 10px 22px 8px; background: rgba(241,230,207,.9);
  box-shadow: 5px 4px 0 rgba(34,32,28,.85);
}
#endstamp b { display: block; font-family: var(--display); font-weight: 900; font-size: clamp(40px, 9vw, 92px); color: var(--verm); line-height: .9; letter-spacing: .02em; text-shadow: 3px 2px 0 rgba(29,92,99,.45); }
#endstamp span { font-weight: 700; font-size: 13px; letter-spacing: .12em; text-transform: uppercase; }
#endstamp.show { animation: stampin .45s cubic-bezier(.2,1.5,.4,1) forwards; }
@keyframes stampin { to { opacity: 1; transform: translate(-50%, -50%) rotate(-8deg) scale(1); } }

/* ------------------------------------------------------------ screens */
#app[data-screen="title"] #hud, #app[data-screen="title"] #tray { visibility: hidden; }
#app[data-screen="results"] #tray { visibility: hidden; }

/* ------------------------------------------------------------ responsive */
@media (hover: none) { .act kbd, .card .key, .keys { display: none; } .card .key { display: grid; } }
@media (max-height: 560px) {
  #hud { min-height: 44px; padding: 3px 8px 4px; }
  .hud-block b { font-size: 24px; }
  .ticket b { font-size: 22px; }
  .card { width: 70px; height: 84px; padding: 4px; }
  .card svg { width: 44px; height: 44px; }
  .card .nm { font-size: 12px; }
  .act { width: 58px; min-height: 60px; font-size: 9px; }
  .act kbd { display: none; }
  #tray { padding-top: 6px; padding-bottom: calc(6px + env(safe-area-inset-bottom)); gap: 10px; }
  #gauge { min-width: 110px; }
  #gauge-cells i { width: 13px; height: 22px; }
  .logo { font-size: clamp(48px, 13vh, 110px); }
  .poster { padding: 14px 18px; }
  .mode { padding: 7px 12px; } .mode .mname { font-size: 22px; }
}
@media (max-width: 760px) {
  #hud { padding: 4px 6px; }
  .hud-block { padding: 0 8px; }
  .hud-block b { font-size: 24px; }
  .ticket { margin: 0 4px; padding: 2px 10px; }
  .ticket b { font-size: 22px; }
  .ticket .tno { display: none; }
  .timeb .lbl { display: none; }
  #tray { flex-wrap: wrap; gap: 8px 10px; }
  #hand { order: 2; width: 100%; justify-content: center; }
  .card { flex: 1 1 0; max-width: 96px; width: auto; height: 96px; }
  #gauge { order: 1; min-width: 0; flex: 1; }
  #actions { order: 1; gap: 6px; }
  .act { width: 54px; min-height: 54px; font-size: 9px; padding: 4px 2px; }
  .act kbd { display: none; }
  .act.small { width: 46px; }
  #depot-cards { grid-template-columns: 1fr; gap: 10px; }
  .upg { flex-direction: row; text-align: left; padding: 10px 12px; flex-wrap: wrap; }
  .upg .art { width: 46px; height: 46px; } .upg .art svg { width: 38px; height: 38px; }
  .upg .nm { font-size: 20px; }
  .upg .ds { flex-basis: 100%; }
  .res-grid { grid-template-columns: 1fr; }
  .bigscore b { font-size: 48px; }
  .mode { flex-direction: column; align-items: flex-start; gap: 2px; }
  .mode .minfo { text-align: left; }
  .charges { display: none; }
}
@media (max-width: 420px) {
  .speedb { display: none; }
  .hud-block .lbl { font-size: 9px; letter-spacing: .1em; }
  .seat { width: 13px; height: 13px; }
  .holes i { width: 10px; height: 10px; }
  #gauge-cells i { width: 12px; height: 20px; }
}
