:root {
  color-scheme: dark;
  --bg: #07110e;
  --panel: #0d1b16;
  --panel-2: #13261f;
  --table: #0d5a3c;
  --table-edge: #7f5527;
  --text: #f7f4ea;
  --muted: #a7b8b0;
  --gold: #f0c86a;
  --danger: #ff7b7b;
  --accent: #5de0a5;
  --line: rgba(255, 255, 255, 0.12);
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

/* The app drives every screen/form/panel purely through the `hidden` property
   (app.js). Several of those elements also carry a `display: grid|flex` rule,
   which would otherwise win the cascade over the UA `[hidden]` rule and leave
   them visible (all three entry forms at once, entry screen never hiding, etc).
   Force `hidden` to always win. */
[hidden] { display: none !important; }

html { min-height: 100%; background: var(--bg); }

body {
  min-height: 100vh;
  margin: 0;
  color: var(--text);
  background:
    radial-gradient(circle at top, rgba(32, 108, 78, 0.24), transparent 38rem),
    var(--bg);
}

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

.app-shell { min-height: 100vh; }

.entry-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.entry-card {
  width: min(100%, 500px);
  padding: clamp(24px, 5vw, 42px);
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(19, 38, 31, 0.98), rgba(9, 22, 17, 0.98));
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--gold);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 10px; font-size: clamp(2rem, 7vw, 3.5rem); line-height: 0.98; }
h2 { margin-bottom: 8px; font-size: 1.05rem; }
.entry-copy, .fine-print, .lobby-panel p { color: var(--muted); line-height: 1.55; }
.fine-print { margin: 18px 0 0; font-size: 0.78rem; }

.tab-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  padding: 6px;
  margin: 28px 0 20px;
  border-radius: 16px;
  background: rgba(0, 0, 0, 0.24);
}

.tab-button, .small-button, .secondary-button, .primary-button, .action-button {
  min-height: 46px;
  border: 0;
  border-radius: 13px;
  font-weight: 800;
}

.tab-button { color: var(--muted); background: transparent; }
.tab-button.is-active { color: var(--text); background: var(--panel-2); }

.entry-form { display: grid; gap: 10px; }
.entry-form label, .bet-control label { color: var(--muted); font-size: 0.82rem; font-weight: 800; }

input {
  width: 100%;
  min-height: 50px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--text);
  background: rgba(0, 0, 0, 0.22);
  outline: none;
}

input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(93, 224, 165, 0.16); }

.primary-button { padding: 0 20px; color: #062218; background: var(--accent); }
.secondary-button { padding: 0 20px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); }
.entry-card .primary-button, .entry-card .secondary-button { width: 100%; margin-top: 8px; }
.error-message { min-height: 1.3em; margin: 12px 0 0; color: var(--danger); font-weight: 700; }

.game-screen { min-height: 100vh; padding: clamp(12px, 2vw, 24px); }
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 1450px;
  margin: 0 auto 16px;
}
.game-header h1 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.6rem); }
.room-tools { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: 8px; }
.room-label { padding: 10px 12px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); }
.room-label strong { color: var(--gold); letter-spacing: 0.12em; }
.small-button { min-height: 40px; padding: 0 14px; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); }
.danger-text { color: var(--danger); }

.game-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
  max-width: 1450px;
  margin: 0 auto;
}

.table-panel, .side-card {
  border: 1px solid var(--line);
  border-radius: 24px;
  background: rgba(10, 24, 18, 0.94);
  box-shadow: var(--shadow);
}
.table-panel { padding: clamp(12px, 2vw, 22px); }
.sidebar { display: grid; align-content: start; gap: 16px; }
.side-card { padding: 16px; }
.side-card-heading { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.side-card-heading h2 { margin: 0; }
.side-card-heading span { color: var(--muted); font-size: 0.8rem; }

.poker-table {
  position: relative;
  min-height: clamp(430px, 63vw, 690px);
  overflow: hidden;
  border: clamp(12px, 2vw, 22px) solid var(--table-edge);
  border-radius: 50% / 42%;
  background:
    radial-gradient(circle, rgba(255,255,255,0.06), transparent 50%),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.015) 0 2px, transparent 2px 8px),
    var(--table);
  box-shadow: inset 0 0 0 4px rgba(0,0,0,0.2), inset 0 -30px 60px rgba(0,0,0,0.18);
}

