:root {
  color-scheme: dark;
  --bg: #0a0d12;
  --panel: rgba(17, 23, 31, 0.94);
  --line: rgba(136, 154, 175, 0.18);
  --line-strong: rgba(174, 194, 216, 0.28);
  --text: #eef4fb;
  --muted: #93a1b2;
  --ok: #29c46d;
  --warn: #ffb44d;
  --danger: #ff6c67;
  --accent: #3f7cff;
  --rail-shadow: 0 20px 50px rgba(0, 0, 0, 0.32);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, system-ui, Arial, sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at 50% -10%, rgba(52, 92, 160, 0.26), transparent 32%),
    radial-gradient(circle at 20% 0%, rgba(255, 180, 77, 0.09), transparent 24%),
    linear-gradient(180deg, #090c10 0%, #0b1016 30%, #0a0d12 100%);
}

.app-shell {
  max-width: 1680px;
  margin: 0 auto;
  padding: 14px 18px 26px;
}

.chrome-panel {
  background: linear-gradient(180deg, rgba(20, 27, 36, 0.96), rgba(14, 19, 27, 0.98));
  border: 1px solid var(--line);
  box-shadow: var(--rail-shadow);
}

.panel {
  border-radius: 22px;
  padding: 16px;
}

.topbar, .toolbar-panel, .action-dock, .utilities-panel, .bottom > * {
  margin-bottom: 14px;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
}

.brand-kicker,
.table-stage-kicker,
.dock-kicker,
.rail-kicker {
  font-size: 11px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #7d8b9d;
}

.topbar h1 {
  margin: 4px 0 3px;
  font-size: 31px;
  line-height: 1;
}

.topbar p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.topbar-status,
.toolbar-actions,
.table-head-right,
.section-header,
.action-dock-top,
.grid,
.seat-top,
.seat-flags {
  display: flex;
  gap: 12px;
}

.topbar-status,
.table-head-right,
.action-dock-top,
.section-header,
.seat-top {
  align-items: center;
}

.topbar-status {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.status-pill,
.minor-status,
.table-chip,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  white-space: nowrap;
}

.status-pill {
  min-width: 124px;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(28, 37, 49, 0.95);
  font-size: 14px;
}

.status-pill.ok {
  border-color: rgba(41,196,109,.35);
  color: #a7efc2;
  background: rgba(41,196,109,.11);
}

.status-pill.warn {
  border-color: rgba(255,180,77,.35);
  color: #ffd8a0;
  background: rgba(255,180,77,.1);
}

.minor-status {
  padding: 9px 13px;
  border-radius: 999px;
  border: 1px solid var(--line);
  color: var(--muted);
  background: rgba(17, 23, 31, 0.88);
  font-size: 13px;
}

.minor-status.turn {
  color: #bcd9ff;
  border-color: rgba(63,124,255,.36);
  background: rgba(63,124,255,.12);
}

.minor-status.active {
  color: #ffd8a0;
  border-color: rgba(255,180,77,.36);
  background: rgba(255,180,77,.12);
}

.toolbar-panel {
  padding: 14px 16px;
}

.toolbar-grid {
  display: grid;
  gap: 14px;
  margin-bottom: 12px;
}

.toolbar-grid-main {
  grid-template-columns: minmax(220px, 1.4fr) minmax(160px, .7fr) minmax(0, 1.7fr);
}

.toolbar-grid-player {
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1.3fr);
}

.player-inline-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.toolbar-actions {
  flex-wrap: wrap;
  align-content: flex-start;
}

.primary-actions button,
.player-actions button {
  flex: 1 1 150px;
}

.toolbar-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-top: 4px;
}

