.ml-page { width: var(--page); margin: 0 auto; }
.ml-page [hidden] { display: none !important; }
.ml-page.page-columns, .ml-page .page-columns, #ml-explorer.page-columns { display: block !important; }
.ml-page .page-columns > * { grid-column: auto !important; }
.ml-heading { max-width: 800px; margin: 3rem 0 1.5rem; }
.ml-heading .eyebrow { color: var(--gold); margin-bottom: .7rem; }
.ml-heading h1 { color: var(--paper); font-size: clamp(2.6rem, 5vw, 4.4rem); line-height: 1.06; margin: 0 0 1rem; }
.ml-heading h1 em { color: var(--gold); }
.ml-heading > p:last-child { color: var(--soft); font-size: 1.05rem; max-width: 64ch; }
.ml-loading { color: var(--soft); }
.ml-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0, 0, 0, 0); }
.ml-page button { font-family: var(--sans); }
.ml-page button:focus-visible, .ml-page input:focus-visible { outline: 3px solid var(--gold); outline-offset: 3px; }

.ml-panel { position: relative; margin-bottom: 1.5rem; padding: clamp(1.25rem, 3vw, 1.9rem); border-radius: var(--radius); background: var(--paper); color: var(--ink); box-shadow: 0 24px 70px rgba(0,0,0,.35); }
.ml-panel::before { content: ""; position: absolute; inset: 0 0 auto 0; height: 6px; border-radius: var(--radius) var(--radius) 0 0; background: var(--rainbow); }
.ml-panel .eyebrow { margin-bottom: .3rem; }
.ml-panel h2 { margin: 0 0 .5rem; padding: 0; border: 0; color: var(--ink); font-size: clamp(1.7rem, 3vw, 2.3rem); }

