:root {
  color-scheme: dark;
  --ink: #081b1b;
  --cream: #fff1cf;
  --muted: #b3c1b5;
  --gold: #f3ce83;
  --brass: #9a774c;
  --mint: #8bf1cc;
  --metal: linear-gradient(100deg, #685035, #d6aa68 9%, #ffdfa1 18%, #a07948 41%, #eac58b 76%, #76583b);
  --enamel: linear-gradient(165deg, #264844, #15332f 40%, #102726 80%, #0b1e1e);
  --font: ui-rounded, "Hiragino Maru Gothic ProN", "Yu Gothic", Meiryo, system-ui, sans-serif;
  font: 700 15px/1.45 var(--font);
  color: var(--cream);
  font-variant-numeric: tabular-nums;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  padding: max(10px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  min-height: 100vh;
  background: radial-gradient(ellipse at 50% 0, #3b4240, transparent 62%),
    repeating-linear-gradient(130deg, #101d1d 0 2px, #122021 2px 6px);
}
body:has(dialog[open]) { overflow: hidden; }
h1, h2, h3, p, ol, dl, dd { margin: 0; }
button, select, input { font: inherit; color: inherit; }
button, select { cursor: pointer; }
button { -webkit-tap-highlight-color: transparent; }
button:disabled, input:disabled { cursor: default; }
button:focus-visible, select:focus-visible, input:focus-visible, [tabindex]:focus-visible {
  outline: 3px solid #aaffeb;
  outline-offset: 2px;
  z-index: 2;
}
[hidden] { display: none !important; }
.sr-only {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden; clip-path: inset(50%); white-space: nowrap;
}
i[data-icon] {
  display: inline-block;
  flex: none;
  width: 1.2em; height: 1.2em;
  background: currentColor;
  mask: var(--icon) center / contain no-repeat;
  vertical-align: -.2em;
}
.cabinet {
  width: min(100%, 1190px);
  margin: auto;
  border: 1px solid #d7b880;
  border-bottom: 5px solid #72543c;
  border-radius: 33px 33px 23px 23px;
  padding: 4px;
  background: var(--metal);
  box-shadow: 0 0 0 2px #281f1d, 0 13px 35px #0009, inset 0 1px #fff0bc;
}
.marquee {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(12px, 2.2vw, 36px);
  padding: 11px clamp(13px, 2.5vw, 38px) 13px;
  border-radius: 27px 27px 4px 4px;
  border: 1px solid #423124;
  background: radial-gradient(ellipse at 50% 160%, #467161, transparent 65%),
    repeating-conic-gradient(from -3deg at 50% 195%, #ffffff05 0 5deg, transparent 5deg 12deg),
    linear-gradient(#2d5047, #1b3e36 58%, #14322f);
  box-shadow: inset 0 2px #a1b6a061, inset 0 -5px 0 #0e2424, inset 0 -6px 0 #a98d58;
}
.identity { display: flex; align-items: center; gap: 14px; }
.identity h1 { line-height: 0; }
#wordmark {
  width: clamp(196px, 22vw, 300px);
  height: auto;
  image-rendering: pixelated;
  transform: skewX(-6deg);
  filter: sepia(1) saturate(2.1) drop-shadow(0 2px #9c6a3c) drop-shadow(0 2px #563421) drop-shadow(0 2px 2px #0c1917);
}
.identity p {
  margin-top: 5px;
  color: #f6deae;
  font-size: 10px;
  text-align: center;
  letter-spacing: .19em;
}
.crest, .level-medal, .medal-price i {
  display: inline-grid;
  place-content: center;
  flex: none;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid #d8ae69;
  color: #6a3e22;
  background: linear-gradient(135deg, #fff3b6 3%, #e1ad60 40%, #a77136 51%, #e4b56a 70%, #ffe4a0);
  box-shadow: inset 0 0 0 2px #80512d, inset 0 0 0 3px #ffeeac, 0 2px 0 #593822, 0 3px 5px #061412;
  text-shadow: 0 1px #ffe4a2;
}
.crest {
  position: relative;
  width: clamp(40px, 4.2vw, 51px);
  font-size: 2rem;
  transform: rotate(-10deg);
}
.crest::before {
  content: '';
  position: absolute; inset: 6px;
  border: 1px dashed #895c37; border-radius: 50%;
}
.marquee-wing {
  height: 22px; width: min(100%, 216px);
  justify-self: end;
  display: grid; align-items: center;
  background: linear-gradient(90deg, transparent, #d3b278) right 24% / 77% 1px no-repeat,
    linear-gradient(90deg, transparent, #dfc592) right center / 100% 2px no-repeat,
    linear-gradient(90deg, transparent, #d3b278) right 80% / 66% 1px no-repeat;
}
.marquee-wing i {
  justify-self: end; width: 9px; height: 9px;
  transform: rotate(45deg); background: var(--gold);
  border: 2px solid #57432e; box-shadow: 0 0 0 1px #bc9e68;
}
.tools { display: flex; justify-self: end; align-items: center; gap: 7px; }
.tools button, .dialog-body button:not(.choice), .dialog-body select {
  display: inline-flex; align-items: center; justify-content: center; gap: .45em;
  padding: 8px 13px;
  border: 1px solid #a58b5f; border-radius: 18px;
  background: linear-gradient(#31524a, #1c3732 52%, #152823);
  color: #ffebc1;
  box-shadow: inset 0 1px #eedfaf42, 0 2px #071716, 0 3px 0 #8c7651;
}
.tools button { min-height: 34px; font-size: 12px; white-space: nowrap; }
.tools #pause { width: 35px; padding-inline: 0; border-radius: 50%; }
.tools #sound[aria-pressed=true] i { color: var(--mint); }
button:enabled:hover { filter: brightness(1.13); }
button:enabled:active { translate: 0 2px; }
button:disabled { opacity: .57; }
.machine { border-radius: 2px 2px 15px 15px; background: var(--enamel); }
.score-rail {
  display: flex; align-items: center; justify-content: space-between;
  gap: clamp(16px, 4vw, 66px);
  padding: 7px clamp(18px, 4.6vw, 74px);
  border-block: 1px solid #5e5845;
  background: linear-gradient(90deg, #152a28, #243d35 46%, #182e2c);
  box-shadow: inset 0 2px #0a1c19, inset 0 -2px #0f201d;
}
.stage-plate, .clock-window { flex: none; display: flex; align-items: center; gap: 10px; }
.stage-plate, .clock-window > span, .meter-label, .control-deck h2, .collection h2, .multiplier {
  font-size: 12px;
  letter-spacing: .045em;
  font-weight: 800;
}
.stage-plate { color: var(--gold); }
.stage-plate strong {
  min-width: 2.1em; padding: 1px 9px;
  font-size: 22px; line-height: 1.3; text-align: center;
  border-radius: 3px 11px; border: 1px solid #d2ae74;
  color: #3e2b1c; background: var(--metal); text-shadow: 0 1px #f5dba5;
  box-shadow: inset 0 0 0 2px #755839, 0 2px 3px #0008;
}
.quota-meter { flex: 1; max-width: 570px; min-width: 0; }
.meter-label { display: flex; align-items: baseline; justify-content: space-between; gap: 5px; }
.meter-label b { color: var(--cream); white-space: nowrap; }
.quota-meter .meter-label { padding-right: 25px; font-size: 11px; color: #e5d5af; }
#quota { color: #b2fcdc; font-size: 16px; }
.quota-track { position: relative; padding-right: 17px; }
.quota-track > i {
  position: absolute; right: 0; bottom: -2px;
  color: var(--gold); width: 15px; height: 18px;
}
.track {
  position: relative; isolation: isolate;
  overflow: hidden; height: 10px;
  border: 1px solid #8a7758; border-radius: 7px;
  background: #0b1716; box-shadow: inset 0 2px 3px #000a, 0 1px #d2c8a329;
}
.track > div {
  width: 0; height: 100%;
  background: linear-gradient(#cfffe4, #69e3b3 42%, #35a77e);
  box-shadow: 0 0 7px #73ebb7; transition: width .24s ease-out;
}
.quota-track .track::after {
  content: ''; position: absolute; inset: 0;
  background: repeating-linear-gradient(90deg, transparent 0 calc(5% - 2px), #0d191b80 calc(5% - 2px) 5%);
}
.complete #quota, .complete .meter-label, .complete .quota-track > i { color: #ffe59c; text-shadow: 0 0 8px #ffc64e; }
.complete .track { border-color: #ffe19b; box-shadow: 0 0 12px #ecba5666; }
.complete #quota-bar { background: linear-gradient(#fffab9, #ffd363, #e9a43c); }
.clock-window > span { color: #cec9b4; display: inline-flex; align-items: center; gap: 4px; }
#timer {
  border-radius: 6px; border: 1px solid #846c4a;
  padding: 1px 10px; background: #101a18;
  color: #ffeeac; font-size: 23px; letter-spacing: .07em;
  box-shadow: inset 1px 2px 4px #000, 0 1px #bfbb9226;
  text-shadow: 0 0 7px #f1c37265;
}
#timer.urgent { color: #ff9c94; animation: time-alarm .9s ease-in-out infinite alternate; }
@keyframes time-alarm { to { color: #fff1e4; background: #8e2929; box-shadow: 0 0 10px #ff584c; } }

.glass-frame {
  position: relative; padding: 5px clamp(10px, 1.35vw, 20px) 8px;
  background: linear-gradient(90deg, #59442d, #e7c48d 3px, #69533a 5px, #2a4840 9px, #0a1717 2.6% 97.4%, #253e38 calc(100% - 9px), #69533a calc(100% - 5px), #ebc78e calc(100% - 3px), #59442d);
}
.glass-frame::before, .glass-frame::after {
  content: ''; position: absolute; pointer-events: none;
  top: 11%; bottom: 11%; left: 3px; width: 3px;
  background: linear-gradient(transparent, #f9d481 28% 72%, transparent);
  box-shadow: 0 0 7px #ffdc8f55;
}
.glass-frame::after { left: auto; right: 3px; }
#viewport {
  position: relative; isolation: isolate; overflow: hidden;
  height: clamp(280px, min(57vw, calc(100svh - 319px)), 720px);
  border-radius: 9px 9px 15px 15px;
  background: #191a19;
  box-shadow: 0 0 0 2px #060f10, 0 2px 1px 2px #9c8051;
  touch-action: none; cursor: crosshair;
}
#viewport > canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; z-index: -2; }
#viewport::after {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: radial-gradient(ellipse at 50% 54%, transparent 52%, #07111038 91%);
  box-shadow: inset 0 2px 8px #000a;
}
.glass-signs {
  position: absolute; top: 10px; left: 12px; right: 12px;
  display: flex; align-items: center; justify-content: space-between; pointer-events: none;
}
#mode-indicator, #curse-mark {
  display: inline-flex; gap: 8px; align-items: center;
  border: 1px solid #b79a628a; border-radius: 18px;
  padding: 4px 10px; background: #0e211feb;
  color: #f9e0a6; font-size: 11px; box-shadow: 0 2px 4px #0007;
}
#mode-indicator b {
  width: 7px; height: 7px; border-radius: 50%;
  background: #ffda83; box-shadow: 0 0 6px #ffbb60;
}
#mode-indicator.live b { background: #a0f7c4; box-shadow: 0 0 6px #74edb1; }
#curse-mark { color: #ffc4b8; background: #451d24eb; }
#machine-event, #startup {
  position: absolute; left: 50%; top: 13px; transform: translateX(-50%);
  max-width: 92%; width: max-content;
  padding: 8px 16px; text-align: center; font-size: 13px;
  pointer-events: none; border: 1px solid var(--brass); border-radius: 8px;
  background: #132d2bf2; box-shadow: 0 3px 9px #000a; color: var(--cream);
}
#startup { top: 48%; }
#machine-event strong { color: var(--gold); }
.reels { display: inline-flex; gap: 2px; margin-right: 6px; vertical-align: middle; }
.reel {
  width: 19px; height: 20px; overflow: hidden; border: 1px solid #d5ad69;
  border-radius: 3px; background: #f4dfad; color: #854333;
}
.reel i { display: block; font: 900 15px/18px var(--font); animation: spin-reel .55s ease-out var(--delay) both; }
.reel i span { display: block; height: 18px; }
@keyframes spin-reel { from { transform: translateY(0); } to { transform: translateY(-54px); } }
#float-pay {
  position: absolute; left: 50%; bottom: 12%; opacity: 0; pointer-events: none;
  color: #ffe3a1; font-size: clamp(26px, 4vw, 48px); font-weight: 1000;
  text-shadow: 0 2px #724c20, 0 3px 5px #131509;
}
.pay-pop { animation: pay-pop .64s ease-out; }
@keyframes pay-pop {
  0% { opacity: 0; transform: translate(-50%, 10px) scale(.8); }
  20%, 68% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -25px); }
}

/* The console rests against the lower lip of the glass. */
.control-deck {
  position: relative;
  display: grid;
  grid-template-columns: minmax(142px, .9fr) minmax(0, 3fr) minmax(102px, .65fr);
  grid-template-areas: "bank feed trigger" "bank aim trigger";
  align-items: center;
  gap: 3px clamp(18px, 3vw, 52px);
  padding: 11px clamp(18px, 3.6vw, 57px) 12px;
  border-top: 3px double #ceb082;
  border-bottom: 4px double #7d785a;
  background: radial-gradient(ellipse at 50% 0, #5b776344, transparent 70%),
    repeating-linear-gradient(2deg, #ffffff03 0 1px, transparent 1px 4px), var(--enamel);
  box-shadow: inset 0 3px 3px #b9b48c36, inset 0 -5px 7px #081c19;
}
.control-deck::before, .control-deck::after {
  content: '';
  position: absolute; inset: 9px 7px auto; height: 6px;
  pointer-events: none;
  background: radial-gradient(circle, #7f694c 0 1px, #dbc49b 1.5px, #7e694c 2.5px, #13221f 3px, transparent 3.5px) left / 7px 7px no-repeat,
    radial-gradient(circle, #7f694c 0 1px, #dbc49b 1.5px, #7e694c 2.5px, #13221f 3px, transparent 3.5px) right / 7px 7px no-repeat;
}
.control-deck::after { top: auto; bottom: 8px; }
.bank { grid-area: bank; min-width: 0; text-align: center; }
.bank h2 { margin-bottom: 5px; color: #f1d5a0; }
.bank-glass {
  display: flex; align-items: baseline; justify-content: center; gap: 3px;
  padding: 11px 8px; border: 2px solid #9d8056; border-radius: 9px;
  background: repeating-linear-gradient(0deg, #241914 0 1px, #1b1612 1px 3px);
  box-shadow: inset 0 3px 7px #000, 0 1px #d6c398, 0 0 0 2px #1e2720;
}
.bank-glass small { color: #e6b67c; font-size: 11px; }
#wallet { display: block; min-width: 0; color: #ffc568; font-size: clamp(30px, 3.4vw, 48px); line-height: 1; }
.led-face { display: flex; align-items: center; justify-content: center; gap: .09em; transform: skewX(-5deg); }
.led-face.bounce { animation: bank-bounce .24s ease-out; }
@keyframes bank-bounce {
  35% { transform: skewX(-5deg) translateY(-2px) scale(1.045); filter: brightness(1.3); }
}
.led-digit { display: block; position: relative; width: .53em; min-width: 0; aspect-ratio: .55; }
.led-digit i { position: absolute; background: #39251a; }
.led-digit i.lit { background: #ffbd57; filter: drop-shadow(0 0 2px #ff9722); }
.led-face { filter: drop-shadow(0 0 3px #ff941951); }
.seg-a, .seg-d, .seg-g {
  left: 7%; width: 86%; height: 12%;
  clip-path: polygon(0 50%, 12% 0, 88% 0, 100% 50%, 88% 100%, 12% 100%);
}
.seg-a { top: 0; } .seg-d { bottom: 0; } .seg-g { top: 44%; }
.seg-b, .seg-c, .seg-e, .seg-f {
  height: 45%; width: 19%;
  clip-path: polygon(50% 0, 100% 14%, 100% 86%, 50% 100%, 0 86%, 0 14%);
}
.seg-b, .seg-f { top: 4%; } .seg-c, .seg-e { bottom: 4%; }
.seg-b, .seg-c { right: 0; } .seg-e, .seg-f { left: 0; }

.feed { grid-area: feed; min-width: 0; }
.feed-head { display: flex; justify-content: space-between; align-items: baseline; flex-wrap: wrap; gap: 2px 10px; margin-bottom: 4px; }
.feed-head h2, .collection h2 { color: #f2d8a8; white-space: nowrap; }
.feed-head h2 small, .collection h2 small { font-size: 10px; color: #bdc9ba; margin-left: 4px; }
.load-line { display: flex; flex-wrap: wrap; gap: 2px 12px; font-size: 10px; color: var(--muted); }
.load-line b { margin-left: 3px; color: #f9eacc; font-size: 12px; }
.load-line span:first-child b { color: #ffe19a; }
#magazine {
  display: grid; grid-template-columns: repeat(10, minmax(0, 1fr));
  padding: 2px 4px; border: 1px solid #908266; border-radius: 11px;
  background: linear-gradient(#0b1716, #303a2e 54%, #101d1a 55%, #18241e);
  box-shadow: inset 0 2px 4px #030908, 0 1px #a09672;
}
.loaded-belt {
  padding: 0; list-style: none; min-width: 0; overflow: hidden;
  grid-column: span var(--capacity);
  display: grid; grid-template-columns: repeat(var(--capacity), minmax(0, 1fr));
}
.mag-slot, .reserve-slot {
  position: relative; display: grid; place-items: center;
  min-width: 0; height: 52px;
}
.mag-slot::before, .reserve-slot::before {
  content: ''; position: absolute; top: calc(50% - 6px); left: 50%;
  width: min(85%, 34px); aspect-ratio: 1; transform: translate(-50%, -50%);
  border-radius: 50%; border: 1px solid #74725a;
  background: radial-gradient(circle, #16221f 52%, #070e0d 72%);
  box-shadow: inset 0 2px 4px #0008, 0 1px #b4a78455;
}
.reserve-slot::before {
  background: radial-gradient(circle, #0b1513 0 9%, #475044 10% 14%, transparent 15%),
    linear-gradient(145deg, #192521, #364037 50%, #19251f);
  border-style: dashed; border-color: #68705a;
}
.reserve-slot::after { content: '·'; align-self: end; color: #79816e; }
.carrier, .exit-carrier {
  position: relative; width: 100%; height: 100%;
  display: grid; grid-template-rows: 1fr 10px; place-items: center;
  padding-bottom: 2px;
}
.advancing .carrier { animation: feed-one .21s cubic-bezier(.18,.76,.3,1) both; }
.exit-carrier { position: absolute; inset: 0; animation: eject-one .21s cubic-bezier(.18,.76,.3,1) both; }
@keyframes feed-one { from { transform: translateX(100%); } to { transform: translateX(0); } }
@keyframes eject-one { to { transform: translateX(-100%); visibility: hidden; } }
.slot-token {
  width: min(70%, 28px); aspect-ratio: 1; border-radius: 50%;
  display: grid; place-items: center; flex: none;
  border: 2px solid var(--coin);
  color: var(--coin); font-size: 14px; font-weight: 1000; line-height: 1;
  background: linear-gradient(145deg, #5e6150, #333e38 46%, #202a25 52%, #3b463b);
  box-shadow: inset 0 0 0 1px #050e0d, inset 0 0 0 2px #c5b58d59, 0 2px 0 #070c0b;
}
.carrier small { font-size: 9px; color: #c3cabe; line-height: 1; white-space: nowrap; }
.current .carrier .slot-token {
  width: min(84%, 33px);
  border-color: #ffe5a1; color: #65401e;
  background: linear-gradient(135deg, #fff2b6, #ffcf74 44%, #ca914a 46%, #f8c66c);
  box-shadow: 0 0 7px #ffca6c, inset 0 0 0 1px #916131, inset 0 0 0 2px #ffe5a0;
  animation: loaded-medal 1.75s ease-in-out infinite;
}
.current .carrier small { color: #ffe19a; }
@keyframes loaded-medal { 50% { transform: translateY(-2px); } }

.aim-strip { grid-area: aim; display: flex; gap: 9px; align-items: center; font-size: 11px; color: #d6d9c5; }
.aim-strip label { white-space: nowrap; }
.aim-strip output { width: 4em; text-align: right; color: #f3dba8; white-space: nowrap; }
.lever {
  position: relative; display: grid; align-items: center; flex: 1; height: 28px;
  background: repeating-linear-gradient(90deg, #baa87c 0 1px, transparent 1px 10%) center 90% / calc(100% - 24px) 3px no-repeat;
}
#aim {
  appearance: none; width: 100%; height: 28px; margin: 0;
  cursor: ew-resize; background: transparent; touch-action: pan-y;
}
#aim::-webkit-slider-runnable-track {
  height: 7px; border-radius: 10px; border: 1px solid #857358;
  background: #091817; box-shadow: inset 0 2px 2px #000, 0 1px #bcc4a055;
}
#aim::-moz-range-track {
  height: 5px; border-radius: 10px; border: 1px solid #857358;
  background: #091817; box-shadow: inset 0 2px 2px #000, 0 1px #bcc4a055;
}
#aim::-webkit-slider-thumb {
  appearance: none; width: 25px; height: 23px; margin-top: -9px;
  border: 2px solid #ab8551; border-radius: 8px 8px 5px 5px;
  background: linear-gradient(90deg, transparent 39%, #785331 40% 45%, #ffe7a3 46% 54%, #785331 55% 60%, transparent 61%),
    linear-gradient(#ffdfa0, #d1a367 50%, #986d41 55%, #c5985c);
  box-shadow: 0 2px 0 #3d3425, 0 3px 4px #071210;
}
#aim::-moz-range-thumb {
  width: 21px; height: 19px;
  border: 2px solid #ab8551; border-radius: 8px 8px 5px 5px;
  background: linear-gradient(90deg, transparent 40%, #785331 41% 46%, #ffe7a3 47% 54%, #785331 55% 60%, transparent 61%),
    linear-gradient(#ffdfa0, #c3965d 54%, #996d41 55%, #c5985c);
  box-shadow: 0 2px 0 #3d3425, 0 3px 4px #071210;
}
.trigger-mount { grid-area: trigger; display: grid; justify-items: center; gap: 6px; }
#fire {
  width: 82px; aspect-ratio: 1; border-radius: 50%;
  display: grid; align-content: center; justify-items: center; gap: 0;
  padding: 0; border: 4px solid #e2bc83; outline-offset: 5px;
  color: #fff0d1; text-shadow: 0 2px 1px #902d24;
  background: radial-gradient(ellipse at 41% 17%, #ffd4acb3 0 3%, transparent 26%),
    linear-gradient(165deg, #ffb28c, #f87959 39%, #e05b43 48%, #b7382f 78%, #d74f37);
  box-shadow: inset 0 0 0 2px #bb4832, inset 0 3px 3px #fff0c7a3, inset 0 -5px 0 #942e2b,
    0 0 0 2px #715940, 0 0 0 4px #10221d, 0 5px 0 4px #091410, 0 7px 8px #050d0a99;
  touch-action: none; user-select: none;
  transition: transform .08s, box-shadow .08s;
}
#fire i { width: 15px; height: 15px; }
#fire b { font-size: 22px; line-height: 1.15; }
#fire:enabled:is(:active,.firing) {
  translate: none; transform: translateY(4px);
  box-shadow: inset 0 0 0 2px #ae412e, inset 0 1px 4px #962e24, 0 0 0 3px #493b2a, 0 1px 0 4px #091410;
}
.trigger-mount small { font-size: 10px; letter-spacing: .08em; color: #e1d6b6; }
.apron {
  display: flex; align-items: center; gap: clamp(15px, 2.8vw, 45px); padding: 7px clamp(16px, 3.6vw, 57px) 9px;
  border-radius: 0 0 15px 15px; border: 1px solid #31453c;
  background: linear-gradient(115deg, #182f2c, #203a32 55%, #142825);
  box-shadow: inset 0 -3px #0c201d;
}
.growth { display: flex; align-items: center; gap: 10px; }
.level-medal { width: 41px; text-align: center; line-height: .95; }
.level-medal small { font-size: 9px; }
.level-medal b { font-size: 19px; }
.exp-meter { width: clamp(80px, 9vw, 130px); }
.exp-meter .meter-label, .draft-meter .meter-label { color: #d6dccb; font-size: 10px; margin-bottom: 4px; }
.thin { height: 5px; border-color: #5f6955; }
.multiplier { display: grid; margin-left: 2px; font-size: 10px; color: #c3cdbb; }
.multiplier b { color: var(--gold); font-size: 15px; }
.collection {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px;
  padding-left: clamp(6px, 1.6vw, 22px); border-left: 1px solid #7379607d;
}
#relic-list { display: flex; align-items: center; gap: 12px; min-width: 0; overflow-x: auto; padding: 4px; scrollbar-width: thin; }
.relic-chip, .empty-relic {
  display: inline-flex; gap: 6px; align-items: center; flex: none;
  border: 0; padding: 0; background: transparent; color: #dfdfcc; font-size: 11px;
}
.empty-relic { color: #b6c6b8; }
.empty-relic i { display: grid; place-items: center; width: 25px; aspect-ratio: 1; border: 1px dashed #8c9680; border-radius: 50%; font-style: normal; }
.casino-chip {
  --chip-color: var(--gold);
  display: inline-grid; place-items: center; flex: none;
  width: 31px; aspect-ratio: 1; border: 1px solid var(--chip-color); border-radius: 50%;
  background: repeating-conic-gradient(from -10deg, var(--chip-color) 0deg 22deg, #283530 22deg 45deg, var(--chip-accent, var(--chip-color)) 45deg 67deg, #283530 67deg 90deg);
  box-shadow: 0 2px #071210, 0 3px 4px #0813118c;
}
.casino-chip i {
  display: grid; place-items: center; width: 72%; aspect-ratio: 1; border: 1px solid var(--chip-color); border-radius: 50%;
  font: 900 1em/1 var(--font); color: var(--chip-color); background: linear-gradient(140deg, #455349, #182723 72%);
}
.draft-meter { width: clamp(132px, 15vw, 205px); }
#draft-bar { background: linear-gradient(#fff4b6, #e6b45f); }

/* The overlays open on a felt-lined card table. */
dialog {
  color: var(--cream); padding: 4px; width: min(740px, calc(100% - 24px));
  max-width: none; max-height: calc(100svh - 28px); overflow-y: auto;
  border: 1px solid #efce93; border-radius: 23px;
  background: var(--metal); box-shadow: 0 0 0 2px #292219, 0 18px 65px #020907bd;
  scrollbar-width: thin;
}
dialog:has(.compact) { width: min(450px, calc(100% - 24px)); }
dialog::backdrop { background: #040c0bba; }
.dialog-body {
  padding: clamp(18px, 3vw, 32px); border-radius: 18px; border: 1px solid #3e4737;
  background: radial-gradient(ellipse at 45% -10%, #42695380, transparent 65%),
    repeating-linear-gradient(39deg, transparent 0 2px, #e7f0c504 2px 3px),
    repeating-linear-gradient(-39deg, #162f29 0 2px, #19352c 2px 3px);
  box-shadow: inset 0 0 0 4px #152b24, inset 0 0 0 5px #a98d555e;
}
.dialog-body h2 { color: #ffe3a9; font-size: clamp(22px, 3vw, 34px); font-weight: 900; letter-spacing: .03em; text-shadow: 0 2px #261f13; }
.dialog-body h3 { font-size: 16px; color: var(--gold); }
.dialog-body p, .dialog-info { font-size: 14px; line-height: 1.75; color: #e2e4d4; }
.dialog-body p { margin: 5px 0 13px; }
.dialog-body button:not(.choice), .dialog-body select { min-height: 40px; font-size: 13px; font-weight: 800; }
.dialog-body select { color-scheme: dark; padding-right: 8px; }
.dialog-body option { background: #172d28; }
.dialog-body button.primary {
  color: #47301e; border-color: #ffe0a3;
  background: linear-gradient(#ffe8aa, #f0c67c 48%, #d4a562 52%, #e4bd79);
  box-shadow: inset 0 1px #ffffd1, 0 2px #674934, 0 3px 0 #0d1e18;
}
.dialog-top, .shop-foot, .shop-heading, .shop-row {
  display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 10px;
}
.ribbon {
  display: inline-flex; align-items: center; gap: 7px; margin-bottom: 5px;
  color: var(--gold); font-size: 12px;
}
.ribbon::before, .ribbon::after { content: ''; width: 20px; height: 1px; background: #bb9f6a; }
.dialog-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 10px; margin-top: 18px; }
.draft-grid, .contracts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.choice {
  --rarity: #bab79c;
  position: relative; display: flex; flex-direction: column; align-items: center; width: 100%; min-width: 0;
  padding: 12px; text-align: center; border: 2px solid var(--rarity); border-radius: 11px;
  color: #342b24;
  background: linear-gradient(125deg, transparent 28%, #fff9df9e 29%, #fff9df15 45%, transparent 46%),
    radial-gradient(ellipse at 40% 20%, #fff8de, #e7d8ae 80%);
  box-shadow: inset 0 0 0 2px #67553a, inset 0 0 0 4px #f7ecce, 0 4px 0 #132019, 0 6px 10px #07150d75;
}
.choice[data-rarity=RARE] { --rarity: #83ccf2; }
.choice[data-rarity=EPIC] { --rarity: #d3a2fa; }
.choice[data-rarity=EVOLVED] { --rarity: #ffcc56; }
.choice:enabled:hover, .choice:focus-visible { transform: translateY(-2px); }
.choice:disabled { opacity: .73; filter: saturate(.5); }
.card-rank, .card-foot { display: flex; align-items: center; justify-content: space-between; width: 100%; }
.card-rank { color: #534335; font-size: 11px; }
.card-rank i { color: #634735; font-style: normal; font-size: 15px; }
.choice .casino-chip { width: 52px; margin: 3px 0 11px; font-size: 24px; }
.choice > b { font-size: 18px; font-weight: 900; overflow-wrap: anywhere; line-height: 1.3; }
.card-tags { font-size: 9px; letter-spacing: .07em; margin: 4px 0 10px; color: #68543b; }
.description { flex: 1; font-size: 13px; line-height: 1.6; font-weight: 700; text-align: left; align-self: stretch; }
.card-foot { justify-content: center; padding-top: 7px; margin-top: 12px; border-top: 1px solid #907d5a77; font-size: 12px; }
.choice.sold {
  justify-content: center; gap: 8px; border: 3px double #ac996e; color: #e3cea0;
  background: repeating-linear-gradient(45deg, #2b453b 0 3px, #304a3e 3px 6px);
  box-shadow: inset 0 0 0 3px #233a30;
}
.sold i { font: 900 40px/1 var(--font); }
.shop-wallet { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--gold); }
.medal-price { display: inline-flex; align-items: center; gap: .35em; font-weight: 900; white-space: nowrap; }
.medal-price i { width: 1.38em; border-width: 1px; font-style: normal; font-size: .92em; box-shadow: inset 0 0 0 1px #986c39, 0 1px 1px #301e13; }
.shop-tabs {
  display: flex; flex-wrap: wrap; gap: 6px;
  padding: 8px 0; border-block: 1px solid #9a8b644d;
}
.shop-tabs button[aria-pressed=true] { color: #402e1b; background: var(--metal); border-color: #f6db9e; }
.shop-group, .dialog-info { padding: 11px 0; border-bottom: 1px solid #a1946b59; }
.dialog-info.owned { display: flex; align-items: center; gap: 12px; }
.shop-group p, .dialog-info p { margin: 3px 0; }
.shop-row { margin: 8px 0; }
.shop-row label { font-size: 13px; }
.reroll > span, .shop-foot small { font-size: 12px; color: #cfdbc9; }
.shop-foot { border-top: 1px solid #b49a665e; padding-top: 13px; margin-top: 13px; }
.contracts { grid-template-columns: 1fr 1fr; }
.deal {
  display: flex; flex-direction: column; align-items: center; padding: 17px;
  border: 3px double #c78373; border-radius: 10px;
  background: radial-gradient(ellipse at 50% 12%, #732c35, transparent 68%), linear-gradient(130deg, #30151b, #200f16 70%, #3d1923);
  box-shadow: inset 0 0 0 3px #231017, 0 3px 6px #08171166;
}
.deal > span { color: #ea9686; font-size: 32px; line-height: 1; text-shadow: 0 1px 8px #ef654954; }
.deal h3 { margin: 6px 0; color: #ffcab2; }
.deal p { flex: 1; color: #f2dcd1; font-size: 13px; }
.deal button[data-action] { background: linear-gradient(#78383b, #441f28); color: #ffe3c9; border-color: #c68e77; }
.continue-screen { text-align: center; }
.continue-screen h2 {
  font-size: clamp(30px, 6vw, 49px); font-weight: 1000; line-height: 1.1; letter-spacing: .025em;
  color: #ffd881; text-shadow: 0 2px #ae7339, 0 4px #67442c, 0 5px 10px #0e140c;
}
.record-plate {
  display: flex; justify-content: space-evenly; gap: 12px; padding: 16px 10px; margin: 14px 0 9px;
  background: radial-gradient(ellipse at top, #403924, #1c231c 70%);
  border: 3px double #c6a46a; border-radius: 8px; box-shadow: inset 0 1px 6px #080c07;
}
.record-plate dt { color: #e2c798; font-size: 12px; }
.record-plate dd { font-size: clamp(27px, 5vw, 42px); line-height: 1.2; color: #ffdc8b; text-shadow: 0 0 9px #d599464a; }
.record-plate dd small { font-size: 14px; }
.help-list { display: grid; grid-template-columns: auto 1fr; gap: 12px 18px; margin: 16px 0; font-size: 14px; }
.help-list dt { color: var(--gold); }
.help-list dd { line-height: 1.65; }

@media (max-width: 820px) {
  .marquee { grid-template-columns: minmax(0, 1fr) auto; gap: 10px; }
  .marquee-wing { display: none; }
  .score-rail { gap: 18px; }
  .control-deck { gap: 3px 16px; padding-inline: 18px; grid-template-columns: minmax(120px, .9fr) minmax(0, 2.9fr) 84px; }
  .apron { gap: 16px; padding-inline: 16px; }
  .collection { padding-left: 10px; }
  .slot-index { display: none; }
}
@media (max-width: 650px) {
  body { padding: max(4px, env(safe-area-inset-top)) max(4px, env(safe-area-inset-right)) max(6px, env(safe-area-inset-bottom)) max(4px, env(safe-area-inset-left)); }
  .cabinet { padding: 3px; border-radius: 21px 21px 17px 17px; }
  .marquee { padding: 10px 9px 12px; border-radius: 16px 16px 3px 3px; }
  .identity { gap: 8px; min-width: 0; }
  .identity > div { min-width: 0; }
  .crest { width: 33px; font-size: 22px; }
  #wordmark { display: block; width: min(44vw, 230px); max-width: 100%; }
  .identity p { font-size: 8px; letter-spacing: .035em; }
  .tools { gap: 4px; }
  .tools button, .tools #pause { width: 36px; height: 36px; min-height: 0; padding: 0; border-radius: 50%; font-size: 15px; }
  .tools button span { display: none; }
  .score-rail { padding: 5px 10px; gap: 12px; }
  .stage-plate, .clock-window { flex-direction: column; justify-content: center; gap: 1px; }
  .stage-plate > span, .clock-window > span { font-size: 9px; }
  .stage-plate strong { font-size: 18px; padding: 0 8px; }
  #timer { font-size: 17px; padding: 0 6px; }
  .quota-meter .meter-label { font-size: 10px; padding-right: 14px; }
  .glass-frame { padding: 4px 6px 6px; }
  .glass-frame::before, .glass-frame::after { width: 1px; }
  #viewport { height: clamp(196px, calc(100svh - 366px), min(98vw, 455px)); border-radius: 5px 5px 10px 10px; }
  .glass-signs { top: 6px; left: 7px; right: 7px; }
  #mode-indicator, #curse-mark { font-size: 10px; padding: 2px 7px; }
  #machine-event { top: 31px; font-size: 11px; padding: 5px 10px; }
  .control-deck {
    grid-template-columns: minmax(78px, .87fr) minmax(86px, 1.3fr) 70px;
    grid-template-areas: "feed feed feed" "bank aim trigger";
    gap: 8px 14px; padding: 8px 13px 9px;
  }
  .feed-head { margin-bottom: 3px; }
  .mag-slot, .reserve-slot { height: 44px; }
  .slot-token { width: min(70%, 24px); font-size: 12px; }
  .current .carrier .slot-token { width: min(84%, 29px); }
  .mag-slot::before, .reserve-slot::before { width: min(85%, 29px); }
  .bank h2 { font-size: 11px; margin-bottom: 3px; }
  .bank-glass { padding: 7px 5px; gap: 2px; }
  #wallet { font-size: 31px; }
  .aim-strip { display: grid; grid-template-columns: 1fr auto; gap: 0; }
  .aim-strip output { grid-row: 1; grid-column: 2; }
  .aim-strip .lever { grid-column: 1 / -1; height: 37px; }
  #aim { height: 37px; }
  #fire { width: 62px; }
  #fire b { font-size: 18px; }
  #fire i { width: 13px; height: 13px; }
  .trigger-mount { gap: 5px; }
  .apron { display: grid; grid-template-columns: 1fr minmax(90px, .65fr); align-items: center; padding: 6px 12px; gap: 3px 13px; }
  .growth { gap: 6px; min-width: 0; }
  .level-medal { width: 34px; }
  .level-medal b { font-size: 16px; }
  .exp-meter { width: auto; min-width: 53px; flex: 1; }
  .multiplier { margin-left: 0; font-size: 9px; }
  .multiplier b { font-size: 13px; }
  .draft-meter { width: auto; grid-column: 2; grid-row: 1; }
  .draft-meter .meter-label { flex-wrap: wrap; gap: 0 5px; }
  .collection { grid-column: 1 / -1; border: 0; padding: 3px 0 0; border-top: 1px solid #777b603d; }
  .collection h2 { font-size: 11px; }
}
@media (max-width: 480px) {
  .dialog-body { padding: 16px; }
  .draft-grid, .contracts { grid-template-columns: 1fr; gap: 8px; }
  .choice {
    display: grid; grid-template-columns: 41px minmax(0, 1fr) auto; align-items: center;
    text-align: left; column-gap: 9px; padding: 9px 11px;
  }
  .card-rank { grid-column: 1; grid-row: 1; justify-content: center; font-size: 9px; }
  .card-rank i { display: none; }
  .choice .casino-chip { grid-column: 1; grid-row: 2 / 4; width: 35px; margin: 2px auto; font-size: 17px; }
  .choice > b { grid-column: 2; grid-row: 1 / 3; font-size: 16px; }
  .card-tags { grid-column: 2; grid-row: 3; margin: 0; }
  .description { grid-column: 1 / -1; grid-row: 4; padding-top: 5px; font-size: 12px; }
  .card-foot { grid-column: 3; grid-row: 1 / 4; margin: 0; padding: 0; border: 0; font-size: 10px; }
  .choice.sold { display: flex; flex-direction: row; }
  .sold i { font-size: 22px; }
  .help-list { gap: 9px 10px; font-size: 13px; }
}
@media (max-width: 365px) {
  .crest { width: 26px; font-size: 18px; }
  .tools button, .tools #pause { width: 31px; height: 33px; }
  .control-deck { padding-inline: 9px; gap: 6px 8px; }
  .score-rail { gap: 8px; }
  .feed-head h2 small { margin-left: 1px; }
  .load-line { gap: 4px; }
}
/* A short screen puts the same controls on the right-hand wing. */
@media (orientation: landscape) and (max-height: 540px) and (max-width: 1050px) {
  body { padding-block: max(3px, env(safe-area-inset-top)) max(3px, env(safe-area-inset-bottom)); }
  .cabinet { padding: 2px; border-radius: 18px 18px 12px 12px; }
  .marquee { grid-template-columns: 1fr auto; padding: 4px 12px 6px; border-radius: 14px 14px 3px 3px; }
  .marquee-wing { display: none; }
  .crest { width: 28px; font-size: 18px; }
  #wordmark { width: 174px; }
  .identity { gap: 9px; }
  .identity p { display: none; }
  .tools button, .tools #pause { min-height: 28px; height: 28px; }
  .score-rail { padding: 3px 16px; gap: 22px; }
  .stage-plate, .clock-window { flex-direction: row; gap: 7px; }
  .stage-plate strong, #timer { font-size: 17px; }
  .quota-meter .meter-label { font-size: 9px; }
  #quota { font-size: 12px; }
  .quota-track .track { height: 6px; }
  .play-assembly { display: grid; grid-template-columns: minmax(0, 1fr) clamp(212px, 30vw, 295px); }
  .glass-frame { padding: 4px 6px 6px; }
  #viewport { height: 100%; min-height: max(182px, calc(100svh - 144px)); }
  .control-deck {
    grid-template-columns: minmax(0, 1fr) 67px;
    grid-template-areas: "bank bank" "feed feed" "aim trigger";
    align-content: space-evenly; gap: 5px 10px; padding: 7px 10px;
    border-block: 0; border-left: 3px double #af9363;
  }
  .bank { display: flex; justify-content: space-evenly; align-items: center; gap: 8px; }
  .bank h2 { font-size: 11px; margin: 0; }
  .bank-glass { padding: 5px 7px; }
  #wallet { font-size: 28px; }
  .feed-head { flex-wrap: wrap; gap: 0 6px; }
  .feed-head h2 { font-size: 11px; }
  .load-line { gap: 5px; font-size: 9px; }
  .load-line b { font-size: 10px; margin-left: 0; }
  .mag-slot, .reserve-slot { height: 36px; }
  .slot-token { font-size: 10px; border-width: 1px; }
  .slot-index { display: none; }
  .aim-strip { display: grid; grid-template-columns: 1fr auto; gap: 0; }
  .aim-strip output { grid-column: 2; grid-row: 1; }
  .aim-strip .lever { grid-column: 1 / -1; }
  #fire { width: 56px; }
  #fire b { font-size: 16px; }
  #fire i { width: 12px; height: 12px; }
  .apron { display: flex; padding: 4px 12px 5px; gap: 12px; border-top: 1px solid #8a805d; }
  .growth { gap: 6px; }
  .level-medal { width: 31px; }
  .level-medal b { font-size: 15px; }
  .exp-meter { width: 77px; }
  .collection { border: 0; padding: 0; gap: 4px; }
  .draft-meter { width: 125px; }
  .glass-signs { top: 5px; left: 7px; }
  #mode-indicator { padding: 2px 7px; font-size: 10px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: 0s !important; }
  #timer.urgent { background: #69272b; color: #ffccc1; }
  .reel i { transform: translateY(-54px); }
}
