/* Kabal Poker. Laid out to match the Poker Now table people already know:
   stadium felt, player pods around the rail, chip bets, log bottom-left,
   three big action buttons bottom-right. */

:root {
  --room: #1b1d21;
  --room-2: #232629;
  --panel: #2a2d31;
  --panel-2: #33373c;
  --line: #3c4147;
  --ink: #e8eaed;
  --ink-soft: #a9afb6;
  --mute: #7d848c;

  --felt: #35654d;
  --felt-dark: #2a5340;
  --rail: #1f2226;
  --rail-edge: #14161a;

  --fold: #8c3b3b;
  --fold-hi: #a54747;
  --call: #3f7d4f;
  --call-hi: #4c945f;
  --raise: #2f6a9e;
  --raise-hi: #3a80bd;
  --gold: #e2b53f;
  --live: #61b16f;

  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: radial-gradient(ellipse 90% 70% at 50% 40%, #26292e, var(--room) 70%);
  color: var(--ink);
  font-size: 14px;
  overflow: hidden;
}
button { font: inherit; cursor: pointer; border: none; }
input, select { font: inherit; }
.mono { font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }

/* ---------------- top bar ---------------- */
.top {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; background: var(--room-2);
  border-bottom: 1px solid var(--line);
  position: relative; z-index: 60;
  height: 46px;
}
.top .name { font-weight: 700; font-size: 0.95rem; }
.top .meta { color: var(--mute); font-size: 0.78rem; }
.top .spacer { flex: 1; }
.badge {
  font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.08em;
  padding: 3px 8px; border-radius: 3px; background: var(--panel); color: var(--ink-soft);
}
.badge.live { background: rgba(97, 177, 111, 0.18); color: var(--live); }
.badge.paused { background: rgba(226, 181, 63, 0.18); color: var(--gold); }
.badge.ended { background: rgba(140, 59, 59, 0.22); color: #d98a8a; }

.btn {
  background: var(--raise); color: #fff; padding: 9px 16px; border-radius: 4px;
  font-weight: 600;
}
.btn:hover { background: var(--raise-hi); }
.btn.ghost { background: var(--panel); color: var(--ink-soft); }
.btn.ghost:hover { background: var(--panel-2); color: var(--ink); }
.btn.small { padding: 5px 10px; font-size: 0.78rem; border-radius: 3px; }
.btn:disabled { opacity: 0.4; cursor: default; }

/* ---------------- the table ---------------- */
.stage { position: relative; height: calc(100vh - 46px); }

.felt {
  position: absolute; left: 50%; top: 40%;
  transform: translate(-50%, -50%);
  width: min(60vw, 900px); height: min(40vh, 400px);
  background:
    radial-gradient(ellipse 65% 65% at 50% 45%, #3d7358, transparent 72%),
    linear-gradient(180deg, var(--felt), var(--felt-dark));
  border-radius: 280px / 200px;
  border: 16px solid var(--rail);
  box-shadow:
    inset 0 0 0 2px rgba(255, 255, 255, 0.05),
    inset 0 8px 40px rgba(0, 0, 0, 0.35),
    0 0 0 4px var(--rail-edge),
    0 24px 60px rgba(0, 0, 0, 0.55);
}
/* the painted line on the felt */
.felt::after {
  content: ""; position: absolute; inset: 26px;
  border: 2px solid rgba(255, 255, 255, 0.06);
  border-radius: 240px / 165px;
}
/* The seat ring is the felt's ellipse, inflated so pods straddle the rail. */
#seats {
  position: absolute; left: 50%; top: 40%; transform: translate(-50%, -50%);
  width: calc(min(60vw, 900px) + 26px);
  height: calc(min(40vh, 400px) + 44px);
  pointer-events: none;
  /* The transform above makes this a stacking context, so the z-index on the
     seats inside counts for nothing outside it. The container has to win, or
     the log panel swallows clicks on the bottom-left chair. */
  z-index: 46;
}
#seats .seat { pointer-events: auto; }

.felt .brand {
  position: absolute; left: 50%; top: 74%; transform: translateX(-50%);
  font-weight: 800; letter-spacing: 0.4em; text-transform: uppercase;
  font-size: 0.68rem; color: rgba(255, 255, 255, 0.09); white-space: nowrap;
  pointer-events: none;
}

/* pot + board sit on the felt */
.board {
  position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%);
  display: flex; gap: 8px; z-index: 3; min-height: 76px; align-items: center;
}
.pot {
  position: absolute; left: 50%; top: 26%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 8px; z-index: 3;
  background: rgba(0, 0, 0, 0.38); padding: 5px 14px; border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.08);
}
.pot .amt { font-size: 1rem; }
.pot .label { color: rgba(255,255,255,0.6); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.1em; }
.pot .amt { color: #fff; font-weight: 700; }
.pot .chip { width: 14px; height: 14px; border-radius: 50%; background: var(--gold); border: 2px dashed rgba(0,0,0,0.35); }

.winbanner {
  position: absolute; left: 50%; top: 71%; transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.82); border: 1px solid var(--gold); color: var(--gold);
  padding: 7px 16px; border-radius: 4px; font-weight: 700; white-space: nowrap; z-index: 6;
  font-size: 0.85rem;
}

