:root { color-scheme: dark; font-family: system-ui, sans-serif; color: #fff; --blow: #62f5cc; --draw: #7dc8ff; }
#recording-controls { margin-bottom: 16px; }
#record-status { font-size: 13px; }
#record-status.recording { color: #ff6868; font-weight: 800; }
#record-download { color: var(--blow); padding: 9px 12px; }
#recording-preview { position: relative; aspect-ratio: 16 / 9; background: #102029; }
#webcam, #recording-canvas { width: 100%; height: 100%; display: block; }
#webcam { position: absolute; object-fit: cover; }
#recording-canvas { position: relative; }
body.recording-preview:not(.tuner-visible) #overlay-source { position: fixed; left: -10000px; top: 0; width: 400px; }
* { box-sizing: border-box; }
html, body { margin: 0; background: transparent !important; overflow: hidden; }
main { width: min(1160px, 100%); padding: 24px 28px; margin: auto; text-shadow: 0 2px 5px #000, 0 0 3px #000; }
header { display: flex; justify-content: space-between; gap: 12px; font-size: 12px; letter-spacing: 2px; color: #dfebf0; }
header b { color: var(--blow); }
.readout { display: flex; align-items: center; gap: 22px; min-height: 114px; }
#note { font-size: 72px; line-height: 1; letter-spacing: -3px; min-width: 112px; }
#matches { font-size: 23px; font-weight: 750; }
#frequency { font-size: 18px; margin-top: 6px; font-variant-numeric: tabular-nums; }
#cents { color: #d3dfe5; font-size: 14px; }
.harmonica { display: grid; grid-template-columns: 100px repeat(10, minmax(0, 1fr)); grid-template-rows: 30px 62px 62px; gap: 7px; }
.row-label { display: flex; align-items: center; justify-content: space-between; font-size: 13px; font-weight: 800; }
.blow-label { grid-row: 2; color: var(--blow); }
.draw-label { grid-row: 3; color: var(--draw); }
.hole-number { grid-row: 1; text-align: center; font-size: 22px; font-weight: 800; }
.reed { display: grid; place-items: center; border: 1px solid #ffffff65; border-radius: 9px; background: #10202930; font-size: 23px; font-weight: 700; transition: background 70ms, box-shadow 70ms; }
.reed.blow { grid-row: 2; border-bottom: 3px solid #62f5cc90; }
.reed.draw { grid-row: 3; border-bottom: 3px solid #7dc8ff90; }
.reed.active { color: #071e26; text-shadow: none; border-color: white; transform: translateY(-2px); }
.reed.blow.active { background: var(--blow); box-shadow: 0 0 22px #62f5cc80; }
.reed.draw.active { background: var(--draw); box-shadow: 0 0 22px #7dc8ff80; }
#status { font-size: 14px; min-height: 20px; margin: 16px 0 10px; }
summary { cursor: pointer; font-size: 13px; width: fit-content; }
summary span, .hint { color: #d0dbe0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: end; gap: 8px; margin-top: 12px; }
label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; }
button, select { font: inherit; font-size: 13px; border: 1px solid #ffffff55; border-radius: 6px; padding: 9px 12px; background: #12212be6; color: white; }
select { max-width: 270px; }
button { cursor: pointer; }
button:hover { border-color: var(--blow); }
button:disabled { opacity: .45; cursor: default; }
:focus-visible { outline: 2px solid var(--blow); outline-offset: 3px; }
input { accent-color: var(--blow); }
.tests { align-items: center; }
.tests > span { font-size: 11px; letter-spacing: 2px; }
.hint { font-size: 12px; max-width: 900px; }
body.clean #controls, body.clean #status, body.clean #recording-controls { display: none; }
#tab-overlay { margin-top: 14px; }
#tab-title { font-size: 13px; overflow-wrap: anywhere; }
#tab-notes { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; font-size: 24px; }
#tab-notes span { padding: 3px 7px; border-radius: 5px; overflow-wrap: anywhere; max-width: 100%; }
#tab-notes .tab-current { background: var(--blow); color: #071e26; text-shadow: none; font-weight: 800; }
#tab-position { font-size: 11px; margin: 5px 0; }
body:not(.compact) main { max-height: 100dvh; overflow-y: auto; }
body.compact #tab-notes { font-size: 16px; gap: 3px; }
@media (max-width: 760px) {
  main { padding: 16px 12px; }
  header { font-size: 9px; letter-spacing: 1px; }
  .harmonica { grid-template-columns: 65px repeat(10, minmax(0, 1fr)); gap: 3px; grid-template-rows: 26px 48px 48px; }
  .row-label { font-size: 9px; }
  .reed { font-size: 15px; border-radius: 5px; }
  #matches { font-size: 17px; }
  #note { font-size: 58px; min-width: 90px; }
}

/* Optional 400 × 300 overlay: ?compact=1. H reveals scrollable controls. */
body.compact main { width: min(400px, 100%); max-height: min(300px, 100dvh); padding: 10px; overflow: auto; scrollbar-width: thin; }
body.compact header { font-size: 8px; letter-spacing: .6px; gap: 6px; }
body.compact .readout { min-height: 70px; gap: 10px; }
body.compact #note { font-size: 44px; min-width: 65px; letter-spacing: -2px; }
body.compact .readout > div { min-width: 0; }
body.compact #matches { font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
body.compact #frequency { font-size: 13px; margin-top: 3px; }
body.compact #cents { font-size: 10px; }
body.compact .harmonica { grid-template-columns: 48px repeat(10, minmax(0, 1fr)); grid-template-rows: 22px 36px 36px; gap: 3px; }
body.compact .row-label { font-size: 8px; }
body.compact .row-label span { display: none; }
body.compact .hole-number { font-size: 15px; }
body.compact .reed { font-size: 12px; border-radius: 4px; }
body.compact .reed.active { box-shadow: 0 0 9px currentColor; }
body.compact #status { font-size: 10px; line-height: 1.4; min-height: 14px; margin: 10px 0 0; overflow-wrap: anywhere; }
body.compact #controls { margin-top: 8px; }
body.compact summary { font-size: 11px; }
body.compact summary span { display: none; }
body.compact .toolbar { gap: 6px; margin-top: 8px; }
body.compact button, body.compact select { font-size: 11px; padding: 6px 8px; }
body.compact .hint { font-size: 10px; }
#overlay-source { width: min(400px, 100%); margin: 0 auto; }
#played-notes { display: flex; align-items: center; justify-content: flex-end; gap: 8px; height: 64px; padding: 8px 8px 8px 0; border-radius: 12px; background: #07121bb8; overflow: hidden; }
.played-token { display: flex; flex: 0 0 auto; align-items: center; justify-content: center; gap: 2px; padding: 5px 4px; border-radius: 7px; font-size: 28px; line-height: 1.2; font-weight: 700; white-space: nowrap; opacity: .65; }
.played-token.played-current { background: #ffffff22; opacity: 1; }
.played-blow { color: var(--blow); }
.played-draw { color: var(--draw); }
body.clean main { width: min(424px, 100%); padding: 12px; }
body.clean.recording-preview main { width: min(1160px, 100%); }

[hidden] { display: none !important; }
body:not(.tuner-visible) #overlay-source { position: fixed; left: -10000px; top: 0; width: 400px; }
#record-toggle { min-width: 180px; background: #14634e; font-weight: 700; }
button[aria-expanded="true"] { border-color: var(--blow); }
#controls, #player-panel, #tuner-panel { margin-top: 20px; }
