:root {
  --bg: #14532d;
  --bg2: #166534;
  --panel: rgba(0, 0, 0, 0.22);
  --text: #fff;
  --muted: #bbf7d0;
  --accent: #facc15;
  --good: #4ade80;
  --bad: #f87171;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: radial-gradient(ellipse at center, var(--bg2), var(--bg) 70%) fixed;
  color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}
main { max-width: 980px; margin: 0 auto; padding: 12px 12px 48px; }
h1 { font-size: 2.1rem; margin: 20px 0 8px; text-align: center; }
h2 { margin: 6px 0; font-size: 1.2rem; }
h4 { margin: 12px 0 2px; color: var(--accent); }
.center { text-align: center; }
.muted { color: var(--muted); }
.hidden { display: none !important; }
.banner { position: fixed; top: 0; left: 0; right: 0; z-index: 10; background: var(--bad); text-align: center; padding: 8px; font-weight: 600; }
.error { background: rgba(248, 113, 113, 0.25); border: 1px solid var(--bad); border-radius: 10px; padding: 8px 12px; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #111827; padding: 10px 16px; border-radius: 10px; z-index: 20; max-width: 90vw; }
.panel { background: var(--panel); border-radius: 16px; padding: 14px 16px; margin: 12px 0; }
.stack { display: flex; flex-direction: column; gap: 10px; max-width: 380px; margin: 0 auto; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

button {
  font: inherit; font-weight: 700; border: 0; border-radius: 12px; padding: 11px 18px; cursor: pointer;
  background: var(--accent); color: #1f2937; box-shadow: 0 3px 0 #a16207;
}
button:active { transform: translateY(2px); box-shadow: 0 1px 0 #a16207; }
button.secondary { background: #dcfce7; box-shadow: 0 3px 0 #15803d; }
button.danger { background: var(--bad); box-shadow: 0 3px 0 #991b1b; }
button.small { padding: 6px 10px; font-size: 0.9rem; }
button:disabled { opacity: 0.5; cursor: default; }
input[type='text'], input[type='number'] { font: inherit; padding: 11px; border-radius: 12px; border: 2px solid transparent; width: 100%; }
input[type='number'] { width: 110px; padding: 6px 8px; }
input:focus { outline: none; border-color: var(--accent); }
.code { font-size: 2.4rem; font-weight: 900; letter-spacing: 0.3em; }
label.setting { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; }
ul.players { list-style: none; padding: 0; margin: 0; }
ul.players li { padding: 4px 0; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--good); margin-right: 6px; }
.dot.off { background: #9ca3af; }
details summary { cursor: pointer; font-weight: 700; }
details ul, details ol { padding-left: 20px; margin: 4px 0; }

/* ---------- table ---------- */
.topbar { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 0.95rem; }
.seats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; margin: 10px 0; }
.seat { background: var(--panel); border-radius: 14px; padding: 8px 10px; border: 3px solid transparent; }
.seat.turn, .me.turn { border-color: var(--accent); box-shadow: 0 0 16px rgba(250, 204, 21, 0.4); }
.seat.dim { opacity: 0.55; }
.who { display: flex; justify-content: space-between; align-items: center; gap: 6px; font-weight: 700; }
.chip { display: inline-block; min-width: 22px; padding: 1px 5px; margin-left: 3px; border-radius: 999px; background: #e5e7eb; color: #111827; font-size: 0.7rem; font-weight: 800; text-align: center; }
.chip.dealer { background: #fff; border: 2px solid #111827; }
.hole { display: flex; gap: 4px; margin: 6px 0 4px; min-height: 10px; }
.stackline { display: flex; justify-content: space-between; font-size: 0.9rem; }
.stackamt { font-weight: 700; }
.stackamt.big { font-size: 1.3rem; }
.bet { color: var(--accent); font-weight: 700; }
.action { font-size: 0.85rem; color: var(--muted); min-height: 1.2em; }
.timer { display: inline-block; margin-left: 8px; font-weight: 800; color: var(--accent); }
.timer.urgent { color: var(--bad); }
.handname { font-size: 0.85rem; font-weight: 700; color: #fde68a; }

.middle { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 14px 0; }
.board { display: flex; gap: 6px; justify-content: center; flex-wrap: wrap; }
.pot { font-size: 1.2rem; font-weight: 800; min-height: 1.4em; }

.me { background: var(--panel); border-radius: 16px; padding: 10px 12px; border: 3px solid transparent; }
.myhand { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.controls { background: rgba(0, 0, 0, 0.3); border-radius: 16px; padding: 12px; margin: 10px 0; }
.controls .msg { font-size: 1.1rem; font-weight: 700; margin-bottom: 8px; }
.controls .row { margin: 6px 0; }
.actions button { min-width: 110px; }
.raise input[type='range'] { flex: 1; min-width: 200px; accent-color: var(--accent); }
.seatctl { justify-content: flex-end; margin-top: 10px !important; }

.results { background: rgba(250, 204, 21, 0.15); border: 2px solid var(--accent); border-radius: 16px; padding: 12px; margin: 10px 0; text-align: center; }
.results .msg { font-size: 1.1rem; font-weight: 800; margin: 4px 0; }
.results table { width: 100%; border-collapse: collapse; margin: 8px 0; }
.results td, .results th { padding: 6px; border-bottom: 1px solid rgba(255, 255, 255, 0.15); text-align: left; }
.results tr.win { color: var(--accent); font-weight: 800; }
.results button { margin-top: 8px; }

.log { font-size: 0.9rem; color: var(--muted); margin-top: 12px; }
.log div:nth-child(2) { color: var(--text); font-weight: 600; }

/* ---------- cards ---------- */
.card {
  --w: 54px;
  width: var(--w); height: calc(var(--w) * 1.4); border-radius: calc(var(--w) * 0.12);
  background: #fff; color: #111827; flex: none; display: flex; flex-direction: column; align-items: center; justify-content: center;
  font-weight: 800; box-shadow: 0 3px 6px rgba(0, 0, 0, 0.35); border: 3px solid transparent; line-height: 1;
}
.card.sm { --w: 34px; }
.card.lg { --w: 58px; }
@media (min-width: 640px) { .card.lg { --w: 72px; } .card.sm { --w: 40px; } }
.card .r { font-size: calc(var(--w) * 0.42); }
.card .s { font-size: calc(var(--w) * 0.36); }
.card.red { color: #dc2626; }
.card.back { background: repeating-linear-gradient(45deg, #b91c1c 0 5px, #991b1b 5px 10px); border-color: #fff; }
.card.slot { background: transparent; border: 2px dashed rgba(255, 255, 255, 0.3); box-shadow: none; }
.card.win { border-color: var(--accent); box-shadow: 0 0 14px 3px var(--accent); }

.rules ol.ranks li { margin: 2px 0; }
.madeby { position: fixed; bottom: 4px; left: 8px; font-size: 0.75rem; color: var(--muted); opacity: 0.7; }
.madeby a { color: inherit; }
.version { position: fixed; bottom: 4px; right: 8px; font-size: 0.75rem; color: var(--muted); opacity: 0.7; pointer-events: none; }
.updatebar { position: fixed; top: 0; left: 0; right: 0; z-index: 11; background: var(--accent); color: #1f2937; display: flex; gap: 12px; justify-content: center; align-items: center; padding: 6px; font-weight: 700; }
.updatebar button { background: #1f2937; color: #fff; box-shadow: none; }
.timerpick { display: inline-flex; align-items: center; gap: 4px; font-size: 0.85rem; }
.timerpick select { font: inherit; padding: 4px 6px; border-radius: 8px; border: 1px solid var(--muted); background: transparent; color: inherit; }
.timerpick option { color: #000; }
.lobbybtns { display: flex; flex-direction: column; align-items: center; gap: 14px; margin: 16px 0; }
.lobbybtns p { margin: 0; }
