/* HAMSTER HAVOC: the page around the scene canvas. The canvas draws the world, the board and every control's art;
   the DOM on top holds only the text (amounts, labels, the rail line), the controls' hit areas and the panels. */
@font-face { font-family: 'Fredoka'; src: url('assets/fonts/fredoka-700.woff2?v=f67eddbc') format('woff2'); font-weight: 700; font-display: block; }
:root { --gold: #ffd23e; --green: #8dff5c; --ink: #f2f6ff; --steel: #1b2532; --font: 'Fredoka', 'Trebuchet MS', sans-serif;
  /* the game's lettering for small labels: Fredoka (rounded, heavy) with a dark outline drawn as a ring of shadows */
  --ol: #1a0c02; --outline: 1px 0 0 var(--ol), -1px 0 0 var(--ol), 0 1px 0 var(--ol), 0 -1px 0 var(--ol),
    1px 1px 0 var(--ol), -1px 1px 0 var(--ol), 1px -1px 0 var(--ol), -1px -1px 0 var(--ol), 0 2px 3px rgba(0, 0, 0, .55);
  /* the cards' lines: the gold digits' look (cream fill, a heavier dark brown outline, a soft shadow) */
  --olb: #3a1900; --outline-b: 2px 0 0 var(--olb), -2px 0 0 var(--olb), 0 2px 0 var(--olb), 0 -2px 0 var(--olb),
    1.5px 1.5px 0 var(--olb), -1.5px 1.5px 0 var(--olb), 1.5px -1.5px 0 var(--olb), -1.5px -1.5px 0 var(--olb),
    0 4px 6px rgba(0, 0, 0, .5); }
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; height: 100%; background: #06080d; overflow: hidden; touch-action: none; user-select: none;
  -webkit-user-select: none; font-family: var(--font); color: var(--ink); }
#cv { position: fixed; left: 0; top: 0; display: block; }
#ui { position: fixed; inset: 0; pointer-events: none; }
#ui button, #ui .plate { pointer-events: auto; }
.hidden { display: none !important; }
button { font-family: var(--font); }

/* hit areas over the canvas-drawn controls: transparent, the art is in the canvas */
.key { position: absolute; border: 0; padding: 0; margin: 0; background: transparent; border-radius: 50%; cursor: pointer;
  outline: none; color: var(--ink); }
.key small { position: absolute; left: 0; right: 0; bottom: 25%; font-size: 12px; letter-spacing: -.02em; line-height: 1;
  text-shadow: var(--outline); pointer-events: none; }
.key:disabled { cursor: default; }

/* the money plates: small label on top, the amount on its own line */
.plate { position: absolute; line-height: 1; text-align: center; }
.plate small { position: absolute; left: 0; right: 0; display: flex; justify-content: center; line-height: 0; z-index: 1; }
.plate b.gold { position: absolute; left: 0; right: 0; margin: 0 !important; display: flex; justify-content: center; }
/* a painted word (parts w_*): its picture is about 1.45 x the letters' cap height (outline, shadow) */
.pw { display: block; height: 1.45em; width: auto; pointer-events: none; }
.key small { line-height: 0; }
.key small .pw { margin: 0 auto; width: auto; }
.plate small { font-size: 12px; letter-spacing: .05em; color: #f2f5fb; text-shadow: var(--outline); }
.plate b { font-size: 17px; color: var(--gold); margin-top: 4px; white-space: nowrap; text-shadow: var(--outline); }
#betBox button { position: absolute; top: 0; bottom: 0; width: max(44px, 34%); min-height: 44px; border: 0; background: transparent; cursor: pointer; }
#betDown { left: 0; } #betUp { right: 0; }
/* iOS Safari keeps its double-tap zoom despite user-scalable=no and takes every second quick tap on a control for it:
   manipulation on the controls themselves drops the double-tap */
button, .key, .card, #betBox button { touch-action: manipulation; }

#rail { position: absolute; display: flex; align-items: center; justify-content: center; overflow: hidden; }
#railTxt { font-size: 12px; letter-spacing: .04em; color: #f6e6a8; white-space: nowrap; text-transform: uppercase;
  text-shadow: var(--outline), 0 0 6px rgba(255, 200, 60, .35); transition: opacity .15s;
  /* its own layer, its glow inside its box: WebKit left the old line's glowing edges on the rail after a change */
  display: inline-block; padding: 0 10px; will-change: opacity; }
