:root {
  --bg: #0b0e13;
  --surface: #131820;
  --surface-2: #1a212c;
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #eef2f6;
  --text-muted: #8b96a6;
  --accent: #22c55e;
  --accent-dim: rgba(34, 197, 94, 0.16);
  --amber: #f59e0b;
  --danger: #ef4444;
  --danger-dim: rgba(239, 68, 68, 0.15);
  --felt-center: #162e24;
  --felt-edge: #0d1d17;
  --felt-border: #254538;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "PingFang SC", "Helvetica Neue", sans-serif;
}

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

html, body {
  height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

.hidden {
  display: none !important;
}

/* Buttons & Inputs */
button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

input[type="text"],
input[type="password"],
input[type="number"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  outline: none;
}

input[type="text"]:focus,
input[type="password"]:focus,
input[type="number"]:focus {
  border-color: var(--accent);
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 14px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 13px;
}

.account-user {
  color: var(--text);
}

.account-user small {
  color: var(--text-muted);
  margin-left: 6px;
}

.money-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.flag-seg {
  height: 36px;
  align-items: center;
}

.flag-seg button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 5px 9px;
  white-space: nowrap;
}

.flag-seg .flag {
  font-size: 14px;
  line-height: 1;
}

.input-money {
  flex: 1;
  min-width: 118px;
  display: flex;
  align-items: center;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  padding: 0 10px;
  height: 36px;
}

