:root {
  color-scheme: dark;
  --accent: #d4a017;
  --accent-deep: #8a1538;
  --bg-deep: #241019;
  --bg-mid: #3a1734;
  --bg-teal: #0f2b2e;
  --fg: #f6ead1;
  --card: rgba(255, 246, 224, 0.08);
  --border: rgba(212, 160, 23, 0.45);
  --muted: #d8c9a8;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 2rem 1rem;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: linear-gradient(160deg, var(--bg-deep) 0%, var(--bg-mid) 55%, var(--bg-teal) 100%);
}

main {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  text-align: center;
}

.controls {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.6rem;
  margin: 2rem 0;
}

#record-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 5rem;
  height: 5rem;
  background: radial-gradient(circle at 35% 30%, #f0cf6a, var(--accent) 60%, var(--accent-deep) 100%);
  color: var(--bg-deep);
  border: 2px solid rgba(255, 246, 224, 0.5);
  border-radius: 999px;
  cursor: pointer;
  flex-shrink: 0;
  box-shadow: 0 4px 18px rgba(212, 160, 23, 0.5);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

#record-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px rgba(212, 160, 23, 0.65);
}

#record-btn svg {
  width: 2.2rem;
  height: 2.2rem;
}

#record-btn.recording {
  background: radial-gradient(circle at 35% 30%, #e08a8a, var(--accent-deep) 70%);
  color: var(--fg);
}

#record-btn[hidden] {
  display: none;
}

.wave {
  width: 8rem;
  height: 2.5rem;
  overflow: hidden;
}

.wave[hidden] {
  display: none;
}

.wave-svg {
  width: 200%;
  height: 100%;
  display: block;
}

.wave-path {
  fill: none;
  stroke-width: 2;
}

.wave-path-1 {
  stroke: var(--accent);
  opacity: 0.9;
  animation: wave-scroll 1.3s linear infinite;
}

.wave-path-2 {
  stroke: var(--accent-deep);
  opacity: 0.7;
  animation: wave-scroll 1.9s linear infinite reverse;
}

.wave-path-3 {
  stroke: var(--fg);
  opacity: 0.4;
  animation: wave-scroll 2.5s linear infinite;
}

@keyframes wave-scroll {
  from { transform: translateX(0); }
  to { transform: translateX(-200px); }
}

.spinner {
  width: 2.6rem;
  height: 2.6rem;
  border-radius: 50%;
  border: 4px solid rgba(212, 160, 23, 0.25);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

.spinner[hidden] {
  display: none;
}

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

#status {
  min-height: 1.2rem;
  font-size: 0.9rem;
  color: var(--muted);
}

#results {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
}

#results li {
  background: var(--card);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  padding: 0.9rem 1.1rem;
  margin-bottom: 0.6rem;
}

#results .title {
  font-weight: 600;
  color: var(--fg);
}

#results .rank {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.2rem;
}

#results .meta {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.4rem;
}

#results .meta div {
  margin-top: 0.15rem;
}

.record-again {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.6rem;
  height: 2.6rem;
  margin: 1.5rem auto 0;
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 999px;
  text-decoration: none;
  transition: background 0.15s ease;
}

.record-again svg {
  width: 1.3rem;
  height: 1.3rem;
}

.record-again:hover {
  background: var(--card);
}
