:root {
  color-scheme: light;
  --bg: #f6f1e7;
  --bg-accent: #efe4d1;
  --panel: rgba(255, 252, 246, 0.88);
  --panel-strong: #fffaf0;
  --line: rgba(51, 37, 17, 0.12);
  --line-strong: rgba(51, 37, 17, 0.24);
  --text: #23180c;
  --muted: #6b5a47;
  --accent: #a24521;
  --accent-strong: #7d2f12;
  --accent-soft: rgba(162, 69, 33, 0.12);
  --good: #0f766e;
  --good-soft: rgba(15, 118, 110, 0.12);
  --warning: #9a6700;
  --warning-soft: rgba(154, 103, 0, 0.12);
  --shadow: 0 20px 60px rgba(63, 45, 20, 0.08);
  --radius-lg: 28px;
  --radius-md: 20px;
  --radius-sm: 14px;
  --content: min(1480px, calc(100vw - 32px));
}

@view-transition {
  navigation: auto;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

body {
  font-family: "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(162, 69, 33, 0.14), transparent 26%),
    radial-gradient(circle at bottom right, rgba(15, 118, 110, 0.1), transparent 22%),
    linear-gradient(180deg, var(--bg), var(--bg-accent));
}

@keyframes arena-view-out {
  from {
    opacity: 1;
  }

  to {
    opacity: 0;
  }
}

@keyframes arena-view-in {
  from {
    opacity: 0;
  }

  to {
    opacity: 1;
  }
}

@keyframes arena-title-old {
  from {
    opacity: 1;
    transform: translateX(0);
  }

  to {
    opacity: 0;
    transform: translateX(-14px);
  }
}

@keyframes arena-title-new {
  from {
    opacity: 0;
    transform: translateX(14px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (prefers-reduced-motion: no-preference) {
  ::view-transition-group(root) {
    animation-duration: 240ms;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }

  ::view-transition-old(root),
  ::view-transition-new(root) {
    mix-blend-mode: normal;
    height: 100%;
    overflow: clip;
  }

  ::view-transition-old(root) {
    animation: 140ms linear both arena-view-out;
  }

  ::view-transition-new(root) {
    animation: 180ms 20ms linear both arena-view-in;
  }

  ::view-transition-group(page-title) {
    animation-duration: 220ms;
    animation-timing-function: cubic-bezier(0.22, 1, 0.36, 1);
  }

  ::view-transition-old(page-title),
  ::view-transition-new(page-title) {
    mix-blend-mode: normal;
    height: auto;
    width: fit-content;
    transform-origin: left center;
  }

  ::view-transition-old(page-title) {
    animation: 170ms cubic-bezier(0.33, 0, 0.2, 1) both arena-title-old;
  }

  ::view-transition-new(page-title) {
    animation: 240ms 38ms cubic-bezier(0.22, 1, 0.36, 1) both arena-title-new;
  }
}

@media (prefers-reduced-motion: reduce) {
  ::view-transition-old(root),
  ::view-transition-new(root) {
    animation: none;
  }
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font: inherit;
}

.shell {
  width: var(--content);
  margin: 0 auto;
  padding: 28px 0 40px;
}

.arena-shell {
  width: min(1800px, calc(100vw - 24px));
}

.page-header {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: end;
  margin-bottom: 20px;
}

.page-header.compact {
  align-items: center;
}

.page-header h1,
.panel-head h2 {
  margin: 4px 0 0;
  font-size: clamp(2rem, 4vw, 3.2rem);
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.page-header h1 {
  view-transition-name: page-title;
}

.panel-head h2 {
  font-size: clamp(1.3rem, 2.2vw, 2rem);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--muted);
  font-size: 0.72rem;
}

.lede,
.status-line,
.meta-note {
  margin: 12px 0 0;
  color: var(--muted);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  line-height: 1.5;
}

.page-main {
  display: grid;
  gap: 18px;
}

.page-footer {
  margin-top: 18px;
  color: var(--muted);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 0.88rem;
}

.panel {
  border: 1px solid var(--line);
  background: var(--panel);
  backdrop-filter: blur(12px);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 24px;
}

.panel-tight {
  padding: 20px 24px;
}

.panel-head,
.preview-head {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
}

.header-nav,
.meta-chips {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.lang-switch {
  display: inline-flex;
  gap: 8px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.42);
}

.lang-button {
  min-width: 60px;
  min-height: 38px;
  padding-inline: 12px;
}

.lang-button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff7f1;
}

.ghost-link,
.ghost-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 10px 14px;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.48);
  cursor: pointer;
}

.ghost-link:hover,
.ghost-button:hover {
  border-color: var(--accent);
}

.icon {
  display: inline-block;
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  vertical-align: -0.15em;
}

.icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.icon-button {
  padding: 0;
  width: 42px;
  min-height: 42px;
}

.icon-button .icon {
  width: 18px;
  height: 18px;
}

.has-tooltip {
  position: relative;
}

.has-tooltip::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 10px);
  transform: translate(-50%, 6px);
  padding: 7px 10px;
  border-radius: 12px;
  border: 1px solid rgba(35, 24, 12, 0.14);
  background: rgba(35, 24, 12, 0.94);
  color: #fff7f1;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 0.78rem;
  line-height: 1;
  white-space: nowrap;
  box-shadow: 0 14px 28px rgba(35, 24, 12, 0.18);
  opacity: 0;
  pointer-events: none;
  transition:
    opacity 140ms ease,
    transform 140ms ease;
  z-index: 20;
}

