:root {
  --ink: #625477;
  --muted: #8a8095;
  --panel: rgba(255, 250, 255, 0.86);
  --panel-strong: #fffafd;
  --pink: #eba4cc;
  --pink-strong: #ae5b91;
  --blue: #a8c7e9;
  --yellow: #f4e59c;
  --green: #cae6d6;
  --lavender: #ded8ef;
  --shadow: 0 22px 52px rgba(145, 106, 144, 0.17);
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 8% 0%, rgba(245, 185, 211, 0.34), transparent 34rem),
    radial-gradient(circle at 100% 16%, rgba(179, 193, 237, 0.26), transparent 40rem),
    linear-gradient(135deg, #f9e5ef 0%, #f4edf8 45%, #eef0fb 100%);
  color: var(--ink);
}

button,
input {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

.shell {
  width: min(1380px, calc(100% - 40px));
  margin: 0 auto;
  padding: 28px 0 48px;
}

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

.eyebrow {
  margin: 0 0 2px;
  color: var(--pink-strong);
  font-weight: 800;
  letter-spacing: 0;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: clamp(2rem, 4vw, 4.25rem);
  line-height: 0.98;
  max-width: 760px;
  letter-spacing: 0;
}

.capture-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

.capture-panel button,
.file-button,
.progress-actions button {
  min-height: 46px;
  padding: 0 18px;
  border-radius: 8px;
  background: var(--panel-strong);
  color: var(--ink);
  font-weight: 850;
  box-shadow: var(--shadow);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 160ms ease, background 160ms ease;
}

.capture-panel button:hover,
.file-button:hover,
.progress-actions button:hover {
  transform: translateY(-1px);
  background: white;
}

.capture-panel button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
  transform: none;
}

.file-button input {
  position: absolute;
  inline-size: 1px;
  block-size: 1px;
  opacity: 0;
  pointer-events: none;
}

#recordButton {
  background: #f4c4df;
  color: #704461;
}

#stopButton {
  background: #f2e5ad;
}

#analyzeButton {
  background: #b7d2ef;
}

.status-strip,
.score-row,
.register-grid {
  display: grid;
  gap: 18px;
}

.status-strip {
  grid-template-columns: minmax(0, 1fr) minmax(260px, 390px);
  align-items: center;
  margin-bottom: 24px;
  padding: 18px 22px;
  border-radius: 8px;
  background: rgba(255, 250, 255, 0.62);
  box-shadow: var(--shadow);
}

.status-strip span,
.status-strip strong {
  display: block;
}

.status-strip span,
.metric-title,
.mini-card span,
.score-card span,
.coaching-card span {
  color: var(--muted);
  font-weight: 680;
}

audio {
  width: 100%;
}

.score-row {
  grid-template-columns: minmax(260px, 380px) minmax(0, 1fr);
  margin-bottom: 34px;
}

.score-card,
.coaching-card,
.metric-card,
.wide-panel,
.chart-panel,
.mini-card {
  background: var(--panel);
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.score-card,
.coaching-card {
  min-height: 150px;
  padding: 24px;
}

.score-card strong {
  display: block;
  margin: 10px 0;
  color: var(--pink-strong);
  font-size: 4.7rem;
  line-height: 0.9;
}

.score-card p,
.coaching-card li,
.panel-copy,
.mini-card p,
.section-title p {
  color: var(--muted);
  font-weight: 620;
  line-height: 1.45;
}

.coaching-card ol {
  margin: 12px 0 0;
  padding-left: 24px;
  display: grid;
  gap: 8px;
}

.section-title {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 34px 0 18px;
}

.section-title h2 {
  font-size: clamp(1.45rem, 2.4vw, 2rem);
  line-height: 1;
}

.mark {
  color: var(--pink);
  font-weight: 900;
  font-size: 1.35rem;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 20px;
}

.metric-card {
  min-height: 230px;
  padding: 24px;
}

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

.pill {
  flex: 0 0 auto;
  padding: 7px 12px;
  border-radius: 999px;
  background: #f5dfeb;
  color: #5e496c;
  font-size: 0.9rem;
  font-weight: 900;
}

.metric-value {
  margin-top: 18px;
  color: var(--pink-strong);
  font-size: 3.2rem;
  font-weight: 900;
  line-height: 0.92;
}

.metric-value small {
  color: var(--ink);
  font-size: 1.1rem;
}

.meter {
  position: relative;
  height: 16px;
  margin: 26px 0 10px;
  border-radius: 999px;
  overflow: hidden;
  background: linear-gradient(90deg, var(--blue) 0 30%, var(--yellow) 30% 43%, var(--pink) 43% 100%);
}

.meter-marker {
  position: absolute;
  top: -3px;
  width: 5px;
  height: 22px;
  border-radius: 6px;
  background: #4d435e;
  box-shadow: 0 0 0 3px rgba(255,255,255,0.92);
}

.scale {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-weight: 660;
}

.metric-hint {
  margin-top: 8px;
  color: var(--muted);
  font-weight: 650;
  line-height: 1.45;
}

.wide-panel {
  padding: 26px;
}

.resonance-bars {
  display: grid;
  gap: 22px;
  margin-top: 24px;
}

.resonance-row {
  display: grid;
  gap: 10px;
}

.resonance-top {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  font-weight: 850;
}

.resonance-value {
  color: var(--pink-strong);
  white-space: nowrap;
}

.long-meter {
  height: 15px;
  border-radius: 999px;
  position: relative;
  background: linear-gradient(90deg, var(--blue) 0 38%, var(--yellow) 38% 56%, var(--pink) 56% 100%);
}

.resonance-foot {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: var(--muted);
  font-size: 0.94rem;
  font-weight: 650;
}

.chart-panel {
  padding: 18px 18px 12px;
  margin-bottom: 20px;
}

#pitchChart,
#progressChart {
  display: block;
  width: 100%;
  height: 360px;
}

#progressChart {
  height: 240px;
}

.axis-label {
  fill: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.register-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  margin-bottom: 20px;
}

.mini-card {
  padding: 24px;
  min-height: 165px;
}

.mini-card strong {
  display: block;
  margin: 12px 0;
  color: var(--pink-strong);
  font-size: 3.1rem;
  line-height: 0.95;
}

.drop-bars {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 28px;
  align-items: end;
  min-height: 210px;
  padding: 18px 0 0;
}

.drop-item {
  display: grid;
  justify-items: center;
  gap: 10px;
  color: var(--muted);
  font-weight: 720;
}

.drop-track {
  position: relative;
  width: 64px;
  height: 150px;
  border-radius: 8px;
  background: #eeeafb;
  overflow: hidden;
}

.drop-fill {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--blue);
  border-radius: 8px;
}

.drop-value {
  color: #6f83aa;
  font-size: 1.35rem;
  font-weight: 900;
}

.progress-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.empty-state {
  min-height: 120px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 750;
  text-align: center;
}

@media (max-width: 1050px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }
}

@media (max-width: 760px) {
  .shell {
    width: min(100% - 24px, 680px);
    padding-top: 18px;
  }

  .topbar,
  .section-title {
    align-items: flex-start;
    flex-direction: column;
  }

  .capture-panel {
    width: 100%;
    justify-content: stretch;
  }

  .capture-panel button,
  .file-button {
    flex: 1 1 44%;
  }

  .status-strip,
  .score-row,
  .register-grid,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .metric-card {
    min-height: 210px;
  }

  .score-card strong,
  .metric-value,
  .mini-card strong {
    font-size: 2.8rem;
  }

  #pitchChart {
    height: 300px;
  }

  .drop-bars {
    gap: 12px;
  }
}