/* ---------------- cards ---------------- */
.card {
  width: 54px; height: 76px; border-radius: 5px; background: #fbfbf9;
  position: relative; line-height: 1;
  box-shadow: 0 3px 8px rgba(0,0,0,0.45), inset 0 0 0 1px rgba(0,0,0,0.1);
}
.card .corner {
  position: absolute; top: 5px; left: 5px;
  display: flex; flex-direction: column; align-items: center; gap: 1px;
}
.card .corner b { font-size: 1.05rem; font-weight: 800; letter-spacing: -0.03em; }
.card .corner i { font-size: 0.72rem; font-style: normal; }
.card .pip {
  position: absolute; right: 5px; bottom: 2px;
  font-size: 1.7rem; opacity: 0.9;
}
.card.back {
  background: repeating-linear-gradient(45deg, #7a2b2b, #7a2b2b 3px, #6a2323 3px, #6a2323 6px);
  border: 2px solid #fbfbf9;
}
/* four-colour deck, same as Poker Now's default */
.card.s-s { color: #1d1f22; }
.card.s-h { color: #c0392b; }
.card.s-d { color: #2a6fb8; }
.card.s-c { color: #27823f; }
.card.small { width: 38px; height: 54px; border-radius: 4px; }
.card.small .corner b { font-size: 0.8rem; }
.card.small .corner i { font-size: 0.55rem; }
.card.small .pip { font-size: 1.1rem; right: 3px; bottom: 0; }

/* ---------------- player pods ---------------- */
.seat {
  position: absolute; transform: translate(-50%, -50%);
  width: 126px; z-index: 46; /* above the log panel and action bar: a chair must always be clickable */
}
.seat .pod {
  background: var(--panel); border: 1px solid var(--line); border-radius: 6px;
  padding: 6px 8px 6px 6px; position: relative;
  box-shadow: 0 4px 14px rgba(0,0,0,0.4);
  display: grid; grid-template-columns: 34px 1fr; gap: 7px; align-items: center;
}
/* the head */
.seat .head {
  width: 34px; height: 34px; border-radius: 50%; position: relative;
  display: flex; align-items: center; justify-content: center;
  box-shadow: inset 0 -6px 12px rgba(0,0,0,0.25);
}
.seat .head svg { width: 24px; height: 24px; fill: rgba(255,255,255,0.85); }
.seat .head .ini {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 0.72rem; font-weight: 800; color: #fff;
  text-shadow: 0 1px 2px rgba(0,0,0,0.6);
}
.seat .head.photo { overflow: hidden; background: var(--panel-2); }
.seat .head.photo img { width: 100%; height: 100%; object-fit: cover; }
.seat .who { min-width: 0; text-align: left; }
.seat .strength {
  grid-column: 1 / -1; font-size: 0.66rem; color: var(--live); font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em; text-align: center;
  border-top: 1px solid var(--line); padding-top: 3px; margin-top: 2px;
}
.seat.toact .pod { border-color: var(--gold); box-shadow: 0 0 0 2px rgba(226,181,63,0.5), 0 4px 18px rgba(0,0,0,0.5); }
.seat.folded { opacity: 0.42; }
.seat.winner .pod {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px var(--gold), 0 0 28px rgba(226, 181, 63, 0.55);
  animation: pop 0.4s ease-out;
}
@keyframes pop { from { transform: scale(1); } 50% { transform: scale(1.06); } to { transform: scale(1); } }
.seat .nick {
  font-weight: 600; font-size: 0.82rem; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.seat .stack { color: var(--gold); font-size: 0.8rem; font-weight: 700; }
.seat .tag {
  grid-column: 1 / -1; font-size: 0.6rem; color: var(--mute);
  text-transform: uppercase; letter-spacing: 0.06em; text-align: center;
}
.seat .tag:empty { display: none; }
.seat .allin { color: #e08b8b; font-weight: 700; }

/* hole cards tucked behind the pod, like Poker Now */
.seat .cards {
  display: flex; gap: 3px; justify-content: center;
  margin-bottom: -6px; min-height: 0;
}
.seat .timerbar {
  grid-column: 1 / -1; position: relative;
  height: 5px; background: var(--line); border-radius: 3px; margin-top: 4px;
}
.seat .timerbar .fill {
  height: 100%; background: var(--gold); width: 100%; border-radius: 3px;
  transition: width 0.2s linear;
}
.seat .timerbar .fill.low { background: var(--fold-hi); }
.seat .timerbar .secs {
  position: absolute; right: 0; top: -16px;
  font-size: 0.66rem; font-weight: 800; color: var(--gold);
}
.seat .timerbar .secs.low { color: #e08b8b; }

.seat .dbtn {
  position: absolute; right: -9px; top: -9px; width: 21px; height: 21px; border-radius: 50%;
  background: #f2f2f0; color: #1d1f22; font-weight: 800; font-size: 0.68rem;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.5); z-index: 5;
}

/* the chips a player has pushed forward this street */
.seat .bet {
  position: absolute; left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 5px;
  background: rgba(0, 0, 0, 0.45); padding: 2px 8px; border-radius: 12px;
  font-size: 0.75rem; font-weight: 700; color: #fff; white-space: nowrap;
}
/* a little stack of chips beside the amount */
.seat .bet .chips { position: relative; display: inline-block; width: 14px; height: 16px; }
.seat .bet .chips i {
  position: absolute; left: 0; width: 14px; height: 6px; border-radius: 50%;
  border: 1px solid rgba(0,0,0,0.45);
  box-shadow: inset 0 -1px 0 rgba(255,255,255,0.35);
}

/* empty chairs */
/* an empty chair is a quiet circle you can click, not a big grey box */
.seat.empty { width: auto; }
.seat.empty .chair {
  width: 54px; height: 54px; border-radius: 50%;
  background: rgba(0, 0, 0, 0.28); border: 2px dashed rgba(255, 255, 255, 0.18);
  color: rgba(255, 255, 255, 0.4);
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0; transition: all 0.15s; margin: 0 auto;
}
.seat.empty .chair .plus { font-size: 1.2rem; font-weight: 300; line-height: 1; }
.seat.empty .chair .sit {
  font-size: 0.56rem; text-transform: uppercase; letter-spacing: 0.1em; font-weight: 700;
}
.seat.empty .chair:not(:disabled):hover {
  border-color: var(--gold); color: var(--gold);
  background: rgba(226, 181, 63, 0.12); transform: scale(1.08);
}
.seat.empty .chair:disabled { cursor: default; opacity: 0.5; }

/* ---------------- action bar (bottom right) ---------------- */
.actionbar {
  position: absolute; right: 18px; bottom: 16px; z-index: 30;
  display: flex; flex-direction: column; gap: 8px; align-items: flex-end;
  min-width: 380px;
}
.actionbar .waiting {
  color: var(--mute); font-size: 0.82rem; background: rgba(0,0,0,0.35);
  padding: 8px 14px; border-radius: 4px;
}
/* your own shot clock, next to the buttons */
.clock {
  font-size: 1.05rem; font-weight: 800; color: var(--gold);
  background: rgba(0,0,0,0.45); padding: 4px 12px; border-radius: 4px;
  border: 1px solid rgba(226,181,63,0.35); letter-spacing: 0.02em;
}
.clock.low { color: #e08b8b; }
/* decide before it is your turn */
.preacts {
  display: flex; gap: 6px; background: rgba(0,0,0,0.4); padding: 7px 10px; border-radius: 4px;
}
.preacts label {
  display: flex; align-items: center; gap: 5px; cursor: pointer;
  font-size: 0.76rem; color: var(--ink-soft); white-space: nowrap;
}
.preacts input { accent-color: var(--gold); cursor: pointer; }
.sizer { display: flex; gap: 6px; align-items: center; width: 100%; justify-content: flex-end; }
.sizer input[type="range"] { flex: 1; accent-color: var(--gold); max-width: 190px; }
.sizer input[type="number"] {
  width: 84px; background: var(--room-2); border: 1px solid var(--line); color: var(--ink);
  padding: 7px 8px; border-radius: 4px; text-align: center; font-weight: 700;
}
.presets { display: flex; gap: 5px; }
.presets .btn { background: var(--panel); color: var(--ink-soft); padding: 6px 9px; font-size: 0.72rem; }
.presets .btn:hover { background: var(--panel-2); color: var(--ink); }
.buttons { display: flex; gap: 8px; }
.buttons .btn {
  min-width: 116px; padding: 14px 20px; font-size: 0.9rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.05em;
  box-shadow: 0 4px 14px rgba(0,0,0,0.35);
  transition: transform 0.08s, background 0.15s;
}
.buttons .btn:active { transform: translateY(1px); }
.btn.fold { background: var(--fold); }
.btn.fold:hover { background: var(--fold-hi); }
.btn.check, .btn.call { background: var(--call); }
.btn.check:hover, .btn.call:hover { background: var(--call-hi); }
.btn.bet, .btn.raise { background: var(--raise); }
.btn.bet:hover, .btn.raise:hover { background: var(--raise-hi); }

/* ---------------- log panel (bottom left, always on) ---------------- */
.logpanel {
  position: absolute; left: 16px; bottom: 16px; z-index: 30;
  width: 280px; height: clamp(140px, 20vh, 180px);
  background: rgba(20, 22, 25, 0.9); border: 1px solid var(--line); border-radius: 6px;
  display: flex; flex-direction: column; backdrop-filter: blur(3px);
}
.logtabs { display: flex; border-bottom: 1px solid var(--line); }
.logtabs button {
  flex: 1; background: transparent; color: var(--mute); padding: 7px;
  font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 700;
}
.logtabs button.on { color: var(--ink); box-shadow: inset 0 -2px 0 var(--gold); }
.logbody { flex: 1; overflow-y: auto; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.logbody::-webkit-scrollbar { width: 6px; }
.logbody::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }
.logline { font-size: 0.76rem; line-height: 1.4; color: var(--ink-soft); }
.logline .who { color: var(--gold); font-weight: 600; }
.logline.sys { color: var(--mute); font-style: italic; }
.logfoot { display: flex; gap: 6px; padding: 7px; border-top: 1px solid var(--line); }
.logfoot input {
  flex: 1; background: var(--room-2); border: 1px solid var(--line);
  color: var(--ink); padding: 6px 8px; border-radius: 3px; font-size: 0.8rem;
}

/* ---------------- drawers (games, hands, host) ---------------- */
.drawer {
  position: fixed; top: 46px; right: 0; bottom: 0; width: 330px; max-width: 92vw;
  background: var(--room-2); border-left: 1px solid var(--line); z-index: 45;
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform 0.18s;
}
.drawer.open { transform: none; }
.drawer h3 { padding: 13px 15px; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.drawer .body { flex: 1; overflow-y: auto; padding: 12px 15px; display: flex; flex-direction: column; gap: 9px; }

.hostpanel .section { border: 1px solid var(--line); border-radius: 5px; padding: 10px; display: flex; flex-direction: column; gap: 8px; background: var(--panel); }
.hostpanel h4 { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.1em; color: var(--mute); }
.hostpanel .rowline { display: flex; gap: 8px; align-items: center; justify-content: space-between; font-size: 0.82rem; }
.hostpanel input { width: 66px; background: var(--room); border: 1px solid var(--line); color: var(--ink); padding: 5px; border-radius: 3px; }

.histhand { border: 1px solid var(--line); border-radius: 5px; padding: 9px; font-size: 0.76rem; background: var(--panel); }
.histhand .hd { color: var(--gold); font-weight: 700; margin-bottom: 5px; }
.histhand .line { color: var(--ink-soft); line-height: 1.5; }

.gamerow { border: 1px solid var(--line); border-radius: 5px; padding: 10px; display: flex; justify-content: space-between; align-items: center; gap: 8px; background: var(--panel); }
.gamerow.here { border-color: var(--gold); }
.gamerow .n { font-weight: 600; font-size: 0.85rem; }
.gamerow .f { color: var(--mute); font-size: 0.72rem; margin-top: 2px; }
.gamerow .dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--mute); margin-right: 5px; }
.gamerow .dot.live { background: var(--live); }

/* ---------------- modals ---------------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(10, 12, 14, 0.66);
  backdrop-filter: blur(3px); display: flex; align-items: center; justify-content: center; z-index: 50;
}
.modal {
  background: var(--room-2); border: 1px solid var(--line); border-radius: 8px;
  padding: 24px; width: 380px; max-width: 92vw; display: grid; gap: 12px;
  box-shadow: 0 24px 70px rgba(0,0,0,0.6);
}
.modal h2 { font-size: 1.15rem; }
.modal .note { color: var(--mute); font-size: 0.82rem; }
.modal input, .modal select {
  background: var(--room); border: 1px solid var(--line); color: var(--ink);
  padding: 9px 11px; border-radius: 4px; width: 100%;
}
.modal .f { display: grid; gap: 4px; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.08em; color: var(--mute); }
.modal .frow { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.modal .check { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; color: var(--ink-soft); }
.modal .check input { width: auto; }

/* discord on the join screen */
.discordrow {
  display: flex; align-items: center; gap: 9px; cursor: pointer;
  background: var(--room); border: 1px solid var(--line); border-radius: 5px;
  padding: 8px 10px; font-size: 0.82rem; color: var(--ink-soft);
}
.discordrow input { width: auto; accent-color: #5865f2; }
.discordrow img { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; }
.discordrow b { color: var(--ink); font-weight: 600; }
.btn.discord {
  background: #5865f2; display: flex; align-items: center; justify-content: center; gap: 8px;
}
.btn.discord:hover { background: #6b76f4; }
.btn.discord svg { width: 19px; height: 19px; fill: #fff; }

.toast {
  position: fixed; left: 50%; top: 60px; transform: translateX(-50%);
  background: var(--fold); color: #fff; padding: 9px 16px; border-radius: 4px;
  z-index: 100; font-size: 0.85rem; box-shadow: 0 6px 24px rgba(0,0,0,0.5);
}

@media (max-width: 900px) {
  .felt { width: 92vw; height: 46vh; }
  .seat { width: 104px; }
  .card { width: 38px; height: 54px; }
  .logpanel { display: none; }
  .actionbar { left: 12px; right: 12px; min-width: 0; align-items: stretch; }
  .buttons .btn { flex: 1; min-width: 0; }
}

/* bots */
.seat .head.bot svg { fill: #cfd4da; }
.seat .botlabel {
  color: var(--mute); background: rgba(255,255,255,0.07);
  padding: 1px 5px; border-radius: 3px; font-weight: 700;
}
.hostpanel select {
  background: var(--room); border: 1px solid var(--line); color: var(--ink);
  padding: 5px; border-radius: 3px; flex: 1;
}
