:root {
  /* Surfaces */
  --bg: #F8F9FA;
  --card: #FFFFFF;
  --surface-low: #F1F3F4;
  --border: #DADCE0;
  --border-soft: #E8EAED;

  /* Text */
  --ink: #1F1F1F;
  --muted: #444746;
  --subtle: #747775;

  /* Signature accent, with Material-style tonal roles */
  --violet: #7C3AED;
  --violet-strong: #6425D0;
  --magenta: #D946EF;
  --primary-container: #EDE5FF;
  --on-primary-container: #2E0A6E;
  --state-hover: rgba(124, 58, 237, 0.08);
  --state-press: rgba(124, 58, 237, 0.14);
  --violet-ring: rgba(124, 58, 237, 0.22);

  --radius-xl: 28px;
  --radius-l: 20px;
  --radius-m: 12px;
  --elev-1: 0 1px 2px rgba(60, 64, 67, 0.1), 0 1px 3px 1px rgba(60, 64, 67, 0.05);
  --elev-2: 0 1px 2px rgba(60, 64, 67, 0.12), 0 2px 6px 2px rgba(60, 64, 67, 0.08);
  --ease: cubic-bezier(0.2, 0, 0, 1);
  --ease-spring: cubic-bezier(0.3, 1.5, 0.5, 1);

  --font-ui: "Google Sans Flex", "Google Sans", "Product Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "Google Sans Code", ui-monospace, SFMono-Regular, Menlo, monospace;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }

body {
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
svg { flex: none; }

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

/* ---------- Status dot ---------- */
.status-dot {
  position: relative; display: inline-block; flex: none;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--violet);
}
.status-dot::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  background: var(--magenta); opacity: 0;
  animation: pulse 2.4s var(--ease) infinite;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.55; }
  100% { transform: scale(3); opacity: 0; }
}

/* ---------- App bar ---------- */
.appbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 14px;
  height: 64px; padding: 0 20px 0 24px;
  background: rgba(248, 249, 250, 0.88);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.labs-mark { display: inline-flex; align-items: center; gap: 8px; color: var(--ink); text-decoration: none; }
.labs-logo {
  display: grid; place-items: center;
  width: 32px; height: 32px; border-radius: 50%;
  background: var(--violet); color: #fff;
  transition: transform .5s var(--ease-spring);
}
.labs-logo svg { width: 18px; height: 18px; }
.labs-mark:hover .labs-logo { transform: rotate(-14deg); }
.labs-word { font-size: 21px; font-weight: 500; letter-spacing: -0.01em; }

.appbar-divider { width: 1px; height: 22px; background: var(--border); }
.appbar-title { font-size: 17px; font-weight: 500; color: var(--muted); }

.badge {
  display: inline-flex; align-items: center;
  height: 24px; padding: 0 10px; border-radius: 8px;
  background: var(--primary-container); color: var(--on-primary-container);
  font-size: 12px; font-weight: 600; letter-spacing: 0.01em;
}

.appbar-actions { margin-left: auto; display: flex; gap: 4px; }

.btn-text {
  display: inline-flex; align-items: center; gap: 8px;
  height: 40px; padding: 0 16px 0 12px;
  border: 0; border-radius: 999px; background: none;
  font-size: 14px; font-weight: 500; color: var(--violet);
  transition: background-color .2s var(--ease);
}
.btn-text svg { width: 20px; height: 20px; }
.btn-text:hover { background: var(--state-hover); }
.btn-text:active { background: var(--state-press); }

.btn-filled {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 40px; padding: 0 24px;
  border: 0; border-radius: 999px;
  background: var(--violet); color: #fff;
  font-size: 14px; font-weight: 500;
  transition: background-color .2s var(--ease), box-shadow .2s var(--ease);
}
.btn-filled:hover { background: var(--violet-strong); box-shadow: var(--elev-1); }

/* ---------- Page ---------- */
.app { max-width: 1360px; margin: 0 auto; padding: 24px 24px 16px; }

