:root {
  --felt: #16794a;
  --felt-lite: #1c9a5e;
  --bg: #0a1712;
  --bg2: #0c1f16;
  --card-bg: #fff;
  --gold: #e8c37a;
  --gold-deep: #c9a35a;
  --ink: #eaf3ee;
  --muted: #9fb7ab;
  --danger: #e0574b;
  --win: #ffd257;
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; }
body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1200px 600px at 50% -10%, #123b28, transparent),
    var(--bg);
  color: var(--ink);
  min-height: 100dvh;
}
.screen { padding: 18px; min-height: 100dvh; display: flex; flex-direction: column; gap: 14px; }
.hidden { display: none !important; }

button {
  font-size: 17px; padding: 14px 18px; border-radius: 14px; border: 0; cursor: pointer;
  background: linear-gradient(180deg, #f2d492, var(--gold)); color: #26210f; font-weight: 800;
  box-shadow: 0 4px 14px rgba(0,0,0,.35); transition: transform .06s ease, filter .15s ease;
}
button:active { transform: translateY(1px) scale(.99); }
button:disabled { filter: grayscale(.6) opacity(.6); cursor: default; }
button.secondary { background: rgba(255,255,255,.08); color: var(--ink); box-shadow: none; border: 1px solid rgba(255,255,255,.14); }
button.ghost { background: transparent; color: var(--gold); box-shadow: none; border: 1px solid rgba(232,195,122,.4); }

/* ============ LANDING ============ */
#lobby { justify-content: flex-start; gap: 26px; padding-bottom: 40px; }
.hero { text-align: center; padding: 26px 8px 8px; }
.hero .logo {
  width: 76px; height: 76px; margin: 0 auto 10px; border-radius: 22px;
  display: grid; place-items: center; font-size: 42px; color: #fff;
  background: radial-gradient(circle at 40% 30%, var(--felt-lite), var(--felt));
  border: 2px solid rgba(232,195,122,.5); box-shadow: 0 10px 30px rgba(0,0,0,.45);
}
.hero h1 { font-size: 40px; margin: 6px 0; letter-spacing: .5px;
  background: linear-gradient(180deg, #fff, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tagline { color: var(--muted); font-size: 16px; max-width: 34ch; margin: 0 auto 18px; line-height: 1.4; }
.cta { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.cta button { min-width: 160px; }

.features h2, .how-to h2 { font-size: 20px; margin: 0 0 12px; text-align: center; color: var(--gold); }
.feature-grid { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; grid-template-columns: 1fr; }
@media (min-width: 620px) { .feature-grid { grid-template-columns: 1fr 1fr; } }
.feature-grid li {
  background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px; padding: 14px 16px; display: grid; grid-template-columns: auto 1fr;
  grid-template-rows: auto auto; column-gap: 12px; align-items: center; font-size: 14px; color: var(--muted);
}
.feature-grid .fi { grid-row: 1 / span 2; font-size: 26px; }
.feature-grid strong { color: var(--ink); font-size: 15px; }
.how-to ol { margin: 0; padding-left: 20px; line-height: 1.6; color: var(--muted); }
.how-to ol strong { color: var(--ink); }
.how-to .fine { text-align: center; color: var(--muted); font-size: 12.5px; margin-top: 14px; opacity: .8; }

/* ============ FORMS ============ */
#setup h2, #join-setup h2, #signal h2 { color: var(--gold); }
label { display: flex; justify-content: space-between; align-items: center; gap: 12px; font-size: 15px; }
label input {
  font-size: 16px; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.12);
  width: 42%; background: rgba(0,0,0,.3); color: var(--ink);
}
#qr { display: grid; place-items: center; }
#qr img { width: min(72vw, 340px); height: auto; image-rendering: pixelated; background: #fff; padding: 10px; border-radius: 12px; }
#scanner { width: min(82vw, 360px); border-radius: 14px; background: #000; align-self: center; }
#signal-hint { text-align: center; color: var(--muted); }

/* ============ BACK ARROWS ============ */
#btn-back-float {
  position: fixed; top: calc(10px + env(safe-area-inset-top)); left: 10px; z-index: 60;
  width: 42px; height: 42px; padding: 0; border-radius: 12px; font-size: 24px; line-height: 1;
  background: rgba(0,0,0,.35); color: var(--ink); box-shadow: none; border: 1px solid rgba(255,255,255,.14);
}
#btn-back-table {
  font-size: 22px; line-height: 1; padding: 6px 10px; border-radius: 12px; min-width: 40px;
  background: rgba(0,0,0,.3); color: var(--ink); box-shadow: none; border: 1px solid rgba(255,255,255,.12); font-weight: 700;
}

/* ============ TOP PANEL ============ */
#table-screen { padding: 8px; gap: 8px; }
#top-panel {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,.07), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.1); border-radius: 14px; padding: 6px 8px;
}
#table-info { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
#phase-chip, #blinds-chip {
  font-size: 12px; font-weight: 800; padding: 5px 10px; border-radius: 999px;
  background: rgba(0,0,0,.35); color: var(--gold); letter-spacing: .5px;
}
#top-actions { display: flex; gap: 6px; }
#top-actions button {
  font-size: 17px; padding: 8px 10px; border-radius: 12px; min-width: 40px;
  background: rgba(0,0,0,.3); color: var(--ink); box-shadow: none; border: 1px solid rgba(255,255,255,.12); font-weight: 700;
}
#top-actions button.on { background: linear-gradient(180deg, #f2d492, var(--gold)); color: #26210f; border-color: transparent; }
#status-bar { font-size: 13px; text-align: center; color: var(--muted); min-height: 16px; }