/* The instrument */
.ml-cabinet { padding: 1.1rem 1.1rem .9rem; border-radius: 14px; background: linear-gradient(180deg, #6b4a2f, #4a321f); box-shadow: inset 0 2px 0 rgba(255,255,255,.12), inset 0 -6px 12px rgba(0,0,0,.35); color: #fff5e1; }
.ml-top { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: start; gap: 1rem 2rem; margin-bottom: 1rem; padding: .9rem 1rem; border-radius: 10px; background: #2a1d15; }
.ml-brand { margin: 0 0 .6rem; font-family: var(--serif); font-size: 1.5rem; font-weight: 650; letter-spacing: .02em; color: #f2c94c; }
.ml-brand span { color: #cfb99a; font-family: var(--mono); font-size: .7rem; font-weight: 400; letter-spacing: .05em; text-transform: uppercase; }
.ml-voices { display: flex; flex-wrap: wrap; gap: .35rem; }
.ml-voices button { padding: .45rem .85rem; border: 1px solid #8a6a4a; border-radius: 6px; background: #3b2a1f; color: #fff5e1; font-size: .85rem; cursor: pointer; box-shadow: 0 2px 0 #1a120d; }
.ml-voices button[aria-pressed="true"] { background: #f2c94c; border-color: #f2c94c; color: #1f1830; box-shadow: inset 0 2px 3px rgba(0,0,0,.25); }
.ml-voice-note { margin: .6rem 0 0; max-width: 52ch; color: #cfb99a; font-size: .8rem; }
.ml-controls { display: grid; gap: .6rem; min-width: min(280px, 100%); }
.ml-pitch { display: grid; gap: .3rem; font-size: .8rem; }
.ml-pitch span { color: #cfb99a; font-family: var(--mono); font-size: .68rem; letter-spacing: .05em; text-transform: uppercase; }
.ml-pitch output { margin-left: .4rem; color: #fff5e1; text-transform: none; }
.ml-pitch input { width: 100%; accent-color: #f2c94c; }
.ml-row { display: flex; flex-wrap: wrap; gap: .4rem; }
.ml-btn { padding: .4rem .85rem; border: 1px solid #8a6a4a; border-radius: 6px; background: #3b2a1f; color: #fff5e1; font-size: .82rem; cursor: pointer; }
.ml-btn[aria-pressed="true"] { background: #e23d80; border-color: #e23d80; }

.ml-keywrap { overflow-x: auto; padding: 1.3rem 0 .3rem; -webkit-overflow-scrolling: touch; }
.ml-keys { --w: max(28px, calc((100cqw - 2px) / var(--whites, 21))); --bw: calc(var(--w) * .62); position: relative; width: calc(var(--whites, 21) * var(--w)); height: 190px; margin: 0 auto; container-type: normal; touch-action: none; user-select: none; -webkit-user-select: none; }
.ml-keywrap { container-type: inline-size; }
.ml-key { position: absolute; top: 0; padding: 0; border: 0; cursor: pointer; --left: 1; }
.ml-key.is-white { width: var(--w); height: 100%; border: 1px solid #b9a888; border-radius: 0 0 5px 5px; background: linear-gradient(180deg, #fffaf0, #f1e6cf); box-shadow: inset 0 -5px 0 #ddd0b4; z-index: 1; }
.ml-key.is-black { width: var(--bw); height: 60%; border-radius: 0 0 4px 4px; background: linear-gradient(180deg, #2b2b2b, #111); box-shadow: inset 0 -4px 0 #000; z-index: 2; }
.ml-key.is-white.is-down { background: #f2c94c; box-shadow: inset 0 -2px 0 #c9a02e; }
.ml-key.is-black.is-down { background: #8a6a1a; }
.ml-key.is-out { opacity: .55; }
.ml-label { position: absolute; left: 0; right: 0; bottom: 18px; color: #8a7a5a; font-family: var(--mono); font-size: .58rem; text-align: center; pointer-events: none; }
.ml-tape { position: absolute; left: 18%; right: 18%; bottom: 6px; height: 5px; border-radius: 3px; background: #4a321f; transform-origin: left; transform: scaleX(var(--left)); pointer-events: none; }
.ml-key.is-black .ml-tape { background: #f2c94c; bottom: 6px; }
.ml-key.is-rewind .ml-tape { transition: transform .3s ease-out; }
.ml-keys.show-split .ml-key.is-split::before { content: "soprano ▸"; position: absolute; top: -1.3rem; left: 0; white-space: nowrap; color: #f2c94c; font-family: var(--mono); font-size: .6rem; pointer-events: none; }
.ml-shift { display: flex; justify-content: space-between; gap: .5rem; margin-top: .6rem; }
.ml-shift[hidden] { display: none; }
.ml-status { margin: .8rem 0 0; color: #f6e7c8; font-size: .85rem; min-height: 1.4em; }

.ml-help { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; margin-top: 1.1rem; font-size: .85rem; }
.ml-help p { margin: 0; color: #4a4040; }
.ml-help kbd { padding: 0 .3rem; border: 1px solid #bbaeaa; border-radius: 4px; background: #fffaf0; color: var(--ink); font-family: var(--mono); font-size: .75em; box-shadow: none; }
.ml-fine { margin: 1rem 0 0; color: var(--muted); font-size: .78rem; }

/* Story */
.ml-story > p:not(.eyebrow), .ml-story li { max-width: 80ch; }
.ml-story ul { padding-left: 1.2rem; }
.ml-story li { margin-bottom: .45rem; }
.ml-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1rem; margin-top: 1rem; }
.ml-step { padding: 1rem 1.1rem; border: 1px solid var(--paper-line); border-radius: 10px; background: #fffaf0; font-size: .9rem; }
.ml-step h3 { margin: .4rem 0 .3rem; color: var(--ink); font-size: 1.15rem; }
.ml-step p { margin: 0; }
.ml-n { display: inline-grid; place-items: center; width: 1.8rem; height: 1.8rem; border-radius: 50%; background: var(--ink); color: var(--gold); font-family: var(--mono); font-size: .85rem; }
.ml-story a { color: var(--pink-ink); }
.ml-method { max-width: 90ch; margin: 1.75rem 0; color: var(--soft); font-size: .82rem; }
.ml-method a { color: var(--gold); }
.ml-signoff { margin: 2rem 0; text-align: center; font-family: var(--serif); font-size: 1.2rem; }

@media (max-width: 1000px) { .ml-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } .ml-help { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
  .ml-steps { grid-template-columns: minmax(0, 1fr); }
  .ml-keys { height: 160px; }
  .ml-cabinet { padding: .7rem .6rem; }
}

/* Inside a key: the cutaway above the keyboard */
.ml-inside { margin: 0 auto .4rem; max-width: 720px; }
.ml-mech { display: block; width: 100%; height: auto; }
.ml-mech-bg { fill: #21170f; stroke: #8a6a4a; stroke-width: 1.5; }
.ml-mech-labels text { fill: #cfb99a; font-family: var(--mono); font-size: 11px; letter-spacing: .03em; }
.ml-mech-note { fill: #f2c94c; font-family: var(--mono); font-size: 12px; }
.ml-bin { fill: rgba(255,245,225,.04); stroke: #8a6a4a; stroke-width: 2; }
.ml-anchor { fill: #6d6558; stroke: #cfc6b4; }
.ml-spring { fill: none; stroke: #cfc6b4; stroke-width: 2; stroke-linejoin: round; }
.ml-tape-path { fill: none; stroke: #7a4b1e; stroke-width: 5; stroke-linecap: round; }
.ml-tape-run { fill: none; stroke: #c08a3e; stroke-width: 2; stroke-dasharray: 3 9; }
.ml-mech.is-on .ml-tape-run { animation: ml-run .35s linear infinite; }
@keyframes ml-run { to { stroke-dashoffset: -12; } }
.ml-head { stroke: #4a443a; }
.ml-gap { fill: #21170f; }
.ml-leader { fill: none; stroke: #8a6a4a; stroke-width: 1; }
.ml-mech.is-on .ml-head { filter: drop-shadow(0 0 4px rgba(242,201,76,.8)); }
.ml-capstan > circle:first-child { stroke: #4a443a; }
.ml-spin { transform-box: fill-box; transform-origin: center; animation: ml-spin .5s linear infinite; }
.ml-spin path { stroke: #4a443a; stroke-width: 2; }
.ml-hub { fill: #2a2a2a; }
@keyframes ml-spin { to { transform: rotate(360deg); } }
.ml-lift { transition: transform .07s ease-out; }
.ml-mech.is-on .ml-lift { transform: translateY(-4px); }
.ml-rod { stroke: #a59c8c; stroke-width: 3; }
.ml-pad { fill: #b0476a; stroke: #6b2238; }
.ml-pivot { fill: #a59c8c; }
.ml-keycap { fill: #fffaf0; stroke: #b9a888; stroke-width: 1.5; transition: fill .07s, transform .07s; }
.ml-mech.is-on .ml-keycap { fill: #f2c94c; transform: translateY(3px); }
.ml-mech-read { margin: .35rem 0 0; color: #cfb99a; font-family: var(--mono); font-size: .68rem; letter-spacing: .04em; text-align: center; text-transform: uppercase; min-height: 1.2em; }
@media (max-width: 600px) { .ml-mech-labels text { font-size: 13px; } .ml-mech-note { font-size: 14px; } }
@media (prefers-reduced-motion: reduce) { .ml-spin, .ml-mech.is-on .ml-tape-run { animation: none; } .ml-lift, .ml-keycap { transition: none; } }

/* the pitch knob on the cabinet: a cream pointer that turns with the Pitch control, straight up when in tune */
.ml-pitchrow { display: flex; align-items: center; gap: .8rem; }
.ml-pitchrow .ml-pitch { flex: 1; min-width: 0; }
.ml-knob { flex: none; display: flex; flex-direction: column; align-items: center; gap: .2rem; }
.ml-knob-cap { position: relative; display: block; width: 46px; height: 46px; border-radius: 50%; transform: rotate(var(--turn, 0deg)); transition: transform .1s ease-out;
  background: radial-gradient(circle at 36% 30%, #5a4130, #2a1d15 70%); box-shadow: 0 0 0 2px #8a6a4a, 0 3px 6px rgba(0,0,0,.5); }
.ml-knob-cap::after { content: ""; position: absolute; left: 50%; top: 5px; width: 4px; height: 14px; margin-left: -2px; border-radius: 2px; background: #f2c94c; }
.ml-knob small { color: #cfb99a; font-family: var(--mono); font-size: .6rem; letter-spacing: .05em; text-transform: uppercase; }
@media (prefers-reduced-motion: reduce) { .ml-knob-cap { transition: none; } }
