:root {
  --ink: #141414;
  --paper: #f2f0e9;
  --cream: #e3dfd2;
  --blue: #2450ff;
  --lime: #d8ff43;
  --red: #ff5b4d;
  --green: #17664b;
  --felt: #0f503b;
  --line: rgba(20, 20, 20, 0.24);
  --max: 1240px;
  --pad: clamp(1.25rem, 4vw, 3.5rem);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; color: var(--ink); background: var(--paper); font-family: Arial, Helvetica, sans-serif; line-height: 1.5; }
button, input, select { font: inherit; }
button { color: inherit; }
a { color: inherit; }
[hidden] { display: none !important; }
.skip-link { position: fixed; top: .75rem; left: .75rem; z-index: 100; transform: translateY(-180%); padding: .65rem 1rem; background: var(--ink); color: white; }
.skip-link:focus { transform: translateY(0); }
.hand-guide { display: none; }
body.game-active .hand-guide { position: fixed; top: .55rem; left: .55rem; z-index: 1001; display: block; color: var(--ink); }
.hand-guide summary { width: max-content; padding: .55rem .75rem; border: 1px solid white; background: var(--lime); box-shadow: 3px 3px 0 rgba(0,0,0,.75); cursor: pointer; font-size: .75rem; font-weight: 900; line-height: 1; list-style: none; user-select: none; }
.hand-guide summary::-webkit-details-marker { display: none; }
.hand-guide summary::before { content: "☰"; margin-right: .45rem; }
.hand-guide[open] summary { background: white; box-shadow: none; }
.hand-guide[open] summary::before { content: "×"; }
.hand-guide-panel { width: min(22rem, calc(100vw - 1.1rem)); max-height: calc(100svh - 3.5rem); margin-top: .45rem; padding: 1rem; overflow: auto; border: 1px solid white; background: rgba(20,20,20,.96); box-shadow: .45rem .45rem 0 rgba(216,255,67,.9); color: white; }
.hand-guide-panel ol { display: grid; grid-template-columns: 1fr 1fr; gap: .35rem .8rem; margin: .75rem 0 0; padding: 0; counter-reset: hand-rank; list-style: none; }
.hand-guide-panel li { display: grid; grid-template-columns: 1.25rem 1fr; padding-bottom: .35rem; border-bottom: 1px solid rgba(255,255,255,.2); counter-increment: hand-rank; }
.hand-guide-panel li::before { content: counter(hand-rank, decimal-leading-zero); grid-row: 1 / 3; color: var(--lime); font-size: .65rem; font-weight: 800; }
.hand-guide-panel li strong { font-size: .78rem; }
.hand-guide-panel li span { color: rgba(255,255,255,.7); font-size: .62rem; }
.card-order { display: grid; gap: .5rem; margin-top: 1rem; padding-top: .85rem; border-top: 1px solid white; }
.card-order > strong { color: var(--lime); font-size: .83rem; word-spacing: .08rem; }
.card-order small { color: rgba(255,255,255,.72); font-size: .66rem; line-height: 1.45; }
.site-header, main > section, .site-footer { width: min(100%, var(--max)); margin-inline: auto; padding-inline: var(--pad); }
.site-header { display: flex; align-items: center; justify-content: space-between; min-height: 5.25rem; }
.brand { display: inline-flex; align-items: center; gap: .7rem; font-weight: 700; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 2.25rem; aspect-ratio: 1; border-radius: 50%; background: var(--ink); color: var(--paper); font-size: .75rem; }
.header-meta { display: flex; align-items: center; gap: .65rem; font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.status-dot { width: .55rem; aspect-ratio: 1; border-radius: 50%; background: var(--lime); border: 1px solid var(--ink); }
.eyebrow { margin: 0; font-size: .76rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
h1, h2, h3 { margin: 0; letter-spacing: -.065em; line-height: .93; }

.hero { position: relative; min-height: clamp(34rem, 72vh, 48rem); overflow: hidden; padding-top: clamp(3rem, 7vw, 6rem); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.hero h1 { margin-top: 1.5rem; font-size: clamp(5.5rem, 17vw, 13rem); line-height: .7; text-transform: uppercase; }
.hero h1 span { display: block; }
.hero h1 span:first-child { color: var(--blue); }
.hero h1 span:last-child { margin-left: 17%; }
.hero-note { position: absolute; right: var(--pad); bottom: 3rem; display: flex; align-items: end; gap: 3rem; max-width: 34rem; }
.hero-note p { margin: 0; max-width: 24rem; }
.hero-note span { color: var(--red); font-size: 1.7rem; letter-spacing: .2em; white-space: nowrap; }

.panel, .game-shell { padding-top: clamp(4rem, 8vw, 7rem); padding-bottom: clamp(4rem, 8vw, 7rem); }
.panel-heading, .game-toolbar { display: flex; align-items: end; justify-content: space-between; gap: 3rem; margin-bottom: 3rem; }
.panel-heading h2, .game-toolbar h2 { margin-top: .8rem; font-size: clamp(3rem, 7vw, 6rem); }
.panel-heading > p { max-width: 25rem; margin: 0; }
.lobby-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.field { display: grid; gap: .5rem; grid-column: 1 / -1; margin-bottom: 1.25rem; }
.field span { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; }
.field input, .field select { width: 100%; min-height: 3.25rem; padding: .75rem 1rem; border: 1px solid var(--ink); border-radius: 0; background: white; color: var(--ink); outline: none; }
.field input:focus, .field select:focus { box-shadow: inset 0 0 0 2px var(--blue); }
.field.compact { margin: 1.4rem 0; }
.field.compact input { text-transform: uppercase; }
.money-confirmation { display: grid; grid-template-columns: 1.15rem 1fr; gap: .65rem; align-items: start; margin: 0 0 1.35rem; cursor: pointer; font-size: .82rem; line-height: 1.4; }
.money-confirmation input { width: 1.15rem; height: 1.15rem; margin: .05rem 0 0; accent-color: var(--lime); }
.money-confirmation input:focus-visible { outline: 2px solid var(--lime); outline-offset: 2px; }
.lobby-card { display: flex; flex-direction: column; min-height: 25rem; padding: 1.5rem; border: 1px solid var(--ink); }
.lobby-card + .lobby-card { border-left: 0; }
.lobby-card h3 { margin: 4rem 0 1rem; font-size: clamp(2.2rem, 4.5vw, 4rem); }
.lobby-card p { margin: 0 0 2rem; }
.card-number { font-size: .78rem; font-weight: 700; }
.join-card { background: var(--blue); color: white; }
.practice-card { background: var(--ink); color: white; }
.practice-card .practice-count { margin: .45rem 0; }
.practice-count select { cursor: pointer; }
.button { display: flex; align-items: center; justify-content: space-between; width: 100%; min-height: 3.25rem; margin-top: auto; padding: .75rem 1rem; border: 1px solid currentColor; cursor: pointer; font-weight: 700; }
.button:hover, .button:focus-visible { transform: translateY(-2px); }
.button-dark { background: var(--ink); color: white; }
.button-blue { background: white; color: var(--blue); }
.button-light { background: transparent; color: white; }
.lobby-status { min-height: 1.5rem; margin: 1rem 0 0; color: #9b271f; font-weight: 700; }

.rules { border-top: 1px solid var(--ink); background: var(--cream); }
.rules-heading h2 { margin-top: .8rem; font-size: clamp(3rem, 7vw, 6rem); }
.rules-grid { display: grid; grid-template-columns: repeat(3, 1fr); }
.rule-card { min-height: 19rem; padding: 1.5rem; border: 1px solid var(--ink); background: var(--paper); }
.rule-card + .rule-card { border-left: 0; }
.rule-card h3 { margin: 3.5rem 0 1rem; font-size: clamp(1.9rem, 3.6vw, 3.25rem); }
.rule-card p { max-width: 27rem; margin: 0; }
.rule-goal { background: var(--lime); }
.hand-ranking { display: grid; grid-template-columns: minmax(9rem, .7fr) 3fr; gap: 1.5rem; padding: 1.5rem; border: 1px solid var(--ink); border-top: 0; background: var(--blue); color: white; }
.hand-ranking ol { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: .75rem 1rem; margin: 0; padding: 0; list-style-position: inside; }
.hand-ranking li { font-size: .82rem; font-weight: 700; white-space: nowrap; }

.game-shell { background: var(--cream); }
.toolbar-actions { display: flex; gap: 1.5rem; }
.text-button { padding: .4rem 0; border: 0; border-bottom: 1px solid currentColor; background: transparent; cursor: pointer; }
.table-wrap { padding: clamp(1rem, 3vw, 2.5rem); background: var(--ink); }
.poker-table { position: relative; min-height: clamp(33rem, 62vw, 47rem); overflow: hidden; border: clamp(.55rem, 1.4vw, 1rem) solid #6b432c; border-radius: 46%; background: radial-gradient(circle at center, #176e50 0, var(--felt) 62%, #0a3b2b 100%); box-shadow: inset 0 0 0 2px rgba(255,255,255,.25), inset 0 0 5rem rgba(0,0,0,.22); color: white; }
.table-center { position: absolute; inset: 50% auto auto 50%; z-index: 2; width: min(90%, 36rem); text-align: center; transform: translate(-50%, -50%); }
.table-street { margin: 0 0 .75rem; font-size: .72rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
.community-cards, .hole-cards { display: flex; justify-content: center; gap: clamp(.3rem, 1vw, .65rem); min-height: 6.7rem; }
.playing-card { display: grid; align-content: space-between; width: clamp(3.5rem, 7vw, 5.4rem); aspect-ratio: .7; padding: .42rem; border-radius: .35rem; background: white; color: var(--ink); box-shadow: 0 .3rem .8rem rgba(0,0,0,.2); font-size: clamp(1rem, 2vw, 1.35rem); font-weight: 800; line-height: 1; animation: deal-in 280ms ease both; }
.playing-card.red { color: #d53030; }
.playing-card.back { place-items: center; background: repeating-linear-gradient(45deg, #2450ff 0 7px, #1739bd 7px 14px); color: white; border: 3px solid white; }
.playing-card .suit { justify-self: end; font-size: 1.5em; }
.card-slot { width: clamp(3.5rem, 7vw, 5.4rem); aspect-ratio: .7; border: 1px dashed rgba(255,255,255,.42); border-radius: .35rem; }
.pot { display: inline-flex; gap: .55rem; margin: 1rem 0 .45rem; padding: .35rem .75rem; border-radius: 999px; background: var(--lime); color: var(--ink); }
.table-message { margin: 0; font-size: .85rem; }
.seats { position: absolute; inset: 0; }
.seat { position: absolute; z-index: 3; width: clamp(7.5rem, 17vw, 12rem); padding: .3rem .45rem; border: 0; background: transparent; color: white; text-align: center; text-shadow: 0 2px 7px rgba(0,0,0,.9); transition: color 180ms ease; }
.seat.active { background: transparent; color: var(--lime); }
.seat.folded { opacity: .48; }
.seat-heading { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: .3rem .55rem; }
.seat-name { min-width: 0; overflow: hidden; font-weight: 700; text-overflow: ellipsis; white-space: nowrap; }
.seat-roles { display: inline-flex; align-items: center; justify-content: center; gap: .18rem; }
.role-marker { display: inline-grid; min-width: 1.35rem; min-height: 1.35rem; place-items: center; padding: .14rem .34rem; border: 1px solid white; border-radius: 999px; color: var(--ink); font-size: .58rem; font-weight: 900; line-height: 1; text-shadow: none; white-space: nowrap; }
.role-dealer { background: var(--lime); }
.role-small-blind { background: var(--blue); color: white; }
.role-big-blind { background: var(--red); }
.role-number { background: white; }
.seat-last-action { display: inline-block; max-width: 100%; padding: .3rem .62rem; border: 2px solid white; border-radius: .3rem; background: var(--lime); box-shadow: 3px 3px 0 rgba(0,0,0,.72); color: var(--ink); font-size: clamp(.95rem, 1.7vw, 1.35rem); font-weight: 950; letter-spacing: -.035em; line-height: 1; text-shadow: none; white-space: nowrap; animation: seat-action-in 180ms ease-out both; }
.seat-meta { display: grid; justify-content: center; gap: .05rem; font-size: .68rem; line-height: 1.35; opacity: .88; }
.bot-countdown { display: block; margin-top: .25rem; color: var(--lime); font-size: .92rem; font-weight: 900; line-height: 1; text-shadow: 0 2px 7px rgba(0,0,0,.9); }
.seat-cards { display: flex; justify-content: center; gap: .2rem; margin-top: .3rem; }
.seat-cards .playing-card, .seat-cards .card-slot { width: 1.75rem; padding: .17rem; border-width: 1px; border-radius: .2rem; font-size: .62rem; }
.seat-cards .playing-card .suit { font-size: 1.15em; }
.play-grid { display: grid; grid-template-columns: .85fr 1.35fr .8fr; border: 1px solid var(--ink); border-top: 0; }
.play-grid > * { min-height: 17rem; padding: 1.5rem; }
.play-grid > * + * { border-left: 1px solid var(--ink); }
.hand-heading { display: flex; align-items: center; justify-content: space-between; gap: .75rem; }
.reveal-cards { flex: 0 0 auto; padding: .45rem .65rem; border: 1px solid var(--ink); background: var(--lime); color: var(--ink); cursor: pointer; font-size: .72rem; font-weight: 800; line-height: 1; user-select: none; touch-action: none; }
.reveal-cards:hover, .reveal-cards:focus-visible { box-shadow: 3px 3px 0 var(--ink); outline: none; }
.reveal-cards.is-holding { background: var(--blue); color: white; transform: translate(2px, 2px); box-shadow: none; }
.reveal-cards:disabled { cursor: not-allowed; opacity: .35; }
.hole-cards { justify-content: start; margin: 1.5rem 0; }
.chip-line { margin: 0; }
.action-controls { display: grid; grid-template-columns: repeat(2, 1fr); gap: .5rem; margin-top: 1.5rem; }
.action { min-height: 3rem; padding: .6rem .8rem; border: 1px solid var(--ink); background: white; cursor: pointer; font-weight: 700; }
.action.fold { background: var(--red); }
.action.call { background: var(--lime); }
.action.raise { background: var(--blue); color: white; }
.action.all-in { background: var(--ink); color: var(--lime); }
.action:disabled { cursor: not-allowed; filter: grayscale(1); opacity: .35; }
.host-controls { display: grid; gap: .5rem; }
.host-controls .button { margin: 1.5rem 0 0; }
.turn-hint { margin: 1rem 0 0; font-size: .85rem; }
.stats-summary { display: grid; grid-template-columns: 1fr 1fr; gap: .45rem; margin-top: .75rem; }
.stats-summary > div { display: grid; gap: .1rem; padding: .45rem .55rem; background: rgba(20,20,20,.08); }
.stats-summary .stat-net { grid-column: 1 / -1; }
.stats-summary span { font-size: .68rem; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; }
.stats-summary strong { font-size: 1.15rem; }
.positive { color: #17664b; }
.negative { color: #b3261e; }
.earnings-board { display: grid; gap: .2rem; max-height: 6.6rem; margin: .6rem 0 0; padding: 0; overflow: auto; list-style: none; }
.earnings-board li { display: flex; justify-content: space-between; gap: .75rem; font-size: .76rem; }
.earnings-board li span:first-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-panel ol { max-height: 14rem; margin: 1.25rem 0 0; padding-left: 1.4rem; overflow: auto; }
.log-panel li { margin-bottom: .45rem; font-size: .85rem; animation: log-in 180ms ease both; }
.site-footer { display: flex; justify-content: space-between; padding-top: 1.5rem; padding-bottom: 2rem; background: var(--ink); color: white; }
.site-footer p { margin: 0; }
.site-footer a { text-underline-offset: .3rem; }

body.game-active {
  overflow: hidden;
  background: var(--ink);
}

body.game-active .site-header,
body.game-active main > .hero,
body.game-active main > .lobby,
body.game-active main > .rules,
body.game-active .site-footer {
  display: none;
}

body.game-active main { height: 100svh; }

body.game-active .game-shell {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(18rem, 27vw, 23rem);
  grid-template-rows: auto minmax(0, 1fr);
  gap: .65rem;
  width: 100vw;
  max-width: none;
  height: 100svh;
  margin: 0;
  padding: .65rem;
  background: var(--ink);
  color: white;
}

body.game-active .game-toolbar {
  grid-column: 1 / -1;
  grid-row: 1;
  align-items: center;
  min-height: 2.8rem;
  margin: 0;
  padding-inline: .4rem;
}

body.game-active .game-toolbar h2 {
  display: inline;
  margin: 0 0 0 .65rem;
  font-size: 1.25rem;
  letter-spacing: -.03em;
}

body.game-active .game-toolbar > div:first-child { display: flex; align-items: baseline; margin-left: 5.1rem; }

body.game-active .table-wrap {
  grid-column: 1;
  grid-row: 2;
  min-height: 0;
  padding: .55rem;
  overflow: hidden;
}

body.game-active .poker-table {
  width: 100%;
  height: 100%;
  min-height: 0;
  border-width: clamp(.45rem, 1vw, .75rem);
}

body.game-active .seat { width: clamp(7rem, 12vw, 10rem); }

body.game-active .play-grid {
  display: grid;
  grid-column: 2;
  grid-row: 2;
  grid-template-columns: 1fr;
  grid-template-rows: auto auto auto minmax(0, 1fr);
  min-height: 0;
  overflow-x: hidden;
  overflow-y: auto;
  border: 0;
  background: var(--cream);
  color: var(--ink);
}

body.game-active .play-grid > * {
  min-height: 0;
  padding: .9rem 1rem;
}

body.game-active .play-grid > * + * {
  border-top: 1px solid var(--ink);
  border-left: 0;
}

body.game-active .hole-cards {
  min-height: 4.7rem;
  margin: .65rem 0;
}

body.game-active .reveal-cards { padding: .38rem .55rem; font-size: .67rem; }

body.game-active .hole-cards .playing-card,
body.game-active .hole-cards .card-slot { width: 3.2rem; }

body.game-active .action-controls {
  gap: .35rem;
  margin-top: .7rem;
}

body.game-active .action { min-height: 2.45rem; padding: .4rem .55rem; }
body.game-active .host-controls .button { min-height: 2.6rem; margin-top: .65rem; }
body.game-active .turn-hint { margin: .55rem 0 0; }
body.game-active .stats-summary { margin-top: .45rem; }
body.game-active .earnings-board { max-height: 5rem; margin-top: .4rem; }
body.game-active .log-panel { min-height: 0; overflow: hidden; }
body.game-active .log-panel ol { height: calc(100% - 1.5rem); max-height: none; margin-top: .65rem; }

@keyframes deal-in { from { opacity: 0; transform: translateY(-.8rem) rotate(-4deg); } to { opacity: 1; transform: none; } }
@keyframes log-in { from { opacity: 0; transform: translateY(.35rem); } to { opacity: 1; transform: none; } }
@keyframes seat-action-in { from { opacity: 0; transform: scale(.9); } to { opacity: 1; transform: scale(1); } }

@media (max-width: 820px) {
  .header-meta span:not(.status-dot) { display: none; }
  .hero { min-height: 31rem; }
  .hero h1 { font-size: clamp(4.4rem, 21vw, 8rem); }
  .hero h1 span:last-child { margin-left: 4%; }
  .hero-note { left: var(--pad); right: var(--pad); bottom: 2rem; align-items: start; flex-direction: column; gap: .7rem; }
  .panel-heading, .game-toolbar { align-items: start; flex-direction: column; }
  .lobby-grid, .play-grid { grid-template-columns: 1fr; }
  .lobby-card + .lobby-card { border-left: 1px solid var(--ink); border-top: 0; }
  .rules-grid { grid-template-columns: 1fr; }
  .rule-card { min-height: auto; }
  .rule-card + .rule-card { border-top: 0; border-left: 1px solid var(--ink); }
  .rule-card h3 { margin-top: 2.5rem; }
  .hand-ranking { grid-template-columns: 1fr; }
  .hand-ranking ol { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .play-grid > * + * { border-left: 0; border-top: 1px solid var(--ink); }
  .poker-table { min-height: 38rem; border-radius: 35%; }
  .seat { width: 7.2rem; padding: .45rem; }
  .table-center { width: 78%; }
  .playing-card, .card-slot { width: clamp(2.8rem, 11vw, 4rem); }
  .community-cards, .hole-cards { min-height: 5.5rem; }
  .toolbar-actions { width: 100%; justify-content: space-between; }
  .site-footer { gap: 1rem; flex-direction: column; }
}

@media (orientation: landscape) and (max-height: 700px) {
  body.game-active .game-shell { gap: .4rem; padding: .4rem; }
  body.game-active .game-toolbar { min-height: 2.3rem; }
  body.game-active .table-wrap { padding: .35rem; }
  body.game-active .playing-card,
  body.game-active .card-slot { width: clamp(2.65rem, 6vh, 3.5rem); }
  body.game-active .community-cards { min-height: 4.7rem; }
  body.game-active .seat { width: 7rem; padding: .35rem .45rem; }
  body.game-active .play-grid > * { padding: .55rem .7rem; }
  body.game-active .hole-cards { min-height: 3.8rem; margin: .35rem 0; }
  body.game-active .hole-cards .playing-card,
  body.game-active .hole-cards .card-slot { width: 2.7rem; }
  body.game-active .action { min-height: 2.1rem; }
  body.game-active .log-panel li { margin-bottom: .2rem; }
}

@media (orientation: portrait) {
  body.game-active { overflow: auto; }
  body.game-active main { height: auto; }
  body.game-active .game-shell {
    display: block;
    width: 100%;
    height: auto;
    min-height: 100svh;
    padding: .75rem;
  }
  body.game-active .game-toolbar { margin-bottom: .75rem; }
  body.game-active .game-toolbar > div:first-child { margin-left: 4.8rem; }
  body.game-active .table-wrap { height: 38rem; }
  body.game-active .play-grid { display: grid; margin-top: .75rem; overflow: visible; }
  body.game-active .log-panel ol { height: auto; max-height: 12rem; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
