/* Thunder Hunter Sebastian — page chrome: fonts, loader, splash and DOM panels.
 * The game itself is drawn on the canvas (js/). */

@font-face { font-family: "Cinzel"; font-weight: 700; font-display: swap; src: url(../assets/fonts/cinzel-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Cinzel"; font-weight: 900; font-display: swap; src: url(../assets/fonts/cinzel-latin-900-normal.woff2) format("woff2"); }
@font-face { font-family: "Outfit"; font-weight: 500; font-display: swap; src: url(../assets/fonts/outfit-latin-500-normal.woff2) format("woff2"); }
@font-face { font-family: "Outfit"; font-weight: 700; font-display: swap; src: url(../assets/fonts/outfit-latin-700-normal.woff2) format("woff2"); }
@font-face { font-family: "Outfit"; font-weight: 800; font-display: swap; src: url(../assets/fonts/outfit-latin-800-normal.woff2) format("woff2"); }

:root {
  /* v10 chrome tokens: machined ink steel, warm-white text, emerald for ON (not Stake green) */
  --ink-0: #0A0C16; --ink-1: #12152A; --ink-2: #1B1F3A; --ink-3: #272C4D;
  --text-1: #F4F1EA; --text-2: #B9B6D3; --emerald: #2FD27A;
  --r-s: 4px; --r-m: 8px; --r-l: 12px;
  --ink: #0b0520;
  --panel: #1a0b36;
  --panel-2: #0f0622;
  --gold: #f2c45a;
  --gold-hi: #ffe9a0;
  --gold-lo: #9a6614;
  --text: #efe6ff;
  --muted: #a996d6;
  --good: #3ddc84;
  --bad: #ff5a6a;
  --display: "Cinzel", Georgia, "Times New Roman", serif;
  --ui: "Outfit", "Segoe UI", Roboto, Arial, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { height: 100%; background: var(--ink-0); overflow: hidden; }
body { font-family: var(--ui); color: var(--text); -webkit-tap-highlight-color: transparent; }
/* the canvas keeps clear of notches and the home indicator; the page's ink shows in the insets */
/* (a canvas is a replaced element: left + right alone would not stretch it, so its size is explicit) */
#game { display: block; position: fixed; left: env(safe-area-inset-left, 0px); top: env(safe-area-inset-top, 0px);
  width: calc(100vw - env(safe-area-inset-left, 0px) - env(safe-area-inset-right, 0px));
  height: calc(100vh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  height: calc(100dvh - env(safe-area-inset-top, 0px) - env(safe-area-inset-bottom, 0px));
  touch-action: manipulation; outline: none; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* ---------- brand lockup ---------- */
.presents { display: block; font-family: var(--display); font-weight: 700; letter-spacing: .25em; text-transform: uppercase;
  color: #e9d7ff; font-size: clamp(11px, 1.6vw, 15px); text-shadow: 0 2px 6px #000; }
.title-sm, .title { display: block; font-family: var(--display); font-weight: 900; line-height: 1;
  background: linear-gradient(#fffbe0, #ffe27a 30%, #f4b62a 60%, #c47d0e 80%, #ffd75e);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 14px rgba(255, 150, 40, .55)) drop-shadow(0 3px 0 #3a1d03); }
.title-sm { font-size: clamp(20px, 4vw, 40px); letter-spacing: .12em; }
.title { font-size: clamp(36px, 8.5vw, 92px); letter-spacing: .04em; }

/* the hidden attribute always wins (buttons here set their own display) */
[hidden] { display: none !important; }

/* ---------- "Only on Stake" preroll (above everything while it plays) ---------- */
/* the clip covers the screen when the text stays in view; otherwise (narrow
   screens) a blurred live copy of it fills around it. preroll.js sizes it. */
#preroll { position: fixed; inset: 0; z-index: 60; background: #000; overflow: hidden; transition: opacity .4s ease; }
#preroll.done { opacity: 0; pointer-events: none; }
#prerollVideo { position: absolute; left: 50%; top: 50%; width: 100%; height: 100%; transform: translate(-50%, -50%);
  object-fit: cover; display: block; }
#prerollBack { position: absolute; left: -8%; top: -8%; width: 116%; height: 116%; display: none; object-fit: cover;
  filter: blur(24px); }
#preroll.framed #prerollBack { display: block; }
/* soften the seam between the clip and the blurred fill */
#preroll.framed-v #prerollVideo { -webkit-mask-image: linear-gradient(to bottom, transparent, #000 16%, #000 84%, transparent);
  mask-image: linear-gradient(to bottom, transparent, #000 16%, #000 84%, transparent); }
#preroll.framed-h #prerollVideo { -webkit-mask-image: linear-gradient(to right, transparent, #000 16%, #000 84%, transparent);
  mask-image: linear-gradient(to right, transparent, #000 16%, #000 84%, transparent); }
/* sound needs a tap first: the logo frame waits behind this prompt */
#preroll.ask { cursor: pointer; }
#prerollTap { position: absolute; left: 50%; bottom: max(12%, calc(env(safe-area-inset-bottom) + 24px)); transform: translateX(-50%);
  padding: 14px 30px; border: 2px solid rgba(255, 255, 255, .85); border-radius: 999px; background: rgba(4, 20, 48, .45);
  color: #fff; font: 800 clamp(14px, 2.4vw, 20px) / 1 var(--ui, sans-serif); letter-spacing: .2em; cursor: pointer;
  -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: prerollPulse 1.6s ease-in-out infinite; }
#prerollTap[hidden] { display: none; }
#prerollTap:focus-visible { outline: 3px solid #ffd75e; outline-offset: 4px; }
@keyframes prerollPulse { 50% { transform: translateX(-50%) scale(1.06); box-shadow: 0 0 28px rgba(255, 255, 255, .45); } }
@media (prefers-reduced-motion: reduce) { #prerollTap { animation: none; } }

/* ---------- loader ---------- */
#loader { position: fixed; inset: 0; z-index: 30; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 26px;
  background: radial-gradient(ellipse at 50% 38%, #3a1a6e, var(--ink) 72%); transition: opacity .6s ease; text-align: center; }
#loader.gone { opacity: 0; pointer-events: none; }
.meter { width: min(72vw, 360px); height: 8px; border-radius: 8px; background: #1b0f33; overflow: hidden; box-shadow: inset 0 0 0 1px rgba(242, 196, 90, .35); }
#loadBar { display: block; height: 100%; width: 3%; border-radius: 8px; transition: width .25s ease;
  background: linear-gradient(90deg, #c47d0e, #ffd75e, #fff2b8); box-shadow: 0 0 14px rgba(255, 190, 80, .7); }
#loadPct { color: var(--muted); font-size: 13px; letter-spacing: .2em; }

/* ---------- splash (the live game animates behind it) ---------- */
#splash { position: fixed; inset: 0; z-index: 20; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(ellipse at 50% 40%, rgba(40, 14, 84, .55), rgba(6, 2, 16, .88) 75%);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
  opacity: 0; pointer-events: none; transition: opacity .6s ease; }
#splash.show { opacity: 1; pointer-events: auto; }
#splash.leaving { opacity: 0; pointer-events: none; transform: scale(1.04); transition: opacity .6s ease, transform .6s ease; }
.splash-inner { display: flex; align-items: center; gap: clamp(8px, 3vw, 40px); max-width: 1100px; width: 100%; }
.splash-seb { height: min(72vh, 560px); width: auto; flex: none; filter: drop-shadow(0 0 22px rgba(127, 212, 255, .55)); animation: float 4s ease-in-out infinite; }
.splash-copy { flex: 1; text-align: center; }
.splash-copy h1 { margin: 6px 0 22px; }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 26px; }
.feature { background: linear-gradient(180deg, rgba(48, 20, 90, .85), rgba(16, 6, 34, .9)); border: 1px solid rgba(242, 196, 90, .55);
  border-radius: 14px; padding: 14px 12px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .35); animation: rise .7s both; }
.feature:nth-child(2) { animation-delay: .1s; } .feature:nth-child(3) { animation-delay: .2s; }
.feature svg, .feature img { width: 52px; height: 52px; }
.feature b { font-family: var(--display); color: var(--gold-hi); font-size: 15px; letter-spacing: .04em; }
.feature span { font-size: 13px; line-height: 1.4; color: #d8cbf5; }
.play-btn { cursor: pointer; font-family: var(--display); font-weight: 900; font-size: clamp(20px, 2.6vw, 28px); letter-spacing: .2em;
  color: #2a0f00; padding: 16px 64px; border-radius: 999px; border: 2px solid #fff2b8;
  background: linear-gradient(#fff2b8, #ffd25a 45%, #e09a1e); box-shadow: 0 0 34px rgba(255, 180, 60, .65), 0 6px 0 #8a5208;
  animation: breathe 1.6s ease-in-out infinite; transition: transform .12s, filter .2s; }
.play-btn:hover { filter: brightness(1.08); }
.play-btn:active { transform: translateY(4px); box-shadow: 0 0 24px rgba(255, 180, 60, .5), 0 2px 0 #8a5208; }
.play-btn:focus-visible { outline: 3px solid #fff; outline-offset: 4px; }
.fine { margin-top: 16px; font-size: 12px; color: var(--muted); letter-spacing: .05em; }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-10px); } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.05); } }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }

@media (max-aspect-ratio: 1/1), (max-width: 760px) {
  .splash-inner { flex-direction: column; gap: 0; }
  .splash-seb { height: min(26vh, 220px); }
  .features { grid-template-columns: 1fr; gap: 8px; margin-bottom: 18px; }
  .feature { flex-direction: row; text-align: left; padding: 10px 12px; }
  .feature svg, .feature img { width: 40px; height: 40px; flex: none; }
  .feature b { min-width: 7.5em; font-size: 13px; }
  .feature span { font-size: 12px; }
  .splash-copy h1 { margin: 4px 0 14px; }
}

/* ---------- panels ---------- */
.modal { position: fixed; inset: 0; z-index: 40; display: flex; align-items: center; justify-content: center; padding: 12px;
  background: rgba(4, 1, 12, .7); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade .2s ease; }
.modal[hidden] { display: none; }
.card { width: min(680px, 100%); max-height: min(88vh, 900px); overflow: auto; padding: 22px 22px 18px; border-radius: 18px;
  background: linear-gradient(180deg, var(--panel), var(--panel-2)); border: 1px solid rgba(242, 196, 90, .7);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .5), 0 0 50px rgba(160, 90, 255, .25), 0 30px 60px rgba(0, 0, 0, .5); animation: pop .25s cubic-bezier(.2, .9, .3, 1.2); }
.card.narrow { width: min(440px, 100%); }
.card:focus { outline: none; }
.card.center { text-align: center; }
.card h2 { font-family: var(--display); font-weight: 900; color: var(--gold); text-align: center; font-size: 24px; letter-spacing: .06em; margin-bottom: 14px; }
.card h3 { font-family: var(--display); color: var(--gold-hi); font-size: 15px; letter-spacing: .06em; margin: 18px 0 8px; }
.card p { font-size: 14px; line-height: 1.55; color: #ddd2f7; margin: 8px 0; }
.card b { color: #fff; }
.card code { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; background: #0b0418; border: 1px solid #3c2a68; border-radius: 4px; padding: 1px 5px; color: var(--gold-hi); }
.card code.seed { display: inline-block; margin-top: 4px; word-break: break-all; }
.faint { color: var(--muted); font-size: 12px; font-weight: 500; }
.note { font-size: 12.5px !important; color: var(--muted) !important; }
.with-icon { display: flex; gap: 12px; align-items: flex-start; }
.with-icon canvas { width: 46px; height: 46px; flex: none; }
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 6px 18px; font-size: 13.5px; }
.facts div { display: flex; justify-content: space-between; border-bottom: 1px dashed rgba(169, 150, 214, .25); padding: 4px 0; }
.facts span { color: var(--muted); } .facts b { color: var(--gold-hi); }
.orb-list { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0 4px; }
.orb { font-family: var(--display); font-weight: 900; font-size: 12px; color: #fff; min-width: 40px; text-align: center; padding: 6px 6px; border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, .7); text-shadow: 0 1px 2px #000; }
.orb.t0 { background: radial-gradient(circle at 35% 30%, #eaffd0, #5ee36a 45%, #178a2c); }
.orb.t1 { background: radial-gradient(circle at 35% 30%, #dff4ff, #4fb6ff 45%, #1046b8); }
.orb.t2 { background: radial-gradient(circle at 35% 30%, #f6e2ff, #c46bff 45%, #5a14a8); }
.orb.t3 { background: radial-gradient(circle at 35% 30%, #fff4c4, #ff7a2e 45%, #a3110a); }
.paytable { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pt-cell { display: flex; align-items: center; gap: 8px; background: rgba(255, 255, 255, .04); border: 1px solid #3c2a68; border-radius: 12px; padding: 8px; }
.pt-cell canvas { width: 52px; height: 52px; flex: none; }
.pays { display: grid; grid-template-columns: auto auto; gap: 1px 8px; font-size: 12px; }
.pays span { color: var(--muted); } .pays b { color: var(--gold-hi); text-align: right; }
@media (max-width: 560px) { .paytable { grid-template-columns: repeat(2, 1fr); } .card { padding: 18px 14px 14px; } }

.row { display: flex; align-items: center; justify-content: space-between; gap: 14px; margin: 12px 0; font-size: 15px; }
.row.sub { margin-top: -4px; padding-left: 14px; font-size: 13px; color: var(--muted, #b9b6d3); }
.row small { color: var(--muted); font-size: 12px; }
.row.inline { justify-content: stretch; }
.row.inline input[type=text] { flex: 1; }
input[type=range] { accent-color: var(--gold); width: 55%; }
input[type=text] { font: inherit; font-size: 14px; color: #fff; background: #0b0418; border: 1px solid #4a3a78; border-radius: 8px; padding: 8px 10px; min-width: 0; }
input[type=text]:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.switch { appearance: none; -webkit-appearance: none; width: 46px; height: 26px; border-radius: 26px; background: #2e1d50; border: 1px solid var(--gold-lo);
  position: relative; cursor: pointer; transition: background .2s; flex: none; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%;
  background: linear-gradient(#fff7d6, #d19a2a); transition: transform .2s; }
.switch:checked { background: #1f8a4c; }
.switch:checked::after { transform: translateX(20px); }
.switch:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

button { font: inherit; cursor: pointer; }
button.primary, button.ghost, button.small, .menu-item { border-radius: 10px; padding: 11px 16px; font-weight: 800; letter-spacing: .04em; transition: filter .15s, transform .1s; }
button.primary { display: block; width: 100%; margin-top: 16px; color: #2a0f00; border: 1px solid #fff2b8; background: linear-gradient(#fff2b8, #ffd25a 45%, #e09a1e); }
button.ghost { display: block; width: 100%; margin-top: 10px; color: var(--gold-hi); background: transparent; border: 1px solid var(--gold-lo); }
button.small { color: #2a0f00; border: none; background: var(--gold); padding: 8px 14px; }
button:hover { filter: brightness(1.1); } button:active { transform: translateY(1px); }
button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
.btn-row { display: flex; gap: 10px; margin-top: 8px; } .btn-row > * { flex: 1; margin-top: 8px !important; }
.big-price { font-family: var(--display); font-weight: 900; font-size: 40px; color: var(--gold-hi); margin: 6px 0 4px; text-shadow: 0 0 18px rgba(255, 170, 60, .6); }
.menu-item { display: block; width: 100%; margin: 8px 0; text-align: left; color: var(--text); background: rgba(255, 255, 255, .05); border: 1px solid #4a3a78; }

.fair-box { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; line-height: 1.7; color: #bfe6ff; word-break: break-all;
  background: #0b0418; border: 1px solid #3c2a68; border-radius: 10px; padding: 10px 12px; margin: 10px 0; }
.fair-box b { color: var(--gold-hi); font-family: var(--ui); }
.table-wrap { max-height: 260px; overflow: auto; border: 1px solid #3c2a68; border-radius: 10px; }
table.history { width: 100%; border-collapse: collapse; font-size: 13px; }
.history th { position: sticky; top: 0; background: #1d0e3c; color: var(--muted); font-weight: 700; text-align: left; padding: 7px 10px; }
.history td { padding: 6px 10px; border-top: 1px solid rgba(60, 42, 104, .6); }
.history td.win { color: var(--gold-hi); font-weight: 700; }
.verify { font-size: 12px; padding: 4px 10px; border-radius: 6px; border: 1px solid var(--gold-lo); background: transparent; color: var(--gold-hi); }
.verify.ok { border-color: var(--good); color: var(--good); } .verify.bad { border-color: var(--bad); color: var(--bad); }

/* short landscape screens (phones on their side) */
@media (max-height: 560px) and (min-aspect-ratio: 1/1) {
  #splash { align-items: flex-start; overflow: auto; padding: 10px 16px; }
  .splash-inner { margin: auto; }
  .splash-seb { height: 82vh; }
  .title-sm { font-size: clamp(16px, 5.5vh, 26px); }
  .title { font-size: clamp(28px, 12vh, 56px); }
  .splash-copy h1 { margin: 2px 0 10px; }
  .features { gap: 8px; margin-bottom: 12px; }
  .feature { padding: 8px; gap: 3px; }
  .feature svg, .feature img { width: 30px; height: 30px; }
  .feature b { font-size: 12px; }
  .feature span { display: none; }
  .play-btn { padding: 10px 44px; font-size: 18px; }
  .fine { margin-top: 8px; }
}

/* very short screens (Stake checks 400x225): the splash fits without scrolling */
@media (max-height: 420px) and (min-aspect-ratio: 1/1) {
  #splash { overflow: hidden; align-items: center; padding: 6px 12px; }
  .splash-inner { flex-direction: row; gap: 12px; }
  .features { display: none; }
  .splash-seb { height: 76vh; }
  .presents { font-size: 10px; }
  .title-sm { font-size: clamp(12px, 6.5vh, 22px); }
  .title { font-size: clamp(22px, 14vh, 48px); }
  .splash-copy h1 { margin: 2px 0 8px; }
  .play-btn { padding: 8px 34px; font-size: 16px; }
  .fine { font-size: 10px; margin-top: 6px; }
  .card { padding: 12px 12px 10px; max-height: 94vh; }
  .card h2 { font-size: 17px; margin-bottom: 6px; }
  .card p { font-size: 13px; margin: 4px 0; }
  .facts { font-size: 12px; } .facts div { padding: 2px 0; }
  .replay-facts { margin: 2px 0 6px; }
  button.primary, button.ghost { margin-top: 8px; padding: 8px 12px; }
  .btn-row button.primary, .btn-row button.ghost { margin-top: 6px; }
}

/* rules: modes with their RTP, the controls guide; the replay card */
.facts.modes { grid-template-columns: 1fr; margin-bottom: 8px; }
.facts.modes div { gap: 12px; align-items: baseline; }
.facts.modes span { color: #ddd2f7; } .facts.modes span b { color: #fff; }
.facts.modes > div > b { white-space: nowrap; }
dl.controls { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 13.5px; margin: 6px 0; }
dl.controls dt { color: var(--gold-hi); font-weight: 700; white-space: nowrap; }
dl.controls dd { color: #ddd2f7; margin: 0; line-height: 1.45; }
@media (max-width: 480px) { dl.controls { grid-template-columns: 1fr; gap: 2px; } dl.controls dd { margin-bottom: 6px; } }
.replay-facts { grid-template-columns: 1fr; margin: 4px 0 16px; text-align: left; }

select { font: inherit; font-size: 14px; color: #fff; background: #0b0418; border: 1px solid #4a3a78; border-radius: 8px; padding: 6px 8px; }
select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.stats-wrap { max-height: none; }
table.stats td:not(:first-child), table.stats th:not(:first-child) { text-align: right; font-variant-numeric: tabular-nums; }
table.stats td:first-child { color: var(--muted); }
.ach-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.ach { display: flex; gap: 10px; align-items: flex-start; padding: 8px 10px; border-radius: 10px; border: 1px solid #3c2a68; background: rgba(255, 255, 255, .03); opacity: .55; }
.ach.on { opacity: 1; border-color: var(--gold-lo); background: linear-gradient(180deg, rgba(242, 196, 90, .12), rgba(242, 196, 90, .03)); }
.ach .medal { font-size: 20px; line-height: 1; color: var(--gold); }
.ach b { display: block; font-size: 13.5px; } .ach small { display: block; font-size: 12px; color: var(--muted); line-height: 1.35; margin-top: 2px; }

/* lowest quality level: no backdrop blur (it is expensive without a GPU) */
.lite #splash, .lite .modal { -webkit-backdrop-filter: none; backdrop-filter: none; }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) {
  .splash-seb, .play-btn, .feature { animation: none; }
  .card, .modal { animation: none; }
}

/* ---------- v10 "Forged Storm": DOM cards in the same machined ink steel as the canvas chrome ---------- */
:root { --grain: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .045 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>"); }
.modal { background: rgba(5, 6, 12, .66); }
.card { position: relative; border-radius: var(--r-l); color: var(--text-1); border: 1px solid var(--ink-3);
  background: var(--grain), linear-gradient(180deg, var(--ink-2), var(--ink-1));
  box-shadow: inset 0 1px 0 rgba(120, 132, 210, .35), inset 0 0 0 3px var(--ink-1), inset 0 0 0 4px rgba(242, 201, 90, .42), 0 24px 60px rgba(0, 0, 0, .55);
  animation: pop .22s cubic-bezier(.2, .9, .3, 1.05); }
.card h2 { color: var(--text-1); font-size: 22px; padding: 0 40px; }
.card h3 { color: var(--text-2); text-transform: uppercase; letter-spacing: .1em; font-size: 13px; }
.card p { color: #d6d3e6; } .card b { color: var(--text-1); }
.faint, .note { color: var(--text-2) !important; }
.x-close { position: absolute; top: 6px; right: 6px; width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: transparent; color: var(--text-2); z-index: 3; }
.x-close svg { width: 18px; height: 18px; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; fill: none; }
.x-close:hover { color: var(--text-1); background: rgba(255, 255, 255, .06); }
button.primary { color: var(--text-1); border: 1px solid #4a5390; background: linear-gradient(#343c72, #232850);
  box-shadow: inset 0 1px 0 rgba(160, 170, 240, .45), inset 0 0 0 2px #262b55, inset 0 0 0 3px rgba(242, 201, 90, .55); min-height: 44px; }
button.ghost { color: var(--text-2); border: 1px solid var(--ink-3); min-height: 44px; }
button.small { color: var(--text-1); background: var(--ink-3); }
#buyConfirm { color: #fff3e8; border: 1px solid #f2c95a; background: radial-gradient(circle at 30% 20%, #9a2234, #7A1322 45%, #3A0710);
  box-shadow: inset 0 1px 0 rgba(255, 220, 210, .35); }
.menu-item { color: var(--text-1); background: var(--ink-1); border: 1px solid var(--ink-3); min-height: 44px; }
.big-price { color: var(--gold-hi); }
.switch { background: var(--ink-0); border: 1px solid var(--ink-3); box-shadow: inset 0 2px 3px rgba(0, 0, 0, .6); }
.switch::after { background: radial-gradient(circle at 35% 30%, #f2f4fb, #a9afc6 55%, #4c5270); }
.switch:checked { background: var(--emerald); border-color: #1f9a58; }
input[type=range] { accent-color: var(--emerald); }
select, input[type=text], .fair-box, .card code { background: var(--ink-0); border-color: var(--ink-3); }
.table-wrap { border-color: var(--ink-3); } .history th { background: var(--ink-2); color: var(--text-2); } .history td { border-top-color: rgba(39, 44, 77, .8); }
.pt-cell { background: rgba(255, 255, 255, .03); border-color: var(--ink-3); }
.facts b { color: var(--text-1); } .facts div { border-bottom-color: rgba(185, 182, 211, .18); }
dl.controls dt { color: var(--text-1); }
.lead { font-weight: 700; color: var(--text-2) !important; margin-bottom: 6px !important; }
/* rules in tabs */
.tabs { display: flex; gap: 4px; padding: 4px; margin: 0 0 12px; border-radius: 10px; background: var(--ink-0); position: sticky; top: -22px; z-index: 2;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, .5); }
.tab { flex: 1; min-height: 40px; padding: 8px 6px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2); font-weight: 800; font-size: 13px; letter-spacing: .03em; }
.tab[aria-selected="true"] { background: var(--ink-3); color: var(--text-1); box-shadow: inset 0 1px 0 rgba(120, 132, 210, .45), inset 0 -2px 0 rgba(242, 201, 90, .6); }
/* autoplay: rounds as one segmented control */
select { min-height: 44px; }
.seg { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin: 4px 0 14px; }
.seg button, .bet-grid button { min-height: 44px; border-radius: var(--r-m); border: 1px solid var(--ink-3); background: var(--ink-1); color: var(--text-1);
  font-weight: 800; font-variant-numeric: tabular-nums; box-shadow: inset 0 1px 0 rgba(120, 132, 210, .25); }
.seg button[aria-pressed="true"], .bet-grid button[aria-pressed="true"] { background: var(--ink-3); color: var(--gold-hi); box-shadow: inset 0 0 0 1px rgba(242, 201, 90, .7), inset 0 1px 0 rgba(160, 170, 240, .45); }
.bet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; margin: 6px 0 4px; }
/* phones held upright: cards rise from the bottom as sheets */
@keyframes sheet { from { transform: translateY(48px); opacity: 0; } to { transform: none; opacity: 1; } }
@media (max-width: 600px) and (orientation: portrait) {
  .modal { align-items: flex-end; padding: 0; }
  .card, .card.narrow { width: 100%; max-height: 86vh; border-radius: 16px 16px 0 0; padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    animation: sheet .26s cubic-bezier(.2, .9, .3, 1); }
  .card::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--ink-3); margin: -8px auto 10px; }
}
@media (max-width: 560px) { .tabs { top: -18px; } }
@media (max-height: 420px) and (min-aspect-ratio: 1/1) { .tabs { top: -12px; } .tab { min-height: 34px; font-size: 12px; } .seg { margin: 2px 0 6px; } }
@media (prefers-reduced-motion: reduce) { .card, .modal { animation: none; } }
