:root {
  --bg-0: #0b1418;
  --bg-1: #11212a;
  --bg-2: #16303c;
  --felt: radial-gradient(circle at 50% 35%, #0e7a52 0%, #074a35 70%, #02201a 100%);
  --gold: #e8c46a;
  --gold-dim: #b08f3a;
  --text: #e8eef1;
  --text-dim: #9aacb4;
  --danger: #e15a5a;
  --success: #4ddc8e;
  --card-back: repeating-linear-gradient(45deg, #1c3a52, #1c3a52 6px, #2a4d6d 6px, #2a4d6d 12px);
}

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

html, body { height: 100%; }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: linear-gradient(180deg, #0b1418 0%, #11212a 100%);
  color: var(--text);
  overflow-x: hidden;
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
@supports (padding: env(safe-area-inset-top)) {
  body { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
}

#app { display: flex; flex-direction: column; min-height: 100vh; }

.hidden { display: none !important; }

/* Header */
#topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: rgba(0, 0, 0, 0.4);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(8px);
}

.brand { display: flex; align-items: center; gap: 10px; }
.brand .logo {
  font-size: 28px;
  color: var(--gold);
  filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.6));
}
.brand-text { font-weight: 700; letter-spacing: 0.5px; }

#nav { display: flex; gap: 8px; }
#nav button, #nav a {
  background: transparent;
  color: var(--text-dim);
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 8px 14px;
  cursor: pointer;
  font: inherit;
  text-decoration: none;
  transition: all 0.15s;
}
#nav button:hover, #nav a:hover { color: var(--text); background: rgba(255,255,255,0.05); }
#nav button.active, #nav a.active { color: var(--gold); border-color: rgba(232,196,106,0.3); }

.user-info { display: flex; align-items: center; gap: 16px; font-size: 14px; }
.user-info .balance {
  background: linear-gradient(135deg, #c79a3a, #8a6920);
  color: #1a1100;
  padding: 6px 14px;
  border-radius: 999px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  box-shadow: 0 2px 6px rgba(0,0,0,0.5);
}
.user-info .username { color: var(--text); }
.user-info .role-tag {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(232,196,106,0.15);
  color: var(--gold);
}

/* Main */
#view {
  flex: 1;
  padding: 24px;
  display: flex;
  flex-direction: column;
}

/* Auth page */
.auth-wrap {
  margin: auto;
  width: 360px;
  max-width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  padding: 32px;
  border-radius: 16px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}
.auth-wrap h1 { font-size: 22px; margin-bottom: 6px; text-align: center; }
.auth-wrap h1 .logo { color: var(--gold); margin-right: 4px; }
.auth-wrap .tagline { text-align: center; color: var(--text-dim); margin-bottom: 24px; font-size: 13px; }
.auth-tabs { display: flex; margin-bottom: 16px; border-radius: 8px; background: rgba(0,0,0,0.3); padding: 4px; }
.auth-tabs button {
  flex: 1;
  background: transparent;
  color: var(--text-dim);
  border: none;
  padding: 8px;
  border-radius: 6px;
  cursor: pointer;
  font: inherit;
}
.auth-tabs button.active { background: rgba(232,196,106,0.15); color: var(--gold); }

/* Forms */
label { display: block; font-size: 12px; color: var(--text-dim); margin-bottom: 4px; }
input, select, textarea {
  width: 100%;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 10px 12px;
  color: var(--text);
  font: inherit;
  outline: none;
  transition: border 0.15s;
}
input:focus, select:focus { border-color: var(--gold); }
.form-row { margin-bottom: 14px; }
.form-row.inline { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.btn {
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: #1a1100;
  border: none;
  border-radius: 8px;
  padding: 10px 18px;
  font-weight: 700;
  cursor: pointer;
  font: inherit;
  letter-spacing: 0.3px;
  transition: transform 0.1s, box-shadow 0.1s;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(232,196,106,0.3); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn-full { width: 100%; }
.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1px solid rgba(255,255,255,0.2);
}
.btn-ghost:hover { background: rgba(255,255,255,0.05); box-shadow: none; }
.btn-danger { background: linear-gradient(135deg, #e15a5a, #a13a3a); color: white; }
.btn-sm { padding: 6px 12px; font-size: 12px; }

.error-msg { color: var(--danger); font-size: 13px; margin-top: 8px; min-height: 18px; }

/* Lobby */
.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}
.section-title h2 { font-size: 20px; }
.section-title .actions { display: flex; gap: 8px; }

.tables-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 16px;
}
.table-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 18px;
  transition: all 0.2s;
  cursor: pointer;
}
.table-card:hover { background: rgba(255,255,255,0.07); transform: translateY(-2px); border-color: rgba(232,196,106,0.3); }
.table-card h3 { font-size: 16px; margin-bottom: 6px; }
.table-card .meta { color: var(--text-dim); font-size: 13px; line-height: 1.6; }
.table-card .stage-tag {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 6px;
}
.table-card .stage-tag.waiting { background: rgba(155,180,200,0.1); color: var(--text-dim); }
.table-card .stage-tag.live { background: rgba(77,220,142,0.15); color: var(--success); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--text-dim);
}

