#tuner {
  width: min(560px, calc(100% - 24px)); max-height: calc(100dvh - 24px);
  margin: auto; padding: 24px; border: 1px solid #c7cecb; border-radius: 8px;
  color: #22282a; background: #fff; overflow-y: auto;
}
#tuner::backdrop { background: #18262099; }
.tuner-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.tuner-head h2 { margin: 0 0 5px; font-size: 22px; }
.tuner-head span, #tuner-target { color: #66736c; font-size: 13px; }
.tuner-strings { border: 0; margin: 24px 0 12px; padding: 0; display: grid; grid-template-columns: repeat(5,minmax(0,1fr)); gap: 6px; }
.tuner-strings legend { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.tuner-strings label { position: relative; display: block; min-width: 0; cursor: pointer; }
.tuner-strings input { position: absolute; opacity: 0; inset: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; }
.tuner-strings span { border: 1px solid #c7cecb; border-radius: 5px; height: 62px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 5px; font-size: 20px; }
.tuner-strings small { font-size: 10px; white-space: nowrap; }
.tuner-strings input:checked + span { background: #e7f0ec; border-color: #245d50; color: #245d50; }
.tuner-strings input:focus-visible + span { outline: 3px solid #be6b30; outline-offset: 2px; }
.tuner-strings .detected span { box-shadow: inset 0 -3px #245d50; }
#tuner-target { text-align: center; min-height: 18px; }
.tuner-reading { display: flex; align-items: baseline; justify-content: center; gap: 18px; height: 100px; padding-top: 22px; font-variant-numeric: tabular-nums; }
#tuner-note { font-size: 44px; font-weight: 600; min-width: 76px; text-align: center; }
#tuner-frequency { font-size: 19px; min-width: 110px; color: #536059; }
.tuner-scale { display: flex; justify-content: space-between; padding: 0 3%; font-size: 12px; color: #66736c; font-variant-numeric: tabular-nums; }
.tuner-rail { position: relative; height: 48px; margin: 7px 0; }
.tuner-rail::before { content: ''; position: absolute; left: 5%; right: 5%; top: 23px; height: 2px; background: #bbc9c3; }
.tuner-center { position: absolute; left: 47.3%; width: 5.4%; top: 6px; height: 36px; background: #e2efea; border-left: 1px solid #9cc4b3; border-right: 1px solid #9cc4b3; }
.tuner-center::after { content: ''; position: absolute; left: 50%; top: -6px; height: 48px; width: 1px; background: #638778; }
#tuner-needle { position: absolute; left: 50%; top: 0; height: 48px; width: 3px; transform: translateX(-50%); background: #a96b25; transition: left 90ms linear; }
#tuner-needle::before { content: ''; position: absolute; top: -3px; left: -4px; border-left: 5px solid transparent; border-right: 5px solid transparent; border-top: 7px solid #a96b25; }
.tuner-verdict { display: flex; justify-content: space-between; align-items: baseline; min-height: 36px; font-variant-numeric: tabular-nums; }
#tuner-direction { color: #98601f; font-size: 20px; }
[data-tuning='in'] #tuner-needle { background: #245d50; }
[data-tuning='in'] #tuner-needle::before { border-top-color: #245d50; }
[data-tuning='in'] #tuner-direction { color: #245d50; }
.tuner-input-row { border-top: 1px solid #e0e5e2; padding-top: 18px; margin-top: 12px; }
.tuner-input-row label { display: grid; grid-template-columns: auto minmax(0,1fr); gap: 12px; }
.tuner-input-row select { width: 100%; }
.tuner-bottom { display: grid; grid-template-columns: 44px minmax(0,1fr) 60px; align-items: center; gap: 12px; margin-top: 16px; }
#tuner-mic.listening { background: #8c3c35; border-color: #8c3c35; }
#tuner-mic span:not([hidden]) { display: flex; }
#tuner-status { font-size: 13px; color: #536059; }
#tuner-level { width: 60px; height: 10px; accent-color: #245d50; }
#tuner-error { color: #843b19; font-size: 13px; line-height: 1.5; margin: 12px 0 0; }
#tuner-error:empty { display: none; }
@media (max-width:480px) {
  #tuner { padding: 18px 14px; }
  .tuner-strings { gap: 4px; }
  .tuner-strings span { font-size: 18px; }
  .tuner-strings small { font-size: 9px; }
  .tuner-input-row label { grid-template-columns: minmax(0,1fr); gap: 6px; }
}
@media (prefers-reduced-motion:reduce) { #tuner-needle { transition: none; } }
@media (max-height:640px) {
  .tuner-strings { margin-top: 16px; }
  .tuner-reading { height: 78px; padding-top: 12px; }
}
