:root {
  --seat-red: #e5484d; --seat-blue: #4c8ef7; --seat-white: #ece5dc; --seat-orange: #f5922f; --seat-other: var(--faint);
}

.stats-card { margin-bottom: 1rem; }
.stats-card > .section-title { margin-bottom: 0; }
.stats-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.375rem 0.75rem; }
.stats-name { font-size: 0.9375rem; }
.stats-name b { font-weight: 600; }
.stats-close { margin-left: auto; }
.stats-card > .muted { margin: 0.75rem 0 0; }

.stats-tabs { display: flex; flex-wrap: wrap; gap: 0.25rem; margin: 0.75rem 0; }
.stats-tab {
  min-height: 2rem; padding: 0.25rem 0.75rem; border: 1px solid var(--hairline-strong); border-radius: 4px;
  background: var(--panel-solid); color: var(--muted); font: 500 0.8125rem/1.25 var(--sans); cursor: pointer;
}
.stats-tab:hover { border-color: var(--muted); color: var(--text); }
.stats-tab[aria-selected="true"] { border-color: var(--accent); background: var(--panel-2-solid); color: var(--text); box-shadow: inset 0 -2px 0 var(--accent); }
.stats-body { border-top: 1px solid var(--hairline); }
.stats-body:focus-visible { outline: 2px solid var(--accent-2); outline-offset: -2px; }

.stats-table { overflow-x: auto; }
.stats-subtitle { padding: 0.75rem 1rem 0.25rem; color: var(--muted); font: 500 0.8125rem/1.3 var(--sans); }
.stats-table + .stats-subtitle { border-top: 1px solid var(--hairline); }
.seat-table td { white-space: nowrap; }
table.seat-table th { white-space: normal; vertical-align: bottom; }
.seat-table th:first-child, .seat-table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--bg); }
.seat-table tbody tr:hover td:first-child { background: var(--panel-2-solid); }
.seat-table th[title] { cursor: help; }
.seat-table td.top { color: var(--text); font-weight: 700; }
.seat { display: inline-flex; align-items: center; gap: 0.5rem; }
.swatch { display: inline-block; width: 0.75rem; height: 0.75rem; border-radius: 2px; background: var(--seat-other); box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.35); }
.seat-red { background: var(--seat-red); }
.seat-blue { background: var(--seat-blue); }
.seat-white { background: var(--seat-white); }
.seat-orange { background: var(--seat-orange); }

.dice-table th.dice-cell, .dice-table td.dice-cell { width: 100%; min-width: 5rem; text-align: left; }
.dice-track { position: relative; height: 0.625rem; background: var(--hairline); }
.dice-fill { position: absolute; inset: 0 auto 0 0; background: var(--accent-2); }
@media (max-width: 760px) { table.dice-table th, table.dice-table td { padding-left: 0.5rem; padding-right: 0.5rem; } }
.dice-fair { position: absolute; top: -0.1875rem; bottom: -0.1875rem; width: 2px; margin-left: -1px; background: var(--accent); }

button.stats-open {
  margin-left: 0.375rem; padding: 0 0.375rem; border: 1px solid var(--hairline-strong); border-radius: 4px; background: none;
  color: var(--muted); font: 500 0.75rem/1.4 var(--sans); cursor: pointer;
}
button.stats-open:hover { border-color: var(--muted); color: var(--text); }
button.stats-open.active { border-color: var(--accent); color: var(--text); }
tr.is-open td { box-shadow: inset 0 1px 0 var(--accent), inset 0 -1px 0 var(--accent); }