#rail { contain: paint; }
#railTxt.fade { opacity: 0; }

#actBar { position: absolute; display: flex; gap: 2%; }
/* the page's own plaques (a sideways phone): 9-slice, so the round caps keep their shape at any width */
#actBar .ab { flex: 1; display: flex; align-items: center; justify-content: center; gap: 8px;
  border-style: solid; border-width: 10px 22px; border-image: url('assets/img/actbar_spins.webp?v=32f6e54b') 44 100 fill / 10px 22px stretch; }
#actBar .ab + .ab { border-image-source: url('assets/img/actbar_total.webp?v=69d9f0b8'); }
#actBar.a3 .ab { filter: hue-rotate(255deg) saturate(.9); }
#actBar.a3 .ab b, #actBar.a3 .ab span { filter: hue-rotate(-255deg); }
#actBar b { font-size: 12px; letter-spacing: .02em; color: #fff; white-space: nowrap; font-weight: 700; text-shadow: var(--outline); }
#actBar span { font-size: 16px; color: var(--gold); white-space: nowrap; }

/* the win plaque keeps its painted ends and stripes at their own shape (9-slice, the stripes repeat), never stretched */
#boardWin { position: absolute; transform: translate(-50%, -50%); padding: 0 .1em; height: 1.9em; min-width: 5.2em;
  border-style: solid; border-width: .57em 1.05em;
  border-image: url('assets/img/plaque_win.webp?v=7082d815') 130 240 fill / .57em 1.05em round; display: flex; align-items: center;
  justify-content: center; gap: 6px; font-size: 22px; color: var(--gold); text-shadow: 0 2px 3px #000; white-space: nowrap;
  transition: opacity .25s, left .2s, top .2s; pointer-events: none; }
#boardWin em { font-style: normal; font-size: .8em; color: var(--green); }
#boardWin em:empty { display: none; }
#boardWin.out { opacity: 0; }

#spinCount { position: absolute; transform: translate(-50%, -50%); font-size: 16px; color: #fff4c8; white-space: nowrap;
  text-shadow: 0 1px 2px #5a1a00; pointer-events: none; }

#ovText { position: absolute; left: 0; right: 0; text-align: center; pointer-events: none; z-index: 6; }
/* a leaving card's text fades with it (the card's out is about 0.45 s) */
#ovText.leaving { opacity: 0; transition: opacity .25s ease-in; }
body.card-up .key, body.card-up .plate button { pointer-events: none; }
#ovTitle { font-size: 20px; color: #ffe6a0; letter-spacing: .05em; text-shadow: var(--outline-b); }
#ovTitle:empty, #ovSub:empty { display: none; }
#ovAmtRow { display: flex; justify-content: center; margin: 4px 0; }
#ovAmt { font-size: 44px; color: var(--gold); text-shadow: var(--outline); }
#ovSub { font-size: 14px; color: #ffe6a0; margin-top: 6px; text-shadow: var(--outline-b); }

#toast { position: absolute; left: 50%; top: 40%; transform: translateX(-50%); padding: 4px 8px; min-width: 220px;
  text-align: center; border-style: solid; border-width: 22px 40px;
  border-image: url('assets/img/plaque_win.webp?v=7082d815') 130 240 fill / 22px 40px round; font-size: 14px;
  color: #fff3c4; text-shadow: 0 1px 2px #000; opacity: 0; transition: opacity .25s; pointer-events: none; white-space: nowrap; }
#toast.on { opacity: 1; }
/* a nine-slice picture painted as one (ui/plaque.js): the canvas covers the border box, the border-image is off */
.plqd { border-image-source: none !important; border-color: transparent !important; background-size: 100% 100% !important;
  background-origin: border-box !important; background-clip: border-box !important; background-repeat: no-repeat !important;
  background-position: 0 0 !important; }
