/* =========================================================
   OSE - Outhentic Sound Engine
   Design language mirrors the app: deep black, hub-card
   surfaces with thin accent borders, blue→orange gradient
   accent (matches logo), 14dp-equivalent rounded corners.
   ========================================================= */

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}
img, svg { max-width: 100%; display: block; height: auto; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; border: 0; background: none; color: inherit; }

:root {
  /* Surface palette - pulled from the OseCard hub spec */
  --bg: #050507;
  --bg-1: #0a0a0d;
  --bg-2: #111115;
  --surface: #15151a;
  --surface-2: #1c1c22;
  --line: rgba(255,255,255,0.08);
  --line-strong: rgba(255,255,255,0.14);

  /* Ink (text) */
  --ink: #ECECEE;
  --ink-soft: #B8B8BD;
  --muted: #7A7A82;
  --dim: #4F4F56;

  /* Accent - exact OSE brand gradient (from branding/ose_logo.svg) */
  --accent-blue: #4AA3FF;
  --accent-orange: #FF8A2A;
  --accent: #FF8A2A;            /* primary accent for single-tone use */
  --accent-deep: #E2701B;
  --accent-grad: linear-gradient(90deg, #4AA3FF 0%, #FFFFFF 50%, #FF8A2A 100%);
  --accent-grad-soft: linear-gradient(90deg, rgba(74,163,255,0.55) 0%, rgba(255,255,255,0.45) 50%, rgba(255,138,42,0.55) 100%);

  /* Layout */
  --max: 1240px;
  --gutter: clamp(20px, 4vw, 56px);
  --radius: 14px;
  --radius-sm: 8px;
  --card-pad: clamp(20px, 3vw, 32px);

  /* Typography */
  --display-font: "Inter", -apple-system, sans-serif;
  --sans-font:    "Inter", -apple-system, sans-serif;
  --mono-font:    "JetBrains Mono", "SF Mono", Menlo, Consolas, monospace;
}

/* =========================================================
   Typography
   ========================================================= */
h1, h2, h3, h4, h5 { margin: 0 0 .5em; line-height: 1.15; font-weight: 600; letter-spacing: -.01em; color: var(--ink); }
h1 { font-family: var(--display-font); font-size: clamp(2.4rem, 5vw, 4.4rem); font-weight: 700; letter-spacing: -.025em; line-height: 1.05; }
h2 { font-family: var(--display-font); font-size: clamp(1.8rem, 3.6vw, 2.8rem); font-weight: 700; letter-spacing: -.02em; }
h3 { font-family: var(--sans-font);    font-size: 1.25rem; font-weight: 600; }
h4 { font-family: var(--sans-font);    font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .14em; color: var(--ink-soft); }
p  { margin: 0 0 1em; color: var(--ink-soft); }
strong { font-weight: 600; color: var(--ink); }
small { font-size: .82rem; color: var(--muted); }
code, kbd { font-family: var(--mono-font); font-size: .9em; background: var(--bg-2); padding: 2px 6px; border-radius: 4px; border: 1px solid var(--line); color: var(--ink); }

.eyebrow {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .22em;
  color: var(--accent-orange);
  margin-bottom: 1em;
}
.eyebrow--blue { color: var(--accent-blue); }
.eyebrow--grad {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.lead {
  font-size: clamp(1.05rem, 1.4vw, 1.2rem);
  line-height: 1.55;
  color: var(--ink-soft);
  max-width: 64ch;
}

/* =========================================================
   Layout
   ========================================================= */
.wrap   { max-width: var(--max); margin: 0 auto; padding: 0 var(--gutter); }
.section { padding: clamp(64px, 9vw, 120px) 0; position: relative; }
.section--alt { background: var(--bg-1); }
.section--ink { background: #000; }
.section-title { max-width: 780px; margin: 0 0 56px; }

/* =========================================================
   Navigation
   ========================================================= */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: rgba(5,5,7,.78);
  backdrop-filter: saturate(160%) blur(16px);
  -webkit-backdrop-filter: saturate(160%) blur(16px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  display: flex; align-items: center; justify-content: space-between;
  max-width: var(--max); margin: 0 auto;
  padding: 14px var(--gutter);
}
.nav-logo { display: flex; align-items: center; gap: 12px; }
.nav-logo img, .nav-logo svg { height: 48px; width: 48px; }
@media (max-width: 720px) {
  .nav-logo img, .nav-logo svg { height: 40px; width: 40px; }
}
.nav-logo .nav-wordmark {
  font-family: var(--sans-font);
  font-weight: 700; letter-spacing: .12em; font-size: 1.15rem;
  text-transform: uppercase; white-space: nowrap;
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
/* Brand wordmark adapts to the available space, using one of three forms:
   - nav bar: "OSE - Music App", collapsing to just "OSE" on small phones;
   - footer: the full "Outhentic Sound Engine" (there is room for it). */
.nav-wordmark .wm-l, .nav-wordmark .wm-m, .nav-wordmark .wm-s { display: none; }
.nav-logo .nav-wordmark .wm-m { display: inline; }
@media (max-width: 340px) {
  .nav-logo .nav-wordmark .wm-m { display: none; }
  .nav-logo .nav-wordmark .wm-s { display: inline; }
}
/* Footer has room for the full name. */
.foot-mark .nav-wordmark .wm-l { display: inline; }
.nav-links { display: flex; align-items: center; gap: 28px; }
.nav-links a {
  font-size: .86rem; font-weight: 500; letter-spacing: .02em;
  color: var(--ink-soft); position: relative; padding: 6px 0;
  transition: color .2s ease;
}
.nav-links a:hover, .nav-links a.is-active { color: var(--ink); }
.nav-links a.is-active::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: -2px; height: 1.5px;
  background: var(--accent-grad);
}
.nav-links a.nav-cta {
  font-size: .82rem; font-weight: 600; letter-spacing: .12em;
  text-transform: uppercase; padding: 9px 26px;
  border: 1px solid var(--line-strong); border-radius: 999px;
  color: var(--ink); transition: all .2s ease;
}
.nav-links a.nav-cta:hover {
  border-color: transparent;
  background: var(--accent-grad);
  color: #000;
}
.nav-toggle { display: none; }

@media (max-width: 880px) {
  .nav-toggle {
    display: flex; flex-direction: column; gap: 5px;
    width: 30px; height: 30px; align-items: flex-end; justify-content: center;
  }
  .nav-toggle span { display: block; width: 24px; height: 1.5px; background: var(--ink); transition: transform .25s, opacity .25s; }
  .nav-toggle.open span:nth-child(1) { transform: translateY(6.5px) rotate(45deg); }
  .nav-toggle.open span:nth-child(2) { opacity: 0; }
  .nav-toggle.open span:nth-child(3) { transform: translateY(-6.5px) rotate(-45deg); }
  .nav-links {
    position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: 10px var(--gutter) 22px;
    transform: translateY(-12px); opacity: 0; pointer-events: none;
    transition: transform .25s, opacity .25s;
  }
  .nav-links.open { transform: translateY(0); opacity: 1; pointer-events: auto; }
  .nav-links a { width: 100%; padding: 14px 0; border-bottom: 1px solid var(--line); }
  .nav-links a:last-child { border-bottom: 0; }
  .nav-links a.nav-cta { padding: 12px 26px; text-align: center; margin-top: 8px; align-self: stretch; }
}

/* =========================================================
   Hero
   ========================================================= */
.hero {
  position: relative;
  padding: clamp(80px, 14vw, 160px) 0 clamp(60px, 10vw, 120px);
  background:
    radial-gradient(1100px 600px at 20% 20%, rgba(79,168,255,0.16), transparent 60%),
    radial-gradient(1000px 600px at 85% 85%, rgba(255,139,61,0.18), transparent 60%),
    var(--bg);
  overflow: hidden;
}
.hero-grid {
  display: grid; grid-template-columns: 1fr; gap: 56px;
  align-items: center;
}
@media (min-width: 920px) {
  .hero-grid { grid-template-columns: 1.2fr 1fr; gap: clamp(40px, 5vw, 80px); }
}
.hero h1 {
  font-size: clamp(2.6rem, 6vw, 5rem);
  margin-bottom: .35em;
}
.hero h1 .grad-word {
  background: var(--accent-grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero .lead { margin: 0 0 2em; max-width: 56ch; }

.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.store-badge {
  display: inline-flex; align-items: center; gap: 12px;
  padding: 11px 22px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: rgba(255,255,255,0.02);
  color: var(--ink);
  font-size: .9rem; font-weight: 500;
  transition: all .2s ease;
}
.store-badge:hover {
  border-color: transparent;
  background: var(--accent-grad);
  color: #000;
}
.store-badge svg { width: 22px; height: 22px; flex: 0 0 auto; }
.store-badge .store-line { display: flex; flex-direction: column; line-height: 1.1; align-items: flex-start; }
.store-badge .store-pre { font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.store-badge:hover .store-pre { color: rgba(0,0,0,.72); }
/* The global `strong{color:var(--ink)}` rule (light) overrides the inherited
   #000 on hover, so the label washed out on the bright gradient. Set it dark. */
.store-badge:hover strong { color: #0a0a0d; }
.store-badge:hover svg { color: #0a0a0d; }

/* =========================================================
   Hub cards (the OSE-app card spec, web-translated)
   12dp outer / 14dp radius / 0.5dp accent border / flat hub surface
   ========================================================= */
.hub-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: var(--card-pad);
  transition: border-color .2s, transform .25s, background .25s;
  position: relative;
  overflow: hidden;
}
.hub-card::before {
  content: ""; position: absolute; inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: var(--accent-grad-soft);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity .25s;
  pointer-events: none;
}
.hub-card:hover { border-color: transparent; transform: translateY(-2px); background: var(--surface-2); }
.hub-card:hover::before { opacity: 1; }

a.hub-card { display: block; color: inherit; }

/* =========================================================
   Home grid - matches MainScreen.kt
   Each card: title (accent) + subtitle on top, wide-icon
   visualization fills the bottom (per *Wide functions in
   MainScreenIconsAnimated.kt). 14dp corners, 0.5dp accent
   border, 12dp outer / 16dp gap.
   ========================================================= */
.module-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}
@media (min-width: 720px) { .module-grid { grid-template-columns: repeat(4, 1fr); gap: 16px; } }

.module-card {
  aspect-ratio: 1 / 1;
  display: flex; flex-direction: column;
  text-align: left;
  padding: 18px 18px 0;
  background: rgba(20,20,26,0.80);
  border: 1px solid;
  border-color: rgba(255,255,255,0.05);
  border-radius: 14px;
  position: relative; overflow: hidden;
  transition: transform .25s, background .25s, border-color .2s;
  /* The card's accent color drives both the title text and the SVG
     stroke/fill via currentColor. */
  color: var(--c-play);
}
.module-card:hover { background: rgba(28,28,34,0.92); transform: translateY(-2px); }

.module-card.mc--play       { color: var(--c-play);       border-color: rgba(255,138,42,0.45); }
.module-card.mc--audio      { color: var(--c-audio);      border-color: rgba(224,90,107,0.45); }
.module-card.mc--midi       { color: var(--c-midi);       border-color: rgba(177,139,255,0.45); }
.module-card.mc--practice   { color: var(--c-practice);   border-color: rgba(93,202,165,0.45); }
.module-card.mc--metronome  { color: var(--c-metronome);  border-color: rgba(80,200,120,0.45); }
.module-card.mc--tuner      { color: var(--c-tuner);      border-color: rgba(133,183,235,0.45); }
.module-card.mc--signalgen  { color: var(--c-signalgen);  border-color: rgba(79,209,197,0.45); }
.module-card.mc--meters     { color: var(--c-meters);     border-color: rgba(243,139,160,0.45); }

.module-card.is-emphasized {
  background:
    radial-gradient(120% 80% at 80% 100%, rgba(255,138,42,0.30), transparent 60%),
    radial-gradient(80% 60% at 0% 0%,    rgba(74,163,255,0.10), transparent 70%),
    rgba(20,20,26,0.92);
}

.module-card .mc-head {
  flex: 0 0 auto;
}
.module-card .mc-name {
  font-size: clamp(.95rem, 1.8vw, 1.15rem);
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: currentColor;
  line-height: 1.1;
}
.module-card .mc-sub {
  font-size: .72rem;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: .02em;
  margin-top: 6px;
  line-height: 1.3;
}

.module-card .mc-viz {
  flex: 1;
  margin-top: 14px;
  display: flex;
  align-items: end;
  justify-content: stretch;
  overflow: hidden;
}
.module-card .mc-viz svg {
  width: 100%;
  height: 60%;
  max-height: 70px;
  display: block;
}
@media (min-width: 720px) {
  .module-card .mc-viz svg { max-height: 90px; }
}

/* Module page header card */
.module-hero {
  display: grid;
  grid-template-columns: 1fr;
  gap: 36px;
  padding: clamp(56px, 8vw, 96px) 0 clamp(40px, 6vw, 72px);
  align-items: center;
}
@media (min-width: 920px) {
  .module-hero { grid-template-columns: 1.1fr 1fr; gap: 60px; }
}

/* Phone-frame mockup container */
.phone-frame {
  /* Android phone (Samsung S26 Ultra style): thin uniform bezel, gently
     squared corners, centre punch-hole camera (see ::before). */
  width: 100%; max-width: 320px; aspect-ratio: 380 / 800;
  margin: 0 auto;
  background: #000;
  border-radius: 30px;
  border: 5px solid #0a0a0a;
  box-shadow:
    0 30px 60px rgba(0,0,0,0.6),
    0 0 0 1.5px rgba(255,255,255,0.10),
    inset 0 0 0 1px rgba(255,255,255,0.05);
  overflow: hidden;
  position: relative;
}
.phone-frame::before {
  /* Centre punch-hole camera (Android), not an iPhone notch. */
  content: ""; position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
  width: 9px; height: 9px; background: #000; border-radius: 50%;
  box-shadow: 0 0 0 1.5px rgba(255,255,255,0.10);
  z-index: 3;
}
.phone-frame svg { width: 100%; height: 100%; display: block; }
.phone-frame--landscape { aspect-ratio: 19.5 / 9; max-width: 600px; }


/* Interactive ("clickable") mockups - see ose-mockups.js */
.phone-frame[data-interactive] { cursor: default; }
.phone-frame[data-interactive]::before { pointer-events: none; }
.phone-frame[data-interactive] .mk-key,
.phone-frame[data-interactive] .mk-pad,
.phone-frame[data-interactive] .mk-tab,
.phone-frame[data-interactive] .mk-pick,
.phone-frame[data-interactive] .mk-toggle,
.phone-frame[data-interactive] .mk-press,
.phone-frame[data-interactive] .mk-step { cursor: pointer; -webkit-tap-highlight-color: transparent; }
.phone-frame[data-interactive] .mk-key,
.phone-frame[data-interactive] .mk-pad { transition: fill .04s linear; }
.phone-frame[data-interactive] .mk-tab text,
.phone-frame[data-interactive] .mk-pick text { transition: fill .15s ease; }
.phone-frame[data-interactive] .mk-trk,
.phone-frame[data-interactive] .mk-knob { transition: fill .15s ease, cx .15s ease; }

/* =========================================================
   Manual / control reference table
   ========================================================= */
.spec-list {
  display: grid; gap: 0;
  border-top: 1px solid var(--line);
  margin: 24px 0;
}
.spec-row {
  display: grid;
  grid-template-columns: 1fr 2.2fr;
  gap: 24px;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
  align-items: start;
}
.spec-row dt {
  font-size: .78rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em;
  color: var(--accent-orange);
  margin: 0;
}
.spec-row dd { margin: 0; color: var(--ink-soft); font-size: .95rem; line-height: 1.55; }
.spec-row dd p { margin: 0 0 .6em; color: inherit; }
.spec-row dd p:last-child { margin-bottom: 0; }
@media (max-width: 720px) {
  .spec-row { grid-template-columns: 1fr; gap: 6px; }
}

/* =========================================================
   Step-by-step (tutorial blocks)
   ========================================================= */
.steps { counter-reset: step; display: grid; gap: 22px; }
.step {
  display: grid; grid-template-columns: 44px 1fr; gap: 18px;
  align-items: start;
  padding: 22px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.step::before {
  counter-increment: step;
  content: counter(step, decimal-leading-zero);
  font-family: var(--mono-font); font-size: .92rem;
  display: grid; place-items: center;
  width: 44px; height: 44px; border-radius: 999px;
  background: var(--bg-2); color: var(--accent-orange);
  border: 1px solid var(--line-strong);
}
.step h3 { margin: 0 0 6px; font-size: 1.08rem; }
.step p { margin: 0; }
.step p + p { margin-top: 8px; }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 12px 22px;
  font-size: .82rem; font-weight: 600; text-transform: uppercase; letter-spacing: .14em;
  border: 1px solid var(--line-strong); border-radius: 999px;
  background: transparent; color: var(--ink);
  transition: all .2s;
}
.btn:hover { border-color: transparent; background: var(--accent-grad); color: #000; }
.btn--accent { border-color: transparent; background: var(--accent-grad); color: #000; }
.btn--accent:hover { filter: brightness(1.08); }
.btn--ghost { border-color: var(--line); color: var(--ink-soft); }
.btn--ghost:hover { background: var(--surface-2); border-color: var(--line-strong); color: var(--ink); }
.btn .arrow { transition: transform .2s; }
.btn:hover .arrow { transform: translateX(4px); }

.tag {
  display: inline-flex; align-items: center;
  font-size: .68rem; font-weight: 600;
  text-transform: uppercase; letter-spacing: .14em;
  padding: 4px 10px; border-radius: 999px;
  background: rgba(255,139,61,0.12); color: var(--accent-orange);
  border: 1px solid rgba(255,139,61,0.25);
}
.tag--blue { background: rgba(79,168,255,0.12); color: var(--accent-blue); border-color: rgba(79,168,255,0.25); }
.tag--muted { background: var(--bg-2); color: var(--muted); border-color: var(--line); }

/* =========================================================
   Callouts
   ========================================================= */
.callout {
  background: var(--bg-1);
  border-left: 3px solid var(--accent-orange);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  margin: 24px 0;
}
.callout h4 { margin-bottom: 6px; color: var(--accent-orange); }
.callout--blue { border-left-color: var(--accent-blue); }
.callout--blue h4 { color: var(--accent-blue); }
.callout p:last-child { margin: 0; }

/* =========================================================
   Two-column flexible content
   ========================================================= */
.cols-2 { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 720px) { .cols-2 { grid-template-columns: 1fr 1fr; gap: 28px; } }
.cols-3 { display: grid; grid-template-columns: 1fr; gap: 24px; }
@media (min-width: 720px) { .cols-3 { grid-template-columns: repeat(3, 1fr); gap: 24px; } }

/* =========================================================
   Footer
   ========================================================= */
.foot {
  background: #000;
  border-top: 1px solid var(--line);
  padding: 56px 0 36px;
  margin-top: 80px;
}
.foot-grid {
  display: grid; gap: 32px;
  grid-template-columns: 1fr;
}
@media (min-width: 720px) { .foot-grid { grid-template-columns: 2fr 1fr 1fr 1fr; } }
.foot h4 { color: var(--ink); margin-bottom: 14px; font-size: .76rem; }
.foot a { display: block; padding: 5px 0; color: var(--muted); font-size: .9rem; }
.foot a:hover { color: var(--ink); }
.foot-mark { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.foot-mark img, .foot-mark svg { width: 44px; height: 44px; }
.foot-tag { color: var(--muted); font-size: .88rem; max-width: 32ch; }
.foot-bottom {
  margin-top: 40px; padding-top: 24px;
  border-top: 1px solid var(--line);
  display: flex; align-items: center;
  gap: 28px;
  flex-wrap: wrap;          /* wraps cleanly on phones; on desktop sits in one line */
  font-size: .82rem; color: var(--muted);
}
.fb-item {
  display: inline-flex; align-items: center;
  gap: 8px;
  white-space: nowrap;
}
.fb-item svg {
  width: 14px; height: 14px;
  flex: 0 0 14px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.fb-item a { color: inherit; }
.fb-item a:hover { color: var(--ink); }
/* The middle and last items push right on wide screens so the row
   reads "copyright · site · email" left/centre/right. On narrow
   screens the wrap kicks in and they stack with even gaps. */
@media (min-width: 720px) {
  .foot-bottom { flex-wrap: nowrap; justify-content: flex-start; }
  .fb-item--site { margin-left: auto; }
}

/* =========================================================
   Newsletter signup (footer)
   Static-site friendly - mailto fallback by default, optional
   endpoint URL for any HTTP receiver (Formspree / Cloudflare /
   self-hosted). See ose-newsletter.js for the spam-protection
   details (honeypot + time-check + email regex).
   ========================================================= */
.nl {
  margin-top: 48px; padding-top: 32px;
  border-top: 1px solid var(--line);
}
.nl-card {
  display: grid; gap: 14px;
  grid-template-columns: 1fr;
  align-items: start;
}
@media (min-width: 820px) {
  .nl-card { grid-template-columns: 1fr 1.4fr; gap: 32px; }
}
.nl-head { padding-top: 4px; }
.nl-headline {
  font-family: var(--sans-font);
  font-size: 1.2rem;
  color: var(--ink);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
  font-weight: 700;
}
.nl-subline {
  margin: 0;
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.55;
  max-width: 48ch;
}
.nl-form { display: flex; flex-direction: column; gap: 10px; }
.nl-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}
@media (min-width: 560px) {
  .nl-row { grid-template-columns: 1fr 1.4fr auto; }
}
.nl-name, .nl-email {
  background: #000;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--ink);
  font-family: var(--sans-font);
  font-size: .95rem;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
.nl-name::placeholder, .nl-email::placeholder { color: rgba(255,255,255,0.35); }
.nl-name:focus, .nl-email:focus {
  border-color: var(--c-play);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--c-play) 45%, transparent);
}
.nl-submit {
  background: var(--ink); color: #000;
  border: 0; border-radius: 10px;
  padding: 0 22px;
  min-height: 44px;
  font-family: var(--sans-font);
  font-size: .86rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: filter .12s, transform .08s;
}
.nl-submit:hover:not(:disabled) { filter: brightness(0.92); }
.nl-submit:active:not(:disabled) { transform: scale(0.98); }
.nl-submit:disabled { opacity: 0.55; cursor: progress; }
/* Honeypot - visually hidden but still in DOM so spam bots see it. */
.nl-trap {
  position: absolute !important;
  left: -10000px !important;
  top: auto;
  width: 1px; height: 1px;
  overflow: hidden;
}
.nl-feedback {
  font-size: .86rem;
  min-height: 1.2em;
  padding: 4px 0;
}
.nl-feedback[data-state="ok"] { color: #5DCAA5; }
.nl-feedback[data-state="error"] { color: #E05A6B; }
.nl-fineprint {
  color: var(--muted);
  font-size: .74rem;
  line-height: 1.55;
  max-width: 60ch;
}

/* =========================================================
   Reveals (animate-on-scroll)
   ========================================================= */
@media (prefers-reduced-motion: no-preference) {
  .reveal { opacity: 0; transform: translateY(14px); transition: opacity .7s ease, transform .7s ease; }
  .reveal.is-in { opacity: 1; transform: none; }
}

/* =========================================================
   Module-page interactive demos
   (Play / Metronome / Signal Generator pages)
   ========================================================= */
.module-demo {
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line);
  border-radius: 22px;
  padding: 36px;
  margin: 48px 0 64px;
  position: relative;
  overflow: hidden;
}
.module-demo::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, color-mix(in srgb, currentColor 55%, transparent), transparent 65%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
.module-demo-label {
  font-family: var(--mono-font);
  font-size: .76rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: currentColor;
  margin-bottom: 10px;
}
.module-demo h2 {
  margin: 0 0 8px;
  font-size: clamp(1.6rem, 3vw, 2.2rem);
  color: var(--ink);
  font-weight: 700;
  letter-spacing: -.01em;
}
.module-demo > p {
  color: var(--ink-soft);
  margin: 0 0 28px;
  max-width: 60ch;
}

/* ---- Play module demo ---- */
.pm-controls { display: flex; flex-wrap: wrap; gap: 14px 22px; align-items: center; margin-bottom: 18px; }
.pm-controls-label {
  font-family: var(--mono-font);
  font-size: .68rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
}
.pm-voices { display: flex; gap: 6px; flex-wrap: wrap; }
.pm-voice {
  padding: 10px 18px;
  font-family: var(--mono-font);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .14em;
  background: color-mix(in srgb, var(--demo-accent) 5%, var(--bg-2));
  color: color-mix(in srgb, var(--demo-accent) 85%, var(--ink-soft));
  border: 1px solid color-mix(in srgb, var(--demo-accent) 30%, transparent);
  border-radius: 8px;
  cursor: pointer;
  transition: all .15s;
}
.pm-voice:hover {
  background: color-mix(in srgb, var(--demo-accent) 12%, var(--bg-2));
  border-color: color-mix(in srgb, var(--demo-accent) 55%, transparent);
}
.pm-voice.is-active {
  background: color-mix(in srgb, var(--demo-accent) 24%, transparent);
  color: var(--demo-accent);
  border-color: color-mix(in srgb, var(--demo-accent) 75%, transparent);
}
.pm-sustain {
  padding: 10px 22px;
  font-family: var(--mono-font);
  font-size: .78rem;
  font-weight: 800;
  letter-spacing: .14em;
  background: var(--bg-2);
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
  transition: all .15s;
}
.pm-sustain:hover { background: var(--surface-2); color: var(--ink); }
.pm-sustain.is-active {
  background: color-mix(in srgb, var(--demo-accent) 24%, transparent);
  color: var(--demo-accent);
  border-color: color-mix(in srgb, var(--demo-accent) 75%, transparent);
}
.pm-piano-wrap {
  background: #000;
  border-radius: 12px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.05);
  position: relative;
}
.pm-whites { display: flex; height: 220px; gap: 1px; }
.pm-blacks {
  position: absolute;
  top: 14px; left: 14px; right: 14px;
  height: 220px;
  pointer-events: none;
}
.pm-w-key {
  flex: 1;
  background: #FFFFF0;
  border-radius: 0 0 6px 6px;
  position: relative;
  cursor: pointer;
  transition: background-color .12s, filter .12s;
}
.pm-w-key:hover { filter: brightness(0.94); }
.pm-w-key.is-down { background: color-mix(in srgb, currentColor 45%, #FFFFF0); filter: brightness(0.85); }
.pm-key-label {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  font-family: var(--mono-font); font-size: .62rem; color: rgba(0,0,0,0.5);
  pointer-events: none; letter-spacing: .05em;
}
.pm-blacks { position: absolute; inset: 0; pointer-events: none; }
.pm-b-key {
  position: absolute; top: 0;
  height: 62%;
  background: #1a1a1f;
  border-radius: 0 0 4px 4px;
  cursor: pointer; pointer-events: auto;
  transition: background-color .12s, filter .12s;
  box-shadow: 0 2px 0 #050507, inset 0 -2px 4px rgba(255,255,255,0.05);
}
.pm-b-key:hover { filter: brightness(1.4); }
.pm-b-key.is-down { background: color-mix(in srgb, currentColor 65%, #1a1a1f); filter: brightness(1.4); }

/* ---- Metronome module demo ----
   This is a one-for-one port of MetronomeModule.kt + ClickTrackFace.kt.
   The face uses the same warm accent gradient + accent border,
   header layout (BPM left · polygon centre · meter right), and the
   beat strip below grows per beat (1-16 columns). Controls card +
   green/red START match StartButton + ActionButton chrome. */

.mm-face {
  border-radius: 14px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--demo-accent) 22%, transparent) 0%,
    color-mix(in srgb, var(--demo-accent) 6%, transparent) 50%,
    rgba(28,24,20,0.55) 100%);
  border: 0.5px solid color-mix(in srgb, var(--demo-accent) 55%, transparent);
  padding: 14px;
  display: flex; flex-direction: column;
  gap: 12px;
  margin-bottom: 14px;
}
.mm-face-head {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 14px;
}
.mm-bpm-block { padding-left: 2px; }
.mm-bpm {
  font-family: var(--mono-font);
  font-size: 50px;
  font-weight: 300;
  color: #FFFFFF;
  letter-spacing: -2.5px;
  line-height: 1;
  cursor: pointer;
}
.mm-bpm:focus { outline: none; }
.mm-bpm-edit {
  font-family: var(--mono-font);
  font-size: 50px;
  font-weight: 300;
  color: #FFFFFF;
  letter-spacing: -2.5px;
  line-height: 1;
  background: transparent;
  border: 0;
  outline: none;
  padding: 0;
  width: 5ch;
}
.mm-tempo {
  font-family: var(--mono-font);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 2.4px;
  color: rgba(255,255,255,0.85);
  margin-top: 4px;
}
.mm-poly-host { display: flex; align-items: center; justify-content: center; padding: 0 6px; }
.mm-poly { width: 52px; height: 52px; color: var(--demo-accent); }
.mm-meter {
  display: flex; flex-direction: column;
  align-items: flex-end;
  font-family: var(--mono-font);
  padding: 6px 4px 6px 12px;
  background: transparent;
  border: 0;
  border-radius: 8px;
  cursor: pointer;
  color: inherit;
  transition: background .12s;
  text-align: right;
}
.mm-meter:hover {
  background: color-mix(in srgb, var(--demo-accent) 8%, transparent);
}
.mm-meter:focus-visible {
  outline: 1px solid color-mix(in srgb, var(--demo-accent) 70%, transparent);
  outline-offset: 2px;
}
.mm-meter-row { display: flex; align-items: baseline; }
.mm-meter-row span:nth-child(1),
.mm-meter-row span:nth-child(3) { font-size: 26px; font-weight: 900; color: #FFFFFF; }
.mm-meter-row .mm-meter-slash { font-size: 18px; font-weight: 300; color: rgba(255,255,255,0.55); margin: 0 4px; }
.mm-meter-label {
  font-size: 9px; font-weight: 800;
  letter-spacing: 2.4px;
  color: rgba(255,255,255,0.55);
  margin-top: 4px;
}
.mm-strip {
  display: flex; gap: 6px;
  background: rgba(0,0,0,0.34);
  border-radius: 8px;
  padding: 8px 6px 8px 6px;
  /* Use a real height (not min-height) so % heights on .mm-col-bar
     have a definite reference. The accent column (78% of column =
     ~98 px) needs to clearly tower over the normal column (46% =
     ~58 px) and dwarf the muted column (22% = ~28 px). */
  height: 126px;
  border: 0.5px solid color-mix(in srgb, var(--demo-accent) 30%, transparent);
  overflow-x: auto;
  align-items: flex-end;
  scrollbar-width: thin;
}
.mm-strip::-webkit-scrollbar { height: 4px; }
.mm-strip::-webkit-scrollbar-thumb { background: color-mix(in srgb, var(--demo-accent) 40%, transparent); border-radius: 2px; }
.mm-col {
  flex: 1 0 36px;
  min-width: 34px;
  max-width: 56px;
  height: 100%;
  position: relative;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  display: flex; align-items: flex-end;
  outline: none;
}
/* Normal beat - moderate height, subtle accent tint */
.mm-col-bar {
  width: 100%;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--demo-accent) 55%, transparent),
    color-mix(in srgb, var(--demo-accent) 16%, transparent));
  border: 1px solid color-mix(in srgb, var(--demo-accent) 45%, transparent);
  border-radius: 5px;
  transition: height .16s ease-out, background .16s, border-color .16s, transform .12s, box-shadow .16s;
  display: flex; justify-content: center; align-items: flex-end;
  padding-bottom: 4px;
  color: rgba(255,255,255,0.85);
  font-family: var(--mono-font);
  font-size: 13px;
  font-weight: 700;
}
/* Accent beat - saturated solid fill, dark numeral, lifted glow.
   Visually has to dominate so the downbeat reads at a glance. */
.mm-col[data-state="accent"] .mm-col-bar {
  background: linear-gradient(180deg,
    var(--demo-accent),
    color-mix(in srgb, var(--demo-accent) 60%, transparent));
  border-color: var(--demo-accent);
  border-width: 1.5px;
  color: #1C1814;
  font-weight: 900;
  font-size: 15px;
  box-shadow:
    inset 0 1px 0 color-mix(in srgb, #FFFFFF 30%, transparent),
    0 2px 10px color-mix(in srgb, var(--demo-accent) 35%, transparent);
}
/* Muted beat - barely there, dashed feel */
.mm-col[data-state="muted"] .mm-col-bar {
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  border-color: rgba(255,255,255,0.18);
  color: rgba(255,255,255,0.30);
  font-weight: 600;
  font-size: 11px;
}
/* Live (playing) beat - white border + brighter color, brief flash */
.mm-col.is-live .mm-col-bar {
  background: var(--demo-accent) !important;
  border-color: #FFFFFF !important;
  border-width: 1.5px;
  color: #1C1814 !important;
  font-weight: 900;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.40),
    0 0 14px color-mix(in srgb, var(--demo-accent) 55%, transparent);
}

/* Controls card */
.mm-card {
  background: var(--bg-2);
  border: 1px solid color-mix(in srgb, var(--demo-accent) 30%, transparent);
  border-radius: 14px;
  padding: 14px;
  display: flex; flex-direction: column;
  gap: 14px;
  margin-bottom: 14px;
}
.mm-divider {
  height: 1px;
  background: color-mix(in srgb, var(--demo-accent) 18%, transparent);
}
.mm-bpm-row {
  display: flex; align-items: center;
  gap: 8px;
  height: 60px;
}
.mm-step {
  width: 44px; height: 44px;
  flex: 0 0 44px;
  border-radius: 12px;
  background: color-mix(in srgb, var(--demo-accent) 22%, transparent);
  border: 0.5px solid color-mix(in srgb, var(--demo-accent) 65%, transparent);
  color: #FFFFFF;
  font-size: 20px; font-weight: 300;
  font-family: var(--sans-font);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, transform .08s;
  user-select: none;
}
.mm-step:hover { background: color-mix(in srgb, var(--demo-accent) 32%, transparent); }
.mm-step:active { transform: scale(0.96); }
.mm-bpm-scrubber {
  flex: 1;
  height: 100%;
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  border: 0.5px solid color-mix(in srgb, var(--demo-accent) 55%, transparent);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  cursor: ew-resize;
  user-select: none;
  position: relative;
  touch-action: none;
}
.mm-bpm-scrubber-value {
  font-family: var(--mono-font);
  font-size: 32px;
  font-weight: 300;
  color: #FFFFFF;
  letter-spacing: -1px;
  line-height: 1;
}
.mm-bpm-scrubber-edit {
  font-family: var(--mono-font);
  font-size: 32px;
  font-weight: 300;
  color: #FFFFFF;
  letter-spacing: -1px;
  line-height: 1;
  background: transparent;
  border: 0;
  outline: none;
  text-align: center;
  width: 5ch;
  padding: 0;
  caret-color: var(--demo-accent);
}
.mm-bpm-scrubber-hint {
  font-family: var(--mono-font);
  font-size: 8px;
  letter-spacing: 1.6px;
  color: rgba(255,255,255,0.40);
  margin-top: 4px;
}
.mm-ts-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
}
.mm-ts-stepper {
  display: flex; align-items: center; gap: 6px;
}
.mm-ts-num {
  font-family: var(--mono-font);
  font-size: 26px;
  font-weight: 900;
  color: #FFFFFF;
  min-width: 36px;
  text-align: center;
  letter-spacing: -1px;
}
.mm-ts-labels {
  display: flex; gap: 8px; align-items: center;
  font-family: var(--mono-font);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.6px;
  color: rgba(255,255,255,0.55);
}
.mm-ts-dot { color: rgba(255,255,255,0.30); font-size: 11px; }
.mm-ts-chips { display: flex; gap: 4px; }
.mm-note-chip {
  height: 44px;
  min-width: 44px;
  padding: 0 12px;
  background: transparent;
  border: 0.5px solid color-mix(in srgb, var(--demo-accent) 65%, transparent);
  border-radius: 12px;
  color: rgba(255,255,255,0.55);
  font-family: var(--mono-font);
  font-size: 14px;
  cursor: pointer;
  transition: all .12s;
}
.mm-note-chip:hover { background: color-mix(in srgb, var(--demo-accent) 12%, transparent); color: #FFFFFF; }
.mm-note-chip.is-active {
  background: color-mix(in srgb, var(--demo-accent) 25%, transparent);
  color: var(--demo-accent);
  font-weight: 700;
}

/* Transport */
.mm-transport {
  display: flex; gap: 12px;
}
.mm-tap {
  flex: 1;
  height: 64px;
  border-radius: 14px;
  background: rgba(255,255,255,0.03);
  border: 0.5px solid color-mix(in srgb, var(--demo-accent) 65%, transparent);
  color: var(--demo-accent);
  font-family: var(--sans-font);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 1.6px;
  cursor: pointer;
  transition: background .12s, transform .08s;
}
.mm-tap:hover { background: color-mix(in srgb, var(--demo-accent) 10%, transparent); }
.mm-tap:active { transform: scale(0.98); }
.mm-tap.is-pulsing { background: color-mix(in srgb, var(--demo-accent) 35%, transparent); }

/* Meter picker sheet - mirrors MeterBottomSheet from the app */
.mm-sheet {
  position: fixed; inset: 0;
  z-index: 90;
  display: flex; align-items: flex-end; justify-content: center;
  pointer-events: none;
}
.mm-sheet[hidden] { display: none; }
.mm-sheet-scrim {
  position: absolute; inset: 0;
  background: rgba(0,0,0,0.55);
  pointer-events: auto;
  animation: mm-sheet-fade .18s ease both;
}
@keyframes mm-sheet-fade { from { opacity: 0; } to { opacity: 1; } }
.mm-sheet-card {
  position: relative;
  background: #15131A;
  border: 0.5px solid color-mix(in srgb, var(--c-metronome) 35%, transparent);
  border-radius: 18px 18px 0 0;
  width: 100%;
  max-width: 480px;
  padding: 10px 20px 28px;
  pointer-events: auto;
  box-shadow: 0 -16px 60px rgba(0,0,0,0.55);
  animation: mm-sheet-rise .22s ease-out both;
}
@media (min-width: 720px) {
  .mm-sheet { align-items: center; }
  .mm-sheet-card { border-radius: 18px; margin: 0 24px; }
}
@keyframes mm-sheet-rise {
  from { transform: translateY(40px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.mm-sheet-handle {
  width: 40px; height: 4px;
  background: rgba(255,255,255,0.18);
  border-radius: 2px;
  margin: 4px auto 14px;
}
.mm-sheet-title {
  font-family: var(--mono-font);
  font-size: 14px;
  font-weight: 900;
  letter-spacing: 2px;
  color: var(--c-metronome);
  margin: 0 0 6px;
}
.mm-sheet-sub {
  font-family: var(--sans-font);
  font-size: 12px;
  color: rgba(255,255,255,0.65);
  margin: 0 0 16px;
}
.mm-sheet-grid {
  display: flex; align-items: center; justify-content: center;
  gap: 6px;
  margin-bottom: 18px;
}
.mm-sheet-col {
  display: flex; flex-direction: column; align-items: center;
  gap: 8px;
}
.mm-sheet-label {
  font-family: var(--mono-font);
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 1.6px;
  color: var(--c-metronome);
}
.mm-sheet-slash {
  font-family: var(--mono-font);
  font-size: 28px;
  color: rgba(255,255,255,0.45);
  padding: 0 12px;
}
.mm-wheel {
  width: 90px;
  height: 170px;
  background: rgba(0,0,0,0.40);
  border-radius: 12px;
  border: 0.5px solid rgba(255,255,255,0.10);
  overflow-y: auto;
  scroll-snap-type: y mandatory;
  position: relative;
  scrollbar-width: none;
}
.mm-wheel::-webkit-scrollbar { display: none; }
.mm-wheel::before,
.mm-wheel::after {
  content: '';
  position: absolute; left: 0; right: 0;
  height: 70px;
  pointer-events: none;
  z-index: 2;
}
.mm-wheel::before {
  top: 0;
  background: linear-gradient(180deg, #15131A 0%, rgba(21,19,26,0) 100%);
}
.mm-wheel::after {
  bottom: 0;
  background: linear-gradient(0deg, #15131A 0%, rgba(21,19,26,0) 100%);
}
.mm-wheel-item {
  height: 42px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--mono-font);
  font-size: 22px;
  font-weight: 700;
  color: rgba(255,255,255,0.45);
  scroll-snap-align: center;
  cursor: pointer;
  transition: color .12s;
}
.mm-wheel-item:first-child { margin-top: 64px; }
.mm-wheel-item:last-child { margin-bottom: 64px; }
.mm-wheel-item.is-selected {
  color: var(--c-metronome);
  font-weight: 900;
  font-size: 26px;
}
.mm-wheel-item:hover { color: #FFFFFF; }
.mm-sheet-close {
  display: block;
  width: 100%;
  padding: 14px;
  background: var(--c-metronome);
  color: #1C1814;
  border: 0; border-radius: 12px;
  font-family: var(--sans-font);
  font-size: 12px;
  font-weight: 900;
  letter-spacing: 2.4px;
  cursor: pointer;
  transition: filter .12s, transform .08s;
}
.mm-sheet-close:hover { filter: brightness(1.08); }
.mm-sheet-close:active { transform: scale(0.98); }

.mm-control-row { display: none; }
.mm-control-row label {
  font-family: var(--mono-font);
  font-size: .72rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
  min-width: 60px;
}
.mm-slider, .sg-slider, .mm-vol-slider {
  -webkit-appearance: none; appearance: none;
  flex: 1; height: 8px; border-radius: 4px;
  background: linear-gradient(to right,
    var(--demo-accent) 0%,
    var(--demo-accent) var(--fill, 50%),
    rgba(255,255,255,0.10) var(--fill, 50%),
    rgba(255,255,255,0.10) 100%);
  outline: none;
  cursor: pointer;
}
.mm-slider::-webkit-slider-thumb,
.sg-slider::-webkit-slider-thumb,
.mm-vol-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--demo-accent); cursor: pointer;
  box-shadow: 0 2px 8px rgba(0,0,0,0.55);
  border: 2px solid #000;
}
.mm-slider::-moz-range-thumb,
.sg-slider::-moz-range-thumb,
.mm-vol-slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--demo-accent); border: 2px solid #000;
  cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.55);
}
.mm-slider:disabled, .sg-slider:disabled, .mm-vol-slider:disabled { opacity: 0.45; cursor: not-allowed; }
.mm-slider:disabled::-webkit-slider-thumb,
.sg-slider:disabled::-webkit-slider-thumb,
.mm-vol-slider:disabled::-webkit-slider-thumb { background: var(--muted); }
.mm-slider:disabled::-moz-range-thumb,
.sg-slider:disabled::-moz-range-thumb,
.mm-vol-slider:disabled::-moz-range-thumb { background: var(--muted); }

/* "Free in your browser" callout - small badge that sits above the
   interactive tool demos. Reinforces the messaging that search
   engines pick up from the JSON-LD WebApplication entries. */
.free-badge {
  display: inline-flex; align-items: center;
  gap: 8px;
  margin: 0 0 18px;
  padding: 8px 14px;
  background: color-mix(in srgb, var(--demo-accent) 14%, transparent);
  color: var(--demo-accent);
  border: 0.5px solid color-mix(in srgb, var(--demo-accent) 50%, transparent);
  border-radius: 999px;
  font-family: var(--mono-font);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.6px;
  text-transform: uppercase;
}
.free-badge::before {
  content: '';
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--demo-accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--demo-accent) 25%, transparent);
}

/* Volume row inside the metronome controls card */
.mm-vol-row {
  display: flex; align-items: center;
  gap: 14px;
  min-height: 44px;       /* matches the BPM/step pill row height */
}
.mm-vol-label {
  font-family: var(--mono-font);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.6px;
  color: rgba(255,255,255,0.55);
  min-width: 96px;
  cursor: pointer;
  user-select: none;
  transition: color .12s;
}
.mm-vol-label:hover { color: var(--demo-accent); }
.mm-vol-value {
  font-family: var(--mono-font);
  font-size: 13px;
  font-weight: 800;
  color: #FFFFFF;
  min-width: 48px;
  text-align: right;
  letter-spacing: -.01em;
}

.mm-slider-value {
  font-family: var(--mono-font); font-size: .92rem;
  color: var(--ink); font-weight: 700;
  min-width: 70px; text-align: right;
  letter-spacing: -.01em;
}
.mm-start {
  flex: 2;
  height: 64px;
  border-radius: 14px;
  background: #43A047;
  color: #FFFFFF;
  border: 0;
  font-family: var(--sans-font);
  font-size: 15px;
  font-weight: 900;
  letter-spacing: 2.4px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  gap: 8px;
  transition: background .22s, box-shadow .22s, transform .08s;
  box-shadow: 0 4px 14px rgba(67,160,71,0.35);
}
.mm-start-icon { display: inline-flex; align-items: center; }
.mm-start:hover { filter: brightness(1.08); }
.mm-start:active { transform: scale(0.98); }
.mm-start[data-running="true"] {
  background: #E53935;
  box-shadow: 0 4px 14px rgba(229,57,53,0.40);
}

/* ---- Signal Generator module demo ---- */
.sg-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 28px;
}
@media (min-width: 820px) {
  .sg-grid { grid-template-columns: 1.2fr 1fr; gap: 40px; }
}
.sg-display {
  background: #000;
  border-radius: 14px;
  padding: 18px 20px;
  border: 1px solid color-mix(in srgb, var(--demo-accent) 22%, transparent);
  position: relative;
}
.sg-viz-tabs {
  display: flex; gap: 6px;
  margin-bottom: 10px;
}
.sg-viz-tab {
  flex: 0 0 auto;
  padding: 6px 12px;
  background: transparent;
  border: 0.5px solid color-mix(in srgb, var(--demo-accent) 35%, transparent);
  border-radius: 6px;
  color: rgba(255,255,255,0.55);
  font-family: var(--mono-font);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 1.6px;
  cursor: pointer;
  transition: all .12s;
}
.sg-viz-tab:hover { background: color-mix(in srgb, var(--demo-accent) 10%, transparent); color: #FFFFFF; }
.sg-viz-tab.is-active {
  background: color-mix(in srgb, var(--demo-accent) 22%, transparent);
  color: var(--demo-accent);
  border-color: color-mix(in srgb, var(--demo-accent) 70%, transparent);
}
.sg-viz {
  position: relative;
}
.sg-svg { width: 100%; height: 200px; display: block; }
/* Frequency axis labels - absolute-positioned at log-spaced positions
   to match the spectrum's log x-axis exactly.
   Log positions across [30, 20000] Hz:
     30 →   0.00%
     100 →  18.51%
     1k →  53.91%
     10k → 89.31%
     20k → 100.00% */
.sg-axis {
  position: relative;
  height: 12px;
  padding: 4px 0 0;
  font-family: var(--mono-font);
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 1.2px;
  color: #5A5F68;
}
.sg-axis span {
  position: absolute;
  top: 4px;
  transform: translateX(-50%);
  white-space: nowrap;
}
.sg-axis span:nth-child(1) { left: 0;       transform: none; }
.sg-axis span:nth-child(2) { left: 18.5%; }
.sg-axis span:nth-child(3) { left: 53.9%; }
.sg-axis span:nth-child(4) { left: 89.3%; }
.sg-axis span:nth-child(5) { left: 100%;    transform: translateX(-100%); }

/* Typed frequency entry */
.sg-freq-entry {
  display: flex; align-items: center;
  gap: 10px; flex-wrap: wrap;
  margin-bottom: 14px;
  padding: 12px;
  background: rgba(255,255,255,0.03);
  border: 0.5px solid color-mix(in srgb, var(--demo-accent) 35%, transparent);
  border-radius: 10px;
}
.sg-freq-entry-label {
  font-family: var(--mono-font);
  font-size: 9px; letter-spacing: 1.6px;
  font-weight: 800;
  color: var(--demo-accent);
}
.sg-freq-input {
  flex: 1;
  min-width: 100px;
  background: #000;
  border: 0.5px solid color-mix(in srgb, var(--demo-accent) 55%, transparent);
  border-radius: 8px;
  padding: 10px 12px;
  font-family: var(--mono-font);
  font-size: 18px;
  font-weight: 700;
  color: #FFFFFF;
  -moz-appearance: textfield;
}
.sg-freq-input::-webkit-outer-spin-button,
.sg-freq-input::-webkit-inner-spin-button {
  -webkit-appearance: none; margin: 0;
}
.sg-freq-input:focus {
  outline: none;
  border-color: var(--demo-accent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--demo-accent) 50%, transparent);
}
.sg-freq-entry-unit {
  font-family: var(--mono-font);
  font-size: 10px; letter-spacing: 1.4px;
  font-weight: 800;
  color: rgba(255,255,255,0.55);
}
.sg-freq-presets {
  display: flex; gap: 4px;
  width: 100%;
}
.sg-preset {
  flex: 1;
  padding: 8px 0;
  background: transparent;
  border: 0.5px solid color-mix(in srgb, var(--demo-accent) 35%, transparent);
  border-radius: 6px;
  color: rgba(255,255,255,0.65);
  font-family: var(--mono-font);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all .12s;
}
.sg-preset:hover {
  background: color-mix(in srgb, var(--demo-accent) 12%, transparent);
  color: var(--demo-accent);
  border-color: color-mix(in srgb, var(--demo-accent) 60%, transparent);
}
.sg-readout {
  display: flex; align-items: baseline; gap: 14px;
  margin-top: 12px;
  padding-top: 14px;
  border-top: 1px solid rgba(255,255,255,0.06);
}
.sg-readout-freq {
  font-family: var(--mono-font);
  font-size: 2rem; font-weight: 300;
  color: currentColor;
  letter-spacing: -.02em;
}
.sg-readout-status {
  margin-left: auto;
  font-family: var(--mono-font);
  font-size: .76rem; letter-spacing: .18em;
  color: var(--muted);
  font-weight: 700;
}
.sg-chips {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}
.sg-chips-row-2 { grid-template-columns: repeat(3, 1fr); margin-bottom: 22px; }
.sg-chip {
  padding: 14px 0;
  font-family: var(--mono-font);
  font-size: .76rem; font-weight: 800;
  letter-spacing: .16em;
  background: color-mix(in srgb, var(--demo-accent) 5%, var(--bg-2));
  color: color-mix(in srgb, var(--demo-accent) 80%, var(--ink-soft));
  border: 1px solid color-mix(in srgb, var(--demo-accent) 30%, transparent);
  border-radius: 8px;
  cursor: pointer;
  transition: all .12s;
}
.sg-chip:hover {
  background: color-mix(in srgb, var(--demo-accent) 12%, var(--bg-2));
  border-color: color-mix(in srgb, var(--demo-accent) 55%, transparent);
  color: var(--demo-accent);
}
.sg-chip.is-active {
  background: color-mix(in srgb, var(--demo-accent) 24%, transparent);
  color: var(--demo-accent);
  border-color: color-mix(in srgb, var(--demo-accent) 80%, transparent);
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--demo-accent) 60%, transparent) inset;
}
.sg-control { display: flex; align-items: center; gap: 14px; margin-bottom: 16px; }
.sg-control label {
  font-family: var(--mono-font);
  font-size: .72rem; letter-spacing: .14em;
  text-transform: uppercase; color: var(--muted);
  min-width: 60px;
}
.sg-slider-value {
  font-family: var(--mono-font);
  font-size: .92rem; color: var(--ink);
  font-weight: 700;
  min-width: 80px; text-align: right;
  letter-spacing: -.01em;
}
.sg-play {
  margin-top: 14px;
  width: 100%;
  padding: 16px;
  font-family: var(--sans-font);
  font-size: .9rem; font-weight: 900;
  letter-spacing: .22em; text-transform: uppercase;
  background: var(--demo-accent); color: #000;
  border: 0; border-radius: 12px;
  cursor: pointer; transition: all .15s;
  box-shadow: 0 4px 14px color-mix(in srgb, var(--demo-accent) 35%, transparent);
}
.sg-play:hover { filter: brightness(1.10); transform: translateY(-1px); }
.sg-play[data-running="true"] { background: var(--c-rec-red); color: #FFFFFF; box-shadow: 0 4px 14px rgba(239,75,75,0.35); }

/* Accent color applied to the demo + a separate --demo-accent custom
   property. We need both because some children (buttons, chips) set
   color: #000 locally, which would make `currentColor` resolve to
   black for their background. The custom property survives. */
.module-demo.mc--play       { color: var(--c-play);      --demo-accent: var(--c-play); }
.module-demo.mc--metronome  { color: var(--c-metronome); --demo-accent: var(--c-metronome); }
.module-demo.mc--signalgen  { color: var(--c-signalgen); --demo-accent: var(--c-signalgen); }

/* =========================================================
   Animations - match the actual app's motion language
   Color palette pulled from source: ui/theme/InstrumentHubSkin.kt
   ========================================================= */

/* Module accent palette - exact values from MainScreen.kt */
:root {
  --c-play:        #FF8B3D;   /* current instrument default */
  --c-audio:       #E05A6B;   /* muted red */
  --c-midi:        #B18BFF;   /* lavender */
  --c-practice:    #5DCAA5;   /* mint */
  --c-metronome:   #50C878;   /* green - matches the app's real metronome accent */
  --c-tuner:       #85B7EB;   /* sky blue */
  --c-signalgen:   #4FD1C5;   /* teal */
  --c-meters:      #F38BA0;   /* coral */
  --c-led-green:   #3CCB69;   /* in-tune lock */
  --c-led-red:     #E2503A;
  --c-rec-red:     #EF4B4B;
  --c-plate:       #0a0a0d;   /* mainPlateBase */
  --c-card-bg:     rgba(20,20,26,0.92);
  --c-card-line:   rgba(255,255,255,0.06);
}

/* GlowingO logo - the inner wave runs a traveling sine ripple driven by JS
   (assets/js/ose-main.js), matching the app's GlowingO exactly. No CSS
   transform here: a scale pulse would distort the JS-rebuilt path. */
.anim-glowo-wave { animation: none; }

/* REC red pulse */
@keyframes rec-pulse {
  0%, 100% { opacity: 0.88; }
  50%      { opacity: 1.0;  }
}
@keyframes rec-glow {
  0%, 100% { filter: drop-shadow(0 0 0 rgba(239,75,75,0.0)); }
  50%      { filter: drop-shadow(0 0 14px rgba(239,75,75,0.65)); }
}
.anim-rec      { animation: rec-pulse 1.0s ease-in-out infinite; }
.anim-rec-glow { animation: rec-glow  1.0s ease-in-out infinite; }

/* Keyboard key cycle (Play tile) - 7 keys, one highlights at a time */
@keyframes key-cycle-1 { 0%, 14% { opacity: 1; } 14.01%, 100% { opacity: 0; } }
@keyframes key-cycle-2 { 14.01%, 28% { opacity: 1; } 28.01%, 100% { opacity: 0; } 0%, 14% { opacity: 0; } }
@keyframes key-cycle-3 { 28.01%, 42% { opacity: 1; } 42.01%, 100% { opacity: 0; } 0%, 28% { opacity: 0; } }
@keyframes key-cycle-4 { 42.01%, 57% { opacity: 1; } 57.01%, 100% { opacity: 0; } 0%, 42% { opacity: 0; } }
@keyframes key-cycle-5 { 57.01%, 71% { opacity: 1; } 71.01%, 100% { opacity: 0; } 0%, 57% { opacity: 0; } }
@keyframes key-cycle-6 { 71.01%, 85% { opacity: 1; } 85.01%, 100% { opacity: 0; } 0%, 71% { opacity: 0; } }
@keyframes key-cycle-7 { 85.01%, 100% { opacity: 1; } 0%, 85% { opacity: 0; } }
.anim-key-1 { animation: key-cycle-1 14s linear infinite; }
.anim-key-2 { animation: key-cycle-2 14s linear infinite; }
.anim-key-3 { animation: key-cycle-3 14s linear infinite; }
.anim-key-4 { animation: key-cycle-4 14s linear infinite; }
.anim-key-5 { animation: key-cycle-5 14s linear infinite; }
.anim-key-6 { animation: key-cycle-6 14s linear infinite; }
.anim-key-7 { animation: key-cycle-7 14s linear infinite; }

/* Audio waveform ribbon - moving brightness wave through 22 bars */
@keyframes audio-ribbon {
  0%   { transform: translateX(0); }
  100% { transform: translateX(160px); }
}
.anim-audio-ribbon { animation: audio-ribbon 5s linear infinite; }

/* MIDI note pulse - staggered phases */
@keyframes midi-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.anim-midi-1 { animation: midi-pulse 3s ease-in-out infinite; }
.anim-midi-2 { animation: midi-pulse 3s ease-in-out infinite; animation-delay: -0.4s; }
.anim-midi-3 { animation: midi-pulse 3s ease-in-out infinite; animation-delay: -0.8s; }
.anim-midi-4 { animation: midi-pulse 3s ease-in-out infinite; animation-delay: -1.2s; }
.anim-midi-5 { animation: midi-pulse 3s ease-in-out infinite; animation-delay: -1.6s; }
.anim-midi-6 { animation: midi-pulse 3s ease-in-out infinite; animation-delay: -2.0s; }

/* Practice playhead sweep */
@keyframes practice-sweep { 0% { transform: translateX(0); } 50% { transform: translateX(140px); } 100% { transform: translateX(0); } }
.anim-practice-head { animation: practice-sweep 8s ease-in-out infinite; }

/* Metronome - 4 beat pillars, one accented at a time, period 2s */
@keyframes met-beat-1 { 0%, 24% { fill: var(--c-metronome); transform: scaleY(1.0); } 25%, 100% { fill: rgba(255,255,255,0.18); transform: scaleY(0.55); } }
@keyframes met-beat-2 { 0%, 24% { fill: rgba(255,255,255,0.18); transform: scaleY(0.55); } 25%, 49% { fill: var(--c-metronome); transform: scaleY(1.0); } 50%, 100% { fill: rgba(255,255,255,0.18); transform: scaleY(0.55); } }
@keyframes met-beat-3 { 0%, 49% { fill: rgba(255,255,255,0.18); transform: scaleY(0.55); } 50%, 74% { fill: var(--c-metronome); transform: scaleY(1.0); } 75%, 100% { fill: rgba(255,255,255,0.18); transform: scaleY(0.55); } }
@keyframes met-beat-4 { 0%, 74% { fill: rgba(255,255,255,0.18); transform: scaleY(0.55); } 75%, 99% { fill: var(--c-metronome); transform: scaleY(1.0); } 100% { fill: rgba(255,255,255,0.18); transform: scaleY(0.55); } }
.anim-met-1 { animation: met-beat-1 2s steps(1, end) infinite; transform-origin: 50% 100%; transform-box: fill-box; }
.anim-met-2 { animation: met-beat-2 2s steps(1, end) infinite; transform-origin: 50% 100%; transform-box: fill-box; }
.anim-met-3 { animation: met-beat-3 2s steps(1, end) infinite; transform-origin: 50% 100%; transform-box: fill-box; }
.anim-met-4 { animation: met-beat-4 2s steps(1, end) infinite; transform-origin: 50% 100%; transform-box: fill-box; }

/* Tuner needle - gentle drift around centre (settles to in-tune), snaps green */
@keyframes tuner-drift {
  0%, 100% { transform: rotate(-5deg); }
  35%      { transform: rotate(4deg); }
  55%, 75% { transform: rotate(0deg);  }
  85%      { transform: rotate(-3deg); }
}
@keyframes tuner-snap-flash {
  0%, 50%, 80%, 100% { opacity: 0; }
  55%, 75%           { opacity: 1; }
}
.anim-tuner-needle  { animation: tuner-drift     7s ease-in-out infinite; transform-origin: 50% 100%; transform-box: fill-box; }
.anim-tuner-snap    { animation: tuner-snap-flash 7s linear      infinite; }

/* Signal Generator - sine wave scrolling */
@keyframes sig-scroll { 0% { transform: translateX(0); } 100% { transform: translateX(-60px); } }
.anim-sig-sine { animation: sig-scroll 1.4s linear infinite; }

/* Meters - 8 bar wobble */
@keyframes meters-bar-1 { 0%, 100% { transform: scaleY(0.45); } 50% { transform: scaleY(0.85); } }
@keyframes meters-bar-2 { 0%, 100% { transform: scaleY(0.62); } 50% { transform: scaleY(0.95); } }
@keyframes meters-bar-3 { 0%, 100% { transform: scaleY(0.38); } 50% { transform: scaleY(0.72); } }
@keyframes meters-bar-4 { 0%, 100% { transform: scaleY(0.55); } 50% { transform: scaleY(0.88); } }
@keyframes meters-bar-5 { 0%, 100% { transform: scaleY(0.50); } 50% { transform: scaleY(0.78); } }
@keyframes meters-bar-6 { 0%, 100% { transform: scaleY(0.42); } 50% { transform: scaleY(0.68); } }
@keyframes meters-bar-7 { 0%, 100% { transform: scaleY(0.30); } 50% { transform: scaleY(0.55); } }
@keyframes meters-bar-8 { 0%, 100% { transform: scaleY(0.22); } 50% { transform: scaleY(0.40); } }
.anim-mb-1 { animation: meters-bar-1 1.4s ease-in-out infinite; transform-origin: 50% 100%; transform-box: fill-box; }
.anim-mb-2 { animation: meters-bar-2 1.6s ease-in-out infinite; transform-origin: 50% 100%; transform-box: fill-box; }
.anim-mb-3 { animation: meters-bar-3 1.2s ease-in-out infinite; transform-origin: 50% 100%; transform-box: fill-box; }
.anim-mb-4 { animation: meters-bar-4 1.8s ease-in-out infinite; transform-origin: 50% 100%; transform-box: fill-box; }
.anim-mb-5 { animation: meters-bar-5 1.4s ease-in-out infinite; transform-origin: 50% 100%; transform-box: fill-box; }
.anim-mb-6 { animation: meters-bar-6 1.7s ease-in-out infinite; transform-origin: 50% 100%; transform-box: fill-box; }
.anim-mb-7 { animation: meters-bar-7 1.3s ease-in-out infinite; transform-origin: 50% 100%; transform-box: fill-box; }
.anim-mb-8 { animation: meters-bar-8 1.5s ease-in-out infinite; transform-origin: 50% 100%; transform-box: fill-box; }

/* Playhead breathing for piano roll / audio editor */
@keyframes playhead-glow {
  0%, 100% { opacity: 0.7; }
  50%      { opacity: 1.0; }
}
.anim-playhead { animation: playhead-glow 1.6s ease-in-out infinite; }

/* Card stagger fade on first appearance - used by module-card hero grid */
@keyframes tile-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.anim-tile-in {
  animation: tile-in 0.6s ease-out backwards;
}

/* Live spectrum flow */
@keyframes spectrum-flow {
  0% { transform: scaleY(0.4); }
  50% { transform: scaleY(1); }
  100% { transform: scaleY(0.4); }
}

/* =========================================================
   Interactive home-grid cards (Play / Metronome / Signal Gen)
   ========================================================= */
.module-card.is-interactive {
  /* Same flex column as the navigable cards; the head is now a child link
     and the viz hosts pointer events. */
}
.module-card.is-interactive .mc-head {
  display: block;
  padding: 0;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
}
.module-card.is-interactive .mc-head:hover .mc-name {
  filter: brightness(1.15);
}
.module-card.is-interactive .mc-viz {
  cursor: default;
  position: relative;
}

/* Play card - clickable piano keys */
.mcw-play-key { cursor: pointer; transition: filter .12s, opacity .12s; pointer-events: auto; }
.mcw-play-w:hover { filter: brightness(0.92); }
.mcw-play-b:hover { filter: brightness(1.4); }
.mcw-play-w.is-down { filter: brightness(0.70) saturate(1.5); }
.mcw-play-b.is-down { filter: brightness(1.7); }

/* Metronome card - 4 bars + play glyph + status below */
.module-card.mc--metronome .mc-viz {
  flex-direction: column;
  height: auto;
  flex: 1;
  align-items: stretch;
  justify-content: flex-end;
}
.module-card.mc--metronome .mc-viz svg {
  width: 100%;
  flex: 1;
  min-height: 60px;
  max-height: 90px;
}
.module-card.mc--metronome [data-met-glyph] {
  transition: opacity .15s;
  pointer-events: none;
}
.module-card.mc--metronome.is-running [data-met-glyph] { opacity: 0; }
.mcw-met-status {
  font-family: var(--mono-font);
  font-size: .68rem;
  font-weight: 700;
  letter-spacing: .14em;
  color: currentColor;
  text-align: center;
  opacity: 0.85;
  margin-top: 8px;
}

/* Signal Gen card - waveform + chip row layout */
.mcw-sig-wrap {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  height: 100%;
}
.mcw-sig-svg {
  width: 100%;
  flex: 1;
  min-height: 60px;
  max-height: 90px;
  cursor: pointer;
  display: block;
}
.mcw-sig-svg [data-home-sig-glyph] { transition: opacity .15s; }
.mcw-sig-chips {
  display: flex;
  gap: 4px;
  width: 100%;
}
.mcw-sig-chip {
  flex: 1;
  padding: 4px 0;
  font-family: var(--mono-font);
  font-size: .62rem;
  font-weight: 800;
  letter-spacing: .14em;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 5px;
  cursor: pointer;
  transition: all .12s;
}
.mcw-sig-chip:hover { background: rgba(255,255,255,0.08); color: var(--ink); }
.mcw-sig-chip.is-active {
  background: color-mix(in srgb, currentColor 18%, transparent);
  color: currentColor;
  border-color: color-mix(in srgb, currentColor 45%, transparent);
}
.mcw-sig-status {
  font-family: var(--mono-font);
  font-size: .62rem;
  font-weight: 700;
  letter-spacing: .14em;
  color: currentColor;
  text-align: center;
  opacity: 0.85;
}

/* The signal-gen card uses a vertical layout in its viz - disable the
   default max-height so the chips and status row fit. */
.module-card.mc--signalgen .mc-viz {
  height: auto;
  flex: 1;
  align-items: stretch;
}
.module-card.mc--signalgen .mc-viz svg { max-height: 90px; }

/* TempoPolygon spin - slow rotation matching BPM */
@keyframes tempo-spin { from { transform: rotate(0); } to { transform: rotate(360deg); } }
.anim-tempo-spin { animation: tempo-spin 8s linear infinite; transform-origin: 50% 50%; transform-box: fill-box; }

/* Filter cutoff sweep (Audio Editor / Play DSP) */
@keyframes cutoff-sweep {
  0%   { stroke-dashoffset: 0;   }
  100% { stroke-dashoffset: -90; }
}
.anim-cutoff { animation: cutoff-sweep 2.6s linear infinite; }

/* =========================================================
   Wide-icon animations for the home grid
   Match MainScreenIconsAnimated.kt - ambient pass (slow
   loops, low-amplitude motion). Cards read as alive without
   distracting.
   ========================================================= */

/* PLAY - 7 white keys, accent tint cycles L→R on a 14s loop.
   Each key gets the same animation with a 2s delay offset. */
@keyframes mcw-play-key-tint {
  0%, 4%, 100% { opacity: 0; }
  10%, 14%      { opacity: 0.18; }
}
.mcw-play-tint   { animation: mcw-play-key-tint 14s linear infinite; }
.mcw-play-tint-1 { animation-delay: -2s; }
.mcw-play-tint-2 { animation-delay: -4s; }
.mcw-play-tint-3 { animation-delay: -6s; }
.mcw-play-tint-4 { animation-delay: -8s; }
.mcw-play-tint-5 { animation-delay: -10s; }
.mcw-play-tint-6 { animation-delay: -12s; }

/* AUDIO - 22 vertical bars, gentle alpha L→R drift on 12s.
   Almost imperceptible - just enough to feel alive. */
@keyframes mcw-audio-drift {
  0%, 100% { opacity: 0.65; }
  50%      { opacity: 0.78; }
}
.mcw-audio-bar { animation: mcw-audio-drift 12s linear infinite; }

/* MIDI - 6 note bars on 4 lanes, alpha pulses out-of-phase, 12s loop. */
@keyframes mcw-midi-pulse {
  0%, 100% { opacity: 0.70; }
  50%      { opacity: 0.84; }
}
.mcw-midi-1 { animation: mcw-midi-pulse 12s ease-in-out infinite; }
.mcw-midi-2 { animation: mcw-midi-pulse 12s ease-in-out infinite; animation-delay: -1.5s; }
.mcw-midi-3 { animation: mcw-midi-pulse 12s ease-in-out infinite; animation-delay: -3s; }
.mcw-midi-4 { animation: mcw-midi-pulse 12s ease-in-out infinite; animation-delay: -4.5s; }
.mcw-midi-5 { animation: mcw-midi-pulse 12s ease-in-out infinite; animation-delay: -6s; }
.mcw-midi-6 { animation: mcw-midi-pulse 12s ease-in-out infinite; animation-delay: -7.5s; }

/* PRACTICE - playhead sweeps L→R on a 14s loop.
   The filled rail grows behind it, then both snap back. */
@keyframes mcw-practice-sweep {
  0%   { transform: translateX(0%); }
  100% { transform: translateX(100%); }
}
.mcw-practice-head { animation: mcw-practice-sweep 14s linear infinite; }
@keyframes mcw-practice-fill {
  0%   { transform: scaleX(0); }
  100% { transform: scaleX(1); }
}
.mcw-practice-fill { animation: mcw-practice-fill 14s linear infinite; transform-origin: left center; }

/* METRONOME - 4 pillars, one active at a time. 6s cycle (≈40 bpm equiv) */
@keyframes mcw-met-1 { 0%, 24% { opacity: .62; transform: scaleY(1.20); } 25%, 100% { opacity: .42; transform: scaleY(1.0); } }
@keyframes mcw-met-2 { 0%, 24% { opacity: .42; transform: scaleY(1.0); } 25%, 49% { opacity: .62; transform: scaleY(1.20); } 50%, 100% { opacity: .42; transform: scaleY(1.0); } }
@keyframes mcw-met-3 { 0%, 49% { opacity: .42; transform: scaleY(1.0); } 50%, 74% { opacity: .62; transform: scaleY(1.20); } 75%, 100% { opacity: .42; transform: scaleY(1.0); } }
@keyframes mcw-met-4 { 0%, 74% { opacity: .42; transform: scaleY(1.0); } 75%, 99% { opacity: .62; transform: scaleY(1.20); } 100% { opacity: .42; transform: scaleY(1.0); } }
.mcw-met-1 { animation: mcw-met-1 6s steps(1, end) infinite; transform-origin: 50% 100%; transform-box: fill-box; }
.mcw-met-2 { animation: mcw-met-2 6s steps(1, end) infinite; transform-origin: 50% 100%; transform-box: fill-box; }
.mcw-met-3 { animation: mcw-met-3 6s steps(1, end) infinite; transform-origin: 50% 100%; transform-box: fill-box; }
.mcw-met-4 { animation: mcw-met-4 6s steps(1, end) infinite; transform-origin: 50% 100%; transform-box: fill-box; }

/* TUNER - needle drifts ±3% on 10s ping-pong */
@keyframes mcw-tuner-drift {
  0%, 100% { transform: translateX(-3%); }
  50%      { transform: translateX(3%);  }
}
.mcw-tuner-needle { animation: mcw-tuner-drift 10s ease-in-out infinite; }

/* SIGNAL GEN - sine phase scrolls L→R on a 13s linear loop */
@keyframes mcw-sine-scroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-100px); }
}
.mcw-sine { animation: mcw-sine-scroll 13s linear infinite; }

