/* MicPeek - minimalist monochrome. Tokens: light by default, dark via system preference or [data-theme]. */
:root {
  --bg: #fbfbfa; --ink: #141414; --muted: #6b6b6b; --rule: #e6e6e3; --wave-rest: #8f8f8a;
  --ok: #1f6b36; --warn: #8a5a00; --bad: #b3261e;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #111111; --ink: #f2f2f0; --muted: #9a9a96; --rule: #2a2a2a; --wave-rest: #6a6a66;
    --ok: #6fcf8a; --warn: #e0a93b; --bad: #ff8a80;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #111111; --ink: #f2f2f0; --muted: #9a9a96; --rule: #2a2a2a; --wave-rest: #6a6a66;
  --ok: #6fcf8a; --warn: #e0a93b; --bad: #ff8a80;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.wrap { max-width: 560px; margin: 0 auto; padding: 0 16px; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 3px; }
button, select, summary, a { -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.textlink { color: var(--muted); font-size: .9rem; text-decoration: underline; text-underline-offset: 3px; }
.textlink:hover { color: var(--ink); }

/* Header: one row (brand, tabs, language flag, theme toggle) with a hairline bottom border */
.site-header { border-bottom: 1px solid var(--rule); }
.head-inner { display: flex; align-items: stretch; gap: 14px; min-height: 52px; }
.brand { display: inline-flex; align-items: center; gap: 8px; align-self: center; color: var(--ink); text-decoration: none; font-weight: 650; letter-spacing: -.02em; font-size: 1.1rem; min-height: 32px; flex: none; }
.brand-mark { display: block; flex: none; }
.tabs { display: flex; align-self: stretch; gap: 2px; min-width: 0; }
.tabs a {
  display: flex; align-items: center; padding: 0 8px; min-height: 32px; color: var(--muted); text-decoration: none; font-size: .95rem;
  border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tabs a:hover { color: var(--ink); }
.tabs a[aria-current="page"] { color: var(--ink); font-weight: 600; border-bottom-color: var(--ink); }
.head-tools { display: flex; align-items: center; gap: 2px; flex: none; margin-left: auto; }
.lang { display: flex; gap: 2px; }
.flag, .icon-btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  min-width: 32px; min-height: 32px; border-radius: 6px; color: var(--ink); text-decoration: none; line-height: 0;
}
.icon-btn { background: none; border: 0; padding: 0; }
.flag-svg { display: block; width: 28px; height: 20px; }
a.flag { opacity: .75; }
a.flag:hover, a.flag:focus-visible { opacity: 1; }
.flag[aria-current]::after { content: ''; position: absolute; left: 4px; right: 4px; bottom: 0; height: 2px; border-radius: 1px; background: var(--ink); }
@media (max-width: 359px) {
  .brand-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .head-inner { gap: 8px; }
  .tabs a { padding: 0 6px; }
}

/* Page title */
.page-head { padding: 28px 0 0; }
.page-head h1 { margin: 0; font-size: 1.5rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
.page-head .sub { margin: 6px 0 0; color: var(--muted); font-size: .95rem; }

/* Errors: plain text with a red rule */
.error { border-left: 2px solid var(--bad); padding: 4px 0 4px 12px; margin: 16px 0 0; }

/* Hero: one round button with a level ring */
.hero { text-align: center; margin: 40px 0 28px; }
.ring-wrap { position: relative; width: 168px; height: 168px; margin: 0 auto; }
.ring {
  --lvl: 0; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(var(--ink) calc(var(--lvl) * 1turn), var(--rule) 0);
}
.main-btn {
  position: absolute; inset: 9px; width: 150px; height: 150px; border-radius: 50%; border: 0;
  background: var(--ink); color: var(--bg); font-weight: 600; font-size: 1rem; line-height: 1.25; padding: 0 14px;
}
.main-btn:focus-visible { outline-offset: 13px; }
.main-btn:disabled { opacity: .4; cursor: not-allowed; }
.hint { margin: 18px 0 0; color: var(--muted); font-size: .9rem; min-height: 1.4em; }
@media (max-width: 379px) {
  .ring-wrap { width: 148px; height: 148px; }
  .main-btn { inset: 8px; width: 132px; height: 132px; }
}

/* Quiet controls: underlined inline selects */
.quiet { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 4px 12px; font-size: .9rem; color: var(--muted); }
.uline { position: relative; display: inline-block; max-width: 100%; }
.uline::after { content: "▾"; position: absolute; right: 2px; top: 50%; transform: translateY(-50%); pointer-events: none; color: var(--muted); font-size: .8em; }
.uline select {
  -webkit-appearance: none; appearance: none; background: transparent; color: var(--ink);
  border: 0; border-bottom: 1px solid var(--muted); border-radius: 0; padding: 4px 18px 4px 0; min-height: 32px;
  font: inherit; max-width: 100%; text-overflow: ellipsis; cursor: pointer;
}
.uline select:disabled { opacity: .45; cursor: not-allowed; }

/* Result */
.result { margin-top: 36px; border-top: 1px solid var(--rule); padding-top: 20px; }
.player { display: flex; align-items: center; gap: 12px; }
.play {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--ink); background: none; flex: none;
  display: inline-grid; place-items: center; padding: 0;
}
.play .i-pause, .play[data-playing="true"] .i-play { display: none; }
.play[data-playing="true"] .i-pause { display: block; }
.wave { flex: 1; min-width: 0; width: 100%; height: 48px; display: block; cursor: pointer; touch-action: none; }
.verdict { margin: 12px 0 8px; font-size: .95rem; }
.verdict b { font-weight: 600; }
.v-good { color: var(--ok); } .v-quiet { color: var(--warn); } .v-clip, .v-silent { color: var(--bad); } .v-none { color: var(--muted); }

/* Takes */
.takes-sec { margin-top: 24px; }
.takes { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--rule); }
.takes li { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--rule); }
.take-n { font-variant-numeric: tabular-nums; color: var(--muted); font-size: .85rem; }
.take-main { min-width: 0; }
.take-mic { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .95rem; }
.take-sub { display: block; font-size: .85rem; color: var(--muted); }
.take-sub .textlink { font-size: inherit; }
.take-res { font-weight: 600; }

