/*
 * Valence site.
 *
 * The page is dressed as the editor it describes: a tab strip for navigation,
 * a gutter, a status bar that reports where you are. Colours come straight
 * from src/theme/theme.h -- the blue-violet elevation ramp, the teal accent,
 * the syntax palette -- so the page and the product are one palette.
 *
 * Type follows the editor's own split: a monospace face for code, figures and
 * display, a UI face for prose.
 */

:root {
  color-scheme: dark;

  /* Elevation ramp (theme.h) */
  --base: #0b0c10;
  --chrome: #101218;
  --surface: #15171d;
  --raised: #1b1e26;
  --overlay: #22262f;

  --accent: #2fe0a0;
  --accent-hot: #5cf0ba;
  --accent-glow: rgba(47, 224, 160, 0.25);
  --accent-dim: rgba(47, 224, 160, 0.12);
  --blue: #60a5fa;
  --on-accent: #080e0c;

  --text: #e9ecf1;
  --text-2: rgba(233, 236, 241, 0.72);
  --text-3: rgba(233, 236, 241, 0.56);
  --text-4: rgba(233, 236, 241, 0.34);

  --border: rgba(255, 255, 255, 0.07);
  --border-2: rgba(255, 255, 255, 0.11);
  --border-3: rgba(255, 255, 255, 0.16);
  --highlight-top: rgba(255, 255, 255, 0.07);

  /* Syntax (theme.h) */
  --syn-keyword: #56d1ff;
  --syn-type: #82aaff;
  --syn-string: #c3e88d;
  --syn-comment: rgba(233, 236, 241, 0.42);
  --syn-number: #ffb74d;
  --syn-pre: #c792ea;
  --syn-func: #82e787;
  --syn-punct: rgba(233, 236, 241, 0.68);

  /* Verdicts (theme.h) */
  --ok: #7ed38d;
  --bad: #f07178;
  --warn: #ffb74d;

  --mono: "JetBrains Mono", "Cascadia Code", Consolas, monospace;
  --ui: "Inter", "Segoe UI Variable Text", "Segoe UI", system-ui, sans-serif;

  --tabs-h: 40px;
  --status-h: 24px;
  --gutter-w: 56px;
  --row: 28px;
  --radius: 6px;
  --radius-panel: 9px;
  --focus: 0 0 0 2px var(--base), 0 0 0 4px var(--accent);
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-padding-top: calc(var(--tabs-h) + 12px); }
body {
  margin: 0;
  background: var(--base);
  color: var(--text);
  font: 400 16px/1.65 var(--ui);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
h1, h2, h3, p, dl, dd, ol, pre, figure { margin: 0; }
ol { padding: 0; list-style: none; }
a { color: inherit; }
code, kbd, pre { font-family: var(--mono); font-variant-ligatures: none; }
code { font-size: 0.9em; color: var(--syn-keyword); }
kbd {
  font-size: 0.78em; padding: 1px 6px; border-radius: 4px;
  background: var(--overlay); border: 1px solid var(--border-2); color: var(--text-2);
}
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip {
  position: absolute; left: 12px; top: -60px; z-index: 50;
  background: var(--accent); color: var(--on-accent); padding: 8px 12px; border-radius: var(--radius); text-decoration: none;
}
.skip:focus { top: calc(var(--tabs-h) + 8px); }

/* The one WebGL canvas. Every 3D view on the page is a rectangle of it. */
#gl { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 0; pointer-events: none; display: block; }
main, .sec, .canyon { position: relative; z-index: 1; }

/* ------------------------------------------------------------ chrome */

.tabs {
  position: fixed; inset: 0 0 auto; z-index: 20; height: var(--tabs-h);
  display: flex; align-items: stretch;
  background: var(--chrome);
  border-bottom: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--highlight-top);
  font: 500 13px/1 var(--ui);
}
.brand {
  display: flex; align-items: center; gap: 8px; padding: 0 16px 0 14px;
  width: calc(var(--gutter-w) + 94px); text-decoration: none; font-weight: 600; letter-spacing: 0.01em;
  border-right: 1px solid var(--border);
}
.tablist { display: flex; overflow-x: auto; scrollbar-width: none; flex: 1; }
.tablist::-webkit-scrollbar { display: none; }
.tablist a {
  display: flex; align-items: center; padding: 0 16px; white-space: nowrap;
  font-family: var(--mono); font-size: 12.5px; color: var(--text-3); text-decoration: none;
  border-right: 1px solid var(--border); position: relative;
}
.tablist a:hover { color: var(--text-2); background: rgba(255, 255, 255, 0.03); }
.tablist a[aria-current="true"] { color: var(--text); background: var(--surface); }
.tablist a[aria-current="true"]::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent);
  box-shadow: 0 0 10px var(--accent-glow);
}
.tab-cta {
  display: flex; align-items: center; margin: 6px 8px; padding: 0 14px; border-radius: var(--radius);
  background: var(--accent); color: var(--on-accent); text-decoration: none; font-weight: 600; white-space: nowrap;
}
.tab-cta:hover { background: var(--accent-hot); }

