:root {
  --bg-deep: #0b1015;
  --bg-panel: #121922;
  --bg-card: #17212c;
  --bg-elev: #1e2a38;
  --border: rgba(255, 255, 255, 0.09);
  --border-gold: rgba(212, 168, 83, 0.45);
  --felt-center: #195642;
  --felt-edge: #0d3326;
  --rail-dark: #2a1e16;
  --gold: #d4a853;
  --gold-bright: #f0c975;
  --text-main: #edf2f7;
  --text-muted: #8fa3b8;
  --green: #22c55e;
  --red: #ef4444;
  --blue: #3b82f6;
  --amber: #f59e0b;
  --purple: #a855f7;
  --font: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  height: 100%;
  background: var(--bg-deep);
  color: var(--text-main);
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

.hidden {
  display: none !important;
}

.muted {
  color: var(--text-muted);
}

.danger-text {
  color: #fca5a5 !important;
}

button, select, input {
  font-family: inherit;
}

button {
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

select {
  background: var(--bg-elev);
  color: var(--text-main);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: 12px;
}

/* Top Navigation */
.topbar {
  height: 48px;
  background: #0d131a;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  gap: 12px;
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 18px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.brand-suit {
  color: var(--gold);
  font-size: 16px;
}

.brand-name {
  font-weight: 700;
  font-size: 15px;
  letter-spacing: 0.02em;
}

.brand-sub {
  font-size: 11px;
  color: var(--text-muted);
}

.nav-tabs {
  display: flex;
  gap: 4px;
}

.nav-tab {
  padding: 6px 12px;
  border-radius: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: 0.15s ease;
}

.nav-tab:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.05);
}

.nav-tab.active {
  background: rgba(212, 168, 83, 0.15);
  color: var(--gold-bright);
  border: 1px solid rgba(212, 168, 83, 0.3);
}

.topbar-right {
  display: flex;
  align-items: center;
}

.live-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.status-pill {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--gold-bright);
  white-space: nowrap;
}

.seg-group {
  display: inline-flex;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 2px;
  gap: 2px;
}

.seg-group.full {
  width: 100%;
}

.seg-group.full .seg-btn {
  flex: 1;
}

.seg-btn {
  padding: 4px 9px;
  border-radius: 5px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
  transition: 0.12s ease;
}

.seg-btn:hover {
  color: var(--text-main);
}

