:root {
  color-scheme: dark;
  --bg: #080c10;
  --panel: #121e2b;
  --panel-light: #17293c;
  --line: #1e3247;
  --muted: #7a8e9e;
  --text: #e8ecef;
  --green: #4ade80;
  --yellow: #fbbf24;
  --red: #fb7185;
  --blue: #60a5fa;
}

* { box-sizing: border-box; }

html, body { min-height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
}

button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }

.site-header {
  min-height: 58px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid #1c2a38;
  background: #0e1720;
}

.brand {
  color: var(--text);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: .04em;
  text-decoration: none;
}

.brand span { color: var(--green); }

.tag, .eyebrow {
  color: #6b7d8e;
  font-size: 10px;
  letter-spacing: .12em;
  text-transform: uppercase;
}

.app-shell {
  min-height: calc(100vh - 58px);
  padding: 20px 14px 30px;
  background: radial-gradient(ellipse at center top, #163325 0%, #0f2318 25%, var(--bg) 70%);
}

.screen {
  width: min(100%, 860px);
  margin: 0 auto;
}

.hidden { display: none !important; }

.panel {
  width: min(100%, 460px);
  margin: 9vh auto 0;
  padding: 27px;
  background: rgba(18, 30, 43, .97);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .7);
}

.panel h1, .panel h2 {
  margin: 8px 0 12px;
  color: var(--text);
  font-weight: 900;
  letter-spacing: -.055em;
  line-height: .98;
}

.panel h1 { font-size: clamp(31px, 8vw, 44px); }
.panel h1 span { color: var(--green); }
.panel h2 { font-size: 32px; }