.gutter {
  position: fixed; left: 0; top: var(--tabs-h); bottom: var(--status-h); width: var(--gutter-w); z-index: 5;
  overflow: hidden; pointer-events: none;
  border-right: 1px solid var(--border);
  background: linear-gradient(90deg, rgba(11, 12, 16, 0.72), rgba(11, 12, 16, 0.4));
}
.gutter-inner { position: absolute; left: 0; right: 0; top: 0; will-change: transform; }
.gutter-inner span {
  display: block; height: var(--row); line-height: var(--row); padding-right: 12px; text-align: right;
  font: 400 11.5px/var(--row) var(--mono); color: var(--text-4);
}
.gutter-inner span.cur { color: var(--text-2); }

.status {
  position: fixed; inset: auto 0 0; z-index: 20; height: var(--status-h);
  display: flex; align-items: center; gap: 18px; padding: 0 12px;
  background: var(--chrome); border-top: 1px solid var(--border);
  font: 400 12px/1 var(--ui); color: var(--text-3);
}
.st-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 8px var(--accent-glow); }
.st-spacer { flex: 1; }
#st-file { color: var(--text-2); font-family: var(--mono); font-size: 11.5px; }

/* ------------------------------------------------------------ shared type */

.label {
  font: 500 12px/1.4 var(--mono); color: var(--text-3); letter-spacing: 0.02em; margin-bottom: 14px;
}
.label b { color: var(--accent); font-weight: 500; margin-right: 10px; }
h1, h2 {
  font-family: var(--mono); font-weight: 800; letter-spacing: -0.045em; line-height: 0.98; color: var(--text);
}
h1 { font-size: clamp(44px, 7.4vw, 104px); max-width: 12ch; }
h2 { font-size: clamp(32px, 4.4vw, 60px); max-width: 17ch; }
h3 { font: 700 clamp(22px, 2.2vw, 28px)/1.15 var(--mono); letter-spacing: -0.03em; }
.lede { font-size: clamp(17px, 1.5vw, 20px); color: var(--text-2); max-width: 36em; margin-top: 26px; }
.sec-lede { font-size: 17px; color: var(--text-2); max-width: 44em; margin-top: 22px; }
.fine { font-size: 13px; color: var(--text-3); }
.fine a { color: var(--text-2); }

.caret {
  display: inline-block; width: 0.09em; height: 0.82em; margin-left: 0.08em; vertical-align: -0.04em;
  background: var(--accent); box-shadow: 0 0 0 0.05em var(--accent-glow), 0 0 26px var(--accent-glow);
  animation: blink 1s steps(1) infinite;
}
@keyframes blink { 50% { opacity: 0; } }

.btn {
  display: inline-flex; align-items: center; gap: 8px; min-height: 42px; padding: 0 18px;
  border-radius: var(--radius); border: 1px solid var(--border-3);
  background: var(--raised); color: var(--text); font: 500 14.5px/1 var(--ui); text-decoration: none; cursor: pointer;
  box-shadow: inset 0 1px 0 var(--highlight-top);
  transition: border-color 0.15s, background 0.15s;
}
.btn:hover { border-color: rgba(255, 255, 255, 0.28); background: var(--overlay); }
.btn-accent { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; box-shadow: 0 0 24px var(--accent-dim); }
.btn-accent:hover { background: var(--accent-hot); border-color: var(--accent-hot); }
.btn-quiet { background: transparent; border-color: var(--border-2); color: var(--text-2); }
.btn-small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn kbd { background: rgba(0, 0, 0, 0.18); border-color: rgba(0, 0, 0, 0.12); color: inherit; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 30px; }

