/* Dice Arena web UI. No external fonts or assets; light and dark themes from
   prefers-color-scheme. Layout works from 320px phones to wide desktops. */

:root {
  --bg: #f5f3ee;
  --surface: #ffffff;
  --surface-2: #f0ede5;
  --ink: #1b1c1e;
  --ink-2: #5d6066;
  --ink-3: #8b8e94;
  --line: #e3ded3;
  --line-strong: #cfc8b9;
  --felt: #1f5a46;
  --felt-2: #164234;
  --felt-ink: #eef4f0;
  --felt-ink-2: #b9d3c7;
  --accent: #b8730f;
  --accent-soft: #fbefd6;
  --danger: #b4382c;
  --danger-soft: #f8e1dd;
  --ok: #2e7a4d;
  --ok-soft: #dcefe3;
  --info-soft: #e5edf5;
  --die: #fbf8f1;
  --die-edge: #968c77;
  --pip: #1b1c1e;
  --die-dim: #efebe2;
  --die-counted: #fde8b4;
  --die-dim-edge: #8f8672;
  --pip-dim: #62656c;
  --die-back: #7d3528;
  --die-back-edge: #5f281f;
  --calm: #2e7a4d;
  --warm: #b8730f;
  --hot: #b4382c;
  --shadow: 0 1px 2px rgba(30, 25, 15, 0.06), 0 6px 18px rgba(30, 25, 15, 0.06);
  --scroll-shade: rgba(30, 25, 15, 0.16);
  --radius: 12px;
  --radius-sm: 8px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111315;
    --surface: #191c1f;
    --surface-2: #212529;
    --ink: #e8e6e1;
    --ink-2: #a1a4aa;
    --ink-3: #74787e;
    --line: #2a2f34;
    --line-strong: #3a4046;
    --felt: #18473a;
    --felt-2: #10342a;
    --felt-ink: #e7f0eb;
    --felt-ink-2: #9fc2b3;
    --accent: #e3a43f;
    --accent-soft: #3a2d17;
    --danger: #e2705f;
    --danger-soft: #3b1f1b;
    --ok: #63c18a;
    --ok-soft: #173326;
    --info-soft: #1d2833;
    --die: #f1ece0;
    --die-edge: #c9c0ab;
    --pip: #15171a;
    --die-dim: #a9a397;
    --die-counted: #f4d48a;
    --die-dim-edge: #8d877c;
    --pip-dim: #1d2024;
    --die-back: #8c3e30;
    --die-back-edge: #6a2d23;
    --calm: #63c18a;
    --warm: #e3a43f;
    --hot: #e2705f;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
    --scroll-shade: rgba(0, 0, 0, 0.55);
    color-scheme: dark;
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.5 var(--font);
  font-variant-numeric: tabular-nums;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
}

a {
  color: inherit;
}

h1,
h2,
h3 {
  line-height: 1.2;
  margin: 0;
  font-weight: 650;
  letter-spacing: -0.01em;
}

h1 {
  font-size: 1.6rem;
}

button,
select,
input {
  font: inherit;
  color: inherit;
}

.muted {
  color: var(--ink-2);
}

.small {
  font-size: 0.85rem;
}

.strong {
  font-weight: 650;
}

.mono {
  font-family: var(--mono);
  font-size: 0.85em;
  word-break: break-all;
}

/* ------------------------------------------------------------- shell */

.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 20;
}

.topbar-inner,
.footer-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.topbar-inner {
  height: 56px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.brand-mark {
  width: 28px;
  height: 28px;
}

.brand-mark rect {
  fill: var(--felt);
}

.brand-mark circle {
  fill: var(--felt-ink);
}

/* "no connection, retrying": a small pill over the page, never moving it */
.net-status {
  position: fixed;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  z-index: 30;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: calc(100vw - 32px);
  padding: 4px 12px;
  box-shadow: var(--shadow);
  border-radius: 999px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
}

.net-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--danger);
}

.nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav-link {
  padding: 6px 12px;
  border-radius: 999px;
  text-decoration: none;
  color: var(--ink-2);
  font-weight: 550;
}

.nav-link:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.nav-link.active {
  color: var(--ink);
  background: var(--surface-2);
}

