/* BiSAT — Clean Academic Paper Audio Demo */
:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f7f8fa;
  --surface-glass: rgba(255, 255, 255, 0.92);
  --dock-bg: rgba(255, 255, 255, 0.96);

  --ink: #111827;
  --ink-2: #374151;
  --muted: #6b7280;
  --rule: #e5e7eb;
  --rule-strong: #cbd5e1;
  --rule-heavy: #1f2937;

  /* Academic paper figure palette (harmonized with TASLP manuscript TikZ colors):
     Deep IEEE Sapphire (#164c96) for BiSAT-64k & Academic Pine Teal (#116653) for BiSAT-32k */
  --c64: #164c96;
  --c64-soft: rgba(22, 76, 150, 0.055);
  --c64-border: rgba(22, 76, 150, 0.28);

  --c32: #116653;
  --c32-soft: rgba(17, 102, 83, 0.055);
  --c32-border: rgba(17, 102, 83, 0.28);

  --wave-idle: rgba(17, 24, 39, 0.16);
  --wave-hover: rgba(17, 24, 39, 0.34);

  --shadow-card: 0 1px 2px rgba(17, 24, 39, 0.04);
  --shadow-dock: 0 6px 20px rgba(17, 24, 39, 0.08), 0 1px 2px rgba(17, 24, 39, 0.05);

  --font-serif: Georgia, "Palatino Linotype", "Book Antiqua", "Times New Roman", "Songti SC", "Noto Serif SC", serif;
  --font-sans: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;

  color-scheme: light;
}

[data-theme="dark"] {
  --bg: #0f1217;
  --surface: #151921;
  --surface-2: #1b202b;
  --surface-glass: rgba(15, 18, 23, 0.92);
  --dock-bg: rgba(21, 25, 33, 0.96);

  --ink: #eef1f6;
  --ink-2: #c5ccd6;
  --muted: #8b94a3;
  --rule: rgba(238, 241, 246, 0.10);
  --rule-strong: rgba(238, 241, 246, 0.22);
  --rule-heavy: #d6dce5;

  --c64: #6da4f2;
  --c64-soft: rgba(109, 164, 242, 0.11);
  --c64-border: rgba(109, 164, 242, 0.36);

  --c32: #4eb89d;
  --c32-soft: rgba(78, 184, 157, 0.11);
  --c32-border: rgba(78, 184, 157, 0.36);

  --wave-idle: rgba(238, 241, 246, 0.18);
  --wave-hover: rgba(238, 241, 246, 0.36);

  --shadow-card: 0 1px 3px rgba(0, 0, 0, 0.22);
  --shadow-dock: 0 10px 28px rgba(0, 0, 0, 0.42);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 76px; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-variant-numeric: tabular-nums;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  transition: background-color 180ms ease, color 180ms ease;
}

a { color: inherit; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; touch-action: manipulation; }
button:disabled { opacity: 0.34; cursor: not-allowed; }
[hidden] { display: none !important; }

button:focus-visible, a:focus-visible, input:focus-visible, summary:focus-visible, [role="slider"]:focus-visible {
  outline: 2px solid var(--c64);
  outline-offset: 2px;
}

kbd {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 19px;
  height: 19px;
  padding: 0 5px;
  border-radius: 3px;
  border: 1px solid var(--rule-strong);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-2);
}

.skip {
  position: fixed;
  top: 10px;
  left: 16px;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  background: var(--ink);
  color: var(--bg);
  padding: 10px 14px;
  z-index: 200;
}
.skip:focus { width: auto; height: auto; clip-path: none; }

.swatch {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 2px;
  vertical-align: middle;
  margin-right: 5px;
}
.swatch.s64 { background: var(--c64); }
.swatch.s32 { background: var(--c32); }