.input-money-free {
  flex: 1;
  min-width: 118px;
  height: 36px;
  border-radius: 8px;
  border: 1px dashed var(--border);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-money:focus-within {
  border-color: var(--accent);
}

.input-money input[type="number"] {
  border: none;
  background: transparent;
  padding: 0 6px;
  height: 100%;
  font-variant-numeric: tabular-nums;
}

.money-prefix,
.money-suffix {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}

.pnl-pos {
  color: var(--accent) !important;
  font-weight: 600;
}

.pnl-neg {
  color: #f87171 !important;
  font-weight: 600;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 16px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
}

.btn-block {
  width: 100%;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 12px;
  border-radius: 7px;
}

.btn-primary {
  background: var(--accent);
  color: #06140c;
  font-weight: 600;
}

.btn-primary:hover:not(:disabled) {
  background: #34d36f;
}

.btn-secondary {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: #232c3a;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.btn-ghost:hover:not(:disabled) {
  color: var(--text);
  border-color: var(--border-strong);
  background: rgba(255, 255, 255, 0.04);
}

.btn-danger-text:hover:not(:disabled) {
  color: var(--danger);
  border-color: rgba(239, 68, 68, 0.35);
}

.btn-toggle-on {
  border-color: rgba(34, 197, 94, 0.45) !important;
  color: var(--accent) !important;
  background: var(--accent-dim) !important;
}

.btn-link {
  font-size: 12px;
  color: var(--text-muted);
}

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

/* Lobby */
.lobby-view {
  height: 100vh;
  height: 100dvh;
  overflow-y: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px calc(24px + env(safe-area-inset-bottom));
}

.lobby-container {
  width: 100%;
  max-width: 440px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand {
  text-align: center;
  margin-bottom: 4px;
}

.brand-mark {
  font-size: 30px;
  line-height: 1;
  color: var(--accent);
  margin-bottom: 8px;
}

.brand h1 {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.brand p {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.field label {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.field-row.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.segmented {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
}

.segmented button {
  flex: 1;
  padding: 6px 4px;
  font-size: 12px;
  border-radius: 6px;
  color: var(--text-muted);
}

.segmented button.active {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}

.checkbox-row input {
  accent-color: var(--accent);
  width: 15px;
  height: 15px;
}

.join-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}

.join-header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.table-item-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.join-code-row {
  display: flex;
  gap: 8px;
}

.join-code-row input {
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.tables-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.table-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  border-radius: 8px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 13px;
}

.table-item-meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.table-item-meta small {
  font-size: 11px;
  color: var(--text-muted);
}

.empty-hint {
  font-size: 12px;
  color: var(--text-muted);
  text-align: center;
  padding: 6px 0;
}

/* Table View */
.table-view {
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: 52px;
  padding: 0 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(11, 14, 19, 0.9);
  z-index: 20;
}

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

.logo-mini {
  color: var(--accent);
  font-size: 18px;
  margin-right: 2px;
}

.pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.pill strong {
  color: var(--text);
  letter-spacing: 0.06em;
}

.pill-copy:hover {
  border-color: var(--accent);
}

.meta-item {
  font-size: 12px;
  color: var(--text-muted);
}

/* Table Stage */
.table-stage {
  flex: 1;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 24px 16px;
  overflow: hidden;
}

.poker-table {
  position: relative;
  width: min(920px, 92vw);
  height: min(500px, 66vh);
}

.table-felt {
  position: absolute;
  inset: 50px 68px;
  border-radius: 999px;
  background:
    radial-gradient(ellipse at 50% 42%, rgba(45, 110, 82, 0.28) 0%, transparent 62%),
    radial-gradient(ellipse at center, var(--felt-center) 0%, var(--felt-edge) 100%);
  border: 2px solid var(--felt-border);
  box-shadow:
    0 0 0 11px #141a22,
    0 0 0 12px rgba(255, 255, 255, 0.08),
    inset 0 0 70px rgba(0, 0, 0, 0.52),
    0 26px 70px rgba(0, 0, 0, 0.65);
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.table-felt::before {
  content: "";
  position: absolute;
  inset: 14px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.055);
  pointer-events: none;
}

.table-felt::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.06;
  pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 160 160' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.board-area {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  z-index: 2;
}

.pot-display {
  display: inline-flex;
  align-items: baseline;
  gap: 8px;
  padding: 5px 14px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.08);
}

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

.pot-amount {
  font-size: 16px;
  font-weight: 600;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

.side-pots {
  display: flex;
  gap: 6px;
  font-size: 11px;
  color: var(--text-muted);
}

.side-pot-tag {
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border);
}

.community-cards {
  display: flex;
  gap: 8px;
  min-height: 76px;
  align-items: center;
}

.table-status {
  min-height: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  text-align: center;
}

.status-banner {
  font-size: 13px;
  color: var(--text);
  background: rgba(11, 14, 19, 0.72);
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.status-banner strong {
  color: var(--accent);
}

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

.seat-ready-yes {
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
}

.seat-ready-no {
  font-size: 11px;
  color: var(--text-muted);
}

/* Playing Cards */
@keyframes cardReveal {
  from {
    opacity: 0;
    transform: translateY(-10px) scale(0.94);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.card {
  width: 52px;
  height: 74px;
  border-radius: 7px;
  background: linear-gradient(180deg, #ffffff 0%, #f1f5f9 100%);
  color: #111827;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px 6px;
  font-weight: 700;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 5px 14px rgba(0, 0, 0, 0.38);
  user-select: none;
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.card.card-enter {
  animation: cardReveal 0.22s cubic-bezier(0.2, 0.8, 0.2, 1) both;
}

.card.red,
.card.suit-h,
.card.suit-d {
  color: #dc2626;
}

.card.suit-s,
.card.suit-c {
  color: #111827;
}

/* 4-color deck mode */
body.four-color .card.suit-d {
  color: #2563eb;
}

body.four-color .card.suit-c {
  color: #15803d;
}

.card.best-card {
  transform: translateY(-7px);
  box-shadow:
    0 0 0 2px var(--amber),
    0 10px 22px rgba(245, 158, 11, 0.35);
  z-index: 4;
}

.card.showdown-dim {
  opacity: 0.45;
}

.card.mini {
  width: 38px;
  height: 54px;
  padding: 3px 4px;
  border-radius: 5px;
}

.card.self-card {
  width: 48px;
  height: 68px;
}

.card-corner {
  display: flex;
  flex-direction: column;
  align-items: center;
  align-self: flex-start;
  line-height: 1.05;
  gap: 2px;
}

.card-rank {
  font-size: 16px;
  letter-spacing: -0.04em;
}

.card-suit {
  font-size: 15px;
}

.card.self-card .card-rank {
  font-size: 15px;
}

.card.self-card .card-suit {
  font-size: 14px;
}

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

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

.card.back {
  background: linear-gradient(135deg, #1d2736 0%, #111824 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
}

.card.back::after {
  content: "";
  position: absolute;
  inset: 5px;
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.card.slot {
  background: rgba(255, 255, 255, 0.03);
  border: 1px dashed rgba(255, 255, 255, 0.1);
  box-shadow: none;
}

.card.dimmed {
  opacity: 0.4;
}

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

.seat {
  position: absolute;
  transform: translate(-50%, -50%);
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 140px;
}

.seat-empty {
  width: 110px;
  height: 56px;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.14);
  background: rgba(19, 24, 32, 0.55);
  color: var(--text-muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.seat-empty:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: rgba(34, 197, 94, 0.08);
}

.seat-cards {
  display: flex;
  gap: 3px;
  margin-bottom: -10px;
  z-index: 2;
}

.seat-cards .card:first-child:not(.best-card) {
  transform: rotate(-2.5deg) translateY(1px);
}

.seat-cards .card:last-child:not(.best-card) {
  transform: rotate(2.5deg) translateY(1px);
}

.seat-cards .card.best-card:first-child {
  transform: rotate(-2.5deg) translateY(-6px);
}

.seat-cards .card.best-card:last-child {
  transform: rotate(2.5deg) translateY(-6px);
}

.seat-box {
  position: relative;
  min-width: 136px;
  padding: 12px 12px 8px;
  border-radius: 11px;
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: border-color 0.2s ease, box-shadow 0.2s ease, opacity 0.2s ease;
}

.seat.is-turn .seat-box {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-dim), 0 8px 24px rgba(0, 0, 0, 0.45);
}

.seat.is-winner .seat-box {
  border-color: var(--amber);
  box-shadow: 0 0 0 2px rgba(245, 158, 11, 0.22);
}

.seat.is-folded {
  opacity: 0.48;
}

.seat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 13px;
  font-weight: 500;
}

.seat-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 96px;
}

.seat-ai-tag {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.07);
  color: var(--text-muted);
}

.seat-kick {
  position: absolute;
  top: -8px;
  right: -8px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  opacity: 0.78;
}

.seat:hover .seat-kick {
  opacity: 1;
}

.seat-kick:hover {
  color: var(--danger);
  border-color: var(--danger);
  background: #2a171c;
}

.seat-chips {
  font-size: 12px;
  color: var(--amber);
  margin-top: 2px;
  font-variant-numeric: tabular-nums;
  display: flex;
  align-items: center;
  gap: 5px;
}

.seat-pending-rebuy {
  font-size: 10px;
  padding: 1px 5px;
  border-radius: 4px;
  background: var(--accent-dim);
  color: var(--accent);
  font-weight: 500;
}

.seat-sub {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 4px;
  min-height: 16px;
}

.seat-action-tag {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 500;
}

.seat-action-tag.act-call {
  color: #cbd5e1;
}

.seat-action-tag.act-raise {
  color: var(--accent);
}

.seat-action-tag.act-allin {
  color: var(--amber);
  font-weight: 600;
}

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

.seat-hand-tag {
  font-size: 11px;
  color: var(--accent);
  font-weight: 500;
}

.seat-badges {
  position: absolute;
  top: -12px;
  left: -8px;
  display: flex;
  align-items: center;
  gap: 5px;
  z-index: 12;
}

.badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  line-height: 1.35;
  letter-spacing: 0.03em;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.55);
}

.badge-d {
  width: 23px;
  height: 23px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  color: #0b0e13;
  font-size: 12px;
  border: 2px solid var(--amber);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.5), 0 3px 10px rgba(245, 158, 11, 0.45);
}

.badge-sb {
  background: #0284c7;
  color: #f0f9ff;
  border: 1px solid #38bdf8;
  box-shadow: 0 2px 8px rgba(2, 132, 199, 0.45);
}

.badge-bb {
  background: #d97706;
  color: #fffbeb;
  border: 1px solid #fbbf24;
  box-shadow: 0 2px 8px rgba(217, 119, 6, 0.5);
}

.seat-bet-chip {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(11, 14, 19, 0.82);
  border: 1px solid rgba(245, 158, 11, 0.4);
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

.seat-win-pill {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid var(--accent);
  color: var(--accent);
}

/* Action Bar */
.action-bar {
  min-height: 82px;
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 20;
}

.action-idle {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
  color: var(--text-muted);
}

.action-controls {
  width: 100%;
  max-width: 780px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

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

.btn-fold {
  background: var(--danger-dim);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  min-width: 84px;
}

.btn-fold:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.26);
}

.btn-call {
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  min-width: 108px;
}

.btn-call:hover:not(:disabled) {
  background: #242f3f;
}

.btn-raise {
  background: var(--accent);
  color: #06140c;
  font-weight: 600;
  min-width: 124px;
}

.btn-raise:hover:not(:disabled) {
  background: #34d36f;
}

.raise-panel {
  flex: 1;
  min-width: 240px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.quick-bets {
  display: flex;
  gap: 6px;
}

.chip-btn {
  flex: 1;
  padding: 4px 8px;
  font-size: 11px;
  border-radius: 6px;
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text-muted);
}

.chip-btn:hover {
  color: var(--text);
  border-color: var(--border-strong);
}

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

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

.raise-value {
  min-width: 48px;
  text-align: right;
  font-size: 13px;
  font-weight: 600;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

/* Log Drawer */
.log-drawer {
  position: absolute;
  top: 12px;
  right: 12px;
  bottom: 12px;
  width: 290px;
  background: rgba(19, 24, 32, 0.96);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  z-index: 30;
  backdrop-filter: blur(8px);
}

.log-drawer-header {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 600;
}

.btn-icon {
  font-size: 18px;
  color: var(--text-muted);
  padding: 0 4px;
}

.log-list {
  flex: 1;
  overflow-y: auto;
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--text-muted);
}

.log-entry {
  line-height: 1.45;
  padding-bottom: 5px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

/* Settlement Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(5, 8, 12, 0.72);
  backdrop-filter: blur(6px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 80;
}

.modal-card {
  width: 100%;
  max-width: 520px;
  max-height: 84vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.6);
}

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.modal-header h3 {
  font-size: 16px;
  font-weight: 600;
}

.modal-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 3px;
}

.settlement-warning {
  font-size: 12px;
  color: var(--amber);
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: 8px;
  padding: 8px 10px;
}

.settlement-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.settlement-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
}

.transfer-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.transfer-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 9px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 13px;
}

.transfer-route {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.transfer-arrow {
  color: var(--text-muted);
  font-size: 12px;
}

.transfer-amount {
  font-weight: 700;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.ledger-table {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--border);
  border-radius: 9px;
  overflow: hidden;
  font-size: 12px;
}

.ledger-row {
  display: grid;
  grid-template-columns: 1.4fr 0.7fr 0.8fr 0.8fr 1fr;
  align-items: center;
  padding: 8px 10px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  font-variant-numeric: tabular-nums;
}

.ledger-row:last-child {
  border-bottom: none;
}

.ledger-head {
  background: rgba(255, 255, 255, 0.03);
  color: var(--text-muted);
  font-weight: 500;
}

.ledger-num {
  text-align: right;
}

.voter-list {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.voter-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 12px;
  border-radius: 9px;
  background: var(--bg);
  border: 1px solid var(--border);
  font-size: 13px;
}

.voter-status {
  font-size: 12px;
  color: var(--text-muted);
}

.voter-status.approved {
  color: var(--accent);
  font-weight: 500;
}

.vote-actions {
  display: flex;
  gap: 10px;
  margin-top: 6px;
}

.vote-actions .btn {
  flex: 1;
}

.btn-queued {
  border-color: rgba(245, 158, 11, 0.5) !important;
  color: var(--amber) !important;
}

/* Toast */
.toast {
  position: fixed;
  top: 66px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 999px;
  font-size: 13px;
  z-index: 100;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.45);
}

@media (max-width: 680px) {
  .topbar {
    height: auto;
    min-height: 40px;
    padding: 6px 10px;
    flex-wrap: wrap;
    gap: 5px;
  }
  .topbar-left {
    gap: 6px;
  }
  .topbar-right {
    width: 100%;
    overflow-x: auto;
    padding-bottom: 1px;
    gap: 5px;
    scrollbar-width: none;
  }
  .topbar-right::-webkit-scrollbar {
    display: none;
  }
  .topbar-right .btn-sm {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 4px 8px;
    font-size: 11px;
  }
  .meta-item {
    display: none;
  }
  .table-stage {
    padding: 6px 6px 4px;
    min-height: 0;
  }
  .poker-table {
    width: 100%;
    height: 100%;
    min-height: 300px;
  }
  .table-felt {
    inset: 42px 24px 44px;
    border-radius: 120px;
    box-shadow:
      0 0 0 6px #141a22,
      0 0 0 7px rgba(255, 255, 255, 0.08),
      inset 0 0 40px rgba(0, 0, 0, 0.5);
  }
  .board-area {
    gap: 7px;
  }
  .pot-display {
    padding: 3px 10px;
  }
  .pot-amount {
    font-size: 14px;
  }
  .community-cards {
    gap: 4px;
    min-height: 50px;
  }
  .card {
    width: 35px;
    height: 50px;
    padding: 3px 4px;
    border-radius: 5px;
  }
  .card-rank {
    font-size: 12px;
  }
  .card-suit {
    font-size: 11px;
  }
  .card.self-card {
    width: 38px;
    height: 54px;
  }
  .card.self-card .card-rank {
    font-size: 13px;
  }
  .card.self-card .card-suit {
    font-size: 12px;
  }
  .card.mini {
    width: 28px;
    height: 40px;
    padding: 2px 3px;
  }
  .card.mini .card-rank {
    font-size: 10px;
  }
  .card.mini .card-suit {
    font-size: 9px;
  }
  .seat {
    min-width: 82px;
    gap: 3px;
  }
  .seat-empty {
    width: 78px;
    height: 42px;
    font-size: 11px;
  }
  .seat-cards {
    margin-bottom: -8px;
  }
  .seat-box {
    min-width: 84px;
    padding: 8px 7px 5px;
    border-radius: 9px;
  }
  .seat-header {
    font-size: 11px;
    gap: 3px;
  }
  .seat-name {
    max-width: 56px;
  }
  .seat-ai-tag {
    font-size: 9px;
    padding: 1px 4px;
  }
  .seat-chips {
    font-size: 11px;
  }
  .seat-sub {
    margin-top: 2px;
    min-height: 13px;
  }
  .seat-action-tag,
  .seat-hand-tag,
  .seat-ready-yes,
  .seat-ready-no {
    font-size: 10px;
  }
  .seat-bet-chip,
  .seat-win-pill {
    font-size: 10px;
    padding: 1px 6px;
  }
  .seat-kick {
    width: 18px;
    height: 18px;
    font-size: 11px;
    top: -6px;
    right: -6px;
  }
  .status-banner {
    font-size: 11px;
    padding: 4px 10px;
  }
  .action-bar {
    min-height: 60px;
    padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  }
  .action-idle {
    font-size: 12px;
    text-align: center;
  }
  .action-controls {
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
  }
  .action-buttons {
    width: 100%;
    gap: 7px;
  }
  .action-buttons .btn {
    flex: 1;
    min-width: 0;
    padding: 10px 6px;
    font-size: 13px;
  }
  .raise-panel {
    min-width: 0;
    gap: 4px;
  }
  .chip-btn {
    padding: 5px 4px;
    font-size: 11px;
  }
  .log-drawer {
    width: calc(100% - 20px);
    left: 10px;
    right: 10px;
  }
}

/* ================= BAF (Bet Against Friends) Integration ================= */
.account-bar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.baf-modal-card {
  max-width: 680px;
  width: 94vw;
  max-height: 86vh;
  display: flex;
  flex-direction: column;
}

.baf-header-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.baf-sse-pill {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.baf-sse-pill.live {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: rgba(34, 197, 94, 0.35);
}

.baf-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 10px;
}

.baf-tab {
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text-muted);
  background: transparent;
}

.baf-tab.active {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

.baf-tab-panel {
  overflow-y: auto;
  flex: 1;
  padding-right: 2px;
}

.baf-banner {
  padding: 8px 12px;
  border-radius: 8px;
  margin-bottom: 10px;
  font-size: 13px;
  background: var(--danger-dim);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.baf-markets-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.baf-market-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px;
}

.baf-market-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 8px;
  margin-bottom: 8px;
}

.baf-market-title {
  font-size: 15px;
  font-weight: 600;
}

.baf-market-meta {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.baf-status {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  white-space: nowrap;
}

.baf-status.open {
  background: var(--accent-dim);
  color: var(--accent);
}

.baf-status.locked {
  background: rgba(245, 158, 11, 0.16);
  color: var(--amber);
}

.baf-status.resolved,
.baf-status.cancelled {
  background: var(--surface);
  color: var(--text-muted);
}

.baf-liq-labels {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 5px;
}

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

.baf-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #38bdf8);
}

.baf-bet-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 8px;
}

