:root {
  --ivory-50: #fffdf8;
  --ivory-100: #fbf4e8;
  --ivory-200: #f2e4cf;
  --petrol-700: #0b5960;
  --petrol-900: #073e46;
  --petrol-950: #052f35;
  --vermilion-600: #d8402f;
  --vermilion-700: #bd3022;
  --mustard-500: #d59a2b;
  --charcoal-950: #111719;
  --black: #090c0d;
  --muted: #6e665b;
  --border: #d7c7af;
  --success: #236b5d;
  --warning: #b8731d;
  --danger: #b72f24;
  --shadow-soft: 0 22px 60px rgba(17, 23, 25, 0.12);
  --shadow-card: 0 12px 28px rgba(17, 23, 25, 0.08);
  --radius-control: 12px;
  --radius-field: 14px;
  --radius-card: 18px;
  --radius-hero: 28px;
  --radius-app: 32px;
  --radius-pill: 999px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --font-display: "Avenir Next", "Inter", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Inter", "Avenir Next", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--petrol-950);
  color: var(--charcoal-950);
  font-family: var(--font-body);
  scroll-behavior: smooth;
}

body {
  min-width: 320px;
  min-height: 100vh;
  margin: 0;
  background:
    radial-gradient(circle at 12% 8%, rgba(216, 64, 47, 0.06), transparent 28%),
    linear-gradient(145deg, var(--ivory-100), #f8ecd8 62%, var(--ivory-200));
  color: var(--charcoal-950);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.18;
  background-image:
    repeating-radial-gradient(circle at 0 0, rgba(17, 23, 25, 0.18) 0, rgba(17, 23, 25, 0.18) 0.55px, transparent 0.75px, transparent 3px),
    repeating-linear-gradient(90deg, rgba(255,255,255,0.05) 0, rgba(255,255,255,0.05) 1px, transparent 1px, transparent 5px);
  mix-blend-mode: multiply;
}

button,
input,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid rgba(216, 64, 47, 0.42);
  outline-offset: 3px;
}

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

.hidden {
  display: none !important;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  grid-template-rows: 76px minmax(0, 1fr);
  overflow: hidden;
  background:
    linear-gradient(135deg, transparent 0 88%, rgba(216, 64, 47, 0.9) 88% 89.3%, var(--ivory-100) 89.3% 90.2%, rgba(213, 154, 43, 0.95) 90.2% 92.2%, var(--ivory-100) 92.2% 93.1%, var(--petrol-900) 93.1% 100%),
    var(--ivory-100);
}

.app-header {
  grid-column: 2;
  grid-row: 1;
  display: grid;
  grid-template-columns: auto minmax(220px, 360px) 1fr auto;
  align-items: center;
  gap: 28px;
  padding: 0 28px;
  background: rgba(255, 253, 248, 0.82);
  border-bottom: 1px solid rgba(215, 199, 175, 0.78);
  backdrop-filter: blur(18px);
  z-index: 20;
}

.brand-inline {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: var(--charcoal-950);
  text-decoration: none;
}

.brand-mark {
  position: relative;
  flex: 0 0 auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  overflow: hidden;
  background: var(--petrol-900);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.22);
}

.brand-mark::before,
.brand-mark::after,
.brand-mark span {
  content: "";
  position: absolute;
  left: -7px;
  width: 54px;
  height: 7px;
  transform: rotate(-40deg);
  border-radius: 999px;
}

.brand-mark::before {
  top: 9px;
  background: var(--vermilion-600);
}

.brand-mark span {
  top: 18px;
  background: var(--ivory-100);
}

.brand-mark::after {
  top: 27px;
  background: var(--mustard-500);
}

.brand-name {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.045em;
}

.search-box {
  position: relative;
}

.search-box input {
  width: 100%;
  min-height: 42px;
  padding: 0 46px 0 42px;
  border: 1px solid rgba(215, 199, 175, 0.9);
  border-radius: var(--radius-pill);
  background: rgba(255, 253, 248, 0.66);
  color: var(--charcoal-950);
}

.search-box::before {
  content: "⌕";
  position: absolute;
  left: 16px;
  top: 8px;
  color: var(--muted);
  font-size: 22px;
}

.header-nav {
  display: flex;
  justify-content: center;
  gap: clamp(18px, 3vw, 44px);
}

.header-nav button {
  position: relative;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
}

.header-nav button.is-active,
.header-nav button:hover {
  color: var(--charcoal-950);
}

.header-nav button.is-active::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 2px;
  height: 3px;
  border-radius: 999px;
  background: var(--vermilion-600);
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.icon-button {
  display: inline-grid;
  place-items: center;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--charcoal-950);
  font-size: 21px;
}