/* The download: the one thing the page most wants you to do, so it is the
   only accent-filled object in the hero and the largest control on it. */
.hero-actions { flex-direction: column; align-items: center; gap: 14px; margin-top: 26px; }
.hero-links { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.dl {
  position: relative; overflow: hidden; isolation: isolate;
  display: inline-flex; align-items: center; gap: 16px; padding: 12px 26px 12px 12px;
  border-radius: 10px; text-decoration: none; text-align: left;
  background: var(--accent); color: var(--on-accent);
  box-shadow: 0 0 0 1px rgba(92, 240, 186, 0.6), 0 12px 44px rgba(47, 224, 160, 0.32), 0 0 90px rgba(47, 224, 160, 0.18);
  transition: transform 0.18s cubic-bezier(0.2, 0.7, 0.1, 1), box-shadow 0.18s, background 0.18s;
}
.dl:hover { background: var(--accent-hot); transform: translateY(-2px); box-shadow: 0 0 0 1px var(--accent-hot), 0 18px 56px rgba(47, 224, 160, 0.42), 0 0 120px rgba(47, 224, 160, 0.24); }
.dl:active { transform: translateY(0); }
.dl-icon {
  display: grid; place-items: center; width: 46px; height: 46px; border-radius: 8px;
  background: rgba(8, 14, 12, 0.88); color: var(--accent-hot);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08);
}
.dl-icon svg { transition: transform 0.25s cubic-bezier(0.2, 0.7, 0.1, 1); }
.dl:hover .dl-icon svg { transform: translateY(2px); }
.dl-text { display: flex; flex-direction: column; gap: 3px; }
.dl-text b { font: 800 19px/1.1 var(--ui); letter-spacing: -0.01em; }
.dl-text small { font: 500 11.5px/1.2 var(--mono); opacity: 0.72; letter-spacing: 0.01em; }
/* A slow light sweep across the slab. */
.dl::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: linear-gradient(105deg, transparent 35%, rgba(255, 255, 255, 0.45) 50%, transparent 65%);
  transform: translateX(-120%); animation: dl-sweep 5.5s ease-in-out 1.2s infinite;
}
@keyframes dl-sweep { 0%, 70% { transform: translateX(-120%); } 88%, 100% { transform: translateX(120%); } }
@media (prefers-reduced-motion: reduce) { .dl::after { animation: none; } .dl, .dl-icon svg { transition: none; } }

/* ------------------------------------------------------------ canyon */