/* METERS - 8 FFT bars, ±4% height swing on 9s loop */
@keyframes mcw-meter-1 { 0%,100% { transform: scaleY(0.96); } 50% { transform: scaleY(1.04); } }
@keyframes mcw-meter-2 { 0%,100% { transform: scaleY(1.02); } 50% { transform: scaleY(0.96); } }
@keyframes mcw-meter-3 { 0%,100% { transform: scaleY(0.98); } 50% { transform: scaleY(1.04); } }
@keyframes mcw-meter-4 { 0%,100% { transform: scaleY(1.04); } 50% { transform: scaleY(0.96); } }
.mcw-meter-1 { animation: mcw-meter-1 9s ease-in-out infinite; transform-origin: 50% 100%; transform-box: fill-box; }
.mcw-meter-2 { animation: mcw-meter-2 9s ease-in-out infinite; animation-delay: -1.6s; transform-origin: 50% 100%; transform-box: fill-box; }
.mcw-meter-3 { animation: mcw-meter-3 9s ease-in-out infinite; animation-delay: -3.2s; transform-origin: 50% 100%; transform-box: fill-box; }
.mcw-meter-4 { animation: mcw-meter-4 9s ease-in-out infinite; animation-delay: -4.8s; transform-origin: 50% 100%; transform-box: fill-box; }
.mcw-meter-5 { animation: mcw-meter-1 9s ease-in-out infinite; animation-delay: -6.4s; transform-origin: 50% 100%; transform-box: fill-box; }
.mcw-meter-6 { animation: mcw-meter-2 9s ease-in-out infinite; animation-delay: -8.0s; transform-origin: 50% 100%; transform-box: fill-box; }
.mcw-meter-7 { animation: mcw-meter-3 9s ease-in-out infinite; animation-delay: -2.4s; transform-origin: 50% 100%; transform-box: fill-box; }
.mcw-meter-8 { animation: mcw-meter-4 9s ease-in-out infinite; animation-delay: -7.2s; transform-origin: 50% 100%; transform-box: fill-box; }