.seg-btn.active {
  background: var(--bg-elev);
  color: var(--text-main);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

.icon-btn, .btn-ghost-sm {
  padding: 5px 10px;
  border-radius: 7px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  font-size: 11.5px;
  font-weight: 600;
  color: var(--text-muted);
}

.icon-btn.active {
  border-color: var(--gold);
  color: var(--gold-bright);
}

.btn-primary-sm, .btn-primary {
  background: linear-gradient(135deg, #d4a853, #b88835);
  color: #11161c;
  font-weight: 700;
  border-radius: 7px;
  padding: 6px 12px;
  font-size: 12px;
}

.btn-primary {
  padding: 9px 18px;
  font-size: 13px;
}

.btn-primary:hover, .btn-primary-sm:hover {
  filter: brightness(1.07);
}

.btn-gold-sm, .btn-gold {
  background: rgba(212, 168, 83, 0.16);
  border: 1px solid var(--border-gold);
  color: var(--gold-bright);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 11.5px;
  font-weight: 600;
}

.btn-gold {
  padding: 9px 14px;
  font-size: 12.5px;
}

.btn-ghost {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-main);
  border-radius: 7px;
  padding: 9px 16px;
  font-size: 12.5px;
  font-weight: 600;
}

/* Views */
.view {
  display: none;
  height: calc(100vh - 48px);
}

.view.active {
  display: block;
}

/* LIVE TABLE LAYOUT (Zero outer scroll at 1366x768) */
.table-workspace {
  display: flex;
  height: 100%;
  overflow: hidden;
}

.table-stage {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  padding: 8px 14px 10px;
  gap: 6px;
  background: radial-gradient(circle at 50% 42%, #131c26 0%, #0b1015 80%);
}

.table-hud {
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-shrink: 0;
}

.hud-left, .hud-right {
  display: flex;
  align-items: center;
  gap: 8px;
}

.hud-badge {
  background: rgba(212, 168, 83, 0.16);
  color: var(--gold-bright);
  border: 1px solid rgba(212, 168, 83, 0.35);
  border-radius: 999px;
  padding: 2px 9px;
  font-size: 11px;
  font-weight: 700;
}

.hud-badge.bubble {
  background: rgba(239, 68, 68, 0.18);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.45);
}

.hud-text {
  font-size: 12px;
  font-weight: 600;
}

.chip-toggle {
  padding: 4px 9px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  font-size: 11px;
  color: var(--text-muted);
}

/* Poker Felt Arena */
.table-arena {
  flex: 1;
  min-height: 0;
  position: relative;
  width: 100%;
}

.poker-felt {
  position: absolute;
  top: 76px;
  bottom: 84px;
  left: 142px;
  right: 142px;
  border-radius: 220px;
  background: radial-gradient(ellipse at center, var(--felt-center) 0%, #124031 60%, var(--felt-edge) 100%);
  border: 11px solid var(--rail-dark);
  box-shadow:
    inset 0 0 42px rgba(0, 0, 0, 0.55),
    0 18px 40px rgba(0, 0, 0, 0.65),
    0 0 0 2px rgba(212, 168, 83, 0.25);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.felt-rail {
  position: absolute;
  inset: 8px;
  border-radius: 210px;
  border: 1px solid rgba(212, 168, 83, 0.18);
  pointer-events: none;
}

.felt-watermark {
  position: absolute;
  bottom: 16%;
  font-size: 10px;
  letter-spacing: 0.24em;
  color: rgba(255, 255, 255, 0.12);
  font-weight: 700;
  pointer-events: none;
}

.center-pot-area {
  display: flex;
  align-items: center;
  gap: 8px;
  z-index: 2;
}

.pot-pill {
  background: rgba(8, 14, 18, 0.72);
  border: 1px solid rgba(212, 168, 83, 0.45);
  border-radius: 999px;
  padding: 4px 13px;
  display: flex;
  align-items: center;
  gap: 7px;
}

.pot-label {
  font-size: 10px;
  font-weight: 700;
  color: var(--gold);
  letter-spacing: 0.08em;
}

.pot-value {
  font-family: var(--mono);
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}

.street-badge {
  background: rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: #d7e4df;
}

.community-cards {
  display: flex;
  gap: 7px;
  min-height: 70px;
  align-items: center;
  z-index: 2;
}

.showdown-banner {
  background: rgba(11, 16, 21, 0.88);
  border: 1px solid var(--gold);
  border-radius: 8px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gold-bright);
  z-index: 3;
  max-width: 82%;
  text-align: center;
}

/* Playing Cards */
.card {
  width: 48px;
  height: 68px;
  border-radius: 6px;
  background: #f8fafc;
  border: 1px solid #cbd5e1;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 3px 5px;
  font-weight: 800;
  user-select: none;
  position: relative;
}

.card.mini {
  width: 26px;
  height: 37px;
  padding: 2px 3px;
  border-radius: 4px;
}

.card.hero-card {
  width: 52px;
  height: 74px;
}

.card.back {
  background: linear-gradient(135deg, #1d3557 0%, #12233b 100%);
  border: 1px solid rgba(212, 168, 83, 0.55);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.06) 0px,
    rgba(255, 255, 255, 0.06) 3px,
    transparent 3px,
    transparent 6px
  );
}

.card-rank {
  font-size: 14px;
  line-height: 1;
}

.card.mini .card-rank {
  font-size: 10px;
}

.card-suit-center {
  font-size: 19px;
  line-height: 1;
  align-self: center;
}

.card.mini .card-suit-center {
  font-size: 12px;
}

.suit-s { color: #0f172a; }
.suit-h { color: #dc2626; }
.suit-d { color: #dc2626; }
.suit-c { color: #0f172a; }

body.four-color .suit-d { color: #2563eb; }
body.four-color .suit-c { color: #16a34a; }

.card-placeholder {
  width: 48px;
  height: 68px;
  border-radius: 6px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.14);
}

/* Seats Layer & Coordinates */
.seats-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.seat-wrapper {
  position: absolute;
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.seat-pod {
  width: 156px;
  background: rgba(16, 23, 31, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.13);
  border-radius: 10px;
  padding: 5px 7px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 5px;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.5);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
  position: relative;
}

.table-arena.size-9 .seat-pod.opp-pod {
  width: 146px;
  padding: 4px 6px;
}

.seat-pod.hero-pod {
  width: 268px;
  padding: 6px 10px;
  border-color: rgba(212, 168, 83, 0.4);
}

.seat-pod.active-turn {
  border-color: var(--gold-bright);
  box-shadow: 0 0 0 2px rgba(240, 201, 117, 0.35), 0 8px 22px rgba(0, 0, 0, 0.65);
}

.seat-pod.folded {
  opacity: 0.45;
}

.seat-pod.eliminated {
  opacity: 0.25;
  filter: grayscale(1);
}

.seat-info {
  min-width: 0;
  flex: 1;
}

.seat-top-row {
  display: flex;
  align-items: center;
  gap: 4px;
}

.seat-avatar {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.seat-name {
  font-weight: 700;
  font-size: 11.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat-pos-pill {
  font-size: 9.5px;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.09);
  color: var(--gold-bright);
  margin-left: auto;
  flex-shrink: 0;
}

.seat-arch {
  font-size: 10px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat-stack-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 4px;
  margin-top: 2px;
}

.seat-stack {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  color: #e2e8f0;
}

.seat-cards {
  display: flex;
  gap: 3px;
  flex-shrink: 0;
}

.dealer-puck {
  position: absolute;
  top: -7px;
  right: -7px;
  width: 19px;
  height: 19px;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, #fff, #cbd5e1);
  color: #0f172a;
  font-size: 10px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.6);
  border: 1px solid #475569;
}

.seat-action-tag {
  margin-top: 3px;
  background: rgba(15, 23, 42, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 10px;
  font-weight: 700;
  color: #cbd5e1;
  white-space: nowrap;
}

.seat-action-tag.act-raise {
  border-color: rgba(245, 158, 11, 0.5);
  color: #fcd34d;
}

.seat-action-tag.act-call {
  border-color: rgba(34, 197, 94, 0.45);
  color: #86efac;
}

.seat-action-tag.act-fold {
  color: #94a3b8;
}

.seat-bet-chip {
  position: absolute;
  background: rgba(12, 18, 26, 0.88);
  border: 1px solid var(--border-gold);
  color: var(--gold-bright);
  border-radius: 999px;
  padding: 2px 8px;
  font-family: var(--mono);
  font-size: 10.5px;
  font-weight: 700;
  white-space: nowrap;
  z-index: 4;
}

/* Explicit Seat Placements for 2-Max, 6-Max, 9-Max (Zero Overlap) */
.pos-hero { left: 50%; bottom: 4px; transform: translateX(-50%); }
.pos-hero .seat-bet-chip { top: -26px; left: 50%; transform: translateX(-50%); }

/* 2-Max */
.size-2 .s-1 { left: 50%; top: 4px; transform: translateX(-50%); }
.size-2 .s-1 .seat-bet-chip { bottom: -24px; left: 50%; transform: translateX(-50%); }

/* 6-Max */
.size-6 .s-1 { left: 4px; top: 64%; transform: translateY(-50%); }
.size-6 .s-1 .seat-bet-chip { right: -64px; top: 18px; }
.size-6 .s-2 { left: 4%; top: 10px; }
.size-6 .s-2 .seat-bet-chip { bottom: -22px; right: -12px; }
.size-6 .s-3 { left: 50%; top: 4px; transform: translateX(-50%); }
.size-6 .s-3 .seat-bet-chip { bottom: -22px; left: 50%; transform: translateX(-50%); }
.size-6 .s-4 { right: 4%; top: 10px; }
.size-6 .s-4 .seat-bet-chip { bottom: -22px; left: -12px; }
.size-6 .s-5 { right: 4px; top: 64%; transform: translateY(-50%); }
.size-6 .s-5 .seat-bet-chip { left: -64px; top: 18px; }

/* 9-Max */
.size-9 .s-1 { left: 6%; bottom: 12px; }
.size-9 .s-1 .seat-bet-chip { top: -24px; right: -18px; }
.size-9 .s-2 { left: 4px; top: 48%; transform: translateY(-50%); }
.size-9 .s-2 .seat-bet-chip { right: -58px; top: 18px; }
.size-9 .s-3 { left: 7%; top: 8px; }
.size-9 .s-3 .seat-bet-chip { bottom: -22px; right: -12px; }
.size-9 .s-4 { left: 36%; top: 2px; transform: translateX(-50%); }
.size-9 .s-4 .seat-bet-chip { bottom: -22px; left: 50%; transform: translateX(-50%); }
.size-9 .s-5 { left: 64%; top: 2px; transform: translateX(-50%); }
.size-9 .s-5 .seat-bet-chip { bottom: -22px; left: 50%; transform: translateX(-50%); }
.size-9 .s-6 { right: 7%; top: 8px; }
.size-9 .s-6 .seat-bet-chip { bottom: -22px; left: -12px; }
.size-9 .s-7 { right: 4px; top: 48%; transform: translateY(-50%); }
.size-9 .s-7 .seat-bet-chip { left: -58px; top: 18px; }
.size-9 .s-8 { right: 6%; bottom: 12px; }
.size-9 .s-8 .seat-bet-chip { top: -24px; left: -18px; }

.hero-hand-badge {
  font-size: 10.5px;
  font-weight: 700;
  color: var(--gold-bright);
  margin-top: 2px;
}

/* Opponent Scouting Popover */
.scout-popover {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 280px;
  background: #141d27;
  border: 1px solid var(--border-gold);
  border-radius: 11px;
  padding: 12px 14px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.75);
  z-index: 30;
}

.scout-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-top: 9px;
}

.scout-stat {
  background: var(--bg-deep);
  border-radius: 6px;
  padding: 5px;
  text-align: center;
}

.scout-stat span {
  display: block;
  font-size: 10px;
  color: var(--text-muted);
}

.scout-stat strong {
  font-family: var(--mono);
  font-size: 12px;
}

/* Action Bar */
.action-bar {
  height: 68px;
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.bet-controls {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.action-buttons {
  display: flex;
  gap: 8px;
}

.act-btn {
  padding: 9px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: transform 0.08s ease, filter 0.12s ease;
}

.act-btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

.act-btn kbd {
  font-size: 10px;
  background: rgba(0, 0, 0, 0.28);
  padding: 1px 5px;
  border-radius: 4px;
  font-family: var(--mono);
}

.act-fold { background: #334155; color: #f1f5f9; }
.act-call { background: #166534; color: #dcfce7; }
.act-raise { background: linear-gradient(135deg, #d97706, #b45309); color: #fffbeb; }

.sizing-controls {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-width: 470px;
}

.quick-bets {
  display: flex;
  gap: 5px;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.qb-btn {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 5px;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
}

.qb-btn:hover {
  border-color: var(--gold);
  color: var(--gold-bright);
}

.slider-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.slider-row input[type="range"] {
  flex: 1;
  accent-color: var(--gold);
}

.raise-readout {
  font-family: var(--mono);
  font-size: 11.5px;
  font-weight: 700;
  min-width: 96px;
  text-align: right;
  color: var(--gold-bright);
}

.hand-end-bar {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.hand-end-summary {
  font-size: 13px;
  font-weight: 600;
}

.hand-end-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

/* Right Sidebar (Coach + Hand Feed) */
.right-sidebar {
  width: 350px;
  flex-shrink: 0;
  background: var(--bg-panel);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 10px;
  gap: 10px;
  overflow-y: auto;
}

.coach-card, .log-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.coach-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.coach-title-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.coach-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}

.coach-title {
  font-weight: 700;
  font-size: 13px;
}

.honest-tag {
  font-size: 10px;
  font-weight: 600;
  background: rgba(59, 130, 246, 0.14);
  color: #93c5fd;
  border: 1px solid rgba(59, 130, 246, 0.3);
  border-radius: 999px;
  padding: 1px 7px;
}

.info-pill {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
}

.coach-limits-box {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.28);
  border-radius: 7px;
  padding: 8px;
  font-size: 11.5px;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.coach-rec-banner {
  background: rgba(212, 168, 83, 0.12);
  border: 1px solid rgba(212, 168, 83, 0.35);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 8px;
}

.coach-rec-label {
  font-size: 14px;
  font-weight: 800;
  color: var(--gold-bright);
}

.coach-headline {
  font-size: 12px;
  font-weight: 600;
  margin-top: 2px;
}

.coach-why {
  font-size: 12px;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.coach-metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 5px;
  margin-bottom: 8px;
}

.metric-tile {
  background: var(--bg-deep);
  border-radius: 6px;
  padding: 5px 4px;
  text-align: center;
}

.metric-tile span {
  display: block;
  font-size: 9.5px;
  color: var(--text-muted);
}

.metric-tile strong {
  font-family: var(--mono);
  font-size: 11.5px;
}

.coach-pillars-toggle {
  font-size: 11px;
  color: var(--gold);
  font-weight: 600;
  text-decoration: underline;
}

.pillars-list {
  margin-top: 7px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.pillar-item {
  background: rgba(0, 0, 0, 0.22);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 11.5px;
}

.pillar-item strong {
  color: var(--gold-bright);
  display: block;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.coach-feedback-box {
  margin-top: 8px;
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.04);
}

.grade-pill {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10.5px;
  font-weight: 800;
  margin-bottom: 4px;
}

.grade-Great, .grade-Good { background: rgba(34, 197, 94, 0.2); color: #86efac; }
.grade-Inaccuracy { background: rgba(245, 158, 11, 0.2); color: #fcd34d; }
.grade-Mistake, .grade-Blunder { background: rgba(239, 68, 68, 0.22); color: #fca5a5; }

.log-card {
  flex: 1;
  min-height: 150px;
  display: flex;
  flex-direction: column;
}

.log-header {
  display: flex;
  justify-content: space-between;
  font-weight: 700;
  font-size: 12px;
  margin-bottom: 6px;
}

.hand-log-list {
  flex: 1;
  overflow-y: auto;
  font-size: 11.5px;
  color: #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.log-line {
  padding: 2px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* SCENARIO LAB & DRILLS */
.lab-shell, .report-shell {
  height: 100%;
  overflow-y: auto;
  padding: 16px 22px;
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.lab-toolbar, .report-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
}

.lab-filters, .report-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.mastery-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  overflow-x: visible;
  padding-bottom: 2px;
}

.mastery-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 11px;
  white-space: nowrap;
  cursor: pointer;
}

.mastery-chip.active {
  border-color: var(--gold);
}

.lab-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 14px;
  align-items: start;
}

.spot-card, .explain-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.spot-badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.spot-felt-box {
  background: radial-gradient(ellipse at center, #174c3b 0%, #0d2e23 100%);
  border: 2px solid rgba(212, 168, 83, 0.35);
  border-radius: 12px;
  padding: 14px;
  margin: 10px 0 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.spot-cards-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.spot-cards-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.spot-cards-group label {
  font-size: 10.5px;
  font-weight: 700;
  color: #cbd5e1;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cards-inline {
  display: flex;
  gap: 6px;
}

.spot-meta-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.spot-meta-box {
  background: rgba(0, 0, 0, 0.32);
  border-radius: 7px;
  padding: 6px 8px;
}

.spot-meta-box span {
  display: block;
  font-size: 10px;
  color: #b7c9c2;
}

.spot-meta-box strong {
  font-family: var(--mono);
  font-size: 12px;
}

.spot-narrative {
  background: var(--bg-panel);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.spot-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.spot-opt-btn {
  text-align: left;
  padding: 10px 14px;
  border-radius: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  font-weight: 600;
  font-size: 13px;
  transition: 0.12s ease;
}

.spot-opt-btn:hover:not(:disabled) {
  border-color: var(--gold);
  background: #253445;
}

.spot-opt-btn.opt-best {
  border-color: var(--green);
  background: rgba(34, 197, 94, 0.18);
  color: #bbf7d0;
}

.spot-opt-btn.opt-wrong {
  border-color: var(--red);
  background: rgba(239, 68, 68, 0.18);
  color: #fecaca;
}

.explain-placeholder {
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 20px 8px;
}

.verdict-banner {
  border-radius: 9px;
  padding: 10px 12px;
  margin-bottom: 12px;
  font-weight: 700;
}

.verdict-banner.ok {
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.45);
  color: #bbf7d0;
}

.verdict-banner.miss {
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #fecaca;
}

/* DRILLS */
.drill-hero-card {
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  padding: 18px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.drill-targets-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.drill-topbar {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.drill-progress-wrap {
  flex: 1;
}

.drill-progress-meta {
  display: flex;
  justify-content: space-between;
  margin-bottom: 5px;
  font-weight: 700;
}

.progress-track {
  height: 8px;
  background: var(--bg-deep);
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold), var(--green));
  width: 5%;
  transition: width 0.25s ease;
}

.drill-stats-pills {
  display: flex;
  align-items: center;
  gap: 8px;
}

.kpi-pill {
  background: var(--bg-elev);
  border-radius: 7px;
  padding: 5px 10px;
  font-size: 12px;
}

/* REPORT CARD */
.report-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 10px;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
}

.kpi-card span {
  font-size: 11px;
  color: var(--text-muted);
}

.kpi-card strong {
  display: block;
  font-size: 22px;
  font-family: var(--mono);
  margin-top: 2px;
  color: var(--gold-bright);
}

.report-two-col {
  display: grid;
  grid-template-columns: 0.9fr 1.1fr;
  gap: 14px;
}

.report-panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.report-panel h3 {
  margin-bottom: 12px;
  font-size: 14px;
}

.street-bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.street-bar-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.street-bar-head {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
}

.bar-bg {
  height: 10px;
  background: var(--bg-deep);
  border-radius: 999px;
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #22c55e);
}

.leaks-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.leak-card {
  background: var(--bg-panel);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leak-card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.leak-example {
  background: rgba(0, 0, 0, 0.28);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 11px;
  color: #cbd5e1;
}

/* MODALS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 9, 13, 0.78);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 16px;
}

.modal-card {
  background: var(--bg-panel);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  padding: 18px 20px;
  width: 100%;
  max-width: 600px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.8);
}

.range-modal-card {
  max-width: 660px;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}

.modal-close {
  font-size: 22px;
  color: var(--text-muted);
  line-height: 1;
}

.setup-section {
  margin-bottom: 12px;
}

.setup-label {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.format-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.format-card {
  text-align: left;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}

.format-card.active {
  border-color: var(--gold);
  background: rgba(212, 168, 83, 0.12);
}

.fc-title {
  font-weight: 700;
  font-size: 13.5px;
  margin-bottom: 3px;
}

.fc-desc {
  font-size: 11.5px;
  color: var(--text-muted);
}

.setup-row-2 {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 12px;
}

.setup-row-2 select {
  width: 100%;
}

.pos-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pos-chip {
  padding: 6px 11px;
  border-radius: 7px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 12px;
  font-weight: 700;
}

.pos-chip.active {
  background: rgba(212, 168, 83, 0.2);
  border-color: var(--gold);
  color: var(--gold-bright);
}

.setup-tourney-box {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 10px 12px;
  margin-bottom: 12px;
}

.payouts-preview {
  font-weight: 700;
  color: var(--gold-bright);
  padding-top: 4px;
}

.setup-toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 12px;
  margin-bottom: 12px;
  cursor: pointer;
}

.toggle-title {
  font-size: 12.5px;
  font-weight: 700;
}

.toggle-desc {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.setup-toggle-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--gold);
  flex-shrink: 0;
  cursor: pointer;
}

.coach-mode-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  margin-top: 3px;
}

.coach-mix-strip {
  font-size: 10px;
  font-weight: 700;
  color: var(--gold);
  margin-top: 2px;
}

.setup-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

/* 13x13 Preflop Range Grid */
.range-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
}

.range-grid {
  display: grid;
  grid-template-columns: repeat(13, 1fr);
  gap: 2px;
  margin-bottom: 10px;
}

.range-cell {
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  border-radius: 3px;
  background: #1a232e;
  color: #64748b;
}

.range-cell.tag-raise, .range-cell.tag-3bet { background: #b45309; color: #fffbeb; }
.range-cell.tag-bluff { background: #7c3aed; color: #f5f3ff; }
.range-cell.tag-call { background: #15803d; color: #dcfce7; }
.range-cell.hero-highlight { outline: 2px solid #fff; box-shadow: 0 0 8px #f0c975; z-index: 2; }

.range-legend {
  display: flex;
  gap: 14px;
  font-size: 11px;
  color: var(--text-muted);
}

.lg-box {
  display: inline-block;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  margin-right: 4px;
}
.lg-raise { background: #b45309; }
.lg-bluff { background: #7c3aed; }
.lg-call { background: #15803d; }
.lg-fold { background: #1a232e; }

/* ==================== RESPONSIVE / MOBILE LAYOUT ==================== */
@media (max-width: 960px) {
  html, body {
    height: auto;
    min-height: 100%;
    overflow-x: hidden;
  }
  .view {
    height: auto;
    min-height: calc(100dvh - 48px);
  }
  .topbar {
    height: auto;
    flex-wrap: wrap;
    padding: 8px 10px;
    gap: 8px;
  }
  .topbar-left {
    width: 100%;
    justify-content: space-between;
    gap: 8px;
    flex-wrap: wrap;
  }
  .nav-tabs {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
  }
  .nav-tab {
    padding: 6px 4px;
    font-size: 11px;
    text-align: center;
  }
  .topbar-right, .live-controls {
    width: 100%;
    flex-wrap: wrap;
    gap: 6px;
    justify-content: space-between;
  }
  .table-workspace {
    flex-direction: column;
    height: auto;
    overflow: visible;
  }
  .table-stage {
    width: 100%;
    flex: none;
    padding: 8px 8px 10px;
    gap: 8px;
  }
  .right-sidebar {
    width: 100%;
    flex-shrink: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    padding: 10px 10px 24px;
    overflow: visible;
  }
  .log-card {
    min-height: 160px;
    max-height: 240px;
  }
  .lab-shell, .report-shell {
    height: auto;
    overflow: visible;
    padding: 12px 10px 28px;
  }
  .lab-grid, .report-two-col {
    grid-template-columns: 1fr;
  }
  .drill-hero-card, .drill-topbar {
    flex-direction: column;
    align-items: stretch;
  }
  .modal-backdrop {
    align-items: flex-start;
    overflow-y: auto;
    padding: 12px;
  }
}

@media (max-width: 640px) {
  .brand-sub, #table-status-pill, .act-btn kbd {
    display: none;
  }
  .seg-btn {
    padding: 4px 6px;
    font-size: 10.5px;
  }
  .table-hud {
    height: auto;
    flex-wrap: wrap;
    gap: 6px;
  }
  .hud-left, .hud-right {
    flex-wrap: wrap;
    gap: 6px;
  }
  .table-arena {
    flex: none;
    height: 410px;
  }
  .table-arena.size-2 {
    height: 350px;
  }
  .table-arena.size-9 {
    height: 465px;
  }
  .poker-felt {
    top: 60px;
    bottom: 84px;
    left: 26px;
    right: 26px;
    border-radius: 120px;
    border-width: 7px;
  }
  .table-arena.size-9 .poker-felt {
    top: 56px;
    bottom: 84px;
    left: 42px;
    right: 42px;
  }
  .community-cards {
    gap: 4px;
    min-height: 54px;
  }
  .card, .card-placeholder {
    width: 38px;
    height: 54px;
    padding: 2px 4px;
  }
  .table-arena.size-9 .community-cards .card,
  .table-arena.size-9 .community-cards .card-placeholder {
    width: 35px;
    height: 50px;
  }
  .card-rank {
    font-size: 12px;
  }
  .card-suit-center {
    font-size: 15px;
  }
  .card.hero-card {
    width: 42px;
    height: 58px;
  }
  .card.mini {
    width: 18px;
    height: 26px;
    padding: 1px 2px;
    border-radius: 3px;
  }
  .card.mini .card-rank {
    font-size: 8.5px;
  }
  .card.mini .card-suit-center {
    font-size: 10px;
  }
  .seat-pod.opp-pod {
    width: 104px;
    padding: 3px 5px;
    gap: 3px;
    border-radius: 8px;
  }
  .table-arena.size-9 .seat-pod.opp-pod {
    width: 98px;
    padding: 3px 4px;
  }
  .seat-pod.opp-pod .seat-arch {
    display: none;
  }
  .seat-pod.hero-pod {
    width: 214px;
    padding: 5px 8px;
  }
  .seat-name {
    font-size: 10.5px;
  }
  .seat-stack {
    font-size: 10px;
  }
  .seat-pos-pill {
    font-size: 8.5px;
    padding: 1px 4px;
  }
  .seat-action-tag {
    font-size: 9px;
    padding: 1px 6px;
  }
  .seat-bet-chip {
    font-size: 9.5px;
    padding: 1px 6px;
  }

  /* Mobile 6-Max */
  .size-6 .s-1 { left: 2px; top: 62%; transform: translateY(-50%); }
  .size-6 .s-1 .seat-bet-chip { right: -42px; top: 12px; }
  .size-6 .s-2 { left: 2px; top: 22%; transform: translateY(-50%); }
  .size-6 .s-2 .seat-bet-chip { bottom: -19px; right: 0; }
  .size-6 .s-3 { left: 50%; top: 2px; transform: translateX(-50%); }
  .size-6 .s-3 .seat-bet-chip { bottom: -19px; left: 50%; transform: translateX(-50%); }
  .size-6 .s-4 { right: 2px; top: 22%; transform: translateY(-50%); }
  .size-6 .s-4 .seat-bet-chip { bottom: -19px; left: 0; }
  .size-6 .s-5 { right: 2px; top: 62%; transform: translateY(-50%); }
  .size-6 .s-5 .seat-bet-chip { left: -42px; top: 12px; }

  /* Mobile 9-Max */
  .size-9 .s-1 { left: 2px; top: 73%; bottom: auto; transform: translateY(-50%); }
  .size-9 .s-1 .seat-bet-chip { right: -38px; top: 10px; }
  .size-9 .s-2 { left: 2px; top: 47%; transform: translateY(-50%); }
  .size-9 .s-2 .seat-bet-chip { right: -38px; top: 10px; }
  .size-9 .s-3 { left: 2px; top: 21%; transform: translateY(-50%); }
  .size-9 .s-3 .seat-bet-chip { right: -38px; top: 10px; }
  .size-9 .s-4 { left: 33%; top: 2px; transform: translateX(-50%); }
  .size-9 .s-4 .seat-bet-chip { bottom: -19px; left: 50%; transform: translateX(-50%); }
  .size-9 .s-5 { left: 67%; top: 2px; transform: translateX(-50%); }
  .size-9 .s-5 .seat-bet-chip { bottom: -19px; left: 50%; transform: translateX(-50%); }
  .size-9 .s-6 { right: 2px; top: 21%; transform: translateY(-50%); }
  .size-9 .s-6 .seat-bet-chip { left: -38px; top: 10px; }
  .size-9 .s-7 { right: 2px; top: 47%; transform: translateY(-50%); }
  .size-9 .s-7 .seat-bet-chip { left: -38px; top: 10px; }
  .size-9 .s-8 { right: 2px; top: 73%; bottom: auto; transform: translateY(-50%); }
  .size-9 .s-8 .seat-bet-chip { left: -38px; top: 10px; }

  /* Mobile Action Bar */
  .action-bar {
    height: auto;
    padding: 10px;
  }
  .bet-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .action-buttons {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px;
    width: 100%;
  }
  .act-btn {
    justify-content: center;
    padding: 11px 6px;
    font-size: 12.5px;
    white-space: nowrap;
  }
  .sizing-controls {
    max-width: none;
    width: 100%;
  }
  .quick-bets {
    justify-content: space-between;
  }
  .qb-btn {
    flex: 1;
    text-align: center;
    padding: 5px 4px;
  }
  .raise-readout {
    min-width: 78px;
    font-size: 11px;
  }
  .hand-end-bar {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .hand-end-actions {
    width: 100%;
  }
  .hand-end-actions button {
    flex: 1;
  }

  /* Mobile Scenario, Setup & Range Modals */
  .spot-meta-row {
    grid-template-columns: repeat(2, 1fr);
  }
  .format-cards, .setup-row-2, .setup-tourney-box {
    grid-template-columns: 1fr;
  }
  .setup-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .range-controls {
    flex-wrap: wrap;
  }
  .range-cell {
    font-size: 8px;
  }
  .scout-popover {
    width: min(280px, calc(100vw - 24px));
  }
}