.canyon { height: 300vh; }
.canyon-stage { position: sticky; top: 0; height: 100vh; }
.canyon-hud {
  position: absolute; left: calc(var(--gutter-w) + 24px); bottom: calc(var(--status-h) + 18px);
  display: flex; gap: 16px; font: 400 12px/1 var(--mono); color: var(--text-3);
  opacity: 0; transition: opacity 0.4s;
}
.canyon-hud span:first-child { color: var(--accent); }
.canyon.flying .canyon-hud { opacity: 1; }
.canyon-copy { position: sticky; top: 0; height: 100vh; margin-top: -100vh; pointer-events: none; overflow: clip; }
.beat {
  position: absolute; pointer-events: auto;
  opacity: 0; transform: translateY(18px); visibility: hidden;
}
.beat.on { opacity: 1; transform: none; visibility: visible; transition: opacity 0.5s, transform 0.6s cubic-bezier(0.2, 0.7, 0.1, 1), visibility 0s; }
/* The hero is centred under the name the glyph field draws above it. */
.beat-hero {
  left: var(--gutter-w); right: 0; bottom: calc(var(--status-h) + 6vh);
  display: flex; flex-direction: column; align-items: center; text-align: center; padding: 0 20px;
}
.beat-hero .actions { justify-content: center; }
.beat-hero .lede { margin-left: auto; margin-right: auto; margin-top: 18px; font-size: clamp(15.5px, 1.25vw, 18px); max-width: 44em; }
.beat-hero .pill { margin-bottom: 14px; }
.hero-name { font-size: clamp(64px, 13vw, 190px); max-width: none; letter-spacing: -0.06em; }
html.gl .hero-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tagline { font: 800 clamp(24px, 3vw, 42px)/1.05 var(--mono); letter-spacing: -0.04em; color: var(--text); }
.beat-side {
  right: clamp(20px, 5vw, 80px); top: calc(var(--tabs-h) + 18vh); width: min(430px, 88vw);
  padding: 26px 28px; background: rgba(16, 18, 24, 0.86); border: 1px solid var(--border-2); border-radius: var(--radius-panel);
  box-shadow: inset 0 1px 0 var(--highlight-top), 0 24px 60px rgba(0, 0, 0, 0.45);
}
.beat-side h2 { font-size: clamp(28px, 2.8vw, 40px); }
.beat-side p:not(.label) { color: var(--text-2); margin-top: 16px; font-size: 15.5px; }
.beat-final { left: 0; right: 0; bottom: calc(var(--status-h) + 11vh); display: flex; justify-content: center; }
.bignums { display: flex; gap: clamp(28px, 6vw, 96px); }
.bignums div { text-align: center; }
.bignums dt { font: 800 clamp(44px, 6.4vw, 92px)/1 var(--mono); letter-spacing: -0.05em; color: var(--text-4); }
.bignums dt.lit { color: var(--accent); text-shadow: 0 0 36px var(--accent-glow); }
.bignums dd { margin-top: 10px; font: 500 13px/1 var(--mono); color: var(--text-3); }
.pill {
  display: inline-flex; align-items: center; gap: 10px; padding: 6px 14px 6px 10px; margin-bottom: 30px;
  border-radius: var(--radius); background: var(--accent-dim); border: 1px solid rgba(47, 224, 160, 0.3);
  font: 500 12.5px/1 var(--mono); color: var(--accent-hot); text-decoration: none;
}
.pill i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 10px var(--accent); }
.hint { margin-top: 26px; max-width: 48em; line-height: 1.6; font: 500 12px/1 var(--mono); color: var(--text-3); letter-spacing: 0.04em; }
.hint::after { content: " \2193"; color: var(--accent); }
.canyon-fallback { position: absolute; inset: var(--tabs-h) 0 var(--status-h) var(--gutter-w); overflow: hidden; opacity: 0.35; }
.canyon-fallback pre { font-size: 12px; line-height: 1.5; padding: 20px; color: var(--text-3); }

/* A scrim under the hero text so it holds against bright tokens. */
.beat-hero::before {
  content: ""; position: absolute; inset: -6vh 0 -8vh 0; z-index: -1; pointer-events: none;
  background: radial-gradient(50% 70% at 50% 60%, rgba(11, 12, 16, 0.9), rgba(11, 12, 16, 0.5) 60%, rgba(11, 12, 16, 0) 85%);
}

/* No-JS: the beats are plain content. */
html:not(.js) .canyon { height: auto; }
html:not(.js) .canyon-stage { display: none; }
html:not(.js) .canyon-copy { position: static; height: auto; margin: 0; padding: 100px 24px 60px calc(var(--gutter-w) + 24px); }
html:not(.js) .beat { position: static; opacity: 1; transform: none; visibility: visible; margin-bottom: 40px; }

/* ------------------------------------------------------------ sections */

.sec {
  padding: clamp(80px, 12vh, 140px) clamp(20px, 5vw, 72px) clamp(80px, 12vh, 140px) calc(var(--gutter-w) + clamp(20px, 5vw, 72px));
  /* Transparent: the WebGL views are drawn on the canvas underneath, through
     these rectangles. The canvas clears to the page colour. */
  background: transparent;
  border-top: 1px solid var(--border);
}
.sec-head { max-width: 1180px; margin-bottom: 52px; }
.sec > *:not(.sec-head) { max-width: 1280px; }

