:root {
  color-scheme: dark;
  --ink: #07110d;
  --line: rgba(237, 226, 198, 0.14);
  --cream: #f4eedf;
  --muted: #a9b4aa;
  --green: #2dd48f;
  --felt: #0c6042;
  --felt-dark: #084731;
  --gold: #e2ae62;
  --red: #d96d62;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.35);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--ink);
  color: var(--cream);
  font-synthesis: none;
}

* { box-sizing: border-box; }

html { min-width: 320px; min-height: 100%; }

body {
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 10% 20%, rgba(21, 101, 70, 0.2), transparent 34rem),
    radial-gradient(circle at 88% 5%, rgba(226, 174, 98, 0.08), transparent 30rem),
    var(--ink);
}

button, input { font: inherit; }
button { cursor: pointer; }
button:focus-visible, input:focus-visible {
  outline: 2px solid var(--green);
  outline-offset: 3px;
}

.hidden { display: none !important; }

.noise {
  position: fixed;
  inset: 0;
  opacity: 0.035;
  pointer-events: none;
  background:
    radial-gradient(circle, rgba(255, 255, 255, 0.8) 0 0.45px, transparent 0.65px) 0 0 / 4px 4px,
    radial-gradient(circle, rgba(255, 255, 255, 0.5) 0 0.35px, transparent 0.55px) 2px 1px / 5px 5px;
  z-index: 10;
}

.topbar {
  width: min(1220px, calc(100% - 40px));
  height: 84px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line);
}

.brand { color: inherit; text-decoration: none; display: flex; align-items: center; gap: 14px; }
.brand-mark { font: 800 18px/1 ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: -1px; }
.brand-mark span { color: var(--green); }
.brand-name { color: var(--muted); font-size: 13px; letter-spacing: 0.08em; text-transform: uppercase; }

.network-pill {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: #dce8df;
  background: rgba(255, 255, 255, 0.035);
  font-size: 12px;
}

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(45, 212, 143, 0.12);
}

/* Contain child margins so the wallet cannot push the page background down. */
main { display: flow-root; width: min(1220px, calc(100% - 40px)); margin: 0 auto; }

.lobby-shell {
  min-height: calc(100vh - 150px);
  display: grid;
  grid-template-columns: 1.05fr 0.85fr;
  align-items: center;
  gap: clamp(48px, 9vw, 130px);
  padding: 64px 0 90px;
}

.eyebrow {
  margin: 0 0 16px;
  color: var(--green);
  font: 700 11px/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.hero-copy h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(58px, 7.2vw, 104px);
  font-weight: 500;
  line-height: 0.91;
  letter-spacing: -0.06em;
}

.hero-body {
  max-width: 570px;
  margin: 34px 0 30px;
  color: var(--muted);
  font-size: clamp(16px, 1.6vw, 19px);
  line-height: 1.65;
}

.principles { display: flex; flex-wrap: wrap; gap: 9px; }
.principles span {
  padding: 8px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: #d0d9d1;
  font: 600 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
}

.entry-card, .panel-card, .action-bar {
  border: 1px solid var(--line);
  background: linear-gradient(145deg, rgba(22, 42, 33, 0.96), rgba(13, 27, 21, 0.96));
  box-shadow: var(--shadow);
}

