:root {
  --bg: #121213;
  --text: #f8f8f8;
  --muted: rgba(255, 255, 255, 0.6);

  /* Wordle-style tile colors */
  --green: #538d4e;
  --yellow: #b59f3b;
  --gray: #3a3a3c;
  --blue: #3a6fb0; /* dealt letter that's in the word (position unknown) */
  --key: #818384;

  /* Poker table */
  --felt-light: #2f8350;
  --felt-dark: #154528;
  --wood: #5b3a1e;
  --wood-dark: #3b240f;
  --gold: #e6b422;

  --tile: clamp(30px, 8.5vw, 46px);
  --tile-small: clamp(22px, 6vw, 32px);
  --card: clamp(38px, 10vw, 56px);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Helvetica Neue", Arial, sans-serif;
  padding: 0 12px 24px;
}

/* ---------- Top bar ---------- */
.topbar {
  max-width: 780px;
  margin: 0 auto;
  padding: 12px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  border-bottom: 1px solid #3a3a3c;
}
.logo { margin: 0; display: flex; gap: 3px; }
.logo span {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  font-size: 18px; font-weight: 800;
  background: var(--gray);
}
.logo { cursor: pointer; user-select: none; }
.logo .g { background: var(--green); }
.logo .y { background: var(--yellow); }
/* Logo styles to compare (click the logo to cycle):
   logo-holdem: WO (hole, blue)  RDL (flop)  'E (turn)  M (river)
   logo-rounds: WO R D L  EM, spaced like the betting rounds, EM in blue
   logo-em: "WORDL" + blue "EM" split off to the right
   logo-wo: blue "WO" split off to the left + "RDLEM" */
.logo-holdem span:nth-child(1),
.logo-holdem span:nth-child(2) { background: var(--blue); border-radius: 3px; }
.logo-holdem span:nth-child(3) { background: var(--green); margin-left: 12px; }
.logo-holdem span:nth-child(4) { background: var(--gray); }
.logo-holdem span:nth-child(5) { background: var(--yellow); }
.logo-holdem span:nth-child(6) { background: var(--gray); margin-left: 18px; position: relative; }
.logo-holdem span:nth-child(7) { background: var(--green); margin-left: 12px; }
.logo-holdem span:nth-child(6)::before { /* apostrophe: WORDL'EM, like hold'em */
  content: "\2019";
  position: absolute;
  left: -13px;
  top: -4px;
  font-size: 24px;
  color: var(--text);
}
.logo-rounds span:nth-child(3),
.logo-rounds span:nth-child(4),
.logo-rounds span:nth-child(5) { margin-left: 9px; }
.logo-rounds span:nth-child(6) { margin-left: 18px; position: relative; }
/* apostrophe in the gap before EM, so it reads WORDL'EM like hold'em */
.logo-rounds span:nth-child(6)::before {
  content: "\2019";
  position: absolute;
  left: -13px;
  top: -4px;
  font-size: 24px;
  color: var(--text);
}
.logo-rounds span:nth-child(6),
.logo-rounds span:nth-child(7),
.logo-em span:nth-child(6),
.logo-em span:nth-child(7),
.logo-wo span:nth-child(1),
.logo-wo span:nth-child(2) { background: var(--blue); border-radius: 3px; }
.logo-em span:nth-child(6) { margin-left: 9px; }
.logo-wo span:nth-child(3) { margin-left: 9px; }

.controls { display: flex; align-items: center; gap: 8px 14px; flex-wrap: wrap; }
.controls label, .controls button { white-space: nowrap; }