/* Masthead */
.masthead {
  position: sticky;
  top: 0;
  z-index: 40;
  background: var(--surface-glass);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rule);
}
.masthead-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 36px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.identity {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
}
.brand-glyph {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  height: 18px;
}
.brand-glyph i {
  display: block;
  width: 2.5px;
  border-radius: 1px;
  background: var(--c64);
}
.brand-glyph i:nth-child(1) { height: 7px; }
.brand-glyph i:nth-child(2) { height: 15px; }
.brand-glyph i:nth-child(3) { height: 18px; background: var(--c32); }
.brand-glyph i:nth-child(4) { height: 10px; background: var(--c32); }
.brand-name {
  font-family: var(--font-serif);
  font-weight: 700;
  font-size: 19px;
  letter-spacing: -0.02em;
}
.brand-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted);
  border-left: 1px solid var(--rule-strong);
  padding-left: 9px;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 26px;
}
.nav-links a {
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--muted);
  transition: color 140ms ease;
}
.nav-links a:hover { color: var(--ink); }
.masthead-right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.masthead-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  color: var(--muted);
}
.icon-btn {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  display: grid;
  place-items: center;
  transition: border-color 140ms ease;
}
.icon-btn:hover { border-color: var(--ink); }
.icon-btn svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sun-icon { display: none; }
.moon-icon { display: block; }
[data-theme="dark"] .sun-icon { display: block; }
[data-theme="dark"] .moon-icon { display: none; }

/* Main */
main {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 36px 40px;
}

/* Academic Paper Hero */
.paper-hero {
  padding: 44px 0 36px;
  border-bottom: 1px solid var(--rule);
}
.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(0, 0.78fr);
  gap: 44px;
  align-items: end;
}
.paper-kicker {
  margin: 0 0 10px;
  font-family: var(--font-sans);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.04em;
  color: var(--muted);
}
.paper-title {
  margin: 0 0 16px;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(27px, 3vw, 38px);
  line-height: 1.22;
  letter-spacing: -0.018em;
  color: var(--ink);
}
.title-mark {
  font-weight: 700;
  color: var(--ink);
}
.paper-abstract {
  margin: 0 0 24px;
  font-size: 15px;
  line-height: 1.72;
  color: var(--ink-2);
  max-width: 680px;
}
.spec-strip {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 28px;
}
.spec-strip dt {
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 2px;
}
.spec-strip dd {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

/* Scientific Spectrum Plot */
.acoustic-figure {
  margin: 0;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.fig-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 14px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted);
}
.fig-state {
  padding: 1px 7px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--surface);
  font-size: 9.5px;
  font-weight: 600;
}
.fig-state.live {
  border-color: var(--c64-border);
  background: var(--c64-soft);
  color: var(--c64);
}
.fig-canvas-wrap {
  position: relative;
  padding: 8px 12px 6px;
  background-image:
    linear-gradient(to right, var(--rule) 1px, transparent 1px),
    linear-gradient(to bottom, var(--rule) 1px, transparent 1px);
  background-size: 40px 38px;
}
#hero-canvas {
  display: block;
  width: 100%;
  height: 152px;
}
.fig-axes {
  display: flex;
  justify-content: space-between;
  padding: 4px 4px 0;
  border-top: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted);
}
.fig-caption {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-top: 1px solid var(--rule);
  background: var(--surface-2);
  font-size: 11.5px;
  color: var(--muted);
}
.fig-caption strong { color: var(--ink); font-weight: 600; }

/* Sections */
.section { padding-top: 40px; }
.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.sec-idx {
  color: var(--muted);
  font-weight: 400;
  margin-right: 4px;
}
.section-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-weight: 400;
  font-size: clamp(22px, 2.3vw, 28px);
  letter-spacing: -0.015em;
  color: var(--ink);
}

/* Segmented Academic Task Switcher */
.task-switcher {
  display: inline-flex;
  padding: 3px;
  border-radius: 7px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  gap: 2px;
}
.task-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid transparent;
  border-radius: 5px;
  background: transparent;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}
.task-tab:hover { color: var(--ink); }
.task-tab.active {
  color: var(--ink);
  font-weight: 600;
  background: var(--surface);
  border-color: var(--rule);
  box-shadow: 0 1px 2px rgba(17, 24, 39, 0.05);
}
.tab-code {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 12px;
  color: var(--c64);
}
.tab-count {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 3px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
  color: var(--muted);
}
.task-tab.active .tab-count {
  background: var(--c64-soft);
  border-color: var(--c64-border);
  color: var(--c64);
}

