/* ── Soundz EarScan — single-file styling ──────────────────────── */
:root {
  --orange: #FF8201;
  --orange-soft: rgba(255, 130, 1, 0.12);
  --orange-glow: 0 4px 20px rgba(255, 130, 1, 0.25);
  --cyan: #22d3ee;
  --bg: #050505;
  --bg-raised: #0f0f10;
  --bg-card: rgba(255, 255, 255, 0.03);
  --border: rgba(255, 255, 255, 0.08);
  --border-strong: rgba(255, 255, 255, 0.16);
  --text: #f5f5f5;
  --text-mute: rgba(229, 229, 229, 0.65);
  --text-dim: rgba(229, 229, 229, 0.4);
  --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", system-ui, sans-serif;
  --radius: 12px;
  --radius-lg: 18px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; overscroll-behavior: none; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

/* ── Screens (full viewport) ──────────────────────────────────── */
.screen {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  padding: calc(var(--safe-top) + 20px) 20px calc(var(--safe-bot) + 20px);
  overflow-y: auto;
}
.screen[hidden] { display: none; }

.screen-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.screen-header h2 {
  margin: 0;
  font-size: 19px;
  font-weight: 700;
  letter-spacing: -0.01em;
  flex: 1;
}
.back-btn {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--text);
  cursor: pointer;
  padding: 0;
}
.back-btn svg { width: 20px; height: 20px; }
.back-btn-overlay {
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(10px);
  border-color: rgba(255,255,255,0.2);
}

.screen-intro {
  color: var(--text-mute);
  font-size: 14px;
  margin: 0 0 18px;
}