/* More options */
.more { margin-top: 28px; }
.more summary { display: inline-block; cursor: pointer; list-style: none; color: var(--muted); font-size: .9rem; text-decoration: underline; text-underline-offset: 3px; min-height: 32px; line-height: 32px; }
.more summary::-webkit-details-marker { display: none; }
.more summary:hover { color: var(--ink); }
.opts { margin-top: 8px; border-top: 1px solid var(--rule); }
.opt { padding: 12px 0; border-bottom: 1px solid var(--rule); display: flex; flex-direction: column; gap: 6px; align-items: flex-start; }
.opt[hidden], .opts [hidden] { display: none; }
p.opt { margin: 0; }
.check { display: flex; gap: 10px; align-items: flex-start; cursor: pointer; }
.check input { margin-top: 4px; accent-color: var(--ink); width: 16px; height: 16px; flex: none; }
.check:has(input:disabled) { opacity: .45; cursor: not-allowed; }
.opt-name { display: block; font-size: .95rem; }
.opt-desc { display: block; color: var(--muted); font-size: .85rem; }
.warn { margin: 0; border-left: 2px solid var(--warn); padding-left: 10px; font-size: .85rem; }
#infoList { display: grid; grid-template-columns: max-content 1fr; gap: 2px 14px; margin: 0; font-size: .85rem; width: 100%; }
#infoList dt { color: var(--muted); }
#infoList dd { margin: 0; word-break: break-word; }

/* Content below the tool */
.content { margin-top: 56px; }
.content h2 { font-size: 1.2rem; margin: 40px 0 10px; padding-top: 24px; border-top: 1px solid var(--rule); letter-spacing: -.01em; }
.content section:first-child h2 { margin-top: 0; }
.content h3 { font-size: 1rem; margin: 20px 0 2px; }
.content p, .content li { max-width: 64ch; }
.content p { margin: 6px 0 10px; }
.content ol { padding-left: 1.3em; }
.content li { margin-bottom: 8px; }
details.faq { border-bottom: 1px solid var(--rule); padding: 12px 0; }
.content details.faq:first-of-type { border-top: 1px solid var(--rule); }
details.faq summary { cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; gap: 12px; }
details.faq summary::-webkit-details-marker { display: none; }
details.faq summary::after { content: "+"; font-weight: 400; color: var(--muted); }
details.faq[open] summary::after { content: "\2212"; }
details.faq p { margin: 8px 0 0; color: var(--muted); }
.site-footer { border-top: 1px solid var(--rule); margin-top: 48px; color: var(--muted); font-size: .85rem; }
.site-footer .wrap { padding-top: 16px; padding-bottom: 32px; }
.site-footer p { margin: 0; }
.icon-btn svg[hidden] { display: none; }

/* Link-like buttons and the noise check / read-aloud lines */
.linklike { background: none; border: 0; padding: 0; color: var(--muted); font-size: .9rem; text-decoration: underline; text-underline-offset: 3px; min-height: 32px; }
.linklike:hover { color: var(--ink); }
.linklike:disabled { opacity: .45; cursor: not-allowed; }
.noise { text-align: center; margin-top: 8px; }
.noise .verdict { margin: 6px 0 4px; }
.noise .note { margin: 4px 0; font-size: .85rem; color: var(--muted); }
.noise [hidden] { display: none; }
.read { margin: 12px 0 14px; font-size: .95rem; color: var(--muted); text-align: center; }
.read em { color: var(--ink); font-style: italic; }
.read .linklike { margin-left: 4px; }

/* Speaker test */
.pill-row { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pill { min-height: 40px; padding: 6px 18px; border: 1px solid var(--muted); border-radius: 3px; background: none; font-size: .95rem; }
.pill:hover:not(:disabled) { border-color: var(--ink); background: var(--rule); }
.pill:disabled { opacity: .45; cursor: not-allowed; }
.lr { display: flex; justify-content: center; gap: 56px; margin: 40px 0 16px; }
.lr span { font-size: 4.5rem; font-weight: 650; letter-spacing: -.03em; line-height: 1; color: var(--wave-rest); transition: color .12s; }
.lr span.on { color: var(--ink); }
.sp-block { margin-top: 36px; border-top: 1px solid var(--rule); padding-top: 20px; text-align: center; }
.sp-block h2 { margin: 0 0 12px; font-size: 1rem; }
.sp-hint { margin: 12px 0 0; color: var(--muted); font-size: .9rem; }
.freq { font-size: 2rem; font-variant-numeric: tabular-nums; margin: 18px 0 8px; font-weight: 500; }
.sweep-line { height: 2px; background: var(--rule); margin: 0 auto 16px; max-width: 360px; }
.sweep-line span { display: block; height: 100%; width: 0; background: var(--ink); }
.vol { margin-top: 28px; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.vol label { font-size: .9rem; color: var(--muted); }
.vol input[type=range] { width: min(100%, 320px); accent-color: var(--ink); }
.vol .warn { text-align: left; }
.sp-output { margin-top: 24px; display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap; font-size: .9rem; color: var(--muted); }
.content a { color: var(--ink); text-underline-offset: 3px; }
.site-footer a { color: var(--muted); text-underline-offset: 3px; }
.site-footer p + p { margin-top: 6px; }