/* Admin */
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 900px) { .admin-grid { grid-template-columns: 1fr; } }

.panel {
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 20px;
}
.panel h3 { margin-bottom: 14px; font-size: 16px; }

.user-list { max-height: 480px; overflow-y: auto; }
.user-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.user-row:last-child { border-bottom: none; }
.user-row .name { font-weight: 600; }
.user-row .name + .role-tag,
.user-row .role-tag { margin-left: 6px; }
.user-row .balance-cell {
  font-variant-numeric: tabular-nums;
  color: var(--gold);
  font-weight: 600;
}

.tx-list { max-height: 400px; overflow-y: auto; font-size: 13px; }
.tx-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}
.tx-row .tx-type {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  align-self: start;
}
.tx-amount { font-variant-numeric: tabular-nums; font-weight: 600; }
.tx-amount.positive { color: var(--success); }
.tx-amount.negative { color: var(--danger); }
.tx-meta { font-size: 11px; color: var(--text-dim); }

.tx-type.issue { background: rgba(77,220,142,0.15); color: var(--success); }
.tx-type.revoke { background: rgba(225,90,90,0.15); color: var(--danger); }
.tx-type.buy_in { background: rgba(155,180,200,0.15); color: var(--text-dim); }
.tx-type.cash_out { background: rgba(232,196,106,0.15); color: var(--gold); }
.tx-type.win { background: rgba(77,220,142,0.15); color: var(--success); }
.tx-type.loss { background: rgba(225,90,90,0.15); color: var(--danger); }

/* Poker table */
.poker-stage {
  flex: 1;
  display: flex;
  flex-direction: column;
  position: relative;
}

