:root {
  color-scheme: dark;
  --bg: #161819;
  --panel: #202324;
  --field: #191c1d;
  --line: #454a4b;
  --text: #eeefeb;
  --muted: #abb0af;
  --accent: #a4d6b3;
  --accent-bg: #293e31;
  --button-text: #16281d;
  --error: #f1ae9c;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f4f3ef;
  --panel: #ffffff;
  --field: #f6f6f2;
  --line: #c8cdc8;
  --text: #202624;
  --muted: #626b66;
  --accent: #24663f;
  --accent-bg: #e6f1e8;
  --button-text: #ffffff;
  --error: #a33722;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--text); }
main { max-width: 1020px; margin: auto; padding: 38px 32px; }
header, .panel-top, .string-heading, .saved-head, .dialog-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
header { margin-bottom: 28px; }
h1 { font-size: 27px; font-weight: 650; letter-spacing: -.7px; margin: 0; }
.subtitle { margin: 5px 0 0; font-size: 13px; color: var(--muted); }
.theme-control { margin: 0; font-size: 11px; }
.theme-control select { width: 112px; margin-top: 5px; padding: 9px 10px; }
.workspace { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(270px, 1fr); gap: 20px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
.tuner { padding: 24px 28px; text-align: center; }
.panel-top { color: var(--muted); font-size: 11px; }
.panel-top b { color: var(--text); font-weight: 500; }
.status { display: flex; align-items: center; gap: 7px; letter-spacing: .5px; }
.status i { height: 6px; width: 6px; border-radius: 50%; background: var(--muted); }
.status.on i { background: var(--accent); }
.readout { margin-top: 30px; }
.eyebrow { font-size: 10px; color: var(--muted); letter-spacing: 1px; }
#note { font-size: 104px; font-weight: 500; line-height: 1.25; letter-spacing: -4px; }
#note sub { font-size: 30px; letter-spacing: 0; color: var(--muted); }
#hz { color: var(--muted); font-size: 12px; margin: 5px 0 26px; font-variant-numeric: tabular-nums; }
.meter { height: 66px; position: relative; margin: 0 10px; }
.sweetspot { position: absolute; left: 45%; width: 10%; top: 0; height: 34px; background: var(--accent-bg); border-inline: 1px solid var(--accent); }
.ticks { position: relative; height: 32px; background: repeating-linear-gradient(90deg, var(--line) 0, var(--line) 1px, transparent 1px, transparent 5%); border-bottom: 1px solid var(--line); }
#needle { position: absolute; left: 50%; top: -7px; width: 3px; height: 45px; border-radius: 2px; background: var(--muted); transition: left .1s linear; }
#needle.good { background: var(--accent); }
.scale { display: flex; justify-content: space-between; margin-top: 10px; font-size: 11px; color: var(--muted); }
.direction { font-size: 20px; font-weight: 500; margin: 15px 0 6px; }
.direction.good { color: var(--accent); }
.target { font-size: 12px; color: var(--muted); min-height: 18px; margin: 0 0 24px; }
button, input, select { font: inherit; }
button { cursor: pointer; border-radius: 6px; border: 1px solid var(--line); }
button:hover { border-color: var(--accent); }
button:disabled { opacity: .6; cursor: wait; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.primary { background: var(--accent); border-color: var(--accent); color: var(--button-text); font-size: 14px; font-weight: 600; padding: 13px 22px; }
#mic { min-width: 210px; }
.fine { font-size: 12px; color: var(--muted); line-height: 1.6; }
#mic-help { margin: 10px 0 24px; min-height: 19px; }
.string-heading { border-top: 1px solid var(--line); padding-top: 19px; font-size: 10px; letter-spacing: .8px; text-align: left; }
.string-heading small { color: var(--muted); font-size: 9px; margin-left: 10px; }
.pill { background: transparent; color: var(--muted); padding: 8px 14px; font-size: 12px; }
.pill.active { color: var(--accent); background: var(--accent-bg); border-color: var(--accent); }
.strings { display: flex; gap: 7px; margin-top: 14px; }
.string { flex: 1; min-width: 0; background: var(--field); color: var(--text); padding: 12px 2px; }
.string small { display: block; color: var(--muted); font-size: 10px; margin-bottom: 6px; }
.string strong { font-size: 23px; font-weight: 500; }
.string sub { font-size: 11px; color: var(--muted); }
.string.selected { border-color: var(--accent); background: var(--accent-bg); }
.tip { margin: 14px 0 0; }
.settings { padding: 24px; }
h2 { font-size: 17px; font-weight: 600; margin: 0 0 22px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 18px 0 8px; }
select, input { background: var(--field); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 12px; width: 100%; font-size: 14px; }
select { cursor: pointer; }
.notes { font-size: 12px; color: var(--muted); word-spacing: 3px; line-height: 1.6; margin: 12px 0 18px; }
.secondary { background: transparent; color: var(--text); font-size: 13px; width: 100%; padding: 12px; }
.saved-head { margin-top: 25px; border-top: 1px solid var(--line); padding-top: 18px; flex-wrap: wrap; gap: 4px; }
h3 { font-size: 13px; font-weight: 600; margin: 0; }
.saved-head span { font-size: 10px; }
.preset { display: flex; align-items: center; gap: 6px; margin-top: 10px; }
.preset .choose { flex: 1; min-width: 0; overflow-wrap: anywhere; text-align: left; background: var(--field); color: var(--text); padding: 10px; font-size: 13px; }
.preset .choose small { display: block; color: var(--muted); font-size: 11px; margin-top: 4px; }
.delete { background: transparent; color: var(--muted); border: 0; padding: 10px; font-size: 20px; }
.help { font-size: 12px; line-height: 1.7; color: var(--muted); margin: 18px 4px; }
dialog { width: min(480px, calc(100% - 32px)); background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 26px; }
dialog::backdrop { background: #0008; }
.dialog-head h2 { margin: 0; }
.dialog-head button { background: transparent; color: var(--muted); font-size: 24px; border: 0; padding: 4px 10px; }
.note-inputs { display: flex; gap: 6px; }
.note-inputs input { padding: 10px 3px; text-align: center; min-width: 0; margin-top: 6px; font-size: 16px; }
.note-inputs label { margin: 0; font-size: 10px; flex: 1; min-width: 0; text-align: center; }
#form-error { color: var(--error); font-size: 12px; }
#save { width: 100%; }
@media (max-width: 720px) {
  main { padding: 22px 16px; }
  header { margin-bottom: 20px; }
  .workspace { grid-template-columns: 1fr; }
  .tuner { padding: 20px 16px; }
  .settings { padding: 22px; }
  .strings { gap: 5px; }
  #note { font-size: 90px; }
  input, select { font-size: 16px; }
  .theme-control select { font-size: 14px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }
