/* eleMusic Free MIDI Studio (https://elemusic.studio)
   Standalone stylesheet: zero inline styles, strict CSP (style-src 'self'),
   responsive desktop + 390px mobile layout, crisp dark DAW + concert ivory sheet paper. */

@font-face {
  font-family: "Source Serif 4";
  font-style: normal;
  font-weight: 400 700;
  font-display: swap;
  src: url("/static/fonts/source-serif-4-latin.woff2") format("woff2");
}

:root {
  color-scheme: dark;
  --bg: #0d1015;
  --panel: #151920;
  --panel-hi: #1c222b;
  --panel-soft: #10141a;
  --line: #262e38;
  --line-soft: rgba(255, 255, 255, 0.08);
  --edge: #59636e;
  --text: #eae8e3;
  --muted: #a5aeb8;
  --accent: #8fc1b5;
  --accent-hi: #aee0d4;
  --accent-glow: rgba(143, 193, 181, 0.16);
  --accent-ink: #0b1311;
  --gold: #e5c467;
  --gold-hi: #f6df96;
  --gold-glow: rgba(229, 196, 103, 0.15);
  --good: #7ad19a;
  --warn: #d9b860;
  --bad: #e08a7b;
  --shadow-lg: 0 20px 50px rgba(0, 0, 0, 0.52);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: rgba(143, 193, 181, 0.12);
}