/* Workbench: the live editor beside the vector. */
.workbench { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 22px; }
.ed-window {
  background: var(--surface); border: 1px solid var(--border-2); border-radius: var(--radius-panel); overflow: hidden;
  box-shadow: inset 0 1px 0 var(--highlight-top), 0 30px 80px rgba(0, 0, 0, 0.45);
  display: flex; flex-direction: column;
}
.ed-tabs { display: flex; align-items: stretch; height: 34px; background: var(--chrome); border-bottom: 1px solid var(--border); }
.ed-tab {
  display: flex; align-items: center; padding: 0 16px; font: 400 12.5px/1 var(--mono); color: var(--text);
  background: var(--surface); position: relative;
}
.ed-tab::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); }
.ed-hint { margin-left: auto; display: flex; align-items: center; gap: 6px; padding: 0 12px; font-size: 12px; color: var(--text-3); }
.ed-host { position: relative; height: 430px; cursor: text; outline: none; }
.ed-host:focus-visible { box-shadow: inset 0 0 0 1px var(--accent); border-radius: 0; }
.ed-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.ed-input { position: absolute; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; border: 0; padding: 0; resize: none; overflow: hidden; }
.ed-popup {
  position: absolute; z-index: 3; min-width: 240px;
  background: var(--overlay); border: 1px solid var(--border-3); border-radius: var(--radius);
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.5); font: 400 13px/1.3 var(--mono); padding: 4px;
}
.ed-popup div { display: flex; justify-content: space-between; gap: 18px; padding: 6px 10px; border-radius: 4px; background: var(--accent-dim); }
.ed-popup b { color: var(--text); font-weight: 500; }
.ed-popup span { color: var(--text-3); font-family: var(--ui); font-size: 12px; }
.ed-status {
  display: flex; gap: 16px; height: 26px; align-items: center; padding: 0 12px;
  background: var(--chrome); border-top: 1px solid var(--border); font: 400 12px/1 var(--ui); color: var(--text-3);
}
.ed-sp { flex: 1; }

.viz { display: flex; flex-direction: column; min-width: 0; }
.viz-view {
  flex: 1; min-height: 360px; border-radius: var(--radius-panel); border: 1px solid var(--border);
  background: radial-gradient(120% 90% at 50% 0%, rgba(47, 224, 160, 0.04), transparent 60%);
  position: relative;
}
.viz-caption { padding: 14px 4px 0; min-height: 88px; }
.cost { font: 500 13px/1.5 var(--mono); color: var(--text-3); }
.cost b { color: var(--text); font-weight: 500; margin-left: 8px; }
.cost-detail { font-size: 14px; color: var(--text-2); margin-top: 6px; }

.undo-row { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 36px; margin-top: 76px; align-items: stretch; }
.undo-copy p:not(.label):not(.decision) { color: var(--text-2); margin-top: 16px; max-width: 34em; }
.undo-controls { display: flex; gap: 10px; margin-top: 24px; }
.decision {
  margin-top: 20px; padding: 12px 14px; border-left: 2px solid var(--accent);
  background: var(--accent-dim); border-radius: 0 var(--radius) var(--radius) 0;
  font: 400 13px/1.5 var(--mono); color: var(--text-2); max-width: 34em;
}
.decision b { color: var(--text); font-weight: 500; }
.undo-view { min-height: 420px; }

/* Lexer */
.lex-bar { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.lex-input {
  flex: 1 1 420px; min-height: 48px; padding: 0 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border-2); color: var(--text);
  font: 400 16px var(--mono); font-variant-ligatures: none;
  box-shadow: inset 0 1px 0 var(--highlight-top);
}
.lex-input:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-dim); }
.lex-view { height: 480px; margin-top: 18px; border-radius: var(--radius-panel); border: 1px solid var(--border); }
.lex-lanes { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 8px; margin-top: 14px; }
.lex-lanes li { font: 400 11.5px/1.3 var(--mono); color: var(--text-3); border-top: 2px solid currentColor; padding-top: 6px; }
.lex-lanes li b { display: block; font-size: 18px; font-weight: 700; margin-top: 2px; }
.lex .fine { margin-top: 18px; }

