:root {
  --bg: #0b1117;
  --panel: #121a23;
  --panel-2: #18222e;
  --border: rgba(255, 255, 255, 0.09);
  --text: #eef3f8;
  --muted: #8fa1b3;
  --emerald: #10b981;
  --emerald-dark: #059669;
  --felt: #0f4d36;
  --felt-inner: #156749;
  --amber: #f59e0b;
  --danger: #ef4444;
  --blue: #3b82f6;
  --purple: #a855f7;
  --cyan: #06b6d4;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Inter, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
  overflow-y: scroll;
}

body {
  margin: 0;
  background: radial-gradient(circle at top, #13202d 0%, var(--bg) 55%);
  color: var(--text);
  font-family: var(--font);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
}

.pot-display,
.seat-stack,
.seat-bet-pill,
.prob-pct,
.raise-input {
  font-variant-numeric: tabular-nums;
}

.hidden {
  display: none !important;
}

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

.small-txt {
  font-size: 0.82rem;
}

.error-text {
  color: #f87171;
  font-size: 0.88rem;
  min-height: 1.1em;
}

.success-text {
  color: #34d399;
  font-size: 0.88rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 9px 15px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.08s ease, background 0.15s ease, opacity 0.15s ease;
  color: var(--text);
  background: var(--panel-2);
  touch-action: manipulation;
  user-select: none;
}

.btn:hover:not(:disabled) {
  filter: brightness(1.1);
}

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

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

.btn-primary {
  background: var(--emerald-dark);
  border-color: rgba(16, 185, 129, 0.4);
}

.btn-secondary {
  background: #223041;
  border-color: var(--border);
}

.btn-accent {
  background: #b45309;
  border-color: rgba(245, 158, 11, 0.45);
}

.btn-danger {
  background: #b91c1c;
  border-color: rgba(239, 68, 68, 0.4);
}

.btn-ghost {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--border);
}

.btn-lg {
  padding: 12px 18px;
  font-size: 0.98rem;
}

.btn-sm {
  padding: 6px 11px;
  font-size: 0.82rem;
}

.btn-xs {
  padding: 4px 8px;
  font-size: 0.75rem;
}

.icon-close {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.5rem;
  line-height: 1;
  cursor: pointer;
}
.icon-close:hover {
  color: var(--text);
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}

.badge-emerald {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.35);
}

.badge-amber {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.35);
}

.badge-slate {
  background: rgba(148, 163, 184, 0.14);
  color: #cbd5e1;
  border: 1px solid rgba(148, 163, 184, 0.25);
}

/* Forms */
.stack-form {
  display: flex;
  flex-direction: column;
  gap: 13px;
}

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

.field {
  display: flex;
  flex-direction: column;
  gap: 5px;
  font-size: 0.86rem;
}

.field-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.field input[type="text"],
.field input[type="password"],
.field input[type="number"],
.field select {
  width: 100%;
  background: #0d141c;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 9px 11px;
  color: var(--text);
  font-size: 0.92rem;
}

.field input:focus,
.field select:focus {
  outline: none;
  border-color: var(--emerald);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.87rem;
  cursor: pointer;
}

/* Login */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 410px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 28px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.55);
}

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

.brand-row h1 {
  margin: 0;
  font-size: 1.4rem;
}

.brand-suit {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--emerald), #047857);
  color: #fff;
  font-size: 1.1rem;
}

/* Topbar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 20px;
  background: rgba(15, 22, 30, 0.92);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}

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

.brand-title {
  font-weight: 700;
  font-size: 1.05rem;
}

/* Panels & Lobby */
.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.panel-head h2,
.panel-head h3 {
  margin: 0;
  font-size: 1.02rem;
}

.lobby-view {
  max-width: 1180px;
  margin: 24px auto;
  padding: 0 18px;
}

.lobby-grid {
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 20px;
}

.rooms-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 14px;
}

.room-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

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

.room-card-head h3 {
  margin: 0;
  font-size: 1rem;
}

.room-card-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 0.84rem;
  color: var(--muted);
}

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

/* Room View */
.room-view {
  padding: 16px 20px 26px;
  max-width: 1480px;
  margin: 0 auto;
}