.entry-card { border-radius: 18px; overflow: hidden; }
.entry-tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.tab {
  border: 0;
  padding: 18px;
  color: #7f9084;
  background: transparent;
  font-size: 13px;
  font-weight: 700;
}
.tab + .tab { border-left: 1px solid var(--line); }
.tab.active { color: var(--cream); background: rgba(255, 255, 255, 0.035); }
.entry-panel { padding: 32px; }
.entry-intro { display: flex; gap: 18px; align-items: center; }
.entry-intro h2, .panel-card h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -0.02em; }
.entry-intro p, .panel-card > p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.55; }
.card-glyph {
  display: grid;
  place-items: center;
  flex: 0 0 52px;
  width: 52px;
  height: 68px;
  border-radius: 7px;
  color: #17231c;
  background: var(--cream);
  font: 700 17px/1 Georgia, serif;
  transform: rotate(-3deg);
  box-shadow: 0 9px 25px rgba(0, 0, 0, 0.3);
}
.card-glyph.red { color: #a53b35; transform: rotate(3deg); }

.terms-preview { margin: 30px 0 26px; border-top: 1px solid var(--line); }
.terms-preview div { display: flex; justify-content: space-between; gap: 20px; padding: 13px 0; border-bottom: 1px solid var(--line); font-size: 12px; }
.terms-preview span { color: var(--muted); }
.terms-preview strong { font-weight: 600; text-align: right; }

.primary-button {
  width: 100%;
  min-height: 52px;
  border: 0;
  border-radius: 8px;
  padding: 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #07140e;
  background: var(--green);
  font-weight: 800;
  transition: transform 120ms ease, background 120ms ease;
}
.primary-button:hover { transform: translateY(-1px); background: #42e3a2; }
.primary-button:disabled { cursor: wait; opacity: 0.65; transform: none; }
.fine-print, .microcopy { margin: 12px 0 0; color: #708177; font-size: 11px; }

.field-label { display: block; margin: 28px 0 8px; color: #c6d1c8; font-size: 12px; font-weight: 700; }
.text-field, .copy-row input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  color: var(--cream);
  background: rgba(0, 0, 0, 0.2);
}
#join-panel .primary-button { margin-top: 14px; }
.error-message { margin: 16px 0 0; color: #ffaaa0; font-size: 13px; }
.entry-card > .error-message { padding: 0 32px 24px; }
.game-shell { padding: 34px 0 80px; }
.game-heading { margin-bottom: 24px; text-align: center; }
.game-heading h1 { margin: 0; font: 500 28px/1.1 Georgia, serif; }

.game-layout { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 20px; }
.game-layout:not(:has(.side-panel > :not(.hidden))) {
  grid-template-columns: minmax(0, 1fr);
}
.side-panel:not(:has(> :not(.hidden))) { display: none; }
.table-column { min-width: 0; }
.poker-table {
  position: relative;
  min-height: 610px;
  overflow: hidden;
  border: 12px solid #3b271a;
  border-radius: 48% / 18%;
  background:
    radial-gradient(circle at 50% 48%, rgba(40, 170, 117, 0.22), transparent 35%),
    linear-gradient(135deg, var(--felt), var(--felt-dark));
  box-shadow: inset 0 0 0 3px #6d4830, inset 0 0 80px rgba(0,0,0,.36), var(--shadow);
}
.felt-ring { position: absolute; inset: 26px; border: 1px solid rgba(238, 225, 190, 0.19); border-radius: inherit; }
.seat { position: absolute; z-index: 2; display: flex; align-items: center; gap: 11px; }
.seat-opponent { top: 35px; left: 50%; transform: translateX(-50%); }
.seat-local { bottom: 35px; left: 50%; transform: translateX(-50%); }
.avatar { display: grid; place-items: center; width: 43px; height: 43px; border-radius: 50%; color: var(--ink); background: var(--gold); font-weight: 900; }
.avatar.local { background: var(--green); }
.seat-copy { min-width: 105px; padding: 8px 12px; border-radius: 8px; background: rgba(5, 18, 12, 0.75); backdrop-filter: blur(8px); }
.seat-copy strong, .seat-copy span { display: block; }
.seat-copy strong { font-size: 13px; }
.seat-copy span { margin-top: 3px; color: #9bb0a2; font-size: 10px; }
.seat-copy .seat-stack {
  margin-top: 5px;
  color: var(--gold);
  font: 700 11px/1.1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.blind-marker {
  padding: 7px 9px;
  border: 1px solid rgba(226, 174, 98, 0.55);
  border-radius: 999px;
  color: #ffdda8;
  background: rgba(30, 22, 11, 0.82);
  font: 800 9px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.03em;
  white-space: nowrap;
  box-shadow: 0 5px 18px rgba(0, 0, 0, 0.24);
}
.card-pair { display: flex; align-items: center; }
.card-pair > span { width: 44px; height: 62px; border: 2px solid var(--cream); border-radius: 6px; background: repeating-linear-gradient(45deg, #17382a, #17382a 3px, #24543e 3px, #24543e 6px); box-shadow: 0 4px 10px rgba(0,0,0,.25); }
.card-pair > span + span { margin-left: -27px; transform: rotate(6deg); }
.pot-display { position: absolute; top: calc(50% - 92px); left: 50%; transform: translate(-50%, -50%); text-align: center; }
.pot-display span, .pot-display strong { display: block; }
.pot-display span { color: rgba(255,255,255,.58); font: 700 9px/1 ui-monospace, monospace; letter-spacing: .15em; text-transform: uppercase; }
.pot-display strong { margin-top: 7px; font-size: 16px; }
.community-cards { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); display: flex; gap: 7px; }
.playing-card { width: 64px; height: 88px; display: grid; place-items: center; border-radius: 8px; }
.playing-card.empty { border: 1px dashed rgba(255,255,255,.25); color: rgba(255,255,255,.24); font: 600 11px/1 ui-monospace, monospace; }
.playing-card.dealt, .card-pair > span.dealt { background: #fffdf6; border: 1px solid #ded7c8; color: #18211c; font: 700 18px/1 Georgia, serif; text-shadow: none; }
.playing-card.dealt.red, .card-pair > span.dealt.red { color: #b82f3d; }
.card-pair > span.dealt { display: grid; place-items: center; font-size: 18px; }
.card-pair.face-up > span + span { margin-left: 8px; transform: none; }
.card-label { display: inline-flex; align-items: baseline; justify-content: center; max-width: 100%; white-space: nowrap; }
.card-label .card-suit { margin-left: 1px; font-size: 1em; }
.card-label.wide-rank .card-rank { letter-spacing: -.06em; }
.card-label.wide-rank .card-suit { margin-left: 0; }
.blind-level {
  display: flex;
  justify-content: flex-end;
  align-items: baseline;
  gap: 5px;
  margin: 0 8px 8px 0;
  color: var(--muted);
  font: 400 10px/1.4 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.blind-level strong { font-weight: 500; }
.table-message {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: flex;
  flex-wrap: wrap;
  align-content: center;
  justify-content: center;
  gap: 8px 12px;
  padding: 12px;
  border-radius: inherit;
  text-align: center;
  background: #10241b;
  overflow: auto;
}
.table-message > [role="status"] { flex: 0 0 100%; }
.table-message span, .table-message small { display: block; }
.table-message span { font: 600 20px/1.2 Georgia, serif; }
.table-message small { margin-top: 4px; color: rgba(238,244,239,.76); font-size: 12px; line-height: 1.4; }
.table-primary-action {
  width: auto;
  min-height: 34px;
  margin: 0;
  padding: 6px 14px;
  font-size: 13px;
}
.table-funding-card {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  width: min(560px, calc(100% - 72px));
  max-height: none;
  overflow: auto;
  padding: 24px;
  transform: translate(-50%, -50%);
  background: linear-gradient(145deg, rgba(20, 39, 30, 0.985), rgba(10, 24, 17, 0.985));
  border-color: rgba(226, 174, 98, 0.62);
  box-shadow: 0 24px 65px rgba(0, 0, 0, 0.58);
}
.table-funding-card h2 { font-size: 25px; }
.table-funding-card > p { font-size: 13px; }
.funding-blinds {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin: 10px 0 14px;
}
.funding-blinds span {
  padding: 9px 11px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: rgba(238, 244, 239, 0.65);
  font-size: 10px;
}
.funding-blinds strong {
  display: block;
  margin-top: 4px;
  color: #ffdda8;
  font: 800 11px/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.poker-table:has(.table-funding-card:not(.hidden)) > :not(.felt-ring, .seat, .table-funding-card) {
  opacity: 0.12;
}

.action-bar { position: relative; margin-top: 14px; height: 128px; min-height: 128px; border-radius: 12px; padding: 16px; display: flex; justify-content: center; align-items: center; gap: 20px; box-shadow: none; }
.action-bar.hidden { display: flex !important; visibility: hidden; pointer-events: none; }
.action-bar:has(> .table-message:not(.hidden)) { visibility: visible; pointer-events: auto; }
.action-bar:has(> .table-message:not(.hidden)) > .action-buttons { visibility: hidden; }
.action-buttons { display: flex; justify-content: center; gap: 8px; }
.action-buttons button { min-width: 68px; border: 1px solid var(--line); border-radius: 7px; padding: 10px 12px; color: #718178; background: rgba(255,255,255,.025); }
.action-buttons button:not(:disabled) {
  color: #fffaf0;
  border-color: #76aaa9;
  background: linear-gradient(#286d78, #1e515d);
  box-shadow: inset 0 1px 0 #ffffff26, 0 3px 0 #0b303b, 0 5px 12px #0004;
  cursor: pointer;
}
.action-buttons button:not(:disabled):active {
  transform: translateY(2px);
  box-shadow: inset 0 1px 3px #0003, 0 1px 0 #0b303b;
}

.side-panel { display: flex; flex-direction: column; gap: 14px; }
.panel-card { border-radius: 12px; padding: 20px; box-shadow: none; }
.panel-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
.panel-title-row .eyebrow { margin-bottom: 7px; }
.secure-mark { border: 1px solid var(--line); border-radius: 999px; padding: 6px 8px; color: var(--muted); font-size: 9px; white-space: nowrap; }
.secure-mark { color: var(--green); }
.funding-card { border-color: rgba(226, 174, 98, 0.32); }
.funding-amount {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-top: 16px;
  padding: 13px 14px;
  border: 1px solid rgba(226, 174, 98, 0.24);
  border-radius: 8px;
  background: rgba(226, 174, 98, 0.06);
}
.funding-amount span { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .08em; }
.funding-amount strong { color: var(--gold); font: 700 15px/1 ui-monospace, SFMono-Regular, Menlo, monospace; }
.compact-label { margin-top: 16px; }
.funding-address-row { margin-top: 7px; }
.funding-address-row input { color: #dce8df; }
.funding-state {
  min-height: 34px;
  margin: 12px 0 0;
  padding: 10px;
  border-left: 2px solid var(--gold);
  color: #d9c59f;
  background: rgba(0, 0, 0, 0.14);
  font: 500 10px/1.45 ui-monospace, SFMono-Regular, Menlo, monospace;
}
.funding-state.seen { border-left-color: var(--green); color: #a8e8cc; }
.funding-state.confirmed { border-left-color: var(--green); color: var(--green); }
.funding-state.error { border-left-color: var(--red); color: #ffaaa0; }
.staging-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: 10px;
}
.staging-inputs > span {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  font-size: 9px;
}
.staging-input-state { display: block; margin-top: 5px; color: var(--cream); font-size: 10px; }
.staging-input-state.checking { color: var(--gold); }
.staging-input-state.ready { color: var(--green); }
.funding-links { display: flex; flex-wrap: wrap; gap: 8px 14px; margin-top: 13px; }
.funding-links a { color: #b9c9bd; font-size: 10px; text-decoration-color: rgba(185, 201, 189, 0.45); text-underline-offset: 3px; }
.funding-links a:hover { color: var(--green); }
.funding-warning { line-height: 1.5; }
.secondary-button {
  width: 100%;
  border-radius: 8px;
  padding: 0 14px;
  font-weight: 800;
  border: 1px solid var(--line);
  color: var(--cream);
  background: rgba(255, 255, 255, 0.04);
}
.secondary-button:disabled { cursor: not-allowed; opacity: 0.45; }
.copy-row { display: grid; grid-template-columns: 1fr auto; gap: 7px; margin-top: 16px; }
.copy-row input { min-width: 0; padding: 10px; color: #9eb1a4; font: 500 10px/1 ui-monospace, monospace; }
.copy-row button { border: 0; border-radius: 7px; padding: 0 13px; color: var(--ink); background: var(--cream); font-size: 11px; font-weight: 800; }

@media (max-width: 980px) {
  .lobby-shell { grid-template-columns: 1fr; gap: 50px; max-width: 720px; margin: 0 auto; }
  .hero-copy { text-align: center; }
  .hero-body { margin-left: auto; margin-right: auto; }
  .principles { justify-content: center; }
  .game-layout { grid-template-columns: 1fr; }
  .side-panel { display: grid; grid-template-columns: 1fr 1fr; }
}

@media (max-width: 680px) {
  .topbar, main { width: min(100% - 24px, 1220px); }
  .brand-name { display: none; }
  .lobby-shell { padding-top: 42px; }
  .hero-copy h1 { font-size: clamp(50px, 17vw, 76px); }
  .entry-panel { padding: 24px; }
  .game-heading h1 { font-size: 22px; }
  .poker-table { min-height: 520px; border-width: 8px; border-radius: 42% / 14%; }
  .seat { gap: 7px; }
  .blind-marker { padding: 6px 7px; font-size: 8px; }
  .pot-display { top: calc(50% - 72px); }
  .community-cards { gap: 4px; }
  .playing-card { width: 42px; height: 59px; }
  .table-message span { font-size: 18px; }
  .table-message small { font-size: 11px; }
  .table-funding-card {
    width: calc(100% - 30px);
    max-height: none;
    padding: 18px;
  }
  .table-funding-card h2 { font-size: 21px; }
  .seat-copy { min-width: 92px; }
  .action-bar { align-items: stretch; flex-direction: column; }
  .action-buttons { display: grid; grid-template-columns: repeat(4, 1fr); }
  .action-buttons button { min-width: 0; padding: 9px 5px; }
  .side-panel { display: flex; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition: none !important; }
}

.table-transactions { padding-left: 18px; max-height: 280px; overflow-y: auto; font-size: 12px; line-height: 1.8; }
.table-transactions a { color: var(--cream); }
#table-funding-key { width: 100%; margin-bottom: 12px; }

/* Wagers sit just inside each seat, toward the middle of the felt. */
.table-bet { position: absolute; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 9px; z-index: 2; white-space: nowrap; }
.table-bet-opponent { top: 114px; }
.table-bet-local { bottom: 113px; }
.table-bet strong { display: block; font: 700 12px/1.3 ui-monospace, monospace; color: #ffe3ad; }
.table-bet small { display: block; font-size: 9px; color: #bbcebf; margin-top: 2px; }
.chip-stack { position: relative; width: 32px; height: 29px; }
.chip-stack i { position: absolute; left: 0; bottom: 0; width: 30px; height: 16px; border: 3px dashed #fff0cd; border-radius: 50%; background: #b96b26; box-shadow: 0 3px 0 #603414, 0 4px 5px #0006; }
.chip-stack i:nth-child(2) { bottom: 6px; }
.chip-stack i:nth-child(3) { bottom: 12px; }
@media (max-width: 600px) {
  :is(.onchain-table, .practice-table) .poker-table { min-height: 600px; }
}
.network-details { margin-top: 18px; font-size: 12px; }
.network-details summary { cursor: pointer; color: var(--muted); }
.network-details pre { white-space: pre-wrap; overflow-wrap: anywhere; font-size: 11px; }
/* Keep dealer names on one line so the seat never covers its wager. */
.seat { width: max-content; max-width: calc(100% - 32px); }
.seat-copy strong { white-space: nowrap; }
.dealer-button {
  display: grid;
  place-items: center;
  flex: 0 0 24px;
  width: 24px;
  height: 24px;
  border: 1px solid #fff;
  border-radius: 50%;
  color: #24332a;
  background: #f4f0df;
  box-shadow: 0 2px 0 #aaa894, 0 3px 6px #0004;
  font: 800 12px/1 system-ui, sans-serif;
}
.table-bet small:empty, .seat-copy span:empty { display: none; }
.sit-out-control { display: flex; align-items: center; gap: 7px; width: fit-content; margin-top: 14px; color: var(--muted); font-size: 12px; cursor: pointer; }
.sit-out-control input { width: 15px; height: 15px; margin: 0; accent-color: var(--green); cursor: inherit; }

/* The rail anchors the seats; the middle belongs to the board and wagers. */
body:has(#game:not(.hidden)) .noise { opacity: .008; }
.game-layout { grid-template-columns: minmax(0, 1fr); gap: 8px; }
.table-column { min-width: 0; }
.blind-level { margin: 0 8px 58px; gap: 6px; font-size: 11px; }
.poker-table, :is(.onchain-table,.practice-table) .poker-table {
  height: clamp(500px, 46vw, 560px); min-height: 0;
  margin: 0 18px 38px; border: 9px solid #293831; border-radius: 50%;
  background: radial-gradient(ellipse at 50% 44%, #21694f, #154c3a 75%);
  box-shadow: inset 0 0 0 2px #64706455, inset 0 10px 45px #0003, 0 10px 0 #101d17, 0 20px 35px #0004;
  overflow: visible;
}
.felt-ring { inset: 14px; border-color: #cfdfcb12; }
.seat { gap: 0; width: 188px; max-width: none; height: 62px; padding: 9px; border: 1px solid #72877a66; border-radius: 31px; background: #14221c; box-shadow: 0 5px 12px #0005; transition: border-color .15s, box-shadow .15s; }
.seat-opponent { top: -31px; }
.seat-local { bottom: -31px; }
.seat-copy { min-width: 0; flex: 1; padding: 3px 8px; background: none; backdrop-filter: none; text-align: center; }
.seat-copy strong { font-size: 13px; font-weight: 600; }
.seat-copy .seat-stack { margin-top: 5px; font: 700 15px/1.2 ui-monospace,monospace; color: #f5ecd9; }
.avatar { flex: 0 0 42px; height: 42px; width: 42px; font-size: 15px; background: #a49b79; }
.avatar.local { background: #50836b; color: #f7f3e7; }
.seat.active-turn { border-color: #62e7aa; box-shadow: 0 0 0 3px #62e7aa35,0 5px 12px #0005; }
.dealer-button { position: absolute; right: -37px; top: 18px; }
.blind-marker { position: absolute; left: -45px; }
.card-pair { position: absolute; left: 50%; transform: translateX(-50%); gap: 5px; }
.seat-local .card-pair { bottom: calc(100% + 8px); }
.seat-opponent .card-pair { bottom: calc(100% - 14px); }
.card-pair > span { position: relative; width: 54px; height: 74px; border-radius: 6px; border-width: 1px; }
.card-pair > span + span, .card-pair.face-up > span + span { margin-left: 0; transform: none; }
.seat-opponent .card-pair:not(.face-up) > span { width: 37px; height: 42px; border-radius: 5px; }
.seat-opponent .card-pair.face-up { bottom: auto; top: calc(100% + 5px); }
.pot-display { top: calc(50% - 78px); display: flex; align-items: baseline; justify-content: center; gap: 7px; white-space: nowrap; }
.pot-display > span:first-child { font: 500 11px/1 system-ui,sans-serif; letter-spacing: 0; text-transform: none; }
.pot-display strong { margin: 0; font: 700 18px/1.2 ui-monospace,monospace; }
.pot-display .pot-chips { position: absolute; top: -5px; left: -43px; transform: none; }
.community-cards { gap: 7px; }
.playing-card { position: relative; width: 68px; height: 96px; border-radius: 7px; box-shadow: 0 3px 5px #0002; }
.playing-card.empty { border: 1px solid #ffffff0e; color: transparent; background: #08291b12; box-shadow: none; }
.playing-card.dealt, .card-pair > span.dealt { background: #fffdf7; color: #202b29; border-color: #faf2df; }
.card-label { display: flex; flex-direction: column; align-items: center; gap: 2px; padding-top: 0; font: 700 30px/.95 ui-serif,Georgia,serif; }
.card-label .card-suit { margin: 0; font-size: 27px; }
.card-pair .card-label { font-size: 24px; }
.card-pair .card-label .card-suit { font-size: 21px; }
.table-bet-opponent { top: 56px; }
.table-bet-local { bottom: 137px; }
.table-bet { gap: 8px; }
.table-bet strong { font-size: 13px; color: #f7ecd4; }
.table-bet small { font-size: 9px; }
.chip-stack { flex: 0 0 32px; }
.chip-stack i { border-color: #f5e9cb; }
.flying-chips { position: absolute; z-index: 6; pointer-events: none; visibility: visible !important; }
.table-controls { display: grid; grid-template-columns: 1fr minmax(360px, 55%); align-items: center; gap: 16px; }
.sit-out-control { margin: 0; padding: 12px 0; }
.action-bar { margin: 0; padding: 14px; height: 100px; min-height: 100px; justify-content: flex-end; background: #13251b70; border-color: #ffffff0b; }
.action-buttons { width: 100%; justify-content: flex-end; }
.action-buttons button { flex: 1; min-height: 52px; min-width: 0; padding: 10px 12px; font-size: 14px; font-weight: 700; }
.action-buttons button:not(:disabled):hover { filter: brightness(1.12); }
.table-message { background: #112219; }
.table-message span { font: 600 16px/1.3 system-ui,sans-serif; }
.side-panel { display: block; }
#chain-panel { padding: 0 4px; background: none; border: 0; }
.network-details { margin-top: 6px; }
#invite-card {
  position: absolute;
  z-index: 5;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: min(480px, calc(100% - 32px));
  margin: 0;
  padding: 24px;
  background: #14271e;
  border-color: #8ca58e66;
  box-shadow: 0 18px 50px #0007;
}
.poker-table:has(.table-invite-card:not(.hidden)) > :not(.table-invite-card, .felt-ring) { opacity: .18; }
#invite-card h2 { font-size: 25px; }
#invite-card .copy-row { grid-template-columns: minmax(0, 1fr); gap: 12px; }
#invite-card .copy-row button { width: 100%; min-height: 52px; padding: 14px 20px; font-size: 16px; -webkit-user-select: none; user-select: none; }
@media (max-width: 400px) {
  #invite-card { padding: 18px; }
}
@media(max-width:680px) {
  .blind-level { margin-bottom: 57px; font-size: 10px; }
  .poker-table, :is(.onchain-table,.practice-table) .poker-table { height: 460px; min-height: 0; margin-left: 0; margin-right: 0; border-width: 6px; border-radius: 45% / 35%; }
  .felt-ring { inset: 9px; }
  .seat { width: 168px; height: 58px; padding: 10px; border-radius: 29px; }
  .seat-local { bottom: -29px; }
  .seat-opponent { top: -29px; }
  .seat-copy .seat-stack { font-size: 14px; }
  .avatar { width: 36px; height: 36px; flex-basis: 36px; }
  .community-cards { gap: 4px; }
  .playing-card { width: clamp(44px,12.6vw,62px); height: clamp(66px,18vw,86px); }
  .card-label { font-size: 26px; }
  .card-label .card-suit { font-size: 24px; }
  .pot-display { top: calc(50% - 65px); }
  .pot-display .pot-chips { top: -6px; }
  .table-bet-local { bottom: 132px; }
  .table-controls { display: flex; flex-direction: column; align-items: stretch; gap: 4px; }
  .sit-out-control { padding: 7px 0; }
  .action-bar { height: 100px; min-height: 100px; padding: 10px; flex-direction: row; align-items: center; }
  .action-buttons { display: flex; gap: 6px; }
  .action-buttons button { padding: 10px 6px; font-size: 13px; }

}

/* The opponent's nameplate sits in front of the tucked card backs. */
.seat-opponent::before {
  content: "";
  position: absolute;
  inset: -1px;
  z-index: 1;
  border: 1px solid;
  border-color: inherit;
  border-radius: inherit;
  background: #14221c;
  box-shadow: 0 -2px 5px #0003;
  pointer-events: none;
}
.seat-opponent > :is(.avatar, .seat-copy) { position: relative; z-index: 2; }
.seat-opponent > :is(.dealer-button, .blind-marker) { z-index: 2; }

/* Unavailable actions never remain as greyed-out choices. */
.action-buttons button:disabled { display: none !important; }
.action-bar:not(:has(.action-buttons button:not(:disabled):not(.hidden))):not(:has(> .table-message:not(.hidden))) {
  visibility: hidden;
  pointer-events: none;
}

.player-name-input { width: 100%; margin-bottom: 16px; }
.seat-copy { overflow: hidden; }
.seat-copy strong { overflow: hidden; text-overflow: ellipsis; }

/* Give the table the space used by lobby branding. */
body:has(#game:not(.hidden)) > .topbar { display: none; }
.game-shell { padding-top: 18px; }

.wallet-panel { position: relative; z-index: 7; margin: 14px 0; font-size: 12px; }
.wallet-panel summary { cursor: pointer; width: fit-content; margin-left: auto; color: var(--muted); }
.wallet-panel summary strong { color: var(--cream); margin-left: 8px; }
.wallet-content { position: absolute; right: 0; top: 26px; width: min(380px,100%); padding: 18px; border: 1px solid var(--line); border-radius: 12px; background: #14271e; box-shadow: 0 12px 30px #0006; }
.wallet-refresh { margin-top: 12px; border: 0; background: none; padding: 5px 0; color: var(--cream); text-decoration: underline; }
:is(#back-to-lobby, #leave-table) { position: relative; z-index: 5; flex: 0 0 auto; width: auto; min-height: 44px; white-space: nowrap; }
.action-bar:has(:is(#back-to-lobby, #leave-table):not(.hidden)) { visibility: visible; pointer-events: auto; justify-content: center; }
.action-bar:has(:is(#back-to-lobby, #leave-table):not(.hidden)) :is(.table-message, .action-buttons) { display: none; }

/* The wallet floats above the table instead of adding a header row. */
main { position: relative; }
body:has(#game:not(.hidden)) .wallet-panel { position: absolute; top: 12px; right: 0; width: 100%; margin: 0; pointer-events: none; }
body:has(#game:not(.hidden)) .wallet-panel :is(summary, .wallet-content) { pointer-events: auto; }
body:has(#game:not(.hidden)) .game-shell { padding-top: 42px; }
@media (min-width: 681px) {
  :is(.onchain-table,.practice-table) .poker-table { height: clamp(460px, calc(100dvh - 274px), 560px); }
}

.table-preparation { position: absolute; z-index: 5; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(380px, calc(100% - 40px)); padding: 26px; border: 1px solid #8ca58e55; border-radius: 16px; background: #14271ef5; box-shadow: 0 16px 40px #0005; text-align: center; }
.table-preparation h2 { margin: 0 0 20px; font: 600 20px/1.3 system-ui,sans-serif; color: var(--cream); }
.progress-indicator { display: block; appearance: none; width: 100%; height: 9px; border: 0; border-radius: 99px; overflow: hidden; background: #ffffff14; accent-color: var(--green); }
.progress-indicator::-webkit-progress-bar { background: #ffffff14; border-radius: 99px; }
.progress-indicator::-webkit-progress-value { background: linear-gradient(90deg, #159b6c, #39df9e); border-radius: 99px; transition: width .3s ease; }
.progress-indicator::-moz-progress-bar { background: #28cf91; border-radius: 99px; }
@media (prefers-reduced-motion: reduce) { .progress-indicator::-webkit-progress-value { transition: none; } }

.action-buttons button { -webkit-user-select: none; user-select: none; }

.onchain-table .poker-table > .table-message { inset: auto; top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(380px, calc(100% - 40px)); height: auto; min-height: 0; padding: 26px; border: 1px solid #8ca58e55; border-radius: 16px; background: #14271ef5; box-shadow: 0 16px 40px #0005; z-index: 5; }
.onchain-table .poker-table > .table-message span { font: 600 20px/1.3 system-ui,sans-serif; }

.wallet-onboarding-title { display: none; }
.wallet-onboarding #lobby { display: none; }
.wallet-onboarding .wallet-panel { width: min(440px, 100%); margin: 64px auto; }
.wallet-onboarding .wallet-panel summary { display: none; }
.wallet-onboarding .wallet-content { position: static; width: 100%; padding: 28px; }
.wallet-onboarding .wallet-onboarding-title { display: block; margin: 0 0 16px; font: 600 26px/1.2 system-ui,sans-serif; }
.wallet-onboarding .wallet-content .copy-row { grid-template-columns: minmax(0, 1fr); gap: 12px; }
.wallet-onboarding .wallet-content .copy-row button { min-height: 52px; font-size: 16px; }

/* Unknown-duration setup phases show activity without inventing a percentage. */
.progress-indicator:indeterminate {
  background: linear-gradient(90deg, #ffffff14 0%, #ffffff14 30%, #28cf91 45%, #39df9e 55%, #ffffff14 70%, #ffffff14 100%);
  background-size: 300% 100%;
  animation: progress-activity 1.6s ease-in-out infinite alternate;
}
.progress-indicator:indeterminate::-webkit-progress-bar { background: transparent; }
.progress-indicator:indeterminate::-moz-progress-bar { background: transparent; }
@keyframes progress-activity { from { background-position: 100% 0; } to { background-position: 0% 0; } }
@media (prefers-reduced-motion: reduce) {
  .progress-indicator:indeterminate { animation: none; background-position: 50% 0; }
}

.wallet-content .fine-print a { color: var(--cream); text-underline-offset: 3px; }
.wallet-content .fine-print a:hover { color: var(--green); }

/* Table objects behave like game pieces when clicked or dragged. */
.poker-table, .blind-level, .table-controls {
  -webkit-user-select: none;
  user-select: none;
}
:is(.poker-table, .table-controls) :is(input:not([type="checkbox"]):not([type="radio"]):not([type="range"]), textarea, [contenteditable="true"]) {
  -webkit-user-select: text;
  user-select: text;
}

:is(.wallet-checking, .wallet-awaiting) .wallet-funding-details { display: none; }

.nickname-card { display: none; width: min(440px, 100%); margin: 64px auto; padding: 28px; border: 1px solid #3b5047; border-radius: 20px; background: #14281f; }
.nickname-card h1 { margin: 0 0 24px; font: 600 28px/1.2 system-ui, sans-serif; }
.nickname-card .primary-button { width: 100%; min-height: 52px; }
.nickname-onboarding .nickname-card { display: block; }
.nickname-onboarding #lobby, .nickname-onboarding #wallet-panel { display: none; }

#wallet-progress { display: none; margin: 8px 0 16px; }
:is(.wallet-checking, .wallet-awaiting) #wallet-progress { display: block; }

#table-status-progress { display: none; margin-top: 20px; }
#table-phase.busy ~ #table-status-progress { display: block; }
