:root {
  --bg: #0b1220;
  --panel: #141c2e;
  --line: #243049;
  --text: #f3efe4;
  --muted: #9aa6bd;
  --gold: #e4c36a;
  --felt: #1b6b3e;
  --felt-2: #0f3f25;
  --red: #d64545;
  --ok: #3dd68c;
  --nav: 58px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", sans-serif;
  font-size: 15px;
}

button, input, select { font: inherit; }

#app { min-height: 100vh; }

.screen {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(20px + env(safe-area-inset-bottom));
}

.table-screen {
  max-width: 860px;
  padding: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(ellipse at 50% 18%, #3a2412 0%, #1a1008 38%, #0a0705 100%);
}

h1 { margin: 0; font-size: 24px; letter-spacing: .04em; }
h2 { margin: 0 0 10px; font-size: 16px; }

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.chip-logo {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: conic-gradient(#e4c36a, #8a6a22, #e4c36a, #c9a24a);
  box-shadow: inset 0 0 0 6px #1b1408, 0 0 0 2px #e4c36a;
}

.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  color: var(--gold);
  border: 1px solid #8a6f32;
  border-radius: 999px;
  padding: 2px 8px;
}

.sub { color: var(--muted); font-size: 13px; margin: 6px 0 18px; }

.card, .panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px;
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.field span { color: var(--muted); font-size: 12px; }
.field input, .field select {
  background: #0d1424;
  border: 1px solid var(--line);
  color: var(--text);
  border-radius: 10px;
  padding: 11px 12px;
}

.row { display: flex; gap: 8px; }
.row > * { flex: 1; }

.btn {
  border: 0;
  border-radius: 12px;
  padding: 12px 14px;
  font-weight: 700;
  cursor: pointer;
  background: linear-gradient(#f0d78a, #c9a24a);
  color: #2a1c08;
}

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

.btn.danger { background: linear-gradient(#e26868, #b43c3c); color: #fff; }
.btn.ok { background: linear-gradient(#4adf96, #1f9d5d); color: #08301c; }
.btn.wide { width: 100%; }
.btn:disabled { opacity: .45; }

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

.cash {
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
}

.room {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.room:last-child { border-bottom: 0; }

.nav {
  position: sticky;
  bottom: 0;
  display: flex;
  background: #10182a;
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}

.nav button {
  flex: 1;
  background: none;
  border: 0;
  color: var(--muted);
  padding: 12px 0;
}

.nav button.on { color: var(--gold); font-weight: 700; }

.table-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(10px + env(safe-area-inset-top)) 12px 8px;
}

.table-bar .meta { flex: 1; min-width: 0; }
.table-bar b { display: block; font-size: 15px; }
.table-bar small { color: var(--muted); }

.arena {
  position: relative;
  flex: 1;
  min-height: 420px;
  margin: 0 8px;
}

.felt {
  position: absolute;
  inset: 14% 6% 20%;
  border-radius: 50%;
  background:
    radial-gradient(ellipse at 50% 32%, #3aa35f 0%, #1d7a42 42%, #0e4d28 78%, #08351b 100%);
  box-shadow:
    inset 0 0 40px #04180c88,
    inset 0 0 0 3px #0a3d20,
    0 0 0 14px #6b3e1a,
    0 0 0 18px #c9a24a,
    0 0 0 22px #3d2410,
    0 22px 50px #000a;
}
.felt::before {
  content: 'TEXAS HOLD\'EM';
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  font-size: 13px;
  letter-spacing: .35em;
  color: #146b38;
  font-weight: 800;
  pointer-events: none;
}
.felt::after {
  content: '';
  position: absolute;
  inset: 10%;
  border-radius: 50%;
  border: 2px dashed #1f8a4a55;
  pointer-events: none;
}

.board {
  position: absolute;
  left: 50%;
  top: 46%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 2;
}

.pot {
  color: var(--gold);
  font-weight: 800;
  text-shadow: 0 2px 8px #0008;
}

.cards { display: flex; gap: 6px; min-height: 72px; }

.pcard {
  width: 52px;
  height: 74px;
  border-radius: 8px;
  background: linear-gradient(#fffdf8, #f3ead4);
  color: #1b1b1b;
  position: relative;
  box-shadow: 1px 3px 0 #c9b48a, 0 8px 14px #0006;
  overflow: hidden;
}
.pcard .corner { position: absolute; top: 4px; left: 5px; line-height: 1; font-weight: 800; }
.pcard .corner b { display: block; font-size: 13px; }
.pcard .corner i { font-style: normal; font-size: 12px; }
.pcard .corner.bot { top: auto; left: auto; right: 5px; bottom: 4px; transform: rotate(180deg); }
.pcard .pip { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; }
.pcard.red { color: #c62828; }
.pcard.back {
  background:
    repeating-linear-gradient(45deg, #7a1d2c 0 6px, #9a2a3d 6px 12px);
  border: 2px solid #e8c56a;
  box-shadow: 0 8px 14px #0006;
}
.pcard.back .corner, .pcard.back .pip { display: none; }

.seat {
  position: absolute;
  width: 92px;
  text-align: center;
  z-index: 3;
  transform: translate(-50%, -50%);
}

.seat .avatar {
  width: 54px;
  height: 54px;
  margin: 0 auto;
  border-radius: 50%;
  background: #22304d;
  border: 3px solid #8a9bb8;
  display: grid;
  place-items: center;
  font-weight: 800;
  overflow: hidden;
  font-size: 22px;
}

.avatar-img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar-lg { width: 88px; height: 88px; margin: 0 auto 12px; border-radius: 50%; overflow: hidden; border: 3px solid #8a9bb8; display: grid; place-items: center; background: #22304d; font-size: 40px; }
.preset-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.preset { border: 1px solid var(--line); background: #0d1424; border-radius: 12px; padding: 8px 0; font-size: 22px; cursor: pointer; }
.preset.on { border-color: var(--gold); box-shadow: 0 0 0 2px #e4c36a55; }
.start-mid { min-width: 120px; font-size: 18px; padding: 12px 22px; }

.seat.acting .avatar { border-color: var(--gold); box-shadow: 0 0 0 4px #e4c36a44; }
.seat.empty .avatar {
  background: transparent;
  border-style: dashed;
  color: #d9c48a;
  font-size: 12px;
  box-shadow: none;
}
.seat.empty { background: none; border: 0; }

.seat .name, .seat .stack { font-size: 11px; margin-top: 3px; }
.seat .stack { color: var(--gold); font-weight: 700; }

.seat .holes {
  display: flex;
  justify-content: center;
  gap: 3px;
  margin-top: 4px;
}

.seat .holes .pcard { width: 34px; height: 48px; }
.seat.hero .holes .pcard { width: 58px; height: 82px; }

.badge {
  position: absolute;
  top: -6px;
  right: 4px;
  min-width: 28px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: linear-gradient(#fff7d6, #e4c36a);
  color: #3a2a08;
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
  box-shadow: 0 2px 4px #0007;
}
.badge.sb { background: linear-gradient(#dbeafe, #38bdf8); color: #0c4a6e; }
.badge.bb { background: linear-gradient(#fed7aa, #f59e0b); color: #7c2d12; }
.badge.utg { background: linear-gradient(#e9d5ff, #a855f7); color: #4a044e; }

.chip-pile {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  height: 28px;
  position: relative;
}
.ck {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 2px dashed rgba(255,255,255,.55);
  box-shadow: 0 2px 0 #0006, inset 0 0 0 3px rgba(0,0,0,.18);
  margin-left: -10px;
}
.ck:first-child { margin-left: 0; }
.ck-1 { background: #efefef; }
.ck-5 { background: #dc2626; }
.ck-25 { background: #16a34a; }
.ck-100 { background: #111; border-color: #ddd; }
.ck-500 { background: #7c3aed; }
.chip-amt {
  margin-left: 6px;
  color: #ffe08a;
  font-weight: 800;
  font-size: 12px;
  text-shadow: 0 1px 2px #000;
}

.seat .bet {
  position: absolute;
  left: 50%;
  top: -34px;
  transform: translateX(-50%);
  background: none;
  padding: 0;
  white-space: nowrap;
}

.actions {
  padding: 8px 10px calc(10px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: linear-gradient(#1a120c, #0d0906);
}
.act-main { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.bet-pad { background: #140e0a; border: 1px solid #3d2a14; border-radius: 14px; padding: 8px; }
.bet-presets { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 8px; }
.bet-presets button { padding: 8px 4px; font-size: 12px; }
.bet-slide { display: flex; align-items: center; gap: 8px; }
.bet-slide input[type="range"] { flex: 1; }
.bet-slide input[type="number"] {
  width: 88px;
  background: #0d1424;
  border: 1px solid #3d2a14;
  color: #ffe08a;
  border-radius: 8px;
  padding: 8px;
}

.menu-list { display: flex; flex-direction: column; }
.menu-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  padding: 14px 4px;
  border-bottom: 1px solid var(--line);
  background: none;
  border-left: 0;
  border-right: 0;
  border-top: 0;
  color: inherit;
  text-align: left;
  border-radius: 0;
  cursor: pointer;
}
.menu-item span { color: var(--muted); font-size: 13px; }
.me-hero { display: flex; gap: 14px; align-items: center; margin-bottom: 14px; }
.me-bal { font-size: 28px; color: var(--gold); font-weight: 800; margin: 0; }
.log-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.log-row .up { color: var(--ok); }
.log-row .down { color: #f87171; }

.win {
  text-align: center;
  color: var(--gold);
  font-weight: 700;
  min-height: 22px;
}

.msg { display: flex; gap: 8px; margin: 10px 0; }
.msg.me { justify-content: flex-end; }
.bubble {
  max-width: 80%;
  padding: 8px 10px;
  border-radius: 12px;
  background: #22304d;
}
.msg.me .bubble { background: #3a2f14; color: var(--gold); }

#toast {
  position: fixed;
  left: 50%;
  bottom: 80px;
  transform: translateX(-50%);
  background: #111c;
  color: #fff;
  padding: 8px 14px;
  border-radius: 999px;
  z-index: 9;
}

.admin-body .screen { max-width: 720px; }
.user-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

@media (min-width: 800px) {
  .pcard { width: 56px; height: 80px; }
  .arena { min-height: 560px; }
}