.icon-button:hover {
  background: rgba(17, 23, 25, 0.06);
}

.avatar {
  position: relative;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--charcoal-950);
  color: var(--ivory-100);
  display: grid;
  place-items: center;
  font-size: 18px;
}

.avatar::after {
  content: "";
  position: absolute;
  top: 0;
  right: -1px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--vermilion-600);
  box-shadow: 0 0 0 3px var(--ivory-100);
}

.side-rail {
  grid-column: 1;
  grid-row: 1 / span 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 20px 10px 18px;
  background: rgba(255, 253, 248, 0.88);
  border-right: 1px solid rgba(215, 199, 175, 0.86);
  backdrop-filter: blur(16px);
  z-index: 25;
}

.side-rail .brand-mark {
  width: 52px;
  height: 52px;
  margin-bottom: 38px;
}

.side-rail .brand-mark::before,
.side-rail .brand-mark::after,
.side-rail .brand-mark span {
  left: -9px;
  width: 72px;
  height: 9px;
}

.side-rail .brand-mark::before { top: 12px; }
.side-rail .brand-mark span { top: 24px; }
.side-rail .brand-mark::after { top: 36px; }

.side-nav {
  width: 100%;
  display: grid;
  gap: 10px;
}

.side-nav button {
  position: relative;
  display: grid;
  place-items: center;
  gap: 6px;
  min-height: 78px;
  padding: 8px 4px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--charcoal-950);
  font-size: 10px;
  font-weight: 600;
}

.side-nav button:hover,
.side-nav button.is-active {
  background: rgba(7, 62, 70, 0.07);
}

.side-nav button.is-active::after {
  content: "";
  position: absolute;
  bottom: 8px;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--petrol-900);
}

.nav-icon {
  font-size: 23px;
  line-height: 1;
}

.side-rail-footer {
  margin-top: auto;
  display: grid;
  gap: 12px;
}

.mini-wave-button {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 0;
  background: var(--charcoal-950);
  color: var(--ivory-100);
  box-shadow: var(--shadow-card);
}

.page-stage {
  grid-column: 2;
  grid-row: 2;
  overflow: auto;
  padding: 28px;
  min-width: 0;
}

.page {
  width: min(100%, 1460px);
  margin: 0 auto;
  animation: page-in 380ms var(--ease) both;
}

@keyframes page-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.home-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.16fr) minmax(480px, 0.84fr);
  gap: 28px;
  min-height: calc(100vh - 132px);
}

.hero-panel {
  position: relative;
  min-height: 820px;
  padding: 36px 38px 28px;
  overflow: hidden;
  border-radius: var(--radius-hero);
  background:
    linear-gradient(to bottom, rgba(251, 244, 232, 0.93) 0 44%, rgba(7, 62, 70, 0.98) 44% 100%);
  border: 1px solid rgba(215, 199, 175, 0.75);
  box-shadow: var(--shadow-soft);
}

.hero-copy {
  position: relative;
  z-index: 4;
  max-width: 820px;
  margin: 0 auto;
  text-align: center;
}

.jp-tagline {
  display: inline-flex;
  align-items: center;
  gap: 18px;
  margin-top: 8px;
  color: var(--charcoal-950);
  font-size: 18px;
  letter-spacing: 0.24em;
}

.jp-tagline::before,
.jp-tagline::after {
  content: "";
  width: 120px;
  height: 22px;
  opacity: 0.24;
  background:
    linear-gradient(90deg, transparent, var(--petrol-900), transparent) center / 100% 1px no-repeat,
    repeating-linear-gradient(90deg, transparent 0 5px, var(--petrol-900) 5px 6px, transparent 6px 10px) center / 100% 12px no-repeat;
}

.sonaura-wordmark {
  position: relative;
  margin: 20px auto 10px;
  color: var(--charcoal-950);
  font-family: var(--font-display);
  font-size: clamp(64px, 7.1vw, 112px);
  font-weight: 900;
  line-height: 0.86;
  letter-spacing: -0.075em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sonaura-wordmark .a-disc {
  position: relative;
  display: inline-block;
}

.sonaura-wordmark .a-disc::after {
  content: "";
  position: absolute;
  right: 16%;
  top: 39%;
  width: 0.22em;
  height: 0.22em;
  border-radius: 50%;
  background:
    linear-gradient(135deg, var(--petrol-900) 0 36%, var(--vermilion-600) 36% 57%, var(--ivory-100) 57% 68%, var(--mustard-500) 68% 100%);
  box-shadow: 0 0 0 2px rgba(255, 253, 248, 0.85);
}

.hero-subtitle {
  margin: 20px 0 0;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.44em;
  text-transform: uppercase;
}

.hero-art {
  position: absolute;
  inset: 250px 0 auto;
  height: 360px;
  pointer-events: none;
  z-index: 1;
}

.sun-disc {
  position: absolute;
  left: 50%;
  top: 64px;
  width: 220px;
  height: 220px;
  transform: translateX(-50%);
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 25%, rgba(255,255,255,0.13), transparent 26%),
    var(--vermilion-600);
  box-shadow: 0 18px 60px rgba(216, 64, 47, 0.22);
}