.page {
  flex: 1;
  width: 100%;
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 16px 40px;
  outline: none;
}

.footer {
  border-top: 1px solid var(--line);
  color: var(--ink-3);
  font-size: 0.82rem;
}

.footer-inner {
  padding: 14px 16px;
}

.page-head {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 18px;
}

.page-head .field {
  align-self: flex-start;
}

.head-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
}

.head-meta {
  font-size: 0.92rem;
}

.head-links {
  display: inline-flex;
  gap: 8px;
  margin-left: auto;
}

.lede {
  margin: 0;
  color: var(--ink-2);
}

.updated {
  font-size: 0.8rem;
}

/* ----------------------------------------------------------- panels */

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  margin-bottom: 16px;
  min-width: 0;
}

.panel-title {
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-2);
  font-weight: 650;
  padding: 14px 16px 0;
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.panel-aside {
  margin-left: auto;
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--ink-3);
}

.panel-body {
  padding: 12px 16px 16px;
  min-width: 0;
}

.panel-body .panel-title {
  padding: 2px 0 10px;
}

.empty {
  color: var(--ink-3);
  margin: 4px 0;
}

.notice {
  background: var(--info-soft);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin: 0 0 16px;
  color: var(--ink-2);
}

.banner {
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 4px solid var(--felt);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  margin-bottom: 16px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
}

.banner-done {
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

.banner-warn {
  border-left-color: var(--danger);
  background: var(--danger-soft);
}

.banner-quiet {
  color: var(--ink-2);
}

.error-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  margin-bottom: 16px;
}

.loading {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--ink-2);
  padding: 24px 0;
}

.spinner {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 2px solid var(--line-strong);
  border-top-color: var(--felt);
  animation: spin 0.8s linear infinite;
}

.notice-page {
  text-align: center;
  padding: 60px 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* ---------------------------------------------------------- controls */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: var(--surface);
  text-decoration: none;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.button:hover {
  background: var(--surface-2);
}

.button:disabled {
  opacity: 0.45;
  cursor: default;
}

.button-small {
  padding: 4px 11px;
  font-size: 0.85rem;
}

.button-quiet {
  border-color: transparent;
  background: var(--surface-2);
}

.button-primary {
  background: var(--felt);
  color: var(--felt-ink);
  border-color: var(--felt);
}

.button-primary:hover {
  background: var(--felt-2);
}

.select {
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line-strong);
  background: var(--surface);
  max-width: 100%;
}

.field {
  display: inline-flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  color: var(--ink-2);
}

.field-check {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  font-size: 0.9rem;
  color: var(--ink);
}

.segmented {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  overflow: hidden;
}

.seg {
  border: 0;
  background: transparent;
  padding: 6px 12px;
  cursor: pointer;
  font-weight: 600;
  color: var(--ink-2);
}

.seg.active {
  background: var(--felt);
  color: var(--felt-ink);
}

.seg:disabled {
  opacity: 0.4;
  cursor: default;
}

a:focus-visible,
button:focus-visible,
select:focus-visible,
input:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ------------------------------------------------------- tags, pills */

.pill {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 650;
  background: var(--surface-2);
  color: var(--ink-2);
}

.pill-running,
.pill-finishing {
  background: var(--ok-soft);
  color: var(--ok);
}

.pill-open {
  background: var(--info-soft);
  color: var(--ink);
}

.pill-finished {
  background: var(--surface-2);
}

.pill-aborted,
.pill-closed {
  background: var(--danger-soft);
  color: var(--danger);
}

.chip {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 6px;
  background: var(--surface-2);
  font-size: 0.82rem;
  color: var(--ink-2);
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.chip-strong {
  color: var(--ink);
  font-weight: 600;
}

.tag {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0 6px;
  border-radius: 5px;
  background: var(--surface-2);
  color: var(--ink-2);
  line-height: 1.6;
  white-space: nowrap;
}

.tag-palifico {
  background: var(--accent-soft);
  color: var(--accent);
}

.tag-strong {
  font-size: 0.8rem;
  padding: 1px 8px;
}

.tag-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.tag-winner {
  background: var(--accent);
  color: #fff;
}

.tag-muted {
  font-weight: 600;
}

/* ------------------------------------------------------------- lobby */

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr));
  gap: 14px;
}

