/* maczo Originals — maczo.co CI (casino dark + maczo green/blue, Bai Jamjuree) */
:root {
  /* surfaces (maczo.co extracted) */
  --bg: #0f212e;          /* page background */
  --bg-deep: #0b1a24;     /* deepest / behind sidebar */
  --panel: #1a2c38;       /* surface / cards */
  --panel-2: #213743;     /* raised: inputs, active pill, board insets */
  --panel-3: #2f4553;     /* borders, hover, secondary button */
  --line: rgba(255, 255, 255, 0.06);
  --line-2: #2f4553;
  --text: #ffffff;
  --muted: #b1bad3;       /* secondary text */
  --muted-2: #557086;     /* faint labels / hints */
  /* brand */
  --accent: #1ff7ac;      /* maczo brand green (mint) — bet / go / highlight */
  --accent-2: #00e701;    /* win green */
  --accent-soft: #7cffb2;
  --blue: #1475e1;        /* primary CTA / links / info */
  --blue-dim: #0f5cb8;
  --red: #ff4d5e;
  --gold: #ffb636;
  --cyan: #5ac8fa;
  --shadow: 0 8px 30px rgba(0, 0, 0, 0.40);
  --shadow-lg: 0 18px 50px rgba(0, 0, 0, 0.55);
  --radius: 12px;
  --radius-sm: 8px;
  --radius-btn: 6px;
  --sidebar-w: 248px;
  font-synthesis: none;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Bai Jamjuree", "Segoe UI", system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100%;
  -webkit-font-smoothing: antialiased;
  letter-spacing: 0.1px;
}

.tabular { font-variant-numeric: tabular-nums; }
button { font-family: inherit; cursor: pointer; }

/* ---------------- app shell: sidebar + content ---------------- */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar-w); flex: 0 0 var(--sidebar-w);
  background: var(--bg-deep); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: 2px; padding: 16px 12px;
  position: sticky; top: 0; align-self: flex-start; height: 100vh; overflow-y: auto;
}
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; font-size: 18px; letter-spacing: .3px; }
.brand .logo {
  width: 30px; height: 30px; border-radius: 8px; flex: none; position: relative;
  background: linear-gradient(150deg, var(--accent), #12c98c);
  box-shadow: 0 0 16px rgba(31, 247, 172, .35);
}
.brand .logo::after { content: "m"; position: absolute; inset: 0; display: grid; place-items: center;
  color: #06210f; font-weight: 700; font-size: 19px; }
.brand .logo.sm { width: 18px; height: 18px; border-radius: 5px; }
.brand .logo.sm::after { font-size: 12px; }
.brand .o { color: var(--accent); font-weight: 700; }
.brand-tx { font-size: 16px; }
.sidebar .brand { padding: 6px 8px 12px; }
.side-cap { font-size: 10px; text-transform: uppercase; letter-spacing: .14em; color: var(--muted-2);
  padding: 6px 10px 6px; font-weight: 600; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-foot { margin-top: auto; padding: 14px 8px 4px; }
.badge-fair { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 600; color: var(--accent); }

/* sidebar game items (rendered by app.js buildNav) */
.side-item {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--radius-btn);
  background: transparent; border: none; color: var(--muted); width: 100%; text-align: left;
  font-weight: 600; font-size: 13.5px; transition: background .12s, color .12s; position: relative; cursor: pointer;
}
.side-item:hover { background: var(--panel); color: var(--text); }
.side-item.active { background: var(--panel-2); color: var(--text); }
.side-item.active::before { content: ""; position: absolute; left: -12px; top: 7px; bottom: 7px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent); }
.side-item .ico { width: 28px; height: 28px; border-radius: 7px; flex: none; display: grid; place-items: center;
  font-size: 15px; background: var(--g-grad, linear-gradient(150deg, var(--panel-3), var(--panel-2)));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.07); }
.side-item .gname { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------------- top bar ---------------- */
.topbar {
  display: flex; align-items: center; gap: 14px; padding: 11px 22px;
  border-bottom: 1px solid var(--line); background: rgba(15, 33, 46, .85);
  backdrop-filter: blur(12px); position: sticky; top: 0; z-index: 20; min-height: 62px;
}
.menu-btn { display: none; font-size: 18px; }
.brand-top { display: none; }
.badge-demo {
  font-size: 10px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase;
  color: var(--gold); border: 1px solid rgba(255, 182, 54, 0.35);
  padding: 3px 9px; border-radius: 999px; background: rgba(255, 182, 54, 0.08);
}
.spacer { flex: 1; }
.balance-pill {
  display: flex; align-items: baseline; gap: 8px; background: var(--panel-2);
  border: 1px solid var(--line-2); border-radius: var(--radius-btn); padding: 9px 16px;
}
.balance-pill .amt { font-weight: 700; font-size: 16px; }
.balance-pill .cur { color: var(--muted); font-size: 12px; font-weight: 600; }
.balance-pill.flash { animation: pop 0.5s ease; }
@keyframes pop { 0% { transform: scale(1); } 35% { transform: scale(1.06); } 100% { transform: scale(1); } }

/* ---------------- layout ---------------- */
.shell { max-width: 1200px; margin: 0 auto; padding: 22px; width: 100%; }
/* align-items:start so the game board (right) and the bet panel (left) size INDEPENDENTLY — switching to
   Auto adds controls to the bet panel and must NOT stretch / resize the game frame. */
.layout { display: grid; grid-template-columns: 320px 1fr; gap: 16px; align-items: start; }

/* mobile sidebar drawer */
.sidebar-scrim { display: none; }
@media (max-width: 980px) {
  .layout { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; z-index: 60; transform: translateX(-100%);
    transition: transform .2s ease; box-shadow: var(--shadow-lg); }
  .app.nav-open .sidebar { transform: none; }
  .app.nav-open .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 55; background: rgba(8, 12, 20, .6); }
  .menu-btn { display: flex; }
  .brand-top { display: flex; font-size: 16px; }
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
.betpanel { padding: 16px; display: flex; flex-direction: column; gap: 14px; background: var(--panel-2); }
.board { padding: 18px; min-height: 480px; display: flex; flex-direction: column; }

.label { font-size: 12px; color: var(--muted); font-weight: 600; margin-bottom: 7px; }
.field { display: flex; flex-direction: column; }
.amount-row { display: flex; gap: 8px; }
.input {
  background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-btn);
  color: var(--text); padding: 11px 13px; font-size: 15px; font-weight: 600; width: 100%;
}
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 2px rgba(31,247,172,.18); }
/* wallet-currency token shown inside a money input (Bet amount, Stop on profit/loss) — Stake parity */
.cur-field { position: relative; flex: 1; display: flex; }
.cur-field .input { padding-left: 26px; }
.cur-sym { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); pointer-events: none;
  color: var(--muted); font-weight: 800; font-size: 13px; }