.sun-disc::after {
  content: "";
  position: absolute;
  left: 40px;
  right: 40px;
  bottom: 18px;
  height: 74px;
  background: repeating-linear-gradient(90deg, rgba(255,253,248,0.74) 0 2px, transparent 2px 6px);
  clip-path: polygon(0 100%, 0 96%, 5% 94%, 8% 76%, 11% 92%, 15% 57%, 19% 84%, 24% 30%, 28% 88%, 33% 18%, 38% 80%, 43% 42%, 48% 92%, 53% 10%, 58% 67%, 63% 31%, 68% 89%, 72% 52%, 77% 96%, 82% 40%, 87% 83%, 92% 61%, 100% 100%);
}

.wave-scape {
  position: absolute;
  left: -3%;
  right: -3%;
  bottom: -2px;
  height: 260px;
}

.wave-layer {
  position: absolute;
  left: -4%;
  width: 108%;
  border-radius: 50% 50% 0 0 / 100% 100% 0 0;
  transform-origin: center bottom;
}

.wave-layer.w1 {
  bottom: 0;
  height: 210px;
  background: var(--petrol-900);
  clip-path: polygon(0 56%, 7% 49%, 16% 61%, 26% 48%, 34% 58%, 44% 42%, 53% 57%, 63% 44%, 72% 58%, 81% 34%, 89% 48%, 100% 29%, 100% 100%, 0 100%);
}

.wave-layer.w2,
.wave-layer.w3,
.wave-layer.w4,
.wave-layer.w5 {
  background: transparent;
  border-top: 6px solid var(--ivory-100);
  height: 160px;
  bottom: 28px;
  clip-path: polygon(0 56%, 8% 47%, 18% 62%, 29% 47%, 39% 59%, 49% 43%, 58% 58%, 68% 42%, 78% 60%, 87% 35%, 100% 43%, 100% 100%, 0 100%);
}

.wave-layer.w3 {
  bottom: 15px;
  border-color: var(--mustard-500);
  border-top-width: 8px;
}

.wave-layer.w4 {
  bottom: 2px;
  border-color: var(--vermilion-600);
  border-top-width: 9px;
}

.wave-layer.w5 {
  bottom: 44px;
  border-color: rgba(255, 253, 248, 0.7);
  border-top-width: 2px;
  opacity: 0.65;
}

.mode-grid {
  position: absolute;
  z-index: 5;
  left: 38px;
  right: 38px;
  bottom: 112px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.mode-card {
  position: relative;
  min-height: 278px;
  padding: 24px 18px 18px;
  overflow: hidden;
  border: 1px solid rgba(255, 253, 248, 0.48);
  border-radius: 20px;
  color: var(--ivory-100);
  text-align: center;
  transition: transform 180ms var(--ease), box-shadow 180ms var(--ease), filter 180ms var(--ease);
  box-shadow: inset 0 0 0 1px rgba(17, 23, 25, 0.08);
}

.mode-card::before {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.16;
  background-image: repeating-radial-gradient(circle at 0 0, rgba(255,255,255,0.7) 0 0.5px, transparent 0.7px 3px);
  pointer-events: none;
}

.mode-card:hover,
.mode-card:focus-within {
  transform: translateY(-6px);
  box-shadow: 0 18px 38px rgba(0, 0, 0, 0.18);
  filter: saturate(1.03);
}

.mode-card.mode-ez { background: var(--petrol-700); }
.mode-card.mode-soft { background: var(--vermilion-600); }
.mode-card.mode-hard { background: var(--charcoal-950); }

.mode-card h3 {
  position: relative;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(30px, 3vw, 48px);
  line-height: 1;
  letter-spacing: -0.055em;
}

.mode-kicker {
  position: relative;
  display: block;
  margin-top: 10px;
  color: var(--ivory-200);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.25em;
  text-transform: uppercase;
}

.waveform-mini {
  position: relative;
  display: block;
  height: 34px;
  margin: 22px auto 16px;
  background:
    linear-gradient(90deg, transparent 0 5%, currentColor 5% 6%, transparent 6% 10%, currentColor 10% 11%, transparent 11% 15%, currentColor 15% 17%, transparent 17% 21%, currentColor 21% 22%, transparent 22% 28%, currentColor 28% 30%, transparent 30% 34%, currentColor 34% 35%, transparent 35% 40%, currentColor 40% 43%, transparent 43% 48%, currentColor 48% 49%, transparent 49% 53%, currentColor 53% 57%, transparent 57% 62%, currentColor 62% 63%, transparent 63% 68%, currentColor 68% 71%, transparent 71% 77%, currentColor 77% 78%, transparent 78% 83%, currentColor 83% 85%, transparent 85% 90%, currentColor 90% 91%, transparent 91% 100%);
  color: currentColor;
  mask-image: linear-gradient(to bottom, transparent, black 18%, black 82%, transparent);
  opacity: 0.88;
}

.mode-card p {
  position: relative;
  min-height: 64px;
  margin: 0 auto;
  max-width: 180px;
  font-size: 13px;
  line-height: 1.5;
}

.mode-select {
  position: relative;
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  margin-top: 16px;
  border: 0;
  border-radius: 50%;
  background: var(--ivory-100);
  color: var(--charcoal-950);
  font-size: 22px;
  transition: transform 120ms var(--ease), background 120ms var(--ease);
}

.mode-select:hover {
  transform: scale(1.06);
  background: var(--ivory-50);
}

.recent-strip {
  position: absolute;
  z-index: 6;
  left: 38px;
  right: 38px;
  bottom: 24px;
  min-height: 70px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--ivory-100);
  color: var(--charcoal-950);
  box-shadow: var(--shadow-card);
}

