:root {
  color-scheme: dark;
  --bg: #07101d;
  --panel: #0c1726;
  --panel-2: #101e30;
  --line: #25364b;
  --line-soft: #192a3e;
  --text: #f2f7fb;
  --muted: #91a3b8;
  --mint: #6de2bd;
  --mint-dark: #183f39;
  --focus: #f7d36b;
  --intro: #58c7e8;
  --verse: #668ef2;
  --chorus: #ed6f9f;
  --outro: #e6a34c;
  --inst: #9b7be6;
  --bridge: #50c795;
  --silence: #6f7e91;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 78% -15%, rgba(49, 112, 131, 0.18), transparent 34rem),
    var(--bg);
  color: var(--text);
}

a { color: inherit; }

button, select { font: inherit; }

.site-header {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--line-soft);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-weight: 750;
  letter-spacing: 0.08em;
}

.brand small {
  margin-left: 5px;
  color: var(--muted);
  font-size: 0.66rem;
  font-weight: 650;
}

.brand-mark {
  width: 26px;
  height: 24px;
  display: flex;
  align-items: flex-end;
  gap: 3px;
}

.brand-mark i {
  display: block;
  width: 6px;
  border-radius: 1px 1px 0 0;
  background: var(--mint);
}

.brand-mark i:nth-child(1) { height: 12px; }
.brand-mark i:nth-child(2) { height: 22px; }
.brand-mark i:nth-child(3) { height: 16px; }

nav { display: flex; align-items: center; gap: 20px; }

.nav-link {
  color: #c7d3df;
  font-size: 0.88rem;
  text-decoration: none;
}