.room-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 18px;
  align-items: start;
}

.room-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 12px;
}

.room-header-bar h2 {
  margin: 0;
  font-size: 1.2rem;
}

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

#start-hand-btn {
  min-width: 136px;
}

.ws-pill {
  font-size: 0.74rem;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 999px;
  text-transform: uppercase;
}
.ws-pill.online {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
}
.ws-pill.offline {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
}

.table-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 14px;
  margin-bottom: 12px;
  font-size: 0.88rem;
}

.table-banner.is-turn {
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.45);
  color: #a7f3d0;
}

.table-banner.is-finished {
  background: rgba(245, 158, 11, 0.12);
  border-color: rgba(245, 158, 11, 0.38);
}

.banner-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* Poker Table */
.table-stage {
  background: rgba(8, 13, 19, 0.7);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 26px 20px;
}

.poker-table {
  position: relative;
  width: 100%;
  height: 520px;
  max-width: 960px;
  margin: 0 auto;
}

.table-felt {
  position: absolute;
  inset: 14% 12%;
  border-radius: 240px;
  background: radial-gradient(ellipse at center, var(--felt-inner) 0%, var(--felt) 70%, #093524 100%);
  border: 12px solid #2d2016;
  box-shadow:
    inset 0 0 0 3px rgba(212, 175, 55, 0.35),
    inset 0 18px 40px rgba(0, 0, 0, 0.45),
    0 20px 50px rgba(0, 0, 0, 0.6);
  display: grid;
  place-items: center;
}

.table-center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 8px;
}

.street-badge {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #a7f3d0;
  background: rgba(0, 0, 0, 0.35);
  padding: 3px 10px;
  border-radius: 999px;
}

.pot-display {
  font-size: 1.05rem;
  font-weight: 700;
  color: #fde68a;
  background: rgba(0, 0, 0, 0.48);
  border: 1px solid rgba(253, 230, 138, 0.25);
  padding: 4px 14px;
  border-radius: 999px;
}

.board-cards {
  display: flex;
  gap: 7px;
  min-height: 68px;
  align-items: center;
}

.board-slot {
  width: 46px;
  height: 64px;
  border-radius: 7px;
  border: 1px dashed rgba(255, 255, 255, 0.18);
  background: rgba(0, 0, 0, 0.14);
}

/* Playing Cards */
.playing-card {
  width: 46px;
  height: 64px;
  border-radius: 7px;
  background: #f8fafc;
  color: #0f172a;
  border: 1px solid rgba(0, 0, 0, 0.25);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  line-height: 1.05;
  font-weight: 800;
  user-select: none;
}

.playing-card .card-rank {
  font-size: 0.98rem;
}

.playing-card .card-suit {
  font-size: 1.05rem;
}

.playing-card.small {
  width: 36px;
  height: 50px;
  border-radius: 5px;
}
.playing-card.small .card-rank {
  font-size: 0.82rem;
}
.playing-card.small .card-suit {
  font-size: 0.88rem;
}

.playing-card.mini {
  width: 28px;
  height: 38px;
  border-radius: 4px;
}
.playing-card.mini .card-rank {
  font-size: 0.72rem;
}
.playing-card.mini .card-suit {
  font-size: 0.76rem;
}

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

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

.playing-card.card-back {
  background: linear-gradient(135deg, #1e3a8a, #0f172a);
  border-color: rgba(255, 255, 255, 0.35);
  padding: 4px;
}

.card-back-pattern {
  width: 100%;
  height: 100%;
  border-radius: 3px;
  border: 1px solid rgba(147, 197, 253, 0.35);
  background-image: repeating-linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.08) 0,
    rgba(255, 255, 255, 0.08) 3px,
    transparent 3px,
    transparent 6px
  );
}

/* Seats */
.seat-box {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 150px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  z-index: 2;
}

.seat-box.empty {
  height: 76px;
  justify-content: center;
  background: rgba(15, 23, 34, 0.82);
  border: 1px dashed rgba(255, 255, 255, 0.22);
  border-radius: 11px;
  padding: 8px;
}

.empty-seat-label {
  font-size: 0.76rem;
  color: var(--muted);
}

.empty-seat-btns {
  display: flex;
  gap: 5px;
}

