:root {
  color-scheme: dark;
  --night: #091610;
  --deep: #10251a;
  --moss: #b5c5a8;
  --light: #f1f0e5;
  --sun: #dfaf6e;
  --leaf: #9fd8a6;
  --line: rgba(181, 197, 168, .28);
  --gutter: clamp(16px, 4vw, 64px);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

body {
  margin: 0;
  background: var(--night);
  color: var(--light);
  font: 400 1rem/1.55 "DM Sans", sans-serif;
}

a { color: inherit; }
a:focus-visible,
button:focus-visible,
input:focus-visible + span { outline: 3px solid var(--sun); outline-offset: 3px; }

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
}

/* Header */
.bar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 0 16px;
  padding: 14px var(--gutter);
}
.brand {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  font-size: 1.1rem;
  font-weight: 700;
  letter-spacing: -.02em;
  text-decoration: none;
  white-space: nowrap;
}
.bar nav { display: flex; gap: clamp(12px, 2vw, 28px); font-size: .9rem; }
.bar nav a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration: none;
  border-bottom: 1px solid transparent;
}
.bar nav a:hover,
.bar nav a[aria-current] { border-color: currentColor; }

/* Page layout: single column, then notes beside the tuner */
.page {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 24px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 10px var(--gutter) 48px;
}
.intro h1 {
  margin: 0 0 8px;
  font: 400 clamp(3.4rem, 9vw, 6.4rem)/.95 Newsreader, Georgia, serif;
  letter-spacing: -.05em;
}
.intro p { max-width: 460px; margin: 0; color: var(--moss); font-size: 1.05rem; }

/* Tuner panel */
.tuner {
  min-width: 0;
  padding: clamp(16px, 3vw, 28px);
  background: var(--deep);
  border: 1px solid var(--line);
  border-radius: 3px;
}

.instrument { display: flex; flex-wrap: wrap; gap: 8px; margin: 0; padding: 0; border: 0; }
.instrument legend {
  padding: 0;
  margin-bottom: 8px;
  color: var(--sun);
  font: 600 .74rem/1.2 "DM Sans", sans-serif;
  letter-spacing: .08em;
  text-transform: uppercase;
}
.instrument label { flex: 1 1 130px; cursor: pointer; }
.instrument input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.instrument span {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--moss);
  font-size: .9rem;
  text-align: center;
}
.instrument input:checked + span {
  border-color: var(--light);
  color: var(--light);
  background: rgba(241, 240, 229, .08);
  font-weight: 600;
}

.topline {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 18px;
  color: var(--moss);
  font-size: .84rem;
}
.mic { display: inline-flex; align-items: center; gap: 8px; }
.dot { width: 8px; height: 8px; border: 1px solid var(--moss); border-radius: 50%; }
.mic.live { color: var(--light); }
.mic.live .dot { border-color: var(--sun); background: var(--sun); }

.readout { padding-top: 8px; text-align: center; }
.target { display: flex; justify-content: center; align-items: baseline; gap: 14px; margin: 0; }
.note {
  font: 400 clamp(4.6rem, 15vw, 6.6rem)/1.05 Newsreader, Georgia, serif;
  letter-spacing: -.04em;
}
.note sub { font-size: .36em; letter-spacing: 0; color: var(--moss); vertical-align: baseline; }
.target-hz { color: var(--moss); font-size: .95rem; font-variant-numeric: tabular-nums; }

.meter { position: relative; height: 54px; margin-top: 6px; border-bottom: 1px solid var(--moss); }
.zone {
  position: absolute;
  left: 45%;
  width: 10%;
  top: 6px;
  bottom: 0;
  background: rgba(159, 216, 166, .16);
}
.centre { position: absolute; left: 50%; top: 2px; bottom: 0; width: 1px; background: var(--light); }
.needle {
  position: absolute;
  left: 50%;
  top: 10px;
  bottom: 0;
  width: 3px;
  margin-left: -1.5px;
  background: var(--sun);
  opacity: .22;
  transition: left .12s linear;
}
.ends {
  display: flex;
  justify-content: space-between;
  padding-top: 6px;
  color: var(--moss);
  font-size: .76rem;
}

.advice {
  min-height: 1.2em;
  margin: 14px 0 2px;
  font: 400 clamp(1.7rem, 4.6vw, 2.3rem)/1.15 Newsreader, Georgia, serif;
  letter-spacing: -.02em;
}
.detail { min-height: 3.1em; margin: 0; color: var(--moss); font-size: .95rem; font-variant-numeric: tabular-nums; }

.readout.heard .needle { opacity: 1; }
.readout.good .note,
.readout.good .advice { color: var(--leaf); }
.readout.good .needle { background: var(--leaf); }

/* Strings */
.strings { display: grid; grid-template-columns: repeat(var(--count, 4), minmax(0, 1fr)); gap: 8px; margin-top: 10px; }
.string {
  position: relative;
  min-height: 62px;
  padding: 8px 2px;
  border: 1px solid var(--line);
  border-radius: 2px;
  background: transparent;
  color: var(--light);
  font: inherit;
  cursor: pointer;
  touch-action: manipulation;
}
.string strong { display: block; font: 400 1.5rem/1.1 Newsreader, Georgia, serif; }
.string strong sub { font-size: .6em; color: var(--moss); vertical-align: baseline; }
.string small { display: block; color: var(--moss); font-size: .72rem; font-variant-numeric: tabular-nums; }
.string[aria-pressed="true"] { border-color: var(--sun); background: rgba(223, 175, 110, .13); }
.string .tick { position: absolute; top: 4px; right: 6px; color: var(--leaf); font-size: .78rem; }

.done { margin: 14px 0 0; color: var(--leaf); }

.actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
.actions button {
  min-height: 50px;
  padding: 11px 18px;
  border-radius: 2px;
  font: 600 1rem/1.2 "DM Sans", sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}
.primary { flex: 2 1 190px; border: 1px solid var(--sun); background: var(--sun); color: var(--night); font-weight: 700; }
.primary.on { background: transparent; color: var(--light); }
.secondary { flex: 1 1 120px; border: 1px solid var(--moss); background: transparent; color: var(--light); }
.secondary:disabled { opacity: .5; cursor: default; }

/* Notes */
.notes { max-width: 560px; color: var(--moss); }
.notes h2 {
  margin: 0 0 8px;
  color: var(--light);
  font: 400 1.6rem/1.1 Newsreader, Georgia, serif;
  letter-spacing: -.02em;
}
.notes ul { margin: 0 0 24px; padding-left: 18px; }
.notes li { margin-bottom: 6px; }
.notes p { margin: 0 0 12px; }
.onward { color: var(--light); }
.onward a { color: var(--sun); text-underline-offset: 4px; white-space: nowrap; }

.foot {
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 4px 20px;
  padding: 12px var(--gutter);
  color: var(--moss);
  font-size: .8rem;
}
.foot a {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  text-decoration-color: rgba(181, 197, 168, .5);
  text-underline-offset: 4px;
}

@media (min-width: 900px) {
  .page {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.25fr);
    grid-template-areas: "intro tuner" "notes tuner";
    grid-template-rows: auto 1fr;
    gap: 30px clamp(32px, 5vw, 80px);
  }
  .intro { grid-area: intro; }
  .tuner { grid-area: tuner; align-self: start; }
  .notes { grid-area: notes; }
}

@media (max-width: 480px) {
  .strings.six { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .needle { transition: none; }
}
