:root {
  --audio-bg: #070b14;
  --audio-bg-2: #0b1020;
  --audio-card: rgba(15, 23, 42, 0.72);
  --audio-card-2: rgba(2, 6, 23, 0.52);
  --audio-border: rgba(148, 163, 184, 0.16);
  --audio-border-strong: rgba(34, 211, 238, 0.32);
  --audio-text: #e5e7eb;
  --audio-muted: #94a3b8;
  --audio-dim: #64748b;
  --audio-cyan: #22d3ee;
  --audio-violet: #a78bfa;
  --audio-green: #34d399;
  --audio-amber: #f59e0b;
  --audio-red: #fb7185;
  --audio-radius: 22px;
  --audio-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

* { box-sizing: border-box; }
html { min-height: 100%; scroll-behavior: smooth; }
body.audio-shell {
  margin: 0;
  min-height: 100vh;
  color: var(--audio-text);
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    radial-gradient(circle at top left, rgba(34, 211, 238, 0.18), transparent 34rem),
    radial-gradient(circle at top right, rgba(167, 139, 250, 0.14), transparent 36rem),
    linear-gradient(180deg, var(--audio-bg), #030712 72%, #020617);
}

a { color: inherit; }
.audio-nav {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(18px);
  background: rgba(7, 11, 20, 0.78);
  border-bottom: 1px solid rgba(148, 163, 184, 0.10);
}
.audio-nav-inner {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.audio-brand {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  font-family: Outfit, Inter, sans-serif;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.audio-brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: #06111d;
  background: linear-gradient(135deg, var(--audio-cyan), var(--audio-violet));
  box-shadow: 0 0 24px rgba(34, 211, 238, 0.24);
}
.audio-brand-mark svg { width: 20px; height: 20px; }
.audio-nav-links {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.audio-nav-link {
  text-decoration: none;
  color: var(--audio-muted);
  font-size: 0.82rem;
  font-weight: 700;
  padding: 9px 11px;
  border-radius: 999px;
  transition: all .2s ease;
}
.audio-nav-link:hover,
.audio-nav-link.active {
  color: white;
  background: rgba(34, 211, 238, 0.10);
  box-shadow: inset 0 0 0 1px rgba(34, 211, 238, 0.16);
}
.audio-container {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}
.audio-hero {
  position: relative;
  padding: 86px 0 54px;
  overflow: hidden;
}
.audio-hero::after {
  content: "";
  position: absolute;
  inset: auto 6% 0 6%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(34,211,238,.35), rgba(167,139,250,.30), transparent);
}
.audio-kicker {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid rgba(34, 211, 238, 0.22);
  background: rgba(34, 211, 238, 0.08);
  color: #a5f3fc;
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: .12em;
  text-transform: uppercase;
}
.audio-title {
  max-width: 850px;
  margin: 20px 0 18px;
  font-family: Outfit, Inter, sans-serif;
  font-size: clamp(2.4rem, 6vw, 5.4rem);
  line-height: .96;
  letter-spacing: -0.055em;
}
.audio-subtitle {
  max-width: 720px;
  margin: 0;
  color: #b6c3d1;
  font-size: clamp(1rem, 2vw, 1.22rem);
  line-height: 1.75;
}
.audio-hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 28px; }
.audio-button,
.audio-button-secondary {
  border: 0;
  cursor: pointer;
  text-decoration: none;
  border-radius: 14px;
  padding: 12px 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-weight: 800;
  transition: transform .18s ease, box-shadow .18s ease, border-color .18s ease;
}
.audio-button {
  color: #03121e;
  background: linear-gradient(135deg, var(--audio-cyan), #67e8f9);
  box-shadow: 0 12px 32px rgba(34, 211, 238, 0.20);
}
.audio-button:hover { transform: translateY(-1px); box-shadow: 0 16px 38px rgba(34, 211, 238, 0.26); }
.audio-button-secondary {
  color: #dbeafe;
  background: rgba(15, 23, 42, 0.72);
  border: 1px solid rgba(148, 163, 184, 0.16);
}
.audio-button-secondary:hover { transform: translateY(-1px); border-color: rgba(34, 211, 238, 0.32); }
.audio-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
  padding: 44px 0 32px;
}
.audio-card,
.audio-panel,
.audio-result,
.privacy-receipt {
  border: 1px solid var(--audio-border);
  border-radius: var(--audio-radius);
  background: linear-gradient(180deg, var(--audio-card), var(--audio-card-2));
  box-shadow: var(--audio-shadow);
}
.audio-card {
  position: relative;
  padding: 24px;
  text-decoration: none;
  min-height: 250px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  transition: transform .18s ease, border-color .18s ease, background .18s ease;
}
.audio-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at top right, rgba(34,211,238,.13), transparent 17rem);
  opacity: .85;
  pointer-events: none;
}
.audio-card:hover { transform: translateY(-3px); border-color: var(--audio-border-strong); }
.audio-card > * { position: relative; z-index: 1; }
.audio-card-icon {
  width: 46px;
  height: 46px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  color: var(--audio-cyan);
  background: rgba(34, 211, 238, 0.10);
  border: 1px solid rgba(34, 211, 238, 0.18);
  margin-bottom: 18px;
}
.audio-card-icon svg { width: 22px; height: 22px; }
.audio-card-title {
  margin: 0 0 10px;
  font-family: Outfit, Inter, sans-serif;
  font-size: 1.25rem;
  letter-spacing: -0.02em;
}
.audio-card-desc { margin: 0; color: var(--audio-muted); line-height: 1.65; font-size: .92rem; }
.audio-chip-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.audio-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: #a5f3fc;
  background: rgba(34, 211, 238, 0.08);
  border: 1px solid rgba(34, 211, 238, 0.16);
  border-radius: 999px;
  padding: 5px 9px;
  font-size: .72rem;
  font-weight: 800;
}
.audio-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(320px, .95fr);
  gap: 22px;
  align-items: start;
  padding: 42px 0 70px;
}
.audio-panel { padding: 24px; }
.audio-panel h2,
.audio-result h2 { margin: 0 0 18px; font-family: Outfit, Inter, sans-serif; letter-spacing: -.02em; }
.audio-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.audio-field { display: flex; flex-direction: column; gap: 8px; margin-bottom: 15px; }
.audio-field label { color: #cbd5e1; font-size: .82rem; font-weight: 800; }
.audio-input,
.audio-select,
.audio-textarea {
  width: 100%;
  color: white;
  border: 1px solid rgba(148, 163, 184, 0.18);
  background: rgba(2, 6, 23, 0.54);
  border-radius: 14px;
  padding: 12px 13px;
  outline: none;
  font: inherit;
}
.audio-input:focus,
.audio-select:focus,
.audio-textarea:focus { border-color: rgba(34, 211, 238, .55); box-shadow: 0 0 0 3px rgba(34, 211, 238, .08); }
.audio-input[type="range"] { padding: 0; accent-color: var(--audio-cyan); }
.audio-file {
  width: 100%;
  border: 1px dashed rgba(34, 211, 238, .25);
  background: rgba(34, 211, 238, .055);
  border-radius: 18px;
  padding: 18px;
  color: #cbd5e1;
}
.audio-player { width: 100%; margin: 12px 0 4px; }
.audio-note,
.audio-warning,
.audio-error {
  border-radius: 16px;
  padding: 12px 14px;
  margin: 14px 0;
  font-size: .86rem;
  line-height: 1.55;
}
.audio-note { color: #bfdbfe; background: rgba(59, 130, 246, .08); border: 1px solid rgba(59, 130, 246, .16); }
.audio-warning { color: #fde68a; background: rgba(245, 158, 11, .08); border: 1px solid rgba(245, 158, 11, .20); }
.audio-error { color: #fecdd3; background: rgba(251, 113, 133, .08); border: 1px solid rgba(251, 113, 133, .20); }
.audio-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 18px; }
.audio-result { padding: 24px; position: sticky; top: 94px; }
.stat-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin-top: 14px; }
.stat-box {
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 18px;
  background: rgba(2, 6, 23, .42);
  padding: 16px;
}
.stat-label { color: var(--audio-muted); font-size: .72rem; font-weight: 800; letter-spacing: .07em; text-transform: uppercase; }
.stat-value { margin-top: 8px; color: white; font-family: Outfit, Inter, sans-serif; font-size: 1.45rem; font-weight: 800; word-break: break-word; }
.audio-meter {
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(15, 23, 42, .86);
  border: 1px solid rgba(148, 163, 184, .12);
  margin: 12px 0;
}
.audio-meter-fill {
  width: 0%;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--audio-cyan), var(--audio-violet));
  transition: width .25s ease;
}
.wave-lite {
  display: flex;
  align-items: end;
  gap: 4px;
  height: 86px;
  padding: 14px;
  border-radius: 18px;
  border: 1px solid rgba(148, 163, 184, .12);
  background: linear-gradient(180deg, rgba(34,211,238,.07), rgba(15,23,42,.35));
  overflow: hidden;
}
.wave-lite span {
  flex: 1;
  min-width: 3px;
  border-radius: 999px 999px 0 0;
  background: linear-gradient(180deg, var(--audio-cyan), var(--audio-violet));
  opacity: .75;
}
.tap-pad {
  width: 100%;
  min-height: 160px;
  border-radius: 26px;
  border: 1px solid rgba(34, 211, 238, .24);
  background: radial-gradient(circle at center, rgba(34,211,238,.23), rgba(15,23,42,.68));
  color: white;
  font-family: Outfit, Inter, sans-serif;
  font-size: clamp(2rem, 7vw, 4.2rem);
  font-weight: 900;
  cursor: pointer;
  box-shadow: inset 0 0 40px rgba(34, 211, 238, .08), 0 20px 70px rgba(0,0,0,.28);
}
.metronome-light {
  width: 120px;
  height: 120px;
  border-radius: 999px;
  margin: 8px auto 20px;
  border: 1px solid rgba(148, 163, 184, .18);
  background: radial-gradient(circle, rgba(15,23,42,.9), rgba(2,6,23,.8));
  box-shadow: inset 0 0 34px rgba(0,0,0,.35);
  transition: background .08s ease, box-shadow .08s ease, transform .08s ease;
}
.metronome-light.active {
  transform: scale(1.04);
  background: radial-gradient(circle, rgba(34,211,238,.78), rgba(167,139,250,.22));
  box-shadow: 0 0 34px rgba(34,211,238,.35), inset 0 0 34px rgba(255,255,255,.08);
}
.privacy-receipt { padding: 18px; margin-top: 20px; color: var(--audio-muted); font-size: .82rem; line-height: 1.7; }
.privacy-receipt strong { color: #dbeafe; }
.audio-footer {
  border-top: 1px solid rgba(148, 163, 184, .10);
  padding: 34px 0;
  color: var(--audio-dim);
  font-size: .86rem;
}
.audio-footer a { color: #a5f3fc; text-decoration: none; }
.audio-footer a:hover { text-decoration: underline; }
.hidden { display: none !important; }
.text-muted { color: var(--audio-muted); }
.full-span { grid-column: 1 / -1; }

@media (max-width: 920px) {
  .audio-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .audio-layout { grid-template-columns: 1fr; }
  .audio-result { position: static; }
}
@media (max-width: 700px) {
  .audio-nav-inner { align-items: flex-start; flex-direction: column; padding: 14px 0; }
  .audio-nav-links { justify-content: flex-start; }
  .audio-hero { padding-top: 54px; }
  .audio-grid { grid-template-columns: 1fr; }
  .audio-form-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
}

@media print {
  .audio-nav, .audio-hero-actions, .audio-footer, .audio-actions { display: none !important; }
  body.audio-shell { background: white; color: #111827; }
  .audio-panel, .audio-result, .audio-card, .privacy-receipt { box-shadow: none; border-color: #cbd5e1; background: white; color: #111827; }
}

/* Phase 3 processing-state refinements */
.audio-button[disabled],
.audio-button-secondary[disabled] {
  cursor: wait;
  opacity: .62;
  transform: none !important;
  box-shadow: none !important;
}
.stat-value[id="clip-risk"] {
  font-size: 1.08rem;
  line-height: 1.3;
}
.stat-value[id="output-peak"] {
  color: #a5f3fc;
}

/* Phase 4 Waveform Editor Lite */
.compact-grid { margin-top: 16px; }
.wave-editor {
  margin: 16px 0 18px;
  border: 1px solid rgba(34, 211, 238, .18);
  background:
    radial-gradient(circle at top left, rgba(34, 211, 238, .10), transparent 28rem),
    linear-gradient(180deg, rgba(2, 6, 23, .68), rgba(15, 23, 42, .42));
  border-radius: 22px;
  padding: 14px;
  box-shadow: inset 0 0 34px rgba(34, 211, 238, .035);
}
.wave-canvas {
  display: block;
  width: 100%;
  height: 220px;
  border-radius: 16px;
  border: 1px solid rgba(148, 163, 184, .12);
  background: linear-gradient(180deg, rgba(7, 11, 20, .96), rgba(2, 6, 23, .96));
  cursor: crosshair;
  touch-action: none;
}
.wave-editor.loaded .wave-canvas { cursor: grab; }
.wave-editor.dragging .wave-canvas { cursor: grabbing; }
.wave-editor-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 14px;
  margin-top: 12px;
  color: var(--audio-muted);
  font-size: .76rem;
  font-weight: 700;
}
.wave-editor-legend span { display: inline-flex; align-items: center; gap: 6px; }
.wave-editor-legend i { display: inline-block; width: 18px; height: 8px; border-radius: 99px; }
.legend-trim { background: rgba(34, 211, 238, .55); }
.legend-fade { background: linear-gradient(90deg, rgba(167, 139, 250, .08), rgba(167, 139, 250, .72)); }
.legend-handle { background: var(--audio-amber); width: 4px !important; }
.wave-status { margin: 12px 0 0; }
@media (max-width: 700px) {
  .wave-canvas { height: 180px; }
  .wave-editor { padding: 10px; }
}


/* Phase 5 AI BGM Toolkit */
.audio-card-featured {
  border-color: rgba(167, 139, 250, .28);
  background:
    radial-gradient(circle at top right, rgba(167, 139, 250, .16), transparent 26rem),
    linear-gradient(180deg, rgba(15, 23, 42, .76), rgba(2, 6, 23, .72));
}
.audio-card-featured .audio-card-icon {
  color: #ddd6fe;
  background: rgba(167, 139, 250, .12);
  border-color: rgba(167, 139, 250, .22);
}
.download-stack {
  margin-top: 18px;
  padding: 18px;
  border-radius: 20px;
  border: 1px solid rgba(34, 211, 238, .16);
  background: rgba(2, 6, 23, .38);
  display: grid;
  gap: 10px;
}
.download-stack h3 { margin: 0 0 4px; font-family: Outfit, Inter, sans-serif; }
.pack-link { justify-content: center; text-align: center; }
.prompt-output {
  width: 100%;
  min-height: 180px;
  resize: vertical;
  line-height: 1.65;
}
.audio-field.full-span { grid-column: 1 / -1; }


/* Phase 6 Unified Waveform Editing UX */
.unified-wave-editor {
  border-color: rgba(34, 211, 238, .24);
  background:
    radial-gradient(circle at 12% 0%, rgba(34, 211, 238, .14), transparent 28rem),
    radial-gradient(circle at 88% 0%, rgba(167, 139, 250, .13), transparent 28rem),
    linear-gradient(180deg, rgba(2, 6, 23, .72), rgba(15, 23, 42, .45));
}
.dual-wave-stack {
  display: grid;
  gap: 14px;
  margin-bottom: 16px;
}
.dual-wave-stack > div {
  border: 1px solid rgba(148, 163, 184, .12);
  border-radius: 18px;
  padding: 12px;
  background: rgba(2, 6, 23, .34);
}
.dual-wave-stack span {
  display: block;
  margin-bottom: 8px;
  color: var(--audio-muted);
  font-size: .72rem;
  font-weight: 900;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.compact-wave { height: 64px; padding: 10px; }
@media (max-width: 700px) {
  .dual-wave-stack { gap: 10px; }
  .compact-wave { height: 56px; }
}