.seat-cards {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 4px;
  height: 50px;
}

.seat-plate {
  position: relative;
  width: 100%;
  height: 54px;
  background: rgba(14, 21, 30, 0.94);
  border: 1.5px solid rgba(255, 255, 255, 0.16);
  border-radius: 10px;
  padding: 7px 9px;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.seat-box.is-self .seat-plate {
  border-color: rgba(16, 185, 129, 0.7);
}

.seat-box.is-turn .seat-plate {
  border-color: #fbbf24;
  box-shadow: 0 0 0 3px rgba(251, 191, 36, 0.28), 0 8px 20px rgba(0, 0, 0, 0.5);
}

.seat-box.is-folded .seat-plate,
.seat-box.is-folded .seat-cards {
  opacity: 0.55;
}

.seat-top {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: nowrap;
  overflow: hidden;
}

.seat-name {
  font-size: 0.82rem;
  font-weight: 700;
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bot-tag {
  flex-shrink: 0;
  font-size: 0.62rem;
  font-weight: 700;
  padding: 1px 4px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.22);
  color: #93c5fd;
}

.pos-tag {
  flex-shrink: 0;
  font-size: 0.64rem;
  font-weight: 700;
  padding: 1px 5px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
}

.pos-tag.btn-pos {
  background: rgba(245, 158, 11, 0.25);
  color: #fde68a;
}

.seat-stack {
  font-size: 0.84rem;
  font-weight: 600;
  color: #a7f3d0;
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seat-status-pill {
  position: absolute;
  left: 50%;
  top: -10px;
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.68rem;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #e2e8f0;
  z-index: 3;
  max-width: 146px;
  overflow: hidden;
  text-overflow: ellipsis;
}
.seat-status-pill.thinking {
  background: #451a03;
  border-color: rgba(251, 191, 36, 0.6);
  color: #fde68a;
}
.seat-status-pill.allin {
  background: #450a0a;
  border-color: rgba(248, 113, 113, 0.6);
  color: #fca5a5;
}
.seat-status-pill.folded {
  background: #111827;
  color: var(--muted);
}
.seat-status-pill.win {
  background: #064e3b;
  border-color: rgba(52, 211, 153, 0.6);
  color: #a7f3d0;
}
.seat-status-pill.lose {
  background: #450a0a;
  border-color: rgba(248, 113, 113, 0.45);
  color: #fecaca;
}
.seat-status-pill.rank {
  background: #172554;
  border-color: rgba(147, 197, 253, 0.45);
  color: #bfdbfe;
}

.seat-corner-actions {
  position: absolute;
  top: -8px;
  right: -6px;
  display: flex;
  gap: 3px;
  z-index: 4;
}

.seat-icon-btn {
  width: 20px;
  height: 20px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: #1e293b;
  color: #e2e8f0;
  font-size: 0.78rem;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}
.seat-icon-btn:hover {
  background: #dc2626;
}
.seat-icon-btn.rebuy {
  width: auto;
  padding: 0 5px;
  font-size: 0.65rem;
  background: #047857;
}

.seat-bet-pill {
  position: absolute;
  white-space: nowrap;
  background: rgba(245, 158, 11, 0.94);
  color: #111827;
  font-weight: 800;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 999px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.45);
  z-index: 3;
}
.seat-bet-pill.bet-bottom {
  bottom: -21px;
  left: 50%;
  transform: translateX(-50%);
}
.seat-bet-pill.bet-top {
  top: -19px;
  left: 50%;
  transform: translateX(-50%);
}
.seat-bet-pill.bet-right {
  left: calc(100% + 4px);
  top: 62%;
  transform: translateY(-50%);
}
.seat-bet-pill.bet-left {
  right: calc(100% + 4px);
  top: 62%;
  transform: translateY(-50%);
}

.dealer-button {
  position: absolute;
  bottom: -7px;
  left: -7px;
  width: 22px;
  height: 22px;
  border-radius: 999px;
  background: linear-gradient(135deg, #fde68a, #d97706);
  color: #111827;
  font-weight: 900;
  font-size: 0.74rem;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
  z-index: 4;
}

/* Permanent Fixed-Height Action Dock */
.action-bar {
  margin-top: 12px;
  min-height: 112px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 10px;
  transition: border-color 0.15s ease;
}

.action-bar.is-active {
  border-color: rgba(16, 185, 129, 0.65);
  box-shadow: 0 0 0 2px rgba(16, 185, 129, 0.14);
}

.action-primary-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
}

.action-primary-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.action-primary-buttons .btn {
  height: 40px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 0 10px;
}

.action-turn-hint {
  font-size: 0.8rem;
  color: var(--muted);
  white-space: nowrap;
  flex-shrink: 0;
}

.action-bar.is-active .action-turn-hint {
  color: #34d399;
  font-weight: 600;
}

.action-sizing-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 36px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

.action-sizing-row.is-inactive {
  opacity: 0.35;
  pointer-events: none;
}

.sizing-presets {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 34px;
  min-height: 34px;
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}
.sizing-presets::-webkit-scrollbar {
  display: none;
}

.sizing-placeholder {
  font-size: 0.78rem;
  color: var(--muted);
  white-space: nowrap;
}

.sizing-chip {
  flex-shrink: 0;
  height: 32px;
  min-height: 32px;
  padding: 4px 10px;
}

.raise-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.raise-controls input[type="range"] {
  width: 110px;
}

.raise-input {
  width: 74px;
  background: #0d141c;
  border: 1px solid var(--border);
  border-radius: 7px;
  padding: 6px 8px;
  color: var(--text);
}

/* Sidebar */
.room-sidebar {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.mobile-sidebar-tabs {
  display: none;
  gap: 6px;
}

.mobile-tab-btn {
  flex: 1;
  background: var(--panel);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 9px;
  padding: 9px 8px;
  font-size: 0.84rem;
  font-weight: 600;
  cursor: pointer;
}
.mobile-tab-btn.active {
  background: rgba(16, 185, 129, 0.16);
  border-color: rgba(16, 185, 129, 0.5);
  color: #a7f3d0;
}

.sidebar-btn-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 12px;
}

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

.live-action-log {
  height: 190px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.log-row {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.8rem;
}

.log-street {
  font-size: 0.68rem;
  color: var(--muted);
  min-width: 54px;
}

.log-name {
  font-weight: 600;
}

.log-act {
  color: #fde68a;
  font-family: var(--mono);
  font-size: 0.76rem;
}

.hand-history-list {
  height: 230px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.history-item {
  width: 100%;
  text-align: left;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 9px 11px;
  color: var(--text);
  cursor: pointer;
}
.history-item:hover {
  border-color: rgba(245, 158, 11, 0.5);
}
.history-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.86rem;
}
.history-sub {
  font-size: 0.77rem;
  margin-top: 3px;
}

/* Modals */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(3, 7, 12, 0.78);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 18px;
  z-index: 50;
}

.modal {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 16px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.7);
}
.modal-sm {
  max-width: 440px;
  padding: 18px;
}
.modal-md {
  max-width: 660px;
  padding: 18px;
}
.modal-lg {
  max-width: 980px;
  padding: 18px;
}

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.modal-head h3 {
  margin: 0;
  font-size: 1.1rem;
}