/* "?" help button with a styled tooltip */
.with-help { display: flex; align-items: center; gap: 6px; }
.help { position: relative; display: inline-flex; }
.controls .help-btn {
  width: 20px;
  height: 20px;
  padding: 0;
  border-radius: 50%;
  background: var(--gray);
  border: 1px solid #6a6a6c;
  color: var(--text);
  font-size: 12px;
  font-weight: 700;
  line-height: 1;
}
.controls .help-btn:hover,
.help.open .help-btn { background: var(--blue); border-color: var(--blue); }
.tip {
  position: absolute;
  top: calc(100% + 10px);
  right: -10px;
  width: 270px;
  background: #f8f8f8;
  color: #121213;
  font-size: 13px;
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-4px);
  transition: opacity 0.15s, transform 0.15s, visibility 0.15s;
  z-index: 20;
}
.tip strong { display: block; margin-bottom: 3px; }
.tip .tip-gap { margin-top: 8px; }
.tip::before { /* little arrow pointing at the ? */
  content: "";
  position: absolute;
  top: -6px;
  right: 14px;
  border: 6px solid transparent;
  border-top: 0;
  border-bottom-color: #f8f8f8;
}
.help:hover .tip,
.help:focus-within .tip,
.help.open .tip { opacity: 1; visibility: visible; transform: none; }
.toggle { display: flex; align-items: center; gap: 6px; font-size: 14px; cursor: pointer; }
.toggle input { width: 16px; height: 16px; accent-color: var(--green); }
.toggle select {
  background: var(--gray);
  color: var(--text);
  border: 1px solid #565758;
  border-radius: 4px;
  padding: 5px 6px;
  font-size: 14px;
}
.controls button {
  background: var(--green);
  color: #fff;
  border: 0;
  border-radius: 4px;
  padding: 8px 14px;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
}
.controls button:hover { filter: brightness(1.1); }

/* ---------- Table ---------- */
.table {
  position: relative;
  max-width: 780px;
  margin: 18px auto;
  padding: 28px 24px;
  background: radial-gradient(ellipse at center, var(--felt-light) 0%, var(--felt-dark) 80%);
  border: 16px solid var(--wood);
  border-radius: 160px;
  box-shadow:
    inset 0 0 50px rgba(0, 0, 0, 0.55),
    0 0 0 3px var(--wood-dark),
    0 14px 40px rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  gap: 18px;
}
/* inner rail line printed on the felt */
.table::before {
  content: "";
  position: absolute;
  inset: 10px;
  border: 2px solid rgba(255, 255, 255, 0.12);
  border-radius: 144px;
  pointer-events: none;
}