/* =========================================================
   Tutorial scene animations - for tutorials.html
   ========================================================= */

/* Scene reveal on scroll */
@keyframes tut-scene-in {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: none; }
}

/* Tap ripple - a circle expands and fades from a tap point */
@keyframes tut-tap-ripple {
  0%   { opacity: 0;   transform: scale(0.4); }
  20%  { opacity: 0.85; }
  100% { opacity: 0;   transform: scale(2.4); }
}
.tut-ripple { animation: tut-tap-ripple 1.6s ease-out infinite; transform-origin: center; transform-box: fill-box; }

/* Finger pointer cycle - slides in, taps (scales), holds, fades */
@keyframes tut-finger-tap {
  0%, 5%   { opacity: 0; transform: translate(0,8px) scale(1); }
  18%      { opacity: 1; transform: translate(0,0) scale(1); }
  28%      { transform: translate(0,0) scale(0.85); }
  38%      { transform: translate(0,0) scale(1); }
  85%, 100%{ opacity: 0; transform: translate(0,0) scale(1); }
}
.tut-finger { animation: tut-finger-tap 4s ease-in-out infinite; transform-origin: 50% 90%; transform-box: fill-box; }

/* Long-press hold - finger holds for 1.5s, ring grows, MIDI Learn sheet slides up */
@keyframes tut-long-press-ring {
  0%, 10%  { opacity: 0;   r: 6; }
  20%      { opacity: 0.55; r: 6; }
  60%      { opacity: 1;    r: 32; }
  70%, 100%{ opacity: 0;    r: 32; }
}
.tut-long-ring { animation: tut-long-press-ring 4.4s ease-out infinite; }