.modal-body {
  overflow-y: auto;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Review Modal */
.review-summary-card {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 14px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 14px;
}

.review-section-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}

.review-cards-row {
  display: flex;
  gap: 6px;
  align-items: center;
}

.winner-pill {
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: #a7f3d0;
  border-radius: 8px;
  padding: 5px 10px;
  font-size: 0.86rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.review-players-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
  gap: 9px;
}

.review-player-chip {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.review-player-chip.is-winner {
  border-color: rgba(16, 185, 129, 0.55);
}

.review-player-top,
.review-player-mid {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.review-hole-cards {
  display: flex;
  gap: 4px;
}

.rp-name {
  font-weight: 700;
  font-size: 0.85rem;
}
.rp-net {
  font-weight: 700;
  font-size: 0.86rem;
}
.rp-net.pos {
  color: #34d399;
}
.rp-net.neg {
  color: #f87171;
}
.review-player-foot {
  font-size: 0.75rem;
}

.review-filter-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.review-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tab-btn {
  background: var(--panel-2);
  border: 1px solid var(--border);
  color: var(--muted);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
}
.tab-btn.active {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.5);
  color: #a7f3d0;
}

.review-hint {
  font-size: 0.82rem;
  color: #fde68a;
}

.review-street-header {
  font-size: 0.8rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #93c5fd;
  margin-top: 6px;
}

.thought-card {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 11px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

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

.thought-who,
.thought-cards-inline,
.thought-chosen-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  flex-wrap: wrap;
}

.think-tokens-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.think-summary-line {
  font-size: 0.84rem;
  color: #cbd5e1;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 7px;
  padding: 7px 10px;
}

.probs-bars-wrap {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.prob-bar-row {
  display: grid;
  grid-template-columns: 128px 1fr 54px;
  align-items: center;
  gap: 8px;
}

.prob-track {
  height: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.prob-fill {
  height: 100%;
  border-radius: 999px;
  background: #475569;
}
.prob-fill.chosen {
  background: var(--emerald);
}

.prob-pct {
  text-align: right;
  font-size: 0.8rem;
  font-family: var(--mono);
  color: var(--muted);
}

.thought-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.76rem;
}

.warn-badge {
  background: rgba(239, 68, 68, 0.2);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.4);
  border-radius: 6px;
  padding: 2px 6px;
}

.full-tokens-details {
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.full-tokens-details summary {
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
}
.full-tokens-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 10px;
}

/* Token Pills & Tooltip */
.token-pill {
  font-family: var(--mono);
  font-size: 0.76rem;
  font-weight: 600;
  padding: 3px 7px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.06);
  color: #e2e8f0;
  cursor: help;
}
.token-pill:hover,
.token-pill:focus-visible {
  outline: none;
  border-color: #fde68a;
  box-shadow: 0 0 0 2px rgba(253, 230, 138, 0.2);
}