.baf-bet-row input {
  width: 88px;
  padding: 7px 9px;
}

.baf-resolver-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.baf-bets-list {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.baf-bet-item {
  display: flex;
  justify-content: space-between;
}

.baf-pot {
  color: var(--amber);
  font-weight: 600;
}

.baf-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.baf-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.baf-hint {
  font-size: 12px;
  color: var(--text-muted);
}

.baf-audit-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  font-size: 13px;
}

.baf-audit-result {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
  margin-bottom: 10px;
  font-size: 12px;
}

.baf-audit-row,
.baf-ledger-row {
  display: flex;
  justify-content: space-between;
  padding: 5px 0;
  font-size: 12px;
  border-bottom: 1px solid var(--border);
}

.baf-pos {
  color: var(--accent);
  font-weight: 600;
}

.baf-neg {
  color: var(--danger);
  font-weight: 600;
}

/* Admin-only GTO Strategy Advisor Drawer */
.advisor-drawer {
  width: 340px;
  max-width: 92vw;
}

.advisor-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.advisor-auto-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  cursor: pointer;
}

.advisor-body {
  padding: 12px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12.5px;
}

.advisor-empty {
  color: var(--text-muted);
  line-height: 1.5;
  padding: 12px 4px;
}

.advisor-rec-card {
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.4);
  border-radius: 10px;
  padding: 10px 12px;
}