/* Speed wheel - rotating + waveform stretching tied to it */
@keyframes tut-speed-wheel {
  0%, 100% { transform: rotate(0deg);   }
  40%, 60% { transform: rotate(-100deg); }
}
.tut-speed-wheel { animation: tut-speed-wheel 5s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }
@keyframes tut-waveform-stretch {
  0%, 100% { transform: scaleX(1);   }
  40%, 60% { transform: scaleX(0.55); }
}
.tut-waveform-stretch { animation: tut-waveform-stretch 5s ease-in-out infinite; transform-origin: left center; transform-box: fill-box; }

/* Tuner needle - drifts, then snaps to centre + green halo flashes */
@keyframes tut-tuner-needle-snap {
  0%   { transform: rotate(-22deg); }
  20%  { transform: rotate(15deg);  }
  35%  { transform: rotate(-10deg); }
  45%  { transform: rotate(0deg);   }
  60%, 90% { transform: rotate(0deg); }   /* snap-locked */
  100% { transform: rotate(-22deg); }
}
.tut-tuner-needle { animation: tut-tuner-needle-snap 7s ease-in-out infinite; transform-origin: 50% 100%; transform-box: fill-box; }
@keyframes tut-tuner-snap-flash {
  0%, 44% { opacity: 0; }
  50%, 88% { opacity: 1; }
  100%    { opacity: 0; }
}
.tut-tuner-snap { animation: tut-tuner-snap-flash 7s ease-in-out infinite; }

