:root {
  --felt: #0d5c3a;
  --felt-dark: #08361f;
  --felt-light: #14764c;
  --gold: #f0b429;
  --gold-dark: #b4820f;
  --bg: #0b1410;
  --surface: #14211a;
  --surface-variant: #1d2f25;
  --outline: #8fa89a;
  --on-surface: #eef5f0;
  --error: #ff6b5e;
  --danger: #c62828;
  --chip-red: #d64545;
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background: radial-gradient(ellipse at top, #16241c 0%, var(--bg) 60%);
  color: var(--on-surface);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}

.wrap { max-width: 480px; margin: 0 auto; padding: 24px; }
.wrap.wide { max-width: 760px; }
.wrap.full { max-width: 1400px; }

h1, h2, h3 { font-weight: 900; letter-spacing: 0.5px; }

.brand {
  text-align: center;
  color: var(--gold);
  font-weight: 900;
  letter-spacing: 3px;
  font-size: 34px;
  margin: 28px 0 4px;
  text-shadow: 0 2px 0 rgba(0,0,0,0.4);
}
.brand .suit { color: var(--chip-red); }

.subtitle {
  text-align: center;
  color: var(--outline);
  margin-bottom: 28px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 2px;
}

.card {
  background: var(--surface);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 16px;
}
.card.center { text-align: center; }

label {
  display: block;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--outline);
  margin-bottom: 6px;
}

input[type=text], input[type=email], input[type=password], input[type=number], select {
  width: 100%;
  padding: 14px 16px;
  margin-bottom: 18px;
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.15);
  background: var(--surface-variant);
  color: var(--on-surface);
  font-size: 16px;
  font-weight: 600;
}
input:focus, select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }

input.code-input {
  text-align: center;
  font-size: 34px;
  font-weight: 900;
  letter-spacing: 10px;
  text-transform: uppercase;
  padding: 16px 8px 16px 18px;
}

