@import url('https://fonts.googleapis.com/css2?family=Libre+Baskerville:ital,wght@0,400;0,700;1,400&family=Inter:wght@400;500;600;700&display=swap');

* { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f172a;
  --bg-card: #1e293b;
  --bg-surface: #334155;
  --text: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --green: #10B981;
  --amber: #F59E0B;
  --red: #EF4444;
  --blue: #3B82F6;
  --purple: #8B5CF6;
}

html, body {
  height: 100%;
  font-family: 'Inter', -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
body.scrollable { overflow-y: auto; }

.hidden { display: none !important; }

/* ================================================================
   APP HEADER & NAVIGATION
   ================================================================ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  padding: 0 24px;
  height: 48px;
  background: var(--bg-card);
  border-bottom: 1px solid rgba(51,65,85,0.6);
}

.app-logo {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  white-space: nowrap;
  margin-right: 16px;
}

.app-nav {
  display: flex;
  gap: 4px;
  flex: 1;
  justify-content: center;
}
.app-nav button {
  padding: 12px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-dim);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}
.app-nav button:hover { color: var(--text-muted); }
.app-nav button.active {
  color: var(--green);
  border-bottom-color: var(--green);
}

.app-header-right {
  margin-left: 16px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.auth-links {
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-auth-link {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
  padding: 4px 10px;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}
.header-auth-link:hover {
  color: var(--text);
  background: var(--bg-surface);
}
.header-auth-register {
  color: var(--bg);
  background: var(--green);
  font-weight: 600;
}
.header-auth-register:hover {
  background: #4ade80;
  color: var(--bg);
}

.app-page { display: none; }
.app-page.active { display: block; }
#page-record.active { display: flex; }

/* Record page fills viewport; other pages scroll */
#page-record { overflow: hidden; }
#page-progress, #page-compare, #page-account { overflow-y: auto; max-height: calc(100vh - 48px); }

.page-content {
  max-width: 840px;
  margin: 0 auto;
  padding: 32px 24px;
}

@media (max-width: 700px) {
  .app-logo { display: none; }
  .app-header-right { display: none; }
  .app-nav button { padding: 10px 10px; font-size: 12px; }
}

/* ================================================================
   WELCOME SCREEN
   ================================================================ */
#welcome {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  text-align: center;
  padding: 24px;
  background: radial-gradient(ellipse at 50% 30%, rgba(16,185,129,0.06) 0%, transparent 60%),
              var(--bg);
}

.welcome-auth {
  position: absolute;
  top: 16px;
  right: 20px;
  display: flex;
  align-items: center;
  gap: 4px;
}

.header-auth-greeting {
  color: var(--text-muted);
  font-size: 13px;
  margin-right: 4px;
}

.welcome-badge {
  display: inline-block;
  background: rgba(16,185,129,0.1);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 20px;
  padding: 5px 16px;
  font-size: 12px;
  font-weight: 600;
  color: var(--green);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 24px;
}

#welcome h1 {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: clamp(26px, 4.5vw, 42px);
  line-height: 1.3;
  margin-bottom: 16px;
  color: #f1f5f9;
}

#welcome .subtitle {
  font-size: 16px;
  color: var(--text-muted);
  max-width: 440px;
  margin-bottom: 36px;
  line-height: 1.7;
}

#start-btn {
  background: var(--green);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 16px 36px;
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  letter-spacing: 0.3px;
}

#start-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 24px rgba(16, 185, 129, 0.35);
}

#start-btn:active { transform: translateY(0); }

#start-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.hint {
  margin-top: 12px;
  font-size: 12px;
  color: var(--text-dim);
}

.hint kbd {
  background: var(--bg-surface);
  border: 1px solid #475569;
  border-radius: 4px;
  padding: 1px 6px;
  font-family: inherit;
  font-size: 11px;
}

.steps {
  display: flex;
  gap: 40px;
  margin-top: 56px;
  color: var(--text-dim);
  font-size: 13px;
}

.steps .step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.steps .step-icon {
  font-size: 24px;
  margin-bottom: 4px;
}

.steps .step strong {
  color: var(--text-muted);
  font-size: 14px;
}