.track-art {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  background: var(--charcoal-950);
  color: var(--mustard-500);
  display: grid;
  place-items: center;
}

.track-meta strong,
.track-meta span {
  display: block;
}

.track-meta strong {
  font-size: 13px;
}

.track-meta span {
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.track-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.track-actions button {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--charcoal-950);
}

.track-actions button.primary-play {
  width: 46px;
  height: 46px;
  background: var(--charcoal-950);
  color: var(--ivory-100);
}

.analysis-panel {
  display: flex;
  flex-direction: column;
  min-height: 820px;
  padding: 28px;
  border: 1px solid rgba(215, 199, 175, 0.78);
  border-radius: var(--radius-hero);
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(18px);
}

.analysis-panel h2 {
  margin: 16px 0 8px;
  font-family: var(--font-display);
  font-size: clamp(30px, 3vw, 48px);
  letter-spacing: -0.045em;
}

.eyebrow-wave {
  width: 92px;
  height: 22px;
  color: var(--petrol-900);
  background: repeating-linear-gradient(90deg, transparent 0 4px, currentColor 4px 5px, transparent 5px 8px);
  mask-image: linear-gradient(to bottom, transparent, black 18%, black 82%, transparent);
  opacity: 0.78;
}

.panel-subtitle {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.analysis-empty,
.analysis-audio {
  margin-top: 24px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: rgba(251, 244, 232, 0.72);
}

.analysis-empty {
  display: grid;
  place-items: center;
  min-height: 190px;
  text-align: center;
}

.analysis-empty strong {
  display: block;
  margin-bottom: 8px;
  font-size: 15px;
}

.analysis-empty p {
  max-width: 360px;
  margin: 0 auto 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.upload-button,
.secondary-button,
.primary-button,
.ghost-button,
.small-button {
  border: 0;
  border-radius: var(--radius-pill);
  font-weight: 700;
  transition: transform 120ms var(--ease), box-shadow 120ms var(--ease), background 120ms var(--ease);
}

.primary-button,
.secondary-button,
.ghost-button {
  min-height: 52px;
  padding: 0 24px;
}

.primary-button {
  background: var(--vermilion-600);
  color: var(--ivory-50);
  box-shadow: 0 10px 24px rgba(216, 64, 47, 0.22);
}

.primary-button:hover {
  transform: translateY(-2px);
  background: var(--vermilion-700);
}

.secondary-button {
  border: 1px solid var(--border);
  background: var(--ivory-50);
  color: var(--charcoal-950);
}

.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
  background: var(--ivory-200);
}

.ghost-button {
  background: transparent;
  color: var(--charcoal-950);
}

.small-button,
.upload-button {
  min-height: 38px;
  padding: 0 16px;
  background: var(--petrol-900);
  color: var(--ivory-50);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 18px;
}

.metric-card {
  min-height: 116px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: rgba(251, 244, 232, 0.72);
}

.metric-label {
  display: block;
  margin-bottom: 14px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.metric-value {
  display: block;
  font-family: var(--font-display);
  font-size: clamp(22px, 2vw, 32px);
  font-weight: 700;
  letter-spacing: -0.04em;
}

.metric-note {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.suggestions-title,
.preview-title {
  margin: 26px 0 12px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.suggestion-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}

.suggestion-card {
  min-height: 140px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: rgba(251, 244, 232, 0.72);
}

.suggestion-card strong {
  display: block;
  font-size: 12px;
}

.suggestion-card p {
  min-height: 54px;
  margin: 9px 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.suggestion-card button {
  min-height: 34px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--ivory-50);
  font-size: 10px;
  font-weight: 700;
}

.preview-card {
  min-height: 116px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: rgba(251, 244, 232, 0.72);
}

.waveform-placeholder {
  height: 64px;
  background:
    linear-gradient(90deg, transparent 0 1%, rgba(7,62,70,0.32) 1% 1.4%, transparent 1.4% 2.2%, rgba(7,62,70,0.42) 2.2% 2.6%, transparent 2.6% 3.7%, rgba(7,62,70,0.18) 3.7% 4.1%, transparent 4.1% 5.3%, rgba(7,62,70,0.47) 5.3% 5.7%, transparent 5.7% 6.8%, rgba(7,62,70,0.26) 6.8% 7.2%, transparent 7.2% 8.7%, rgba(7,62,70,0.41) 8.7% 9.1%, transparent 9.1% 10.2%);
  background-size: 98px 100%;
  mask-image: linear-gradient(to bottom, transparent, black 13%, black 87%, transparent);
  opacity: 0.85;
}

.flow-page {
  display: grid;
  gap: 22px;
  min-height: calc(100vh - 132px);
}

.flow-hero {
  position: relative;
  padding: 24px 28px;
  overflow: hidden;
  border-radius: var(--radius-hero);
  background: var(--petrol-900);
  color: var(--ivory-50);
  box-shadow: var(--shadow-card);
}

.flow-hero::after {
  content: "";
  position: absolute;
  right: 24px;
  top: 0;
  width: 260px;
  height: 100%;
  opacity: 0.34;
  background: repeating-linear-gradient(90deg, transparent 0 8px, rgba(255,255,255,0.75) 8px 9px, transparent 9px 14px);
  mask-image: linear-gradient(to bottom, transparent, black 20%, black 80%, transparent);
}

.flow-hero h1 {
  position: relative;
  z-index: 1;
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(30px, 4vw, 52px);
  letter-spacing: -0.05em;
}

.flow-hero p {
  position: relative;
  z-index: 1;
  max-width: 740px;
  margin: 8px 0 0;
  color: var(--ivory-200);
  font-size: 13px;
}

.stepper {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  padding: 0 24px;
}

.stepper-item {
  position: relative;
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 10px;
  min-height: 48px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.stepper-item:not(:last-child)::after {
  content: "";
  position: absolute;
  left: 40px;
  right: 10px;
  bottom: 4px;
  height: 2px;
  background: var(--border);
}

.stepper-item.is-complete:not(:last-child)::after,
.stepper-item.is-active:not(:last-child)::after {
  background: var(--success);
}

.step-dot {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--ivory-50);
}

.stepper-item.is-active,
.stepper-item.is-complete {
  color: var(--charcoal-950);
}

.stepper-item.is-active .step-dot {
  border-color: var(--vermilion-600);
  background: var(--vermilion-600);
  color: var(--ivory-50);
}

.stepper-item.is-complete .step-dot {
  border-color: var(--success);
  background: var(--success);
  color: var(--ivory-50);
}

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(320px, 0.8fr);
  gap: 22px;
}

.card {
  padding: 22px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: rgba(255, 253, 248, 0.88);
  box-shadow: var(--shadow-card);
}

.card h2,
.card h3 {
  margin-top: 0;
  font-family: var(--font-display);
  letter-spacing: -0.035em;
}

.card h2 { font-size: 24px; }
.card h3 { font-size: 16px; }

.card-subtitle {
  margin: -10px 0 20px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label,
.field-label {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.field-help {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-field);
  background: var(--ivory-50);
  color: var(--charcoal-950);
  transition: border 120ms var(--ease), box-shadow 120ms var(--ease);
}

.input,
.select {
  min-height: 48px;
  padding: 0 14px;
}

.textarea {
  min-height: 150px;
  padding: 14px;
  resize: vertical;
  line-height: 1.55;
}

.input:focus,
.textarea:focus,
.select:focus {
  border-color: var(--petrol-700);
  box-shadow: 0 0 0 4px rgba(11, 89, 96, 0.1);
  outline: none;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.segmented button {
  min-height: 48px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius-control);
  background: var(--ivory-50);
  color: var(--charcoal-950);
  font-size: 12px;
  font-weight: 700;
}

.segmented button.is-selected {
  border-color: var(--petrol-900);
  background: var(--petrol-900);
  color: var(--ivory-50);
}

.chip-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--ivory-50);
  color: var(--charcoal-950);
  font-size: 12px;
  font-weight: 700;
}

.chip.is-selected {
  border-color: var(--petrol-900);
  background: var(--petrol-900);
  color: var(--ivory-50);
}

.chip.is-accent.is-selected {
  border-color: var(--vermilion-600);
  background: var(--vermilion-600);
}

.file-drop {
  display: grid;
  place-items: center;
  min-height: 150px;
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-card);
  background: rgba(251, 244, 232, 0.62);
  text-align: center;
}

