@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

:root {
    --bg: #0d0e12;
    --panel: #15171c;
    --panel-2: #1c1e25;
    --input: #090a0d;
    --line: rgba(255,255,255,.07);
    --muted: #8d8f99;
    --text: #f2f2f0;
    --gold: #d3b66f;
    --gold-light: #e6cf91;
    --green: #38b982;
    --red: #ed5a68;
}
* { box-sizing: border-box; }
html { min-height: 100%; -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    min-height: 100vh;
    color: var(--text);
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: 15px;
    line-height: 1.45;
    font-feature-settings: 'tnum' 1, 'cv11' 1;
    -webkit-font-smoothing: antialiased;
    background: var(--bg);
}
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .42; }
a { color: inherit; text-decoration: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }

/* ---------- Chip icon ---------- */
.chip-icon { width: 20px; height: 20px; object-fit: contain; flex: none; display: inline-block; vertical-align: middle; }

/* ---------- Shell / top bar ---------- */
.site-shell {
    width: min(1440px, 100%);
    min-height: 100vh;
    margin: 0 auto;
    padding: 0 32px 24px;
    display: flex;
    flex-direction: column;
}
.topbar {
    min-height: 80px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-size: 22px; font-weight: 700; letter-spacing: -.6px; }
.brand-mark { color: var(--gold); font-size: 27px; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.player-pill, .balance-pill {
    min-height: 42px; display: flex; align-items: center; gap: 9px;
    padding: 0 16px; border-radius: 8px; background: var(--panel-2);
    color: #dcdce0; font-size: 14px; font-weight: 600;
}
.balance-pill { color: var(--gold-light); font-weight: 700; }
.balance-pill small { color: var(--muted); font-size: 11px; font-weight: 600; letter-spacing: .6px; }
.logout-form { margin: 0; }
.icon-button { width: 42px; height: 42px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); color: #b7b8bf; font-size: 19px; }
.icon-button:hover { border-color: var(--gold); color: var(--gold); }

/* ---------- Layout ---------- */
.game-layout { flex: 1; min-height: 640px; display: grid; grid-template-columns: 400px minmax(0, 1fr); }
.control-panel { padding: 32px 32px 20px 0; border-right: 1px solid var(--line); display: flex; flex-direction: column; }
.mode-switch { display: grid; grid-template-columns: 1fr 1fr; padding: 4px; border-radius: 9px; background: var(--panel-2); margin-bottom: 30px; }
.mode { min-height: 46px; border: 0; border-radius: 7px; color: #9b9da6; background: transparent; font-size: 15px; font-weight: 600; }
.mode.active { color: #f4f1e9; background: #31333b; box-shadow: 0 2px 8px rgba(0,0,0,.25); }
.mode small { margin-left: 5px; color: var(--gold); font-size: 10px; font-weight: 700; letter-spacing: .5px; text-transform: uppercase; }
.panel-heading { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.eyebrow { color: #b0b1b9; font-size: 13px; font-weight: 600; }
.balance-small { color: #7c7e89; font-size: 13px; }

/* ---------- Bet form ---------- */
.bet-form { display: flex; flex-direction: column; gap: 14px; }
.bet-input-wrap { order: 1; height: 56px; padding: 0 16px; display: flex; align-items: center; gap: 11px; background: var(--input); border: 1px solid rgba(255,255,255,.06); border-radius: 8px; }
.bet-input-wrap:focus-within { border-color: rgba(211,182,111,.6); }
.bet-input-wrap input { min-width: 0; flex: 1; border: 0; outline: 0; background: transparent; color: white; font-size: 18px; font-weight: 600; }
.bet-input-wrap input::-webkit-inner-spin-button { opacity: .4; }
.bet-unit { color: #787a85; font-size: 12px; font-weight: 600; letter-spacing: .6px; }
.deal-button { order: 3; margin-top: 4px; width: 100%; }
.quick-bets { order: 2; display: grid; grid-template-columns: repeat(6, 1fr); gap: 7px; }
.quick-bet { height: 38px; padding: 0 3px; border: 1px solid var(--line); border-radius: 6px; color: #b4b6be; background: var(--panel-2); font-size: 13px; font-weight: 600; }
.quick-bet:hover { border-color: var(--gold); color: var(--gold-light); background: rgba(211,182,111,.1); }
.bet-form .action-hint { order: 4; margin: 0 2px; }

.button { min-height: 54px; border: 0; border-radius: 8px; font-weight: 700; font-size: 16px; transition: transform .15s ease, filter .15s ease; }
.button:hover { filter: brightness(1.08); transform: translateY(-1px); }
.button span { float: right; font-size: 19px; line-height: 17px; }
.button-gold { padding: 0 20px; color: #211b0e; background: linear-gradient(135deg, #dfc783, #c9ad68); }
.button-quiet { padding: 0 20px; color: #eee; background: #292b33; border: 1px solid var(--line); }

.active-bet { display: flex; align-items: center; justify-content: space-between; min-height: 56px; padding: 0 16px; background: var(--input); border: 1px solid var(--line); border-radius: 8px; }
.muted-label { color: #8a8c97; font-size: 13px; font-weight: 600; }
.active-bet strong { display: inline-flex; align-items: center; gap: 8px; color: var(--gold-light); font-size: 18px; }
.active-bet small { color: #7c7e89; font-size: 11px; }

.action-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.action-grid form { margin: 0; }
.game-action { width: 100%; height: 56px; padding: 0 16px; display: flex; align-items: center; justify-content: space-between; flex-direction: row-reverse; border: 1px solid rgba(255,255,255,.04); border-radius: 8px; color: #ececf0; background: #22242b; font-weight: 600; font-size: 15px; }
.game-action:not(:disabled):hover { background: #2b2e37; border-color: rgba(211,182,111,.35); }
.action-icon { font-size: 20px; font-weight: 700; }
.hit-icon { color: #43c58d; }
.stand-icon { color: var(--red); font-size: 14px; }
.split-icon { color: #5e9eff; }
.double-icon { color: #e5c65f; }
.unavailable { opacity: .35; }
.action-hint { margin: 14px 2px 0; color: #7b7d88; font-size: 13px; line-height: 1.6; }
.panel-rule { height: 1px; margin: 28px 0 22px; background: var(--line); }
.table-info { display: grid; gap: 14px; }
.table-info div { display: flex; justify-content: space-between; color: #8a8c97; font-size: 14px; }
.table-info strong { color: #d8d8dc; font-size: 14px; font-weight: 600; }

/* ---------- Table ---------- */
.table-area { min-width: 0; min-height: 640px; padding: 24px 32px 12px; display: flex; flex-direction: column; position: relative; }
.table-topline { display: flex; justify-content: space-between; align-items: center; }
.table-label { color: #9fa1aa; font-size: 14px; font-weight: 600; letter-spacing: 0; text-transform: none; }
.round-status { color: #8d8f99; font-size: 13px; font-weight: 600; }
.round-status.live { color: var(--green); }
.dealer-zone, .player-zone { width: 100%; display: flex; flex-direction: column; align-items: center; }
.dealer-zone { margin-top: 26px; }
.player-zone { margin-top: auto; margin-bottom: 10px; }
.hand-heading { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.hand-heading strong { display: block; color: #e0e0e4; font-size: 15px; font-weight: 600; }
.hand-heading small { display: block; margin-top: 1px; color: #7c7e89; font-size: 12px; }
.seat-avatar { width: 34px; height: 34px; display: grid; place-items: center; border-radius: 50%; color: #d7c38e; background: #343039; font-size: 15px; font-weight: 700; }
.player-avatar { color: #111; background: var(--gold); }
.hand-content { min-height: 160px; width: 100%; display: flex; align-items: center; justify-content: center; gap: 20px; }
.cards { display: flex; justify-content: center; gap: 14px; flex-wrap: wrap; }

.playing-card { position: relative; width: 96px; height: 138px; border-radius: 7px; background: #f8f8f5; color: #17181b; box-shadow: 0 10px 24px rgba(0,0,0,.35); overflow: hidden; }
.playing-card.red { color: #c2394a; }
.card-corner { position: absolute; top: 9px; left: 11px; display: flex; flex-direction: column; align-items: center; font-family: 'Inter', sans-serif; font-size: 28px; line-height: 24px; font-weight: 700; }
.card-corner small { font-size: 20px; line-height: 20px; }
.card-corner.bottom { top: auto; left: auto; right: 11px; bottom: 9px; transform: rotate(180deg); }
.card-centre { position: absolute; inset: 0; display: grid; place-items: center; font-size: 52px; }
.card-back { display: grid; place-items: center; color: #d5bd7d; background: repeating-linear-gradient(45deg,#272a32 0,#272a32 5px,#30333c 5px,#30333c 10px); border: 4px solid #d4bd7b; }
.card-back span { display: grid; place-items: center; width: 46px; height: 46px; border: 1px solid rgba(221,199,137,.5); border-radius: 50%; font-size: 26px; }
.empty-hand { display: flex; gap: 12px; opacity: .18; }
.empty-card { width: 70px; height: 100px; display: grid; place-items: center; border: 1px dashed #777a84; border-radius: 6px; color: #aaa; font-size: 28px; }
.hand-total { min-width: 48px; height: 34px; display: grid; place-items: center; padding: 0 12px; border-radius: 20px; color: #e9e9eb; background: #292b32; font-size: 15px; font-weight: 600; }

.table-centre { min-height: 120px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; }
.table-rules { display: flex; flex-direction: column; align-items: center; gap: 6px; }
.table-rules span { padding: 8px 22px; color: #b0b2b9; background: #22242b; clip-path: polygon(0 0,100% 0,95% 100%,5% 100%); font-size: 11px; font-weight: 600; letter-spacing: .6px; }
.table-prompt { margin: 0; color: #7d7f8a; font-size: 14px; }
.round-notice { padding: 10px 22px; border-radius: 6px; background: #262830; color: #e2e2e6; font-size: 16px; font-weight: 700; letter-spacing: .2px; }
.round-notice.win { color: #63d6a2; background: rgba(56,185,130,.12); }
.round-notice.loss { color: #ee7a83; background: rgba(237,90,104,.12); }

/* ---------- Alerts / key notice ---------- */
.alert { margin: 14px 0; padding: 13px 16px; border: 1px solid var(--line); border-radius: 8px; color: #ddd; background: var(--panel-2); font-size: 14px; }
.alert.success { border-color: rgba(56,185,130,.25); color: #7bd8ae; }
.alert.error { border-color: rgba(237,90,104,.25); color: #f08b94; }
.game-alert { margin: 14px 0 0; }
.key-notice { margin: 16px 0 0; padding: 16px 18px; border: 1px solid rgba(211,182,111,.3); border-radius: 10px; background: rgba(211,182,111,.07); }
.key-notice strong { color: var(--gold-light); font-size: 15px; }
.key-notice p { margin: 5px 0 12px; color: #a3a5ae; font-size: 14px; }
.key-notice code { display: block; padding: 12px 14px; border-radius: 7px; background: var(--input); overflow-wrap: anywhere; color: #f0f0f0; font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: 14px; user-select: all; -webkit-user-select: all; }
.key-download { display: inline-block; margin-top: 12px; color: var(--gold-light); font-size: 14px; font-weight: 600; border-bottom: 1px solid rgba(230,207,145,.4); }
.key-download:hover { color: #fff; border-color: #fff; }

/* ---------- Auth screens ---------- */
.auth-page { min-height: 100vh; display: grid; place-items: center; padding: 40px 18px; background: var(--bg); color: var(--text); }
.auth-card { width: min(480px, 100%); padding: 34px; border: 1px solid rgba(255,255,255,.075); border-radius: 16px; background: #15171c; box-shadow: 0 24px 70px rgba(0,0,0,.38); }
.auth-brand { display: flex; justify-content: center; font-size: 27px; letter-spacing: -.8px; }
.auth-subtitle { margin: 8px 0 30px; color: #92949d; text-align: center; font-size: 15px; line-height: 1.5; }
.auth-section .eyebrow { display: block; text-align: center; margin-bottom: 6px; color: var(--gold); }
.auth-section h1 { margin: 0 0 7px; text-align: center; font-size: 28px; line-height: 1.25; font-weight: 700; letter-spacing: -.7px; }
.auth-section > p { margin: 0 0 22px; color: #92949d; text-align: center; font-size: 15px; line-height: 1.55; }
.auth-form { display: grid; gap: 12px; }
.auth-form input { width: 100%; height: 52px; padding: 0 15px; border: 1px solid #30323a; border-radius: 8px; outline: 0; color: var(--text); background: #1f2026; font-size: 15px; transition: border-color .15s ease, box-shadow .15s ease; }
.auth-form input:focus { border-color: rgba(211,182,111,.75); box-shadow: 0 0 0 3px rgba(211,182,111,.1); }
.auth-form input::placeholder { color: #777984; }
.auth-form .button { width: 100%; }
.auth-form .button-gold { color: #17130a; }
.auth-divider { display: flex; align-items: center; gap: 13px; margin: 26px 0 16px; color: #777a84; font-size: 13px; font-weight: 600; white-space: nowrap; }
.auth-divider:before, .auth-divider:after { content: ''; height: 1px; flex: 1; background: rgba(255,255,255,.09); }
.login-details { border: 1px solid #363840; border-radius: 8px; overflow: hidden; }
.login-details summary { min-height: 52px; padding: 0 15px; display: flex; align-items: center; justify-content: center; gap: 9px; color: #e8e8eb; background: #191a20; cursor: pointer; list-style: none; font-size: 15px; font-weight: 600; }
.login-details summary::-webkit-details-marker { display: none; }
.login-details summary:hover { background: #202128; }
.login-key-icon { color: var(--gold); font-size: 18px; }
.login-chevron { color: #8d9099; margin-left: 3px; transition: transform .15s ease; }
.login-details[open] .login-chevron { transform: rotate(180deg); }
.login-details-content { padding: 16px; border-top: 1px solid var(--line); }
.login-details-content p { margin: 0 0 12px; color: #92949d; font-size: 14px; line-height: 1.5; }
.auth-footnote { margin: 22px 0 0; color: #777a84; text-align: center; font-size: 13px; line-height: 1.5; }

/* ---------- Responsive ---------- */
@media (max-width: 1000px) {
    .site-shell { padding: 0 20px 18px; }
    .game-layout { grid-template-columns: 330px minmax(0,1fr); }
    .control-panel { padding-right: 20px; }
    .table-area { padding-right: 12px; padding-left: 16px; }
    .playing-card { width: 80px; height: 116px; }
    .card-corner { font-size: 23px; line-height: 20px; }
    .card-corner small { font-size: 16px; line-height: 16px; }
    .card-centre { font-size: 42px; }
}
@media (max-width: 720px) {
    .site-shell { padding: 0 16px 16px; }
    .topbar { min-height: 68px; }
    .brand { font-size: 19px; }
    .topbar-right { gap: 7px; }
    .player-pill { display: none; }
    .balance-pill { padding: 0 11px; font-size: 13px; }
    .game-layout { display: flex; flex-direction: column; }
    .table-area { order: 1; min-height: 560px; padding: 18px 0 12px; }
    .control-panel { order: 2; border-right: 0; border-top: 1px solid var(--line); padding: 22px 0 14px; }
    .mode-switch { margin-bottom: 22px; }
    .hand-content { min-height: 130px; }
    .playing-card { width: 66px; height: 96px; }
    .card-corner { font-size: 19px; line-height: 17px; top: 7px; left: 8px; }
    .card-corner small { font-size: 14px; line-height: 14px; }
    .card-corner.bottom { right: 8px; bottom: 7px; top: auto; left: auto; }
    .card-centre { font-size: 34px; }
    .table-centre { min-height: 100px; }
}
@media (max-width: 400px) {
    .quick-bets { grid-template-columns: repeat(3, 1fr); }
    .playing-card { width: 56px; height: 84px; }
    .cards { gap: 7px; }
    .hand-total { min-width: 40px; padding: 0 8px; }
}
@media (max-width: 520px) {
    .auth-page { padding: 22px 14px; }
    .auth-card { padding: 26px 20px; border-radius: 13px; }
}
/* ================= Menu / sidebar ================= */
.topbar-left { display: flex; align-items: center; gap: 18px; }
.menu-link {
    min-height: 38px; display: inline-flex; align-items: center; padding: 0 14px;
    border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2);
    color: #c9cad1; font-size: 14px; font-weight: 600;
}
.menu-link:hover { border-color: var(--gold); color: var(--gold-light); }

.app { min-height: 100vh; display: grid; grid-template-columns: 280px minmax(0, 1fr); }

.sidebar {
    position: sticky; top: 0; height: 100vh; overflow-y: auto;
    padding: 24px 16px; display: flex; flex-direction: column; gap: 22px;
    background: #0a0b0e; border-right: 1px solid var(--line);
}
.sidebar .brand { padding: 4px 12px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
    min-height: 48px; padding: 0 14px; display: flex; align-items: center; gap: 14px;
    border-radius: 10px; color: #b4b6be; font-size: 15px; font-weight: 500;
    transition: background .15s ease, color .15s ease;
}
.nav-item:hover { background: #16181d; color: #fff; }
.nav-item.active { background: rgba(211,182,111,.12); color: var(--gold-light); }
.nav-icon { width: 21px; height: 21px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.nav-rule { height: 1px; margin: 12px 6px; background: var(--line); }

.nav-group summary { list-style: none; cursor: pointer; }
.nav-group summary::-webkit-details-marker { display: none; }
.nav-group summary .nav-icon:last-child { width: 17px; height: 17px; margin-left: auto; transition: transform .15s ease; }
.nav-group[open] summary .nav-icon:last-child { transform: rotate(90deg); }

.nav-sub { margin: 4px 0 6px 31px; padding-left: 14px; display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--line); }
.nav-sub a, .nav-sub .soon {
    min-height: 42px; padding: 0 14px; display: flex; align-items: center; gap: 10px;
    border-radius: 8px; font-size: 14px; font-weight: 500;
}
.nav-sub a { color: #c4c5cc; }
.nav-sub a:hover { background: #16181d; color: #fff; }
.sub-mark { color: var(--gold); font-size: 16px; }
.nav-sub .soon { color: #6f717c; cursor: default; }

.app-main { min-width: 0; padding: 0 32px 32px; display: flex; flex-direction: column; }
.app-topbar { justify-content: space-between; }
.app-content { padding-top: 32px; max-width: 1100px; width: 100%; }

.page-head { margin-bottom: 26px; }
.page-head h1 { margin: 0 0 6px; font-size: 30px; font-weight: 700; letter-spacing: -.7px; }
.page-head p { margin: 0; color: var(--muted); font-size: 15px; }

.game-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 18px; }
.game-tile {
    position: relative; min-height: 230px; padding: 24px; overflow: hidden;
    display: flex; flex-direction: column; justify-content: flex-end; gap: 4px;
    border: 1px solid var(--line); border-radius: 14px;
    background: linear-gradient(150deg, #1d1f26 0%, #121318 100%);
    transition: border-color .15s ease, transform .15s ease;
}
a.game-tile:hover { border-color: rgba(211,182,111,.5); transform: translateY(-2px); }
.tile-art { position: absolute; top: 14px; right: 22px; font-size: 96px; line-height: 1; color: rgba(211,182,111,.2); }
.tile-title { font-size: 21px; font-weight: 700; letter-spacing: -.3px; }
.tile-sub { color: var(--muted); font-size: 14px; }
.tile-cta { margin-top: 14px; color: var(--gold-light); font-size: 14px; font-weight: 600; }
.game-tile.soon { align-items: center; justify-content: center; text-align: center; border-style: dashed; background: transparent; }
.game-tile.soon .tile-title { color: #8d8f99; font-size: 17px; font-weight: 600; }

@media (max-width: 860px) {
    .app { display: block; }
    .sidebar { position: static; height: auto; padding: 16px; gap: 14px; border-right: 0; border-bottom: 1px solid var(--line); }
    .app-main { padding: 0 16px 24px; }
    .app-content { padding-top: 22px; }
    .topbar-left { gap: 10px; }
}
