/* Decision Arena shares the Foundation Studio's dark horizon and warm glass theme. */
@font-face { font-family: "Geist"; src: url("/assets/fonts/Geist-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }
@font-face { font-family: "Geist Mono"; src: url("/assets/fonts/GeistMono-Variable.woff2") format("woff2"); font-weight: 100 900; font-display: swap; }

:root {
  color-scheme: dark;
  --bg: #0b0910;
  --bg-subtle: rgba(255,255,255,.045);
  --ink: #f3eee8;
  --ink-2: #d9d2dc;
  --ink-3: #a9a1b2;
  --line: rgba(255,255,255,.10);
  --line-strong: rgba(255,255,255,.20);
  --accent: #f2b47a;
  --accent-strong: #f6c99d;
  --accent-bright: #ec8a5a;
  --grad: linear-gradient(92deg,#f6d1a4 0%,#f0a46c 45%,#e97a5c 80%,#e2657c 100%);
  --well: #100d17;
  --grid: rgba(255,255,255,.055);
  --mono: "Geist Mono",ui-monospace,SFMono-Regular,Menlo,monospace;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --board-width: clamp(232px, min(23vw, calc((100dvh - 352px) / 2)), 336px);
  --gap: clamp(28px, 6vw, 96px);
  font-family: "Geist",ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;
  font-optical-sizing: auto;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html,
body { min-width: 320px; min-height: 100%; }

body {
  margin: 0;
  color: var(--ink);
  background: radial-gradient(1000px 600px at 70% 15%,rgba(164,84,110,.09),transparent 60%),var(--bg);
  letter-spacing: -0.006em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body.has-pk-summary { overflow: hidden; }

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

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

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  border-bottom: 1px solid var(--line);
  background: rgba(11,9,16,.75);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
}

.topbar__inner {
  display: flex;
  align-items: center;
  gap: 24px;
  max-width: 1240px;
  height: 56px;
  margin: 0 auto;
  padding: 0 clamp(18px, 4vw, 48px);
}

.brand { display: flex; align-items: center; gap: 14px; color: var(--ink); text-decoration: none; }
.brand__logo { display: block; width: auto; height: 24px; }
.brand__rule { width: 1px; height: 20px; background: var(--line-strong); }
.brand__name { font-size: 15px; font-weight: 600; letter-spacing: -0.015em; }
.topbar__links { display: flex; gap: 26px; margin-left: auto; }
.topbar__links a { color: var(--ink-2); font-size: 13.5px; font-weight: 500; text-decoration: none; }
.topbar__links a:hover,
.topbar__links a[aria-current="page"] { color: var(--ink); }

.page {
  width: min(1240px, 100%);
  margin: 0 auto;
  padding: clamp(22px, 3.4vh, 40px) clamp(18px, 4vw, 48px) 0;
}

.toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px 40px;
  padding-bottom: clamp(18px, 2.6vh, 28px);
  border-bottom: 1px solid var(--line);
}

.wordmark { min-width: 0; }

.wordmark__eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 13px;
  font-weight: 600;
}

.wordmark h1 {
  margin: 0;
  font-size: clamp(30px, 3.4vw, 44px);
  font-weight: 650;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.wordmark__lede {
  max-width: 34em;
  margin: 8px 0 0;
  color: var(--ink-3);
  font-size: 15px;
  line-height: 1.45;
}

.controls {
  display: flex;
  min-width: 0;
  align-items: flex-end;
  justify-content: flex-end;
  gap: 10px;
}

.control { position: relative; display: grid; min-width: 0; gap: 6px; }

.control > span {
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.control--model { width: 11.5rem; }
.control--steps { width: 7.2rem; }
.control--steps.is-survival { width: 15.5rem; }
.control--custom { width: 5.2rem; }
.control--seed { width: 4.8rem; }

.control input,
.control select,
.start { height: 40px; border-radius: 11px; }

.control input,
.control select {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  outline: none;
  color: var(--ink);
  background-color: #17131f;
  font-size: 13.5px;
  font-weight: 500;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.control.control--model select,
.control.control--model select:disabled { color: transparent; }
.control--model select option { color: var(--ink); }
.control__selection {
  position: absolute;
  bottom: 0;
  left: 12px;
  display: flex;
  width: calc(100% - 44px);
  height: 40px;
  align-items: center;
  overflow: hidden;
  color: var(--ink);
  font-size: 13.5px;
  font-weight: 500;
  pointer-events: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.control--model select:disabled + .control__selection { color: var(--ink-3); }

.control select {
  appearance: none;
  padding: 0 32px 0 12px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='m1.5 1.5 4.5 4.5 4.5-4.5' fill='none' stroke='%23a9a1b2' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-position: right 12px center;
  background-repeat: no-repeat;
  cursor: pointer;
}

.control select:hover,
.control input:hover { border-color: var(--line-strong); }
.control select:disabled,
.control input:disabled { color: var(--ink-3); background-color: var(--bg-subtle); cursor: not-allowed; }
.control input { padding: 0 12px; font-variant-numeric: tabular-nums; }

.control input:focus,
.control select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px rgba(242,180,122,.12);
}

.versus {
  display: grid;
  height: 40px;
  place-items: center;
  color: var(--ink-3);
  font-size: 12px;
  font-weight: 600;
}

.start {
  min-width: 108px;
  padding: 0 18px;
  border: 0;
  border-radius: 999px;
  color: #1d1420;
  background: var(--grad);
  box-shadow: 0 8px 26px rgba(236,138,90,.22);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s var(--ease), transform 0.2s var(--ease);
}

.start:hover:not(:disabled) { filter: brightness(1.08); box-shadow: 0 10px 32px rgba(236,138,90,.3); }
.start:active:not(:disabled) { transform: scale(0.98); }
.start:disabled { color: var(--ink-3); background: var(--bg-subtle); box-shadow: none; cursor: not-allowed; }

.arena {
  position: relative;
  display: grid;
  grid-template-columns: var(--board-width) clamp(36px, 5vw, 64px) var(--board-width);
  align-items: center;
  justify-content: center;
  gap: calc(var(--gap) / 2);
  padding-top: clamp(18px, 2.8vh, 30px);
}

.player { width: var(--board-width); min-width: 0; }

.player__header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: baseline;
  gap: 12px;
  padding: 0 2px 10px;
}

.player__header h2 {
  overflow: hidden;
  margin: 0;
  font-size: clamp(17px, 1.5vw, 21px);
  font-weight: 650;
  letter-spacing: -0.02em;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.player__header output {
  color: var(--ink-3);
  font-size: 13px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.board-shell {
  position: relative;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: #17131f;
  background: linear-gradient(180deg,rgba(255,255,255,.045),rgba(255,255,255,.025));
  box-shadow: 0 1px 0 rgba(255,255,255,.045) inset,0 22px 48px rgba(0,0,0,.35);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.board-shell::after {
  position: absolute;
  z-index: 3;
  inset: -1px;
  border: 2px solid var(--accent-bright);
  border-radius: 18px;
  box-shadow: 0 0 0 4px rgba(242,180,122,.16), 0 0 28px rgba(242,180,122,.28);
  content: "";
  opacity: 0;
  pointer-events: none;
}

.board-shell.is-clearing { animation: frame-halo 560ms var(--ease) both; }
.board-shell.is-clearing::after { animation: border-bloom 560ms var(--ease) both; }

.board {
  display: grid;
  width: 100%;
  aspect-ratio: 1 / 2;
  grid-template-columns: repeat(10, 1fr);
  grid-template-rows: repeat(20, 1fr);
  gap: 1px;
  overflow: hidden;
  border-radius: 11px;
  background:
    linear-gradient(var(--grid) 1px, transparent 1px) 0 -1px / 10% 5%,
    linear-gradient(90deg, var(--grid) 1px, transparent 1px) -1px 0 / 10% 5%,
    var(--well);
}

.cell {
  min-width: 0;
  min-height: 0;
  border-radius: 3px;
  transition: background-color 0.4s var(--ease), box-shadow 0.4s var(--ease);
}

.cell[data-piece]:not([data-piece="."]) {
  background: var(--piece-color);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), inset 0 -1px 0 rgba(0, 0, 0, 0.18);
}

/* Monochrome stack; the model's latest placement is the one accent. */
.cell[data-piece="I"] { --piece-color: #777779; }
.cell[data-piece="O"] { --piece-color: #929296; }
.cell[data-piece="T"] { --piece-color: #858589; }
.cell[data-piece="S"] { --piece-color: #aaaab0; }
.cell[data-piece="Z"] { --piece-color: #9c9ca0; }
.cell[data-piece="J"] { --piece-color: #646468; }
.cell[data-piece="L"] { --piece-color: #bcbcc2; }

.cell[data-fresh]:not([data-piece="."]) {
  background: var(--accent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), 0 0 12px rgba(242,180,122,.45);
  transition-duration: 0.12s;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  margin-top: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.metrics p {
  display: grid;
  gap: 2px;
  margin: 0;
  padding: 8px 12px;
}

.metrics p + p { border-left: 1px solid var(--line); }
.metrics span { color: var(--ink-3); font-size: 10.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.metrics strong { font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; }

.arena__divider { display: grid; height: 100%; place-items: center; }

.arena__divider::before {
  width: 1px;
  height: 46%;
  background: linear-gradient(transparent, var(--line-strong), transparent);
  content: "";
  grid-area: 1 / 1;
}

.arena__divider span {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink-3);
  background: #17131f;
  box-shadow: 0 6px 18px rgba(16, 16, 20, 0.06);
  font-size: 12px;
  font-weight: 600;
  grid-area: 1 / 1;
}

.finish-card {
  position: absolute;
  z-index: 4;
  inset: 8px;
  display: grid;
  place-content: center;
  justify-items: center;
  border-radius: 11px;
  background: rgba(17,13,23,.86);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  animation: finish-in 320ms var(--ease) both;
}

.finish-card > span {
  margin-bottom: 6px;
  color: var(--ink-3);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.finish-card > strong {
  font-size: clamp(44px, 5vw, 68px);
  font-weight: 650;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.05em;
  line-height: 1;
}

.finish-card__score-label {
  margin-top: 4px;
  color: var(--ink-3);
  font-size: 11px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.finish-card__metrics { display: flex; gap: 28px; margin-top: 18px; }
.finish-card__metrics p { display: grid; justify-items: center; gap: 2px; margin: 0; }
.finish-card__metrics b { font-size: 19px; font-weight: 600; font-variant-numeric: tabular-nums; }
.finish-card__metrics small { color: var(--ink-3); font-size: 10.5px; letter-spacing: 0.05em; text-transform: uppercase; }

.pk-summary {
  position: fixed;
  z-index: 30;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(0,0,0,.55);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.pk-summary__card {
  position: relative;
  width: min(820px, 100%);
  max-height: calc(100dvh - 32px);
  overflow-y: auto;
  padding: clamp(24px, 4vw, 44px);
  border-radius: 26px;
  background: #17131f;
  border: 1px solid var(--line-strong);
  box-shadow: 0 1px 0 rgba(255,255,255,.045) inset,0 32px 80px rgba(0,0,0,.5);
  animation: summary-in 300ms var(--ease) both;
}

.pk-summary__heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.pk-summary__label { color: var(--accent); font-size: 13px; font-weight: 600; }
.pk-summary h2 { margin: 4px 0 0; font-size: clamp(28px, 3vw, 38px); font-weight: 650; letter-spacing: -0.035em; line-height: 1.05; }
.pk-summary__models { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: end; gap: clamp(12px, 3vw, 32px); margin-top: clamp(24px, 4vw, 40px); }
.pk-summary__models div { min-width: 0; }
.pk-summary__models div:last-child { text-align: right; }
.pk-summary__models div span { display: block; margin-bottom: 6px; color: var(--ink-3); font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.pk-summary__models strong { display: block; font-size: clamp(20px, 2.6vw, 30px); font-weight: 650; letter-spacing: -0.025em; line-height: 1.1; overflow-wrap: anywhere; }
.pk-summary__models > span { align-self: center; color: var(--ink-3); font-size: 13px; font-weight: 600; }
.pk-summary__comparisons { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); margin-top: clamp(24px, 4vw, 40px); border-top: 1px solid var(--line); }
.pk-summary__comparison { min-width: 0; padding-top: 22px; }
.pk-summary__comparison + .pk-summary__comparison { padding-left: clamp(20px, 4vw, 40px); border-left: 1px solid var(--line); }
.pk-summary__comparison:first-child { padding-right: clamp(20px, 4vw, 40px); }
.pk-summary__comparison span { display: block; color: var(--ink-3); font-size: 11.5px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; }
.pk-summary__comparison strong { display: block; margin-top: 8px; font-size: clamp(48px, 6vw, 76px); font-variant-numeric: tabular-nums; font-weight: 650; letter-spacing: -0.05em; line-height: 1; white-space: nowrap; }
.pk-summary__comparison--speed strong { color: var(--accent); }
.pk-summary__comparison.is-long strong { font-size: clamp(36px, 4.6vw, 58px); }
.pk-summary__comparison p { margin: 10px 0 0; color: var(--ink-2); font-size: clamp(15px, 1.6vw, 18px); font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.pk-summary__outcome { margin: 24px 0 0; padding-top: 18px; border-top: 1px solid var(--line); color: var(--ink); font-size: clamp(15px, 1.8vw, 19px); font-weight: 600; line-height: 1.4; }

.summary-close {
  flex: none;
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  color: var(--ink-3);
  background: var(--bg-subtle);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s, color 0.2s;
}

.summary-close:hover { color: var(--ink); background: rgba(255,255,255,.10); }

.status { min-height: 1.4em; margin: 18px 0 0; color: var(--ink-3); font-size: 13px; text-align: center; }

.footer { margin-top: clamp(32px, 5vh, 64px); border-top: 1px solid var(--line); background: var(--bg-subtle); }

.footer__inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px 32px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 24px clamp(18px, 4vw, 48px) 28px;
}

.footer__brand img { display: block; width: auto; height: 26px; }
.footer__links { display: flex; flex-wrap: wrap; gap: 10px 24px; }
.footer__links a { color: var(--ink-2); font-size: 13px; text-decoration: none; }
.footer__links a:hover { color: var(--ink); }

@keyframes finish-in {
  from { opacity: 0; transform: scale(0.97); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes border-bloom {
  0%, 100% { opacity: 0; }
  10% { opacity: 1; }
  55% { opacity: 0.55; }
}

@keyframes frame-halo {
  0%, 100% { transform: scale(1); }
  12% { transform: scale(1.006); }
}

@keyframes summary-in {
  from { opacity: 0; transform: translateY(14px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Foundation Studio typography and horizon. */
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; -webkit-text-fill-color: transparent; }
body::before { content: ""; position: absolute; z-index: -1; inset: 52px 0 auto; height: 540px; background: linear-gradient(180deg,rgba(11,9,16,.62),var(--bg)),url("/assets/hero-interstellar.png") center 78% / cover no-repeat; pointer-events: none; }
.skip-link { position: absolute; top: -60px; left: 16px; z-index: 100; padding: 10px 14px; border-radius: 8px; background: var(--accent); color: #1d1420; text-decoration: none; font-size: 13px; }
.skip-link:focus { top: 8px; }
.topbar__inner { height: 60px; }
.brand { gap: 10px; }
.brand__logo { width: 30px; height: 30px; }
.brand__name { font-size: 19px; font-weight: 650; letter-spacing: -.02em; }
.studio-tag { padding: 4px 6px; border: 1px solid var(--line-strong); border-radius: 4px; color: var(--ink-3); font: 500 9px var(--mono); letter-spacing: .22em; }
.wordmark__eyebrow { margin-bottom: 10px; font: 500 10px/1.5 var(--mono); letter-spacing: .2em; text-transform: uppercase; }
.wordmark h1 { font-weight: 700; }
.control > span,.player__header output,.metrics span,.finish-card > span,.finish-card__score-label,.finish-card__metrics small,.pk-summary__label,.pk-summary__comparison span { font-family: var(--mono); font-size: 10px; letter-spacing: .08em; }
.control input,.control select { box-shadow: 0 1px 0 rgba(255,255,255,.035) inset; }
.control--model select option { background: #17131f; }
.metrics { background: rgba(255,255,255,.025); }
.footer__brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 600; font-size: 14px; }
.footer__brand img { width: 142px; height: auto; }
.status { font: 400 11px/1.6 var(--mono); }

@media (max-width: 1100px) {
  .toolbar { align-items: flex-start; flex-direction: column; }
  .controls { width: 100%; flex-wrap: wrap; justify-content: flex-start; }
  .control--model { flex: 1 1 11rem; }
  :root { --board-width: clamp(220px, min(36vw, calc((100dvh - 430px) / 2)), 320px); }
}

@media (max-width: 680px) {
  :root { --board-width: calc((100vw - 48px) / 2); }
  .topbar__inner { height: 52px; }
  .brand { gap: 10px; }
  .brand__logo { width: 26px; height: 26px; }
  .studio-tag { display: none; }
  .brand__rule { height: 16px; }
  .brand__name { font-size: 14px; }
  .topbar__links { gap: 18px; }
  .wordmark h1 { font-size: 30px; }
  .wordmark__lede { font-size: 14px; }
  .controls { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .versus { display: none; }
  .control--model,
  .control--steps,
  .control--custom,
  .control--seed,
  .control--steps.is-survival { width: auto; }
  .start { grid-column: 1 / -1; width: 100%; }
  .arena { grid-template-columns: var(--board-width) var(--board-width); gap: 12px; }
  .arena__divider { display: none; }
  .player__header { padding-bottom: 8px; }
  .player__header h2 { font-size: 15px; }
  .player__header output { font-size: 11.5px; }
  .board-shell { padding: 5px; border-radius: 14px; }
  .board-shell::after { border-radius: 14px; }
  .board { border-radius: 9px; }
  .cell { border-radius: 2px; }
  .finish-card { inset: 5px; }
  .finish-card > strong { font-size: 36px; }
  .finish-card__metrics { gap: 16px; margin-top: 12px; }
  .finish-card__metrics b { font-size: 15px; }
  .metrics { margin-top: 8px; border-radius: 10px; }
  .metrics p { padding: 6px 8px; }
  .metrics span { font-size: 9px; }
  .metrics strong { font-size: 13.5px; }
  .footer__inner { flex-direction: column; align-items: flex-start; }
  .pk-summary__card { padding: 22px; border-radius: 22px; }
  .pk-summary__models { gap: 8px; }
  .pk-summary__models strong { font-size: clamp(17px, 5vw, 22px); }
  .pk-summary__comparisons { grid-template-columns: 1fr; }
  .pk-summary__comparison:first-child { padding-right: 0; }
  .pk-summary__comparison + .pk-summary__comparison { margin-top: 18px; padding-left: 0; border-top: 1px solid var(--line); border-left: 0; }
  .pk-summary__comparison strong { font-size: clamp(44px, 13vw, 60px); }
  .pk-summary__comparison.is-long strong { font-size: clamp(34px, 10vw, 48px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: 1ms !important; transition-duration: 1ms !important; }
}

/* Archive notice: this Arena replays recorded races and points to Decision 3.0. */
.archive-notice { position: relative; z-index: 60; padding: 10px 24px; border-bottom: 1px solid var(--line); background: linear-gradient(90deg, rgba(255, 138, 76, .16), rgba(150, 110, 255, .16)); color: var(--ink); font-size: 13.5px; line-height: 1.55; text-align: center; }
.archive-notice p { max-width: 1200px; margin: 0 auto; }
.archive-notice a { color: var(--accent); font-weight: 600; text-underline-offset: 2px; }
