/* Cash ring tables (/cash9/, /rush6/), on top of style.css. The page is one
   viewport: header, then the felt and the action dock beside a results panel.
   The felt scales with its stage (a size container), and everything on it is
   sized in em off the felt's font size; ring_table.js places the seats from
   the landscape or portrait layout that --layout names. */

.ring-page {
  --header-h: 3.6rem;
  --dock-h: 9.4rem;
  --line: #2a313b;
  --chart-aivat: #c98500;
  --chart-net: #3987e5;
  --win: #5fd394;
  --loss: #ff7a7a;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  grid-template-columns: minmax(0, 1fr);
}
.ring-page .muted { color: var(--muted); }

/* Header */
.ring-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 1rem;
  min-height: var(--header-h);
  border-bottom: 1px solid var(--line);
  background: #0f141b;
  text-align: left;
}
.brand { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.brand-mark {
  width: 2.2rem; height: 2.2rem; border-radius: 10px;
  display: grid; place-items: center;
  background: linear-gradient(145deg, #1f5a40, #123524);
  border: 1px solid #2f6b4f;
  font-size: 1.25rem;
}
.brand-text { min-width: 0; }
.ring-header h1 { margin: 0; font-size: 1.05rem; letter-spacing: 0.01em; white-space: nowrap; }
.brand-sub {
  color: var(--muted); font-size: 0.74rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.brand-sub .model-info { color: var(--muted); }
.table-links { display: flex; gap: 0.25rem; margin-left: auto; }
.table-links a {
  color: var(--muted); text-decoration: none; font-size: 0.8rem; font-weight: 600;
  padding: 0.35rem 0.65rem; border-radius: 999px; border: 1px solid transparent; white-space: nowrap;
}
.table-links a:hover { color: var(--text); border-color: var(--line); }
.table-links a[aria-current="page"] { color: var(--text); background: var(--panel-2); border-color: var(--line); }
.header-controls { display: flex; align-items: center; gap: 0.5rem; }
.field { display: flex; align-items: center; gap: 0.4rem; color: var(--muted); font-size: 0.8rem; }
.field select {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px; padding: 0.3rem 0.4rem; font-size: 0.8rem;
}
.switch {
  display: flex; align-items: center; gap: 0.35rem; cursor: pointer; user-select: none;
  color: var(--muted); font-size: 0.8rem; padding: 0.3rem 0.55rem;
  border: 1px solid var(--line); border-radius: 999px;
}
.switch:has(input:checked) { color: var(--text); border-color: #3a6ea8; background: #14243a; }
.switch input { accent-color: var(--accent); margin: 0; }
.icon-btn, .btn {
  background: var(--panel-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 8px;
  height: 2rem; min-width: 2rem; padding: 0 0.6rem;
  font-size: 0.85rem; font-weight: 600; cursor: pointer;
}
.icon-btn:hover, .btn:hover { border-color: var(--accent); }
.link-btn {
  background: none; border: none; color: var(--accent); cursor: pointer;
  font-size: 0.78rem; padding: 0.2rem 0.3rem;
}
.link-btn:hover { text-decoration: underline; }

.about {
  max-width: 34rem; width: calc(100vw - 2rem);
  background: var(--panel); color: var(--text);
  border: 1px solid var(--line); border-radius: 14px; padding: 1.2rem 1.4rem;
  font-size: 0.88rem; line-height: 1.5;
}
.about::backdrop { background: rgba(0, 0, 0, 0.6); }
.about h2 { margin: 0 0 0.5rem; font-size: 1.1rem; }
.about h3 { margin: 1rem 0 0.3rem; font-size: 0.95rem; }
.about p { margin: 0.4rem 0; }
.about .close { position: absolute; right: 0.8rem; top: 0.8rem; }
.dialog-settings:empty { display: none; }
.dialog-settings {
  display: flex; flex-direction: column; gap: 0.6rem;
  padding: 0 0 0.9rem; margin: 0 2.4rem 0.8rem 0; border-bottom: 1px solid var(--line);
}
.dialog-settings .field { font-size: 0.85rem; gap: 0.5rem; }
.dialog-settings .field select { font-size: 0.85rem; }
.dialog-settings .table-links { margin: 0; flex-wrap: wrap; }
.dialog-settings .dialog-buttons { display: flex; gap: 0.5rem; }

/* Main grid */
.ring-main { min-height: 0; max-width: none; padding: 0; margin: 0; display: block; }
.ring-main .loading { max-width: 24rem; margin: 4rem auto; }
.ring-game {
  height: 100%;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 22rem;
}
.play-column { display: flex; flex-direction: column; min-height: 0; min-width: 0; }

/* The felt */
.table-stage {
  flex: 1 1 auto;
  min-height: 0;
  container: stage / size;
  display: grid;
  place-items: center;
}
.table.ring {
  --layout: landscape;
  --table-w: min(100cqw - 2.5rem, (100cqh - 2.2rem) * 1.95);
  width: var(--table-w);
  aspect-ratio: 1.95;
  height: auto;
  min-height: 0;
  display: block;
  padding: 0;
  border-width: calc(var(--table-w) / 85);
  border-radius: 50% / 50%;
  font-size: clamp(10.5px, calc(var(--table-w) / 74), 16px);
  background:
    radial-gradient(ellipse at 50% 42%, #24573f 0%, #1a4431 55%, #12301f 100%);
  box-shadow: 0 0 0 1px #000, 0 1.2em 3em rgba(0, 0, 0, 0.55), inset 0 0 3em rgba(0, 0, 0, 0.45);
  outline-offset: -1.1em;
}
@container stage (aspect-ratio >= 1.12) and (aspect-ratio < 1.75) {
  .table.ring {
    --table-w: min(100cqw - 2.5rem, (100cqh - 2.2rem) * 1.55);
    aspect-ratio: 1.55;
    font-size: clamp(10.5px, calc(var(--table-w) / 62), 16px);
  }
}
@container stage (aspect-ratio < 1.12) {
  .table.ring {
    --layout: portrait;
    --table-w: min(100cqw - 1rem, (100cqh - 1.4rem) * 0.64);
    aspect-ratio: 0.64;
    border-radius: 46% / 30%;
    font-size: clamp(10px, calc(var(--table-w) / 30), 15px);
  }
}

.ring .board-area {
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  width: 21em;
  padding: 0;
  text-align: center;
  z-index: 3;
}
.ring .pot { font-size: 1.25em; margin: 0 auto 0.45em; min-height: 1.4em; width: fit-content; }
.ring .pot .pot-total { color: #c9d3c0; font-weight: 500; font-size: 0.8em; }
.ring .board { gap: 0.35em; min-height: 4em; }
.ring .board .card { width: 2.85em; height: 4em; font-size: 1.15em; border-radius: 0.3em; }
.ring .board .card .suit { font-size: 1.1em; }
.ring .board:empty::before {
  content: attr(data-watermark); align-self: center;
  color: rgba(255, 255, 255, 0.07); font-weight: 800; letter-spacing: 0.12em; text-transform: uppercase; font-size: 1.1em;
}
.ring .banner {
  position: absolute; left: 0; right: 0; top: 100%;
  margin-top: 0.55em; min-height: 0; height: auto; overflow: visible;
  font-size: 1em; font-weight: 700;
}
.ring .banner .result { display: inline-block; padding: 0.3em 0.9em; border-radius: 999px; background: rgba(0, 0, 0, 0.45); }
.ring .banner .win { color: var(--win); }
.ring .banner .lose { color: var(--loss); }
.ring .banner .even { color: var(--text); }
.ring .banner .banner-sub {
  display: block; margin-top: 0.6em;
  font-size: max(12px, 0.85em); font-weight: 500; color: #cfe3d6;
}

/* Seats */
.ring .seat {
  position: absolute;
  transform: translate(-50%, -50%);
  display: flex; flex-direction: column; align-items: center;
  gap: 0; padding: 0;
  min-width: 0; height: auto;
  background: none; border: none; box-shadow: none;
  border-radius: 0;
  z-index: 2;
  font-size: 1em;
  animation: none;
}
.ring .seat .cards { display: flex; gap: 0.2em; min-height: 3.5em; margin-bottom: -0.7em; z-index: 1; position: relative; }
.ring .seat .card { width: 2.5em; height: 3.5em; font-size: 1em; border-radius: 0.28em; }
.ring .seat .card .suit { font-size: 1em; }
.ring .seat.human .cards { min-height: 5.2em; margin-bottom: -0.8em; gap: 0.25em; }
.ring .seat.human .card { width: 3.75em; height: 5.2em; font-size: 1.45em; }
.ring .seat.folded .cards { visibility: hidden; }
.ring .seat.folded.reveal .cards { visibility: visible; opacity: 0.35; }

.pod {
  position: relative;
  z-index: 2;
  display: flex; align-items: center; gap: 0.5em;
  min-width: 8.6em;
  padding: 0.35em 0.75em 0.35em 0.4em;
  border-radius: 999px;
  background: linear-gradient(180deg, #1d2430, #121820);
  border: 1px solid #36404d;
  box-shadow: 0 0.3em 0.8em rgba(0, 0, 0, 0.5);
  transition: border-color 0.2s, box-shadow 0.2s, opacity 0.2s;
}
.avatar {
  width: 2.2em; height: 2.2em; flex: 0 0 auto;
  border-radius: 50%;
  display: grid; place-items: center;
  font-weight: 800; font-size: max(10px, 0.95em);
  color: #0d1117;
  background: var(--avatar, #8b949e);
}
.ring .seat.human .avatar { background: linear-gradient(145deg, #ffe08a, #d4a017); }
.pod-text { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.ring .seat .name { font-size: max(10px, 0.9em); font-weight: 700; display: flex; gap: 0.35em; align-items: center; white-space: nowrap; }
.ring .position-name { font-size: max(10px, 0.8em); padding: 0.02em 0.4em; }
.ring .seat .stack { font-size: max(10px, 0.88em); color: #c3ccd6; font-variant-numeric: tabular-nums; }
.ring .seat.acting .pod {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(212, 160, 23, 0.4), 0 0 1.2em rgba(212, 160, 23, 0.45);
  animation: acting-pulse 1.25s ease-in-out infinite;
}
.ring .seat.acting .pod::after {
  content: ""; position: absolute; left: 1.2em; right: 1.2em; bottom: -0.12em; height: 0.18em;
  border-radius: 999px; background: var(--gold);
  animation: think-bar var(--think, 0.4s) linear both;
  transform-origin: left;
}
@keyframes think-bar { from { transform: scaleX(1); } to { transform: scaleX(0); } }
.ring .seat.folded .pod { opacity: 0.45; }
.ring .seat.human .pod { min-width: 11em; border-color: #6b5a26; }
.ring .seat.winner .pod { border-color: var(--win); box-shadow: 0 0 1.4em rgba(95, 211, 148, 0.45); }

.ring .seat .last-action {
  position: absolute;
  top: calc(100% + 0.25em);
  left: 50%;
  transform: translateX(-50%);
  height: auto; max-width: none;
  padding: 0.12em 0.6em;
  border-radius: 999px;
  font-size: max(10px, 0.8em); font-weight: 700;
  white-space: nowrap;
  color: #dbe7f3;
  background: rgba(10, 14, 20, 0.78);
  border: 1px solid #3a4452;
  z-index: 3;
}
.ring .seat .last-action:empty { display: none; }
.last-action.kind-fold { color: #9aa4ae; border-color: #3a4048; }
.last-action.kind-check, .last-action.kind-call { color: #9ecbff; border-color: #2f5e8f; }
.last-action.kind-raise { color: #ffd766; border-color: #7a6420; }
.last-action.kind-allin { color: #ffb070; border-color: #8a4e25; }
.last-action.kind-hand { color: #e6edf3; border-color: #5a6675; }
.last-action.kind-win { color: #0d1117; background: var(--win); border-color: var(--win); }
.ring .seat.top-half .last-action { top: auto; bottom: calc(100% + 0.25em); }

.ring .markers { position: absolute; right: -0.9em; top: 50%; bottom: auto; transform: translateY(-50%); z-index: 4; font-size: 1em; }
.ring .table-marker { width: 1.7em; height: 1.7em; font-size: 0.55em; }
.ring .markers .table-marker { width: 1.75em; height: 1.75em; font-size: max(10px, 0.62em); }
.ring .seat .pod { overflow: visible; }

.ring .bet-spot { font-size: 0.9em; gap: 0.3em; }
.ring .bet-spot .bet-value {
  background: rgba(0, 0, 0, 0.5); padding: 0.05em 0.45em; border-radius: 999px;
}
.ring .chip-pile { font-size: 0.8em; }

/* Action dock */
.action-dock {
  flex: 0 0 var(--dock-h);
  height: var(--dock-h);
  display: flex; flex-direction: column; justify-content: flex-end; gap: 0.45rem;
  padding: 0.4rem 1rem 0.8rem;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, #0f141b, #0b0f15);
}
.dock-status {
  display: flex; align-items: center; justify-content: center; gap: 0.9rem; flex-wrap: wrap;
  min-height: 1.6rem;
  font-size: 0.82rem; color: var(--muted); font-variant-numeric: tabular-nums;
}
.dock-status strong { color: var(--text); font-weight: 700; }
.dock-status .pill {
  padding: 0.12rem 0.6rem; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line);
}
.dock-status .deal-now {
  background: #1d3a2a; color: #b5f0cd; border: 1px solid #2f6b4f; border-radius: 999px;
  padding: 0.2rem 0.8rem; font-weight: 700; cursor: pointer; font-size: 0.8rem;
}
.dock-status .deal-now:hover { filter: brightness(1.2); }
.ring-page .raise-controls { max-width: 44rem; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: 0.3rem; }
.ring-page .raise-controls input[type="range"] { width: 100%; accent-color: var(--gold); margin: 0; height: 1rem; }
.size-chips { display: flex; gap: 0.3rem; justify-content: center; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
.size-chip {
  position: relative; flex: 0 0 auto;
  display: flex; flex-direction: column; align-items: center; line-height: 1.1;
  min-width: 3.4rem; padding: 0.22rem 0.45rem;
  border-radius: 8px; border: 1px solid var(--line); background: var(--panel);
  color: var(--muted); font-size: 0.72rem; font-weight: 700; cursor: pointer;
  overflow: hidden;
}
.size-chip .amount { color: var(--text); font-size: 0.8rem; font-variant-numeric: tabular-nums; }
.size-chip:hover { border-color: #7a6420; }
.size-chip.active { border-color: var(--gold); background: #2c2410; color: #ffd766; }
.size-chip .advice-bar { position: absolute; left: 0; bottom: 0; height: 5px; background: var(--accent); }
.size-chip .advice-label { font-size: 0.66rem; color: #b8dbff; margin-bottom: 3px; }

.ring-page .action-bar {
  max-width: 44rem; width: 100%; margin: 0 auto;
  grid-template-columns: 1fr 1.35fr 1.5fr 1.1fr;
  gap: 0.5rem;
}
.ring-page .action-btn {
  position: relative;
  display: flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0; height: 3.1rem;
  font-size: 1rem;
}
.ring-page .action-btn .key {
  font-size: 0.65rem; font-weight: 700; opacity: 0.55;
  border: 1px solid currentColor; border-radius: 4px; padding: 0 0.25rem; line-height: 1.3;
}
.ring-page .action-btn .advice-pct {
  position: absolute; right: 0.4rem; top: 0.18rem;
  font-size: 0.75rem; font-weight: 800; color: #b8dbff;
  background: rgba(13, 17, 23, 0.6); border-radius: 4px; padding: 0 0.25rem;
}
.ring-page .action-btn .advice-pct:empty { display: none; }
.ring-page .action-btn.advice-top { box-shadow: 0 0 0 2px rgba(88, 166, 255, 0.55); }
.ring-page .action-bar.hidden, .ring-page .raise-controls.hidden { display: grid !important; visibility: hidden; }
.ring-page .raise-controls.hidden { display: flex !important; }

/* Results panel */
.side-panel {
  min-height: 0;
  overflow-y: auto;
  border-left: 1px solid var(--line);
  background: #10151c;
  padding: 0.75rem 0.9rem 1rem;
  display: flex; flex-direction: column; gap: 0.7rem;
  font-size: 0.84rem;
}
.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--line); }
.tab {
  background: none; border: none; color: var(--muted); cursor: pointer;
  font-weight: 700; font-size: 0.85rem; padding: 0.45rem 0.7rem;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--text); border-bottom-color: var(--gold); }
.badge { font-size: 0.68rem; color: var(--muted); font-weight: 600; }
.tab-panel { display: flex; flex-direction: column; gap: 0.7rem; }
.segmented {
  display: grid; grid-template-columns: 1fr 1fr; padding: 0.15rem;
  background: var(--panel); border: 1px solid var(--line); border-radius: 9px;
}
.segmented button {
  background: none; border: none; color: var(--muted); cursor: pointer;
  border-radius: 7px; padding: 0.35rem; font-weight: 700; font-size: 0.78rem;
}
.segmented button.active { background: var(--panel-2); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.4); }

.kpis { display: flex; flex-direction: column; gap: 0.5rem; }
.kpi-row { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 0.5rem; }
.kpi-row .kpi .kpi-value { font-size: 1.05rem; }
.kpi.hero.early .kpi-value { color: var(--muted); }
.kpi.hero.early .kpi-value span { color: var(--muted); }
.kpi .verdict { margin-top: 0.4rem; padding: 0.45rem 0.55rem; background: rgba(0, 0, 0, 0.2); font-size: 0.82rem; }
.kpi .verdict strong { font-size: 0.92rem; }
.info-btn { background: none; border: none; color: var(--muted); cursor: pointer; font-size: 0.8rem; padding: 0 0.15rem; }
.info-btn:hover { color: var(--accent); }
.results-pill { display: none; }
.kpi {
  background: var(--panel); border: 1px solid var(--line); border-radius: 10px;
  padding: 0.5rem 0.65rem; min-width: 0;
}
.kpi.hero { grid-column: 1 / -1; border-color: #4d3f15; background: linear-gradient(180deg, #1b1a12, var(--panel)); }
.kpi .kpi-label { color: var(--muted); font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.kpi .kpi-value { font-size: 1.25rem; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 0.1rem; white-space: nowrap; }
.kpi.hero .kpi-value { font-size: 1.9rem; }
.kpi .kpi-value small { font-size: max(10px, 0.55em); font-weight: 600; color: var(--muted); margin-left: 0.2rem; }
.kpi .kpi-sub { color: var(--muted); font-size: 0.74rem; font-variant-numeric: tabular-nums; margin-top: 0.1rem; }
.pos { color: var(--win); }
.neg { color: var(--loss); }
.ci-bar { position: relative; height: 0.5rem; margin-top: 0.45rem; background: #1f2630; border-radius: 999px; }
.ci-bar .zero { position: absolute; top: -0.2rem; bottom: -0.2rem; width: 1px; background: #8b949e; }
.ci-bar .span { position: absolute; top: 0; bottom: 0; border-radius: 999px; background: rgba(201, 133, 0, 0.45); }
.ci-bar .point { position: absolute; top: -0.15rem; width: 0.8rem; height: 0.8rem; margin-left: -0.4rem; border-radius: 50%; background: var(--chart-aivat); border: 2px solid #10151c; }
.ci-scale { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.66rem; margin-top: 0.2rem; font-variant-numeric: tabular-nums; }

.verdict {
  display: flex; gap: 0.5rem; align-items: flex-start;
  padding: 0.5rem 0.65rem; border-radius: 10px;
  background: var(--panel); border: 1px solid var(--line); font-size: 0.78rem; line-height: 1.35;
}
.verdict .icon { font-weight: 900; }
.verdict.good { border-color: #2f6b4f; }
.verdict.good .icon { color: var(--win); }
.verdict.bad { border-color: #7a3b3b; }
.verdict.bad .icon { color: var(--loss); }
.verdict.open .icon { color: var(--muted); }

.chart-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 0.5rem 0.6rem 0.4rem; }
.chart-head { display: flex; justify-content: space-between; color: var(--muted); font-size: 0.72rem; font-weight: 700; }
.legend { display: flex; align-items: center; gap: 0.35rem; font-weight: 600; }
.key-line { display: inline-block; width: 0.9rem; height: 2px; border-radius: 2px; margin-left: 0.3rem; }
.key-line.aivat { background: var(--chart-aivat); }
.key-line.net { background: var(--chart-net); }
.chart { position: relative; height: 8rem; margin-top: 0.3rem; }
.chart-note { color: var(--muted); font-size: 0.7rem; margin-top: 0.2rem; }
.chart svg { width: 100%; height: 100%; display: block; overflow: visible; }
.chart .empty { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 0.78rem; }
.chart .tooltip {
  position: absolute; top: 0; pointer-events: none;
  background: #0b0f15; border: 1px solid var(--line); border-radius: 8px;
  padding: 0.3rem 0.5rem; font-size: 0.72rem; white-space: nowrap; z-index: 5;
  font-variant-numeric: tabular-nums;
}
.chart .tooltip strong { color: var(--text); }
.chart .tooltip .row { display: flex; align-items: center; gap: 0.35rem; color: var(--muted); }

.position-table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; font-size: 0.78rem; }
.position-table th { color: var(--muted); font-weight: 700; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em; text-align: right; padding: 0.25rem 0.3rem; border-bottom: 1px solid var(--line); }
.position-table td { text-align: right; padding: 0.25rem 0.3rem; border-bottom: 1px solid #1b2129; }
.position-table th:first-child, .position-table td:first-child { text-align: left; }
.style-stats { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.style-stats span { background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: 0.15rem 0.55rem; font-size: 0.74rem; color: var(--muted); }
.style-stats strong { color: var(--text); }
.panel-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.5rem; font-size: 0.72rem; }

/* Hand history */
.hands-toolbar { display: flex; justify-content: space-between; align-items: center; font-size: 0.75rem; }
.hand-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.hand-row { background: var(--panel); border: 1px solid var(--line); border-radius: 9px; }
.hand-row > button {
  width: 100%; display: grid; grid-template-columns: 2rem 2.3rem auto 1fr auto; align-items: center; gap: 0.4rem;
  background: none; border: none; color: var(--text); cursor: pointer; padding: 0.35rem 0.55rem; text-align: left;
  font-size: 0.78rem; font-variant-numeric: tabular-nums;
}
.hand-row .hn { color: var(--muted); }
.hand-row .hp { color: var(--muted); font-weight: 700; font-size: 0.7rem; }
.hand-row .hres { text-align: right; font-weight: 800; }
.hand-row .hres small { display: block; font-weight: 600; color: var(--muted); font-size: 0.68rem; }
.mini-cards { display: inline-flex; gap: 2px; }
.mini-card {
  display: inline-grid; place-items: center; width: 1.45rem; height: 1.85rem; border-radius: 3px;
  background: var(--card-bg); font-weight: 800; font-size: 0.78rem; line-height: 1;
}
.mini-card.suit-h { color: var(--card-red); }
.mini-card.suit-s { color: var(--card-black); }
.mini-card.suit-c { color: var(--card-green); }
.mini-card.suit-d { color: var(--card-blue); }
.hand-row .hboard { overflow: hidden; }
.hand-row .hboard .mini-card { width: 1.08rem; height: 1.45rem; font-size: 0.64rem; }
.hand-row .hboard .mini-cards { gap: 1px; }
.hand-detail { display: none; padding: 0 0.6rem 0.55rem; font-size: 0.74rem; color: #c3ccd6; line-height: 1.45; }
.hand-row.open .hand-detail { display: block; }
.hand-detail .street { color: var(--muted); font-weight: 700; margin-top: 0.4rem; }
.hand-detail .own { color: #ffe08a; font-weight: 700; }
.hand-detail .all-cards { display: flex; flex-wrap: wrap; gap: 0.3rem 0.7rem; }
.hand-detail .all-cards span.folded { opacity: 0.5; }
.hand-detail .luck { margin-top: 0.4rem; display: grid; grid-template-columns: 1fr auto; gap: 0 0.6rem; font-variant-numeric: tabular-nums; }
.hand-detail .luck span:nth-child(even) { text-align: right; }
.hand-detail .luck .total { font-weight: 800; color: var(--text); border-top: 1px solid var(--line); padding-top: 0.15rem; }
.ring-page .log { max-height: none; font-size: 0.7rem; }

/* Narrow screens: one scrolling column; the felt and dock fill the first screen. */
@media (max-width: 900px) {
  .ring-page { height: auto; min-height: 100dvh; overflow: visible; display: block; }
  .ring-game { display: block; height: auto; }
  .play-column { height: calc(100dvh - var(--header-h)); min-height: 30rem; }
  .side-panel { border-left: none; border-top: 1px solid var(--line); overflow: visible; max-width: 40rem; margin: 0 auto; }
  .table-links { margin-left: 0; }
  .ring-header { flex-wrap: wrap; row-gap: 0.4rem; }
  .header-controls { margin-left: auto; }
}
@media (max-width: 640px) {
  .ring-header { padding: 0.45rem 0.6rem; gap: 0.5rem; }
  .brand-mark { width: 1.9rem; height: 1.9rem; font-size: 1rem; }
  .ring-header h1 { font-size: 0.95rem; }
  .brand { flex: 1 1 0; order: 0; }
  .ring-header h1 { overflow: hidden; text-overflow: ellipsis; }
  .brand-sub { display: none; }
  .header-controls { display: contents; }
  .switch, .icon-btn, .btn { order: 1; }

  .table-links a { font-size: 0.72rem; padding: 0.2rem 0.55rem; }
  .header-controls { gap: 0.3rem; }
  .field { font-size: 0; gap: 0; }
  .field select { font-size: 0.75rem; }
  .switch { font-size: 0.72rem; padding: 0.25rem 0.45rem; }
  .btn { font-size: 0; padding: 0 0.5rem; }
  .btn::after { content: "New"; font-size: 0.78rem; }
  .action-dock { padding: 0.3rem 0.5rem calc(0.5rem + env(safe-area-inset-bottom)); gap: 0.35rem; }
  .ring-page .action-bar { grid-template-columns: 1fr 1fr 1fr 1fr; gap: 0.35rem; }
  .ring-page .action-btn { height: 2.9rem; font-size: 0.82rem; flex-direction: column; gap: 0; line-height: 1.1; white-space: normal; }
  .ring-page .action-btn .key { display: none; }
  .dock-status { font-size: 0.74rem; gap: 0.5rem; flex-wrap: nowrap; white-space: nowrap; }
  .dock-status .dock-session { display: none; }
  .size-chip { min-width: 2.9rem; padding: 0.18rem 0.3rem; font-size: 0.66rem; }
  .size-chips { justify-content: stretch; gap: 0.2rem; }
  .size-chip { flex: 1 1 0; min-width: 0; padding: 0.18rem 0.1rem; }
  .results-pill {
    display: inline-flex; gap: 0.25rem; align-items: center; order: 1;
    background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); border-radius: 999px;
    padding: 0 0.6rem; height: 2rem; font-size: 0.72rem; font-weight: 700; white-space: nowrap; cursor: pointer;
  }
  .results-pill strong { color: var(--text); }
  .results-pill strong.pos { color: var(--win); }
  .results-pill strong.neg { color: var(--loss); }
  .dock-status kbd { display: none; }

  .ring-page { --dock-h: 7.4rem; }
  .ring-page .raise-controls input[type="range"] { display: none; }
}
@media (max-width: 1150px) and (min-width: 901px) {
  .ring-game { grid-template-columns: minmax(0, 1fr) 19rem; }
}
@media (max-width: 1150px) {
  .field { font-size: 0; gap: 0; }
  .field select { font-size: 0.8rem; }
  .brand-sub .model-info { display: none; }
  .ring-header { gap: 0.6rem; }
}
@media (max-height: 640px) and (min-width: 901px) {
  .ring-page { --dock-h: 8.4rem; }
}

/* Portrait felt (phones): compact pods without avatars, a narrower board.
   Last in the file so it wins over the rules above. */
@container stage (aspect-ratio < 1.12) {
  .ring .board-area { width: 15em; display: flex; flex-direction: column; top: 48%; }
  .ring .banner .banner-sub { max-width: 12em; margin-left: auto; margin-right: auto; }
  .ring .pot { order: 2; margin: 0.45em auto 0; }
  .ring .banner { order: 3; }
  .ring .board { min-height: 3.5em; gap: 0.25em; }
  .ring .board .card { width: 2.45em; height: 3.45em; font-size: 1em; }
  .ring .banner { font-size: max(11px, 0.95em); }
  .ring .avatar { display: none; }
  .ring .pod { min-width: 6.4em; padding: 0.3em 0.7em; justify-content: center; }
  .ring .seat.human .pod { min-width: 8em; }
  .ring .seat .name { font-size: max(10px, 0.95em); }
  .ring .seat .last-action { max-width: 10em; overflow: hidden; text-overflow: ellipsis; }
  .ring .seat.human .cards { min-height: 3.7em; }
  .ring .seat.human .card { width: 2.65em; height: 3.7em; font-size: 1.15em; }
}
