:root {
  --bg: #050814;
  --panel: rgba(13, 18, 38, 0.72);
  --panel-strong: rgba(18, 25, 52, 0.92);
  --line: rgba(176, 190, 230, 0.16);
  --text: #f6f1e8;
  --muted: #aeb8d2;
  --soft: #d8d0ff;
  --indigo: #4338ca;
  --violet: #9b7cff;
  --teal: #65d6c5;
  --danger: #ff8a9b;
  --shadow: 0 22px 80px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 20% 8%, rgba(91, 77, 217, 0.34), transparent 30rem),
    radial-gradient(circle at 80% 18%, rgba(101, 214, 197, 0.12), transparent 28rem),
    linear-gradient(135deg, #03050e 0%, #09112a 48%, #050814 100%);
  color: var(--text);
  font-family: Inter, system-ui, sans-serif;
}

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

button {
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
summary:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 3px;
}

.aurora {
  position: fixed;
  inset: -20%;
  z-index: -2;
  background:
    radial-gradient(circle at 35% 35%, rgba(155, 124, 255, 0.22), transparent 22rem),
    radial-gradient(circle at 70% 55%, rgba(67, 56, 202, 0.22), transparent 26rem);
  filter: blur(25px);
  animation: drift 18s ease-in-out infinite alternate;
}

#particles {
  position: fixed;
  inset: 0;
  z-index: -1;
  width: 100%;
  height: 100%;
  opacity: 0.52;
  pointer-events: none;
}

.shell {
  min-height: 100vh;
  padding-bottom: 82px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px clamp(18px, 4vw, 56px);
  border-bottom: 1px solid var(--line);
  background: rgba(5, 8, 20, 0.74);
  backdrop-filter: blur(18px);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  background: transparent;
  color: var(--text);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.theta-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgba(216, 208, 255, 0.48);
  border-radius: 50%;
  box-shadow: inset 0 0 24px rgba(155, 124, 255, 0.26), 0 0 30px rgba(101, 214, 197, 0.12);
  color: var(--soft);
  font-family: "Cormorant Garamond", serif;
  font-size: 26px;
}

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

.nav button,
.bottom-nav button {
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 10px 14px;
}

.nav button.active,
.nav button:hover,
.bottom-nav button.active,
.bottom-nav button:hover {
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

.bottom-nav {
  position: fixed;
  right: 12px;
  bottom: 12px;
  left: 12px;
  z-index: 30;
  display: none;
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 22px;
  background: rgba(8, 12, 28, 0.88);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.bottom-nav button {
  padding: 10px 8px;
  font-size: 13px;
}

.main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.hero {
  display: grid;
  min-height: calc(100vh - 78px);
  align-items: center;
  padding: 56px 0;
}

.hero-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.03fr) minmax(320px, 0.72fr);
  gap: clamp(28px, 5vw, 70px);
  align-items: center;
}

.eyebrow {
  color: var(--teal);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

h1,
h2,
h3 {
  margin: 0;
  font-family: "Cormorant Garamond", Georgia, serif;
  line-height: 0.98;
}

h1 {
  max-width: 820px;
  margin-top: 18px;
  font-size: clamp(54px, 9vw, 116px);
}

h2 {
  font-size: clamp(38px, 6vw, 72px);
}

h3 {
  font-size: 28px;
}

p {
  color: var(--muted);
  line-height: 1.7;
}

.hero p {
  max-width: 670px;
  font-size: 18px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 28px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 11px 18px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  text-decoration: none;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.btn:hover {
  transform: translateY(-1px);
  border-color: rgba(216, 208, 255, 0.42);
  background: rgba(255, 255, 255, 0.09);
}

.btn.primary {
  border-color: rgba(155, 124, 255, 0.55);
  background: linear-gradient(135deg, rgba(67, 56, 202, 0.95), rgba(155, 124, 255, 0.78));
  box-shadow: 0 18px 48px rgba(67, 56, 202, 0.34);
}

.btn.ghost {
  background: transparent;
}

.btn.danger {
  border-color: rgba(255, 138, 155, 0.42);
  color: #ffd6dc;
}

.btn.small {
  min-height: 36px;
  padding: 8px 12px;
  font-size: 13px;
}

.hero-orb {
  position: relative;
  display: grid;
  min-height: 460px;
  place-items: center;
}

.wave-card {
  width: min(100%, 430px);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 28px;
  background: linear-gradient(180deg, rgba(18, 25, 52, 0.76), rgba(8, 12, 28, 0.72));
  box-shadow: var(--shadow);
  backdrop-filter: blur(22px);
}

.theta-circle {
  position: relative;
  display: grid;
  width: min(72vw, 310px);
  height: min(72vw, 310px);
  margin: 12px auto 22px;
  place-items: center;
  border: 1px solid rgba(216, 208, 255, 0.18);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(216, 208, 255, 0.18), transparent 42%),
    conic-gradient(from 130deg, rgba(101, 214, 197, 0.0), rgba(155, 124, 255, 0.42), rgba(101, 214, 197, 0.26), rgba(101, 214, 197, 0));
  box-shadow: inset 0 0 80px rgba(155, 124, 255, 0.2), 0 0 90px rgba(67, 56, 202, 0.2);
  animation: breathe 7s ease-in-out infinite;
}

.theta-circle::before,
.theta-circle::after {
  content: "";
  position: absolute;
  inset: 13%;
  border: 1px solid rgba(216, 208, 255, 0.16);
  border-radius: 50%;
}

.theta-circle::after {
  inset: 29%;
}

.theta-symbol {
  font-family: "Cormorant Garamond", serif;
  font-size: 112px;
  color: rgba(246, 241, 232, 0.92);
  text-shadow: 0 0 30px rgba(155, 124, 255, 0.4);
}

.panel {
  border: 1px solid var(--line);
  border-radius: 28px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(20px);
}

.section {
  padding: 42px 0 72px;
}

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

.wizard {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 22px;
}

.steps {
  position: sticky;
  top: 96px;
  align-self: start;
  padding: 16px;
}

.step-pill {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 16px;
  background: transparent;
  color: var(--muted);
  padding: 12px;
  text-align: left;
}

.step-pill.active {
  background: rgba(155, 124, 255, 0.14);
  color: var(--text);
}

.step-num {
  display: grid;
  width: 28px;
  height: 28px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--soft);
  font-size: 13px;
}

.step-body {
  min-height: 620px;
  padding: clamp(20px, 4vw, 34px);
}

.form-block {
  display: grid;
  gap: 20px;
  animation: fadeIn 220ms ease;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  padding: 14px 16px;
}

.input-with-action {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.textarea {
  min-height: 96px;
  resize: vertical;
}

.field label,
.label {
  display: block;
  margin-bottom: 8px;
  color: var(--soft);
  font-size: 13px;
  font-weight: 700;
}

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

.grid {
  display: grid;
  gap: 14px;
}

.grid.cards {
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.card-button,
.med-card {
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.055);
  color: var(--text);
  padding: 16px;
  text-align: left;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}

.card-button:hover,
.card-button.selected,
.med-card:hover {
  transform: translateY(-2px);
  border-color: rgba(155, 124, 255, 0.48);
  background: rgba(155, 124, 255, 0.12);
}

.voice-select {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  text-align: left;
}

.card-icon {
  display: grid;
  width: 38px;
  height: 38px;
  margin-bottom: 10px;
  place-items: center;
  border-radius: 14px;
  background: rgba(101, 214, 197, 0.12);
  color: var(--teal);
}

.summary {
  display: grid;
  gap: 12px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: rgba(0, 0, 0, 0.16);
}

.summary-row {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 12px;
  color: var(--muted);
}

.summary-row strong {
  color: var(--soft);
}

.wizard-actions {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 22px;
}

.loading {
  display: grid;
  min-height: 360px;
  place-items: center;
  text-align: center;
}

.library-tools {
  display: grid;
  grid-template-columns: 1.5fr repeat(3, minmax(145px, 0.7fr));
  gap: 12px;
  margin-bottom: 18px;
}

.med-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.med-card {
  display: grid;
  gap: 10px;
}

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

.tag {
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 5px 9px;
  color: var(--muted);
  font-size: 12px;
}

.empty {
  display: grid;
  min-height: 340px;
  place-items: center;
  padding: 24px;
  text-align: center;
}

.player {
  display: grid;
  gap: 18px;
  padding: clamp(18px, 4vw, 32px);
}

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

.player-center {
  display: grid;
  place-items: center;
  padding: 8px 0 20px;
  text-align: center;
}

.section-label {
  color: var(--teal);
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.progress {
  width: 100%;
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
}

.progress > span {
  display: block;
  width: var(--pct, 0%);
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), var(--violet));
}

