/* ==========================================================================
   Casino Royale — app stylesheet
   Mobile-first, app-like shell. No inline styles anywhere (strict CSP).
   ========================================================================== */

@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("../fonts/inter-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 500; font-display: swap; src: url("../fonts/inter-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/inter-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/inter-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 800; font-display: swap; src: url("../fonts/inter-latin-800-normal.woff2") format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 600; font-display: swap; src: url("../fonts/playfair-display-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 700; font-display: swap; src: url("../fonts/playfair-display-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Playfair Display"; font-style: normal; font-weight: 800; font-display: swap; src: url("../fonts/playfair-display-latin-800-normal.woff2") format("woff2"); }

:root {
  --bg: #050d0a;
  --bg-2: #0a1712;
  --bg-3: #0f2119;
  --surface: rgba(255, 255, 255, 0.035);
  --surface-2: rgba(255, 255, 255, 0.06);
  --surface-solid: #0f1f18;
  --border: rgba(212, 175, 55, 0.16);
  --border-strong: rgba(212, 175, 55, 0.38);
  --line: rgba(255, 255, 255, 0.08);
  --gold: #d4af37;
  --gold-2: #f3d27a;
  --gold-3: #9c7a1c;
  --text: #f4efe2;
  --muted: #9fb0a7;
  --faint: #6b7d74;
  --felt: #0b5d3b;
  --red: #c8202f;
  --red-2: #ff5a67;
  --black: #15171a;
  --green: #0f8a52;
  --pos: #3ddc84;
  --neg: #ff6b6b;
  --warn: #f5b942;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --display: "Playfair Display", Georgia, "Times New Roman", serif;
  --topbar-h: 60px;
  --tabbar-h: 64px;
  --sidenav-w: 232px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: none;
}
img, svg, canvas { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
code, pre { font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 0.86em; }
code { background: rgba(255, 255, 255, 0.06); border-radius: 6px; padding: 0.1em 0.4em; }
pre { background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 14px; overflow-x: auto; }
pre code { background: none; padding: 0; }
hr.divider { border: 0; border-top: 1px solid var(--line); margin: 20px 0; }
[hidden] { display: none !important; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.ico { width: 20px; height: 20px; flex: none; }
.ico-lg { width: 32px; height: 32px; }
.ico-xl { width: 64px; height: 64px; margin: 0 auto; color: var(--gold); }
.skip-link { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--gold); color: #000; padding: 8px 14px; border-radius: 8px; }
.skip-link:focus { left: 8px; }
:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }

/* Typography ------------------------------------------------------------- */
h1, h2, h3, h4, h5 { margin: 0 0 0.5em; line-height: 1.2; font-weight: 700; }
.display { font-family: var(--display); font-size: clamp(2.4rem, 7vw, 4.8rem); font-weight: 800; letter-spacing: -0.02em; line-height: 1.02; margin: 0.2em 0 0.3em; }
.h2 { font-family: var(--display); font-size: clamp(1.5rem, 4vw, 2rem); }
.h3 { font-size: 1.25rem; }
.h4 { font-size: 1.05rem; }
.h5 { font-size: 0.95rem; }
.page-title { font-family: var(--display); font-size: clamp(1.6rem, 4.5vw, 2.3rem); margin: 0; }
.eyebrow { text-transform: uppercase; letter-spacing: 0.14em; font-size: 0.72rem; font-weight: 700; color: var(--gold); margin: 0 0 4px; }
.lead { font-size: clamp(1rem, 2.4vw, 1.2rem); color: #d6dccf; max-width: 38rem; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.gold { color: var(--gold-2); }
.pos { color: var(--pos); }
.neg { color: var(--neg); }
.nowrap { white-space: nowrap; }
.break { word-break: break-all; }
.truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.link { color: var(--gold-2); font-weight: 600; }
.link:hover { text-decoration: underline; }
.mt { margin-top: 20px; }
.prose p, .prose li { color: #d3dacf; }
.prose ol, .prose ul { padding-left: 1.2em; }
.prose li { margin: 0.4em 0; }
.bullets { padding-left: 1.2em; margin: 0; }

/* Buttons ---------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px; padding: 0 18px; border-radius: 999px; border: 1px solid transparent;
  font-weight: 700; font-size: 0.92rem; letter-spacing: 0.01em; white-space: nowrap;
  transition: transform 0.12s ease, filter 0.2s ease, background 0.2s ease, border-color 0.2s ease;
  user-select: none;
}
.btn:active { transform: scale(0.97); }
.btn[disabled], .btn.is-loading { opacity: 0.55; pointer-events: none; }
.btn-gold { background: linear-gradient(180deg, var(--gold-2), var(--gold) 55%, var(--gold-3)); color: #1b1404; box-shadow: 0 6px 18px rgba(212, 175, 55, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.45); }
.btn-gold:hover { filter: brightness(1.07); }
.btn-ghost { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-ghost:hover { border-color: var(--border-strong); background: var(--surface-2); }
.btn-danger { background: linear-gradient(180deg, #e04050, #a3131f); color: #fff; }
.btn-sm { min-height: 34px; padding: 0 14px; font-size: 0.82rem; }
.btn-lg { min-height: 52px; padding: 0 28px; font-size: 1rem; }
.btn-block { width: 100%; }
.btn-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.icon-btn {
  display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 12px;
  background: var(--surface); border: 1px solid var(--line); color: var(--text);
}
.icon-btn:hover { border-color: var(--border-strong); }

/* Badges & numbers ------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.02em; background: var(--surface-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.badge .ico { width: 12px; height: 12px; }
.badge-gold { background: rgba(212, 175, 55, 0.14); color: var(--gold-2); border-color: rgba(212, 175, 55, 0.3); }
.badge-green { background: rgba(61, 220, 132, 0.12); color: var(--pos); border-color: rgba(61, 220, 132, 0.25); }
.badge-red { background: rgba(255, 90, 103, 0.13); color: #ff8a93; border-color: rgba(255, 90, 103, 0.28); }
.badge-muted { color: var(--muted); }
.num { display: inline-grid; place-items: center; min-width: 34px; height: 34px; padding: 0 6px; border-radius: 50%; font-weight: 800; font-size: 0.9rem; color: #fff; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.4); }
.num-sm { min-width: 26px; height: 26px; font-size: 0.75rem; }
.num-lg { min-width: 64px; height: 64px; font-size: 1.6rem; }
.num-red { background: radial-gradient(circle at 35% 30%, #ff4d5b, var(--red) 60%, #7c0d17); }
.num-black { background: radial-gradient(circle at 35% 30%, #4a4f57, var(--black) 65%); }
.num-green { background: radial-gradient(circle at 35% 30%, #28c07a, var(--green) 60%, #054a2a); }

/* Avatars ---------------------------------------------------------------- */
.avatar { display: inline-grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; font-weight: 800; font-size: 0.85rem; color: #fff; flex: none; border: 2px solid rgba(255, 255, 255, 0.15); text-transform: uppercase; }
.avatar-sm { width: 34px; height: 34px; font-size: 0.75rem; }
.avatar-lg { width: 64px; height: 64px; font-size: 1.3rem; }
.hue-0 { background: linear-gradient(135deg, #c0392b, #7b1d14); } .hue-1 { background: linear-gradient(135deg, #d35400, #7e3200); }
.hue-2 { background: linear-gradient(135deg, #c9a227, #6f5a10); } .hue-3 { background: linear-gradient(135deg, #7fae1d, #3f5a0c); }
.hue-4 { background: linear-gradient(135deg, #27ae60, #135c32); } .hue-5 { background: linear-gradient(135deg, #16a085, #0a5446); }
.hue-6 { background: linear-gradient(135deg, #1abc9c, #0d6555); } .hue-7 { background: linear-gradient(135deg, #2980b9, #144466); }
.hue-8 { background: linear-gradient(135deg, #3f51b5, #1f2864); } .hue-9 { background: linear-gradient(135deg, #8e44ad, #4a2160); }
.hue-10 { background: linear-gradient(135deg, #c2185b, #680c30); } .hue-11 { background: linear-gradient(135deg, #e84393, #7c1e4c); }

/* App shell -------------------------------------------------------------- */
.app { min-height: 100dvh; background: radial-gradient(1200px 600px at 80% -10%, rgba(15, 138, 82, 0.16), transparent 60%), radial-gradient(900px 500px at -10% 110%, rgba(212, 175, 55, 0.08), transparent 60%), var(--bg); }
.shell { min-height: 100dvh; }
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 12px;
  height: calc(var(--topbar-h) + var(--safe-top)); padding: var(--safe-top) max(16px, var(--safe-right)) 0 max(16px, var(--safe-left));
  background: rgba(5, 13, 10, 0.82); backdrop-filter: blur(16px) saturate(140%); -webkit-backdrop-filter: blur(16px) saturate(140%);
  border-bottom: 1px solid var(--border);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 1.15rem; letter-spacing: 0.01em; }
.brand-mark svg { width: 32px; height: 32px; }
.brand-lg { font-size: 1.5rem; justify-content: center; }
.brand-lg .brand-mark svg { width: 44px; height: 44px; }
.brand .badge { font-family: var(--font); margin-left: 4px; }
.topbar .brand-name { white-space: nowrap; }
@media (max-width: 440px) {
  .topbar .brand-name { display: none; }
  .admin .role-tag { display: none; }
}
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.balance-pill { display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 14px 0 8px; border-radius: 999px; background: linear-gradient(180deg, rgba(212, 175, 55, 0.18), rgba(212, 175, 55, 0.06)); border: 1px solid var(--border-strong); font-weight: 800; font-variant-numeric: tabular-nums; }
.balance-pill .ico { width: 24px; height: 24px; }
.role-tag { font-size: 0.75rem; color: var(--gold-2); font-weight: 700; }

.sidenav { display: none; }
.main { padding: 18px max(16px, var(--safe-left)) calc(var(--tabbar-h) + var(--safe-bottom) + 24px) max(16px, var(--safe-right)); max-width: 1240px; margin: 0 auto; }
.admin .main { padding-bottom: 40px; }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  display: grid; grid-template-columns: repeat(5, 1fr);
  height: calc(var(--tabbar-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom);
  background: rgba(7, 16, 12, 0.92); backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  border-top: 1px solid var(--border);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 0.68rem; font-weight: 600; color: var(--faint); position: relative; }
.tab .ico { width: 23px; height: 23px; }
.tab.is-active { color: var(--gold-2); }
.tab:focus-visible { outline: 2px solid var(--gold-2); outline-offset: -4px; border-radius: 12px; }
.tab.is-active::before { content: ""; position: absolute; top: 0; width: 28px; height: 3px; border-radius: 0 0 4px 4px; background: var(--gold); }

.nav-link { display: flex; align-items: center; gap: 12px; width: 100%; padding: 11px 14px; border-radius: 12px; color: var(--muted); font-weight: 600; font-size: 0.92rem; border: 0; background: none; text-align: left; }
.nav-link:hover { background: var(--surface); color: var(--text); }
.nav-link.is-active { background: linear-gradient(90deg, rgba(212, 175, 55, 0.16), rgba(212, 175, 55, 0.02)); color: var(--gold-2); box-shadow: inset 3px 0 0 var(--gold); }
.nav-muted { font-size: 0.85rem; }
.nav-spacer { flex: 1; }
.nav-scrim { display: none; }

.only-mobile { display: inline-grid; }
.hide-sm { display: none; }

/* Admin nav on mobile = slide-over drawer */
.admin .sidenav {
  display: flex; flex-direction: column; gap: 2px;
  position: fixed; top: calc(var(--topbar-h) + var(--safe-top)); bottom: 0; left: 0; width: 270px; z-index: 40;
  padding: 14px 12px calc(14px + var(--safe-bottom)); overflow-y: auto;
  background: var(--bg-2); border-right: 1px solid var(--border);
  transform: translateX(-102%); transition: transform 0.25s ease;
}
.admin.nav-open .sidenav { transform: none; }
@media (max-width: 959.98px) { .admin:not(.nav-open) .sidenav { visibility: hidden; transition: transform 0.25s ease, visibility 0s linear 0.25s; } .admin.nav-open .sidenav { visibility: visible; transition: transform 0.25s ease; } }
.admin.nav-open .nav-scrim { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(0, 0, 0, 0.55); }

@media (min-width: 640px) {
  .hide-sm { display: inline; }
}
@media (min-width: 960px) {
  .only-mobile { display: none; }
  .tabbar { display: none; }
  .shell { display: grid; grid-template-columns: var(--sidenav-w) 1fr; grid-template-rows: auto 1fr; }
  .topbar { grid-column: 1 / -1; }
  .sidenav, .admin .sidenav {
    display: flex; flex-direction: column; gap: 2px; position: sticky; top: calc(var(--topbar-h) + var(--safe-top));
    height: calc(100dvh - var(--topbar-h) - var(--safe-top)); padding: 18px 12px; transform: none; width: auto;
    border-right: 1px solid var(--line); background: transparent; overflow-y: auto;
  }
  .main { padding: 28px 32px 48px; width: 100%; }
  .admin.nav-open .nav-scrim { display: none; }
}

/* Page furniture --------------------------------------------------------- */
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.page-narrow { max-width: 780px; margin: 0 auto; }
.profile-head { display: flex; align-items: center; gap: 16px; }
.profile-head p { margin: 2px 0 0; }
.section-title { font-family: var(--display); font-size: 1.3rem; margin: 28px 0 14px; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.badges { display: flex; gap: 6px; flex-wrap: wrap; }
.empty { color: var(--muted); text-align: center; padding: 22px 8px; }
.app-footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; margin-top: 40px; padding-top: 18px; border-top: 1px solid var(--line); color: var(--faint); font-size: 0.78rem; }
.app-footer a:hover { color: var(--gold-2); }

.card { background: linear-gradient(180deg, rgba(255, 255, 255, 0.045), rgba(255, 255, 255, 0.02)); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; margin-bottom: 18px; box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head h2, .card-head h3 { margin: 0; }
.grid { display: grid; gap: 16px; }
.grid > * { min-width: 0; }
.grid > .card { margin-bottom: 0; }
.grid + .card, .grid + .grid, .card + .grid { margin-top: 18px; }
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1024px) {
  .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .grid-3-1 { grid-template-columns: minmax(0, 2fr) minmax(0, 1fr); }
}
.stats-row { grid-template-columns: repeat(2, minmax(0, 1fr)); margin-bottom: 18px; }
@media (min-width: 1024px) { .stats-row.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } .stats-row.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.stat { background: linear-gradient(160deg, rgba(212, 175, 55, 0.08), rgba(255, 255, 255, 0.02) 60%); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.stat-label { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); font-weight: 700; }
.stat-value { font-size: clamp(1.15rem, 3.5vw, 1.6rem); font-weight: 800; font-variant-numeric: tabular-nums; overflow: hidden; text-overflow: ellipsis; }
.stat-sub { font-size: 0.78rem; color: var(--faint); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; margin: 0 0 16px; }
.kv dt { color: var(--muted); font-size: 0.85rem; }
.kv dd { margin: 0; font-weight: 600; text-align: right; }
.kv-stack { grid-template-columns: 1fr; gap: 2px; }
.kv-stack dd { text-align: left; margin-bottom: 10px; }
.kv-inline dd { text-align: left; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.list li:last-child { border-bottom: 0; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; padding: 4px; background: var(--surface); border: 1px solid var(--line); border-radius: 22px; }
.tab-link { flex: 1 0 auto; text-align: center; padding: 7px 14px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; color: var(--muted); white-space: nowrap; }
.tab-link.is-active { background: var(--gold); color: #1b1404; }

.callout { background: rgba(212, 175, 55, 0.07); border: 1px solid var(--border); border-left: 3px solid var(--gold); border-radius: var(--radius-sm); padding: 12px 14px; margin: 0 0 18px; color: #e6e1d2; font-size: 0.92rem; }
.callout-warning { border-left-color: var(--warn); background: rgba(245, 185, 66, 0.08); }
.callout-error { border-left-color: var(--neg); background: rgba(255, 107, 107, 0.08); }
.callout-success { border-left-color: var(--pos); background: rgba(61, 220, 132, 0.07); }
.callout-row { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: center; justify-content: space-between; }
.callout-row p { margin: 0; flex: 1 1 220px; }

/* Flash messages */
.flash-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.flash { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-solid); box-shadow: var(--shadow); animation: slideDown 0.35s ease; }
.flash span { flex: 1; }
.flash-success { border-color: rgba(61, 220, 132, 0.35); } .flash-success .ico { color: var(--pos); }
.flash-warning { border-color: rgba(245, 185, 66, 0.4); } .flash-warning .ico { color: var(--warn); }
.flash-error { border-color: rgba(255, 107, 107, 0.45); } .flash-error .ico { color: var(--neg); }
.flash-close { background: none; border: 0; font-size: 1.3rem; line-height: 1; color: var(--muted); padding: 0 4px; }
@keyframes slideDown { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }

/* Forms ------------------------------------------------------------------ */
.form { display: flex; flex-direction: column; gap: 14px; }
.form-inline { flex-direction: row; align-items: flex-end; flex-wrap: wrap; }
.form-inline .field { flex: 1; min-width: 160px; }
.form-section { margin: 10px 0 0; color: var(--gold-2); }
.form-actions { display: flex; gap: 10px; justify-content: space-between; flex-wrap: wrap; margin-top: 6px; }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.label { font-size: 0.8rem; font-weight: 700; color: #cfd7cd; letter-spacing: 0.02em; }
.input {
  width: 100%; min-height: 46px; padding: 10px 14px; border-radius: 12px;
  background: rgba(0, 0, 0, 0.35); border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 16px; /* prevents iOS zoom */ transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
textarea.input { min-height: 96px; resize: vertical; }
select.input { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--gold) 50%), linear-gradient(135deg, var(--gold) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
.input:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18); }
.input::placeholder { color: var(--faint); }
.input-code { letter-spacing: 0.3em; font-weight: 700; text-transform: uppercase; font-variant-numeric: tabular-nums; }
.has-error .input { border-color: var(--neg); }
.error { color: var(--neg); font-size: 0.82rem; margin: 0; }
.help { color: var(--faint); font-size: 0.8rem; margin: 0; }
.hp { position: absolute; left: -10000px; width: 1px; height: 1px; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; border: 0; }
fieldset.field { border: 0; margin: 0; padding: 0; }
fieldset.field > legend { padding: 0; margin-bottom: 6px; }
.dob-grid { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1.2fr); gap: 8px; }
.notice-card { display: flex; flex-direction: column; gap: 12px; }
.notice-card .mail-badge { width: 56px; height: 56px; border-radius: 16px; display: grid; place-items: center; background: rgba(212, 175, 55, 0.12); border: 1px solid rgba(212, 175, 55, 0.35); color: var(--gold); }
.notice-card .mail-badge svg { width: 28px; height: 28px; }
.link-row { display: flex; flex-wrap: wrap; gap: 8px 16px; justify-content: center; font-size: 0.9rem; }
.details-plain > summary { cursor: pointer; color: var(--gold-2); font-weight: 600; padding: 6px 0; }
.checkbox { display: flex; align-items: flex-start; gap: 10px; font-size: 0.9rem; color: #d3dacf; cursor: pointer; }
.checkbox input { width: 20px; height: 20px; margin: 1px 0 0; accent-color: var(--gold); flex: none; }
.switch { display: flex; align-items: center; gap: 12px; cursor: pointer; font-size: 0.92rem; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.switch-ui { position: relative; width: 46px; height: 28px; border-radius: 999px; background: rgba(255, 255, 255, 0.12); border: 1px solid var(--line); flex: none; transition: background 0.2s ease; }
.switch-ui::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #e9e4d6; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.4); transition: transform 0.2s ease; }
.switch input:checked + .switch-ui { background: var(--gold); }
.switch input:checked + .switch-ui::after { transform: translateX(18px); background: #fff; }
.switch input:focus-visible + .switch-ui { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.switch strong, .switch small { display: block; }
.switch small { color: var(--faint); font-size: 0.78rem; }
.segmented { display: inline-flex; padding: 4px; gap: 4px; background: rgba(0, 0, 0, 0.3); border: 1px solid var(--line); border-radius: 999px; align-self: flex-start; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: block; padding: 7px 14px; border-radius: 999px; font-size: 0.85rem; font-weight: 600; color: var(--muted); cursor: pointer; }
.segmented input:checked + span { background: var(--gold); color: #1b1404; }
.segmented label { position: relative; }
.segmented input:focus-visible { outline: none; }
.segmented input:focus-visible + span { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.strength { height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.08); overflow: hidden; margin-top: -6px; }
.strength span { display: block; height: 100%; width: 0; background: var(--neg); transition: width 0.25s ease, background 0.25s ease; }
.strength.s1 span { width: 25%; } .strength.s2 span { width: 50%; background: var(--warn); }
.strength.s3 span { width: 75%; background: #9bd36a; } .strength.s4 span { width: 100%; background: var(--pos); }
.filter-bar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; padding: 12px; }
.filter-bar .input { flex: 1; min-width: 150px; min-height: 42px; }

.toggle { position: relative; width: 58px; height: 34px; border-radius: 999px; border: 1px solid var(--line); background: rgba(255, 255, 255, 0.12); flex: none; }
.toggle span { position: absolute; top: 4px; left: 4px; width: 24px; height: 24px; border-radius: 50%; background: #e9e4d6; transition: transform 0.2s ease; box-shadow: 0 2px 5px rgba(0, 0, 0, 0.4); }
.toggle.is-on { background: linear-gradient(180deg, var(--gold-2), var(--gold)); }
.toggle.is-on span { transform: translateX(24px); background: #fff; }
.landing-toggle { display: flex; align-items: center; gap: 14px; padding: 10px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.landing-toggle strong, .landing-toggle span { display: block; }

/* Permission matrix */
.perm-grid { display: grid; gap: 12px; }
@media (min-width: 720px) { .perm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (min-width: 1100px) { .perm-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.perm-group { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px 6px; margin: 0; min-width: 0; }
.perm-group legend { padding: 0 6px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--gold); font-weight: 700; }
.perm { display: flex; gap: 12px; align-items: flex-start; padding: 8px 0; cursor: pointer; }
.perm input { position: absolute; opacity: 0; }
.perm-ui { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid rgba(255, 255, 255, 0.25); flex: none; margin-top: 1px; display: grid; place-items: center; transition: background 0.15s ease; }
.perm input:checked + .perm-ui { background: var(--gold); border-color: var(--gold); }
.perm input:checked + .perm-ui::after { content: ""; width: 10px; height: 6px; border-left: 2.5px solid #1b1404; border-bottom: 2.5px solid #1b1404; transform: rotate(-45deg) translate(1px, -1px); }
.perm input:focus-visible + .perm-ui { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.perm strong { display: block; font-family: ui-monospace, Menlo, monospace; font-size: 0.8rem; color: var(--text); }
.perm small { color: var(--muted); font-size: 0.8rem; }

/* Tables */
.table-wrap { overflow-x: auto; margin: 0 -18px; padding: 0 18px; -webkit-overflow-scrolling: touch; }
.table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.table th { text-align: left; font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--faint); font-weight: 700; padding: 10px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.table td { padding: 11px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: rgba(255, 255, 255, 0.02); }
.table .num-col { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.table-compact td, .table-compact th { padding: 7px 8px; }
.user-cell { display: flex; align-items: center; gap: 10px; }
.user-cell strong, .user-cell small { display: block; }
.meta-cell pre { margin: 6px 0 0; max-width: 420px; white-space: pre-wrap; font-size: 0.75rem; }
.pager { display: flex; align-items: center; justify-content: space-between; margin-top: 14px; }

/* Lobby ------------------------------------------------------------------ */
.bonus-card { display: flex; align-items: center; gap: 12px; padding: 10px 12px 10px 14px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface); }
.bonus-card strong, .bonus-card span { display: block; }
.bonus-card span { font-size: 0.8rem; color: var(--muted); }
.bonus-card.is-ready { border-color: var(--border-strong); background: linear-gradient(135deg, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.04)); animation: glow 2.4s ease-in-out infinite; }
.bonus-card .ico { color: var(--gold); width: 26px; height: 26px; }
@keyframes glow { 50% { box-shadow: 0 0 24px rgba(212, 175, 55, 0.35); } }
.game-grid { display: grid; gap: 14px; }
@media (min-width: 720px) { .game-grid { grid-template-columns: repeat(2, 1fr); } }
.game-tile { position: relative; display: flex; align-items: center; gap: 16px; padding: 16px; border-radius: 20px; overflow: hidden; border: 1px solid var(--border); min-height: 136px; transition: transform 0.2s ease, border-color 0.2s ease; }
.game-tile:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.game-american { background: radial-gradient(circle at 15% 50%, rgba(200, 32, 47, 0.35), transparent 55%), linear-gradient(135deg, #10251c, #0a1611); }
.game-european { background: radial-gradient(circle at 15% 50%, rgba(15, 138, 82, 0.45), transparent 55%), linear-gradient(135deg, #10251c, #0a1611); }
.game-tile.is-disabled { opacity: 0.5; pointer-events: none; }
.game-info h3 { font-family: var(--display); font-size: 1.35rem; margin: 6px 0 2px; }
.game-info p { margin: 0; color: var(--muted); font-size: 0.85rem; }
.game-go { margin-left: auto; align-self: flex-end; font-weight: 800; color: var(--gold-2); font-size: 0.9rem; }
.mini-wheel, .variant-wheel {
  position: relative; width: 96px; height: 96px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: repeating-conic-gradient(from 0deg, #b0141f 0 9.47deg, #121212 9.47deg 18.95deg);
  border: 5px solid #5a3415; box-shadow: 0 0 0 2px var(--gold-3), 0 10px 26px rgba(0, 0, 0, 0.6), inset 0 0 0 10px rgba(0, 0, 0, 0.25);
  animation: spin 18s linear infinite;
}
.game-art { border-radius: 50%; box-shadow: 0 6px 12px rgba(0, 0, 0, 0.55); }
.game-tile .mini-wheel, .gtile-art .mini-wheel { box-shadow: 0 0 0 2px var(--gold-3), inset 0 0 0 10px rgba(0, 0, 0, 0.25); }
.game-european .mini-wheel, .variant-european { background: repeating-conic-gradient(from 0deg, #b0141f 0 9.73deg, #121212 9.73deg 19.46deg); }
.mini-wheel::after, .variant-wheel::after { content: ""; position: absolute; inset: 26%; border-radius: 50%; background: radial-gradient(circle at 40% 35%, #f8de8a, #b58a22 55%, #6d5212); box-shadow: 0 2px 8px rgba(0, 0, 0, 0.6); }
.mini-wheel span, .variant-wheel span { position: relative; z-index: 1; font-weight: 800; color: #1b1404; font-size: 0.95rem; }
@keyframes spin { to { transform: rotate(360deg); } }

.room-grid { display: grid; gap: 14px; }
@media (min-width: 640px) { .room-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .room-grid { grid-template-columns: repeat(3, 1fr); } }
.room-card { display: flex; flex-direction: column; gap: 10px; padding: 16px; border-radius: 18px; border: 1px solid var(--border); background: linear-gradient(160deg, rgba(11, 93, 59, 0.28), rgba(255, 255, 255, 0.02)); transition: transform 0.2s ease, border-color 0.2s ease; }
.room-card:hover { transform: translateY(-2px); border-color: var(--border-strong); }
.room-card.is-full { opacity: 0.6; }
.room-card h3 { margin: 0; font-size: 1.05rem; }
.room-top { display: flex; gap: 6px; }
.room-meta { display: flex; flex-wrap: wrap; gap: 4px 12px; color: var(--muted); font-size: 0.8rem; }
.room-go { align-self: flex-end; font-weight: 800; color: var(--gold-2); font-size: 0.88rem; }
.seats { display: flex; gap: 6px; }
.seat { width: 22px; height: 22px; border-radius: 50%; border: 2px dashed rgba(255, 255, 255, 0.2); }
.seat.is-taken { border: 2px solid var(--gold); background: radial-gradient(circle at 40% 35%, var(--gold-2), var(--gold-3)); }
.seats-sm .seat { width: 12px; height: 12px; border-width: 1.5px; }
.result-strip { display: flex; gap: 12px; overflow-x: auto; padding: 6px 4px 8px; margin: -6px -4px 0; }
.result-item { display: flex; flex-direction: column; align-items: center; gap: 6px; min-width: 70px; }
.result-item small { color: var(--muted); font-size: 0.7rem; white-space: nowrap; }
.wallet-card { display: flex; flex-direction: column; gap: 4px; background: radial-gradient(circle at 90% 0%, rgba(212, 175, 55, 0.25), transparent 50%), linear-gradient(160deg, #13281f, #0b1813); }
.wallet-amount { display: flex; align-items: center; gap: 10px; font-size: clamp(1.8rem, 6vw, 2.6rem); font-weight: 800; font-variant-numeric: tabular-nums; }
.wallet-amount .ico { width: 36px; height: 36px; }
.bonus-panel { display: flex; align-items: center; gap: 14px; }
.bonus-panel > div { flex: 1; }
.bonus-panel .ico { color: var(--gold); }
.bonus-panel.is-ready { border-color: var(--border-strong); }

/* Bar chart (SVG) */
.bar-chart { width: 100%; height: auto; }
.bar-chart .grid-line { stroke: rgba(255, 255, 255, 0.06); stroke-width: 1; }
.bar-gold { fill: var(--gold); }
.bar-green { fill: #2fbf78; }
.bar-label { fill: var(--faint); font-size: 10px; font-family: var(--font); }
.legend { display: inline-flex; align-items: center; gap: 6px; font-size: 0.78rem; color: var(--muted); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-left: 8px; }
.lg-gold { background: var(--gold); } .lg-green { background: #2fbf78; }
.freq-chart { width: 100%; height: 80px; margin-top: 10px; }
.freq-red { fill: var(--red); } .freq-black { fill: #5a6068; } .freq-green { fill: var(--green); }
.chat-mod { list-style: none; padding: 0; margin: 0; }
.chat-mod li { display: flex; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); align-items: flex-start; }
.chat-mod li.is-deleted { opacity: 0.5; }
.chat-mod-body { flex: 1; min-width: 0; }
.chat-mod-body p { margin: 4px 0 0; word-wrap: break-word; }
.totp-setup { display: flex; flex-wrap: wrap; gap: 20px; align-items: center; margin: 12px 0 18px; }
.qr { width: 196px; height: 196px; padding: 10px; background: #fff; border-radius: 12px; }
.qr svg, .qr img { width: 100%; height: 100%; }
.secret { display: inline-block; font-size: 1rem; letter-spacing: 0.08em; padding: 8px 12px; }
.verify-out { margin-top: 14px; padding: 14px; border-radius: 12px; border: 1px solid var(--border); background: rgba(0, 0, 0, 0.25); display: flex; align-items: center; gap: 14px; }
.checklist { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 8px; }
.checklist li { display: flex; gap: 12px; align-items: center; padding: 10px 12px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.checklist strong, .checklist small { display: block; }
.checklist small { color: var(--muted); }
.check-ico { display: grid; place-items: center; width: 26px; height: 26px; border-radius: 50%; font-weight: 800; flex: none; }
.checklist .ok .check-ico { background: rgba(61, 220, 132, 0.15); color: var(--pos); }
.checklist .fail .check-ico { background: rgba(255, 107, 107, 0.15); color: var(--neg); }
.checklist .warn .check-ico { background: rgba(245, 185, 66, 0.15); color: var(--warn); }
.checklist .warn { border-color: rgba(245, 185, 66, 0.35); }
.check-ico .ico { width: 15px; height: 15px; }

/* Auth & install --------------------------------------------------------- */
.auth-page { min-height: 100dvh; background: var(--bg); }
.auth-bg { position: fixed; inset: 0; z-index: 0; background: radial-gradient(800px 500px at 50% -10%, rgba(15, 138, 82, 0.35), transparent 65%), radial-gradient(600px 400px at 100% 100%, rgba(212, 175, 55, 0.12), transparent 60%), repeating-radial-gradient(circle at 50% 120%, rgba(255, 255, 255, 0.015) 0 2px, transparent 2px 22px), var(--bg); }
.auth-wrap { position: relative; z-index: 1; max-width: 460px; margin: 0 auto; padding: calc(32px + var(--safe-top)) 18px calc(32px + var(--safe-bottom)); display: flex; flex-direction: column; gap: 18px; min-height: 100dvh; justify-content: center; }
.auth-wrap-wide { max-width: 720px; }
.auth-card { background: linear-gradient(180deg, rgba(20, 38, 30, 0.92), rgba(10, 21, 16, 0.92)); border: 1px solid var(--border); border-radius: 22px; padding: 26px 22px; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.05); backdrop-filter: blur(10px); }
.auth-switch { text-align: center; color: var(--muted); font-size: 0.9rem; margin: 18px 0 0; }
.auth-switch a { color: var(--gold-2); font-weight: 700; }
.auth-foot { text-align: center; color: var(--faint); font-size: 0.78rem; margin: 0; }
.auth-foot a { color: var(--muted); text-decoration: underline; }
.stepper { list-style: none; display: flex; justify-content: center; gap: 8px; padding: 0; margin: 0; flex-wrap: wrap; }
.stepper li { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--faint); font-weight: 600; padding: 6px 12px 6px 6px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); }
.stepper li span { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; background: rgba(255, 255, 255, 0.08); font-size: 0.75rem; }
.stepper .is-current { color: var(--text); border-color: var(--border-strong); }
.stepper .is-current span { background: var(--gold); color: #1b1404; }
.stepper .is-done span { background: var(--pos); color: #04210f; }
.error-page { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.error-code { font-family: var(--display); font-size: 4.5rem; font-weight: 800; color: var(--gold); line-height: 1; }
.trace { text-align: left; max-height: 300px; font-size: 0.72rem; width: 100%; }

/* Landing ---------------------------------------------------------------- */
.landing { background: var(--bg); }
.landing-nav { position: fixed; top: 0; left: 0; right: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: calc(12px + var(--safe-top)) max(18px, var(--safe-right)) 12px max(18px, var(--safe-left)); background: linear-gradient(180deg, rgba(5, 13, 10, 0.9), rgba(5, 13, 10, 0)); }
.landing-nav nav { display: flex; align-items: center; gap: 14px; font-size: 0.9rem; font-weight: 600; }
.landing-nav nav > a:not(.btn) { color: var(--muted); }
.landing-nav nav > a:not(.btn):hover { color: var(--text); }
.landing > .flash-stack { position: fixed; top: 80px; left: 16px; right: 16px; z-index: 25; max-width: 560px; margin: 0 auto; }
.hero { position: relative; min-height: 100svh; display: flex; align-items: flex-end; overflow: hidden; }
.hero-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.hero-vignette { position: absolute; inset: 0; background: linear-gradient(0deg, var(--bg) 2%, rgba(5, 13, 10, 0.55) 40%, rgba(5, 13, 10, 0.1) 70%), radial-gradient(ellipse at center, transparent 40%, rgba(0, 0, 0, 0.6)); pointer-events: none; }
.hero-copy { position: relative; z-index: 2; padding: calc(76px + var(--safe-top)) max(20px, var(--safe-left)) calc(56px + var(--safe-bottom)); max-width: 820px; }
.hero-cta { display: flex; flex-wrap: wrap; gap: 12px; margin: 22px 0 16px; }
.hero-note { color: var(--muted); font-size: 0.9rem; }
.hero-note .ico { display: inline-block; width: 20px; height: 20px; vertical-align: -5px; margin-right: 6px; }
@media (min-width: 960px) { .hero { align-items: center; } .hero-copy { padding-left: 7vw; padding-bottom: 0; } .hero-vignette { background: linear-gradient(90deg, var(--bg) 8%, rgba(5, 13, 10, 0.7) 38%, rgba(5, 13, 10, 0) 70%), linear-gradient(0deg, var(--bg) 1%, transparent 25%); } }
.landing-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 1px; background: var(--border); border-block: 1px solid var(--border); }
.landing-stats div { background: var(--bg); padding: 22px 12px; text-align: center; }
.landing-stats strong { display: block; font-family: var(--display); font-size: 2rem; color: var(--gold-2); }
.landing-stats span { color: var(--muted); font-size: 0.85rem; }
@media (min-width: 720px) { .landing-stats { grid-template-columns: repeat(4, 1fr); } }
.features { display: grid; gap: 16px; padding: 56px 20px; max-width: 1180px; margin: 0 auto; }
@media (min-width: 720px) { .features { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .features { grid-template-columns: repeat(4, 1fr); } }
.feature { padding: 22px; border-radius: 20px; border: 1px solid var(--border); background: linear-gradient(160deg, rgba(212, 175, 55, 0.06), rgba(255, 255, 255, 0.015)); }
.feature h3 { font-family: var(--display); font-size: 1.25rem; margin: 14px 0 8px; }
.feature p { color: var(--muted); margin: 0; font-size: 0.92rem; }
.feature-ico { display: grid; place-items: center; width: 48px; height: 48px; border-radius: 14px; background: rgba(212, 175, 55, 0.12); color: var(--gold-2); border: 1px solid var(--border-strong); }
.feature-ico .ico { width: 24px; height: 24px; }
.variants { display: grid; gap: 16px; padding: 0 20px 56px; max-width: 980px; margin: 0 auto; }
@media (min-width: 720px) { .variants { grid-template-columns: 1fr 1fr; } }
.variant-card { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; padding: 30px 22px; border-radius: 24px; border: 1px solid var(--border); background: radial-gradient(circle at 50% 0%, rgba(11, 93, 59, 0.5), transparent 70%), var(--bg-2); }
.variant-card h3 { font-family: var(--display); font-size: 1.5rem; margin: 10px 0 0; }
.variant-card p { color: var(--muted); margin: 0; }
.variant-wheel { width: 132px; height: 132px; }
.cta-band { text-align: center; padding: 64px 20px; background: radial-gradient(600px 300px at 50% 100%, rgba(212, 175, 55, 0.18), transparent 70%); border-top: 1px solid var(--border); }
.landing-footer { padding: 32px 20px calc(32px + var(--safe-bottom)); text-align: center; color: var(--faint); font-size: 0.82rem; border-top: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; gap: 8px; }
.landing-footer a:hover { color: var(--gold-2); }
.landing .page-narrow { padding: calc(96px + var(--safe-top)) 18px 40px; }

/* ==========================================================================
   Game screen — full-bleed 3D canvas with an app-like HUD overlay
   ========================================================================== */
.game-page { background: #020604; overflow: hidden; height: 100dvh; position: fixed; inset: 0; touch-action: none; user-select: none; -webkit-user-select: none; }
.game { position: absolute; inset: 0; }
.stage { position: absolute; inset: 0; }
.stage-canvas { width: 100%; height: 100%; touch-action: none; }
.stage-loading, .stage-error { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; background: radial-gradient(circle, #0c2a1d, #020604 70%); text-align: center; padding: 24px; z-index: 5; transition: opacity 0.6s ease; }
.stage-loading.is-done { opacity: 0; pointer-events: none; }
.loader-wheel { width: 72px; height: 72px; border-radius: 50%; border: 4px solid rgba(212, 175, 55, 0.2); border-top-color: var(--gold); animation: spin 0.9s linear infinite; }
.stage-loading p { color: var(--muted); font-family: var(--display); font-size: 1.1rem; }

.hud-top { position: absolute; top: 0; left: 0; right: 0; z-index: 10; display: flex; align-items: center; gap: 10px; padding: calc(10px + var(--safe-top)) max(12px, var(--safe-right)) 10px max(12px, var(--safe-left)); background: linear-gradient(180deg, rgba(0, 0, 0, 0.7), transparent); pointer-events: none; }
.hud-top > * { pointer-events: auto; }
.hud-top .icon-btn { background: rgba(0, 0, 0, 0.45); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.hud-title { flex: 1; min-width: 0; line-height: 1.2; }
.hud-title strong { display: block; font-family: var(--display); font-size: 1.05rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-title span { display: block; font-size: 0.72rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hud-actions { display: flex; gap: 6px; }

.hud-status { position: absolute; z-index: 10; top: calc(64px + var(--safe-top)); left: max(12px, var(--safe-left)); display: flex; flex-direction: column; gap: 6px; pointer-events: none; }
.hud-status > div { align-self: flex-start; display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px 5px 6px; border-radius: 999px; background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); border: 1px solid rgba(255, 255, 255, 0.08); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.hud-balance { font-weight: 800; font-size: 0.95rem !important; border-color: var(--border-strong) !important; }
.hud-balance .ico { width: 22px; height: 22px; }
.hud-bet, .hud-session { padding-left: 12px !important; color: var(--muted); }
.hud-bet strong { color: var(--text); }
.hud-session strong.pos { color: var(--pos); } .hud-session strong.neg { color: var(--neg); }

.hud-history { position: absolute; z-index: 10; top: calc(64px + var(--safe-top)); right: max(12px, var(--safe-right)); display: flex; flex-direction: column; align-items: flex-end; gap: 6px; pointer-events: none; }
/* Overflowing balls wrap onto a hidden extra column/row instead of being sliced in half. */
.history-strip { --ball: 28px; display: flex; flex-direction: column; flex-wrap: wrap; align-content: flex-start; gap: 4px 12px; width: calc(var(--ball) + 14px); max-height: 30vh; padding: 6px 6px 8px; border-radius: 14px; background: rgba(0, 0, 0, 0.5); border: 1px solid rgba(255, 255, 255, 0.07); overflow: hidden; }
.history-strip .num { flex: none; width: var(--ball); min-width: var(--ball); height: var(--ball); padding: 0; font-size: 0.75rem; }
.history-strip:empty { display: none; }
.history-strip .num:first-child { outline: 2px solid var(--gold); outline-offset: 1px; }
.hotcold { display: flex; flex-direction: column; gap: 4px; font-size: 0.7rem; }
.hotcold > div { display: flex; align-items: center; gap: 4px; padding: 3px 8px 3px 5px; border-radius: 999px; background: rgba(0, 0, 0, 0.5); }
.hotcold .ico { width: 14px; height: 14px; }
.hotcold > div:first-child .ico { color: #ff8a3d; }
.hotcold > div:last-child .ico { color: #7cc8ff; }
.hotcold .num { min-width: 20px; height: 20px; font-size: 0.62rem; box-shadow: none; }

.hud-room { position: absolute; z-index: 10; top: calc(64px + var(--safe-top)); left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; align-items: center; gap: 6px; width: min(46vw, 360px); pointer-events: none; }
.phase { display: inline-flex; align-items: center; gap: 8px; padding: 6px 14px; border-radius: 999px; background: rgba(0, 0, 0, 0.6); border: 1px solid var(--border); font-weight: 700; font-size: 0.82rem; white-space: nowrap; }
.phase-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); }
.phase.is-betting .phase-dot { background: var(--pos); box-shadow: 0 0 10px var(--pos); animation: pulse 1s ease-in-out infinite; }
.phase.is-spinning .phase-dot { background: var(--warn); }
.phase.is-result .phase-dot { background: var(--gold); }
.phase-timer { font-variant-numeric: tabular-nums; color: var(--gold-2); }
@keyframes pulse { 50% { opacity: 0.4; } }
.timer-bar { width: 100%; height: 4px; border-radius: 4px; background: rgba(255, 255, 255, 0.1); overflow: hidden; }
.timer-bar span { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--pos), var(--gold)); transform-origin: left; }
.timer-bar.is-low span { background: linear-gradient(90deg, var(--neg), var(--warn)); }
.seat-list { list-style: none; margin: 0; padding: 0; display: flex; gap: 6px; flex-wrap: wrap; justify-content: center; pointer-events: auto; }
.seat-list li { display: flex; align-items: center; gap: 5px; padding: 3px 8px 3px 3px; border-radius: 999px; background: rgba(0, 0, 0, 0.55); border: 1px solid rgba(255, 255, 255, 0.08); font-size: 0.7rem; max-width: 140px; }
.seat-list li.is-me { border-color: var(--gold); }
.seat-list li.is-empty { opacity: 0.5; width: 24px; height: 24px; padding: 0; justify-content: center; border: 1.5px dashed rgba(255, 255, 255, 0.3); background: transparent; font-size: 0.62rem; color: var(--muted); }
.seat-list .avatar { width: 22px; height: 22px; font-size: 0.55rem; border-width: 1px; }
.seat-list .seat-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seat-list .seat-bet { color: var(--gold-2); font-weight: 700; font-variant-numeric: tabular-nums; }
.room-code { pointer-events: auto; font-size: 0.75rem; padding: 4px 10px; border-radius: 999px; background: rgba(0, 0, 0, 0.55); border: 1px dashed var(--border-strong); }
.room-code strong { letter-spacing: 0.15em; color: var(--gold-2); }

.hud-bottom { position: absolute; z-index: 10; left: 0; right: 0; bottom: 0; padding: 10px max(10px, var(--safe-right)) calc(10px + var(--safe-bottom)) max(10px, var(--safe-left)); background: linear-gradient(0deg, rgba(0, 0, 0, 0.85) 40%, transparent); display: flex; flex-direction: column; gap: 10px; align-items: center; }
/* A horizontal scroller clips on both axes (overflow-y computes to auto), so the rack carries enough
   padding for the selected chip's lift, ring and glow; negative margins keep the HUD height unchanged. */
.chip-rack { display: flex; gap: 6px; overflow-x: auto; overflow-y: hidden; max-width: 100%; padding: 14px 14px 18px; margin: -8px 0 -10px; scroll-padding-inline: 14px; scrollbar-width: none; }
.chip-rack::-webkit-scrollbar { display: none; }
.chip {
  --c: #e9e6dc; --c2: #b9b4a5; --ink: #1b1b1b;
  position: relative; flex: none; width: clamp(42px, calc((100vw - 84px) / 7), 50px); height: clamp(42px, calc((100vw - 84px) / 7), 50px); border-radius: 50%; border: 0; padding: 0;
  background: radial-gradient(circle at 50% 50%, var(--c) 0 52%, transparent 53%), repeating-conic-gradient(from 0deg, var(--c) 0 22.5deg, #fff 22.5deg 30deg, var(--c) 30deg 45deg), var(--c);
  box-shadow: 0 0 0 2px var(--c2) inset, 0 4px 10px rgba(0, 0, 0, 0.6), 0 2px 0 var(--c2);
  color: var(--ink); font-weight: 900; font-size: 0.72rem; letter-spacing: -0.02em;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.chip::before { content: ""; position: absolute; inset: 9px; border-radius: 50%; border: 1.5px dashed rgba(0, 0, 0, 0.35); }
.chip span { position: relative; }
.chip[aria-checked="true"] { z-index: 1; transform: translateY(-4px) scale(1.06); box-shadow: 0 0 0 2px var(--c2) inset, 0 0 0 3px var(--gold-2), 0 6px 14px -2px rgba(212, 175, 55, 0.45); }
.chip:focus-visible { outline-offset: 1px; }
.chip:disabled { opacity: 0.35; }
.chip-1 { --c: #f1efe8; --c2: #bdb8a8; }
.chip-5 { --c: #d0202e; --c2: #8b0f19; --ink: #fff; }
.chip-25 { --c: #128a4e; --c2: #0a5230; --ink: #fff; }
.chip-100 { --c: #1d1f24; --c2: #000; --ink: #fff; }
.chip-500 { --c: #6b2fb5; --c2: #3d1670; --ink: #fff; }
.chip-1000 { --c: #e3a21a; --c2: #8f6208; --ink: #1b1404; }
.chip-5000 { --c: #1e74c9; --c2: #0f4071; --ink: #fff; }
.action-row { display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; max-width: 560px; }
.act { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px; min-height: 52px; padding: 6px 4px; border-radius: 14px; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.08); font-size: 0.68rem; font-weight: 700; color: #d9dfd6; }
.act:active { transform: scale(0.96); }
.act:disabled { opacity: 0.35; }
.act .ico { width: 20px; height: 20px; }
.spin-btn { flex: 1.5; min-height: 64px; border-radius: 20px; border: 0; background: radial-gradient(circle at 50% 0%, #fff3c4, var(--gold-2) 25%, var(--gold) 60%, var(--gold-3)); color: #1b1404; font-family: var(--display); font-size: 1.35rem; font-weight: 800; letter-spacing: 0.04em; box-shadow: 0 8px 24px rgba(212, 175, 55, 0.4), inset 0 2px 0 rgba(255, 255, 255, 0.6), inset 0 -3px 0 rgba(0, 0, 0, 0.2); display: grid; place-items: center; text-transform: uppercase; }
.spin-btn:active { transform: scale(0.97); }
.spin-btn:disabled { filter: grayscale(0.7) brightness(0.7); }
.spin-btn-timer { font-family: var(--font); font-size: 0.85rem; text-transform: none; letter-spacing: 0; text-align: center; padding: 0 8px; line-height: 1.15; }
.spin-btn-timer.is-closed { background: rgba(255, 255, 255, 0.08); color: var(--muted); box-shadow: none; }

.result-pop { position: absolute; z-index: 12; left: 50%; top: 42%; transform: translate(-50%, -50%) scale(0.6); opacity: 0; display: flex; flex-direction: column; align-items: center; gap: 10px; pointer-events: none; transition: transform 0.45s cubic-bezier(0.2, 1.4, 0.4, 1), opacity 0.3s ease; }
.result-pop.is-shown { transform: translate(-50%, -50%) scale(1); opacity: 1; }
.result-num { display: grid; place-items: center; width: 110px; height: 110px; border-radius: 50%; font-size: 2.8rem; font-weight: 900; color: #fff; border: 4px solid var(--gold-2); box-shadow: 0 0 60px rgba(0, 0, 0, 0.8), 0 0 40px rgba(212, 175, 55, 0.35); }
.result-num.num-red { background: radial-gradient(circle at 35% 30%, #ff4d5b, var(--red) 60%, #7c0d17); }
.result-num.num-black { background: radial-gradient(circle at 35% 30%, #4a4f57, #111 65%); }
.result-num.num-green { background: radial-gradient(circle at 35% 30%, #28c07a, var(--green) 60%, #054a2a); }
.result-text { padding: 8px 18px; border-radius: 999px; background: rgba(0, 0, 0, 0.75); border: 1px solid var(--border-strong); font-weight: 800; font-size: 1.05rem; white-space: nowrap; }
.result-text.is-win { color: var(--pos); border-color: rgba(61, 220, 132, 0.5); }
.toast { position: absolute; z-index: 13; left: 50%; bottom: calc(190px + var(--safe-bottom)); transform: translateX(-50%); max-width: calc(100% - 32px); padding: 10px 16px; border-radius: 12px; background: rgba(20, 8, 10, 0.92); border: 1px solid rgba(255, 107, 107, 0.45); font-size: 0.85rem; font-weight: 600; text-align: center; animation: slideDown 0.25s ease; }
.toast.is-info { background: rgba(5, 25, 16, 0.92); border-color: var(--border-strong); }

.chat { position: absolute; z-index: 11; right: max(12px, var(--safe-right)); bottom: calc(196px + var(--safe-bottom)); display: flex; flex-direction: column; align-items: flex-end; gap: 8px; }
.chat-toggle { position: relative; width: 48px; height: 48px; border-radius: 50%; border: 1px solid var(--border-strong); background: rgba(0, 0, 0, 0.65); color: var(--gold-2); display: grid; place-items: center; }
.chat-badge { position: absolute; top: -2px; right: -2px; min-width: 18px; height: 18px; border-radius: 9px; background: var(--red); color: #fff; font-size: 0.65rem; font-weight: 800; display: grid; place-items: center; padding: 0 4px; }
.chat-panel { order: -1; width: min(330px, calc(100vw - 24px)); max-height: 46vh; display: flex; flex-direction: column; border-radius: 18px; background: rgba(6, 14, 11, 0.94); border: 1px solid var(--border); box-shadow: var(--shadow); overflow: hidden; }
.chat-log { list-style: none; margin: 0; padding: 12px; overflow-y: auto; flex: 1; display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; min-height: 120px; }
.chat-log li { word-wrap: break-word; }
.chat-log b { color: var(--gold-2); margin-right: 6px; }
.chat-log li.is-me b { color: var(--pos); }
.chat-form { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.chat-form .input { min-height: 38px; padding: 6px 12px; }
.chat-form .btn-gold { box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.45); }

.sheet { border: 1px solid var(--border); border-radius: 22px; padding: 0; background: #0b1712; color: var(--text); width: min(560px, calc(100vw - 24px)); max-height: 86dvh; box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7); }
.sheet::backdrop { background: rgba(0, 0, 0, 0.6); backdrop-filter: blur(4px); }
.sheet-inner { padding: 22px; display: flex; flex-direction: column; gap: 12px; }
.sheet .kv dd { text-align: right; }

/* Portrait phones: stack the HUD in rows above the table instead of columns over it */
@media (max-width: 760px) and (orientation: portrait) {
  .hud-status { right: max(12px, var(--safe-right)); flex-direction: row; flex-wrap: wrap; }
  .hud-status > div { align-self: center; }
  .hud-history { top: calc(100px + var(--safe-top)); left: max(12px, var(--safe-left)); flex-direction: row; align-items: center; justify-content: space-between; }
  .history-strip { --ball: 26px; flex-direction: row; flex-wrap: wrap; gap: 14px 4px; width: auto; max-width: 62vw; max-height: calc(var(--ball) + 15px); }
  .history-strip .num { font-size: 0.7rem; }
  .hotcold { flex-direction: row; }
  .hotcold > div:last-child { display: none; }
  .game[data-mode="multi"] .hud-room { top: calc(140px + var(--safe-top)); left: max(12px, var(--safe-left)); right: max(12px, var(--safe-right)); transform: none; width: auto; }
  .seat-list li { max-width: 108px; }
  .hud-session .hide-xs { display: none; }
}

/* Landscape phones: compact HUD so the table stays visible */
@media (max-height: 500px) and (orientation: landscape) {
  .hud-bottom { flex-direction: row; justify-content: center; padding-top: 4px; }
  .chip-rack { flex: none; max-width: 48%; }
  .chip { width: 40px; height: 40px; font-size: 0.65rem; }
  .act { min-height: 44px; }
  .spin-btn { min-height: 48px; font-size: 1.1rem; }
  .history-strip { max-height: 46vh; }
  .chat { bottom: calc(80px + var(--safe-bottom)); }
  .toast { bottom: calc(80px + var(--safe-bottom)); }
}
@media (min-width: 960px) {
  .hud-bottom { padding-bottom: calc(18px + var(--safe-bottom)); }
  .chip { width: 58px; height: 58px; font-size: 0.8rem; }
  .history-strip { --ball: 32px; }
  .history-strip .num { font-size: 0.8rem; }
  .chat { bottom: calc(170px + var(--safe-bottom)); }
}
@media (max-width: 420px) {
  .hud-actions { gap: 4px; }
  .hud-actions .icon-btn, .hud-top > .icon-btn { width: 34px; height: 34px; border-radius: 10px; }
  .hud-title strong { font-size: 0.95rem; }
  .hud-room { width: 58vw; }
  .act span { font-size: 0.62rem; }
  .hud-status > div { font-size: 0.72rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* Package game host ------------------------------------------------------- */
.host-page { touch-action: manipulation; }
.gh { position: fixed; inset: 0; display: grid; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr) auto; background: radial-gradient(ellipse at 50% 30%, #0e2a1d, #020604 75%); }
.gh > * { min-width: 0; }
.gh-top { position: relative; background: linear-gradient(180deg, rgba(0, 0, 0, 0.55), rgba(0, 0, 0, 0.2)); border-bottom: 1px solid rgba(212, 175, 55, 0.12); }
.gh-top .icon-btn[aria-pressed="true"][data-favorite] { color: var(--gold); border-color: var(--border-strong); }
.gh-top .icon-btn[aria-pressed="false"][data-sound] { opacity: 0.55; }
.gh-stage { position: relative; min-height: 0; margin: 0 max(0px, var(--safe-right)) 0 max(0px, var(--safe-left)); }
.gh-frame { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; display: block; }
.gh-loading, .gh-error, .gh-rotate { position: absolute; inset: 0; z-index: 3; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px; padding: 24px; text-align: center; background: rgba(2, 6, 4, 0.94); }
.gh-loading[hidden], .gh-error[hidden], .gh-rotate[hidden] { display: none; }
.gh-progress { width: min(260px, 70vw); height: 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.08); overflow: hidden; }
.gh-progress span { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--gold-3), var(--gold-2)); transition: width 0.3s ease; }
.gh-error p { color: var(--muted); max-width: 420px; margin: 0; }
.gh-bar {
  display: grid; grid-template-columns: minmax(0, 1fr) auto auto minmax(0, 1fr); align-items: center; gap: 10px 14px;
  padding: 12px max(14px, var(--safe-right)) calc(12px + var(--safe-bottom)) max(14px, var(--safe-left));
  background: linear-gradient(180deg, rgba(7, 17, 13, 0.92), #050c09); border-top: 1px solid rgba(212, 175, 55, 0.18);
}
.gh-label { display: block; font-size: 0.68rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.gh-balance strong, .gh-last strong { font-size: 1.05rem; font-variant-numeric: tabular-nums; white-space: nowrap; }
.gh-balance strong { color: var(--gold-2); }
.gh-last { text-align: right; }
.gh-stake { display: flex; flex-direction: column; align-items: center; gap: 4px; }
/* Padding leaves room for focus rings: nothing in the bar clips a selected control. */
.stepper { display: flex; align-items: center; gap: 6px; padding: 3px; }
.stepper-btn { width: 40px; height: 40px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-size: 1.3rem; font-weight: 700; line-height: 1; }
.stepper-btn:disabled { opacity: 0.4; }
.stepper-value { min-width: 108px; height: 40px; padding: 0 12px; border-radius: 12px; border: 1px solid var(--border-strong); background: rgba(212, 175, 55, 0.08); color: var(--gold-2); font-weight: 800; font-size: 1rem; font-variant-numeric: tabular-nums; }
.stepper-btn:focus-visible, .stepper-value:focus-visible, .gh-play:focus-visible, .preset:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.gh-play { min-width: 132px; min-height: 52px; font-size: 1.05rem; letter-spacing: 0.04em; }
.gh-play.is-busy { opacity: 0.7; }
.gh .sheet { padding: 18px 20px 20px; }
.gh .sheet[open] { display: flex; flex-direction: column; gap: 10px; overflow: auto; }
.gh .sheet-wide { width: min(720px, calc(100vw - 24px)); }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.sheet-head h2 { margin: 0; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 10px; padding: 4px; }
.preset { min-height: 46px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 700; font-variant-numeric: tabular-nums; }
.preset.is-active { border-color: var(--gold); background: rgba(212, 175, 55, 0.14); color: var(--gold-2); box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.35); }
.info-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.info-stats > div { padding: 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); }
.info-stats strong { font-size: 1.05rem; }
.rules-list { margin: 0; padding-left: 18px; display: grid; gap: 6px; color: #d9dfd6; }
.gh .toast { bottom: 16px; }
.gh.is-immersive .gh-top { display: none; }
@media (max-width: 640px) {
  .gh-bar { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); grid-template-areas: "bal last" "stake stake" "play play"; gap: 8px 10px; padding-top: 10px; }
  .gh-balance { grid-area: bal; }
  .gh-last { grid-area: last; }
  .gh-stake { grid-area: stake; flex-direction: row; justify-content: center; gap: 10px; }
  .gh-stake .gh-label { display: none; }
  .gh-play { grid-area: play; width: 100%; min-height: 50px; }
}
/* Phones turned sideways: one compact row and a slimmer top bar, so the game keeps most of the height.
   Comes after the narrow-screen block above and undoes its three-row grid. */
@media (max-height: 520px) and (orientation: landscape) {
  .gh-top { padding-top: calc(6px + var(--safe-top)); padding-bottom: 6px; }
  .gh-top .icon-btn { width: 34px; height: 34px; border-radius: 10px; }
  /* The balance never shrinks; the last win's summary does (ellipsis), so the balance gets a little more room. */
  .gh-bar { grid-template-columns: minmax(0, 1.2fr) auto auto minmax(0, 1fr); grid-template-areas: none; gap: 6px 12px; padding-top: 6px; padding-bottom: calc(6px + var(--safe-bottom)); }
  .gh-balance, .gh-last, .gh-stake, .gh-play { grid-area: auto; }
  .gh-stake { flex-direction: row; gap: 0; }
  .gh-stake .gh-label { display: none; }
  /* After a round the server's summary takes the label's place, so the bar keeps its height. */
  .gh-last:has(.gh-detail:not(:empty)) .gh-label { display: none; }
  /* A long label from the game (up to 14 characters) wraps to two lines rather than squeezing the balance. */
  .gh-play { width: auto; min-width: 112px; max-width: 124px; min-height: 40px; padding: 0 14px; white-space: normal; text-align: center; line-height: 1.1; overflow-wrap: anywhere; }
  .stepper-btn, .stepper-value { height: 36px; }
  .stepper-btn { width: 36px; }
  .stepper-value { min-width: 92px; }
}
/* Small phones turned sideways (about 560 px wide or less): one row cannot hold a long balance, the stake and
   Play beside the last win, so the last win and the server's summary move to a slim second line. */
@media (max-height: 520px) and (orientation: landscape) and (max-width: 560px) {
  .gh-bar { grid-template-columns: minmax(0, 1fr) auto auto; grid-template-areas: "bal stake play" "last last last"; row-gap: 2px; }
  .gh-balance { grid-area: bal; }
  .gh-stake { grid-area: stake; }
  .gh-play { grid-area: play; }
  .gh-last { grid-area: last; display: flex; align-items: baseline; justify-content: flex-end; gap: 8px; }
  .gh-last .gh-label { display: none; }
  .gh-last strong { font-size: 0.85rem; }
  /* Two classes: the base .gh-detail rule comes later in this file. */
  .gh-last .gh-detail { max-width: none; min-width: 0; margin-left: 0; }
}

/* Game catalog ------------------------------------------------------------ */
.search-bar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 10px 12px; margin: 0 0 14px; border-radius: 16px; background: var(--surface); border: 1px solid var(--border); }
.search-bar > .ico { color: var(--gold-2); width: 20px; height: 20px; flex: none; }
.search-bar input[type="search"] { flex: 1 1 200px; min-width: 0; }
.search-bar select { flex: 0 1 170px; width: auto; }
.search-bar-compact { margin-top: 6px; }
/* Horizontal chip rows scroll; block padding keeps the active chip's ring and lift inside the scroller. */
.cat-chip-row { display: flex; gap: 8px; overflow-x: auto; padding: 8px 4px 12px; margin: 0 -4px 6px; scrollbar-width: thin; -webkit-overflow-scrolling: touch; }
.cat-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); color: var(--text); font-weight: 600; font-size: 0.88rem; text-decoration: none; white-space: nowrap; transition: border-color 0.2s ease, background 0.2s ease; }
.cat-chip:hover { border-color: var(--border-strong); }
.cat-chip.is-active { background: rgba(212, 175, 55, 0.16); border-color: var(--gold); color: var(--gold-2); box-shadow: 0 0 0 2px rgba(212, 175, 55, 0.25); }
.cat-chip:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.cat-chip-count { font-size: 0.72rem; color: var(--muted); font-weight: 700; }
.gtile-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 168px), 1fr)); gap: 14px; padding: 6px 2px; }
.gtile { position: relative; min-width: 0; border-radius: 18px; background: var(--surface); border: 1px solid var(--border); transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease; }
.gtile:hover { transform: translateY(-3px); border-color: var(--border-strong); box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45); }
.gtile:focus-within { outline: 2px solid var(--gold-2); outline-offset: 3px; }
.gtile-link { display: block; color: inherit; text-decoration: none; border-radius: inherit; }
.gtile-link:focus-visible { outline: none; }
/* Only the artwork clips (rounded top corners); the tile itself never clips its ring or buttons. */
.gtile-art { position: relative; aspect-ratio: 4 / 3; border-radius: 17px 17px 0 0; overflow: hidden; background: radial-gradient(ellipse at 50% 40%, #134a2f, #06150e 75%); display: grid; place-items: center; }
.gtile-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gtile-art .mini-wheel { width: 46%; height: auto; aspect-ratio: 1; }
.gtile-art .mini-wheel span { font-size: clamp(0.9rem, 3vw, 1.25rem); }
.mini-wheel.is-live { background: repeating-conic-gradient(from 0deg, #b0141f 0 9.73deg, #121212 9.73deg 19.46deg); }
.mini-wheel.is-live .ico { position: relative; z-index: 1; color: #1b1404; width: 34%; height: 34%; }
.gtile-badge { position: absolute; top: 10px; left: 10px; padding: 3px 10px; border-radius: 999px; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; background: rgba(0, 0, 0, 0.7); border: 1px solid rgba(255, 255, 255, 0.2); color: #fff; }
.gtile-badge.badge-new { background: linear-gradient(180deg, #2fd282, #138a50); border-color: transparent; color: #031a0d; }
.gtile-badge.badge-hot { background: linear-gradient(180deg, #ff6a4d, #c2261b); border-color: transparent; }
.gtile-badge.badge-exclusive { background: linear-gradient(180deg, var(--gold-2), var(--gold-3)); border-color: transparent; color: #1b1404; }
.gtile-body { padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.gtile-name { margin: 0; font-size: 0.98rem; font-weight: 700; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-clamp: 2; overflow-wrap: anywhere; padding-right: 2px; }
.gtile-meta { margin: 0; font-size: 0.76rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gtile-foot { display: flex; align-items: center; min-width: 0; min-height: 30px; margin-top: 4px; padding-right: 34px; }
.gtile-rtp { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 0.68rem; font-weight: 700; color: var(--gold-2); background: rgba(212, 175, 55, 0.1); border: 1px solid rgba(212, 175, 55, 0.25); border-radius: 999px; padding: 1px 7px; }
.gtile-fav, .gtile-info { position: absolute; width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; border: 1px solid rgba(255, 255, 255, 0.18); background: rgba(0, 0, 0, 0.55); color: #fff; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.gtile-fav { top: 8px; right: 8px; }
/* The info button sits in the footer row, not over the artwork. */
.gtile-info { right: 8px; bottom: 12px; width: 30px; height: 30px; background: transparent; border-color: var(--border); color: var(--muted); backdrop-filter: none; -webkit-backdrop-filter: none; }
.gtile-info:hover { color: var(--text); border-color: var(--border-strong); }
.gtile-fav .ico, .gtile-info .ico { width: 17px; height: 17px; }
.gtile-fav[aria-pressed="true"] { color: var(--gold-2); border-color: var(--gold); background: rgba(40, 30, 5, 0.75); }
.gtile-fav[aria-pressed="true"], [data-fav][aria-pressed="true"], [data-favorite][aria-pressed="true"] { --icon-fill: currentColor; }
/* Stylesheet rules reach <use> clones of sprite symbols; the custom property inherits from the button. */
#i-star path { fill: var(--icon-fill, none); }
.gtile-fav:focus-visible, .gtile-info:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
/* Shelves: horizontally scrolling rows. Padding on all sides leaves room for hover lift and focus rings. */
.shelf { margin-bottom: 4px; }
.shelf .section-title { margin: 22px 0 6px; }
.shelf-track { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(158px, 200px); gap: 14px; overflow-x: auto; overscroll-behavior-x: contain; scroll-snap-type: x proximity; padding: 10px 6px 16px; margin: 0 -6px; scroll-padding: 0 6px; -webkit-overflow-scrolling: touch; scrollbar-width: thin; }
.shelf-track > .gtile { scroll-snap-align: start; }
.num-game { border-radius: 999px; min-width: 64px; font-size: 0.78rem; background: var(--surface-2); border: 1px solid var(--line); }
.num-game.is-win { background: rgba(61, 220, 132, 0.16); color: var(--pos); border-color: rgba(61, 220, 132, 0.35); }
.game-hero { display: grid; gap: 18px; align-items: center; }
@media (min-width: 760px) { .game-hero { grid-template-columns: minmax(220px, 360px) 1fr; } }
.game-hero-art img, .game-hero-art .gtile-art { width: 100%; height: auto; border-radius: 16px; display: block; aspect-ratio: 4 / 3; }
.game-hero .page-title { margin: 2px 0 8px; }
.cell-sub { display: block; font-size: 0.72rem; color: var(--muted); }
.mono-cell { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.78rem; }
.narrow { max-width: 560px; margin: 24px auto; }

/* Admin game catalog --------------------------------------------------------- */
.badge-btn { min-height: 30px; padding: 0 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); font-weight: 700; font-size: 0.78rem; cursor: pointer; }
.badge-btn.is-on { background: rgba(61, 220, 132, 0.14); color: var(--pos); border-color: rgba(61, 220, 132, 0.35); }
.badge-btn:focus-visible { outline: 2px solid var(--gold-2); outline-offset: 2px; }
.checklist-compact { margin: 6px 0 0; }
.code-block { margin: 0; padding: 12px 14px; border-radius: 12px; background: rgba(0, 0, 0, 0.35); border: 1px solid var(--line); font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.78rem; line-height: 1.5; color: #d9e4d8; overflow: auto; max-height: 420px; white-space: pre; }
.input-file { padding: 10px; }
.card-danger { border-color: rgba(255, 107, 107, 0.35); }
.gh-detail { display: block; font-size: 0.7rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 26ch; margin-left: auto; }