/* TempoPolygon morph - square → pentagon */
@keyframes tut-poly-morph-4-5 {
  0%, 30%  { d: path('M 50,10 L 90,50 L 50,90 L 10,50 Z'); }
  50%, 100%{ d: path('M 50,10 L 88,38 L 73,82 L 27,82 L 12,38 Z'); }
}
.tut-poly-morph { animation: tut-poly-morph-4-5 5s ease-in-out infinite; }

/* TempoPolygon orbit dot - moves around the pentagon's 5 vertices */
@keyframes tut-poly-dot {
  0%   { transform: translate(38px, -42px); }
  20%  { transform: translate(36px, -10px);  }
  40%  { transform: translate(21px, 30px);   }
  60%  { transform: translate(-25px, 30px);  }
  80%  { transform: translate(-39px, -10px); }
  100% { transform: translate(38px, -42px);  }
}
.tut-poly-dot { animation: tut-poly-dot 2.5s steps(5, end) infinite; }

/* REC pill - red pulse */
@keyframes tut-rec-pulse {
  0%, 100% { transform: scale(1);    opacity: 0.85; }
  50%      { transform: scale(1.05); opacity: 1.0;  }
}
.tut-rec { animation: tut-rec-pulse 1s ease-in-out infinite; transform-origin: center; transform-box: fill-box; }