/* ============ TABLE ============ */
#table {
  position: relative; flex: 1; margin: 4px 0; min-height: 46vh;
  background:
    radial-gradient(ellipse at center, var(--felt-lite), var(--felt) 62%, #0f5c38 100%);
  border: 10px solid #5a3a1a;
  border-radius: 48% / 34%;
  box-shadow: inset 0 0 60px rgba(0,0,0,.5), 0 10px 30px rgba(0,0,0,.5);
}
#center { position: absolute; inset: 30% 12%; text-align: center; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; }
#community { display: flex; gap: 5px; justify-content: center; min-height: 58px; align-items: center; }
#pot { font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.6); background: rgba(0,0,0,.28); padding: 4px 12px; border-radius: 999px; font-size: 14px; }

#winner-banner {
  margin-top: 4px; font-weight: 900; color: #26210f; padding: 6px 14px; border-radius: 999px;
  background: linear-gradient(180deg, #ffe089, var(--win)); box-shadow: 0 6px 20px rgba(255,210,87,.45);
  animation: pop .35s ease; font-size: 14px;
}
@keyframes pop { from { transform: scale(.6); opacity: 0; } to { transform: scale(1); opacity: 1; } }

/* ============ SEATS ============ */
#seats .seat {
  position: absolute; width: 72px; text-align: center; font-size: 11px;
  background: rgba(4,12,8,.72); border: 1px solid rgba(255,255,255,.08);
  border-radius: 12px; padding: 5px 4px; transform: translate(-50%,-50%);
  transition: box-shadow .2s ease, border-color .2s ease;
}
#seats .seat .pname { font-weight: 700; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#seats .seat .pstack { color: var(--gold); font-weight: 800; }
#seats .seat .pbet { margin-top: 2px; font-size: 10px; color: #bfe9d3; }
#seats .seat.active { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 0 0 18px rgba(232,195,122,.6); }
#seats .seat.folded { opacity: .38; }
#seats .seat.winner { border-color: var(--win); box-shadow: 0 0 0 2px var(--win), 0 0 24px rgba(255,210,87,.8); animation: pop .35s ease; }
#seats .seat.sitting-out { opacity: .5; filter: grayscale(.5); }
#seats .seat .badge {
  position: absolute; top: -10px; left: 50%; transform: translateX(-50%);
  font-size: 9px; font-weight: 900; padding: 2px 7px; border-radius: 999px; white-space: nowrap;
}
#seats .seat .badge.win { background: var(--win); color: #26210f; }
#seats .seat .allin-tag { color: var(--danger); font-weight: 800; font-size: 10px; }
#seats .seat .timer { height: 3px; background: rgba(255,255,255,.15); border-radius: 2px; margin-top: 3px; overflow: hidden; }
#seats .seat .timer > i { display: block; height: 100%; background: var(--gold); width: 100%; }

