:root {
  color-scheme: light;
  --ink: oklch(19% 0.025 248);
  --muted: oklch(46% 0.035 236);
  --paper: oklch(96% 0.012 82);
  --surface: oklch(99% 0.006 82);
  --surface-strong: oklch(91% 0.022 79);
  --line: oklch(82% 0.027 80);
  --accent: oklch(55% 0.16 168);
  --accent-deep: oklch(35% 0.12 170);
  --warn: oklch(58% 0.15 42);
  --bad: oklch(53% 0.16 27);
  --good: oklch(48% 0.14 155);
  --shadow: 0 18px 60px oklch(25% 0.04 80 / 0.11);
  --radius: 8px;
  --ease-out: cubic-bezier(0.25, 1, 0.5, 1);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, oklch(88% 0.025 82) 1px, transparent 1px) 0 0 / 64px 64px,
    linear-gradient(0deg, oklch(88% 0.025 82) 1px, transparent 1px) 0 0 / 64px 64px,
    var(--paper);
  color: var(--ink);
}

button,
select {
  font: inherit;
}

button {
  min-height: 44px;
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  transition: transform 150ms var(--ease-out), background 150ms var(--ease-out), color 150ms var(--ease-out);
}

button:focus-visible,
select:focus-visible {
  outline: 3px solid oklch(69% 0.15 168);
  outline-offset: 3px;
}

button:active {
  transform: translateY(1px);
}

button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 32px 0;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 760;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 2.35rem;
  line-height: 1;
}

h2 {
  margin-bottom: 12px;
  font-size: 1rem;
  line-height: 1.2;
}

.status-stack {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
  color: var(--muted);
  font-weight: 720;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--bad);
  box-shadow: 0 0 0 6px oklch(53% 0.16 27 / 0.12);
}

.status-dot.is-on {
  background: var(--good);
  box-shadow: 0 0 0 6px oklch(48% 0.14 155 / 0.15);
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 360px;
  gap: 20px;
  align-items: start;
}

.live-panel,
.controls-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.live-panel {
  min-height: 690px;
  padding: clamp(20px, 4vw, 44px);
}

.test-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--line);
}

.test-hero h2 {
  margin: 0;
  font-size: 5rem;
  line-height: 0.9;
  font-variant-numeric: tabular-nums;
}

.test-hero p:last-child {
  margin: 10px 0 0;
  color: var(--muted);
  font-weight: 700;
}

.hero-actions {
  display: grid;
  justify-items: end;
  gap: 12px;
}

.score-orb {
  display: grid;
  place-items: center;
  width: 116px;
  aspect-ratio: 1;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: oklch(94% 0.045 155);
  color: var(--accent-deep);
}

.score-orb span {
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 0.95;
  font-variant-numeric: tabular-nums;
}

.score-orb small {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.assessment-card {
  display: grid;
  gap: 14px;
  padding: 18px 0 0;
}

.assessment-card h2 {
  margin-bottom: 8px;
  font-size: 1.45rem;
}

.assessment-card p {
  max-width: 68ch;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.5;
}

.test-progress {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: oklch(88% 0.02 82);
}

.test-progress div {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 180ms linear;
}

.pitch-dial {
  display: grid;
  gap: 20px;
  margin: 56px 0 28px;
}

.dial-scale {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  color: var(--muted);
  font-size: 0.8rem;
  font-variant-numeric: tabular-nums;
}

.dial-scale span:nth-child(3) {
  color: var(--ink);
  font-weight: 800;
  text-align: center;
}

.dial-scale span:nth-child(4),
.dial-scale span:nth-child(5) {
  text-align: right;
}

.meter-track {
  position: relative;
  height: 62px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    linear-gradient(90deg, oklch(54% 0.15 29 / 0.18), transparent 22%, transparent 78%, oklch(54% 0.15 29 / 0.18)),
    repeating-linear-gradient(90deg, transparent 0 9.5%, oklch(72% 0.025 82) 9.5% 10%),
    var(--surface-strong);
}

.target-zone {
  position: absolute;
  inset: 0 42%;
  background: oklch(67% 0.13 154 / 0.32);
  border-inline: 1px solid oklch(54% 0.13 154 / 0.5);
}

.needle {
  position: absolute;
  top: 8px;
  bottom: 8px;
  left: 50%;
  width: 4px;
  border-radius: 999px;
  background: var(--ink);
  transform: translateX(-50%);
  transition: left 90ms linear, background 120ms var(--ease-out);
}

.needle.is-good {
  background: var(--good);
}

.needle.is-warn {
  background: var(--warn);
}

.needle.is-bad {
  background: var(--bad);
}

.live-readout {
  display: grid;
  place-items: center;
  min-height: 250px;
  border-bottom: 1px solid var(--line);
}

.detected-note {
  font-size: clamp(6rem, 18vw, 13rem);
  line-height: 0.82;
  font-weight: 880;
  font-variant-numeric: tabular-nums;
}

.detected-meta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px 20px;
  color: var(--muted);
  font-weight: 720;
  font-variant-numeric: tabular-nums;
}