.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.table-header h2 { font-size: 18px; }
.table-header .meta-tags { display: flex; gap: 8px; align-items: center; color: var(--text-dim); font-size: 13px; }
.table-header .stage-pill {
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(232,196,106,0.15);
  color: var(--gold);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.poker-table {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  max-width: 1100px;
  margin: 0 auto;
  background: var(--felt);
  border-radius: 50% / 30%;
  border: 12px solid #2b1b0c;
  box-shadow: 0 20px 60px rgba(0,0,0,0.8), inset 0 0 50px rgba(0,0,0,0.4);
}

.table-center {
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.pot-display {
  background: rgba(0,0,0,0.5);
  border: 1px solid rgba(232,196,106,0.3);
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--gold);
  font-weight: 600;
}

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

.card {
  width: 54px;
  height: 76px;
  background: white;
  border-radius: 6px;
  border: 1px solid rgba(0,0,0,0.2);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  font-weight: 700;
  position: relative;
  box-shadow: 0 4px 10px rgba(0,0,0,0.5);
  user-select: none;
  animation: dealIn 0.3s ease-out;
}
@keyframes dealIn {
  from { transform: translateY(-30px) rotateY(180deg); opacity: 0; }
  to { transform: translateY(0) rotateY(0); opacity: 1; }
}
.card.small { width: 40px; height: 56px; font-size: 16px; }
.card.face-down {
  background: var(--card-back);
  color: transparent;
  border-color: #0e2840;
}
.card .card-rank { line-height: 1; }
.card .card-suit { line-height: 1; font-size: 0.8em; }
.card.red { color: #c92020; }
.card.black { color: #0a0a0a; }

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

.seat {
  position: absolute;
  width: 130px;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  pointer-events: auto;
}
.seat .seat-cards {
  display: flex;
  gap: 4px;
  margin-bottom: 4px;
  min-height: 56px;
}
.seat-plate {
  width: 100%;
  background: rgba(0,0,0,0.65);
  border: 2px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 6px 8px;
  text-align: center;
  transition: all 0.2s;
}
.seat-plate.active { border-color: var(--gold); box-shadow: 0 0 18px rgba(232,196,106,0.6); }
.seat-plate.folded { opacity: 0.4; }
.seat-plate.you { background: rgba(0, 60, 30, 0.85); }

.seat-name { font-size: 12px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seat-chips { font-size: 13px; color: var(--gold); font-variant-numeric: tabular-nums; font-weight: 700; }
.seat-status { font-size: 10px; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.5px; }

.seat-bet {
  position: absolute;
  background: rgba(232,196,106,0.85);
  color: #1a1100;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.dealer-button {
  position: absolute;
  width: 24px;
  height: 24px;
  background: white;
  color: #1a1100;
  border-radius: 50%;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #888;
  box-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

.empty-seat {
  width: 100%;
  height: 70px;
  background: rgba(0,0,0,0.3);
  border: 1px dashed rgba(255,255,255,0.2);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}
.empty-seat:hover { background: rgba(232,196,106,0.1); border-color: var(--gold); color: var(--gold); }

/* Actions */
.action-bar {
  margin-top: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  min-height: 60px;
}
.action-btn {
  background: linear-gradient(135deg, #4a6a8a, #2a4a6a);
  color: white;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-weight: 700;
  cursor: pointer;
  font: inherit;
  min-width: 90px;
  transition: all 0.1s;
}
.action-btn:hover { transform: translateY(-1px); }
.action-btn.fold { background: linear-gradient(135deg, #a13a3a, #6a2424); }
.action-btn.check, .action-btn.call { background: linear-gradient(135deg, #4a8a5a, #2a6a3a); }
.action-btn.bet, .action-btn.raise, .action-btn.all_in { background: linear-gradient(135deg, var(--gold), var(--gold-dim)); color: #1a1100; }

.bet-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0,0,0,0.4);
  padding: 6px;
  border-radius: 10px;
}
.bet-controls input {
  width: 100px;
  text-align: center;
  padding: 8px;
}
.bet-controls .bet-slider {
  width: 200px;
}

.your-turn-banner {
  text-align: center;
  color: var(--gold);
  font-size: 13px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 2px;
  animation: pulse 1.5s infinite;
}
@keyframes pulse { 50% { opacity: 0.5; } }

.waiting-msg {
  text-align: center;
  color: var(--text-dim);
  padding: 20px;
}

.result-overlay {
  position: absolute;
  left: 50%; top: 60%;
  transform: translate(-50%, -50%);
  background: rgba(0,0,0,0.85);
  border: 2px solid var(--gold);
  border-radius: 16px;
  padding: 18px 24px;
  text-align: center;
  z-index: 10;
  animation: fadeIn 0.4s;
}
@keyframes fadeIn { from { opacity: 0; transform: translate(-50%, -40%); } to { opacity: 1; transform: translate(-50%, -50%); } }
.result-overlay h3 { color: var(--gold); margin-bottom: 6px; }
.result-overlay .win-line { font-size: 14px; margin: 3px 0; }

/* Modal */
.modal-back {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  backdrop-filter: blur(4px);
}
.modal {
  background: var(--bg-1);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 14px;
  padding: 24px;
  width: 400px;
  max-width: 90vw;
}
.modal h3 { margin-bottom: 16px; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }

/* Toasts */
#toast-wrap {
  position: fixed;
  top: 80px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.toast {
  background: var(--bg-2);
  color: var(--text);
  padding: 12px 18px;
  border-radius: 8px;
  border-left: 4px solid var(--gold);
  box-shadow: 0 6px 16px rgba(0,0,0,0.4);
  animation: slideIn 0.3s;
  min-width: 240px;
}
.toast.error { border-left-color: var(--danger); }
.toast.success { border-left-color: var(--success); }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 8px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.2); }

/* ============================================================
   Mobile layout (≤ 760px wide)
   ============================================================ */
@media (max-width: 760px) {

  /* Header */
  #topbar {
    padding: 8px 12px;
    flex-wrap: wrap;
    gap: 8px;
  }
  .brand-text { display: none; }
  .brand .logo { font-size: 22px; }

  #nav {
    order: 3;
    width: 100%;
    justify-content: center;
    gap: 4px;
    border-top: 1px solid rgba(255,255,255,0.06);
    padding-top: 6px;
  }
  #nav button, #nav a { padding: 6px 10px; font-size: 13px; }

  .user-info { gap: 8px; font-size: 13px; flex: 1; justify-content: flex-end; }
  .user-info .balance { padding: 4px 10px; font-size: 13px; }
  .user-info .username { display: none; }
  .user-info .role-tag { display: none; }
  .user-info .btn { padding: 6px 10px; font-size: 12px; }

  /* Main */
  #view { padding: 12px; }

  /* Auth */
  .auth-wrap { width: 100%; padding: 22px; border-radius: 12px; }

  /* Lobby */
  .section-title { flex-direction: column; align-items: stretch; gap: 10px; }
  .section-title .actions { justify-content: flex-end; }
  .tables-grid { grid-template-columns: 1fr; gap: 10px; }
  .table-card { padding: 14px; }

  /* Admin */
  .admin-grid { grid-template-columns: 1fr; gap: 14px; }
  .user-row {
    grid-template-columns: 1fr auto;
    grid-template-areas: "name balance" "actions actions";
    row-gap: 8px;
  }
  .user-row > div:first-child { grid-area: name; }
  .user-row .balance-cell { grid-area: balance; }
  .user-row > div:last-child {
    grid-area: actions;
    justify-content: stretch;
    display: grid !important;
    grid-template-columns: repeat(3, 1fr);
    gap: 6px !important;
  }
  .user-row > div:last-child .btn { width: 100%; }
  .tx-row { grid-template-columns: auto 1fr; row-gap: 2px; }
  .tx-row .tx-amount { grid-column: 2; justify-self: end; }

  /* Modals */
  .modal { padding: 18px; border-radius: 12px; max-height: 90vh; overflow-y: auto; }
  .form-row.inline { grid-template-columns: 1fr; gap: 14px; }

  /* Poker table — mobile rebuild: full-height flex column */
  .table-header { flex-direction: column; align-items: stretch; gap: 8px; flex: 0 0 auto; }
  .table-header h2 { font-size: 16px; }

  body[data-view="table"], body[data-view="table"] #app {
    height: 100dvh;
    height: 100vh; /* fallback */
    min-height: 0;
    overflow: hidden;
  }
  body[data-view="table"] #view {
    flex: 1 1 0;
    overflow: hidden;
    padding-bottom: 0;
    padding-top: 8px;
    min-height: 0;
  }
  body[data-view="table"] .poker-stage {
    height: 100%;
    padding-bottom: 0;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }

  .poker-table {
    aspect-ratio: auto;
    height: auto;
    min-height: 0;
    flex: 1;
    border-radius: 22px / 22px;
    border-width: 6px;
    padding: 10px 8px 0;
    position: relative;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0,0,0,0.6), inset 0 0 30px rgba(0,0,0,0.4);
  }

  /* Seats layer scrolls (opponents + center pot/community); your-seat is pinned */
  .seats-layer {
    position: static;
    pointer-events: auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overflow-x: hidden;
    padding-bottom: 160px; /* leave room for the absolutely-positioned your-seat */
  }
  .seats-layer .opponents-row, .seats-layer .seat, .seats-layer .empty-seat,
  .seats-layer .your-seat { pointer-events: auto; }
  .seat {
    position: static;
    transform: none;
    width: 100%;
  }
  .seat .seat-cards { justify-content: center; min-height: 50px; }

  /* Opponent row at top, your seat at bottom */
  .seats-layer .opponents-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(78px, 1fr));
    gap: 6px;
  }
  .seats-layer .opponents-row .seat .seat-plate {
    padding: 4px 6px;
    font-size: 11px;
  }
  .seats-layer .opponents-row .seat-name { font-size: 11px; }
  .seats-layer .opponents-row .seat-chips { font-size: 12px; }

  /* Your seat: absolutely pinned at the bottom of the felt, always visible */
  .poker-table > .your-seat-anchor,
  .seats-layer .your-seat {
    position: absolute;
    left: 8px;
    right: 8px;
    bottom: 8px;
    margin: 0;
    background: rgba(0,0,0,0.6);
    border-radius: 14px;
    padding: 8px;
    border: 1px solid rgba(232,196,106,0.3);
    backdrop-filter: blur(2px);
    z-index: 3;
  }
  .seats-layer .your-seat .seat-cards { min-height: 76px; }
  .seats-layer .your-seat .card { width: 50px; height: 70px; font-size: 20px; }

  .empty-seat { height: 50px; font-size: 11px; }

  /* Center area on mobile */
  .table-center {
    position: static;
    transform: none;
    align-self: center;
    margin: 6px 0 8px;
    gap: 6px;
  }
  .community-cards { min-height: 0; gap: 4px; }
  .card { width: 42px; height: 60px; font-size: 17px; }
  .card.small { width: 32px; height: 46px; font-size: 13px; }
  .pot-display { font-size: 12px; padding: 4px 12px; }

  /* Dealer button / bet chips: render inline-near-seat instead of absolute */
  .dealer-button-inline {
    display: inline-flex;
    width: 18px; height: 18px;
    background: white; color: #1a1100;
    border-radius: 50%; font-size: 10px; font-weight: 700;
    align-items: center; justify-content: center;
    margin-left: 4px;
    border: 1px solid #888;
  }
  .seat-bet-inline {
    display: inline-block;
    background: rgba(232,196,106,0.85);
    color: #1a1100;
    padding: 1px 6px;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 700;
    margin-left: 4px;
  }
  /* Hide desktop-absolute bet chips and dealer buttons on mobile */
  .seats-layer > .seat-bet, .seats-layer > .dealer-button { display: none; }

  /* Action bar pinned at the bottom of the flex column */
  .action-bar {
    flex: 0 0 auto;
    margin-top: 10px;
    margin-left: -12px;
    margin-right: -12px;
    padding: 12px;
    background: rgba(11, 20, 24, 0.96);
    border-top: 1px solid rgba(255,255,255,0.08);
    flex-direction: column;
    gap: 8px;
    z-index: 5;
    min-height: 0;
    padding-bottom: calc(12px + env(safe-area-inset-bottom));
  }
  .bet-controls {
    width: 100%;
    flex-direction: row;
    align-items: center;
    gap: 8px;
    padding: 4px 6px;
  }
  .bet-controls .bet-slider { flex: 1; width: auto; }
  .bet-controls input { width: 72px; padding: 6px 8px; font-size: 13px; }
  .action-bar .action-buttons-row {
    display: grid;
    grid-auto-flow: column;
    grid-auto-columns: 1fr;
    gap: 6px;
    width: 100%;
  }
  .action-btn {
    min-width: 0;
    padding: 12px 6px;
    font-size: 13px;
    line-height: 1.1;
  }
  .your-turn-banner { font-size: 10px; letter-spacing: 1px; margin-bottom: 2px; }

  /* Toasts */
  #toast-wrap { top: auto; bottom: 80px; right: 12px; left: 12px; }
  .toast { min-width: 0; width: 100%; font-size: 13px; padding: 10px 14px; }

  /* Result overlay */
  .result-overlay {
    width: 90%;
    padding: 14px 16px;
    font-size: 13px;
    top: 50%;
  }
  .result-overlay h3 { font-size: 16px; }
}

/* Very small phones (≤ 380px) — extra-compact */
@media (max-width: 380px) {
  .seats-layer .your-seat .card { width: 44px; height: 62px; font-size: 18px; }
  .card.small { width: 28px; height: 40px; font-size: 12px; }
  .action-btn { padding: 12px; font-size: 13px; }
  .user-info .balance { font-size: 12px; padding: 3px 8px; }
}

/* Landscape phones */
@media (max-width: 900px) and (orientation: landscape) {
  .poker-table { min-height: 280px; }
  .seats-layer .your-seat .card { width: 44px; height: 60px; font-size: 16px; }
}
