@import url("https://fonts.googleapis.com/css2?family=Fraunces:opsz,wght@9..144,600;9..144,700&family=Manrope:wght@400;500;700;800&display=swap");

:root {
  --bg: #f5efe2;
  --bg-deep: #d7e4df;
  --panel: rgba(255, 252, 247, 0.84);
  --panel-strong: rgba(255, 252, 247, 0.95);
  --line: rgba(46, 38, 31, 0.12);
  --line-strong: rgba(46, 38, 31, 0.2);
  --ink: #1f1915;
  --muted: #64574e;
  --muted-soft: rgba(100, 87, 78, 0.76);
  --accent: #b55c38;
  --accent-soft: rgba(181, 92, 56, 0.12);
  --teal: #1f6c67;
  --teal-soft: rgba(31, 108, 103, 0.12);
  --gold: #b78c33;
  --gold-soft: rgba(183, 140, 51, 0.14);
  --danger: #bf5244;
  --danger-soft: rgba(191, 82, 68, 0.12);
  --shadow: 0 18px 44px rgba(74, 55, 30, 0.09);
  --radius-xl: 28px;
  --radius-lg: 22px;
  --radius-md: 16px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  color: var(--ink);
  font-family: "Manrope", system-ui, sans-serif;
  background:
    radial-gradient(circle at top left, rgba(181, 92, 56, 0.18), transparent 26%),
    radial-gradient(circle at top right, rgba(31, 108, 103, 0.14), transparent 28%),
    linear-gradient(180deg, var(--bg) 0%, var(--bg-deep) 100%);
  overflow-x: hidden;
}

button,
input,
textarea {
  font: inherit;
}

button {
  color: inherit;
}

.backdrop,
.wash,
.grid-noise {
  position: fixed;
  inset: 0;
  pointer-events: none;
}

.wash {
  filter: blur(64px);
  opacity: 0.4;
}

.wash-a {
  inset: -12rem auto auto -8rem;
  width: 24rem;
  height: 24rem;
  border-radius: 999px;
  background: rgba(181, 92, 56, 0.26);
}

.wash-b {
  inset: auto -8rem -10rem auto;
  width: 22rem;
  height: 22rem;
  border-radius: 999px;
  background: rgba(31, 108, 103, 0.22);
}

.grid-noise {
  background-image:
    linear-gradient(rgba(46, 38, 31, 0.028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(46, 38, 31, 0.028) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(to bottom, rgba(0, 0, 0, 0.44), transparent 86%);
}

.app-shell {
  position: relative;
  z-index: 1;
  width: min(430px, calc(100% - 20px));
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 0 calc(24px + env(safe-area-inset-bottom));
}

.panel {
  margin-bottom: 10px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--panel);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow);
}

.reveal {
  animation: rise 360ms ease both;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-nav {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}

.page-nav::-webkit-scrollbar {
  display: none;
}

.page-nav-link {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  padding: 0.62rem 0.9rem;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.7);
  color: var(--muted);
  text-decoration: none;
  transition:
    transform 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.page-nav-link:hover {
  transform: translateY(-1px);
}

.page-nav-link.is-current {
  background: var(--ink);
  color: #fff;
}

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

.hero-copy {
  display: grid;
  gap: 0.7rem;
}

.eyebrow,
.section-kicker,
.hero-label,
.field-label,
.voice-count {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.72rem;
  font-weight: 800;
}

.eyebrow,
.section-kicker,
.hero-label,
.field-label {
  color: var(--accent);
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: -0.03em;
}

h1 {
  font-family: "Fraunces", "Georgia", serif;
  font-size: clamp(1.58rem, 6.4vw, 2rem);
  line-height: 0.98;
}

h2 {
  font-size: 1.12rem;
  font-weight: 800;
  line-height: 1.14;
}

h3 {
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.16;
}

.lede,
.hero-card p,
.section-note,
.subpanel-note,
.empty-state,
.variant-note,
.library-meta,
.library-note,
.notice,
.hvpt-card p {
  color: var(--muted);
}

.lede {
  margin: 0;
  line-height: 1.58;
}

.hero-stack {
  display: grid;
  gap: 10px;
}

.hero-card,
.subpanel,
.hvpt-card,
.variant-card,
.library-card {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--panel-strong);
}

.hero-card {
  padding: 13px 14px;
}

.hero-card strong {
  display: block;
  margin-top: 0.28rem;
  font-size: 1rem;
}

.hero-card p {
  margin: 0.45rem 0 0;
  line-height: 1.45;
}

.panel-head,
.subpanel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.section-note,
.subpanel-note {
  font-size: 0.86rem;
  line-height: 1.4;
}

.notice {
  display: none;
  margin-bottom: 12px;
  padding: 12px 13px;
  border-radius: var(--radius-md);
  border: 1px solid transparent;
  font-size: 0.95rem;
  line-height: 1.45;
}

.notice.is-visible {
  display: block;
}

.notice.notice-info {
  border-color: rgba(31, 108, 103, 0.16);
  background: var(--teal-soft);
  color: #134843;
}

.notice.notice-success {
  border-color: rgba(31, 108, 103, 0.16);
  background: rgba(31, 108, 103, 0.08);
  color: #134843;
}

.notice.notice-warning {
  border-color: rgba(183, 140, 51, 0.18);
  background: var(--gold-soft);
  color: #6f5312;
}

.notice.notice-error {
  border-color: rgba(191, 82, 68, 0.18);
  background: var(--danger-soft);
  color: #7f2e24;
}

