:root {
  --ink: #17191d;
  --muted: #656a73;
  --navy: #12263f;
  --paper: #ffffff;
  --soft: #faf8f3;
  --soft-blue: #edf3f8;
  --sand: #ead8b3;
  --gold: #b6812b;
  --gold-dark: #79521b;
  --line: #e8e2d7;
  --line-strong: #d8cdb9;
  --blue: #1f77b4;
  --orange: #ff7f0e;
  --green: #2ca02c;
  --danger: #d45050;
  --radius: 18px;
  --max: 1540px;
  --shadow: 0 10px 28px rgba(20, 28, 41, .055);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.45;
}
button, select { font: inherit; }
a { color: inherit; text-decoration: none; }

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
  padding: 15px max(22px, calc((100vw - var(--max)) / 2));
  background: rgba(255,255,255,.93);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: baseline; gap: 11px; }
.brand-mark { color: var(--navy); font-weight: 850; letter-spacing: -.015em; }
.brand-sub { color: var(--muted); font-size: .82rem; font-weight: 650; }
.top-nav { display: flex; align-items: center; gap: 18px; color: var(--navy); font-size: .88rem; font-weight: 750; }
.top-nav a { opacity: .75; }
.top-nav a:hover { opacity: 1; color: var(--gold-dark); }