.table-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--surface);
  min-width: 0;
}

.table-running {
  border-color: color-mix(in srgb, var(--ok) 35%, var(--line));
}

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.card-title {
  font-weight: 650;
  font-size: 1.05rem;
  text-decoration: none;
  min-width: 0;
  overflow-wrap: anywhere;
}

.card-title:hover {
  text-decoration: underline;
}

.card-meta,
.card-players,
.card-config {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  align-items: center;
  font-size: 0.88rem;
  min-width: 0;
}

.card-config {
  gap: 6px;
}

.card-foot {
  display: flex;
  justify-content: flex-end;
}

.seat-dots {
  display: inline-flex;
  gap: 3px;
}

.seat-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  border: 1.5px solid var(--line-strong);
}

.seat-dot.taken {
  background: var(--felt);
  border-color: var(--felt);
}

.progress {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.progress-track {
  height: 6px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--felt);
  border-radius: 99px;
  transition: width 0.4s ease;
}

.progress-label {
  font-size: 0.82rem;
  color: var(--ink-2);
}

/* -------------------------------------------------------------- live */

.live-head h1 {
  overflow-wrap: anywhere;
}

.conn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--ink-2);
}

.conn-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--ink-3);
}

.conn-live .conn-dot {
  background: var(--ok);
  animation: pulse 2s ease-in-out infinite;
}

.conn-reconnecting .conn-dot {
  background: var(--danger);
}

/* the chain check of the live stream (PROTOCOL.md section 18) */
.chain-state {
  font-size: 0.8rem;
  color: var(--ink-2);
  border: 1px solid var(--line, currentColor);
  border-radius: 99px;
  padding: 1px 8px;
}

.chain-ok,
.chain-ended {
  color: var(--ok);
}

/* a pin reset is two steps: the confirmation appears only when asked for */
.doc-pin-confirm {
  margin-top: 10px;
}

.chain-broken {
  color: var(--danger);
  font-weight: 700;
}

.counter {
  font-weight: 650;
}

.rules {
  font-size: 0.85rem;
}

.live-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 370px;
  gap: 16px;
  align-items: start;
}

.live-main,
.live-side {
  min-width: 0;
}

/* the table: an oval felt with seats around it */

.board {
  position: relative;
  height: 520px;
  margin-bottom: 16px;
}

.felt {
  position: absolute;
  inset: 13% 12%;
  border-radius: 50%;
  background: radial-gradient(ellipse at 50% 40%, var(--felt) 0%, var(--felt-2) 100%);
  box-shadow: inset 0 0 0 10px color-mix(in srgb, var(--felt-2) 70%, #000), inset 0 4px 30px rgba(0, 0, 0, 0.35), var(--shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--felt-ink);
}

.center {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 0 12%;
  max-width: 100%;
}

.center-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--felt-ink-2);
}

.center-label {
  font-size: 0.78rem;
  color: var(--felt-ink-2);
}

.fresh-bid {
  animation: pop 0.35s ease-out;
}

.center-by {
  font-size: 0.9rem;
  color: var(--felt-ink-2);
  overflow-wrap: anywhere;
}

.center-final {
  margin-top: 4px;
  font-weight: 700;
  color: var(--accent);
}

.felt .result-summary {
  font-size: 0.85rem;
  color: var(--felt-ink);
}

.felt .muted {
  color: var(--felt-ink-2);
}

.board-limit {
  position: absolute;
  right: 0;
  bottom: 0;
  font-size: 0.75rem;
}

.seat {
  position: absolute;
  left: var(--x);
  top: var(--y);
  transform: translate(-50%, -50%);
  width: 168px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.seat-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent), var(--shadow);
}

.seat-bidder .seat-name {
  text-decoration: underline;
  text-decoration-color: var(--accent);
  text-underline-offset: 3px;
}

.seat-out {
  opacity: 0.55;
}

.seat-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  min-width: 0;
}

.seat-no {
  font-size: 0.72rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  color: var(--ink-2);
  flex: none;
}

.seat-name {
  font-weight: 650;
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex: 1 1 5em;
}

.seat-dice {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
  min-height: 26px;
}

.seat-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--ink-2);
  flex-wrap: wrap;
}