.lede {
  margin: 0 0 20px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.field-label {
  display: block;
  margin: 0 0 6px;
  color: #9badbb;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.text-input {
  width: 100%;
  min-height: 47px;
  margin: 0 0 10px;
  padding: 12px 14px;
  color: var(--text);
  background: #0a121a;
  border: 1px solid var(--line);
  border-radius: 11px;
  outline: none;
}

.text-input:focus { border-color: var(--green); box-shadow: 0 0 0 3px rgba(74, 222, 128, .12); }
.text-input::placeholder { color: #536878; }

.button {
  width: 100%;
  min-height: 45px;
  padding: 12px 15px;
  color: var(--text);
  background: transparent;
  border: 0;
  border-radius: 11px;
  font-size: 14px;
  font-weight: 850;
}

.button-primary { color: #0a121a; background: var(--text); }
.button-primary:hover { background: #fff; }
.button-secondary { background: #1a2c3e; border: 1px solid #243a52; }
.button-secondary:hover { border-color: #3a5a76; background: #20364c; }
.button-ghost { width: auto; min-height: auto; padding: 8px 10px; color: #718698; font-size: 12px; }
.button-ghost:hover { color: var(--text); }
.button-small { width: auto; min-height: 34px; padding: 8px 11px; font-size: 12px; }

.divider {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 21px 0 13px;
  color: #536878;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.divider::before, .divider::after { content: ""; flex: 1; height: 1px; background: #1e3247; }
.join-row, .link-row, .button-row, .action-row, .secondary-row { display: flex; gap: 8px; }
.join-row .text-input { flex: 1; margin: 0; text-transform: uppercase; }
.join-row .button { flex: 0 0 84px; }

.status-line {
  min-height: 17px;
  margin: 14px 0 0;
  color: #6e8495;
  font-size: 11px;
  line-height: 1.4;
  text-align: center;
}

.room-code {
  margin: 16px 0 10px;
  padding: 15px;
  color: var(--green);
  background: #0a121a;
  border: 1px dashed #2a4058;
  border-radius: 12px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 29px;
  font-weight: 900;
  letter-spacing: .18em;
  text-align: center;
}

.link-row {
  align-items: center;
  padding: 7px 8px 7px 11px;
  background: #0a121a;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.link-row code {
  min-width: 0;
  flex: 1;
  overflow: hidden;
  color: #8196a6;
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.lobby-heading {
  display: flex;
  justify-content: space-between;
  margin: 24px 0 8px;
  color: #b7c5ce;
  font-size: 11px;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.lobby-heading span:last-child { color: var(--muted); font-weight: 600; text-transform: none; letter-spacing: 0; }
.lobby-players { display: grid; gap: 7px; }

.lobby-player {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 13px;
  color: #d8e2ea;
  background: #17293c;
  border: 1px solid #1e3247;
  border-radius: 11px;
  font-size: 13px;
  font-weight: 800;
}

.lobby-player small { color: #7a8e9e; font-size: 10px; font-weight: 600; }
.lobby-panel .button-row { margin-top: 18px; }
.lobby-panel > .button-ghost { display: block; margin: 12px auto -8px; }

.game-screen { padding-bottom: 20px; }
.game-topline { display: flex; justify-content: space-between; align-items: center; margin: 0 0 10px; color: #8aa0b2; font-size: 12px; font-weight: 800; }
.topline-dot { margin: 0 6px; color: #3a5367; }

.poker-table {
  min-height: 190px;
  display: grid;
  place-items: center;
  padding: 18px;
  background: radial-gradient(ellipse at center, #1a5135 0%, #123823 48%, #0d2017 100%);
  border: 1px solid #23553b;
  border-radius: 26px;
  box-shadow: inset 0 0 70px rgba(0, 0, 0, .35), 0 20px 60px rgba(0, 0, 0, .32);
}

.table-copy { width: 100%; text-align: center; }
.pot-label { color: #a7bdad; font-size: 10px; font-weight: 900; letter-spacing: .16em; }
.pot-label span { color: var(--yellow); font-size: 22px; letter-spacing: -.03em; }
.community-cards { min-height: 75px; display: flex; justify-content: center; align-items: center; gap: 6px; margin: 14px 0 10px; flex-wrap: wrap; }
.table-message { min-height: 17px; color: #bad0c1; font-size: 12px; }
.winner-message { min-height: 20px; margin-top: 5px; color: var(--green); font-size: 14px; font-weight: 900; }

.players-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 9px; margin-top: 10px; }

.player-card {
  min-width: 0;
  padding: 12px;
  background: linear-gradient(180deg, #17293c 0%, #121e2b 100%);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.player-card.self { border-color: #2e784b; box-shadow: 0 0 0 1px rgba(74, 222, 128, .12); }
.player-card.active { border-color: var(--green); box-shadow: 0 0 0 2px rgba(74, 222, 128, .18); }
.player-card.folded { opacity: .45; }
.player-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.player-name { color: #edf3f5; font-size: 14px; font-weight: 900; }
.player-status { min-height: 15px; margin-top: 3px; color: #7a8e9e; font-size: 10px; }
.player-stack { color: #a8bbc7; font-size: 11px; text-align: right; white-space: nowrap; }
.player-stack strong { color: var(--yellow); font-size: 14px; }
.player-badges { display: flex; gap: 4px; margin-top: 7px; }
.badge { padding: 2px 6px; border-radius: 20px; color: #07100b; font-size: 9px; font-weight: 950; }
.badge-dealer { background: var(--yellow); }
.badge-small { background: #a78bfa; }
.badge-big { background: var(--blue); }
.player-cards { display: flex; gap: 5px; min-height: 70px; margin-top: 10px; }
.bet-line { margin-top: 7px; color: #708596; font-size: 10px; }
.bet-line strong { color: #b6c7d0; }

.playing-card {
  width: 48px;
  height: 68px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 5px;
  color: #0a121a;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .55);
  font-size: 15px;
  font-weight: 950;
  line-height: 1;
}

.playing-card.red { color: #e11d48; }
.playing-card.small { width: 44px; height: 62px; font-size: 13px; }
.playing-card .card-bottom { align-self: flex-end; transform: rotate(180deg); }
.card-suit { font-size: 11px; }
.playing-card.back { background: repeating-linear-gradient(45deg, #1e2e44, #1e2e44 6px, #2b3d58 6px, #2b3d58 12px); border: 2px solid #d8e2ea; }
.playing-card.placeholder { color: transparent; background: rgba(255, 255, 255, .06); border: 1px dashed rgba(255, 255, 255, .14); box-shadow: none; }

.controls {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 10px -14px -30px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom));
  background: rgba(8, 12, 16, .94);
  border-top: 1px solid #1c2a38;
  backdrop-filter: blur(14px);
}

.action-row > * { flex: 1; }
.action-button { min-height: 47px; padding: 12px; border: 0; border-radius: 11px; font-size: 13px; font-weight: 900; }
.action-fold { color: #d8e2ea; background: #1c2a38; }
.action-check { color: var(--text); background: #243a52; }
.action-call { color: #0a121a; background: var(--text); }
.action-bet { color: #0a121a; background: var(--green); }
.bet-control { display: grid; grid-template-columns: 1fr auto; gap: 5px 10px; align-items: center; padding: 10px 11px; background: #0a121a; border: 1px solid var(--line); border-radius: 11px; }
.bet-copy { display: flex; justify-content: space-between; grid-column: 1 / -1; color: #8aa0b2; font-size: 11px; }
.bet-copy output { color: var(--yellow); font-size: 14px; font-weight: 900; }
.bet-control input { width: 100%; accent-color: var(--green); }
.bet-control .action-button { min-height: 39px; padding: 8px 14px; }
.secondary-row { justify-content: center; }

.toast { position: fixed; left: 50%; bottom: 20px; z-index: 20; max-width: min(90vw, 430px); padding: 10px 14px; color: #0a121a; background: var(--green); border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .4); font-size: 12px; font-weight: 800; opacity: 0; pointer-events: none; transform: translate(-50%, 12px); transition: opacity .18s ease, transform .18s ease; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 520px) {
  .site-header { padding-inline: 15px; }
  .tag { font-size: 8px; }
  .app-shell { padding-inline: 10px; }
  .panel { margin-top: 5vh; padding: 22px 18px; }
  .players-grid { grid-template-columns: 1fr; }
  .poker-table { min-height: 170px; border-radius: 20px; }
  .controls { margin-inline: -10px; padding-inline: 10px; }
}