/* Live waveform draw - bars appearing one by one, sweeping right to left */
@keyframes tut-live-bar-1  { 0%, 8%  { opacity: 0; } 12%, 100% { opacity: 0.92; } }
@keyframes tut-live-bar-2  { 0%, 16% { opacity: 0; } 20%, 100% { opacity: 0.92; } }
@keyframes tut-live-bar-3  { 0%, 24% { opacity: 0; } 28%, 100% { opacity: 0.92; } }
@keyframes tut-live-bar-4  { 0%, 32% { opacity: 0; } 36%, 100% { opacity: 0.92; } }
@keyframes tut-live-bar-5  { 0%, 40% { opacity: 0; } 44%, 100% { opacity: 0.92; } }
@keyframes tut-live-bar-6  { 0%, 48% { opacity: 0; } 52%, 100% { opacity: 0.92; } }
@keyframes tut-live-bar-7  { 0%, 56% { opacity: 0; } 60%, 100% { opacity: 0.92; } }
@keyframes tut-live-bar-8  { 0%, 64% { opacity: 0; } 68%, 100% { opacity: 0.92; } }
@keyframes tut-live-bar-9  { 0%, 72% { opacity: 0; } 76%, 100% { opacity: 0.92; } }
@keyframes tut-live-bar-10 { 0%, 80% { opacity: 0; } 84%, 100% { opacity: 0.92; } }
.tut-live-1  { animation: tut-live-bar-1  4.5s linear infinite; }
.tut-live-2  { animation: tut-live-bar-2  4.5s linear infinite; }
.tut-live-3  { animation: tut-live-bar-3  4.5s linear infinite; }
.tut-live-4  { animation: tut-live-bar-4  4.5s linear infinite; }
.tut-live-5  { animation: tut-live-bar-5  4.5s linear infinite; }
.tut-live-6  { animation: tut-live-bar-6  4.5s linear infinite; }
.tut-live-7  { animation: tut-live-bar-7  4.5s linear infinite; }
.tut-live-8  { animation: tut-live-bar-8  4.5s linear infinite; }
.tut-live-9  { animation: tut-live-bar-9  4.5s linear infinite; }
.tut-live-10 { animation: tut-live-bar-10 4.5s linear infinite; }

/* Layer dropping in - slides down + fades */
@keyframes tut-layer-drop {
  0%, 30%  { opacity: 0; transform: translateY(-12px); }
  45%, 100%{ opacity: 1; transform: none; }
}
.tut-layer-drop { animation: tut-layer-drop 4s ease-out infinite; }

/* MIDI Learn sheet sliding up from the bottom */
@keyframes tut-sheet-up {
  0%, 50%   { transform: translateY(100%); opacity: 0; }
  60%, 100% { transform: translateY(0); opacity: 1; }
}
.tut-sheet-up { animation: tut-sheet-up 4.4s ease-out infinite; transform-origin: bottom; transform-box: fill-box; }

/* Selection rectangle drawing on waveform */
@keyframes tut-sel-draw {
  0%, 20%  { transform: scaleX(0); }
  45%, 100%{ transform: scaleX(1); }
}
.tut-sel-draw { animation: tut-sel-draw 5s ease-out infinite; transform-origin: left center; transform-box: fill-box; }

/* Loop pillars appearing */
@keyframes tut-loop-pillar {
  0%, 40%   { opacity: 0; }
  55%, 100% { opacity: 1; }
}
.tut-loop-pillar { animation: tut-loop-pillar 5s ease-out infinite; }

/* Tile highlight - for "tap this tile" demo */
@keyframes tut-tile-highlight {
  0%, 30%  { box-shadow: 0 0 0 0 rgba(255,138,42,0); }
  50%      { box-shadow: 0 0 0 6px rgba(255,138,42,0.45); }
  70%, 100%{ box-shadow: 0 0 0 0 rgba(255,138,42,0); }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .anim-glowo-wave, .anim-rec, .anim-rec-glow,
  .anim-key-1, .anim-key-2, .anim-key-3, .anim-key-4, .anim-key-5, .anim-key-6, .anim-key-7,
  .anim-audio-ribbon, .anim-midi-1, .anim-midi-2, .anim-midi-3, .anim-midi-4, .anim-midi-5, .anim-midi-6,
  .anim-practice-head, .anim-met-1, .anim-met-2, .anim-met-3, .anim-met-4,
  .anim-tuner-needle, .anim-tuner-snap, .anim-sig-sine,
  .anim-mb-1, .anim-mb-2, .anim-mb-3, .anim-mb-4, .anim-mb-5, .anim-mb-6, .anim-mb-7, .anim-mb-8,
  .anim-playhead, .anim-tempo-spin, .anim-cutoff { animation: none !important; }
}

/* =========================================================
   Misc utilities
   ========================================================= */
.hidden { display: none !important; }
.center { text-align: center; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.divider { height: 1px; background: var(--line); margin: 36px 0; border: 0; }

/* List inside content */
.content ul, .content ol { margin: 0 0 1em; padding-left: 22px; color: var(--ink-soft); }
.content li { margin-bottom: .35em; }

/* =========================================================
   Tutorials page
   ========================================================= */
.tut-toc {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 28px;
}
.tut-toc a {
  display: block;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
  transition: all .25s;
}
.tut-toc a:hover {
  background: var(--surface-2);
  border-color: var(--line-strong);
  transform: translateY(-2px);
}
.tut-toc .tut-toc-num {
  font-family: var(--mono-font);
  font-size: .72rem;
  letter-spacing: .14em;
  color: var(--muted);
  margin-bottom: 6px;
}
.tut-toc .tut-toc-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.3;
}

.tutorial {
  margin: 0 0 120px;
  scroll-margin-top: 80px;
}
.tutorial:last-of-type { margin-bottom: 60px; }

.tut-hero {
  display: grid;
  gap: 48px;
  grid-template-columns: 1fr;
  margin-bottom: 64px;
  padding: 56px 0 0;
  border-top: 1px solid var(--line);
}
@media (min-width: 920px) {
  .tut-hero { grid-template-columns: 1.2fr 1fr; align-items: center; }
}
.tut-hero h2 {
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  font-weight: 700;
  letter-spacing: -.02em;
  margin: 12px 0 18px;
  line-height: 1.05;
}
.tut-hero .tut-num {
  font-family: var(--mono-font);
  font-size: .76rem;
  letter-spacing: .22em;
  color: var(--muted);
  text-transform: uppercase;
}
.tut-hero .tut-scenario {
  font-size: 1.05rem;
  font-style: italic;
  color: var(--ink-soft);
  border-left: 2px solid;
  padding: 4px 0 4px 18px;
  margin: 22px 0;
  max-width: 56ch;
  line-height: 1.55;
}
.tut-hero .tut-meta { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }

