:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #f7f7f6;
  --surface-strong: #eeeeec;
  --text: #171716;
  --muted: #62625f;
  --border: #d9d9d5;
  --border-strong: #a7a7a1;
  --button: #1c1c1b;
  --button-text: #ffffff;
  --meter: #247449;
  --meter-quiet: #657261;
  --warning: #946200;
  --error: #a32b25;
  --focus: #1769aa;
  --measure: 72rem;
  --copy: 43rem;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #111111;
  --surface: #191918;
  --surface-strong: #242423;
  --text: #f2f2ef;
  --muted: #adada7;
  --border: #3c3c39;
  --border-strong: #666660;
  --button: #f0f0ec;
  --button-text: #151514;
  --meter: #70bd8d;
  --meter-quiet: #95a492;
  --warning: #d8a84f;
  --error: #ed8079;
  --focus: #75baff;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-underline-offset: .2em; }
a:hover { text-decoration-thickness: 2px; }
button, select { font: inherit; }
button, select, audio { max-width: 100%; }
button, select { min-height: 44px; }
button {
  border: 1px solid var(--button);
  border-radius: .2rem;
  background: var(--button);
  color: var(--button-text);
  cursor: pointer;
  font-weight: 650;
  padding: .65rem 1rem;
}
button:hover { opacity: .86; }
button:disabled { cursor: wait; opacity: .58; }
button.secondary {
  background: transparent;
  border-color: var(--border-strong);
  color: var(--text);
}
button.text-button {
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: .25rem .4rem;
  font-size: .9rem;
  font-weight: 550;
}
:focus-visible { outline: 3px solid var(--focus); outline-offset: 3px; }
[hidden] { display: none !important; }

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 10;
  transform: translateY(-200%);
  background: var(--button);
  color: var(--button-text);
  padding: .5rem .8rem;
}
.skip-link:focus { transform: translateY(0); }
.site-header {
  border-bottom: 1px solid var(--border);
}
.header-inner,
.footer-inner,
.page-shell {
  width: min(calc(100% - 2rem), var(--measure));
  margin-inline: auto;
}
.header-inner {
  min-height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.wordmark { font-weight: 720; text-decoration: none; letter-spacing: -.015em; }
.page-shell { padding-block: 3.25rem 5rem; }
.hero { max-width: 47rem; }
.home-shell {
  width: min(calc(100% - 2rem), 45rem);
  padding-top: 2.5rem;
}
.home-shell .hero { max-width: none; }
.home-shell .hero > h1,
.home-shell .hero > .lede,
.home-shell .hero > .privacy-note { text-align: center; margin-inline: auto; }
h1, h2, h3 { line-height: 1.16; letter-spacing: -.025em; text-wrap: balance; }
h1 { font-size: clamp(2rem, 5vw, 3.25rem); margin: 0 0 .7rem; }
h2 { font-size: clamp(1.5rem, 3vw, 2rem); margin: 0 0 1rem; }
h3 { font-size: 1.08rem; margin: 0 0 .35rem; letter-spacing: -.01em; }
p { margin: 0 0 1rem; }
.lede { color: var(--muted); font-size: clamp(1.05rem, 2vw, 1.18rem); max-width: 44rem; }
.privacy-note { color: var(--muted); font-size: .92rem; }

.tester {
  margin-top: 1.8rem;
  border: 1px solid var(--border-strong);
  border-radius: .35rem;
  overflow: hidden;
}
.tester-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  padding: .65rem 1rem;
  font-size: .85rem;
  color: var(--muted);
}
.permission-state { display: inline-flex; align-items: center; gap: .45rem; }
.permission-state::before {
  content: "";
  width: .55rem;
  height: .55rem;
  border: 1px solid currentColor;
  border-radius: 50%;
  background: transparent;
}
.tester-body { padding: clamp(1.15rem, 4vw, 2rem); }
.home-shell .tester-body { min-height: 12rem; }
.home-shell #start-test,
.home-shell #retry-test { display: block; margin-inline: auto; }
.home-shell .tester .status {
  border-left: 0;
  padding-left: 0;
  text-align: center;
  margin-block: .45rem 1.25rem;
}
.home-shell .tester .control-row { justify-content: center; }
.control-row { display: flex; gap: .65rem; flex-wrap: wrap; align-items: center; }
.field { margin-bottom: 1.35rem; }
.field label { display: block; margin-bottom: .35rem; font-size: .9rem; font-weight: 650; }
select {
  width: min(100%, 34rem);
  border: 1px solid var(--border-strong);
  border-radius: .2rem;
  background: var(--bg);
  color: var(--text);
  padding: .55rem .75rem;
}
.meter-header { display: flex; justify-content: space-between; gap: 1rem; font-size: .9rem; font-weight: 650; }
.meter-track {
  position: relative;
  height: 2.2rem;
  margin: .45rem 0 1rem;
  border: 1px solid var(--border-strong);
  border-radius: .15rem;
  overflow: hidden;
  background-color: var(--surface-strong);
  background-image: repeating-linear-gradient(90deg, transparent 0, transparent calc(5% - 2px), var(--bg) calc(5% - 2px), var(--bg) 5%);
}
.meter-fill {
  position: absolute;
  inset: 0 auto 0 0;
  width: 0;
  background: var(--meter);
  transition: width 70ms linear;
}
.status { border-left: 3px solid var(--border-strong); padding-left: 1rem; margin: 1.2rem 0 1.5rem; }
.status[data-tone="success"] { border-color: var(--meter); }
.status[data-tone="warning"] { border-color: var(--warning); }
.status[data-tone="error"] { border-color: var(--error); }
.status strong { display: block; margin-bottom: .12rem; font-size: 1.05rem; }
.status p { color: var(--muted); margin: 0; }
.error-help { background: var(--surface); border: 1px solid var(--border); padding: 1rem 1rem .1rem; margin-bottom: 1rem; }
.error-help ol { padding-left: 1.3rem; }
.recording-panel {
  margin-top: 1.6rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border);
}
.recording-panel h3 { margin-bottom: .25rem; }
.recording-panel audio { display: block; width: min(100%, 30rem); margin: 1rem 0; }
.recording-time { color: var(--error); font-variant-numeric: tabular-nums; font-weight: 650; }
details.tech-details { margin-top: 1.4rem; border-top: 1px solid var(--border); padding-top: 1rem; }
details summary { cursor: pointer; font-weight: 650; }
.detail-list { margin: .8rem 0 0; }
.detail-list div { display: grid; grid-template-columns: minmax(8rem, 1fr) 2fr; gap: 1rem; border-top: 1px solid var(--border); padding: .4rem 0; }
.detail-list dt { color: var(--muted); }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.ad-slot[hidden] { display: none; }