main { max-width: var(--max); margin: 0 auto; padding: 0 22px 70px; }
.hero { padding: 38px 0 24px; border-bottom: 1px solid var(--line); }
.eyebrow {
  margin: 0 0 9px;
  color: var(--gold-dark);
  text-transform: uppercase;
  letter-spacing: .16em;
  font-size: .7rem;
  font-weight: 850;
}
.hero h1 {
  max-width: 1080px;
  margin: 0;
  color: var(--navy);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(2rem, 4vw, 3.7rem);
  line-height: .99;
  letter-spacing: -.047em;
  font-weight: 700;
}
.hero-copy { max-width: 900px; margin: 16px 0 0; color: #4e535c; font-size: 1rem; }
.examples { padding-top: 14px; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 28px; margin-bottom: 17px; }
.section-heading h2 { margin: 0; color: var(--navy); font-size: clamp(1.5rem, 2.5vw, 2.1rem); letter-spacing: -.03em; }
.section-note { max-width: 720px; margin: 0; color: var(--muted); font-size: .82rem; text-align: right; }
.compact-note { margin: 0 0 10px auto; }
.sample-list { display: grid; gap: 28px; }

.sample-card {
  overflow: hidden;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.sample-head {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: flex-start;
  padding: 13px 17px 11px;
  border-bottom: 1px solid var(--line);
}
.sample-kicker { margin: 0 0 4px; color: var(--gold-dark); font-size: .69rem; letter-spacing: .12em; text-transform: uppercase; font-weight: 850; }
.sample-title { margin: 0; color: var(--navy); font-size: 1.12rem; line-height: 1.15; letter-spacing: -.02em; }
.sample-meta { margin: 7px 0 0; color: var(--muted); font-size: .78rem; }
.status-pill { min-height: 26px; padding: 5px 9px; border: 1px solid var(--line); border-radius: 999px; color: var(--muted); background: var(--soft); font-size: .72rem; font-weight: 750; white-space: nowrap; }

.playback-row {
  display: grid;
  grid-template-columns: auto auto auto minmax(180px, 1fr);
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: #fff;
  border-bottom: 1px solid var(--line);
}
.play-button {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: #fff;
  background: var(--navy);
  cursor: pointer;
  box-shadow: 0 5px 14px rgba(18, 38, 63, .15);
}
.play-button:hover { transform: translateY(-1px); }
.play-icon { width: 14px; height: 14px; fill: currentColor; }
.time-readout { min-width: 92px; color: var(--navy); font-variant-numeric: tabular-nums; font-size: .76rem; font-weight: 780; white-space: nowrap; }
.audio-toggle {
  display: inline-grid;
  grid-template-columns: auto auto;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--soft);
}
.audio-toggle button {
  min-height: 27px;
  padding: 4px 9px;
  border: 0;
  border-radius: 999px;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
  font-size: .67rem;
  font-weight: 780;
  white-space: nowrap;
}
.audio-toggle button.active { color: #fff; background: var(--navy); box-shadow: 0 3px 9px rgba(18, 38, 63, .16); }
.activation-toggle {
  min-height: 27px;
  padding: 4px 8px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  color: var(--navy);
  background: #fff;
  cursor: pointer;
  font-size: .66rem;
  font-weight: 790;
  white-space: nowrap;
}
.activation-toggle:hover, .activation-toggle.active { background: var(--soft-blue); border-color: #bdcad5; }
.window-presets { display: flex; align-items: center; gap: 4px; }
.window-presets button {
  min-height: 23px;
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--muted);
  background: #fff;
  cursor: pointer;
  font-size: .62rem;
  font-weight: 780;
  white-space: nowrap;
}
.window-presets button:hover { border-color: #b8c4cf; color: var(--navy); }
.window-presets button.active { color: #fff; border-color: var(--navy); background: var(--navy); }


.audio-scrubber {
  --scrub-progress: 0%;
  width: 100%;
  height: 22px;
  margin: 0;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
.audio-scrubber::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(to right, var(--navy) 0 var(--scrub-progress), #d9dde2 var(--scrub-progress) 100%);
}
.audio-scrubber::-webkit-slider-thumb {
  appearance: none;
  width: 15px;
  height: 15px;
  margin-top: -5.5px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--navy);
  box-shadow: 0 1px 5px rgba(18,38,63,.35);
}
.audio-scrubber::-moz-range-track { height: 4px; border-radius: 99px; background: #d9dde2; }
.audio-scrubber::-moz-range-progress { height: 4px; border-radius: 99px; background: var(--navy); }
.audio-scrubber::-moz-range-thumb { width: 13px; height: 13px; border: 2px solid #fff; border-radius: 50%; background: var(--navy); box-shadow: 0 1px 5px rgba(18,38,63,.35); }

.sample-view {
  display: grid;
  grid-template-columns: minmax(560px, 1.62fr) minmax(390px, 1fr);
  align-items: stretch;
  gap: 14px;
  width: 100%;
  padding: 10px 12px 12px;
  background: #fff;
}
.sample-view[hidden] { display: none; }
.sample-view.orbits-hidden { grid-template-columns: minmax(0, 1fr); }
.column { min-width: 0; }
.semantic-column { min-width: 560px; }
.orbit-column {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-width: 0;
  min-height: 0;
  align-self: stretch;
}
.orbit-column .orbit-panel { height: 100%; min-height: 306px; min-width: 0; }
.orbit-column.collapsed { display: none; }
.semantic-heading { align-items: center; justify-content: space-between; min-height: 32px; padding-bottom: 6px; }
.window-control-inline { display: flex; align-items: center; gap: 7px; min-width: 0; }
.window-label { color: var(--navy); font-size: .67rem; font-weight: 820; white-space: nowrap; }
.semantic-heading .activation-toggle { margin-left: auto; }
.orbit-heading { position: relative; z-index: 8; align-items: center; justify-content: flex-start; overflow: visible; }
.orbit-info-trigger {
  display: inline-block;
  margin: -2px -4px;
  padding: 2px 4px;
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: help;
  outline: none;
}
.orbit-info-trigger:hover,
.orbit-info-trigger:focus,
.orbit-heading.info-open .orbit-info-trigger {
  border-color: #26384d;
  background: rgba(255,249,232,.96);
  box-shadow: 0 2px 7px rgba(38,56,77,.14);
}
.orbit-info-legend {
  position: absolute;
  top: calc(100% + 1px);
  left: 2px;
  z-index: 12;
  display: grid;
  gap: 4px;
  width: min(310px, calc(100vw - 48px));
  padding: 10px 12px;
  border: 1px solid rgba(38,56,77,.28);
  border-radius: 9px;
  color: #26384d;
  background: rgba(255,255,255,.92);
  box-shadow: 0 10px 25px rgba(18,38,63,.16);
  font-size: .68rem;
  line-height: 1.35;
  opacity: 0;
  transform: translateY(-3px);
  pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}
.orbit-info-legend strong { color: var(--navy); font-size: .75rem; }
.orbit-info-legend span { display: block; }
.orbit-info-legend b { color: var(--navy); }
.orbit-heading.info-open .orbit-info-legend { opacity: 1; transform: translateY(0); }
.column-heading { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; min-height: 24px; padding: 0 2px 5px; }
.column-heading h3 { margin: 0; color: var(--navy); font-size: .86rem; letter-spacing: .015em; }
.column-heading span { color: var(--muted); font-size: .65rem; }

.analysis-legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  margin: 0 0 7px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: linear-gradient(180deg, #fff, #fbfaf7);
  color: var(--muted);
  font-size: .61rem;
  line-height: 1.2;
}
.legend-group { display: inline-flex; align-items: center; flex-wrap: wrap; gap: 5px; min-width: 0; }
.legend-title { color: var(--navy); font-weight: 850; white-space: nowrap; }
.legend-item { display: inline-flex; align-items: center; gap: 4px; white-space: nowrap; }
.legend-line { width: 14px; height: 2px; border-radius: 99px; background: var(--legend-color); }
.root-color-key {
  flex: 1 1 100%;
  flex-wrap: nowrap;
  gap: 3px;
  white-space: nowrap;
}
.curve-key {
  flex: 1 1 100%;
  padding-top: 5px;
  border-top: 1px solid #eee9df;
}
.root-color-key .legend-title, .curve-key .legend-title { margin-right: 2px; }
.root-key { display: inline-flex; align-items: center; gap: 2px; min-width: 0; color: #555d67; font-size: .58rem; font-weight: 720; white-space: nowrap; }
.root-key i { width: 7px; height: 7px; flex: 0 0 7px; border-radius: 2px; background: var(--root-color); box-shadow: inset 0 0 0 1px rgba(18,38,63,.13); }
.semantic-stack { display: grid; gap: 0; }
.semantic-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.semantic-panel .plot-panel { border: 0; border-radius: 0; }
.semantic-panel .plot-panel + .plot-panel { border-top: 1px solid var(--line); }
.plot-panel {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}
.plot-panel canvas {
  position: absolute;
  inset: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  cursor: crosshair;
}
.piano-panel { height: 110px; }
.curve-panel { height: 88px; }
.sample-card.reference-focus .piano-panel canvas,
.sample-card.estimation-focus .curve-panel canvas,
.sample-card.melody-focus .melody-panel canvas { cursor: help; }
.melody-panel { height: 106px; }
.orbit-panel { border-color: var(--line); background: #fff; }
.plot-playhead { position: absolute; top: 0; bottom: 0; width: 1px; background: rgba(209, 55, 55, .95); box-shadow: 0 0 0 1px rgba(255,255,255,.16); pointer-events: none; z-index: 4; display: none; }
.orbit-panel .plot-playhead { width: 1px; background: rgba(255,255,255,.95); box-shadow: 0 0 2px rgba(0,0,0,.45); }
.plot-tooltip {
  position: fixed;
  z-index: 100;
  max-width: 240px;
  padding: 7px 9px;
  border: 1px solid rgba(18,38,63,.16);
  border-radius: 8px;
  color: #fff;
  background: rgba(14, 24, 38, .94);
  box-shadow: 0 10px 26px rgba(0,0,0,.18);
  font-size: .69rem;
  line-height: 1.4;
  pointer-events: none;
  display: none;
}
.plot-tooltip strong { color: #ffe09a; }
.plot-tooltip.detail-tooltip {
  width: min(430px, calc(100vw - 24px));
  max-width: 430px;
  max-height: min(72vh, 560px);
  overflow: auto;
  padding: 11px 13px 12px;
  border-color: rgba(255,255,255,.18);
  font-size: .72rem;
  line-height: 1.46;
}
.detail-tooltip .tooltip-title { margin: 0 0 5px; color: #ffe09a; font-size: .86rem; font-weight: 850; letter-spacing: .01em; }
.detail-tooltip p { margin: 0 0 8px; color: #f5f7fa; }
.detail-tooltip code { padding: 1px 4px; border-radius: 4px; color: #fff3c9; background: rgba(255,255,255,.09); font: 600 .66rem/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.detail-tooltip .tooltip-section { display: grid; grid-template-columns: 105px minmax(0, 1fr); gap: 5px 9px; padding: 6px 0; border-top: 1px solid rgba(255,255,255,.11); }
.detail-tooltip .tooltip-section > b { color: #ffe09a; font-weight: 800; }
.detail-tooltip .tooltip-section > span { color: #eef1f5; }
.detail-tooltip .tooltip-lines span { position: relative; padding-left: 15px; }
.detail-tooltip .tooltip-lines span i { position: absolute; left: 0; top: .62em; width: 10px; height: 2px; border-radius: 99px; background: var(--tip-color); }
.detail-tooltip .tooltip-lines span strong { color: #fff; }
.detail-tooltip .tooltip-axes { display: grid; grid-template-columns: 44px minmax(0, 1fr); gap: 4px 8px; margin-top: 4px; padding-top: 7px; border-top: 1px solid rgba(255,255,255,.16); }
.detail-tooltip .tooltip-axes b { color: #ffe09a; }
.detail-tooltip .tooltip-axes span { color: #eef1f5; }
.loading-state, .error-state { padding: 48px 22px; text-align: center; color: var(--muted); }
.error-state { color: #9b2d2d; }


footer { max-width: var(--max); margin: 0 auto; padding: 23px 22px 38px; color: var(--muted); border-top: 1px solid var(--line); font-size: .76rem; }

@media (max-width: 1100px) {
  .window-presets button { padding-inline: 5px; }
}
@media (max-width: 1020px) {
  .sample-view { grid-template-columns: minmax(0, 1.62fr) minmax(280px, 1fr); }
  .sample-view.orbits-hidden { grid-template-columns: minmax(0, 1fr); }
  .semantic-column { min-width: 0; }
  .section-heading { align-items: start; flex-direction: column; }
  .section-note { text-align: left; }
  .compact-note { margin-left: 0; }
  .window-presets { gap: 3px; }
}
@media (max-width: 760px) {
  .playback-row { grid-template-columns: auto auto 1fr; }
  .time-readout { justify-self: end; }
  .audio-scrubber { grid-column: 1 / -1; }
  .semantic-heading { align-items: center; }
  .window-control-inline { gap: 5px; }
  .sample-view { grid-template-columns: 1fr; }
  .sample-view.orbits-hidden { grid-template-columns: 1fr; }
  .orbit-column .orbit-panel { height: 360px; }
}
@media (max-width: 620px) {
  .site-header { padding: 13px 16px; }
  .brand-sub { display: none; }
  main { padding-inline: 12px; }
  .hero { padding-top: 34px; }
  .hero h1 { font-size: 2.2rem; }
  .sample-head { padding: 14px; }
  .playback-row { padding-inline: 12px; gap: 8px; }
  .audio-toggle button { padding-inline: 7px; }
  .sample-view { padding: 9px; }
  .semantic-heading { gap: 7px; }
  .window-control-inline { gap: 4px; }
  .window-label { font-size: .61rem; }
  .window-presets { justify-content: flex-start; flex-wrap: nowrap; gap: 2px; }
  .window-presets button { padding-inline: 4px; font-size: .58rem; }
  .analysis-legend { font-size: .59rem; }
  .root-key { font-size: .56rem; }
  .piano-panel { height: 132px; }
  .curve-panel { height: 104px; }
  .melody-panel { height: 124px; }
  .orbit-column .orbit-panel { height: 360px; }
}