.delta {
  font-weight: 700;
  font-size: 0.8rem;
}

.delta-loss {
  color: var(--danger);
}

.delta-gain {
  color: var(--ok);
}

.board-placeholder {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 24px;
  border-radius: var(--radius);
  background: var(--felt);
  margin-bottom: 16px;
}

/* dice */

.die {
  display: inline-block;
  flex: none;
  vertical-align: middle;
}

.die-md {
  width: 26px;
  height: 26px;
}

.die-sm {
  width: 22px;
  height: 22px;
}

.die-glyph {
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
}

.die-body {
  fill: var(--die);
  stroke: var(--die-edge);
  stroke-width: 1.2;
}

.die-pip {
  fill: var(--pip);
}

.die-hidden .die-body {
  fill: var(--die-back);
  stroke: var(--die-back-edge);
}

.die-back-mark {
  fill: none;
  stroke: rgba(255, 255, 255, 0.28);
  stroke-width: 1.2;
}

.die-counted .die-body {
  stroke: var(--accent);
  stroke-width: 2.4;
  fill: var(--die-counted);
}

.die-wild-mark {
  fill: var(--accent);
}

/* dice that do not count for the bid: dimmed with their own colours (not
   opacity), so their pips keep a readable contrast in both themes */
.reveal .die[data-face]:not(.die-counted) .die-body,
.seat-dice .die[data-face].die-dim .die-body {
  fill: var(--die-dim);
  stroke: var(--die-dim-edge);
}

.reveal .die[data-face]:not(.die-counted) .die-pip,
.seat-dice .die[data-face].die-dim .die-pip {
  fill: var(--pip-dim);
}

.seat-dice .die[data-face] {
  animation: flip 0.45s ease-out backwards;
}

.seat-dice .die:nth-child(2) {
  animation-delay: 0.04s;
}

.seat-dice .die:nth-child(3) {
  animation-delay: 0.08s;
}

.seat-dice .die:nth-child(4) {
  animation-delay: 0.12s;
}

.seat-dice .die:nth-child(5) {
  animation-delay: 0.16s;
}

/* bids and calls */

.bid {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 650;
  white-space: nowrap;
}

.bid-large {
  font-size: 2.1rem;
  gap: 8px;
}

.bid-large .die-glyph {
  width: 1em;
  height: 1em;
  vertical-align: 0;
}

.bid-x {
  opacity: 0.6;
  font-weight: 500;
}

.call {
  font-weight: 700;
  white-space: nowrap;
}

.call-challenge {
  color: var(--danger);
}

.call-exact {
  color: var(--ok);
}

.felt .call-challenge,
.felt .call-exact {
  color: var(--accent);
}

/* timing: prominent everywhere */

.elapsed {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 0.98rem;
  white-space: nowrap;
}

.elapsed-value {
  min-width: 4.6em;
  text-align: right;
}

.elapsed-track {
  width: 64px;
  height: 6px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}

.elapsed-bar {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: currentColor;
}

.heat-calm {
  color: var(--calm);
}

.heat-warm {
  color: var(--warm);
}

.heat-hot {
  color: var(--hot);
}

.timer {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-left: auto;
  font-weight: 750;
  font-size: 0.95rem;
}

.timer-track {
  width: 46px;
  height: 6px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
}

.timer-bar {
  display: block;
  height: 100%;
  width: 0;
  background: currentColor;
  border-radius: 99px;
}

/* history of the round */

.moves {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}

