/* Arena styles. The design tokens, .site-header, .play-button, .timeline-input,
   .speed-control, .text-button, and .empty-state all come from ../../styles.css;
   only the arena-specific layout lives here. */

.arena-page {
  padding-bottom: 32px;
}

/* The page paints a 48px rule grid behind everything, and a bare strip lets one
   of those rules cut straight through the tab labels. An opaque strip hides the
   rule, and symmetric padding centres the pills inside it. */
.arena-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  background: var(--canvas);
  padding: 12px 0;
}

.arena-tab {
  border: 1px solid transparent;
  border-radius: 999px;
  background: none;
  padding: 6px 16px;
  color: var(--muted);
  font-size: 0.9rem;
  cursor: pointer;
}

.arena-tab:hover {
  color: var(--ink);
}

.arena-tab[aria-current="page"] {
  border-color: var(--line-strong);
  background: var(--surface-strong);
  color: var(--ink);
}

.arena-panel[hidden] {
  display: none;
}

/* --- Voting ------------------------------------------------------------- */

.arena-case-bar {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.arena-case-title {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 600;
}

.arena-progress {
  margin: 0;
  color: var(--faint);
  font-size: 0.84rem;
  font-variant-numeric: tabular-nums;
}

.arena-stage {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}

.arena-slot {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 10px;
  box-shadow: var(--shadow);
}

.arena-slot.is-reference {
  border-color: var(--line-strong);
  background: var(--surface-strong);
}

.arena-slot figcaption {
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.arena-frame {
  overflow: hidden;
  border-radius: var(--radius-small);
  background: var(--empty);
  aspect-ratio: 16 / 9;
}

.arena-frame video {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.arena-transport {
  margin: 16px 0 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 14px;
}

.speed-control {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 0.84rem;
}

.speed-control select {
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  background: var(--surface-strong);
  padding: 4px 8px;
  font-size: 0.86rem;
}

.arena-questions {
  display: grid;
  gap: 10px;
}

.arena-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  padding: 12px 16px;
}

.arena-question-text {
  display: grid;
  gap: 2px;
}

.arena-question-text strong {
  font-size: 1.0rem;
}

.arena-question-text span {
  color: var(--faint);
  font-size: 0.85rem;
}

.arena-choices {
  display: flex;
  gap: 8px;
}

.arena-choice {
  display: flex;
  align-items: center;
  min-width: 116px;
  justify-content: center;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-small);
  background: var(--surface-strong);
  padding: 8px 14px;
  font-size: 0.9rem;
  cursor: pointer;
}

.arena-choice:hover {
  border-color: var(--ink);
}

.arena-choice.is-chosen {
  border-color: var(--ink);
  background: var(--ink);
  color: #fff;
}

.arena-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 16px;
  margin-top: 18px;
}

.arena-message {
  margin: 0 auto 0 0;
  color: var(--muted);
  font-size: 0.87rem;
}

.arena-submit {
  display: flex;
  align-items: center;
  border: 0;
  border-radius: var(--radius-small);
  background: var(--ink);
  padding: 10px 22px;
  color: #fff;
  font-size: 0.95rem;
  cursor: pointer;
}

.arena-submit:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

/* --- Leaderboard -------------------------------------------------------- */

.arena-board-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.arena-segment {
  display: flex;
  gap: 2px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  padding: 3px;
}

.arena-segment-button {
  border: 0;
  border-radius: 999px;
  background: none;
  padding: 5px 14px;
  color: var(--muted);
  font-size: 0.87rem;
  cursor: pointer;
}

.arena-segment-button.is-active {
  background: var(--ink);
  color: #fff;
}

.arena-board-summary {
  margin: 0 0 16px;
  color: var(--muted);
  font-size: 0.87rem;
  font-variant-numeric: tabular-nums;
}

.arena-board-tables {
  display: grid;
  gap: 26px;
}

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

.arena-table caption {
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 0.84rem;
  text-align: left;
}

.arena-table th,
.arena-table td {
  border-bottom: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
}

.arena-table thead th {
  color: var(--faint);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.arena-rank {
  color: var(--faint);
  font-variant-numeric: tabular-nums;
}

.arena-number {
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.arena-elo {
  font-weight: 600;
}

.arena-muted {
  color: var(--muted);
}

.arena-matrix-scroll {
  overflow-x: auto;
}

.arena-matrix {
  width: auto;
}

.arena-matrix th,
.arena-matrix td {
  border: 1px solid var(--line);
  text-align: center;
}

.arena-matrix thead th span {
  display: inline-block;
  width: 98px;
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.35;
  white-space: normal;
}

.arena-matrix tbody th {
  white-space: nowrap;
  padding-right: 14px;
  background: var(--surface);
  font-size: 0.82rem;
  font-weight: 600;
  text-align: right;
}

.arena-cell {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
}

.arena-cell small {
  display: block;
  font-size: 0.7rem;
  font-weight: 400;
  opacity: 0.7;
}

/* A rate from a handful of comparisons is noise, so it stays visible but
   clearly does not carry the same weight as a filled cell. */
.arena-cell.is-sparse {
  opacity: 0.34;
}

.arena-cell-self {
  background: repeating-linear-gradient(
    45deg,
    var(--surface),
    var(--surface) 4px,
    var(--canvas) 4px,
    var(--canvas) 8px
  );
}

.arena-cell-empty {
  background: var(--surface);
  color: var(--faint);
}

@media (max-width: 900px) {
  .arena-stage {
    grid-template-columns: 1fr;
  }

  .arena-question {
    align-items: stretch;
    flex-direction: column;
  }

  .arena-choices {
    justify-content: stretch;
  }

  .arena-choice {
    flex: 1;
    min-width: 0;
  }
}
