:root {
  /* A mid-century title sequence: three print colours. Black ink on mustard and paper; ink is the accent. */
  --bg: #e0ad10;          /* mustard ground, the one colour */
  --bg-2: #c99a0c;
  --panel: #f1e8d4;       /* paper stock */
  --panel-2: #e7dcc3;
  --panel-3: #dccfb2;
  --line: #cdbd99;
  --line-2: #1d1a16;
  --ink: #1d1a16;
  --text: #1d1a16;
  --muted: #5c5141;
  --dim: #85785f;
  --on-ground: #3d2d0c;
  --paste: #4a4237;       /* the stage's surround: a dark viewing table */
  --accent: #1d1a16;      /* ink carries the accent */
  --accent-2: #3a342b;
  --accent-ink: #f1e8d4;
  --accent-soft: rgba(29, 26, 22, 0.1);
  --display: 'Staatliches', 'Jost', sans-serif;
  --gut: clamp(18px, 5vw, 72px);
  --ui: 'Jost', system-ui, sans-serif;
  --radius: 0;
  --names: 168px;
  --cut: 6px 6px 0 var(--ink);
  color-scheme: light;
}
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15.5px/1.5 var(--ui);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: 0.35; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
svg *:focus, svg:focus { outline: none; }
h1, h2, h3 { margin: 0; }
p { margin: 0; }
.dim { color: var(--dim); }
.small { font-size: 13.5px; color: var(--muted); }

/* ---------- header ---------- */
.site-head {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 32px;
  height: 60px; padding: 0 var(--gut);
  background: var(--bg);
  border-bottom: 2px solid var(--ink);
}
.logo { position: relative; display: flex; align-items: center; color: var(--text); text-decoration: none; }
.logo-slip { display: block; padding: 5px 9px 2px; background: var(--ink); color: var(--panel); font: 400 25px/1 var(--display); letter-spacing: 0.04em; transform: rotate(-2.5deg); clip-path: polygon(0 4%, 22% 0, 61% 3%, 100% 0, 98% 52%, 100% 100%, 64% 96%, 30% 100%, 2% 97%, 0 48%); }
.logo-dot { position: absolute; right: -9px; top: -4px; width: 14px; height: 14px; border-radius: 50%; background: var(--panel); border: 2px solid var(--ink); box-sizing: border-box; }
.site-nav { display: flex; gap: clamp(14px, 3vw, 32px); margin-left: auto; }
.site-nav a { color: var(--ink); text-decoration: none; font-size: 13px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.site-nav a:hover { color: var(--panel); }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 36px; padding: 1px 16px 0; border-radius: 0; border: 2px solid var(--ink);
  font-size: 12.5px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; white-space: nowrap;
}
.btn svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.btn-primary { background: var(--ink); color: var(--panel); }
.btn-primary:hover { background: var(--panel); color: var(--ink); }
.btn-pill { height: 44px; padding: 0 22px; font-size: 15px; text-decoration: none; }
.btn-ghost { background: var(--panel); color: var(--text); }
.btn-ghost:hover { background: var(--panel-2); }
.btn-small { height: 30px; padding: 0 12px; font-size: 13px; font-weight: 500; }
.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; padding: 0;
  border-radius: 0; border: 1px solid transparent; background: transparent; color: var(--ink);
}
.icon-btn:hover:not(:disabled) { background: var(--panel-3); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.toggle[aria-pressed='true'] { color: var(--accent); background: var(--accent-soft); }

/* ---------- hero: a title card ---------- */
/* The headline is hand-set on cut-paper slips at different heights, so the ball has steps to bounce down
   and back up. Each slip gets a seeded tilt and scissor-cut edges in js/hero.js. */
.hero { padding: 0 var(--gut) clamp(64px, 10vh, 112px); }
.title-card { position: relative; padding: clamp(96px, 10vw, 150px) 0 0; }
.hero h1 { --fs: clamp(52px, 6.4vw, 104px); display: flex; flex-wrap: nowrap; align-items: flex-start; gap: 0 0.16em; font: 400 var(--fs)/1 var(--display); letter-spacing: 0.01em; text-transform: uppercase; padding-bottom: 0.2em; }
.slip { display: inline-block; margin-top: calc(var(--y) * var(--fs)); font-size: calc(var(--s) * 1em); padding: 0.1em 0.2em 0.02em; background: var(--ink); color: var(--panel); transform: translateY(var(--dip, 0px)) rotate(calc(var(--rot, 0deg) + var(--wob, 0deg))); }
.hero-ball { position: absolute; inset: 0; pointer-events: none; }
.hero-ball i { position: absolute; left: 0; top: 0; border-radius: 50%; transform-origin: 50% 100%; box-sizing: border-box; }
.hero-ball i:first-child { z-index: 1; background: var(--panel); border: 2.5px solid var(--ink); }
/* Afterimage: eight earlier positions 22 ms apart, plain white, no outline. */
.hero-ball i:not(:first-child) { background: rgba(255, 255, 255, 0.38); }
.credits { display: grid; grid-template-columns: repeat(3, auto) minmax(260px, 420px); gap: 20px 48px; align-items: start; margin: clamp(30px, 5vh, 52px) 0 clamp(30px, 5vh, 44px); padding-top: 18px; border-top: 2px solid var(--ink); color: var(--on-ground); }
.credits dl { display: contents; margin: 0; }
.credits dt { font: 600 11.5px/1 var(--ui); letter-spacing: 0.2em; text-transform: uppercase; margin-bottom: 7px; }
.credits dd { margin: 0; font: 400 26px/1 var(--display); color: var(--ink); letter-spacing: 0.02em; text-transform: uppercase; }
.credits p { justify-self: end; font-size: 15.5px; color: var(--on-ground); }

/* ---------- editor shell ---------- */
.editor {
  display: grid;
  grid-template-columns: 216px minmax(0, 1fr) 300px;
  grid-template-rows: 52px minmax(0, 1fr) auto;
  grid-template-areas: 'top top top' 'layers stage insp' 'time time time';
  height: clamp(620px, calc(100svh - 160px), 860px);
  background: var(--panel);
  border: 2px solid var(--ink);
  box-shadow: var(--cut);
}
.ed-top { grid-area: top; display: flex; align-items: center; gap: 12px; padding: 0 10px 0 12px; border-bottom: 2px solid var(--ink); }
.ed-top .spacer, .transport .spacer { flex: 1; }
.add-group { display: flex; align-items: center; gap: 2px; padding-left: 12px; border-left: 1px solid var(--line); }
.tb-label { font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--dim); margin-right: 6px; }
.menu-wrap { position: relative; }
.menu {
  position: absolute; top: calc(100% + 6px); left: 0; z-index: 30; width: 360px; padding: 6px;
  background: var(--panel); border: 2px solid var(--ink); border-radius: 0;
  box-shadow: var(--cut);
}
.menu button { display: flex; gap: 12px; align-items: flex-start; width: 100%; padding: 8px; border: 0; border-radius: 0; background: none; text-align: left; }
.menu button:hover, .menu button:focus-visible { background: var(--panel-3); }
.menu img { width: 44px; height: 44px; flex: none; outline: 1.5px solid var(--ink); }
.menu strong { display: block; font: 400 18px/1 var(--display); letter-spacing: 0.04em; text-transform: uppercase; margin-bottom: 2px; }
.menu span span { display: block; font-size: 12px; color: var(--muted); line-height: 1.4; }

