:root {
  --ink: #10160f;
  --ink-2: #1a2418;
  --fog: #d8e0d2;
  --mist: #9aa896;
  --paper: #eef3ea;
  --accent: #c6f25a;
  --accent-ink: #15200c;
  --warn: #f0b35a;
  --line: rgba(238, 243, 234, 0.12);
  --shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
  --radius: 18px;
  --font-display: "Fraunces", Georgia, serif;
  --font-body: "Manrope", "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  min-height: 100%;
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-body);
}

body {
  min-height: 100vh;
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(1100px 700px at 12% -10%, rgba(198, 242, 90, 0.18), transparent 55%),
    radial-gradient(900px 600px at 90% 10%, rgba(90, 160, 140, 0.16), transparent 50%),
    radial-gradient(800px 500px at 50% 110%, rgba(240, 179, 90, 0.08), transparent 45%),
    linear-gradient(160deg, #0d120c 0%, #162015 45%, #10160f 100%);
  z-index: 0;
}

.atmosphere::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  pointer-events: none;
}

.shell {
  position: relative;
  z-index: 1;
  width: min(760px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(2.5rem, 8vh, 5rem) 0 3rem;
  animation: rise 0.7s ease both;
}

@keyframes rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

.brand {
  margin-bottom: 1.5rem;
}

.demo-banner {
  margin-bottom: 1.25rem;
  padding: 0.9rem 1.05rem;
  border: 1px solid rgba(240, 179, 90, 0.45);
  border-radius: 14px;
  background: rgba(240, 179, 90, 0.1);
  color: #f6d7a8;
  font-size: 0.95rem;
  line-height: 1.45;
  animation: rise 0.75s ease 0.05s both;
}

.demo-banner strong {
  color: var(--warn);
  font-weight: 700;
}

.wordmark {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(3.4rem, 10vw, 5.4rem);
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--paper);
}

.tag {
  margin: 0.7rem 0 0;
  color: var(--mist);
  font-size: 1.05rem;
  font-weight: 500;
}

.stage {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(26, 36, 24, 0.88), rgba(16, 22, 15, 0.92));
  border-radius: calc(var(--radius) + 6px);
  padding: clamp(1.25rem, 3vw, 1.75rem);
  box-shadow: var(--shadow);
  animation: rise 0.85s ease 0.08s both;
}

.field-label {
  display: block;
  margin-bottom: 0.55rem;
  color: var(--fog);
  font-size: 0.92rem;
  font-weight: 600;
}

textarea {
  width: 100%;
  resize: vertical;
  min-height: 140px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(8, 12, 8, 0.55);
  color: var(--paper);
  padding: 1rem 1.1rem;
  font: 500 1.05rem/1.55 var(--font-body);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

textarea:focus {
  border-color: rgba(198, 242, 90, 0.55);
  box-shadow: 0 0 0 3px rgba(198, 242, 90, 0.12);
}

.meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.55rem;
  color: var(--mist);
  font-size: 0.85rem;
}

.ghost {
  border: 0;
  background: transparent;
  color: var(--accent);
  font: 600 0.85rem var(--font-body);
  cursor: pointer;
  padding: 0.2rem 0;
}

.ghost:hover { text-decoration: underline; }

.controls {
  display: grid;
  grid-template-columns: 1.3fr 1fr 0.8fr;
  gap: 0.85rem;
  margin-top: 1.25rem;
}

.control label {
  display: flex;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  color: var(--fog);
  font-size: 0.82rem;
  font-weight: 600;
}

select,
input[type="number"] {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(8, 12, 8, 0.55);
  color: var(--paper);
  padding: 0.7rem 0.8rem;
  font: 500 0.95rem var(--font-body);
  outline: none;
}

select:focus,
input[type="number"]:focus {
  border-color: rgba(198, 242, 90, 0.5);
}

input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1.4rem;
  flex-wrap: wrap;
}

.primary {
  appearance: none;
  border: 0;
  border-radius: 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font: 700 1rem/1 var(--font-body);
  padding: 0.95rem 1.35rem;
  cursor: pointer;
  min-width: 180px;
  transition: transform 0.15s ease, filter 0.15s ease;
}

.primary:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.primary:disabled {
  opacity: 0.65;
  cursor: wait;
}

.btn-spinner {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  margin-left: 0.55rem;
  border: 2px solid rgba(21, 32, 12, 0.25);
  border-top-color: var(--accent-ink);
  border-radius: 50%;
  vertical-align: -2px;
  animation: spin 0.7s linear infinite;
}

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

.api-link {
  color: var(--mist);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}

.api-link:hover { color: var(--paper); }

.status {
  min-height: 1.4rem;
  margin-top: 0.9rem;
  color: var(--mist);
  font-size: 0.92rem;
}

.status.error { color: var(--warn); }

.player {
  margin-top: 1.25rem;
  padding-top: 1.15rem;
  border-top: 1px solid var(--line);
  animation: rise 0.45s ease both;
}

audio {
  width: 100%;
  margin-bottom: 0.9rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.6rem;
  margin-bottom: 0.85rem;
}

.metrics div {
  border-top: 1px solid var(--line);
  padding-top: 0.55rem;
}

.metrics span {
  display: block;
  color: var(--mist);
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 0.2rem;
}

.metrics strong {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 500;
}

.download {
  color: var(--accent);
  font-weight: 600;
  text-decoration: none;
}

.download:hover { text-decoration: underline; }

.foot {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin-top: 1.5rem;
  color: var(--mist);
  font-size: 0.88rem;
}

.dot {
  width: 0.55rem;
  height: 0.55rem;
  border-radius: 50%;
  background: var(--mist);
}

.dot.ok { background: var(--accent); box-shadow: 0 0 0 4px rgba(198, 242, 90, 0.12); }
.dot.bad { background: var(--warn); }

@media (max-width: 720px) {
  .controls { grid-template-columns: 1fr; }
  .metrics { grid-template-columns: 1fr 1fr; }
  .wordmark { font-size: clamp(2.8rem, 16vw, 4rem); }
}
