*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --ink:       #0d0c0a;
  --paper:     #f5f0e8;
  --sepia:     #c8b89a;
  --ash:       #7a7268;
  --gold:      #b8965a;
  --gold-pale: #e8d9b8;
  --red:       #8b2020;
  --font-serif: 'Cormorant Garamond', Georgia, serif;
  --font-mono:  'Courier Prime', 'Courier New', monospace;
}

html { scroll-behavior: smooth; }

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-serif);
  font-size: 18px;
  line-height: 1.7;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 9999;
  opacity: 0.6;
}

/* Hero */
#intro {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
  position: relative;
  overflow: hidden;
}

#intro::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 1px;
  height: 80px;
  background: linear-gradient(to bottom, var(--gold), transparent);
}

.eyebrow {
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 2.5rem;
  opacity: 0;
  animation: fadeUp 1s 0.3s forwards;
}

h1 {
  font-size: clamp(3.5rem, 10vw, 8rem);
  font-weight: 300;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--paper);
  opacity: 0;
  animation: fadeUp 1.2s 0.6s forwards;
}

h1 em {
  font-style: italic;
  color: var(--gold);
}

.subtitle {
  margin-top: 2rem;
  font-size: 1.1rem;
  font-weight: 300;
  color: var(--sepia);
  max-width: 480px;
  font-style: italic;
  opacity: 0;
  animation: fadeUp 1s 1s forwards;
}

.divider-ornament {
  margin: 3rem auto;
  display: flex;
  align-items: center;
  gap: 1rem;
  width: fit-content;
  opacity: 0;
  animation: fadeUp 1s 1.3s forwards;
}

.divider-ornament span {
  display: block;
  width: 60px;
  height: 1px;
  background: var(--gold);
  opacity: 0.5;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
  opacity: 0;
  animation: fadeUp 1s 1.5s forwards;
}

/* Buttons */
.btn {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.9rem 2.2rem;
  border: 1px solid;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: inline-block;
  background: transparent;
}

.btn-primary {
  border-color: var(--gold);
  color: var(--gold);
}

.btn-primary:hover {
  background: var(--gold);
  color: var(--ink);
}

.btn-ghost {
  border-color: var(--ash);
  color: var(--ash);
}

.btn-ghost:hover {
  border-color: var(--sepia);
  color: var(--sepia);
}

.btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.btn-help {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.5rem 1rem;
  border: 1px solid rgba(184,150,90,0.3);
  background: transparent;
  color: var(--ash);
  cursor: pointer;
  transition: all 0.2s;
}

.btn-help:hover {
  border-color: var(--gold);
  color: var(--gold);
}

/* Sections */
section {
  max-width: 780px;
  margin: 0 auto;
  padding: 5rem 2rem;
}

.section-label {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--gold);
  margin-bottom: 1.5rem;
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.section-label::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--gold);
  opacity: 0.25;
}

h2 {
  font-size: 2.8rem;
  font-weight: 300;
  line-height: 1.1;
  margin-bottom: 1.2rem;
  letter-spacing: -0.01em;
}

h2 em {
  font-style: italic;
  color: var(--gold);
}

/* App steps */
#app {
  background: #111009;
  border-top: 1px solid rgba(184,150,90,0.15);
  border-bottom: 1px solid rgba(184,150,90,0.15);
}

.steps-nav {
  display: flex;
  justify-content: center;
  border-bottom: 1px solid rgba(184,150,90,0.12);
  overflow-x: auto;
}

.step-tab {
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  padding: 1.2rem 2rem;
  color: var(--ash);
  border-bottom: 2px solid transparent;
  white-space: nowrap;
  transition: color 0.3s;
}

.step-tab.active {
  color: var(--gold);
  border-bottom-color: var(--gold);
}

.step-tab.done { color: var(--sepia); }

.step-panel {
  display: none;
  padding: 3.5rem 2rem;
  max-width: 680px;
  margin: 0 auto;
}

.step-panel.active { display: block; }

/* Forms */
.field { margin-bottom: 1.8rem; }

label {
  display: block;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--sepia);
  margin-bottom: 0.6rem;
}

input[type="text"],
input[type="email"],
input[type="date"],
input[type="password"],
textarea {
  width: 100%;
  background: rgba(245,240,232,0.04);
  border: 1px solid rgba(184,150,90,0.2);
  color: var(--paper);
  font-family: var(--font-serif);
  font-size: 1rem;
  padding: 0.9rem 1.1rem;
  outline: none;
  transition: border-color 0.3s;
  resize: vertical;
}

input:focus, textarea:focus {
  border-color: var(--gold);
  background: rgba(245,240,232,0.06);
}

textarea { min-height: 140px; }

.hint {
  font-size: 0.82rem;
  color: var(--ash);
  margin-top: 0.4rem;
  font-style: italic;
}

/* Toggle group */
.toggle-group {
  display: flex;
  border: 1px solid rgba(184,150,90,0.2);
  overflow: hidden;
}

.toggle-group label {
  flex: 1;
  text-align: center;
  padding: 0.8rem;
  cursor: pointer;
  color: var(--ash);
  border: none;
  margin: 0;
  letter-spacing: 0.15em;
  font-size: 0.62rem;
  transition: all 0.2s;
}

.toggle-group input[type="radio"] { display: none; }

.toggle-group input:checked + label {
  background: var(--gold);
  color: var(--ink);
}

/* Recorder */
#recorder-area {
  border: 1px solid rgba(184,150,90,0.2);
  padding: 2.5rem;
  text-align: center;
  background: rgba(184,150,90,0.03);
}

#waveform {
  height: 60px;
  margin: 1.5rem 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
}

.wave-bar {
  width: 3px;
  background: var(--gold);
  border-radius: 2px;
  opacity: 0.3;
  transition: height 0.1s ease;
  height: 4px;
}

