:root {
  --bg: #10161c;
  --panel: #182029;
  --panel-2: #1f2933;
  --line: #2b3742;
  --text: #e6edf3;
  --muted: #8b9aa8;
  --accent: #3fb27f;
  --accent-dim: #2c7a58;
  --bad: #e05252;
  --spade: #e6edf3;
  --heart: #ff6b6b;
  --diamond: #57a6ff;
  --club: #4fd18b;
  --font: Helvetica, "Helvetica Neue", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 26px 16px 51px;
  background: var(--bg);
  color: var(--text);
  font: 12px/1.5 var(--font);
}

main { max-width: 768px; margin: 0 auto; }

header { margin-bottom: 22px; }
h1 { margin: 0; font-size: 21px; letter-spacing: -0.01em; }
h2 { margin: 0; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  margin-bottom: 13px;
}

/* Card inputs. These are hand sized; the board overrides down to 80% below. */
.card {
  width: 52px; height: 62px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  font: 600 20px/1 var(--font);
  text-align: center;
  padding: 0;
  cursor: pointer;
  caret-color: transparent;
}
.card::placeholder { color: #4b5a68; font-weight: 400; font-size: 15px; }
.card:focus { outline: none; }
/* The slot the next deck click deals into. */
.card.active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(63, 178, 127, 0.3); }
.card.invalid { border-color: var(--bad); box-shadow: 0 0 0 2px rgba(224, 82, 82, 0.2); }
.card.suit-s { color: var(--spade); }
.card.suit-h { color: var(--heart); }
.card.suit-d { color: var(--diamond); }
.card.suit-c { color: var(--club); }

/* The table: hands around the ring, board in the middle */
.table-panel { padding: 0 10px; display: flex; justify-content: center; }
.table {
  position: relative;
  width: 100%;
  max-width: 720px;
  margin: 0 auto;
  aspect-ratio: 6 / 5;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 6px;
}
/* The felt and the board share the middle cell; the felt is first in the
   markup, so the board paints over it. */
.felt {
  grid-area: 2 / 2;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: radial-gradient(ellipse at center, rgba(63, 178, 127, 0.10), rgba(63, 178, 127, 0.02) 72%, transparent);
}

.board {
  grid-area: 2 / 2;
  align-self: center;
  justify-content: center;
  display: flex; gap: 8px;
}
.board .card { width: 42px; height: 50px; font-size: 16px; border-radius: 6px; }
.board .card::placeholder { font-size: 12px; }
.slot { display: flex; flex-direction: column; align-items: center; }
/* Turn and river stand off from the flop, so the streets read at a glance. */
.board .slot:nth-child(4), .board .slot:nth-child(5) { margin-left: 8px; }

/* display: contents lets the seats sit directly in the table's grid, so there
   is no full size layer left to swallow clicks aimed at the board. */
.players { display: contents; }
.player {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--panel-2);
  min-width: 0;
}
.player.leader { border-color: var(--accent-dim); background: rgba(63, 178, 127, 0.07); }
.seat { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; }
.holecards { display: flex; gap: 8px; }

.result { width: 100%; text-align: center; }
.result.empty { display: none; }
.equity-pct { font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; }
/* One line each, so a seat never grows into the one beside it. */
.breakdown {
  color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bar { height: 5px; border-radius: 3px; background: var(--panel-2); margin: 5px 0 4px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); border-radius: 3px; }

/* Deck */
.deck-panel { display: flex; align-items: flex-start; gap: 16px; }
.side { flex: 0 0 auto; display: flex; flex-direction: column; gap: 10px; }
.status-sizer {
  display: block; height: 0; overflow: hidden; visibility: hidden;
  white-space: nowrap; font-size: 10px;
}
.deck {
  flex: 1 1 auto;
  display: grid;
  grid-template-columns: repeat(13, minmax(0, 1fr));
  gap: 5px;
  max-width: 624px;
}
.deck-card {
  display: flex; align-items: center; justify-content: center; gap: 1px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--text);
  font: 600 11px/1 var(--font);
  padding: 7px 0;
  cursor: pointer;
}
.deck-card:hover { background: #26323d; border-color: var(--accent); }
.deck-card.used { opacity: 0.28; }
.deck-card.suit-s { color: var(--spade); }
.deck-card.suit-h { color: var(--heart); }
.deck-card.suit-d { color: var(--diamond); }
.deck-card.suit-c { color: var(--club); }
.pip { font-size: 10px; }

/* Controls */
button {
  background: var(--accent); color: #06110b; border: 0; border-radius: 6px;
  padding: 9px 18px; font-size: 12px; font-weight: 600; cursor: pointer;
  font-family: var(--font);
}
button:hover { background: #4ac68e; }
button:disabled { opacity: 0.55; cursor: default; }
button.ghost { background: transparent; color: var(--muted); border: 1px solid var(--line); }
button.ghost:hover { background: var(--panel-2); color: var(--text); }

.status { margin: 0; color: var(--muted); font-size: 10px; min-height: 16px; }
.status.error { color: var(--bad); }

/* Too narrow for the ring: board on top, hands stacked below it. */
@media (min-width: 941px) and (min-height: 701px) {
  body { height: 100dvh; overflow: hidden; }
  main { height: 100%; display: flex; flex-direction: column; min-height: 0; }
  .table-panel { flex: 1 1 auto; min-height: 0; align-items: flex-start; }
  .table { height: min(100%, 600px); width: auto; max-width: 100%; container-type: inline-size; }

  .player { gap: 0.83cqw; padding: 1.11cqw; border-radius: 1.39cqw; }
  .seat { font-size: max(8px, 1.53cqw); }
  .holecards { gap: 1.11cqw; }
  .card { width: 7.22cqw; height: 8.61cqw; font-size: 2.78cqw; border-radius: 1.11cqw; }
  .card::placeholder { font-size: 2.08cqw; }
  .board { gap: 1.11cqw; }
  .board .card { width: 5.83cqw; height: 6.94cqw; font-size: 2.22cqw; border-radius: 0.83cqw; }
  .board .card::placeholder { font-size: 1.67cqw; }
  .board .slot:nth-child(4), .board .slot:nth-child(5) { margin-left: 1.11cqw; }
  .equity-pct { font-size: max(11px, 2.5cqw); }
  .breakdown { font-size: max(8px, 1.53cqw); }
  .bar { height: 0.69cqw; margin: 0.69cqw 0 0.56cqw; }
}

@media (max-width: 940px), (max-height: 700px) {
  .deck-panel { flex-direction: column; }
  /* Column flex, so flex-grow works on the vertical axis: the deck has to be
     told to fill the width outright. */
  .deck { max-width: none; width: 100%; }
  .side { flex-direction: row; align-items: center; width: 100%; }
  .status-sizer { display: none; }

  .table { width: 100%; aspect-ratio: auto; display: flex; flex-direction: column; align-items: center; gap: 16px; }
  .felt { display: none; }
  .board { position: static; transform: none; flex-wrap: wrap; justify-content: center; padding-top: 8px; }
  .players {
    display: flex; flex-wrap: wrap; justify-content: center; gap: 8px;
    width: 100%;
  }
  .player { width: 150px; }
}

@media (max-width: 620px) {
  .deck { gap: 4px; }
  .deck-card { font-size: 10px; padding: 6px 0; }
  .pip { font-size: 9px; }
}