.task-note-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  padding: 10px 0 14px;
  font-size: 13px;
  color: var(--ink-2);
}
.task-note-bar p { margin: 0; }
.criteria-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--muted);
  padding: 3px 9px;
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: var(--surface);
}

/* Workspace */
.workspace {
  display: grid;
  grid-template-columns: 296px minmax(0, 1fr);
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: 8px;
  box-shadow: var(--shadow-card);
  overflow: hidden;
}

/* Rail */
.sample-rail {
  border-right: 1px solid var(--rule);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  min-width: 0;
}
.rail-tools {
  padding: 13px;
  border-bottom: 1px solid var(--rule);
  background: var(--surface);
}
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid var(--rule-strong);
  background: var(--bg);
}
.search-box svg {
  width: 14px;
  height: 14px;
  flex: none;
  fill: none;
  stroke: var(--muted);
  stroke-width: 2;
}
.search-box input {
  width: 100%;
  min-width: 0;
  border: 0;
  background: transparent;
  font-size: 12px;
  outline: none;
}
.rail-filters {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}
.lang-pills { display: flex; gap: 4px; flex-wrap: wrap; }
.lang-pill {
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--muted);
  font-size: 11px;
  font-weight: 500;
  padding: 3px 9px;
  border-radius: 4px;
  transition: all 130ms ease;
}
.lang-pill:hover { color: var(--ink); border-color: var(--ink); }
.lang-pill.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
}
.sample-count {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.sample-list {
  flex: 1;
  max-height: 750px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--rule-strong) transparent;
}
.sample-button {
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  gap: 9px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--rule);
  border-left: 3px solid transparent;
  background: transparent;
  text-align: left;
  padding: 12px 13px 12px 10px;
  transition: background 130ms ease, border-color 130ms ease;
}
.sample-button:hover { background: var(--surface); }
.sample-button.selected {
  background: var(--surface);
  border-left-color: var(--c64);
}
.sample-button .rank {
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 600;
  color: var(--muted);
  padding-top: 2px;
}
.sample-button.selected .rank { color: var(--c64); }
.sample-button .snippet {
  font-family: var(--font-serif);
  font-size: 13.5px;
  line-height: 1.4;
  color: var(--ink);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.sample-button.selected .snippet { font-weight: 600; }
.sample-button .meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  margin-top: 6px;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted);
}
.sample-button .ds-tag {
  padding: 1px 5px;
  border-radius: 3px;
  border: 1px solid var(--rule);
  background: var(--surface-2);
}
.sample-button.selected .ds-tag {
  border-color: var(--c64-border);
  background: var(--c64-soft);
  color: var(--c64);
}
.no-results { padding: 20px 14px; font-size: 12.5px; color: var(--muted); }

/* Listening Desk */
.listening-desk {
  padding: 22px 26px 18px;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.desk-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 16px;
}
.sample-tags { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.loc-tag {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--c64);
}
.uid-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--muted);
  background: var(--surface-2);
  padding: 2px 7px;
  border-radius: 3px;
  border: 1px solid var(--rule);
  max-width: 340px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sample-nav { display: inline-flex; align-items: center; gap: 6px; flex: none; }
.nav-arrow {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  font-size: 14px;
  display: grid;
  place-items: center;
  transition: border-color 130ms ease, color 130ms ease;
}
.nav-arrow:hover:not(:disabled) { border-color: var(--c64); color: var(--c64); }
.nav-counter {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  min-width: 50px;
  text-align: center;
}

.transcript {
  margin: 0 0 20px;
  padding-left: 16px;
  border-left: 2px solid var(--rule-strong);
  font-family: var(--font-serif);
  font-size: clamp(19px, 2vw, 24px);
  line-height: 1.48;
  letter-spacing: -0.01em;
  color: var(--ink);
}