.cat-think-delim { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }
.cat-think-opps { background: rgba(59, 130, 246, 0.18); color: #93c5fd; border-color: rgba(59, 130, 246, 0.35); }
.cat-think-pos { background: rgba(6, 182, 212, 0.18); color: #67e8f9; border-color: rgba(6, 182, 212, 0.35); }
.cat-think-spr { background: rgba(245, 158, 11, 0.18); color: #fcd34d; border-color: rgba(245, 158, 11, 0.35); }
.cat-think-brd { background: rgba(168, 85, 247, 0.18); color: #d8b4fe; border-color: rgba(168, 85, 247, 0.35); }
.cat-think-cat { background: rgba(236, 72, 153, 0.18); color: #f9a8d4; border-color: rgba(236, 72, 153, 0.35); }
.cat-think-eq { background: rgba(16, 185, 129, 0.2); color: #6ee7b7; border-color: rgba(16, 185, 129, 0.4); }
.cat-think-odds { background: rgba(34, 197, 94, 0.2); color: #86efac; border-color: rgba(34, 197, 94, 0.4); }
.cat-think-plan { background: rgba(249, 115, 22, 0.2); color: #fdba74; border-color: rgba(249, 115, 22, 0.4); }
.cat-action { background: rgba(239, 68, 68, 0.16); color: #fca5a5; border-color: rgba(239, 68, 68, 0.35); }
.cat-card { background: rgba(248, 250, 252, 0.14); color: #f8fafc; }

.token-tooltip {
  position: fixed;
  z-index: 120;
  max-width: 340px;
  background: #090e14;
  border: 1px solid rgba(253, 230, 138, 0.45);
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.75);
  pointer-events: none;
}

.tt-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 5px;
}

.tt-code {
  font-family: var(--mono);
  font-weight: 700;
  font-size: 0.85rem;
  color: #fde68a;
}

.tt-cat {
  font-size: 0.7rem;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 5px;
}

.tt-title {
  font-weight: 700;
  font-size: 0.88rem;
  margin-bottom: 4px;
}

.tt-desc {
  font-size: 0.8rem;
  line-height: 1.38;
  color: #cbd5e1;
}

/* Weights modal */
.weights-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

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

.weight-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
}
.weight-row.active {
  border-color: rgba(16, 185, 129, 0.55);
}

.weight-name {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--mono);
  font-size: 0.88rem;
  font-weight: 600;
}

.weight-meta {
  font-size: 0.78rem;
  margin-top: 3px;
}

.weight-actions {
  display: flex;
  gap: 6px;
}

.upload-section {
  border-top: 1px solid var(--border);
  padding-top: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.upload-section h4 {
  margin: 0;
  font-size: 0.94rem;
}

.dropzone {
  border: 2px dashed rgba(255, 255, 255, 0.22);
  border-radius: 11px;
  padding: 22px;
  text-align: center;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
  background: rgba(0, 0, 0, 0.2);
}
.dropzone:hover,
.dropzone.dragover {
  border-color: var(--emerald);
  color: var(--text);
}

.progress-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
}
.progress-track {
  flex: 1;
  height: 8px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  width: 0%;
  background: var(--emerald);
  transition: width 0.12s linear;
}

.empty-box {
  padding: 20px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--border);
  border-radius: 10px;
}

/* Toasts */
.toast-container {
  position: fixed;
  right: 16px;
  bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 150;
}

.toast {
  background: #102a22;
  border: 1px solid rgba(16, 185, 129, 0.5);
  color: #ecfdf5;
  padding: 10px 14px;
  border-radius: 9px;
  font-size: 0.88rem;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  transition: opacity 0.25s ease;
}
.toast.error {
  background: #331317;
  border-color: rgba(239, 68, 68, 0.55);
  color: #fee2e2;
}
.toast.fade-out {
  opacity: 0;
}

@media (max-width: 1080px) {
  .room-layout {
    grid-template-columns: 1fr;
  }
  .lobby-grid {
    grid-template-columns: 1fr;
  }
  .mobile-sidebar-tabs {
    display: flex;
  }
  .room-sidebar[data-active-tab="log"] .sidebar-panel:not([data-panel="log"]),
  .room-sidebar[data-active-tab="controls"] .sidebar-panel:not([data-panel="controls"]),
  .room-sidebar[data-active-tab="history"] .sidebar-panel:not([data-panel="history"]) {
    display: none;
  }
}

@media (max-width: 768px) {
  .field input[type="text"],
  .field input[type="password"],
  .field input[type="number"],
  .field select,
  .raise-input {
    font-size: 16px;
  }

  .room-view {
    padding: 8px 8px 16px;
  }

  .action-bar {
    position: sticky;
    bottom: 0;
    z-index: 25;
    margin-top: 8px;
    padding: 8px 10px calc(8px + env(safe-area-inset-bottom));
    background: rgba(15, 22, 30, 0.97);
    backdrop-filter: blur(10px);
    height: auto;
    min-height: 132px;
    gap: 8px;
  }

  .action-primary-row {
    min-height: 44px;
  }

  .action-turn-hint {
    display: none;
  }

  .action-primary-buttons {
    gap: 6px;
  }

  .action-primary-buttons .btn {
    height: 44px;
    font-size: 0.84rem;
    padding: 0 6px;
  }

  .action-sizing-row {
    flex-direction: column;
    align-items: stretch;
    gap: 7px;
    padding-top: 7px;
  }

  .sizing-presets {
    height: 34px;
    min-height: 34px;
  }

  .raise-controls {
    width: 100%;
    height: 36px;
    justify-content: space-between;
  }

  .raise-controls input[type="range"] {
    flex: 1;
    min-width: 80px;
  }

  .raise-input {
    width: 68px;
    padding: 5px 6px;
  }

  .toast-container {
    left: 10px;
    right: 10px;
    bottom: 148px;
  }
}

@media (max-width: 680px) {
  .topbar {
    padding: 7px 10px;
    gap: 6px;
    flex-wrap: nowrap;
  }
  .topbar-left,
  .topbar-right {
    gap: 5px;
    flex-wrap: nowrap;
  }
  .brand-title,
  #header-model-badge {
    display: none;
  }
  .topbar .btn-sm {
    padding: 6px 8px;
    font-size: 0.78rem;
  }
  #header-nick-btn {
    max-width: 78px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .lobby-view {
    margin: 12px auto;
    padding: 0 10px;
  }
  .rooms-grid {
    grid-template-columns: 1fr;
  }

  .room-header-bar {
    gap: 6px;
    margin-bottom: 6px;
    flex-wrap: nowrap;
  }
  .room-header-bar > div:first-child {
    min-width: 0;
    flex: 1;
  }
  .room-header-bar h2 {
    font-size: 0.96rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #room-meta {
    font-size: 0.72rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .room-header-actions {
    width: auto;
    flex-wrap: nowrap;
    gap: 5px;
    flex-shrink: 0;
  }
  .room-header-actions .btn-sm {
    padding: 6px 8px;
    font-size: 0.76rem;
  }
  .ws-pill {
    font-size: 0.65rem;
    padding: 2px 6px;
  }
  #start-hand-btn {
    min-width: 96px;
  }

  .table-banner {
    height: 44px;
    min-height: 44px;
    max-height: 44px;
    padding: 4px 10px;
    margin-bottom: 6px;
    font-size: 0.78rem;
    flex-wrap: nowrap;
    overflow: hidden;
  }
  .banner-text {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .banner-actions .btn-sm {
    padding: 4px 8px;
    font-size: 0.74rem;
  }

  .table-stage {
    padding: 6px 4px;
    border-radius: 12px;
  }

  .poker-table {
    height: clamp(340px, 46dvh, 405px);
  }

  .table-felt {
    inset: 14% 18%;
    border-radius: 999px;
    border-width: 6px;
  }

  .table-center {
    gap: 5px;
    padding: 4px;
  }
  .street-badge {
    font-size: 0.66rem;
    padding: 2px 8px;
  }
  .pot-display {
    font-size: 0.8rem;
    padding: 2px 9px;
  }
  .board-cards {
    gap: 3px;
    min-height: 42px;
  }
  .board-slot,
  .board-cards .playing-card {
    width: 30px;
    height: 42px;
    border-radius: 5px;
  }
  .board-cards .playing-card .card-rank {
    font-size: 0.74rem;
  }
  .board-cards .playing-card .card-suit {
    font-size: 0.8rem;
  }

  .seat-box {
    width: 84px;
    gap: 2px;
  }
  .seat-box.empty {
    height: 54px;
    padding: 4px;
  }
  .empty-seat-label {
    font-size: 0.64rem;
  }
  .empty-seat-btns .btn-xs {
    padding: 3px 5px;
    font-size: 0.68rem;
  }
  .seat-cards {
    height: 32px;
  }
  .playing-card.small {
    width: 24px;
    height: 32px;
  }
  .playing-card.small .card-rank {
    font-size: 0.64rem;
  }
  .playing-card.small .card-suit {
    font-size: 0.68rem;
  }
  .seat-plate {
    height: 38px;
    padding: 3px 5px;
    border-radius: 7px;
  }
  .seat-name {
    font-size: 0.68rem;
  }
  .bot-tag {
    display: none;
  }
  .pos-tag {
    font-size: 0.55rem;
    padding: 1px 3px;
  }
  .seat-stack {
    font-size: 0.7rem;
    margin-top: 1px;
  }
  .seat-bet-pill {
    font-size: 0.62rem;
    padding: 1px 5px;
  }
  .seat-bet-pill.bet-bottom {
    bottom: -16px;
  }
  .seat-bet-pill.bet-top {
    top: -15px;
  }
  .seat-bet-pill.bet-right {
    left: calc(100% + 2px);
  }
  .seat-bet-pill.bet-left {
    right: calc(100% + 2px);
  }
  .seat-status-pill {
    font-size: 0.58rem;
    max-width: 82px;
    top: -8px;
    padding: 1px 5px;
  }
  .dealer-button {
    width: 16px;
    height: 16px;
    font-size: 0.6rem;
    bottom: -5px;
    left: -5px;
  }

  .modal-backdrop {
    padding: 0;
    align-items: end;
  }
  .modal {
    border-radius: 16px 16px 0 0;
    max-height: 92dvh;
    padding: 14px;
  }
  .review-players-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
  .token-tooltip {
    max-width: calc(100vw - 20px);
  }
  .prob-bar-row {
    grid-template-columns: 96px 1fr 46px;
  }
}

@media (max-width: 480px) {
  .two-col {
    grid-template-columns: 1fr;
  }
}
