:root {
  --ink: #0e0809;
  --panel: #1b1012;
  --line: #2a1517;
  --line2: #3a2023;
  --muted: #b9a3a5;
  --soft: #f2d7d9;
  --red: #c8202b;
  --felt-1: #b3222b;
  --felt-2: #8f1820;
  --felt-3: #6d1118;
  --print: #6a0f16;
  --win: #7fd49a;
  --lose: #ff8a8f;
  --cw: 76px;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'DM Sans', system-ui, sans-serif;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--ink); color: #fff; font-family: var(--sans); -webkit-font-smoothing: antialiased; }
body { overscroll-behavior: none; }
button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: default; }
[hidden] { display: none !important; }
kbd { display: none; }
@media (hover: hover) and (pointer: fine) {
  kbd { display: inline-block; margin-left: 6px; padding: 0 5px; border: 1px solid var(--line2); border-radius: 4px; font: 500 10px var(--sans); color: var(--muted); vertical-align: middle; }
  .act kbd { margin: 2px 0 0; }
}
a { color: var(--soft); }

/* ---------- Auth ---------- */
.auth { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; background: radial-gradient(ellipse 120% 80% at 50% 40%, var(--felt-1), var(--felt-2) 55%, var(--felt-3)); }
.auth-card { width: 100%; max-width: 400px; display: flex; flex-direction: column; gap: 18px; }
/* Logo: script 5K behind CINCO MIL, CASINO & RESORTS beneath. Sized by font-size on .mark (= the wordmark size). */
.mark { position: relative; isolation: isolate; display: flex; flex-direction: column; align-items: center; gap: 0.21em; text-align: center; font-family: 'Cormorant Garamond', Georgia, serif; --m-word: #fff; --m-sub: var(--soft); --m-script: #5e0d13; }
.mark-word { position: relative; font-weight: 600; font-size: 1em; line-height: 1; letter-spacing: 0.32em; margin-right: -0.32em; color: var(--m-word); white-space: nowrap; }
.mark-5k { position: absolute; z-index: -1; left: 50%; top: 50%; transform: translate(calc(-50% - 0.23em), calc(-50% - 0.15em)); font: 400 3.64em/1.5 'Pinyon Script', cursive; letter-spacing: -0.017em; white-space: nowrap; color: var(--m-script); pointer-events: none; }
.mark-sub { font-weight: 600; font-size: 0.32em; letter-spacing: 0.62em; margin-right: -0.62em; color: var(--m-sub); white-space: nowrap; }
.mark-auth { font-size: clamp(28px, 8.4vw, 46px); padding: 1.1em 0 0.6em; }
.mark-felt { font-size: clamp(22px, 6.8vw, 32px); --m-word: var(--print); --m-sub: var(--print); --m-script: rgba(80, 8, 14, 0.55); margin-bottom: 0.2em; }
.auth-pitch { margin: 0; text-align: center; color: var(--soft); line-height: 1.5; }
.fine { margin: 0; text-align: center; font-size: 12px; color: #e3b9bc; }
form { display: flex; flex-direction: column; gap: 12px; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 500; color: var(--soft); }
input:not([type=checkbox]) { height: 48px; padding: 0 14px; border-radius: 12px; border: 1px solid var(--line2); background: rgba(14, 8, 9, 0.75); color: #fff; font: 16px var(--sans); }
input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--soft); outline-offset: 2px; }
.check { flex-direction: row; align-items: center; gap: 10px; font-size: 14px; }
.check input { width: 20px; height: 20px; accent-color: var(--red); }
.form-error { margin: 0; min-height: 18px; color: #ffd0d3; font-size: 13px; }

.seg { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; gap: 4px; border-radius: 12px; background: rgba(14, 8, 9, 0.6); }
.seg button { height: 40px; border: 0; border-radius: 9px; background: none; color: var(--muted); font-weight: 700; }
.seg button.on { background: var(--red); color: #fff; }

.btn { height: 46px; white-space: nowrap; padding: 0 18px; border-radius: 12px; border: 1.5px solid var(--red); background: var(--panel); color: #fff; font-weight: 700; font-size: 15px; }
.btn.primary { background: var(--red); }
.btn.ghost { border: 1px solid var(--line2); color: #e3cfd1; font-weight: 500; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: 0.4; }

/* ---------- Shell ---------- */
.shell { height: 100dvh; max-width: 560px; margin: 0 auto; display: flex; flex-direction: column; background: var(--ink); border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
.topnav { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: max(10px, env(safe-area-inset-top)) 16px 10px; border-bottom: 1px solid var(--line); }
.logo { font: 800 16px var(--serif); letter-spacing: 2.5px; color: #fff; text-decoration: none; white-space: nowrap; }
.navlinks { display: flex; align-items: center; gap: 2px; }
.navlinks a { display: flex; align-items: center; min-height: 36px; padding: 0 9px; border-radius: 9px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.navlinks a.on { color: #fff; background: var(--panel); }
.view { flex: 1; min-height: 0; }

/* ---------- Table ---------- */
.table-view { display: flex; flex-direction: column; }
.statbar { flex: none; padding: 12px 16px; display: flex; flex-direction: column; gap: 10px; border-bottom: 1px solid var(--line); }
.statrow { display: flex; justify-content: space-between; align-items: flex-end; }
.stat-main, .stat-next { display: flex; flex-direction: column; gap: 2px; }
.stat-next { align-items: flex-end; }
.lbl { font-size: 10.5px; letter-spacing: 1.5px; text-transform: uppercase; color: var(--muted); }
.balance { font: 700 30px/1 var(--serif); font-variant-numeric: lining-nums; }
.next { font-size: 16px; font-weight: 500; font-variant-numeric: tabular-nums; }
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 7px 10px; border-radius: 10px; background: var(--panel); }
.tile span:last-child { font-size: 15px; font-weight: 700; font-variant-numeric: tabular-nums; }
.pos { color: var(--win); }
.neg { color: var(--lose); }

.felt { position: relative; flex: 1; min-height: 340px; overflow: hidden; background: radial-gradient(ellipse 120% 80% at 50% 45%, var(--felt-1) 0%, var(--felt-2) 55%, var(--felt-3) 100%); display: flex; flex-direction: column; justify-content: space-between; padding: 22px 12px 18px; }
.shoe { position: absolute; top: -52px; right: -12px; width: 66px; height: 94px; border-radius: 7px; border: 3px solid #fff; transform: rotate(-28deg); }
.back, .shoe { background-color: #1a0d0f; background-image: repeating-linear-gradient(45deg, var(--felt-1) 0 2px, transparent 2px 9px), repeating-linear-gradient(-45deg, var(--felt-1) 0 2px, transparent 2px 9px); }
.felt-print { position: absolute; left: 0; right: 0; top: 50%; transform: translateY(-58%); display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--print); text-align: center; pointer-events: none; }
.fp-rules { margin-top: 10px; padding: 5px 14px; border-top: 1.5px solid var(--print); border-bottom: 1.5px solid var(--print); font-size: 9px; font-weight: 700; letter-spacing: 1.6px; }
.fp-rules2 { font-size: 8.5px; font-weight: 700; letter-spacing: 1.6px; margin-top: 4px; }

.dealer-zone { position: relative; z-index: 1; display: flex; justify-content: center; min-height: calc(var(--cw) * 1.4 + 10px); }
.spots { position: relative; z-index: 1; display: flex; justify-content: center; align-items: flex-end; gap: 10px; min-height: calc(var(--cw) * 1.4 + 70px); }

.hand { position: relative; height: calc(var(--cw) * 1.4 + (var(--n, 2) - 1) * var(--cw) * 0.14); width: calc(var(--cw) + (var(--n, 2) - 1) * var(--cw) * 0.36); transition: transform 0.2s, filter 0.2s; }
.hand.active { filter: drop-shadow(0 0 10px rgba(255, 230, 160, 0.75)); }
.hand.dim { opacity: 0.8; }
.card { position: absolute; width: var(--cw); height: calc(var(--cw) * 1.4); border-radius: calc(var(--cw) * 0.1); background: #fff; color: #1a0d0f; box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35); }
.card.red { color: var(--red); }
.card .ix { position: absolute; top: 6%; left: 8%; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.card .ix b { font: 700 calc(var(--cw) * 0.27) var(--sans); letter-spacing: -1px; }
.card .ix i { font-style: normal; font-size: calc(var(--cw) * 0.22); }
.card .pip { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; padding-top: 18%; font-size: calc(var(--cw) * 0.5); }
.card .pip.face { font: 700 calc(var(--cw) * 0.48) var(--serif); }
.card.back { border: calc(var(--cw) * 0.05) solid #fff; }
.card.deal { animation: deal 0.42s cubic-bezier(0.2, 0.8, 0.3, 1) both; }
@keyframes deal { from { transform: translate(55vw, -45vh) rotate(-30deg); opacity: 0.2; } to { transform: none; opacity: 1; } }

.tag { position: absolute; z-index: 2; padding: 4px 10px; border-radius: 6px 13px 13px 6px; background: #fff; color: #1a0d0f; font-weight: 700; font-size: 14px; box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3); white-space: nowrap; }
.dealer-zone .tag { left: calc(var(--cw) * -0.85 - 18px); top: 30%; }
.solo .tag { left: calc(var(--cw) * -0.85 - 18px); top: 30%; }
.multi .tag { left: -4px; top: -26px; font-size: 12px; padding: 3px 8px; }
.tag.bust { background: #2a1517; color: var(--lose); }
.tag.bj { background: #f5d76e; }

.result { position: absolute; z-index: 3; left: 50%; bottom: -8px; transform: translateX(-50%); padding: 3px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.5px; white-space: nowrap; background: var(--ink); animation: pop 0.25s both; }
.result.win, .result.blackjack { background: #e9f8ee; color: #116b33; }
.result.lose, .result.bust { background: var(--ink); color: var(--lose); }
.result.push { background: #fff; color: #333; }
@keyframes pop { from { opacity: 0; transform: translateX(-50%) scale(0.7); } to { opacity: 1; transform: translateX(-50%) scale(1); } }

.spot { position: relative; display: flex; flex-direction: column; align-items: center; gap: 8px; }
.spot-hands { display: flex; gap: 10px; align-items: flex-end; }
.spot-ring { width: 84px; height: 84px; border-radius: 50%; border: 2px dashed var(--print); display: flex; align-items: center; justify-content: center; background: none; padding: 0; color: var(--print); font-size: 11px; font-weight: 700; letter-spacing: 1px; }
.spot-ring.has { border-style: solid; }
.spot-ring:hover { border-color: var(--soft); }
.spot-amt { font-size: 13px; font-weight: 700; color: var(--soft); min-height: 18px; }
.spot-side { display: flex; gap: 4px; flex-wrap: wrap; justify-content: center; max-width: 140px; }
.pill { padding: 2px 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; background: rgba(14, 8, 9, 0.45); color: var(--soft); }
.pill.hit { background: #f5d76e; color: #3a2a00; }
.pill.miss { opacity: 0.55; text-decoration: line-through; }

.chip { --s: 56px; width: var(--s); height: var(--s); flex: none; border-radius: 50%; background: #111; border: calc(var(--s) * 0.085) dashed var(--red); display: flex; align-items: center; justify-content: center; padding: 0; box-shadow: 0 3px 0 #000; transition: transform 0.12s; }
.chip span { width: 64%; height: 64%; border-radius: 50%; border: 1.5px solid var(--red); display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: calc(var(--s) * 0.22); font-weight: 700; line-height: 1; color: #fff; }
.chip-5k { font: normal 400 calc(var(--s) * 0.17)/0.9 'Pinyon Script', cursive; color: var(--red); margin: calc(var(--s) * -0.03) calc(var(--s) * 0.03) 0 0; }
.chip.sel { box-shadow: 0 0 0 3px var(--soft), 0 3px 0 #000; transform: translateY(-3px); }
.chip.mini { --s: 50px; box-shadow: 0 3px 0 #000, 0 6px 10px rgba(0, 0, 0, 0.4); }

.banner { position: absolute; z-index: 4; left: 50%; top: 50%; transform: translate(-50%, -50%); padding: 10px 22px; border-radius: 14px; background: rgba(14, 8, 9, 0.88); font: 700 26px var(--serif); opacity: 0; pointer-events: none; }
.banner.show { animation: banner 2.4s both; }
@keyframes banner { 0% { opacity: 0; transform: translate(-50%, -40%); } 12%, 75% { opacity: 1; transform: translate(-50%, -50%); } 100% { opacity: 0; } }

.controls { flex: none; padding: 12px 14px max(14px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: var(--ink); }
.c-bet { display: flex; flex-direction: column; gap: 10px; }
.sidebets { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -14px; padding: 0 14px; }
.sidebets::-webkit-scrollbar { display: none; }
.sidebets button { flex: none; white-space: nowrap; padding: 6px 11px; border-radius: 999px; border: 1px solid var(--line2); background: var(--panel); color: var(--muted); font-size: 12px; font-weight: 500; }
.sidebets button.on { border-color: var(--red); color: #fff; background: #3a1418; }
.chips { display: flex; justify-content: space-between; padding: 0 6px; }
.bet-buttons { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.bet-buttons .btn.full { grid-column: 1 / -1; }
.c-ins { display: flex; flex-direction: column; gap: 10px; text-align: center; }
.c-ins p { margin: 0; color: var(--soft); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.c-play { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; padding-top: 4px; }
.act { display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: none; font-size: 13px; font-weight: 500; min-height: 44px; }
.act .ring { width: 56px; height: 56px; border-radius: 50%; background: var(--panel); border: 2px solid var(--red); display: flex; align-items: center; justify-content: center; }
.act .ring.txt { font-weight: 700; font-size: 17px; }
.act.hit .ring { background: var(--red); }
.act:disabled { opacity: 0.3; }
.act:not(:disabled):active .ring { transform: scale(0.94); }

/* ---------- Pages ---------- */
.page { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.page-inner { padding: 20px 16px 40px; display: flex; flex-direction: column; gap: 16px; }
h1 { margin: 0; font: 700 28px var(--serif); }
h2 { margin: 0 0 4px; font: 700 18px var(--serif); }
.sub { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }
.pcard { padding: 16px; border-radius: 14px; background: var(--panel); display: flex; flex-direction: column; gap: 12px; }
.rules { margin: 0; padding-left: 18px; color: #e3cfd1; font-size: 14px; line-height: 1.7; }

.lb { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.lb li { display: grid; grid-template-columns: 34px 1fr auto; align-items: center; gap: 10px; padding: 12px 14px; border-radius: 12px; background: var(--panel); }
.lb li.me { outline: 1.5px solid var(--red); }
.lb .rank { font: 700 18px var(--serif); color: var(--muted); }
.lb li:nth-child(1) .rank { color: #f5d76e; }
.lb .who { display: flex; flex-direction: column; min-width: 0; }
.lb .who b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb .who span { font-size: 12px; color: var(--muted); }
.lb .amt { font-weight: 700; font-variant-numeric: tabular-nums; }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); border: 1px dashed var(--line2); border-radius: 12px; }

.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.kpi { padding: 12px 14px; border-radius: 12px; background: var(--panel); display: flex; flex-direction: column; gap: 4px; }
.kpi b { font: 700 22px var(--serif); font-variant-numeric: lining-nums tabular-nums; }
.kpi small { color: var(--muted); font-size: 12px; }
.chart { width: 100%; height: auto; display: block; }
.bars { display: flex; flex-direction: column; gap: 8px; }
.bar { display: grid; grid-template-columns: 92px 1fr 52px; align-items: center; gap: 10px; font-size: 13px; }
.bar .track { height: 10px; border-radius: 5px; background: #2a1517; overflow: hidden; }
.bar .fill { height: 100%; background: var(--red); border-radius: 5px; }
.bar .v { text-align: right; font-variant-numeric: tabular-nums; color: #e3cfd1; }
table.t { width: 100%; border-collapse: collapse; font-size: 13px; }
table.t th { text-align: left; color: var(--muted); font-weight: 500; font-size: 11.5px; letter-spacing: 0.5px; padding: 6px 4px; border-bottom: 1px solid var(--line2); }
table.t td { padding: 8px 4px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
table.t td.r, table.t th.r { text-align: right; }
.mistake { display: grid; grid-template-columns: 1fr auto; gap: 2px 10px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.mistake:last-child { border-bottom: 0; }
.mistake b { font-size: 14px; }
.mistake span { color: var(--muted); font-size: 12.5px; }
.mistake em { grid-row: 1 / 3; grid-column: 2; align-self: center; font-style: normal; font-weight: 700; color: var(--lose); }

.toast { position: fixed; z-index: 50; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(20px); max-width: calc(100% - 32px); padding: 12px 16px; border-radius: 12px; background: #f2d7d9; color: #1a0d0f; font-weight: 500; font-size: 14px; opacity: 0; pointer-events: none; transition: 0.25s; }
.toast.show { opacity: 1; transform: translateX(-50%); }

@media (max-height: 720px) {
  :root { --cw: 64px; }
  .statbar { padding: 8px 16px; gap: 6px; }
  .balance { font-size: 24px; }
  .felt { padding-top: 14px; }
  .chip { --s: 52px; }
}
@media (min-width: 600px) {
  body { background: radial-gradient(ellipse at 50% 0%, #2a0d10, var(--ink) 60%); }
  .shell { box-shadow: 0 0 80px rgba(0, 0, 0, 0.6); }
}
@media (prefers-reduced-motion: reduce) {
  .card.deal, .banner.show, .result { animation-duration: 0.01s !important; }
}
@keyframes fadein { from { opacity: 0; } to { opacity: 1; } }
.who-lbl { color: #fff; font-weight: 700; letter-spacing: 1px; text-transform: none; }
