@font-face {
  font-family: "Brown";
  src: url("./assets/fonts/BrownLLWeb-Regular.woff2") format("woff2"),
       url("./assets/fonts/BrownLLWeb-Regular.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Brown";
  src: url("./assets/fonts/BrownLLWeb-Bold.woff2") format("woff2"),
       url("./assets/fonts/BrownLLWeb-Bold.woff") format("woff");
  font-weight: 700; font-style: normal; font-display: swap;
}
@font-face {
  font-family: "Autoscape";
  src: url("./assets/fonts/AutoscapeWeb-Regular.woff2") format("woff2"),
       url("./assets/fonts/AutoscapeWeb-Regular.woff") format("woff");
  font-weight: 400; font-style: normal; font-display: swap;
}

:root {
  --bg: #0a0a0b;
  --bg-2: #0d0d0f;
  --bg-3: #141417;
  --ink: #ece5d0;
  --ink-soft: #6a6458;
  --ink-mute: #3a362e;
  --gold: #c9a35a;
  --gold-hi: #e6c075;
  --violet: #a78bfa;
  --line: #1a1a1d;
  --win: #9bb86a;

  /* Chess board */
  --sq-light: #2a2620;
  --sq-dark: #16130f;

  --sans: "Brown", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  --numeric: "Autoscape", "Brown", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.5;
  font-size: 15px;
}
a { color: inherit; }
button { font-family: inherit; background: none; border: 0; color: inherit; cursor: pointer; }
::selection { background: var(--gold); color: #000; }

/* ── Stage ─────────────────────────────────────── */
.stage {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  padding: 28px;
  gap: 28px;
}

.top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}
.mark {
  font-weight: 400;
  font-size: 32px;
  letter-spacing: -.02em;
  margin: 0;
  color: var(--ink);
  line-height: 1;
}
.mark-i { position: relative; display: inline-block; }
.mark-i-dot {
  position: absolute;
  top: .14em;
  left: 50%;
  width: .14em;
  height: .14em;
  transform: translateX(-50%);
  background: var(--gold);
  box-shadow: 0 0 6px currentColor;
  color: var(--gold);
  animation: dotcycle 9s ease-in-out infinite;
}
@keyframes dotcycle {
  0%, 12%    { background: var(--gold);   color: var(--gold); }
  20%, 29%   { background: var(--ink);    color: transparent; }
  37%, 54%   { background: var(--violet); color: var(--violet); }
  62%, 71%   { background: var(--ink);    color: transparent; }
  79%, 96%   { background: var(--win);    color: var(--win); }
  100%       { background: var(--ink);    color: transparent; }
}
.top-meta {
  font-family: var(--numeric);
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: .02em;
}

.bottom { display: flex; justify-content: center; }
.company {
  font-family: var(--numeric);
  font-size: 11px;
  color: var(--ink-mute);
  text-decoration: none;
  letter-spacing: .06em;
  transition: color .2s;
}
.company:hover { color: var(--ink-soft); }

/* ── Cards ─────────────────────────────────────── */
.choice {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  width: 100%;
  max-width: 1500px;
  justify-self: center;
  align-self: stretch;
  border: 1px solid var(--line);
}

.card {
  position: relative;
  display: grid;
  grid-template-columns: minmax(200px, 1fr) minmax(240px, 1fr);
  gap: 36px;
  padding: 32px;
  min-height: 460px;
  text-decoration: none;
  text-align: left;
  color: var(--ink);
  background: var(--bg-2);
  cursor: pointer;
  font-family: inherit;
  width: 100%;
  transition: background .5s ease;
  overflow: hidden;
  isolation: isolate;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background-size: cover;
  background-position: center;
  opacity: .22;
  z-index: 0;
  transition: opacity .6s ease, transform 1.2s cubic-bezier(.2,.7,.2,1);
  will-change: transform, opacity;
}
.card::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
}
.card > * { position: relative; z-index: 2; }
.card:hover::before { opacity: .32; transform: scale(1.04); }

.card--play::before {
  background-image: url("https://images.unsplash.com/photo-1580541832626-2a7131ee809f?auto=format&fit=crop&w=1600&q=80");
  filter: grayscale(.35) contrast(1.05) saturate(1.1);
}
.card--play::after {
  background:
    radial-gradient(ellipse at 75% 40%, rgba(201,163,90,.18), transparent 55%),
    linear-gradient(100deg, var(--bg-2) 18%, rgba(13,13,15,.72) 52%, rgba(13,13,15,.55) 100%);
}

.card--studio::before {
  background-image: url("https://images.unsplash.com/photo-1529699211952-734e80c4d42b?auto=format&fit=crop&w=1600&q=80");
  filter: grayscale(.55) contrast(1.05);
}
.card--studio::after {
  background:
    radial-gradient(ellipse at 75% 40%, rgba(167,139,250,.14), transparent 55%),
    linear-gradient(100deg, var(--bg-2) 18%, rgba(13,13,15,.72) 52%, rgba(13,13,15,.55) 100%);
}

