:root {
  --bg: #f7f6f3;
  --panel: #ffffff;
  --tint: #efede8;
  --text: #1b1c1f;
  --muted: #5f6168;
  --line: #e0ddd5;
  --line-strong: #c9c5bb;
  --accent: #d7362b;
  --mark: #e0912b;
  --shot: #2f9e62;
  --voice: #4f7fd6;
  --bad: #c9352b;
  --bad-tint: #fcecea;
  --code-bg: #f1efea;
  --link: #b42a20;
  --mono: ui-monospace, "SF Mono", Menlo, monospace;
  --shadow: 0 1px 2px rgba(0, 0, 0, .05), 0 8px 28px rgba(0, 0, 0, .08);
  --fast: 140ms;
  --wrap: 1240px;
  --gutter: max(16px, calc((100vw - var(--wrap)) / 2));
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #131417;
    --panel: #1b1c20;
    --tint: #24252a;
    --text: #ecebe8;
    --muted: #a2a2a8;
    --line: #2c2e34;
    --line-strong: #44464e;
    --accent: #ff5a4e;
    --bad: #ff7a70;
    --bad-tint: #3a2321;
    --code-bg: #222328;
    --link: #ff8177;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 8px 28px rgba(0, 0, 0, .4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 60px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--link); text-decoration: none; white-space: nowrap; }
code { font: .9em/1.5 var(--mono); }
p code, li code, dd code { background: var(--tint); border-radius: 4px; padding: 1px 4px; }
h1, h2, h3 { margin: 0; line-height: 1.15; letter-spacing: -.02em; }
h2 { font-size: 30px; }
h3 { font-size: 15px; letter-spacing: 0; }
kbd {
  display: inline-block; min-width: 24px; padding: 1px 6px;
  font: 600 13px/20px var(--mono); text-align: center; color: var(--text);
  background: var(--panel); border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px;
}

/* Nav */
.nav {
  position: sticky; top: 0; z-index: 5; height: 52px;
  display: flex; align-items: center; gap: 24px; padding: 0 var(--gutter);
  background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}
.wordmark { display: inline-flex; align-items: center; gap: 8px; font-weight: 650; color: var(--text); }
.nav nav { margin-left: auto; display: flex; align-items: center; gap: 20px; font-size: 15px; }
.nav nav a { color: var(--muted); display: inline-flex; align-items: center; gap: 6px; }

main > section { padding: 64px var(--gutter); }
main > section + section { border-top: 1px solid var(--line); }

/* Hero */
.hero { padding-top: 28px !important; }
.hero-copy { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: 14px 48px; align-items: end; margin-bottom: 20px; }
.hero h1 { font-size: clamp(32px, 4vw, 46px); letter-spacing: -.025em; word-spacing: .04em; grid-row: span 2; }
.lede { margin: 0; color: var(--muted); font-size: 16.5px; max-width: 62ch; }
.keys { margin: 0; color: var(--muted); font-size: 15px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; }
.keys > span { display: inline-flex; align-items: center; gap: 7px; white-space: nowrap; }

/* Player */
.player {
  display: grid; grid-template-columns: minmax(0, 1fr) 440px;
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); overflow: hidden;
}
.stage { padding: 14px; min-width: 0; border-right: 1px solid var(--line); }
.video-wrap { position: relative; aspect-ratio: 16 / 10; background: #000; border-radius: 8px; overflow: hidden; }
.video-wrap video { display: block; width: 100%; height: 100%; object-fit: contain; cursor: pointer; }
.play {
  position: absolute; left: 14px; bottom: 14px; height: 44px; min-width: 44px; padding: 0 12px; border-radius: 22px; border: 0;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; color: #fff;
  background: rgba(20, 20, 22, .74); backdrop-filter: blur(8px);
}
.play .i-pause, .player.playing .play .i-play { display: none; }
.player.playing .play .i-pause { display: inline; }
.player:not(.playing) .play { padding-right: 16px; }
.player:not(.playing) .play::after { content: "Play with sound"; font: 600 14px/1 -apple-system, system-ui, sans-serif; }

.rail { position: relative; height: 46px; margin: 12px 13px 0; cursor: pointer; touch-action: none; user-select: none; }
.lane { position: absolute; left: 0; right: 0; }
.lane.voice { top: 34px; height: 8px; background: var(--tint); border-radius: 4px; }
.lane.voice span { position: absolute; top: 0; height: 8px; border-radius: 4px; background: color-mix(in srgb, var(--voice) 40%, var(--tint)); transition: background-color var(--fast); }
.lane.voice span.on { background: var(--voice); }
.lane.marks { top: 0; height: 26px; z-index: 1; }
.lane.marks button {
  position: absolute; top: 0; translate: -50% 0; width: 26px; height: 26px; padding: 0; border-radius: 50%;
  border: 2px solid var(--panel); color: #fff; font: 700 12px/1 -apple-system, system-ui, sans-serif; background: var(--mark);
}
.lane.marks button.screenshot { background: var(--shot); }
.lane.marks button.on { border-color: var(--panel); box-shadow: 0 0 0 2px var(--mark); }
.lane.marks button.screenshot.on { box-shadow: 0 0 0 2px var(--shot); }
.playhead { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--voice); pointer-events: none; }
.caption { display: flex; align-items: baseline; gap: 12px; margin: 10px 4px 0; height: 48px; overflow: hidden; font-size: 15px; line-height: 24px; }
.caption .time { font: 600 13px/24px var(--mono); color: var(--muted); flex: none; width: 36px; font-variant-numeric: tabular-nums; }