.file-drop.is-dragover {
  border-color: var(--petrol-700);
  background: rgba(11, 89, 96, 0.08);
}

.file-drop p {
  margin: 8px 0 14px;
  color: var(--muted);
  font-size: 12px;
}

.file-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 14px;
  min-height: 82px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--ivory-50);
}

.file-card strong,
.file-card span {
  display: block;
}

.file-card span {
  margin-top: 4px;
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.summary-list {
  display: grid;
  gap: 10px;
}

.summary-row {
  display: grid;
  grid-template-columns: 126px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
  min-height: 48px;
  padding: 10px 0;
  border-bottom: 1px solid rgba(215, 199, 175, 0.64);
}

.summary-row:last-child {
  border-bottom: 0;
}

.summary-label {
  font-size: 11px;
  font-weight: 800;
}

.summary-value {
  font-size: 12px;
  line-height: 1.5;
}

.provenance {
  display: inline-grid;
  place-items: center;
  min-width: 24px;
  height: 24px;
  padding: 0 7px;
  border-radius: var(--radius-pill);
  color: var(--ivory-50);
  font-size: 10px;
  font-weight: 800;
}

.provenance.user { background: var(--success); }
.provenance.system { background: var(--petrol-700); }
.provenance.unknown { background: var(--warning); }
.provenance.locked { background: var(--charcoal-950); }

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

.contract-card {
  min-height: 190px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: var(--ivory-50);
}

.contract-card h3 {
  margin-bottom: 14px;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.contract-card.preserve h3 { color: var(--petrol-700); }
.contract-card.transform h3 { color: var(--warning); }
.contract-card.exclude h3 { color: var(--danger); }

.contract-card ul {
  display: grid;
  gap: 10px;
  margin: 0;
  padding-left: 18px;
  font-size: 12px;
  line-height: 1.45;
}

.notice {
  padding: 14px 16px;
  border-radius: var(--radius-card);
  font-size: 12px;
  line-height: 1.5;
}

.notice.warning {
  border: 1px solid rgba(184, 115, 29, 0.58);
  background: #fff1e5;
  color: #74430f;
}

.notice.info {
  border: 1px solid rgba(11, 89, 96, 0.34);
  background: rgba(11, 89, 96, 0.08);
  color: var(--petrol-950);
}

.notice.error {
  border: 1px solid rgba(183, 47, 36, 0.38);
  background: rgba(216, 64, 47, 0.08);
  color: #7d2119;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  z-index: 12;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(215, 199, 175, 0.76);
  border-radius: var(--radius-card);
  background: rgba(255, 253, 248, 0.88);
  backdrop-filter: blur(18px);
  box-shadow: 0 -12px 32px rgba(17, 23, 25, 0.08);
}

.action-group {
  display: flex;
  gap: 10px;
}

.save-status {
  color: var(--muted);
  font-size: 11px;
}

.save-status.is-saving { color: var(--warning); }
.save-status.is-saved { color: var(--success); }

.package-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 22px;
}

.package-status {
  padding: 20px 22px;
  border-radius: var(--radius-card);
  background: var(--petrol-900);
  color: var(--ivory-50);
}

.package-status strong {
  display: block;
  font-size: 18px;
}

.package-status span {
  display: block;
  margin-top: 6px;
  color: var(--ivory-200);
  font-size: 11px;
}

.output-stack {
  display: grid;
  gap: 16px;
}

.output-card {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: rgba(255, 253, 248, 0.92);
  box-shadow: var(--shadow-card);
}

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

.output-title {
  margin: 0;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.char-count {
  color: var(--muted);
  font-family: var(--font-mono);
  font-size: 10px;
}

.output-content {
  margin-top: 14px;
  padding: 14px;
  border-radius: var(--radius-field);
  background: var(--ivory-100);
  white-space: pre-wrap;
  font-size: 12px;
  line-height: 1.6;
}

.output-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.output-actions button {
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-pill);
  background: var(--ivory-50);
  color: var(--charcoal-950);
  font-size: 11px;
  font-weight: 700;
}

.output-actions button.copy-primary {
  border-color: var(--petrol-900);
  background: var(--petrol-900);
  color: var(--ivory-50);
}

.settings-list,
.export-guide {
  display: grid;
  gap: 10px;
}

.setting-row,
.guide-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  align-items: center;
  min-height: 44px;
  padding: 8px 0;
  border-bottom: 1px solid rgba(215, 199, 175, 0.64);
  font-size: 12px;
}