/* Summary Cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}
.metric-card {
  padding: 10px 13px;
  border-radius: 5px;
  border: 1px solid var(--rule);
  background: var(--bg);
}
.card-64k { border-top: 2.5px solid var(--c64); background: var(--c64-soft); }
.card-32k { border-top: 2.5px solid var(--c32); background: var(--c32-soft); }
.card-ref { border-top: 2.5px solid var(--rule-strong); }
.mc-head {
  display: flex;
  align-items: center;
  font-size: 12px;
  margin-bottom: 6px;
}
.mc-head small {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 9.5px;
  color: var(--muted);
}
.mc-vals {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.mc-vals b { color: var(--ink); font-weight: 700; }

/* Reference prompt row */
.reference-row {
  display: grid;
  grid-template-columns: 34px minmax(145px, 200px) minmax(0, 1fr) 46px;
  align-items: center;
  gap: 12px;
  padding: 9px 13px;
  margin-bottom: 16px;
  border-radius: 5px;
  border: 1px dashed var(--rule-strong);
  background: var(--bg);
}
.ref-play {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  display: grid;
  place-items: center;
  transition: all 130ms ease;
}
.ref-play:hover:not(:disabled) { border-color: var(--ink); }
.ref-play.playing { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.ref-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
}
.ref-meta small { display: block; font-size: 11px; color: var(--muted); margin-top: 1px; }
.ref-wave { height: 30px; }

/* Lanes toolbar */
.lanes-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding-bottom: 9px;
  border-bottom: 1px solid var(--rule-strong);
}
.lanes-title {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--ink);
}
.lanes-title small { font-weight: 400; color: var(--muted); letter-spacing: 0.02em; }
.sync-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.sync-toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.sync-box {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1.5px solid var(--rule-strong);
  background: var(--surface);
  display: inline-grid;
  place-items: center;
  transition: all 120ms ease;
}
.sync-toggle input:checked + .sync-box {
  background: var(--c64);
  border-color: var(--c64);
}
.sync-toggle input:checked + .sync-box::after {
  content: "";
  width: 4px;
  height: 7px;
  border: solid #fff;
  border-width: 0 1.8px 1.8px 0;
  transform: rotate(45deg) translate(-0.5px, -0.5px);
}

/* System Lanes (Academic ruled ledger with interactive real waveforms) */
.system-lanes { display: flex; flex-direction: column; }
.system-lane {
  display: grid;
  grid-template-columns: 20px 34px minmax(165px, 215px) minmax(160px, 1fr) 44px;
  align-items: center;
  gap: 14px;
  padding: 11px 10px;
  border-bottom: 1px solid var(--rule);
  border-left: 3px solid transparent;
  transition: background-color 130ms ease, border-color 130ms ease;
}
.system-lane:hover { background: var(--bg); }
.system-lane.is-64k { border-left-color: var(--c64); }
.system-lane.is-32k { border-left-color: var(--c32); }
.system-lane.active { background: var(--surface-2); }
.system-lane.active.is-64k { background: var(--c64-soft); }
.system-lane.active.is-32k { background: var(--c32-soft); }

.lane-key {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  text-align: center;
}
.lane-play {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--ink);
  display: grid;
  place-items: center;
  padding: 0;
  transition: transform 110ms ease, background 130ms ease, border-color 130ms ease, color 130ms ease;
}
.lane-play:hover { border-color: var(--ink); }
.lane-play:active { transform: scale(0.95); }
.system-lane.active .lane-play {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--bg);
}
.system-lane.active.is-64k .lane-play {
  background: var(--c64);
  border-color: var(--c64);
  color: #fff;
}
.system-lane.active.is-32k .lane-play {
  background: var(--c32);
  border-color: var(--c32);
  color: #fff;
}
.play-icon { width: 14px; height: 14px; fill: currentColor; display: block; pointer-events: none; }
.main-play .play-icon { width: 17px; height: 17px; }

