:root {
    --itr-background: #111111;
    --itr-text: #eeeeee;
    --itr-text-muted: #aaaaaa;
    --itr-text-faint: #777777;
    --itr-panel-line: rgba(255,255,255,0.18);
    --itr-control-border: rgba(255,255,255,0.28);
    --itr-control-background: rgba(255,255,255,0.05);
    --itr-control-text: #bbbbbb;
    --itr-active: #00ff00;
    --itr-active-ui: #00ff00;
    --itr-active-soft: rgba(0,255,0,0.12);
    --itr-font: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
    --itr-ui-top: 26px;
    --itr-ui-left: 28px;
    --itr-ui-width: 220px;
    --itr-ui-line-height: 1.65;
    --itr-label-size: 11px;
    --itr-section-size: 10px;
    color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; width: 100%; height: 100%; overflow: hidden; background: var(--itr-background); color: var(--itr-text); font-family: var(--itr-font); }
#view { position: fixed; inset: 0; }
canvas { display: block; touch-action: none; }
#info { position: absolute; top: var(--itr-ui-top); left: var(--itr-ui-left); z-index: 20; width: var(--itr-ui-width); max-height: calc(100dvh - 76px); overflow-y: auto; overflow-x: hidden; scrollbar-width: thin; pointer-events: auto; line-height: var(--itr-ui-line-height); font-size: 12px; font-weight: 400; }
strong { font-size: 12px; }
.help { color: var(--itr-text); margin: 0 0 14px; }
#modelRow { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 12px; margin-top: 14px; }
#model { overflow-wrap: anywhere; min-width: 0; flex-basis: 100%; }
#stats { color: var(--itr-text-muted); font-size: 11px; margin-top: 6px; overflow-wrap: anywhere; }
button, input, select { font: inherit; font-size: var(--itr-label-size); border-radius: 0; }
button { appearance: none; border: 1px solid var(--itr-control-border); background: var(--itr-control-background); color: var(--itr-control-text); padding: 6px 8px; cursor: pointer; }
button:hover, button.active { border-color: var(--itr-active-ui); color: var(--itr-active-ui); background: var(--itr-active-soft); }
#load, #demo, .textButton { border: 0; padding: 0; background: none; color: var(--itr-active-ui); font-size: inherit; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
#load:hover, #demo:hover, .textButton:hover { background: none; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 1px solid var(--itr-active-ui); outline-offset: 3px; }
section { margin-top: 18px; }
.sectionTitle { font-size: var(--itr-section-size); letter-spacing: .14em; opacity: .65; margin-bottom: 9px; }
.row { display: grid; grid-template-columns: 64px minmax(0,1fr); align-items: center; gap: 8px; margin: 7px 0; font-size: var(--itr-label-size); }
.pitchRow { grid-template-columns: 64px minmax(0,82px) minmax(0,1fr); }
input:not([type=range]), select { min-width: 0; width: 100%; color: var(--itr-control-text); background: var(--itr-control-background); border: 1px solid var(--itr-control-border); padding: 3px 5px; }
input:not([type=range]) { text-align: right; }
input[type=number] { appearance: textfield; }
input[type=number]::-webkit-inner-spin-button, input[type=number]::-webkit-outer-spin-button { appearance: none; margin: 0; }
#lowNote, #highNote { color: var(--itr-text-muted); font-size: 10px; overflow-wrap: anywhere; }
.small { color: var(--itr-text-faint); font-size: 10px; margin-top: 4px; }
#auto { font-size: 10px; margin-top: 6px; }
.timbre { display: flex; justify-content: space-between; font-size: 11px; color: var(--itr-text-muted); }
.spectrum { height: 1px; background: linear-gradient(90deg,#333,#aaa); margin-top: 8px; }
input[type=range] { appearance: none; width: 100%; height: 1px; margin: 0; background: rgba(255,255,255,.35); outline: none; cursor: pointer; touch-action: none; }
input[type=range]::-webkit-slider-thumb { appearance: none; width: 1px; height: 9px; border: 0; border-radius: 0; background: var(--itr-active-ui); }
input[type=range]::-moz-range-thumb { width: 1px; height: 9px; border: 0; border-radius: 0; background: var(--itr-active-ui); }
#performanceControls { position: sticky; top: 0; z-index: 4; margin-top: 8px; padding: 2px 0 10px; border-bottom: 1px solid var(--itr-panel-line); background: var(--itr-background); }
.modeToggle { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.modeToggle > button { min-width: 0; }
#modePanel { margin-top: 0; }
.clockRow { display: flex; justify-content: space-between; color: var(--itr-text-muted); font-size: 11px; margin-top: 8px; font-variant-numeric: tabular-nums; }
#seek { display: block; margin: 12px 0; }
#status { color: var(--itr-text-muted); font-size: 11px; overflow-wrap: anywhere; margin-bottom: 8px; }
#fit { font-size: 11px; }
.transport { display: flex; gap: 12px; align-items: center; margin-top: 8px; }
.transport button { border: 0; background: transparent; padding: 5px; width: 28px; height: 32px; font-family: Arial,sans-serif; font-size: 17px; line-height: 1; }
.transport button:hover, .transport button.active { background: transparent; }
.transport button:disabled { opacity: .25; cursor: default; }
#info { padding-right: 16px; scrollbar-color: #555 transparent; }
#info::-webkit-scrollbar { width: 3px; }
#info::-webkit-scrollbar-track { background: transparent; }
#info::-webkit-scrollbar-thumb { background: #555; border-radius: 0; }
#info::-webkit-scrollbar-button { display: none; height: 0; }
@supports selector(::-webkit-scrollbar) { #info { scrollbar-width: auto; scrollbar-color: auto; } }
#manualHint { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); color: var(--itr-text-muted); font-size: 10px; pointer-events: none; max-width: calc(100vw - 32px); text-align: center; }
.scanView canvas { cursor: ew-resize; }
#edgeRangeControls { margin-top: 10px; width: 100%; }
#edgeRangeValue { float: right; }
#edgeRangeControls input { touch-action: none; }
.dualRange { position: relative; height: 28px; overflow: hidden; background: linear-gradient(rgba(255,255,255,.35),rgba(255,255,255,.35)) center/100% 1px no-repeat; }
.dualRange::before, .dualRange::after { content: ''; position: absolute; top: 50%; transform: translateY(-50%); width: 1px; height: 9px; background: var(--itr-active-ui); z-index: 3; pointer-events: none; }
.dualRange::before { left: calc((100% - 1px) * var(--lower, .05)); }
.dualRange::after { left: calc((100% - 1px) * var(--upper, 1)); }
/* Compensate for the thumb's 8px hit border so its visible marker reaches both track ends. */
.dualRange input { position: absolute; top: 0; left: -8px; width: calc(100% + 16px); height: 28px; margin: 0; appearance: none; background: transparent; pointer-events: none; }
.dualRange input::-webkit-slider-thumb { appearance: none; width: 1px; height: 9px; background: transparent; background-clip: padding-box; border: 8px solid transparent; box-sizing: content-box; border-radius: 0; pointer-events: auto; cursor: ew-resize; }
.dualRange input::-moz-range-thumb { width: 1px; height: 9px; background: transparent; background-clip: padding-box; border: 8px solid transparent; box-sizing: content-box; border-radius: 0; pointer-events: auto; cursor: ew-resize; }
.dualRange input:focus { z-index: 2; }
.dualRange input:focus-visible { outline: 1px solid var(--itr-text-muted); outline-offset: -9px; }
#axesnote { position: fixed; bottom: 48px; right: 20px; color: var(--itr-text-faint); font-size: 10px; line-height: 1.65; white-space: pre-line; pointer-events: none; }
#projectName { font-family: "Inter",Arial,sans-serif; position: fixed; right: max(20px,env(safe-area-inset-right)); bottom: max(16px,env(safe-area-inset-bottom)); font-size: 12px; color: var(--itr-text-muted); pointer-events: none; z-index: 25; }
#settingsToggle { display: none; position: fixed; left: 16px; top: 16px; z-index: 40; font: inherit; font-size: 12px; color: var(--itr-active-ui); background: var(--itr-background); border: 0; padding: 8px; }
[hidden] { display: none !important; }
body.drag #view { outline: 1px solid var(--itr-active-ui); outline-offset: -1px; }
@media (pointer: coarse), (max-width: 600px) {
    :root { --itr-ui-top: 16px; --itr-ui-left: 16px; }
    #settingsToggle { display: block; }
    #info { display: none; top: 56px; left: 16px; padding: 12px 20px 12px 12px; width: 260px; background: rgba(17,17,17,.96); max-height: calc(100dvh - 120px); max-width: calc(100vw - 56px); }
    body.settingsOpen #info { display: block; }
    button, input:not([type=range]), select { min-height: 32px; }
    input[type=range] { height: 24px; background: linear-gradient(rgba(255,255,255,.35),rgba(255,255,255,.35)) center/100% 1px no-repeat; }
}