.card-left {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 24px;
}
.card-right {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 0;
  gap: 20px;
  opacity: .85;
  transition: opacity .5s ease;
}
.card:hover .card-right { opacity: 1; }

.card-num {
  font-family: var(--numeric);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: .04em;
  align-self: start;
}

.card-body {
  max-width: 320px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.card-word {
  font-weight: 400;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -.03em;
  color: var(--ink);
  transition: color .4s ease, transform .5s cubic-bezier(.2,.7,.2,1);
}
.card-line {
  font-size: 15px;
  color: var(--ink-soft);
  letter-spacing: -.005em;
  line-height: 1.4;
  max-width: 240px;
  transition: color .4s ease;
}
.card-body::after {
  content: "";
  display: block;
  width: 40px;
  height: 1px;
  background: var(--ink-mute);
  margin-top: 6px;
  transition: width .5s cubic-bezier(.2,.7,.2,1), background .4s ease;
}
.card:hover .card-body::after { width: 80px; }
.card--play:hover .card-body::after { background: var(--gold); }
.card--studio:hover .card-body::after { background: var(--violet); }

.card-tag {
  font-family: var(--numeric);
  font-size: 11px;
  color: var(--ink-mute);
  letter-spacing: .06em;
  text-transform: uppercase;
  align-self: end;
}

.card:hover { background: #101012; }
.card:hover .card-word { transform: translateX(3px); }
.card--play:hover .card-word { color: var(--gold); }
.card--studio:hover .card-word { color: var(--violet); }

/* ── Play card fill: live pulse ─────────────────── */
.live {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-family: var(--numeric);
  font-size: 11px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--ink-soft);
  align-self: flex-end;
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--gold);
  box-shadow: 0 0 12px var(--gold);
  animation: pulse 1.4s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .35; transform: scale(.85); }
}