.move {
  display: grid;
  grid-template-columns: minmax(0, 10em) minmax(0, 1fr) auto;
  grid-template-areas: "who what time" ". msg msg";
  align-items: center;
  gap: 2px 14px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.move:last-child {
  border-bottom: 0;
}

.move-who {
  grid-area: who;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.move-what {
  grid-area: what;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.move .elapsed {
  grid-area: time;
}

.move-message,
.move-detail {
  grid-area: msg;
  font-size: 0.88rem;
  color: var(--ink-2);
  overflow-wrap: anywhere;
}

.move-message::before {
  content: "“";
}

.move-message::after {
  content: "”";
}

.move-rejected {
  color: var(--ink-2);
}

.move-rejected s {
  text-decoration-color: var(--danger);
}

.move-violation .move-what {
  color: var(--danger);
  font-weight: 700;
}

.fresh {
  animation: rise 0.35s ease-out;
}

/* round result */

.result-summary {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.result-summary.compact {
  margin-top: 6px;
  align-items: center;
}

.result-line {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  font-weight: 600;
  justify-content: inherit;
}

.result-count {
  font-weight: 700;
}

.result-violation {
  color: var(--danger);
}

.felt .result-violation {
  color: var(--accent);
}

.result-delta.loss {
  color: var(--danger);
}

.result-delta.gain {
  color: var(--ok);
}

.felt .result-delta.loss,
.felt .result-delta.gain {
  color: var(--felt-ink);
}

.reveal {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reveal-hands {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reveal-row {
  display: grid;
  grid-template-columns: minmax(0, 7em) 1fr;
  gap: 10px;
  align-items: center;
}

.reveal-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.reveal-dice {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}

.reveal-dice .die {
  animation: flip 0.45s ease-out backwards;
}

.reveal-note {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
}

.legend-wild {
  width: 10px;
  height: 10px;
  background: var(--accent);
  clip-path: polygon(50% 0, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
}

/* chat */

.panel-chat .panel-body {
  max-height: 340px;
  overflow-y: auto;
}

.chat {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.chat-line {
  display: grid;
  grid-template-columns: auto 1fr;
  grid-template-areas: "who round" "text text";
  gap: 0 8px;
}

.chat-who {
  grid-area: who;
  font-weight: 650;
}

.chat-round {
  grid-area: round;
  font-size: 0.75rem;
  align-self: center;
}

.chat-text {
  grid-area: text;
  overflow-wrap: anywhere;
  white-space: pre-wrap;
}

/* rounds list */

.rounds {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
}

.round-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
}

.round-no {
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--ink-3);
  min-width: 1.6em;
}

.panel-rounds .panel-body {
  max-height: 320px;
  overflow-y: auto;
}

/* ------------------------------------------------------------ replay */

.controls {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: var(--shadow);
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.control-options {
  gap: 10px 18px;
  align-items: flex-end;
}

.button-ctl {
  min-width: 84px;
}

.scrub {
  width: 100%;
  accent-color: var(--felt);
}

.step-info {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 12px;
  align-items: center;
  font-size: 0.92rem;
}

.step-count {
  font-weight: 700;
}

.step-event {
  color: var(--ink-2);
  overflow-wrap: anywhere;
  min-width: 0;
}

.keys {
  margin-top: 0;
}

/* --------------------------------------------------------- fairness */

.fair-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px 3px 8px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 700;
}

.fair-icon {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  color: #fff;
}

.fair-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.fair-ok .fair-icon {
  background: var(--ok);
}

.fair-failed {
  background: var(--danger-soft);
  color: var(--danger);
}

.fair-failed .fair-icon {
  background: var(--danger);
}

.fair-pending,
.fair-checking,
.fair-unverified,
.fair-unfinished {
  background: var(--surface-2);
  color: var(--ink-2);
}

.fair-pending .fair-icon,
.fair-checking .fair-icon,
.fair-unverified .fair-icon,
.fair-unfinished .fair-icon {
  background: var(--ink-3);
}

.fair-head {
  margin-bottom: 8px;
}

.checks {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.9rem;
}

.check {
  display: grid;
  grid-template-columns: 1.2em minmax(0, 1fr);
  gap: 0 6px;
  align-items: baseline;
}

.check > :nth-child(n + 3) {
  grid-column: 2;
}

.check-icon {
  font-weight: 800;
  width: 1em;
}

.check-ok .check-icon {
  color: var(--ok);
}

.check-fail {
  color: var(--danger);
}

.kv {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 4px 12px;
  margin: 0 0 10px;
  font-size: 0.88rem;
}

.kv dt {
  color: var(--ink-2);
}

.kv dd {
  margin: 0;
  min-width: 0;
}

.hash {
  max-width: 22em;
}

/* ------------------------------------------------------------ tables */

.table-wrap {
  overflow-x: auto;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
  /* a shadow at an edge with more columns behind it (covered at the ends) */
  background:
    linear-gradient(to right, var(--surface) 40%, transparent) left / 28px 100% no-repeat local,
    linear-gradient(to left, var(--surface) 40%, transparent) right / 28px 100% no-repeat local,
    radial-gradient(farthest-side at 0 50%, var(--scroll-shade), transparent) left / 12px 100% no-repeat scroll,
    radial-gradient(farthest-side at 100% 50%, var(--scroll-shade), transparent) right / 12px 100% no-repeat scroll;
}

.data {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data th,
.data td {
  text-align: left;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  vertical-align: middle;
}

.data th {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--ink-2);
  font-weight: 650;
}

.data tbody tr:hover {
  background: var(--surface-2);
}

.data .num {
  text-align: right;
}

.data td.seating {
  white-space: normal;
  min-width: 14em;
}

.data td.seating .chip {
  margin: 1px 2px;
}

.data .mono {
  white-space: normal;
}

.sort {
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  color: inherit;
  text-transform: inherit;
  letter-spacing: inherit;
  cursor: pointer;
}

th.sorted {
  color: var(--ink);
}

th.sorted[aria-sort="descending"] .sort::after {
  content: " ↓";
}

th.sorted[aria-sort="ascending"] .sort::after {
  content: " ↑";
}

.player-link {
  text-decoration: none;
  font-weight: 600;
}

.player-link:hover {
  text-decoration: underline;
}

/* ------------------------------------------------- series and player */

.stats-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 140px), 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 12px 14px;
  min-width: 0;
}

.stat-value {
  font-size: 1.35rem;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.stat-leaders .stat-value {
  font-size: 1.05rem;
  overflow-wrap: normal;
}

.stat-tie {
  grid-column: span 2;
}

.stat-tie .stat-name {
  /* cut to a few characters in the text; this only guards very wide ones */
  max-width: min(100%, 11em);
}

.stat-item {
  white-space: nowrap;
}

.stat-name {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--ink-2);
}

.series-grid,
.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 340px), 1fr));
  gap: 0 16px;
}