.setting-row:last-child,
.guide-row:last-child {
  border-bottom: 0;
}

.guide-row {
  grid-template-columns: 34px 1fr;
}

.guide-number {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--petrol-900);
  color: var(--ivory-50);
  font-size: 11px;
  font-weight: 800;
}

.projects-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 18px;
}

.project-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  background: rgba(255, 253, 248, 0.9);
  box-shadow: var(--shadow-card);
}

.project-card h3 {
  margin: 0;
  font-size: 18px;
}

.project-meta {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.5;
}

.project-card .action-group {
  margin-top: auto;
}

.empty-page {
  min-height: 560px;
  display: grid;
  place-items: center;
  padding: 34px;
  border: 1px solid var(--border);
  border-radius: var(--radius-hero);
  background: rgba(255, 253, 248, 0.84);
  text-align: center;
}

.empty-page h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(34px, 5vw, 62px);
  letter-spacing: -0.055em;
}

.empty-page p {
  max-width: 580px;
  margin: 16px auto 26px;
  color: var(--muted);
  line-height: 1.6;
}

.bottom-nav {
  display: none;
}

.toast-region {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10000;
  display: grid;
  gap: 10px;
  width: min(360px, calc(100vw - 32px));
}

.toast {
  padding: 14px 16px;
  border-radius: var(--radius-card);
  background: var(--charcoal-950);
  color: var(--ivory-50);
  box-shadow: var(--shadow-soft);
  font-size: 12px;
  line-height: 1.45;
  animation: toast-in 260ms var(--ease) both;
}

