/* Mango Mountain Race — carved wood, jungle leaves and mango gold.
   Layout concept: one scaled stage (1920x1080 landscape, 1080x1920 portrait). The board is
   anchored at its bottom edge and grows upward per bonus tier; the Dice Rail and HUD never move. */
:root {
  color-scheme: dark;
  --onyx: #140b05;
  --felt-900: #1a0f07;
  --felt-700: #3b2412;
  --felt-500: #5c3a1c;
  --gold-hi: #fff1c2;
  --gold: #ffc23d;
  --gold-mid: #c7822a;
  --gold-lo: #6b3a12;
  --ivory: #fff4dc;
  --muted: #dcc196;
  --ruby: #d8381e;
  --jade: #5fae2e;
  --sapphire: #3b7fd6;
  --amethyst: #8e45c0;
  --bronze: #79b83a;
  --wood: #8a5426;
  --wood-dk: #2a1407;
  --shadow: rgba(0, 0, 0, 0.6);
  --font-display: "Lilita One", "Arial Rounded MT Bold", "Trebuchet MS", sans-serif;
  --font-ui: "Nunito", "Segoe UI", "Trebuchet MS", sans-serif;
  /* the carved-wood rim of every plaque, the board frame and the HUD edge */
  --gold-grad: linear-gradient(170deg, #f0c486 0%, #c07c3c 26%, #7a4520 52%, #b06c32 76%, #e8b26c 100%);
  --text-grad: linear-gradient(180deg, #fff7cf 0%, #ffd84f 38%, #f39a1f 60%, #ffc84a 80%, #fff2b8 100%);
  --panel-fill: radial-gradient(120% 140% at 50% 0%, #5e3819 0%, #3c2210 46%, #211108 100%);
  --chamfer: inset(0 round 20px);
  --chamfer-in: inset(0 round 16px);
}

[hidden] { display: none !important; }
html, body { height: 100%; }
/* The host may pad the root by the phone's safe-area insets: keep that padding inside the 100% height. */
html { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--onyx);
  color: var(--ivory);
  font-family: var(--font-ui);
  overflow: hidden;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
:focus-visible { outline: 3px solid var(--gold-hi); outline-offset: 3px; }
img { -webkit-user-drag: none; }

/* ------------------------------------------------------------------ backdrop */
#bg { position: fixed; inset: 0; z-index: 0; background: var(--onyx); }
.bg-img { position: absolute; inset: 0; background: center / cover no-repeat; }
.bg-base { background-image: url(../assets/img/bg_base.jpg); }
.bg-bonus { background-image: url(../assets/img/bg_bonus.jpg); opacity: 0; }
.bg-shade {
  position: absolute; inset: 0;
  background:
    radial-gradient(64% 60% at 50% 46%, rgba(20, 10, 3, 0) 0%, rgba(20, 10, 3, 0.18) 62%, rgba(14, 7, 2, 0.7) 100%),
    linear-gradient(180deg, rgba(14, 7, 2, 0.15) 0%, rgba(14, 7, 2, 0) 30%, rgba(14, 7, 2, 0.5) 100%);
}

#app {
  position: relative; z-index: 1; height: 100%; box-sizing: border-box;
  padding-left: max(16px, env(safe-area-inset-left, 0px));
  padding-right: max(16px, env(safe-area-inset-right, 0px));
  padding-block: 6px;
}
#viewport { position: relative; width: 100%; height: 100%; overflow: hidden; }
#stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
#stage.land { width: 1920px; height: 1080px; }
#stage.port { width: 1080px; height: 1920px; }
/* The shaken containers sit on their own GPU layers, so a shake moves pixels instead of repainting the table. */
#shake { position: absolute; inset: 0; will-change: transform; }

.gold-text {
  background: var(--text-grad);
  -webkit-background-clip: text; background-clip: text;
  color: transparent;
  filter: drop-shadow(0 3px 0 rgba(36, 22, 4, 0.95)) drop-shadow(0 0 16px rgba(255, 196, 80, 0.3));
}

/* ------------------------------------------------------------------ plaques */
.plaque { position: relative; isolation: isolate; border: 0; background: none; }
.plaque::before {
  content: ""; position: absolute; inset: 0; z-index: -2;
  clip-path: var(--chamfer); background: var(--gold-grad);
}
.plaque::after {
  content: ""; position: absolute; inset: 3px; z-index: -1;
  clip-path: var(--chamfer-in); background: var(--panel-fill);
  box-shadow: inset 0 0 0 2px rgba(42, 20, 7, 0.9), inset 0 2px 0 3px rgba(255, 214, 160, 0.12), inset 0 -18px 30px rgba(0, 0, 0, 0.4);
}

/* ------------------------------------------------------------------ left column */
#logo { position: absolute; max-width: none; filter: drop-shadow(0 14px 24px rgba(0, 0, 0, 0.65)); }
.land #logo { left: 95px; top: 30px; width: 370px; }
/* The rooster racer: placed by UI.layoutLogo, behind the panels and the board so they overlap his lower body. */
#hero { position: absolute; left: 1462px; top: 10px; width: 250px; height: 400px; pointer-events: none; transform-origin: 50% 100%; }
#hero .hero-body { position: absolute; inset: 0; transform-origin: 50% 100%; filter: drop-shadow(0 16px 26px rgba(0, 0, 0, 0.55)); }
#hero img { display: block; width: 100%; height: 100%; max-width: none; object-fit: contain; object-position: 50% 100%; }
/* Sprite-sheet animation (frames from the Codex GIFs); the still shows until the sheets have decoded. */
.hero-sprite { position: absolute; inset: 0; background-repeat: no-repeat; visibility: hidden; }
#hero.anim img { visibility: hidden; }
#hero.anim .hero-sprite { visibility: visible; }
.port #logo { left: 240px; top: 330px; width: 600px; }

.btn-buy, .toggle {
  position: absolute; display: grid; align-content: center; justify-items: center; gap: 6px;
  text-align: center; transition: transform 0.15s ease, filter 0.2s ease;
}
.btn-buy:hover:not(:disabled), .toggle:hover:not(:disabled) { transform: translateY(-2px); filter: brightness(1.12); }
.btn-buy:active:not(:disabled), .toggle:active:not(:disabled) { transform: translateY(1px); }
.btn-buy:disabled, .toggle:disabled { filter: grayscale(0.7) brightness(0.6); }
.btn-buy .lbl { font-family: var(--font-display); font-size: 42px; letter-spacing: 0.04em; color: var(--ivory); text-shadow: 0 3px 0 #6a2405, 0 0 14px rgba(255, 220, 140, 0.35); }
.btn-buy .sub { font-size: 19px; font-weight: 800; letter-spacing: 0.12em; color: #ffe9c4; text-transform: uppercase; text-shadow: 0 2px 0 rgba(90, 30, 4, 0.8); }
.btn-buy::after { background: radial-gradient(120% 140% at 50% 0%, #ffb53c 0%, #e0701a 45%, #8a320a 100%); }
.land .btn-buy { left: 115px; top: 352px; width: 330px; height: 124px; }
.port .btn-buy { left: 36px; top: 150px; width: 320px; height: 132px; }

.toggle .lbl { font-family: var(--font-display); font-weight: 400; font-size: 27px; letter-spacing: 0.08em; }
.toggle .sub { font-size: 16px; font-weight: 700; letter-spacing: 0.03em; color: var(--muted); }
.toggle .state {
  position: absolute; right: 16px; top: 12px; font-size: 14px; font-weight: 700; letter-spacing: 0.12em;
  color: var(--muted); padding: 3px 8px 1px; border: 1px solid rgba(226, 187, 93, 0.4); border-radius: 4px;
}
.toggle[aria-pressed="true"]::after { background: radial-gradient(120% 140% at 50% 0%, #6fb032 0%, #3d7016 50%, #1d3a08 100%); }
.toggle[aria-pressed="true"] .state { color: var(--onyx); background: var(--gold); border-color: var(--gold-hi); }
.toggle[aria-pressed="true"] { filter: drop-shadow(0 0 14px rgba(255, 210, 110, 0.55)); }
.land #dcBtn { left: 115px; top: 500px; width: 330px; height: 92px; }
.land #edBtn { left: 115px; top: 606px; width: 330px; height: 92px; }
.port #dcBtn { left: 380px; top: 150px; width: 320px; height: 132px; }
.port #edBtn { left: 724px; top: 150px; width: 320px; height: 132px; }
.land .toggle .lbl { padding-right: 44px; }
.port .toggle .state { right: 50%; transform: translateX(50%); top: auto; bottom: 10px; }
.port .toggle .sub { display: none; }
.port .toggle { align-content: start; padding-top: 30px; }

.tier-badge { position: absolute; display: grid; place-items: center; }
.tier-badge img { width: 100%; max-width: none; display: block; filter: drop-shadow(0 10px 18px rgba(0, 0, 0, 0.6)); }
.tier-badge .name {
  position: absolute; top: 46%; left: 50%; transform: translate(-50%, -50%);
  font-family: var(--font-display); font-size: 58px; letter-spacing: 0.06em; color: var(--ivory);
  text-shadow: 0 4px 0 rgba(42, 20, 7, 0.9), 0 0 18px rgba(255, 230, 170, 0.45);
}
.tier-badge .meta { position: absolute; top: 102%; left: 0; right: 0; text-align: center; font-size: 20px; letter-spacing: 0.14em; color: var(--muted); }
.land .tier-badge { left: 100px; top: 330px; width: 360px; }
.port .tier-badge { left: 24px; top: 140px; width: 340px; }
.port .tier-badge .name { font-size: 50px; }
.port .tier-badge .meta { display: none; }

/* ------------------------------------------------------------------ right column */
#ladder { position: absolute; padding: 26px 26px 24px; display: grid; gap: 10px; }
.land #ladder { left: 1475px; top: 344px; width: 330px; box-sizing: border-box; }
.port #ladder { display: none; }
#ladder h2 {
  margin: 0 0 6px; text-align: center; font-family: var(--font-display); font-weight: 400; font-size: 32px;
  letter-spacing: 0.12em; background: var(--text-grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.ladder-row {
  display: grid; grid-template-columns: 54px 1fr auto; align-items: center; gap: 12px;
  font-size: 22px; letter-spacing: 0.05em; padding: 8px 10px 6px; border-radius: 10px; white-space: nowrap;
  background: rgba(0, 0, 0, 0.28); border: 1px solid rgba(226, 187, 93, 0.16);
}
.ladder-row .cnt { font-family: var(--font-display); font-size: 30px; text-align: center; color: var(--gold); white-space: nowrap; letter-spacing: 0; }
.ladder-row.base .cnt { font-size: 23px; }
.ladder-row .what { font-weight: 900; }
.ladder-row .tag { color: var(--muted); font-size: 19px; font-variant-numeric: tabular-nums; }
.ladder-row.base .what { font-weight: 800; letter-spacing: 0; text-transform: none; }
.ladder-row.t0 { border-left: 5px solid var(--bronze); }
.ladder-row.t1 { border-left: 5px solid var(--sapphire); }
.ladder-row.t2 { border-left: 5px solid var(--ruby); }
.ladder-row.t3 { border-left: 5px solid var(--amethyst); }
.ladder-row.hot { background: rgba(226, 187, 93, 0.22); border-color: var(--gold); }

.panel { position: absolute; display: grid; justify-items: center; align-content: center; box-sizing: border-box; }
.panel .lbl { font-size: 20px; font-weight: 700; letter-spacing: 0.22em; color: var(--muted); }
#fsPanel .val { font-family: var(--font-display); font-size: 64px; line-height: 1; color: var(--ivory); font-variant-numeric: tabular-nums; }
#multPanel .val { font-family: var(--font-display); font-size: 124px; line-height: 1.02; font-variant-numeric: tabular-nums; }
#multPanel .note { font-size: 16px; letter-spacing: 0.16em; color: var(--muted); text-transform: uppercase; }
.land #fsPanel { left: 1475px; top: 318px; width: 330px; height: 124px; gap: 6px; }
.land #multPanel { left: 1475px; top: 462px; width: 330px; height: 250px; gap: 4px; }
.port #fsPanel { left: 380px; top: 150px; width: 320px; height: 132px; gap: 4px; }
.port #multPanel { left: 724px; top: 150px; width: 320px; height: 132px; gap: 0; }
.port #multPanel .val { font-size: 74px; }
.port #multPanel .note { display: none; }
.port #fsPanel .val { font-size: 64px; }

/* ------------------------------------------------------------------ board */
#boardWrap { position: absolute; will-change: transform; }
.board-bg {
  position: absolute; inset: -16px;
  background:
    linear-gradient(180deg, rgba(255, 220, 160, 0.07), rgba(0, 0, 0, 0) 22%),
    radial-gradient(90% 70% at 50% 40%, rgba(66, 40, 20, 0.95) 0%, rgba(40, 23, 10, 0.97) 60%, rgba(22, 12, 5, 0.98) 100%);
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.7), inset 0 0 50px rgba(0, 0, 0, 0.55);
}
.reels { position: absolute; inset: 0; }
.reel { position: absolute; top: 0; bottom: 0; overflow: hidden; }
.reel::after {
  content: ""; position: absolute; top: 4%; bottom: 4%; right: 0; width: 1px; z-index: 2;
  background: linear-gradient(180deg, rgba(226, 187, 93, 0), rgba(226, 187, 93, 0.32), rgba(226, 187, 93, 0));
}
.reel:last-child::after { display: none; }
.strip { position: absolute; left: 0; top: 0; width: 100%; will-change: transform; }
.cell { position: absolute; left: 0; display: grid; place-items: center; }
.cell > img { width: 88%; height: 88%; object-fit: contain; max-width: none; pointer-events: none; }
.cell.blur > img { width: 80%; height: 80%; opacity: 0.92; }
.cell .die { pointer-events: none; }
.cell.dim { opacity: 0.3; filter: saturate(0.45); transition: opacity 0.25s, filter 0.25s; }
.cell.win::before {
  content: ""; position: absolute; inset: 5px; border-radius: 12px;
  border: 2px solid rgba(255, 226, 150, 0.9);
  box-shadow: 0 0 18px rgba(255, 200, 90, 0.6), inset 0 0 22px rgba(255, 200, 90, 0.35);
  background: radial-gradient(closest-side, rgba(255, 220, 140, 0.18), rgba(255, 220, 140, 0));
}
.cell.win > img, .cell.win > .die { animation: winPulse 0.9s ease-in-out infinite; }
@keyframes winPulse { 50% { transform: scale(1.09); filter: drop-shadow(0 0 16px rgba(255, 214, 120, 0.95)); } }

.board-frame { position: absolute; inset: -16px; pointer-events: none; z-index: 3; }
.board-frame::before {
  content: ""; position: absolute; inset: -6px; border-radius: 26px;
  padding: 12px; background: var(--gold-grad);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
  filter: drop-shadow(0 0 1.5px var(--wood-dk)) drop-shadow(0 0 1.5px var(--wood-dk));
}
.board-frame::after {
  content: ""; position: absolute; inset: 7px; border-radius: 16px; border: 2px solid rgba(42, 20, 7, 0.85);
  box-shadow: inset 0 0 0 1px rgba(255, 200, 130, 0.18);
}
.board-frame .orn { position: absolute; width: 150px; max-width: none; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, 0.7)); }
.board-frame .tl { left: -40px; top: -40px; }
.board-frame .tr { right: -40px; top: -40px; transform: scaleX(-1); }
/* The rail is the board's base, so only the top corners carry ornaments. */
.board-frame .bl, .board-frame .br { display: none; }
.board-frame .crest { position: absolute; left: 50%; top: -84px; width: 340px; max-width: none; transform: translateX(-50%); filter: drop-shadow(0 6px 8px rgba(0, 0, 0, 0.7)); }

.board-glow { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.reel-glow {
  position: absolute; top: -6px; bottom: -6px; border-radius: 8px; opacity: 0;
  border: 3px solid rgba(255, 222, 140, 0.95);
  box-shadow: 0 0 26px 6px rgba(255, 196, 80, 0.75), inset 0 0 40px rgba(255, 196, 80, 0.5);
  background: linear-gradient(0deg, rgba(255, 200, 90, 0.28), rgba(255, 200, 90, 0) 70%);
}
.reel-glow.on { animation: anticGlow 0.42s ease-in-out infinite alternate; }
@keyframes anticGlow { from { opacity: 0.55; } to { opacity: 1; } }

.board-fx { position: absolute; inset: 0; pointer-events: none; z-index: 4; }
/* The caption takes the crest's place at the top centre of the frame while wins cycle. */
.win-caption {
  position: absolute; left: 50%; top: -16px; transform: translate(-50%, -50%); z-index: 6;
  display: flex; align-items: center; gap: 14px; white-space: nowrap;
  padding: 8px 26px 6px; border-radius: 40px; font-size: 24px; letter-spacing: 0.06em; font-weight: 600;
  background: linear-gradient(180deg, rgba(92, 54, 24, 0.97), rgba(38, 20, 8, 0.97));
  border: 3px solid #d9a05a; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.6); color: var(--ivory);
  font-variant-numeric: tabular-nums;
}
.win-caption img { width: 40px; height: 40px; max-width: none; }
.win-caption b { color: var(--gold-hi); font-size: 28px; }
.win-caption span { color: var(--ivory); }

.win-toast {
  position: absolute; left: 50%; top: 50%; z-index: 7;
  display: flex; align-items: baseline; gap: 18px; white-space: nowrap;
  padding: 18px 40px 12px; border-radius: 14px;
  background: radial-gradient(120% 160% at 50% 0%, rgba(84, 48, 20, 0.95), rgba(30, 15, 5, 0.97));
  border: 2px solid var(--gold); box-shadow: 0 10px 40px rgba(0, 0, 0, 0.7), 0 0 30px rgba(255, 196, 80, 0.35);
  font-variant-numeric: tabular-nums;
}
.win-toast .raw { font-family: var(--font-ui); font-weight: 700; font-size: 46px; color: var(--ivory); }
.win-toast .x { font-family: var(--font-display); font-size: 52px; color: var(--gold); }
.win-toast .eq { font-family: var(--font-display); font-size: 64px; }
.win-toast .note { font-size: 18px; letter-spacing: 0.14em; color: var(--muted); align-self: center; }

/* dice */
.die { position: relative; background: center / 100% 100% no-repeat; flex: none; }
.die-normal { background-image: url(../assets/img/die_ivory.webp); }
.die-wild { background-image: url(../assets/img/die_jade.webp); }
.die-mult { background-image: url(../assets/img/die_gold.webp); }
.pip {
  position: absolute; width: 15.5%; height: 15.5%; border-radius: 50%; transform: translate(-50%, -50%);
  background: radial-gradient(circle at 36% 32%, #a8744c 0 7%, #5a2e12 34%, #2e1406 76%, #180901 100%);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 250, 235, 0.6);
}
.die-wild .pip {
  background: radial-gradient(circle at 36% 32%, #fffbe3 0 8%, #f2c94e 36%, #9a6b12 78%, #4d3304 100%);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.5), 0 1px 0 rgba(0, 0, 0, 0.35);
}
.die-mult .pip {
  background: radial-gradient(circle at 36% 32%, #ff7d7d 0 7%, #a50f26 36%, #4a0410 80%, #200005 100%);
  box-shadow: inset 0 2px 3px rgba(0, 0, 0, 0.6), 0 1px 0 rgba(255, 245, 210, 0.6);
}
.die.blank .pip { opacity: 0; }
.die .tag {
  position: absolute; right: -10%; top: -10%; min-width: 40%; padding: 4% 6% 2%; box-sizing: border-box;
  border-radius: 999px; text-align: center; font-family: var(--font-display); font-weight: 400; line-height: 1.1;
  font-size: calc(var(--ds, 120px) * 0.2); color: var(--ivory);
  background: linear-gradient(180deg, #ff5a26, #a8240a); border: 2px solid var(--gold-hi);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
}
.die-wild .tag {
  right: auto; top: auto; left: 50%; bottom: -11%; transform: translateX(-50%); min-width: 70%;
  background: linear-gradient(180deg, #2b9b6e, #0b4a33); font-size: calc(var(--ds, 120px) * 0.15); letter-spacing: 0.08em;
}
.die.blank .tag { opacity: 0; }
.die.lit { filter: drop-shadow(0 0 14px rgba(255, 220, 140, 0.95)) brightness(1.08); }
.pinned::after {
  content: "EXTRA DIE"; position: absolute; left: 50%; top: 100%; transform: translate(-50%, 6px);
  white-space: nowrap; font-size: 16px; font-weight: 700; letter-spacing: 0.16em; color: var(--gold-hi);
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9);
}

.cube-wrap { position: absolute; perspective: 900px; pointer-events: none; z-index: 8; }
.cube { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; }
.cube .face { position: absolute; left: 0; top: 0; backface-visibility: hidden; -webkit-backface-visibility: hidden; }

/* wilds */
.wild-beam {
  position: absolute; height: 8px; transform-origin: 0 50%; border-radius: 4px; z-index: 6;
  background: linear-gradient(90deg, rgba(170, 255, 120, 0.1), rgba(190, 255, 140, 0.95), rgba(255, 245, 200, 1));
  box-shadow: 0 0 16px 4px rgba(130, 220, 70, 0.7);
}

/* ------------------------------------------------------------------ rail */
#rail { position: absolute; will-change: transform; }
.rail-bar {
  position: absolute; left: -20px; right: -20px; top: 4px; bottom: 4px; border-radius: 40px;
  background:
    repeating-linear-gradient(100deg, rgba(255, 220, 160, 0) 0 34px, rgba(255, 220, 160, 0.07) 34px 38px),
    linear-gradient(180deg, #8a5426 0%, #5e3517 45%, #3e220e 100%);
  box-shadow: inset 0 0 0 3px var(--wood-dk), inset 0 3px 0 4px rgba(255, 210, 150, 0.18), 0 8px 24px rgba(0, 0, 0, 0.6);
}
.sockets { position: absolute; inset: 0; }
.socket {
  position: absolute; top: 50%; border-radius: 50%; box-sizing: border-box;
  background: radial-gradient(ellipse 70% 60% at 50% 38%, #2a1608 0%, #160a03 60%, #6b3d1a 86%, #a0642e 100%);
  box-shadow: inset 0 6px 12px rgba(0, 0, 0, 0.9), 0 0 0 3px var(--wood-dk), 0 3px 0 3px rgba(42, 20, 7, 0.6);
  display: grid; place-items: center;
}
.socket .die { filter: drop-shadow(0 2px 3px rgba(0, 0, 0, 0.7)); }
.socket.lit { animation: socketLit 0.6s ease-in-out infinite alternate; }
@keyframes socketLit {
  from { box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.6), 0 0 0 2px var(--gold), 0 0 16px 4px rgba(255, 210, 110, 0.6); }
  to { box-shadow: inset 0 4px 10px rgba(0, 0, 0, 0.6), 0 0 0 3px var(--gold-hi), 0 0 34px 12px rgba(255, 210, 110, 0.95); }
}
.rail-total {
  position: absolute; display: grid; justify-items: center; align-content: center; box-sizing: border-box;
  border-radius: 18px; background: linear-gradient(180deg, #5a3417, #241207);
  box-shadow: inset 0 0 0 3px #d9a05a, 0 0 0 3px var(--wood-dk), 0 8px 18px rgba(0, 0, 0, 0.6);
}
.rail-total .lbl { font-size: 15px; font-weight: 700; letter-spacing: 0.2em; color: var(--muted); }
.rail-total .val { font-family: var(--font-display); font-size: 38px; line-height: 1; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.rail-total.t0 { box-shadow: inset 0 0 0 3px var(--bronze), 0 0 26px 6px rgba(192, 132, 78, 0.7); }
.rail-total.t1 { box-shadow: inset 0 0 0 3px #8fb0ff, 0 0 26px 6px rgba(80, 130, 230, 0.7); }
.rail-total.t2 { box-shadow: inset 0 0 0 3px #ff6b80, 0 0 26px 6px rgba(220, 40, 70, 0.7); }
.rail-total.t3 { box-shadow: inset 0 0 0 3px #d79cff, 0 0 26px 6px rgba(150, 70, 210, 0.8); }
.rail-total.fs { box-shadow: inset 0 0 0 3px var(--jade), 0 0 26px 6px rgba(47, 174, 124, 0.7); }

/* ------------------------------------------------------------------ HUD */
#hud { position: absolute; inset: 0; pointer-events: none; }
#hud > * { pointer-events: auto; }
#hud > .hud-bar { pointer-events: none; }
.hud-bar {
  position: absolute; left: 0; right: 0;
  background:
    repeating-linear-gradient(90deg, rgba(0, 0, 0, 0) 0 238px, rgba(30, 14, 4, 0.55) 238px 241px),
    linear-gradient(180deg, rgba(96, 56, 24, 0.95), rgba(40, 21, 8, 0.98));
  box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.45);
}
.hud-bar::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 6px; background: var(--gold-grad); box-shadow: 0 2px 0 var(--wood-dk); }
.land .hud-bar { top: 960px; height: 120px; }
.port .hud-bar { top: 1540px; height: 380px; }

.hud-icons { position: absolute; display: flex; gap: 14px; }
.land .hud-icons { left: 34px; top: 992px; }
.port .hud-icons { right: 36px; top: 36px; gap: 20px; }
.icon-btn {
  width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; padding: 0;
  background: radial-gradient(circle at 50% 30%, #9a6234, #5a3417 60%, #3a200c); border: 3px solid #e0aa66;
  box-shadow: 0 0 0 2px var(--wood-dk), 0 4px 10px rgba(0, 0, 0, 0.5);
}
.port .icon-btn { width: 84px; height: 84px; }
.icon-btn svg { width: 58%; height: 58%; fill: none; stroke: var(--ivory); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn:hover { border-color: var(--gold-hi); }
#soundBtn .off { display: none; }
#soundBtn.muted .on { display: none; }
#soundBtn.muted .off { display: inline; }

.readout { position: absolute; display: grid; gap: 4px; }
.readout .lbl { font-size: 16px; font-weight: 900; letter-spacing: 0.18em; color: var(--muted); }
.readout output { font-family: var(--font-display); font-weight: 400; font-size: 36px; letter-spacing: 0.02em; color: var(--ivory); font-variant-numeric: tabular-nums; white-space: nowrap; }
.land .r-balance { left: 260px; top: 980px; }
.land .r-bet { left: 600px; top: 980px; }
.land .r-win { left: 1250px; top: 980px; min-width: 300px; }
.land .r-cost { left: 1640px; top: 980px; }
.port .r-balance { left: 40px; top: 1572px; }
.port .r-win { right: 40px; top: 1572px; text-align: right; }
.port .r-bet { left: 40px; top: 1700px; }
.port .r-cost { left: 40px; top: 1822px; }
.port .readout .lbl { font-size: 22px; }
.port .readout output { font-size: 44px; }
.r-win output { color: var(--gold-hi); }
.r-win.hot output { text-shadow: 0 0 18px rgba(255, 210, 110, 0.85); }

.bet-ctl { display: flex; align-items: center; gap: 12px; }
.step-btn {
  width: 40px; height: 40px; border-radius: 50%; padding: 0; line-height: 1; font-size: 28px; font-weight: 700;
  background: radial-gradient(circle at 50% 30%, #9a6234, #5a3417 60%, #3a200c); border: 3px solid #e0aa66; color: var(--ivory);
  box-shadow: 0 0 0 2px var(--wood-dk);
}
.port .step-btn { width: 70px; height: 70px; font-size: 40px; }
.step-btn:disabled { opacity: 0.35; }
.bet-ctl output { min-width: 128px; text-align: center; }
.port .bet-ctl output { min-width: 170px; }

#spinBtn {
  position: absolute; border: 0; padding: 0; border-radius: 50%;
  background: center / 100% 100% no-repeat url(../assets/img/orn_medallion.webp);
  filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.7));
  transition: filter 0.2s ease, transform 0.12s ease;
}
.land #spinBtn { left: 908px; top: 968px; width: 104px; height: 104px; }
.port #spinBtn { left: 430px; top: 1666px; width: 220px; height: 220px; }
#spinBtn:hover:not(:disabled) { filter: drop-shadow(0 8px 14px rgba(0, 0, 0, 0.7)) drop-shadow(0 0 16px rgba(255, 210, 110, 0.6)) brightness(1.08); }
#spinBtn:active:not(:disabled) { transform: scale(0.96); }
#spinBtn:disabled { filter: grayscale(0.6) brightness(0.7); }
#spinBtn .spin-ico { position: absolute; left: 26%; top: 26%; width: 48%; height: 48%; fill: none; stroke: var(--ivory); stroke-width: 5; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.8)); }
#spinBtn.spinning .spin-ico { animation: spinIco 0.6s linear infinite; }
@keyframes spinIco { to { transform: rotate(360deg); } }
#spinBtn .auto-count { position: absolute; inset: 0; display: grid; place-items: center; font-family: var(--font-display); font-size: 40px; color: var(--ivory); text-shadow: 0 2px 4px rgba(0, 0, 0, 0.9); }
.port #spinBtn .auto-count { font-size: 80px; }
#spinBtn.auto .spin-ico { opacity: 0.25; }

.round-btn {
  position: absolute; display: grid; place-items: center; align-content: center; gap: 2px; padding: 0;
  border-radius: 50%; background: radial-gradient(circle at 50% 30%, #9a6234, #5a3417 60%, #3a200c); border: 3px solid #e0aa66;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
}
.round-btn svg { width: 30px; height: 30px; fill: none; stroke: var(--ivory); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.round-btn svg .fill { fill: var(--ivory); stroke: none; }
.round-btn span { font-size: 11px; font-weight: 900; letter-spacing: 0.12em; color: #ffe2b0; }
.round-btn[aria-pressed="true"] { border-color: var(--gold-hi); box-shadow: 0 0 0 2px var(--wood-dk), 0 0 16px rgba(255, 210, 110, 0.65); }
.round-btn[aria-pressed="true"] span { color: var(--gold-hi); }
.land .round-btn { width: 72px; height: 72px; top: 984px; }
.land #autoBtn { left: 1040px; }
.land #turboBtn { left: 1126px; }
.port .round-btn { width: 128px; height: 128px; top: 1712px; }
.port .round-btn span { font-size: 18px; }
.port .round-btn svg { width: 54px; height: 54px; }
.port #autoBtn { left: 712px; }
.port #turboBtn { left: 866px; }

#fly { position: absolute; inset: 0; pointer-events: none; z-index: 20; }
#fly > * { position: absolute; left: 0; top: 0; }
.fly-text {
  font-family: var(--font-display); font-size: 56px; color: var(--gold-hi); white-space: nowrap;
  text-shadow: 0 3px 0 rgba(30, 16, 2, 0.95), 0 0 18px rgba(255, 200, 90, 0.8);
}
.fly-text.jade { color: #d6ffb0; text-shadow: 0 3px 0 rgba(18, 36, 4, 0.95), 0 0 18px rgba(130, 220, 70, 0.8); }
.x2-stamp {
  font-family: var(--font-display); font-size: 220px; line-height: 1; color: var(--gold-hi);
  text-shadow: 0 8px 0 #3a0610, 0 0 40px rgba(255, 90, 90, 0.85), 0 0 90px rgba(255, 210, 110, 0.7);
}

/* ------------------------------------------------------------------ effects layers
   #amb (behind everything): drifting motes, embers and the light rays behind the board.
   #vignette pulls the eye to the board during anticipation and big moments.
   #fx and #flash sit over the scene; while a celebration overlay is open they rise above it (.top). */
#amb { position: absolute; left: 0; top: 0; pointer-events: none; }
#vignette {
  position: absolute; inset: 0; pointer-events: none; z-index: 29; opacity: 0;
  background: radial-gradient(ellipse 64% 60% at var(--bx, 50%) var(--by, 58%), rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.5) 78%, rgba(0, 0, 0, 0.86) 100%);
}
.port #vignette { background: radial-gradient(ellipse 88% 48% at var(--bx, 50%) var(--by, 60%), rgba(0, 0, 0, 0) 50%, rgba(0, 0, 0, 0.5) 78%, rgba(0, 0, 0, 0.86) 100%); }
#fx { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 30; }
#fx.top { z-index: 45; }
#flash { position: absolute; inset: 0; pointer-events: none; z-index: 31; opacity: 0; background: radial-gradient(circle at var(--fx, 50%) var(--fy, 45%), rgba(255, 246, 214, 0.95), rgba(255, 200, 90, 0.55) 45%, rgba(255, 160, 60, 0) 80%); }
#flash.top { z-index: 46; }
#flash.ruby { background: radial-gradient(circle at var(--fx, 50%) var(--fy, 45%), rgba(255, 236, 232, 0.95), rgba(255, 70, 95, 0.55) 45%, rgba(200, 20, 50, 0) 80%); }
#flash.jade { background: radial-gradient(circle at var(--fx, 50%) var(--fy, 45%), rgba(244, 255, 230, 0.95), rgba(140, 230, 70, 0.5) 45%, rgba(70, 160, 20, 0) 80%); }
#flash.royal { background: radial-gradient(circle at var(--fx, 50%) var(--fy, 45%), rgba(248, 238, 255, 0.95), rgba(190, 110, 255, 0.55) 45%, rgba(120, 40, 200, 0) 80%); }
#flash.sapph { background: radial-gradient(circle at var(--fx, 50%) var(--fy, 45%), rgba(238, 244, 255, 0.95), rgba(110, 160, 255, 0.55) 45%, rgba(40, 80, 200, 0) 80%); }
#flash.white { background: radial-gradient(circle at var(--fx, 50%) var(--fy, 45%), rgba(255, 255, 255, 1), rgba(255, 246, 226, 0.85) 50%, rgba(255, 230, 190, 0.45) 100%); }

/* spin press ripple, the START pulse and the win readout's throb while it counts */
#spinBtn::after {
  content: ""; position: absolute; inset: -4%; border-radius: 50%; pointer-events: none; opacity: 0;
  border: 4px solid rgba(255, 228, 160, 0.95); box-shadow: 0 0 18px rgba(255, 210, 110, 0.8);
}
#spinBtn.press::after { animation: spinRipple 0.5s ease-out; }
@keyframes spinRipple { from { opacity: 1; transform: scale(0.82); } to { opacity: 0; transform: scale(1.5); } }
#introGo { animation: goPulse 1.15s ease-in-out infinite; }
@keyframes goPulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 0 rgba(255, 214, 120, 0)); }
  50% { transform: scale(1.05); filter: drop-shadow(0 0 20px rgba(255, 214, 120, 0.85)); }
}
.r-win.hot output { animation: winThrob 0.28s ease-in-out infinite alternate; }
.land .r-win output { transform-origin: 0 60%; }
.port .r-win output { transform-origin: 100% 60%; }
@keyframes winThrob { to { transform: scale(1.07); } }

/* ------------------------------------------------------------------ overlays */
.overlay {
  position: absolute; inset: 0; z-index: 40; display: grid; place-items: center;
  background: rgba(14, 7, 2, 0.72);
}
.overlay[hidden] { display: none; }
.modal { box-sizing: border-box; padding: 44px 52px 40px; display: grid; gap: 18px; justify-items: center; text-align: center; }
.modal h2 {
  margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 52px; letter-spacing: 0.06em;
  background: var(--text-grad); -webkit-background-clip: text; background-clip: text; color: transparent; text-wrap: balance;
}
.modal h3 { margin: 10px 0 0; font-size: 22px; font-weight: 900; letter-spacing: 0.18em; color: var(--gold); text-transform: uppercase; }
.modal-sub { margin: 0; max-width: 46ch; font-size: 22px; line-height: 1.45; color: var(--muted); }
.port .modal-sub { font-size: 30px; }
.close-btn {
  position: absolute; right: 18px; top: 14px; width: 56px; height: 56px; border-radius: 50%; padding: 0;
  font-size: 40px; line-height: 1; background: rgba(42, 20, 7, 0.6); border: 2px solid #d9a05a; color: var(--gold-hi);
}
.btn-big, .btn-mid { display: grid; place-items: center; padding: 0; }
.btn-big { width: 380px; height: 110px; }
.btn-mid { width: 260px; height: 84px; }
.btn-big .lbl { font-family: var(--font-display); font-size: 56px; letter-spacing: 0.08em; color: var(--ivory); text-shadow: 0 4px 0 #6a2405, 0 0 18px rgba(255, 220, 140, 0.4); }
.btn-mid .lbl { font-family: var(--font-display); font-weight: 400; font-size: 30px; letter-spacing: 0.08em; color: var(--ivory); text-shadow: 0 3px 0 rgba(60, 20, 4, 0.85); }
.btn-big::after, .btn-mid::after { background: radial-gradient(120% 140% at 50% 0%, #ffad3a 0%, #e0601a 48%, #8a2a08 100%); }
.btn-mid.ghost::after { background: var(--panel-fill); }
.btn-big:hover, .btn-mid:hover { filter: brightness(1.12); }
.link-btn { background: none; border: 0; padding: 8px 12px; font-size: 24px; letter-spacing: 0.12em; color: var(--gold); text-decoration: underline; text-underline-offset: 6px; }

/* splash */
.splash { background: radial-gradient(70% 60% at 50% 40%, rgba(30, 16, 5, 0.5), rgba(14, 7, 2, 0.9)); }
.splash-inner { display: grid; justify-items: center; gap: 22px; width: 1500px; max-width: 94%; }
.splash-logo { width: 520px; max-width: none; filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.7)); }
.tagline { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: 0.02em; color: var(--ivory); text-align: center; text-shadow: 0 2px 6px rgba(0, 0, 0, 0.7); }
.cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; width: 100%; }
.card {
  display: grid; justify-items: center; align-content: start; gap: 10px; text-align: center; padding: 26px 26px 24px;
  background: linear-gradient(180deg, rgba(92, 54, 24, 0.94), rgba(36, 19, 7, 0.96)); border: 3px solid #c98b4a; border-radius: 22px;
  box-shadow: 0 0 0 3px var(--wood-dk), inset 0 0 0 3px rgba(42, 20, 7, 0.6), 0 12px 30px rgba(0, 0, 0, 0.5);
}
.card h3 { margin: 6px 0 0; font-family: var(--font-display); font-weight: 400; font-size: 36px; letter-spacing: 0.04em; color: var(--gold-hi); }
.card p { margin: 0; font-size: 22px; font-weight: 700; line-height: 1.4; color: #f1dcb8; max-width: 30ch; }
.card-art { height: 140px; display: flex; align-items: center; justify-content: center; gap: 12px; }
.card-art .xbig { font-family: var(--font-display); font-size: 64px; color: var(--gold-hi); }
.card-art .mini-badge { display: grid; place-items: center; width: 92px; font-size: 15px; font-weight: 700; letter-spacing: 0.08em; }
.card-art .mini-badge img { width: 100%; max-width: none; }
.card-art .mini-badge span { margin-top: -4px; }
.splash-actions { display: flex; align-items: center; gap: 30px; margin-top: 6px; }
.fineprint { margin: 0; font-size: 18px; letter-spacing: 0.08em; color: var(--muted); opacity: 0.85; text-align: center; }
.port .splash-inner { width: 980px; gap: 26px; }
.port .splash-logo { width: 640px; }
.port .tagline { font-size: 38px; max-width: 22ch; text-wrap: balance; }
.port .cards { grid-template-columns: 1fr; gap: 18px; }
.port .splash { background: radial-gradient(70% 60% at 50% 40%, rgba(30, 16, 5, 0.8), rgba(14, 7, 2, 0.95)); }
.port .card { grid-template-columns: 300px 1fr; justify-items: start; text-align: left; align-items: center; column-gap: 24px; row-gap: 6px; padding: 22px 28px; }
.port .card-art { grid-row: span 2; height: auto; min-height: 120px; width: 300px; }
.port #cardArt2 { display: grid; grid-template-columns: repeat(2, 132px); gap: 6px 16px; justify-content: center; }
.port .card-art .mini-badge { width: 132px; font-size: 19px; }
.port .card h3 { font-size: 40px; margin: 0; }
.port .card p { font-size: 28px; max-width: none; }
.port .fineprint { font-size: 24px; }
.port .link-btn { font-size: 32px; }

/* buy */
.buy-modal { width: 1500px; max-width: 96%; }
.buy-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 22px; width: 100%; }
.buy-card {
  display: grid; justify-items: center; align-content: start; gap: 8px; padding: 20px 16px 22px; border-radius: 10px;
  background: rgba(42, 20, 7, 0.55); border: 2px solid rgba(217, 160, 90, 0.55);
}
.buy-card .bc-badge { position: relative; width: 100%; height: 136px; display: grid; place-items: center; }
.buy-card .bc-badge img { width: 100%; height: 100%; max-width: none; object-fit: contain; }
.port .buy-card .bc-badge { height: 200px; }
.buy-card .bc-badge span { position: absolute; top: 48%; left: 50%; transform: translate(-50%, -50%); font-family: var(--font-display); font-size: 42px; color: var(--ivory); text-shadow: 0 3px 0 rgba(42, 20, 7, 0.9); }
.buy-card dl { margin: 6px 0 4px; display: grid; grid-template-columns: auto auto; gap: 6px 14px; font-size: 20px; text-align: left; }
.buy-card dt { color: var(--muted); letter-spacing: 0.08em; }
.buy-card dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.buy-card .bc-price { font-family: var(--font-display); font-size: 44px; color: var(--gold-hi); font-variant-numeric: tabular-nums; }
.buy-card .bc-x { font-size: 18px; letter-spacing: 0.12em; color: var(--muted); }
.buy-card .btn-mid { width: 200px; height: 72px; margin-top: 6px; }
.buy-card.no .btn-mid { filter: grayscale(0.8) brightness(0.6); }
.port .buy-modal { width: 1000px; padding: 44px 32px; }
.port .buy-grid { grid-template-columns: 1fr 1fr; }
.port .buy-card dl { font-size: 26px; }

.confirm-modal { width: 820px; max-width: 94%; }
.confirm-modal p { margin: 0; font-size: 28px; line-height: 1.45; color: var(--ivory); max-width: 34ch; }
.confirm-modal p b { color: var(--gold-hi); }
.confirm-actions { display: flex; gap: 24px; margin-top: 10px; }
.port .confirm-modal p { font-size: 36px; }

.menu-modal { width: 980px; max-width: 94%; justify-items: stretch; text-align: left; }
.menu-modal h2, .menu-modal h3 { text-align: center; }
.menu-modal .modal-sub { justify-self: center; text-align: center; }
.menu-list { display: grid; gap: 14px; }
.switch { display: flex; align-items: center; gap: 18px; font-size: 26px; letter-spacing: 0.04em; cursor: pointer; }
.switch input { width: 30px; height: 30px; accent-color: var(--gold); }
.test-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.test-btn {
  padding: 14px 10px 10px; border-radius: 12px; font-size: 20px; font-weight: 800; letter-spacing: 0.02em; line-height: 1.25;
  background: rgba(42, 20, 7, 0.55); border: 2px solid rgba(217, 160, 90, 0.55); color: var(--ivory);
}
.test-btn small { display: block; font-size: 15px; color: var(--muted); letter-spacing: 0.06em; }
.test-btn:hover { background: rgba(226, 187, 93, 0.16); }
.menu-foot { display: flex; justify-content: center; }
.port .switch { font-size: 34px; }
.port .test-grid { grid-template-columns: 1fr 1fr; }
.port .test-btn { font-size: 28px; }
.port .test-btn small { font-size: 20px; }

.auto-modal { width: 760px; }
.auto-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 14px; width: 100%; }
.auto-grid button { height: 86px; border-radius: 14px; font-family: var(--font-display); font-size: 38px; background: rgba(42, 20, 7, 0.55); border: 2px solid rgba(217, 160, 90, 0.6); color: var(--gold-hi); }
.auto-grid button:hover { background: rgba(226, 187, 93, 0.18); }
.port .auto-modal { width: 960px; }

/* bonus intro / end */
.bonus-intro { background: radial-gradient(60% 55% at 50% 45%, rgba(90, 36, 10, 0.55), rgba(16, 6, 2, 0.9)); }
.intro-inner { position: relative; display: grid; justify-items: center; gap: 20px; }
.intro-inner .bw-rays { top: 50%; opacity: 0.45; }
.intro-badge { position: relative; width: 640px; display: grid; place-items: center; }
.intro-badge img { width: 100%; max-width: none; filter: drop-shadow(0 18px 30px rgba(0, 0, 0, 0.8)); }
.intro-badge span { position: absolute; top: 48%; left: 50%; transform: translate(-50%, -50%); font-family: var(--font-display); font-size: 110px; letter-spacing: 0.06em; color: var(--ivory); text-shadow: 0 5px 0 rgba(0, 0, 0, 0.8), 0 0 30px rgba(255, 230, 170, 0.6); }
.intro-meta { margin: 0; font-size: 30px; letter-spacing: 0.12em; color: var(--ivory); text-transform: uppercase; text-align: center; }
.intro-dice { display: flex; gap: 22px; min-height: 130px; align-items: center; }
.intro-sum { display: grid; justify-items: center; }
.intro-sum .lbl { font-size: 22px; font-weight: 700; letter-spacing: 0.24em; color: var(--muted); }
.intro-sum .val { font-family: var(--font-display); font-size: 150px; line-height: 1.05; }
.port .intro-badge { width: 860px; }
.port .intro-badge span { font-size: 140px; }
.port .intro-meta { font-size: 34px; max-width: 24ch; text-wrap: balance; }

.bonus-end { background: rgba(14, 7, 2, 0.78); }
.end-inner { width: 900px; max-width: 94%; box-sizing: border-box; padding: 50px 40px 46px; display: grid; justify-items: center; gap: 14px; text-align: center; }
.end-tier { font-size: 24px; font-weight: 700; letter-spacing: 0.3em; color: var(--muted); }
.end-inner h2 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 64px; letter-spacing: 0.04em; text-wrap: balance; }
.end-amount { font-family: var(--font-display); font-size: 120px; color: var(--ivory); font-variant-numeric: tabular-nums; text-shadow: 0 0 30px rgba(255, 210, 110, 0.5); }
.end-meta { margin: 0; font-size: 24px; letter-spacing: 0.08em; color: var(--muted); }

/* big win */
.big-win { background: radial-gradient(60% 60% at 50% 45%, rgba(40, 24, 2, 0.55), rgba(2, 4, 3, 0.9)); cursor: pointer; }
.bw-inner { position: relative; display: grid; justify-items: center; gap: 10px; }
.bw-rays {
  position: absolute; left: 50%; top: 42%; width: 1500px; height: 1500px; margin: -750px 0 0 -750px; z-index: -1; opacity: 0.55;
  background: repeating-conic-gradient(from 0deg, rgba(255, 214, 120, 0.32) 0deg 6deg, rgba(255, 214, 120, 0) 6deg 15deg);
  -webkit-mask: radial-gradient(circle, #000 0%, rgba(0, 0, 0, 0) 62%); mask: radial-gradient(circle, #000 0%, rgba(0, 0, 0, 0) 62%);
  animation: rays 18s linear infinite;
}
@keyframes rays { to { transform: rotate(360deg); } }
.bw-title { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 170px; letter-spacing: 0.04em; line-height: 1; text-align: center; }
.bw-amount { font-family: var(--font-display); font-size: 130px; color: var(--ivory); font-variant-numeric: tabular-nums; text-shadow: 0 6px 0 rgba(0, 0, 0, 0.6), 0 0 40px rgba(255, 210, 110, 0.6); }
.bw-x { font-size: 34px; font-weight: 700; letter-spacing: 0.2em; color: var(--gold); }
.bw-hint { margin: 16px 0 0; font-size: 22px; letter-spacing: 0.2em; color: var(--muted); text-transform: uppercase; }
.port .bw-title { font-size: 150px; }
.port .bw-amount { font-size: 110px; }

.toast {
  position: absolute; left: 50%; top: 40px; z-index: 60; transform: translate(-50%, -160%);
  padding: 16px 30px 12px; border-radius: 10px; font-size: 26px; letter-spacing: 0.04em; white-space: nowrap;
  background: rgba(46, 25, 10, 0.97); border: 2px solid #d9a05a; color: var(--ivory); font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6); opacity: 0; visibility: hidden;
  transition: transform 0.35s ease, opacity 0.35s ease, visibility 0s linear 0.35s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; visibility: visible; transition: transform 0.35s ease, opacity 0.35s ease, visibility 0s; }
.port .toast { font-size: 34px; top: 140px; }

/* ------------------------------------------------------------------ rules (native size, scrolls) */
.rules {
  position: fixed; inset: 0; z-index: 100; overflow-y: auto; overscroll-behavior: contain;
  background: rgba(20, 11, 4, 0.97); -webkit-user-select: text; user-select: text;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
}
.rules[hidden] { display: none; }
.rules-inner { max-width: 880px; margin: 0 auto; padding-block: 18px 60px; font-size: 16px; line-height: 1.55; color: var(--ivory); }
.rules-head {
  position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding-block: 12px; background: rgba(20, 11, 4, 0.99); border-bottom: 1px solid rgba(217, 160, 90, 0.45);
}
.rules-head h1 { margin: 0; font-family: var(--font-display); font-weight: 400; font-size: 28px; letter-spacing: 0.04em; color: var(--gold-hi); }
.rules .close-btn { position: static; width: 44px; height: 44px; font-size: 30px; flex: none; }
.rules h2 { margin: 30px 0 8px; font-family: var(--font-display); font-weight: 400; font-size: 22px; letter-spacing: 0.06em; color: var(--gold); text-wrap: balance; }
.rules p, .rules li { max-width: 68ch; color: var(--ivory); }
.rules ol, .rules ul { padding-left: 1.3em; }
.rules .muted { color: var(--muted); }
.rules .tbl { overflow-x: auto; }
.rules table { border-collapse: collapse; width: 100%; font-variant-numeric: tabular-nums; font-size: 15px; }
.rules th, .rules td { padding: 7px 10px; border-bottom: 1px solid rgba(226, 187, 93, 0.2); text-align: left; white-space: nowrap; }
.rules th { color: var(--muted); font-weight: 600; letter-spacing: 0.06em; font-size: 13px; text-transform: uppercase; }
.pay-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 10px; }
.pay-card { display: grid; grid-template-columns: 64px 1fr; gap: 10px; align-items: center; padding: 10px; border-radius: 8px; background: rgba(255, 255, 255, 0.04); border: 1px solid rgba(226, 187, 93, 0.18); }
.pay-card img { width: 64px; height: 64px; max-width: none; }
.pay-card ul { list-style: none; margin: 0; padding: 0; font-size: 14px; font-variant-numeric: tabular-nums; }
.pay-card li b { display: inline-block; min-width: 2.2em; color: var(--gold); }
.rules .chip { display: inline-block; padding: 1px 8px; border-radius: 4px; font-size: 13px; font-weight: 700; letter-spacing: 0.08em; background: rgba(226, 187, 93, 0.16); color: var(--gold-hi); }

/* ------------------------------------------------------------------ portrait readability
   At 320 px wide the portrait stage is drawn at ~0.27 scale, so its type runs larger. On tall
   phones the stage grows by --extra: the HUD rides down with the bottom edge, the icons stay up. */
.port #hud { transform: translateY(var(--extra, 0px)); }
.port .hud-icons { top: calc(36px - var(--extra, 0px)); }
.port .readout .lbl { font-size: 28px; }
.port .readout output { font-size: 54px; }
.port .r-cost output { font-size: 40px; }
.port .bet-ctl output { min-width: 190px; }
.port .toggle .lbl { font-size: 32px; letter-spacing: 0.1em; padding-right: 0; }
.port .toggle .state { font-size: 20px; padding: 4px 12px 2px; }
.port .btn-buy .lbl { font-size: 46px; }
.port .btn-buy .sub { font-size: 24px; }
.port .panel .lbl { font-size: 26px; }
.port #fsPanel .val { font-size: 72px; }
.port #multPanel .val { font-size: 80px; }
.port .rail-total .lbl { font-size: 22px; }
.port .rail-total .val { font-size: 56px; }
.port .win-caption { font-size: 30px; }
.port .win-caption b { font-size: 34px; }
.port .fly-text { font-size: 72px; }
.port .pinned::after { font-size: 22px; }

#spinBtn .spin-ico .sh { stroke: #5a1a04; stroke-width: 10; }
#spinBtn .spin-ico .fg { stroke: var(--ivory); stroke-width: 5; }

@media (prefers-reduced-motion: reduce) {
  .bw-rays, #spinBtn.spinning .spin-ico, .reel-glow.on, .socket.lit, .cell.win > img, .cell.win > .die,
  #introGo, .r-win.hot output, #spinBtn.press::after { animation: none; }
}