.chip {
  background: var(--panel-3); border: 1px solid transparent; border-radius: var(--radius-btn);
  color: var(--text); padding: 0 12px; font-weight: 600; font-size: 13px; transition: background .12s, color .12s;
}
.chip:hover { background: #3a5466; color: #fff; }
.chip.step { min-width: 40px; padding: 0; font-size: 20px; font-weight: 700; line-height: 1; }

.seg { display: flex; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--radius-btn); padding: 4px; gap: 4px; }
.seg button { flex: 1; border: none; background: transparent; color: var(--muted); font-weight: 600; padding: 9px; border-radius: var(--radius-btn); font-size: 13px; transition: background .12s, color .12s; }
.seg button.on { background: var(--panel-3); color: var(--text); }
.seg.win button.on { color: var(--accent); }

.odds { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius-btn); padding: 10px 12px; }
.stat .k { font-size: 11px; color: var(--muted); letter-spacing: 0.3px; }
.stat .v { font-weight: 700; font-size: 17px; margin-top: 3px; }
.stat .v.accent { color: var(--accent); }

.betbtn {
  width: 100%; box-sizing: border-box; display: block;
  border: none; border-radius: var(--radius-btn); padding: 15px; font-size: 16px; font-weight: 800;
  color: #053a06; background: var(--accent);
  box-shadow: 0 6px 18px rgba(31, 247, 172, 0.22); transition: transform 0.1s, filter 0.15s; letter-spacing: 0.2px;
}
.betbtn:hover { filter: brightness(1.08); }
.betbtn:active { transform: translateY(1px) scale(0.995); }
.betbtn:disabled { filter: grayscale(0.55) brightness(0.7); cursor: not-allowed; box-shadow: none; }
.err { color: var(--red); font-size: 12.5px; min-height: 16px; font-weight: 600; }

.slider { width: 100%; -webkit-appearance: none; appearance: none; height: 8px; border-radius: 8px; background: transparent; }
.slider::-webkit-slider-thumb { -webkit-appearance: none; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.5); border: 3px solid var(--accent); margin-top: -7px; cursor: grab; }
.slider::-webkit-slider-runnable-track { height: 8px; border-radius: 8px; }

/* ---------------- board header + footer ---------------- */
.board-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.board-title-wrap { display: flex; align-items: center; gap: 11px; }
.board-ico { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; background: var(--panel-2);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.06); }
.board-ico[src=""], .board-ico:not([src]) { display: none; }
.board-head .gt { font-weight: 700; font-size: 18px; }
.fairlink { color: var(--blue); font-size: 12.5px; font-weight: 600; background: none; border: none; cursor: pointer; }
.fairlink:hover { color: #3a90ee; text-decoration: underline; }
.board-stage { flex: 1; display: flex; align-items: center; justify-content: center; position: relative; padding: 8px 0 4px; }
.board-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line);
}
.bf-gear { background: none; border: none; color: var(--muted); font-size: 16px; cursor: pointer; line-height: 1; }
.bf-gear:hover { color: var(--text); }
.bf-brand { display: flex; align-items: center; gap: 7px; color: var(--muted-2); font-size: 12.5px; font-weight: 600; }
.bf-brand b { color: var(--muted); font-weight: 700; }

/* big result */
.result-pop { position: absolute; top: 50%; left: 50%; z-index: 40; text-align: center; font-weight: 900; font-size: 64px; opacity: 0; transform: translate(-50%,-50%) scale(0.6); pointer-events: none; }
.result-pop.show { animation: rpop 0.9s cubic-bezier(.2,1.3,.4,1) forwards; }
.result-pop.win { color: var(--accent); text-shadow: 0 0 30px rgba(31,247,172,.6); }
.result-pop.lose { color: var(--red); text-shadow: 0 0 30px rgba(255,77,109,.4); }
@keyframes rpop { 0% { opacity: 0; transform: translate(-50%,-50%) scale(.6); } 25% { opacity: 1; transform: translate(-50%,-50%) scale(1.1); } 80% { opacity: 1; transform: translate(-50%,-50%) scale(1); } 100% { opacity: 0; transform: translate(-50%,-50%) scale(1) translateY(-26px); } }