.steps .step span:last-child {
  font-size: 12px;
}

/* ================================================================
   CALIBRATION SCREEN
   ================================================================ */
#calibration {
  height: 100vh;
  height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 40%, rgba(16,185,129,0.04) 0%, transparent 60%), var(--bg);
}

.cal-screen {
  text-align: center;
  max-width: 480px;
  padding: 32px 24px;
}

.cal-header h2 {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 24px;
  color: var(--text);
  margin-bottom: 8px;
}

.cal-header p {
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 12px;
}

/* Instruction text — e.g. "Play your A string" */
.cal-instruction {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  min-height: 28px;
  margin-bottom: 28px;
  transition: opacity 0.3s;
}

/* Central visual: large circle + progress ring */
.cal-visual {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 20px;
  width: 120px;
  height: 120px;
}

.cal-circle-large {
  width: 108px;
  height: 108px;
  border-radius: 50%;
  border: 3px solid #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  background: var(--bg-card);
  transition: border-color 0.4s, background 0.4s, box-shadow 0.4s;
  position: relative;
  z-index: 1;
}

.cal-circle-large.listening {
  border-color: #3B82F6;
  background: rgba(59,130,246,0.06);
  box-shadow: 0 0 24px rgba(59,130,246,0.15);
}

.cal-circle-large.detected {
  border-color: var(--green);
  background: rgba(16,185,129,0.08);
  box-shadow: 0 0 24px rgba(16,185,129,0.2);
}

.cal-circle-note {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 36px;
  font-weight: 700;
  color: var(--text-dim);
  transition: color 0.3s;
  line-height: 1;
}
.cal-circle-large.listening .cal-circle-note { color: #60A5FA; }
.cal-circle-large.detected .cal-circle-note { color: var(--green); }

.cal-circle-check {
  font-size: 40px;
  color: var(--green);
  line-height: 1;
}

/* Progress ring around the circle */
.cal-progress-ring {
  position: absolute;
  top: 0; left: 0;
  width: 120px;
  height: 120px;
  border-radius: 50%;
  --cal-progress: 0;
  background: conic-gradient(
    rgba(59,130,246,0.35) calc(var(--cal-progress) * 360deg),
    transparent calc(var(--cal-progress) * 360deg)
  );
  -webkit-mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 4px));
  mask: radial-gradient(farthest-side, transparent calc(100% - 4px), #000 calc(100% - 4px));
  z-index: 0;
  transition: --cal-progress 0.1s linear;
}

/* Feedback text below the circle */
.cal-feedback {
  font-size: 14px;
  min-height: 20px;
  margin-bottom: 6px;
  transition: color 0.3s;
}
.cal-feedback.waiting { color: var(--text-dim); }
.cal-feedback.listening { color: #60A5FA; }
.cal-feedback.success { color: var(--green); font-weight: 600; }

/* Hz readout */
.cal-freq-display {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-height: 18px;
  margin-bottom: 28px;
}

/* Skip button */
.cal-skip {
  background: none;
  border: 1px solid #475569;
  border-radius: 8px;
  color: var(--text-dim);
  font-size: 13px;
  padding: 8px 20px;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s;
}
.cal-skip:hover {
  background: rgba(255,255,255,0.04);
  color: var(--text-muted);
}

/* ================================================================
   PRACTICE SCREEN
   ================================================================ */
#page-record {
  display: flex;
  height: calc(100vh - 48px);
  height: calc(100dvh - 48px);
  position: relative;
}

/* Record state containers */
.record-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  opacity: 1;
  transition: opacity 0.25s ease;
}
.record-state.state-entering { opacity: 0; }