/* The inspector matches the stage's height and scrolls inside. */
.inspector { display: flex; flex-direction: column; min-width: 0; height: 0; min-height: 100%; }
.ins-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.mark-nav, .seg, .tabs { display: flex; gap: 2px; padding: 2px; background: var(--tint); border-radius: 8px; }
.mark-nav button, .seg button, .tabs button {
  height: 26px; padding: 0 10px; border: 0; border-radius: 6px; background: transparent; color: var(--muted);
  font: 500 13px/26px -apple-system, system-ui, sans-serif; white-space: nowrap;
}
.mark-nav button[aria-selected=true], .seg button[aria-selected=true], .tabs button[aria-selected=true] {
  background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .14);
}
.ins-body { flex: 1; min-height: 0; overflow: auto; padding: 14px 16px; }
.ins-foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 4px 12px; margin: 0; padding: 10px 16px; border-top: 1px solid var(--line); font-size: 13px; color: var(--muted); }
.ins-foot .hint { display: inline-flex; align-items: center; gap: 4px; }
.ins-foot kbd { font-size: 11px; line-height: 16px; min-width: 20px; padding: 0 4px; }
.ins-foot kbd + kbd { margin-left: -1px; }
.ins-foot .hint kbd:nth-of-type(3) { margin-left: 8px; }

.m-head { display: flex; gap: 8px; align-items: center; font: 13px var(--mono); color: var(--muted); min-width: 0; }
.m-head .dim { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m-kind { font: 700 11px/18px -apple-system, system-ui, sans-serif; text-transform: uppercase; letter-spacing: .04em; color: var(--mark); }
.m-kind.screenshot { color: var(--shot); }
.m-title { font-size: 17px; line-height: 1.3; margin: 6px 0 12px; }
.m-grid { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 12px; }
.thumb { padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--tint); align-self: start; cursor: zoom-in; }
.thumb img { display: block; width: 100%; height: auto; }
.said { font-size: 13.5px; color: var(--muted); line-height: 1.45; }
.said b { color: var(--text); font-weight: 600; }
.lbl { display: block; font: 600 11px/1.6 -apple-system, system-ui, sans-serif; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-bottom: 3px; }
.lbl.bad { color: var(--bad); }
.block { margin-top: 14px; font-size: 13.5px; }
.prob { padding: 6px 8px; margin-top: 4px; background: var(--bad-tint); border-radius: 6px; word-break: break-word; }
.prob .tag { font: 700 12px var(--mono); color: var(--bad); }
.prob .body { font: 12px/1.4 var(--mono); color: var(--muted); margin-top: 2px; }
.dim { color: var(--muted); }
.el { word-break: break-word; }
.el + .el, .chain, .props, .src { margin-top: 2px; }
.el code { color: var(--muted); font-size: 12px; }
.chain { color: var(--muted); }
.props { display: flex; flex-wrap: wrap; gap: 2px 12px; font: 12px var(--mono); }
.props .k { color: var(--muted); }
.src { display: block; font: 12px/1.5 var(--mono); color: var(--link); }
.el .src { display: inline; }

pre { margin: 0; overflow: auto; background: var(--code-bg); border-radius: 8px; font: 12.5px/1.55 var(--mono); }
pre code { font: inherit; }
pre.md { white-space: pre-wrap; word-break: break-word; padding: 12px 14px; color: var(--muted); border-radius: 0 0 8px 8px; }
pre.md b { color: var(--text); font-weight: 600; }
pre.md .mk { opacity: .55; }
pre.md .ic { color: var(--text); }
.md-bar { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 6px 6px 6px 14px; background: var(--code-bg); border-bottom: 1px solid var(--line); border-radius: 8px 8px 0 0; }
.md-bar code { font-size: 12px; color: var(--muted); }

/* Copy buttons: the label turns into a check for a moment, at the same width. */
.copy {
  height: 26px; width: 84px; padding: 0; text-align: center; flex: none; border-radius: 6px; border: 1px solid var(--line-strong);
  background: var(--panel); color: var(--text); font: 500 13px/24px -apple-system, system-ui, sans-serif;
}
.copy.done { color: var(--shot); border-color: var(--shot); }
.copy.done span { font-size: 0; }
.copy.done span::after { content: "✓ Copied"; font-size: 13px; }
.cmd { position: relative; max-width: 720px; }
.cmd pre { padding: 12px 104px 12px 14px; font-size: 13.5px; }
.cmd > .copy { position: absolute; top: 8px; right: 8px; }
.cmd.stacked pre { padding-right: 14px; }
.cmd-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 8px; }
.cmd-head h3 { margin: 0; }

