:root { font-family: Arial, Helvetica, sans-serif; color: #fff; background: #2346d7; font-synthesis: none; --panel: #2346d7; --deep: #142a8b; --line: #8197ed; }
* { box-sizing: border-box; }
body { margin: 0; min-width: 290px; }
main { max-width: 1440px; padding: 38px 5vw 24px; margin: auto; }
header { display: flex; justify-content: space-between; align-items: baseline; gap: 20px; margin-bottom: 34px; }
h1 { margin: 0; font-size: clamp(40px, 5.8vw, 76px); letter-spacing: -0.065em; font-weight: 750; line-height: 1; }
a { color: inherit; text-underline-offset: 5px; }
header a { text-decoration: none; font-weight: 700; white-space: nowrap; }
header a span { margin-left: 6px; }
.instrument { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(285px, 0.85fr); gap: clamp(32px, 5vw, 72px); align-items: start; }
.visual { min-width: 0; }
.qr-stage { display: grid; place-items: center; background: #fff; aspect-ratio: 1; width: 100%; position: relative; }
canvas { display: block; width: 100%; height: 100%; image-rendering: pixelated; }
canvas:not([width]) { visibility: hidden; }
#loading { position: absolute; color: #000; text-align: center; padding: 20px; }
.scan-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 50px; font-size: 13px; }
.scan-row p { margin: 0; font-weight: 700; }
.scan-row span { text-align: right; }
.qr-actions { display: flex; gap: 12px; }
.qr-actions button { flex: 1; }
.qr-actions label { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; white-space: nowrap; }
.qr-actions input[type=checkbox] { accent-color: white; }
button { font: inherit; font-size: 15px; font-weight: 700; padding: 13px 16px; border: 1px solid white; color: var(--deep); background: #fff; border-radius: 5px; cursor: pointer; min-height: 46px; }
button:hover { background: #e8ebf5; }
button:active { transform: translateY(1px); }
button.secondary { background: transparent; color: #fff; border-color: var(--line); }
button.secondary:hover { background: var(--deep); border-color: #fff; }
button:disabled { opacity: .45; cursor: default; }
button:disabled:active { transform: none; }
button:focus-visible, a:focus-visible, input:focus-visible, audio:focus-visible, select:focus-visible { outline: 3px solid white; outline-offset: 5px; box-shadow: 0 0 0 5px var(--deep); }
fieldset { margin: 0 0 32px; padding: 0; border: 0; min-width: 0; }
legend { padding: 0; margin-bottom: 15px; font-size: 22px; font-weight: 700; letter-spacing: -.025em; }
.source-buttons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.source-buttons button { padding: 12px 9px; font-size: 14px; }
#computer, #default-track { grid-column: 1 / -1; }
.source-help { font-size: 12px; line-height: 1.5; margin: 10px 0 16px; }
.auto-fit-label { display: flex; align-items: center; gap: 8px; font-size: 14px; margin-top: 15px; }
.auto-fit-label input { width: 18px; height: 18px; accent-color: white; }
.input-label { display: block; font-size: 13px; margin-bottom: 7px; }
select { width: 100%; min-height: 42px; padding: 9px; font: inherit; font-size: 14px; color: var(--deep); background: white; border: 1px solid white; border-radius: 4px; }
select:disabled { opacity: .65; }
.status { font-size: 13px; line-height: 1.55; min-height: 40px; overflow-wrap: anywhere; margin: 15px 0 10px; }
.meter { height: 5px; background: var(--deep); overflow: hidden; }
.meter div { background: #fff; height: 100%; transform: scaleX(0); transform-origin: left; }
.patterns { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; margin-bottom: 25px; }
.patterns button { display: flex; flex-direction: column; align-items: center; gap: 8px; color: #fff; background: transparent; border-color: var(--line); font-size: 12px; padding: 12px 4px; }
.patterns button[aria-pressed=true] { background: #fff; color: var(--deep); border-color: #fff; }
.pattern-icon { font-size: 25px; line-height: 1; height: 27px; }
.slider-label { display: flex; justify-content: space-between; font-size: 14px; margin: 23px 0 9px; }
output { font-variant-numeric: tabular-nums; font-weight: bold; }
input[type=range] { width: 100%; accent-color: white; margin: 0; height: 24px; cursor: pointer; }
#player:not(:empty) { margin-top: 16px; }
audio { display: block; width: 100%; max-width: 100%; height: 42px; }
.scan-help { font-size: 14px; line-height: 1.5; max-width: 30ch; }
.error { border-left: 3px solid white; padding: 10px 12px; background: var(--deep); font-size: 14px; line-height: 1.5; }
footer { display: flex; justify-content: space-between; gap: 12px; border-top: 1px solid var(--line); margin-top: 40px; padding-top: 16px; font-size: 12px; }
@media (min-width: 1100px) { .controls { padding-top: 10px; } }
@media (max-width: 760px) { main { padding: 24px 20px; max-width: 580px; } header { margin-bottom: 25px; } header a { font-size: 13px; } .instrument { grid-template-columns: 1fr; gap: 32px; } .scan-row { font-size: 11px; } .controls { display: grid; grid-template-columns: 1fr; } fieldset { margin-bottom: 25px; } .scan-help { max-width: none; margin-bottom: 0; } footer { margin-top: 26px; } }
@media (prefers-reduced-motion: reduce) { button:active { transform: none; } }
/* Source and pattern controls sit beside each other on wide displays. */
@media(min-width:1200px) {
  main { max-width:1880px; padding:18px 32px 12px; }
  header { margin-bottom:18px; }
  h1 { font-size:46px; }
  .instrument { grid-template-columns:minmax(0,min(48vw,calc(100dvh - 240px))) minmax(0,1fr); gap:32px; }
  .controls { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1fr); gap:12px 24px; padding-top:0; align-items:start; }
  fieldset { margin:0; }
  legend { font-size:20px; margin-bottom:12px; }
  .scan-help,.error { grid-column:1/-1; max-width:none; margin:0; }
  button { min-height:42px; padding:10px 12px; font-size:13px; }
  .source-buttons { gap:8px; margin-top:12px; }
  .source-buttons button { font-size:12px; padding:9px 7px; }
  .source-help { font-size:11px; line-height:1.4; margin:8px 0 12px; }
  .status { min-height:34px; font-size:12px; line-height:1.4; margin:10px 0 8px; }
  .patterns { margin-bottom:16px; }
  .patterns button { gap:6px; padding:10px 4px; }
  .slider-label { margin:16px 0 6px; font-size:13px; }
  .scan-row { min-height:36px; font-size:12px; }
  footer { margin-top:18px; padding-top:12px; }
}