/* ── Landing screen ─────────────────────────────────────────── */
.screen-landing {
  justify-content: space-between;
  text-align: center;
}
.landing-hero {
  margin-top: 12vh;
}
.brand-mark {
  width: 80px; height: 80px;
  margin: 0 auto 20px;
  display: flex; align-items: center; justify-content: center;
}
.brand-icon { width: 100%; height: 100%; }
.screen-landing h1 {
  margin: 0 0 8px;
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.subtitle {
  margin: 0;
  font-size: 14px;
  color: var(--text-mute);
}
.landing-intro {
  padding: 0 8px;
  margin: 24px 0;
}
.landing-intro p {
  font-size: 13.5px;
  color: var(--text-mute);
  margin: 0;
  line-height: 1.65;
}
.footer-note {
  margin: 18px 0 0;
  font-size: 11px;
  color: var(--text-dim);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 18px;
  border-radius: var(--radius);
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  border: none;
  margin-top: 10px;
  transition: transform 80ms ease, box-shadow 120ms ease, opacity 120ms ease;
}
.btn:active { transform: scale(0.98); }
.btn-primary {
  background: var(--orange);
  color: #0a0a0a;
  box-shadow: var(--orange-glow);
}
.btn-primary:disabled {
  background: rgba(255, 130, 1, 0.25);
  color: rgba(0,0,0,0.4);
  box-shadow: none;
  cursor: not-allowed;
}
.btn-ghost {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-arrow {
  width: 18px;
  height: 18px;
}

/* ── Capability grid ───────────────────────────────────────── */
.capability-grid {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  margin-bottom: 18px;
}
.cap-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.cap-row:last-child { border-bottom: none; }
.cap-label {
  color: var(--text-mute);
  font-weight: 500;
}
.cap-value {
  color: var(--text);
  font-weight: 600;
  text-align: right;
  max-width: 60%;
}
.cap-loading {
  color: var(--text-dim);
  font-weight: 400;
  font-style: italic;
}
.cap-yes  { color: #6ee7a7; }
.cap-no   { color: #fca5a5; }
.cap-warn { color: #fcd34d; }

/* ── Mode card (recommended scan mode) ──────────────────────── */
.mode-card {
  background: linear-gradient(135deg, rgba(255,130,1,0.10), rgba(255,130,1,0.02));
  border: 1px solid rgba(255,130,1,0.30);
  border-radius: var(--radius-lg);
  padding: 18px 18px 16px;
  margin-bottom: 14px;
}
.mode-eyebrow {
  margin: 0;
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--orange);
  font-weight: 700;
}
.mode-title {
  margin: 6px 0 4px;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--text);
}
.mode-detail {
  margin: 0 0 10px;
  font-size: 13px;
  color: var(--text-mute);
  line-height: 1.5;
}
.mode-quality {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
}
.quality-stars {
  color: var(--orange);
  letter-spacing: 1px;
  font-size: 13px;
}
.quality-label {
  color: var(--text-mute);
  font-weight: 500;
}

/* ── Instructions screen ──────────────────────────────────── */
.instructions-illustration {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-bottom: 18px;
  display: flex;
  justify-content: center;
}
.instructions-illustration svg { width: 100%; max-width: 240px; height: auto; }
.instruction-steps {
  margin: 0 0 18px;
  padding-left: 22px;
}
.instruction-steps li {
  margin-bottom: 10px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--text-mute);
}
.instruction-steps li strong { color: var(--text); font-weight: 600; }
.warning {
  background: rgba(252, 211, 77, 0.10);
  border: 1px solid rgba(252, 211, 77, 0.30);
  border-radius: var(--radius);
  padding: 10px 14px;
  color: #fcd34d;
  font-size: 12.5px;
  margin: 0 0 18px;
}

/* ── Side selection ───────────────────────────────────────── */
.side-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 18px;
}
.side-card {
  background: var(--bg-card);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 28px 16px 22px;
  text-align: center;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: border-color 120ms ease, transform 80ms ease;
}
.side-card:active { transform: scale(0.97); }
.side-card:hover { border-color: var(--orange); }
.side-icon {
  width: 56px; height: 56px;
  margin: 0 auto 12px;
  display: flex; align-items: center; justify-content: center;
  background: var(--orange-soft);
  border: 2px solid var(--orange);
  border-radius: 50%;
  font-weight: 800;
  font-size: 24px;
  color: var(--orange);
}
.side-name { font-size: 16px; font-weight: 700; margin-bottom: 2px; }
.side-hint { font-size: 11px; color: var(--text-dim); letter-spacing: 0.04em; }

/* ── Capture screen (full-bleed video) ────────────────────── */
.screen-capture {
  padding: 0;
  background: #000;
  overflow: hidden;
}
.screen-capture video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #000;
}
.capture-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: calc(var(--safe-top) + 14px) 16px calc(var(--safe-bot) + 22px);
  pointer-events: none;
}
.capture-overlay > * { pointer-events: auto; }
.capture-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.capture-status {
  display: flex;
  align-items: center;
  gap: 10px;
}
.side-badge {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255,130,1,0.4);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 700;
  color: var(--orange);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.capture-time {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.capture-guide-center {
  align-self: center;
  text-align: center;
  margin-top: -40px;
}
.capture-ring {
  width: 240px; height: 240px;
  margin: 0 auto;
  display: flex; align-items: center; justify-content: center;
}
.capture-ring svg { width: 100%; height: 100%; }
.capture-guide-text {
  margin: 20px 16px 0;
  padding: 10px 16px;
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(12px);
  border-radius: 22px;
  font-size: 13.5px;
  font-weight: 500;
  color: var(--text);
  text-align: center;
  max-width: 320px;
}

.capture-bottom {
  display: flex;
  justify-content: center;
}
.record-btn {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 26px;
  background: rgba(0, 0, 0, 0.65);
  border: 2px solid var(--orange);
  border-radius: 999px;
  color: var(--orange);
  font-family: inherit;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  backdrop-filter: blur(12px);
  transition: background 150ms ease, color 150ms ease;
}
.record-btn[data-state="recording"] {
  background: var(--orange);
  color: #0a0a0a;
}
.record-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  background: var(--orange);
  transition: background 150ms ease;
}
.record-btn[data-state="recording"] .record-dot {
  background: #0a0a0a;
  border-radius: 3px;
  animation: pulse 1s ease-in-out infinite;
}
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:0.5} }

/* ── Review screen ────────────────────────────────────────── */
.review-video-wrap {
  background: #000;
  border-radius: var(--radius-lg);
  overflow: hidden;
  margin-bottom: 16px;
  aspect-ratio: 9/16;
  max-height: 60vh;
}
.review-video-wrap video {
  width: 100%; height: 100%;
  object-fit: cover;
}
.review-side-badge {
  background: var(--orange-soft);
  border: 1px solid rgba(255,130,1,0.4);
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  color: var(--orange);
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.review-stats {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 14px;
  margin-bottom: 14px;
}
.stat-row {
  display: flex;
  justify-content: space-between;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.stat-row:last-child { border-bottom: none; }
.stat-row > span:first-child { color: var(--text-mute); font-weight: 500; }
.stat-row > span:last-child  { color: var(--text); font-weight: 600; }

.review-actions {
  display: grid;
  grid-template-columns: 1fr 1.5fr;
  gap: 10px;
}
.review-actions .btn { margin-top: 0; }

/* ── Done screen ──────────────────────────────────────────── */
.done-hero {
  text-align: center;
  margin: 14vh 0 8vh;
}
.done-check {
  width: 96px; height: 96px;
  margin: 0 auto 22px;
}
.done-check svg { width: 100%; height: 100%; }
.done-hero h2 {
  margin: 0 0 6px;
  font-size: 24px;
  font-weight: 800;
}
.done-side {
  margin: 0;
  font-size: 14px;
  color: var(--orange);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-weight: 700;
}
