/* loopstr arcade - dark, playful, satoshi-orange */
:root {
  --bg: #0c0e13;
  --bg2: #12151d;
  --card: #171b25;
  --card2: #1d2230;
  --line: #262c3b;
  --text: #e8ecf4;
  --muted: #8b93a7;
  --orange: #f7931a;
  --orange2: #ffb347;
  --green: #2ee6a8;
  --red: #ff5470;
  --purple: #9d7bff;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(0, 0, 0, .45);
}
* { box-sizing: border-box; margin: 0; padding: 0; -webkit-tap-highlight-color: transparent; }
html { color-scheme: dark; }
body {
  background: radial-gradient(1200px 600px at 80% -100px, #1a1408 0%, var(--bg) 55%);
  color: var(--text);
  font-family: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  line-height: 1.45;
}
button { font: inherit; cursor: pointer; border: none; color: inherit; background: none; }
input, select { font: inherit; color: inherit; }
a { color: var(--orange2); text-decoration: none; }

/* header */
header {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: rgba(12, 14, 19, .82);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.logo { font-weight: 800; font-size: 1.25rem; letter-spacing: -.5px; }
.logo b { color: var(--orange); }
.logo .loop { display: inline-block; animation: spin-slow 6s linear infinite; transform-origin: 54% 52%; }
@keyframes spin-slow { to { transform: rotate(360deg); } }
.spacer { flex: 1; }

.balance-chip {
  display: flex; align-items: center; gap: 6px;
  background: var(--card); border: 1px solid var(--line);
  padding: 7px 12px; border-radius: 999px;
  font-weight: 700; font-variant-numeric: tabular-nums;
  transition: transform .15s ease, border-color .3s ease;
}
.balance-chip.bump { transform: scale(1.12); border-color: var(--orange); }
.balance-chip .sat { color: var(--orange); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 18px; border-radius: 12px;
  background: var(--card2); border: 1px solid var(--line);
  font-weight: 700; min-height: 44px;
  transition: transform .08s ease, filter .15s ease, background .2s ease;
  user-select: none;
}
.btn:active { transform: scale(.96); }
.btn:hover { filter: brightness(1.12); }
.btn.primary { background: linear-gradient(135deg, var(--orange) 0%, #e07c00 100%); color: #14100a; border: none; box-shadow: 0 4px 18px rgba(247, 147, 26, .35); }
.btn.green { background: linear-gradient(135deg, var(--green), #14b984); color: #06231a; border: none; }
.btn.ghost { background: transparent; }
.btn.small { padding: 7px 12px; min-height: 36px; font-size: .9rem; }
.btn:disabled { opacity: .45; cursor: not-allowed; filter: none; transform: none; }
.btn.block { width: 100%; }

main { max-width: 640px; margin: 0 auto; padding: 14px 14px 90px; }

/* ticker */
.ticker-wrap { overflow: hidden; border: 1px solid var(--line); border-radius: 999px; background: var(--bg2); margin-bottom: 16px; height: 34px; display: flex; align-items: center; }
.ticker { display: inline-flex; gap: 26px; white-space: nowrap; animation: ticker 30s linear infinite; padding-left: 100%; }
.ticker span { font-size: .82rem; color: var(--muted); }
.ticker b { color: var(--green); }
@keyframes ticker { to { transform: translateX(-100%); } }
/* static welcome state when no real wins exist yet */
.ticker.static { animation: none; padding-left: 0; width: 100%; justify-content: center; }
.ticker.static span { color: var(--muted); }

/* game grid */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.game-card {
  position: relative; text-align: left;
  background: linear-gradient(160deg, var(--card) 0%, var(--bg2) 100%);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 56px 14px 16px; min-height: 148px;
  display: flex; flex-direction: column; gap: 4px; justify-content: flex-end;
  overflow: hidden;
  transition: transform .12s ease, border-color .2s ease;
}
.game-card:active { transform: scale(.97); }
.game-card:hover { border-color: #3a4358; }
.game-card .emoji { font-size: 1.9rem; position: absolute; top: 12px; left: 12px; filter: drop-shadow(0 4px 10px rgba(0,0,0,.4)); }
.game-card h3 { font-size: 1.02rem; }
.game-card p { font-size: .76rem; color: var(--muted); }
.game-card .edge { position: absolute; top: 10px; right: 10px; font-size: .66rem; color: var(--muted); background: rgba(0,0,0,.35); padding: 3px 7px; border-radius: 999px; }
.game-card.wide { grid-column: span 2; min-height: 84px; padding: 16px 14px; flex-direction: row; align-items: center; gap: 14px; }
.game-card.wide .emoji { position: static; }
.game-card.wide div { flex: 1; }

/* game view */
.view { display: none; }
.view.active { display: block; animation: pop-in .22s ease; }
@keyframes pop-in { from { opacity: 0; transform: translateY(8px) scale(.99); } }
.view-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.view-head h2 { font-size: 1.25rem; flex: 1; }
.view-head .edge-note { font-size: .72rem; color: var(--muted); }

.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 12px; }

/* bet controls */
.bet-row { display: flex; gap: 8px; align-items: center; margin: 10px 0; }
.bet-input {
  flex: 1; display: flex; align-items: center; gap: 6px;
  background: var(--bg2); border: 1px solid var(--line); border-radius: 12px; padding: 4px 6px 4px 14px;
}
.bet-input input { background: none; border: none; outline: none; width: 100%; font-size: 1.1rem; font-weight: 700; min-height: 40px; }
.bet-input .unit { color: var(--muted); font-size: .85rem; }
.chip-btns { display: flex; gap: 6px; }
.chip { background: var(--card2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; font-size: .82rem; font-weight: 700; min-height: 40px; }
.chip:active { transform: scale(.94); }

/* result banner */
.result {
  min-height: 54px; display: flex; align-items: center; justify-content: center; gap: 10px;
  border-radius: 12px; font-weight: 800; font-size: 1.05rem;
  background: var(--bg2); border: 1px dashed var(--line); color: var(--muted);
  transition: all .2s ease; text-align: center; padding: 8px;
}
.result.win { background: rgba(46, 230, 168, .12); border: 1px solid rgba(46, 230, 168, .5); color: var(--green); animation: win-pulse .5s ease; }
.result.lose { background: rgba(255, 84, 112, .1); border: 1px solid rgba(255, 84, 112, .4); color: var(--red); animation: shake .35s ease; }
/* break-even: payout == stake is neither a win nor a loss */
.result.push { background: var(--card2); border: 1px solid var(--line); color: var(--text); }
@keyframes win-pulse { 0% { transform: scale(.9); } 45% { transform: scale(1.06); } 100% { transform: scale(1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* dice */
.dice-display { font-size: 3.2rem; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; letter-spacing: 1px; margin: 6px 0 2px; }
.dice-display.rolling { color: var(--orange2); }
.range-row { display: flex; align-items: center; gap: 12px; margin: 12px 0; }
input[type=range] { flex: 1; accent-color: var(--orange); height: 34px; }
.dir-toggle { display: flex; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); }
.dir-toggle button { padding: 10px 16px; background: var(--bg2); font-weight: 700; min-height: 44px; }
.dir-toggle button.on { background: var(--orange); color: #14100a; }
.stat-row { display: flex; justify-content: space-between; font-size: .85rem; color: var(--muted); margin-top: 6px; }
.stat-row b { color: var(--text); font-variant-numeric: tabular-nums; }

canvas { display: block; width: 100%; border-radius: 12px; background: var(--bg2); touch-action: manipulation; }

/* crash */
.crash-mult { font-size: 3rem; font-weight: 900; text-align: center; font-variant-numeric: tabular-nums; margin: 4px 0; }
.crash-mult.alive { color: var(--green); }
.crash-mult.crashed { color: var(--red); animation: shake .35s ease; }
.crash-mult.cashed { color: var(--orange2); animation: win-pulse .5s ease; }

/* hilo */
.hilo-table { display: flex; align-items: center; justify-content: center; gap: 16px; margin: 10px 0; }
.playing-card {
  width: 96px; height: 132px; border-radius: 12px;
  background: linear-gradient(150deg, #fefaf3, #e8dcc8);
  color: #1b1408; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 900; font-size: 2.2rem; box-shadow: var(--shadow);
  transition: transform .3s ease; position: relative;
}
.playing-card .blk { font-size: .6rem; letter-spacing: 1.5px; color: #8a6f3c; }
.playing-card.flip { animation: flip .4s ease; }
@keyframes flip { 0% { transform: rotateY(90deg) scale(.9); } 100% { transform: rotateY(0); } }
.hilo-streak { display: flex; gap: 5px; justify-content: center; flex-wrap: wrap; margin: 8px 0; min-height: 22px; }
.hilo-streak .dot { width: 18px; height: 18px; border-radius: 6px; background: var(--card2); border: 1px solid var(--line); font-size: .6rem; display: flex; align-items: center; justify-content: center; color: var(--muted); }
.hilo-streak .dot.hit { background: rgba(46,230,168,.25); border-color: var(--green); color: var(--green); }
.hilo-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hilo-actions .cash { grid-column: span 2; }

/* spin wheel */
.wheel-wrap { position: relative; width: 260px; margin: 10px auto; }
.wheel-pointer { position: absolute; top: -6px; left: 50%; transform: translateX(-50%); font-size: 1.6rem; z-index: 2; filter: drop-shadow(0 2px 4px rgba(0,0,0,.6)); }
#wheel { border-radius: 50%; }

/* plinko */
.plinko-mults { display: flex; gap: 2px; margin-top: 4px; }
.plinko-mults span { flex: 1; text-align: center; font-size: .56rem; padding: 4px 0; border-radius: 6px; background: var(--card2); color: var(--muted); font-weight: 700; transition: all .2s; }
.plinko-mults span.hit { background: var(--orange); color: #14100a; transform: scale(1.15); }

/* modal */
.modal-back {
  position: fixed; inset: 0; background: rgba(5, 6, 9, .7); backdrop-filter: blur(6px);
  display: none; align-items: flex-end; justify-content: center; z-index: 100;
}
.modal-back.open { display: flex; }
.modal {
  width: 100%; max-width: 480px; max-height: 88vh; overflow-y: auto;
  background: var(--bg2); border: 1px solid var(--line);
  border-radius: 20px 20px 0 0; padding: 20px 18px 30px;
  animation: slide-up .25s ease;
}
@media (min-width: 560px) { .modal-back { align-items: center; } .modal { border-radius: 20px; } }
@keyframes slide-up { from { transform: translateY(40px); opacity: 0; } }
.modal h2 { margin-bottom: 6px; }
.modal .sub { color: var(--muted); font-size: .85rem; margin-bottom: 14px; }
.modal-close { position: sticky; float: right; top: 0; font-size: 1.4rem; color: var(--muted); padding: 4px 10px; }
.field { margin: 12px 0; }
.field label { display: block; font-size: .8rem; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; outline: none; min-height: 48px;
}
.field input:focus { border-color: var(--orange); }
.qr-box { background: #fff; border-radius: 16px; padding: 12px; width: fit-content; margin: 14px auto; }
.qr-box svg { display: block; width: 240px; height: 240px; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .72rem; word-break: break-all; color: var(--muted); background: var(--card); border-radius: 10px; padding: 10px; }
.pending-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--orange); animation: blink 1s ease infinite; margin-right: 6px; }
@keyframes blink { 50% { opacity: .25; } }

/* toast — anchored to the TOP so it never covers bottom forms/inputs or the tab bar */
#toasts { position: fixed; top: 66px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
#toasts .toast { pointer-events: auto; }
.toast {
  background: var(--card2); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 14px; font-size: .9rem; box-shadow: var(--shadow);
  animation: slide-up .25s ease;
}
.toast.err { border-color: rgba(255, 84, 112, .5); }
.toast.ok { border-color: rgba(46, 230, 168, .5); }

/* bottom nav */
nav.bottom {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex; justify-content: space-around;
  background: rgba(12, 14, 19, .92); backdrop-filter: blur(12px);
  border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
}
nav.bottom button { display: flex; flex-direction: column; align-items: center; gap: 2px; font-size: .62rem; color: var(--muted); padding: 6px 10px; border-radius: 10px; min-width: 58px; }
nav.bottom button .ico { font-size: 1.25rem; }
nav.bottom button.on { color: var(--orange); background: rgba(247, 147, 26, .1); }

.footer-note { text-align: center; color: var(--muted); font-size: .72rem; margin-top: 26px; }
.hidden { display: none !important; }

/* history table */
table.hist { width: 100%; border-collapse: collapse; font-size: .8rem; }
table.hist th, table.hist td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); }
table.hist th { color: var(--muted); font-weight: 600; font-size: .7rem; text-transform: uppercase; letter-spacing: .5px; }
.win-txt { color: var(--green); font-weight: 700; }
.lose-txt { color: var(--red); }
/* break-even in the recent-plays table: neutral, not a loss */
.push-txt { color: var(--muted); font-weight: 700; }

/* verify page */
.verify-out { font-family: ui-monospace, Menlo, monospace; font-size: .8rem; background: var(--card); border-radius: 10px; padding: 12px; margin-top: 10px; white-space: pre-wrap; word-break: break-all; }

/* count-up header balance number */
.big-balance { font-size: 2.2rem; font-weight: 900; font-variant-numeric: tabular-nums; }

/* ---- zero-balance onboarding / broke hero ---- */
.zero-hero {
  display: flex; align-items: center; gap: 14px;
  background: linear-gradient(135deg, rgba(46,230,168,.14), rgba(247,147,26,.10));
  border: 1px solid rgba(46,230,168,.4); border-radius: var(--radius);
  padding: 14px 16px; margin-bottom: 16px;
  animation: pop-in .3s ease;
}
.zero-hero.broke { background: linear-gradient(135deg, rgba(247,147,26,.14), rgba(157,123,255,.10)); border-color: rgba(247,147,26,.45); }
.zero-hero .hero-emoji { font-size: 2rem; line-height: 1; }
.zero-hero .hero-copy { flex: 1; min-width: 0; }
.zero-hero .hero-copy h3 { font-size: 1rem; }
.zero-hero .hero-copy p { font-size: .8rem; color: var(--muted); margin-top: 2px; }
.zero-hero .btn { flex-shrink: 0; }
.zero-hero .hero-sub { display: block; font-size: .72rem; color: var(--muted); margin-top: 6px; }
/* de-emphasise the header Deposit CTA while the player has 0 sats */
body.at-zero #depositBtn { background: transparent; color: var(--text); border: 1px solid var(--line); box-shadow: none; }

/* ---- spin retention: streak, countdown, odds table ---- */
.spin-layout { display: flex; gap: 18px; align-items: center; justify-content: center; flex-wrap: wrap; }
.spin-side { flex: 1; min-width: 180px; max-width: 300px; text-align: left; }
.spin-streak { display: inline-flex; align-items: center; gap: 6px; font-size: .82rem; font-weight: 700; color: var(--orange2); background: rgba(247,147,26,.12); border: 1px solid rgba(247,147,26,.35); border-radius: 999px; padding: 5px 12px; margin-bottom: 10px; }
.odds-table { border: 1px solid var(--line); border-radius: 12px; overflow: hidden; background: var(--bg2); }
.odds-table .odds-head { font-size: .68rem; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); padding: 8px 12px; border-bottom: 1px solid var(--line); }
.odds-table .odds-row { display: flex; align-items: center; gap: 8px; padding: 4px 12px; font-size: .78rem; }
.odds-table .odds-row:nth-child(even) { background: rgba(255,255,255,.02); }
.odds-table .odds-row .op { width: 46px; color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.odds-table .odds-row .obar { flex: 1; height: 7px; border-radius: 4px; background: var(--card2); overflow: hidden; }
.odds-table .odds-row .obar i { display: block; height: 100%; background: linear-gradient(90deg, var(--orange), var(--orange2)); }
.odds-table .odds-row .opct { width: 44px; text-align: right; color: var(--muted); font-variant-numeric: tabular-nums; }
.spin-countdown { margin-top: 10px; font-size: .85rem; color: var(--muted); text-align: center; }
.spin-countdown b { color: var(--orange2); font-variant-numeric: tabular-nums; }

/* ---- small honesty notes under game controls ---- */
.game-note { font-size: .74rem; color: var(--muted); text-align: center; margin-top: 8px; }
.game-note.warn { color: var(--orange2); }

/* ---- desktop side navigation ---- */
.shell { display: block; }
.side-nav { display: none; }

@media (min-width: 900px) {
  main { padding-bottom: 40px; }
  nav.bottom { display: none; }
  .shell {
    display: flex; gap: 32px; justify-content: center;
    max-width: 1280px; margin: 0 auto; padding: 26px 28px 40px; align-items: flex-start;
  }
  .side-nav {
    display: flex; flex-direction: column; gap: 6px;
    width: 232px; flex-shrink: 0;
    position: sticky; top: 82px; align-self: flex-start;
  }
  .side-nav .nav-title { font-size: .68rem; text-transform: uppercase; letter-spacing: 1px; color: var(--muted); padding: 4px 12px 8px; }
  .side-nav button {
    display: flex; align-items: center; gap: 12px; text-align: left;
    padding: 12px 14px; border-radius: 12px; font-weight: 700; font-size: .95rem;
    color: var(--muted); border: 1px solid transparent; min-height: 48px;
    transition: background .15s ease, color .15s ease;
  }
  .side-nav button .ico { font-size: 1.2rem; width: 24px; text-align: center; }
  .side-nav button:hover { background: var(--card); color: var(--text); }
  .side-nav button.on { background: rgba(247,147,26,.12); color: var(--orange); border-color: rgba(247,147,26,.3); }
  .side-nav .side-foot { margin-top: 12px; padding: 12px; border-top: 1px solid var(--line); font-size: .74rem; color: var(--muted); }
  .side-nav .side-foot a { display: block; margin-bottom: 6px; }
  main { max-width: 960px; margin: 0; padding: 0; flex: 1 1 auto; min-width: 0; }
  /* use the horizontal space: three-across game grid */
  .grid { grid-template-columns: repeat(3, 1fr); gap: 16px; }
  .game-card { min-height: 168px; padding: 60px 18px 18px; }
  .game-card.wide { grid-column: span 2; min-height: 0; }
  .game-card h3 { font-size: 1.1rem; }
  .game-card p { font-size: .82rem; }
  /* larger game surfaces */
  .panel { padding: 22px; }
  .dice-display { font-size: 4rem; }
  .crash-mult { font-size: 3.6rem; }
  .playing-card { width: 120px; height: 166px; font-size: 2.8rem; }
  .wheel-wrap { width: 320px; }
  #wheel { width: 320px !important; height: 320px !important; }
  #toasts { top: 78px; }
}

@media (max-width: 380px) {
  .grid { grid-template-columns: 1fr; }
  .game-card.wide { grid-column: span 1; }
  .zero-hero { flex-wrap: wrap; }
  .zero-hero .btn { width: 100%; }
}