/* Studio — unified idle/ready state */
.record-studio {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 32px;
}
.studio-status {
  color: var(--text-muted);
  font-size: 16px;
  font-weight: 500;
  min-height: 24px;
}
.studio-status.listening {
  color: var(--green);
}
.studio-rec-btn {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  border: 4px solid #475569;
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, transform 0.15s;
  position: relative;
}
.studio-rec-btn:hover {
  border-color: #94a3b8;
  transform: scale(1.05);
}
.studio-rec-btn:active { transform: scale(0.97); }
.studio-rec-btn:disabled {
  opacity: 0.5;
  cursor: default;
  transform: none;
}
.studio-rec-dot {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: #EF4444;
  transition: border-radius 0.2s, width 0.2s, height 0.2s;
}
.studio-rec-btn.listening {
  border-color: var(--green);
  animation: pulse-ring 2s ease-in-out infinite;
}
.studio-rec-btn.listening .studio-rec-dot {
  background: var(--green);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-ring {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16,185,129,0.3); }
  50% { box-shadow: 0 0 0 12px rgba(16,185,129,0); }
}
@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}
.studio-hint {
  color: var(--text-dim);
  font-size: 12px;
}

/* CALIBRATING state */
#record-calibrating {
  padding: 24px;
}

/* RECORDING state — override .record-state centering */
#record-live {
  justify-content: flex-start;
  align-items: stretch;
  height: 100%;
}
#record-live #live-panel {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;
  overflow: hidden;
}

/* Legacy practice header — hidden, transport bar replaces it */
.practice-header {
  display: none;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.rec-indicator {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--red);
  letter-spacing: 0.5px;
  text-transform: uppercase;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

.session-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--red);
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.live-hz {
  font-size: 16px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
  min-width: 100px;
  text-align: center;
  transition: color 0.15s;
}

.timer {
  font-variant-numeric: tabular-nums;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 40px;
}

.tuning-badge {
  font-size: 11px;
  color: var(--text-dim);
  background: rgba(255,255,255,0.04);
  border-radius: 4px;
  padding: 2px 7px;
  font-variant-numeric: tabular-nums;
}

#record-live #live-panel > * {
  width: 100%;
}

.spectrogram-area {
  flex: 0 0 60px;
  position: relative;
  background: rgba(15,23,42,0.8);
  border: 1px solid rgba(51,65,85,0.4);
  border-radius: 6px;
  margin: 8px 16px 0;
  overflow: hidden;
}
#spectrogram-canvas {
  width: 100%;
  height: 100%;
  display: block;
  position: relative;
  z-index: 1;
}

.gauge-area {
  flex: 0 0 180px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  background: var(--bg-card);
  border: 1px solid rgba(51,65,85,0.4);
  border-radius: 8px;
  margin: 8px 16px;
  overflow: hidden;
}
#gauge-canvas {
  width: 100%;
  height: 100%;
  max-width: 600px;
  margin: 0 auto;
  display: block;
  position: relative;
  z-index: 1;
}

.area-placeholder {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-dim);
  font-size: 13px;
  pointer-events: none;
  z-index: 0;
}
.area-placeholder.hidden { display: none; }

.hz-display {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 8px 20px;
}
.hz-note {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text);
  min-width: 60px;
  text-align: right;
}
.hz-value {
  font-size: 18px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
  min-width: 100px;
}
.hz-cents {
  font-size: 18px;
  font-weight: 600;
  min-width: 70px;
  font-variant-numeric: tabular-nums;
}

.live-score-area {
  flex: 1 1 auto;
  min-height: 140px;
  max-height: 300px;
  padding: 4px 16px 10px;
  overflow-y: auto;
  margin: 0 16px 8px;
  border: 1px solid rgba(51,65,85,0.4);
  border-radius: 8px;
  background: rgba(15,23,42,0.6);
}

/* Transport bar — fixed at bottom like a DAW */
.transport-bar {
  flex: 0 0 auto;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: var(--bg-card);
  border-top: 1px solid rgba(51,65,85,0.6);
}
.transport-left, .transport-right {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
}
.transport-right {
  justify-content: flex-end;
}
.transport-center {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.transport-rec-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.15);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, border-color 0.2s;
}
.transport-rec-btn:hover {
  transform: scale(1.08);
  border-color: rgba(255,255,255,0.3);
}
.transport-rec-btn:active { transform: scale(0.95); }
.transport-rec-btn:disabled { opacity: 0.4; cursor: default; transform: none; }
.transport-rec-btn.hidden { display: none; }
.transport-rec-dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #EF4444;
  box-shadow: 0 0 16px rgba(239,68,68,0.4);
}