button {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 12px;
  background: var(--gold);
  color: #241a00;
  font-size: 16px;
  font-weight: 900;
  letter-spacing: 0.5px;
  cursor: pointer;
}
button:hover:not(:disabled) { background: #ffc844; }
button:disabled { opacity: 0.4; cursor: not-allowed; }
button.ghost { background: transparent; color: var(--outline); border: 1px solid rgba(255,255,255,0.18); }
button.ghost:hover:not(:disabled) { background: rgba(255,255,255,0.06); color: var(--on-surface); }
button.danger { background: var(--danger); color: #fff; }
button.danger:hover:not(:disabled) { background: #e33; }
button.small { width: auto; padding: 8px 14px; font-size: 13px; border-radius: 9px; }

.row { display: flex; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.row.wrap-row { flex-wrap: wrap; }
.grow { flex: 1; }
.center { text-align: center; }
.muted { color: var(--outline); font-size: 14px; }
.error-text { color: var(--error); font-weight: 700; font-size: 14px; margin-bottom: 12px; }
.ok-text { color: var(--gold); font-weight: 700; font-size: 14px; }

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 24px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
  background: rgba(0,0,0,0.25);
}
.topbar .brand { font-size: 20px; margin: 0; }

.password-field { position: relative; }
.password-field input { padding-right: 74px; }
.password-toggle {
  position: absolute; right: 8px; top: 7px; width: auto;
  padding: 7px 12px; font-size: 12px; background: transparent;
  color: var(--outline); border: 1px solid rgba(255,255,255,0.18); border-radius: 8px;
}

.join-code {
  font-size: 54px;
  font-weight: 900;
  letter-spacing: 12px;
  color: var(--gold);
  margin: 6px 0 12px;
  text-indent: 12px;
}
.qrcode {
  width: 170px; max-width: 100%; margin: 10px auto 18px;
  background: #fff; border-radius: 12px; padding: 8px;
}
.qrcode svg { display: block; width: 100%; height: auto; }

.pill {
  display: inline-block; padding: 4px 12px; border-radius: 999px;
  background: var(--surface-variant); color: var(--outline);
  font-size: 11px; font-weight: 800; letter-spacing: 1px; text-transform: uppercase;
}
.pill.live { background: var(--felt-light); color: #fff; }
.pill.lobby { background: var(--gold-dark); color: #fff; }
.pill.done { background: #3a3a3a; color: #bbb; }

.table-item, .player-row {
  display: flex; justify-content: space-between; align-items: center;
  background: var(--surface); border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px; padding: 14px 16px; margin-bottom: 10px;
}
.table-item h3 { margin: 0 0 4px; font-size: 17px; }

.empty-state { text-align: center; color: var(--outline); padding: 32px 12px; }

/* ---- cards ------------------------------------------------------------ */

.playing-card {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  width: 46px; height: 64px; border-radius: 7px;
  background: #fdfdf7; color: #14181a;
  font-weight: 900; line-height: 1;
  box-shadow: 0 2px 6px rgba(0,0,0,0.45);
  border: 1px solid rgba(0,0,0,0.2);
  user-select: none;
}
.playing-card .rank { font-size: 21px; }
.playing-card .suit { font-size: 17px; margin-top: 2px; }
.playing-card.red { color: var(--chip-red); }
.playing-card.facedown {
  background: repeating-linear-gradient(45deg, #7a1d1d, #7a1d1d 5px, #611616 5px, #611616 10px);
  border: 2px solid #fdfdf7;
}
.playing-card.big { width: 78px; height: 110px; border-radius: 10px; }
.playing-card.big .rank { font-size: 38px; }
.playing-card.big .suit { font-size: 30px; }
.playing-card.small { width: 30px; height: 42px; border-radius: 5px; }
.playing-card.small .rank { font-size: 14px; }
.playing-card.small .suit { font-size: 11px; }
.playing-card.dim { opacity: 0.42; }

.card-row { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }

/* ---- the felt --------------------------------------------------------- */

.felt {
  background: radial-gradient(ellipse at center, var(--felt-light) 0%, var(--felt) 45%, var(--felt-dark) 100%);
  border: 10px solid #4a2c14;
  border-radius: 180px / 110px;
  box-shadow: inset 0 0 60px rgba(0,0,0,0.5), 0 8px 30px rgba(0,0,0,0.5);
  padding: 26px 20px;
  margin-bottom: 18px;
}
.felt .board { min-height: 70px; align-items: center; }
.pot {
  text-align: center; color: var(--gold);
  font-size: 26px; font-weight: 900; letter-spacing: 1px;
  margin: 14px 0 4px;
}
.pot small { display: block; font-size: 11px; letter-spacing: 2px; color: rgba(255,255,255,0.6); }
.street-label {
  text-align: center; color: rgba(255,255,255,0.65);
  font-size: 11px; font-weight: 800; letter-spacing: 3px; text-transform: uppercase;
}

.seat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(168px, 1fr));
  gap: 10px;
}
.seat {
  background: var(--surface); border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px; padding: 10px 12px; position: relative;
}
.seat.acting { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(240,180,41,0.35); }
.seat.folded { opacity: 0.42; }
.seat.winner { border-color: var(--gold); background: #24301d; }
.seat .seat-name { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.seat .seat-stack { color: var(--gold); font-weight: 800; font-size: 14px; }
.seat .seat-bet { color: var(--outline); font-size: 12px; font-weight: 700; }
.seat .seat-cards { margin-top: 8px; display: flex; gap: 4px; min-height: 42px; }

.badge {
  display: inline-flex; align-items: center; justify-content: center;
  width: 20px; height: 20px; border-radius: 50%;
  font-size: 10px; font-weight: 900;
}
.badge.button { background: #fdfdf7; color: #111; }
.badge.sb { background: var(--outline); color: #111; }
.badge.bb { background: var(--gold); color: #241a00; }

.timer-bar { height: 4px; background: rgba(255,255,255,0.12); border-radius: 2px; overflow: hidden; margin-top: 8px; }
.timer-bar > div { height: 100%; background: var(--gold); transition: width 0.5s linear; }
.timer-bar.urgent > div { background: var(--error); }

/* ---- the action bar --------------------------------------------------- */

.action-bar {
  position: sticky; bottom: 0;
  background: linear-gradient(180deg, rgba(11,20,16,0.85), var(--bg) 40%);
  padding: 14px 0 18px;
}
.action-bar .row button { flex: 1; }
.raise-row { display: flex; gap: 10px; align-items: center; margin-bottom: 10px; }
.raise-row input[type=range] { flex: 1; accent-color: var(--gold); }
.raise-amount { min-width: 86px; text-align: right; font-weight: 900; color: var(--gold); font-size: 19px; }
.quick-row { display: flex; gap: 8px; margin-bottom: 10px; }
.quick-row button { flex: 1; padding: 8px; font-size: 12px; }

.your-hand { text-align: center; margin: 8px 0 16px; }
.your-hand .card-row { margin-bottom: 6px; }

.log { font-size: 13px; color: var(--outline); line-height: 1.6; }
.log b { color: var(--on-surface); }

.result-banner {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: #241a00; border-radius: 14px; padding: 14px 16px;
  font-weight: 800; margin-bottom: 14px; text-align: center;
}

.spinner {
  width: 32px; height: 32px; margin: 0 auto 12px;
  border: 3px solid rgba(255,255,255,0.15); border-top-color: var(--gold);
  border-radius: 50%; animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

a { color: var(--gold); }

/* Big-screen host view: the pub's TV is the audience, so scale up. */
@media (min-width: 1000px) {
  .tv .join-code { font-size: 76px; }
  .tv .playing-card.big { width: 104px; height: 146px; }
  .tv .playing-card.big .rank { font-size: 50px; }
  .tv .playing-card.big .suit { font-size: 40px; }
  .tv .pot { font-size: 38px; }
  .tv .seat-grid { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); }
}