.stats {
  display: flex;
  gap: 40px;
  align-self: flex-end;
  padding: 18px 0 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  width: 100%;
}
.stat {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.stat-num {
  font-family: var(--numeric);
  font-size: 30px;
  color: var(--ink);
  line-height: 1;
  letter-spacing: -.01em;
  font-variant-numeric: tabular-nums;
}
.stat-label {
  font-family: var(--numeric);
  font-size: 10.5px;
  color: var(--ink-soft);
  letter-spacing: .1em;
  text-transform: uppercase;
}

.ticker {
  list-style: none;
  margin: 0;
  padding: 0;
  font-family: var(--numeric);
  font-size: 12px;
  color: var(--ink-soft);
  align-self: flex-end;
  width: 100%;
  max-height: 120px;
  overflow: hidden;
  position: relative;
  mask-image: linear-gradient(to bottom, transparent 0%, black 30%, black 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 30%, black 100%);
}
.ticker li {
  display: grid;
  grid-template-columns: 1fr 60px 72px;
  gap: 16px;
  padding: 6px 0;
  align-items: baseline;
  animation: tickin .5s ease-out;
  letter-spacing: .01em;
}
.ticker li .tk-user { color: var(--ink); }
.ticker li .tk-amt { color: var(--win); font-variant-numeric: tabular-nums; text-align: right; }
.ticker li .tk-when { color: var(--ink-mute); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; text-align: right; }
@keyframes tickin {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Studio card fill: feature list ─────────────── */
.features {
  list-style: none;
  margin: 0;
  padding: 0;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 0;
}
.features li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  align-items: baseline;
  padding: 16px 0;
  border-top: 1px solid var(--line);
}
.features li:last-child { border-bottom: 1px solid var(--line); }
.ft-num {
  font-family: var(--numeric);
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: .1em;
}
.ft-body { display: flex; flex-direction: column; gap: 4px; }
.ft-name {
  font-size: 15px;
  color: var(--ink);
  letter-spacing: -.005em;
}
.ft-desc {
  font-size: 13px;
  color: var(--ink-soft);
  line-height: 1.45;
}

/* ── (legacy) progression ───────────────────────── */
.rating {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 18px 0 20px;
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  align-self: flex-end;
  width: 100%;
}
.rating-label {
  font-family: var(--numeric);
  font-size: 10.5px;
  color: var(--ink-soft);
  letter-spacing: .1em;
  text-transform: uppercase;
}
.rating-row {
  display: flex;
  align-items: baseline;
  gap: 14px;
  font-family: var(--numeric);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.rating-from { font-size: 22px; color: var(--ink-soft); }
.rating-arrow { font-size: 18px; color: var(--ink-mute); }
.rating-to { font-size: 34px; color: var(--ink); letter-spacing: -.01em; }
.rating-delta {
  font-family: var(--numeric);
  font-size: 11px;
  color: var(--win);
  letter-spacing: .06em;
}

.tracks {
  list-style: none;
  margin: 0;
  padding: 0;
  align-self: flex-end;
  width: 100%;
  font-family: var(--numeric);
  font-size: 12px;
}
.tracks li {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 9px 0;
  border-bottom: 1px solid var(--line);
  letter-spacing: .02em;
}
.tracks li:last-child { border-bottom: 0; }
.tracks .tk-name { color: var(--ink-soft); text-transform: uppercase; letter-spacing: .1em; font-size: 10.5px; }
.tracks .tk-val { color: var(--ink); font-variant-numeric: tabular-nums; }

/* ── (legacy) Studio chess diagram ──────────────── */
.diagram {
  position: relative;
  align-self: center;
  justify-self: flex-end;
  width: 100%;
  max-width: 280px;
}
.board {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  aspect-ratio: 1 / 1;
  width: 100%;
  border: 1px solid var(--line);
  font-family: "Noto Sans Symbols 2", "DejaVu Sans", "Segoe UI Symbol", "Arial Unicode MS", serif;
}
.sq {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(14px, 2.4vw, 22px);
  line-height: 1;
  position: relative;
}
.sq.l { background: var(--sq-light); }
.sq.d { background: var(--sq-dark); }
.sq.w { color: var(--ink); }
.sq.b { color: #4a443a; }
.sq.hi::after {
  content: "";
  position: absolute;
  inset: 10%;
  border: 1px solid var(--gold);
  border-radius: 2px;
  opacity: .5;
}

.arrow {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.annotation {
  display: grid;
  grid-template-columns: auto auto 1fr;
  align-items: baseline;
  gap: 14px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.eval {
  font-family: var(--numeric);
  font-size: 22px;
  color: var(--gold);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.move {
  font-family: var(--numeric);
  font-size: 14px;
  color: var(--ink);
  letter-spacing: .04em;
}
.annot-note {
  font-family: var(--numeric);
  font-size: 10.5px;
  color: var(--ink-mute);
  letter-spacing: .1em;
  text-transform: uppercase;
  text-align: right;
}

/* ── Modal ──────────────────────────────────────── */
.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0,0,0,.82);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fade .2s ease-out;
}
.modal-card {
  position: relative;
  background: var(--bg-2);
  border: 1px solid var(--line);
  padding: 40px 36px 32px;
  width: 100%;
  max-width: 420px;
  animation: pop .3s cubic-bezier(.2,.8,.2,1);
}
.modal-close {
  position: absolute;
  top: 8px; right: 12px;
  font-size: 22px;
  line-height: 1;
  color: var(--ink-soft);
  padding: 6px 10px;
  transition: color .2s;
}
.modal-close:hover { color: var(--ink); }

.modal-title {
  font-weight: 400;
  font-size: 24px;
  line-height: 1.2;
  letter-spacing: -.02em;
  margin: 0 0 10px;
}
.modal-sub {
  font-size: 14px;
  color: var(--ink-soft);
  margin: 0 0 24px;
}

.field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.field-label {
  font-family: var(--numeric);
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: .04em;
}
.field--check {
  flex-direction: row;
  align-items: center;
  gap: 12px;
  padding: 13px 15px;
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--ink);
}
.field--check input {
  accent-color: var(--gold);
  width: 15px; height: 15px;
}
.field select {
  font-family: inherit;
  font-size: 14px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--ink);
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'><path d='M2 4l4 4 4-4' fill='none' stroke='%236a6458' stroke-width='1.4' stroke-linecap='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 38px;
  transition: border-color .2s;
}
.field select:focus { outline: none; border-color: var(--gold); }
.field select option { background: var(--bg-2); color: var(--ink); }
.field select optgroup { background: var(--bg); color: var(--gold); font-style: normal; }
.field--error select, .field--error.field--check { border-color: #8a1522; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font-weight: 400;
  font-size: 14px;
  padding: 14px 20px;
  background: var(--ink);
  color: #0a0a0b;
  text-decoration: none;
  width: 100%;
  transition: background .2s;
}
.btn:hover { background: #fff; }

.modal-textlink {
  display: block;
  margin: 12px auto 0;
  font-family: var(--numeric);
  font-size: 11px;
  color: var(--ink-soft);
  letter-spacing: .06em;
  transition: color .2s;
}
.modal-textlink:hover { color: var(--ink); }

@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ── Responsive ─────────────────────────────────── */
@media (max-width: 900px) {
  .stage { padding: 20px; gap: 20px; }
  .choice { grid-template-columns: 1fr; }
  .card { grid-template-columns: 1fr; min-height: auto; padding: 28px; gap: 32px; }
  .card-word { font-size: 36px; }
  .stats { gap: 24px; }
  .stat-num { font-size: 24px; }
  .diagram { max-width: 220px; }
}
