:root {
  --bg: #0f1a14; --bg2: #16251c; --card: #1b2e23; --line: #2b4536;
  --text: #eef5f0; --muted: #a9bfb1; --gold: #f2c14e; --gold-d: #d9a62e; --green: #3ddc84; --red: #ff6b6b;
  --radius: 14px; --max: 1080px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); line-height: 1.55; min-height: 100vh; display: flex; flex-direction: column; }
main { flex: 1; width: 100%; max-width: var(--max); margin: 0 auto; padding: 1.25rem 1rem 3rem; }
a { color: var(--gold); }
a:hover { color: #ffd77a; }
img, svg { max-width: 100%; }
h1, h2, h3 { line-height: 1.2; }
h1 { font-size: clamp(1.8rem, 5vw, 2.8rem); margin: .5rem 0 .75rem; }
.skip { position: absolute; left: -999px; top: 0; background: var(--gold); color: #000; padding: .5rem 1rem; z-index: 10; }
.skip:focus { left: .5rem; }
:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* header */
.site-header { position: sticky; top: 0; z-index: 5; background: rgba(15,26,20,.95); border-bottom: 1px solid var(--line); padding-top: env(safe-area-inset-top); }
.site-header .inner { max-width: var(--max); margin: 0 auto; display: flex; align-items: center; gap: .75rem; padding: .6rem 1rem; }
.brand { display: flex; align-items: center; gap: .5rem; font-weight: 800; font-size: 1.2rem; color: var(--text); text-decoration: none; }
.brand .logo { width: 32px; height: 32px; }
.nav { margin-left: auto; display: flex; gap: .5rem; align-items: center; flex-wrap: wrap; }
.nav a { text-decoration: none; color: var(--text); padding: .45rem .6rem; border-radius: 8px; }
.nav a:hover, .nav a[aria-current="page"] { background: var(--card); }
.balance-pill { background: var(--card); border: 1px solid var(--line); border-radius: 999px; padding: .35rem .8rem; font-weight: 700; color: var(--gold); white-space: nowrap; }

/* buttons & forms */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; min-height: 44px; padding: .6rem 1.1rem; border-radius: 10px; border: 1px solid transparent; font: inherit; font-weight: 700; cursor: pointer; text-decoration: none; }
.btn-primary { background: var(--gold); color: #1a1200; }
.btn-primary:hover { background: #ffd56a; color: #1a1200; }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line); }
.btn-ghost:hover { background: var(--card); color: var(--text); }
.btn-danger { background: transparent; color: var(--red); border-color: var(--red); }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }
form { display: grid; gap: .9rem; }
label { display: grid; gap: .3rem; font-weight: 600; }
.hint { font-weight: 400; color: var(--muted); font-size: .9rem; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line); border-radius: 10px; padding: .7rem .8rem; min-height: 44px; width: 100%; }
textarea { min-height: 140px; resize: vertical; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-weight: 400; }
.check input { width: 22px; height: 22px; min-height: 0; margin-top: .15rem; flex: none; }
.hp { position: absolute; left: -5000px; }

/* layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.25rem; }
.grid { display: grid; gap: 1rem; }
@media (min-width: 720px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }
/* Game lobby: always three games per row; compact tiles on phones. */
#game-list { grid-template-columns: repeat(3, minmax(0, 1fr)); }
@media (max-width: 719px) {
  #game-list { gap: .5rem; }
  #game-list .game-card { padding: .6rem .45rem; gap: .25rem; text-align: center; justify-items: center; }
  #game-list .game-card .art { font-size: 1.5rem; letter-spacing: -.1em; }
  #game-list .game-card strong { font-size: .82rem; line-height: 1.15; }
  #game-list .game-card .meta { font-size: .68rem; line-height: 1.2; }
}
.narrow { max-width: 460px; margin: 0 auto; }
.hero { padding: 1.5rem 0 1rem; }
.hero p { color: var(--muted); font-size: 1.1rem; max-width: 40rem; }
.hero .cta { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1rem; }
.game-card { display: grid; gap: .4rem; text-decoration: none; color: var(--text); }
a.game-card:hover { border-color: var(--gold); color: var(--text); }
.game-card .art { font-size: 2.5rem; }
.game-card .meta { color: var(--muted); font-size: .9rem; }
.badge { display: inline-block; font-size: .75rem; font-weight: 700; padding: .15rem .5rem; border-radius: 999px; background: var(--bg2); color: var(--muted); border: 1px solid var(--line); }
.badge.ok { color: var(--green); border-color: var(--green); }
.badge.warn { color: var(--gold); border-color: var(--gold); }
.badge.bad { color: var(--red); border-color: var(--red); }
.notice { border-left: 4px solid var(--gold); background: var(--bg2); padding: .75rem 1rem; border-radius: 8px; }
.notice.error { border-color: var(--red); }
.notice.success { border-color: var(--green); }
.muted { color: var(--muted); }
.tabs { display: flex; gap: .5rem; flex-wrap: wrap; margin-bottom: 1rem; }
.tabs button[aria-selected="true"] { background: var(--gold); color: #1a1200; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; padding: .55rem .4rem; border-bottom: 1px solid var(--line); }
.table-wrap { overflow-x: auto; }
.amounts { display: flex; gap: .5rem; flex-wrap: wrap; }
.amounts button { flex: 1 1 70px; }

/* slot */
.slot { display: grid; gap: 1rem; justify-items: center; text-align: center; }
.reels { display: grid; grid-template-columns: repeat(3, minmax(70px, 120px)); gap: .6rem; background: var(--bg2); padding: 1rem; border-radius: var(--radius); border: 2px solid var(--gold-d); }
.reel { aspect-ratio: 1; display: grid; place-items: center; font-size: clamp(2.4rem, 11vw, 4rem); background: #0b130e; border-radius: 10px; }
.reels.spinning .reel { animation: blur .12s linear infinite; }
@keyframes blur { 50% { transform: translateY(-6px); opacity: .6; } }
@media (prefers-reduced-motion: reduce) { .reels.spinning .reel { animation: none; opacity: .6; } }
/* 5-reel grid games (3 or 4 rows); cells are laid out row by row */
.reels.grid5 { grid-template-columns: repeat(5, minmax(40px, 1fr)); width: 100%; max-width: 520px; gap: .35rem; padding: .6rem; }
.reels.grid5 .reel { font-size: clamp(1.3rem, 6.5vw, 2.4rem); border-radius: 8px; }
.reel.hit { box-shadow: inset 0 0 0 3px var(--gold), 0 0 14px var(--gold); animation: pop .45s ease 2; }
@keyframes pop { 50% { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .reel.hit { animation: none; } }
.line-wins { font-size: .9rem; color: var(--muted); min-height: 1.2em; }
/* Rocket Rise (crash) */
.crash { width: 100%; max-width: 520px; display: grid; gap: .8rem; }
.crash-screen { position: relative; height: clamp(170px, 42vw, 230px); border-radius: var(--radius); border: 2px solid var(--gold-d); overflow: hidden;
  background: linear-gradient(180deg, #050a14 0%, #0b1a2e 60%, #10261b 100%); }
/* The multiplier sits in a band at the top; the rocket flies below it and always stays inside the screen. */
.crash-mult { position: absolute; top: .4rem; left: 0; right: 0; text-align: center; font-size: clamp(2rem, 11vw, 3.4rem); font-weight: 800; color: var(--text); text-shadow: 0 2px 12px #000; z-index: 1; }
.crash-rocket { position: absolute; left: 6%; bottom: 6%; font-size: clamp(1.8rem, 8vw, 2.4rem); line-height: 1; transition: left .1s linear, bottom .1s linear; }
/* Crash mode: the rocket screen, the result and the Start / Cash out button stay together at the top of the card. */
.slot.is-crash > * { order: 10; }
.slot.is-crash > #crash-panel { order: 1; }
.slot.is-crash > #win { order: 2; min-height: 1.4em; font-size: 1.05rem; }
.slot.is-crash > #spin { order: 3; font-size: 1.2rem; padding-block: .9rem; }
.slot.is-crash > .bet-row { order: 4; }
.slot.is-crash > #crash-extra { order: 5; }
.crash-screen.flying .crash-mult { color: var(--gold); }
.crash-screen.cashed .crash-mult { color: var(--green); }
.crash-screen.crashed .crash-mult { color: #ff5a5a; }
.crash-screen.crashed .crash-rocket { opacity: .3; }
.crash-history { display: flex; gap: .35rem; flex-wrap: wrap; justify-content: center; min-height: 1.6em; }
.crash-history .badge { font-variant-numeric: tabular-nums; }
.slot-tools { display: flex; gap: .5rem; justify-content: center; flex-wrap: wrap; }
.bet-row { display: flex; gap: .5rem; align-items: center; justify-content: center; flex-wrap: wrap; }
.bet-row output { min-width: 7ch; font-weight: 800; font-size: 1.2rem; }
.win { font-size: 1.3rem; font-weight: 800; color: var(--green); min-height: 1.6em; }
.paytable td:last-child { text-align: right; font-weight: 700; }

/* prose / legal */
.prose { max-width: 760px; }
.prose h2 { margin-top: 2rem; font-size: 1.3rem; }
.prose li { margin: .3rem 0; }

/* footer */
.site-footer { border-top: 1px solid var(--line); background: var(--bg2); padding: 1.5rem 1rem calc(1.5rem + env(safe-area-inset-bottom)); font-size: .9rem; color: var(--muted); }
.site-footer .inner { max-width: var(--max); margin: 0 auto; display: grid; gap: 1rem; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: .4rem 1rem; }
.site-footer a { color: var(--text); }
.age { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--red); color: var(--text); font-weight: 800; font-size: .8rem; }
[hidden] { display: none !important; }
.steps { padding-left: 1.2rem; }

/* v2 additions */
dialog { background: var(--card); color: var(--text); border: 1px solid var(--gold-d); border-radius: var(--radius); max-width: 440px; width: calc(100% - 2rem); padding: 1.5rem; }
dialog::backdrop { background: rgba(0,0,0,.75); }
.cta { display: flex; gap: .6rem; flex-wrap: wrap; }
.featured { display: grid; gap: .5rem; justify-items: start; text-decoration: none; color: var(--text); border: 2px solid var(--gold); background: linear-gradient(135deg, #1b2e23, #24402f); padding: 1.5rem; margin-bottom: 1.5rem; }
.featured:hover { color: var(--text); border-color: #ffd77a; }
.featured .art { font-size: 3rem; }
.featured-title { font-size: 1.6rem; }
fieldset { border: 1px solid var(--line); border-radius: 10px; display: grid; gap: .6rem; padding: .8rem; }
legend { padding: 0 .4rem; font-weight: 700; }
.fair { width: 100%; text-align: left; border-top: 1px solid var(--line); padding-top: .6rem; }
.fair summary { cursor: pointer; font-weight: 700; }
.small { font-size: .85rem; overflow-wrap: anywhere; }
code { font-size: .85em; overflow-wrap: anywhere; }
form.inline { display: grid; gap: .5rem; }
.admin-nav { display: flex; gap: .4rem; flex-wrap: wrap; margin: 1rem 0; }
.admin-nav button[aria-current="true"] { background: var(--gold); color: #1a1200; }
.kpis { display: grid; gap: .75rem; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); }
.kpis .card strong { display: block; font-size: 1.3rem; color: var(--gold); }
