:root {
  --ink: #0c1410;
  --ink-soft: #152019;
  --moss: #1f6f4a;
  --moss-bright: #2f9e68;
  --lime: #c8f06c;
  --sand: #e8e2d4;
  --sand-dim: rgba(232, 226, 212, 0.62);
  --danger: #ff7a5c;
  --font-display: "Syne", sans-serif;
  --font-body: "Figtree", sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
}

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

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

body {
  font-family: var(--font-body);
  color: var(--sand);
  background: var(--ink);
  overflow-x: hidden;
}

.atmosphere {
  position: fixed;
  inset: 0;
  z-index: -2;
  background:
    radial-gradient(ellipse 80% 55% at 15% 10%, rgba(47, 158, 104, 0.28), transparent 55%),
    radial-gradient(ellipse 70% 50% at 90% 80%, rgba(200, 240, 108, 0.12), transparent 50%),
    radial-gradient(ellipse 50% 40% at 50% 50%, rgba(21, 32, 25, 0.9), transparent 70%),
    linear-gradient(160deg, #08110d 0%, #0c1410 45%, #121c16 100%);
  animation: drift 18s ease-in-out infinite alternate;
}

.grain {
  position: fixed;
  inset: 0;
  z-index: -1;
  opacity: 0.08;
  pointer-events: none;
  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='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

@keyframes drift {
  from {
    transform: scale(1) translate(0, 0);
  }
  to {
    transform: scale(1.05) translate(-1.5%, 1%);
  }
}

.stage {
  width: min(720px, calc(100% - 2.5rem));
  margin: 0 auto;
  padding: clamp(2.5rem, 8vh, 5rem) 0 3rem;
  display: flex;
  flex-direction: column;
  gap: clamp(1.75rem, 4vh, 2.75rem);
  min-height: 100vh;
}

.brand-block {
  animation: rise 0.8s var(--ease-out) both;
}

.brand {
  margin: 0 0 0.85rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: clamp(2.6rem, 8vw, 4.2rem);
  letter-spacing: -0.04em;
  line-height: 0.95;
  color: var(--lime);
}

.headline {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 4vw, 2.2rem);
  letter-spacing: -0.03em;
  color: var(--sand);
}

.lede {
  margin: 0;
  max-width: 34ch;
  font-size: 1.05rem;
  line-height: 1.55;
  color: var(--sand-dim);
}

.recorder {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
  animation: rise 0.9s var(--ease-out) 0.08s both;
}

.orb {
  position: relative;
  width: 148px;
  height: 148px;
  display: grid;
  place-items: center;
}

.orb-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid rgba(200, 240, 108, 0.25);
  transition: transform 0.4s var(--ease-out), border-color 0.3s ease;
}

.orb-core {
  width: 78px;
  height: 78px;
  border-radius: 50%;
  background:
    radial-gradient(circle at 35% 30%, #eaf8b4, var(--lime) 45%, var(--moss-bright) 100%);
  box-shadow: 0 0 40px rgba(200, 240, 108, 0.25);
  transition: transform 0.35s var(--ease-out), box-shadow 0.35s ease;
}

.orb[data-state="recording"] .orb-ring {
  border-color: rgba(200, 240, 108, 0.7);
  animation: pulse-ring 1.4s ease-out infinite;
}

.orb[data-state="recording"] .orb-core {
  transform: scale(1.08);
  box-shadow: 0 0 55px rgba(200, 240, 108, 0.45);
  animation: pulse-core 1.4s ease-in-out infinite;
}

.orb[data-state="processing"] .orb-core {
  animation: spin-glow 1.2s linear infinite;
}

@keyframes pulse-ring {
  0% {
    transform: scale(0.92);
    opacity: 1;
  }
  100% {
    transform: scale(1.28);
    opacity: 0;
  }
}

@keyframes pulse-core {
  0%,
  100% {
    transform: scale(1.05);
  }
  50% {
    transform: scale(1.14);
  }
}

@keyframes spin-glow {
  from {
    filter: hue-rotate(0deg);
  }
  to {
    filter: hue-rotate(40deg);
  }
}

.status {
  margin: 0;
  font-size: 0.95rem;
  color: var(--sand-dim);
  text-align: center;
}

.timer {
  margin: -0.5rem 0 0;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.08em;
  color: var(--lime);
  font-weight: 600;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.btn-primary {
  appearance: none;
  border: 0;
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: 600;
  padding: 0.9rem 1.35rem;
  border-radius: 999px;
  transition: transform 0.2s var(--ease-out), background 0.2s ease, color 0.2s ease;
  background: var(--lime);
  color: var(--ink);
}

.btn-primary:hover {
  transform: translateY(-1px);
  background: #d7f68a;
}

.btn-primary[aria-pressed="true"] {
  background: var(--danger);
  color: #1a0a06;
}

.result {
  animation: rise 0.55s var(--ease-out) both;
  border-top: 1px solid rgba(232, 226, 212, 0.12);
  padding-top: 1.75rem;
}

.result-kicker {
  margin: 0 0 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--moss-bright);
}

.result-amount {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(2.4rem, 7vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -0.03em;
  color: var(--sand);
}

.result-summary {
  margin: 0.35rem 0 1.25rem;
  color: var(--sand-dim);
  font-size: 1.05rem;
}

.result-meta {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.result-meta dt {
  margin: 0;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--sand-dim);
}

.result-meta dd {
  margin: 0.25rem 0 0;
  font-weight: 600;
  color: var(--sand);
  word-break: break-word;
}

.transcript {
  margin: 1.25rem 0 0;
  padding: 0;
  border: 0;
  font-style: italic;
  color: rgba(232, 226, 212, 0.78);
}

.error {
  margin: 0;
  color: var(--danger);
  text-align: center;
  animation: rise 0.4s var(--ease-out) both;
}

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

@media (max-width: 560px) {
  .result-meta {
    grid-template-columns: 1fr;
  }

  .actions {
    width: 100%;
  }

  .btn-primary {
    flex: 1 1 auto;
    justify-content: center;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}