.seat-layer { position: absolute; inset: 0; }
.seat {
  position: absolute;
  width: clamp(112px, 16vw, 172px);
  min-height: 76px;
  padding: 10px;
  transform: translate(-50%, -50%);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 17px;
  background: rgba(5, 16, 12, 0.88);
  box-shadow: 0 8px 20px rgba(0,0,0,0.28);
}
.seat.is-turn { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(240,200,106,0.2), 0 8px 20px rgba(0,0,0,0.28); }
.seat.is-you { background: rgba(16, 48, 36, 0.96); }
.seat.is-folded { opacity: 0.58; }
.seat-pos-0 { left: 50%; top: 10%; }
.seat-pos-1 { left: 84%; top: 28%; }
.seat-pos-2 { left: 84%; top: 72%; }
.seat-pos-3 { left: 50%; top: 90%; }
.seat-pos-4 { left: 16%; top: 72%; }
.seat-pos-5 { left: 16%; top: 28%; }
.seat-name { display: flex; align-items: center; gap: 6px; font-weight: 900; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.seat-meta, .seat-bet { margin-top: 4px; color: var(--muted); font-size: 0.78rem; }
.seat-bet { color: var(--gold); font-weight: 800; }
.badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 5px; border-radius: 999px; color: #1e1605; background: var(--gold); font-size: 0.68rem; }
.badge.secondary { color: var(--text); background: #365f50; }
.mini-cards { display: flex; gap: 4px; margin-top: 7px; }

.table-center {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(58%, 620px);
  transform: translate(-50%, -50%);
  text-align: center;
}
.street-label { margin-bottom: 10px; color: rgba(255,255,255,0.7); font-size: 0.75rem; font-weight: 900; letter-spacing: 0.14em; text-transform: uppercase; }
.community-cards, .your-cards { display: flex; justify-content: center; gap: clamp(5px, 1vw, 10px); }
.pot-display { display: inline-block; margin-top: 14px; padding: 8px 14px; border-radius: 999px; background: rgba(0,0,0,0.28); }
.pot-display strong { color: var(--gold); }

.card {
  position: relative;
  width: clamp(42px, 7vw, 76px);
  aspect-ratio: 0.7;
  display: grid;
  place-items: center;
  border-radius: clamp(7px, 1vw, 12px);
  color: #151515;
  background: #fffdf7;
  border: 1px solid rgba(0,0,0,0.22);
  box-shadow: 0 8px 16px rgba(0,0,0,0.24);
  font-weight: 950;
}
.card.red { color: #c42026; }
.card-rank { font-size: clamp(1rem, 2.7vw, 1.75rem); line-height: 1; }
.card-suit { font-size: clamp(1rem, 2.7vw, 1.75rem); line-height: 1; }
.card.back {
  background:
    repeating-linear-gradient(45deg, rgba(255,255,255,0.12) 0 3px, transparent 3px 8px),
    #122f5d;
  border: 3px solid #f4ecd1;
}
.card.placeholder { background: rgba(0,0,0,0.12); border: 2px dashed rgba(255,255,255,0.18); box-shadow: none; }
.mini-cards .card { width: 25px; border-radius: 5px; box-shadow: none; }
.mini-cards .card-rank, .mini-cards .card-suit { font-size: 0.65rem; }

.your-panel, .action-panel, .lobby-panel, .hand-result {
  margin-top: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
}
.your-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.your-panel h2 { margin: 0; }
.your-cards .card { width: clamp(58px, 9vw, 92px); }

.turn-message { min-height: 24px; margin-bottom: 10px; color: var(--muted); font-weight: 800; }
.action-grid { display: grid; grid-template-columns: repeat(5, minmax(90px, 1fr)); gap: 8px; }
.action-button { padding: 0 12px; color: var(--text); background: #284b3e; }
.action-button.fold { background: #4e2527; }
.action-button.raise { color: #102016; background: var(--gold); }
.action-button.all-in { background: #4a3282; }
.bet-control { display: grid; gap: 3px; }
.bet-control input { min-height: 46px; }

.lobby-panel { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.lobby-panel h2 { margin-bottom: 4px; }
.lobby-panel p { margin: 0; }
.lobby-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; }
.hand-result { border-color: rgba(240,200,106,0.4); background: rgba(240,200,106,0.08); }
.hand-result strong { color: var(--gold); }

.player-list { display: grid; gap: 8px; }
.player-row { display: grid; grid-template-columns: 30px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: 9px; border-radius: 12px; background: rgba(255,255,255,0.04); }
.player-row.is-turn { outline: 1px solid var(--gold); }
.player-seat { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 8px; color: var(--muted); background: rgba(0,0,0,0.22); font-size: 0.75rem; font-weight: 900; }
.player-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.player-chips { color: var(--gold); font-size: 0.78rem; font-weight: 800; }

.table-log { max-height: 360px; margin: 0; padding-left: 22px; overflow: auto; color: var(--muted); font-size: 0.82rem; line-height: 1.45; }
.table-log li + li { margin-top: 7px; }

.toast {
  position: fixed;
  left: 50%;
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 20;
  max-width: min(92vw, 560px);
  margin: 0;
  padding: 12px 16px;
  transform: translateX(-50%);
  border: 1px solid rgba(255,123,123,0.45);
  border-radius: 14px;
  color: #fff;
  background: #532628;
  box-shadow: var(--shadow);
  font-weight: 800;
}

@media (max-width: 980px) {
  .game-layout { grid-template-columns: 1fr; }
  .sidebar { grid-template-columns: 1fr 1fr; }
  .table-log { max-height: 220px; }
}

@media (max-width: 700px) {
  .game-screen { padding: 8px; }
  .game-header { align-items: flex-start; }
  .game-header .eyebrow { display: none; }
  .room-tools { max-width: 62%; }
  .room-label { width: 100%; text-align: center; }
  .poker-table { min-height: 485px; border-width: 10px; border-radius: 42% / 34%; }
  .seat { width: 105px; min-height: 70px; padding: 8px; }
  .seat-pos-0 { top: 9%; }
  .seat-pos-1 { left: 82%; top: 27%; }
  .seat-pos-2 { left: 82%; top: 73%; }
  .seat-pos-3 { top: 91%; }
  .seat-pos-4 { left: 18%; top: 73%; }
  .seat-pos-5 { left: 18%; top: 27%; }
  .table-center { width: 64%; }
  .your-panel { align-items: flex-start; }
  .action-grid { grid-template-columns: 1fr 1fr; }
  .bet-control { grid-column: 1 / -1; }
  .lobby-panel { align-items: stretch; flex-direction: column; }
  .lobby-actions { justify-content: stretch; }
  .lobby-actions button { flex: 1; }
  .sidebar { grid-template-columns: 1fr; }
}

@media (max-width: 420px) {
  .game-header h1 { font-size: 1.25rem; }
  .room-tools { max-width: 68%; }
  .small-button { padding: 0 9px; }
  .poker-table { min-height: 450px; }
  .seat { width: 96px; font-size: 0.82rem; }
  .seat-meta, .seat-bet { font-size: 0.68rem; }
  .your-panel { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; animation: none !important; }
}

/* Tournament and daily-mode additions */
.three-tabs { grid-template-columns: repeat(3, 1fr); }
.rule-callout {
  display: grid;
  gap: 4px;
  margin: 4px 0 2px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.18);
  font-size: 0.82rem;
  line-height: 1.45;
}
.rule-callout strong { color: var(--gold); }
.resume-grid { display: grid; gap: 8px; margin-top: 12px; }
.tournament-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  margin-bottom: 12px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  color: var(--muted);
  background: rgba(0, 0, 0, 0.18);
  font-size: 0.8rem;
  font-weight: 800;
}
.tournament-bar strong { color: var(--gold); }
.seat.is-eliminated, .player-row.is-eliminated {
  opacity: 0.5;
  filter: grayscale(0.75);
}
.seat.is-eliminated { border-style: dashed; }

@media (max-width: 520px) {
  .three-tabs { grid-template-columns: 1fr; }
  .tab-row.three-tabs { gap: 4px; }
  .tab-row.three-tabs .tab-button { min-height: 40px; }
  .tournament-bar { justify-content: flex-start; }
}

/* Site chrome — a way back to the park + the canonical mission line.
   Styled to the poker table's own dark theme rather than importing the
   cream site CSS, so the two looks don't fight. */
.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 30;
  background: var(--gold); color: #1e1605; padding: 10px 14px;
  border-radius: 0 0 10px 0; font-weight: 800; text-decoration: none;
}
.skip-link:focus { left: 0; }
.site-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px clamp(14px, 4vw, 26px);
  border-bottom: 1px solid var(--line);
  background: rgba(7, 17, 14, 0.85);
}
.site-brand {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--text); text-decoration: none; font-weight: 800; letter-spacing: 0.01em;
}
.site-brand img { display: block; border-radius: 6px; }
.site-back {
  color: var(--muted); text-decoration: none; font-weight: 700; font-size: 0.92rem;
  padding: 8px 12px; border-radius: 999px; white-space: nowrap;
}
.site-back:hover, .site-back:focus-visible { color: var(--text); background: rgba(255, 255, 255, 0.06); }
.site-footer {
  padding: 22px clamp(14px, 4vw, 26px) 34px;
  border-top: 1px solid var(--line);
  color: var(--muted); font-size: 0.9rem; line-height: 1.55; text-align: center;
}
.site-footer p { max-width: 60ch; margin: 0 auto; }
.site-footer strong { color: var(--text); }
.site-footer a { color: var(--gold); }
