/* ─── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --navy:       #0f1117;
  --navy-mid:   #161b27;
  --navy-card:  #1a2035;
  --gold:       #c9a227;
  --gold-dim:   #8a6d1a;
  --gold-light: #f0c84a;
  --felt:       #1a5c38;
  --felt-edge:  #0f3d24;
  --felt-hi:    #20703f;
  --red:        #e53e3e;
  --white:      #eef2ff;
  --grey:       #4a5568;
  --text-dim:   #8892a4;
  --chip-white: #f5f5f5;
  --chip-red:   #e74c3c;
  --chip-green: #27ae60;
  --chip-black: #2c3e50;
  --chip-purple:#8e44ad;
  --seat-w:    110px;
  --card-w:     54px;
  --card-h:     76px;
  --card-w-sm:  40px;
  --card-h-sm:  56px;
  --header-h:   42px;
  --tabbar-h:    0px;
}

html, body { background: var(--navy); color: var(--white); font-family: Arial, sans-serif; font-size: 15px; overflow-x: hidden; }
#app { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; }

/* Header */
#game-header { display: flex; align-items: center; justify-content: space-between; padding: 6px 16px; background: linear-gradient(180deg, #0a0d14 0%, var(--navy) 100%); border-bottom: 1px solid var(--gold-dim); flex-shrink: 0; height: var(--header-h); gap: 12px; position: sticky; top: 0; z-index: 100; }
.title { font-family: Arial, sans-serif; font-size: clamp(0.95rem, 2.5vw, 1.35rem); font-weight: 700; color: var(--gold); letter-spacing: 0.05em; text-shadow: 0 0 20px rgba(201,162,39,0.3); white-space: nowrap; }
#game-info { display: flex; align-items: center; gap: 10px; font-size: 0.88rem; color: var(--text-dim); font-weight: 500; letter-spacing: 0.04em; flex: 1; }
#blind-info, #hand-count { white-space: nowrap; }
.end-session-btn { padding: 5px 12px; background: transparent; border: 1px solid var(--grey); border-radius: 5px; color: var(--text-dim); font-family: Arial, sans-serif; font-size: 0.72rem; font-weight: 600; cursor: pointer; white-space: nowrap; transition: all 0.15s; flex-shrink: 0; }
.end-session-btn:hover { border-color: var(--gold-dim); color: var(--gold-light); }
/* Profile icon + dropdown */
#profile-menu-wrap { position: relative; flex-shrink: 0; }
#btn-profile { width: 32px; height: 32px; border-radius: 50%; background: rgba(255,255,255,0.07); border: 1px solid rgba(255,255,255,0.15); color: var(--text-dim); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.15s; padding: 0; flex-shrink: 0; }
#btn-profile:hover, #btn-profile.active { background: rgba(255,255,255,0.14); color: var(--white); border-color: rgba(255,255,255,0.3); }
#profile-dropdown { position: absolute; top: calc(100% + 8px); right: 0; background: #111827; border: 1px solid rgba(255,255,255,0.12); border-radius: 10px; min-width: 148px; box-shadow: 0 8px 32px rgba(0,0,0,0.7); z-index: 500; overflow: hidden; }
#profile-dropdown.profile-dropdown-hidden { display: none; }
.pdrop-item { display: block; width: 100%; padding: 10px 16px; font-family: Arial, sans-serif; font-size: 0.82rem; color: var(--text-dim); text-decoration: none; background: transparent; border: none; cursor: pointer; text-align: left; transition: background 0.12s, color 0.12s; white-space: nowrap; box-sizing: border-box; }
.pdrop-item:hover { background: rgba(255,255,255,0.07); color: var(--white); }
.pdrop-signout:hover { color: #f87171; }
/* Help button */
.help-btn { width: 26px; height: 26px; border-radius: 50%; background: transparent; border: 1px solid var(--grey); color: var(--text-dim); font-family: Arial, sans-serif; font-size: 0.78rem; font-weight: 700; cursor: pointer; display: flex; align-items: center; justify-content: center; padding: 0; flex-shrink: 0; transition: all 0.15s; line-height: 1; }
.help-btn:hover { background: rgba(255,255,255,0.1); color: var(--white); border-color: rgba(255,255,255,0.3); }

/* Layout */
#content-wrapper { display: flex; flex: 1; overflow: hidden; min-height: 0; }
#left-panel { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }
#table-view { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-height: 0; }

/* Deal hand prompt */
#deal-hand-prompt { display: none; flex-direction: column; justify-content: center; align-items: center; gap: 10px; padding: 14px 20px; background: linear-gradient(0deg, #0a0d14 0%, var(--navy) 100%); border-top: 1px solid var(--gold-dim); }
.see-analysis-btn { padding: 7px 22px; background: transparent; border: 1px solid var(--gold-dim); border-radius: 6px; color: var(--gold); font-family: Arial, sans-serif; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.18s; letter-spacing: 0.03em; }
.see-analysis-btn:hover { background: rgba(201,162,39,0.12); color: var(--gold-light); border-color: var(--gold); }
.deal-btn { padding: 12px 44px; background: linear-gradient(135deg, #b8860b 0%, var(--gold) 50%, #d4a832 100%); border: none; border-radius: 8px; color: var(--navy); font-family: Arial, sans-serif; font-size: 1rem; font-weight: 700; cursor: pointer; letter-spacing: 0.04em; transition: filter 0.15s, transform 0.1s; box-shadow: 0 4px 20px rgba(201,162,39,0.3); }
.deal-btn:hover { filter: brightness(1.1); }
.deal-btn:active { transform: scale(0.98); }

/* Table */
#table-container { flex: 1; display: flex; justify-content: center; align-items: center; padding: 16px; overflow: hidden; }
#poker-table { position: relative; width: min(820px, 98%); height: clamp(300px, calc(100dvh - var(--header-h) - 140px), 550px); flex-shrink: 0; }
#poker-table::before { content: ''; position: absolute; inset: 0; border-radius: 50%; background: radial-gradient(ellipse at 40% 35%, var(--felt-hi) 0%, var(--felt) 50%, var(--felt-edge) 100%); box-shadow: 0 0 0 10px var(--felt-edge), 0 0 0 14px #0a1f11, 0 0 0 20px #1a1a1a, 0 8px 60px rgba(0,0,0,0.8), inset 0 2px 30px rgba(0,0,0,0.4); }

/* Seats */
#seats-container { position: absolute; inset: 0; z-index: 4; }
.seat { position: absolute; width: var(--seat-w); text-align: center; transform: translate(-50%, -50%); transition: opacity 0.3s; }
.seat.folded { opacity: 0.4; }
.seat.folded .seat-cards { filter: grayscale(0.8); }
.seat-header { display: flex; align-items: center; justify-content: center; gap: 4px; max-width: var(--seat-w); }
.seat-name { font-size: 0.78rem; font-weight: 600; color: var(--white); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-pos-label { font-size: 0.66rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-dim); min-height: 12px; }
.seat-user-label { display: inline-block; font-size: 0.56rem; font-weight: 700; letter-spacing: 0.04em; padding: 1px 5px; border-radius: 3px; text-transform: uppercase; cursor: pointer; border: 1px dashed rgba(255,255,255,0.22); background: transparent; color: rgba(255,255,255,0.35); transition: all 0.15s; -webkit-tap-highlight-color: transparent; font-family: Arial, sans-serif; flex-shrink: 0; white-space: nowrap; }
.seat-user-label:hover { border-color: rgba(255,255,255,0.45); color: rgba(255,255,255,0.65); }
.seat-user-label.ulabel-fish { background: #1a6b8a; color: #7ecef4; border-color: #1a6b8a; }
.seat-user-label.ulabel-tag  { background: #1a4a1a; color: #7ef47e; border-color: #1a4a1a; }
.seat-user-label.ulabel-lag  { background: #6b1a1a; color: #f47e7e; border-color: #6b1a1a; }
.seat-you .seat-user-label { display: none; }
.seat-chips { font-size: 0.76rem; color: var(--gold); font-weight: 600; }
.seat-cards { display: flex; justify-content: center; gap: 2px; margin: 1px 0; min-height: var(--card-h-sm); }
.card-placeholder { width: var(--card-w-sm); height: var(--card-h-sm); border-radius: 4px; border: 1px dashed rgba(255,255,255,0.18); background: rgba(0,0,0,0.12); flex-shrink: 0; }
.seat-current-bet { display: none; }
.seat-action-label { font-size: 0.62rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; opacity: 0; transition: opacity 0.2s; }
.seat-action-label.visible { opacity: 1; }
.action-fold  { color: #e53e3e; }
.action-check { color: #68d391; }
.action-call  { color: #63b3ed; }
.action-raise { color: var(--gold-light); }
.action-allin { color: #fc8181; }
.action-sb, .action-bb { color: #b794f4; }

/* Dealer button on felt */
.dealer-button { position: absolute; width: 22px; height: 22px; border-radius: 50%; background: var(--gold); color: var(--navy); font-size: 0.6rem; font-weight: 900; display: flex; align-items: center; justify-content: center; box-shadow: 0 0 8px rgba(201,162,39,0.7); z-index: 6; transform: translate(-50%, -50%); pointer-events: none; }

/* Bet chips on felt */
#bets-layer { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.felt-bet { position: absolute; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 3px; pointer-events: none; }
.chip-stack-label { font-size: 0.60rem; font-weight: 900; color: #ffd700; text-shadow: 0 1px 3px rgba(0,0,0,0.9); white-space: nowrap; text-align: center; }

.seat.active-turn::before { content: ''; position: absolute; inset: -6px; border-radius: 8px; border: 2px solid var(--gold); animation: pulse-border 1s infinite; pointer-events: none; }
@keyframes pulse-border { 0%, 100% { opacity: 1; box-shadow: 0 0 8px var(--gold); } 50% { opacity: 0.5; box-shadow: 0 0 2px var(--gold); } }
.seat.rebought .seat-name::after { content: ' \21ba Rebuy'; color: #68d391; font-size: 0.5rem; animation: rebuy-flash 2.5s ease forwards; }
@keyframes rebuy-flash { 0% { opacity: 1; } 75% { opacity: 1; } 100% { opacity: 0; } }
.seat-you .seat-name { color: var(--gold-light); }

/* Cards */
.card { width: var(--card-w-sm); height: var(--card-h-sm); border-radius: 4px; background: #fff; display: flex; align-items: center; justify-content: center; font-family: Arial, sans-serif; font-weight: 700; box-shadow: 0 2px 6px rgba(0,0,0,0.5); position: relative; overflow: hidden; flex-shrink: 0; transition: transform 0.3s; }
.card.face-down { background: linear-gradient(135deg, #1a2a5a 25%, #0f1a40 100%); border: 1px solid #2a3a7a; }
.card.face-down::after { content: '\2660'; color: #2a3a7a; font-size: 0.82rem; }
.card.suit-red   { color: var(--red); }
.card.suit-black { color: #1a1a2e; }
.card-rank        { position: absolute; top: 2px; left: 4px; font-size: 0.88rem; line-height: 1; }
.card-suit-center { font-size: 1.25rem; margin-top: 8px; }
.card-rank-bottom { position: absolute; bottom: 2px; right: 4px; font-size: 0.88rem; transform: rotate(180deg); line-height: 1; }
.community-slot { width: var(--card-w); height: var(--card-h); border-radius: 5px; border: 1px dashed rgba(201,162,39,0.2); }
.community-slot .card { width: var(--card-w); height: var(--card-h); }
.community-slot .card-rank        { font-size: 1.0rem; }
.community-slot .card-suit-center { font-size: 1.5rem; }
.community-slot .card-rank-bottom { font-size: 1.0rem; }
@keyframes deal-in { from { transform: scale(0.1) rotate(-20deg); opacity: 0; } to { transform: scale(1) rotate(0deg); opacity: 1; } }
.card.dealing { animation: deal-in 0.3s ease-out forwards; }

/* Table center */
#table-center { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; flex-direction: column; align-items: center; gap: 3px; z-index: 5; pointer-events: none; }
#community-cards { display: flex; gap: 3px; }
#pot-area { display: flex; flex-direction: column; align-items: center; gap: 2px; }
#pot-chips { display: flex; gap: 2px; min-height: 18px; flex-wrap: wrap; justify-content: center; max-width: 100px; }
#pot-label { font-size: 0.74rem; font-weight: 700; color: var(--gold); letter-spacing: 0.05em; background: rgba(0,0,0,0.4); padding: 2px 9px; border-radius: 10px; border: 1px solid var(--gold-dim); }
#round-label { font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-dim); }

/* Chips */
.chip { width: 18px; height: 18px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-family: Arial, sans-serif; font-size: 0.5rem; font-weight: 700; border: 2px solid rgba(255,255,255,0.35); box-shadow: 0 2px 4px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.3); color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,0.9); flex-shrink: 0; }
.chip-1    { background: var(--chip-white); color: #333; text-shadow: none; border-color: #999; }
.chip-5    { background: var(--chip-red); }
.chip-25   { background: var(--chip-green); }
.chip-100  { background: var(--chip-black); }
.chip-500  { background: var(--chip-purple); }
.chip-1000 { background: #e67e22; }

/* Action bar */
#action-bar { flex-shrink: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 20px 8px; background: linear-gradient(0deg, #0a0d14 0%, var(--navy) 100%); border-top: 1px solid var(--gold-dim); }
#action-buttons { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.action-btn { padding: 8px 20px; border-radius: 6px; border: 1px solid var(--grey); background: var(--navy-card, #1a2035); color: var(--white); font-family: Arial, sans-serif; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all 0.15s; letter-spacing: 0.03em; }
.action-btn:hover:not(:disabled) { background: #253050; border-color: var(--gold-dim); color: var(--gold-light); }
.action-btn:disabled { opacity: 0.35; cursor: not-allowed; }
.action-btn.primary { background: linear-gradient(135deg, #b8860b 0%, var(--gold) 50%, #d4a832 100%); border-color: var(--gold-light); color: var(--navy); font-weight: 700; }
.action-btn.primary:hover:not(:disabled) { background: linear-gradient(135deg, #d4a832 0%, var(--gold-light) 50%, #f0c84a 100%); }
.fast-fwd-btn { border-color: #4a5568; color: #a0aec0; font-size: 0.8rem; padding: 8px 14px; }
.fast-fwd-btn:hover:not(:disabled) { border-color: #a0aec0; color: #fff; background: #253050; }
#btn-fold:hover:not(:disabled)  { border-color: var(--red); color: var(--red); }
#btn-check:hover:not(:disabled) { border-color: #68d391; color: #68d391; }
#btn-call:hover:not(:disabled)  { border-color: #63b3ed; color: #63b3ed; }

/* Raise controls — always visible */
#raise-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; justify-content: center; padding: 5px 8px; background: rgba(0,0,0,0.15); border-radius: 7px; border: 1px solid rgba(201,162,39,0.12); width: 100%; max-width: 520px; }
#raise-slider { width: 130px; accent-color: var(--gold); cursor: pointer; }
#raise-slider:disabled { cursor: not-allowed; opacity: 0.4; }
#raise-value  { min-width: 54px; text-align: center; font-weight: 700; color: var(--gold-light); font-size: 1rem; }
#raise-presets { display: flex; gap: 5px; flex-wrap: wrap; }
.preset-btn { padding: 5px 10px; border-radius: 4px; border: 1px solid var(--gold-dim); background: transparent; color: var(--gold); font-family: Arial, sans-serif; font-size: 0.8rem; font-weight: 600; cursor: pointer; transition: all 0.15s; }
.preset-btn:hover:not(:disabled) { background: var(--gold-dim); color: var(--white); }
.preset-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.hidden { display: none !important; }

/* History toggle button — desktop/iPad only, top-right of table view */
#table-view { position: relative; }
.history-toggle-btn { position: absolute; top: 8px; right: 12px; z-index: 20; padding: 5px 11px; background: rgba(10,13,20,0.7); border: 1px solid var(--gold-dim); border-radius: 5px; color: var(--gold-dim); font-family: Arial, sans-serif; font-size: 0.72rem; font-weight: 600; cursor: pointer; transition: all 0.15s; letter-spacing: 0.03em; backdrop-filter: blur(4px); }
.history-toggle-btn:hover { color: var(--gold-light); border-color: var(--gold); }

/* Hand log — hidden on desktop (entries maintained for mobile tab) */
#hand-log { display: none; flex-shrink: 0; border-top: 1px solid var(--gold-dim); background: rgba(0,0,0,0.25); max-height: 100px; overflow-y: auto; }
.hand-log-header { padding: 5px 14px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold-dim); background: rgba(0,0,0,0.2); border-bottom: 1px solid rgba(201,162,39,0.1); position: sticky; top: 0; }
#hand-log-entries { display: flex; flex-direction: column; }
.hand-log-entry { display: flex; gap: 8px; align-items: center; padding: 4px 14px; font-size: 0.78rem; border-bottom: 1px solid rgba(255,255,255,0.04); overflow: hidden; }
.hand-log-entry:hover { background: rgba(255,255,255,0.03); }
.log-hand-num  { color: var(--gold-dim); font-weight: 700; min-width: 26px; }
.log-winner    { color: var(--white); font-weight: 600; min-width: 55px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-hand-name { color: var(--gold-light); flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-pot       { color: #68d391; min-width: 38px; text-align: right; }
.log-cards     { color: var(--text-dim); min-width: 55px; text-align: right; }

/* Coaching panel */
#coaching-panel { width: 320px; flex-shrink: 0; background: #1a2035; border-left: 1px solid var(--gold-dim); display: flex; flex-direction: column; height: calc(100vh - var(--header-h)); position: sticky; top: var(--header-h); overflow-y: auto; }
#coaching-header { display: flex; align-items: center; justify-content: space-between; padding: 12px 14px; background: linear-gradient(135deg, #1a1f2e, #161b27); border-bottom: 1px solid var(--gold-dim); position: sticky; top: 0; z-index: 1; flex-shrink: 0; }
#coaching-header h2 { font-family: Arial, sans-serif; font-size: 0.95rem; font-weight: 700; color: var(--gold); }
#coaching-badges { display: flex; gap: 8px; flex-wrap: wrap; }
.hand-badge { font-size: 0.66rem; padding: 2px 8px; border-radius: 4px; font-weight: 700; }
.hand-badge-win  { background: #1a4a1a; color: #7ef47e; border: 1px solid #2d6e2d; }
.hand-badge-lose { background: #4a1a1a; color: #f47e7e; border: 1px solid #6e2d2d; }
#coaching-content { padding: 12px 14px 20px; flex: 1; }
#coaching-loading { display: flex; align-items: center; gap: 10px; color: var(--text-dim); padding: 6px 0; }
.spinner { width: 18px; height: 18px; border: 2px solid var(--gold-dim); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.8s linear infinite; flex-shrink: 0; }
@keyframes spin { to { transform: rotate(360deg); } }
#coaching-text { line-height: 1.65; color: #c8d0e0; font-size: 0.92rem; }
#coaching-text h1, #coaching-text h2, #coaching-text h3 { color: var(--gold); font-weight: 700; margin: 10px 0 5px; }
#coaching-text p    { margin-bottom: 8px; }
#coaching-text ul   { margin: 5px 0 8px 16px; }
#coaching-text li   { margin-bottom: 3px; }
#coaching-text strong { color: var(--gold-light); }
#coaching-text code { background: rgba(0,0,0,0.3); padding: 1px 5px; border-radius: 3px; font-family: monospace; color: #a0c4ff; }
.coaching-placeholder { color: var(--text-dim); font-style: italic; font-size: 0.8rem; text-align: center; margin-top: 16px; }
/* #coaching-footer removed — Deal Next Hand button moved to #deal-hand-prompt in table view */
#tab-bar { display: none; }

/* Toast */
#toast-container { position: fixed; top: 52px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 1000; pointer-events: none; white-space: nowrap; }
.toast { background: #1a2035; border: 1px solid var(--gold-dim); color: var(--white); padding: 7px 16px; border-radius: 6px; font-size: 0.8rem; font-weight: 500; box-shadow: 0 4px 20px rgba(0,0,0,0.4); animation: toast-in 0.3s ease-out, toast-out 0.3s 2.7s ease-in forwards; }
@keyframes toast-in  { from { opacity: 0; transform: translateY(-10px); } }
@keyframes toast-out { to   { opacity: 0; transform: translateY(-10px); } }

/* Winner overlay */
#winner-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.6); display: flex; align-items: center; justify-content: center; z-index: 500; animation: fade-in 0.3s ease; pointer-events: none; }
@keyframes fade-in { from { opacity: 0; } }
#winner-box { background: linear-gradient(135deg, #1a2035, #0f1117); border: 2px solid var(--gold); border-radius: 16px; padding: 28px 44px; text-align: center; box-shadow: 0 0 60px rgba(201,162,39,0.3); }
#winner-box h2 { font-family: Arial, sans-serif; font-size: 1.7rem; font-weight: 700; color: var(--gold); margin-bottom: 6px; }
#winner-box p  { color: var(--text-dim); font-size: 0.88rem; }


/* Short viewports: sticky action bar so it never scrolls off-screen */
@media (max-height: 540px) {
  #action-bar       { position: sticky; bottom: 0; z-index: 50; }
  #deal-hand-prompt { position: sticky; bottom: 0; z-index: 50; }
}

@media (max-width: 1100px) {
  :root { --seat-w: 96px; --card-w-sm: 33px; --card-h-sm: 46px; --card-w: 44px; --card-h: 62px; }
  #coaching-panel { width: 280px; }
  .card-rank, .card-rank-bottom { font-size: 0.72rem; }
  .card-suit-center { font-size: 1.0rem; margin-top: 6px; }
  .community-slot .card-rank, .community-slot .card-rank-bottom { font-size: 0.82rem; }
  .community-slot .card-suit-center { font-size: 1.2rem; }
  .seat-name { font-size: 0.68rem; }
  .seat-chips { font-size: 0.66rem; }
  .seat-pos-label { font-size: 0.58rem; }
}

@media (max-width: 768px) {
  :root { --header-h: 40px; --tabbar-h: 54px; --seat-w: 88px; --card-w-sm: 35px; --card-h-sm: 49px; --card-w: 36px; --card-h: 52px; }
  .history-toggle-btn { display: none; } /* mobile uses History tab */
  html, body { overflow: hidden; height: 100%; }
  html.auth-open, html.auth-open body { overflow: auto; height: auto; }
  #app { height: 100vh; height: 100dvh; overflow: hidden; }
  #game-header { height: var(--header-h); padding: 4px 10px; flex-shrink: 0; }
  .title { font-size: 0.95rem; }
  #game-info { font-size: 0.76rem; gap: 6px; }
  .hdr-lbl { display: none; }
  .end-session-btn { font-size: 0.68rem; padding: 4px 8px; }
  #content-wrapper { flex: 1; min-height: 0; overflow: visible; position: relative; display: block; }
  #left-panel { height: 100%; overflow: visible; }
  #table-view { display: flex; flex-direction: column; height: 100%; overflow: visible; }
  #table-container { flex: 1; min-height: 0; padding: 8px 16px 6px; align-items: center; }
  #poker-table { width: 100%; height: clamp(200px, calc(100dvh - var(--header-h) - 210px), 420px); max-width: 100%; }
  .seat-name { font-size: 0.62rem; }
  .seat-chips { font-size: 0.60rem; }
  .seat-pos-label { font-size: 0.54rem; }
  .seat-user-label { font-size: 0.5rem; padding: 1px 3px; }
  .card-placeholder { width: var(--card-w-sm); height: var(--card-h-sm); }
  .chip { width: 15px; height: 15px; font-size: 0.38rem; }
  .chip-stack-label { font-size: 0.54rem; }
  /* On mobile, show deal-hand-prompt by default; hide action-bar by default.
     JS toggles them: hideDealPrompt() hides prompt + shows action-bar,
     showDealPrompt() shows prompt + hides action-bar. */
  #deal-hand-prompt { display: flex; padding: 10px 14px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 14px); }
  #action-bar { display: none; padding: 5px 8px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 8px); gap: 5px; }
  .deal-btn { padding: 11px 32px; font-size: 0.95rem; }
  #raise-controls { padding: 4px 6px; gap: 6px; }
  #raise-slider { width: 110px; }
  #raise-presets { gap: 4px; }
  .preset-btn { padding: 6px 8px; font-size: 0.76rem; }
  #raise-value { min-width: 44px; font-size: 0.9rem; }
  .action-btn { padding: 10px 12px; font-size: 0.9rem; min-height: 44px; }
  #action-buttons { gap: 6px; }
  .fast-fwd-btn { font-size: 0.8rem; padding: 10px 10px; }
  #hand-log { display: none; max-height: none; flex: 1; overflow-y: auto; }
  #hand-log.mobile-active { display: block; position: fixed; top: var(--header-h); bottom: var(--tabbar-h); left: 0; right: 0; background: var(--navy); z-index: 10; overflow-y: auto; }
  .hand-log-header { font-size: 0.76rem; padding: 6px 14px; }
  .hand-log-entry { font-size: 0.76rem; padding: 5px 14px; }
  #coaching-panel { display: none; width: 100%; height: auto; position: fixed; top: var(--header-h); bottom: var(--tabbar-h); left: 0; right: 0; border-left: none; border-top: 1px solid var(--gold-dim); z-index: 10; overflow-y: auto; }
  #coaching-panel.mobile-active { display: flex; }
  #tab-bar { display: flex; position: fixed; bottom: 0; left: 0; right: 0; height: var(--tabbar-h); background: #0a0d14; border-top: 1px solid var(--gold-dim); z-index: 200; padding-bottom: env(safe-area-inset-bottom); }
  .tab-btn { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: none; background: transparent; color: var(--text-dim); font-family: Arial, sans-serif; font-size: 0.68rem; font-weight: 600; cursor: pointer; padding: 4px; transition: color 0.15s; -webkit-tap-highlight-color: transparent; }
  .tab-btn.active { color: var(--gold); border-top: 2px solid var(--gold); margin-top: -2px; }
  .tab-icon { font-size: 1.2rem; line-height: 1; }
  .tab-label { line-height: 1; }
  #toast-container { top: 52px; }
  .card-rank { font-size: 0.72rem; }
  .card-suit-center { font-size: 1.05rem; margin-top: 5px; }
  .card-rank-bottom { font-size: 0.72rem; }
  .community-slot .card-rank { font-size: 0.82rem; }
  .community-slot .card-suit-center { font-size: 1.2rem; }
  .community-slot .card-rank-bottom { font-size: 0.82rem; }
  #pot-label { font-size: 0.66rem; padding: 2px 8px; }
  #round-label { font-size: 0.66rem; }
  #pot-chips { max-width: 100px; }
}

@media (max-width: 480px) {
  :root { --seat-w: 76px; --card-w-sm: 27px; --card-h-sm: 38px; --card-w: 31px; --card-h: 45px; }
  /* Header: hide chip logo, tighten gap, abbreviate buttons via ::after trick */
  .header-brand { display: none; }
  #game-header { gap: 6px; padding: 4px 8px; }
  .end-session-btn { font-size: 0 !important; padding: 5px 8px !important; white-space: nowrap; }
  .end-session-btn::after { content: 'End'; font-size: 0.68rem; font-family: Arial, sans-serif; }
  #profile-menu-wrap { flex-shrink: 0; }
  #btn-profile { width: 28px; height: 28px; }
  /* Vertical oval — height-driven sizing so it never overflows the screen */
  #table-container { padding: 40px 0 20px; align-items: flex-start; }
  #poker-table {
    /* Use 85% of available width — wider oval so board cards don't crowd side seats */
    height: 100%;
    width: 85%;
    aspect-ratio: unset;
    max-width: none;
    max-height: none;
  }
  .seat-name { font-size: 0.68rem; }
  .seat-chips { font-size: 0.65rem; }
  .seat-pos-label { font-size: 0.52rem; }
  .seat-user-label { font-size: 0.50rem; padding: 1px 3px; }
  .chip-stack-label { font-size: 0.50rem; }
  .chip { width: 14px; height: 14px; }
  .seat-action-label { font-size: 0.65rem; }
  .action-btn { padding: 7px 10px; min-height: 38px; font-size: 0.85rem; }
  .preset-btn { padding: 3px 6px; font-size: 0.72rem; }
  #raise-controls { padding: 2px 4px; gap: 4px; }
  #action-bar { gap: 3px; }
  #deal-hand-prompt { padding: 8px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px) + 14px); gap: 8px; }
  .deal-btn { font-size: 0.92rem; padding: 11px 36px; }
  .see-analysis-btn { font-size: 0.82rem; padding: 7px 20px; }
}

@media (max-width: 380px) {
  :root { --card-w-sm: 25px; --card-h-sm: 36px; --card-w: 29px; --card-h: 42px; --seat-w: 70px; }
  #table-container { padding: 36px 0 16px; }
  #poker-table {
    height: 100%;
    width: 82%;
    aspect-ratio: unset;
    max-width: none;
  }
  .action-btn { padding: 9px 9px; font-size: 0.85rem; }
  .seat-name { font-size: 0.61rem; }
  .seat-chips { font-size: 0.59rem; }
}

/* ═══ HISTORY MODAL ══════════════════════════════════════════ */
#history-modal { position: fixed; inset: 0; z-index: 850; background: rgba(0,0,0,0.78); display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); animation: gate-in 0.2s ease; }
#history-modal.gate-hidden { display: none; }
#history-card { background: linear-gradient(160deg, #131820 0%, #0d1117 100%); border: 1px solid rgba(201,162,39,0.25); border-radius: 16px; padding: 28px 28px 20px; width: min(620px, 94vw); max-height: 78vh; overflow-y: auto; position: relative; box-shadow: 0 24px 80px rgba(0,0,0,0.7); }
#history-headline { font-size: 1.05rem; font-weight: 700; color: var(--gold); margin-bottom: 16px; letter-spacing: 0.03em; }
#history-modal-entries { display: flex; flex-direction: column; }
#history-empty { margin-top: 8px; }

/* ═══ AUTH GATE ═══════════════════════════════════════════════ */
#auth-gate { position: fixed; inset: 0; z-index: 900; background: #08090f; display: flex; align-items: stretch; overflow-y: scroll; overflow-x: hidden; -webkit-overflow-scrolling: touch; animation: gate-in 0.3s ease; }
#auth-gate.gate-hidden { display: none; }
html.has-session #auth-gate { display: none; }
#auth-gate.gate-closing { animation: gate-out 0.4s ease forwards; pointer-events: none; }
@keyframes gate-in  { from { opacity: 0; } to { opacity: 1; } }
@keyframes gate-out { from { opacity: 1; transform: translateY(0); } to { opacity: 0; transform: translateY(-24px); } }
#app.gated { visibility: hidden; }
#auth-gate-inner { display: flex; width: 100%; min-height: 100%; }
#auth-hero { flex: 1; display: flex; flex-direction: column; justify-content: center; padding: 60px 56px 60px 64px; background: linear-gradient(135deg, #080c10 0%, #0d1520 60%, #0f1a10 100%); position: relative; overflow: hidden; }
#auth-hero::before { content: ''; position: absolute; top: -120px; right: -120px; width: 480px; height: 480px; border-radius: 50%; background: radial-gradient(circle, rgba(201,162,39,0.08) 0%, transparent 70%); pointer-events: none; }
#auth-logo { font-family: Arial, sans-serif; font-size: 0.85rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--gold); margin-bottom: 48px; }
#auth-headline { font-family: Arial, sans-serif; font-size: clamp(2rem, 4vw, 3rem); font-weight: 800; color: #ffffff; line-height: 1.15; margin-bottom: 20px; letter-spacing: -0.02em; }
#auth-sub { font-size: 1rem; color: #8892a4; line-height: 1.65; max-width: 420px; margin-bottom: 36px; }
#auth-features { list-style: none; display: flex; flex-direction: column; gap: 14px; margin-bottom: 40px; }
#auth-features li { display: flex; align-items: flex-start; gap: 12px; font-size: 0.92rem; color: #c8d0e0; line-height: 1.5; }
.feat-icon { color: var(--gold); font-size: 0.85rem; flex-shrink: 0; width: 22px; text-align: center; line-height: 1.5; }
#auth-free-label { display: inline-flex; align-items: center; gap: 8px; background: rgba(201,162,39,0.1); border: 1px solid var(--gold-dim); color: var(--gold-light); font-size: 0.82rem; font-weight: 700; letter-spacing: 0.04em; padding: 8px 16px; border-radius: 20px; width: fit-content; }
#auth-card { width: 420px; flex-shrink: 0; display: flex; flex-direction: column; justify-content: center; padding: 60px 48px; background: #0d1017; border-left: 1px solid rgba(255,255,255,0.06); }
#auth-tabs { display: flex; gap: 0; margin-bottom: 28px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.auth-tab { flex: 1; padding: 10px; background: transparent; border: none; border-bottom: 2px solid transparent; color: var(--text-dim); font-family: Arial, sans-serif; font-size: 0.9rem; font-weight: 600; cursor: pointer; transition: all 0.18s; margin-bottom: -1px; }
.auth-tab.active { color: var(--white); border-bottom-color: var(--gold); }
.auth-tab:hover:not(.active) { color: var(--white); }
#auth-form { display: flex; flex-direction: column; gap: 16px; }
.auth-label { display: block; font-size: 0.78rem; font-weight: 600; color: var(--text-dim); letter-spacing: 0.05em; margin-bottom: 6px; }
.auth-input { width: 100%; padding: 11px 14px; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.10); border-radius: 7px; color: var(--white); font-family: Arial, sans-serif; font-size: 0.92rem; outline: none; transition: border-color 0.15s; }
.auth-input:focus { border-color: var(--gold-dim); }
.auth-input::placeholder { color: rgba(255,255,255,0.25); }
#auth-error { font-size: 0.8rem; color: #f47e7e; min-height: 16px; margin-top: -6px; }
.auth-cta { width: 100%; padding: 13px; background: linear-gradient(135deg, #b8860b 0%, var(--gold) 60%, #d4a832 100%); border: none; border-radius: 7px; color: #080c0e; font-family: Arial, sans-serif; font-size: 0.95rem; font-weight: 700; cursor: pointer; letter-spacing: 0.02em; transition: filter 0.15s, transform 0.1s; margin-top: 4px; }
.auth-cta:hover { filter: brightness(1.1); }
.auth-cta:active { transform: scale(0.99); }
#auth-terms { font-size: 0.72rem; color: rgba(255,255,255,0.25); text-align: center; line-height: 1.5; margin-top: 18px; }
.trial-badge { cursor: pointer; }
.trial-badge { font-size: 0.7rem; font-weight: 700; padding: 2px 9px; border-radius: 10px; letter-spacing: 0.04em; }
.trial-badge.free    { background: rgba(201,162,39,0.15); color: var(--gold-light); border: 1px solid var(--gold-dim); }
.trial-badge.expired { background: rgba(244,126,126,0.15); color: #f47e7e; border: 1px solid #6e2d2d; }
.trial-badge.pro     { background: rgba(126,244,126,0.15); color: #7ef47e; border: 1px solid #2d6e2d; }

/* ═══ UPGRADE GATE ════════════════════════════════════════════ */
#upgrade-gate { position: fixed; inset: 0; z-index: 800; background: rgba(0,0,0,0.78); display: flex; align-items: center; justify-content: center; animation: gate-in 0.25s ease; backdrop-filter: blur(6px); overflow-y: auto; padding: 16px 0; }
#upgrade-gate.gate-hidden { display: none; }
#upgrade-card { background: linear-gradient(160deg, #131820 0%, #0d1117 100%); border: 1px solid rgba(201,162,39,0.3); border-radius: 20px; padding: 36px 40px 30px; width: min(700px, 96vw); position: relative; box-shadow: 0 24px 80px rgba(0,0,0,0.7), 0 0 0 1px rgba(201,162,39,0.08); text-align: center; margin: auto; }
#upgrade-close { position: absolute; top: 14px; right: 18px; background: transparent; border: none; color: var(--text-dim); font-size: 1.4rem; cursor: pointer; line-height: 1; transition: color 0.15s; }
#upgrade-close:hover { color: var(--white); }
.upgrade-badge-dynamic { display: inline-block; background: rgba(201,162,39,0.12); border: 1px solid var(--gold-dim); color: var(--gold); font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; padding: 4px 14px; border-radius: 12px; margin-bottom: 10px; }
#upgrade-headline { font-family: Arial, sans-serif; font-size: 1.45rem; font-weight: 800; color: var(--white); margin-bottom: 14px; letter-spacing: -0.02em; }
#upgrade-toggle { display: inline-flex; background: rgba(255,255,255,0.05); border: 1px solid rgba(255,255,255,0.1); border-radius: 10px; padding: 3px; gap: 3px; margin-bottom: 18px; }
.toggle-btn { background: transparent; border: none; color: var(--text-dim); font-size: 0.85rem; font-weight: 600; padding: 8px 20px; border-radius: 7px; cursor: pointer; transition: all 0.15s; display: flex; align-items: center; gap: 6px; }
.toggle-btn.active { background: rgba(201,162,39,0.18); color: var(--gold); }
.toggle-save { background: rgba(201,162,39,0.2); color: var(--gold); font-size: 0.7rem; font-weight: 700; padding: 2px 7px; border-radius: 5px; letter-spacing: 0.03em; }
/* Two-column plan grid */
#upgrade-plans { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; text-align: left; }
.plan-col { border-radius: 14px; padding: 22px 18px 18px; position: relative; }
.plan-free { background: rgba(255,255,255,0.03); border: 1px solid rgba(255,255,255,0.08); }
.plan-pro  { background: linear-gradient(160deg, rgba(201,162,39,0.1) 0%, rgba(201,162,39,0.03) 100%); border: 1px solid rgba(201,162,39,0.35); padding-top: 28px; }
.plan-col-popular { position: absolute; top: -11px; left: 50%; transform: translateX(-50%); background: var(--gold); color: #080c0e; font-size: 0.62rem; font-weight: 800; letter-spacing: 0.07em; text-transform: uppercase; padding: 3px 12px; border-radius: 8px; white-space: nowrap; }
.plan-col-name { font-size: 0.72rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--text-dim); margin-bottom: 6px; }
.plan-pro .plan-col-name { color: var(--gold); }
.plan-col-price { margin-bottom: 2px; line-height: 1.1; }
.plan-col-amt { font-size: 1.9rem; font-weight: 800; color: var(--white); font-family: Arial, sans-serif; }
.plan-col-per { font-size: 0.8rem; color: var(--text-dim); }
#upgrade-annual-note { font-size: 0.72rem; color: #a8c070; min-height: 16px; margin-bottom: 10px; font-weight: 600; }
.plan-col-feats { list-style: none; padding: 0; margin: 12px 0 16px; display: flex; flex-direction: column; gap: 7px; }
.pcf { font-size: 0.8rem; color: var(--white); display: flex; align-items: flex-start; gap: 7px; line-height: 1.35; }
.pcf::before { flex-shrink: 0; margin-top: 1px; font-size: 0.75rem; }
.pcf-yes::before { content: "✓"; color: var(--gold); }
.pcf-no { color: var(--text-dim); opacity: 0.5; }
.pcf-no::before { content: "✕"; color: var(--text-dim); }
.pcf-soon::before { content: "✓"; color: var(--gold); opacity: 0.65; }
.pcf-soon { opacity: 0.65; }
.soon-chip { display: inline-block; background: rgba(201,162,39,0.15); color: var(--gold); font-size: 0.6rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; padding: 1px 5px; border-radius: 4px; margin-left: 3px; vertical-align: middle; }
.plan-keep-free-btn { width: 100%; padding: 9px 14px; background: transparent; border: 1px solid rgba(255,255,255,0.12); border-radius: 9px; color: var(--text-dim); font-family: Arial, sans-serif; font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: border-color 0.15s, color 0.15s; }
.plan-keep-free-btn:hover { border-color: rgba(255,255,255,0.3); color: var(--white); }
.upgrade-btn { display: block; width: 100%; padding: 11px 16px; background: linear-gradient(135deg, #b8860b 0%, var(--gold) 60%, #d4a832 100%); border: none; border-radius: 9px; color: #080c0e; font-family: Arial, sans-serif; font-size: 0.95rem; font-weight: 700; cursor: pointer; text-decoration: none; text-align: center; letter-spacing: 0.02em; transition: filter 0.15s, opacity 0.15s; }
.upgrade-btn:hover { filter: brightness(1.1); }
#upgrade-cta-error { font-size: 0.75rem; color: #f47e7e; min-height: 14px; margin-top: 6px; }
#upgrade-footer { font-size: 0.72rem; color: var(--text-dim); margin-top: 14px; }
/* ═══ SESSION MODAL ═══════════════════════════════════════════ */
#session-modal { position: fixed; inset: 0; z-index: 850; background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); animation: gate-in 0.25s ease; overflow-y: auto; padding: 20px; }
#session-modal.gate-hidden { display: none; }
#session-card { background: linear-gradient(160deg, #131820 0%, #0d1117 100%); border: 1px solid rgba(201,162,39,0.25); border-radius: 18px; padding: 40px 44px; width: min(560px, 96vw); position: relative; text-align: center; box-shadow: 0 24px 80px rgba(0,0,0,0.7); }
.modal-close-btn { position: absolute; top: 14px; right: 18px; background: transparent; border: none; color: var(--text-dim); font-size: 1.4rem; cursor: pointer; line-height: 1; transition: color 0.15s; }
.modal-close-btn:hover { color: var(--white); }
#session-badge-pill { display: inline-block; background: rgba(201,162,39,0.12); border: 1px solid var(--gold-dim); color: var(--gold); font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; padding: 4px 12px; border-radius: 12px; margin-bottom: 14px; }
#session-headline { font-size: 1.6rem; font-weight: 800; color: var(--white); margin-bottom: 24px; letter-spacing: -0.02em; }
#session-stats-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-bottom: 28px; }
.session-stat { background: rgba(255,255,255,0.04); border: 1px solid rgba(255,255,255,0.08); border-radius: 10px; padding: 14px 10px; }
.session-stat-value { font-size: 1.4rem; font-weight: 800; color: var(--gold-light); line-height: 1; margin-bottom: 5px; }
.session-stat-label { font-size: 0.65rem; color: var(--text-dim); font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }
#session-label-section { margin-bottom: 24px; text-align: left; }
#session-label-heading { font-size: 0.8rem; font-weight: 700; color: var(--gold); letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 12px; }
.label-accuracy-row { display: flex; align-items: center; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid rgba(255,255,255,0.05); font-size: 0.82rem; }
.label-accuracy-row:last-child { border-bottom: none; }
.la-name   { color: var(--white); font-weight: 600; min-width: 80px; }
.la-guess  { font-size: 0.72rem; padding: 2px 8px; border-radius: 3px; font-weight: 700; }
.la-actual { font-size: 0.72rem; padding: 2px 8px; border-radius: 3px; font-weight: 700; color: var(--text-dim); background: rgba(255,255,255,0.06); }
.la-result { font-size: 0.8rem; font-weight: 700; margin-left: 4px; }
.la-correct   { color: #7ef47e; }
.la-incorrect { color: #f47e7e; }
.la-unread    { color: var(--text-dim); font-style: italic; font-size: 0.75rem; }

/* ═══ REBUY MODAL ════════════════════════════════════════════ */
#rebuy-modal { position: fixed; inset: 0; z-index: 850; background: rgba(0,0,0,0.8); display: flex; align-items: center; justify-content: center; backdrop-filter: blur(4px); animation: gate-in 0.25s ease; }
#rebuy-modal.gate-hidden { display: none; }
#access-modal.gate-hidden { display: none; }
#rebuy-card { background: linear-gradient(160deg, #131820 0%, #0d1117 100%); border: 1px solid rgba(244,126,126,0.3); border-radius: 18px; padding: 40px 48px; width: min(380px, 94vw); text-align: center; display: flex; flex-direction: column; gap: 14px; box-shadow: 0 24px 80px rgba(0,0,0,0.7); }
#rebuy-icon    { font-size: 2.5rem; line-height: 1; }
#rebuy-card h3 { font-size: 1.3rem; font-weight: 800; color: var(--white); }
#rebuy-sub     { font-size: 0.88rem; color: var(--text-dim); line-height: 1.5; }

@media (max-width: 768px) {
  #auth-gate-inner { flex-direction: column; min-height: 0; }
  #auth-hero { flex: 0 0 auto; justify-content: flex-start; padding: 20px 24px 14px; overflow: hidden; }
  #auth-logo-img { width: auto; height: 44px; margin-bottom: 10px; }
  #auth-headline { font-size: 1.5rem; margin-bottom: 6px; }
  #auth-sub { font-size: 0.82rem; margin-bottom: 0; }
  #auth-features { display: none; }
  #auth-free-label { display: none; }
  #auth-features { gap: 10px; margin-bottom: 20px; }
  #auth-features li { font-size: 0.85rem; }
  #auth-logo     { margin-bottom: 24px; font-size: 0.78rem; }
  #auth-free-label { font-size: 0.75rem; }
  #auth-card { width: 100%; padding: 28px 24px 40px; border-left: none; border-top: 1px solid rgba(255,255,255,0.06); }
  #upgrade-plans { grid-template-columns: 1fr; }
  .plan-free { order: 2; }
  .plan-pro  { order: 1; }
  #upgrade-card  { padding: 28px 16px 20px; }
  #upgrade-headline { font-size: 1.2rem; }
  #session-stats-grid { grid-template-columns: repeat(2, 1fr); }
  #session-card { padding: 32px 20px; }
  #footer-inner { flex-direction: column; gap: 8px; text-align: center; }
  #footer-disclaimer { padding: 0; }
  .header-brand-name { display: none; }
  #session-headline { font-size: 1.3rem; }
  #rebuy-card { padding: 32px 28px; }
}

/* ── Session stats widget ────────────────────────────────────────────────── */
#stats-widget {
  padding: 10px 14px 10px;
  flex-shrink: 0;
}
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 6px;
}
.stats-cell {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 7px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.stats-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--white);
  line-height: 1;
}
.stats-lbl {
  font-size: 0.58rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.stats-row2 {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 2px;
  font-size: 0.72rem;
  font-weight: 600;
}
.stat-pos { color: #4ade80; }
.stat-neg { color: #f87171; }
.stats-net   { color: var(--text-dim); }
.stats-bb100 { color: var(--text-dim); }
.stats-net.stat-pos   { color: #4ade80; }
.stats-net.stat-neg   { color: #f87171; }
.stats-bb100.stat-pos { color: #4ade80; }
.stats-bb100.stat-neg { color: #f87171; }
.stats-empty {
  text-align: center;
  font-size: 0.72rem;
  color: var(--text-dim);
  padding: 8px 0;
}

/* ── Header logo ─────────────────────────────────────────────────────────── */
.header-brand { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.header-logo {
  height: 30px;
  width: 30px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}
.header-brand-name { font-size: 0.84rem; font-weight: 700; color: var(--gold-light); letter-spacing: 0.01em; white-space: nowrap; }
@media (max-width: 768px) {
  .header-logo { height: 26px; width: 26px; }
  .header-brand-name { display: none; }
}

/* ── Auth gate logo ──────────────────────────────────────────────────────── */
#auth-logo-img {
  width: min(280px, 70vw);
  height: auto;
  border-radius: 8px;
  margin-bottom: 8px;
  display: block;
}

/* ── Site footer ─────────────────────────────────────────────────────────── */
#site-footer {
  background: #080f18;
  border-top: 1px solid rgba(255,255,255,0.07);
  padding: 12px 24px;
  flex-shrink: 0;
}
#footer-inner {
  max-width: 1000px;
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}
#footer-brand {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
#footer-logo {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  object-fit: cover;
}
#footer-brand-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.04em;
  white-space: nowrap;
}
#footer-disclaimer {
  font-size: 0.65rem;
  color: var(--text-dim);
  line-height: 1.45;
  text-align: center;
  padding: 0 8px;
  flex: 1;
}
#footer-links {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.65rem;
  flex-shrink: 0;
}
#footer-links a {
  color: var(--text-dim);
  text-decoration: none;
  transition: color 0.2s;
  white-space: nowrap;
}
#footer-links a:hover { color: var(--white); }
.footer-sep { color: rgba(255,255,255,0.2); }


/* Footer only visible at auth gate (game uses 100dvh so footer is below fold) */
/* On mobile the footer is accessible by scrolling down from the auth gate */

/* ── Email verification step ─────────────────────────────────────────────── */
.verify-prompt {
  font-size: 0.85rem;
  color: var(--text-dim);
  margin-bottom: 16px;
  line-height: 1.5;
  text-align: center;
}
.verify-prompt strong { color: var(--white); }
.verify-code-row { margin-bottom: 8px; }
.verify-code-input {
  text-align: center;
  font-size: 1.4rem;
  letter-spacing: 8px;
  font-weight: 700;
}
#verify-error {
  min-height: 18px;
  font-size: 0.78rem;
  color: #f87171;
  text-align: center;
  margin-bottom: 8px;
}
#verify-step .link-btn {
  display: block;
  margin: 6px auto 0;
  font-size: 0.78rem;
  color: var(--text-dim);
  background: none;
  border: none;
  cursor: pointer;
  text-decoration: underline;
}
#verify-step .link-btn:hover { color: var(--white); }

/* ═══ TUTORIAL OVERLAY ═══════════════════════════════ */
#tutorial-overlay { position: fixed; inset: 0; z-index: 900; background: rgba(0,0,0,0.75); display: flex; align-items: center; justify-content: center; padding: 16px; backdrop-filter: blur(4px); animation: gate-in 0.2s ease; }
#tutorial-overlay[style*="display: none"] { display: none !important; }
#tutorial-card { background: linear-gradient(160deg, #131820 0%, #0d1117 100%); border: 1px solid rgba(201,162,39,0.3); border-radius: 20px; padding: 36px 32px 28px; width: min(520px, 96vw); position: relative; box-shadow: 0 24px 80px rgba(0,0,0,0.7); text-align: center; }
#tutorial-skip { position: absolute; top: 14px; right: 16px; background: transparent; border: none; color: var(--text-dim); font-size: 0.72rem; font-weight: 600; cursor: pointer; padding: 4px 8px; border-radius: 5px; transition: color 0.15s; font-family: Arial, sans-serif; }
#tutorial-skip:hover { color: var(--white); }
#tutorial-icon { font-size: 2.4rem; margin-bottom: 10px; line-height: 1; }
#tutorial-title { font-family: Arial, sans-serif; font-size: 1.2rem; font-weight: 800; color: var(--white); margin-bottom: 14px; letter-spacing: -0.01em; }
#tutorial-body { font-size: 0.88rem; color: var(--text-dim); line-height: 1.6; margin-bottom: 22px; }
#tutorial-body strong { color: var(--gold); font-weight: 700; }
#tutorial-dots { display: flex; justify-content: center; gap: 6px; margin-bottom: 22px; }
.tdot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,0.15); transition: background 0.2s; }
.tdot.active { background: var(--gold); }
#tutorial-actions { display: flex; gap: 10px; justify-content: center; }
#tutorial-prev { padding: 9px 20px; background: transparent; border: 1px solid var(--grey); border-radius: 8px; color: var(--text-dim); font-family: Arial, sans-serif; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all 0.15s; }
#tutorial-prev:hover { border-color: rgba(255,255,255,0.3); color: var(--white); }
#tutorial-next { padding: 9px 24px; background: rgba(201,162,39,0.15); border: 1px solid var(--gold-dim); border-radius: 8px; color: var(--gold); font-family: Arial, sans-serif; font-size: 0.85rem; font-weight: 700; cursor: pointer; transition: all 0.15s; }
#tutorial-next:hover { background: rgba(201,162,39,0.25); color: var(--gold-light); }
#tutorial-next.tutorial-finish { background: linear-gradient(135deg, #b8860b 0%, var(--gold) 60%, #d4a832 100%); border-color: transparent; color: #080c0e; }
#tutorial-next.tutorial-finish:hover { filter: brightness(1.1); }
@media (max-width: 480px) {
  #tutorial-card { padding: 28px 18px 22px; }
  #tutorial-title { font-size: 1.05rem; }
  #tutorial-body { font-size: 0.82rem; }
}