/* ---------------- feed ---------------- */
.feed { margin-top: 22px; }
.feed h3 { font-size: 13px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; margin-bottom: 10px; }
.feed-row { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border: 1px solid var(--line); border-radius: 10px; margin-bottom: 7px; background: var(--panel); font-size: 13px; animation: slidein 0.3s ease; }
@keyframes slidein { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.feed-row .g { font-weight: 700; width: 64px; color: var(--muted); }
.feed-row .m { font-weight: 800; }
.feed-row.win .m { color: var(--accent); }
.feed-row.lose .m { color: var(--red); }
.feed-row .p { margin-left: auto; font-weight: 700; }

/* ---------------- modal ---------------- */
.modal-bg { position: fixed; inset: 0; background: rgba(4, 6, 12, 0.7); backdrop-filter: blur(4px); display: none; align-items: center; justify-content: center; z-index: 50; }
.modal-bg.open { display: flex; }
.modal { width: min(560px, 92vw); max-height: 86vh; overflow: auto; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
.modal h2 { font-size: 19px; margin-bottom: 6px; }
.modal p { color: var(--muted); font-size: 13px; line-height: 1.55; margin-bottom: 14px; }
.kv { display: flex; flex-direction: column; gap: 9px; }
.kv .row { display: flex; flex-direction: column; gap: 4px; }
.kv .row .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; }
.kv .row code { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; font-size: 12px; word-break: break-all; color: var(--cyan); }
.modal .close { float: right; background: none; border: none; color: var(--muted); font-size: 22px; line-height: 1; }
.btn-row { display: flex; gap: 10px; margin-top: 16px; }
.btn { border: 1px solid var(--line-2); background: var(--panel-3); color: var(--text); border-radius: 10px; padding: 11px 16px; font-weight: 700; font-size: 13px; }
.btn.primary { background: var(--accent); color: #06210f; border-color: transparent; }
.win-tag { color: var(--accent); } .lose-tag { color: var(--red); }

/* ===================== per-game boards ===================== */
.ctrl { display: flex; flex-direction: column; gap: 14px; }

/* dice */
.dice-wrap { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 30px; }
.dice-roll { font-size: 72px; font-weight: 900; letter-spacing: -1px; }
.dice-track { position: relative; width: 100%; max-width: 580px; height: 30px; border-radius: 16px; background: var(--red); overflow: visible; box-shadow: inset 0 2px 6px rgba(0,0,0,.45); }
.dice-track .win-zone { position: absolute; top: 0; bottom: 0; background: linear-gradient(180deg,#7dffd0,var(--accent)); border-radius: 16px; }
.dice-marker { position: absolute; top: 50%; width: 26px; height: 46px; border-radius: 8px; background: linear-gradient(180deg,#fff,#dfe6f0); box-shadow: 0 6px 16px rgba(0,0,0,.55); transform: translate(-50%, -50%); transition: none; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #0a0d15; }
.dice-marker::before { content: ""; position: absolute; width: 10px; height: 18px; border-radius: 2px; background: repeating-linear-gradient(90deg,#9aa6b8 0 1px,transparent 1px 4px); opacity: .6; }
.dice-scale { width: 100%; max-width: 580px; display: flex; justify-content: space-between; color: var(--muted); font-size: 12px; font-weight: 700; }

/* limbo */
.limbo-wrap { width: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; }
.limbo-mult { font-size: 84px; font-weight: 900; letter-spacing: -2px; line-height: 1; transition: color .2s; }
.limbo-sub { color: var(--muted); font-weight: 700; font-size: 14px; }
.limbo-rocket { font-size: 40px; transform: translateY(0); }

/* mines */
.mines-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 12px; width: min(100%, 580px); margin: 0 auto; }
.mtile { aspect-ratio: 1; border-radius: 12px; border: 1px solid var(--line-2); background: linear-gradient(180deg,#33495a,#1d2c38); display: flex; align-items: center; justify-content: center; font-size: 30px; cursor: pointer; transition: transform .1s, background .2s, border-color .15s, box-shadow .12s; user-select: none; box-shadow: inset 0 1px 0 rgba(255,255,255,.07), inset 0 -4px 8px rgba(0,0,0,.38), 0 2px 5px rgba(0,0,0,.3); }
.mtile:hover { transform: translateY(-2px); border-color: var(--accent); }
.mtile:active { transform: translateY(1px); box-shadow: inset 0 2px 6px rgba(0,0,0,.4); }
.mtile.picked { border-color: var(--accent); background: linear-gradient(180deg,#1d3a2b,#16302330); box-shadow: inset 0 0 0 1px var(--accent); }
.mtile.gem { background: linear-gradient(180deg,#13402c,#0e2d1f); border-color: var(--accent); }
.mtile.bomb { background: linear-gradient(180deg,#3a1620,#2a0f17); border-color: var(--red); }
.mtile.flip { animation: flip .35s ease; }
@keyframes flip { 0% { transform: rotateY(0); } 50% { transform: rotateY(90deg); } 100% { transform: rotateY(0); } }
.mtile.dim { opacity: .35; }

/* plinko */
.plinko-wrap { width: 100%; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.plinko-canvas { width: 100%; max-width: 520px; display: block; }
.plinko-buckets { display: flex; gap: 4px; width: 100%; max-width: 520px; justify-content: center; }
.pbucket { flex: 1; text-align: center; font-size: 11px; font-weight: 800; padding: 6px 2px; border-radius: 7px; color: #06210f; }
.pbucket.hit { animation: bhit .5s ease; box-shadow: 0 0 0 2px #fff inset; }
@keyframes bhit { 0% { transform: translateY(0); } 40% { transform: translateY(6px); } 100% { transform: translateY(0); } }

/* ===================== v2: juice / interactive mines / verifier / responsive ===================== */
.icon-btn { display:flex; align-items:center; justify-content:center; }
.feed h3 .hint { color: var(--muted); font-weight: 600; font-size: 11px; text-transform: none; letter-spacing: 0; }
.feed-row { cursor: pointer; transition: border-color .12s, transform .12s; }
.feed-row:hover { border-color: var(--line-2); transform: translateX(2px); }

/* result pop split win/lose intensity */
.result-pop.win { color: var(--accent); text-shadow: 0 0 34px rgba(31,247,172,.7); }
.result-pop.lose { color: var(--red); text-shadow: 0 0 26px rgba(255,77,109,.4); }

/* interactive mines tile states */
.mtile.idle { cursor: default; background: linear-gradient(180deg,#243542,#192630); box-shadow: inset 0 2px 7px rgba(0,0,0,.4); }
.mtile.idle:hover { transform: none; border-color: var(--line-2); }
.mtile.live { cursor: pointer; }
.mtile.live:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 6px 18px rgba(0,0,0,.35); }

/* cash-out button */
.betbtn.cashout { background: linear-gradient(180deg,#ffe07a,var(--gold)); color:#3a2c00; box-shadow: 0 8px 24px rgba(255,206,77,.35); }

/* provably-fair verifier + copy */
.copyrow { display:flex; gap:8px; align-items:stretch; }
.copyrow code { flex:1; }
.btn.copy { padding:8px 12px; font-size:12px; white-space:nowrap; }
.verify-out { margin-top:12px; font-size:13px; }
.verify-out .vline { padding:6px 0; border-top:1px solid var(--line); }
.verify-out code { color: var(--cyan); word-break: break-all; }
.muted { color: var(--muted); }
#v-game, #v-server, #v-client, #v-nonce, #v-params { font-size:13px; }

/* responsive */
@media (max-width: 880px) {
  .game-nav { grid-template-columns: repeat(2, 1fr); }
  .shell { padding: 16px; }
  .board { min-height: 360px; }
}
@media (max-width: 520px) {
  .topbar { gap: 10px; padding: 12px 14px; flex-wrap: wrap; }
  .brand { font-size: 16px; }
  .balance-pill .amt { font-size: 16px; }
  .dice-roll { font-size: 52px; } .limbo-mult { font-size: 60px; }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

/* ===================== v3: presets / autobet (click, don't type) ===================== */
.preset-row { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 9px; }
.preset-row .chip { flex: 1 1 auto; min-width: 48px; height: 34px; display: flex; align-items: center; justify-content: center; }
#bet-presets { display: grid; grid-template-columns: repeat(5, 1fr); }
.preset-row .chip.on { border-color: var(--accent); color: var(--accent); background: rgba(31,247,172,.08); }

.mode-seg { margin-bottom: 14px; }
.mode-seg button.on { color: var(--text); }
#auto-controls { display: flex; flex-direction: column; gap: 12px; margin-bottom: 14px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(0,0,0,.18); }
.auto-rules { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
#auto-strategy:not(:empty) { display: flex; flex-direction: column; gap: 12px; padding-bottom: 12px; margin-bottom: 2px; border-bottom: 1px solid var(--line); }

.betbtn.stopbtn { background: linear-gradient(180deg,#ff6f86,var(--red)); color: #2a0a12; box-shadow: 0 8px 24px rgba(255,77,109,.35); }

/* While autobet drives a round, block manual clicks on the board + game controls (the Stop button sits outside these). */
.auto-lock { pointer-events: none; }
#board-stage.auto-lock { position: relative; }
#board-stage.auto-lock::after { content: "AUTO"; position: absolute; top: 10px; right: 12px; font-size: 11px; font-weight: 800; letter-spacing: .12em; color: var(--accent); opacity: .7; pointer-events: none; }

/* ===================== v4: limbo recent strip ===================== */
.limbo-strip { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; min-height: 24px; margin-bottom: 4px; }
.lchip { font-size: 12px; font-weight: 800; padding: 3px 9px; border-radius: 999px; background: var(--panel-3); color: var(--muted); border: 1px solid var(--line); }
.lchip.win { color: var(--accent); border-color: rgba(31,247,172,.4); }
.lchip.gold { color: var(--gold); border-color: rgba(255,206,77,.4); }
.lchip.lo { color: var(--red); border-color: rgba(255,77,109,.3); }

/* Recent-results history strip — pinned flush to a board edge; only the NEWEST chip slides in from the
   side. Shared across games (limbo/crash/hilo/slider/coinflip/roulette). !important on the layout so it
   wins over each game's own strip rules regardless of <style> injection order. */
.hist-edge { position: absolute !important; left: 0; right: 0; z-index: 6; display: flex !important;
  flex-wrap: nowrap !important; gap: 6px; justify-content: center; align-items: center;
  margin: 0 !important; padding: 7px 12px; min-height: 0 !important; max-width: none !important;
  pointer-events: none; overflow: hidden; }
.hist-edge.top { top: 0; background: linear-gradient(180deg, rgba(11,26,36,.6), transparent); }
.hist-edge.bottom { bottom: 0; background: linear-gradient(0deg, rgba(11,26,36,.6), transparent); }
@keyframes histChipIn { from { opacity: 0; transform: translateX(-18px) scale(.78); } to { opacity: 1; transform: none; } }
.hist-fresh { animation: histChipIn .34s cubic-bezier(.2,.85,.25,1) both; }

/* ===================== v5: coinflip / keno / wheel ===================== */
.coin-wrap { display: flex; flex-direction: column; align-items: center; gap: 22px; }
.coin { width: 130px; height: 130px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: 60px; font-weight: 900; color: #06210f;
  background: radial-gradient(circle at 35% 30%, #ffe9a8, var(--gold)); box-shadow: 0 12px 36px rgba(0,0,0,.5), inset 0 -6px 14px rgba(0,0,0,.25);
  transform-style: preserve-3d; }
.coin.win { background: radial-gradient(circle at 35% 30%, #8ff5c4, var(--accent)); }
.coin.lose { background: radial-gradient(circle at 35% 30%, #ff9fb0, var(--red)); color: #2a0a12; }

.keno-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 9px; width: min(100%, 600px); margin: 0 auto; }
.kcell { aspect-ratio: 1; border-radius: 10px; border: 1px solid var(--line-2); background: linear-gradient(180deg,#2f4553,#243643);
  display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 16px; cursor: pointer;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.06), inset 0 -3px 6px rgba(0,0,0,.3);
  transition: transform .1s, background .15s, border-color .15s; user-select: none; }
.kcell:hover { transform: translateY(-2px); border-color: var(--accent); }
.kcell.picked { background: linear-gradient(180deg,#1d3a2b,#163023); border-color: var(--accent); color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.kcell.hit { background: var(--panel-2); border-color: var(--line-2); color: var(--muted); }     /* drawn, not picked */
.kcell.match { background: linear-gradient(180deg,#7dffd0,var(--accent)); color: #06210f; border-color: #fff; animation: pop .35s ease; }

.wheel-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.wheel-canvas { filter: drop-shadow(0 14px 30px rgba(0,0,0,.5)); }

/* ===================== v6: dragon tower ===================== */
.tower { display: flex; flex-direction: column; gap: 7px; width: 100%; max-width: 420px; margin: 0 auto; }
.trow { display: flex; gap: 7px; justify-content: center; opacity: .5; transition: opacity .15s; }
.trow.active { opacity: 1; }
.tcell { flex: 1; max-width: 92px; aspect-ratio: 16/10; border-radius: 10px; border: 1px solid var(--line-2);
  background: linear-gradient(180deg,var(--panel-3),var(--panel-2)); display: flex; align-items: center; justify-content: center;
  font-size: 22px; transition: transform .1s, border-color .15s, background .2s; }
.trow.active .tcell.live { cursor: pointer; }
.trow.active .tcell.live:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 6px 16px rgba(0,0,0,.35); }
.tcell.gem { background: linear-gradient(180deg,#13402c,#0e2d1f); border-color: var(--accent); }
.tcell.egg { background: linear-gradient(180deg,#3a2a10,#2a1f0c); border-color: var(--gold); }
.tcell.boom { background: linear-gradient(180deg,#3a1620,#2a0f17); border-color: var(--red); }
.tcell.dim { opacity: .4; }

/* ===================== v7: hilo ===================== */
.hilo-wrap { display: flex; flex-direction: column; align-items: center; gap: 26px; width: 100%; }
.hcard { width: 130px; height: 180px; border-radius: 16px; background: linear-gradient(180deg,#fff,#e7ecf5);
  color: #14233a; display: flex; align-items: center; justify-content: center;
  font-size: 46px; font-weight: 900; box-shadow: 0 16px 40px rgba(0,0,0,.5); border: 1px solid rgba(0,0,0,.1); }
.hcard.red { color: #e0123c; }
.hcard.bust { box-shadow: 0 0 0 3px var(--red), 0 16px 40px rgba(255,77,109,.4); }
.hbtns { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: 100%; max-width: 420px; }
.hbtn { display: flex; flex-direction: column; gap: 4px; align-items: center; padding: 14px; border-radius: 12px;
  border: 1px solid var(--line-2); background: var(--panel-3); color: var(--text); font-weight: 800; font-size: 14px; }
.hbtn .hm { font-size: 18px; }
.hbtn.hi:not(:disabled):hover { border-color: var(--accent); color: var(--accent); }
.hbtn.lo:not(:disabled):hover { border-color: var(--cyan); color: var(--cyan); }
.hbtn:disabled { opacity: .45; cursor: not-allowed; }

/* ===================== v8: diamonds ===================== */
.dia-wrap { display: flex; flex-direction: column; align-items: center; gap: 26px; }
.dia-slots { display: flex; gap: 14px; }
.dgem { width: 76px; height: 76px; border-radius: 50%; background: var(--panel-3); border: 1px solid var(--line-2);
  transform: rotate(45deg) scale(.6); opacity: .3; transition: transform .25s cubic-bezier(.2,1.3,.4,1), opacity .25s; box-shadow: inset 0 -4px 10px rgba(0,0,0,.3); }
.dgem.reveal { transform: rotate(45deg) scale(1); opacity: 1; }
.dgem.match { box-shadow: 0 0 0 3px #fff, 0 0 22px rgba(255,255,255,.5), inset 0 -4px 10px rgba(0,0,0,.3); }
@media (max-width: 520px) { .dgem { width: 54px; height: 54px; } }

/* ===================== v9: slider ===================== */
.slider-wrap { display: flex; flex-direction: column; align-items: center; gap: 30px; width: 100%; }
.slider-track { position: relative; width: 100%; max-width: 640px; padding-top: 26px; }
.slider-bar { display: flex; gap: 4px; width: 100%; min-height: 150px; border-radius: 12px; }
.szone { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; padding: 0 2px 12px; font-size: 14px; font-weight: 800; color: #06210f; border-radius: 10px; transition: transform .15s, box-shadow .15s; }
.szone.hit { transform: scale(1.05); box-shadow: 0 0 0 2px var(--accent), 0 0 24px rgba(31,247,172,.45); z-index: 2; }
.slider-marker { position: absolute; top: 2px; left: 50%; width: 2px; height: 150px; background: #fff; box-shadow: 0 0 10px rgba(255,255,255,.6); transform: translateX(-50%); transition: none; }
.slider-marker::after { content: ""; position: absolute; top: -6px; left: 50%; transform: translateX(-50%); width: 12px; height: 12px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px rgba(255,255,255,.6); }

/* ===================== v10: roulette ===================== */
.roul-nums { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; }
.rnum { aspect-ratio: 1; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; color: #fff; cursor: pointer; border: 1px solid transparent; transition: transform .1s; }
.rnum:hover { transform: translateY(-1px); }
.rnum.sel { border-color: #fff; box-shadow: 0 0 0 1px #fff; }

/* ===================== v11: baccarat ===================== */
.bac-wrap { display: flex; flex-direction: column; align-items: center; gap: 24px; width: 100%; }
.bac-table { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; width: 100%; max-width: 520px; }
.bac-side { border: 1px solid var(--line-2); border-radius: 14px; padding: 16px; background: var(--panel-2); text-align: center; transition: border-color .2s, box-shadow .2s; }
.bac-side.win { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent), 0 0 24px rgba(31,247,172,.2); }
.bac-name { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; font-weight: 700; }
.bac-cards { display: flex; gap: 8px; justify-content: center; min-height: 70px; margin: 12px 0; }
.bcard { width: 46px; height: 64px; border-radius: 8px; background: linear-gradient(180deg,#fff,#e7ecf5); color: #14233a; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 20px; box-shadow: 0 6px 16px rgba(0,0,0,.4); animation: slidein .25s ease; }
.bac-total { font-size: 30px; font-weight: 900; }

/* ===================== v12: cross the road ===================== */
.road { display: flex; gap: 6px; width: 100%; max-width: 700px; margin: 0 auto; overflow-x: auto; padding: 8px 0; }
.lane { position: relative; flex: 1 0 58px; min-height: 210px; border-radius: 8px; background: linear-gradient(180deg,#1c2a36,#16242f);
  border: 1px solid var(--line); }
.lane::after { content: ""; position: absolute; top: 10px; bottom: 10px; right: -4px; width: 2px;
  background: repeating-linear-gradient(180deg,#557086 0 10px, transparent 10px 22px); opacity: .45; }
.lane .lmult { position: absolute; top: 50%; left: 50%; transform: translate(-50%,-50%); display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line-2);
  font-size: 11px; font-weight: 800; color: var(--text); }
.lane.passed { background: linear-gradient(180deg,#13402c,#0e2d1f); border-color: var(--accent); }
.lane.passed .lmult { border-color: var(--accent); color: var(--accent); box-shadow: 0 0 0 2px rgba(31,247,172,.25); }
.lane.hit { background: linear-gradient(180deg,#3a1620,#2a0f17); border-color: var(--red); }
.lane.hit .lmult { border-color: var(--red); color: var(--red); }
.chick { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); font-size: 22px; transition: none; }
.car { position: absolute; top: 40%; left: 50%; transform: translateX(-50%); font-size: 20px; }

/* ===================== v13: crash ===================== */
.crash-wrap { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; min-height: 280px; }
.crash-rocket { font-size: 46px; transition: transform .1s linear; }
.crash-rocket.boom { font-size: 64px; }
.crash-num { font-size: 80px; }

/* ===================== v14: blackjack ===================== */
.bj-wrap { display: flex; flex-direction: column; align-items: center; gap: 22px; width: 100%; }
.bj-row { width: 100%; max-width: 480px; }
.bj-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; font-weight: 700; margin-bottom: 8px; }
.bj-tot { color: var(--text); font-size: 16px; }
.bj-cards { display: flex; gap: 8px; min-height: 70px; }
.bcard .bsuit { font-size: 12px; margin-left: 1px; }
.bcard.back { background: repeating-linear-gradient(45deg,#2a3550,#2a3550 6px,#222a3f 6px,#222a3f 12px); color: transparent; }

/* ===================== v15: video poker ===================== */
.vp-wrap { display: flex; flex-direction: column; align-items: center; gap: 26px; width: 100%; }
.vp-cards { display: flex; gap: 10px; }
.vp-card { width: 72px; height: 100px; border-radius: 10px; background: linear-gradient(180deg,#fff,#e7ecf5); cursor: pointer; position: relative; box-shadow: 0 8px 20px rgba(0,0,0,.4); display: flex; align-items: center; justify-content: center; transition: transform .12s, box-shadow .15s; }
.vp-card:hover { transform: translateY(-3px); }
.vp-card.held { box-shadow: 0 0 0 3px var(--accent), 0 8px 20px rgba(31,247,172,.3); transform: translateY(-6px); }
.vpc-face { font-size: 24px; font-weight: 900; color: #14233a; }
.vpc-face.red { color: #e0123c; }
.vpc-hold { position: absolute; bottom: 6px; left: 50%; transform: translateX(-50%); font-size: 10px; font-weight: 800; color: #06210f; background: var(--accent); padding: 1px 8px; border-radius: 999px; }
@media (max-width: 520px) { .vp-card { width: 54px; height: 76px; } .vpc-face { font-size: 18px; } }

/* ===================== v16: premium board additions (maczo CI) ===================== */

/* wheel — multiplier legend below the ring */
.wheel-legend { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 16px; }
.wheel-chip { display: flex; align-items: center; gap: 7px; padding: 6px 12px; border-radius: 6px; background: var(--panel-2); color: var(--muted); font-weight: 600; font-size: 13px; border: 1px solid var(--line); }
.wheel-chip .sw { width: 11px; height: 11px; border-radius: 3px; flex: none; }
.wheel-chip.on { color: #fff; box-shadow: 0 0 0 2px var(--accent); }

/* diamonds — on-board paytable + dealt tray */
.dia-paytable { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 440px; }
.dia-pt-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 12px; border-radius: 6px; background: var(--panel-2); border: 1px solid transparent; }
.dia-pt-row.active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.dia-pt-row .pt-gems { display: flex; gap: 4px; }
.dia-pt-row .pt-gem { width: 15px; height: 15px; border-radius: 4px; transform: rotate(45deg); }
.dia-pt-row .pt-mult { font-weight: 700; color: var(--accent); font-variant-numeric: tabular-nums; }
.dia-tray { display: flex; gap: 14px; padding: 16px; border-radius: 12px; background: var(--panel-2); border: 1px solid var(--line); }

/* video poker — hand-ranking paytable */
.vp-paytable { display: flex; flex-direction: column; width: 100%; max-width: 460px; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.vp-pt-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 14px; font-size: 13px; background: var(--panel); }
.vp-pt-row:nth-child(even) { background: var(--panel-2); }
.vp-pt-row .pt-name { color: var(--muted); font-weight: 600; flex: 1; }
.vp-pt-row .pt-x { color: #fff; font-weight: 700; width: 54px; text-align: right; font-variant-numeric: tabular-nums; }
.vp-pt-row .pt-pay { color: var(--accent); font-weight: 700; width: 96px; text-align: right; font-variant-numeric: tabular-nums; }
.vp-pt-row.win { background: rgba(31,247,172,.13); }
.vp-pt-row.win .pt-name { color: var(--accent); }
.vp-banner { font-weight: 700; font-size: 16px; color: var(--muted); }
.vp-banner.win { color: var(--accent); text-shadow: 0 0 16px rgba(31,247,172,.4); }

/* coinflip — recent results strip */
.coin-strip { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; min-height: 26px; }
.cchip { width: 24px; height: 24px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 800; background: var(--panel-3); border: 1px solid var(--line); color: var(--muted); }
.cchip.h { color: var(--gold); border-color: rgba(255,182,54,.4); }
.cchip.t { color: var(--blue); border-color: rgba(20,117,225,.4); }

/* dragon tower — per-row multiplier ladder */
.tower { padding-right: 64px; }
.trow { position: relative; }
.trow .rmult { position: absolute; right: -58px; top: 0; bottom: 0; display: flex; align-items: center; justify-content: flex-start;
  width: 52px; font-size: 12px; font-weight: 700; color: var(--muted); font-variant-numeric: tabular-nums; }
.trow.reached .rmult, .trow.active .rmult { color: var(--accent); }

/* blackjack — pre-deal rules watermark + centered felt */
.bj-empty { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted-2); text-transform: uppercase; letter-spacing: .6px; font-size: 13px; font-weight: 600; }
.bj-empty .be-big { font-size: 44px; opacity: .22; letter-spacing: 0; }
.bj-row { margin: 0 auto; }
.bj-cards { justify-content: center; }

/* baccarat — three bet zones + odds callout */
.bac-table.three { grid-template-columns: 1fr 1fr 1fr; max-width: 720px; }
.bac-odds { align-self: center; padding: 7px 16px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: .3px; }
.bac-side.picked { border-color: var(--blue); box-shadow: 0 0 0 1px var(--blue); }

/* roulette — recent results history strip */
.roul-history { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 16px; min-height: 26px; }
.rhist { min-width: 26px; height: 26px; padding: 0 6px; border-radius: 6px; display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 800; color: #fff; }

/* keno — helper hint + hits→multiplier strip */
.keno-hint { color: var(--muted-2); font-size: 13px; text-align: center; margin-top: 16px; }
.keno-pays { display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; margin-top: 12px; }
.keno-pay { min-width: 46px; padding: 5px 8px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); text-align: center; font-size: 11px; font-weight: 700; color: var(--muted); }
.keno-pay .kp-h { display: block; color: var(--muted-2); font-size: 10px; }
.keno-pay.on { border-color: var(--accent); color: var(--accent); }

/* ============================================================================
   v17: VISUAL SYSTEM 2.0 — premium dark-casino theme.
   Backward-compatible: enhances shared shells/components so every game lifts at
   once; rebuilt games layer FX (lib/fx.js) on top. maczo CI palette throughout.
   ============================================================================ */
:root {
  --glass: linear-gradient(180deg, rgba(33,55,67,.92), rgba(22,40,52,.84));
  --glass-line: rgba(255,255,255,.09);
  --neon: 0 0 0 1px rgba(31,247,172,.5), 0 0 22px rgba(31,247,172,.35);
  --ring: 0 0 0 3px rgba(31,247,172,.20);
}

/* page: deep base + slow-drifting brand-colour aurora behind everything */
body { background: var(--bg-deep); }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(60% 52% at 14% 0%,  rgba(20,117,225,.20), transparent 60%),
    radial-gradient(55% 46% at 102% 8%, rgba(31,247,172,.15), transparent 58%),
    radial-gradient(75% 62% at 50% 115%, rgba(20,117,225,.14), transparent 62%);
  animation: bgdrift 26s ease-in-out infinite alternate;
}
@keyframes bgdrift { from { transform: translateY(0) scale(1); } to { transform: translateY(-20px) scale(1.07); } }
@media (prefers-reduced-motion: reduce) { body::before { animation: none; } }

/* sidebar: subtle vertical sheen + crisper active state */
.sidebar { background: linear-gradient(180deg, #0c1b25, #0a161f); }
.side-item.active { background: linear-gradient(180deg, rgba(31,247,172,.10), rgba(33,55,67,.6)); box-shadow: inset 0 0 0 1px rgba(31,247,172,.18); }
.side-item.active::before { box-shadow: 0 0 12px var(--accent); }
.side-item .ico { box-shadow: inset 0 0 0 1px rgba(255,255,255,.10), 0 4px 10px rgba(0,0,0,.35); }
.side-item:hover .ico { box-shadow: inset 0 0 0 1px rgba(255,255,255,.18), 0 6px 14px rgba(0,0,0,.4); }

/* topbar + balance pill */
.topbar { background: rgba(12,27,37,.78); box-shadow: 0 1px 0 rgba(255,255,255,.04); }
.balance-pill { background: linear-gradient(180deg, rgba(33,55,67,.9), rgba(26,44,56,.85)); border-color: var(--glass-line); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.balance-pill .amt { color: var(--accent); text-shadow: 0 0 18px rgba(31,247,172,.25); }
.badge-fair, .badge-demo { backdrop-filter: blur(6px); }

/* glass bet panel */
.betpanel {
  background: var(--glass); backdrop-filter: blur(12px);
  border: 1px solid var(--glass-line);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255,255,255,.06);
}

/* the board — was an empty black box; now a lit stage with depth, grid & vignette */
.board {
  background:
    radial-gradient(120% 75% at 50% -12%, rgba(31,247,172,.07), transparent 62%),
    radial-gradient(90%  78% at 50% 118%, rgba(20,117,225,.12), transparent 60%),
    linear-gradient(180deg, rgba(22,41,53,.6), rgba(12,24,33,.6)),
    var(--panel);
  position: relative; overflow: hidden;
  border: 1px solid rgba(255,255,255,.08);
  box-shadow: var(--shadow-lg), inset 0 1px 0 rgba(255,255,255,.05);
}
.board::before {
  content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .6;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 36px 36px;
  -webkit-mask-image: radial-gradient(125% 100% at 50% 0%, #000, transparent 78%);
          mask-image: radial-gradient(125% 100% at 50% 0%, #000, transparent 78%);
}
.board::after { content: ""; position: absolute; inset: 0; pointer-events: none; border-radius: inherit; box-shadow: inset 0 0 130px rgba(0,0,0,.5); }
/* rendered per-game backdrop (set by app.js from /img/bg/<id>.png), behind the live board */
.board-bg { position: absolute; inset: 0; z-index: 0; border-radius: inherit; pointer-events: none;
  background-size: cover; background-position: center; opacity: .4; transition: opacity .35s ease, background-image .2s; }
.board-bg::after { content: ""; position: absolute; inset: 0; border-radius: inherit;
  background: radial-gradient(120% 90% at 50% 42%, rgba(11,26,36,.30), rgba(11,26,36,.84) 100%); }
/* Plinko draws its own full canvas background — hide the per-game backdrop image so it isn't doubled up. */
#board-panel[data-game="plinko"] .board-bg { display: none !important; }
/* Busy photographic/dungeon backdrops lower play-surface contrast. Hide the flat-photo ones (darts, rps)
   and dim+blur the busy dungeon scenes (cases, bars) so tiles/numerals read clearly on top. */
#board-panel[data-game="darts"] .board-bg,
#board-panel[data-game="rps"] .board-bg { display: none !important; }
#board-panel[data-game="cases"] .board-bg,
#board-panel[data-game="bars"] .board-bg { opacity: .18 !important; filter: blur(3px); }
.board-head, .board-stage, .board-foot { position: relative; z-index: 1; }
.board-head .gt { letter-spacing: .2px; }
.board-ico { box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), 0 4px 12px rgba(0,0,0,.4); }

/* primary action button — glossy gradient + shine sweep */
.betbtn {
  background: linear-gradient(180deg, #3dffc2, #11c98c);
  color: #042619; position: relative; overflow: hidden;
  box-shadow: 0 8px 22px rgba(31,247,172,.28), inset 0 1px 0 rgba(255,255,255,.45);
}
.betbtn::after {
  content: ""; position: absolute; top: 0; left: -65%; width: 42%; height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255,255,255,.55), transparent);
  transform: skewX(-18deg); transition: left .55s ease; pointer-events: none;
}
.betbtn:hover { filter: brightness(1.06); transform: translateY(-1px); }
.betbtn:hover::after { left: 135%; }
.betbtn:active { transform: translateY(1px) scale(.995); }
.betbtn.cashout { background: linear-gradient(180deg, #ffe07a, #ffb636); color: #3a2c00; box-shadow: 0 8px 24px rgba(255,182,54,.4), inset 0 1px 0 rgba(255,255,255,.5); }
.betbtn.stopbtn { background: linear-gradient(180deg, #ff7d92, #ff4d5e); color: #2a0a12; box-shadow: 0 8px 24px rgba(255,77,94,.4), inset 0 1px 0 rgba(255,255,255,.4); }

/* inputs / chips / segments */
.input { background: rgba(8,18,26,.7); border-color: var(--glass-line); transition: border-color .15s, box-shadow .15s; }
.input:focus { border-color: var(--accent); box-shadow: var(--ring); }
.chip { background: linear-gradient(180deg, #33495a, #283a47); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); transition: transform .1s, background .12s, color .12s, box-shadow .12s; }
.chip:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255,255,255,.1), 0 4px 10px rgba(0,0,0,.3); }
.chip.on { box-shadow: var(--neon); }
.seg { background: rgba(8,18,26,.7); border-color: var(--glass-line); }
.seg button.on { background: linear-gradient(180deg, #36505f, #2a4150); box-shadow: inset 0 0 0 1px rgba(255,255,255,.08); }
.stat { background: rgba(8,18,26,.55); border-color: var(--glass-line); }
.stat .v.accent { text-shadow: 0 0 16px rgba(31,247,172,.3); }

/* feed rows — glass cards with a result-coloured edge */
.feed-row { background: linear-gradient(180deg, rgba(26,44,56,.85), rgba(20,36,46,.8)); border-color: var(--glass-line); backdrop-filter: blur(6px); border-left: 3px solid transparent; }
.feed-row.win { border-left-color: var(--accent); }
.feed-row.lose { border-left-color: var(--red); }

/* slider thumb glow */
.slider::-webkit-slider-thumb { box-shadow: 0 2px 8px rgba(0,0,0,.5), 0 0 14px rgba(31,247,172,.4); }

/* modal glass */
.modal { background: var(--glass); backdrop-filter: blur(16px); border-color: var(--glass-line); box-shadow: var(--shadow-lg); }

/* tidy scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--panel-3) transparent; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--panel-3); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
*::-webkit-scrollbar-thumb:hover { background: #3a5466; background-clip: content-box; }

/* ============================================================================
   v18: EMBED / IFRAME mode — bx loads ONE Originals game in an iframe.
   Hide the lobby chrome (bx has its own), let the single game fill the frame.
   Activate with ?embed (or ?mode=embed); optionally &game=<id>. body gets .embed.
   ============================================================================ */
/* bx embeds at a fixed 1366x768 frame. Lay the whole app out at exactly that design size and uniformly
   SCALE it to fit the iframe/screen (centred + letterboxed). This guarantees the game never overflows the
   iframe, and that going fullscreen only changes the scale — never the layout/positions. */
body.embed { background: var(--bg-deep); overflow: hidden; position: fixed; inset: 0;
  display: grid; place-items: center; }
body.embed .sidebar, body.embed .sidebar-scrim, body.embed .menu-btn,
body.embed .brand-top, body.embed .badge-demo, body.embed .feed,
body.embed .topbar, body.embed .game-frame-wrap, body.embed .game-stage,
body.embed #manual-extras { display: none !important; }   /* iframe = the game only; host supplies balance + recent bets */
body.embed #app { width: 1366px; height: 768px; flex: none; min-height: 0; overflow: hidden;
  transform: scale(var(--embed-scale, 1)); transform-origin: center center; }
body.embed .content { height: 100%; min-height: 0; min-width: 0; display: flex; flex-direction: column; }
/* slim top bar: keep balance + sound + fairness, drop branding */
body.embed .topbar { flex: none; padding: 8px 18px; min-height: 0; background: transparent; border-bottom: none; backdrop-filter: none; }
body.embed .topbar .spacer { flex: 1; }
/* the single game fills the remaining height of the fixed frame */
body.embed .shell { flex: 1; min-height: 0; max-width: none; padding: 10px 18px 16px; display: flex; }
body.embed .layout { flex: 1; min-height: 0; align-items: stretch; }
body.embed .betpanel { overflow-y: auto; }
body.embed .board { min-height: 0; }

/* HOST (lobby): the selected game runs inside a fixed 1366:768 iframe (same as bx will embed it). The
   fullscreen toggle is PAGE chrome — a bar under the frame (premium), NOT inside the embed. The
   inline game UI (betpanel + board) is only used INSIDE that iframe, so hide it here. */
.game-stage { display: none; }
body:not(.embed) .layout { display: block; }
body:not(.embed) #betpanel, body:not(.embed) #board-panel { display: none; }
body:not(.embed) .game-stage { display: block; }
body:not(.embed) .game-frame-wrap { position: relative; width: 100%; aspect-ratio: 1366 / 768;
  background: var(--bg-deep); border-radius: var(--radius) var(--radius) 0 0; overflow: hidden; box-shadow: var(--shadow); }
body:not(.embed) .game-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }

/* host control bar under the frame: Full Screen (left) + demo tag (right) */
body:not(.embed) .game-bar { display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 12px; background: var(--panel); border: 1px solid var(--line); border-top: none;
  border-radius: 0 0 var(--radius) var(--radius); }
.gb-btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 13px;
  border-radius: var(--radius-sm); border: 1px solid var(--line-2); background: transparent;
  color: var(--muted); font-weight: 700; font-size: 13px; line-height: 1; cursor: pointer;
  transition: background .15s, color .15s, border-color .15s; }
.gb-btn:hover { color: var(--text); background: rgba(31,247,172,.1); border-color: rgba(31,247,172,.4); }
.gb-btn .gb-ic { font-size: 16px; line-height: 1; }
.gb-spacer { flex: 1; }
.gb-demo { font-size: 11.5px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; color: var(--muted-2);
  padding: 4px 11px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255,255,255,.03); }

/* fullscreen: the whole stage (frame + bar) fills the screen — the frame flexes, the bar stays at the bottom */
#game-stage:fullscreen { background: var(--bg-deep); display: flex; flex-direction: column; }
#game-stage:fullscreen .game-frame-wrap { flex: 1; width: 100%; height: auto; aspect-ratio: auto; min-height: 0; border-radius: 0; }
#game-stage:fullscreen .game-bar { border-radius: 0; border-left: none; border-right: none; }

/* compact autobet (classic: number-of-bets input + collapsible Advanced) */
.adv-toggle { display: flex; align-items: center; gap: 6px; width: 100%; margin-top: 4px;
  background: transparent; border: none; color: var(--muted); font-weight: 700; font-size: 13px;
  padding: 7px 2px; cursor: pointer; text-align: left; }
.adv-toggle:hover { color: #fff; }
.adv-toggle .caret { font-size: 11px; opacity: .8; }
.auto-hint { color: #6b7f8e; font-size: 11px; margin-top: 5px; }
#auto-num { flex: 1; }
/* autobet "Increase by %" input (Stake-parity: On win / On loss = Reset | Increase by %) */
.pct-row { display: flex; align-items: center; gap: 6px; margin-top: 7px; }
.pct-row .input { flex: 1; text-align: right; padding-right: 8px; }
.pct-suffix { color: #6b7f8e; font-weight: 700; font-size: 13px; }
