:root {
  --page: #08150f;
  --felt: #14513b;
  --felt-deep: #0b3223;
  --wood: #3b2316;
  --brass: #d1a84f;
  --brass-dim: #8f7330;
  --paper: #f3ead3;
  --ink: #1c1a16;
  --red: #b3261e;
  --wine: #7a2233;
  --text: #ece3cb;
  --muted: #9fb3a6;
  --line: rgba(236, 227, 203, .14);
  --display: 'Fraunces', Georgia, serif;
  --ui: 'Bricolage Grotesque', 'Trebuchet MS', sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }

html, body { margin: 0; }

body {
  background: radial-gradient(1200px 700px at 50% -10%, #12301f 0%, var(--page) 60%) fixed;
  color: var(--text);
  font-family: var(--ui);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

button { font: inherit; color: inherit; cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
:focus-visible { outline: 2px solid var(--brass); outline-offset: 2px; }

.app { max-width: 980px; margin: 0 auto; padding: 20px 16px 40px; }

/* header */
.top { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.top h1 { margin: 0; font-family: var(--display); font-weight: 800; font-size: 28px; letter-spacing: -.01em; text-wrap: balance; }
.top h1 em { font-style: italic; font-weight: 600; color: var(--brass); }
.meta { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: 13px; flex-wrap: wrap; font-variant-numeric: tabular-nums; }
.opt { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.opt select { background: var(--felt-deep); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 4px 6px; font: inherit; }
.opt input { accent-color: var(--brass); }
.ghost { background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 5px 12px; color: var(--text); }
.ghost:hover { border-color: var(--brass); }

/* table */
.felt {
  display: grid;
  grid-template-columns: 1fr minmax(0, 1.7fr) 1fr;
  grid-template-areas: ". top ." "left board right" ". me .";
  align-items: center;
  justify-items: center;
  gap: 14px;
  padding: 28px 28px 24px;
  border: 14px solid var(--wood);
  border-radius: 190px / 150px;
  background: radial-gradient(ellipse at 50% 45%, var(--felt) 0%, var(--felt-deep) 100%);
  box-shadow: inset 0 0 0 2px var(--brass-dim), inset 0 0 60px rgba(0, 0, 0, .45), 0 18px 40px rgba(0, 0, 0, .5);
}
.a-top { grid-area: top; }
.a-left { grid-area: left; }
.a-right { grid-area: right; }
.a-board { grid-area: board; }
.a-me { grid-area: me; }

/* seats */
.seat {
  --cw: 34px;
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 8px 10px; min-width: 0; width: 100%; max-width: 150px;
  border-radius: 12px; border: 1px solid transparent;
  transition: opacity .25s, border-color .25s, box-shadow .25s;
}
.seat.me { --cw: clamp(54px, 15vw, 76px); max-width: 260px; }
.seat.active { border-color: var(--brass); box-shadow: 0 0 0 3px rgba(209, 168, 79, .22), 0 0 24px rgba(209, 168, 79, .25); }
.seat.folded { opacity: .45; }
.seat.out { opacity: .25; }
.seat.winner { border-color: var(--brass); background: rgba(209, 168, 79, .12); }

.who { display: flex; align-items: center; gap: 6px; max-width: 100%; }
.name { font-weight: 800; letter-spacing: .02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.persona { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .08em; text-align: center; }
.stack { font-variant-numeric: tabular-nums; color: var(--brass); font-weight: 600; }
.badge {
  font-size: 10px; font-weight: 800; letter-spacing: .04em;
  background: var(--paper); color: var(--ink);
  border-radius: 99px; padding: 1px 6px; line-height: 1.4;
}
.badge.blind { background: transparent; color: var(--brass); border: 1px solid var(--brass-dim); }
.hole { display: flex; gap: 4px; min-height: calc(var(--cw) * 1.4); }
.bet {
  font-size: 12px; font-weight: 800; font-variant-numeric: tabular-nums;
  background: rgba(0, 0, 0, .35); border: 1px dashed var(--brass-dim);
  color: var(--text); border-radius: 99px; padding: 1px 10px;
}
.note { font-size: 12px; color: var(--muted); text-align: center; min-height: 1.4em; text-wrap: balance; }
.note.hand { color: var(--paper); }

/* board */
.board { display: flex; flex-direction: column; align-items: center; gap: 12px; --cw: clamp(42px, 10.5vw, 64px); min-width: 0; }
.pot { font-family: var(--display); font-weight: 600; font-size: 20px; font-variant-numeric: tabular-nums; }
.pot small { display: block; font-family: var(--ui); font-size: 11px; font-weight: 600; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); text-align: center; }
.cards { display: flex; gap: clamp(3px, 1vw, 8px); }
.street { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }

/* cards */
.card {
  position: relative; width: var(--cw); aspect-ratio: 5 / 7; flex: none;
  background: var(--paper); color: var(--ink);
  border-radius: calc(var(--cw) * .1);
  box-shadow: 0 2px 5px rgba(0, 0, 0, .45);
  font-family: var(--display); font-weight: 800;
  container-type: inline-size;
}
.card.red { color: var(--red); }
.card b { position: absolute; top: 6%; left: 9%; font-size: 34cqw; line-height: 1; font-weight: 800; }
.card i { position: absolute; inset: 0; display: grid; place-items: center; padding-top: 22%; font-style: normal; font-size: 62cqw; line-height: 1; }
.card.back {
  background:
    repeating-linear-gradient(45deg, var(--wine) 0 4px, #5a1826 4px 8px);
  border: 3px solid var(--paper);
}
.card.empty { background: transparent; box-shadow: none; border: 1.5px dashed rgba(236, 227, 203, .22); }
.card.deal { animation: deal .38s cubic-bezier(.2, .8, .3, 1) backwards; animation-delay: var(--d, 0s); }
@keyframes deal { from { transform: translateY(-26px) scale(.9); opacity: 0; } }

/* lower area */
.lower { display: grid; grid-template-columns: minmax(0, 1fr) 280px; gap: 20px; margin-top: 22px; align-items: start; }
.controls { display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.prompt { font-family: var(--display); font-size: 19px; font-weight: 600; min-height: 1.5em; text-wrap: balance; }
.btns { display: grid; grid-template-columns: 1fr 1.2fr 1.4fr; gap: 10px; }
.b {
  border: 0; border-radius: 8px; padding: 13px 10px; font-weight: 800; font-size: 15px;
  font-variant-numeric: tabular-nums; transition: transform .08s, filter .15s;
}
.b:not(:disabled):hover { filter: brightness(1.12); }
.b:not(:disabled):active { transform: translateY(1px); }
.b.fold { background: var(--wine); color: #f7dfe0; }
.b.call { background: #2c6b52; color: #e8f5ee; }
.b.raise { background: var(--brass); color: #231a05; }
.sizer { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 14px; align-items: center; }
.sizer input[type=range] { width: 100%; accent-color: var(--brass); }
.quick { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.quick button { background: transparent; border: 1px solid var(--line); border-radius: 6px; padding: 4px 9px; font-size: 12px; font-weight: 600; }
.quick button:hover { border-color: var(--brass); }

.side h2 { margin: 0 0 8px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.log { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; font-size: 13px; max-height: 190px; overflow-y: auto; }
.log li { color: var(--muted); }
.log li:first-child { color: var(--text); }
.ranks { margin-top: 14px; font-size: 13px; color: var(--muted); }
.ranks summary { cursor: pointer; color: var(--text); }
.ranks ol { margin: 8px 0 0; padding-left: 20px; }

/* overlay */
.overlay { position: fixed; inset: 0; background: rgba(4, 10, 7, .78); display: grid; place-items: center; padding: 16px; z-index: 20; }
.overlay[hidden] { display: none; }
.modal { background: var(--felt-deep); border: 1px solid var(--brass-dim); border-radius: 14px; padding: 28px; max-width: 420px; width: 100%; text-align: center; display: flex; flex-direction: column; gap: 14px; }
.modal h2 { margin: 0; font-family: var(--display); font-size: 30px; color: var(--brass); text-wrap: balance; }
.modal p { margin: 0; color: var(--text); }

/* phones */
@media (max-width: 760px) {
  .felt {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    grid-template-areas: "left top right" "board board board" "me me me";
    padding: 16px 8px 14px; border-width: 8px; border-radius: 36px; gap: 10px;
  }
  .seat { padding: 6px 4px; --cw: 30px; }
  .lower { grid-template-columns: minmax(0, 1fr); }
  .top h1 { font-size: 24px; }
}

@media (prefers-reduced-motion: reduce) {
  .card.deal { animation: none; }
  * { transition: none !important; }
}