.controls {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 12px;
  align-items: center;
}

.control-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
}

.range-row {
  display: grid;
  gap: 8px;
}

.switch {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 44px;
}

.script-box {
  max-height: 420px;
  overflow: auto;
  white-space: pre-wrap;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(0, 0, 0, 0.22);
  padding: 16px;
  color: #e8e2ff;
  line-height: 1.75;
}

.voice-studio {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: center;
  border: 1px solid rgba(101, 214, 197, 0.22);
  border-radius: 22px;
  background:
    radial-gradient(circle at 12% 18%, rgba(101, 214, 197, 0.1), transparent 18rem),
    rgba(255, 255, 255, 0.045);
  padding: 18px;
}

.voice-studio h3 {
  margin-top: 6px;
}

.voice-studio p {
  margin: 8px 0 12px;
}

details {
  border-top: 1px solid var(--line);
  padding-top: 14px;
}

summary {
  cursor: pointer;
  color: var(--soft);
  font-weight: 700;
}

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

.notice {
  border: 1px solid rgba(101, 214, 197, 0.26);
  border-radius: 20px;
  background: rgba(101, 214, 197, 0.08);
  padding: 16px;
}

.topic-voice-panel {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  border: 1px solid rgba(155, 124, 255, 0.22);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.05);
  padding: 16px;
}

.topic-voice-panel p {
  margin: 6px 0 12px;
}

.mic-pulse {
  width: 46px;
  height: 46px;
  border: 1px solid rgba(216, 208, 255, 0.34);
  border-radius: 50%;
  background:
    radial-gradient(circle, rgba(246, 241, 232, 0.9) 0 16%, transparent 17%),
    radial-gradient(circle, rgba(155, 124, 255, 0.28), rgba(101, 214, 197, 0.06));
  box-shadow: 0 0 32px rgba(155, 124, 255, 0.2);
}

.mic-pulse.active {
  animation: breathe 1.7s ease-in-out infinite;
  box-shadow: 0 0 42px rgba(101, 214, 197, 0.34);
}

@keyframes drift {
  from {
    transform: translate3d(-2%, -1%, 0) scale(1);
  }
  to {
    transform: translate3d(2%, 2%, 0) scale(1.04);
  }
}

@keyframes breathe {
  0%,
  100% {
    transform: scale(0.94);
  }
  50% {
    transform: scale(1.03);
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

@media (max-width: 860px) {
  .topbar .nav {
    display: none;
  }

  .bottom-nav {
    display: grid;
  }

  .hero-grid,
  .wizard,
  .grid.two,
  .settings-grid {
    grid-template-columns: 1fr;
  }

  .hero {
    min-height: auto;
    padding-top: 36px;
  }

  .hero-orb {
    min-height: 360px;
  }

  .steps {
    position: relative;
    top: 0;
    display: flex;
    overflow-x: auto;
  }

  .step-pill {
    min-width: 190px;
  }

  .page-head,
  .player-top,
  .controls {
    align-items: stretch;
    flex-direction: column;
  }

  .controls,
  .library-tools,
  .control-grid,
  .voice-studio,
  .input-with-action,
  .topic-voice-panel {
    grid-template-columns: 1fr;
  }

  .summary-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 560px) {
  .main {
    width: min(100% - 22px, 1180px);
  }

  .topbar {
    padding: 14px;
  }

  h1 {
    font-size: 54px;
  }

  .actions,
  .wizard-actions {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }
}