/* the speed levels: NORMAL cool white, QUICK green, TURBO gold (the key's icon and glow use the same colours) */
#turboBtn[data-speed="quick"] small, #toast.speed-quick { color: #a8ff7a; }
#turboBtn[data-speed="turbo"] small, #toast.speed-turbo { color: #ffd23e; }
#toast.speed-normal, #toast.speed-quick, #toast.speed-turbo { font-size: 18px; letter-spacing: .06em; text-shadow: var(--outline); }
#toast .pw { height: 30px; margin: 0 auto; }

/* loading screen: the painted title picture (logo and Bun in it) from the first frame; PLAY keeps its place */
#loader { position: fixed; inset: 0; z-index: 50; transition: opacity .4s;
  background-color: #0a1220; background-image: url('assets/img/loader_port.webp?v=3ae6b374'), var(--ld-lq, none);
  background-position: center top; background-size: cover; background-repeat: no-repeat; }
@media (orientation: landscape) { #loader { background-image: url('assets/img/loader_land.webp?v=f12e4f41'), var(--ld-lq-l, none); } }
#loader.gone { opacity: 0; pointer-events: none; }
.ld-foot { position: absolute; left: 0; right: 0; bottom: 6%; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.ld-bar { width: 288px; height: 12px; background: url('assets/img/btn_steel.webp?v=39c90dfb') left center / 24px 12px repeat-x;
  overflow: hidden; }
.ld-bar i { display: block; height: 100%; width: 0; background: url('assets/img/btn_green.webp?v=6a5a2bd3') left center / 24px 12px repeat-x; }
.ld-txt { font-size: 13px; letter-spacing: .14em; color: #e9f5ff; text-shadow: 0 1px 3px #000; min-height: 16px; }
#playBtn { visibility: hidden; }
#playBtn.ready { visibility: visible; }

/* the painted pills (PLAY, START, COLLECT, BUY, CONFIRM, CANCEL): text on parts/btn_gold, btn_green, btn_steel */
.pill { border: 0; background: center / 100% 100% no-repeat; min-width: 150px; min-height: 52px; padding: 0 30px; font-size: 20px;
  letter-spacing: .06em; cursor: pointer; text-shadow: var(--outline); }
.pill.gold { background-image: url('assets/img/btn_gold.webp?v=11b115cf'); color: #fff4c8; }
.pill.green { background-image: url('assets/img/btn_green.webp?v=6a5a2bd3'); color: #fff4c8; }
.pill.steel { background-image: url('assets/img/btn_steel.webp?v=39c90dfb'); color: #e8f0ff; }
.pill:active { transform: translateY(1px); }
.pill:disabled { filter: grayscale(.9) brightness(.7); cursor: default; }
#playBtn { min-width: 200px; min-height: 64px; font-size: 26px; }

/* panels: menu (paytable, rules, settings), the bonus buy, autoplay; the painted panel frame (parts/ui_panel) */
#panelWrap.pending, #panelWrap.pending * { visibility: hidden !important; }
body.ov-wait #ovText, body.ov-wait #ovText * { visibility: hidden !important; }
#panelWrap { position: fixed; inset: 0; z-index: 40; background: rgba(3, 5, 9, .85); display: flex; align-items: center; justify-content: center; }
#panel { position: relative; width: min(94vw, 560px); max-height: min(86vh, 860px); display: flex; flex-direction: column;
  border-style: solid; border-width: 52px 22px 28px; border-image: url('assets/img/ui_panel.webp?v=ef22b88e') 180 76 95 76 fill / 52px 22px 28px stretch;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, .6)); }
#panelHead { position: absolute; left: 0; right: 0; top: -78px; height: 70px; display: flex; align-items: center; justify-content: center;
  pointer-events: none; }
#panelHead button { pointer-events: auto; }
#panelTitle { font-size: 20px; letter-spacing: .08em; color: #fff; text-shadow: 0 2px 3px #000, 0 0 8px rgba(141, 255, 92, .4); }
#panelClose { position: absolute; right: -14px; top: 24px; width: 48px; height: 48px; border: 0; padding: 0; font-size: 0; cursor: pointer;
  background: url('assets/img/btn_x.webp?v=4d8d57da') center / contain no-repeat; }
/* the panel's text keeps clear of the painted frame and is set in the game's lettering: cream on the dark window */
/* the panel scrolls, which starts its own gesture zone: pan-y keeps the scroll and drops the double-tap zoom that ate
   every second quick tap (the bet's + and -) */
#panelBody { touch-action: pan-y; }
#panelBody { flex: 1; padding: 14px 18px 18px; overflow-y: auto; font-size: 14px; line-height: 1.45; color: #f3e8c8;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .7); }
#panelBody h3 { margin: 14px 0 6px; font-size: 15px; color: var(--gold); letter-spacing: .04em; text-shadow: var(--outline); }
#panelBody p { margin: 4px 0; }
.tabs { display: flex; gap: 8px; margin-bottom: 10px; justify-content: center; }
/* a painted word on a pill: its height follows the pill, never wider than the pill's face */
.pw-pill { display: flex; align-items: center; justify-content: center; }
.pw-pill .pw { height: 46%; max-width: 86%; object-fit: contain; }
.tabs .pw-pill .pw { height: 40%; }
.card h4 .pw { height: auto; width: 92%; max-height: 22px; margin: 0 auto; object-fit: contain; }
.autos .pill .gold { font-size: 22px; }
/* painted pills keep their painted aspect (stretched capsules squash their caps) */
.tabs button { flex: 0 0 auto; width: auto; height: 44px; min-width: 0; min-height: 0; aspect-ratio: 205 / 100; padding: 0;
  font-size: 13px; letter-spacing: 0; }
.buyact .pill { width: auto; height: 56px; min-width: 0; min-height: 0; aspect-ratio: 205 / 100; padding: 0; }
.tabs button.on { filter: none; }
.tabs button:not(.on) { filter: brightness(.75) saturate(.6); }
.pays { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.pay { display: flex; gap: 10px; align-items: center; padding: 4px 0; }
.pay img { width: 60px; height: 60px; flex: none; object-fit: contain; padding: 4px; box-sizing: border-box;
  background: url('assets/img/cell.webp?v=5dcc49e3') center / 100% 100% no-repeat; }
.pay div { font-size: 13px; }
.pay b { color: var(--gold); font-weight: 700; }
.rtp { width: 100%; border-collapse: collapse; margin: 6px 0; font-size: 14px; }
.rtp td { padding: 6px 4px; border-bottom: 1px solid rgba(255, 255, 255, .08); }
.rtp td:last-child { text-align: right; color: var(--gold); }
/* the buy panel: three painted cards, each with its price at the panel's own bet; a CONFIRM step */
.buybet { display: flex; align-items: center; justify-content: center; gap: 12px; margin: 2px 0 10px; font-size: 15px; }
.buybet button { width: 46px; height: 46px; border: 0; padding: 0; font-size: 0; cursor: pointer;
  background: center / contain no-repeat; }
.buybet button.bm { background-image: url('assets/img/btn_minus.webp?v=8637073e'); }
.buybet button.bp { background-image: url('assets/img/btn_plus.webp?v=fe706164'); }
.buybet .pw { height: 22px; }
.buybet b { min-width: 90px; justify-content: center; font-size: 20px; color: var(--gold); }
/* the word BET, then - amount + as one group: the steps sit right beside the amount they change */
.buybet { gap: 14px; }
.buybet .step { display: inline-flex; align-items: center; gap: 6px; }
/* a step at the end of the bet list: dimmed like the bar's (render/scene.js BET_END_TONE), it does nothing */
.buybet button.off { filter: brightness(.45); cursor: default; }
/* on a short window the cards narrow (their height follows) so BUY / CONFIRM stay inside the panel: the rest of the
   panel (frame, bet row, text, button) takes about 300 px of its 86vh. Never below 264 px for the three (a phone
   held sideways, under about 518 px of height): there the panel body scrolls to BUY instead */
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; max-width: max(264px, calc((86vh - 300px) * 1.709 + 16px));
  margin: 0 auto; }
.card { position: relative; border-radius: 12px; overflow: hidden; background: center / cover no-repeat; aspect-ratio: 420 / 737;
  display: flex; flex-direction: column; justify-content: space-between; padding: 6px 4px 8px; cursor: pointer; border: 2px solid transparent; }
/* the chosen card steps forward and the others step back (no coloured glow: a stock look) */
.card { transition: transform .15s, filter .15s; }
.card.sel { border-color: var(--gold); transform: translateY(-3px) scale(1.04); }
.cards:has(.card.sel) .card:not(.sel):not(.off) { filter: brightness(.72); }
.card.off { filter: grayscale(.85) brightness(.6); cursor: default; }
.card h4 { margin: 0; padding: 4px 2px; font-size: 12px; line-height: 1.2; letter-spacing: 0; text-align: center; color: #fff; text-shadow: var(--outline); }
.card .price { display: flex; justify-content: center; align-items: center; font-size: 17px; margin: 0 auto 7%; padding: 0 12%;
  width: 84%; aspect-ratio: 420 / 191; box-sizing: border-box; background: url('assets/img/btn_steel.webp?v=39c90dfb') center / 100% 100% no-repeat; }
/* a long price shrinks to the plaque's width (panels.js fitPrices) */
.card .price .gold { max-width: 100%; }
.card .why { text-align: center; font-size: 12px; color: #ffd0c8; background: rgba(0, 0, 0, .7); border-radius: 6px; padding: 2px; }
.buyinfo { margin-top: 10px; min-height: 44px; font-size: 14px; text-align: center; }
.buyact { display: flex; justify-content: center; gap: 10px; margin-top: 8px; }
.autos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.autos .pill { min-width: 0; min-height: 0; padding: 0; width: min(100%, 120px); height: auto; aspect-ratio: 205 / 100; justify-self: center; }

/* under a full-screen card the rail line and the board's win step aside; under the blast door all the text does */
body.ov-card #rail, body.ov-card #boardWin { visibility: hidden; }
body.door-shut #ui > :not(#toast) { visibility: hidden; }
/* START / COLLECT under the card's text, outside its flow: the number never moves when it appears */
#ovBtn { position: absolute; left: 50%; top: 100%; transform: translateX(-50%); margin-top: 10px; pointer-events: auto; }

#ovSub { line-height: 1.25; }
/* the act bar drawn by its rig: the page keeps only the two lines, centred on the rig's text bones */
#actBar.rig .ab { position: absolute; flex: none; background: none !important; border: 0; border-image: none; filter: none; transform: translate(-50%, -50%);
  white-space: nowrap; }
#actBar.rig .ab b, #actBar.rig .ab span { filter: none; }

/* amounts in the painted gold digits (ui/gold.js): 1em = a digit's height, the row's box is its ink box */
.gold { display: inline-flex; align-items: flex-start; height: 1em; line-height: 1; white-space: nowrap; text-shadow: none; }
.gold img { display: block; flex: none; }
.gold span { font-size: .78em; line-height: 1.28; color: var(--gold); text-shadow: var(--outline); }
#bwMult.gold { filter: hue-rotate(70deg) saturate(1.25) brightness(1.1); font-size: .9em; }
#actBar span.gold { height: 1em; }

/* the painted worded buttons (parts btn_play, btn_start, btn_collect, btn_buy, btn_confirm, btn_cancel): the word is
   in the picture, the element only sizes it and takes the tap */
.wbtn { border: 0; padding: 0; margin: 0; font-size: 0; color: transparent; cursor: pointer; aspect-ratio: 470 / 229;
  width: 168px; background: center / contain no-repeat; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .45)); }