.lane-label { min-width: 0; }
.lane-name-row { display: flex; align-items: center; gap: 6px; }
.lane-name {
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.ours-pill {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.04em;
  padding: 1px 6px;
  border-radius: 999px;
  border: 1px solid transparent;
  flex: none;
}
.is-64k .ours-pill { background: var(--c64-soft); border-color: var(--c64-border); color: var(--c64); }
.is-32k .ours-pill { background: var(--c32-soft); border-color: var(--c32-border); color: var(--c32); }
.lane-tag {
  display: block;
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Interactive Waveform */
.wave-wrap {
  position: relative;
  height: 36px;
  cursor: pointer;
  display: flex;
  align-items: center;
  user-select: none;
}
.wave-svg { display: block; width: 100%; height: 100%; overflow: visible; }
.wave-base { fill: var(--wave-idle); transition: fill 130ms ease; }
.wave-wrap:hover .wave-base { fill: var(--wave-hover); }
.wave-played {
  position: absolute;
  inset: 0;
  pointer-events: none;
  clip-path: inset(0 calc(100% - var(--progress, 0%)) 0 0);
}
.wave-played svg rect { fill: var(--ink); }
.is-64k .wave-played svg rect { fill: var(--c64); }
.is-32k .wave-played svg rect { fill: var(--c32); }
.ref-wave .wave-played svg rect { fill: var(--ink); }
.wave-hover-line {
  position: absolute;
  top: 2px;
  bottom: 2px;
  width: 1px;
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
  left: var(--hover-x, 0%);
  transition: opacity 90ms ease;
}
.wave-wrap:hover .wave-hover-line { opacity: 0.55; }

/* Per-track tabular metrics */
.lane-metrics {
  display: flex;
  align-items: center;
  gap: 5px;
  justify-content: flex-end;
}
.m-pill {
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--ink-2);
  white-space: nowrap;
}
.m-pill.best {
  border-color: var(--rule-strong);
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
}
.is-64k .m-pill.best { border-color: var(--c64-border); color: var(--c64); }
.is-32k .m-pill.best { border-color: var(--c32-border); color: var(--c32); }
.m-pill.gt { color: var(--muted); border-style: dashed; }
.track-duration {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}

.audio-status {
  min-height: 18px;
  margin: 8px 0 0;
  font-size: 11.5px;
  color: var(--c64);
}

/* Academic Sticky Transport Bar */
.transport-wrap {
  position: sticky;
  bottom: 14px;
  z-index: 30;
  margin-top: 14px;
}
.transport {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 11px 18px;
  border-radius: 8px;
  background: var(--dock-bg);
  color: var(--ink);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--rule-strong);
  box-shadow: var(--shadow-dock);
}
.main-play {
  width: 38px;
  height: 38px;
  flex: none;
  border-radius: 50%;
  border: 0;
  background: var(--c64);
  color: #fff;
  display: grid;
  place-items: center;
  transition: transform 110ms ease, background 140ms ease;
}
.main-play:active { transform: scale(0.95); }
.main-play.is-32k { background: var(--c32); }
.main-play.is-neutral { background: var(--ink); color: var(--bg); }

.transport-meta {
  min-width: 170px;
  max-width: 230px;
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.transport-sys { display: flex; align-items: center; gap: 8px; }
.transport-meta strong {
  font-size: 13px;
  font-weight: 650;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.transport-sub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.eq-bars {
  display: inline-flex;
  align-items: flex-end;
  gap: 2px;
  height: 11px;
  width: 11px;
  opacity: 0.3;
}
.eq-bars i {
  display: block;
  width: 2px;
  height: 4px;
  border-radius: 1px;
  background: var(--c64);
}
.eq-bars.playing { opacity: 1; }
.eq-bars.playing i { animation: eq-pulse 680ms ease-in-out infinite; }
.eq-bars.playing i:nth-child(2) { animation-delay: 140ms; }
.eq-bars.playing i:nth-child(3) { animation-delay: 280ms; }
@keyframes eq-pulse {
  0%, 100% { height: 3px; }
  50% { height: 11px; }
}

.transport-scrubber {
  flex: 1;
  min-width: 120px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.time-code {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  min-width: 34px;
}
.seek-shell {
  position: relative;
  flex: 1;
  height: 22px;
  display: flex;
  align-items: center;
}
.seek-shell::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 2px;
  background: var(--rule-strong);
}
.seek-fill {
  position: absolute;
  left: 0;
  height: 3px;
  width: 0%;
  border-radius: 2px;
  background: var(--c64);
  pointer-events: none;
}
.seek-fill.is-32k { background: var(--c32); }
.seek-fill.is-neutral { background: var(--ink); }
#seek {
  position: relative;
  width: 100%;
  margin: 0;
  appearance: none;
  -webkit-appearance: none;
  background: transparent;
  cursor: pointer;
  height: 22px;
}
#seek::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--ink);
  border: 2px solid var(--surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
#seek::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  border: 2px solid var(--surface);
  background: var(--ink);
}

.transport-controls { display: flex; align-items: center; gap: 8px; flex: none; }
.ctrl-btn {
  width: 32px;
  height: 32px;
  border-radius: 5px;
  border: 1px solid var(--rule-strong);
  background: var(--surface-2);
  display: grid;
  place-items: center;
}
.ctrl-btn svg { width: 15px; height: 15px; fill: currentColor; }
.ctrl-btn .vol-off { display: none; }
.ctrl-btn.muted .vol-on { display: none; }
.ctrl-btn.muted .vol-off { display: block; }
.speed-group {
  display: inline-flex;
  padding: 2px;
  border-radius: 5px;
  background: var(--surface-2);
  border: 1px solid var(--rule);
}
.speed-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 4px 7px;
  border-radius: 3px;
}
.speed-btn.active { background: var(--surface); color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgba(0,0,0,0.08); }