.content-section { border-top: 1px solid var(--border); margin-top: 4.5rem; padding-top: 2.8rem; }
.home-shell .content-section {
  border-top: 0;
  margin-top: 2.75rem;
  padding-top: 0;
}
.home-shell .content-section + .content-section { margin-top: 1.8rem; }
.home-shell .content-section h2 { font-size: 1.35rem; margin-bottom: .75rem; }
.home-shell .copy-grid { gap: 1.35rem 2.5rem; }
.home-shell .copy-grid h3 { font-size: .95rem; }
.home-shell .copy-grid p { font-size: .9rem; line-height: 1.5; margin-bottom: 0; }
.home-shell .faq-list { max-width: none; }
.home-shell .faq-list details { padding: .62rem 0; font-size: .92rem; }
.copy-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 2.2rem 4rem; }
.copy-grid p, .faq-list p { color: var(--muted); }
.steps { counter-reset: steps; list-style: none; padding: 0; margin: 1.5rem 0 0; max-width: var(--copy); }
.steps li { counter-increment: steps; display: grid; grid-template-columns: 2rem 1fr; gap: .7rem; margin-bottom: .7rem; }
.steps li::before { content: counter(steps); font-weight: 700; font-variant-numeric: tabular-nums; }
.faq-list { max-width: var(--copy); }
.faq-list details { border-top: 1px solid var(--border); padding: .9rem 0; }
.faq-list details:last-child { border-bottom: 1px solid var(--border); }
.faq-list summary { padding-right: 2rem; }
.faq-list p { margin: .65rem 0 .2rem; }

.article { max-width: var(--copy); }
.article h1 { margin-bottom: .5rem; }
.article h2 { font-size: 1.35rem; margin-top: 2.6rem; }
.article h3 { margin-top: 1.6rem; }
.article p, .article li { color: var(--muted); }
.article strong { color: var(--text); }
.notice { border: 1px solid var(--warning); padding: 1rem; margin: 1.5rem 0; }
.site-footer { border-top: 1px solid var(--border); }
.footer-inner { display: flex; justify-content: space-between; align-items: flex-start; gap: 2rem; padding-block: 1.5rem 2rem; color: var(--muted); font-size: .88rem; }
.footer-nav { display: flex; gap: .5rem 1.2rem; flex-wrap: wrap; justify-content: flex-end; }

@media (max-width: 44rem) {
  .page-shell { padding-top: 2.2rem; }
  .copy-grid { grid-template-columns: 1fr; gap: 1.2rem; }
  .footer-inner { flex-direction: column; }
  .footer-nav { justify-content: flex-start; }
  .detail-list div { grid-template-columns: 1fr; gap: 0; }
  .control-row button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .meter-fill { transition: none; }
}

@media print {
  .site-header, .site-footer, .tester { display: none; }
  .page-shell { width: 100%; padding: 0; }
}