.seat {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 28px;
  flex-wrap: wrap;
}
.seat-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.nameplate {
  background: rgba(0, 0, 0, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  padding: 6px 16px;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 34px;
  transition: box-shadow 0.3s, border-color 0.3s;
}
.nameplate .name { font-weight: 700; letter-spacing: 0.03em; }
.badges { display: flex; gap: 4px; }
.badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 2px 6px;
  border-radius: 3px;
  background: var(--gray);
}
.badge.solved { background: var(--green); }
.badge.win { background: var(--gold); color: #222; }
.badge.blind { background: #6b4fa0; }
.badge.mode { background: #b5532b; }

/* ---------- Easy mode: possible-words panel ---------- */
.candidates {
  max-width: 1180px;
  margin: 22px auto 0;
  padding: 12px 14px;
  border: 1px solid #2c2c2e;
  border-radius: 8px;
  background: #18181a;
}
.cand-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
  font-size: 12px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
}
.cand-count { color: #8a8a8d; letter-spacing: 0.05em; }
.cand-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(4.6em, 1fr));
  gap: 2px 6px;
  font-family: ui-monospace, Menlo, Consolas, monospace;
  font-size: 13px;
}
.cand {
  color: #5f5f63;
  padding: 1px 3px;
  border-radius: 3px;
  cursor: pointer;
  text-align: center;
}
.cand:hover { color: var(--text); background: var(--gray); }
/* letters matching what you know (text color only, lightened for the dark panel) */
.cand b { font-weight: 700; }
.cand b.green  { color: #6fb467; }
.cand b.yellow { color: #d4bd4a; }
.cand b.blue   { color: #5d93dc; }

/* Wide monitors: the panel becomes a sidebar filling the spare width. */
@media (min-width: 1500px) {
  body.easy .layout { display: flex; gap: 20px; align-items: flex-start; }
  body.easy .game-col { flex: 1 1 auto; min-width: 0; }
  body.easy .candidates {
    flex: 0 0 clamp(260px, calc(100vw - 1250px), 640px);
    margin: 12px 0 0;
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 24px);
    overflow-y: auto;
  }
}

.seat.winner .nameplate {
  border-color: var(--gold);
  box-shadow: 0 0 18px var(--gold);
}

/* ---------- Center / community ---------- */
.center {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  padding: 14px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.stage-pill {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  background: rgba(0, 0, 0, 0.45);
  padding: 4px 12px;
  border-radius: 999px;
}
.stage-pill .sub { color: var(--muted); font-weight: 400; letter-spacing: 0.05em; margin-left: 6px; }

.board { display: flex; gap: 16px; flex-wrap: wrap; justify-content: center; }
.group { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.group .cards { display: flex; gap: 6px; }
.caption {
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--muted);
}

.secret { display: flex; gap: 5px; }
.secret:empty { display: none; }

.status {
  min-height: 1.3em;
  text-align: center;
  font-size: 15px;
  max-width: 460px;
}
.status.big { font-size: 18px; font-weight: 700; }
.status .line { display: block; } /* one sentence per line */
.hand-id {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-family: ui-monospace, Menlo, Consolas, monospace;
}

/* ---------- Cards ---------- */
.hole { display: flex; gap: 6px; }
.card {
  position: relative;
  width: var(--card);
  height: calc(var(--card) * 1.4);
  border-radius: 6px;
  display: grid;
  place-items: center;
  color: #fff;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.5), inset 0 0 0 2px rgba(255, 255, 255, 0.25);
}
.card .big { font-size: calc(var(--card) * 0.6); font-weight: 800; }
.card .idx {
  position: absolute;
  top: 3px; left: 5px;
  font-size: calc(var(--card) * 0.22);
  font-weight: 700;
  opacity: 0.85;
}
.card.in  { background: var(--blue); }
.card.out { background: var(--gray); }
.card.back {
  background: repeating-linear-gradient(45deg, #8b1e2b 0 6px, #a3293a 6px 12px);
  border: 3px solid #f2f2f2;
}
.card.slot {
  background: transparent;
  border: 2px dashed rgba(255, 255, 255, 0.22);
  box-shadow: none;
}

/* ---------- Guess grids ---------- */
.grid { display: flex; flex-direction: column; gap: 5px; }
.row { display: flex; gap: 5px; align-items: center; }
.row-label {
  width: 5.2em; /* fits PRE-FLOP */
  white-space: nowrap;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: right;
  color: var(--muted);
  margin-right: 2px;
}
.tile {
  width: var(--tile);
  height: var(--tile);
  display: grid;
  place-items: center;
  font-size: calc(var(--tile) * 0.55);
  font-weight: 800;
  text-transform: uppercase;
  border: 2px solid transparent;
}
.grid.small .tile { width: var(--tile-small); height: var(--tile-small); font-size: calc(var(--tile-small) * 0.55); }
.tile.empty { background: rgba(0, 0, 0, 0.22); border-color: rgba(255, 255, 255, 0.16); }
.tile.typed { background: rgba(0, 0, 0, 0.35); border-color: #a0a0a0; }
.tile.green  { background: var(--green); }
.tile.yellow { background: var(--yellow); }
.tile.black  { background: var(--gray); }
.row.current .tile.empty { border-color: rgba(255, 255, 255, 0.35); }

/* ---------- Keyboard ---------- */
.keyboard {
  max-width: 500px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.kb-row { display: flex; gap: 5px; justify-content: center; }
.key {
  flex: 1;
  max-width: 44px;
  height: 54px;
  border: 0;
  border-radius: 4px;
  background: var(--key);
  color: #fff;
  font-weight: 700;
  font-size: 15px;
  cursor: pointer;
  user-select: none;
}
.key.wide { flex: 1.6; max-width: 70px; font-size: 11px; }
.key.green  { background: var(--green); }
.key.yellow { background: var(--yellow); }
.key.blue   { background: var(--blue); }
.key.black  { background: var(--gray); }
.key:disabled { opacity: 0.5; cursor: default; }

/* ---------- Toast ---------- */
.toast {
  position: fixed;
  top: 70px;
  left: 50%;
  transform: translateX(-50%);
  background: #f8f8f8;
  color: #121213;
  font-weight: 700;
  padding: 10px 16px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
  z-index: 10;
}
.toast.show { opacity: 1; }

/* ---------- Animations ---------- */
@keyframes flipIn { from { transform: rotateX(90deg); } to { transform: rotateX(0); } }
@keyframes dealIn {
  from { transform: translateY(-40px) rotate(-10deg); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
@keyframes pop { 50% { transform: scale(1.12); } }
@keyframes shake {
  20%, 60% { transform: translateX(-6px); }
  40%, 80% { transform: translateX(6px); }
}
.flip  { animation: flipIn 0.35s ease-out backwards; }
.deal  { animation: dealIn 0.4s ease-out backwards; }
.pop   { animation: pop 0.1s ease-in-out; }
.shake { animation: shake 0.4s ease-in-out; }

/* ---------- Side seating (wide screens only) ----------
   Bot | board | you in one row, so the table is short enough to fit a
   laptop screen without scrolling. "Bot across" keeps the stacked layout. */
@media (min-width: 1120px) {
  body:not([data-seating="across"]) {
    --tile: 42px;
    --tile-small: 32px;
    --card: 50px;
  }
  body:not([data-seating="across"]) .topbar { max-width: 1180px; }
  body:not([data-seating="across"]) .table {
    max-width: 1180px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 22px;
    margin: 12px auto;
    padding: 22px 56px;
    border-radius: 130px;
  }
  body:not([data-seating="across"]) .table::before { border-radius: 116px; }
  body:not([data-seating="across"]) .seat {
    flex-direction: column;
    flex: 0 0 auto;
    gap: 14px;
  }
  body:not([data-seating="across"]) .seat-info { flex-direction: row; gap: 14px; }
  /* name on top, badges underneath, to keep each seat narrow */
  body:not([data-seating="across"]) .nameplate {
    flex-direction: column;
    gap: 4px;
    border-radius: 14px;
    padding: 8px 14px;
  }
  body:not([data-seating="across"]) .status.big { font-size: 16px; }
  body:not([data-seating="across"]) .seat-you .seat-info { order: -1; }
  body:not([data-seating="across"]) .center {
    flex: 1;
    align-self: stretch;
    justify-content: center;
    border: 0;
    border-left: 1px solid rgba(255, 255, 255, 0.1);
    border-right: 1px solid rgba(255, 255, 255, 0.1);
    padding: 0 16px;
  }
  /* Bot on right (also the Auto choice): you | board | bot */
  body[data-seating="auto"] .seat-you, body[data-seating="right"] .seat-you { order: 1; }
  body[data-seating="auto"] .center,   body[data-seating="right"] .center   { order: 2; }
  body[data-seating="auto"] .seat-bot, body[data-seating="right"] .seat-bot { order: 3; }
  body:not([data-seating="across"]) .key { height: 44px; }
  /* 6 guesses = 6 rows; shrink tiles so the table stays short */
  body[data-rounds="6"]:not([data-seating="across"]) { --tile: 38px; --tile-small: 29px; }
}

/* ---------- Narrow screens ---------- */
@media (max-width: 600px) {
  /* tooltip spans the screen just under the header */
  .topbar { position: relative; }
  .help { position: static; }
  .tip { left: 0; right: 0; width: auto; top: calc(100% + 4px); }
  .tip::before { display: none; }
  .table { border-width: 9px; border-radius: 48px; padding: 20px 10px; }
  .table::before { inset: 6px; border-radius: 40px; }
  .seat { gap: 14px; }
  .row-label { display: none; }
}