/* Sections */
.sec-head { max-width: 760px; margin-bottom: 22px; }
.sec-head h2 { margin-bottom: 10px; }
.sec-head p { margin: 0 0 10px; color: var(--muted); }
.note { font-size: 14px; color: var(--muted); margin: 14px 0 0; }

/* Gallery */
.gallery { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 12px 16px; align-items: center; }
.gcap { margin: 0; font-size: 14px; color: var(--muted); min-height: 2.9em; display: flex; align-items: center; }
.shot { grid-column: 1 / -1; padding: 0; border: 0; background: none; cursor: zoom-in; border-radius: 12px; }
.shot img { display: block; width: 100%; height: auto; border-radius: 12px; box-shadow: var(--shadow); }
.features { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px 36px; margin: 32px 0 0; }
.features dt { font-weight: 650; }
.features dd { margin: 2px 0 0; color: var(--muted); font-size: 15px; }

/* Install */
.install-grid { display: grid; grid-template-columns: minmax(0, .9fr) minmax(0, 1.6fr) minmax(0, 1fr); gap: 32px; }
.install-grid h3 { margin-bottom: 8px; }
.needs { margin: 0; padding-left: 18px; color: var(--muted); font-size: 15px; }
.needs li { margin-bottom: 6px; }
.needs b { color: var(--text); }

.footer { display: flex; flex-wrap: wrap; gap: 8px 24px; align-items: center; padding: 24px var(--gutter) 40px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; }

/* Full-size screenshot */
.zoom { padding: 0; border: 0; margin: 0; width: 100vw; height: 100vh; max-width: none; max-height: none; background: transparent; overflow: hidden; }
.zoom::backdrop { background: rgba(10, 10, 12, .88); }
.zwrap { width: 100%; height: 100%; overflow: auto; display: grid; place-items: center; overscroll-behavior: contain; user-select: none; }
.zwrap img { display: block; max-width: 94vw; max-height: calc(100vh - 80px); border-radius: 8px; cursor: zoom-in; -webkit-user-drag: none; }
.zoom.zoomed .zwrap { place-items: start; cursor: grab; }
.zoom.zoomed .zwrap img { max-width: none; max-height: none; width: 200vw; cursor: zoom-out; margin: 40px; }
.zhint { position: fixed; left: 50%; bottom: 14px; translate: -50% 0; margin: 0; padding: 4px 12px; border-radius: 14px; background: rgba(20, 20, 22, .8); color: #ddd; font-size: 13px; pointer-events: none; }
.zoom .close {
  position: fixed; top: 16px; right: 16px; width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(255, 255, 255, .92); color: #111; font-size: 24px; line-height: 40px;
}

@media (max-width: 1180px) {
  .player { grid-template-columns: minmax(0, 1fr) 360px; }
  .ins-head { flex-wrap: wrap; }
  .m-grid { grid-template-columns: 96px minmax(0, 1fr); }
  .install-grid, .features { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .install-grid > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  .player { grid-template-columns: minmax(0, 1fr); }
  .stage { border-right: 0; border-bottom: 1px solid var(--line); }
  .inspector { height: auto; min-height: 0; }
  .ins-body { flex: none; }
  .hero-copy { grid-template-columns: minmax(0, 1fr); }
  .hero h1 { grid-row: auto; }
}

@media (max-width: 640px) {
  .nav nav a:not(.gh) { display: none; }
  main > section { padding-block: 44px; }
  .hero { padding-top: 24px !important; }
  .stage { padding: 8px; }
  .rail { margin-inline: 13px; }
  .caption { height: 72px; font-size: 14px; }
  .m-grid { grid-template-columns: 96px minmax(0, 1fr); }
  .ins-head { flex-wrap: wrap; }
  .gallery { grid-template-columns: minmax(0, 1fr); }
  .tabs { flex-wrap: wrap; }
  .player .play { width: 44px; padding: 0; }
  .player:not(.playing) .play { padding: 0; }
  .player:not(.playing) .play::after { content: none; }
  .install-grid, .features { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .install-grid > :last-child { grid-column: auto; }
}

/* Controls: one state model for every button and link. */
button { cursor: pointer; font-family: inherit; transition: background-color var(--fast), color var(--fast), border-color var(--fast), box-shadow var(--fast); }
@media (hover: hover) {
  a:hover { color: var(--accent); }
  .nav nav a:hover { color: var(--text); }
  .mark-nav button:hover, .seg button:hover, .tabs button:hover { color: var(--text); }
  .copy:hover { border-color: var(--muted); }
  .play:hover { background: rgba(20, 20, 22, .9); }
  .lane.marks button:hover { filter: brightness(1.1); }
  .thumb:hover, .shot:hover img { box-shadow: 0 0 0 2px var(--line-strong); }
}
button:active { transition-duration: 0ms; }
.copy:active, .mark-nav button:active, .seg button:active, .tabs button:active, .play:active { scale: .97; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }

/* Without a playable video, the stage is a still of the selected mark's frame. */
.player.novideo .play { display: none; }
.player.novideo video { cursor: default; }