.recording .wave-bar {
  opacity: 1;
  animation: waveAnim 0.8s ease-in-out infinite alternate;
}

@keyframes waveAnim {
  from { height: 4px; }
  to   { height: var(--h, 40px); }
}

#rec-status {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.2em;
  color: var(--ash);
  margin-top: 1rem;
}

#rec-status.active { color: var(--red); }
#rec-status.done   { color: var(--gold); }

.rec-timer {
  font-family: var(--font-mono);
  font-size: 2rem;
  color: var(--paper);
  margin: 0.5rem 0;
  letter-spacing: 0.1em;
}

/* Status boxes */
.status-box {
  border: 1px solid rgba(184,150,90,0.2);
  padding: 1.2rem 1.5rem;
  margin-top: 1.5rem;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.05em;
  color: var(--sepia);
  display: none;
}

.status-box.visible { display: block; }
.status-box.error   { border-color: var(--red); color: #c97070; }
.status-box.success { border-color: rgba(184,150,90,0.5); color: var(--gold); }

.spinner {
  display: inline-block;
  width: 10px;
  height: 10px;
  border: 1px solid var(--gold);
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 0.5rem;
  vertical-align: middle;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* Vault card */
.vault-card {
  border: 1px solid rgba(184,150,90,0.3);
  padding: 2.5rem;
  text-align: center;
  background: rgba(184,150,90,0.04);
  margin-top: 1.5rem;
}

.vault-url {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--sepia);
  margin-top: 0.8rem;
  word-break: break-all;
}

/* Vault player page */
#vault-page {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 4rem 2rem;
  text-align: center;
}

.envelope {
  width: 120px;
  height: 80px;
  border: 1px solid var(--gold);
  margin: 0 auto 3rem;
  position: relative;
  opacity: 0;
  animation: fadeUp 1s 0.5s forwards;
}

.envelope::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 50%;
  background:
    linear-gradient(135deg, transparent 49%, rgba(184,150,90,0.15) 50%),
    linear-gradient(225deg, transparent 49%, rgba(184,150,90,0.15) 50%);
}

.envelope::after {
  content: '';
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 55%;
  background:
    linear-gradient(to top right, rgba(184,150,90,0.1) 50%, transparent 50%),
    linear-gradient(to top left,  rgba(184,150,90,0.1) 50%, transparent 50%);
}

#unlock-form { width: 100%; max-width: 420px; }

.audio-player {
  width: 100%;
  max-width: 480px;
  margin: 2rem auto 0;
  display: none;
}

.audio-player.visible { display: block; }

.play-btn {
  width: 80px;
  height: 80px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  margin: 0 auto 1.5rem;
  transition: all 0.3s;
  background: transparent;
  color: var(--gold);
  font-size: 1.5rem;
}

.play-btn:hover {
  background: var(--gold);
  color: var(--ink);
}

.audio-meta {
  font-style: italic;
  color: var(--sepia);
  font-size: 1rem;
}

/* How it works */
#how { border-top: 1px solid rgba(184,150,90,0.08); }

.how-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-top: 3rem;
}

.how-item {
  padding: 2rem;
  border: 1px solid rgba(184,150,90,0.1);
  transition: border-color 0.3s;
}

.how-item:hover { border-color: rgba(184,150,90,0.35); }

.how-num {
  font-family: var(--font-mono);
  font-size: 2.5rem;
  color: rgba(184,150,90,0.2);
  line-height: 1;
  margin-bottom: 1rem;
}

.how-item h3 {
  font-size: 1.1rem;
  font-weight: 400;
  margin-bottom: 0.5rem;
  color: var(--paper);
}

.how-item p {
  font-size: 0.9rem;
  color: var(--ash);
  line-height: 1.6;
}

/* Footer */
footer {
  text-align: center;
  padding: 3rem 2rem;
  border-top: 1px solid rgba(184,150,90,0.1);
  font-family: var(--font-mono);
  font-size: 0.62rem;
  letter-spacing: 0.2em;
  color: var(--ash);
}

footer a { color: var(--sepia); text-decoration: none; }
footer a:hover { color: var(--gold); }

/* Modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(13,12,10,0.85);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
}

.modal-overlay.open {
  opacity: 1;
  pointer-events: all;
}

.modal {
  background: #18160f;
  border: 1px solid rgba(184,150,90,0.25);
  max-width: 560px;
  width: 100%;
  padding: 2.5rem;
  position: relative;
  transform: translateY(16px);
  transition: transform 0.3s;
}

.modal-overlay.open .modal { transform: translateY(0); }

.modal-close {
  position: absolute;
  top: 1rem; right: 1.2rem;
  background: none;
  border: none;
  color: var(--ash);
  font-size: 1.2rem;
  cursor: pointer;
  font-family: var(--font-mono);
  transition: color 0.2s;
}

.modal-close:hover { color: var(--paper); }

.lang-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.7rem;
  margin: 1.5rem 0;
}

.lang-btn {
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  padding: 0.8rem;
  border: 1px solid rgba(184,150,90,0.2);
  background: transparent;
  color: var(--sepia);
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
}

.lang-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.generated-text {
  background: rgba(184,150,90,0.05);
  border: 1px solid rgba(184,150,90,0.2);
  padding: 1.5rem;
  font-style: italic;
  color: var(--paper);
  line-height: 1.8;
  margin-top: 1rem;
  font-size: 0.95rem;
  display: none;
  white-space: pre-wrap;
}

.generated-text.visible { display: block; }

/* Animations */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* Responsive */
@media (max-width: 600px) {
  h1 { font-size: 3rem; }
  h2 { font-size: 2rem; }
  .step-tab { padding: 1rem 1.2rem; }
}