.shortcut-bar {
  display: flex;
  justify-content: center;
  gap: 18px;
  flex-wrap: wrap;
  padding-top: 7px;
  font-size: 11px;
  color: var(--muted);
}
.shortcut-bar span { display: inline-flex; align-items: center; gap: 5px; }

/* §2 LaTeX Booktabs Benchmark Table */
.benchmarks {
  margin-top: 48px;
  border-top: 1px solid var(--rule);
}
.bench-tabs { display: inline-flex; gap: 6px; flex-wrap: wrap; }
.bench-tab {
  border: 1px solid var(--rule-strong);
  background: var(--surface);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 4px;
  transition: all 130ms ease;
}
.bench-tab:hover { color: var(--ink); border-color: var(--ink); }
.bench-tab.active {
  background: var(--ink);
  color: var(--bg);
  border-color: var(--ink);
  font-weight: 600;
}
.bench-note { margin: 0 0 14px; font-size: 13px; color: var(--muted); }
.booktabs-wrap {
  background: var(--surface);
  padding: 8px 18px;
  border: 1px solid var(--rule);
  border-radius: 8px;
  overflow-x: auto;
}
.bench-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12.5px;
  border-top: 1.75px solid var(--rule-heavy);
  border-bottom: 1.75px solid var(--rule-heavy);
  margin: 8px 0;
}
.bench-table th, .bench-table td {
  padding: 7px 9px;
  text-align: right;
  white-space: nowrap;
}
.bench-table thead tr.group-row th {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--ink);
  text-align: center;
  padding: 8px 9px 5px;
  border-bottom: 0;
}
.bench-table thead tr.group-row th.group-span {
  border-bottom: 1px solid var(--rule-strong);
}
.bench-table thead tr.sub-row th {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.03em;
  color: var(--muted);
  font-weight: 600;
  padding: 5px 9px 8px;
  border-bottom: 1px solid var(--rule-heavy);
}
.bench-table thead th.left-col, .bench-table td.left-col { text-align: left; }
.bench-table thead th.group-row-left { text-align: left; border-bottom: 1px solid var(--rule-heavy); vertical-align: bottom; padding-bottom: 8px; }
.bench-table thead th.group-row-right { text-align: right; border-bottom: 1px solid var(--rule-heavy); vertical-align: bottom; padding-bottom: 8px; }
.bench-table td.cat-col { color: var(--muted); font-size: 11px; font-weight: 600; }
.bench-table td.meta-col { color: var(--muted); font-size: 11.5px; }
.bench-table td.group-start, .bench-table th.group-start { padding-left: 16px; }
.bench-table tbody tr + tr td { border-top: 1px solid var(--rule); }
.bench-table tbody tr:not(.row-gt):not(.row-64k):not(.row-32k):hover { background: var(--surface-2); }
.bench-table tr.row-gt { background: var(--surface-2); color: var(--ink-2); }
.bench-table tr.row-64k { background: var(--c64-soft); }
.bench-table tr.row-32k { background: var(--c32-soft); }
.bench-table tr.row-divider td { border-top: 1.25px solid var(--rule-strong); }
.bench-table td.best-val { font-weight: 700; color: var(--ink); }
.bench-table td.second-val { text-decoration: underline; text-underline-offset: 3px; }
.sys-cell { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; }
.row-gt .sys-cell { font-weight: 600; font-style: italic; }
.table-footnote {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.6;
}