[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background:
    radial-gradient(68rem 34rem at 14% -8%, rgba(143, 193, 181, 0.10), transparent 65%),
    radial-gradient(52rem 28rem at 88% 0%, rgba(229, 196, 103, 0.06), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  overflow-x: hidden;
}

a {
  color: var(--accent-hi);
  text-underline-offset: 3px;
}

a:hover {
  color: #ffffff;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 8px;
  z-index: 200;
  padding: 8px 14px;
  border-radius: 10px;
  background: var(--accent-hi);
  color: var(--accent-ink);
  font-weight: 700;
  text-decoration: none;
}

.skip-link:focus {
  left: 12px;
}

/* ---- Site Header & Paid Services Nav ---- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
  background: rgba(13, 16, 21, 0.90);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--line);
}

.header-inner {
  width: 100%;
  max-width: 86rem;
  margin: 0 auto;
  padding: 9px 16px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
}

.brand-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 10px;
  min-width: 0;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  color: var(--text);
  text-decoration: none;
  font-weight: 750;
  font-size: 1.05rem;
  letter-spacing: -0.015em;
}

.brand-mark {
  width: 24px;
  height: 24px;
  border-radius: 7px;
  flex: none;
}

.free-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(122, 209, 154, 0.45);
  background: rgba(122, 209, 154, 0.12);
  color: var(--good);
  font: 700 0.70rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.02em;
}

.zero-ai-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid rgba(143, 193, 181, 0.38);
  background: rgba(143, 193, 181, 0.10);
  color: var(--accent-hi);
  font: 650 0.70rem/1.3 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.header-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 4px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid transparent;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-pill-studio {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid rgba(229, 196, 103, 0.48);
  background: rgba(229, 196, 103, 0.12);
  color: var(--gold-hi);
  font-size: 0.80rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.nav-pill-studio:hover {
  border-color: var(--gold);
  background: rgba(229, 196, 103, 0.22);
  color: #ffffff;
}

.nav-pill-fm {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 4px 11px;
  border-radius: 999px;
  border: 1px solid rgba(143, 193, 181, 0.46);
  background: rgba(143, 193, 181, 0.12);
  color: var(--accent-hi);
  font-size: 0.80rem;
  font-weight: 650;
  text-decoration: none;
  white-space: nowrap;
}

.nav-pill-fm:hover {
  border-color: var(--accent-hi);
  background: rgba(143, 193, 181, 0.22);
  color: #ffffff;
}

/* ---- Main Shell ---- */

.page-shell {
  flex: 1;
  width: 100%;
  max-width: 86rem;
  margin: 0 auto;
  padding: 12px 16px 48px;
}

.prose-shell {
  max-width: 58rem;
  margin: 0 auto;
  padding: 24px 16px 56px;
}

/* ---- Hero & Primary Import / Export / Keyboard Action Bar ---- */

.studio-hero {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px 20px;
  margin-bottom: 10px;
}

.studio-hero-copy {
  flex: 1 1 26rem;
  min-width: 0;
}

.studio-hero h1 {
  margin: 0;
  font-size: clamp(1.22rem, 2.1vw, 1.58rem);
  font-weight: 780;
  letter-spacing: -0.02em;
  line-height: 1.2;
}

.studio-hero-sub {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.42;
  max-width: 72ch;
}

.hero-export-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

/* ---- Shared Buttons & Form Controls ---- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 40px;
  padding: 7px 15px;
  border: 1px solid var(--accent);
  border-radius: 10px;
  background: linear-gradient(180deg, var(--accent-hi) 0%, var(--accent) 100%);
  color: var(--accent-ink);
  font: inherit;
  font-size: 0.88rem;
  font-weight: 700;
  white-space: nowrap;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.08s ease, filter 0.14s ease, border-color 0.14s ease, background 0.14s ease;
}

.button:hover:not([disabled]) {
  filter: brightness(1.06);
  color: var(--accent-ink);
}

.button:active:not([disabled]) {
  transform: translateY(1px);
}

.button.gold-btn {
  border-color: var(--gold);
  background: linear-gradient(180deg, var(--gold-hi) 0%, var(--gold) 100%);
  color: #161206;
}

.button.quiet {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
  color: var(--text);
  font-weight: 600;
}

.button.quiet:hover:not([disabled]) {
  border-color: var(--accent);
  color: var(--accent-hi);
  background: var(--accent-glow);
}

.button.small-btn {
  min-height: 34px;
  padding: 5px 11px;
  font-size: 0.82rem;
  border-radius: 9px;
}

.button[disabled],
.oct-pill[disabled] {
  opacity: 0.46;
  cursor: default;
}

.button:focus-visible,
.oct-pill:focus-visible,
.seg-pill:focus-visible,
.nav-link:focus-visible,
.nav-pill-studio:focus-visible,
.nav-pill-fm:focus-visible,
select:focus-visible,
input:focus-visible,
textarea:focus-visible {
  outline: 2px solid var(--accent-hi);
  outline-offset: 2px;
}

input[type="text"],
input[type="number"],
textarea,
select {
  border: 1px solid var(--edge);
  border-radius: 8px;
  background: #11151b;
  color: var(--text);
  font: inherit;
  font-size: 16px;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, #9aa4af 50%), linear-gradient(135deg, #9aa4af 50%, transparent 50%);
  background-repeat: no-repeat;
  background-position: calc(100% - 13px) 52%, calc(100% - 8px) 52%;
  background-size: 5px 5px, 5px 5px;
  padding-right: 24px;
}

.hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.4;
}

.clock {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-variant-numeric: tabular-nums;
}

.buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 7px;
}

/* ---- Segmented Pills & Oct Pills ---- */

.seg-pills {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 5px;
  padding: 3px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #0b0e13;
}

.seg-pill {
  min-height: 32px;
  padding: 4px 12px;
  border-radius: 8px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: 650 0.80rem/1.2 inherit;
  cursor: pointer;
  white-space: nowrap;
}

.seg-pill:hover {
  color: var(--text);
}

.seg-pill.on {
  background: var(--accent-glow);
  border-color: rgba(143, 193, 181, 0.52);
  color: var(--accent-hi);
}

.oct-pill {
  min-height: 32px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141920;
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.76rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
}

.oct-pill:hover:not([disabled]) {
  border-color: var(--accent);
  color: var(--text);
}

.oct-pill.on {
  border-color: var(--accent);
  background: rgba(143, 193, 181, 0.20);
  color: var(--text);
}

.toolbar-label {
  font-size: 0.71rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* ---- Workstation Container & Top Project / Import / Keyboard Deck ---- */

.workstation-shell {
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: linear-gradient(180deg, #161b22 0%, #0d1015 100%);
  box-shadow: var(--shadow-lg);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.workstation-Shell-dragover,
.workstation-shell.drag-over {
  border-color: var(--accent-hi);
  box-shadow: 0 0 0 2px var(--accent-hi), var(--shadow-lg);
}

.ms-top-command-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b0e13;
}

.ms-project-fields,
.ms-import-template-group,
.ms-kbd-midi-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

input[type="text"].ms-title-input {
  width: 12rem;
  max-width: 100%;
  min-height: 32px;
  height: 32px;
  padding: 3px 10px;
  font-size: 16px;
  font-weight: 650;
}

input[type="text"].ms-composer-input {
  width: 9.8rem;
  max-width: 100%;
}

select.ms-mini-select {
  width: auto;
  max-width: 100%;
  min-height: 32px;
  height: 32px;
  padding: 0 24px 0 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background-color: #131820;
  color: var(--text);
  font: 600 0.76rem/30px inherit;
  cursor: pointer;
}

.ms-num-input {
  width: 4.5rem;
  min-height: 32px;
  height: 32px;
  padding: 2px 6px;
  text-align: center;
  font: 700 0.82rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.ms-kbd-btn.on {
  border-color: var(--gold);
  background: rgba(229, 196, 103, 0.20);
  color: var(--gold-hi);
}

.ms-import-btn-accent {
  border-color: rgba(143, 193, 181, 0.55);
  background: rgba(143, 193, 181, 0.14);
  color: var(--accent-hi);
}

/* ---- Status / Toast / Clean-Score / Keyboard Cheatsheet Banners ---- */

.ms-status-banner {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
  padding: 8px 12px;
  border: 1px solid rgba(143, 193, 181, 0.42);
  border-radius: 10px;
  background: rgba(16, 25, 28, 0.92);
  font-size: 0.83rem;
}

.ms-status-banner.warn {
  border-color: rgba(229, 196, 103, 0.55);
  background: rgba(34, 28, 14, 0.92);
  color: var(--gold-hi);
}

.ms-status-banner-actions {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.kbd-cheatsheet {
  padding: 10px 12px;
  border: 1px solid rgba(229, 196, 103, 0.38);
  border-radius: 12px;
  background: #0c1016;
  display: grid;
  gap: 8px;
}

.kbd-cheatsheet-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.kbd-cheatsheet-head strong {
  font-size: 0.86rem;
  color: var(--gold-hi);
}

.kbd-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(13.5rem, 1fr));
  gap: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}

.kbd-card {
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #12171f;
}

.kbd-card strong {
  display: block;
  color: var(--text);
  margin-bottom: 2px;
  font-size: 0.78rem;
}

kbd {
  display: inline-block;
  padding: 1px 5px;
  border-radius: 4px;
  border: 1px solid #36414e;
  background: #0a0d12;
  color: var(--gold-hi);
  font: 700 0.70rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---- Editing, Track Rack, Synth Strip & Groove Sections ---- */

.ms-overall-tools {
  display: grid;
  gap: 6px;
}

.ms-bar-box {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  padding: 6px 9px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: #0b0e13;
}

.ms-tool-pills,
.ms-roll-view-ctrls,
.ms-ctrl-group,
.ms-track-inspector,
.ms-deck-tabs {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.ms-pair {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

.ms-top-pill {
  border-color: rgba(229, 196, 103, 0.5);
  color: var(--gold-hi);
  background: rgba(229, 196, 103, 0.1);
}

.ms-pos-pill {
  display: inline-flex;
  align-items: center;
  min-height: 31px;
  padding: 3px 9px;
  border: 1px solid #2b3946;
  border-radius: 8px;
  background: #0d131a;
  color: var(--gold-hi);
  font: 700 0.76rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: nowrap;
}

.ms-clean-pill {
  border-color: rgba(245, 208, 97, 0.52);
  background: linear-gradient(180deg, rgba(245, 208, 97, 0.16) 0%, rgba(143, 193, 181, 0.12) 100%);
  color: #f7dfa0;
  font-weight: 650;
}

.ms-clean-pill:hover:not([disabled]) {
  border-color: rgba(245, 208, 97, 0.88);
  color: #fff8dc;
}

.ms-sheet-export-pill {
  border-color: rgba(229, 196, 103, 0.55);
  color: var(--gold-hi);
  background: rgba(229, 196, 103, 0.13);
}

.ms-sheet-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
  padding: 7px 9px;
  border: 1px solid #243342;
  border-radius: 11px;
  background: #0c1219;
}

/* ---- Track Pills & Mixer ---- */

.tr-tone-0 { --tr-color: #8fc1b5; }
.tr-tone-1 { --tr-color: #7aa8e8; }
.tr-tone-2 { --tr-color: #e5c467; }
.tr-tone-3 { --tr-color: #e08a7b; }
.tr-tone-4 { --tr-color: #c59be8; }
.tr-tone-5 { --tr-color: #f2a8c6; }
.tr-tone-6 { --tr-color: #f0b26a; }
.tr-tone-7 { --tr-color: #9be0c8; }
.tr-tone-8 { --tr-color: #8ab8f0; }
.tr-tone-9 { --tr-color: #a5e3e0; }

.ms-track-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.ms-track-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 34px;
  padding: 4px 8px;
  border: 1px solid #262e36;
  border-radius: 9px;
  background: #13181e;
  color: var(--muted);
  font: 600 0.76rem/1 inherit;
  cursor: pointer;
}

.ms-track-pill.armed {
  border-color: var(--tr-color, var(--accent));
  background: rgba(143, 193, 181, 0.14);
  color: #f4f7f9;
  box-shadow: 0 0 0 1px rgba(143, 193, 181, 0.20);
}

.ms-track-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  background: var(--tr-color, var(--accent));
  flex: none;
}

.ms-track-cnt {
  padding: 2px 5px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  font: 600 0.66rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #cfd6dd;
}

.ms-ms-btn {
  padding: 2px 5px;
  border: 1px solid #2c353f;
  border-radius: 5px;
  background: #0d1115;
  color: #8b95a1;
  font: 700 0.62rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  cursor: pointer;
}

.ms-ms-btn.mute-on {
  background: #5c2323;
  border-color: #c95656;
  color: #ffd8d8;
}

.ms-ms-btn.solo-on {
  background: #5b4a16;
  border-color: #e5c467;
  color: #fff3c4;
}

.ms-track-name-input {
  width: 10.5rem;
  max-width: 60vw;
  min-height: 31px;
  padding: 3px 8px;
  font-size: 16px;
}

.ms-add-part-btn {
  border-style: dashed;
  border-color: rgba(143, 193, 181, 0.48);
  color: #bce4da;
}

.danger-pill {
  border-color: rgba(224, 138, 123, 0.48);
  color: #f0a79b;
}

.ms-vol-slider {
  width: 78px;
  height: 22px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---- 5-Knob Synth Strip ---- */

.ms-synth-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 12px;
  padding: 6px 10px;
  border: 1px solid #24303a;
  border-radius: 10px;
  background: linear-gradient(180deg, #121820 0%, #0b0f14 100%);
}

.ms-synth-knob {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}

input[type="range"].ms-synth-slider {
  width: 66px;
  height: 18px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---- Beat Clock LEDs & Metronome ---- */

.ms-clock-leds {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0 4px;
}

.ms-beat-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #232d37;
  border: 1px solid #33404d;
}

.ms-beat-dot.downbeat {
  width: 8px;
  height: 8px;
}

.ms-beat-dot.pulse {
  background: var(--accent);
  border-color: #c9efe6;
  box-shadow: 0 0 7px rgba(143, 193, 181, 0.85);
}

.ms-beat-dot.downbeat.pulse {
  background: var(--gold);
  border-color: #fff0b8;
  box-shadow: 0 0 8px rgba(229, 196, 103, 0.92);
}

.ms-metro-pill.on.downbeat-flash {
  border-color: var(--gold);
  color: #fef3c7;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.28);
}

.ms-metro-pill.on.beat-flash {
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.32);
}

/* ---- Main Stage: Piano Roll, Sheet Music Grand Staff & Split View ---- */

.ms-instrument {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: #0f151c;
  min-width: 0;
}

.ms-stage-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.ms-arrangement-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.ms-arrangement-controls label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 650;
}

.ms-freeplay-pill.on {
  border-color: rgba(245, 208, 97, 0.85);
  background: rgba(245, 208, 97, 0.18);
  color: #ffea9f;
}

.ms-stage-dual {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}

.ms-stage-dual.split-active {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 10px;
}

@media (min-width: 1100px) {
  .ms-stage-dual.split-active {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1.06fr);
    align-items: start;
  }
}

.ms-roll-pane,
.ms-sheet-pane {
  min-width: 0;
}

.rec-canvas {
  display: block;
  width: 100%;
  border: 1px solid #1f2933;
  border-radius: 10px;
  background: #070a0e;
}

.ms-roll-canvas {
  width: 100%;
  height: 276px;
  cursor: crosshair;
  touch-action: none;
}

.ms-roll-canvas.roll-size-compact { height: 184px; }
.ms-roll-canvas.roll-size-tall { height: 390px; }
.ms-roll-canvas.roll-size-xl { height: 510px; }

.ms-sheet-scroll {
  width: 100%;
  max-height: 430px;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid #2a3440;
  background: #fbf9f3;
}

.ms-sheet-scroll.dark-paper {
  background: #0b1016;
  border-color: #1f2b37;
}

.ms-sheet-scroll.roll-size-compact { max-height: 250px; }
.ms-sheet-scroll.roll-size-tall { max-height: 540px; }
.ms-sheet-scroll.roll-size-xl { max-height: 680px; }

.ms-sheet-canvas {
  display: block;
  width: 100%;
  height: auto;
  cursor: crosshair;
  touch-action: none;
}

.ms-sheet-scroll.strip-layout .ms-sheet-canvas {
  width: auto;
  min-width: 100%;
  height: 266px;
}

.ms-roll-subtip {
  margin-top: 5px;
  font-size: 0.74rem;
  color: var(--muted);
}

/* ---- Performance Decks: Piano, Chord Pads, Drums, Melody Mic ---- */

.ms-input-slot {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.ms-deck-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 12px;
}

.ms-session-readout {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.rec-badge {
  display: inline-block;
  padding: 3px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.76rem;
  color: var(--muted);
}

.rec-badge.on {
  border-color: var(--good);
  color: var(--good);
}

.rec-badge.rec {
  border-color: var(--bad);
  color: var(--bad);
  font-weight: 700;
}

.rec-pitch {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.80rem;
  color: var(--accent-hi);
}

.ms-piano-console {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  gap: 8px;
  align-items: stretch;
}

.ms-wheels-canvas {
  width: 76px;
  height: 100%;
  min-height: 156px;
  max-height: 220px;
  border: 1px solid #26313b;
  border-radius: 12px;
  background: #0a0e13;
  cursor: ns-resize;
  touch-action: none;
  user-select: none;
}

.pop-piano-stage {
  display: flex;
  flex-direction: column;
  gap: 6px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
  min-width: 0;
}

.piano-deck-wrap {
  position: relative;
  border: 2px solid #2b3239;
  border-top: 4px solid #5a1d1d;
  border-radius: 12px;
  overflow: hidden;
  background: #050608;
}

.piano-deck-tag {
  position: absolute;
  top: 4px;
  left: 8px;
  z-index: 4;
  padding: 1px 7px;
  border-radius: 6px;
  background: rgba(14, 17, 20, 0.86);
  border: 1px solid #2f373e;
  color: var(--accent-hi);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.66rem;
  font-weight: 600;
  pointer-events: none;
}

.piano-deck {
  position: relative;
  display: flex;
  width: 100%;
  height: 164px;
  touch-action: none;
}

.piano-deck.compact {
  height: 112px;
}

.pop-key.white {
  position: relative;
  flex: 1;
  height: 100%;
  border-right: 1px solid #252a30;
  border-bottom: 5px solid #c5c2b8;
  border-radius: 0 0 7px 7px;
  background: linear-gradient(180deg, #fbfaf7 0%, #eae7df 82%, #dcd8ce 100%);
  color: #1d2125;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 7px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
  z-index: 1;
}

.pop-key.white:last-child {
  border-right: 0;
}

.pop-key.white.active {
  background: linear-gradient(180deg, #9ad4c6 0%, #6ba698 100%);
  border-bottom-color: #4b7d71;
  color: #07110e;
  transform: translateY(2px);
}

.pop-key.black {
  position: absolute;
  top: 0;
  height: 61%;
  background: linear-gradient(180deg, #2d3238 0%, #14171a 78%, #090a0c 100%);
  border: 1px solid #050607;
  border-bottom: 5px solid #040506;
  border-radius: 0 0 7px 7px;
  box-shadow: 0 5px 10px rgba(0, 0, 0, 0.65);
  color: #b5bcc2;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  align-items: center;
  padding-bottom: 5px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.60rem;
  font-weight: 600;
  cursor: pointer;
  z-index: 3;
  transform: translateX(-50%);
}

.pop-key.black.active {
  background: linear-gradient(180deg, #e5c467 0%, #b5923b 100%);
  border-bottom-color: #7c6222;
  color: #111111;
  transform: translateX(-50%) translateY(2px);
}

.pop-key.arp-lit {
  box-shadow: 0 0 0 2px #e5c467 inset, 0 0 12px rgba(229, 196, 103, 0.45);
}

.pop-key:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: -4px;
}

.pop-key * {
  pointer-events: none;
}

.pop-key .scale-dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #268c77;
  margin-bottom: 3px;
  opacity: 0;
}

.pop-key.black .scale-dot {
  background: #d9b860;
}

.pop-key.in-scale .scale-dot {
  opacity: 0.9;
}

.pop-key .kbd-hint {
  padding: 0 3px;
  border-radius: 3px;
  background: rgba(13, 18, 24, 0.12);
  opacity: 0.78;
  font-size: 0.58rem;
  margin-bottom: 2px;
}

.pop-key.black .kbd-hint {
  background: rgba(255, 255, 255, 0.12);
  color: var(--gold-hi);
}

.pop-key .note-lbl {
  line-height: 1.05;
}

.pop-key .acc-sub {
  opacity: 0.72;
  font-size: 0.52rem;
  line-height: 1.05;
}

.pop-piano-stage.piano-hide-notes .note-lbl,
.pop-piano-stage.piano-hide-notes .acc-sub {
  display: none;
}

.pop-piano-stage.piano-hide-kbd .kbd-hint {
  display: none;
}

.pop-key.black.oct1-bk-0 { width: 8.2%; left: 12.50%; }
.pop-key.black.oct1-bk-1 { width: 8.2%; left: 25.00%; }
.pop-key.black.oct1-bk-2 { width: 8.2%; left: 50.00%; }
.pop-key.black.oct1-bk-3 { width: 8.2%; left: 62.50%; }
.pop-key.black.oct1-bk-4 { width: 8.2%; left: 75.00%; }
.pop-key.black.wide-bk-0 { width: 4.5%; left: 6.67%; }
.pop-key.black.wide-bk-1 { width: 4.5%; left: 13.33%; }
.pop-key.black.wide-bk-2 { width: 4.5%; left: 26.67%; }
.pop-key.black.wide-bk-3 { width: 4.5%; left: 33.33%; }
.pop-key.black.wide-bk-4 { width: 4.5%; left: 40.00%; }
.pop-key.black.wide-bk-5 { width: 4.5%; left: 53.33%; }
.pop-key.black.wide-bk-6 { width: 4.5%; left: 60.00%; }
.pop-key.black.wide-bk-7 { width: 4.5%; left: 73.33%; }
.pop-key.black.wide-bk-8 { width: 4.5%; left: 80.00%; }
.pop-key.black.wide-bk-9 { width: 4.5%; left: 86.67%; }

.ms-keys-subbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 6px 10px;
}

.piano-oct-group,
.piano-layout-group,
.ms-keys-assist {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 5px;
}

.oct-ribbon {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 3px;
  background: #14181c;
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.ms-arp-bar {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border: 1px solid #222c36;
  border-radius: 10px;
  background: #0b1016;
}

#ms-arp-latch.on {
  border-color: var(--gold);
  background: rgba(229, 196, 103, 0.22);
  color: #fbe59b;
}

/* ---- Chord Pads & Drum Sequencer ---- */

.ms-chord-deck,
.ms-perc-deck,
.ms-vocal-deck {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0a0e13;
  padding: 10px;
}

.ms-pad-bank-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  margin-bottom: 6px;
}

.ms-pad-bank-head input[type="range"] {
  width: clamp(5rem, 22vw, 11rem);
  accent-color: var(--accent);
}

#ms-chord-pads {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 7px;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

@media (max-width: 960px) {
  #ms-chord-pads {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
}

@media (max-width: 640px) {
  #ms-chord-pads {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.ms-chord-pad {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 70px;
  padding: 7px 9px;
  border: 1px solid #28323c;
  border-radius: 11px;
  background: linear-gradient(180deg, #161d24 0%, #0e1318 100%);
  color: var(--text);
  text-align: left;
  cursor: pointer;
  touch-action: none;
}

.ms-chord-pad.borrowed {
  border-color: #3a3448;
  background: linear-gradient(180deg, #1b1824 0%, #100e17 100%);
}

.ms-chord-pad.borrowed .ms-chord-roman {
  color: #d9b8f3;
}

.ms-chord-pad.active {
  border-color: #9ad4c6;
  background: linear-gradient(180deg, rgba(143, 193, 181, 0.32) 0%, rgba(74, 128, 115, 0.22) 100%);
  transform: translateY(1px);
}

.ms-chord-pad.latched {
  border-color: var(--gold);
  box-shadow: 0 0 0 1px rgba(229, 196, 103, 0.55);
}

.ms-chord-pad * {
  pointer-events: none;
}

.ms-chord-pad .ms-chord-stamp-btn {
  pointer-events: auto;
  touch-action: manipulation;
}

.ms-chord-pad-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
}

.ms-chord-roman {
  font: 700 0.70rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--accent);
}

.ms-chord-kbd {
  display: inline-block;
  padding: 1px 4px;
  border-radius: 4px;
  background: #0b0f14;
  border: 1px solid #28333e;
  color: #9aa5b1;
  font: 600 0.60rem/1.1 ui-monospace, SFMono-Regular, Menlo, monospace;
}

.ms-chord-stamp-btn {
  padding: 2px 6px;
  border: 1px solid #33414d;
  border-radius: 6px;
  background: #10161c;
  color: #c7e6de;
  font: 600 0.65rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  cursor: pointer;
}

.ms-chord-sym {
  font-size: 1.02rem;
  font-weight: 750;
  color: #f6f8fa;
  background: transparent;
  border: 0;
  padding: 0;
  text-align: left;
}

.ms-chord-notes {
  font: 500 0.66rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #8e99a4;
}

.ms-chord-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
}

.ms-drum-pads {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

@media (max-width: 720px) {
  .ms-drum-pads {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.ms-drum-pad {
  min-height: 50px;
  padding: 6px 8px;
  border: 1px solid #2a333d;
  border-radius: 10px;
  background: linear-gradient(180deg, #192028 0%, #10151a 100%);
  color: #e6ecf2;
  font: 650 0.74rem/1.15 inherit;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  align-items: flex-start;
  cursor: pointer;
  user-select: none;
  touch-action: manipulation;
}

.ms-drum-pad small {
  font: 600 0.60rem/1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--gold);
}

.ms-drum-pad.active {
  border-color: var(--gold);
  background: rgba(229, 196, 103, 0.26);
}

.ms-perc-top {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.ms-step-grid {
  display: grid;
  gap: 4px;
  overflow-x: auto;
  padding-bottom: 3px;
}

.ms-step-row {
  display: grid;
  grid-template-columns: 96px repeat(16, minmax(19px, 1fr));
  gap: 3px;
  align-items: center;
}

.ms-step-lbl {
  font: 600 0.70rem/1.1 ui-monospace, SFMono-Regular, Menlo, monospace;
  color: #cfd6dd;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.ms-step-cell {
  height: 24px;
  border: 1px solid #222a32;
  border-radius: 5px;
  background: #11161b;
  cursor: pointer;
  padding: 0;
}

.ms-step-cell.beat-start { border-left-color: #3a4652; }
.ms-step-cell.vel-1 { background: rgba(143, 193, 181, 0.55); border-color: var(--accent); }
.ms-step-cell.vel-2 { background: var(--gold); border-color: #f5de93; }
.ms-step-cell.vel-3 { background: rgba(143, 193, 181, 0.24); border-color: #52736b; }
.ms-step-cell.play-col { box-shadow: 0 0 0 1.5px #ffffff inset; }

/* ---- Melody Mic & Sheet Lyrics Deck ---- */

.ms-vocal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 12px;
  align-items: start;
}

@media (max-width: 780px) {
  .ms-vocal-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.ms-vocal-canvas {
  height: 68px;
  margin-top: 6px;
}

.ms-vocal-lyrics {
  width: 100%;
  min-height: 86px;
  padding: 8px 10px;
  margin-top: 4px;
  font-size: 0.88rem;
  line-height: 1.4;
}

/* ---- Sticky Transport & Export Footer Bar ---- */

.ms-sticky-transport {
  position: sticky;
  bottom: 0;
  z-index: 20;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 14px;
  padding: 9px 12px;
  border: 1px solid rgba(143, 193, 181, 0.28);
  border-radius: 12px;
  background: rgba(13, 17, 22, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.ms-transport-left,
.ms-transport-exports {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.ms-transport-pos {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 6px;
}

/* ---- Hardware Web MIDI & Arrangement Readout Drawer ---- */

.ms-hw-drawer {
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #0b0f14;
  display: grid;
  gap: 7px;
}

.ms-hw-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
}

.ms-cond-readout {
  margin: 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: #080b0e;
  border: 1px solid #1e262e;
  color: #b7d7ce;
  font-size: 0.78rem;
}

.draft-status {
  color: var(--muted);
  font-size: 0.76rem;
  margin-left: auto;
}

/* ---- Paid Services Showcase, Feature Matrix & FAQ (SEO / AEO) ---- */

.section-block {
  margin-top: 32px;
}

.section-kicker {
  display: inline-block;
  color: var(--accent-hi);
  font: 700 0.74rem/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
}

.section-block h2 {
  margin: 0 0 8px;
  font-size: clamp(1.2rem, 2vw, 1.48rem);
  letter-spacing: -0.015em;
}

.paid-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-top: 14px;
}

@media (max-width: 820px) {
  .paid-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}

.paid-card {
  padding: 20px;
  border-radius: 16px;
  border: 1px solid rgba(143, 193, 181, 0.30);
  background: linear-gradient(180deg, rgba(24, 31, 39, 0.92) 0%, rgba(15, 19, 25, 0.96) 100%);
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
}

.paid-card.paid-card-studio {
  border-color: rgba(229, 196, 103, 0.40);
}

.paid-card h3 {
  margin: 4px 0 6px;
  font-size: 1.15rem;
}

.paid-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.5;
}

.paid-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
}

.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.spec-card {
  padding: 16px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.spec-card h3 {
  margin: 0 0 6px;
  font-size: 0.98rem;
  color: var(--text);
}

.spec-card p,
.spec-card ul {
  margin: 0;
  color: var(--muted);
  font-size: 0.86rem;
  line-height: 1.48;
}

.spec-card ul {
  padding-left: 18px;
}

.faq-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.faq-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--panel);
  padding: 0 16px;
}

.faq-item summary {
  cursor: pointer;
  padding: 14px 0;
  font-weight: 680;
  font-size: 0.95rem;
  color: var(--text);
}

.faq-item p {
  margin: 0 0 14px;
  color: var(--muted);
  font-size: 0.90rem;
  line-height: 1.55;
}

/* ---- Prose Pages (/about, /privacy, /terms, /notices) ---- */

.prose-card {
  padding: 24px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--panel);
}

.prose-card h1 {
  margin: 0 0 10px;
  font-size: 1.65rem;
}

.prose-card h2 {
  margin: 24px 0 8px;
  font-size: 1.18rem;
  color: var(--accent-hi);
}

.prose-card p,
.prose-card li {
  color: var(--text);
  font-size: 0.94rem;
  line-height: 1.6;
}

.data-table-wrap {
  overflow-x: auto;
  margin-top: 12px;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

.data-table th {
  color: var(--accent-hi);
  font-weight: 700;
}

/* ---- Footer ---- */

.site-footer {
  width: 100%;
  border-top: 1px solid var(--line);
  background: #0a0d11;
  margin-top: auto;
}

.footer-inner {
  width: 100%;
  max-width: 86rem;
  margin: 0 auto;
  padding: 22px 16px 32px;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px 24px;
  color: var(--muted);
  font-size: 0.82rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 16px;
}

.workstation-shell,
.ms-top-command-bar,
.ms-import-template-group,
.ms-overall-tools,
.ms-bar-box,
.ms-instrument,
.ms-input-slot,
.ms-hw-drawer,
.ms-hw-row {
  min-width: 0;
}

select,
.ms-mini-select {
  max-width: 100%;
  min-width: 0;
}

@media (max-width: 640px) {
  .header-inner,
  .page-shell {
    padding-left: 10px;
    padding-right: 10px;
  }
  .workstation-shell {
    padding: 8px;
  }
  .ms-piano-console {
    grid-template-columns: 56px minmax(0, 1fr);
  }
  .ms-wheels-canvas {
    width: 56px;
    min-height: 124px;
  }
  .piano-deck {
    height: 128px;
  }
  .piano-deck.compact {
    height: 92px;
  }
  .ms-roll-canvas {
    height: 204px;
  }
  input[type="text"].ms-title-input,
  input[type="text"].ms-composer-input,
  select.ms-mini-select {
    width: 100%;
    max-width: 100%;
  }
  .ms-pair {
    flex-wrap: wrap;
    white-space: normal;
    max-width: 100%;
  }
}