.hero {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: end; gap: 24px 48px;
  padding: 24px 8px 32px;
}
.hero h1 {
  margin: 0;
  font-size: clamp(44px, 7vw, 88px);
  font-weight: 500; line-height: 1; letter-spacing: -0.045em;
  font-variation-settings: "opsz" 144;
  background: linear-gradient(100deg, var(--ink) 0 52%, var(--violet) 78%, var(--magenta));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  padding-bottom: 0.06em;
  display: inline-block;
}
.hero-lede { margin: 16px 0 0; max-width: 560px; font-size: 18px; line-height: 1.5; color: var(--muted); }

.hero-meta {
  display: grid; grid-auto-flow: column; gap: 32px; margin: 0;
  padding-bottom: 6px;
}
.hero-meta dt { font-size: 12px; color: var(--subtle); margin-bottom: 2px; }
.hero-meta dd { margin: 0; font-size: 14px; font-weight: 500; display: flex; align-items: center; gap: 8px; }

.workspace {
  display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; align-items: start;
}

/* ---------- Stage panel ---------- */
.stage-panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 12px 12px 16px;
}

/* Material-style segmented button */
.segmented {
  display: inline-flex; height: 40px;
  border: 1px solid var(--subtle); border-radius: 999px; overflow: hidden;
}
.segmented button {
  position: relative;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-width: 48px; padding: 0 16px;
  border: 0; border-right: 1px solid var(--subtle); background: none;
  font-size: 14px; font-weight: 500; color: var(--ink);
  transition: background-color .2s var(--ease);
}
.segmented button:last-child { border-right: 0; }
.segmented button:hover { background: var(--state-hover); }
.segmented svg { width: 18px; height: 18px; }
.segmented .seg-check { display: none; }
.segmented button[aria-checked="true"] { background: var(--primary-container); color: var(--on-primary-container); }
.segmented button[aria-checked="true"] .seg-check { display: block; animation: pop .35s var(--ease-spring); }
.segmented button[aria-checked="true"] .seg-icon { display: none; }
@keyframes pop { from { transform: scale(0.3); opacity: 0; } to { transform: none; opacity: 1; } }