.advisor-rec-card.is-fold {
  background: rgba(239, 68, 68, 0.12);
  border-color: rgba(239, 68, 68, 0.4);
}

.advisor-rec-card.is-check {
  background: rgba(148, 163, 184, 0.12);
  border-color: rgba(148, 163, 184, 0.35);
}

.advisor-rec-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
}

.advisor-rec-action {
  font-size: 16px;
  font-weight: 700;
  color: var(--text);
}

.advisor-rec-sub {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 3px;
}

.advisor-mix {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-top: 8px;
}

.advisor-mix-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
}

.advisor-mix-bar {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.advisor-mix-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 999px;
}

.advisor-metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.advisor-metric {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
}

.advisor-metric-label {
  font-size: 10.5px;
  color: var(--text-muted);
}

.advisor-metric-val {
  font-size: 13px;
  font-weight: 700;
  margin-top: 2px;
}

.advisor-section {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 10px;
}

.advisor-section-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 5px;
}

.advisor-reasons {
  margin: 0;
  padding-left: 16px;
  display: flex;
  flex-direction: column;
  gap: 5px;
  line-height: 1.45;
}

.advisor-hud-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
  font-size: 11.5px;
}

.advisor-hud-row:last-child {
  border-bottom: none;
}

.advisor-hud-tag {
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-muted);
}

/* Global Stats Bar (Home & In-Game) */
.global-stats-bar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-muted);
}

.stat-pill strong {
  color: var(--text);
  font-weight: 700;
}

.stat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.7);
  display: inline-block;
}

.global-stats-mini {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border);
  font-size: 11.5px;
  color: var(--text-muted);
}

.ccp-icon {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  vertical-align: -3px;
  object-fit: contain;
  display: inline-block;
}