.wbtn:active { transform: translateY(1px) scale(.98); }
.wbtn:disabled { filter: grayscale(.6) brightness(.82); cursor: default; }
.w-play { background-image: url('assets/img/btn_play.webp?v=097fa37f'); }
.w-start { background-image: url('assets/img/btn_start.webp?v=f4ce206d'); }
.w-collect { background-image: url('assets/img/btn_collect.webp?v=dd66b83a'); }
.w-buy { background-image: url('assets/img/btn_buy.webp?v=6b59e526'); }
.w-confirm { background-image: url('assets/img/btn_confirm.webp?v=d5d4f56b'); }
.w-cancel { background-image: url('assets/img/btn_cancel.webp?v=351c6de8'); }
/* a step with no painted word of its own (NEXT): the green pill with the word in the game's lettering */
.w-next { background-image: url('assets/img/btn_green.webp?v=6a5a2bd3'); font-size: 22px; color: #fff4c8; letter-spacing: .06em;
  text-shadow: var(--outline); }
#playBtn.wbtn { width: min(62vw, 250px); }
#ovBtn.wbtn { width: clamp(150px, 40vw, 210px); }
.buyact .wbtn { width: 150px; }
/* build 84: the buy panel on a short landscape screen */
@media (orientation: landscape) and (max-height: 500px) and (min-width: 560px) {
  #panel:has(.cards) { width: min(94vw, 680px); }
  #panelBody:has(.cards) { display: grid; grid-template-columns: auto minmax(0, 1fr); grid-template-areas: "cards bet" "cards info" "cards act";
    column-gap: 18px; align-items: center; align-content: center; }
  #panelBody:has(.cards) .cards { grid-area: cards; width: clamp(264px, calc((86vh - 112px) * 1.709 + 16px), 300px); max-width: none; margin: 0; }
  #panelBody:has(.cards) .buybet { grid-area: bet; flex-wrap: wrap; margin: 0; }
  #panelBody:has(.cards) .buyinfo { grid-area: info; margin: 0; min-height: 0; }
  #panelBody:has(.cards) .buyact { grid-area: act; margin: 0; }
  #panelBody:has(.cards) .buyact .wbtn { width: min(150px, calc(50% - 5px)); }
}