.field {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
}

.compact-field {
  margin-bottom: 0;
}

.text-area,
.text-input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.82);
  color: var(--ink);
  padding: 0.92rem 0.98rem;
  transition:
    border-color 160ms ease,
    box-shadow 160ms ease,
    transform 160ms ease;
}

.text-area {
  resize: vertical;
  min-height: 118px;
  line-height: 1.5;
}

.short-area {
  min-height: 134px;
}

.text-input:focus,
.text-area:focus,
.speed-slider:focus {
  outline: none;
  border-color: rgba(31, 108, 103, 0.28);
  box-shadow: 0 0 0 3px rgba(31, 108, 103, 0.14);
}

.tuning-grid {
  display: grid;
  gap: 10px;
}

.subpanel {
  padding: 13px;
}

.preset-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.preset-chip,
.mini-button,
.ghost-button,
.primary-button {
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease,
    color 160ms ease;
}

.preset-chip,
.mini-button,
.ghost-button {
  background: rgba(255, 255, 255, 0.72);
  color: var(--ink);
}

.preset-chip,
.mini-button {
  min-height: 34px;
  padding: 0.55rem 0.82rem;
}

.ghost-button,
.primary-button {
  min-height: 44px;
  padding: 0.72rem 1.05rem;
  font-weight: 700;
}

.primary-button {
  border-color: rgba(31, 108, 103, 0.22);
  background: var(--ink);
  color: #fff;
}

.preset-chip:hover,
.mini-button:hover,
.ghost-button:hover,
.primary-button:hover {
  transform: translateY(-1px);
}

.preset-chip.is-active {
  border-color: rgba(181, 92, 56, 0.26);
  background: var(--accent-soft);
  color: #7a391e;
}

.slider-wrap {
  display: block;
  margin: 10px 0 12px;
}

.speed-slider {
  width: 100%;
  accent-color: var(--teal);
}

.speed-value {
  font-size: 1.18rem;
}

.voice-panel {
  margin-top: 2px;
}

.voice-toolbar {
  display: grid;
  gap: 8px;
  justify-items: end;
}

.inline-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

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

.voice-option {
  position: relative;
}

.voice-option input {
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
}

.voice-option span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 46px;
  padding: 0.68rem 0.78rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  font-weight: 700;
  color: var(--muted);
  transition:
    transform 160ms ease,
    border-color 160ms ease,
    background 160ms ease,
    color 160ms ease;
}

.voice-option input:checked + span {
  border-color: rgba(31, 108, 103, 0.24);
  background: var(--teal-soft);
  color: #134843;
}

.voice-option span:hover {
  transform: translateY(-1px);
}

.action-row,
.pack-tools {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 0.48rem 0.82rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.82rem;
  font-weight: 700;
}

.variant-list,
.library-list,
.hvpt-grid {
  display: grid;
  gap: 10px;
}

.empty-state {
  padding: 1rem;
  border: 1px dashed rgba(46, 38, 31, 0.16);
  border-radius: var(--radius-lg);
  text-align: center;
  background: rgba(255, 255, 255, 0.45);
  line-height: 1.5;
}

.variant-card {
  padding: 13px;
}

.variant-card.is-playing {
  border-color: rgba(31, 108, 103, 0.3);
  box-shadow: inset 0 0 0 1px rgba(31, 108, 103, 0.16);
}

.variant-top,
.library-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.voice-badge,
.library-date,
.library-tag {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 0.36rem 0.72rem;
  border-radius: 999px;
  font-size: 0.77rem;
}

.voice-badge {
  background: var(--accent-soft);
  color: #7a391e;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

.library-date,
.library-tag {
  background: rgba(255, 255, 255, 0.74);
  color: var(--muted);
}

.variant-meta {
  color: var(--muted);
  font-size: 0.86rem;
}

.variant-note {
  margin: 0.7rem 0 0.9rem;
  line-height: 1.45;
}

.variant-actions,
.library-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.audio-player {
  width: 100%;
  min-width: 0;
}

.library-card {
  padding: 13px;
}

.library-card.is-active {
  border-color: rgba(181, 92, 56, 0.22);
  box-shadow: inset 0 0 0 1px rgba(181, 92, 56, 0.12);
}

.library-text {
  margin: 0.2rem 0 0;
  font-size: 1rem;
  line-height: 1.35;
}

.library-note {
  margin: 0.5rem 0 0;
  line-height: 1.42;
}

.library-meta {
  margin: 0.65rem 0 0.9rem;
  font-size: 0.88rem;
}

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

.hvpt-card {
  padding: 14px;
}

.step-index {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #725410;
  font-weight: 800;
}

.hvpt-card h3 {
  margin-top: 0.8rem;
  margin-bottom: 0.5rem;
}

.hvpt-card p {
  margin: 0;
  line-height: 1.5;
}

button:disabled {
  opacity: 0.56;
  cursor: not-allowed;
  transform: none;
}

@media (max-width: 430px) {
  .hero {
    gap: 10px;
  }

  .hero-stack {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  .hero-card {
    padding: 10px 11px;
  }

  .hero-card strong {
    font-size: 0.94rem;
  }

  .hero-card p {
    margin-top: 0.34rem;
    font-size: 0.86rem;
    line-height: 1.36;
  }

  .lede {
    font-size: 0.96rem;
    line-height: 1.5;
  }

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

  .hvpt-grid {
    grid-template-columns: 1fr;
  }
}