/* Architecture */
.arch { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; }
.arch-view { height: 600px; border-radius: var(--radius-panel); border: 1px solid var(--border); cursor: grab; }
.arch-view:active { cursor: grabbing; }
.arch-info { display: flex; flex-direction: column; gap: 24px; }
.callpath { counter-reset: step; display: grid; gap: 6px; }
.callpath li {
  counter-increment: step; display: flex; gap: 10px; align-items: baseline;
  padding: 8px 10px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--chrome);
  font-size: 12.5px; transition: border-color 0.2s, background 0.2s;
}
.callpath li::before { content: counter(step); font: 500 11px var(--mono); color: var(--text-4); }
.callpath li.on { border-color: rgba(47, 224, 160, 0.5); background: var(--accent-dim); }
.callpath code { color: var(--text-2); font-size: 12px; }
.callpath li.on code { color: var(--text); }
.arch-file { padding: 16px; border-radius: var(--radius-panel); background: var(--chrome); border: 1px solid var(--border); min-height: 150px; }
.arch-file h4 { margin: 0; font: 600 14px/1.3 var(--mono); color: var(--text); word-break: break-all; }
.arch-file .loc { font: 500 12px var(--mono); color: var(--accent); margin-top: 6px; }
.arch-file p { font-size: 13.5px; color: var(--text-2); margin-top: 10px; }

/* Judge */
.cph { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0; border: 1px solid var(--border-2); border-radius: var(--radius-panel); overflow: hidden; background: var(--surface); box-shadow: 0 30px 80px rgba(0, 0, 0, 0.4); }
.cph-src { border-right: 1px solid var(--border); min-width: 0; display: flex; flex-direction: column; }
.cph-tabs { display: flex; overflow-x: auto; background: var(--chrome); border-bottom: 1px solid var(--border); scrollbar-width: none; }
.cph-tabs button {
  border: 0; border-right: 1px solid var(--border); background: transparent; color: var(--text-3);
  font: 400 12.5px/1 var(--mono); padding: 0 14px; height: 36px; cursor: pointer; white-space: nowrap; position: relative;
}
.cph-tabs button[aria-selected="true"] { background: var(--surface); color: var(--text); }
.cph-tabs button[aria-selected="true"]::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; background: var(--accent); }
.cph-code { flex: 1; margin: 0; padding: 16px 18px; overflow: auto; font-size: 13px; line-height: 1.6; color: var(--text); min-height: 420px; max-height: 560px; counter-reset: ln; }
.cph-code .ln { display: block; }
.cph-code .ln::before { counter-increment: ln; content: counter(ln); display: inline-block; width: 2.4em; margin-right: 14px; text-align: right; color: var(--text-4); }
.cph-panel { padding: 18px; display: flex; flex-direction: column; gap: 12px; background: var(--chrome); min-width: 0; }
.cph-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; }
.cph-title { font: 600 15px/1.3 var(--ui); }
.cph-summary { font: 500 13px/1.4 var(--mono); color: var(--text-2); }
.cph-summary b.ok { color: var(--ok); } .cph-summary b.bad { color: var(--bad); }
.cph-compile { margin: 0; padding: 12px; border-radius: var(--radius); background: var(--base); border: 1px solid rgba(240, 113, 120, 0.3); color: var(--text-2); font-size: 12px; line-height: 1.5; overflow-x: auto; white-space: pre; }
.cph-compile.busy { border-color: var(--border-2); color: var(--text-3); }
.cph-cases { display: grid; gap: 8px; }
.case {
  border-radius: var(--radius); background: var(--raised); border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 var(--highlight-top); overflow: hidden;
}
.case-row { display: flex; align-items: center; gap: 12px; padding: 10px 12px; }
.case-name { font: 500 13px/1.2 var(--ui); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.case-time { font: 400 12px var(--mono); color: var(--text-3); min-width: 64px; text-align: right; }
.verdict {
  font: 700 11.5px/1 var(--mono); min-width: 44px; text-align: center; padding: 5px 0; border-radius: 4px;
  background: rgba(255, 255, 255, 0.05); color: var(--text-3);
}
.verdict.AC { color: var(--ok); background: rgba(126, 211, 141, 0.12); }
.verdict.WA, .verdict.RE, .verdict.CE { color: var(--bad); background: rgba(240, 113, 120, 0.12); }
.verdict.TLE { color: var(--warn); background: rgba(255, 183, 77, 0.12); }
.verdict.RUN { color: var(--accent); background: var(--accent-dim); }
.case-meter { height: 2px; background: rgba(255, 255, 255, 0.05); }
.case-meter i { display: block; height: 100%; width: 0; background: var(--accent); }
.case-meter i.warn { background: var(--warn); }
.case-body { padding: 0 12px 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.case-body div { min-width: 0; }
.case-body span { display: block; font: 500 11px var(--mono); color: var(--text-4); margin-bottom: 4px; }
.case-body pre {
  margin: 0; padding: 8px 10px; background: var(--base); border-radius: 4px; border: 1px solid var(--border);
  font-size: 12px; line-height: 1.5; max-height: 140px; overflow: auto; white-space: pre-wrap; word-break: break-all;
}
.case-body pre .diff { background: rgba(240, 113, 120, 0.18); box-shadow: inset 2px 0 0 var(--bad); display: inline-block; min-width: 100%; }
.case-body .err { grid-column: 1 / -1; }

.rule { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr) minmax(0, 1fr); gap: 18px; margin-top: 44px; align-items: start; }
.rule-copy p:not(.rule-verdict) { color: var(--text-2); margin-top: 12px; font-size: 15px; }
.rule-box span { display: block; font: 500 12px var(--mono); color: var(--text-3); margin-bottom: 6px; }
.rule-box textarea {
  width: 100%; min-height: 150px; resize: vertical; padding: 10px 12px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border-2); color: var(--text); font: 400 13.5px/1.55 var(--mono);
}
.rule-box textarea:focus { outline: none; border-color: var(--accent); }
.rule-verdict { margin-top: 18px; font: 500 14px/1.5 var(--mono); }
.rule-verdict b { font-weight: 700; margin-right: 8px; }

