/* One instrument, four modes. The graph and player keep their state between modes. */
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--stage); color: var(--ink-1); font: var(--type-body); }
body { -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
[hidden] { display: none !important; }
button, a, summary { -webkit-tap-highlight-color: transparent; }
button { color: inherit; font: inherit; border: 0; background: none; cursor: pointer; }
button:disabled { cursor: default; opacity: .4; }
a { color: inherit; text-decoration: none; }
a:hover { color: var(--hot); }
button, a, summary { transition: color var(--dur), background-color var(--dur), border-color var(--dur); }
:focus-visible { outline: none; }
:is(a, summary):focus-visible { color: var(--hot); }
button:focus-visible { background-color: var(--surface-2); }
svg { display: block; }
.diagonal-arrow { display: inline-block; width: 1em; height: 1em; flex: none; vertical-align: -.15em; }
.workspace { position: relative; height: 100%; height: 100dvh; }
.console { position: absolute; inset: 16px auto 16px 16px; width: var(--col); z-index: 3; display: flex; flex-direction: column; gap: var(--gap); }
.console-header, .view-shell, .player { border: 1px solid var(--line); border-radius: var(--radius); corner-shape: superellipse(var(--corner-k)); background: var(--surface); }
.console-header { display: flex; flex: none; align-items: center; gap: 12px; padding: 18px 24px; min-height: 62px; }
.wordmark { font: 500 16px/1 var(--font-sans); letter-spacing: -.03em; display: flex; align-items: center; gap: 9px; }
.wordmark i { width: 7px; height: 7px; border-radius: 50%; background: var(--hot); }
#clock { margin-left: auto; font: var(--type-label); letter-spacing: .08em; color: var(--ink-3); }
#shortcuts-toggle { flex: none; width: 28px; height: 28px; border: 1px solid var(--line-strong); border-radius: 7px; color: var(--ink-2); }
#shortcuts-toggle:hover, #shortcuts-toggle[aria-expanded="true"] { color: var(--hot); }
.shortcut-help { position: absolute; z-index: 5; top: 70px; left: 0; right: 0; max-height: calc(100% - 70px); overflow: auto; scroll-padding: 8px; overscroll-behavior: contain; padding: 20px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius); corner-shape: superellipse(var(--corner-k)); }
.shortcut-help header { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.shortcut-help h2 { font: 500 18px/1.2 var(--font-sans); margin: 0; }
.shortcut-help h3 { font: var(--type-label); text-transform: uppercase; letter-spacing: var(--track-label); color: var(--hot); margin: 22px 0 8px; }
.shortcut-help dl { margin: 0; font: var(--type-micro); }
.shortcut-help dl > div { display: grid; grid-template-columns: 108px 1fr; align-items: center; gap: 12px; min-height: 32px; border-bottom: 1px solid var(--line); padding: 4px 0; }
.shortcut-help dd { margin: 0; color: var(--ink-2); }
kbd { display: inline-block; min-width: 20px; padding: 2px 4px; border: 1px solid var(--line-strong); border-radius: 4px; font: var(--type-label); text-align: center; color: var(--ink-1); }
#shortcuts-close { flex: none; padding: 6px 0; font: var(--type-micro); color: var(--ink-2); }
.shortcut-help p { font: var(--type-micro); color: var(--ink-2); margin: 16px 0; }
.shortcut-help .shortcut-note { color: var(--ink-3); margin-bottom: 0; }
.shortcut-preference { display: flex; align-items: center; gap: 8px; font: var(--type-micro); }
.shortcut-preference input { accent-color: var(--hot); }
.view-shell { position: relative; flex: 1; min-height: 0; }
.view-area { height: 100%; overflow: auto; scroll-padding: 8px; overscroll-behavior: contain; scrollbar-width: none; border-radius: inherit; corner-shape: inherit; }
.view-area :is(button, a, summary, [tabindex]), .shortcut-help :is(button, input) { scroll-margin-block: 8px; }
.view-area::-webkit-scrollbar { display: none; }
.scroll-rail { position: absolute; top: 12px; right: 5px; bottom: 12px; width: 2px; background: var(--line); pointer-events: none; }
.scroll-rail i { position: absolute; inset: 0 0 auto; background: var(--ink-4); }
.panel { padding: var(--pad); }
.panel:focus-visible { outline-offset: -5px; border-radius: var(--radius); corner-shape: superellipse(var(--corner-k)); }
.bucket { min-height: 100%; display: flex; flex-direction: column; gap: 22px; }
.panel header, .player header { display: flex; align-items: center; gap: 8px; }
.label, .eyebrow, .asof, .stat .l, .tag, .legend, .section-label { font: var(--type-label); letter-spacing: var(--track-label); text-transform: uppercase; }
.eyebrow { display: flex; gap: 7px; align-items: center; color: var(--ink-3); white-space: nowrap; }
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--status-unavailable); flex: none; }
[data-status="ready"] .dot { background: var(--status-ready); }
[data-status="partial"] .dot { background: var(--status-partial); }
[data-status="stale"] .dot { background: var(--status-stale); }
.asof { margin-left: auto; color: var(--ink-3); white-space: nowrap; }
[data-status="stale"] > header .asof { color: var(--hot); }
.mode-name { margin: 0; font: 400 34px/1.1 var(--font-display); letter-spacing: -.015em; text-transform: uppercase; display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.body { display: flex; flex-direction: column; gap: 24px; }
.stats { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 16px; }
.stat { min-width: 0; display: flex; flex-direction: column; gap: 8px; }
.stat .l { color: var(--ink-3); order: 0; }
.stat .v { font: var(--type-numeral); order: 1; letter-spacing: -.025em; overflow-wrap: anywhere; }
.stat .v small { display: block; color: var(--ink-2); font: var(--type-micro); letter-spacing: 0; margin-top: 10px; }
.stat.warn .v { color: var(--hot); }
.section-label { display: flex; justify-content: space-between; color: var(--ink-3); padding-bottom: 10px; }
.section-label span { color: var(--ink-2); }
.list { list-style: none; padding: 0; margin: 0; }
.questions { display: flex; flex-direction: column; gap: 8px; }
.chip { display: flex; align-items: start; gap: 10px; padding: 14px; color: var(--ink-2); background: var(--surface-2); font: var(--type-body); border-radius: var(--radius-sm); corner-shape: superellipse(var(--corner-k)); }
.chip .q { flex: none; display: grid; place-items: center; width: 16px; height: 16px; border: 1px solid var(--hot-dim); border-radius: 50%; color: var(--hot); font: var(--type-micro); margin-top: 3px; }
.chip.do svg { width: 16px; height: 16px; flex: none; color: var(--good); margin-top: 3px; }
.list li { display: flex; align-items: center; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line); min-width: 0; }
.list li a, .list li .t { flex: 1; min-width: 0; line-height: 1.3; }
.tag { margin-left: auto; font-size: 9px; color: var(--ink-3); flex: none; }
.bars { display: flex; flex-direction: column; gap: 16px; }
.bar { display: grid; grid-template-columns: 92px 1fr 76px; align-items: center; gap: 8px; font: var(--type-micro); color: var(--ink-2); text-align: left; }
.bar .n { min-width: 0; }
.bar .n code { font: var(--type-label); letter-spacing: .04em; color: var(--ink-3); display: block; margin-bottom: 5px; }
.bar .t { height: 3px; background: var(--line); position: relative; }
.bar .t i { position: absolute; inset: 0 auto 0 0; background: var(--ink-2); }
.bar .t i.new, .bar.over .t i { background: var(--hot); }
.bar .v { color: var(--ink-3); text-align: right; }
.bar .v b { color: var(--ink-1); font-weight: 500; }
.bars.stack { gap: 0; }
.bars.stack .bar { width: 100%; padding: 13px 0; grid-template-columns: minmax(0, 1fr) 58px; grid-template-areas: "n v" "t t"; border-top: 1px solid var(--line); row-gap: 9px; }
.bars.stack .n { grid-area: n; font-size: 15px; line-height: 1.25; }
.bars.stack .v { grid-area: v; align-self: start; padding-top: 2px; }
.bars.stack .t { grid-area: t; }
.bar.clickable:hover .n, .bar.selected .n, .bar.selected .n code { color: var(--hot); }
.bar.clickable:hover { background: var(--surface-2); }
.bar.selected { background: var(--screen); }
.bar .t .src-assistant, .src-assistant { background: var(--src-assistant); }
.bar .t .src-ops_ticket, .src-ops_ticket { background: var(--src-ops_ticket); }
.bar .t .src-copilot, .src-copilot { background: var(--src-copilot); }
.bar .t .src-ops_comment, .src-ops_comment { background: var(--src-ops_comment); }
.bar .t .src-ops_event, .src-ops_event { background: var(--src-ops_event); }
.legend { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--ink-3); font-size: 9px; }
.legend span { display: flex; gap: 5px; align-items: center; }
.legend i { width: 4px; height: 4px; border-radius: 50%; }
.feed-footnote { font: var(--type-micro); color: var(--ink-3); margin: -10px 0 0; }
.review-note { margin-top: auto; padding-top: 14px; border-top: 1px solid var(--line); }
.review-note summary { font: var(--type-label); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-3); cursor: pointer; padding: 6px 0; }
.review-note summary:hover { color: var(--ink-1); }
.headline { font: var(--type-body); margin: 14px 0 10px; color: var(--ink-2); }
.limits { color: var(--ink-3); font: var(--type-micro); margin-bottom: 0; }
.empty-state { padding: 32px 0; color: var(--ink-2); }
.player { flex: none; padding: 18px 24px 12px; }
.player header { justify-content: space-between; margin-bottom: 16px; }
.player .eyebrow { font-size: 9px; color: var(--ink-2); }
.player .state { display: none; }
.player-format { color: var(--ink-3); font-size: 9px; }
.deck { display: grid; grid-template-columns: 68px minmax(0, 1fr) 52px; align-items: center; gap: 18px; }
.counter { font: 400 27px/1 var(--font-display); letter-spacing: -.015em; }
.player-duration { margin-top: 6px; color: var(--ink-3); font: var(--type-label); letter-spacing: .08em; }
.level { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 3px; height: 12px; align-items: end; margin-top: 10px; }
.level i { height: 5px; background: var(--line-strong); }
.level i.on { height: 10px; background: var(--ink-2); }
.level i.on.peak { background: var(--hot); }
#play { width: 52px; height: 58px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--hot); display: grid; place-items: center; }
.play-symbol { width: 32px; height: 32px; fill: currentColor; transform-origin: center; transition: transform 140ms var(--ease); }
#play:not(:disabled):is(:hover, :focus-visible) .play-symbol { transform: translateX(2px) scale(1.1); }
#play:not(:disabled):active .play-symbol { transform: translateY(2px) scale(.9); }
#play:focus-visible { outline: none; outline-offset: -2px; }
.player-message { text-align: left; white-space: normal; margin: 12px 0 0; font-size: 9px; letter-spacing: .06em; color: var(--ink-3); }
.mode-tabs { flex: none; display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--gap); }
.mode-tabs button { position: relative; min-height: 62px; padding: 8px 2px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; border: 1px solid var(--line); border-radius: var(--radius-sm); corner-shape: superellipse(var(--corner-k)); background: var(--surface); font: var(--type-label); text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.mode-tabs button:hover { color: var(--ink-1); background: var(--surface-2); border-color: var(--line-strong); }
.mode-tabs button[aria-selected="true"] { background: var(--hot); color: var(--lit-ink-1); border-color: var(--hot); }
.mode-tabs button:active > span { transform: translateY(1px); transition: transform 70ms linear; }
.tab-symbol svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.3; }
.mode-tabs .tab-key { position: absolute; top: 5px; right: 5px; min-width: 0; padding: 0; border: 0; color: inherit; opacity: .7; font-size: 9px; }
/* Focus uses each control's color or surface feedback without an outline. */
:is(.mode-tabs button, .graph-controls button, .pattern-detent, .task-position, .sorter-channel):focus-visible { position: relative; z-index: 1; outline-offset: -3px; }
.mode-tabs button[aria-selected="true"]:focus-visible { outline-color: var(--lit-ink-1); }
/* The canvas and its projected labels use the same local coordinate system. */
#graph-view { position: absolute; inset: 16px 16px 16px calc(var(--col) + 48px); overflow: hidden; }
#stage, #labels { position: absolute; inset: 0; width: 100%; height: 100%; }
#stage { display: block; cursor: grab; touch-action: none; }
#stage:focus-visible { outline-offset: -2px; border-radius: var(--radius-sm); }
.map-instructions { position: absolute; bottom: 76px; left: 14px; right: 14px; margin: 0; font: var(--type-micro); color: var(--ink-3); pointer-events: none; }
.map-active { display: none; }
.map-mouse { display: none; }
#stage:focus ~ .map-instructions .map-rest { display: none; }
#stage:focus ~ .map-instructions .map-active { display: inline; color: var(--hot); }
#stage:is([data-mouse-look="locked"], [data-mouse-look="bounded"]) ~ .map-instructions :is(.map-rest, .map-active) { display: none; }
#stage:is([data-mouse-look="locked"], [data-mouse-look="bounded"]) ~ .map-instructions .map-mouse { display: inline; color: var(--hot); }
#stage:is([data-mouse-look="locked"], [data-mouse-look="bounded"]) ~ #labels .hub { pointer-events: none; }
#stage[data-mouse-look="bounded"] { cursor: crosshair; }
#mouse-look-status { display: block; margin-top: 4px; color: var(--ink-2); }
#mouse-look-status:empty { display: none; }
#stage.hover { cursor: pointer; }
#stage:active { cursor: grabbing; }
#labels { pointer-events: none; overflow: hidden; }
.graph-heading { position: absolute; top: 18px; left: 14px; right: 14px; display: flex; align-items: center; gap: 12px; pointer-events: none; }
.graph-heading .label { color: var(--ink-2); }
.graph-subtitle { display: block; font: var(--type-micro); color: var(--ink-3); margin-top: 5px; }
.graph-heading .graph-status { margin-left: auto; color: var(--ink-3); }
.graph-key { position: absolute; top: 74px; left: 14px; z-index: 2; max-width: 310px; color: var(--ink-3); font: var(--type-micro); }
.graph-key > summary { cursor: pointer; width: fit-content; padding: 6px 0; }
.graph-key[open] { padding: 8px 14px; left: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--stage); }
.graph-key-body p { line-height: 1.5; margin: 12px 0 4px; }
.graph-key .legend { flex-wrap: wrap; gap: 8px 12px; margin-top: 12px; }
@media (max-width: 760px) { .graph-key { display: none; } }
.graph-footer { position: absolute; bottom: 14px; left: 14px; right: 14px; display: flex; align-items: end; justify-content: space-between; gap: 20px; pointer-events: none; }
.graph-caption { display: flex; flex-direction: column; gap: 6px; color: var(--ink-3); font: var(--type-micro); }
.graph-caption .label { color: var(--ink-2); }
.graph-controls { pointer-events: auto; display: flex; gap: 2px; border: 1px solid var(--line); border-radius: 10px; corner-shape: superellipse(var(--corner-k)); background: var(--stage); }
.graph-controls button { border-radius: 8px; corner-shape: superellipse(var(--corner-k)); }
.graph-controls button { height: 38px; min-width: 38px; font: var(--type-label); }
.graph-controls button:first-child, .graph-controls button:last-child { font-size: 20px; }
.graph-controls button:hover { background: var(--surface-2); color: var(--hot); }
.graph-label { position: absolute; top: 0; left: 0; display: flex; align-items: baseline; gap: 6px; padding: 4px 8px; margin: -10px 0 0; white-space: nowrap; max-width: 270px; color: var(--ink-2); background: transparent; border: 0; border-radius: 2px; font: var(--type-micro); text-align: left; }
.graph-label .id { font: var(--type-label); color: var(--ink-3); font-size: 8px; }
.graph-label .t { overflow: hidden; text-overflow: ellipsis; }
.graph-label.hub { display: block; width: 32px; height: 32px; max-width: none; margin: -16px 0 0 -16px; padding: 0; pointer-events: auto; cursor: pointer; }
.graph-handle { position: absolute; inset: 8px; border: 1px solid var(--ink-3); border-radius: 50%; transition: transform 100ms linear, border-color 100ms linear; }
.graph-handle::after { content: ""; position: absolute; top: 50%; left: 50%; width: 5px; height: 5px; background: var(--ink-2); border-radius: 50%; transform: translate(-50%, -50%); }
.graph-label.hub .id, .graph-label.hub .t { position: absolute; left: 34px; padding: 2px 5px; background: var(--stage); visibility: hidden; pointer-events: none; }
.graph-label.hub .id { top: -2px; font-size: 9px; }
.graph-label.hub .t { top: 12px; max-width: 250px; font-size: 12px; }
.graph-label.hub.label-left .id, .graph-label.hub.label-left .t { left: auto; right: 34px; }
.graph-label.hub:is(:hover, .hover, .preview, .selected, :focus-visible) { z-index: 2; color: var(--ink-1); }
.graph-label.hub:is(:hover, .hover, .preview, .selected, :focus-visible) .id,
.graph-label.hub:is(:hover, .hover, .preview, .selected, :focus-visible) .t { visibility: visible; }
.graph-label.hub:is(:hover, .hover, .preview, .selected, :focus-visible) .id { color: var(--hot); }
.graph-label.hub:is(:hover, .hover, .preview, .selected, :focus-visible) .graph-handle { transform: scale(.75); border-color: var(--hot); }
.graph-label.hub:is(:hover, .hover, .preview, .selected, :focus-visible) .graph-handle::after { background: var(--hot); }
.graph-label.hub:focus-visible { outline-offset: -2px; border-radius: 50%; }
#labels.compact .graph-label.hub { pointer-events: none; }
#labels.compact .graph-label.hub .t { max-width: min(145px, calc(50vw - 50px)); }
#labels.compact .graph-handle { inset: 13px; transition: border-color 100ms linear; }
#labels.compact .graph-handle::after { width: 2px; height: 2px; }
#labels.compact .graph-label.hub:is(:hover, .hover, .preview, .selected, :focus-visible) .graph-handle { inset: 10px; transform: none; }
.graph-label.source { font: var(--type-label); font-size: 9px; color: var(--source-color, var(--ink-3)); }
.graph-label.source[data-status="unavailable"] { color: var(--ink-4); text-decoration: line-through; }
.graph-empty { position: absolute; inset: 0; display: grid; place-content: center; gap: 12px; color: var(--ink-2); font: var(--type-wordmark); text-align: center; }
.graph-empty span { font: var(--type-body); color: var(--ink-3); }
.detail { display: flex; flex-direction: column; gap: 24px; }
.detail header { flex-wrap: wrap; }
.detail header code { font: var(--type-label); color: var(--hot); }
.detail .stage { font: var(--type-label); color: var(--ink-3); }
.detail .chip { padding: 3px 6px; font: var(--type-label); }
.detail .chip b { font-weight: 500; }
.close { display: flex; align-items: center; gap: 7px; min-height: 36px; padding: 0; font: var(--type-label); color: var(--ink-2); margin-bottom: 0; }
.close svg { width: 15px; height: 15px; }
.close:hover { color: var(--hot); }
.detail h3 { font: var(--type-wordmark); margin: 0; overflow-wrap: anywhere; }
.detail .next { margin: 0; font: var(--type-body); color: var(--ink-2); }
.detail .next b { display: block; font: var(--type-label); letter-spacing: .08em; text-transform: uppercase; color: var(--hot); margin-bottom: 10px; }
.micro { width: 12px; height: 12px; overflow: visible; }
.stat .l .micro { display: inline-block; vertical-align: -1px; width: 9px; height: 9px; margin-left: 4px; color: var(--hot); }
@media (min-width: 1500px) { :root { --col: 408px; --pad: 24px; } }
@media (max-width: 760px) {
  :root { --col: 100%; --pad: 20px; }
  .workspace { display: flex; flex-direction: column; padding: 10px; gap: var(--gap); }
  #graph-view { position: relative; inset: auto; flex: 0 0 clamp(128px, 23vh, 190px); width: 100%; border: 1px solid var(--line); border-radius: var(--radius); corner-shape: superellipse(var(--corner-k)); }
  .graph-heading { top: 12px; left: 14px; }
  .graph-heading .graph-subtitle, .graph-heading .graph-status, .graph-caption, .graph-label.source { display: none; }
  .graph-heading .label { font-size: 9px; }
  .graph-footer { bottom: 8px; right: 8px; left: auto; }
  .graph-controls button { min-width: 30px; height: 28px; font-size: 9px; }
  .console { position: relative; inset: auto; flex: 1; width: 100%; min-height: 0; }
  .console-header { padding: 10px 22px; min-height: 48px; }
  .shortcut-help { top: 56px; max-height: calc(100% - 56px); }
  .map-instructions { bottom: 42px; font-size: 9px; }
  body.preview-hidden #graph-view { display: none; }
  .bucket { gap: 20px; }
  .mode-name { font-size: 31px; }
  .player { padding: 13px 22px 10px; }
  .player header { margin-bottom: 10px; }
  .deck { grid-template-columns: 54px minmax(0, 1fr) 48px; gap: 16px; }
  .counter { font-size: 25px; }
  #play { width: 48px; height: 52px; }
  .player-message { margin-top: 9px; }
  .mode-tabs button { min-height: 54px; }
}
@media (max-height: 700px) {
  .bucket { gap: 16px; }
  .player-format { display: none; }
  .player header { margin-bottom: 8px; }
  .player { padding-top: 12px; }
  .deck { grid-template-columns: 45px minmax(0, 1fr) 48px; }
  .counter { font-size: 22px; }
  .player-message { margin-top: 8px; }
  .mode-tabs button { min-height: 48px; }
  .mode-tabs .tab-symbol { display: none; }
}
@media (max-width: 360px) {
  :root { --pad: 16px; }
  .console-header, .player { padding-left: 16px; padding-right: 16px; }
  .eyebrow { font-size: 9px; }
  .asof { font-size: 9px; }
  .mode-name { font-size: 29px; }
  .console-header { gap: 7px; }
  #clock { font-size: 8px; letter-spacing: .02em; }
  .wordmark { font-size: 14px; gap: 6px; }
  .shortcut-help { padding: 16px; }
  .shortcut-help dl > div { grid-template-columns: 96px 1fr; gap: 8px; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; } }
@media (prefers-reduced-motion: reduce) { .mode-tabs button:active > span { transform: none; } }
@media (prefers-reduced-motion: reduce) { #play:not(:disabled):is(:hover, :focus-visible, :active) .play-symbol { transform: none; } }

/* Source annotations remain subordinate to the interactive pattern handles. */


.signals-overview { display: flex; flex-direction: column; gap: 22px; flex: 1; }
@media (max-width: 760px) {
  :root { --hero-size: 58px; }
  #graph-view { flex-basis: clamp(104px, 16vh, 144px); }
  .bucket, .signals-overview { gap: 16px; }
  .body { gap: 18px; }
  .player { padding-top: 12px; padding-bottom: 10px; }
  .player header { margin-bottom: 8px; }
  .deck { grid-template-columns: 46px minmax(0, 1fr) 44px; gap: 16px; }
  #play { width: 44px; height: 46px; }
  .player .counter { font-size: 23px; }
  .player-duration { margin-top: 4px; }
  .level { margin-top: 5px; height: 8px; }
  .player-message { font-size: 8px; }
  .mode-tabs button { min-height: 46px; }
}
