:root {
  --bg: #f7f7f8;
  --card: #ffffff;
  --text: #1c1c21;
  --muted: #5d5d6b;
  --border: #e2e2e8;
  --accent: #4f46e5;
  --accent-text: #ffffff;
  --bar: #e8e7fb;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #111114;
    --card: #1b1b20;
    --text: #ececf1;
    --muted: #a0a0ad;
    --border: #2c2c34;
    --accent: #818cf8;
    --accent-text: #111114;
    --bar: #2a2a45;
    color-scheme: dark;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", sans-serif;
}

main {
  max-width: 40rem;
  margin: 0 auto;
  padding: 2.5rem 1rem 3rem;
}

h1 {
  font-size: 1.75rem;
  line-height: 1.2;
  margin: 0 0 0.5rem;
}

h2 {
  font-size: 1.05rem;
  margin: 0 0 0.75rem;
}

.lead,
.note,
footer,
#status {
  color: var(--muted);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  margin-top: 1.25rem;
}

.actions,
.examples {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin: 0.75rem 0;
}

.examples span {
  color: var(--muted);
  font-size: 0.9rem;
}

button,
.file span {
  font: inherit;
  border: 1px solid var(--border);
  background: var(--card);
  color: var(--text);
  border-radius: 8px;
  padding: 0.45rem 0.85rem;
  cursor: pointer;
}

#record {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-text);
  font-weight: 600;
}

button:disabled,
input:disabled + span {
  opacity: 0.5;
  cursor: default;
}

.file input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.file input:focus-visible + span,
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

audio {
  width: 100%;
  margin-top: 0.5rem;
}

#results {
  list-style: none;
  padding: 0;
  margin: 1rem 0 0;
}

#results li {
  display: grid;
  grid-template-columns: 6rem 1fr 3.5rem;
  gap: 0.75rem;
  align-items: center;
  padding: 0.3rem 0;
}

#results li:first-child .label {
  font-weight: 700;
}

.bar {
  height: 0.6rem;
  background: var(--bar);
  border-radius: 999px;
  overflow: hidden;
}

.bar span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.score {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.words {
  margin: 0;
}

footer {
  margin-top: 2rem;
  font-size: 0.85rem;
}

a {
  color: var(--accent);
}