.transport-stop-btn {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.15);
  background: transparent;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.15s, border-color 0.2s;
}
.transport-stop-btn:hover {
  transform: scale(1.08);
  border-color: rgba(255,255,255,0.3);
}
.transport-stop-btn:active { transform: scale(0.95); }
.transport-stop-btn.hidden { display: none; }
.transport-stop-square {
  width: 22px;
  height: 22px;
  border-radius: 4px;
  background: var(--text);
}

.transport-notes {
  font-size: 13px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}
.transport-status {
  font-size: 11px;
  font-weight: 600;
  color: var(--red);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.transport-status.recording {
  animation: pulse-dot 1.5s ease-in-out infinite;
}

/* Heatmap in summary */
.heatmap-container {
  width: 100%;
  height: 240px;
  border-radius: 8px;
  overflow: hidden;
}
.heatmap-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.done-btn {
  background: var(--bg-surface);
  color: var(--text-muted);
  border: 1px solid #475569;
  border-radius: 8px;
  padding: 5px 16px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}
.done-btn:hover {
  background: #475569;
  color: var(--text);
}

/* ================================================================
   SUMMARY PANEL
   ================================================================ */
#summary-panel {
  flex: 1;
  overflow-y: auto;
  background: var(--bg);
  padding: 0;
}


.summary-content {
  max-width: 600px;
  margin: 0 auto;
  padding: 32px 24px 48px;
}

.summary-header {
  text-align: center;
  margin-bottom: 28px;
}
.summary-header h3 {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 24px;
  color: var(--text);
  margin-bottom: 8px;
}
.summary-topline {
  font-size: 16px;
  color: var(--text-muted);
}
.summary-pct {
  font-size: 32px;
  font-weight: 700;
}

.summary-feedback {
  background: rgba(16,185,129,0.06);
  border: 1px solid rgba(16,185,129,0.15);
  border-radius: 10px;
  padding: 16px 20px;
  margin-bottom: 24px;
}
.summary-feedback p {
  font-size: 14px;
  color: #cbd5e1;
  line-height: 1.6;
  margin: 0 0 8px;
}
.summary-feedback p:last-child { margin-bottom: 0; }

.summary-section {
  margin-bottom: 24px;
  overflow: visible;
  position: relative;
}
.summary-section h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(51,65,85,0.4);
}

/* Problem notes */
.problem-notes {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.problem-note {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-card);
  border-radius: 8px;
}
.pn-name {
  font-weight: 700;
  font-size: 16px;
  min-width: 40px;
}
.pn-cents {
  font-weight: 700;
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}
.pn-detail {
  font-size: 12px;
  color: var(--text-dim);
}

/* Octave breakdown */
.octave-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(51,65,85,0.2);
}
.octave-pc {
  font-weight: 700;
  font-size: 15px;
  min-width: 24px;
  color: var(--text);
}
.octave-cell {
  font-size: 13px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Register summary */
.register-summary {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.reg-summary-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 12px;
  background: var(--bg-card);
  border-radius: 6px;
  font-size: 14px;
  color: var(--text-muted);
}
.reg-summary-item span:first-child {
  flex: 1;
}
.reg-count {
  font-size: 12px;
  color: var(--text-dim);
}

/* Play again */
.play-again-btn {
  display: block;
  width: 100%;
  margin-top: 32px;
  padding: 14px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
}
.play-again-btn:hover { opacity: 0.9; }

.summary-actions {
  display: flex;
  gap: 10px;
  margin-top: 32px;
}
.summary-actions .play-again-btn {
  margin-top: 0;
  flex: 1;
}

.continue-btn {
  flex: 1;
  padding: 14px;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid #475569;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
}
.continue-btn:hover {
  background: rgba(255,255,255,0.04);
}

/* Audio player */
.player-container {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-radius: 10px;
  border: 1px solid rgba(51,65,85,0.4);
}

.player-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--green);
  color: white;
  font-size: 16px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: opacity 0.15s;
}
.player-btn:hover { opacity: 0.85; }

.player-icon {
  font-size: 14px;
  margin-left: 2px;
}