.feedback-band {
  min-height: 52px;
  display: flex;
  align-items: center;
  padding: 14px 16px;
  margin: 24px 0;
  border-radius: var(--radius);
  background: oklch(91% 0.026 82);
  color: var(--accent-deep);
  font-weight: 760;
}

.feedback-band.is-good {
  background: oklch(88% 0.07 154);
  color: oklch(31% 0.09 154);
}

.feedback-band.is-warn {
  background: oklch(90% 0.07 70);
  color: oklch(34% 0.1 52);
}

.feedback-band.is-bad {
  background: oklch(89% 0.06 29);
  color: oklch(35% 0.12 27);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.metric {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: oklch(97% 0.01 82);
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 720;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 1.6rem;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}

.hold-track {
  height: 10px;
  margin-top: 18px;
  overflow: hidden;
  border-radius: 999px;
  background: oklch(88% 0.02 82);
}

.hold-track div {
  width: 0%;
  height: 100%;
  background: var(--accent);
  transition: width 120ms linear;
}

.results-panel {
  margin-top: 26px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
}

.score-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.score-row {
  display: grid;
  gap: 10px;
  min-height: 104px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: oklch(97% 0.01 82);
}

.score-row span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.score-row strong {
  align-self: end;
  font-size: 2rem;
  font-variant-numeric: tabular-nums;
}

.recommendations {
  display: grid;
  gap: 8px;
  margin: 16px 0 0;
  padding-left: 22px;
  color: var(--ink);
  line-height: 1.45;
}

.controls-panel {
  display: grid;
  gap: 1px;
  overflow: hidden;
}

.control-section {
  padding: 20px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
}

.control-section:last-child {
  border-bottom: 0;
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading span {
  color: var(--muted);
  font-weight: 760;
  font-variant-numeric: tabular-nums;
}

.button-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.button-row.compact {
  margin-top: 12px;
}

.primary-button {
  background: var(--ink);
  color: var(--surface);
  font-weight: 820;
}

.secondary-button,
.ghost-button {
  background: oklch(91% 0.024 82);
  color: var(--ink);
  font-weight: 760;
}

.ghost-button {
  padding-inline: 18px;
}

.ghost-button.wide {
  width: 100%;
  margin-top: 12px;
}

.text-button {
  min-height: 34px;
  padding: 4px 0;
  background: transparent;
  color: var(--accent-deep);
  font-weight: 800;
}

@media (hover: hover) {
  .primary-button:hover,
  .secondary-button:hover,
  .ghost-button:hover {
    transform: translateY(-1px);
  }
}

.help-text {
  margin: 12px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.45;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: oklch(93% 0.018 82);
}

.segment {
  min-height: 38px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.segment.is-active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 2px oklch(30% 0.02 82 / 0.12);
}

label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 800;
}

select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  font-weight: 760;
}

.range-result {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
  margin-bottom: 14px;
}

.range-result span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 740;
}

.range-result strong {
  font-size: 1.5rem;
}

.range-list,
.history-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  min-height: 36px;
  margin: 0;
  padding: 0;
}

.note-pill,
.history-list li {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: oklch(96% 0.012 82);
  font-size: 0.86rem;
  font-weight: 780;
  font-variant-numeric: tabular-nums;
}

.history-list {
  list-style: none;
}

@media (max-width: 920px) {
  .workspace {
    grid-template-columns: 1fr;
  }

  .live-panel {
    min-height: auto;
  }
}

@media (max-width: 620px) {
  .app-shell {
    width: min(100% - 20px, 1180px);
    padding: 18px 0;
  }

  .topbar,
  .test-hero {
    align-items: start;
    flex-direction: column;
  }

  .hero-actions {
    justify-items: start;
  }

  .test-hero h2 {
    font-size: 4rem;
  }

  .metrics-grid,
  .button-row,
  .score-grid {
    grid-template-columns: 1fr;
  }

  .live-readout {
    min-height: 210px;
  }
}

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