:root {
  color-scheme: dark;
  --bg: #111317;
  --panel: #f7f0df;
  --ink: #171511;
  --muted: #6f6658;
  --line: rgba(23, 21, 17, 0.16);
  --accent: #f0b429;
  --accent-strong: #d77222;
  --green: #2aae68;
  --blue: #3157a4;
  --shadow: 0 28px 90px rgba(0, 0, 0, 0.38);
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at 18% 16%, rgba(240, 180, 41, 0.22), transparent 30%),
    linear-gradient(135deg, #101116 0%, #1e2423 48%, #24170e 100%);
}

button {
  font: inherit;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 32px 18px;
}

.listener-panel {
  width: min(100%, 560px);
  padding: clamp(28px, 6vw, 54px);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.78), rgba(255, 255, 255, 0.18)),
    var(--panel);
  box-shadow: var(--shadow);
}

.status-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 24px;
  margin-bottom: 26px;
  color: var(--muted);
  font-size: 0.85rem;
  font-weight: 750;
  letter-spacing: 0;
  text-transform: uppercase;
}

.pulse {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: #a8a095;
  box-shadow: 0 0 0 0 rgba(42, 174, 104, 0);
}

.is-listening .pulse {
  background: var(--green);
  animation: pulse 1.25s ease-out infinite;
}

.has-won .pulse {
  background: var(--accent-strong);
}

h1 {
  margin: 0;
  max-width: 10ch;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3.2rem, 13vw, 6.5rem);
  line-height: 0.89;
  font-weight: 700;
  letter-spacing: 0;
}

.lede {
  max-width: 37rem;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: clamp(1rem, 2.3vw, 1.13rem);
  line-height: 1.55;
}

.meter {
  display: flex;
  align-items: end;
  gap: 8px;
  height: 64px;
  margin: 34px 0;
}

.meter span {
  width: 14px;
  height: 16px;
  border-radius: 999px 999px 3px 3px;
  background: var(--blue);
  opacity: 0.26;
  transform-origin: bottom;
}

.is-listening .meter span {
  animation: bounce 980ms ease-in-out infinite;
}

.is-listening .meter span:nth-child(2) {
  animation-delay: 120ms;
}

.is-listening .meter span:nth-child(3) {
  animation-delay: 240ms;
}

.is-listening .meter span:nth-child(4) {
  animation-delay: 360ms;
}

.is-listening .meter span:nth-child(5) {
  animation-delay: 480ms;
}

.primary-action {
  width: 100%;
  min-height: 56px;
  border: 0;
  border-radius: 8px;
  color: #171511;
  background: linear-gradient(135deg, var(--accent), #f6d36c);
  box-shadow: 0 12px 28px rgba(215, 114, 34, 0.28);
  cursor: pointer;
  font-size: 1rem;
  font-weight: 850;
}

.primary-action:hover {
  transform: translateY(-1px);
}

.primary-action:active {
  transform: translateY(0);
}

.primary-action[disabled] {
  cursor: default;
  opacity: 0.78;
  transform: none;
}

.transcript-box {
  min-height: 98px;
  margin-top: 22px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.48);
}

.transcript-label {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.transcript-box p {
  margin: 0;
  color: var(--ink);
  font-size: 1.08rem;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  overflow: hidden;
  margin: 20px 0 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--line);
}

.stats div {
  padding: 16px;
  background: rgba(255, 255, 255, 0.36);
}

.stats dt {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.stats dd {
  margin: 0;
  font-size: 1.45rem;
  font-weight: 850;
}

@keyframes pulse {
  0% {
    box-shadow: 0 0 0 0 rgba(42, 174, 104, 0.45);
  }
  100% {
    box-shadow: 0 0 0 14px rgba(42, 174, 104, 0);
  }
}

@keyframes bounce {
  0%,
  100% {
    height: 16px;
    opacity: 0.28;
  }
  50% {
    height: 58px;
    opacity: 0.92;
  }
}

@media (max-width: 520px) {
  .app-shell {
    align-items: stretch;
    padding: 14px;
  }

  .listener-panel {
    display: flex;
    min-height: calc(100vh - 28px);
    flex-direction: column;
    justify-content: center;
  }

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

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