.has-tooltip:hover::after,
.has-tooltip:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.inline-help-group,
.meta-inline {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.meta-inline .eyebrow,
.readme-head .eyebrow {
  margin: 0;
}

.vote-with-help {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
}

.vote-with-help .vote-button {
  width: 100%;
}

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

.status-row .status-line {
  margin-top: 0;
}

.help-tip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  padding: 0;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.62);
  color: var(--muted);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: help;
}

.help-tip:hover,
.help-tip:focus-visible {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.help-tip::after {
  min-width: 220px;
  max-width: min(340px, calc(100vw - 32px));
  white-space: normal;
  line-height: 1.35;
  text-align: left;
}

th .help-tip,
.summary-card .help-tip,
.readme-head .help-tip {
  vertical-align: middle;
}

.leaderboard-table th {
  position: relative;
  overflow: visible;
}

.leaderboard-table th .help-tip::after {
  top: calc(100% + 10px);
  bottom: auto;
  transform: translate(-50%, -6px);
}

.leaderboard-table th .help-tip:hover::after,
.leaderboard-table th .help-tip:focus-visible::after {
  transform: translate(-50%, 0);
}

.status-row .help-tip::after,
.vote-with-help .help-tip::after {
  left: auto;
  right: 0;
  transform: translate(0, 6px);
}

.status-row .help-tip:hover::after,
.status-row .help-tip:focus-visible::after,
.vote-with-help .help-tip:hover::after,
.vote-with-help .help-tip:focus-visible::after {
  transform: translate(0, 0);
}

.benchmark-grid,
.summary-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  margin-top: 18px;
}

.benchmark-card,
.summary-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  padding: 18px;
  background: var(--panel-strong);
}

.benchmark-card h3,
.summary-card h3 {
  margin: 0;
  font-size: 1.2rem;
}

.benchmark-card p,
.summary-card p,
.run-meta p {
  margin: 8px 0 0;
  color: var(--muted);
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  line-height: 1.45;
}

.benchmark-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.primary-link,
.secondary-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 16px;
  border-radius: 999px;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

.primary-link {
  background: var(--accent);
  color: #fff7f1;
}

.secondary-link {
  background: var(--accent-soft);
  color: var(--accent-strong);
}

.comparison-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.comparison-stage {
  width: 100vw;
  margin-left: calc(50% - 50vw);
  padding-inline: 12px;
}

body[data-page="arena"][data-layout="vertical"] .comparison-stage {
  grid-template-columns: 1fr;
  width: min(1120px, 100%);
  margin-left: auto;
  margin-right: auto;
  padding-inline: 0;
}

.preview-panel {
  padding: 18px;
}

.preview-badge,
.chip,
.pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  font-size: 0.84rem;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
}

.preview-viewport {
  display: block;
  width: min(100%, calc(54vh * 16 / 9));
  aspect-ratio: 16 / 9;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  margin: 16px auto 0;
  background: white;
}

.preview-frame {
  display: block;
  width: calc(100% / 0.6);
  height: calc(100% / 0.6);
  min-height: 0;
  border: 0;
  transform: scale(0.6);
  transform-origin: top left;
  background: white;
}

.preview-viewport .preview-frame {
  max-width: none;
  max-height: none;
}

.layout-toggle {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.42);
}

.toggle-button {
  padding: 0;
  width: 38px;
  min-height: 38px;
}

.toggle-button .icon {
  width: 18px;
  height: 18px;
}

.toggle-button.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff7f1;
}

.vote-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
}

.vote-button {
  min-height: 50px;
  border-radius: 16px;
  border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, 0.7);
  cursor: pointer;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
}

.vote-button:hover:not(:disabled) {
  border-color: var(--accent);
  transform: translateY(-1px);
}

.vote-button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.vote-strong {
  background: linear-gradient(180deg, #b14f29, #8b3617);
  color: #fff7f1;
}

.vote-subtle {
  background: var(--warning-soft);
  color: var(--warning);
}

.vote-next {
  background: linear-gradient(180deg, #1d8c7d, #0f766e);
  color: #f2fffc;
}

.vote-selected {
  outline: 3px solid rgba(162, 69, 33, 0.2);
}

.hidden {
  display: none;
}

.run-meta {
  display: grid;
  gap: 14px;
}

.skill-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.pill {
  background: var(--good-soft);
  color: var(--good);
  border-color: rgba(15, 118, 110, 0.18);
}

.readme-box {
  padding: 14px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.52);
  white-space: pre-wrap;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  max-height: 280px;
  overflow: auto;
}

.readme-head {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.table-wrap {
  overflow-x: auto;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 920px;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 14px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  vertical-align: top;
}

.leaderboard-table th {
  font-size: 0.82rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.score-cell strong {
  display: block;
  font-size: 1.2rem;
  color: var(--text);
}

.score-cell span {
  color: var(--muted);
  font-size: 0.82rem;
}

.status-good {
  color: var(--good);
}

.status-warn {
  color: var(--warning);
}

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

  .vote-with-help {
    width: 100%;
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 20px, var(--content));
    padding-top: 18px;
  }

  .panel,
  .panel-tight {
    padding: 18px;
  }

  .page-header {
    align-items: start;
    flex-direction: column;
  }

  .page-header h1 {
    font-size: 2.2rem;
  }
}
