:root {
  color-scheme: dark;
  --bg: #101218;
  --surface: #171a22;
  --panel: #1c202a;
  --line: #343a48;
  --divider: #2b303d;
  --text: #f4f0e9;
  --muted: #b0b5c2;
  --subtle: #8d94a6;
  --orange: #ffad75;
  --orange-ink: #321c13;
  --periwinkle: #b3bcff;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body { background: var(--bg); color: var(--text); font: 16px/1.5 var(--sans); margin: 0; }
button, input, select { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--periwinkle); outline-offset: 3px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; clip: rect(0, 0, 0, 0); white-space: nowrap; overflow: hidden; border: 0; }
.masthead { min-height: 62px; padding: 0 max(24px, calc((100% - 1330px) / 2)); border-bottom: 1px solid var(--divider); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--text); text-decoration: none; font-size: 1.17rem; font-weight: 730; white-space: nowrap; letter-spacing: -.055em; }
.brand-separator { color: var(--orange); margin: 0 3px; }
.signal-mark { width: 33px; height: 33px; display: inline-flex; align-items: center; justify-content: center; gap: 2px; border-radius: 9px; background: var(--orange); }
.signal-mark i { width: 2px; background: var(--orange-ink); border-radius: 2px; height: 7px; }
.signal-mark i:nth-child(2), .signal-mark i:nth-child(4) { height: 13px; }
.signal-mark i:nth-child(3) { height: 19px; }
.mast-meta, .dataset-meta { display: flex; align-items: center; gap: 16px; }
.mast-meta { color: var(--muted); font-size: .86rem; }
.benchmark-link { color: var(--periwinkle); }
.dataset-meta { padding-left: 16px; border-left: 1px solid var(--line); color: var(--periwinkle); }
.shell { width: min(1330px, calc(100% - 48px)); margin: auto; }
.intro { display: flex; align-items: end; justify-content: space-between; gap: 24px; padding: 23px 0 21px; }
.intro h1 { margin: 0; font-size: clamp(2.1rem, 3.8vw, 3.35rem); font-weight: 740; line-height: 1.05; letter-spacing: -.07em; }
.intro h1 span { color: var(--orange); }
.intro p { margin: 8px 0 0; color: var(--muted); }
.jump-library { display: none !important; }
.bench { display: grid; grid-template-columns: minmax(235px, 305px) minmax(0, 1fr); align-items: start; gap: 18px; }
.surface { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; min-width: 0; box-shadow: 0 12px 30px #08090b26; }
.load-message { padding: 22px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); color: var(--muted); }
.library { scroll-margin-top: 12px; }
.library-head { padding: 15px; border-bottom: 1px solid var(--divider); }
.library-heading, .section-row, .section-name, .workbench-head, .plot-head { display: flex; align-items: center; }
.library-heading, .section-row, .workbench-head, .plot-head { justify-content: space-between; gap: 10px; }
.library-heading { margin-bottom: 12px; }
h2, h3, p { margin: 0; }
.library-heading h2 { font-size: 1rem; font-weight: 700; }
.pill { border-radius: 20px; border: 1px solid var(--line); padding: 1px 7px; color: var(--muted); font: .75rem/1.6 var(--mono); white-space: nowrap; }
.search { position: relative; display: grid; align-items: center; }
.search-icon { position: absolute; top: 12px; left: 12px; border: 1.5px solid var(--muted); border-radius: 50%; width: 10px; height: 10px; pointer-events: none; }
.search-icon::after { content: ""; position: absolute; width: 5px; height: 1.5px; background: var(--muted); transform: rotate(45deg); left: 6px; top: 7px; }
.search input, .filters select { width: 100%; background: #12151c; border: 1px solid var(--line); border-radius: 7px; color: var(--text); font-size: .89rem; }
.search input { padding: 8px 10px 8px 32px; }
.search input::placeholder { color: var(--subtle); }
.filters { display: flex; gap: 6px; margin-top: 7px; }
.filters label { flex: 1 1 0; min-width: 0; position: relative; }
.filters select { appearance: none; padding: 7px 19px 7px 7px; text-overflow: ellipsis; }
.filters label::after { content: ""; border: solid var(--muted); border-width: 0 1.5px 1.5px 0; padding: 2.5px; transform: rotate(45deg); position: absolute; right: 8px; top: 13px; pointer-events: none; }
.clip-list { padding: 6px 7px 10px; max-height: max(425px, calc(100vh - 336px)); overflow: auto; scrollbar-color: #545b6e transparent; }
.category-group + .category-group { margin-top: 7px; }
.category-heading { margin: 0; padding: 11px 9px 5px; color: var(--muted); font-size: .77rem; font-weight: 680; display: flex; gap: 8px; align-items: center; }
.category-heading span { color: var(--subtle); font: .72rem var(--mono); }
.clip-item { width: 100%; min-width: 0; display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 2px 8px; border: 1px solid transparent; border-radius: 8px; text-align: left; background: transparent; color: var(--text); padding: 8px 9px; }
.clip-item:hover { background: #242a37; }
.clip-item[aria-current="true"] { background: #382720; border-color: #705040; color: #ffdcc6; }
.clip-name { display: block; font-size: .88rem; font-weight: 630; line-height: 1.35; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.clip-duration { color: var(--muted); font: .73rem var(--mono); }
.clip-language { grid-column: 1/-1; color: var(--subtle); font-size: .75rem; }
.clip-item[aria-current="true"] .clip-language { color: #e5b8a3; }
.empty { color: var(--muted); padding: 13px 8px; font-size: .9rem; }
.workbench { display: flex; flex-direction: column; overflow: hidden; }
.workbench-head { padding: 17px 22px 14px; align-items: end; }
.clip-meta { display: flex; gap: 4px 11px; align-items: center; flex-wrap: wrap; color: var(--muted); font-size: .83rem; line-height: 1.3; }
.clip-meta .clip-category { color: var(--orange); }
.clip-title, #clip-title { font-size: clamp(1.25rem, 2.65vw, 2.1rem); letter-spacing: -.04em; line-height: 1.16; overflow-wrap: anywhere; margin-top: 6px; }
.quiet-button { display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; text-decoration: none; color: var(--text); background: #222633; border: 1px solid #40485b; border-radius: 7px; font-size: .82rem; min-height: 35px; padding: 6px 10px; }
.quiet-button:hover { background: #30384a; }
.text-button { color: var(--muted); background: transparent; border: 0; padding: 4px 0 4px 6px; font-size: .82rem; white-space: nowrap; }
.text-button:not(:disabled):hover { color: var(--orange); }
.codebook-panel { padding: 10px 22px 15px; border-bottom: 1px solid var(--divider); }
h3 { font-size: .95rem; font-weight: 685; }
.section-name { align-items: baseline; flex-wrap: wrap; gap: 3px 11px; }
.technical { color: var(--muted); font: .78rem/1.45 var(--mono); white-space: nowrap; }
.codebooks { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 5px; margin-top: 8px; }
.codebook { padding: 5px 0; min-height: 34px; border-radius: 6px; border: 1px solid var(--line); background: #1d212b; color: var(--text); font: 650 .9rem var(--mono); }
.codebook:hover { border-color: var(--orange); }
.codebook[aria-pressed="true"] { background: var(--orange); color: var(--orange-ink); border-color: var(--orange); }
.comparison { padding: 13px 22px 14px; }
.comparison-head { margin-bottom: 8px; }
.color-legend { display: flex; align-items: center; gap: 5px; color: var(--muted); font: .72rem var(--mono); white-space: nowrap; }
.color-legend i { width: clamp(30px, 7vw, 94px); height: 6px; border-radius: 2px; background: var(--mel-palette, linear-gradient(90deg,#100d25,#654588,#d37681,#ffba88,#fbf0c8)); }
.plots { display: grid; gap: 8px; }
.plot-card { min-width: 0; border: 1px solid var(--divider); border-radius: 8px; padding: 7px 9px 6px; background: #151821; }
.plot-card.active { border-color: #5a658a; background: #1b2030; }
.plot-card.reconstruction.active { border-color: #805c49; background: #281e20; }
.plot-head { margin-bottom: 5px; }
.source-button { display: inline-flex; align-items: center; gap: 7px; border: 0; padding: 0 4px 0 0; min-height: 28px; color: var(--text); background: transparent; font-size: .88rem; font-weight: 650; }
.source-button:hover { text-decoration: underline; text-underline-offset: 4px; }
.source-key { display: inline-flex; min-width: 22px; height: 22px; border-radius: 5px; align-items: center; justify-content: center; font: 700 .76rem var(--mono); background: #303955; color: #d7ddff; }
.reconstruction .source-key { background: #4a3029; color: #ffcfb4; }
.original.active .source-key { background: var(--periwinkle); color: #202543; }
.reconstruction.active .source-key { background: var(--orange); color: var(--orange-ink); }
.plot-grid { display: grid; grid-template-columns: 32px minmax(0, 1fr); }
.plot-view { cursor: crosshair; height: clamp(85px, 10.3vw, 130px); position: relative; background: #100d25; overflow: hidden; border-radius: 3px; }
.plot-view img { display: block; width: 100%; height: 100%; object-fit: fill; }
.plot-status { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); background: #131423; pointer-events: none; font-size: .81rem; }
.frequency-axis { color: var(--muted); font: .69rem var(--mono); position: relative; }
.frequency-axis span { position: absolute; left: 0; top: var(--position); transform: translateY(-50%); }
.frequency-axis span:first-child { transform: none; }
.frequency-axis span:last-child { transform: translateY(-100%); }
.time-axis { grid-column: 2; display: flex; justify-content: space-between; padding-top: 3px; color: var(--muted); font: .69rem/1.2 var(--mono); }
.playhead { position: absolute; left: var(--playhead, 0%); width: 1px; background: #fff9e8; box-shadow: 0 0 4px #000; inset-block: 0; pointer-events: none; transform: translateX(-50%); }
.playback-bar { padding: 8px 22px; border-bottom: 1px solid var(--divider); background: #151820; }
.transport { display: flex; align-items: center; gap: 9px; }
.play-button { display: grid; place-items: center; width: 38px; height: 36px; flex: 0 0 38px; background: var(--orange); color: var(--orange-ink); border: 0; border-radius: 8px; }
.play-button:hover { background: #ffd1b4; }
.play-button span { border: solid transparent; border-width: 6px 0 6px 10px; border-left-color: currentColor; margin-left: 2px; }
.play-button.playing span { border: solid currentColor; border-width: 0 3px; width: 10px; height: 12px; margin: 0; }
.transport-time { min-width: 58px; display: grid; color: var(--text); font: .76rem/1.17 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.transport-time span + span { color: var(--muted); }
#seek { flex: 1 1 0; min-width: 0; cursor: pointer; width: 100%; accent-color: var(--orange); }
.ab { min-width: 87px; }
.loss-panel { display: grid; grid-template-columns: minmax(180px, .75fr) minmax(0, 1fr); gap: 18px; margin: 0 22px 17px; border: 1px solid var(--divider); background: #141720; border-radius: 9px; padding: 11px 12px; }
.loss-value { position: relative; }
.loss-value .section-name { align-items: center; gap: 7px; }
.info-button { border: 1px solid #545c72; border-radius: 50%; background: #222737; color: var(--muted); width: 19px; height: 19px; padding: 0; font: 700 .69rem var(--mono); }
.metric-note { position: absolute; z-index: 2; left: 0; bottom: calc(100% + 6px); width: min(270px, 70vw); padding: 9px; border: 1px solid var(--line); border-radius: 7px; background: #272d3b; color: var(--text); font-size: .8rem; box-shadow: 0 8px 26px #0008; }
#loss-number { color: var(--orange); font: 700 1.78rem/1.1 var(--mono); letter-spacing: -.05em; }
#loss-unit { color: var(--muted); font: .8rem var(--mono); }
#loss-comparison { color: var(--muted); font-size: .79rem; margin-top: 1px; }
.loss-history-heading { display: flex; justify-content: space-between; gap: 9px; color: var(--muted); font-size: .75rem; }
.loss-bars { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 4px; min-height: 51px; }
.loss-bar { display: grid; align-items: end; grid-template-rows: 1fr auto; justify-items: center; min-width: 0; border: 0; background: transparent; color: var(--muted); padding: 2px 0 0; font: .66rem var(--mono); }
.loss-bar i { display: block; border-radius: 2px 2px 0 0; width: 77%; height: var(--bar-height); background: #838cc5; opacity: .74; }
.loss-bar:hover i { opacity: 1; }
.loss-bar[aria-pressed="true"] { color: var(--orange); }
.loss-bar[aria-pressed="true"] i { background: var(--orange); opacity: 1; }
.foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 14px 0 23px; color: var(--muted); font-size: .75rem; }
kbd { display: inline-block; padding: 1px 4px; background: #1c202b; border: 1px solid var(--line); border-radius: 4px; font: .7rem var(--mono); margin-right: 3px; }
kbd:not(:first-child) { margin-left: 7px; }
@media (max-width: 950px) {
  .bench { grid-template-columns: minmax(205px, 248px) minmax(0, 1fr); gap: 12px; }
  .shell { width: calc(100% - 34px); }
  .masthead { padding-inline: 17px; }
  .workbench-head, .codebook-panel, .comparison, .playback-bar { padding-inline: 13px; }
  .loss-panel { margin-inline: 13px; }
  .library-head { padding: 12px; }
}
@media (max-width: 690px) {
  .shell { width: calc(100% - 24px); }
  .masthead { min-height: 49px; padding-inline: 12px; }
  .intro { align-items: flex-start; padding-block: 17px; gap: 8px; }
  .intro h1 { font-size: clamp(1.95rem, 8vw, 2.65rem); }
  .intro p { font-size: .91rem; max-width: 29ch; }
  .bench { display: flex; flex-direction: column; gap: 12px; }
  .workbench { order: -1; }
  .bench > * { width: 100%; }
  .mast-meta { font-size: .72rem; }
  .dataset-meta, .model-name { display: none; }
  .jump-library { display: inline-flex !important; margin-top: 2px; }
  .clip-list { max-height: 350px; }
  .plot-view { height: 100px; }
  .frequency-axis span:nth-last-child(2) { display: none; }
  .codebooks { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .workbench-head { align-items: start; position: relative; }
  .clip-meta { padding-right: 68px; }
  .share { position: absolute; top: 10px; right: 13px; min-height: 29px; }
  .loss-value .section-name { flex-wrap: nowrap; }
  .loss-value h3 { white-space: nowrap; font-size: .9rem; }
  .loss-panel { gap: 9px; grid-template-columns: minmax(127px, .65fr) minmax(0, 1fr); }
  .loss-history-heading span:last-child { display: none; }
  .foot { flex-wrap: wrap; }
}
@media (max-width: 355px) {
  .masthead { gap: 6px; }
  .brand { font-size: 1rem; gap: 6px; }
  .signal-mark { width: 29px; height: 29px; }
  .benchmark-link { font-size: .73rem; padding-inline: 7px; }
  .loss-panel { grid-template-columns: 1fr; }
  .codebooks { gap: 2px; }
  .codebook { font-size: .77rem; }
  .technical { font-size: .7rem; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