label {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

input {
  width: 100%;
  margin-top: 7px;
  padding: 11px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: rgba(22, 30, 41, 0.96);
  color: var(--text);
  font-size: 15px;
}

input[readonly] {
  opacity: .9;
}

button {
  border: 0;
  border-radius: 12px;
  padding: 12px 16px;
  cursor: pointer;
  font-size: 15px;
  font-weight: 700;
  background: linear-gradient(180deg, #4b86ff, #356df2);
  color: white;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12);
}

button.secondary {
  background: linear-gradient(180deg, #39485d, #2c394a);
}

button.ghost {
  background: transparent;
  border: 1px solid var(--line-strong);
}

button.danger-soft {
  background: linear-gradient(180deg, #485363, #313c49);
}

button:disabled {
  opacity: .44;
  cursor: not-allowed;
}

.hint,
.muted {
  color: var(--muted);
  font-size: 13px;
}

.play-stage {
  display: grid;
  grid-template-columns: minmax(0, 1.9fr) minmax(300px, .75fr);
  gap: 14px;
  align-items: start;
}

.table-stage-panel {
  padding: 14px 14px 12px;
}

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

.table-stage-head h2,
.rail-header h2,
.action-dock h3 {
  margin: 2px 0 0;
  font-size: 20px;
}

.status-chip,
.table-chip {
  padding: 7px 11px;
  border-radius: 999px;
  border: 1px solid rgba(63,124,255,.25);
  color: #bfd6ff;
  background: rgba(63,124,255,.12);
  font-size: 12px;
}

.poker-table-shell {
  position: relative;
  min-height: 770px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.poker-table {
  position: relative;
  width: min(100%, 1180px);
  min-height: 740px;
  border-radius: 320px;
  background:
    radial-gradient(circle at 50% 45%, rgba(22, 156, 102, 0.30), transparent 42%),
    radial-gradient(circle at 50% 48%, rgba(12, 103, 67, 0.98), rgba(4, 45, 29, 0.98) 72%),
    linear-gradient(180deg, rgba(255,255,255,.02), rgba(0,0,0,.12));
  border: 18px solid #2e241c;
  box-shadow:
    inset 0 0 0 3px rgba(160, 109, 55, 0.55),
    inset 0 0 120px rgba(0, 0, 0, 0.22),
    0 38px 90px rgba(0, 0, 0, 0.45);
}

.poker-table::before {
  content: '';
  position: absolute;
  inset: 18px;
  border-radius: 300px;
  border: 2px solid rgba(255,255,255,.08);
  pointer-events: none;
}

.table-felt-logo {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -48%);
  font-size: 60px;
  font-weight: 800;
  letter-spacing: .06em;
  color: rgba(234, 243, 247, 0.09);
  pointer-events: none;
  user-select: none;
}

.table-center {
  position: absolute;
  inset: 50% auto auto 50%;
  transform: translate(-50%, -46%);
  width: min(66%, 560px);
  text-align: center;
  z-index: 2;
}

.table-pot-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 12px;
}

.table-pot {
  padding: 10px 18px;
  border-radius: 999px;
  border: 1px solid rgba(255, 180, 77, 0.24);
  background: rgba(15, 22, 19, 0.85);
  color: #ffd36f;
  font-weight: 800;
  font-size: 24px;
}

.board {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 82px;
}

.card {
  min-width: 68px;
  min-height: 92px;
  padding: 18px 14px;
  border-radius: 16px;
  background: linear-gradient(180deg, #fefefe, #eef2f6);
  color: #111827;
  font-size: 25px;
  font-weight: 900;
  box-shadow: 0 12px 26px rgba(0,0,0,.3);
}

.card.placeholder {
  background: transparent;
  color: rgba(255,255,255,.62);
  border: 1px dashed rgba(255,255,255,.22);
  box-shadow: none;
}

.table-stage,
.table-meta {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  margin-top: 14px;
  padding: 8px 16px;
  border-radius: 999px;
  background: rgba(11, 18, 25, 0.82);
  border: 1px solid rgba(255,255,255,.09);
}

.table-stage {
  font-weight: 700;
  font-size: 15px;
}

.table-meta {
  margin-top: 10px;
  color: #bcc9d5;
  font-size: 13px;
}

.seat-spot {
  position: absolute;
  width: 198px;
  z-index: 3;
}

.pos-1 { top: 30px; left: 50%; transform: translateX(-50%); }
.pos-2 { top: 96px; right: 102px; }
.pos-3 { top: 284px; right: 30px; }
.pos-4 { bottom: 120px; right: 104px; }
.pos-5 { bottom: 32px; left: 50%; transform: translateX(-50%); }
.pos-6 { bottom: 120px; left: 104px; }
.pos-7 { top: 284px; left: 30px; }
.pos-8 { top: 96px; left: 102px; }
.pos-9 { top: 30px; left: 158px; }

.seat {
  position: relative;
  border: 1px solid rgba(168, 186, 209, 0.18);
  border-radius: 20px;
  padding: 10px 12px 12px;
  background: linear-gradient(180deg, rgba(8, 13, 20, 0.92), rgba(11, 18, 27, 0.96));
  box-shadow: 0 12px 26px rgba(0, 0, 0, 0.28);
}

.seat.compact {
  min-height: 124px;
}

.seat.empty {
  background: rgba(8, 13, 20, 0.58);
  border-style: dashed;
  opacity: .92;
}

.seat.self-seat {
  border-color: rgba(41,196,109,.48);
  box-shadow: 0 0 0 1px rgba(41,196,109,.16), 0 12px 26px rgba(0, 0, 0, 0.28);
}

.seat.turn-seat {
  border-color: rgba(63,124,255,.54);
  box-shadow: 0 0 0 1px rgba(63,124,255,.18), 0 12px 26px rgba(0,0,0,.28);
}

.seat-name {
  margin-top: 5px;
  font-size: 14px;
  color: #dce7f2;
}

.stack {
  margin: 8px 0 6px;
  font-size: 18px;
  font-weight: 800;
  color: #f4fbff;
}

.seat-top strong {
  font-size: 15px;
}

.seat-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
  min-height: 26px;
}

.badge {
  padding: 4px 8px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font-size: 11px;
}

.badge.turn {
  color: #bed7ff;
  border-color: rgba(63,124,255,.35);
  background: rgba(63,124,255,.12);
}

.badge.ready {
  color: #b5f2c8;
  border-color: rgba(41,196,109,.35);
  background: rgba(41,196,109,.12);
}

.badge.hand {
  color: #ffd5a2;
  border-color: rgba(255,180,77,.35);
  background: rgba(255,180,77,.12);
}

.badge.self {
  color: #d0ffe1;
  border-color: rgba(41,196,109,.35);
  background: rgba(41,196,109,.08);
}

.hole-cards {
  display: flex;
  gap: 8px;
  margin-top: 9px;
  min-height: 42px;
  justify-content: center;
}

.card-mini {
  min-width: 42px;
  padding: 10px 7px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fbfdff, #eef3f8);
  color: #111827;
  text-align: center;
  font-weight: 800;
}

.card-mini.back {
  background: linear-gradient(180deg, #924848, #6b2e2e);
  color: #fff4f0;
}

.play-rail {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.summary-rail-card,
.log-rail-card {
  padding: 14px;
}

.compact-kv {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.kv-item {
  border-radius: 14px;
  padding: 11px 12px;
  border: 1px solid var(--line);
  background: rgba(19, 27, 37, 0.88);
}

.kv-item .key {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 6px;
}

.kv-item .value {
  font-size: 16px;
  font-weight: 800;
}

.action-dock {
  margin-top: 14px;
  padding: 16px;
}

.action-dock-top {
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 12px;
}

.action-dock h3 {
  margin: 4px 0 0;
}

.action-inputs {
  display: grid;
  grid-template-columns: minmax(180px, .8fr) minmax(160px, .8fr);
  gap: 12px;
  margin-bottom: 12px;
}

.table-actions-row {
  display: grid;
  gap: 10px;
  margin-bottom: 10px;
}

.primary-row {
  grid-template-columns: 1.05fr 1fr 1fr;
}

.secondary-row {
  grid-template-columns: 1fr 1fr;
}

.action-dock-hint {
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 14px;
  border: 1px solid rgba(255,180,77,.28);
  background: rgba(255,180,77,.08);
}

.utilities-panel,
.diagnostics-grid {
  margin-top: 14px;
}

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

.debug-seat-wrap,
.debug-seat {
  min-width: 0;
}

.code {
  min-height: 220px;
  max-height: 420px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: #091018;
  color: #d9e4ef;
  white-space: pre-wrap;
  word-break: break-word;
}

.log {
  min-height: 260px;
  max-height: 620px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.log-entry {
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 10px 12px;
  background: rgba(10, 16, 24, 0.88);
}

.log-entry.error {
  border-color: rgba(255,108,103,.35);
}

.log-entry .top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.log-entry .kind {
  font-weight: 800;
}

.log-entry .desc {
  color: var(--muted);
  font-size: 13px;
  word-break: break-word;
}

@media (max-width: 1380px) {
  .play-stage {
    grid-template-columns: 1fr;
  }

  .play-rail {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1220px) {
  .toolbar-grid-main,
  .toolbar-grid-player {
    grid-template-columns: 1fr;
  }

  .player-inline-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar-foot {
    flex-direction: column;
  }

  .poker-table {
    min-height: 820px;
  }

  .seat-spot {
    width: 184px;
  }

  .pos-2,
  .pos-4 {
    right: 64px;
  }

  .pos-6,
  .pos-8 {
    left: 64px;
  }
}

@media (max-width: 1080px) {
  .poker-table-shell {
    min-height: 980px;
  }

  .poker-table {
    min-height: 940px;
    border-radius: 80px;
  }

  .poker-table::before {
    border-radius: 60px;
  }

  .seat-spot {
    width: calc(50% - 18px);
  }

  .pos-1 { top: 16px; left: 10px; transform: none; }
  .pos-2 { top: 16px; right: 10px; }
  .pos-3 { top: 170px; right: 10px; }
  .pos-4 { top: 324px; right: 10px; bottom: auto; }
  .pos-5 { bottom: 16px; left: 10px; transform: none; }
  .pos-6 { bottom: 16px; right: 10px; left: auto; }
  .pos-7 { top: 324px; left: 10px; }
  .pos-8 { top: 170px; left: 10px; }
  .pos-9 { top: 478px; left: 10px; }

  .table-center {
    width: calc(100% - 44px);
    top: auto;
    bottom: 220px;
    transform: translateX(-50%);
  }

  .table-felt-logo {
    font-size: 44px;
  }
}

@media (max-width: 820px) {
  .app-shell {
    padding: 12px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-status {
    justify-content: flex-start;
  }

  .player-inline-grid {
    grid-template-columns: 1fr;
  }

  .play-rail {
    grid-template-columns: 1fr;
  }

  .action-inputs,
  .primary-row,
  .secondary-row,
  .compact-kv {
    grid-template-columns: 1fr;
  }

  .poker-table-shell {
    min-height: 1240px;
  }

  .poker-table {
    min-height: 1180px;
  }

  .seat-spot {
    width: calc(100% - 20px);
    left: 10px !important;
    right: auto !important;
    transform: none !important;
  }

  .pos-1 { top: 18px; }
  .pos-2 { top: 146px; }
  .pos-3 { top: 274px; }
  .pos-4 { top: 402px; }
  .pos-5 { top: 530px; bottom: auto; }
  .pos-6 { top: 658px; bottom: auto; }
  .pos-7 { top: 786px; }
  .pos-8 { top: 914px; }
  .pos-9 { top: 1042px; }

  .table-center {
    width: calc(100% - 32px);
    bottom: 24px;
  }

  .board {
    gap: 8px;
  }

  .card {
    min-width: 54px;
    min-height: 74px;
    padding: 14px 10px;
    font-size: 20px;
  }
}
.card.card-face,
.card-mini.card-mini-face {
  padding: 0;
  background: transparent;
  border: 0;
  box-shadow: none;
  overflow: visible;
}

.playing-card-img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.28));
}

.playing-card-img.board {
  border-radius: 14px;
}

.playing-card-img.mini {
  border-radius: 10px;
}

.card.card-face {
  min-width: 68px;
  min-height: 92px;
}

.card-mini.card-mini-face {
  min-width: 42px;
  min-height: 58px;
}

.hole-cards.self-cards,
.hole-cards.hidden-cards {
  align-items: center;
}
/* Ajuste visual: cartas más pequeñas, caja de jugador compacta y fichas apostadas en mesa */

.poker-table-shell {
  min-height: 700px;
}

.poker-table {
  min-height: 660px;
}

.table-center {
  width: min(54%, 430px);
  transform: translate(-50%, -42%);
}

.table-pot {
  position: relative;
  z-index: 8;
  padding: 8px 16px;
  font-size: 20px;
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.22);
}

.board {
  gap: 8px;
  min-height: 62px;
}

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

.playing-card-img.board {
  width: 48px;
  height: 68px;
  border-radius: 10px;
}

.card.placeholder {
  min-width: 48px;
  min-height: 68px;
  font-size: 18px;
}

.seat-spot {
  width: 140px;
  z-index: 5;
}

.pos-1 { top: 16px; left: 50%; transform: translateX(-50%); }
.pos-2 { top: 78px; right: 58px; }
.pos-3 { top: 246px; right: 18px; }
.pos-4 { bottom: 98px; right: 68px; }
.pos-5 { bottom: 18px; left: 50%; transform: translateX(-50%); }
.pos-6 { bottom: 98px; left: 68px; }
.pos-7 { top: 246px; left: 18px; }
.pos-8 { top: 78px; left: 58px; }
.pos-9 { top: 16px; left: 116px; }

.seat-minimal {
  min-height: auto;
  padding: 10px 10px 8px;
  border-radius: 18px;
}

.compact-empty {
  min-height: 88px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.seat-headline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.player-name {
  font-size: 20px;
  font-weight: 800;
  line-height: 1;
  color: #f3f7fd;
}

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

.compact-stack {
  margin: 0 0 6px;
  font-size: 24px;
  line-height: 1;
}

.seat-minimal .hole-cards {
  margin-top: 2px;
  min-height: 48px;
  gap: 6px;
  justify-content: flex-start;
}

.seat-minimal .card-mini.card-mini-face {
  min-width: 34px;
  min-height: 48px;
}

.seat-minimal .playing-card-img.mini {
  width: 34px;
  height: 48px;
  border-radius: 8px;
}

.compact-flags {
  margin-top: 4px;
  min-height: unset;
  gap: 4px;
}

.compact-flags .badge {
  padding: 2px 6px;
  font-size: 10px;
}

.badge.dealer,
.badge.blind {
  color: #ffe39e;
  border-color: rgba(255, 180, 77, 0.28);
  background: rgba(255, 180, 77, 0.08);
}

.seat-bet {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 6px;
  z-index: 7;
  pointer-events: none;
}

.chip-stack-visual {
  position: relative;
  width: 24px;
  height: 20px;
  display: inline-block;
}

.chip-stack-visual span {
  position: absolute;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.75);
  background: radial-gradient(circle at 35% 35%, #ff6f6f, #c62828);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.28);
}

.chip-stack-visual span:nth-child(1) { left: 0; top: 4px; }
.chip-stack-visual span:nth-child(2) { left: 5px; top: 2px; }
.chip-stack-visual span:nth-child(3) { left: 10px; top: 0; }

.bet-amount {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(10, 16, 24, 0.92);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #fff0c7;
  font-weight: 800;
  font-size: 12px;
}

.bet-1 { left: 50%; top: 100%; transform: translate(-50%, 10px); }
.bet-2 { right: 100%; top: 50%; transform: translate(-14px, -50%); }
.bet-3 { right: 100%; top: 50%; transform: translate(-16px, -50%); }
.bet-4 { right: 100%; bottom: 18px; transform: translate(-18px, 0); }
.bet-5 { left: 50%; bottom: 100%; transform: translate(-50%, -12px); }
.bet-6 { left: 100%; bottom: 18px; transform: translate(18px, 0); }
.bet-7 { left: 100%; top: 50%; transform: translate(16px, -50%); }
.bet-8 { left: 100%; top: 50%; transform: translate(14px, -50%); }
.bet-9 { left: 100%; top: 100%; transform: translate(8px, 10px); }

.table-stage,
.table-meta {
  position: relative;
  z-index: 6;
  font-size: 12px;
  padding: 7px 12px;
}
/* Cuenta: login + billetera */
.account-panel [hidden] { display: none !important; }
.account-panel .toolbar-grid { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px; }
.account-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; }
.account-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); }
.account-summary { display: flex; flex-direction: column; gap: 2px; }
.account-summary strong { color: var(--text); }
#account-status.error { color: var(--danger); }