.tut-scenes {
  display: grid;
  gap: 28px;
}
.tut-scene {
  display: grid;
  grid-template-columns: 1fr;
  gap: 32px;
  align-items: center;
  padding: 36px 0;
  border-top: 1px dashed var(--line);
}
.tut-scene:first-child { border-top: 0; padding-top: 0; }
@media (min-width: 720px) {
  .tut-scene { grid-template-columns: 0.9fr 1.1fr; gap: 56px; }
  .tut-scene:nth-child(even) > .tut-scene-text { order: 2; }
  .tut-scene:nth-child(even) > .tut-scene-viz  { order: 1; }
}
.tut-scene-num {
  display: inline-flex;
  font-family: var(--mono-font);
  font-size: .72rem;
  letter-spacing: .18em;
  color: var(--muted);
  margin-bottom: 12px;
}
.tut-scene-num strong { color: currentColor; margin-right: 12px; }
.tut-scene h3 {
  font-size: 1.4rem;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--ink);
  line-height: 1.25;
}
.tut-scene p {
  margin: 0 0 12px;
  color: var(--ink-soft);
  font-size: .98rem;
  line-height: 1.6;
}
.tut-scene-viz {
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 18px;
  overflow: hidden;
  aspect-ratio: 4 / 5;
  max-width: 260px;
  width: 100%;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}
.tut-scene-viz svg { width: 100%; height: 100%; display: block; }

/* Interactive demo block - sits between the hero and the walkthrough */
.tut-demo {
  background: linear-gradient(180deg, var(--bg-1) 0%, var(--bg-2) 100%);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 32px;
  margin: 40px 0 56px;
  position: relative;
  overflow: hidden;
}
.tut-demo::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--tut-accent, #FF8A2A) 50%, transparent), transparent 60%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  pointer-events: none;
}
.tut-demo-label {
  font-family: var(--mono-font);
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--tut-accent);
  margin-bottom: 8px;
}
.tut-demo h3 {
  margin: 0 0 18px;
  font-size: 1.5rem;
  color: var(--ink);
  font-weight: 700;
}
.tut-demo-body { display: grid; gap: 24px; align-items: center; }
@media (min-width: 720px) { .tut-demo-body { grid-template-columns: 1fr 1.2fr; gap: 36px; } }
.tut-demo-canvas {
  background: #000;
  border-radius: 14px;
  padding: 24px;
  position: relative;
  min-height: 280px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(255,255,255,0.04);
}
.tut-demo-controls { display: flex; flex-direction: column; gap: 18px; }
.tut-demo-row { display: flex; align-items: center; gap: 16px; }
.tut-demo-row label {
  font-size: .72rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--muted);
  flex: 0 0 auto;
  min-width: 70px;
}

/* Range slider - accent-styled */
.tut-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  border-radius: 3px;
  background: var(--bg-2);
  outline: none;
}
.tut-slider::-webkit-slider-runnable-track { height: 6px; border-radius: 3px; background: var(--bg-2); }
.tut-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--tut-accent, var(--accent-orange));
  cursor: pointer;
  margin-top: -8px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.35);
}
.tut-slider::-moz-range-thumb {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--tut-accent, var(--accent-orange));
  border: 0;
  cursor: pointer;
}
.tut-slider-value {
  font-family: var(--mono-font);
  font-size: .9rem;
  color: var(--ink);
  font-weight: 600;
  flex: 0 0 auto;
  min-width: 60px;
  text-align: right;
}