/* Budget chart */
.budget { margin-bottom: 44px; }
.budget-sizes { display: flex; gap: 6px; flex-wrap: wrap; }
.budget-sizes button {
  font: 500 13px/1 var(--mono); padding: 9px 14px; border-radius: var(--radius); cursor: pointer;
  border: 1px solid var(--border-2); background: var(--chrome); color: var(--text-3);
}
.budget-sizes button[aria-checked="true"] { background: var(--accent-dim); border-color: rgba(47, 224, 160, 0.45); color: var(--text); }
.budget-chart { margin-top: 24px; position: relative; }
.budget-note { margin-top: 16px; font-size: 15px; color: var(--text-2); max-width: 52em; min-height: 3em; }
.facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1px; background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-panel); overflow: hidden; margin-bottom: 20px; }
.facts div { background: var(--chrome); padding: 22px; }
.facts dt { font: 800 clamp(26px, 2.6vw, 36px)/1 var(--mono); letter-spacing: -0.04em; color: var(--text); }
.facts dt small { font-size: 0.5em; color: var(--text-3); font-weight: 500; margin-left: 4px; letter-spacing: 0; }
.facts dd { margin-top: 10px; font-size: 14px; color: var(--text-2); }

.bars { position: relative; display: grid; gap: 14px; padding: 30px 0 4px; }
.brow { display: grid; grid-template-columns: 300px minmax(0, 1fr); gap: 16px; align-items: center; }
.blabel { font: 500 13px/1.3 var(--mono); color: var(--text-2); }
.btrack { position: relative; height: 34px; border-radius: var(--radius); background: var(--chrome); border: 1px solid var(--border); }
.bfill { position: absolute; left: 0; top: 0; bottom: 0; width: 0; border-radius: var(--radius); transition: width 0.8s cubic-bezier(0.2, 0.7, 0.1, 1); }
.brow-before .bfill { background: var(--syn-type); }
.brow-worst .bfill { background: var(--syn-number); }
.brow-typical .bfill { background: var(--accent); box-shadow: 0 0 20px var(--accent-dim); }
.bfill.over { background: linear-gradient(90deg, var(--syn-type), var(--bad)); }
.bval.inside { color: var(--base); }
.bval { position: absolute; top: 50%; transform: translate(10px, -50%); font: 700 13px var(--mono); color: var(--text); white-space: nowrap; transition: left 0.8s cubic-bezier(0.2, 0.7, 0.1, 1); }
.boverlay { position: absolute; top: 0; bottom: 0; left: 316px; right: 0; pointer-events: none; }
.bbudget { position: absolute; top: 4px; bottom: -4px; width: 2px; background: var(--text); box-shadow: 0 0 12px rgba(255, 255, 255, 0.35); }
.bbudget span { position: absolute; left: 8px; top: -2px; white-space: nowrap; font: 500 11.5px var(--mono); color: var(--text); }
.baxis { position: relative; height: 22px; margin: 10px 0 0 316px; }
.baxis span { position: absolute; transform: translateX(-50%); font: 400 11px var(--mono); color: var(--text-4); }
.baxis span:first-child { transform: none; }
.baxis span:last-child { transform: translateX(-100%); }
@media (prefers-reduced-motion: reduce) { .bfill, .bval { transition: none; } }
@media (max-width: 760px) {
  .brow { grid-template-columns: 1fr; gap: 6px; }
  .baxis { margin-left: 0; }
  .boverlay { left: 0; }
  .bbudget span { left: auto; right: 8px; top: -18px; }
  .dl-text b { font-size: 17px; }
}