.player-progress-wrap {
  flex: 1;
  min-width: 0;
}

.player-progress {
  position: relative;
  height: 6px;
  background: #1e293b;
  border-radius: 3px;
  cursor: pointer;
  margin-bottom: 6px;
}

.player-progress-fill {
  height: 100%;
  background: var(--green);
  border-radius: 3px;
  width: 0%;
  transition: width 0.1s linear;
}

.player-cursor {
  position: absolute;
  top: -4px;
  left: 0%;
  width: 14px;
  height: 14px;
  background: white;
  border: 2px solid var(--green);
  border-radius: 50%;
  transform: translateX(-50%);
  transition: left 0.1s linear;
  box-shadow: 0 1px 4px rgba(0,0,0,0.3);
}

.player-time {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.player-notes {
  text-align: center;
  margin-top: 8px;
  min-height: 24px;
}

.player-current-note {
  font-size: 18px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.player-current-note strong {
  font-size: 22px;
  font-family: 'Libre Baskerville', Georgia, serif;
  margin-right: 6px;
}

.no-audio {
  font-size: 13px;
  color: var(--text-dim);
  font-style: italic;
  padding: 8px 0;
}

/* Progression overview */
.progress-cards {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.progress-card {
  background: var(--bg-card);
  border: 1px solid rgba(51,65,85,0.4);
  border-radius: 10px;
  padding: 14px;
  text-align: center;
}

.pc-value {
  font-size: 28px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}

.pc-label {
  font-size: 11px;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-top: 2px;
}

.pc-trend {
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
}

/* Progression chart */
.progression-chart-container {
  width: 100%;
  height: 320px;
  border-radius: 8px;
  overflow: visible;
  margin-top: 8px;
  position: relative;
}
/* Chart tooltip */
.chart-tooltip {
  position: absolute;
  background: #1e293b;
  border: 1px solid rgba(51,65,85,0.8);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 14px;
  pointer-events: none;
  z-index: 10;
  min-width: 200px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}
.ct-date {
  font-size: 13px;
  color: #94a3b8;
  margin-bottom: 8px;
  font-weight: 600;
}
.ct-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 3px 0;
}
.ct-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.ct-label {
  flex: 1;
  color: #cbd5e1;
  font-size: 14px;
}
.ct-val {
  font-weight: 600;
  color: #f8fafc;
  font-variant-numeric: tabular-nums;
  font-size: 14px;
}
.ct-sub {
  font-size: 13px;
  color: #94a3b8;
  padding-left: 18px;
  line-height: 1.5;
}

.ct-table {
  width: 100%;
  border-collapse: collapse;
  margin: 4px 0 2px 18px;
  font-size: 13px;
}
.ct-table th {
  font-size: 10px;
  color: #64748b;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  text-align: left;
  padding: 0 8px 4px 0;
}
.ct-table td {
  padding: 2px 8px 2px 0;
  font-variant-numeric: tabular-nums;
}
.ct-table td:first-child {
  font-weight: 600;
}
.ct-table .ct-target {
  color: #94a3b8;
}
.ct-table .ct-diff {
  font-size: 11px;
  color: #64748b;
}

/* Music score */
.score-container {
  margin-top: 0;
  overflow: visible;
  max-height: 0;
  opacity: 0;
  transition: max-height 0.4s ease, opacity 0.3s ease, margin 0.3s ease;
}
.score-container.open {
  max-height: 3000px;
  opacity: 1;
  margin-top: 12px;
  overflow: visible;
}
.score-header h4 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-muted);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.score-close {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
}
.score-close:hover { color: var(--text); }
.score-scroll {
  overflow-x: auto;
  overflow-y: visible;
  border: 1px solid rgba(51,65,85,0.4);
  border-radius: 8px;
  background: #0f172a;
  padding: 8px 0;
  position: relative;
}
.score-scroll svg {
  min-width: 100%;
  overflow: visible;
}

/* Score HTML tooltip (floats above SVG) */
.score-html-tooltip {
  display: none;
  position: absolute;
  z-index: 100;
  border-radius: 10px;
  padding: 14px 16px;
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  pointer-events: none;
  min-width: 200px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5);
  color: #fff;
}
.sht-main {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
}
.sht-row {
  display: flex;
  gap: 8px;
  align-items: center;
  padding: 2px 0;
}
.sht-label {
  color: rgba(255,255,255,0.6);
  min-width: 50px;
}
.sht-val {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.sht-divider {
  height: 1px;
  background: rgba(255,255,255,0.12);
  margin: 8px 0;
}
.sht-section {
  font-size: 10px;
  color: rgba(255,255,255,0.45);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 6px;
}
.sht-note {
  font-weight: 600;
  min-width: 30px;
}
.sht-target {
  color: rgba(255,255,255,0.4);
  font-size: 12px;
  min-width: 70px;
}

.progression-chart-container canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.chart-subtitle {
  font-size: 12px;
  color: var(--text-dim);
  margin-bottom: 4px;
  line-height: 1.4;
}

/* Compare picker cards */
.compare-hint {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 10px;
}

.compare-cards {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 280px;
  overflow-y: auto;
  margin-bottom: 12px;
  padding-right: 4px;
}

.session-card-selectable {
  padding: 10px 14px;
  background: var(--bg-card);
  border: 1.5px solid rgba(51,65,85,0.4);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  position: relative;
}

.session-card-selectable:hover {
  border-color: #64748b;
}

.session-card-selectable.selected {
  border-color: var(--green);
  background: rgba(16,185,129,0.06);
}

.session-card-selectable .sc-check {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 18px;
  height: 18px;
  border: 2px solid #475569;
  border-radius: 50%;
}

.session-card-selectable.selected .sc-check {
  border-color: var(--green);
  background: var(--green);
}

.session-card-selectable.selected .sc-check::after {
  content: '✓';
  color: white;
  font-size: 11px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.compare-go-btn {
  width: 100%;
  padding: 10px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.15s;
  font-family: inherit;
}

.compare-go-btn:hover { opacity: 0.9; }
.compare-go-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.session-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.session-card {
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid rgba(51,65,85,0.4);
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s;
}
.session-card:hover {
  border-color: var(--green);
}

.sc-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.sc-label {
  font-weight: 600;
  font-size: 14px;
}
.sc-date {
  font-size: 12px;
  color: var(--text-dim);
}
.sc-stats {
  font-size: 13px;
  color: var(--text-muted);
}
.sc-pct {
  font-weight: 700;
  font-size: 15px;
}

.session-date {
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}

/* Comparison */
.comparison-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.comp-row {
  display: grid;
  grid-template-columns: 80px 1fr 1fr 100px;
  gap: 8px;
  padding: 6px 10px;
  background: rgba(255,255,255,0.02);
  border-radius: 4px;
  font-size: 13px;
  align-items: center;
}
.comp-row.comp-header {
  background: transparent;
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.comp-label { color: var(--text); }
.comp-val { color: var(--text-muted); font-variant-numeric: tabular-nums; }
.comp-change {
  text-align: right;
  font-weight: 600;
  font-size: 12px;
}
.comp-change.improved { color: var(--green); }
.comp-change.worsened { color: var(--red); }
.comp-change.same { color: var(--text-dim); }

/* Practice header right */
.header-right-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Auth modal overlay */
.auth-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.auth-modal {
  background: var(--bg-card);
  border: 1px solid rgba(51,65,85,0.6);
  border-radius: 16px;
  padding: 32px;
  max-width: 400px;
  width: 100%;
  position: relative;
}

.auth-close {
  position: absolute;
  top: 12px;
  right: 16px;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
}
.auth-close:hover { color: var(--text); }

.auth-modal h3 {
  font-family: 'Libre Baskerville', Georgia, serif;
  font-size: 20px;
  margin-bottom: 6px;
  text-align: center;
}

.auth-subtitle {
  font-size: 13px;
  color: var(--text-dim);
  text-align: center;
  margin-bottom: 20px;
}

/* Social provider buttons */
.auth-providers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}

.auth-provider-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 10px 16px;
  border: 1px solid #475569;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
  font-family: inherit;
}
.auth-provider-btn:hover {
  background: rgba(255,255,255,0.04);
  border-color: #64748b;
}
.auth-provider-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-provider-icon {
  width: 20px;
  text-align: center;
  font-weight: 700;
  font-size: 15px;
}

.auth-provider-btn.google .auth-provider-icon { color: #4285f4; }
.auth-provider-btn.facebook .auth-provider-icon { color: #1877f2; }
.auth-provider-btn.reddit .auth-provider-icon { color: #ff4500; }
.auth-provider-btn.apple .auth-provider-icon { color: #a2aaad; }

/* Divider */
.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  color: var(--text-dim);
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: #334155;
}

/* Email form */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-form input {
  padding: 10px 12px;
  background: var(--bg);
  border: 1px solid #475569;
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}
.auth-form input:focus {
  outline: none;
  border-color: var(--green);
}
.auth-form input::placeholder { color: var(--text-dim); }

.auth-submit {
  padding: 10px;
  background: var(--green);
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  margin-top: 4px;
}
.auth-submit:hover { opacity: 0.9; }
.auth-submit:disabled { opacity: 0.5; cursor: not-allowed; }

.auth-toggle {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 12px;
}
.auth-toggle a {
  color: var(--green);
  text-decoration: none;
  font-weight: 500;
}
.auth-toggle a:hover { text-decoration: underline; }

.confirm-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  background: var(--green);
  color: var(--bg);
  padding: 12px 24px;
  text-align: center;
  font-weight: 600;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  animation: slideDown 0.3s ease;
}
.confirm-banner-close {
  background: none;
  border: none;
  color: var(--bg);
  font-size: 20px;
  cursor: pointer;
  padding: 0 4px;
  opacity: 0.7;
}
.confirm-banner-close:hover { opacity: 1; }
@keyframes slideDown { from { transform: translateY(-100%); } to { transform: translateY(0); } }

.auth-standalone {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: radial-gradient(ellipse at 50% 30%, rgba(16,185,129,0.06) 0%, transparent 60%), var(--bg);
  padding: 24px;
}
.auth-page-content {
  width: 100%;
  max-width: 420px;
}
.auth-page-content h2 {
  color: var(--text);
  font-size: 24px;
  margin-bottom: 8px;
}
.auth-back-link {
  display: inline-block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  margin-bottom: 24px;
}
.auth-back-link:hover { color: var(--text); }

.auth-success {
  text-align: center;
  padding: 20px 0;
}
.auth-success-icon {
  font-size: 48px;
  color: var(--green);
  margin-bottom: 12px;
  line-height: 1;
}
.auth-success h3 {
  color: var(--text);
  margin-bottom: 10px;
}
.auth-success p {
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.6;
  margin-bottom: 8px;
}
.auth-success .auth-submit {
  margin-top: 16px;
}

.auth-forgot {
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
  margin-top: 4px;
}
.auth-forgot a {
  color: var(--text-muted);
  text-decoration: none;
}
.auth-forgot a:hover { text-decoration: underline; }

.auth-pw-wrapper {
  position: relative;
}
.auth-pw-wrapper input {
  padding-right: 52px;
}
.auth-pw-toggle {
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
}
.auth-pw-toggle:hover { color: var(--text); background: var(--bg-surface); }
.auth-pw-wrapper.hidden { display: none; }
.auth-form input.hidden { display: none; }

.auth-error {
  text-align: center;
  font-size: 13px;
  margin-top: 10px;
  padding: 8px;
  border-radius: 6px;
  background: rgba(239,68,68,0.1);
}

/* ================================================================
   RESPONSIVE
   ================================================================ */
@media (max-width: 700px) {
  .gauge-area {
    flex: 1 1 auto;
  }
  .steps { gap: 24px; margin-top: 40px; }
  .steps .step span:last-child { display: none; }
  .progress-cards { grid-template-columns: 1fr; }
  .comp-row { grid-template-columns: 60px 1fr 1fr 80px; font-size: 12px; }
}

@media (max-height: 500px) {
  .gauge-area { flex: 1 1 auto; }
  .live-score-area { padding: 4px 12px 6px; min-height: 36px; }
}