.toolbar-actions { display: flex; gap: 4px; }
.icon-btn {
  position: relative;
  display: grid; place-items: center;
  width: 40px; height: 40px;
  border: 0; border-radius: 50%; background: none; color: var(--muted);
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn:hover { background: var(--state-hover); color: var(--violet); }
.icon-btn:active { background: var(--state-press); }
.icon-btn[data-tip]::after {
  content: attr(data-tip);
  position: absolute; top: calc(100% + 6px); left: 50%;
  transform: translate(-50%, -4px); opacity: 0; pointer-events: none;
  padding: 4px 8px; border-radius: 4px;
  background: #303030; color: #F2F2F2;
  font-size: 12px; white-space: nowrap; z-index: 5;
  transition: opacity .15s var(--ease), transform .15s var(--ease);
}
.icon-btn[data-tip]:hover::after, .icon-btn[data-tip]:focus-visible::after { opacity: 1; transform: translate(-50%, 0); }

.stage-wrap {
  position: relative;
  height: clamp(420px, 60svh, 640px);
  margin: 0 12px;
  border-radius: var(--radius-l);
  background-color: var(--bg);
  background-image: radial-gradient(circle, #DFE1E5 1px, transparent 1.3px);
  background-size: 22px 22px;
  background-position: 11px 11px;
  overflow: hidden;
  user-select: none; -webkit-user-select: none;
}
#stage { display: block; width: 100%; height: 100%; touch-action: none; cursor: crosshair; }

.stage-mode {
  position: absolute; top: 14px; left: 14px; pointer-events: none;
  display: inline-flex; align-items: center; gap: 8px;
  height: 28px; padding: 0 12px;
  border-radius: 999px; background: var(--card); box-shadow: var(--elev-1);
  font-size: 12px; font-weight: 500; color: var(--muted);
}

.stage-hint {
  position: absolute; top: 14px; right: 14px; pointer-events: none;
  padding: 6px 14px; border-radius: 999px;
  background: rgba(48, 48, 48, 0.86); color: #F2F2F2;
  font-size: 12px; white-space: nowrap;
  transition: opacity .6s var(--ease), transform .6s var(--ease);
}
.stage-hint.is-hidden { opacity: 0; transform: translateY(-8px); }

/* Loading */
.stage-loading {
  position: absolute; inset: 0; display: none;
  flex-direction: column; align-items: center; justify-content: center; gap: 20px;
  color: var(--subtle); font-size: 14px;
}
.stage-loading p { margin: 0; }
.stage-wrap.is-loading .stage-loading { display: flex; }
.stage-wrap.is-loading .stage-hint, .stage-wrap.is-loading .stage-mode { opacity: 0; }
.skeleton-word { display: flex; align-items: flex-end; gap: 10px; }
.skeleton-word i {
  display: block; width: clamp(28px, 5vw, 64px); height: clamp(44px, 8vw, 96px);
  border-radius: 14px;
  background: linear-gradient(90deg, #ECEEF1 0%, #F7F2FF 50%, #ECEEF1 100%);
  background-size: 300% 100%;
  animation: shimmer 1.4s linear infinite, bob 1.4s var(--ease) infinite alternate;
}
.skeleton-word i:nth-child(2) { animation-delay: -.1s, .08s; }
.skeleton-word i:nth-child(3) { animation-delay: -.2s, .16s; }
.skeleton-word i:nth-child(4) { animation-delay: -.3s, .24s; }
.skeleton-word i:nth-child(5) { animation-delay: -.4s, .32s; }
.skeleton-word i:nth-child(6) { animation-delay: -.5s, .40s; }
.skeleton-word i:nth-child(7) { animation-delay: -.6s, .48s; }
@keyframes shimmer { from { background-position: 100% 0; } to { background-position: -200% 0; } }
@keyframes bob { from { transform: translateY(0); } to { transform: translateY(-10px); } }

/* Error */
.stage-error {
  position: absolute; inset: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 32px; text-align: center; background: var(--bg);
}
.stage-error[hidden] { display: none; }
.error-icon {
  display: grid; place-items: center; width: 56px; height: 56px; margin-bottom: 16px;
  border-radius: 50%; background: #FCE8E6; color: #B3261E;
}
.error-icon svg { width: 28px; height: 28px; }
.stage-error h2 { margin: 0 0 8px; font-size: 22px; font-weight: 500; letter-spacing: -0.01em; }
.stage-error p { margin: 0 0 20px; max-width: 380px; color: var(--muted); }

/* Prompt bar */
.prompt { padding: 16px 16px 18px; }
.prompt-box {
  display: flex; align-items: center; gap: 10px;
  height: 60px; padding: 0 8px 0 20px;
  border-radius: 999px;
  background: var(--surface-low);
  border: 1px solid transparent;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), box-shadow .2s var(--ease);
}
.prompt-box:hover { background: #ECEEF0; }
.prompt-box:focus-within { background: var(--card); border-color: var(--border); box-shadow: var(--elev-2); }
.prompt-spark { width: 20px; height: 20px; color: var(--violet); }
.prompt-box:focus-within .prompt-spark { animation: twinkle 2.4s var(--ease) infinite; }
@keyframes twinkle { 50% { transform: rotate(90deg) scale(0.85); color: var(--magenta); } }
.prompt-box input {
  flex: 1; min-width: 0; height: 100%;
  border: 0; outline: 0; background: transparent;
  font-size: 17px;
}
.prompt-box input::placeholder { color: var(--subtle); }
.prompt-count { font-family: var(--font-mono); font-size: 12px; color: var(--subtle); }

.fab {
  display: grid; place-items: center;
  width: 44px; height: 44px; border: 0; border-radius: 50%;
  background: var(--violet); color: #fff;
  transition: background-color .2s var(--ease), transform .3s var(--ease-spring), box-shadow .2s var(--ease);
}
.fab svg { width: 22px; height: 22px; transform: rotate(180deg); transition: transform .3s var(--ease-spring); }
.fab:hover { background: var(--violet-strong); box-shadow: var(--elev-1); }
.fab:hover svg { transform: rotate(180deg) translateY(-2px); }
.fab:active { transform: scale(0.92); }

.suggestions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin-top: 12px; padding: 0 4px;
}
.suggest-label { font-size: 13px; color: var(--subtle); margin-right: 2px; }
.chip {
  height: 32px; padding: 0 14px;
  border: 1px solid var(--border); border-radius: 8px; background: var(--card);
  font-size: 13px; font-weight: 500; color: var(--muted);
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.chip:hover { background: var(--state-hover); border-color: var(--violet-ring); color: var(--on-primary-container); }
.chip:active { background: var(--state-press); }

/* ---------- Side panel ---------- */
.panel { display: flex; flex-direction: column; gap: 16px; }
.panel-section {
  padding: 20px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
}
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-title { margin: 0 0 16px; font-size: 16px; font-weight: 500; letter-spacing: -0.005em; }
.panel-head .panel-title { margin: 0; }
.live {
  display: inline-flex; align-items: center; gap: 8px;
  height: 24px; padding: 0 10px; border-radius: 8px;
  background: var(--primary-container); color: var(--on-primary-container);
  font-size: 12px; font-weight: 500;
}

.control { margin-bottom: 18px; }
.control:last-child { margin-bottom: 0; }
.control-row { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.control-row label, .control-label { font-size: 14px; color: var(--ink); }
.control-row output { font-size: 12px; color: var(--muted); }
.control-split { display: flex; align-items: center; justify-content: space-between; }

/* Material-style slider: thick track, thin handle */
input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 28px; margin: 0; background: transparent; cursor: pointer;
  --pct: 50%;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 12px; border-radius: 999px;
  background: linear-gradient(to right, var(--violet) var(--pct), var(--primary-container) var(--pct));
}
input[type="range"]::-moz-range-track { height: 12px; border-radius: 999px; background: var(--primary-container); }
input[type="range"]::-moz-range-progress { height: 12px; border-radius: 999px; background: var(--violet); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 4px; height: 28px; margin-top: -8px; border-radius: 2px;
  background: var(--violet); border: 0;
  box-shadow: 0 0 0 4px var(--card);
  transition: transform .15s var(--ease);
}
input[type="range"]::-moz-range-thumb {
  width: 4px; height: 28px; border-radius: 2px; border: 0;
  background: var(--violet); box-shadow: 0 0 0 4px var(--card);
}
input[type="range"]:active::-webkit-slider-thumb { transform: scaleX(0.6); }
input[type="range"]:disabled { opacity: 0.38; cursor: not-allowed; }

.toggle-group { display: inline-flex; gap: 4px; padding: 4px; border-radius: 999px; background: var(--surface-low); }
.toggle-group button {
  height: 30px; padding: 0 14px; border: 0; border-radius: 999px; background: none;
  font-size: 13px; font-weight: 500; color: var(--muted);
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.toggle-group button:hover { color: var(--ink); }
.toggle-group button[aria-checked="true"] { background: var(--card); color: var(--violet); box-shadow: var(--elev-1); }

/* Material-style switch */
.switch { cursor: pointer; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch-track {
  position: relative; width: 52px; height: 32px; border-radius: 999px;
  background: var(--surface-low); border: 2px solid var(--subtle);
  transition: background-color .2s var(--ease), border-color .2s var(--ease);
}
.switch-thumb {
  position: absolute; top: 50%; left: 6px;
  display: grid; place-items: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--subtle); color: var(--violet);
  transform: translateY(-50%);
  transition: all .25s var(--ease-spring);
}
.switch-thumb svg { width: 16px; height: 16px; opacity: 0; transition: opacity .2s; }
.switch input:checked + .switch-track { background: var(--violet); border-color: var(--violet); }
.switch input:checked + .switch-track .switch-thumb { left: 22px; width: 24px; height: 24px; background: #fff; }
.switch input:checked + .switch-track .switch-thumb svg { opacity: 1; }
.switch input:focus-visible + .switch-track { outline: 2px solid var(--violet); outline-offset: 2px; }

/* Telemetry */
.readouts {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 0;
}
.readouts > div { padding: 10px 12px; border-radius: var(--radius-m); background: var(--bg); }
.readouts dt { font-size: 12px; color: var(--subtle); }
.readouts dd { margin: 2px 0 0; font-size: 17px; font-weight: 500; color: var(--ink); }

.spark { margin-top: 16px; }
.spark-label { display: flex; justify-content: space-between; font-size: 12px; color: var(--subtle); margin-bottom: 6px; }
#spark { display: block; width: 100%; height: 56px; }

.inspector {
  display: flex; gap: 14px; align-items: center;
  margin-top: 16px; padding: 12px;
  border-radius: var(--radius-l); background: var(--bg);
}
.inspector-glyph {
  flex: none; display: grid; place-items: center;
  width: 60px; height: 60px; border-radius: 16px;
  background: var(--primary-container); color: var(--violet);
  font-family: var(--font-ui); font-weight: 900; font-size: 34px; line-height: 1;
}
.inspector dl { margin: 0; flex: 1; display: grid; gap: 1px; font-size: 11px; }
.inspector dl > div { display: flex; justify-content: space-between; gap: 8px; }
.inspector dt { color: var(--subtle); }
.inspector dd { margin: 0; color: var(--ink); text-align: right; }

.pointer-line { margin: 12px 4px 0; font-size: 11px; color: var(--subtle); white-space: pre; }
.pointer-line span { color: var(--muted); }

/* ---------- Footer ---------- */
.footer {
  max-width: 1360px; margin: 0 auto; padding: 16px 32px 40px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px;
  font-size: 13px; color: var(--subtle);
}
.footer p { margin: 0; }

/* ---------- Dialog ---------- */
.dialog {
  width: min(520px, calc(100vw - 32px)); padding: 0;
  border: 0; border-radius: var(--radius-xl);
  background: var(--card); color: var(--ink);
  box-shadow: 0 12px 40px -8px rgba(32, 33, 36, 0.28);
}
.dialog[open] { animation: dialog-in .35s var(--ease); }
.dialog::backdrop { background: rgba(31, 31, 31, 0.32); }
@keyframes dialog-in { from { opacity: 0; transform: translateY(12px) scale(0.97); } }
.dialog-inner { padding: 24px; }
.dialog-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 16px; }
.dialog-icon {
  display: grid; place-items: center; width: 48px; height: 48px; border-radius: 16px;
  background: var(--primary-container); color: var(--violet);
}
.dialog-icon svg { width: 26px; height: 26px; }
.dialog h2 { margin: 0 0 8px; font-size: 24px; font-weight: 500; letter-spacing: -0.015em; }
.dialog-lede { margin: 0 0 20px; color: var(--muted); }
.modes-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 14px; }
.modes-list li { display: flex; gap: 14px; }
.mode-icon {
  display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface-low); color: var(--violet);
}
.mode-icon svg { width: 20px; height: 20px; }
.modes-list strong { font-weight: 500; }
.modes-list p { margin: 2px 0 0; font-size: 14px; color: var(--muted); }
.dialog-keys { margin: 20px 0 0; font-size: 13px; color: var(--muted); line-height: 2; }
kbd {
  display: inline-block; margin: 0 4px 0 0; padding: 0 7px; line-height: 22px;
  border: 1px solid var(--border); border-bottom-width: 2px; border-radius: 6px;
  font-family: var(--font-mono); font-size: 11px; color: var(--ink); background: var(--bg);
}
.dialog-keys kbd:not(:first-child) { margin-left: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; margin-top: 24px; }

/* ---------- Entrance ---------- */
.hero, .stage-panel, .panel-section {
  animation: rise .7s var(--ease) both;
}
.stage-panel { animation-delay: .08s; }
.panel-section:nth-child(1) { animation-delay: .16s; }
.panel-section:nth-child(2) { animation-delay: .24s; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .workspace { grid-template-columns: 1fr; }
  .panel { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
  .hero { grid-template-columns: 1fr; }
  .hero-meta { grid-auto-flow: row; grid-template-columns: repeat(3, auto); justify-content: start; }
}

@media (max-width: 720px) {
  .appbar { padding: 0 8px 0 16px; gap: 10px; }
  .appbar-title, .appbar-divider { display: none; }
  .btn-text span { display: none; }
  .btn-text { padding: 0; width: 40px; justify-content: center; }
  .app { padding: 8px 12px 12px; }
  .hero { padding: 16px 4px 24px; }
  .hero-lede { font-size: 16px; }
  .hero-meta { grid-template-columns: 1fr 1fr; gap: 12px 24px; }
  .toolbar { flex-wrap: wrap; padding: 10px; }
  .segmented { width: 100%; }
  .segmented button { flex: 1; padding: 0 8px; }
  .segmented button span { display: none; }
  .segmented button[aria-checked="true"] span { display: inline; }
  .toolbar-actions { width: 100%; justify-content: flex-end; }
  .stage-wrap { margin: 0 8px; height: clamp(360px, 56svh, 520px); }
  .stage-hint { top: 50px; left: 14px; right: auto; font-size: 11px; white-space: normal; max-width: calc(100% - 28px); }
  .prompt { padding: 12px 10px 14px; }
  .prompt-count { display: none; }
  .footer { padding: 12px 16px 32px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition-duration: 0s !important; }
}

/* ---------- Intro ---------- */
.intro-lock body { overflow: hidden; }

.intro {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg);
  transition: background-color .65s var(--ease);
  /* Failsafe: never trap the page if the intro script doesn't run. */
  animation: intro-failsafe .4s 7s forwards;
}
.intro.is-running { animation: none; }
.intro.is-leaving { background-color: rgba(248, 249, 250, 0); pointer-events: none; }
@keyframes intro-failsafe { to { opacity: 0; visibility: hidden; } }

.intro-canvas { position: absolute; inset: 0; width: 100%; height: 100%; }

.intro-mark {
  position: absolute; top: 16px; left: 24px;
  display: inline-flex; align-items: center; gap: 8px;
  animation: intro-fade .6s var(--ease) both;
}
.intro-mark svg { width: 18px; height: 18px; }

.intro-sub {
  position: absolute; left: 0; right: 0; bottom: 14vh; margin: 0;
  text-align: center; font-size: 15px; color: var(--muted);
  animation: intro-fade .7s .55s var(--ease) both;
}

.intro-skip {
  position: absolute; right: 20px; bottom: 20px;
  height: 36px; padding: 0 16px; border: 0; border-radius: 999px;
  background: none; color: var(--muted); font-size: 13px; font-weight: 500;
  animation: intro-fade .6s 1s var(--ease) both;
  transition: background-color .2s var(--ease), color .2s var(--ease);
}
.intro-skip:hover { background: var(--state-hover); color: var(--violet); }

.intro.is-leaving .intro-mark,
.intro.is-leaving .intro-sub,
.intro.is-leaving .intro-skip { opacity: 0; transition: opacity .3s var(--ease); animation: none; }

@keyframes intro-fade { from { opacity: 0; transform: translateY(6px); } }

/* The site rises in once the intro hands over. */
html:has(.intro:not(.is-leaving)) :is(.appbar, .hero, .stage-panel, .panel-section) { animation-play-state: paused; }
.appbar { animation: rise .7s var(--ease) both; }