/* The phone download dialog */
.verdict-dialog {
  width: min(420px, calc(100vw - 32px)); padding: 22px; border-radius: var(--radius-panel);
  background: var(--overlay); color: var(--text); border: 1px solid var(--border-3);
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.6);
}
.verdict-dialog::backdrop { background: rgba(5, 6, 9, 0.72); }
.verdict-dialog[open] { animation: pop 0.22s cubic-bezier(0.2, 0.7, 0.1, 1); }
@keyframes pop { from { opacity: 0; transform: translateY(12px) scale(0.98); } }
.mdl-badge { display: flex; align-items: center; gap: 10px; font: 500 12px var(--mono); color: var(--text-3); margin-bottom: 14px; }
.verdict-dialog h3 { font-size: 24px; }
.verdict-dialog p:not(.mdl-badge) { margin-top: 12px; color: var(--text-2); font-size: 15px; }
.verdict-dialog p.fine { font-size: 13px; color: var(--text-3); }
.mdl-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 20px; }
@media (prefers-reduced-motion: reduce) { .verdict-dialog[open] { animation: none; } }

/* History */
.history { position: relative; }
.history svg { width: 100%; height: auto; display: block; overflow: visible; }
.releases { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px; margin-top: 30px; }
.release { border-top: 2px solid var(--border-3); padding-top: 16px; }
.release.cur { border-color: var(--accent); }
.release h4 { margin: 0; font: 700 22px/1 var(--mono); letter-spacing: -0.03em; }
.release time { display: block; margin-top: 6px; font: 400 12px var(--mono); color: var(--text-3); }
.release ul { margin: 12px 0 0; padding-left: 18px; color: var(--text-2); font-size: 14px; }
.release li { margin-top: 5px; }

.get { padding-bottom: 160px; }
.get h2 { max-width: 20ch; }
.credit { margin-top: 60px; color: var(--text-3); font-size: 14px; }

/* ------------------------------------------------------------ responsive */

@media (max-width: 1080px) {
  .workbench, .undo-row, .arch, .cph, .rule { grid-template-columns: 1fr; }
  .cph-src { border-right: 0; border-bottom: 1px solid var(--border); }
  .arch-view { height: 480px; }
  .lex-lanes { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .facts { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 760px) {
  :root { --gutter-w: 0px; }
  .gutter { display: none; }
  .brand { width: auto; }
  .brand span { display: none; }
  .tab-cta { display: none; }
  .st-hide-sm { display: none; }
  .beat-side { left: 16px; right: 16px; width: auto; top: auto; bottom: calc(var(--status-h) + 16px); padding: 20px; }
  .beat-hero { bottom: calc(var(--status-h) + 3vh); }
  .bignums { gap: 20px; }
  .releases { grid-template-columns: 1fr; }
  .facts { grid-template-columns: 1fr; }
  .ed-host { height: 360px; }
  .lex-view { height: 420px; }
  .lex-lanes { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .case-body { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .caret { animation: none; }
  .beat.on { transition: none; }
}