.toast.success { background: var(--success); }
.toast.warning { background: var(--warning); color: #281b0a; }
.toast.error { background: var(--danger); }

@keyframes toast-in {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(9, 12, 13, 0.46);
  backdrop-filter: blur(10px);
}

.modal {
  width: min(560px, 100%);
  max-height: min(760px, calc(100vh - 40px));
  overflow: auto;
  padding: 22px;
  border-radius: 24px;
  background: var(--ivory-50);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

.modal h2 {
  margin-top: 0;
  font-family: var(--font-display);
  letter-spacing: -0.04em;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 78px minmax(0, 1fr);
  }
  .app-header {
    grid-template-columns: auto minmax(180px, 280px) 1fr auto;
    gap: 16px;
    padding: 0 18px;
  }
  .header-nav {
    gap: 18px;
  }
  .home-grid {
    grid-template-columns: minmax(0, 1.1fr) minmax(390px, 0.9fr);
  }
  .hero-panel,
  .analysis-panel {
    min-height: 780px;
  }
  .metrics-grid,
  .suggestion-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .mode-card {
    padding-left: 12px;
    padding-right: 12px;
  }
}

@media (max-width: 960px) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
  }
  .app-shell {
    display: block;
    min-height: 100vh;
    background: var(--ivory-100);
  }
  .side-rail,
  .header-nav,
  .search-box,
  .desktop-only {
    display: none !important;
  }
  .app-header {
    position: sticky;
    top: 0;
    z-index: 30;
    display: flex;
    min-height: 64px;
    padding: calc(8px + env(safe-area-inset-top)) 16px 8px;
    background: rgba(251, 244, 232, 0.91);
  }
  .brand-name {
    font-size: 19px;
  }
  .brand-mark {
    width: 36px;
    height: 36px;
  }
  .header-actions {
    margin-left: auto;
  }
  .page-stage {
    min-height: calc(100vh - 64px);
    padding: 0 0 calc(92px + env(safe-area-inset-bottom));
    overflow: visible;
  }
  .page {
    width: 100%;
  }
  .home-grid {
    display: block;
    min-height: 0;
  }
  .hero-panel {
    min-height: calc(100svh - 136px);
    height: calc(100svh - 136px);
    padding: 24px 16px 18px;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    background: linear-gradient(to bottom, var(--ivory-100) 0 45%, var(--petrol-900) 45% 100%);
  }
  .hero-copy {
    margin-top: 12px;
  }
  .jp-tagline {
    font-size: 12px;
    letter-spacing: 0.18em;
    gap: 10px;
  }
  .jp-tagline::before,
  .jp-tagline::after {
    width: 58px;
  }
  .sonaura-wordmark {
    margin-top: 22px;
    font-size: clamp(60px, 15.5vw, 78px);
    letter-spacing: -0.08em;
  }
  .hero-subtitle {
    margin-top: 14px;
    font-size: 9px;
    letter-spacing: 0.3em;
    line-height: 1.7;
  }
  .hero-art {
    top: 226px;
    height: 318px;
  }
  .sun-disc {
    top: 54px;
    width: 182px;
    height: 182px;
  }
  .wave-scape {
    height: 222px;
  }
  .mode-grid {
    left: 16px;
    right: 16px;
    bottom: 104px;
    gap: 8px;
  }
  .mode-card {
    min-height: 230px;
    padding: 20px 8px 14px;
    border-radius: 18px;
  }
  .mode-card h3 {
    font-size: clamp(28px, 8vw, 38px);
  }
  .mode-kicker {
    font-size: 8px;
    letter-spacing: 0.16em;
  }
  .waveform-mini {
    margin: 18px auto 12px;
    height: 28px;
  }
  .mode-card p {
    min-height: 56px;
    font-size: 10px;
    line-height: 1.45;
  }
  .mode-select {
    width: 42px;
    height: 42px;
    margin-top: 10px;
  }
  .recent-strip {
    left: 16px;
    right: 16px;
    bottom: 12px;
    min-height: 76px;
    grid-template-columns: auto minmax(0, 1fr) auto;
  }
  .recent-strip .track-actions button:not(.primary-play),
  .recent-strip .more-button {
    display: none;
  }
  .analysis-panel {
    display: none;
  }
  .flow-page {
    gap: 14px;
    min-height: 0;
    padding: 14px 14px 0;
  }
  .flow-hero {
    padding: 20px;
    border-radius: 22px;
  }
  .flow-hero h1 {
    font-size: 30px;
  }
  .stepper {
    padding: 0 4px;
  }
  .stepper-item {
    grid-template-columns: 30px 1fr;
    gap: 6px;
    font-size: 10px;
  }
  .stepper-item:not(:last-child)::after {
    left: 38px;
    right: 4px;
  }
  .content-grid,
  .package-layout {
    grid-template-columns: 1fr;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .field.full {
    grid-column: auto;
  }
  .segmented {
    grid-template-columns: 1fr;
  }
  .contract-grid {
    grid-template-columns: 1fr;
  }
  .summary-row {
    grid-template-columns: 92px minmax(0, 1fr) auto;
  }
  .sticky-actions {
    bottom: calc(76px + env(safe-area-inset-bottom));
    padding: 10px;
    border-radius: 18px;
  }
  .sticky-actions .save-status {
    display: none;
  }
  .action-group {
    width: 100%;
  }
  .action-group > * {
    flex: 1;
  }
  .package-status {
    border-radius: 20px;
  }
  .projects-grid {
    grid-template-columns: 1fr;
  }
  .bottom-nav {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 50;
    display: grid;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    min-height: calc(72px + env(safe-area-inset-bottom));
    padding: 8px 6px env(safe-area-inset-bottom);
    border-top: 1px solid rgba(215, 199, 175, 0.84);
    border-radius: 22px 22px 0 0;
    background: rgba(251, 244, 232, 0.94);
    backdrop-filter: blur(18px);
    box-shadow: 0 -16px 36px rgba(17, 23, 25, 0.08);
  }
  .bottom-nav button {
    display: grid;
    place-items: center;
    gap: 4px;
    min-height: 56px;
    padding: 4px 1px;
    border: 0;
    background: transparent;
    color: var(--charcoal-950);
    font-size: 9px;
    font-weight: 700;
  }
  .bottom-nav button.is-active {
    color: var(--vermilion-600);
  }
  .bottom-nav .nav-icon {
    font-size: 20px;
  }
  .toast-region {
    right: 16px;
    bottom: calc(88px + env(safe-area-inset-bottom));
  }
}

@media (max-width: 420px) {
  .hero-panel {
    min-height: calc(100svh - 136px);
    height: calc(100svh - 136px);
  }
  .sonaura-wordmark {
    font-size: 56px;
  }
  .mode-grid {
    gap: 6px;
  }
  .mode-card {
    min-height: 246px;
    padding-left: 6px;
    padding-right: 6px;
  }
  .mode-card h3 {
    font-size: 27px;
  }
  .mode-card p {
    font-size: 9px;
  }
  .summary-row {
    grid-template-columns: 80px minmax(0, 1fr) auto;
    gap: 8px;
  }
}

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