/* §3 Protocol */
.protocol {
  margin-top: 48px;
  border-top: 1px solid var(--rule);
  display: grid;
  grid-template-columns: minmax(0, 0.8fr) minmax(0, 1.4fr);
  gap: 44px;
}
.protocol-intro p {
  font-size: 13.5px;
  line-height: 1.7;
  color: var(--muted);
  margin: 10px 0 0;
}
.protocol-list details {
  border-top: 1px solid var(--rule);
  padding: 14px 0;
}
.protocol-list details:last-child { border-bottom: 1px solid var(--rule); }
.protocol-list summary {
  cursor: pointer;
  list-style: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  font-family: var(--font-serif);
  font-size: 15.5px;
  font-weight: 600;
}
.protocol-list summary::-webkit-details-marker { display: none; }
.protocol-list summary span {
  font-family: var(--font-sans);
  font-size: 18px;
  color: var(--c64);
  transition: transform 160ms ease;
}
.protocol-list details[open] summary span { transform: rotate(45deg); }
.protocol-list details p {
  margin: 10px 0 0;
  font-size: 13px;
  line-height: 1.75;
  color: var(--ink-2);
}

/* Footer */
.site-footer {
  border-top: 1px solid var(--rule);
  margin-top: 56px;
}
.footer-inner {
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 36px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}
.footer-copy { font-size: 12px; color: var(--muted); }
.footer-top { font-size: 12px; font-weight: 600; text-decoration: none; color: var(--ink-2); }
.footer-top:hover { color: var(--c64); }

/* Responsive */
@media (max-width: 1120px) {
  .masthead-inner, main, .footer-inner { padding-left: 22px; padding-right: 22px; }
  .hero-grid { grid-template-columns: 1fr; gap: 24px; }
  .workspace { grid-template-columns: 250px minmax(0, 1fr); }
  .system-lane { grid-template-columns: 18px 32px 160px minmax(120px, 1fr) 42px; gap: 10px; padding: 10px 8px; }
  .protocol { grid-template-columns: 1fr; gap: 20px; }
}

@media (max-width: 860px) {
  .nav-links, .masthead-meta, .shortcut-bar { display: none; }
  .spec-strip { grid-template-columns: 1fr; }
  .workspace { grid-template-columns: 1fr; }
  .sample-rail { border-right: 0; border-bottom: 1px solid var(--rule); }
  .sample-list { display: flex; overflow-x: auto; overflow-y: hidden; max-height: none; }
  .sample-button {
    flex: none;
    width: 205px;
    border-bottom: 0;
    border-right: 1px solid var(--rule);
    border-left: 0;
    border-top: 3px solid transparent;
    padding: 10px 11px;
  }
  .sample-button.selected { border-left-color: transparent; border-top-color: var(--c64); }
  .summary-cards { grid-template-columns: 1fr; }
  .reference-row { grid-template-columns: 32px minmax(0, 1fr) 42px; }
  .ref-wave { grid-column: 1 / -1; height: 28px; }
  .system-lane { grid-template-columns: 32px minmax(0, 1fr) 40px; row-gap: 7px; }
  .lane-key { display: none; }
  .wave-wrap { grid-column: 1 / -1; height: 32px; }
  .lane-metrics { grid-column: 1 / -1; justify-content: flex-start; flex-wrap: wrap; }
  .transport { flex-wrap: wrap; gap: 10px; padding: 11px 13px; }
  .transport-meta { min-width: 0; flex: 1; }
  .transport-scrubber { order: 5; flex-basis: 100%; }
  .listening-desk { padding: 16px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