/* layers */
.ed-layers { grid-area: layers; display: flex; flex-direction: column; border-right: 2px solid var(--ink); min-height: 0; }
.panel-head { padding: 12px 14px 6px; }
.ed-layers h2, .canvas-set h2 { font: 600 11px/1 var(--ui); letter-spacing: 0.18em; text-transform: uppercase; color: var(--muted); }
.layer-list { list-style: none; margin: 0; padding: 4px 6px; overflow: auto; flex: 1; min-height: 60px; }
.layer-list li { display: flex; align-items: center; }
.layer-list li.sel { background: var(--ink); }
.layer-list li.sel .lname, .layer-list li.sel .ltype, .layer-list li.sel .eye { color: var(--panel); }
.layer-list li.sel .lbadge { background: var(--bg); color: var(--ink); }
.layer-list li.off .lname { color: var(--dim); }
.layer-list .empty { padding: 8px; color: var(--dim); font-size: 13px; }
.eye { width: 28px; height: 30px; display: grid; place-items: center; border: 0; background: none; color: var(--dim); padding: 0; flex: none; }
.eye:hover { color: var(--text); }
.eye svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.4; }
.lname { flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; height: 30px; padding: 0 8px 0 2px; border: 0; background: none; font-size: 13.5px; text-align: left; }
.layer-list li.sel .lname { color: var(--panel); font-weight: 600; }
.ltype svg { width: 14px; height: 14px; display: block; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.ltype { color: var(--muted); flex: none; }
.ltxt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lbadge { margin-left: auto; font-size: 11px; color: var(--muted); background: var(--panel-3); border-radius: 0; padding: 1px 5px; font-variant-numeric: tabular-nums; }
.layer-actions { display: flex; gap: 2px; padding: 4px 8px; border-top: 1px solid var(--line); }
.canvas-set { padding: 12px 14px 14px; border-top: 1px solid var(--line); display: grid; gap: 10px; }
.seg { display: flex; padding: 0; background: var(--panel); border: 1.5px solid var(--ink); border-radius: 0; gap: 0; }
.seg button { flex: 1; height: 28px; border: 0; border-radius: 0; background: none; color: var(--muted); font-size: 12.5px; font-weight: 500; display: grid; place-items: center; }
.seg button:hover { color: var(--text); }
.seg button + button { border-left: 1.5px solid var(--ink); }
.seg button[aria-checked='true'], .seg button[aria-pressed='true'] { background: var(--ink); color: var(--panel); }
.seg svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.color-field { display: flex; align-items: center; justify-content: space-between; gap: 12px; font-size: 13px; color: var(--muted); }
.swatch { position: relative; width: 28px; height: 28px; border-radius: 0; overflow: hidden; box-shadow: 0 0 0 1.5px var(--ink); display: inline-block; flex: none; }
.swatch.big { width: 36px; height: 36px; }
.swatch input { position: absolute; inset: -8px; width: calc(100% + 16px); height: calc(100% + 16px); border: 0; padding: 0; cursor: pointer; background: none; }

/* stage */
.ed-stage {
  grid-area: stage; position: relative; display: grid; place-items: center; min-width: 0; min-height: 0;
  background-color: var(--paste);
  background-image: radial-gradient(circle at 1px 1px, #5f5546 1px, transparent 0);
  background-size: 18px 18px;
}
#stage { display: block; touch-action: none; box-shadow: 5px 5px 0 #0f0d0a; overflow: hidden; font: 16px/1 sans-serif; letter-spacing: normal; word-spacing: normal; text-transform: none; font-feature-settings: normal; }
#stageContent [data-l] { cursor: grab; }
.ov-box { fill: none; filter: drop-shadow(0 0 1px #000); stroke: #fff8ee; stroke-width: 1.5; vector-effect: non-scaling-stroke; pointer-events: none; }
.ov-stem { filter: drop-shadow(0 0 1px #000); stroke: #fff8ee; stroke-width: 1.5; vector-effect: non-scaling-stroke; pointer-events: none; }
.ov-handle { fill: #fff8ee; stroke: #1d1a16; stroke-width: 1.5; vector-effect: non-scaling-stroke; cursor: grab; }
.ov-path { fill: none; stroke: rgba(255, 250, 240, 0.6); stroke-width: 1.2; stroke-dasharray: 3 4; vector-effect: non-scaling-stroke; pointer-events: none; }
.ov-pathkey { fill: #fff8ee; stroke: #1d1a16; stroke-width: 1; pointer-events: none; }
.ov-anchor { fill: none; filter: drop-shadow(0 0 1px #000); stroke: #fff8ee; stroke-width: 1.5; vector-effect: non-scaling-stroke; pointer-events: none; }
.stage-hint { position: absolute; left: 14px; bottom: 10px; font-size: 12px; color: #a99d86; pointer-events: none; }

/* inspector */
.ed-insp { grid-area: insp; display: flex; flex-direction: column; border-left: 2px solid var(--ink); min-height: 0; }
.tabs { display: flex; gap: 2px; padding: 8px 10px 0; border-bottom: 1px solid var(--line); }
.tabs button { flex: 1; height: 34px; border: 0; background: none; color: var(--muted); font-size: 12px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; border-bottom: 3px solid transparent; margin-bottom: -1px; }
.tabs button[aria-selected='true'] { color: var(--text); border-bottom-color: var(--ink); }
.insp-body { overflow: auto; flex: 1; padding: 4px 14px 16px; overscroll-behavior: contain; }
.insp-empty { padding: 20px 4px; display: grid; gap: 8px; font-size: 13.5px; color: var(--muted); }
.group { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; gap: 10px; }
.group:last-child { border-bottom: 0; }
.group h3 { font: 600 11px/1.2 var(--ui); letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.group h3 .dim { font-weight: 400; margin-left: 4px; }
.hint { font-size: 12.5px; color: var(--dim); line-height: 1.45; }
.hint.lead { color: var(--muted); }
.field { display: grid; gap: 5px; font-size: 12px; color: var(--muted); }
.field input, .select {
  height: 32px; padding: 0 10px; border-radius: 0; border: 1.5px solid var(--ink); background: #fbf6ea; font-size: 13.5px; color: var(--text); width: 100%;
}
.field textarea { min-height: 76px; padding: 8px 10px; border-radius: 0; border: 1.5px solid var(--ink); background: #fbf6ea; font: 14px/1.4 var(--ui); color: var(--text); width: 100%; resize: vertical; }
.field input:focus, .field textarea:focus, .select:focus, .pnum:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 2px var(--bg); }
.hint.warn { color: #93301d; }
.wrow { grid-template-columns: 62px minmax(0, 1fr); }
/* Anchor picker: nine squares, the chosen one filled. */
.anchor-row { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 12px; align-items: center; }
.anchor { display: grid; grid-template-columns: repeat(3, 24px); border: 1.5px solid var(--ink); background: var(--panel); }
.anchor button { width: 24px; height: 24px; border: 0; padding: 0; background: none; display: grid; place-items: center; }
.anchor button i { width: 6px; height: 6px; border: 1.5px solid var(--dim); }
.anchor button:hover i { border-color: var(--ink); }
.anchor button[aria-pressed='true'] i { width: 9px; height: 9px; background: var(--ink); border-color: var(--ink); }
.srow { display: grid; grid-template-columns: 62px minmax(0, 1fr) 46px; align-items: center; gap: 10px; font-size: 13px; color: var(--muted); }
.srow output { text-align: right; color: var(--text); font-variant-numeric: tabular-nums; font-size: 12.5px; }
input[type='range'] { -webkit-appearance: none; appearance: none; width: 100%; height: 22px; background: none; margin: 0; cursor: pointer; }
input[type='range']::-webkit-slider-runnable-track { height: 2px; background: var(--ink); }
input[type='range']::-moz-range-track { height: 2px; background: var(--ink); }
input[type='range']::-moz-range-progress { height: 2px; background: var(--accent); }
/* The thumb is the ball from the logo. */
input[type='range']::-webkit-slider-thumb { -webkit-appearance: none; width: 15px; height: 15px; margin-top: -6.5px; border-radius: 50%; background: var(--panel); border: 2.5px solid var(--ink); box-sizing: border-box; }
input[type='range']::-moz-range-thumb { width: 15px; height: 15px; border-radius: 50%; background: var(--panel); border: 2.5px solid var(--ink); box-sizing: border-box; }
input[type='range']:focus-visible { outline: none; }
input[type='range']:focus-visible::-webkit-slider-thumb { box-shadow: 0 0 0 3px var(--bg); }
.colors { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; width: 100%; margin-top: 2px; }
.chip-col, .chip-grad { width: 22px; height: 22px; border-radius: 50%; border: 0; padding: 0; box-shadow: inset 0 0 0 1.5px rgba(29, 26, 22, 0.5); }
.chip-grad { border-radius: 0; width: 28px; }
.chip-col:hover, .chip-grad:hover { transform: scale(1.12); }
.quick { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { height: 28px; padding: 0 10px; border-radius: 0; border: 1.5px solid var(--ink); background: var(--panel); font-size: 12.5px; font-weight: 500; }
.chip:hover { background: var(--ink); color: var(--panel); }
.chip-quiet { color: var(--muted); border-style: dashed; }
.chip[aria-pressed='true'] { background: var(--ink); color: var(--panel); }
.chip:disabled { opacity: 0.45; cursor: not-allowed; }
.chip:disabled:hover { background: var(--panel); color: inherit; }
.quick .hint { align-self: center; }

/* property rows */
.props { display: grid; gap: 2px; }
.prow { display: grid; grid-template-columns: 22px 1fr 82px 18px; align-items: center; gap: 6px; height: 32px; }
.plabel { font-size: 13px; color: var(--muted); cursor: ew-resize; user-select: none; touch-action: none; }
.prow.animated .plabel { color: var(--text); }
.pnum { height: 28px; width: 100%; padding: 0 8px; border-radius: 0; border: 1.5px solid var(--ink); background: #fbf6ea; font-size: 13px; text-align: right; font-variant-numeric: tabular-nums; -moz-appearance: textfield; }
.pnum::-webkit-inner-spin-button { display: none; }
.punit { font-size: 12px; color: var(--dim); }
.kbtn { width: 22px; height: 22px; border: 0; background: none; padding: 0; display: grid; place-items: center; }
.kbtn::before { content: ''; width: 9px; height: 9px; transform: rotate(45deg); border: 1.5px solid var(--dim); border-radius: 1.5px; }
.kbtn:hover::before { border-color: var(--text); }
.kbtn[data-state='anim']::before { border-color: var(--ink); background: var(--bg); }
.kbtn[data-state='on']::before { background: var(--ink); border-color: var(--ink); }

/* easing graph */
.ease-graph { width: 100%; max-width: 224px; display: block; margin: 0 auto; touch-action: none; overflow: visible; }
.eg-box { fill: #fbf6ea; stroke: var(--ink); stroke-width: 1.5; }
.eg-grid { stroke: var(--line); }
.eg-lab { fill: var(--dim); font: 10px var(--ui); }
.eg-curve { fill: none; stroke: var(--text); stroke-width: 2.2; stroke-linejoin: round; }
.eg-arm { stroke: var(--accent); stroke-width: 1.3; }
.eg-handle { fill: var(--bg); stroke: var(--ink); stroke-width: 2; cursor: grab; }
.eg-end { fill: var(--text); }
.eg-scan, .eg-dot, .eg-ball, .eg-track, .eg-curve, .eg-arm, .eg-grid, .eg-lab { pointer-events: none; }
.eg-scan { stroke: rgba(29, 26, 22, 0.14); }
.eg-dot { fill: var(--bg); stroke: var(--ink); stroke-width: 1.2; }
.eg-track { stroke: var(--line); stroke-width: 2; stroke-linecap: round; }
.eg-ball { fill: var(--bg); stroke: var(--ink); stroke-width: 1.5; }
.ease-chips { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px; }
.echip { display: flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px 0 6px; border-radius: 0; border: 1.5px solid var(--line); background: var(--panel); font-size: 12.5px; text-align: left; color: var(--muted); }
.echip svg { width: 22px; height: 22px; flex: none; }
.echip polyline { fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linejoin: round; }
.echip:hover { color: var(--text); }
.echip[aria-pressed='true'] { border-color: var(--ink); color: var(--panel); background: var(--ink); }
.echip[aria-pressed='true'] polyline { stroke: var(--bg); }
.ease-note { font-size: 12.5px; color: var(--muted); }
.ease-css { font: 11.5px/1.4 ui-monospace, 'SF Mono', Menlo, monospace; color: var(--dim); word-break: break-all; }
.ease-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* timeline */
.ed-time { grid-area: time; border-top: 2px solid var(--ink); background: var(--panel); }
.transport { display: flex; align-items: center; gap: 14px; height: 46px; padding: 0 12px; border-bottom: 1px solid var(--line); }
.play-btn { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; padding: 0; flex: none; }
.play-btn svg { width: 16px; height: 16px; grid-area: 1 / 1; }
.play-btn .i-pause { fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.play-btn .i-play { fill: currentColor; }
.editor.is-playing .i-play, .editor:not(.is-playing) .i-pause { display: none; }
.readout { font-size: 13.5px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.readout #timeOut { display: inline-block; min-width: 2.6em; text-align: right; font-weight: 600; }
.readout { font-feature-settings: 'tnum'; }
.beat #beatOut { display: inline-block; min-width: 2.2em; font-weight: 600; }
.tfield { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); }
.tfield input, .tfield select { height: 28px; border-radius: 0; border: 1.5px solid var(--ink); background: #fbf6ea; font-size: 13px; letter-spacing: 0; text-transform: none; padding: 0 6px; }
.tfield input { width: 56px; text-align: right; font-variant-numeric: tabular-nums; }
.tl { position: relative; height: 172px; display: flex; flex-direction: column; user-select: none; touch-action: none; }
.tl-head { display: flex; height: 26px; border-bottom: 1px solid var(--line); flex: none; }
.tl-names-head { width: var(--names); flex: none; font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--muted); padding: 6px 12px; border-right: 1px solid var(--line); }
.tl-ruler { position: relative; flex: 1; margin-right: 14px; cursor: ew-resize; }
.tl-ruler .rb { position: absolute; top: 0; bottom: 0; padding: 5px 0 0 5px; font-size: 11px; font-weight: 600; color: var(--muted); border-left: 1.5px solid var(--ink); font-variant-numeric: tabular-nums; }
.tl-ruler i { position: absolute; bottom: 0; height: 6px; border-left: 1px solid var(--muted); }
.tl-rows { flex: 1; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; }
.tl-row { display: flex; height: 26px; }
.tl-row.lrow { height: 28px; border-top: 1px solid var(--line); }
.tl-row.lrow:first-child { border-top: 0; }
.tl-name { width: var(--names); flex: none; display: flex; align-items: center; gap: 8px; padding: 0 12px; font-size: 12.5px; border-right: 1px solid var(--line); cursor: pointer; overflow: hidden; color: var(--muted); }
.lrow.sel .tl-name { color: var(--panel); font-weight: 600; background: var(--ink); }
.lrow.off .tl-name { color: var(--dim); }
.tl-name.sub { padding-left: 34px; font-size: 12px; color: var(--dim); cursor: default; }
.prow-t.animated .tl-name.sub { color: var(--muted); }
.tl-track {
  position: relative; flex: 1; margin-right: 14px; cursor: crosshair;
  background-image: linear-gradient(to right, var(--line) 1px, transparent 1px), linear-gradient(to right, rgba(29, 26, 22, 0.05) 1px, transparent 1px);
  background-size: calc(100% / var(--beats)) 100%, calc(100% / var(--subs)) 100%;
}
.prow-t .tl-track { background-color: rgba(29, 26, 22, 0.025); }
.segbar { position: absolute; top: 50%; height: 4px; margin-top: -2px; background: rgba(29, 26, 22, 0.26); border-radius: 0; pointer-events: none; }
.segbar.hold { background: repeating-linear-gradient(90deg, rgba(29, 26, 22, 0.3) 0 3px, transparent 3px 6px); }
.kf {
  position: absolute; top: 50%; width: 22px; height: 22px; margin: -11px 0 0 -11px; padding: 0; border: 0; background: none; z-index: 1;
  display: grid; place-items: center; cursor: ew-resize; touch-action: none;
}
.kf i, .kf.sum::before { width: 10px; height: 10px; transform: rotate(45deg); background: var(--panel); border: 1.8px solid var(--ink); border-radius: 2px; display: block; }
.kf.sum::before { content: ''; width: 8px; height: 8px; border-color: var(--muted); background: var(--muted); }
.lrow.sel .kf.sum::before { background: var(--ink); border-color: var(--ink); }
.kf i.g-linear { border-radius: 0; }
.kf i.g-hold { transform: none; border-radius: 1px; width: 9px; height: 9px; }
.kf i.g-in, .kf i.g-out, .kf i.g-inout, .kf i.g-expo, .kf i.g-custom { border-radius: 2px 5px 2px 5px; }
.kf i.g-back, .kf i.g-anticipate, .kf i.g-spring, .kf i.g-bounce { border-radius: 50%; transform: none; }
.kf.sel i { background: var(--bg); border-color: var(--ink); box-shadow: 0 0 0 2px var(--ink); }
.kf:hover i { background: var(--accent-soft); }
.kf.sel:hover i { background: var(--bg); }
.tl-empty { padding: 12px; font-size: 13px; color: var(--dim); }
.tl-playhead {
  --t: 0; position: absolute; top: 0; bottom: 0; width: 0; pointer-events: none; z-index: 3;
  left: calc(var(--names) + (100% - var(--names) - 14px) * var(--t));
  border-left: 1.5px solid var(--accent);
}
.tl-playhead span { position: absolute; top: 0; left: -6px; width: 11px; height: 12px; background: var(--accent); clip-path: polygon(0 0, 100% 0, 100% 60%, 50% 100%, 0 60%); }

/* ---------- sections ---------- */
.section { padding: clamp(56px, 10vh, 112px) var(--gut); border-top: 2px solid var(--ink); }
.studio { padding-top: clamp(40px, 7vh, 80px); }
.section-head { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 40px; align-items: end; margin-bottom: clamp(24px, 4vh, 40px); }
.section-head h2, .export-grid h2 { font: 400 clamp(36px, 4.4vw, 66px)/0.98 var(--display); letter-spacing: 0.01em; text-transform: uppercase; text-wrap: balance; }
.section-head p { color: var(--on-ground); max-width: 520px; }
.starter-grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.starter { display: grid; grid-template-columns: 148px minmax(0, 1fr); gap: 18px; align-items: center; width: 100%; padding: 12px; border: 2px solid var(--ink); background: var(--panel); text-align: left; box-shadow: var(--cut); transform: rotate(var(--tilt, 0deg)); transition: none; }
.starter-grid li:nth-child(3n+1) .starter { --tilt: -0.7deg; }
.starter-grid li:nth-child(3n+2) .starter { --tilt: 0.5deg; }
.starter-grid li:nth-child(3n) .starter { --tilt: -0.3deg; }
.starter:hover { --tilt: 0deg; background: #fbf6ea; }
.starter img { width: 148px; height: 148px; display: block; outline: 1.5px solid var(--ink); }
.st-text { display: grid; gap: 6px; }
.st-text strong { font: 400 28px/1 var(--display); letter-spacing: 0.03em; text-transform: uppercase; }
.st-text > span { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.st-text .st-meta { font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--dim); font-feature-settings: 'tnum'; }

.timing { background: var(--ink); color: var(--panel); }
.timing .section-head p { color: #c9bd9f; }
.lanes { list-style: none; margin: 0; padding: 0; border-top: 1.5px solid #4a4236; overflow: hidden; }
.lane-run { margin-right: 40px; }
.lane { display: grid; grid-template-columns: 60px 260px minmax(0, 1fr); gap: 24px; align-items: center; padding: 16px 0; border-bottom: 1.5px solid #4a4236; }
.lane-curve { width: 60px; height: 60px; }
.lane-curve rect { fill: none; stroke: #6b6050; }
.lane-curve polyline { fill: none; stroke: var(--bg); stroke-width: 2.4; stroke-linejoin: round; }
.lane-text strong { display: block; font: 400 25px/1.05 var(--display); letter-spacing: 0.04em; text-transform: uppercase; }
.lane-text span { font-size: 13.5px; color: #c9bd9f; }
.lane-run { position: relative; height: 40px; border-left: 2px solid #6b6050; border-right: 2px solid #6b6050; }
.lane-dot {
  position: absolute; top: 50%; left: 0; width: 32px; height: 32px; margin-top: -16px; border-radius: 50%; background: var(--bg);
  animation: lane 2.4s infinite;
}
@keyframes lane { 0%, 10% { left: 0; } 78%, 100% { left: calc(100% - 32px); } }
@media (prefers-reduced-motion: reduce) { .lane-dot { animation: none; } }

.export-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 56px; align-items: start; }
.export-grid h2 { margin-bottom: 20px; }
.export-grid p { color: var(--on-ground); max-width: 540px; margin-bottom: 14px; }
.export-grid .small { color: var(--on-ground); }
.export-grid p strong { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.code-card { margin: 0; padding: 20px; background: var(--panel); border: 2px solid var(--ink); box-shadow: var(--cut); display: grid; gap: 10px; transform: rotate(0.6deg); }
.code-card figcaption { font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase; color: var(--muted); }
.code-card pre { margin: 0 0 8px; padding: 14px 16px; border-radius: 0; background: var(--ink); border: 0; overflow-x: auto; font: 13px/1.6 ui-monospace, 'SF Mono', Menlo, monospace; color: var(--panel); }
.code-card pre span { color: var(--bg); }

.site-foot { padding: 28px var(--gut) 40px; border-top: 2px solid var(--ink); color: var(--on-ground); font-size: 13.5px; }
.site-foot strong { color: var(--ink); }

/* ---------- export dialog ---------- */
.export-dialog { padding: 0; border: 2px solid var(--ink); border-radius: 0; box-shadow: var(--cut); background: var(--panel); color: var(--text); width: min(860px, calc(100vw - 32px)); max-height: calc(100vh - 32px); }
.export-dialog::backdrop { background: rgba(29, 26, 22, 0.7); }
.xd { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); position: relative; }
.xd-preview { background-color: var(--paste); background-image: radial-gradient(circle at 1px 1px, #5f5546 1px, transparent 0); background-size: 18px 18px; display: grid; place-items: center; padding: 28px; min-height: 340px; }
.xd-preview img { max-width: 100%; max-height: 440px; box-shadow: 5px 5px 0 #0f0d0a; }
.xd-side { padding: 28px 24px 24px; display: grid; gap: 14px; align-content: start; }
.xd-side h2 { font: 400 34px/1 var(--display); letter-spacing: 0.02em; text-transform: uppercase; padding-right: 30px; }
.xd-meta { font-size: 13.5px; color: var(--text); font-variant-numeric: tabular-nums; }
.xd-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.xd-close { position: absolute; top: 14px; right: 14px; }

.toast { position: fixed; left: 50%; bottom: 24px; z-index: 50; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; padding: 10px 16px; border-radius: 0; background: var(--ink); color: var(--panel); font-size: 13.5px; font-weight: 500; max-width: calc(100vw - 32px); transition: opacity 0.2s, transform 0.2s; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- narrower desktops ---------- */
@media (max-width: 1180px) {
  .editor { grid-template-columns: 184px minmax(0, 1fr) 276px; }
  .starter-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .credits { grid-template-columns: repeat(3, auto); }
  .credits p { grid-column: 1 / -1; justify-self: start; max-width: 560px; }
}

/* ---------- phone and tablet ---------- */
@media (max-width: 900px) {
  :root { --names: 96px; }
  .site-head { height: 54px; gap: 16px; }
  .site-nav { gap: 16px; }
  .site-nav a:nth-child(3) { display: none; }
  .hero { padding: 0 12px 64px; }
  .title-card { padding-top: 88px; }
  .hero h1 { --fs: min(14.5vw, 80px); flex-wrap: wrap; row-gap: 0.14em; padding: 0 4px 0.3em; }
  .slip { margin-top: calc(var(--ym, var(--y)) * var(--fs)); }
  .credits { grid-template-columns: repeat(3, auto); gap: 16px 18px; margin: 22px 4px 24px; }
  .credits dt { font-size: 10px; letter-spacing: 0.16em; }
  .credits dd { font-size: 18px; }
  .credits p { font-size: 14.5px; }
  .studio { padding-left: 12px; padding-right: 12px; }
  .studio .section-head { padding: 0 4px; }
  .editor {
    height: auto; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto;
    grid-template-areas: 'top' 'stage' 'time' 'insp' 'layers';
    box-shadow: 4px 4px 0 var(--ink);
  }
  .ed-top { height: auto; flex-wrap: wrap; gap: 6px; padding: 8px; }
  .tb-label { display: none; }
  .add-group { order: 5; width: 100%; justify-content: space-between; padding: 6px 0 0; border-left: 0; border-top: 1.5px solid var(--ink); }
  .add-group .icon-btn { width: 44px; height: 36px; }
  .icon-btn { width: 30px; }
  .btn { padding: 0 11px; }
  .menu { position: fixed; top: auto; left: 12px; right: 12px; width: auto; max-height: 70vh; overflow: auto; }
  .ed-stage { background: var(--paste); }
  #stage { border-radius: 0; box-shadow: none; }
  .stage-hint { display: none; }
  .transport { gap: 10px; padding: 0 8px; flex-wrap: wrap; height: auto; min-height: 46px; padding-top: 7px; padding-bottom: 7px; row-gap: 6px; }
  .transport .beat { display: none; }
  .tfield { gap: 4px; }
  .tfield input { width: 50px; }
  .tl { height: auto; max-height: 300px; }
  .tl-rows { max-height: 260px; }
  .tl-name { padding: 0 8px; gap: 6px; }
  .tl-name .ltype { display: none; }
  .tl-name.sub { padding-left: 14px; }
  .tl-ruler, .tl-track { margin-right: 10px; }
  .tl-playhead { left: calc(var(--names) + (100% - var(--names) - 10px) * var(--t)); }
  .tl-row { height: 30px; }
  .tl-row.lrow { height: 32px; }
  .ed-insp { border-left: 0; border-top: 2px solid var(--ink); }
  .insp-body { overflow: visible; }
  .ed-layers { border-right: 0; border-top: 2px solid var(--ink); }
  .layer-list { max-height: none; }
  .canvas-set { grid-template-columns: 1fr auto; align-items: center; }
  .canvas-set h2 { grid-column: 1 / -1; }

  .section-head { grid-template-columns: 1fr; gap: 12px; margin-bottom: 24px; }
  .section-head h2, .export-grid h2 { font-size: 38px; }
  .starter-grid { grid-template-columns: 1fr; gap: 10px; }
  .starter { grid-template-columns: 104px minmax(0, 1fr); gap: 14px; padding: 10px; }
  .starter img { width: 104px; height: 104px; }
  .st-text strong { font-size: 24px; }
  .st-text > span { font-size: 13px; }
  .lane { grid-template-columns: 44px minmax(0, 1fr); gap: 6px 14px; }
  .lane-curve { width: 44px; height: 44px; }
  .lane-run { grid-column: 1 / -1; }
  .export-grid { grid-template-columns: 1fr; gap: 28px; }
  .code-card { padding: 14px; }
  .code-card pre { font-size: 12px; }

  .xd { grid-template-columns: 1fr; }
  .xd-preview { min-height: 0; padding: 16px; }
  .xd-preview img { max-height: 46vh; }
  .xd-side { padding: 18px 16px 18px; }
}
@media (max-width: 380px) {
  .site-nav a:nth-child(2) { display: none; }
}
