:root {
  color-scheme: light;
  --bg: oklch(1 0 0);
  --surface: oklch(0.965 0.006 170);
  --ink: oklch(0.22 0.025 170);
  --muted: oklch(0.43 0.022 170);
  --primary: oklch(0.45 0.086 170);
  --primary-hover: oklch(0.39 0.086 170);
  --accent: oklch(0.66 0.145 50);
  --error: oklch(0.48 0.18 25);
  --focus: oklch(0.72 0.12 170);
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  min-height: 100svh;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
}

main {
  width: min(100% - 2rem, 30rem);
  margin-inline: auto;
  padding: clamp(2rem, 8vh, 5rem) 0 2rem;
}

header {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 2rem;
}

.mark {
  display: grid;
  flex: 0 0 2.75rem;
  width: 2.75rem;
  height: 2.75rem;
  place-items: center;
  border-radius: 12px;
  background: var(--primary);
  color: var(--bg);
  font-weight: 750;
}

h1, h2, p { margin-top: 0; }
h1, h2 { text-wrap: balance; }
h1 { margin-bottom: 0.15rem; font-size: 1.3rem; letter-spacing: -0.02em; }
h2 { margin-bottom: 0.35rem; font-size: 1.05rem; }
header p, .support, footer { color: var(--muted); }
header p { margin-bottom: 0; font-size: 0.9rem; }

section {
  padding: 1.4rem;
  border-radius: 14px;
  background: var(--surface);
}

form { display: flex; flex-direction: column; gap: 0.7rem; margin-top: 1.25rem; }
label { font-size: 0.9rem; font-weight: 650; }

input, button {
  min-height: 2.85rem;
  border-radius: 10px;
  font: inherit;
}

input {
  width: 100%;
  border: 1px solid oklch(0.78 0.018 170);
  background: var(--bg);
  color: var(--ink);
  padding: 0 0.85rem;
}

input:focus-visible, button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

button {
  border: 0;
  background: var(--primary);
  color: var(--bg);
  padding: 0.6rem 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: background-color 180ms ease-out, transform 180ms ease-out;
}

button:hover { background: var(--primary-hover); }
button:active { transform: translateY(1px); }
button:disabled { cursor: wait; opacity: 0.65; }
button.secondary { border: 1px solid var(--primary); background: transparent; color: var(--primary); }
button.secondary:hover { background: oklch(0.92 0.025 170); }
button.quiet { background: transparent; color: var(--muted); }
button.quiet:hover { color: var(--ink); background: oklch(0.92 0.01 170); }

#listener > button { width: 100%; margin-top: 0.65rem; }
.state { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.2rem; }
.state p { margin-bottom: 0; color: var(--muted); text-wrap: pretty; }

.setting {
  margin-bottom: 0.75rem;
  padding: 0.9rem 0;
  border-block: 1px solid oklch(0.82 0.018 170);
}

.setting-label { display: flex; justify-content: space-between; gap: 1rem; }
.setting output { color: var(--primary); font-weight: 750; font-variant-numeric: tabular-nums; }
.setting p { margin: 0; color: var(--muted); font-size: 0.8rem; }
input[type="range"] {
  min-height: 2rem;
  border: 0;
  background: transparent;
  padding: 0;
  accent-color: var(--primary);
  cursor: pointer;
}

.pulse {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  flex: 0 0 3.5rem;
  width: 3.5rem;
  height: 3.5rem;
  border-radius: 50%;
  background: oklch(0.91 0.035 170);
}

.pulse i { width: 3px; height: 10px; border-radius: 2px; background: var(--primary); }
.listening .pulse i { animation: listen 900ms ease-in-out infinite alternate; }
.listening .pulse i:nth-child(2) { animation-delay: -300ms; }
.listening .pulse i:nth-child(3) { animation-delay: -600ms; }
.listening .pulse i:nth-child(4) { animation-delay: -150ms; }

#message { min-height: 1.5rem; margin: 1rem 0 0; color: var(--primary); font-size: 0.9rem; }
#message.error { color: var(--error); }
footer { margin-top: 2rem; font-size: 0.8rem; line-height: 1.5; text-align: center; }

@keyframes listen { from { height: 8px; } to { height: 24px; } }

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