:root {
  --bg: #0a0a0a;
  --panel: #121212;
  --line: #2a2a2a;
  --text: #f2f2f2;
  --muted: #9a9a9a;
  --red: #e10600;
  --green: #5dff8a;
  --radius: 12px;
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}
a { color: var(--red); }
.top {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0.85rem 1.25rem; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: rgba(10,10,10,0.92); backdrop-filter: blur(8px); z-index: 10;
}
.brand { color: #fff; font-weight: 800; text-decoration: none; letter-spacing: 0.02em; }
.top nav { display: flex; gap: 1rem; flex-wrap: wrap; }
.top nav a { color: var(--muted); text-decoration: none; font-size: 0.92rem; }
.top nav a:hover { color: #fff; }
main { max-width: 1200px; margin: 0 auto; padding: 1.25rem; }
.hero h1 { margin: 0.2rem 0 0.5rem; font-size: clamp(1.8rem, 4vw, 2.6rem); }
.eyebrow { color: var(--red); font-weight: 700; text-transform: uppercase; letter-spacing: 0.08em; font-size: 0.75rem; margin: 0; }
.lede { color: #ddd; max-width: 52rem; line-height: 1.5; }
.legal-blurb { color: var(--muted); font-size: 0.9rem; max-width: 52rem; line-height: 1.45; }
.badge {
  display: inline-block; font-size: 0.7rem; font-weight: 700; padding: 0.1rem 0.4rem;
  border-radius: 4px; vertical-align: middle;
}
.badge.pd { background: #1e3a2f; color: var(--green); }
.badge.cc0 { background: #2a1a10; color: #ffb86b; }
.badge.fav { background: #3a2040; color: #ff9ad5; }

/* Start-here + packs */
.start-here, .instrument-landings, .community-block, .credits-block {
  margin: 1rem 0 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
}
.start-here h2, .instrument-landings h2, .community-block h2, .credits-block h2 {
  margin: 0 0 0.5rem; font-size: 1.15rem;
}
.start-here p, .instrument-landings p, .community-block p, .credits-block p {
  margin: 0 0 0.75rem; color: var(--muted); font-size: 0.95rem; line-height: 1.45;
}
.chip-row {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
}
.chip {
  display: inline-flex; align-items: center; gap: 0.35rem;
  background: #1a1a1a; border: 1px solid #333; color: #fff;
  border-radius: 999px; padding: 0.45rem 0.85rem; font-size: 0.88rem;
  cursor: pointer; text-decoration: none; font-weight: 600;
}
.chip:hover, .chip.active { border-color: var(--red); color: #fff; background: #221010; }
.chip .n { color: var(--muted); font-weight: 500; font-size: 0.78rem; }

.library-store-cta {
  margin: 1rem 0 1.25rem;
  padding: 1rem 1.1rem;
  border: 1px solid #2a2a2a;
  border-radius: 12px;
  background: linear-gradient(135deg, #1a0a0a, #121212);
}
.library-store-cta strong { color: #fff; }
.library-store-cta p { margin: 0.35rem 0 0.6rem; color: #bbb; font-size: 0.95rem; }
.cta-row { margin: 0; display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Soft conversion banner after opens */
.soft-cta {
  position: sticky; bottom: 0; z-index: 20;
  background: linear-gradient(180deg, transparent, rgba(10,10,10,0.95) 18%);
  padding: 1rem 1.25rem 1.1rem;
  border-top: 1px solid var(--line);
}
.soft-cta .inner {
  max-width: 1200px; margin: 0 auto;
  display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; justify-content: space-between;
  background: #1a0c0c; border: 1px solid #3a1515; border-radius: 12px; padding: 0.85rem 1rem;
}
.soft-cta .msg { color: #ddd; font-size: 0.95rem; flex: 1; min-width: 16rem; }
.soft-cta .msg strong { color: #fff; }
.soft-cta .actions { display: flex; flex-wrap: wrap; gap: 0.5rem; align-items: center; }
.soft-cta .dismiss {
  background: transparent; border: 0; color: var(--muted); cursor: pointer; font-size: 0.85rem;
}

.controls {
  display: flex; flex-wrap: wrap; gap: 0.75rem; margin: 1.25rem 0 0.5rem;
  padding: 1rem; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
}
.field { display: flex; flex-direction: column; gap: 0.25rem; min-width: 9rem; }
.field.grow { flex: 1; min-width: 12rem; }
.field span { font-size: 0.72rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
select, input, textarea {
  background: #0d0d0d; color: var(--text); border: 1px solid #333; border-radius: 8px;
  padding: 0.55rem 0.65rem; font-size: 0.95rem;
}
textarea { min-height: 5rem; resize: vertical; width: 100%; font-family: inherit; }
.counts { color: var(--muted); font-size: 0.9rem; margin: 0.5rem 0 1rem; display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }
.counts .toggle-link {
  background: none; border: 0; color: var(--red); cursor: pointer; font-size: 0.9rem; padding: 0;
}
.layout {
  display: grid; grid-template-columns: minmax(240px, 340px) 1fr; gap: 1rem; align-items: start;
}
@media (max-width: 860px) {
  .layout { grid-template-columns: 1fr; }
}
.list-panel, .viewer-panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius);
  min-height: 420px;
}
.piece-list { list-style: none; margin: 0; padding: 0.4rem; max-height: 70vh; overflow: auto; }
.piece-list li button {
  width: 100%; text-align: left; background: transparent; border: 0; color: inherit;
  padding: 0.7rem 0.75rem; border-radius: 8px; cursor: pointer;
}
.piece-list li button:hover, .piece-list li button.active { background: #1a1a1a; }
.piece-list .t { font-weight: 650; display: block; }
.piece-list .s { color: var(--muted); font-size: 0.8rem; }
.piece-list .fav-star { float: right; color: #ff9ad5; font-size: 0.85rem; }
.viewer-panel { padding: 1rem 1.1rem 1.25rem; }
.viewer-empty { text-align: center; padding: 2.5rem 1rem; color: var(--muted); }
.viewer-head { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; align-items: flex-start; }
.viewer-head h2 { margin: 0 0 0.25rem; }
.meta { margin: 0; color: var(--muted); font-size: 0.92rem; }
.viewer-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; }
.btn {
  display: inline-block; background: var(--red); color: #fff !important; text-decoration: none;
  border: 0; border-radius: 8px; padding: 0.55rem 0.9rem; font-weight: 700; cursor: pointer;
  font-size: 0.92rem;
}
.btn.ghost { background: transparent; border: 1px solid #444; color: #fff !important; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.license-line { margin: 0.75rem 0 1rem; font-size: 0.85rem; color: var(--muted); }
.instrument-cta {
  margin: 0 0 1rem; padding: 0.75rem 0.9rem;
  background: #151010; border: 1px solid #3a2020; border-radius: 10px;
  font-size: 0.92rem; color: #ddd;
}
.instrument-cta a { font-weight: 700; }
.stave-host {
  background: #faf8f5; color: #111; border-radius: 10px; padding: 1rem 0.5rem 1.5rem;
  overflow-x: auto; min-height: 180px;
}
.stave-host svg { max-width: 100%; }
.hint { color: var(--muted); font-size: 0.85rem; }
.hidden { display: none !important; }
.foot {
  max-width: 1200px; margin: 2rem auto; padding: 1rem 1.25rem 2.5rem;
  color: var(--muted); border-top: 1px solid var(--line); font-size: 0.9rem;
}
.foot .small { font-size: 0.8rem; }

/* Request form */
.request-form {
  display: grid; gap: 0.65rem; max-width: 36rem;
}
.request-form label { display: flex; flex-direction: column; gap: 0.25rem; font-size: 0.85rem; color: var(--muted); }
.request-form .row { display: flex; flex-wrap: wrap; gap: 0.65rem; }
.request-form .row label { flex: 1; min-width: 10rem; }
.request-status { font-size: 0.9rem; margin-top: 0.35rem; }
.request-status.ok { color: var(--green); }
.request-status.err { color: #ff6b6b; }

/* Practice mode (mobile-friendly focus) */
body.practice-mode .hero,
body.practice-mode .start-here,
body.practice-mode .instrument-landings,
body.practice-mode .library-store-cta,
body.practice-mode .community-block,
body.practice-mode .credits-block,
body.practice-mode .list-panel,
body.practice-mode .foot,
body.practice-mode .top nav { display: none !important; }
body.practice-mode .layout { grid-template-columns: 1fr; }
body.practice-mode .viewer-panel { min-height: 80vh; }
body.practice-mode .top { justify-content: center; }

/* Print branding */
.print-only { display: none; }
@media print {
  .top, .controls, .list-panel, .foot, .viewer-actions, .hint,
  .hero, .start-here, .instrument-landings, .library-store-cta,
  .community-block, .credits-block, .soft-cta, .counts, .instrument-cta { display: none !important; }
  .layout { display: block; }
  .viewer-panel { border: 0; background: #fff; color: #000; padding: 0; }
  body { background: #fff; color: #000; }
  .stave-host { background: #fff; border: 0; }
  .print-only {
    display: block !important;
    margin-top: 1.25rem;
    padding-top: 0.75rem;
    border-top: 1px solid #ccc;
    font-size: 11pt;
    color: #333;
    line-height: 1.4;
  }
  .print-only .brand-line { font-weight: 700; color: #000; }
  .print-only a { color: #000; text-decoration: none; }
  #vLicense { color: #444 !important; }
  #vTitle { color: #000; }
  #vMeta { color: #333 !important; }
}

.inst-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.5rem;
}
.inst-card {
  display: block;
  padding: 0.65rem 0.75rem;
  background: #151515;
  border: 1px solid #2a2a2a;
  border-radius: 10px;
  color: #eee;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
}
.inst-card:hover { border-color: var(--red); }
.inst-card span { display: block; color: var(--muted); font-weight: 500; font-size: 0.75rem; margin-top: 0.2rem; }

/* Mini metronome in piece viewer */
.mini-metro {
  margin: 0 0 1rem;
  padding: 0.65rem 0.75rem;
  background: #151010;
  border: 1px solid #3a2020;
  border-radius: 10px;
}
.mini-metro-inner {
  display: flex; flex-wrap: wrap; gap: 0.65rem; align-items: center;
}
.metro-pulse {
  width: 2.4rem; height: 2.4rem; border-radius: 50%;
  border: 2px solid #444; background: #1a1a1a; color: #fff;
  font-weight: 800; font-size: 1rem; cursor: default;
  transition: border-color 0.05s, box-shadow 0.05s, background 0.05s;
}
.metro-pulse.on {
  border-color: var(--red);
  background: #3a1010;
  box-shadow: 0 0 14px rgba(225, 6, 0, 0.55);
}
.metro-pulse.on.accent {
  border-color: var(--green);
  background: #103a1a;
  box-shadow: 0 0 14px rgba(93, 255, 138, 0.55);
}
.metro-controls {
  display: flex; flex-wrap: wrap; gap: 0.4rem; align-items: center; flex: 1;
}
.metro-bpm-field {
  display: flex; flex-direction: column; gap: 0.1rem; min-width: 4.5rem;
}
.metro-bpm-field span {
  font-size: 0.65rem; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em;
}
.metro-bpm-field input {
  width: 4.5rem; padding: 0.4rem 0.45rem; font-weight: 700;
}
.metro-step { min-width: 2.4rem; padding: 0.45rem 0.55rem !important; }
body.practice-mode .mini-metro {
  position: sticky; top: 3.5rem; z-index: 5;
  background: rgba(21, 16, 16, 0.96);
}
@media print {
  .mini-metro { display: none !important; }
}

.play-status {
  margin: 0.35rem 0 0.25rem;
  min-height: 1.2em;
  font-size: 0.88rem;
  color: var(--muted);
}
.play-status:not(:empty) {
  color: #ddd;
}
