/* Casino shell: header, panels, bet control, cards, sheets. Built on the tokens in /style.css.
   --acc is the current game's accent as "r g b" so it can be used with alpha. */
:root { --acc: 102 162 215; --on-acc: #14161c; --btn-bg: rgb(102 162 215); }

body.cx-body {
  background:
    radial-gradient(72vmax 48vmax at 50% -14%, rgb(var(--acc) / .30), transparent 62%),
    radial-gradient(50vmax 40vmax at 100% 30%, rgb(var(--acc) / .10), transparent 60%),
    var(--bg);
  background-attachment: fixed;
}
main.cx { max-width: 640px; }

/* ---- header ---- */
.cx-top { display: flex; align-items: center; gap: 6px; margin-bottom: var(--sp-md); }
.cx-top h1 { flex: 1; min-width: 0; margin: 0 0 0 2px; font-size: 26px; font-weight: 700; letter-spacing: -.025em; line-height: 1.1; overflow-wrap: anywhere; text-wrap: balance; }
.cx-pill { flex: none; display: inline-flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--glass); border: 1px solid var(--glass-edge); box-shadow: var(--shadow-sm); font-weight: 650; font-variant-numeric: tabular-nums; transition: transform 180ms var(--ease-out); }
.cx-pill.pulse { transform: scale(1.12); }
.cx-top .icon-btn { width: 40px; height: 40px; font-size: 20px; }
@media (max-width: 460px) { .cx-top h1 { font-size: 22px; } .cx-top #signoutBtn { display: none; } }

/* ---- shared surfaces ---- */
.cx-view { display: grid; gap: var(--sp-md); align-content: start; }
.panel { background: var(--glass); border: 1px solid var(--glass-edge); border-radius: var(--r-card); box-shadow: inset 0 1px 0 rgb(255 255 255 / .4), var(--glass-shadow); -webkit-backdrop-filter: blur(24px) saturate(160%); backdrop-filter: blur(24px) saturate(160%); padding: var(--sp-md); }
@media (prefers-reduced-transparency: reduce) { .panel { background: var(--bg); -webkit-backdrop-filter: none; backdrop-filter: none; } }
.cap { font-size: 12px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.title-s { font-size: 15px; font-weight: 650; }
.meta { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.err { color: var(--bad); font-size: 14px; display: flex; gap: 6px; align-items: flex-start; }
.err:not([hidden])::before { content: "\26A0"; }
.hint-text { font-size: 13px; color: var(--muted); }

/* Buttons take the game's accent */
.cx-body .btn { background: var(--btn-bg); color: var(--on-acc); }
.cx-body .btn.ghost { background: var(--line); color: var(--fg); box-shadow: none; }
.cx-body .btn.good { background: var(--good); color: var(--on-good); }
.cx-body .btn.danger { background: var(--bad); color: #fff; }
.cx-body .btn.small { min-height: 38px; padding: 0 var(--sp-md); font-size: 14px; }
.cx-body .btn.block { width: 100%; }
.cx-body .btn.red { background: #c9382f; color: #fff; }
.cx-body .btn.green { background: #1f9d55; color: #fff; }
.cx-body .btn.purple { background: #8b4fc9; color: #fff; }
.cx-body .btn.orange { background: #d9741f; color: #fff; }
.cx-body .btn.blue { background: #2f6fd1; color: #fff; }
.btn.plain { background: var(--line); color: var(--fg); box-shadow: none; }

.chip-sm { min-height: 32px; padding: 0 14px; border-radius: 999px; background: var(--line); font-weight: 600; font-size: 14px; transition: transform 160ms var(--ease-out), background-color 160ms; }
.chip-sm:active { transform: scale(.95); }
.chip-sm:disabled { opacity: .5; }
@media (hover: hover) and (pointer: fine) { .chip-sm:hover:not(:disabled) { background: rgb(var(--acc) / .25); } }

.choices { display: flex; gap: var(--sp-sm); }
.choice { flex: 1; min-height: 40px; border-radius: 999px; background: var(--line); font-weight: 650; font-size: 15px; transition: background-color 180ms var(--ease-out), color 180ms, transform 160ms var(--ease-out); }
.choice:active { transform: scale(.97); }
.choice.on { background: var(--btn-bg); color: var(--on-acc); }
.choice:disabled { opacity: .55; }

/* ---- bet control ---- */
.bet { display: grid; gap: var(--sp-sm); }
.bet-row { display: flex; gap: var(--sp-sm); align-items: stretch; }
.bet-input { flex: none; width: 112px; min-height: 48px; text-align: center; font: inherit; font-size: 20px; font-weight: 650; font-variant-numeric: tabular-nums; color: var(--fg); background: var(--field); border: 1px solid var(--line); border-radius: var(--r-control); }
.bet-input:focus-visible { outline: none; border-color: rgb(var(--acc)); box-shadow: 0 0 0 3px rgb(var(--acc) / .35); }
.bet-go { flex: 1; min-height: 48px; font-size: 17px; }
.bet-chips { display: flex; gap: var(--sp-sm); flex-wrap: wrap; align-items: center; }

/* ---- result banner ---- */
.banner { display: inline-flex; align-items: center; gap: var(--sp-sm); justify-self: center; padding: 8px 18px; border-radius: 999px; font-weight: 650; background: var(--glass); border: 1px solid var(--glass-edge); animation: pop 260ms var(--ease-out) both; font-variant-numeric: tabular-nums; }
.banner-delta { font-size: 20px; font-weight: 750; }
.banner.win { color: var(--good); background: color-mix(in srgb, var(--good) 18%, var(--glass)); }
.banner.lose { color: var(--bad); }
.banner.even { color: var(--muted); }
@keyframes pop { from { opacity: 0; transform: scale(.7); } }

/* ---- home ---- */
.checkin-row { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-md); }
.game-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-sm); }
.game-card, .banner-card { display: block; color: inherit; text-decoration: none; transition: transform 160ms var(--ease-out), box-shadow 200ms var(--ease-out); }
.game-card:active, .banner-card:active { transform: scale(.98); }
@media (hover: hover) and (pointer: fine) { .game-card:hover, .banner-card:hover { transform: translateY(-2px); } }
.game-card { display: grid; gap: 4px; align-content: start; }
.banner-card { display: flex; align-items: center; gap: var(--sp-md); background: linear-gradient(rgb(var(--acc) / .16), rgb(var(--acc) / .16)), var(--glass); }
.g-emoji { display: grid; place-items: center; width: 52px; height: 52px; border-radius: var(--r-control); background: rgb(var(--acc) / .2); font-size: 30px; margin-bottom: 6px; }
.g-emoji.big { width: 60px; height: 60px; font-size: 36px; margin: 0; flex: none; }
.g-name { font-size: 17px; font-weight: 650; display: flex; align-items: center; gap: 8px; }
.g-blurb { font-size: 14px; color: var(--muted); text-wrap: pretty; }
.g-text { flex: 1; min-width: 0; }
.g-go { color: var(--faint); font-size: 18px; }
.new { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 999px; background: rgb(var(--acc)); color: var(--on-acc); letter-spacing: .04em; }

/* ---- leaderboard ---- */
.lb { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.lb-row { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: var(--r-control); }
.lb-row.me { background: rgb(var(--acc) / .16); }
.lb-rank { width: 32px; font-weight: 650; font-variant-numeric: tabular-nums; }
.lb-avatar { flex: none; display: grid; place-items: center; border-radius: 50%; background: rgb(102 162 215 / .25); font-weight: 700; overflow: hidden; }
.lb-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.lb-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-bal { font-weight: 650; font-variant-numeric: tabular-nums; }

/* ---- sheets (dialogs) ---- */
dialog.sheet { color: var(--fg); padding: var(--sp-lg); width: min(440px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); overflow-y: auto; overscroll-behavior: contain; opacity: 0; transform: scale(.96) translateY(6px); transition: opacity 130ms var(--ease-out), transform 130ms var(--ease-out), overlay 130ms allow-discrete, display 130ms allow-discrete; }
dialog.sheet.wide { width: min(560px, calc(100vw - 24px)); }
dialog.sheet[open] { opacity: 1; transform: none; transition-duration: 180ms; }
@starting-style { dialog.sheet[open] { opacity: 0; transform: scale(.96) translateY(6px); } }
dialog.sheet::backdrop { background: rgb(10 15 25 / 0); -webkit-backdrop-filter: blur(0); backdrop-filter: blur(0); transition: background-color 130ms, backdrop-filter 130ms, overlay 130ms allow-discrete, display 130ms allow-discrete; }
dialog.sheet[open]::backdrop { background: rgb(10 15 25 / .5); -webkit-backdrop-filter: blur(5px); backdrop-filter: blur(5px); transition-duration: 180ms; }
@starting-style { dialog.sheet[open]::backdrop { background: rgb(10 15 25 / 0); } }
.sheet-head { display: flex; align-items: center; gap: var(--sp-sm); margin-bottom: var(--sp-md); }
.sheet-head h3 { flex: 1; margin: 0; font-size: 22px; letter-spacing: -.01em; }
.how { display: grid; gap: var(--sp-sm); }
.how-emoji { font-size: 52px; line-height: 1.1; }
.how p { margin: 0; line-height: 1.5; text-wrap: pretty; }
.confirm p { margin: 0 0 var(--sp-md); line-height: 1.45; }
.actions { display: flex; gap: var(--sp-sm); justify-content: flex-end; }

/* ---- playing cards ---- */
.hand { display: flex; align-items: center; min-height: 80px; }
.hand .pc + .pc { margin-left: -14px; }
.pc { --w: 56px; flex: none; width: var(--w); height: calc(var(--w) * 1.4286); perspective: 700px; transition: transform 380ms cubic-bezier(.34, 1.3, .64, 1), opacity 240ms; }
.pc.small { --w: 44px; }
.pc.pre { opacity: 0; transform: translateY(-44px); }
.pc-inner { position: relative; width: 100%; height: 100%; transform-style: preserve-3d; transition: transform 420ms var(--ease-in-out); }
.pc.down .pc-inner { transform: rotateY(180deg); }
.pc-face, .pc-back { position: absolute; inset: 0; border-radius: 8px; backface-visibility: hidden; -webkit-backface-visibility: hidden; box-shadow: 0 2px 6px rgb(0 0 0 / .25); }
.pc-face { display: grid; align-content: center; justify-items: center; background: #fff; color: #14161c; font-weight: 700; }
.pc-face.red { color: #cf3329; }
.pc-rank { font-size: calc(var(--w) * .32); line-height: 1; font-family: ui-rounded, "SF Pro Rounded", "Geist Variable", system-ui, sans-serif; }
.pc-suit { font-size: calc(var(--w) * .42); line-height: 1.05; }
.pc-back { transform: rotateY(180deg); background: linear-gradient(160deg, #3f8bf8, #2559c4); }
.pc-back::after { content: ""; position: absolute; inset: 4px; border-radius: 5px; border: 1.5px solid rgb(255 255 255 / .5); }

@media (prefers-reduced-motion: reduce) { .pc, .pc-inner { transition-duration: 1ms !important; } }

.lb-sheet { display: grid; gap: var(--sp-sm); }
.lb-sheet .lb { margin-top: var(--sp-xs); }