/* the how-to cards after the first PLAY (and from RULES): the painted card on the canvas, its line, three dots and a
   worded button on the page */
#howto { position: absolute; left: 0; width: 100%; min-height: 150px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 10px; pointer-events: none; z-index: 8; }
#howLine { max-width: min(92vw, 520px); padding: 0 12px; text-align: center; font-size: 17px; line-height: 1.3; color: #fff4c8;
  text-shadow: var(--outline); }
#howLine b { color: var(--gold); font-weight: 700; }
#howDots { display: flex; gap: 8px; }
#howDots i { width: 10px; height: 10px; border-radius: 50%; background: rgba(255, 255, 255, .3); box-shadow: 0 0 0 1px rgba(0, 0, 0, .5); }
#howDots i.on { background: var(--green); box-shadow: 0 0 8px rgba(141, 255, 92, .8); }
#howBtn { pointer-events: auto; width: clamp(150px, 40vw, 200px); flex: none; }
body.how-up .key, body.how-up .plate button { pointer-events: none; }
/* RULES: the three painted how-to cards, each opens the how-to from itself */
.howrow { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 2px 0 10px; }
.howrow button { border: 0; padding: 0; aspect-ratio: 900 / 1350; background: center / cover no-repeat; border-radius: 10px;
  cursor: pointer; box-shadow: 0 0 0 2px rgba(141, 255, 92, .35); }
/* the panel's painted title plate (parts title_*), centred on the frame's top edge */
#panelTitle { height: 64px; width: auto; display: block; filter: drop-shadow(0 3px 6px rgba(0, 0, 0, .5)); }
#boardWin.line { min-width: 3.6em; }
/* a worded button the btn_pill rig draws in the canvas: the page keeps the tap (and NEXT's word) only */
.wbtn.rig { background-image: none !important; filter: none; }
/* a card, the how-to or a panel is up: the stage's page parts step away with the canvas's bar (render/scene.js) */
#ui > .key, #ui > .plate, #rail, #actBar, #spinCount { transition: opacity .25s; }
body.stage-off #ui > .key, body.stage-off #ui > .plate, body.stage-off #rail, body.stage-off #actBar,
body.stage-off #spinCount, body.stage-off #boardWin { opacity: 0 !important; pointer-events: none !important; }