.payouts {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.payouts li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.rates {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.rate-head {
  display: flex;
  justify-content: space-between;
  font-weight: 600;
}

.rate-track {
  height: 8px;
  border-radius: 99px;
  background: var(--surface-2);
  overflow: hidden;
  margin: 4px 0;
}

.rate-bar {
  height: 100%;
  background: var(--felt);
  border-radius: 99px;
}

.rate-foot {
  font-size: 0.82rem;
}

.rate-plain {
  display: grid;
  grid-template-columns: 1fr auto 1fr auto;
  gap: 4px 10px;
  font-size: 0.92rem;
}

.hist {
  margin: 0;
}

.hist-svg {
  width: 100%;
  height: 140px;
  display: block;
}

.hist-bar {
  fill: var(--felt);
}

.hist-col:hover .hist-bar {
  fill: var(--accent);
}

.hist-labels {
  display: grid;
  grid-template-columns: repeat(10, minmax(0, 1fr));
  gap: 2px;
  font-size: 0.62rem;
  text-align: center;
  margin-top: 4px;
}

.hist-label {
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow-wrap: anywhere;
}

.hist-count {
  font-size: 0.78rem;
}

/* --------------------------------------------------------- animation */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes pop {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
}

@keyframes flip {
  from {
    opacity: 0;
    transform: rotateY(90deg);
  }
}

@keyframes pulse {
  50% {
    opacity: 0.35;
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

/* -------------------------------------------------------- responsive */

/* ------------------------------------------------------- developers */

.doc {
  max-width: 860px;
  min-width: 0;
  line-height: 1.6;
}

.doc h1 {
  margin: 0 0 12px;
}

.doc h2 {
  margin: 28px 0 8px;
  font-size: 1.2rem;
}

.doc h3 {
  margin: 20px 0 6px;
  font-size: 1.05rem;
}

.doc p,
.doc-list {
  margin: 0 0 12px;
}

.doc-list {
  padding-left: 1.4em;
}

.doc-list li + li {
  margin-top: 4px;
}

.doc-note {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--info-soft);
}

.code-inline {
  padding: 1px 5px;
  border-radius: 5px;
  background: var(--surface-2);
  overflow-wrap: anywhere;
  word-break: normal;
}

.code-block {
  margin: 0 0 14px;
  padding: 12px 14px;
  max-width: 100%;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  white-space: pre;
  word-break: normal;
  line-height: 1.5;
  tab-size: 4;
}

.code-block:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.doc-files {
  display: grid;
  gap: 8px;
  margin: 0 0 16px;
  padding: 0;
  list-style: none;
}

.doc-files li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 10px;
  min-width: 0;
}

.doc-example summary {
  cursor: pointer;
  margin-bottom: 8px;
  font-weight: 600;
}

@media (max-width: 1080px) {
  .live-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 760px) {
  body {
    font-size: 14px;
  }

  h1 {
    font-size: 1.3rem;
  }

  .page {
    padding: 14px 12px 32px;
  }

  .topbar-inner {
    padding: 0 12px;
    gap: 8px;
  }

  .nav-link {
    padding: 6px 8px;
  }

  .head-links {
    margin-left: 0;
  }

  /* the table becomes a stack: the felt on top, seats in a grid */
  .board {
    height: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .felt {
    position: relative;
    inset: auto;
    grid-column: 1 / -1;
    border-radius: 22px;
    min-height: 150px;
    padding: 16px 8px;
  }

  .center {
    padding: 0;
  }

  .seat {
    position: relative;
    left: auto;
    top: auto;
    transform: none;
    width: auto;
    min-width: 0;
  }

  .board-limit {
    position: static;
    grid-column: 1 / -1;
    text-align: right;
  }

  .bid-large {
    font-size: 1.7rem;
  }

  .die-md {
    width: 22px;
    height: 22px;
  }

  .move {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas: "who time" "what what" "msg msg";
  }

  .elapsed-track {
    width: 40px;
  }

  .button-ctl {
    min-width: 0;
    flex: 1 1 auto;
  }

  .hist-labels {
    font-size: 0.55rem;
  }

  .rate-plain {
    grid-template-columns: 1fr auto;
  }
}

/* --------------------------------------------- long names and table names */

h1,
h2,
.card-title,
.stat-value,
.banner,
.result-summary,
.result-line,
.result-delta,
.center > *,
.step-event,
.check,
.head-meta > * {
  overflow-wrap: anywhere;
  min-width: 0;
  max-width: 100%;
}

kbd {
  font-family: var(--mono);
  font-size: 0.85em;
  padding: 0 4px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
}

.center {
  min-width: 0;
  width: 100%;
}

.data .player-link,
.data .series-link,
.delta-name,
.chat-who,
.name-col {
  display: inline-block;
  max-width: 12em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.live-side .data .player-link,
.standings .player-link {
  max-width: 8.5em;
}

/* the standings in the narrow side panel: every column fits, no scrolling */
.data.compact th,
.data.compact td {
  padding: 6px 4px;
}

.data.compact th {
  letter-spacing: 0;
}

.data.compact th:first-child,
.data.compact td:first-child {
  padding-left: 8px;
}

/* the name takes what the numbers leave and is cut there, so the table
   never needs more than its panel, whatever the names and values */
.data.compact td.name-cell {
  width: 100%;
  max-width: 0;
}

.data.compact td.name-cell .player-link {
  display: block;
  max-width: none;
}

.data td.placements {
  white-space: normal;
  min-width: 12em;
}

.data td.placements .user-text {
  display: inline-block;
  max-width: 10em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

/* text from players is its own bidi paragraph: right-to-left names and chat
   never reorder the numbers and labels around them */
.user-text {
  unicode-bidi: isolate;
}

.chip .user-text {
  vertical-align: bottom;
}

.pager {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.lobby-more {
  margin-top: 12px;
}

.check-neutral {
  color: var(--ink-2);
}

.check-reason {
  grid-column: 2;
  color: var(--danger);
  font-weight: 600;
}

.summary-slot:empty {
  display: none;
}

[hidden] {
  display: none !important;
}

@media (max-width: 760px) {
  .data .player-link,
  .data .series-link,
  .name-col {
    max-width: 9em;
  }
}

/* three nav links and the brand do not fit a phone: the brand keeps its mark */
@media (max-width: 480px) {
  .brand span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
  }

  .nav {
    gap: 2px;
  }

  .nav-link {
    padding: 6px 7px;
  }
}
