:root {
  --bg: #f6f7f9;
  --card: #fff;
  --text: #1c2127;
  --muted: #5b6672;
  --accent: #0b6b60;
  --link: #0b6b60;
  --line: #dfe3e8;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #111418; --card: #1a1f25; --text: #e8ecf0; --muted: #9aa5b1; --line: #2c333b; --accent: #0b6b60; --link: #4fd1bd; }
}
* { box-sizing: border-box; }
/* A display rule like #results { display: flex } would otherwise beat the hidden attribute. */
[hidden] { display: none !important; }
body {
  margin: 0; font: 16px/1.5 system-ui, sans-serif; background: var(--bg); color: var(--text);
}
header, main, footer { max-width: 720px; margin: 0 auto; padding: 0 16px; }
/* Title and language buttons share a line when they fit; on narrow screens the buttons wrap under the title. */
header { display: flex; flex-wrap: wrap; align-items: center; column-gap: 16px; padding-top: 24px; }
h1 { flex: 1 1 auto; margin: 0 0 4px; }
header p { order: 2; flex-basis: 100%; color: var(--muted); margin: 0 0 16px; }
.lang { order: 1; display: flex; gap: 4px; margin-bottom: 4px; }
.lang button[aria-pressed="true"] { background: var(--accent); color: #fff; border-color: var(--accent); }
section { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 16px; margin-bottom: 16px; }
h2 { margin: 0 0 12px; font-size: 1.1rem; }
h3 { font-size: 1rem; margin: 16px 0 4px; }
.row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin: 12px 0; }
.file { display: flex; flex-direction: column; gap: 6px; }
.or { color: var(--muted); margin: 8px 0; }
.hint { color: var(--muted); font-size: .9rem; }
input[type="number"] { width: 6em; }
button, .lang button {
  font: inherit; padding: 8px 14px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--text); cursor: pointer;
}
button:disabled { opacity: .5; cursor: default; }
button.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.recording { background: #c62828; border-color: #c62828; color: #fff; }
canvas {
  display: block; width: 100%; max-width: 320px; aspect-ratio: 1; margin-top: 8px; border-radius: 8px;
  background: repeating-conic-gradient(#ccc 0 25%, #fff 0 50%) 0 0 / 20px 20px;
}
#results { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; margin-top: 12px; }
#results a { color: var(--link); }
#message { min-height: 1.5em; }
footer { color: var(--muted); font-size: .9rem; padding-bottom: 32px; }
footer a { color: var(--link); }