/* ============ CARDS ============ */
.card {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 30px; min-height: 42px; padding: 3px 4px; background: var(--card-bg); color: #111;
  border-radius: 6px; font-weight: 800; line-height: 1; box-shadow: 0 1px 3px rgba(0,0,0,.45);
}
.card .r { font-size: 15px; }
.card .s { font-size: 15px; }
.card.red { color: #c81414; }
.card.back {
  background: repeating-linear-gradient(45deg,#3a5a92,#3a5a92 4px,#28406a 4px,#28406a 8px);
  border: 1px solid #22345a; color: transparent;
}
#community .card { min-width: 40px; min-height: 56px; }
#community .card .r { font-size: 19px; }
#community .card .s { font-size: 20px; }
#seats .seat .card { min-width: 16px; min-height: 22px; padding: 1px; border-radius: 3px; }
#seats .seat .card .r, #seats .seat .card .s { font-size: 9px; }
#seats .seat .revealed { display: flex; gap: 2px; justify-content: center; margin-top: 3px; }

/* ============ SELF / MY CHIPS ============ */
#self { background: rgba(0,0,0,.5); border: 1px solid rgba(255,255,255,.08); border-radius: 16px; padding: 10px; }
#my-chips {
  display: flex; align-items: center; justify-content: center; gap: 8px; margin-bottom: 8px;
  font-weight: 800; font-size: 15px;
}
#my-chips .chip-amt { color: var(--gold); font-size: 20px; }
#my-chips .chip-icon { font-size: 18px; }
#hole { display: flex; gap: 10px; justify-content: center; margin-bottom: 8px; min-height: 78px; align-items: center; }
#hole .card { min-width: 54px; min-height: 76px; }
#hole .card .r { font-size: 26px; }
#hole .card .s { font-size: 28px; }
#hole.face-down { cursor: pointer; }
#hole .peek-hint { color: var(--muted); font-size: 12px; }
#controls { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: center; }
#controls .raise-row { display: flex; align-items: center; gap: 8px; width: 100%; }
#controls input[type=range] { flex: 1; accent-color: var(--gold); }
#controls .raise-val { min-width: 52px; text-align: center; font-weight: 800; color: var(--gold); }
#controls button.danger { background: linear-gradient(180deg,#ef6c60,var(--danger)); color: #fff; }

/* ============ PANELS (leaderboard / history / chat) ============ */
.panel {
  position: fixed; left: 50%; bottom: 0; transform: translateX(-50%);
  width: min(100%, 520px); max-height: 72dvh; display: flex; flex-direction: column;
  background: #0e241a; border: 1px solid rgba(255,255,255,.12);
  border-radius: 18px 18px 0 0; box-shadow: 0 -12px 40px rgba(0,0,0,.6); z-index: 20;
  animation: slideup .2s ease;
}
@keyframes slideup { from { transform: translate(-50%, 100%); } to { transform: translate(-50%, 0); } }
.panel-head { display: flex; align-items: center; justify-content: space-between; padding: 12px 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.panel-head h3 { margin: 0; color: var(--gold); font-size: 16px; }
.panel-close { background: transparent; box-shadow: none; color: var(--muted); padding: 4px 10px; font-size: 18px; }
#leaderboard-body, #history-body, #chat-log { overflow-y: auto; padding: 10px 16px; }
.lb-row { display: grid; grid-template-columns: 28px 1fr auto auto; gap: 10px; align-items: center; padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.06); }
.lb-row .rank { color: var(--gold); font-weight: 900; text-align: center; }
.lb-row .lb-name { font-weight: 700; }
.lb-row .lb-stack { color: var(--gold); font-weight: 800; }
.lb-row .lb-hands { color: var(--muted); font-size: 12px; }
.lb-row.me { background: rgba(232,195,122,.08); border-radius: 8px; }
.hist-row { padding: 8px 0; border-bottom: 1px solid rgba(255,255,255,.06); font-size: 13px; }
.hist-row .hist-hd { color: var(--gold); font-weight: 700; }
.hist-row .hist-detail { color: var(--muted); }

/* chat */
#chat-log { flex: 1; display: flex; flex-direction: column; gap: 6px; }
.chat-msg { font-size: 14px; } .chat-msg .who { color: var(--gold); font-weight: 700; margin-right: 6px; }
.chat-msg.system { color: var(--muted); font-style: italic; font-size: 12.5px; }
#chat-emojis { display: flex; gap: 6px; padding: 6px 16px; flex-wrap: wrap; }
#chat-emojis button { background: rgba(255,255,255,.06); box-shadow: none; border: 0; font-size: 20px; padding: 6px 8px; border-radius: 10px; }
#chat-input-row { display: flex; gap: 8px; padding: 10px 16px 14px; }
#chat-input { flex: 1; padding: 10px 12px; border-radius: 10px; border: 1px solid rgba(255,255,255,.14); background: rgba(0,0,0,.3); color: var(--ink); font-size: 15px; }

.toast {
  position: fixed; left: 50%; top: 14px; transform: translateX(-50%);
  background: rgba(0,0,0,.85); color: #fff; padding: 10px 16px; border-radius: 12px;
  z-index: 50; font-size: 14px; border: 1px solid rgba(255,255,255,.15); animation: pop .2s ease;
}

/* ============ CONTENT PAGES (blog / faq) ============ */
/* Sticky glass header (full-bleed), centred content beneath. */
.site-header {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px clamp(16px, 5vw, 48px);
  background: rgba(10,23,18,.82); backdrop-filter: blur(10px) saturate(1.2);
  -webkit-backdrop-filter: blur(10px) saturate(1.2);
  border-bottom: 1px solid rgba(232,195,122,.16);
}
.site-header a.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; font-weight: 800; font-size: 18px;
  background: linear-gradient(180deg, #fff, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.site-header .brand .logo { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  font-size: 18px; color: #fff; -webkit-text-fill-color: #fff;
  background: radial-gradient(circle at 40% 30%, var(--felt-lite), var(--felt));
  border: 1px solid rgba(232,195,122,.5); box-shadow: 0 4px 14px rgba(0,0,0,.45); }
.site-nav { display: flex; gap: 6px; flex-wrap: wrap; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 600; padding: 8px 12px; border-radius: 10px; }
.site-nav a:hover { color: var(--gold); background: rgba(255,255,255,.06); }

.doc { max-width: 720px; margin: 0 auto; padding: 6px clamp(16px, 5vw, 24px) 56px; line-height: 1.72; }
.breadcrumb { font-size: 12.5px; color: var(--muted); margin: 18px 0 12px; letter-spacing: .2px; }
.breadcrumb a { color: var(--muted); text-decoration: none; }
.breadcrumb a:hover { color: var(--gold); }

.doc h1 { font-size: clamp(28px, 6vw, 40px); line-height: 1.14; margin: 6px 0 12px; letter-spacing: -.5px;
  background: linear-gradient(180deg, #fff 35%, var(--gold)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.doc .lead { font-size: 18px; color: #d3e2d9; margin: 0 0 18px; }
.doc .meta { display: inline-block; color: var(--gold); font-size: 12px; font-weight: 800; letter-spacing: .4px; text-transform: uppercase;
  background: rgba(232,195,122,.1); border: 1px solid rgba(232,195,122,.24); padding: 5px 12px; border-radius: 999px; margin-bottom: 20px; }

.doc h2 { font-size: 22px; color: #fff; margin: 34px 0 10px; padding-left: 14px; position: relative; }
.doc h2::before { content: ""; position: absolute; left: 0; top: .18em; bottom: .18em; width: 4px; border-radius: 3px;
  background: linear-gradient(180deg, var(--gold), var(--felt-lite)); }
.doc h3 { font-size: 17px; color: #fff; margin: 22px 0 6px; }
.doc p, .doc li { color: #c9dad0; }
.doc strong { color: #fff; }
.doc a { color: var(--gold); text-decoration: underline; text-underline-offset: 2px; text-decoration-thickness: 1px; }
.doc ul, .doc ol { padding-left: 22px; }
.doc li { margin: 6px 0; }
.doc li::marker { color: var(--gold); }

/* FAQ cards */
.faq-item { background: rgba(255,255,255,.04); border: 1px solid rgba(255,255,255,.08); border-radius: 14px;
  padding: 15px 18px; margin: 12px 0; transition: border-color .15s ease, background .15s ease; }
.faq-item:hover { border-color: rgba(232,195,122,.32); background: rgba(255,255,255,.06); }
.faq-item h3 { margin: 0 0 8px; color: var(--gold); font-size: 17px; display: flex; gap: 8px; align-items: baseline; }
.faq-item h3::before { content: "♠"; color: var(--felt-lite); font-size: 14px; }
.faq-item p { margin: 0; }

/* Blog cards */
.post-list { list-style: none; padding: 0; margin: 16px 0; display: grid; gap: 14px; }
.post-list li { position: relative; overflow: hidden;
  background: linear-gradient(180deg, rgba(28,154,94,.12), rgba(255,255,255,.03));
  border: 1px solid rgba(255,255,255,.1); border-radius: 16px; padding: 18px 44px 18px 18px;
  transition: transform .1s ease, border-color .15s ease; }
.post-list li:hover { transform: translateY(-2px); border-color: rgba(232,195,122,.4); }
.post-list li::after { content: "→"; position: absolute; right: 18px; top: 18px; color: var(--gold); font-weight: 800; opacity: .75; }
.post-list a { text-decoration: none; color: #fff; font-weight: 800; font-size: 18px; display: block; }
.post-list p { margin: 6px 0 0; color: var(--muted); font-size: 14px; }

/* CTA */
.cta-box { margin: 34px 0 10px; padding: 26px 20px; text-align: center; border-radius: 18px;
  background: radial-gradient(ellipse at center, rgba(28,154,94,.30), rgba(12,31,22,.55));
  border: 1px solid rgba(232,195,122,.28); }
.cta-box strong { display: block; font-size: 18px; color: #fff; margin-bottom: 2px; }
.cta-box a.play { display: inline-block; margin-top: 12px; padding: 14px 26px; border-radius: 14px;
  background: linear-gradient(180deg, #f2d492, var(--gold)); color: #26210f; font-weight: 800; text-decoration: none;
  box-shadow: 0 6px 20px rgba(232,195,122,.32); }
.cta-box a.play:hover { filter: brightness(1.05); }

/* Footer */
.site-footer { max-width: 720px; margin: 20px auto 0; padding: 28px 18px 46px;
  border-top: 1px solid rgba(255,255,255,.08); color: var(--muted); font-size: 13px; text-align: center; }
.site-footer::before { content: "♠ ♥ ♣ ♦"; display: block; color: rgba(232,195,122,.45); letter-spacing: 6px; margin-bottom: 14px; }
.site-footer nav { margin-bottom: 10px; }
.site-footer a { color: var(--muted); text-decoration: none; margin: 0 6px; }
.site-footer a:hover { color: var(--gold); }