.nav-link:not(.muted):hover { color: var(--mint); }
.nav-link.muted { color: #6f8297; cursor: default; }

main {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
}

.intro {
  max-width: 820px;
  padding: 70px 0 58px;
}

.eyebrow, .section-kicker, .card-kicker, .panel-label, .track-id {
  margin: 0 0 10px;
  color: var(--mint);
  font-size: 0.75rem;
  font-weight: 750;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

h1, h2, h3, h4, p { margin-top: 0; }

h1 {
  margin-bottom: 2px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(4rem, 8vw, 7.2rem);
  line-height: 0.95;
  letter-spacing: -0.055em;
}

.dek {
  max-width: 740px;
  margin: 14px 0 22px;
  color: #d8e4ed;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.35rem, 2.7vw, 2.05rem);
  line-height: 1.25;
}

.intro-copy {
  max-width: 710px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.7;
}

.demo-shell {
  margin-bottom: 86px;
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(9, 20, 33, 0.78);
  box-shadow: 0 28px 70px rgba(0, 0, 0, 0.24);
}

.demo-heading {
  padding: 28px 30px 26px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 30px;
  border-bottom: 1px solid var(--line);
}

.demo-heading h2 {
  margin-bottom: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.9rem, 3.4vw, 3rem);
  font-weight: 500;
  letter-spacing: -0.03em;
}

.selection-note {
  max-width: 560px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.55;
}

.demo-grid {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
}

.song-panel {
  padding: 22px 14px 24px;
  border-right: 1px solid var(--line);
  background: rgba(6, 14, 25, 0.6);
}

.panel-label { margin-left: 12px; color: var(--muted); }

.song-list {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
  counter-reset: songs;
}

.song-list li { counter-increment: songs; }

.song-button {
  width: 100%;
  min-height: 58px;
  padding: 9px 12px;
  display: grid;
  grid-template-columns: 27px 1fr;
  gap: 8px;
  align-items: center;
  border: 1px solid transparent;
  border-radius: 9px;
  background: transparent;
  color: #b7c6d5;
  text-align: left;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.song-button::before {
  content: counter(songs, decimal-leading-zero);
  color: #5f7288;
  font-size: 0.7rem;
  font-variant-numeric: tabular-nums;
}

.song-button:hover { background: #101e30; color: var(--text); }

.song-button[aria-current="true"] {
  border-color: #315b58;
  background: var(--mint-dark);
  color: #ecfff9;
}

.song-button[aria-current="true"]::before { color: var(--mint); }

.song-button span { display: block; }
.song-button .song-title { font-size: 0.92rem; font-weight: 680; }
.song-button .song-artist { margin-top: 3px; color: #8295a9; font-size: 0.74rem; }

.result-panel { min-width: 0; }

.track-header {
  min-height: 112px;
  padding: 23px 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 26px;
  border-bottom: 1px solid var(--line);
}

.track-id { margin-bottom: 5px; color: #73889e; font-size: 0.65rem; }

.track-header h3 {
  margin-bottom: 3px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.75rem, 3vw, 2.45rem);
  line-height: 1.08;
  font-weight: 500;
  letter-spacing: -0.025em;
}

.track-artist { margin-bottom: 0; color: var(--muted); font-size: 0.92rem; }

.metrics { display: flex; gap: 8px; }

.metric {
  min-width: 72px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #0a1524;
}

.metric span { display: block; color: var(--muted); font-size: 0.66rem; letter-spacing: 0.08em; }
.metric strong { display: block; margin-top: 3px; color: var(--text); font-size: 1.12rem; font-variant-numeric: tabular-nums; }

.media-and-structure {
  display: grid;
  grid-template-columns: minmax(280px, 0.74fr) minmax(420px, 1.26fr);
  min-height: 470px;
}

.player-card, .structure-card { padding: 24px 26px 28px; }
.player-card { border-right: 1px solid var(--line); }

.card-heading {
  min-height: 52px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
}

.card-kicker { margin-bottom: 4px; color: #71869d; font-size: 0.65rem; }

.card-heading h4 {
  margin-bottom: 0;
  font-size: 1rem;
  font-weight: 680;
}

.duration, .interaction-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.76rem;
  font-variant-numeric: tabular-nums;
}

.player-wrap {
  min-height: 164px;
  margin-top: 17px;
  padding: 28px 24px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 10px;
  background:
    linear-gradient(90deg, rgba(109, 226, 189, 0.08), transparent 55%),
    #07111e;
}

.player-wrap audio {
  width: 100%;
  min-width: 0;
  accent-color: var(--mint);
}

.source-fallback {
  margin: 12px 0 0;
  color: #71869d;
  font-size: 0.7rem;
  line-height: 1.5;
}

.source-fallback a { color: #b9cadd; text-underline-offset: 3px; }
.source-fallback a:hover { color: var(--mint); }

.structure-card { min-width: 0; }

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 7px 12px;
  margin: 18px 0 28px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #9fb0c1;
  font-size: 0.72rem;
}

.legend-swatch { width: 9px; height: 9px; border-radius: 2px; }

.ruler-wrap, .timeline-row {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  gap: 12px;
}

.time-ruler {
  position: relative;
  height: 24px;
  border-bottom: 1px solid #2d4056;
}

.tick {
  position: absolute;
  bottom: 4px;
  transform: translateX(-50%);
  color: #74889e;
  font-size: 0.64rem;
  font-variant-numeric: tabular-nums;
}

.tick::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 14px;
  width: 1px;
  height: 5px;
  background: #3d5268;
}

.tick:first-child { transform: none; }
.tick:last-child { transform: translateX(-100%); }

.timeline-row { align-items: center; margin-top: 17px; }

.row-label strong, .row-label span { display: block; }
.row-label strong { font-size: 0.8rem; }
.row-label span { margin-top: 2px; color: #71869d; font-size: 0.66rem; }

.timeline {
  position: relative;
  height: 78px;
  overflow: hidden;
  border: 1px solid #2d4056;
  border-radius: 7px;
  background-color: #07111e;
  background-image: linear-gradient(90deg, rgba(87, 112, 139, 0.14) 1px, transparent 1px);
  background-size: 25% 100%;
}

.segment {
  position: absolute;
  top: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 2px;
  padding: 0;
  overflow: hidden;
  border: 0;
  border-right: 1px solid rgba(5, 11, 18, 0.72);
  color: #07101d;
  cursor: pointer;
  transition: filter 120ms ease, transform 120ms ease;
}

.segment:hover, .segment:focus-visible { z-index: 3; filter: brightness(1.18); }
.segment:focus-visible { outline: 2px solid var(--focus); outline-offset: -3px; }

.segment-label {
  overflow: hidden;
  padding: 0 4px;
  font-size: 0.62rem;
  font-weight: 750;
  letter-spacing: 0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
  pointer-events: none;
}

.segment[data-narrow="true"] .segment-label { display: none; }

.label-intro { background: var(--intro); }
.label-verse { background: var(--verse); }
.label-chorus { background: var(--chorus); }
.label-outro { background: var(--outro); }
.label-inst { background: var(--inst); }
.label-bridge { background: var(--bridge); }
.label-silence { background: var(--silence); color: #f5f8fb; }

.playhead {
  position: absolute;
  z-index: 6;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #fff3b3;
  box-shadow: 0 0 0 1px rgba(4, 10, 16, 0.35), 0 0 9px rgba(255, 236, 157, 0.78);
  pointer-events: none;
}

.timeline-footer {
  margin: 18px 0 0 98px;
  padding-top: 13px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line-soft);
  color: #71869d;
  font-size: 0.69rem;
  font-variant-numeric: tabular-nums;
}

.playhead-key {
  display: inline-block;
  width: 2px;
  height: 10px;
  margin-right: 7px;
  vertical-align: -1px;
  background: #fff3b3;
}

footer {
  width: min(1320px, calc(100% - 48px));
  margin: 0 auto;
  padding: 25px 0 34px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid var(--line-soft);
  color: #687d92;
  font-size: 0.76rem;
}

footer p { margin: 0; }

.mobile-picker { display: none; }

.tooltip {
  position: fixed;
  z-index: 20;
  max-width: 240px;
  padding: 9px 11px;
  border: 1px solid #3b5066;
  border-radius: 6px;
  background: #0b1725;
  box-shadow: 0 10px 26px rgba(0,0,0,.34);
  color: #eaf2f8;
  font-size: 0.72rem;
  line-height: 1.4;
  pointer-events: none;
}

@media (max-width: 1040px) {
  .media-and-structure { grid-template-columns: 1fr; }
  .player-card { border-right: 0; border-bottom: 1px solid var(--line); }
  .player-wrap { max-width: 620px; }
}

@media (max-width: 760px) {
  .site-header, main, footer { width: min(100% - 28px, 1320px); }
  .site-header { min-height: 66px; }
  nav { gap: 12px; }
  .nav-link { font-size: 0.78rem; }
  .intro { padding: 50px 0 42px; }
  .intro-copy { font-size: 0.95rem; }
  .demo-heading { display: block; padding: 23px 20px; }
  .selection-note { margin-top: 16px; }
  .mobile-picker { display: grid; gap: 7px; padding: 16px 20px; border-bottom: 1px solid var(--line); }
  .mobile-picker label { color: var(--muted); font-size: 0.75rem; }
  .mobile-picker select { width: 100%; min-height: 44px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 7px; background: var(--panel); color: var(--text); }
  .demo-grid { display: block; }
  .song-panel { display: none; }
  .track-header { align-items: flex-start; padding: 20px; }
  .metrics { gap: 5px; }
  .metric { min-width: 60px; padding: 8px; }
  .metric strong { font-size: 0.96rem; }
  .player-card, .structure-card { padding: 21px 18px 24px; }
  .structure-heading { display: block; }
  .interaction-hint { margin-top: 6px; }
  .ruler-wrap, .timeline-row { grid-template-columns: 70px minmax(0, 1fr); gap: 9px; }
  .timeline-footer { margin-left: 79px; }
  .timeline { height: 68px; }
}

@media (max-width: 520px) {
  h1 { font-size: 4rem; }
  .nav-link.muted { display: none; }
  .track-header { display: block; }
  .metrics { margin-top: 18px; }
  .metric { flex: 1; }
  .ruler-wrap, .timeline-row { display: block; }
  .row-spacer { display: none; }
  .row-label { display: flex; align-items: baseline; gap: 6px; margin-bottom: 7px; }
  .timeline-row { margin-top: 15px; }
  .timeline-footer { margin-left: 0; }
  .legend { margin-bottom: 20px; }
  footer { display: block; }
  footer p + p { margin-top: 5px; }
}

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