/* Big primary demo button */
.tut-demo-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  font-size: .82rem;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  border-radius: 999px;
  border: 1px solid var(--tut-accent);
  background: color-mix(in srgb, var(--tut-accent) 18%, transparent);
  color: var(--tut-accent);
  cursor: pointer;
  transition: all .15s;
}
.tut-demo-btn:hover { background: var(--tut-accent); color: #000; }
.tut-demo-btn[data-running="true"] { background: var(--tut-accent); color: #000; }

.tut-demo-stat {
  display: flex; flex-direction: column;
  align-items: center;
  font-family: var(--mono-font);
  color: var(--ink);
  font-size: 2.4rem;
  font-weight: 300;
  letter-spacing: -.02em;
}
.tut-demo-stat .tut-demo-stat-label {
  font-size: .7rem;
  letter-spacing: .22em;
  color: var(--muted);
  font-weight: 700;
  margin-top: 4px;
}

/* Demo: beat-dot strip */
.tut-beat-strip { display: flex; gap: 10px; margin-top: 16px; }
.tut-beat-dot {
  width: 32px; height: 32px;
  border-radius: 8px;
  background: rgba(255,255,255,0.10);
  display: grid; place-items: center;
  font-family: var(--mono-font);
  font-size: .85rem;
  font-weight: 700;
  color: var(--muted);
  cursor: pointer;
  transition: all .12s;
  border: 1px solid transparent;
}
.tut-beat-dot[data-state="accent"]  { background: var(--tut-accent); color: #000; }
.tut-beat-dot[data-state="silent"]  { background: transparent; border-color: rgba(255,255,255,0.10); color: rgba(255,255,255,0.20); }
.tut-beat-dot.is-playing { transform: scale(1.18); box-shadow: 0 0 0 4px color-mix(in srgb, var(--tut-accent) 30%, transparent); }

/* Tuner demo styles */
.tut-tuner-demo-face {
  width: 220px; height: 130px; position: relative;
  margin-bottom: 14px;
}
.tut-tuner-demo-face svg { width: 100%; height: 100%; }

/* Long-press demo pad */
.tut-longpress-pad {
  width: 100%; max-width: 280px;
  aspect-ratio: 1;
  border-radius: 16px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  display: grid;
  place-items: center;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  user-select: none;
  transition: background .2s;
}
.tut-longpress-pad:hover { background: var(--surface-2); }
.tut-longpress-pad-label {
  font-family: var(--mono-font);
  font-size: .72rem;
  letter-spacing: .18em;
  color: var(--ink-soft);
  text-transform: uppercase;
  text-align: center;
  pointer-events: none;
}
.tut-longpress-ring {
  position: absolute;
  width: 60%; aspect-ratio: 1;
  border-radius: 50%;
  border: 2px solid var(--tut-accent);
  opacity: 0;
  pointer-events: none;
  transition: transform 1s linear, opacity .2s;
  transform: scale(0.2);
}
.tut-longpress-pad[data-pressing="true"] .tut-longpress-ring {
  opacity: 1;
  transform: scale(1.5);
}
.tut-longpress-pad[data-bound="true"] {
  background: color-mix(in srgb, var(--tut-accent) 14%, var(--surface));
  border-color: var(--tut-accent);
}
.tut-longpress-pad[data-bound="true"] .tut-longpress-pad-label { color: var(--tut-accent); }

/* MIDI Learn sheet that slides up from the demo bottom */
.tut-midi-sheet {
  position: absolute;
  inset-inline: 0; bottom: 0;
  background: var(--bg-2);
  border-top: 1px solid var(--tut-accent);
  border-radius: 18px 18px 0 0;
  padding: 22px 28px 28px;
  transform: translateY(100%);
  transition: transform .35s cubic-bezier(.2,.9,.3,1);
  text-align: center;
}
.tut-midi-sheet[data-open="true"] { transform: translateY(0); }
.tut-midi-sheet-title {
  font-size: .76rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  font-weight: 800;
  color: var(--tut-accent);
  margin-bottom: 6px;
}
.tut-midi-sheet-body { color: var(--ink-soft); font-size: .92rem; }
.tut-midi-listening-dots span {
  display: inline-block;
  width: 6px; height: 6px;
  margin: 0 3px;
  border-radius: 50%;
  background: var(--tut-accent);
  animation: tut-listening-blink 1.2s ease-in-out infinite;
}
.tut-midi-listening-dots span:nth-child(2) { animation-delay: .2s; }
.tut-midi-listening-dots span:nth-child(3) { animation-delay: .4s; }
@keyframes tut-listening-blink {
  0%, 100% { opacity: .3; transform: scale(.8); }
  50%      { opacity: 1;  transform: scale(1.2); }
}

/* Speed-pitch demo waveform - animates scaleX with the slider */
.tut-wave-display {
  width: 100%;
  height: 80px;
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 0 8px;
}
.tut-wave-display .tut-wave-bar {
  background: var(--tut-accent);
  width: 3px;
  border-radius: 1.5px;
  opacity: 0.85;
  transform-origin: center;
}
.tut-wave-display-stretch {
  transform: scaleX(var(--stretch, 1));
  transform-origin: left center;
  transition: transform .12s linear;
  height: 100%;
  display: flex;
  align-items: center;
  gap: 2px;
}

/* Layer-keyboard demo */
.tut-keys {
  display: flex;
  position: relative;
  height: 140px;
  width: 100%;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
  user-select: none;
}
.tut-key {
  flex: 1;
  background: #FFFFF0;
  border-right: 1px solid #0a0a0d;
  position: relative;
  cursor: pointer;
  transition: background .1s;
}
.tut-key:last-child { border-right: 0; }
.tut-key.is-playing { background: var(--tut-accent); }
.tut-key-label {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono-font);
  font-size: .62rem;
  color: rgba(0,0,0,0.6);
  pointer-events: none;
}

/* Tutorial hero visual - also smaller now */
.tut-hero .tut-scene-viz { max-width: 260px; }
@media (min-width: 920px) { .tut-hero .tut-scene-viz { max-width: 280px; } }

/* Tuner demo LEDs - driven by data-on attribute from JS */
.tut-tuner-led {
  width: 38px; height: 18px;
  border-radius: 4px;
  background: #080808;
  border: 1px solid #1A1A1A;
  display: grid; place-items: center;
  position: relative;
}
.tut-tuner-led-bulb {
  width: 8px; height: 8px;
  border-radius: 50%;
  transition: background-color .15s, box-shadow .15s;
}
.tut-tuner-led[data-color="red"] .tut-tuner-led-bulb   { background: rgba(226,80,58,0.30); }
.tut-tuner-led[data-color="green"] .tut-tuner-led-bulb { background: rgba(60,203,105,0.30); }
.tut-tuner-led[data-on="true"][data-color="red"]   .tut-tuner-led-bulb { background: #E2503A; box-shadow: 0 0 8px rgba(226,80,58,0.7); }
.tut-tuner-led[data-on="true"][data-color="green"] .tut-tuner-led-bulb { background: #3CCB69; box-shadow: 0 0 12px rgba(60,203,105,0.85); }

/* Toggle checkbox styled as accent switch */
.tut-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: .82rem;
  color: var(--ink-soft);
  cursor: pointer;
  user-select: none;
}
.tut-toggle input { display: none; }
.tut-toggle .tut-toggle-track {
  width: 38px; height: 22px;
  border-radius: 11px;
  background: var(--bg-2);
  border: 1px solid var(--line);
  position: relative;
  transition: all .15s;
}
.tut-toggle .tut-toggle-track::before {
  content: "";
  position: absolute;
  top: 2px; left: 2px;
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: all .15s;
}
.tut-toggle input:checked + .tut-toggle-track {
  background: color-mix(in srgb, var(--tut-accent) 30%, var(--bg-2));
  border-color: var(--tut-accent);
}
.tut-toggle input:checked + .tut-toggle-track::before {
  left: 18px;
  background: var(--tut-accent);
}

/* Tutorial demo metric (e.g. live BPM) */
.tut-demo-metric {
  display: flex; flex-direction: column;
  gap: 4px;
  align-items: flex-start;
  font-family: var(--mono-font);
}
.tut-demo-metric-value {
  font-size: 2rem;
  font-weight: 300;
  color: var(--ink);
  letter-spacing: -.02em;
}
.tut-demo-metric-label {
  font-size: .68rem;
  letter-spacing: .18em;
  color: var(--muted);
  font-weight: 700;
  text-transform: uppercase;
}

/* Caption under canvas */
.tut-demo-caption {
  margin-top: 14px;
  font-size: .85rem;
  color: var(--muted);
  text-align: center;
  font-style: italic;
}

/* =========================================================
   VintageMeterFace (Tuner demo)
   Real ClickTrackFace/VintageMeterFace nesting - rim, glass,
   warm amber tint, half-arc with pivot far below canvas.
   ========================================================= */
.vmf-rim {
  width: 100%;
  max-width: 320px;
  margin: 0 auto;
  padding: 5px;
  border-radius: 12px;
  background: linear-gradient(180deg, #1F1F1F 0%, #050505 100%);
  border: 0.5px solid rgba(255,255,255,0.12);
  box-shadow: 0 6px 14px rgba(0,0,0,0.55), inset 0 0 0 1px rgba(0,0,0,0.40);
}
.vmf-glass {
  position: relative;
  border-radius: 8px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--tut-accent, #85B7EB) 55%, transparent) 0%,
    color-mix(in srgb, var(--tut-accent, #85B7EB) 32%, transparent) 55%,
    color-mix(in srgb, var(--tut-accent, #85B7EB) 18%, transparent) 100%);
  border: 0.5px solid rgba(0,0,0,0.70);
  aspect-ratio: 14 / 13;
  overflow: hidden;
}
.vmf-svg { width: 100%; height: 100%; display: block; }

/* Cents readout row below the rim - same idiom as in the app */
.vmf-readout-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  max-width: 320px;
  margin: 14px auto 0;
  padding: 10px 6px;
}
.vmf-cents {
  font-family: var(--mono-font);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--tut-accent, #85B7EB);
  letter-spacing: -.02em;
  min-width: 70px;
}
.vmf-leds { display: flex; gap: 8px; }
.vmf-hz {
  font-family: var(--mono-font);
  font-size: .9rem;
  color: var(--ink-soft);
  min-width: 70px;
  text-align: right;
}

/* =========================================================
   ClickTrackFace (Metronome demo)
   Real layout: BPM digit left, polygon centre, 4/4 right, on
   amber-glass panel with vertical gradient and accent border.
   Beat strip fills below.
   ========================================================= */
.ctf-face {
  width: 100%;
  max-width: 360px;
  margin: 0 auto;
  border-radius: 14px;
  background: linear-gradient(180deg,
    color-mix(in srgb, var(--tut-accent, #FAC775) 20%, transparent) 0%,
    color-mix(in srgb, var(--tut-accent, #FAC775) 5%, transparent) 50%,
    rgba(28,24,20,0.50) 100%);
  border: 0.5px solid color-mix(in srgb, var(--tut-accent, #FAC775) 55%, transparent);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.ctf-header {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: start;
  gap: 12px;
}
.ctf-bpm-col {
  display: flex; flex-direction: column;
  align-items: flex-start;
}
.ctf-bpm-digit {
  font-family: var(--mono-font);
  font-size: 50px;
  font-weight: 300;
  color: #FFFFFF;
  letter-spacing: -2.5px;
  line-height: 1;
}
.ctf-bpm-label {
  font-family: var(--mono-font);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 2.4px;
  color: rgba(255,255,255,0.85);
  margin-top: 6px;
  text-transform: uppercase;
}
.ctf-poly-col {
  align-self: center;
  padding: 0 8px;
}
.ctf-meter-col {
  display: flex; flex-direction: column;
  align-items: flex-end;
}
.ctf-meter-row {
  display: flex; align-items: baseline;
  font-family: var(--mono-font);
}
.ctf-num {
  font-size: 26px;
  font-weight: 900;
  color: #FFFFFF;
}
.ctf-slash {
  font-size: 18px;
  font-weight: 300;
  color: rgba(255,255,255,0.55);
  margin: 0 4px;
}
.ctf-meter-label {
  font-family: var(--mono-font);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 2.4px;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  margin-top: 6px;
}
.ctf-strip {
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,0.50);
  border-radius: 8px;
  padding: 8px;
  min-height: 70px;
  border: 0.5px solid color-mix(in srgb, var(--tut-accent, #FAC775) 30%, transparent);
}
.ctf-strip .ctf-beat-col {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  cursor: pointer;
  position: relative;
  border-radius: 6px;
  background: rgba(255,255,255,0.04);
  padding: 6px 4px 8px;
  transition: background .12s;
}
.ctf-strip .ctf-beat-col:hover { background: rgba(255,255,255,0.08); }
.ctf-strip .ctf-beat-col[data-state="accent"] {
  background: color-mix(in srgb, var(--tut-accent, #FAC775) 35%, transparent);
}
.ctf-strip .ctf-beat-col[data-state="silent"] {
  background: transparent;
  border: 1px dashed rgba(255,255,255,0.10);
}
.ctf-strip .ctf-beat-col.is-playing {
  background: var(--tut-accent, #FAC775) !important;
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--tut-accent, #FAC775) 45%, transparent);
}
.ctf-strip .ctf-beat-col.is-playing .ctf-beat-num { color: #0a0a0d; }
.ctf-beat-num {
  font-family: var(--mono-font);
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--tut-accent, #FAC775);
  user-select: none;
}
.ctf-strip .ctf-beat-col[data-state="silent"] .ctf-beat-num { color: rgba(255,255,255,0.20); }

/* =========================================================
   Real piano layout (Layered keyboard demo)
   White keys laid out as flex, black keys absolutely positioned
   in the seams that have a sharp (C-D, D-E, F-G, G-A, A-B).
   ========================================================= */
.tut-piano {
  position: relative;
  width: 100%;
  height: 160px;
  background: #000;
  border-radius: 10px;
  overflow: hidden;
  user-select: none;
  border: 1px solid rgba(255,255,255,0.05);
}
.tut-piano-whites {
  display: flex;
  height: 100%;
}
.tut-piano-whites .tut-w-key {
  flex: 1;
  background: #FFFFF0;
  border-right: 1px solid #0a0a0d;
  position: relative;
  cursor: pointer;
  transition: filter .1s, background-color .12s;
}
.tut-piano-whites .tut-w-key:last-child { border-right: 0; }
.tut-piano-whites .tut-w-key.is-playing { filter: brightness(0.78) saturate(1.3); }
.tut-piano-whites .tut-w-label {
  position: absolute;
  bottom: 6px;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono-font);
  font-size: .58rem;
  color: rgba(0,0,0,0.55);
  pointer-events: none;
  letter-spacing: .05em;
}
.tut-piano-blacks {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.tut-piano-blacks .tut-b-key {
  position: absolute;
  top: 0;
  width: 7%;
  height: 62%;
  background: #1a1a1f;
  border-radius: 0 0 3px 3px;
  cursor: pointer;
  pointer-events: auto;
  transition: filter .1s, background-color .12s;
  box-shadow: 0 2px 0 #0a0a0d, inset 0 -2px 4px rgba(255,255,255,0.06);
}
.tut-piano-blacks .tut-b-key.is-playing { filter: brightness(1.4); }
.tut-piano-split {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: rgba(255,255,255,0.85);
  pointer-events: none;
  transition: left .15s ease-out;
  box-shadow: 0 0 6px rgba(255,255,255,0.45);
}

/* Long-press demo pad - make the ring more visible */
.tut-longpress-pad[data-pressing="true"] .tut-longpress-ring {
  opacity: 0.95;
  border-width: 3px;
}

/* Tighten the MIDI Learn sheet's grab handle */
.tut-midi-sheet::before {
  content: "";
  display: block;
  width: 40px; height: 4px;
  border-radius: 2px;
  background: rgba(255,255,255,0.25);
  margin: 0 auto 14px;
}

.tut-tips {
  margin-top: 48px;
  padding: 28px 32px;
  background: var(--bg-1);
  border: 1px solid var(--line);
  border-radius: 16px;
  border-left-width: 3px;
}
.tut-tips h4 {
  font-size: .76rem;
  letter-spacing: .18em;
  text-transform: uppercase;
  color: currentColor;
  margin-bottom: 12px;
}
.tut-tips ul {
  margin: 0;
  padding-left: 18px;
  color: var(--ink-soft);
}
.tut-tips li { margin-bottom: 8px; line-height: 1.55; }

/* Per-tutorial accent - applied to the top-level <article class="tutorial mc--X"> */
.tutorial.mc--play       { --tut-accent: var(--c-play); }
.tutorial.mc--audio      { --tut-accent: var(--c-audio); }
.tutorial.mc--midi       { --tut-accent: var(--c-midi); }
.tutorial.mc--practice   { --tut-accent: var(--c-practice); }
.tutorial.mc--metronome  { --tut-accent: var(--c-metronome); }
.tutorial.mc--tuner      { --tut-accent: var(--c-tuner); }
.tutorial.mc--signalgen  { --tut-accent: var(--c-signalgen); }
.tutorial.mc--meters     { --tut-accent: var(--c-meters); }
.tutorial { color: var(--tut-accent, var(--accent-orange)); }
.tutorial .tut-scenario { border-color: var(--tut-accent); }
.tutorial .tag { background: color-mix(in srgb, var(--tut-accent) 15%, transparent); color: var(--tut-accent); border-color: color-mix(in srgb, var(--tut-accent) 30%, transparent); }
.tutorial .tut-tips { border-left-color: var(--tut-accent); }
.tutorial .tut-tips h4 { color: var(--tut-accent); }

/* =========================================================
   Tutorials v2 - per-module guide: live app mockup + how-tos
   ========================================================= */
.tut-shell { position: relative; }
/* Floating module switcher - sticks just under the site header across the
   whole tutorials shell, shows the current module, and jumps between them. */
.tut-modnav {
  position: sticky; top: 58px; z-index: 40;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 0; margin: 0;
  background: color-mix(in srgb, #050507 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,0.08);
  --tut-now-accent: var(--accent-orange);
}
.tut-modnav-now {
  display: inline-flex; align-items: center; gap: 8px; flex: 0 0 auto;
  font-size: .8rem; font-weight: 800; letter-spacing: .3px; color: #fff;
  padding-right: 12px; border-right: 1px solid rgba(255,255,255,0.14);
  white-space: nowrap;
}
.tut-modnav-now-dot {
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--tut-now-accent); transition: background .2s;
  box-shadow: 0 0 8px var(--tut-now-accent);
}
.tut-modnav-chips {
  display: flex; gap: 7px; overflow-x: auto; padding: 2px 0;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.tut-modnav-chips::-webkit-scrollbar { display: none; }
.tut-modnav-chips a {
  font-size: .73rem; font-weight: 700; white-space: nowrap;
  padding: 6px 12px; border-radius: 999px; text-decoration: none;
  color: var(--ink-soft, #c9ccd4); border: 1px solid rgba(255,255,255,0.10);
  transition: background .15s, color .15s, border-color .15s;
}
.tut-modnav-chips a:hover { color: #fff; border-color: rgba(255,255,255,0.30); }
.tut-modnav-chips a.is-active {
  color: #0a0a0d; background: var(--tut-now-accent); border-color: transparent;
}
@media (max-width: 620px) {
  .tut-modnav-now { font-size: .72rem; padding-right: 9px; }
  .tut-modnav-now [data-tut-now] { max-width: 88px; overflow: hidden; text-overflow: ellipsis; }
}

.tut-mod { padding: 56px 0 8px; scroll-margin-top: 116px; --tut-accent: var(--accent-orange); }
.tut-mod.mc--play       { --tut-accent: var(--c-play); }
.tut-mod.mc--audio      { --tut-accent: var(--c-audio); }
.tut-mod.mc--midi       { --tut-accent: var(--c-midi); }
.tut-mod.mc--practice   { --tut-accent: var(--c-practice); }
.tut-mod.mc--metronome  { --tut-accent: var(--c-metronome); }
.tut-mod.mc--tuner      { --tut-accent: var(--c-tuner); }
.tut-mod.mc--signalgen  { --tut-accent: var(--c-signalgen); }
.tut-mod.mc--meters     { --tut-accent: var(--c-meters); }

.tut-mod-head { max-width: 760px; margin-bottom: 28px; }
.tut-mod-kicker {
  display: inline-block; font-size: .74rem; font-weight: 800;
  letter-spacing: 2px; text-transform: uppercase;
  color: var(--tut-accent); margin-bottom: 10px;
}
.tut-mod-head h2 { font-size: clamp(1.7rem, 3.4vw, 2.4rem); margin: 0 0 12px; line-height: 1.1; }
.tut-mod-intro { color: var(--ink-soft, #c9ccd4); max-width: 680px; line-height: 1.6; margin: 0; }

.tut-mod-grid { display: grid; grid-template-columns: 1fr; gap: 32px; align-items: start; }
@media (min-width: 940px) {
  .tut-mod-grid { grid-template-columns: minmax(280px, 360px) 1fr; gap: 44px; }
}
.tut-mod-stage { position: relative; }
@media (min-width: 940px) {
  .tut-mod-stage { position: sticky; top: 116px; }
}
.tut-mod-stage .phone-frame { margin: 0 auto; max-width: 340px; }
.tut-mod-stagehint {
  text-align: center; font-size: .82rem; color: var(--muted, #7a7d86);
  margin: 14px auto 0; max-width: 300px; line-height: 1.5;
}
.tut-mod-stagehint strong { color: var(--tut-accent); font-weight: 700; }

.tut-mod-howtos { display: flex; flex-direction: column; gap: 16px; }
.tut-howto {
  border: 1px solid rgba(255,255,255,0.08);
  border-left: 3px solid var(--tut-accent);
  border-radius: 14px;
  background: rgba(255,255,255,0.018);
  padding: 20px 22px;
}
.tut-howto > h3 {
  font-size: 1.06rem; margin: 0 0 14px; color: #fff;
  display: flex; gap: 10px; align-items: baseline;
}
.tut-howto > h3::before {
  content: ""; flex: 0 0 auto; width: 8px; height: 8px; margin-top: 6px;
  border-radius: 50%; background: var(--tut-accent);
}
.tut-howto ol { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 9px; }
.tut-howto ol li { line-height: 1.55; color: var(--ink-soft, #c9ccd4); }
.tut-howto ol li::marker { color: var(--tut-accent); font-weight: 700; font-variant-numeric: tabular-nums; }
.tut-howto ol li strong, .tut-howto ol li code { color: #fff; }
.tut-howto ol li code {
  font-family: "JetBrains Mono", monospace; font-size: .88em;
  background: rgba(255,255,255,0.06); padding: 1px 6px; border-radius: 5px;
}
.tut-howto-inset {
  display: block; width: 100%; max-width: 360px; height: auto;
  margin: 16px 0 4px; border-radius: 12px;
  border: 1px solid color-mix(in srgb, var(--tut-accent) 24%, transparent);
  background: #141318;
}
.tut-howto-tip {
  margin: 14px 0 0; padding: 9px 12px;
  font-size: .86rem; line-height: 1.5; color: var(--ink-soft, #c9ccd4);
  border-radius: 9px;
  background: color-mix(in srgb, var(--tut-accent) 9%, transparent);
  border: 1px solid color-mix(in srgb, var(--tut-accent) 22%, transparent);
}
.tut-howto-tip::before { content: "Tip - "; font-weight: 800; color: var(--tut-accent); }

/* =========================================================
   Scroll-to-top button (all pages) - matches the dark theme
   ========================================================= */
.to-top {
  position: fixed; z-index: 60;
  right: clamp(16px, 4vw, 28px); bottom: clamp(16px, 4vw, 28px);
  width: 46px; height: 46px; border-radius: 50%;
  display: grid; place-items: center;
  background: rgba(14, 14, 18, 0.82);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--accent-orange);
  cursor: pointer;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.45);
  opacity: 0; transform: translateY(12px) scale(0.9); pointer-events: none;
  transition: opacity .25s ease, transform .25s ease, border-color .2s ease, background .2s ease;
}
.to-top svg { width: 20px; height: 20px; display: block; }
.to-top.is-visible { opacity: 1; transform: none; pointer-events: auto; }
.to-top:hover {
  border-color: var(--accent-orange);
  background: rgba(22, 22, 28, 0.95);
  transform: translateY(-2px);
}
.to-top:focus-visible { outline: 2px solid var(--accent-orange); outline-offset: 3px; }
/* lift above the cookie/storage notice while it is on screen */
.to-top.to-top--raised { bottom: calc(clamp(16px, 4vw, 28px) + 92px); }
@media (max-width: 600px) { .to-top { width: 42px; height: 42px; } }
@media (prefers-reduced-motion: reduce) { .to-top { transition: opacity .2s ease; transform: none; } }

/* Manual page sub-nav (anchor jump) */
.sub-nav {
  display: flex; flex-wrap: wrap; gap: 8px;
  padding: 18px 0;
  margin-bottom: 30px;
}
.sub-nav a {
  font-size: .76rem; font-weight: 600;
  padding: 7px 14px; border-radius: 999px;
  background: var(--surface); color: var(--ink-soft);
  border: 1px solid var(--line);
  transition: all .2s;
}
.sub-nav a:hover, .sub-nav a.is-active {
  background: var(--accent-grad); color: #000; border-color: transparent;
}
