/* ==========================================================================
   METRICBALL — Interactive Bouncing Ball Music Studio
   Centralized Design System Foundation & Semantic Token System
   Design Paradigm: Dark-Neon Musician's Chalkboard (8pt Harmonic Grid)
   ========================================================================== */

:root {
  /* --------------------------------------------------------------------------
     1. Surface & Canvas Colors (60:30:10 Neutral Chalkboard Studio Palette)
     -------------------------------------------------------------------------- */
  --mb-bg-canvas: #0b0d0f;                  /* 60% Dominant: Deep Matte Obsidian Charcoal */
  --mb-bg-surface-1: #14171a;                /* 30% Secondary: Card Bases, Main Bento Surfaces */
  --mb-bg-surface-2: #1c2025;                /* 30% Secondary: Inputs, Toolbar Controls, Header Pill */
  --mb-bg-surface-3: #262c33;                /* 30% Secondary: Elevated / Hover States */
  --mb-bg-glass: rgba(20, 23, 26, 0.82);
  --mb-bg-glass-strong: rgba(28, 32, 37, 0.94);
  --mb-bg-chalkboard: #15201b;              /* Canvas Chalkboard Slate */

  /* --------------------------------------------------------------------------
     2. Semantic Luminous Accent Tones
     -------------------------------------------------------------------------- */
  --mb-accent-primary: #d98b6e;            /* Terracotta/Coral: Classic Brand Default */
  --mb-accent-primary-glow: rgba(217, 139, 110, 0.16);
  --mb-accent-music: #06b6d4;              /* Cyan: Active Musical Notes & Accents */
  --mb-accent-music-glow: rgba(6, 182, 212, 0.18);
  --mb-accent-transport: #10b981;          /* Emerald: Playback & Active Engine */
  --mb-accent-transport-glow: rgba(16, 185, 129, 0.16);
  --mb-accent-tempo: #f59e0b;              /* Amber: Metronome Pulse & BPM Dials */
  --mb-accent-tempo-glow: rgba(245, 158, 11, 0.16);
  --mb-accent-danger: #f43f5e;             /* Coral: Delete, Stop & Destructive */
  --mb-accent-danger-glow: rgba(244, 63, 94, 0.16);
  --mb-accent-pro: #ec4899;                /* Pink/Magenta: Pro Tier & Monetization */
  --mb-accent-pro-glow: rgba(236, 72, 153, 0.18);

  /* --------------------------------------------------------------------------
     3. Crisp Monochromatic Text Hierarchy
     -------------------------------------------------------------------------- */
  --mb-text-primary: #f8fafc;              /* Crisp White */
  --mb-text-secondary: #cbd5e1;            /* Neutral Light Gray */
  --mb-text-muted: #8492a6;                /* Calibrated Muted Gray */
  --mb-text-dim: #546274;                  /* Inactive Landmarks */
  --mb-text-disabled: #363f4b;             /* Disabled Elements */

  /* --------------------------------------------------------------------------
     4. Monochromatic & Glowing Borders
     -------------------------------------------------------------------------- */
  --mb-border-subtle: rgba(255, 255, 255, 0.07);
  --mb-border-medium: rgba(255, 255, 255, 0.14);
  --mb-border-highlight: rgba(255, 255, 255, 0.22);
  --mb-border-active: rgba(217, 139, 110, 0.75);
  --mb-border-music-active: rgba(6, 182, 212, 0.55);

  /* --------------------------------------------------------------------------
     5. 8pt Harmonic Spacing Scale & Dimensions
     -------------------------------------------------------------------------- */
  --mb-dock-height: 60px;
  --mb-space-2xs: 2px;
  --mb-space-xs: 4px;
  --mb-space-sm: 8px;
  --mb-space-md: 12px;
  --mb-space-lg: 16px;
  --mb-space-xl: 24px;
  --mb-space-2xl: 32px;
  --mb-space-3xl: 48px;

  /* --------------------------------------------------------------------------
     6. Radii & Curvature Scale
     -------------------------------------------------------------------------- */
  --mb-radius-xs: 4px;
  --mb-radius-sm: 8px;
  --mb-radius-md: 14px;
  --mb-radius-lg: 18px;
  --mb-radius-xl: 24px;
  --mb-radius-full: 9999px;

  /* --------------------------------------------------------------------------
     7. Typography Stack Tokens
     -------------------------------------------------------------------------- */
  --mb-font-brand: 'Outfit', system-ui, -apple-system, sans-serif;
  --mb-font-ui: 'Plus Jakarta Sans', system-ui, -apple-system, sans-serif;
  --mb-font-mono: 'Geist Mono', monospace;

  /* Typography Sizes */
  --mb-text-2xs: 10px;
  --mb-text-xs: 11px;
  --mb-text-sm: 12px;
  --mb-text-base: 13px;
  --mb-text-md: 14px;
  --mb-text-lg: 16px;
  --mb-text-xl: 18px;
  --mb-text-2xl: 20px;
  --mb-text-3xl: 24px;

  /* Typography Weights */
  --mb-weight-regular: 400;
  --mb-weight-medium: 500;
  --mb-weight-semibold: 600;
  --mb-weight-bold: 700;
  --mb-weight-extrabold: 800;

  /* --------------------------------------------------------------------------
     8. Shadows & Depth Layering
     -------------------------------------------------------------------------- */
  --mb-shadow-card: 0 4px 20px -2px rgba(0, 0, 0, 0.5), 0 0 0 1px var(--mb-border-subtle);
  --mb-shadow-glass: 0 16px 36px -8px rgba(0, 0, 0, 0.75), 0 0 0 1px var(--mb-border-medium);
  --mb-shadow-active: 0 0 0 1px var(--mb-accent-primary), 0 4px 14px -2px var(--mb-accent-primary-glow);
  --mb-shadow-popover: 0 16px 40px -8px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--mb-border-medium);

  /* --------------------------------------------------------------------------
     9. Backward Compatible Legacy Aliases
     -------------------------------------------------------------------------- */
  --bg-deep: var(--mb-bg-canvas);
  --bg-surface: var(--mb-bg-surface-1);
  --bg-surface-elevated: var(--mb-bg-surface-2);
  --bg-glass: var(--mb-bg-glass);
  --bg-glass-strong: var(--mb-bg-glass-strong);
  --chalkboard-bg: var(--mb-bg-chalkboard);

  --accent-violet: var(--mb-accent-primary);
  --accent-violet-glow: var(--mb-accent-primary-glow);
  --accent-cyan: var(--mb-accent-music);
  --accent-cyan-glow: var(--mb-accent-music-glow);
  --accent-coral: var(--mb-accent-danger);
  --accent-coral-glow: var(--mb-accent-danger-glow);
  --accent-amber: var(--mb-accent-tempo);
  --accent-amber-glow: var(--mb-accent-tempo-glow);
  --accent-emerald: var(--mb-accent-transport);

  --text-primary: var(--mb-text-primary);
  --text-secondary: var(--mb-text-secondary);
  --text-muted: var(--mb-text-muted);
  --text-dim: var(--mb-text-dim);

  --border-subtle: var(--mb-border-subtle);
  --border-active: var(--mb-border-active);
  --border-highlight: var(--mb-border-medium);

  --radius-xs: var(--mb-radius-xs);
  --radius-sm: var(--mb-radius-sm);
  --radius-md: var(--mb-radius-md);
  --radius-lg: var(--mb-radius-lg);
  --radius-xl: var(--mb-radius-xl);
  --radius-full: var(--mb-radius-full);

  --shadow-card: var(--mb-shadow-card);
  --shadow-glass: var(--mb-shadow-glass);
  --shadow-active: var(--mb-shadow-active);
}

/* Base Reset & Typography Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  font-family: var(--mb-font-ui);
  background-color: var(--mb-bg-canvas);
  color: var(--mb-text-primary);
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  height: 100%;
  overflow: hidden;
}

body {
  position: relative;
  height: 100%;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  width: 100%;
  max-width: 100%;
  background: var(--mb-bg-canvas);
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--mb-font-brand);
  color: var(--mb-text-primary);
  letter-spacing: -0.01em;
}

/* Screen Reader & Crawler Accessible Hidden Content */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

/* Controlled Ambient Background Illumination (Reduced Visual Noise) */
.ambient-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  z-index: 0;
  opacity: 0.05;
}

.glow-violet {
  width: 480px;
  height: 480px;
  top: -80px;
  left: 10%;
  background: radial-gradient(circle, var(--mb-accent-primary) 0%, transparent 70%);
}


/* ==========================================================================
   CLASSIC DARK THEME (Matte Mineral Slate Chalkboard Palette)
   ========================================================================== */
html[data-theme="classic"] {
  /* Surfaces (Matte Mineral Slate Chalkboard Palette) */
  --mb-bg-canvas: #111514;
  --mb-bg-surface-1: #161b19;
  --mb-bg-surface-2: #1c2320;
  --mb-bg-surface-3: #242c28;
  --mb-bg-chalkboard: #15201b;
  --mb-bg-glass: rgba(22, 27, 25, 0.85);
  --mb-bg-glass-strong: rgba(28, 35, 32, 0.95);

  /* Structural borders (Architectural Mineral Depth) */
  --mb-border-subtle: rgba(225, 235, 228, 0.08);
  --mb-border-medium: rgba(225, 235, 228, 0.14);
  --mb-border-highlight: rgba(185, 215, 200, 0.28);
  --mb-border-active: rgba(217, 139, 110, 0.75);
  --mb-border-music-active: rgba(168, 218, 220, 0.75);

  /* Text Hierarchy */
  --mb-text-primary: #f4efe6;
  --mb-text-secondary: #c5ddd0;
  --mb-text-muted: #808f87;
  --mb-text-dim: #55635c;
  --mb-text-disabled: #3d4742;

  /* Semantic Accents */
  --mb-accent-primary: #d98b6e;
  --mb-accent-primary-glow: rgba(217, 139, 110, 0.16);
  --mb-accent-music: #a8dadc;
  --mb-accent-music-glow: rgba(168, 218, 220, 0.18);
  --mb-accent-transport: #52b788;
  --mb-accent-transport-glow: rgba(82, 183, 136, 0.16);
  --mb-accent-tempo: #e9c46a;
  --mb-accent-tempo-glow: rgba(233, 196, 106, 0.16);
  --mb-accent-danger: #e76f51;
  --mb-accent-danger-glow: rgba(231, 111, 81, 0.16);

  /* Controls & Radii */
  --mb-radius-xs: 2px;
  --mb-radius-sm: 4px;
  --mb-radius-md: 6px;
  --mb-radius-lg: 8px;
  --mb-radius-xl: 10px;
  --mb-radius-full: 9999px;

  /* Shadows */
  --mb-shadow-card: 0 4px 16px -2px rgba(0, 0, 0, 0.65), 0 0 0 1px var(--mb-border-subtle);
  --mb-shadow-glass: 0 12px 32px -6px rgba(0, 0, 0, 0.75), 0 0 0 1px var(--mb-border-medium);
  --mb-shadow-active: 0 0 0 1px var(--mb-accent-primary), 0 2px 10px -1px var(--mb-accent-primary-glow);
  --mb-shadow-popover: 0 16px 40px -6px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--mb-border-medium);
}

/* ==========================================================================
   MIDNIGHT PURPLE THEME (Obsidian Crystal Palette)
   ========================================================================== */
html[data-theme="midnight"] {
  /* Surfaces (Deep Obsidian / Smoked Glass Palette) */
  --mb-bg-canvas: #090a0d;
  --mb-bg-surface-1: #101116;
  --mb-bg-surface-2: #171820;
  --mb-bg-surface-3: #20212b;
  --mb-bg-chalkboard: #0e0a16;
  --mb-bg-glass: rgba(16, 17, 22, 0.88);
  --mb-bg-glass-strong: rgba(23, 24, 32, 0.95);

  /* Structural borders (Mostly Neutral Graphite) */
  --mb-border-subtle: rgba(220, 225, 235, 0.08);
  --mb-border-medium: rgba(220, 225, 235, 0.13);
  --mb-border-highlight: rgba(192, 132, 252, 0.25);
  --mb-border-active: rgba(232, 121, 249, 0.65);
  --mb-border-music-active: rgba(192, 132, 252, 0.65);

  /* Cool Ultraviolet / Starlight Text Hierarchy (Mostly Neutral) */
  --mb-text-primary: #f5f3ff;
  --mb-text-secondary: #c5c7d0;
  --mb-text-muted: #858894;
  --mb-text-dim: #555866;
  --mb-text-disabled: #353742;

  /* Semantic Accents (PRESERVE INVARIANTS) */
  --mb-accent-primary: #c084fc;
  --mb-accent-primary-glow: rgba(192, 132, 252, 0.16);
  --mb-accent-music: #a855f7;
  --mb-accent-music-glow: rgba(168, 85, 247, 0.18);
  --mb-accent-transport: #10b981;
  --mb-accent-transport-glow: rgba(16, 185, 129, 0.16);
  --mb-accent-tempo: #f59e0b;
  --mb-accent-tempo-glow: rgba(245, 158, 11, 0.16);
  --mb-accent-danger: #f43f5e;
  --mb-accent-danger-glow: rgba(244, 63, 94, 0.16);

  /* Controls & Radii */
  --mb-radius-xs: 2px;
  --mb-radius-sm: 4px;
  --mb-radius-md: 6px;
  --mb-radius-lg: 8px;
  --mb-radius-xl: 10px;
  --mb-radius-full: 9999px;

  /* Shadows */
  --mb-shadow-card: 0 4px 16px -2px rgba(0, 0, 0, 0.75), 0 0 0 1px var(--mb-border-subtle);
  --mb-shadow-glass: 0 12px 32px -6px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--mb-border-medium);
  --mb-shadow-active: 0 0 0 1px var(--mb-accent-primary), 0 2px 10px -1px var(--mb-accent-primary-glow);
  --mb-shadow-popover: 0 16px 40px -6px rgba(0, 0, 0, 0.90), 0 0 0 1px var(--mb-border-medium);
}

/* ==========================================================================
   MINIMAL SLATE THEME (Precision Graphite & Steel Digital Workstation)
   ========================================================================== */
html[data-theme="minimal"] {
  /* Surfaces (Cool Neutral Graphite / Slate Palette) */
  --mb-bg-canvas: #15181c;
  --mb-bg-surface-1: #1b1f24;
  --mb-bg-surface-2: #22272d;
  --mb-bg-surface-3: #292f36;
  --mb-bg-chalkboard: #15181c;
  --mb-bg-glass: rgba(27, 31, 36, 0.88);
  --mb-bg-glass-strong: rgba(34, 39, 45, 0.96);

  /* Structural borders (Milled Steel / Precision Graphite) */
  --mb-border-subtle: rgba(139, 146, 156, 0.10);
  --mb-border-medium: rgba(139, 146, 156, 0.18);
  --mb-border-highlight: rgba(127, 163, 191, 0.28);
  --mb-border-active: rgba(127, 163, 191, 0.75);
  --mb-border-music-active: rgba(127, 163, 191, 0.75);

  /* Cool Neutral Digital Text Hierarchy */
  --mb-text-primary: #e5e7eb;
  --mb-text-secondary: #c5cad1;
  --mb-text-muted: #8b929c;
  --mb-text-dim: #5c6370;
  --mb-text-disabled: #3d434d;

  /* Semantic Accents (PRESERVE INVARIANTS + Cool Steel-Blue Accent) */
  --mb-accent-primary: #7fa3bf;
  --mb-accent-primary-glow: rgba(127, 163, 191, 0.16);
  --mb-accent-music: #7fa3bf;
  --mb-accent-music-glow: rgba(127, 163, 191, 0.18);
  --mb-accent-transport: #10b981;
  --mb-accent-transport-glow: rgba(16, 185, 129, 0.16);
  --mb-accent-tempo: #f59e0b;
  --mb-accent-tempo-glow: rgba(245, 158, 11, 0.16);
  --mb-accent-danger: #f43f5e;
  --mb-accent-danger-glow: rgba(244, 63, 94, 0.16);

  /* Controls & Radii */
  --mb-radius-xs: 2px;
  --mb-radius-sm: 4px;
  --mb-radius-md: 6px;
  --mb-radius-lg: 8px;
  --mb-radius-xl: 10px;
  --mb-radius-full: 9999px;

  /* Shadows */
  --mb-shadow-card: 0 4px 16px -2px rgba(0, 0, 0, 0.70), 0 0 0 1px var(--mb-border-subtle);
  --mb-shadow-glass: 0 12px 32px -6px rgba(0, 0, 0, 0.80), 0 0 0 1px var(--mb-border-medium);
  --mb-shadow-active: 0 0 0 1px var(--mb-accent-primary), 0 2px 10px -1px var(--mb-accent-primary-glow);
  --mb-shadow-popover: 0 16px 40px -6px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--mb-border-medium);
}

/* ==========================================================================
   COSMIC GALAXY THEME (Deep-Space Observatory & Celestial Music Studio)
   ========================================================================== */
html[data-theme="galaxy"] {
  /* Surfaces (Deep Space Observatory / Space Graphite Palette) */
  --mb-bg-canvas: #040711;
  --mb-bg-surface-1: #080c16;
  --mb-bg-surface-2: #0e1422;
  --mb-bg-surface-3: #151d30;
  --mb-bg-chalkboard: #03060d;
  --mb-bg-glass: rgba(8, 12, 22, 0.88);
  --mb-bg-glass-strong: rgba(14, 20, 34, 0.96);

  /* Structural borders (Restrained Space Depth / Subtle Celestial Cyan-Blue) */
  --mb-border-subtle: rgba(147, 197, 253, 0.08);
  --mb-border-medium: rgba(147, 197, 253, 0.14);
  --mb-border-highlight: rgba(56, 189, 248, 0.25);
  --mb-border-active: rgba(56, 189, 248, 0.70);
  --mb-border-music-active: rgba(56, 189, 248, 0.70);

  /* Starlight Text Hierarchy (Crisp Celestial White to Dim Space Slate) */
  --mb-text-primary: #f0f4f8;
  --mb-text-secondary: #c8d3e0;
  --mb-text-muted: #8092a8;
  --mb-text-dim: #4d5c70;
  --mb-text-disabled: #2d3848;

  /* Semantic Accents (PRESERVE FUNCTIONAL INVARIANTS + Celestial Blue Accent) */
  --mb-accent-primary: #38bdf8;
  --mb-accent-primary-glow: rgba(56, 189, 248, 0.16);
  --mb-accent-music: #38bdf8;
  --mb-accent-music-glow: rgba(56, 189, 248, 0.18);
  --mb-accent-transport: #10b981;
  --mb-accent-transport-glow: rgba(16, 185, 129, 0.16);
  --mb-accent-tempo: #f59e0b;
  --mb-accent-tempo-glow: rgba(245, 158, 11, 0.16);
  --mb-accent-danger: #f43f5e;
  --mb-accent-danger-glow: rgba(244, 63, 94, 0.16);

  /* Controls & Radii */
  --mb-radius-xs: 2px;
  --mb-radius-sm: 4px;
  --mb-radius-md: 6px;
  --mb-radius-lg: 8px;
  --mb-radius-xl: 10px;
  --mb-radius-full: 9999px;

  /* Shadows */
  --mb-shadow-card: 0 4px 16px -2px rgba(0, 0, 0, 0.80), 0 0 0 1px var(--mb-border-subtle);
  --mb-shadow-glass: 0 12px 32px -6px rgba(0, 0, 0, 0.90), 0 0 0 1px var(--mb-border-medium);
  --mb-shadow-active: 0 0 0 1px var(--mb-accent-primary), 0 2px 10px -1px var(--mb-accent-primary-glow);
  --mb-shadow-popover: 0 16px 40px -6px rgba(0, 0, 0, 0.95), 0 0 0 1px var(--mb-border-medium);
}
/* ==========================================================================
   CYBERPUNK NEON — HIGH-CONTRAST ELECTRONIC HARDWARE THEME
   Precision cyber control surface: neutral charcoal/black electronic hardware base,
   luminous electric cyan notation and hot magenta secondary accents.
   ========================================================================== */
html[data-theme="cyberpunk"] {
  /* Surfaces (Neutral Charcoal/Black Electronic Hardware Base) */
  --mb-bg-canvas: #080a0f;
  --mb-bg-surface-1: #0d1117;
  --mb-bg-surface-2: #131822;
  --mb-bg-surface-3: #1a202c;
  --mb-bg-chalkboard: #080a0f;
  --mb-bg-glass: rgba(13, 17, 23, 0.88);
  --mb-bg-glass-strong: rgba(19, 24, 34, 0.96);

  /* Borders (Subtle cyan illumination & hardware bevels) */
  --mb-border-subtle: rgba(0, 240, 255, 0.08);
  --mb-border-medium: rgba(0, 240, 255, 0.16);
  --mb-border-highlight: rgba(0, 240, 255, 0.35);
  --mb-border-active: #00f0ff;
  --mb-border-music-active: #00f0ff;

  /* Notation & Text (Luminous electric cyan emphasis & neutral slate hierarchy) */
  --mb-text-primary: #f0f9ff;
  --mb-text-secondary: #94a3b8;
  --mb-text-muted: #64748b;
  --mb-text-dim: #475569;
  --mb-text-disabled: #334155;

  /* Accents & Functional Invariants */
  --mb-accent-primary: #00f0ff;
  --mb-accent-primary-glow: rgba(0, 240, 255, 0.35);
  --mb-accent-secondary: #ff007f;
  --mb-accent-music: #00f0ff;
  --mb-accent-transport: #10b981;
  --mb-accent-tempo: #f59e0b;
  --mb-accent-danger: #f43f5e;

  /* Interactive States */
  --mb-bg-hover: rgba(0, 240, 255, 0.08);
  --mb-bg-active: rgba(0, 240, 255, 0.15);
  --mb-bg-selected: rgba(255, 0, 127, 0.16);
  --mb-bg-dropzone: rgba(0, 240, 255, 0.10);

  /* Shadows & Depth */
  --mb-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.85);
  --mb-shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--mb-border-subtle);
  --mb-shadow-lg: 0 10px 24px -4px rgba(0, 0, 0, 0.90), 0 0 0 1px var(--mb-border-medium);
  --mb-shadow-glass: 0 12px 32px -6px rgba(0, 0, 0, 0.95), 0 0 0 1px var(--mb-border-medium);
  --mb-shadow-active: 0 0 0 1px var(--mb-accent-primary), 0 2px 10px -1px var(--mb-accent-primary-glow);
  --mb-shadow-popover: 0 16px 40px -6px rgba(0, 0, 0, 0.98), 0 0 0 1px var(--mb-border-medium);
}

/* ==========================================================================
   DEEP OCEAN — SUBMERGED MARINE INSTRUMENT THEME
   Deep oceanic abyss: dark blue-green / deep teal surfaces,
   pale seafoam & aqua notation, warm teal accents.
   ========================================================================== */
html[data-theme="ocean"] {
  /* Surfaces (Neutral / deep ocean charcoal surfaces) */
  --mb-bg-canvas: #070e12;
  --mb-bg-surface-1: #0b1419;
  --mb-bg-surface-2: #0f1c22;
  --mb-bg-surface-3: #14242c;
  --mb-bg-chalkboard: #05242b;
  --mb-bg-glass: rgba(11, 20, 25, 0.88);
  --mb-bg-glass-strong: rgba(15, 28, 34, 0.96);

  /* Borders */
  --mb-border-subtle: rgba(45, 212, 191, 0.08);
  --mb-border-medium: rgba(45, 212, 191, 0.16);
  --mb-border-highlight: rgba(45, 212, 191, 0.30);
  --mb-border-active: #2dd4bf;
  --mb-border-music-active: #2dd4bf;

  /* Text & notation */
  --mb-text-primary: #f0fdfa;
  --mb-text-secondary: #99f6e4;
  --mb-text-muted: #5eead4;
  --mb-text-dim: #2dd4bf;
  --mb-text-disabled: #134e4a;

  /* Accents */
  --mb-accent-primary: #2dd4bf;
  --mb-accent-primary-glow: rgba(45, 212, 191, 0.25);
  --mb-accent-secondary: #0d9488;
  --mb-accent-music: #2dd4bf;

  /* Functional invariants PRESERVED */
  --mb-accent-transport: #10b981;
  --mb-accent-tempo: #f59e0b;
  --mb-accent-danger: #f43f5e;

  /* Interactive States */
  --mb-bg-hover: rgba(45, 212, 191, 0.08);
  --mb-bg-active: rgba(45, 212, 191, 0.15);
  --mb-bg-selected: rgba(45, 212, 191, 0.18);
  --mb-bg-dropzone: rgba(45, 212, 191, 0.10);

  /* Shadows & Depth */
  --mb-shadow-sm: 0 1px 3px 0 rgba(0, 0, 0, 0.85);
  --mb-shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--mb-border-subtle);
  --mb-shadow-lg: 0 10px 24px -4px rgba(0, 0, 0, 0.90), 0 0 0 1px var(--mb-border-medium);
  --mb-shadow-glass: 0 12px 32px -6px rgba(0, 0, 0, 0.95), 0 0 0 1px var(--mb-border-medium);
  --mb-shadow-active: 0 0 0 1px var(--mb-accent-primary), 0 2px 10px -1px var(--mb-accent-primary-glow);
  --mb-shadow-popover: 0 16px 40px -6px rgba(0, 0, 0, 0.98), 0 0 0 1px var(--mb-border-medium);
}

/* ==========================================================================
   RETRO 8-BIT PIXEL — THEME DEFINITION
   Deep navy/arcade black CRT surfaces, hard 0-2px square corners,
   warm cream typography, arcade gold focal accents.
   ========================================================================== */
html[data-theme="pixel"] {
  /* Surfaces (Deep navy / arcade black CRT surfaces) */
  --mb-bg-canvas: #0a0c16;
  --mb-bg-surface-1: #101424;
  --mb-bg-surface-2: #161c32;
  --mb-bg-surface-3: #1e2642;
  --mb-bg-chalkboard: #0a0c16;
  --mb-bg-glass: rgba(16, 20, 36, 0.95);
  --mb-bg-glass-strong: rgba(22, 28, 50, 0.98);

  /* Hard square corners */
  --mb-radius-xs: 0px;
  --mb-radius-sm: 2px;
  --mb-radius-md: 2px;
  --mb-radius-lg: 2px;
  --mb-radius-xl: 4px;

  /* Borders */
  --mb-border-subtle: rgba(56, 189, 248, 0.12);
  --mb-border-medium: rgba(56, 189, 248, 0.22);
  --mb-border-highlight: rgba(251, 191, 36, 0.40);
  --mb-border-active: #fbbf24;
  --mb-border-music-active: #fbbf24;

  /* Text & notation */
  --mb-text-primary: #fef3c7;
  --mb-text-secondary: #cbd5e1;
  --mb-text-muted: #94a3b8;
  --mb-text-dim: #64748b;
  --mb-text-disabled: #334155;

  /* Accents */
  --mb-accent-primary: #fbbf24;
  --mb-accent-primary-glow: rgba(251, 191, 36, 0.20);
  --mb-accent-secondary: #38bdf8;
  --mb-accent-music: #fbbf24;

  /* Functional invariants PRESERVED */
  --mb-accent-transport: #10b981;
  --mb-accent-tempo: #f59e0b;
  --mb-accent-danger: #ef4444;

  /* Interactive States */
  --mb-bg-hover: rgba(251, 191, 36, 0.10);
  --mb-bg-active: rgba(251, 191, 36, 0.18);
  --mb-bg-selected: rgba(251, 191, 36, 0.20);
  --mb-bg-dropzone: rgba(251, 191, 36, 0.12);

  /* Shadows & Depth */
  --mb-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.85);
  --mb-shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--mb-border-subtle);
  --mb-shadow-lg: 0 10px 24px -4px rgba(0, 0, 0, 0.90), 0 0 0 1px var(--mb-border-medium);
  --mb-shadow-glass: 0 12px 32px -6px rgba(0, 0, 0, 0.95), 0 0 0 1px var(--mb-border-medium);
  --mb-shadow-active: 0 0 0 1px var(--mb-accent-primary), 0 2px 10px -1px var(--mb-accent-primary-glow);
  --mb-shadow-popover: 0 16px 40px -6px rgba(0, 0, 0, 0.98), 0 0 0 1px var(--mb-border-medium);
}

/* ==========================================================================
   SPOOKY HALLOWEEN — THEME DEFINITION
   Aged-metal / dark wood / haunted-instrument character,
   warm ivory typography, glowing pumpkin orange focal accents, spectral violet.
   ========================================================================== */
html[data-theme="halloween"] {
  /* Surfaces (Aged metal / dark wood / haunted-instrument surfaces) */
  --mb-bg-canvas: #160e0a;
  --mb-bg-surface-1: #1a110c;
  --mb-bg-surface-2: #221711;
  --mb-bg-surface-3: #2d1f17;
  --mb-bg-chalkboard: #160e0a;
  --mb-bg-glass: rgba(26, 17, 12, 0.90);
  --mb-bg-glass-strong: rgba(34, 23, 17, 0.96);

  /* Borders */
  --mb-border-subtle: rgba(249, 115, 22, 0.10);
  --mb-border-medium: rgba(249, 115, 22, 0.18);
  --mb-border-highlight: rgba(249, 115, 22, 0.35);
  --mb-border-active: #f97316;
  --mb-border-music-active: #f97316;

  /* Text & notation */
  --mb-text-primary: #fef3c7;
  --mb-text-secondary: #fed7aa;
  --mb-text-muted: #fdba74;
  --mb-text-dim: #ea580c;
  --mb-text-disabled: #7c2d12;

  /* Accents */
  --mb-accent-primary: #f97316;
  --mb-accent-primary-glow: rgba(249, 115, 22, 0.28);
  --mb-accent-secondary: #a855f7;
  --mb-accent-music: #f97316;

  /* Functional invariants PRESERVED */
  --mb-accent-transport: #10b981;
  --mb-accent-tempo: #f59e0b;
  --mb-accent-danger: #ef4444;

  /* Interactive States */
  --mb-bg-hover: rgba(249, 115, 22, 0.10);
  --mb-bg-active: rgba(249, 115, 22, 0.18);
  --mb-bg-selected: rgba(249, 115, 22, 0.12);
  --mb-bg-dropzone: rgba(249, 115, 22, 0.12);

  /* Shadows & Depth */
  --mb-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.85);
  --mb-shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--mb-border-subtle);
  --mb-shadow-lg: 0 10px 24px -4px rgba(0, 0, 0, 0.90), 0 0 0 1px var(--mb-border-medium);
  --mb-shadow-glass: 0 12px 32px -6px rgba(0, 0, 0, 0.95), 0 0 0 1px var(--mb-border-medium);
  --mb-shadow-active: 0 0 0 1px var(--mb-accent-primary), 0 2px 10px -1px var(--mb-accent-primary-glow);
  --mb-shadow-popover: 0 16px 40px -6px rgba(0, 0, 0, 0.98), 0 0 0 1px var(--mb-border-medium);
}

/* ==========================================================================
   PLAYFUL CAT — THEME DEFINITION
   Sophisticated nighttime cat studio character,
   deep charcoal/plum night base, soft lavender & playful pink accents,
   warm ivory musical notation.
   ========================================================================== */
html[data-theme="cat"] {
  /* Surfaces (Deep charcoal-plum / near-black workstation hierarchy) */
  --mb-bg-canvas: #100C14;
  --mb-bg-surface-1: #17111D;
  --mb-bg-surface-2: #211526;
  --mb-bg-surface-3: #281B2E;
  --mb-bg-chalkboard: #100C14;
  --mb-bg-glass: rgba(23, 18, 29, 0.90);
  --mb-bg-glass-strong: rgba(31, 24, 39, 0.96);

  /* Borders */
  --mb-border-subtle: rgba(167, 139, 250, 0.10);
  --mb-border-medium: rgba(167, 139, 250, 0.18);
  --mb-border-highlight: rgba(167, 139, 250, 0.35);
  --mb-border-active: #a78bfa;
  --mb-border-music-active: #a78bfa;

  /* Text & notation */
  --mb-text-primary: #FFF4E8;
  --mb-text-secondary: #E8DDF0;
  --mb-text-muted: #a78bfa;
  --mb-text-dim: #7c3aed;
  --mb-text-disabled: #4c1d95;

  /* Accents */
  --mb-accent-primary: #a78bfa;
  --mb-accent-primary-glow: rgba(167, 139, 250, 0.28);
  --mb-accent-secondary: #f0a6ca;
  --mb-accent-music: #a78bfa;

  /* Functional invariants PRESERVED */
  --mb-accent-transport: #10b981;
  --mb-accent-tempo: #f59e0b;
  --mb-accent-danger: #ef4444;

  /* Interactive States */
  --mb-bg-hover: rgba(167, 139, 250, 0.10);
  --mb-bg-active: rgba(167, 139, 250, 0.18);
  --mb-bg-selected: rgba(167, 139, 250, 0.12);
  --mb-bg-dropzone: rgba(167, 139, 250, 0.12);

  /* Shadows & Depth */
  --mb-shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.85);
  --mb-shadow-md: 0 4px 12px -2px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--mb-border-subtle);
  --mb-shadow-lg: 0 10px 24px -4px rgba(0, 0, 0, 0.90), 0 0 0 1px var(--mb-border-medium);
  --mb-shadow-glass: 0 12px 32px -6px rgba(0, 0, 0, 0.95), 0 0 0 1px var(--mb-border-medium);
  --mb-shadow-active: 0 0 0 1px var(--mb-accent-primary), 0 2px 10px -1px var(--mb-accent-primary-glow);
  --mb-shadow-popover: 0 16px 40px -6px rgba(0, 0, 0, 0.98), 0 0 0 1px var(--mb-border-medium);
}


/* Suppress neon ambient blur blobs in Classic Dark so slate chalkboard stays crisp & matte */
html[data-theme="classic"] .ambient-glow,
html[data-theme="minimal"] .ambient-glow,
:root:not([data-theme]) .ambient-glow {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* ==========================================================================
   CLASSIC DARK — PHYSICAL BOARD EDGE & FRAME STYLING (Priority 5)
   Restrained architectural mineral slate chalkboard framing and milled tool rails
   ========================================================================== */

/* Canvas stage frame (.canvas-container, .stage-canvas-outer, .stage-card, #stage)
   Restrained mineral/slate recessed edge: subtle milled slate groove & soft chalk-damped border */
html[data-theme="classic"] .canvas-container,
html[data-theme="classic"] .stage-canvas-outer,
html[data-theme="classic"] .stage-card,
html[data-theme="classic"] #stage,
:root:not([data-theme]) .canvas-container,
:root:not([data-theme]) .stage-canvas-outer,
:root:not([data-theme]) .stage-card,
:root:not([data-theme]) #stage,
.canvas-container,
.stage-canvas-outer,
.stage-card {
  border: 1px solid rgba(185, 215, 200, 0.18);
  box-shadow:
    inset 0 3px 8px rgba(0, 0, 0, 0.75),
    inset 0 0 0 1px rgba(185, 215, 200, 0.10),
    inset 0 -1px 2px rgba(244, 239, 230, 0.08),
    0 8px 24px -2px rgba(0, 0, 0, 0.7);
  background: var(--mb-bg-chalkboard);
}

/* Board Outer Card Container (.bento-stage-card) */
html[data-theme="classic"] .bento-stage-card,
:root:not([data-theme]) .bento-stage-card,
.bento-stage-card {
  border: 1px solid var(--mb-border-medium);
  box-shadow:
    0 6px 20px -2px rgba(0, 0, 0, 0.6),
    0 0 0 1px var(--mb-border-subtle);
  background: var(--mb-bg-surface-1);
}

/* Stage Card Body & Viewport Frame (.stage-card-body, .stage-viewport-frame) */
html[data-theme="classic"] .stage-card-body,
html[data-theme="classic"] .stage-viewport-frame,
:root:not([data-theme]) .stage-card-body,
:root:not([data-theme]) .stage-viewport-frame,
.stage-card-body {
  border-radius: var(--mb-radius-lg);
}

/* Chalkboard Canvas Element (#stage) */
html[data-theme="classic"] #stage,
:root:not([data-theme]) #stage {
  border-radius: var(--mb-radius-lg);
}

/* Surrounding rails with milled slate tool ledge/rail styling */

/* Rail 1: Header Control Strip */
html[data-theme="classic"] .header-control-strip,
html[data-theme="classic"] .stage-toolbar-header,
html[data-theme="classic"] .bento-stage-card .bento-card-header,
:root:not([data-theme]) .header-control-strip,
:root:not([data-theme]) .stage-toolbar-header,
:root:not([data-theme]) .bento-stage-card .bento-card-header,
.stage-toolbar-header {
  border-top: 1px solid rgba(225, 235, 228, 0.12);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.6);
}

/* Rail 2: Bottom Dock Rail */
html[data-theme="classic"] .bottom-dock-rail,
html[data-theme="classic"] .dock-inner-glass,
html[data-theme="classic"] .floating-transport-dock .dock-inner-glass,
:root:not([data-theme]) .bottom-dock-rail,
:root:not([data-theme]) .dock-inner-glass,
:root:not([data-theme]) .floating-transport-dock .dock-inner-glass,
.bottom-dock-rail {
  border-top: 1px solid rgba(225, 235, 228, 0.14);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.8), 0 4px 16px rgba(0, 0, 0, 0.6);
}

/* Rail 3: Timeline Strip */
html[data-theme="classic"] .timeline-strip,
html[data-theme="classic"] #piano-roll-header,
html[data-theme="classic"] .bento-editor-card .panel-collapsible-header,
html[data-theme="classic"] .preset-preview-bar,
:root:not([data-theme]) .timeline-strip,
:root:not([data-theme]) #piano-roll-header,
:root:not([data-theme]) .bento-editor-card .panel-collapsible-header,
:root:not([data-theme]) .preset-preview-bar,
.timeline-strip {
  border-top: 1px solid rgba(225, 235, 228, 0.12);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.5);
}

/* ==========================================================================
   MIDNIGHT PURPLE — PRECISION OBSIDIAN FRAME & RAILS STYLING
   Deep obsidian crystal stage framing with titanium bevel top borders and controlled specular edges
   ========================================================================== */

/* Canvas stage frame (.canvas-container, .stage-canvas-outer, .stage-card, #stage) */
html[data-theme="midnight"] .canvas-container,
html[data-theme="midnight"] .stage-canvas-outer,
html[data-theme="midnight"] .stage-card,
html[data-theme="midnight"] #stage {
  border: 1px solid rgba(192, 132, 252, 0.16);
  box-shadow:
    inset 0 3px 12px rgba(0, 0, 0, 0.85),
    inset 0 0 0 1px rgba(168, 85, 247, 0.12),
    0 8px 24px -2px rgba(0, 0, 0, 0.7);
  background: var(--mb-bg-chalkboard);
}

/* Board Outer Card Container (.bento-stage-card) */
html[data-theme="midnight"] .bento-stage-card {
  border: 1px solid var(--mb-border-medium);
  box-shadow:
    0 8px 28px -4px rgba(0, 0, 0, 0.80),
    0 0 0 1px var(--mb-border-subtle);
  background: var(--mb-bg-surface-1);
}

/* Stage Card Body & Viewport Frame (.stage-card-body, .stage-viewport-frame) */
html[data-theme="midnight"] .stage-card-body,
html[data-theme="midnight"] .stage-viewport-frame {
  border-radius: var(--mb-radius-lg);
}

/* Canvas Element (#stage) */
html[data-theme="midnight"] #stage {
  border-radius: var(--mb-radius-lg);
}

/* Surrounding precision dark titanium rails with fine violet top bevel highlight */

/* Rail 1: Header Control Strip */
html[data-theme="midnight"] .header-control-strip,
html[data-theme="midnight"] .stage-toolbar-header,
html[data-theme="midnight"] .bento-stage-card .bento-card-header {
  border-top: 1px solid rgba(216, 180, 254, 0.18);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.70);
}

/* Rail 2: Bottom Dock Rail */
html[data-theme="midnight"] .bottom-dock-rail,
html[data-theme="midnight"] .dock-inner-glass,
html[data-theme="midnight"] .floating-transport-dock .dock-inner-glass {
  border-top: 1px solid rgba(216, 180, 254, 0.20);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.90), 0 4px 16px rgba(0, 0, 0, 0.75);
}

/* Rail 3: Timeline Strip */
html[data-theme="midnight"] .timeline-strip,
html[data-theme="midnight"] #piano-roll-header,
html[data-theme="midnight"] .bento-editor-card .panel-collapsible-header,
html[data-theme="midnight"] .preset-preview-bar {
  border-top: 1px solid rgba(216, 180, 254, 0.16);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.65);
}

/* ==========================================================================
   MINIMAL SLATE — PRECISION GRAPHITE & STEEL WORKSTATION FRAMING
   Milled steel bevels, precision graphite borders, and crisp digital tool rails
   ========================================================================== */

/* Canvas stage frame (.stage-viewport-frame, .canvas-container, .stage-canvas-outer) */
html[data-theme="minimal"] .stage-viewport-frame,
html[data-theme="minimal"] .canvas-container,
html[data-theme="minimal"] .stage-canvas-outer,
html[data-theme="minimal"] .stage-card {
  border: 1px solid rgba(139, 146, 156, 0.20);
  box-shadow:
    inset 0 2px 8px rgba(0, 0, 0, 0.65),
    0 1px 2px rgba(0, 0, 0, 0.4);
  background: var(--mb-bg-chalkboard);
}

/* Board Outer Card Container (.bento-stage-card) */
html[data-theme="minimal"] .bento-stage-card {
  border: 1px solid var(--mb-border-medium);
  box-shadow: 0 4px 20px -2px rgba(0, 0, 0, 0.75);
  background: var(--mb-bg-surface-1);
}

/* Stage Card Body & Viewport Frame (.stage-card-body, .stage-viewport-frame) */
html[data-theme="minimal"] .stage-card-body,
html[data-theme="minimal"] .stage-viewport-frame {
  border-radius: var(--mb-radius-lg);
}

/* Canvas Element (#stage) - fits flush inside without duplicate competing borders */
html[data-theme="minimal"] #stage {
  border: none;
  box-shadow: none;
  border-radius: var(--mb-radius-lg);
}

/* Milled steel workstation rails with subtle cool highlight */

/* Rail 1: Header Control Strip & Stage Toolbar Header */
html[data-theme="minimal"] .header-control-strip,
html[data-theme="minimal"] .bento-stage-card .bento-card-header {
  border-top: 1px solid rgba(139, 146, 156, 0.16);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.65);
}

html[data-theme="minimal"] .stage-toolbar-header {
  border-bottom: 1px solid rgba(139, 146, 156, 0.16);
  box-shadow: 0 1px 0 rgba(139, 146, 156, 0.08);
}

/* Rail 2: Bottom Dock Rail */
html[data-theme="minimal"] .bottom-dock-rail,
html[data-theme="minimal"] .dock-inner-glass,
html[data-theme="minimal"] .floating-transport-dock .dock-inner-glass {
  border-top: 1px solid rgba(139, 146, 156, 0.18);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.85), 0 4px 16px rgba(0, 0, 0, 0.70);
}

/* Rail 3: Timeline Strip */
html[data-theme="minimal"] .timeline-strip,
html[data-theme="minimal"] #piano-roll-header,
html[data-theme="minimal"] .bento-editor-card .panel-collapsible-header,
html[data-theme="minimal"] .preset-preview-bar {
  border-top: 1px solid rgba(139, 146, 156, 0.14);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.60);
}

html[data-theme="galaxy"] .ambient-glow {
  opacity: 0.02 !important;
  pointer-events: none !important;
}

/* Canvas stage frame (.stage-viewport-frame, .canvas-container, .stage-canvas-outer, .stage-card) */
html[data-theme="galaxy"] .stage-viewport-frame,
html[data-theme="galaxy"] .canvas-container,
html[data-theme="galaxy"] .stage-canvas-outer,
html[data-theme="galaxy"] .stage-card {
  border: 1px solid rgba(147, 197, 253, 0.16);
  box-shadow:
    inset 0 2px 12px rgba(0, 0, 0, 0.85),
    0 1px 3px rgba(0, 0, 0, 0.6);
  background: var(--mb-bg-chalkboard);
}

/* Board Outer Card Container (.bento-stage-card) */
html[data-theme="galaxy"] .bento-stage-card {
  border: 1px solid var(--mb-border-medium);
  box-shadow: 0 4px 24px -2px rgba(0, 0, 0, 0.85);
  background: var(--mb-bg-surface-1);
}

/* Stage Card Body & Viewport Frame (.stage-card-body, .stage-viewport-frame) */
html[data-theme="galaxy"] .stage-card-body,
html[data-theme="galaxy"] .stage-viewport-frame {
  border-radius: var(--mb-radius-lg);
}

/* Canvas Element (#stage) */
html[data-theme="galaxy"] #stage {
  border: none;
  box-shadow: none;
  border-radius: var(--mb-radius-lg);
}

/* Rail 1: Header Control Strip & Stage Toolbar Header */
html[data-theme="galaxy"] .header-control-strip,
html[data-theme="galaxy"] .bento-stage-card .bento-card-header {
  border-top: 1px solid rgba(147, 197, 253, 0.14);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.75);
}

html[data-theme="galaxy"] .stage-toolbar-header {
  border-bottom: 1px solid rgba(147, 197, 253, 0.14);
  box-shadow: 0 1px 0 rgba(147, 197, 253, 0.06);
}

/* Rail 2: Bottom Dock Rail */
html[data-theme="galaxy"] .bottom-dock-rail,
html[data-theme="galaxy"] .dock-inner-glass,
html[data-theme="galaxy"] .floating-transport-dock .dock-inner-glass {
  border-top: 1px solid rgba(147, 197, 253, 0.18);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.90), 0 4px 16px rgba(0, 0, 0, 0.75);
}

/* Rail 3: Timeline Strip */
html[data-theme="galaxy"] .timeline-strip,
html[data-theme="galaxy"] #piano-roll-header,
html[data-theme="galaxy"] .bento-editor-card .panel-collapsible-header,
html[data-theme="galaxy"] .preset-preview-bar {
  border-top: 1px solid rgba(147, 197, 253, 0.12);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.70);
}
/* ==========================================================================
   CYBERPUNK NEON — HARDWARE STAGE FRAME & CONTROL RAILS
   ========================================================================== */
html[data-theme="cyberpunk"] .ambient-glow {
  opacity: 0.05 !important;
  pointer-events: none !important;
}

/* Canvas stage frame (.stage-viewport-frame, .canvas-container, .stage-canvas-outer, .stage-card) */
html[data-theme="cyberpunk"] .stage-viewport-frame,
html[data-theme="cyberpunk"] .canvas-container,
html[data-theme="cyberpunk"] .stage-canvas-outer,
html[data-theme="cyberpunk"] .stage-card {
  border: 1px solid rgba(0, 240, 255, 0.25);
  box-shadow:
    inset 0 2px 12px rgba(0, 0, 0, 0.90),
    0 0 15px -3px rgba(0, 240, 255, 0.12);
  background: #080a0f;
}

/* Board Outer Card Container (.bento-stage-card) */
html[data-theme="cyberpunk"] .bento-stage-card {
  border: 1px solid var(--mb-border-medium);
  box-shadow: 0 4px 24px -2px rgba(0, 0, 0, 0.90), 0 0 12px -2px rgba(0, 240, 255, 0.10);
  background: var(--mb-bg-surface-1);
}

/* Stage Card Body & Viewport Frame (.stage-card-body, .stage-viewport-frame) */
html[data-theme="cyberpunk"] .stage-card-body,
html[data-theme="cyberpunk"] .stage-viewport-frame {
  border-radius: var(--mb-radius-lg);
}

/* Canvas Element (#stage) */
html[data-theme="cyberpunk"] #stage {
  border: none;
  box-shadow: none;
  border-radius: var(--mb-radius-lg);
}

/* Rail 1: Header Control Strip & Stage Toolbar Header */
html[data-theme="cyberpunk"] .header-control-strip,
html[data-theme="cyberpunk"] .bento-stage-card .bento-card-header {
  border-top: 1px solid rgba(0, 240, 255, 0.22);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.80);
}

html[data-theme="cyberpunk"] .stage-toolbar-header {
  border-bottom: 1px solid rgba(0, 240, 255, 0.20);
  box-shadow: 0 1px 0 rgba(0, 240, 255, 0.08);
}

/* Rail 2: Bottom Dock Rail */
html[data-theme="cyberpunk"] .bottom-dock-rail,
html[data-theme="cyberpunk"] .dock-inner-glass,
html[data-theme="cyberpunk"] .floating-transport-dock .dock-inner-glass {
  border-top: 1px solid rgba(0, 240, 255, 0.25);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.95), 0 4px 16px rgba(0, 0, 0, 0.80), 0 0 20px -4px rgba(0, 240, 255, 0.15);
}

/* Rail 3: Timeline Strip */
html[data-theme="cyberpunk"] .timeline-strip,
html[data-theme="cyberpunk"] #piano-roll-header,
html[data-theme="cyberpunk"] .bento-editor-card .panel-collapsible-header,
html[data-theme="cyberpunk"] .preset-preview-bar {
  border-top: 1px solid rgba(0, 240, 255, 0.20);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.75);
}

/* ==========================================================================
   DEEP OCEAN — CONTAINER & RAIL FRAMING
   Deep marine instrument frame, subtle teal borders, high-contrast rails
   ========================================================================== */
html[data-theme="ocean"] .ambient-glow {
  opacity: 0.04 !important;
  pointer-events: none !important;
}

/* Canvas stage frame (.stage-viewport-frame, .canvas-container, .stage-canvas-outer, .stage-card) */
html[data-theme="ocean"] .stage-viewport-frame,
html[data-theme="ocean"] .canvas-container,
html[data-theme="ocean"] .stage-canvas-outer,
html[data-theme="ocean"] .stage-card {
  border: 1px solid rgba(45, 212, 191, 0.20);
  box-shadow:
    inset 0 2px 12px rgba(0, 0, 0, 0.90),
    0 4px 20px -2px rgba(0, 0, 0, 0.85);
  background: #05242b;
}

/* Board Outer Card Container (.bento-stage-card) */
html[data-theme="ocean"] .bento-stage-card {
  border: 1px solid var(--mb-border-medium);
  box-shadow: 0 4px 24px -2px rgba(0, 0, 0, 0.90), 0 0 12px -2px rgba(45, 212, 191, 0.08);
  background: var(--mb-bg-surface-1);
}

/* Stage Card Body & Viewport Frame (.stage-card-body, .stage-viewport-frame) */
html[data-theme="ocean"] .stage-card-body,
html[data-theme="ocean"] .stage-viewport-frame {
  border-radius: var(--mb-radius-lg);
}

/* Canvas Element (#stage) */
html[data-theme="ocean"] #stage {
  border: none;
  box-shadow: none;
  border-radius: var(--mb-radius-lg);
}

/* Rail 1: Header Control Strip & Stage Toolbar Header */
html[data-theme="ocean"] .header-control-strip,
html[data-theme="ocean"] .bento-stage-card .bento-card-header {
  border-top: 1px solid rgba(45, 212, 191, 0.20);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.80);
}

html[data-theme="ocean"] .stage-toolbar-header {
  border-bottom: 1px solid rgba(45, 212, 191, 0.18);
  box-shadow: 0 1px 0 rgba(45, 212, 191, 0.06);
}

/* Rail 2: Bottom Dock Rail */
html[data-theme="ocean"] .bottom-dock-rail,
html[data-theme="ocean"] .dock-inner-glass,
html[data-theme="ocean"] .floating-transport-dock .dock-inner-glass {
  border-top: 1px solid rgba(45, 212, 191, 0.22);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.95), 0 4px 16px rgba(0, 0, 0, 0.80), 0 0 20px -4px rgba(45, 212, 191, 0.12);
}

/* Rail 3: Timeline Strip */
html[data-theme="ocean"] .timeline-strip,
html[data-theme="ocean"] #piano-roll-header,
html[data-theme="ocean"] .bento-editor-card .panel-collapsible-header,
html[data-theme="ocean"] .preset-preview-bar {
  border-top: 1px solid rgba(45, 212, 191, 0.18);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.75);
}


/* ==========================================================================
   RETRO 8-BIT PIXEL — CONTAINER & RAIL FRAMING
   Arcade cabinet bezel frame, stepped pixel borders, high-contrast rails
   ========================================================================== */
html[data-theme="pixel"] .ambient-glow {
  opacity: 0 !important;
  pointer-events: none !important;
}

/* Canvas stage frame (.stage-viewport-frame, .canvas-container, .stage-canvas-outer, .stage-card) */
html[data-theme="pixel"] .stage-viewport-frame,
html[data-theme="pixel"] .canvas-container,
html[data-theme="pixel"] .stage-card {
  border: 2px solid rgba(251, 191, 36, 0.30);
  box-shadow:
    inset 0 2px 10px rgba(0, 0, 0, 0.95),
    0 4px 20px -2px rgba(0, 0, 0, 0.90);
  background: #0a0c16;
  border-radius: 2px;
}

html[data-theme="pixel"] .stage-canvas-outer {
  border: 2px solid rgba(251, 191, 36, 0.30);
  box-shadow:
    inset 0 2px 10px rgba(0, 0, 0, 0.95),
    0 4px 20px -2px rgba(0, 0, 0, 0.90);
  background: transparent !important;
  border-radius: 2px;
}

/* Board Outer Card Container (.bento-stage-card) */
html[data-theme="pixel"] .bento-stage-card {
  border: 2px solid var(--mb-border-medium);
  box-shadow: 0 4px 24px -2px rgba(0, 0, 0, 0.90), 0 0 12px -2px rgba(251, 191, 36, 0.10);
  background: var(--mb-bg-surface-1);
  border-radius: 2px;
}

/* Stage Card Body & Viewport Frame (.stage-card-body, .stage-viewport-frame) */
html[data-theme="pixel"] .stage-card-body,
html[data-theme="pixel"] .stage-viewport-frame {
  border-radius: 2px;
}

/* Canvas Element (#stage) */
html[data-theme="pixel"] #stage {
  border: none;
  box-shadow: none;
  background: transparent !important;
  border-radius: 2px;
}

/* Retro Pixel Viewport-Anchored Environment Backdrop */
#stage-pixel-bg-viewport {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
}

/* Rail 1: Header Control Strip & Stage Toolbar Header */
html[data-theme="pixel"] .header-control-strip,
html[data-theme="pixel"] .bento-stage-card .bento-card-header {
  border-top: 2px solid rgba(251, 191, 36, 0.25);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.85);
  border-radius: 2px;
}

html[data-theme="pixel"] .stage-toolbar-header {
  border-bottom: 2px solid rgba(56, 189, 248, 0.18);
  box-shadow: 0 1px 0 rgba(251, 191, 36, 0.10);
}

/* Rail 2: Bottom Dock Rail */
html[data-theme="pixel"] .bottom-dock-rail,
html[data-theme="pixel"] .dock-inner-glass,
html[data-theme="pixel"] .floating-transport-dock .dock-inner-glass {
  border-top: 2px solid rgba(251, 191, 36, 0.30);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.95), 0 4px 16px rgba(0, 0, 0, 0.85), 0 0 16px -2px rgba(251, 191, 36, 0.15);
  border-radius: 2px;
}

/* Rail 3: Timeline Strip */
html[data-theme="pixel"] .timeline-strip,
html[data-theme="pixel"] #piano-roll-header,
html[data-theme="pixel"] .bento-editor-card .panel-collapsible-header,
html[data-theme="pixel"] .preset-preview-bar {
  border-top: 2px solid rgba(56, 189, 248, 0.20);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.80);
  border-radius: 2px;
}

/* Retro Pixel — Hard/square geometry overrides for collapsed bars */
html[data-theme="pixel"] .bento-editor-card,
html[data-theme="pixel"] .bento-editor-card.panel-collapsed,
html[data-theme="pixel"] .bento-sidebar-column .bento-card.panel-collapsed,
html[data-theme="pixel"] .bento-composer-card.panel-collapsed,
html[data-theme="pixel"] .bento-templates-card.panel-collapsed {
  border-radius: var(--mb-radius-sm) !important;
}

html[data-theme="pixel"] .bento-editor-card .panel-collapsible-header {
  border-radius: var(--mb-radius-xs);
}

html[data-theme="pixel"] .piano-collapsed-pill {
  border-radius: var(--mb-radius-xs) !important;
}

html[data-theme="pixel"] .btn-piano-toggle,
html[data-theme="pixel"] .panel-toggle-btn {
  border-radius: var(--mb-radius-xs);
}

/* ==========================================================================
   SPOOKY HALLOWEEN — BOARD EDGE, RAILS & FRAME STYLING
   Aged bronze / dark iron architectural framing and warm amber rails
   ========================================================================== */
html[data-theme="halloween"] .ambient-glow {
  opacity: 0.04 !important;
  pointer-events: none !important;
}

/* Canvas stage frame (.stage-viewport-frame, .canvas-container, .stage-canvas-outer, .stage-card) */
html[data-theme="halloween"] .stage-viewport-frame,
html[data-theme="halloween"] .canvas-container,
html[data-theme="halloween"] .stage-canvas-outer,
html[data-theme="halloween"] .stage-card {
  border: 1px solid rgba(249, 115, 22, 0.22);
  box-shadow:
    inset 0 2px 12px rgba(0, 0, 0, 0.90),
    0 4px 20px -2px rgba(0, 0, 0, 0.85);
}

/* Board Outer Card Container (.bento-stage-card) */
html[data-theme="halloween"] .bento-stage-card {
  border: 1px solid var(--mb-border-medium);
  box-shadow: 0 4px 24px -2px rgba(0, 0, 0, 0.90), 0 0 12px -2px rgba(249, 115, 22, 0.12);
  background: var(--mb-bg-surface-1);
}
/* Selection and Overloaded/Error States in Bento Stage */
html[data-theme="halloween"] .bento-stage-card [data-selected="true"],
html[data-theme="halloween"] .stage-viewport-frame [data-selected="true"] {
  background: rgba(249, 115, 22, 0.10);
  border-color: rgba(249, 115, 22, 0.65);
  box-shadow: 0 0 10px rgba(249, 115, 22, 0.25);
}

html[data-theme="halloween"] .bento-stage-card [data-overloaded="true"],
html[data-theme="halloween"] .stage-viewport-frame [data-overloaded="true"],
html[data-theme="halloween"] .bento-stage-card [data-error="true"],
html[data-theme="halloween"] .stage-viewport-frame [data-error="true"] {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.75);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
}


/* Stage Card Body & Viewport Frame (.stage-card-body, .stage-viewport-frame) */
html[data-theme="halloween"] .stage-card-body,
html[data-theme="halloween"] .stage-viewport-frame {
  border-radius: var(--mb-radius-lg);
}

/* Canvas Element (#stage) */
html[data-theme="halloween"] #stage {
  border: none;
  box-shadow: none;
  border-radius: var(--mb-radius-lg);
}

/* Rail 1: Header Control Strip & Stage Toolbar Header */
html[data-theme="halloween"] .header-control-strip,
html[data-theme="halloween"] .bento-stage-card .bento-card-header {
  border-top: 1px solid rgba(249, 115, 22, 0.20);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.80);
}

html[data-theme="halloween"] .stage-toolbar-header {
  border-bottom: 1px solid rgba(249, 115, 22, 0.18);
  box-shadow: 0 1px 0 rgba(249, 115, 22, 0.08);
}

/* Rail 2: Bottom Dock Rail */
html[data-theme="halloween"] .bottom-dock-rail,
html[data-theme="halloween"] .dock-inner-glass,
html[data-theme="halloween"] .floating-transport-dock .dock-inner-glass {
  border-top: 1px solid rgba(249, 115, 22, 0.22);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.95), 0 4px 16px rgba(0, 0, 0, 0.80), 0 0 20px -4px rgba(249, 115, 22, 0.15);
}

/* Rail 3: Timeline Strip */
html[data-theme="halloween"] .timeline-strip,
html[data-theme="halloween"] #piano-roll-header,
html[data-theme="halloween"] .bento-editor-card .panel-collapsible-header,
html[data-theme="halloween"] .preset-preview-bar {
  border-top: 1px solid rgba(249, 115, 22, 0.18);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.75);
}

/* ==========================================================================
   PLAYFUL CAT — BOARD EDGE, RAILS & FRAME STYLING
   Cozy night plum architectural framing and soft lavender rails
   ========================================================================== */
html[data-theme="cat"] .ambient-glow {
  opacity: 0.05 !important;
  pointer-events: none !important;
}

/* Canvas stage frame (.stage-viewport-frame, .canvas-container, .stage-canvas-outer, .stage-card) */
html[data-theme="cat"] .stage-viewport-frame,
html[data-theme="cat"] .canvas-container,
html[data-theme="cat"] .stage-canvas-outer,
html[data-theme="cat"] .stage-card {
  border: 1px solid rgba(167, 139, 250, 0.22);
  box-shadow:
    inset 0 2px 12px rgba(0, 0, 0, 0.90),
    0 4px 20px -2px rgba(0, 0, 0, 0.85);
}

/* Board Outer Card Container (.bento-stage-card) */
html[data-theme="cat"] .bento-stage-card {
  border: 1px solid var(--mb-border-medium);
  box-shadow: 0 4px 24px -2px rgba(0, 0, 0, 0.90), 0 0 12px -2px rgba(167, 139, 250, 0.12);
  background: var(--mb-bg-surface-1);
}

/* Selection and Overloaded/Error States in Bento Stage */
html[data-theme="cat"] .bento-stage-card [data-selected="true"],
html[data-theme="cat"] .stage-viewport-frame [data-selected="true"] {
  background: rgba(167, 139, 250, 0.10);
  border-color: rgba(167, 139, 250, 0.65);
  box-shadow: 0 0 10px rgba(167, 139, 250, 0.25);
}

html[data-theme="cat"] .bento-stage-card [data-overloaded="true"],
html[data-theme="cat"] .stage-viewport-frame [data-overloaded="true"],
html[data-theme="cat"] .bento-stage-card [data-error="true"],
html[data-theme="cat"] .stage-viewport-frame [data-error="true"] {
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.75);
  box-shadow: 0 0 10px rgba(239, 68, 68, 0.25);
}

/* Stage Card Body & Viewport Frame (.stage-card-body, .stage-viewport-frame) */
html[data-theme="cat"] .stage-card-body,
html[data-theme="cat"] .stage-viewport-frame {
  border-radius: var(--mb-radius-lg);
}

/* Canvas Element (#stage) */
html[data-theme="cat"] #stage {
  border: none;
  box-shadow: none;
  border-radius: var(--mb-radius-lg);
}

/* Rail 1: Header Control Strip & Stage Toolbar Header */
html[data-theme="cat"] .header-control-strip,
html[data-theme="cat"] .bento-stage-card .bento-card-header {
  border-top: 1px solid rgba(167, 139, 250, 0.20);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.80);
}

html[data-theme="cat"] .stage-toolbar-header {
  border-bottom: 1px solid rgba(167, 139, 250, 0.18);
  box-shadow: 0 1px 0 rgba(167, 139, 250, 0.08);
}

/* Rail 2: Bottom Dock Rail */
html[data-theme="cat"] .bottom-dock-rail,
html[data-theme="cat"] .dock-inner-glass,
html[data-theme="cat"] .floating-transport-dock .dock-inner-glass {
  border-top: 1px solid rgba(167, 139, 250, 0.22);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.95), 0 4px 16px rgba(0, 0, 0, 0.80), 0 0 20px -4px rgba(167, 139, 250, 0.15);
}

/* Rail 3: Timeline Strip */
html[data-theme="cat"] .timeline-strip,
html[data-theme="cat"] #piano-roll-header,
html[data-theme="cat"] .bento-editor-card .panel-collapsible-header,
html[data-theme="cat"] .preset-preview-bar {
  border-top: 1px solid rgba(167, 139, 250, 0.18);
  box-shadow: 0 4px 16px -2px rgba(0, 0, 0, 0.75);
}
.glow-cyan {
  width: 440px;
  height: 440px;
  top: 35%;
  right: -60px;
  background: radial-gradient(circle, var(--mb-accent-music) 0%, transparent 70%);
}

.glow-coral {
  width: 500px;
  height: 500px;
  bottom: -120px;
  left: 20%;
  background: radial-gradient(circle, rgba(139, 92, 246, 0.4) 0%, transparent 70%);
  opacity: 0.08;
}

/* App Outer Container */
.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1560px;
  width: 100%;
  flex: 1 1 0%;
  min-height: 0;
  margin: 0 auto;
  padding: var(--mb-space-xs) var(--mb-space-md) 0;
  display: flex;
  flex-direction: column;
  gap: var(--mb-space-xs);
  overflow: hidden;
  box-sizing: border-box;
}
/* ==========================================================================
   GLOBAL COMPONENT INTERACTION STATES & STANDARDIZATION
   ========================================================================== */
button, [role="button"] {
  cursor: pointer;
}

button, input, select, textarea {
  font-family: inherit;
  color: inherit;
  font-size: var(--mb-text-base);
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: none;
  border-color: var(--mb-accent-music) !important;
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.25) !important;
}

button:active:not(:disabled) {
  transform: scale(0.97) translateY(1px);
}

button:disabled,
button.disabled,
input:disabled,
select:disabled,
textarea:disabled,
[disabled],
[aria-disabled="true"] {
  opacity: 0.38 !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
  filter: grayscale(40%) !important;
  border-color: rgba(255, 255, 255, 0.05) !important;
  color: var(--mb-text-dim) !important;
}

button:disabled:hover,
button.disabled:hover,
input:disabled:hover,
select:disabled:hover,
textarea:disabled:hover,
[disabled]:hover,
[aria-disabled="true"]:hover {
  opacity: 0.38 !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
  background: transparent !important;
  border-color: rgba(255, 255, 255, 0.05) !important;
  color: var(--mb-text-dim) !important;
}

button:disabled:active,
button.disabled:active,
input:disabled:active,
select:disabled:active,
textarea:disabled:active,
[disabled]:active,
[aria-disabled="true"]:active {
  transform: none !important;
  box-shadow: none !important;
}

/* Semantic Error States */
.status-error,
.is-error,
input.is-invalid,
select.is-invalid {
  color: var(--mb-accent-danger, #f43f5e) !important;
  border-color: var(--mb-accent-danger, #f43f5e) !important;
}

input.is-invalid:focus-visible,
select.is-invalid:focus-visible {
  box-shadow: 0 0 0 3px rgba(244, 63, 94, 0.3) !important;
}

/* ==========================================================================
   1. SLEEK TOP BRAND HEADER & STRUCTURED HIERARCHY
   ========================================================================== */
.app-top-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--mb-space-lg);
  padding: 8px 12px 12px 12px;
  position: relative;
  z-index: 100;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

/* LEFT CLUSTER: Brand + Live Save Status */
.header-left-cluster {
  display: flex;
  align-items: center;
  gap: var(--mb-space-md);
  flex-shrink: 0;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-subtle);
  padding: 6px 14px;
  border-radius: var(--mb-radius-sm);
  height: 36px;
  box-sizing: border-box;
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--mb-accent-primary);
}

.brand-name {
  font-family: var(--mb-font-brand);
  font-size: 16px;
  font-weight: var(--mb-weight-extrabold);
  letter-spacing: 0.5px;
  color: var(--mb-text-primary);
  line-height: 1;
}

.site-identity-wrapper {
  display: flex;
  align-items: center;
  padding-left: 6px;
  border-left: 1px solid var(--mb-border-subtle);
  margin-left: 4px;
}

.site-title-identity {
  font-size: 13.5px;
  font-weight: 500;
  color: var(--mb-text-secondary);
  margin: 0;
  line-height: 1;
  padding-left: 10px;
}

/* RIGHT CLUSTER: Grouped Tools + Monetization / Profile + Discrete Dev Switcher */
.header-right-cluster {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  height: 32px;
}

/* Group 1: Workspace Tools Capsule */
.header-tools-group {
  display: flex;
  align-items: center;
  gap: 2px;
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-subtle);
  border-radius: var(--mb-radius-sm);
  padding: 2px;
  height: 32px;
  box-sizing: border-box;
}

.header-tool-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  color: var(--mb-text-secondary);
  padding: 0 10px;
  height: 26px;
  border-radius: 4px;
  font-family: var(--mb-font-ui);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.header-tool-btn:hover {
  background: var(--mb-bg-surface-3);
  color: var(--mb-text-primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.35);
}

.header-tool-btn:active {
  transform: translateY(1px);
  background: var(--mb-bg-surface-1);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.5);
}

/* Header Language Switcher Segmented Pill */
.header-lang-switcher {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-subtle);
  border-radius: var(--mb-radius-sm);
  padding: 2px;
  height: 32px;
  box-sizing: border-box;
}

.lang-switch-btn {
  background: transparent;
  border: none;
  color: var(--mb-text-muted);
  font-family: var(--mb-font-ui);
  font-size: 11px;
  font-weight: 600;
  padding: 0 6px;
  height: 26px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 26px;
}

.lang-switch-btn:hover {
  color: var(--mb-text-primary);
}

.lang-switch-btn.active {
  background: var(--mb-bg-surface-3);
  color: var(--mb-text-primary);
  box-shadow: inset 0 1.5px 3px rgba(0, 0, 0, 0.6);
  border: 1px solid var(--mb-border-medium);
  transform: translateY(0.5px);
}

.lang-switch-divider {
  color: var(--mb-text-dim);
  font-size: 10px;
  user-select: none;
}

/* Vertical Separator */
.header-divider {
  width: 1px;
  height: 18px;
  background: var(--mb-border-subtle);
  margin: 0 2px;
}

/* Group 2: Account & Monetization Group */
.header-account-group {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
}

/* Mobile Hamburger Menu Container (Hidden by default on Desktop) */
.header-mobile-menu-wrap {
  display: none;
  position: relative;
}

.mobile-header-upgrade-btn {
  display: none;
}

.mobile-header-upgrade-btn.is-hidden,
.mobile-header-upgrade-btn.hidden,
.mobile-header-upgrade-btn[hidden],
#btn-mobile-header-pricing.is-hidden,
#btn-mobile-header-pricing.hidden,
#btn-mobile-header-pricing[hidden],
#btn-header-pricing.is-hidden,
#btn-header-pricing.hidden,
#btn-header-pricing[hidden] {
  display: none !important;
}

.header-hamburger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-subtle);
  border-radius: var(--mb-radius-sm);
  color: var(--mb-text-primary);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
}

.header-hamburger-btn:hover,
.header-hamburger-btn:active,
.header-hamburger-btn[aria-expanded="true"] {
  background: var(--mb-bg-surface-3);
  border-color: var(--mb-accent-primary);
  color: var(--mb-accent-primary);
}

.mobile-header-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 220px;
  background: var(--mb-bg-glass-strong);
  border: 1px solid var(--mb-border-medium);
  border-radius: var(--mb-radius-lg);
  box-shadow: var(--mb-shadow-popover);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 8px;
  z-index: 10000;
  box-sizing: border-box;
}

.mobile-menu-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.mobile-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 12px;
  background: transparent;
  border: none;
  border-radius: var(--mb-radius-sm);
  color: var(--mb-text-primary);
  font-family: var(--mb-font-ui);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
  user-select: none;
  box-sizing: border-box;
}

.mobile-menu-item:hover,
.mobile-menu-item:active {
  background: var(--mb-bg-surface-3);
  color: var(--mb-accent-primary);
}

.mobile-menu-item.btn-pricing-accent {
  color: var(--mb-accent-pro, #ec4899);
  font-weight: 600;
}

.mobile-menu-item.btn-pricing-accent:hover {
  background: var(--mb-accent-pro-glow, rgba(236, 72, 153, 0.18));
  color: #f472b6;
}

.mobile-menu-divider {
  height: 1px;
  background: var(--mb-border-subtle);
  margin: 6px 0;
}

.mobile-menu-lang-row {
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  padding: 4px 10px;
}

.mobile-menu-label {
  font-family: var(--mb-font-ui);
  font-size: 12px;
  font-weight: 600;
  color: var(--mb-text-secondary);
}

/* Stage More Options Wrap (Hidden by default on Desktop) */
.stage-more-options-wrap {
  display: none;
}

.btn-stage-more {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  font-weight: 700;
  letter-spacing: 1px;
  padding: 0 8px;
  min-width: 32px;
}

.stage-more-popover {
  min-width: 200px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.stage-more-section {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stage-more-heading {
  font-family: var(--mb-font-ui);
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--mb-text-muted);
}

.stage-more-buttons {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
}

.stage-more-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 8px;
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-subtle);
  border-radius: var(--mb-radius-sm);
  color: var(--mb-text-secondary);
  font-family: var(--mb-font-ui);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.stage-more-btn:hover,
.stage-more-btn.active {
  background: var(--mb-bg-surface-3);
  color: var(--mb-text-primary);
  border-color: var(--mb-accent-primary);
}

.stage-more-theme-trigger {
  grid-column: 1 / -1;
  width: 100%;
  justify-content: center;
  text-align: center;
}

.stage-more-divider {
  height: 1px;
  background: var(--mb-border-subtle);
  margin: 2px 0;
}

/* ==========================================================================
   2. FLOATING BOTTOM PERSISTENT TRANSPORT DOCK
   ========================================================================== */
.floating-transport-dock {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  width: auto;
  max-width: calc(100vw - 32px);
  pointer-events: none;
  animation: float-dock-in 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes float-dock-in {
  from { opacity: 0; transform: translate(-50%, 20px) scale(0.96); }
  to { opacity: 1; transform: translate(-50%, 0) scale(1); }
}

.dock-inner-glass {
  display: inline-flex;
  align-items: center;
  gap: var(--mb-space-sm);
  pointer-events: auto;
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  padding: 6px 14px;
  border-radius: var(--mb-radius-full);
  background: rgba(18, 22, 28, 0.94);
  border: 1px solid var(--mb-border-medium);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.75), 0 0 0 1px rgba(255, 255, 255, 0.05);
  flex-wrap: nowrap;
  white-space: nowrap;
}

.dock-divider {
  width: 1px;
  height: 22px;
  background: var(--mb-border-medium);
  margin: 0 2px;
  flex-shrink: 0;
}

/* 1. Unified Metric Cluster (BPM + Time Signature) */
.transport-metric-cluster {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(18, 24, 38, 0.75);
  border: 1px solid rgba(255, 255, 255, 0.12);
  padding: 4px 12px;
  border-radius: var(--mb-radius-full);
  height: 36px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.mobile-timesig-badge {
  display: none !important;
}

.mobile-metric-badge {
  display: none !important;
}

.transport-mobile-unit {
  display: none !important;
}

.transport-metric-cluster:hover {
  border-color: rgba(6, 182, 212, 0.4);
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.15);
}

.transport-metric-cluster:focus-within {
  border-color: var(--mb-accent-music);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.25);
}

.metric-tempo-unit {
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-tempo-unit input[type="number"] {
  width: 58px;
  height: 26px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 5px;
  color: #ffffff;
  font-family: var(--mb-font-mono);
  font-size: 13px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  text-align: left;
  outline: none;
  padding: 0 2px 0 8px;
  transition: all 0.15s ease;
}

.metric-tempo-unit input[type="number"]:focus {
  background: rgba(6, 182, 212, 0.12);
  border-color: var(--mb-accent-music);
}

.metric-tempo-unit input[type="number"]::-webkit-inner-spin-button {
  opacity: 0.6;
  cursor: pointer;
  margin-right: 2px;
}

.metric-tempo-unit input[type="number"]:hover::-webkit-inner-spin-button,
.metric-tempo-unit input[type="number"]:focus::-webkit-inner-spin-button {
  opacity: 1;
}
.metric-unit-label {
  font-family: var(--mb-font-mono);
  font-size: 11px;
  font-weight: 800;
  color: var(--mb-accent-music);
  letter-spacing: 0.06em;
  user-select: none;
  margin-right: 2px;
}

.metric-cluster-divider {
  width: 1px;
  height: 18px;
  background: rgba(255, 255, 255, 0.15);
  margin: 0 4px;
  flex-shrink: 0;
}

.metric-time-sig-unit {
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
}
/* Fallback standalone pills if used outside cluster */
.tempo-pill-control {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-subtle);
  padding: 5px 12px;
  border-radius: var(--mb-radius-full);
  height: 38px;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.tempo-pill-control:focus-within {
  border-color: var(--mb-accent-music);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

.tempo-label {
  font-family: var(--mb-font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--mb-accent-music);
  letter-spacing: 0.05em;
  user-select: none;
}

.tempo-pill-control input[type="number"] {
  width: 48px;
  background: transparent;
  border: none;
  color: var(--mb-text-primary);
  font-family: var(--mb-font-mono);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  text-align: center;
  outline: none;
}

.tempo-pill-control input[type="number"]::-webkit-inner-spin-button {
  opacity: 0.5;
}

.time-sig-pill-control {
  display: flex;
  align-items: center;
  gap: 2px;
  background: transparent;
  border: none;
  padding: 0;
  border-radius: var(--mb-radius-full);
  height: 100%;
  transition: all 0.15s ease;
  flex-shrink: 0;
  cursor: pointer;
}

.time-sig-label {
  font-family: var(--mb-font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--mb-accent-music);
  letter-spacing: 0.05em;
  user-select: none;
  margin-right: 2px;
}

.time-sig-select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: transparent;
  border: none;
  color: var(--mb-text-primary);
  font-family: var(--mb-font-mono);
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  outline: none;
  cursor: pointer;
  padding: 0 4px;
  text-align: center;
  text-align-last: center;
}

.time-sig-divider {
  font-family: var(--mb-font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--mb-text-secondary);
  user-select: none;
  opacity: 0.6;
  line-height: 1;
}

.time-sig-select option {
  background: #181824;
  color: var(--mb-text-primary);
  font-family: var(--mb-font-mono);
  font-size: 13px;
  font-weight: 600;
}

.popover-time-sig-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-subtle);
  border-radius: var(--mb-radius-md);
  padding: 4px 10px;
  height: 38px;
  box-sizing: border-box;
}

.popover-time-sig-wrap:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.popover-time-sig-wrap:focus-within {
  border-color: var(--mb-accent-music);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.2);
}

.popover-time-sig-wrap .time-sig-select {
  flex: 1;
  height: 100%;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background: transparent;
  border: none;
  color: var(--mb-text-primary);
  font-family: var(--mb-font-mono);
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  outline: none;
  cursor: pointer;
  padding: 0 2px;
  text-align: center;
  text-align-last: center;
}

.popover-time-sig-wrap .time-sig-divider {
  font-size: 15px;
  color: var(--mb-accent-music);
  opacity: 0.8;
}

/* 2. Core Playback Actions */
.transport-action-group {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--mb-border-subtle);
  border-radius: var(--mb-radius-full);
  padding: 3px 5px;
}

.btn-play-prominent {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 72px;
  min-width: 72px;
  height: 38px;
  padding: 0 !important;
  background: linear-gradient(180deg, #10b981 0%, #059669 100%);
  border: 1px solid rgba(16, 185, 129, 0.75);
  color: #ffffff;
  border-radius: var(--mb-radius-full);
  font-family: var(--mb-font-ui);
  font-size: var(--mb-text-base);
  font-weight: var(--mb-weight-bold);
  cursor: pointer;
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5), 0 0 14px var(--mb-accent-transport-glow), inset 0 1.5px 0 rgba(255, 255, 255, 0.45), inset 0 -1.5px 0 rgba(0, 0, 0, 0.25);
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
  white-space: nowrap;
}
.btn-play-prominent .play-icon-symbol {
  margin: auto;
  display: block;
}

.btn-play-prominent:hover {
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.6), 0 0 22px var(--mb-accent-transport-glow), inset 0 1.5px 0 rgba(255, 255, 255, 0.6);
  border-color: #34d399;
  transform: translateY(-1.5px);
  color: #ffffff;
}

.btn-play-prominent:active {
  transform: translateY(1px);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.75), 0 0 18px rgba(16, 185, 129, 0.6), inset 0 0 8px rgba(255, 255, 255, 0.2);
}

#play.playing,
#play.active,
.btn-play-prominent.playing,
.btn-play-prominent.active {
  background: linear-gradient(180deg, #06b6d4 0%, #0891b2 100%);
  border-color: #22d3ee;
  border-top-color: rgba(103, 232, 249, 0.85);
  border-bottom-color: rgba(8, 145, 178, 0.8);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6), 0 0 16px var(--mb-accent-music-glow), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  color: #ffffff;
  transform: translateY(1px);
}

#play.playing:hover,
#play.active:hover,
.btn-play-prominent.playing:hover,
.btn-play-prominent.active:hover {
  background: linear-gradient(180deg, #22d3ee 0%, #06b6d4 100%);
  border-color: #67e8f9;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.5), 0 0 20px var(--mb-accent-music-glow), inset 0 1px 0 rgba(255, 255, 255, 0.45);
  color: #ffffff;
  transform: translateY(1px);
}

.btn-stop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  max-width: 32px;
  padding: 0 !important;
  border-radius: var(--mb-radius-full);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.005) 100%), #1c222b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top-color: rgba(255, 255, 255, 0.12);
  border-bottom-color: rgba(0, 0, 0, 0.45);
  color: var(--mb-text-secondary);
  font-family: var(--mb-font-ui);
  font-size: var(--mb-text-sm);
  font-weight: var(--mb-weight-semibold);
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
  white-space: nowrap;
  box-shadow: 0 1.5px 3px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-transport-icon-only {
  width: 32px;
  height: 32px;
  min-width: 32px;
  max-width: 32px;
  padding: 0 !important;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--mb-radius-full);
  flex-shrink: 0;
}

.btn-transport-icon-only .transport-icon {
  margin: 0;
  display: block;
}

.btn-stop .transport-icon {
  color: var(--mb-accent-danger, #f43f5e);
  fill: var(--mb-accent-danger, #f43f5e);
}

.btn-stop:hover {
  background: rgba(244, 63, 94, 0.18);
  color: var(--mb-accent-danger);
  border-color: rgba(244, 63, 94, 0.45);
  border-top-color: rgba(244, 63, 94, 0.6);
  border-bottom-color: rgba(159, 18, 57, 0.6);
  transform: translateY(-1.5px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-stop:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7);
}

.btn-back,
.btn-rewind,
.btn-forward,
.btn-skip {
  width: 32px;
  height: 32px;
  min-width: 32px;
  max-width: 32px;
  padding: 0 !important;
  border-radius: var(--mb-radius-full);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.005) 100%), #1c222b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top-color: rgba(255, 255, 255, 0.12);
  border-bottom-color: rgba(0, 0, 0, 0.45);
  color: var(--mb-text-secondary);
  font-family: var(--mb-font-mono), monospace;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
  box-shadow: 0 1.5px 3px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-back:hover,
.btn-rewind:hover,
.btn-forward:hover,
.btn-skip:hover {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%), #222832;
  color: var(--mb-text-primary);
  border-color: var(--mb-border-medium);
  border-top-color: rgba(255, 255, 255, 0.25);
  border-bottom-color: rgba(0, 0, 0, 0.5);
  transform: translateY(-1.5px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-back:active,
.btn-rewind:active,
.btn-forward:active,
.btn-skip:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.65);
}

.btn-back .transport-icon,
.btn-skip .transport-icon {
  letter-spacing: -2px;
  font-size: 13px;
  font-weight: 800;
  margin-right: 1px;
}

.btn-rewind .transport-icon,
.btn-forward .transport-icon {
  font-size: 14px;
  font-weight: 800;
}

/* 3. Desktop Secondary Controls (Metronome + Export) */
.transport-desktop-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--mb-border-subtle);
  border-radius: var(--mb-radius-full);
  padding: 3px 8px;
}

/* Master Volume Dock Control */
.transport-volume-control {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-subtle);
  padding: 4px 8px;
  height: 38px;
  border-radius: var(--mb-radius-full);
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.transport-volume-control:hover,
.transport-volume-control:focus-within {
  border-color: rgba(6, 182, 212, 0.4);
  box-shadow: 0 0 10px rgba(6, 182, 212, 0.15);
}

.btn-volume-mute {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: var(--mb-radius-full);
  background: transparent;
  border: none;
  color: var(--mb-text-secondary);
  cursor: pointer;
  padding: 0;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.btn-volume-mute:hover {
  color: var(--mb-accent-music);
  background: rgba(6, 182, 212, 0.15);
}

.btn-volume-mute.muted {
  color: var(--mb-accent-danger);
  background: rgba(244, 63, 94, 0.15);
}

.volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 56px;
  height: 6px;
  background: #0b0e11;
  border-radius: 3px;
  outline: none;
  cursor: pointer;
  box-shadow: inset 0 1.5px 3px rgba(0, 0, 0, 0.95), inset 0 -0.5px 0.5px rgba(255, 255, 255, 0.08), 0 1px 0 rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.75);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(180deg, #e2e8f0 0%, #94a3b8 55%, #64748b 100%);
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -1px 1px rgba(0, 0, 0, 0.4);
  border: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.volume-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: linear-gradient(180deg, #e2e8f0 0%, #94a3b8 55%, #64748b 100%);
  cursor: pointer;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(255, 255, 255, 0.9), inset 0 -1px 1px rgba(0, 0, 0, 0.4);
  border: none;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
}

.volume-slider::-webkit-slider-thumb:hover,
.volume-slider::-moz-range-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.85), 0 0 0 1.5px var(--mb-accent-music), inset 0 1px 0 #ffffff;
}

.volume-slider::-webkit-slider-thumb:active,
.volume-slider::-moz-range-thumb:active {
  transform: scale(1.04);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.9), 0 0 0 2px var(--mb-accent-music), inset 0 1px 0 #ffffff;
}

.volume-slider.muted::-webkit-slider-thumb {
  background: linear-gradient(180deg, #fca5a5 0%, #ef4444 60%, #991b1b 100%);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.8), 0 0 8px rgba(244, 63, 94, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.volume-slider.muted::-moz-range-thumb {
  background: linear-gradient(180deg, #fca5a5 0%, #ef4444 60%, #991b1b 100%);
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.8), 0 0 8px rgba(244, 63, 94, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

.volume-percent-label {
  font-family: var(--mb-font-mono);
  font-size: 11px;
  font-weight: 700;
  color: var(--mb-accent-music);
  min-width: 32px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

/* Mobile Popover Volume Controls */
.popover-volume-group {
  display: none;
  flex-direction: column;
  gap: 6px;
}

.popover-volume-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-subtle);
  border-radius: var(--mb-radius-md);
  padding: 6px 10px;
}

.popover-mute-btn {
  flex-shrink: 0;
  padding: 6px 10px;
}

.popover-mute-btn.muted {
  background: rgba(244, 63, 94, 0.18);
  color: var(--mb-accent-danger);
  border-color: rgba(244, 63, 94, 0.45);
}

.popover-slider-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
}

.popover-volume-slider {
  flex: 1;
  width: 100%;
}

.btn-metronome {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  height: 38px;
  border-radius: var(--mb-radius-full);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.005) 100%), #1c222b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top-color: rgba(255, 255, 255, 0.12);
  border-bottom-color: rgba(0, 0, 0, 0.45);
  color: var(--mb-text-secondary);
  font-family: var(--mb-font-ui);
  font-size: var(--mb-text-sm);
  font-weight: var(--mb-weight-semibold);
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
  white-space: nowrap;
  box-shadow: 0 1.5px 3px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-metronome:hover {
  color: var(--mb-accent-tempo);
  border-color: rgba(245, 158, 11, 0.45);
  border-top-color: rgba(245, 158, 11, 0.6);
  border-bottom-color: rgba(180, 83, 9, 0.6);
  background: rgba(245, 158, 11, 0.14);
  transform: translateY(-1.5px);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.btn-metronome:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7);
}

.btn-metronome.active {
  background: linear-gradient(180deg, #f59e0b 0%, #d97706 100%);
  color: #000000;
  font-weight: var(--mb-weight-bold);
  border-color: #f59e0b;
  border-top-color: rgba(254, 215, 170, 0.7);
  border-bottom-color: rgba(180, 83, 9, 0.8);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6), inset 0 1px 1.5px rgba(0, 0, 0, 0.4), 0 0 14px var(--mb-accent-tempo-glow);
  transform: translateY(1px);
}

.btn-metronome.active:hover {
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6), inset 0 1px 1.5px rgba(0, 0, 0, 0.4), 0 0 16px var(--mb-accent-tempo-glow);
}

.btn-metronome.active .transport-icon {
  stroke: #000000;
}

.btn-demo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 7px 14px;
  height: 38px;
  border-radius: var(--mb-radius-full);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.005) 100%), #1c222b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top-color: rgba(255, 255, 255, 0.12);
  border-bottom-color: rgba(0, 0, 0, 0.45);
  color: var(--mb-text-secondary);
  font-family: var(--mb-font-ui);
  font-size: var(--mb-text-sm);
  font-weight: var(--mb-weight-semibold);
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
  white-space: nowrap;
  box-shadow: 0 1.5px 3px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-demo:hover {
  background: rgba(139, 92, 246, 0.18);
  border-color: rgba(139, 92, 246, 0.45);
  border-top-color: rgba(139, 92, 246, 0.6);
  border-bottom-color: rgba(109, 40, 217, 0.6);
  color: #ffffff;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 0 14px var(--mb-accent-primary-glow);
  transform: translateY(-1.5px);
}

.btn-demo:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7);
}

.btn-clear {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 13px;
  height: 38px;
  border-radius: var(--mb-radius-full);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.005) 100%), #1c222b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top-color: rgba(255, 255, 255, 0.12);
  border-bottom-color: rgba(0, 0, 0, 0.45);
  color: var(--mb-text-muted);
  font-family: var(--mb-font-ui);
  font-size: var(--mb-text-sm);
  font-weight: var(--mb-weight-semibold);
  cursor: pointer;
  transition: all 0.12s ease;
  user-select: none;
  white-space: nowrap;
  box-shadow: 0 1.5px 3px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.btn-clear:hover {
  background: rgba(244, 63, 94, 0.18);
  border-color: rgba(244, 63, 94, 0.45);
  border-top-color: rgba(244, 63, 94, 0.6);
  border-bottom-color: rgba(159, 18, 57, 0.6);
  color: var(--mb-accent-danger);
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 0 14px rgba(244, 63, 94, 0.35);
  transform: translateY(-1.5px);
}

.btn-clear:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7);
}

.btn-metronome.btn-transport-icon-only,
.btn-clear.btn-transport-icon-only {
  width: 32px;
  height: 32px;
  min-width: 32px;
  max-width: 32px;
  padding: 0 !important;
}

/* 4. Mode Configuration Dropdown Trigger & Popover */
.transport-more-wrap {
  position: relative;
  flex-shrink: 0;
}

.btn-mode-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 7px 14px;
  height: 38px;
  border-radius: var(--mb-radius-full);
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-subtle);
  color: var(--mb-text-secondary);
  font-family: var(--mb-font-ui);
  font-size: var(--mb-text-sm);
  font-weight: var(--mb-weight-semibold);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.btn-mode-trigger:hover {
  background: var(--mb-bg-surface-3);
  border-color: var(--mb-border-medium);
  color: var(--mb-text-primary);
  transform: translateY(-1px);
}

.btn-mode-trigger:active {
  transform: scale(0.97) translateY(1px);
}

.btn-mode-trigger.active {
  background: var(--mb-bg-surface-3);
  border-color: var(--mb-accent-primary);
  color: #ffffff;
  box-shadow: 0 0 12px var(--mb-accent-primary-glow);
}

.more-arrow {
  font-size: 10px;
  color: var(--mb-text-muted);
}

/* Focused Compact Mode Flyout Popover / Bottom Sheet Drawer */
.transport-mode-popover,
.transport-more-popover {
  position: absolute;
  bottom: calc(100% + 12px);
  right: 0;
  width: 270px;
  min-width: 240px;
  max-width: calc(100vw - 32px);
  background: var(--mb-bg-surface-1);
  border: 1px solid var(--mb-border-medium);
  border-radius: var(--mb-radius-lg);
  box-shadow: 0 20px 48px rgba(0, 0, 0, 0.92), 0 0 20px var(--mb-accent-primary-glow);
  padding: 12px 14px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: popover-fade 0.15s ease-out;
}

.bottom-sheet-handle {
  display: none;
  width: 36px;
  height: 4px;
  border-radius: 2px;
  background: var(--mb-border-medium);
  margin: 0 auto 4px auto;
}

.popover-secondary-tools {
  display: none;
  flex-direction: column;
  gap: 6px;
}

.popover-tools-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.popover-tool-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-subtle);
  color: var(--mb-text-secondary);
  padding: 8px 6px;
  border-radius: var(--mb-radius-md);
  font-family: var(--mb-font-ui);
  font-size: var(--mb-text-xs);
  font-weight: var(--mb-weight-semibold);
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
  white-space: nowrap;
}

.popover-tool-btn:hover {
  background: var(--mb-bg-surface-3);
  color: var(--mb-text-primary);
  border-color: var(--mb-border-medium);
}

.popover-tool-btn:active {
  transform: scale(0.97);
}

.popover-tool-btn.active {
  background: rgba(245, 158, 11, 0.18);
  color: var(--mb-accent-tempo);
  border-color: rgba(245, 158, 11, 0.45);
  box-shadow: 0 0 10px var(--mb-accent-tempo-glow);
}

.popover-tool-btn.btn-danger-tool:hover {
  background: rgba(244, 63, 94, 0.18);
  color: var(--mb-accent-danger);
  border-color: rgba(244, 63, 94, 0.45);
}

.mode-popover-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mode-popover-label {
  font-family: var(--mb-font-ui);
  font-size: 10px;
  font-weight: 700;
  color: var(--mb-text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.mode-segmented-control {
  display: flex;
  gap: 2px;
  background: var(--mb-bg-surface-2);
  padding: 3px;
  border-radius: var(--mb-radius-full);
  border: 1px solid var(--mb-border-subtle);
}

.history-actions-group {
  display: flex;
  gap: 2px;
  background: var(--mb-bg-surface-2);
  padding: 2px;
  border-radius: var(--mb-radius-sm);
  border: 1px solid var(--mb-border-subtle);
  height: 32px;
  box-sizing: border-box;
}

.toolbar-history-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: none;
  background: transparent;
  color: var(--mb-text-secondary);
  font-family: var(--mb-font-ui);
  font-size: 12px;
  font-weight: 500;
  padding: 0 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  white-space: nowrap;
  user-select: none;
}

.toolbar-history-btn:hover:not(:disabled) {
  color: var(--mb-text-primary);
  background: rgba(255, 255, 255, 0.08);
}

.toolbar-history-btn:active:not(:disabled) {
  background: rgba(255, 255, 255, 0.12);
  transform: translateY(1px);
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.6);
}

.toolbar-history-btn:disabled {
  opacity: 0.38 !important;
  cursor: not-allowed !important;
}

.toolbar-history-btn:disabled:hover {
  background: transparent !important;
  color: var(--mb-text-dim) !important;
  cursor: not-allowed !important;
  transform: none !important;
}

.mode-segment-btn,
.mode-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--mb-text-secondary);
  font-family: var(--mb-font-ui);
  font-size: 12px;
  font-weight: 600;
  padding: 5px 8px;
  border-radius: var(--mb-radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  white-space: nowrap;
  user-select: none;
}

.mode-segment-btn:hover:not(.active),
.mode-btn:hover:not(.active) {
  color: var(--mb-text-primary);
  background: rgba(255, 255, 255, 0.06);
}

.mode-segment-btn.active,
.mode-btn.active {
  background: linear-gradient(135deg, var(--mb-accent-primary) 0%, #7c3aed 100%);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 8px var(--mb-accent-primary-glow);
}

.mode-popover-divider {
  width: 100%;
  height: 1px;
  background: var(--mb-border-subtle);
  margin: 1px 0;
}

/* Responsive Collapse Rules */
@media (max-width: 1023px) {
  .transport-desktop-tools {
    display: none !important;
  }
  .mode-trigger-label-desktop {
    display: none;
  }
  .mode-trigger-label-mobile {
    display: inline;
  }
  .popover-secondary-tools,
  .popover-tools-divider,
  .popover-volume-group {
    display: flex;
  }
}

@media (min-width: 1024px) {
  .mode-trigger-label-desktop {
    display: inline;
  }
  .mode-trigger-label-mobile {
    display: none;
  }
  .popover-secondary-tools,
  .popover-tools-divider,
  .popover-volume-group {
    display: none;
  }
}

/* Nav Status Badge */
.status-indicator-badge {
  font-family: var(--mb-font-mono);
  font-size: var(--mb-text-xs);
  font-weight: var(--mb-weight-semibold);
  font-variant-numeric: tabular-nums;
  padding: 5px 12px;
  border-radius: var(--mb-radius-full);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--mb-border-subtle);
  color: var(--mb-text-secondary);
}

.status-indicator-badge.playing {
  background: rgba(16, 185, 129, 0.15);
  border-color: rgba(16, 185, 129, 0.4);
  color: #34d399;
}

/* ==========================================================================
   3. BENTO GRID WORKSPACE LAYOUT (GAPLESS INTERLOCKING)
   ========================================================================== */
.bento-workspace-grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  grid-template-rows: minmax(0, 1fr) auto;
  grid-auto-flow: dense;
  gap: var(--mb-space-sm);
  width: 100%;
  position: relative;
  overflow: hidden;
  padding-bottom: calc(var(--mb-dock-height, 60px) + 24px);
}

.bento-card {
  background: var(--mb-bg-surface-1);
  border-radius: var(--mb-radius-xl);
  border: 1px solid var(--mb-border-subtle);
  box-shadow: var(--mb-shadow-card);
  padding: var(--mb-space-md);
  display: flex;
  flex-direction: column;
  gap: var(--mb-space-sm);
  position: relative;
  overflow: hidden;
  transition: border-color 0.25s ease, box-shadow 0.25s ease;
}

.bento-card:hover {
  border-color: var(--mb-border-medium);
}

.bento-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--mb-space-md);
  flex-wrap: wrap;
}

.header-title-wrap {
  display: flex;
  align-items: center;
  gap: var(--mb-space-md);
}

.stage-title-group {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.stage-role-subtitle {
  font-family: var(--mb-font-ui);
  font-size: var(--mb-text-xs);
  font-weight: var(--mb-weight-medium);
  color: var(--mb-text-muted);
}

.stage-focus-tag {
  font-family: var(--mb-font-mono);
  font-size: 9px;
  font-weight: var(--mb-weight-extrabold);
  letter-spacing: 0.08em;
  background: linear-gradient(135deg, var(--mb-accent-primary) 0%, var(--mb-accent-music) 100%);
  color: #ffffff;
  padding: 3px 8px;
  border-radius: var(--mb-radius-full);
  box-shadow: 0 0 10px var(--mb-accent-primary-glow);
  user-select: none;
}

.section-indicator-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--mb-text-dim);
  opacity: 0.6;
}

.section-indicator-dot.dot-cyan,
.section-indicator-dot.dot-coral,
.section-indicator-dot.dot-amber {
  background: var(--mb-text-dim);
  box-shadow: none;
  opacity: 0.6;
}

.bento-card-header h2 {
  font-size: var(--mb-text-base);
  font-weight: var(--mb-weight-semibold);
  color: var(--mb-text-primary);
  letter-spacing: -0.01em;
  margin: 0;
  line-height: 1.2;
}

.stage-info-pill, .helper-text-pill {
  font-family: var(--mb-font-ui);
  font-size: var(--mb-text-xs);
  font-weight: var(--mb-weight-semibold);
  color: var(--mb-text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  border-radius: var(--mb-radius-full);
  border: 1px solid var(--mb-border-subtle);
}

/* Bento Sizing Grid Rules */
/* 1. Main Stage Centerpiece (Left Column - Top) */
.bento-stage-card {
  grid-column: 1;
  grid-row: 1;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--mb-space-2xs);
  padding: 8px 20px 10px;
  border: 1px solid rgba(139, 92, 246, 0.35);
  box-shadow: 0 12px 32px -4px rgba(0, 0, 0, 0.65), 0 0 0 1px rgba(139, 92, 246, 0.3);
  position: relative;
  overflow: visible;
}

/* 2. Piano Roll Editor (Left Column - Bottom Collapsible Drawer) */
.bento-editor-card {
  grid-column: 1;
  grid-row: 2;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--mb-space-xs);
  padding: var(--mb-space-sm) var(--mb-space-md);
  border: 1px solid rgba(244, 63, 94, 0.35);
  border-radius: var(--mb-radius-xl);
  background: var(--mb-bg-surface-1);
  box-shadow: 0 8px 28px -4px rgba(0, 0, 0, 0.65), 0 0 16px rgba(244, 63, 94, 0.12);
  position: relative;
  overflow: hidden;
  transition: height 0.22s cubic-bezier(0.16, 1, 0.3, 1), padding 0.22s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  z-index: 10;
}

.bento-editor-card:not(.panel-collapsed) {
  height: 230px;
  min-height: 200px;
  max-height: 260px;
}

@media (min-width: 769px) and (max-height: 820px) {
  .bento-editor-card:not(.panel-collapsed) {
    height: 180px;
    min-height: 160px;
    max-height: 200px;
  }
}

.bento-editor-card .panel-collapsible-header {
  cursor: pointer;
  user-select: none;
  padding: 4px 6px;
  border-radius: var(--mb-radius-md);
  transition: background 0.15s ease;
}

.bento-editor-card .panel-collapsible-header:hover {
  background: rgba(244, 63, 94, 0.08);
}

.bento-editor-card:not(.panel-collapsed) .piano-collapsed-pill {
  display: none !important;
}

.bento-editor-card.panel-collapsed {
  height: 42px !important;
  min-height: 42px !important;
  max-height: 42px !important;
  padding: 0 var(--mb-space-md) !important;
  cursor: pointer;
  border-color: rgba(244, 63, 94, 0.35);
  background: rgba(18, 24, 38, 0.95);
}

.bento-editor-card.panel-collapsed:hover {
  border-color: var(--mb-accent-danger);
  box-shadow: 0 0 16px var(--mb-accent-danger-glow);
}

.bento-editor-card.panel-collapsed .panel-collapsible-header {
  height: 100%;
  padding: 0;
  margin: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.bento-editor-card.panel-collapsed .stage-role-subtitle,
.bento-editor-card.panel-collapsed .editor-container,
.bento-editor-card.panel-collapsed .helper-text-pill {
  display: none !important;
}

.bento-editor-card.panel-collapsed h2 {
  font-size: var(--mb-text-sm);
  line-height: 1;
}

.btn-piano-toggle {
  width: 26px;
  height: 26px;
  min-width: 26px;
  border-radius: 50%;
  background: rgba(244, 63, 94, 0.16);
  border: 1px solid rgba(244, 63, 94, 0.45);
  color: #ffffff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: var(--mb-font-mono);
  font-size: 15px;
  font-weight: 800;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-piano-toggle:hover {
  background: rgba(244, 63, 94, 0.35);
  border-color: var(--mb-accent-danger);
  box-shadow: 0 0 10px var(--mb-accent-danger-glow);
  transform: scale(1.08);
}

.piano-collapsed-pill {
  font-family: var(--mb-font-ui);
  font-size: 11px;
  font-weight: var(--mb-weight-medium);
  color: var(--mb-text-muted);
  background: var(--mb-bg-surface-2);
  padding: 2px 10px;
  border-radius: var(--mb-radius-full);
  border: 1px solid var(--mb-border-subtle);
  user-select: none;
}

.bento-editor-card .editor-container {
  flex: 1;
  min-height: 0;
  height: 100%;
  width: 100%;
  display: block;
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--mb-bg-chalkboard);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--mb-radius-lg);
  padding: 3px;
  box-shadow: inset 0 2px 10px rgba(0, 0, 0, 0.65);
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 189, 248, 0.4) transparent;
}

.bento-editor-card .editor-container canvas {
  width: 100%;
  height: 768px;
  display: block;
  touch-action: none !important;
  user-select: none;
  -webkit-user-select: none;
}
/* 3. Right Sidebar Column (Palette, Presets & Templates Exclusive Accordion) */
.bento-sidebar-column {
  grid-column: 2;
  grid-row: 1 / span 2;
  height: 100%;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: var(--mb-space-sm);
  overflow: visible;
  padding-top: 4px;
}

.bento-sidebar-column .bento-card {
  transition: height 0.25s cubic-bezier(0.16, 1, 0.3, 1), flex 0.25s cubic-bezier(0.16, 1, 0.3, 1), border-color 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.bento-sidebar-column .bento-card:not(.panel-collapsed) {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.bento-sidebar-column .bento-card.panel-collapsed {
  flex: 0 0 38px !important;
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  padding: 0 14px !important;
  border-radius: var(--mb-radius-full) !important;
  overflow: hidden !important;
  background: var(--mb-bg-surface-2) !important;
  border: 1px solid var(--mb-border-highlight) !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.65), 0 0 12px rgba(139, 92, 246, 0.25) !important;
  cursor: pointer;
  z-index: 5;
}

.bento-sidebar-column .bento-card.panel-collapsed > *:not(.panel-collapsible-header) {
  display: none !important;
}

.bento-sidebar-column .bento-card.panel-collapsed:hover {
  border-color: var(--mb-accent-primary) !important;
  box-shadow: 0 0 18px var(--mb-accent-primary-glow), 0 6px 20px rgba(0, 0, 0, 0.7) !important;
  transform: translateY(-2px);
  background: var(--mb-bg-surface-3) !important;
}

.bento-sidebar-column .bento-card.panel-collapsed .panel-collapsible-header h2 {
  font-size: var(--mb-text-sm);
  color: var(--mb-text-primary);
  font-weight: 600;
}

.bento-sidebar-column .bento-card.panel-collapsed .panel-scrollable-content,
.bento-sidebar-column .bento-card.panel-collapsed .palette-sections-scroller,
.bento-sidebar-column .bento-card.panel-collapsed .palette-insert-panel {
  display: none !important;
}

.bento-sidebar-column .bento-card.panel-collapsed .panel-collapsible-header {
  padding: 0;
  margin: 0;
  height: 100%;
}

.bento-sidebar-column .bento-card.panel-collapsed .helper-text-pill {
  display: none !important;
}

.bento-palette-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: var(--mb-space-sm) var(--mb-space-md);
  overflow: hidden;
}

.palette-sections-scroller {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.palette-sections-scroller::-webkit-scrollbar {
  width: 4px;
}

.palette-sections-scroller::-webkit-scrollbar-track {
  background: transparent;
}

.palette-sections-scroller::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* Library Card Segmented Tabs */
.library-segmented-tabs {
  display: flex;
  background: var(--mb-bg-surface-2);
  border-bottom: 1px solid var(--mb-border-subtle);
  padding: 4px;
  gap: 4px;
}

.library-tab-btn {
  flex: 1;
  border: none;
  background: transparent;
  color: var(--mb-text-secondary);
  font-family: var(--mb-font-ui);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
}

.library-tab-btn:hover:not(.active) {
  background: rgba(255, 255, 255, 0.06);
  color: var(--mb-text-primary);
}

.library-tab-btn.active {
  background: linear-gradient(135deg, var(--mb-accent-primary) 0%, #7c3aed 100%);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 8px var(--mb-accent-primary-glow);
}

#composer-section.bento-card:not(.panel-collapsed) {
  display: flex;
  flex-direction: column;
}

#composer-section.bento-card:not(.panel-collapsed) #templates-section {
  display: flex !important;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

#composer-section.bento-card:not(.panel-collapsed) .library-tab-panel {
  flex: 1;
  min-height: 0;
  display: flex !important;
  flex-direction: column;
  overflow: hidden;
}

#composer-section.bento-card:not(.panel-collapsed) .library-tab-panel[style*="display: none"] {
  display: none !important;
}

#composer-section.bento-card:not(.panel-collapsed) .shape-template-grid,
#composer-section.bento-card:not(.panel-collapsed) #shape-list,
#composer-section.bento-card:not(.panel-collapsed) .composer-body-split {
  flex: 1;
  min-height: 0;
  overflow-y: auto !important;
  -webkit-overflow-scrolling: touch;
}

/* Composer & Templates Card Internal Scroll Areas */
.bento-composer-card .composer-body-split {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding-right: 4px;
  display: flex;
  flex-direction: column;
  gap: var(--mb-space-md);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.bento-templates-card .shape-template-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 4px 4px 16px 2px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

/* Collapsible Header and Toggle Buttons */
.panel-collapsible-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--mb-space-sm);
  width: 100%;
  cursor: pointer;
  user-select: none;
}

.panel-header-actions {
  display: flex;
  align-items: center;
  gap: var(--mb-space-xs);
}

.panel-toggle-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: var(--mb-radius-xs);
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--mb-border-subtle);
  color: var(--mb-text-secondary);
  font-family: var(--mb-font-mono);
  font-size: 14px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  transition: all 0.15s ease;
}

.panel-toggle-btn:hover {
  background: rgba(255, 255, 255, 0.12);
  color: var(--mb-text-primary);
  border-color: var(--mb-border-medium);
  box-shadow: none;
}

.panel-scrollable-content {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.panel-scrollable-content::-webkit-scrollbar {
  width: 4px;
}
.panel-scrollable-content::-webkit-scrollbar-track {
  background: transparent;
}
.panel-scrollable-content::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

/* Floating / Collapsible Bottom Dock (Piano Roll Editor) */
.floating-editor-panel {
  background: var(--mb-bg-glass-strong);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--mb-border-highlight);
  border-radius: var(--mb-radius-lg);
  box-shadow: var(--mb-shadow-popover);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.2s ease, border-color 0.2s ease, height 0.2s ease;
  pointer-events: auto;
}

.floating-editor-panel.panel-collapsed {
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  padding: 0 14px !important;
  border-radius: var(--mb-radius-full) !important;
  overflow: hidden !important;
  background: var(--mb-bg-surface-2) !important;
  border: 1px solid var(--mb-border-highlight) !important;
  box-shadow: 0 4px 18px rgba(0, 0, 0, 0.65), 0 0 12px rgba(139, 92, 246, 0.25) !important;
  cursor: pointer;
  z-index: 50;
}

.bento-editor-card.panel-collapsed {
  height: 38px !important;
  min-height: 38px !important;
  max-height: 38px !important;
  padding: 0 14px !important;
  border-radius: var(--mb-radius-full) !important;
  overflow: hidden !important;
}

/* Desktop Floating Placement / Card Rules */
@media (min-width: 769px) {
  .bento-editor-card {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    z-index: 10;
  }
  .bento-composer-card.floating-editor-panel,
  .bento-templates-card.floating-editor-panel {
    position: relative !important;
    bottom: 84px;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    max-width: 100% !important;
  }
}

/* Mobile Workspace Segmented Tabs (Desktop hidden) */
.mobile-workspace-tabs {
  display: none;
}

/* ==========================================================================
   4. STAGE CANVAS & PLAYFIELD AREA
   ========================================================================== */
.stage-viewport-frame {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 0;
  display: flex;
  flex: 1 1 auto;
  overflow: hidden;
  border-radius: var(--mb-radius-lg);
}

.stage-canvas-outer {
  position: relative;
  width: 100%;
  background: var(--mb-bg-chalkboard);
  border-radius: var(--mb-radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.08);
  overflow: visible;
  box-shadow:
    inset 0 4px 18px rgba(0, 0, 0, 0.92),
    inset 0 1px 3px rgba(0, 0, 0, 0.95),
    inset 0 -1px 0 rgba(255, 255, 255, 0.04),
    0 4px 16px rgba(0, 0, 0, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;
}

.stage-canvas-outer.chalkboard-container {
  display: flex;
  flex-direction: column;
  justify-content: safe center;
  align-items: center;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  height: 100%;
  width: 100%;
  position: relative;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}

.stage-canvas-outer.chalkboard-container canvas {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  margin: auto 0;
  border-radius: var(--mb-radius-lg);
  cursor: crosshair;
  object-fit: contain;
}

.stage-canvas-outer:not(.chalkboard-container) canvas {
  display: block;
  width: 100%;
  height: auto;
  max-width: 100%;
  border-radius: var(--mb-radius-lg);
  cursor: crosshair;
}

.stage-canvas-outer.linear-container {
  display: flex;
  flex-direction: row;
  justify-content: flex-start;
  align-items: center;
  flex: 1 1 auto;
  min-height: 0;
  max-height: none;
  height: 100%;
  width: 100%;
  position: relative;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 245, 212, 0.28) transparent;
  container-type: inline-size;
}

.stage-canvas-outer.linear-container canvas {
  display: block;
  width: auto;
  height: 100%;
  max-height: min(100%, calc(100cqw * (420 / 980)));
  max-width: none;
  border-radius: var(--mb-radius-lg);
  cursor: crosshair;
  flex-shrink: 0;
}

/* ==========================================================================
   4B. PRESET PREVIEW PLAYGROUND BAR
   ========================================================================== */
.preset-preview-bar {
  position: absolute;
  top: 12px;
  left: 14px;
  right: 14px;
  z-index: 40;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 14px;
  background: var(--mb-bg-glass-strong);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(99, 102, 241, 0.45);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.45), 0 0 16px rgba(99, 102, 241, 0.25);
  border-radius: var(--mb-radius-md, 10px);
  animation: fadeIn 0.2s ease-out;
}

.preset-preview-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.preset-preview-tag {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(99, 102, 241, 0.25);
  color: #c7d2fe;
  border: 1px solid rgba(99, 102, 241, 0.4);
  white-space: nowrap;
}

.preset-preview-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.preset-preview-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-preset-preview {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  border: 1px solid transparent;
  line-height: 1.2;
}

.btn-preset-preview-play {
  background: #10b981;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(16, 185, 129, 0.35);
}

.btn-preset-preview-play:hover {
  background: #059669;
}

.btn-preset-preview-use {
  background: #6366f1;
  color: #ffffff;
  box-shadow: 0 2px 8px rgba(99, 102, 241, 0.35);
}

.btn-preset-preview-use:hover {
  background: #4f46e5;
}

.btn-preset-preview-close {
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

.btn-preset-preview-close:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

/* ==========================================================================
   5. CONTEXTUAL POPOVER NOTE EDITOR
   ========================================================================== */
.stage-note-popover {
  position: absolute;
  z-index: 100;
  background: var(--mb-bg-glass-strong, rgba(22, 28, 43, 0.95));
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: var(--mb-radius-md, 12px);
  box-shadow: 0 16px 36px -4px rgba(0, 0, 0, 0.75), 0 0 20px rgba(139, 92, 246, 0.16), 0 0 0 1px rgba(255, 255, 255, 0.06);
  padding: 12px 14px;
  width: 240px;
  max-width: calc(100% - 24px);
  max-height: calc(100% - 16px);
  overflow-y: auto;
  overflow-x: hidden;
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: rgba(139, 92, 246, 0.4) transparent;
  font-family: var(--mb-font-ui);
  animation: popover-fade 0.12s ease-out;
  pointer-events: auto;
  box-sizing: border-box;
}

@keyframes popover-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.stage-popover-drag-handle {
  display: none;
}

.stage-popover-backdrop {
  display: none;
}

.editor-header-action-btn {
  display: none;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 700;
  color: #ffffff;
  background: var(--mb-accent-primary, #d98b6e);
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  box-shadow: 0 0 8px var(--mb-accent-primary-glow, rgba(217, 139, 110, 0.3));
  transition: all 0.15s ease;
}

.editor-header-action-btn:hover {
  background: var(--mb-accent-primary, #d98b6e);
  filter: brightness(1.15);
  box-shadow: 0 0 12px var(--mb-accent-primary-glow, rgba(217, 139, 110, 0.5));
}

.editor-header-action-btn:active {
  transform: scale(0.96);
}

@keyframes sheet-slide-up {
  from {
    transform: translateY(100%);
    opacity: 0.5;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.stage-popover-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
  border-bottom: 1px solid var(--mb-border-subtle, rgba(255, 255, 255, 0.08));
  padding-bottom: 8px;
}

.stage-popover-title {
  font-size: var(--mb-text-sm, 13px);
  font-weight: var(--mb-weight-bold, 700);
  color: var(--mb-accent-music, #06b6d4);
  font-family: var(--mb-font-ui);
  letter-spacing: -0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.stage-popover-close-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--mb-radius-xs, 4px);
  color: var(--mb-text-muted, #64748b);
  cursor: pointer;
  line-height: 1;
  transition: all 0.15s ease;
  flex-shrink: 0;
}

.stage-popover-close-btn:hover {
  color: var(--mb-text-primary, #f8fafc);
  background: rgba(255, 255, 255, 0.08);
  border-color: var(--mb-border-subtle, rgba(255, 255, 255, 0.1));
}

.stage-popover-close-btn:active {
  transform: scale(0.92);
}

.stage-popover-close-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--mb-accent-primary, #d98b6e);
}

.stage-popover-body {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.stage-popover-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.stage-popover-label {
  font-size: 10.5px;
  font-weight: var(--mb-weight-semibold, 600);
  color: var(--mb-text-muted, #94a3b8);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.2;
  margin: 0;
}

.stage-popover-select {
  background: var(--mb-bg-surface-1, #0f131d);
  border: 1px solid var(--mb-border-subtle, rgba(255, 255, 255, 0.1));
  color: var(--mb-text-primary, #f8fafc);
  border-radius: var(--mb-radius-xs, 6px);
  padding: 6px 10px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--mb-font-ui);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  width: 100%;
  box-sizing: border-box;
}

.stage-popover-select:hover {
  border-color: var(--mb-border-medium, rgba(255, 255, 255, 0.2));
}

.stage-popover-select:focus,
.stage-popover-select:focus-visible {
  border-color: var(--mb-accent-music, #06b6d4);
  box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.25);
}

.stage-popover-piano-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 6px 10px;
  background: rgba(6, 182, 212, 0.08);
  border: 1px solid rgba(6, 182, 212, 0.25);
  border-radius: var(--mb-radius-xs, 6px);
  color: #67e8f9;
  font-family: var(--mb-font-ui);
  font-size: 11.5px;
  font-weight: var(--mb-weight-semibold, 600);
  cursor: pointer;
  transition: all 0.15s ease;
  margin-top: 4px;
  box-sizing: border-box;
}

.stage-popover-piano-btn:hover {
  background: rgba(6, 182, 212, 0.2);
  border-color: var(--mb-accent-music, #06b6d4);
  box-shadow: 0 0 10px var(--mb-accent-music-glow, rgba(6, 182, 212, 0.2));
  color: #ffffff;
}

.stage-popover-piano-btn:active {
  transform: scale(0.98);
}

.stage-popover-piano-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--mb-accent-music);
}

.stage-popover-acc-group {
  display: flex;
  gap: 4px;
  background: rgba(0, 0, 0, 0.25);
  padding: 3px;
  border-radius: var(--mb-radius-xs, 6px);
  border: 1px solid var(--mb-border-subtle, rgba(255, 255, 255, 0.08));
}

.stage-popover-acc-btn {
  flex: 1;
  height: 28px;
  background: transparent;
  border: 1px solid transparent;
  color: var(--mb-text-secondary, #cbd5e1);
  border-radius: 4px;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--mb-font-ui);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  user-select: none;
}

.stage-popover-acc-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--mb-text-primary, #f8fafc);
}

.stage-popover-acc-btn:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7);
}

.stage-popover-acc-btn:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--mb-accent-primary, #d98b6e);
}

.stage-popover-acc-btn.active {
  background: var(--mb-accent-primary, #d98b6e);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.2);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6), 0 0 10px var(--mb-accent-primary-glow, rgba(217, 139, 110, 0.3));
  font-weight: 700;
  transform: translateY(1px);
}

#stage-popover-repeat-group .stage-popover-acc-btn {
  font-family: var(--mb-font-mono, monospace);
  font-size: 11.5px;
}

#stage-popover-repeat-group .stage-popover-acc-btn.active {
  background: var(--mb-accent-tempo, #f59e0b);
  color: #0f172a;
  border-color: rgba(245, 158, 11, 0.8);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6), 0 0 10px var(--mb-accent-tempo-glow, rgba(245, 158, 11, 0.3));
  font-weight: 700;
  transform: translateY(1px);
}

#stage-popover-dur-group {
  display: grid !important;
  grid-template-columns: repeat(3, 1fr) !important;
  gap: 4px !important;
  background: rgba(0, 0, 0, 0.25);
  padding: 3px;
  border-radius: var(--mb-radius-xs, 6px);
  border: 1px solid var(--mb-border-subtle, rgba(255, 255, 255, 0.08));
}

#stage-popover-dur-group .stage-popover-acc-btn {
  flex: unset !important;
  height: 28px;
  padding: 0 4px !important;
  font-size: 11px !important;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 3px;
  white-space: nowrap !important;
}

#stage-popover-dur-group .stage-popover-acc-btn.active {
  background: var(--mb-accent-music, #06b6d4);
  color: #08121f;
  border-color: rgba(6, 182, 212, 0.8);
  box-shadow: 0 0 10px var(--mb-accent-music-glow, rgba(6, 182, 212, 0.35));
  font-weight: 700;
}

.stage-popover-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid var(--mb-border-subtle, rgba(255, 255, 255, 0.08));
}

.stage-popover-btn-secondary {
  flex: 1;
  height: 32px;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: #c4b5fd;
  border-radius: var(--mb-radius-xs, 6px);
  padding: 0 8px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--mb-font-ui);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-sizing: border-box;
}

.stage-popover-btn-secondary:hover {
  background: var(--mb-accent-primary-glow, rgba(217, 139, 110, 0.25));
  border-color: var(--mb-accent-primary, #d98b6e);
  color: #ffffff;
  box-shadow: 0 0 10px var(--mb-accent-primary-glow, rgba(217, 139, 110, 0.25));
}

.stage-popover-btn-secondary:active {
  transform: scale(0.97);
}

.stage-popover-btn-secondary:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--mb-accent-primary);
}

.stage-popover-btn-danger {
  flex: 1;
  height: 32px;
  background: rgba(244, 63, 94, 0.12);
  border: 1px solid rgba(244, 63, 94, 0.35);
  color: #fda4af;
  border-radius: var(--mb-radius-xs, 6px);
  padding: 0 8px;
  font-size: 11.5px;
  font-weight: 600;
  font-family: var(--mb-font-ui);
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  box-sizing: border-box;
}

.stage-popover-btn-danger:hover {
  background: rgba(244, 63, 94, 0.25);
  border-color: var(--mb-accent-danger, #f43f5e);
  color: #ffffff;
  box-shadow: 0 0 10px var(--mb-accent-danger-glow, rgba(244, 63, 94, 0.25));
}

.stage-popover-btn-danger:active {
  transform: scale(0.97);
}

.stage-popover-btn-danger:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--mb-accent-danger);
}

.stage-note-popover button:disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
}

.stage-note-popover button:disabled:hover {
  cursor: not-allowed !important;
  transform: none !important;
  box-shadow: none !important;
}

.palette-subgroup-title {
  font-size: 10px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  margin-top: 8px;
  margin-bottom: 4px;
}

.seq-chip-rep {
  font-size: 9px;
  font-weight: 800;
  color: var(--accent-amber);
  background: rgba(245, 158, 11, 0.18);
  border: 1px solid rgba(245, 158, 11, 0.4);
  padding: 1px 5px;
  border-radius: 4px;
}

/* ==========================================================================
   6. FUNCTIONAL NOTATION PALETTE (RHYTHMIC BALL / RB STYLE)
   ========================================================================== */
.palette-sections-scroller {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
  padding-right: 4px;
}

.palette-sections-scroller::-webkit-scrollbar {
  width: 4px;
}

.palette-sections-scroller::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 4px;
}

.palette-block {
  display: flex;
  flex-direction: column;
  gap: 8px;
  border-bottom: 1px solid var(--mb-border-subtle);
  padding-bottom: 10px;
  margin-bottom: 4px;
}

.palette-block:last-child {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

.collapsible-section {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  transition: none;
}

.collapsible-section.open {
  border: none;
  box-shadow: none;
}

.palette-collapse-toggle,
.palette-static-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: transparent;
  border: none;
  min-height: 28px;
  padding: 4px 6px;
  border-radius: var(--mb-radius-xs);
  cursor: pointer;
  color: var(--text-primary);
  user-select: none;
  outline: none;
  transition: background-color 0.15s ease;
}

.palette-static-header {
  cursor: default;
}

.palette-collapse-toggle:hover {
  background: rgba(255, 255, 255, 0.04);
}

.palette-collapse-toggle:hover .palette-subheading {
  color: var(--mb-text-primary);
}

.collapse-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
}

.collapse-chevron {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--mb-text-muted);
  transition: transform 0.2s ease;
  transform: rotate(0deg);
  flex-shrink: 0;
}

.collapsible-section.open .collapse-chevron {
  transform: rotate(90deg);
}

.active-modifier-badge {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  color: var(--mb-accent-primary);
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.35);
  padding: 2px 7px;
  border-radius: var(--radius-full);
}

.palette-collapse-content {
  margin-top: 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.palette-block-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.palette-inline-hint {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
}

.palette-subheading {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  transition: color 0.15s ease;
}
.action-tag-btn {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.35);
  padding: 3px 8px;
  border-radius: var(--radius-full);
  cursor: pointer;
  transition: all 0.15s ease;
}

.action-tag-btn:hover {
  background: var(--accent-cyan);
  color: #ffffff;
}

.palette-button-matrix {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.rb-durations-row,
.gp8-durations-row {
  grid-template-columns: repeat(4, 1fr);
}

.rb-compound-row,
.gp8-compound-row {
  grid-template-columns: repeat(2, 1fr);
}

.rb-btn,
.gp8-btn {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.005) 100%), #1c222b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-top-color: rgba(255, 255, 255, 0.12);
  border-bottom-color: rgba(0, 0, 0, 0.45);
  color: var(--mb-text-secondary);
  border-radius: var(--radius-sm);
  padding: 8px 4px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 38px;
  transition: all 0.12s ease;
  user-select: none;
  box-shadow: 0 1.5px 3px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
}

.rb-dur-btn,
.gp8-dur-btn,
#rb-btn-rest,
#gp8-btn-rest {
  font-size: 15px;
  line-height: 1;
}

.rb-dur-btn svg,
.gp8-dur-btn svg,
#rb-btn-rest svg,
#gp8-btn-rest svg {
  width: auto;
  height: 18px;
  max-width: 18px;
  max-height: 18px;
  display: block;
  margin: auto;
  flex-shrink: 0;
}

.rb-compound-btn,
.gp8-compound-btn {
  font-size: 16px;
  line-height: 1;
}

.rb-acc-btn,
.gp8-acc-btn,
#rb-btn-fermata,
#gp8-btn-fermata {
  font-size: 16px;
  line-height: 1;
}
#rb-btn-ntuplet,
#gp8-btn-ntuplet {
  font-size: 13px;
  letter-spacing: -0.2px;
}

.rb-btn.is-pro-locked,
.gp8-btn.is-pro-locked,
.stage-popover-acc-btn.is-pro-locked {
  position: relative;
  opacity: 0.75;
}

.rb-btn.is-pro-locked::after,
.gp8-btn.is-pro-locked::after,
.stage-popover-acc-btn.is-pro-locked::after {
  content: 'PRO';
  position: absolute;
  top: -4px;
  right: -4px;
  font-size: 7.5px;
  font-weight: 800;
  line-height: 1;
  padding: 1.5px 3px;
  border-radius: 3px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: #000000;
  letter-spacing: 0.2px;
  pointer-events: none;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}

.rb-btn:hover,
.gp8-btn:hover {
  transform: translateY(-1.5px);
  border-color: rgba(255, 255, 255, 0.18);
  border-top-color: rgba(255, 255, 255, 0.25);
  border-bottom-color: rgba(0, 0, 0, 0.5);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07) 0%, rgba(255, 255, 255, 0.02) 100%), #222832;
  color: #ffffff;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
}

.rb-btn:disabled,
.gp8-btn:disabled,
.rb-btn.disabled,
.gp8-btn.disabled,
.rb-btn[aria-disabled="true"],
.gp8-btn[aria-disabled="true"] {
  opacity: 0.35 !important;
  cursor: not-allowed !important;
  filter: grayscale(1) !important;
  box-shadow: none !important;
  transform: none !important;
}

.rb-btn:disabled:hover,
.gp8-btn:disabled:hover,
.rb-btn.disabled:hover,
.gp8-btn.disabled:hover,
.rb-btn[aria-disabled="true"]:hover,
.gp8-btn[aria-disabled="true"]:hover {
  opacity: 0.35 !important;
  cursor: not-allowed !important;
  filter: grayscale(1) !important;
  box-shadow: none !important;
  transform: none !important;
  border-color: rgba(255, 255, 255, 0.08) !important;
}

#rb-btn-rest.disabled,
#rb-btn-rest[aria-disabled="true"],
#gp8-btn-rest.disabled,
#gp8-btn-rest[aria-disabled="true"] {
  opacity: 0.35 !important;
  cursor: not-allowed !important;
  filter: grayscale(1) !important;
  box-shadow: none !important;
  transform: none !important;
}

#rb-btn-rest.disabled svg,
#rb-btn-rest[aria-disabled="true"] svg,
#gp8-btn-rest.disabled svg,
#gp8-btn-rest[aria-disabled="true"] svg {
  fill: var(--mb-text-muted, #64748b) !important;
  color: var(--mb-text-muted, #64748b) !important;
  opacity: 0.4 !important;
  filter: grayscale(1) !important;
}

#stage-popover-tie-btn.disabled,
#stage-popover-tie-btn[aria-disabled="true"] {
  opacity: 0.35 !important;
  cursor: not-allowed !important;
  filter: grayscale(1) !important;
  box-shadow: none !important;
  transform: none !important;
}

#stage-popover-tie-btn.disabled:hover,
#stage-popover-tie-btn[aria-disabled="true"]:hover {
  opacity: 0.35 !important;
  cursor: not-allowed !important;
  filter: grayscale(1) !important;
  box-shadow: none !important;
  transform: none !important;
}

.rb-btn:active,
.gp8-btn:active {
  transform: translateY(1px);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.75);
}

.rb-btn.active,
.gp8-btn.active,
.rb-dur-btn.active,
.gp8-dur-btn.active,
.rb-rep-btn.active,
.gp8-rep-btn.active,
.rb-acc-btn.active,
.gp8-acc-btn.active,
#rb-btn-rest.active,
#gp8-btn-rest.active,
.rb-compound-btn.active,
.gp8-compound-btn.active,
#rb-btn-dot.active,
#gp8-btn-dot.active,
#rb-btn-double-dot.active,
#gp8-btn-double-dot.active,
#rb-btn-triplet.active,
#gp8-btn-triplet.active,
#rb-btn-ntuplet.active,
#gp8-btn-ntuplet.active,
#rb-btn-fermata.active,
#gp8-btn-fermata.active {
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.22) 0%, rgba(139, 92, 246, 0.12) 100%), #171326;
  border-color: var(--mb-accent-primary);
  border-top-color: rgba(139, 92, 246, 0.7);
  border-bottom-color: rgba(139, 92, 246, 0.3);
  color: #ffffff;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7), inset 0 1px 1.5px rgba(0, 0, 0, 0.5), 0 0 10px rgba(139, 92, 246, 0.28);
  font-weight: 700;
  transform: translateY(1px);
}

.rb-btn.active:hover,
.gp8-btn.active:hover,
.rb-dur-btn.active:hover,
.gp8-dur-btn.active:hover,
.rb-rep-btn.active:hover,
.gp8-rep-btn.active:hover,
.rb-acc-btn.active:hover,
.gp8-acc-btn.active:hover,
#rb-btn-rest.active:hover,
#gp8-btn-rest.active:hover,
.rb-compound-btn.active:hover,
.gp8-compound-btn.active:hover,
#rb-btn-dot.active:hover,
#gp8-btn-dot.active:hover,
#rb-btn-double-dot.active:hover,
#gp8-btn-double-dot.active:hover,
#rb-btn-triplet.active:hover,
#gp8-btn-triplet.active:hover,
#rb-btn-ntuplet.active:hover,
#gp8-btn-ntuplet.active:hover,
#rb-btn-fermata.active:hover,
#gp8-btn-fermata.active:hover {
  transform: translateY(1px);
  background: linear-gradient(180deg, rgba(139, 92, 246, 0.26) 0%, rgba(139, 92, 246, 0.15) 100%), #171326;
  border-color: var(--mb-accent-primary);
  border-top-color: rgba(139, 92, 246, 0.75);
  border-bottom-color: rgba(139, 92, 246, 0.35);
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7), inset 0 1px 1.5px rgba(0, 0, 0, 0.5), 0 0 12px rgba(139, 92, 246, 0.35);
  color: #ffffff;
}

.rb-btn.active svg,
.gp8-btn.active svg,
.rb-dur-btn.active svg,
.gp8-dur-btn.active svg,
#rb-btn-rest.active svg,
#gp8-btn-rest.active svg {
  color: #ffffff;
  filter: drop-shadow(0 0 1px rgba(255, 255, 255, 0.35));
}
.rb-tie-icon {
  width: 18px;
  height: 12px;
  display: block;
  margin: auto;
  flex-shrink: 0;
}
#rb-btn-tie.active .rb-tie-icon,
#stage-popover-tie-btn.active .rb-tie-icon {
  stroke: var(--mb-accent-cyan, #06b6d4);
}
#rb-btn-tie.disabled .rb-tie-icon,
#rb-btn-tie[aria-disabled="true"] .rb-tie-icon,
#gp8-btn-tie.disabled .rb-tie-icon,
#gp8-btn-tie[aria-disabled="true"] .rb-tie-icon,
#stage-popover-tie-btn.disabled .rb-tie-icon,
#stage-popover-tie-btn[aria-disabled="true"] .rb-tie-icon {
  stroke: var(--mb-text-muted, #64748b) !important;
  opacity: 0.4 !important;
  filter: grayscale(1) !important;
}
.custom-chips-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 4px;
}

.custom-compound-empty-state {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  padding: 6px 10px;
  background: var(--mb-bg-surface-2);
  border: 1px dashed rgba(6, 182, 212, 0.22);
  border-radius: 8px;
}

.custom-empty-label {
  font-size: 11px;
  color: #94a3b8;
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
}

.btn-custom-empty-trigger {
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: var(--accent-cyan);
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-custom-empty-trigger:hover {
  background: var(--accent-cyan);
  color: #041322;
  box-shadow: 0 0 10px var(--accent-cyan-glow);
}

.rb-custom-badge-chip,
.gp8-custom-badge-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(6, 182, 212, 0.12);
  border: 1px solid rgba(6, 182, 212, 0.35);
  color: var(--accent-cyan);
  padding: 4px 10px;
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.rb-custom-badge-chip.active,
.gp8-custom-badge-chip.active {
  background: var(--accent-cyan);
  color: #000000;
  box-shadow: 0 2px 10px var(--accent-cyan-glow);
}

.rb-custom-chip-del,
.gp8-custom-chip-del {
  font-size: 14px;
  line-height: 1;
  color: inherit;
  opacity: 0.7;
}

.rb-custom-chip-del:hover,
.gp8-custom-chip-del:hover {
  opacity: 1;
}

/* Palette Quick Insert Panel (Pinned Top Control Strip) */
.palette-insert-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-subtle);
  border-radius: var(--mb-radius-sm);
  padding: var(--mb-space-sm) var(--mb-space-md);
  margin-bottom: 8px;
  flex-shrink: 0;
  box-shadow: none;
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
.insert-select-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.insert-label {
  font-size: var(--mb-text-xs);
  font-weight: var(--mb-weight-semibold);
  color: var(--mb-text-secondary);
}

.insert-pitch-dropdown {
  background: var(--mb-bg-surface-1);
  border: 1px solid var(--mb-border-subtle);
  color: var(--mb-text-primary);
  border-radius: var(--mb-radius-sm);
  padding: 6px 10px;
  font-size: var(--mb-text-base);
  font-weight: var(--mb-weight-semibold);
  outline: none;
  height: 36px;
}

.btn-insert-action {
  background: var(--mb-accent-primary);
  border: 1px solid var(--mb-border-active);
  color: #ffffff;
  padding: 8px 14px;
  border-radius: var(--mb-radius-sm);
  font-family: var(--mb-font-ui);
  font-size: var(--mb-text-base);
  font-weight: var(--mb-weight-bold);
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5), 0 0 12px var(--mb-accent-primary-glow), inset 0 1.5px 0 rgba(255, 255, 255, 0.35), inset 0 -1.5px 0 rgba(0, 0, 0, 0.3);
  height: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
}

html[data-theme="classic"] .btn-insert-action,
html[data-theme="minimal"] .btn-insert-action,
html[data-theme="galaxy"] .btn-insert-action {
  background: var(--mb-accent-primary);
  border-color: var(--mb-border-active);
  color: #ffffff;
}

html[data-theme="cyberpunk"] .btn-insert-action {
  background: linear-gradient(180deg, #26f4ff 0%, #00f0ff 60%, #00c8d6 100%);
  border: 1px solid rgba(0, 240, 255, 0.85);
  color: #080a0f;
  font-weight: 800;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.65), 0 0 16px rgba(0, 240, 255, 0.40), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}

html[data-theme="cyberpunk"] .btn-insert-action:hover {
  background: linear-gradient(180deg, #4df7ff 0%, #1aeaff 60%, #00daf0 100%);
  border-color: #00f0ff;
  color: #040608;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.7), 0 0 22px rgba(0, 240, 255, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

html[data-theme="cyberpunk"] .btn-insert-action:active {
  background: linear-gradient(180deg, #00d2e0 0%, #00b8c4 100%);
  border-color: #00f0ff;
  color: #040608;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.7), 0 0 12px rgba(0, 240, 255, 0.40);
}

html[data-theme="ocean"] .btn-insert-action,
html[data-theme="ocean"] #btn-insert-configured-note {
  background: linear-gradient(180deg, #5eead4 0%, #2dd4bf 60%, #14b8a6 100%);
  border: 1px solid rgba(94, 234, 212, 0.40);
  color: #070e12;
  font-weight: 800;
  box-shadow: 0 2px 10px rgba(45, 212, 191, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.6);
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}

html[data-theme="ocean"] .btn-insert-action:hover,
html[data-theme="ocean"] #btn-insert-configured-note:hover {
  background: linear-gradient(180deg, #99f6e4 0%, #5eead4 60%, #2dd4bf 100%);
  border-color: #2dd4bf;
  color: #04080a;
  box-shadow: 0 4px 16px rgba(45, 212, 191, 0.40), inset 0 1px 0 rgba(255, 255, 255, 0.8);
}

html[data-theme="ocean"] .btn-insert-action:active,
html[data-theme="ocean"] #btn-insert-configured-note:active {
  background: linear-gradient(180deg, #14b8a6 0%, #0d9488 100%);
  border-color: #2dd4bf;
  color: #04080a;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6), 0 0 12px rgba(45, 212, 191, 0.35);
}

html[data-theme="pixel"] .btn-insert-action,
html[data-theme="pixel"] #btn-insert-configured-note {
  background: #fbbf24;
  color: #0a0c16;
  font-weight: 800;
  border: 2px solid #f59e0b;
  border-radius: 2px;
  box-shadow: inset 2px 2px 0px #fef08a, inset -2px -2px 0px #b45309, 0 3px 0px #06070d;
  text-shadow: none;
}

html[data-theme="pixel"] .btn-insert-action:hover,
html[data-theme="pixel"] #btn-insert-configured-note:hover {
  background: #fcd34d;
  border-color: #fbbf24;
  color: #0a0c16;
  box-shadow: inset 2px 2px 0px #ffffff, inset -2px -2px 0px #b45309, 0 3px 0px #06070d;
}

html[data-theme="pixel"] .btn-insert-action:active,
html[data-theme="pixel"] #btn-insert-configured-note:active {
  background: #f59e0b;
  border-color: #d97706;
  color: #0a0c16;
  box-shadow: inset 2px 2px 0px #b45309, inset -2px -2px 0px #fef08a;
  transform: translateY(1px);
}

/* ==========================================================================
   SPOOKY HALLOWEEN — PRIMARY ACTION BUTTON STYLING
   Pumpkin orange radiant gradient with rich warm shadow and dark text
   ========================================================================== */
html[data-theme="halloween"] .btn-insert-action,
html[data-theme="halloween"] #btn-insert-configured-note {
  background: linear-gradient(180deg, #fb923c 0%, #f97316 60%, #ea580c 100%);
  border: 1px solid rgba(251, 146, 60, 0.50);
  color: #0e0805;
  font-weight: 800;
  box-shadow: 0 2px 12px rgba(249, 115, 22, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  text-shadow: none;
}

html[data-theme="halloween"] .btn-insert-action:hover,
html[data-theme="halloween"] #btn-insert-configured-note:hover {
  background: linear-gradient(180deg, #fdba74 0%, #fb923c 60%, #f97316 100%);
  border-color: #fb923c;
  color: #050302;
  box-shadow: 0 4px 16px rgba(249, 115, 22, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

html[data-theme="halloween"] .btn-insert-action:active,
html[data-theme="halloween"] #btn-insert-configured-note:active {
  background: linear-gradient(180deg, #ea580c 0%, #c2410c 100%);
  border-color: #ea580c;
  color: #ffffff;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
  transform: translateY(1px);
}

/* ==========================================================================
   PLAYFUL CAT — PRIMARY ACTION BUTTON STYLING
   Radiant lavender-to-violet gradient with warm ivory text and subtle pink shadow
   ========================================================================== */
html[data-theme="cat"] .btn-insert-action,
html[data-theme="cat"] #btn-insert-configured-note {
  background: linear-gradient(180deg, #c4b5fd 0%, #a78bfa 60%, #8b5cf6 100%);
  border: 1px solid rgba(196, 181, 253, 0.50);
  color: #17111d;
  font-weight: 800;
  box-shadow: 0 2px 12px rgba(167, 139, 250, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.5);
  text-shadow: none;
}

html[data-theme="cat"] .btn-insert-action:hover,
html[data-theme="cat"] #btn-insert-configured-note:hover {
  background: linear-gradient(180deg, #ddd6fe 0%, #c4b5fd 60%, #a78bfa 100%);
  border-color: #c4b5fd;
  color: #0f0b12;
  box-shadow: 0 4px 16px rgba(167, 139, 250, 0.45), 0 0 12px rgba(240, 166, 202, 0.30), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

html[data-theme="cat"] .btn-insert-action:active,
html[data-theme="cat"] #btn-insert-configured-note:active {
  background: linear-gradient(180deg, #8b5cf6 0%, #7c3aed 100%);
  border-color: #7c3aed;
  color: #ffffff;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.6);
  transform: translateY(1px);
}

.btn-insert-action:hover {
  transform: translateY(-1px);
  box-shadow: 0 5px 14px rgba(0, 0, 0, 0.6), 0 0 18px var(--mb-accent-primary-glow), inset 0 1.5px 0 rgba(255, 255, 255, 0.5);
  border-color: #a78bfa;
}

.btn-insert-action:active {
  transform: translateY(1px);
  box-shadow: inset 0 3px 6px rgba(0, 0, 0, 0.7), 0 0 10px var(--mb-accent-primary-glow);
}

/* ==========================================================================
   7. DETAIL PITCH GRID & STEP EDITOR
   ========================================================================== */
.editor-container {
  height: 200px;
  background: var(--mb-bg-chalkboard);
  border: 1px solid var(--mb-border-highlight);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
  border-radius: var(--mb-radius-md);
  overflow-y: auto;
  overflow-x: hidden;
}

/* ==========================================================================
   8. PRESET & TEXT COMPOSER CARD
   ========================================================================== */
.composer-body-split {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.composer-unit {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.composer-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.composer-input-row {
  display: flex;
  gap: 8px;
}

.composer-dropdown, .composer-text-input {
  flex: 1;
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  outline: none;
  transition: border-color 0.15s ease;
}

.composer-dropdown:focus, .composer-text-input:focus {
  border-color: var(--accent-violet);
}

.btn-composer-action {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  padding: 8px 16px;
  border-radius: var(--radius-md);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-composer-action:hover {
  background: var(--accent-violet);
  border-color: var(--accent-violet);
  color: #ffffff;
}

.tool-feedback-tag {
  font-size: 11px;
  color: var(--accent-emerald);
  margin-top: 2px;
}

.btn-composer-delete {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-composer-delete:hover {
  background: rgba(239, 68, 68, 0.25);
  border-color: #ef4444;
  color: #ffffff;
}

.btn-composer-rename {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(139, 92, 246, 0.12);
  border: 1px solid rgba(139, 92, 246, 0.3);
  color: var(--accent-violet);
  padding: 8px 12px;
  border-radius: var(--radius-md);
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-composer-rename:hover {
  background: rgba(139, 92, 246, 0.25);
  border-color: var(--accent-violet);
  color: #ffffff;
}

.preset-save-as-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
}

.btn-composer-save-active {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  color: var(--accent-emerald);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-composer-save-active:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: var(--accent-emerald);
  color: #ffffff;
}
.btn-composer-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px dashed var(--border-subtle);
  color: var(--text-secondary);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-composer-secondary:hover {
  background: rgba(139, 92, 246, 0.12);
  border-color: var(--accent-violet);
  color: var(--text-primary);
}

.btn-composer-export {
  border-style: solid;
  border-color: rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.08);
}

.btn-composer-export:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: #38bdf8;
  color: #ffffff;
}

.save-preset-inline-form {
  display: flex;
  gap: 6px;
  margin-top: 6px;
  align-items: center;
  animation: fadeIn 0.15s ease;
}

.save-preset-inline-form .composer-text-input {
  padding: 6px 10px;
  font-size: 12px;
}

.btn-composer-cancel {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: var(--radius-md);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-composer-cancel:hover {
  background: rgba(239, 68, 68, 0.15);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

/* ==========================================================================
   9. RHYTHM TEMPLATE VAULT GRID
   ========================================================================== */
.shape-template-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.shape-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 10px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
  user-select: none;
}

.shape-card:hover {
  transform: translateY(-3px);
  border-color: var(--accent-violet);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4), 0 0 14px var(--accent-violet-glow);
}

.shape-card:active {
  transform: scale(0.96);
}

.shape-badge-num {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-cyan);
  background: rgba(6, 182, 212, 0.12);
  padding: 2px 8px;
  border-radius: var(--radius-full);
}

.shape-svg-wrapper {
  width: 100%;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 2px 0;
}

.shape-svg-wrapper svg {
  width: 76px;
  height: 50px;
  fill: #f8fafc;
  stroke: #f8fafc;
  display: block;
}

.shape-svg-wrapper svg text {
  fill: #f8fafc;
  stroke: none;
  font-weight: bold;
}

.shape-svg-wrapper svg polyline {
  fill: none;
  stroke: #f8fafc;
  stroke-width: 2;
}

.shape-name {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
}

.shape-duration {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.3;
}

/* ==========================================================================
   10. RICH FLOATING DARK-NEON TOOLTIP
   ========================================================================== */
.rb-floating-tooltip,
.gp8-floating-tooltip {
  position: fixed;
  z-index: 9999;
  background: rgba(14, 18, 30, 0.94);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border: 1px solid rgba(139, 92, 246, 0.45);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  max-width: 270px;
  pointer-events: none;
  opacity: 0;
  transform: scale(0.95) translateY(4px);
  transition: opacity 0.15s ease, transform 0.15s ease;
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.8), 0 0 24px var(--accent-violet-glow);
}

.rb-floating-tooltip.visible,
.gp8-floating-tooltip.visible {
  opacity: 1;
  transform: scale(1) translateY(0);
}

.rb-tooltip-header,
.gp8-tooltip-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 6px;
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 4px;
}

.rb-tooltip-title,
.gp8-tooltip-title {
  font-size: 13px;
  font-weight: 800;
  color: #ffffff;
}

.rb-tooltip-badge,
.gp8-tooltip-badge {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  font-weight: 700;
  background: rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
  padding: 2px 6px;
  border-radius: var(--radius-full);
}

.rb-tooltip-desc,
.gp8-tooltip-desc {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.45;
}

/* ==========================================================================
   11. CUSTOM RHYTHM BUILDER MODAL DIALOG
   ========================================================================== */
.custom-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding-bottom: 14px;
  margin-bottom: 18px;
}

.custom-modal-title {
  display: flex;
  align-items: center;
  gap: 12px;
}

.custom-modal-badge {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  background: linear-gradient(135deg, var(--accent-violet), var(--accent-cyan));
  color: #ffffff;
  padding: 4px 10px;
  border-radius: var(--radius-full);
}

.custom-modal-title h4 {
  font-size: 18px;
  font-weight: 800;
  color: #f8fafc;
  margin: 0;
  font-family: 'Outfit', system-ui, sans-serif;
}

.custom-modal-subtitle {
  font-size: 12px;
  color: #94a3b8;
  margin-top: 2px;
  display: block;
}

.custom-modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.slot-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.slot-meter-badge {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  background: rgba(139, 92, 246, 0.2);
  color: #c4b5fd;
  padding: 3px 8px;
  border-radius: var(--radius-full);
}

.slots-container {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 6px;
}

.slot-card {
  background: var(--bg-surface-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 4px;
  text-align: center;
  cursor: pointer;
  transition: all 0.15s ease;
}

.slot-card.active {
  border-color: var(--accent-violet);
  background: rgba(139, 92, 246, 0.2);
  box-shadow: 0 0 12px var(--accent-violet-glow);
}

.slot-card.disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.slot-num {
  font-size: 9px;
  color: var(--text-muted);
  display: block;
}

.slot-val-display {
  font-size: 12px;
  font-weight: 700;
  color: var(--text-primary);
  margin-top: 2px;
}

.slot-component-palette {
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: var(--bg-surface-elevated);
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
}

.palette-choice-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
}

.palette-btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.palette-choice-btn {
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.palette-choice-btn:hover {
  border-color: var(--accent-violet);
  color: var(--text-primary);
}

.custom-preview-box {
  background: var(--chalkboard-bg);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  padding: 12px;
}

.custom-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

.valid-badge {
  color: var(--accent-emerald);
}

.invalid-badge {
  color: var(--accent-coral);
}

.custom-canvas-wrap {
  display: flex;
  justify-content: center;
}

.custom-meta-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.custom-meta-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
}

.custom-meta-input {
  background: var(--bg-deep);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  outline: none;
}

.custom-meta-input:focus {
  border-color: var(--accent-violet);
}

.custom-modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
  border-top: 1px solid var(--border-subtle);
  padding-top: 14px;
}

.btn-modal-secondary {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 8px 16px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.btn-modal-secondary:hover {
  background: rgba(255, 255, 255, 0.06);
}

.btn-modal-primary {
  background: linear-gradient(135deg, var(--accent-violet) 0%, #7c3aed 100%);
  border: none;
  color: #ffffff;
  padding: 8px 20px;
  border-radius: var(--radius-full);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px var(--accent-violet-glow);
  transition: all 0.2s ease;
}

.btn-modal-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px var(--accent-violet-glow);
}

.btn-modal-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* ==========================================================================
   12. RESPONSIVE BREAKPOINTS
   ========================================================================== */
@media (max-width: 1200px) {
  .bento-workspace-grid {
    grid-template-columns: minmax(0, 1fr) 300px;
  }
}

.btn-auth-authenticated {
  background: var(--mb-bg-surface-2);
  border-color: rgba(6, 182, 212, 0.4);
  color: var(--mb-text-primary);
}

.btn-auth-authenticated:hover {
  background: var(--mb-bg-surface-3);
  border-color: var(--mb-accent-music);
  box-shadow: 0 0 12px var(--mb-accent-music-glow);
}

.btn-auth-pro {
  background: linear-gradient(135deg, rgba(88, 28, 135, 0.45) 0%, rgba(120, 53, 15, 0.35) 100%) !important;
  border: 1px solid rgba(245, 158, 11, 0.6) !important;
  color: #fef08a !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.25);
}

.btn-auth-pro #header-auth-icon {
  color: #fbbf24;
  text-shadow: 0 0 8px rgba(251, 191, 36, 0.8);
}

.btn-auth-pro:hover {
  border-color: #f59e0b !important;
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.5) !important;
  transform: translateY(-1px);
}

#header-auth-label,
#mobile-auth-label {
  display: inline-block;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: middle;
}

@media (max-width: 768px) {
  html {
    height: auto;
    overflow-x: hidden;
    overflow-y: auto;
  }

  body {
    height: auto;
    min-height: 100%;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    display: block;
  }

  .app-shell {
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    max-height: 100vh;
    max-height: 100dvh;
    flex: none;
    width: 100%;
    padding: var(--mb-space-2xs) var(--mb-space-xs);
    padding-bottom: calc(74px + env(safe-area-inset-bottom, 10px));
    gap: 4px;
    overflow: hidden;
    box-sizing: border-box;
  }

  .app-top-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 6px 10px;
    flex-shrink: 0;
    width: 100%;
    flex-wrap: nowrap;
    overflow: visible !important;
    box-sizing: border-box;
    position: relative;
    z-index: 1000;
  }

  .app-top-header::-webkit-scrollbar {
    display: none;
  }

  .site-identity-wrapper {
    display: none;
  }

  .header-left-cluster {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-wrap: nowrap;
    flex-shrink: 0;
  }
  .brand-group {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-wrap: nowrap;
  }

  .brand-badge-pill {
    padding: 3px 8px;
    font-size: 11px;
    gap: 6px;
  }

  .brand-badge-pill .brand-name {
    font-size: 13.5px;
    font-weight: 800;
    letter-spacing: -0.01em;
  }

  .save-status-badge {
    padding: 3px 7px;
    font-size: 10px;
    gap: 4px;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.2;
  }

  .header-mobile-menu-wrap {
    display: flex !important;
    align-items: center;
    gap: 8px;
    margin-left: auto;
  }

  .mobile-header-upgrade-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    height: 30px;
    padding: 0 10px;
    border-radius: var(--mb-radius-full, 9999px);
    font-size: 11.5px;
    font-weight: 700;
    color: #ffffff;
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.3), rgba(139, 92, 246, 0.3));
    border: 1px solid rgba(236, 72, 153, 0.55);
    box-shadow: 0 0 10px rgba(236, 72, 153, 0.25);
    white-space: nowrap;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
  }

  .mobile-header-upgrade-btn .btn-icon {
    flex-shrink: 0;
    color: #f472b6;
  }

  .mobile-header-upgrade-btn span {
    display: inline !important;
    font-size: 11.5px !important;
    font-weight: 700 !important;
    color: #ffffff !important;
    letter-spacing: -0.2px;
  }

  .mobile-header-upgrade-btn:hover {
    background: linear-gradient(135deg, rgba(236, 72, 153, 0.45), rgba(139, 92, 246, 0.45));
    border-color: rgba(236, 72, 153, 0.85);
    box-shadow: 0 0 14px rgba(236, 72, 153, 0.4);
  }

  .mobile-header-upgrade-btn:active {
    transform: scale(0.96);
  }

  .header-right-cluster {
    display: none !important;
  }


  .header-divider {
    display: none !important;
  }

  /* Playground & Stage Mobile Typography */
  .bento-stage-card {
    padding: 8px 10px 6px 10px;
    gap: 6px;
  }

  .stage-title-group {
    display: flex;
    flex-direction: column;
    gap: 2px;
    flex: 1;
    min-width: 0;
  }

  .stage-title-group h2,
  .bento-stage-card .bento-card-header h2 {
    font-size: 13px;
    line-height: 1.2;
    font-weight: 700;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .stage-role-subtitle {
    font-size: 13px;
    line-height: 1.3;
    color: var(--mb-text-secondary);
    font-weight: 500;
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .stage-focus-tag {
    font-size: 10px;
    letter-spacing: 0.05em;
    padding: 2px 6px;
  }

  /* Segmented Workspace Tabs (< 768px) */
  .mobile-workspace-tabs {
    display: flex;
    align-items: center;
    background: rgba(18, 24, 38, 0.92);
    border: 1px solid var(--mb-border-medium);
    border-radius: var(--mb-radius-full);
    padding: 3px;
    gap: 4px;
    width: 100%;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.4), 0 0 12px var(--mb-accent-primary-glow);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    position: static;
    flex-shrink: 0;
    z-index: 20;
    box-sizing: border-box;
  }

  .mobile-tab-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-height: 38px;
    padding: 6px 10px;
    border-radius: var(--mb-radius-full);
    border: 1px solid transparent;
    background: transparent;
    color: var(--mb-text-secondary);
    font-family: var(--mb-font-ui);
    font-size: var(--mb-text-xs);
    font-weight: var(--mb-weight-semibold);
    cursor: pointer;
    transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .mobile-tab-btn:hover {
    color: var(--mb-text-primary);
    background: rgba(255, 255, 255, 0.05);
  }

  .mobile-tab-btn:active {
    transform: scale(0.97);
  }

  .mobile-tab-btn.active {
    background: linear-gradient(135deg, var(--mb-accent-primary) 0%, var(--mb-accent-music) 100%);
    color: #ffffff;
    border-color: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 14px var(--mb-accent-primary-glow);
    font-weight: var(--mb-weight-bold);
  }

  .mobile-tab-btn .tab-icon {
    flex-shrink: 0;
  }

  /* Bento Workspace Grid Stack - Controlled Bottom-Sheet Layout */
  .bento-workspace-grid {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 4px;
    width: 100%;
    padding-bottom: 0;
    overflow: hidden;
  }
  .bento-stage-card {
    flex: 0 0 45vh !important;
    height: 45vh !important;
    min-height: 220px !important;
    max-height: 45vh !important;
    padding: 6px 8px;
    gap: 4px;
    overflow: hidden !important;
  }

  .floating-editor-panel {
    position: relative !important;
    bottom: auto !important;
    left: auto !important;
    right: auto !important;
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    z-index: 10 !important;
    box-shadow: none !important;
  }

  .floating-editor-panel.panel-collapsed {
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 8px 10px !important;
    border-radius: var(--mb-radius-lg) !important;
    background: var(--mb-bg-glass-strong) !important;
    border: 1px solid var(--mb-border-medium) !important;
    cursor: default;
    transform: none !important;
  }

  .floating-editor-panel.panel-collapsed .panel-scrollable-content {
    display: flex !important;
  }

  .floating-editor-panel .panel-toggle-btn {
    display: none !important;
  }

  /* Mobile Piano Roll Drawer Expansion */
  .bento-editor-card.panel-collapsed {
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    padding: 8px 10px !important;
    border-radius: var(--mb-radius-lg) !important;
    background: var(--mb-bg-glass-strong) !important;
    border: 1px solid var(--mb-border-medium) !important;
    cursor: default !important;
    transform: none !important;
  }

  .bento-editor-card.panel-collapsed .editor-container {
    display: flex !important;
    flex: 1;
    min-height: 0;
    height: 100%;
  }

  .bento-editor-card.panel-collapsed .panel-collapsible-header {
    height: auto !important;
    padding-bottom: 4px;
    flex-shrink: 0;
  }

  .bento-editor-card .stage-role-subtitle {
    display: block !important;
    font-size: 10px !important;
    color: var(--mb-text-muted, #94a3b8) !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 190px !important;
  }

  .bento-editor-card .helper-text-pill {
    display: none !important;
  }

  .bento-editor-card .header-title-wrap {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  .bento-editor-card .stage-title-group {
    display: flex !important;
    flex-direction: column !important;
    gap: 1px !important;
    min-width: 0 !important;
  }

  .bento-editor-card .stage-title-group h2 {
    font-size: 12.5px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    margin: 0 !important;
    line-height: 1.2 !important;
  }

  .bento-editor-card .panel-header-actions {
    display: flex !important;
    align-items: center !important;
    gap: 6px !important;
    flex-shrink: 0 !important;
  }
  .bento-editor-card.panel-collapsed .piano-collapsed-pill,
  .bento-editor-card .panel-toggle-btn,
  .bento-editor-card .btn-piano-toggle {
    display: none !important;
  }

  .bento-editor-card .panel-collapsible-header {
    cursor: default !important;
  }

  /* Stage Toolbar Header & Switch Buttons Alignment on Mobile */
  .stage-toolbar-header {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between !important;
    gap: 4px;
    padding: 0;
    width: 100%;
    position: relative !important;
  }

  .stage-toolbar-header .header-title-wrap,
  .stage-title-group,
  .stage-title-group h2,
  .bento-stage-card .bento-card-header h2 {
    display: none !important;
  }

  .editor-primary-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between !important;
    gap: 4px;
    width: 100%;
    flex-wrap: nowrap;
    overflow: visible !important;
    overflow-x: visible !important;
    scrollbar-width: none;
    padding-bottom: 0;
  }

  .editor-primary-toolbar::-webkit-scrollbar {
    display: none;
  }

  /* Symbol-only compact toolbar buttons on Mobile */
  .toolbar-history-btn {
    padding: 0 8px !important;
    min-width: 32px;
    height: 30px !important;
    font-size: 13px !important;
    pointer-events: auto !important;
  }

  .toolbar-history-btn span {
    display: none !important;
  }

  .view-selector-wrap,
  .motion-selector-wrap {
    display: none !important;
  }

  .theme-selector-wrap {
    display: inline-flex !important;
    position: static !important;
    flex-shrink: 0;
  }

  .theme-selector-btn {
    height: 30px !important;
    min-height: 30px !important;
    padding: 0 8px !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 4px !important;
    background: var(--mb-bg-surface-2) !important;
    border: 1px solid var(--mb-border-subtle) !important;
    color: var(--mb-text-primary) !important;
    white-space: nowrap !important;
    cursor: pointer !important;
    max-width: 140px !important;
  }

  .theme-selector-btn span#current-theme-name {
    max-width: 80px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .theme-selector-popover {
    position: fixed !important;
    top: 52px !important;
    right: 8px !important;
    left: auto !important;
    width: min(340px, calc(100vw - 16px)) !important;
    max-width: calc(100vw - 16px) !important;
    z-index: 10050 !important;
    box-sizing: border-box !important;
    max-height: calc(100dvh - 110px) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    padding: 10px !important;
    background: var(--mb-bg-surface-2) !important;
    border: 1px solid var(--mb-border-highlight) !important;
    border-radius: 12px !important;
    box-shadow: 0 16px 36px rgba(0, 0, 0, 0.75) !important;
  }

  .theme-popover-header {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    font-size: 11px !important;
    font-weight: 700 !important;
    margin-bottom: 8px !important;
    color: #94a3b8 !important;
  }

  .theme-popover-close-btn {
    background: transparent !important;
    border: none !important;
    color: #94a3b8 !important;
    font-size: 14px !important;
    cursor: pointer !important;
    padding: 4px 8px !important;
    min-height: 28px !important;
    min-width: 28px !important;
    border-radius: 6px !important;
    line-height: 1 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    touch-action: manipulation !important;
  }

  .theme-popover-close-btn:active {
    background: rgba(255, 255, 255, 0.1) !important;
    color: #ffffff !important;
  }

  .theme-grid-container {
    display: grid !important;
    grid-template-columns: repeat(3, 1fr) !important;
    gap: 8px !important;
  }

  .theme-grid-card {
    padding: 8px 4px !important;
    min-height: 56px !important;
    border-radius: 10px !important;
    gap: 4px !important;
    cursor: pointer !important;
    touch-action: manipulation !important;
    -webkit-tap-highlight-color: transparent !important;
  }

  .theme-card-icon {
    font-size: 18px !important;
  }

  .theme-card-name {
    font-size: 10.5px !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
  }

  .theme-card-badge {
    font-size: 8px !important;
    padding: 1px 5px !important;
  }

  .stage-more-options-wrap {
    display: inline-flex !important;
    margin-left: auto !important;
    position: relative;
  }

  .btn-stage-more {
    height: 30px;
    min-width: 32px;
    padding: 0 8px;
    background: var(--mb-bg-surface-2);
    border: 1px solid var(--mb-border-subtle);
    border-radius: 6px;
    color: var(--mb-text-primary);
    pointer-events: auto !important;
  }

  .stage-more-popover {
    z-index: 1060 !important;
    pointer-events: auto !important;
    right: 0 !important;
    left: auto !important;
    min-width: 220px !important;
    max-width: calc(100vw - 20px) !important;
    padding: 12px 14px !important;
    gap: 10px !important;
    border-radius: 14px !important;
  }

  .stage-more-heading {
    font-size: 10.5px !important;
    font-weight: 700 !important;
    letter-spacing: 0.08em !important;
  }

  .stage-more-btn {
    min-height: 36px !important;
    padding: 8px 10px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    border-radius: 8px !important;
  }

  .stage-more-theme-trigger {
    grid-column: 1 / -1 !important;
    width: 100% !important;
    min-height: 38px !important;
    padding: 8px 12px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    justify-content: center !important;
    text-align: center !important;
  }

  .toolbar-control-group {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    flex-shrink: 0;
  }

  .toolbar-group-label {
    display: none !important;
  }

  .stage-focus-tag {
    display: inline-flex !important;
    order: 2;
    margin-left: auto;
    font-size: 9px;
    font-weight: 700;
    letter-spacing: 0.06em;
    padding: 2px 7px;
    border-radius: var(--mb-radius-full);
    background: rgba(14, 165, 233, 0.12);
    border: 1px solid rgba(14, 165, 233, 0.28);
    color: var(--mb-accent-primary);
    white-space: nowrap;
    flex-shrink: 0;
  }

  .stage-stats-badge {
    display: none !important;
  }

  .toolbar-segmented {
    display: inline-flex;
    align-items: center;
    padding: 2px;
    gap: 2px;
    background: var(--mb-bg-surface-2);
    border: 1px solid var(--mb-border-subtle);
    border-radius: var(--mb-radius-full);
    flex-shrink: 0;
  }

  .toolbar-segmented .mode-segment-btn {
    padding: 3px 8px;
    font-size: 11px;
    font-weight: 600;
    line-height: 1.2;
    min-height: 26px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--mb-radius-full);
    white-space: nowrap;
  }


  .bento-sidebar-column {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    max-height: none !important;
    height: 100% !important;
    width: 100% !important;
    overflow: hidden !important;
    padding-top: 0 !important;
    margin: 0 !important;
  }

  .bento-sidebar-column .bento-card.panel-collapsed {
    border-radius: var(--mb-radius-lg) !important;
  }

  .bento-card[data-mobile-workspace] {
    display: none !important;
    flex: 1;
    flex: 1 1 0% !important;
    min-height: 0;
    min-height: 0 !important;
    max-height: none !important;
    height: 100% !important;
    flex-direction: column;
    margin-top: 0 !important;
    margin-bottom: 6px !important;
    padding: 8px 10px !important;
    gap: 6px;
    border-radius: var(--mb-radius-lg);
    background: var(--mb-bg-glass-strong);
    border: 1px solid var(--mb-border-medium);
    box-shadow: var(--mb-shadow-popover);
  }

  .bento-workspace-grid[data-active-tab="palette"] .bento-card[data-mobile-workspace="palette"] {
    display: flex !important;
    animation: tab-fade-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .bento-workspace-grid[data-active-tab="palette"] .bento-composer-card,
  .bento-workspace-grid[data-active-tab="palette"] .bento-templates-card,
  .bento-workspace-grid[data-active-tab="palette"] [data-mobile-workspace="templates"],
  .bento-workspace-grid[data-active-tab="palette"] .bento-editor-card,
  .bento-workspace-grid[data-active-tab="palette"] [data-mobile-workspace="editor"],
  .bento-workspace-grid[data-active-tab="palette"] .floating-editor-panel {
    display: none !important;
  }

  .bento-workspace-grid[data-active-tab="editor"] .bento-stage-card {
    flex: 0 0 45vh !important;
    height: 45vh !important;
    min-height: 220px !important;
    max-height: 45vh !important;
    padding: 6px 8px !important;
  }

  .bento-workspace-grid[data-active-tab="templates"] .bento-stage-card {
    flex: 0 0 45vh !important;
    height: 45vh !important;
    min-height: 220px !important;
    max-height: 45vh !important;
    padding: 6px 8px !important;
  }

  .bento-workspace-grid[data-active-tab="editor"] .stage-canvas-outer.chalkboard-container {
    max-height: 100% !important;
    aspect-ratio: auto !important;
    height: 100% !important;
  }

  .bento-workspace-grid[data-active-tab="editor"] .bento-sidebar-column,
  .bento-workspace-grid[data-active-tab="editor"] .bento-card[data-mobile-workspace="palette"],
  .bento-workspace-grid[data-active-tab="editor"] .bento-card[data-mobile-workspace="templates"] {
    display: none !important;
  }

  .bento-workspace-grid[data-active-tab="editor"] .bento-card[data-mobile-workspace="editor"],
  .bento-workspace-grid[data-active-tab="editor"] .bento-editor-card {
    display: flex !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    width: 100% !important;
    max-height: none !important;
    margin-top: 0 !important;
    margin-bottom: 6px !important;
    padding: 8px 10px !important;
    animation: tab-fade-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .bento-editor-card .editor-container {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    width: 100% !important;
    max-height: none !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px !important;
  }

  .bento-editor-card .editor-container canvas {
    min-width: 760px;
    height: 768px !important;
    max-height: none !important;
    min-height: 768px !important;
    touch-action: pan-x pan-y !important;
  }
  .bento-workspace-grid[data-active-tab="templates"] {
    overflow-y: hidden !important;
    display: flex !important;
    flex-direction: column !important;
    gap: 4px !important;
    padding-bottom: 0;
  }

  .bento-workspace-grid[data-active-tab="templates"] .bento-palette-card,
  .bento-workspace-grid[data-active-tab="templates"] [data-mobile-workspace="palette"],
  .bento-workspace-grid[data-active-tab="templates"] .bento-editor-card,
  .bento-workspace-grid[data-active-tab="templates"] [data-mobile-workspace="editor"],
  .bento-workspace-grid[data-active-tab="templates"] .floating-editor-panel {
    display: none !important;
  }

  .bento-workspace-grid[data-active-tab="templates"] .bento-card[data-mobile-workspace="templates"],
  .bento-workspace-grid[data-active-tab="templates"] .bento-composer-card,
  .bento-workspace-grid[data-active-tab="templates"] .bento-templates-card {
    display: flex !important;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    width: 100% !important;
    max-height: none !important;
    margin-top: 0 !important;
    margin-bottom: 6px !important;
    padding: 8px 10px !important;
    overflow: hidden !important;
    border-radius: var(--mb-radius-lg) !important;
    animation: tab-fade-in 0.22s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .bento-composer-card .panel-toggle-btn,
  .bento-templates-card .panel-toggle-btn {
    display: none !important;
  }

  .bento-composer-card .panel-collapsible-header,
  .bento-templates-card .panel-collapsible-header {
    cursor: default !important;
  }

  .bento-composer-card.panel-collapsed,
  .bento-templates-card.panel-collapsed {
    height: 100% !important;
    min-height: 0 !important;
    max-height: none !important;
    flex: 1 1 0% !important;
  }

  .bento-composer-card.panel-collapsed .panel-scrollable-content,
  .bento-composer-card.panel-collapsed .composer-body-split,
  .bento-composer-card.panel-collapsed .shape-template-grid,
  .bento-templates-card.panel-collapsed .panel-scrollable-content,
  .bento-templates-card.panel-collapsed .composer-body-split,
  .bento-templates-card.panel-collapsed .shape-template-grid {
    display: flex !important;
  }

  .bento-workspace-grid[data-active-tab="templates"] #templates-section,
  .bento-workspace-grid[data-active-tab="templates"] .library-tab-panel,
  .bento-workspace-grid[data-active-tab="templates"] .library-tab-panel#panel-library-templates,
  .bento-workspace-grid[data-active-tab="templates"] #shape-list {
    width: 100% !important;
  }

  .bento-workspace-grid[data-active-tab="templates"] .library-tab-panel#panel-library-templates {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    overflow: hidden !important;
  }

  .bento-workspace-grid[data-active-tab="templates"] .bento-composer-card .panel-scrollable-content,
  .bento-workspace-grid[data-active-tab="templates"] .bento-templates-card .panel-scrollable-content {
    display: block !important;
    max-height: 100% !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 8px !important;
  }

  .bento-workspace-grid[data-active-tab="templates"] .bento-templates-card .shape-template-grid,
  .bento-templates-card .shape-template-grid,
  #shape-list.shape-template-grid {
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    max-height: 100% !important;
    padding-bottom: 8px !important;
  }
  .bento-workspace-grid[data-active-tab="templates"] .bento-composer-card .composer-body-split {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 0% !important;
    gap: 8px !important;
    overflow-y: auto !important;
    max-height: 100% !important;
    padding-bottom: 16px !important;
  }
  @keyframes tab-fade-in {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
  }

  /* Main Stage Chalkboard Canvas: Scrollable container & Stable Note Size */
  .stage-canvas-outer.chalkboard-container {
    aspect-ratio: auto;
    max-height: 100%;
    height: 100%;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--mb-radius-md);
  }

  .stage-canvas-outer.chalkboard-container canvas {
    width: 100%;
    height: auto;
    object-fit: contain;
    aspect-ratio: auto;
  }

  /* Linear Notation Container: Horizontal Scrolling & Stable Note Size */
  .stage-canvas-outer.linear-container {
    aspect-ratio: auto;
    max-height: 100%;
    height: 100%;
    width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    border-radius: var(--mb-radius-md);
  }

  .stage-canvas-outer.linear-container canvas {
    width: auto;
    height: 100%;
    max-width: none;
    flex-shrink: 0;
    object-fit: contain;
  }

  /* Palette Tab Touch Targets (Minimum ~44px) & Controlled Bottom Sheet */
  .bento-palette-card {
    display: flex;
    flex-direction: column;
    flex: 1 1 0% !important;
    min-height: 0 !important;
    max-height: none !important;
    height: 100% !important;
    overflow: hidden;
    justify-content: flex-start;
  }

  .bento-palette-card.panel-collapsed {
    flex: 0 0 42px !important;
    height: 42px !important;
    min-height: 42px !important;
    max-height: 42px !important;
    padding: 0 12px !important;
    border-radius: var(--mb-radius-lg) !important;
    overflow: hidden !important;
    cursor: pointer;
  }

  .bento-palette-card.panel-collapsed .palette-sections-scroller,
  .bento-palette-card.panel-collapsed .palette-insert-panel {
    display: none !important;
  }

  .bento-palette-card.panel-collapsed .panel-collapsible-header {
    height: 100%;
    padding: 0;
    margin: 0;
  }

  .bento-palette-card .bento-card-header {
    display: none !important;
  }

  .bento-palette-card .panel-toggle-btn {
    display: none !important;
  }

  .palette-sections-scroller {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding-right: 4px;
    margin-bottom: 4px;
    padding-bottom: 8px !important;
  }

  .palette-insert-panel {
    flex-shrink: 0;
    margin-top: auto;
    padding: 4px 6px;
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 6px;
    background: var(--mb-bg-surface-2);
    border-radius: var(--mb-radius-sm);
    border: 1px solid var(--mb-border-subtle);
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.35);
  }

  .palette-insert-panel .insert-select-group {
    flex: 1;
    min-width: 0;
    gap: 2px;
  }

  .palette-insert-panel .insert-label {
    font-size: 10px;
    font-weight: var(--mb-weight-semibold);
    color: var(--mb-text-secondary);
  }

  .palette-insert-panel .insert-pitch-dropdown {
    height: 34px;
    font-size: 12px;
    padding: 2px 6px;
    width: 100%;
  }

  .palette-insert-panel .btn-insert-action {
    flex: 1.1;
    min-width: 0;
    height: 34px;
    font-size: 12px;
    padding: 4px 8px;
    white-space: nowrap;
  }

  .palette-button-matrix {
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
  }

  .gp8-btn {
    min-height: 32px !important;
    min-width: 32px !important;
    font-size: 12px !important;
    padding: 4px 2px !important;
  }

  .gp8-dur-btn,
  #gp8-btn-rest {
    font-size: 15px !important;
  }

  .gp8-compound-btn {
    font-size: 12px !important;
  }

  .gp8-acc-btn,
  #gp8-btn-fermata {
    font-size: 12px !important;
  }

  .palette-subgroup-title {
    font-size: 9px !important;
    margin-top: 4px !important;
    margin-bottom: 2px !important;
  }

  .palette-subheading {
    font-size: 11px !important;
  }

  .palette-collapse-toggle {
    min-height: 30px !important;
    padding: 4px 6px !important;
    font-size: 10px !important;
  }

  .action-tag-btn {
    min-height: 30px !important;
    padding: 4px 8px !important;
    display: inline-flex;
    align-items: center;
    font-size: 10px !important;
  }

  .slots-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .panel-toggle-btn {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 28px !important;
    height: 28px !important;
    min-width: 28px !important;
    min-height: 28px !important;
    border-radius: 8px !important;
    background: rgba(255, 255, 255, 0.08) !important;
    border: 1px solid var(--mb-border-subtle) !important;
    color: var(--mb-text-primary) !important;
    font-family: var(--mb-font-mono) !important;
    font-size: 14px !important;
    font-weight: 700 !important;
    line-height: 1 !important;
    cursor: pointer !important;
    transition: all 0.15s ease !important;
  }

  .panel-toggle-btn:hover,
  .panel-toggle-btn:active {
    background: rgba(255, 255, 255, 0.12) !important;
    color: var(--mb-text-primary) !important;
    border-color: var(--mb-border-medium) !important;
    transform: scale(1.05);
  }


  /* Piano Roll Tab Horizontal Scrolling */
  .bento-editor-card .editor-container {
    flex: 1 1 0% !important;
    min-height: 0 !important;
    height: 100% !important;
    max-height: none !important;
    overflow: auto !important;
    overflow-y: auto !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    touch-action: pan-x pan-y;
    display: block;
    padding-bottom: 8px !important;
  }

  .bento-editor-card .editor-container canvas {
    min-width: 760px;
    height: 768px !important;
    max-height: none !important;
    touch-action: pan-x pan-y !important;
  }
  /* Templates & Composer Tab */
  .bento-composer-card .composer-body-split {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: none;
    gap: 8px;
    padding-bottom: 8px !important;
  }

  .bento-templates-card .shape-template-grid,
  #shape-list.shape-template-grid {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    max-height: none;
    display: grid !important;
    grid-template-columns: repeat(4, minmax(0, 1fr)) !important;
    gap: 6px;
    padding-bottom: 8px !important;
  }

  @media (max-width: 480px) {
    .bento-workspace-grid[data-active-tab="templates"] .bento-templates-card .shape-template-grid,
    .bento-templates-card .shape-template-grid,
    #shape-list.shape-template-grid {
      grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
      gap: 4px !important;
    }
  }

  .shape-card {
    padding: 4px 3px !important;
    min-height: 0 !important;
    height: 74px !important;
    max-height: 74px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 3px !important;
    border-radius: var(--mb-radius-md) !important;
    overflow: hidden !important;
    box-sizing: border-box !important;
  }

  .shape-badge-num {
    font-size: 8.5px !important;
    padding: 1px 4px !important;
    line-height: 1 !important;
    font-weight: 700 !important;
  }

  .shape-svg-wrapper {
    height: 24px !important;
    width: 100% !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    margin: 0 !important;
  }

  .shape-svg-wrapper svg {
    width: 36px !important;
    height: 22px !important;
    max-width: 100% !important;
    object-fit: contain !important;
  }

  .shape-name {
    font-size: 9.5px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    width: 100% !important;
    text-align: center !important;
    margin: 0 !important;
  }

  .shape-duration {
    display: none !important;
  }

  .composer-input-row {
    flex-direction: column;
    gap: 8px;
  }

  .composer-dropdown,
  .composer-text-input {
    height: 44px;
    font-size: 14px;
  }

  .btn-composer-action {
    min-height: 44px;
    width: 100%;
    font-size: 14px;
  }

  /* Sticky Mobile Transport Dock & Bottom Sheet */
  /* ==========================================================================
     METRICBALL — P2 MOBILE TRANSPORT REDESIGN (COMPACT 3-UNIT DOCK)
     [ METRIC BADGE ] [ HERO PLAY/PAUSE ] [ OPTIONS ]
     Target height: ~52px with safe-area support
     ========================================================================== */
  .floating-transport-dock {
    position: fixed;
    bottom: max(10px, env(safe-area-inset-bottom, 10px));
    width: calc(100% - 24px);
    max-width: 420px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 1000;
    pointer-events: auto !important;
  }

  .dock-inner-glass {
    width: 100%;
    height: 52px;
    min-height: 52px;
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    align-items: center !important;
    padding: 5px 8px !important;
    gap: 6px !important;
    border-radius: var(--mb-radius-full);
    box-sizing: border-box;
    background: rgba(18, 24, 38, 0.92);
    border: 1px solid var(--mb-border-medium);
    box-shadow: 0 12px 36px rgba(0, 0, 0, 0.85), 0 0 20px rgba(6, 182, 212, 0.12);
  }

  /* Unit 1 (BPM) & Unit 2 (TimeSig) in 5-Unit Mobile Sequence */
  .transport-metric-cluster {
    display: flex !important;
    align-items: center;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    height: auto !important;
    min-height: 0 !important;
    flex-shrink: 0;
  }

  .metric-tempo-unit,
  .metric-cluster-divider,
  #time-sig-select-container {
    display: none !important;
  }

  .mobile-metric-badge {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    height: 40px;
    min-height: 40px;
    padding: 0 10px;
    background: var(--mb-bg-surface-2);
    border: 1px solid rgba(6, 182, 212, 0.35);
    border-radius: var(--mb-radius-full);
    color: var(--mb-text-primary);
    font-family: var(--mb-font-mono);
    font-size: 11px;
    font-weight: 700;
    white-space: nowrap;
    cursor: pointer;
    box-shadow: 0 0 12px rgba(6, 182, 212, 0.15);
    transition: all 0.15s ease;
    user-select: none;
    pointer-events: auto !important;
    -webkit-tap-highlight-color: transparent;
    flex-shrink: 0;
  }

  .mobile-timesig-badge {
    display: inline-flex !important;
  }

  .mobile-metric-badge:active,
  .mobile-metric-badge.active {
    background: rgba(6, 182, 212, 0.2);
    border-color: var(--mb-accent-music);
    box-shadow: 0 0 16px var(--mb-accent-music-glow);
    color: #ffffff;
  }

  .metric-badge-sep {
    display: none !important;
  }

  /* Unit 3 (Play) & Unit 4 (Stop) in sequence */
  .transport-action-group {
    display: flex !important;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 0 0 auto;
    min-width: 0;
  }

  .btn-play-prominent {
    width: 72px;
    min-width: 72px;
    max-width: 72px;
    height: 40px !important;
    min-height: 40px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 12px !important;
    font-weight: var(--mb-weight-extrabold);
    border-radius: var(--mb-radius-full);
    background: linear-gradient(135deg, var(--mb-accent-transport) 0%, #059669 100%) !important;
    box-shadow: 0 4px 18px var(--mb-accent-transport-glow) !important;
    border: 1px solid rgba(16, 185, 129, 0.6) !important;
    pointer-events: auto !important;
  }

  .btn-play-prominent.playing,
  .btn-play-prominent.active,
  #play.playing,
  #play.active {
    background: linear-gradient(180deg, #06b6d4 0%, #0891b2 100%) !important;
    border-color: #22d3ee !important;
    box-shadow: 0 0 16px var(--mb-accent-music-glow) !important;
    color: #ffffff !important;
  }

  .transport-action-group .btn-stop {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-height: 40px;
    border-radius: var(--mb-radius-full);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.005) 100%), #1c222b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top-color: rgba(255, 255, 255, 0.12);
    border-bottom-color: rgba(0, 0, 0, 0.45);
    box-shadow: 0 1.5px 3px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    color: var(--mb-text-secondary);
    cursor: pointer;
    pointer-events: auto !important;
    transition: all 0.12s ease;
  }

  .transport-action-group .btn-stop:hover {
    background: rgba(244, 63, 94, 0.18);
    border-color: rgba(244, 63, 94, 0.45);
    border-top-color: rgba(244, 63, 94, 0.6);
    border-bottom-color: rgba(159, 18, 57, 0.6);
    color: var(--mb-accent-danger);
    transform: translateY(-1.5px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15);
  }

  .transport-action-group .btn-stop:active {
    background: rgba(244, 63, 94, 0.25);
    border-color: rgba(244, 63, 94, 0.6);
    color: var(--mb-accent-danger);
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7);
  }

  .transport-action-group .btn-back,
  .transport-action-group .btn-rewind,
  .transport-action-group .btn-forward,
  .transport-action-group .btn-skip {
    display: none !important;
  }

  /* Unit 5 (Right): Settings (⚙️) */
  .transport-mobile-unit {
    display: flex !important;
    align-items: center;
    flex-shrink: 0;
  }

  .btn-transport-options {
    display: inline-flex !important;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-height: 40px;
    border-radius: var(--mb-radius-full);
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.04) 0%, rgba(255, 255, 255, 0.005) 100%), #1c222b;
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-top-color: rgba(255, 255, 255, 0.12);
    border-bottom-color: rgba(0, 0, 0, 0.45);
    box-shadow: 0 1.5px 3px rgba(0, 0, 0, 0.4), 0 1px 1px rgba(0, 0, 0, 0.2), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    color: var(--mb-text-secondary);
    cursor: pointer;
    pointer-events: auto !important;
    transition: all 0.12s ease;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  .btn-transport-options:hover {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.08) 0%, rgba(255, 255, 255, 0.02) 100%), #222832;
    border-color: var(--mb-accent-primary);
    color: var(--mb-text-primary);
    transform: translateY(-1.5px);
    box-shadow: 0 3px 6px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.25), inset 0 1px 0 rgba(255, 255, 255, 0.15), 0 0 12px var(--mb-accent-primary-glow);
  }

  .btn-transport-options:active,
  .btn-transport-options.active {
    background: linear-gradient(180deg, rgba(139, 92, 246, 0.22) 0%, rgba(139, 92, 246, 0.12) 100%), #171326;
    border-color: var(--mb-accent-primary);
    border-top-color: rgba(139, 92, 246, 0.7);
    border-bottom-color: rgba(139, 92, 246, 0.3);
    color: #ffffff;
    transform: translateY(1px);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.7), inset 0 1px 1.5px rgba(0, 0, 0, 0.5), 0 0 12px var(--mb-accent-primary-glow);
  }

  .dock-divider,
  .transport-desktop-tools {
    display: none !important;
  }

  /* Mobile Options Bottom Sheet Drawer */
  .transport-more-popover {
    position: fixed !important;
    bottom: calc(max(68px, calc(60px + env(safe-area-inset-bottom, 12px)))) !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: calc(100% - 24px) !important;
    max-width: 400px !important;
    max-height: 72vh !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
    background: var(--mb-bg-surface-1) !important;
    border: 1px solid var(--mb-border-medium) !important;
    border-radius: var(--mb-radius-xl) !important;
    box-shadow: 0 -16px 48px rgba(0, 0, 0, 0.95), 0 0 24px var(--mb-accent-primary-glow) !important;
    padding: 12px 14px 16px 14px !important;
    gap: 12px !important;
    z-index: 1050 !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    box-sizing: border-box !important;
    animation: sheet-slide-up 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
  }

  .bottom-sheet-handle {
    display: block !important;
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: var(--mb-border-medium);
    margin: 0 auto 6px auto;
  }

  .sheet-section {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  }

  .sheet-actions-section {
    border-bottom: none;
    padding-bottom: 0;
  }

  .sheet-section-title {
    font-family: var(--mb-font-ui);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--mb-text-muted);
  }

  #transport-tempo-sheet .sheet-section-title,
  #transport-tempo-sheet .sheet-label {
    display: none !important;
  }

  .sheet-playback-row {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 8px;
  }

  .sheet-tool-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    height: 38px;
    padding: 0 14px;
    box-sizing: border-box;
    background: var(--mb-bg-surface-2);
    border: 1px solid var(--mb-border-subtle);
    color: var(--mb-text-secondary);
    border-radius: var(--mb-radius-md);
    font-family: var(--mb-font-ui);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    min-width: 0;
  }

  #btn-popover-metronome {
    padding: 0 14px;
    gap: 8px;
  }

  #btn-popover-metronome span,
  .sheet-tool-btn span {
    display: inline-block;
    padding: 0 2px;
    line-height: 1;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .sheet-tool-btn:hover,
  .sheet-tool-btn:active,
  .sheet-tool-btn.active {
    background: var(--mb-bg-surface-3);
    color: var(--mb-text-primary);
    border-color: var(--mb-border-medium);
  }

  .sheet-volume-slider-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 2px 4px;
  }

  .sheet-slider {
    flex: 1;
    height: 4px;
    accent-color: var(--mb-accent-primary);
  }

  .sheet-grid-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
  }

  .sheet-grid-row.sheet-tempo-row,
  .sheet-tempo-row {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
  }

  .sheet-bpm-wrap {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 0 0 auto;
  }

  .sheet-bpm-unit-label {
    font-family: var(--mb-font-mono);
    font-size: 12px;
    font-weight: 700;
    color: var(--mb-text-secondary);
    letter-spacing: 0.05em;
  }

  .sheet-tempo-divider {
    font-family: var(--mb-font-mono);
    font-size: 14px;
    font-weight: 600;
    color: var(--mb-border-medium);
    opacity: 0.8;
    user-select: none;
    margin: 0 2px;
  }

  .sheet-timesig-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
  }

  .sheet-label {
    font-family: var(--mb-font-mono);
    font-size: 11px;
    font-weight: 700;
    color: var(--mb-text-secondary);
  }

  .sheet-number-input {
    width: 60px;
    height: 32px;
    background: var(--mb-bg-surface-2);
    border: 1px solid var(--mb-border-subtle);
    border-radius: var(--mb-radius-sm);
    color: #ffffff;
    font-family: var(--mb-font-mono);
    font-size: 13px;
    font-weight: 700;
    padding: 0 6px;
    outline: none;
  }

  .sheet-motion-row {
    display: flex;
    flex-direction: column;
    gap: 8px;
  }

  .sheet-section-view-motion {
    display: none !important;
  }

  .sheet-toggle-group {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }

  .sheet-sublabel {
    font-size: 11px;
    color: var(--mb-text-secondary);
    font-family: var(--mb-font-ui);
  }

  .sheet-segmented {
    display: inline-flex;
    padding: 2px;
    gap: 2px;
  }

  .sheet-segmented .mode-segment-btn {
    padding: 4px 10px;
    font-size: 11px;
    min-height: 28px;
  }

  .sheet-actions-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .sheet-action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    height: 38px;
    border-radius: var(--mb-radius-md);
    font-family: var(--mb-font-ui);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s ease;
  }

  .btn-action-export {
    background: rgba(14, 165, 233, 0.15);
    border: 1px solid rgba(14, 165, 233, 0.35);
    color: var(--mb-accent-primary);
  }

  .btn-action-clear {
    background: rgba(244, 63, 94, 0.12);
    border: 1px solid rgba(244, 63, 94, 0.3);
    color: var(--mb-accent-danger);
  }

  @keyframes sheet-slide-up {
    from { opacity: 0; transform: translate(-50%, 14px); }
    to { opacity: 1; transform: translate(-50%, 0); }
  }

  .popover-tool-btn {
    min-height: 44px;
    font-size: 13px;
    padding: 10px 8px;
  }

  .mode-segment-btn,
  .mode-btn {
    min-height: 44px;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .glass-navbar {
    flex-direction: column;
    align-items: stretch;
    border-radius: var(--radius-xl);
  }

  .nav-transport-controls {
    justify-content: center;
  }

  .pricing-plan-grid {
    display: flex !important;
    flex-direction: column !important;
    gap: 10px !important;
    margin-top: 10px !important;
  }

  .pricing-tier-card.featured-tier,
  .pricing-tier-card.tier-pro {
    order: -1 !important;
  }

  .pricing-tier-card.tier-free {
    order: 1 !important;
  }

  .mobile-header-popover {
    max-width: calc(100vw - 20px) !important;
    box-sizing: border-box !important;
  }

  .upgrade-modal-card,
  .project-modal-card,
  .export-modal-card,
  .pricing-modal-card,
  .auth-modal-card,
  .profile-modal-card,
  .template-gallery-card {
    padding: 20px 16px !important;
    border-radius: 16px !important;
    max-height: 92vh !important;
    width: calc(100vw - 24px) !important;
    box-sizing: border-box !important;
  }

  .pricing-modal-card,
  .upgrade-modal-card {
    max-height: 86vh !important;
    padding: 14px 12px !important;
    border-radius: 14px !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .auth-modal-title {
    font-size: 19px !important;
  }

  .pricing-modal-header {
    margin-bottom: 6px !important;
  }

  .pricing-title {
    font-size: 16px !important;
    margin: 4px 0 !important;
    line-height: 1.25 !important;
  }

  .pricing-subtitle {
    font-size: 11px !important;
    margin: 2px 0 !important;
    line-height: 1.35 !important;
  }

  .pricing-tier-card {
    padding: 12px 10px !important;
    border-radius: 12px !important;
  }

  .tier-header h3 {
    font-size: 13.5px !important;
    margin: 0 0 2px 0 !important;
  }

  .tier-tagline {
    font-size: 10.5px !important;
    margin: 2px 0 4px 0 !important;
  }

  .tier-featured-pill {
    top: -10px !important;
    font-size: 8.5px !important;
    padding: 2px 8px !important;
  }

  .tier-price {
    font-size: 21px !important;
    margin: 4px 0 !important;
  }

  .tier-price span {
    font-size: 11.5px !important;
  }

  .tier-price-selector {
    gap: 4px !important;
    margin: 6px 0 !important;
  }

  .price-toggle-option {
    padding: 6px 8px !important;
    font-size: 11.5px !important;
    gap: 6px !important;
  }

  .tier-features,
  .tier-feature-list {
    margin: 8px 0 10px 0 !important;
    gap: 4px !important;
    font-size: 11px !important;
  }

  .tier-features li,
  .tier-feature-list li {
    line-height: 1.35 !important;
  }

  .btn-tier-action {
    padding: 8px 10px !important;
    font-size: 12px !important;
    border-radius: 8px !important;
    min-height: 36px !important;
  }

  .pricing-guarantee-note {
    font-size: 10px !important;
    margin-top: 8px !important;
  }

  /* Preset Preview Bar Mobile Optimization */
  .preset-preview-bar {
    top: 6px !important;
    left: 6px !important;
    right: 6px !important;
    padding: 4px 8px !important;
    gap: 6px !important;
    border-radius: 10px !important;
    display: flex;
    align-items: center !important;
    justify-content: space-between !important;
  }

  .preset-preview-bar[style*="display: none"],
  .preset-preview-bar[style*="display:none"] {
    display: none !important;
  }
  .preset-preview-left {
    display: none !important;
  }

  .preset-preview-actions {
    display: flex !important;
    width: 100% !important;
    justify-content: space-between !important;
    align-items: center !important;
    gap: 6px !important;
  }

  .btn-preset-preview {
    font-size: 11px !important;
    padding: 4px 8px !important;
    min-height: 32px !important;
    border-radius: 6px !important;
    gap: 4px !important;
    flex: 1 1 auto !important;
    justify-content: center !important;
  }

  .btn-preset-preview-close {
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    max-width: 32px !important;
    flex: 0 0 32px !important;
    padding: 0 !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
  }
  .project-save-section {
    flex-direction: column;
  }
}

/* ==========================================================================
   13. METRICBALL MONETIZATION & THEME SYSTEM UI
   ========================================================================== */

/* Header Actions & Dev Plan Switcher */
.top-meta-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-subtle);
  color: var(--mb-text-secondary);
  padding: 0 12px;
  height: 32px;
  border-radius: var(--mb-radius-sm);
  font-family: var(--mb-font-ui);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s cubic-bezier(0.16, 1, 0.3, 1);
  box-sizing: border-box;
}

.header-action-btn:hover {
  background: var(--mb-bg-surface-3);
  border-color: var(--mb-border-medium);
  color: var(--mb-text-primary);
}

.btn-pricing-accent {
  background: var(--mb-bg-surface-2);
  border-color: var(--mb-border-subtle);
  color: var(--mb-text-secondary);
}

.btn-pricing-accent:hover {
  background: var(--mb-bg-surface-3);
  border-color: var(--mb-border-medium);
  color: #ffffff;
}

/* Primary Editor Toolbar & Stage Header Actions */
@media (min-width: 769px) {
  .stage-toolbar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: nowrap;
    gap: var(--mb-space-md);
    padding: 0 0 6px 0;
    min-height: 36px;
  }

  .editor-primary-toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: nowrap;
    margin: 0;
  }

  .toolbar-control-group {
    display: inline-flex;
    align-items: center;
    gap: var(--mb-space-xs);
  }

  .toolbar-group-label {
    font-family: var(--mb-font-ui);
    font-size: var(--mb-text-2xs);
    font-weight: var(--mb-weight-semibold);
    color: var(--mb-text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    user-select: none;
  }

  .toolbar-segmented {
    background: var(--mb-bg-surface-2);
    border: 1px solid var(--mb-border-subtle);
    border-radius: var(--mb-radius-sm);
    padding: 2px;
    display: inline-flex;
    gap: 2px;
  }

  .toolbar-segmented .mode-segment-btn {
    padding: 4px 10px;
    font-size: var(--mb-text-xs);
    font-weight: var(--mb-weight-semibold);
    font-family: var(--mb-font-ui);
    color: var(--mb-text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--mb-radius-xs);
    cursor: pointer;
    transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  }

  .toolbar-segmented .mode-segment-btn:hover {
    color: var(--mb-text-primary);
    background: rgba(255, 255, 255, 0.06);
  }

  .toolbar-segmented .mode-segment-btn.active {
    background: var(--mb-accent-primary);
    color: #ffffff;
    box-shadow: 0 0 10px var(--mb-accent-primary-glow);
  }
}

#selected-object-pill {
  max-width: 320px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  display: inline-block;
  vertical-align: middle;
  transition: all 0.2s ease;
}

#selected-object-pill.has-selection {
  color: var(--mb-accent-music);
  font-weight: var(--mb-weight-semibold);
  text-shadow: 0 0 8px var(--mb-accent-music-glow);
}

@media (max-width: 1280px) {
  .stage-focus-tag {
    display: none !important;
  }
  #selected-object-pill {
    max-width: 180px;
  }
  .toolbar-segmented .mode-segment-btn {
    padding: 3px 7px;
    font-size: 11px;
  }
  .toolbar-group-label {
    display: none;
  }
}
.stage-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.history-actions-group {
  display: flex;
  gap: 3px;
  background: var(--mb-bg-surface-2);
  padding: 2px;
  border-radius: 8px;
  border: 1px solid var(--mb-border-subtle);
  height: 34px;
  align-items: center;
}

.toolbar-history-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: none;
  background: transparent;
  color: var(--mb-text-secondary);
  font-family: var(--mb-font-ui);
  font-size: 12px;
  font-weight: 600;
  height: 28px;
  padding: 0 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  text-align: center;
  white-space: nowrap;
  user-select: none;
}

.toolbar-history-btn.btn-quick-save {
  color: #38bdf8;
}

.toolbar-history-btn.btn-quick-save:hover:not(:disabled) {
  background: rgba(56, 189, 248, 0.18);
  color: #7dd3fc;
}

.toolbar-dropdown-wrap {
  position: relative;
}

.toolbar-dropdown-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-subtle);
  color: var(--mb-text-secondary);
  height: 32px;
  padding: 0 10px;
  border-radius: var(--mb-radius-sm);
  font-family: var(--mb-font-ui);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.toolbar-dropdown-btn:hover {
  border-color: var(--mb-border-medium);
  background: var(--mb-bg-surface-3);
  color: var(--mb-text-primary);
}

.toolbar-dropdown-popover {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 160px;
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-medium);
  border-radius: 10px;
  box-shadow: var(--mb-shadow-popover);
  padding: 8px;
  z-index: 1000;
}

.toolbar-popover-header {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
  padding: 4px 8px 6px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 4px;
}

.toolbar-dropdown-options {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.toolbar-dropdown-item {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 6px 10px;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #cbd5e1;
  font-family: var(--mb-font-ui);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}

.toolbar-dropdown-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.toolbar-dropdown-item.active {
  background: linear-gradient(135deg, var(--mb-accent-primary) 0%, #7c3aed 100%);
  color: #ffffff;
  font-weight: 700;
  box-shadow: 0 2px 8px var(--mb-accent-primary-glow);
}

.theme-selector-wrap {
  position: relative;
}

.theme-selector-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-subtle);
  color: #e2e8f0;
  height: 34px;
  padding: 0 12px;
  border-radius: 6px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.theme-selector-btn:hover {
  border-color: var(--mb-border-highlight);
  background: var(--mb-bg-surface-3);
}
.theme-selector-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  left: auto;
  width: 360px;
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-medium);
  border-radius: 16px;
  box-shadow: var(--mb-shadow-popover);
  padding: 14px;
  z-index: 1000;
}

.theme-popover-header {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  color: #94a3b8;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.theme-grid-container {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.theme-grid-card {
  background: var(--mb-bg-surface-1);
  border: 1px solid var(--mb-border-subtle);
  border-radius: 12px;
  padding: 10px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
  position: relative;
}

.theme-grid-card:hover {
  background: var(--mb-bg-surface-3);
  transform: translateY(-2px);
  border-color: var(--mb-border-highlight);
}

.theme-grid-card.active-theme {
  border-color: var(--mb-accent-primary);
  background: var(--mb-accent-primary-glow);
  box-shadow: 0 0 12px var(--mb-accent-primary-glow);
}

.theme-card-icon {
  font-size: 20px;
}

.theme-card-name {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 11px;
  font-weight: 700;
  color: #f8fafc;
  line-height: 1.2;
}

.theme-card-badge {
  font-family: 'Geist Mono', monospace;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 9999px;
}

.theme-card-badge.badge-free {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
}

.theme-card-badge.badge-pro {
  background: rgba(236, 72, 153, 0.2);
  color: #f472b6;
}

/* Generic Modal Backdrop & Standardized Cards */
.modal-backdrop,
.custom-modal-overlay,
.export-modal-overlay {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(8, 9, 11, 0.85);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 16px;
  box-sizing: border-box;
  animation: fadeInModal 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes fadeInModal {
  from { opacity: 0; }
  to { opacity: 1; }
}

.upgrade-modal-card,
.project-modal-card,
.export-modal-card,
.pricing-modal-card,
.auth-modal-card,
.profile-modal-card,
.template-gallery-card,
.custom-modal-dialog {
  background: var(--mb-bg-surface-1);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  box-shadow: 0 20px 48px -8px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--mb-border-medium);
  width: 100%;
  max-width: 580px;
  padding: 26px 30px;
  position: relative;
  max-height: min(90vh, calc(100dvh - 32px));
  overflow-y: auto;
  box-sizing: border-box;
  animation: modal-dialog-pop 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.template-gallery-card {
  max-width: 880px;
}

.pricing-modal-card,
.custom-modal-dialog {
  max-width: 760px;
}

.auth-modal-card,
.profile-modal-card {
  max-width: 480px;
}

.upgrade-modal-card,
.export-modal-card,
.project-modal-card {
  max-width: 600px;
}

.modal-close-btn,
.custom-modal-close {
  position: absolute;
  top: 18px;
  right: 18px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #94a3b8;
  width: 34px;
  height: 34px;
  border-radius: 9999px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  z-index: 20;
}

.modal-close-btn:hover,
.custom-modal-close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: #f8fafc;
  border-color: rgba(255, 255, 255, 0.28);
  transform: scale(1.05);
}

.modal-close-btn:focus-visible,
.custom-modal-close:focus-visible {
  outline: 2px solid #38bdf8;
  outline-offset: 2px;
}

/* Upgrade Modal Specifics */
.upgrade-modal-header {
  text-align: center;
  margin-bottom: 20px;
}

.upgrade-badge {
  display: inline-block;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: #ec4899;
  background: rgba(236, 72, 153, 0.15);
  padding: 4px 10px;
  border-radius: 9999px;
  margin-bottom: 10px;
  letter-spacing: 0.05em;
}

.upgrade-title {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 8px 0;
}

.upgrade-subtitle {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 14px;
  color: #94a3b8;
  margin: 0 0 12px 0;
}

.upgrade-feature-tag {
  display: inline-block;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  color: #38bdf8;
  padding: 4px 12px;
  border-radius: 8px;
  font-size: 12px;
}

.upgrade-benefits-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 24px;
  background: var(--mb-bg-surface-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 18px;
}

.benefit-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.benefit-icon {
  color: var(--mb-accent-primary);
  font-weight: 800;
  font-size: 16px;
}

.benefit-item strong {
  display: block;
  color: #f8fafc;
  font-size: 13px;
  font-family: 'Outfit', system-ui, sans-serif;
}

.benefit-item p {
  margin: 2px 0 0 0;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.4;
}

.upgrade-modal-actions {
  display: flex;
  gap: 12px;
}

.btn-upgrade-primary {
  flex: 2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, #ec4899, #8b5cf6);
  border: none;
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 12px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.35);
}

.btn-upgrade-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(236, 72, 153, 0.5);
}

.btn-upgrade-secondary {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 12px 16px;
  border-radius: 12px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-upgrade-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

/* Save Status Indicator Badge */
.save-status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  padding: 0;
  border-radius: 50%;
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  transition: all 0.25s ease;
  user-select: none;
  cursor: default;
}

.save-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  transition: all 0.25s ease;
}

.save-status-badge.status-saved {
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-subtle);
}

.save-status-badge.status-saved .save-status-dot {
  background: #10b981;
}

.save-status-badge.status-saving {
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.save-status-badge.status-saving .save-status-dot {
  background: #38bdf8;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.9);
  animation: pulse-dot 0.9s infinite alternate;
}

.save-status-badge.status-dirty {
  background: rgba(251, 191, 36, 0.15);
  border: 1px solid rgba(251, 191, 36, 0.35);
}

.save-status-badge.status-dirty .save-status-dot {
  background: #f59e0b;
  box-shadow: 0 0 8px rgba(245, 158, 11, 0.7);
  animation: pulse-dot 1.2s infinite alternate;
}

.save-status-badge.status-error {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.save-status-badge.status-error .save-status-dot {
  background: #f87171;
}

@keyframes pulse-dot {
  from { opacity: 0.4; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1.2); }
}

/* Project Manager Modal Styles */
.project-modal-card {
  padding: 24px 28px;
}

.project-modal-card .modal-close-btn {
  top: 20px;
  right: 20px;
}

.project-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: nowrap;
}

.project-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  flex-shrink: 1;
}

.project-header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-right: 36px;
  flex-shrink: 0;
}

.btn-create-new-proj {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f1f5f9;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  padding: 7px 14px;
  min-height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.btn-create-new-proj:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
  transform: translateY(-1px);
}
/* Active Project Banner */
.project-active-banner {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  box-shadow: none;
}
.project-active-banner.banner-draft {
  background: rgba(255, 255, 255, 0.025);
  border-color: rgba(255, 255, 255, 0.08);
  flex-direction: column;
  align-items: stretch;
  gap: 12px;
  box-shadow: none;
}

.project-draft-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.project-draft-input-row {
  display: flex;
  gap: 8px;
  width: 100%;
  align-items: center;
}

.project-active-info {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 0;
}
.active-badge-tag {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  padding: 2.5px 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  flex-shrink: 0;
}

.active-badge-tag.tag-draft {
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.08);
}

.active-project-title {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: #f8fafc;
  letter-spacing: -0.01em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.active-saved-indicator {
  font-size: 11.5px;
  font-weight: 700;
  color: #34d399;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.active-dirty-indicator {
  font-size: 11.5px;
  font-weight: 700;
  color: #fbbf24;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.project-active-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.btn-project-action-save {
  background: var(--mb-accent-primary);
  border: none;
  color: #ffffff;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  box-shadow: 0 2px 10px var(--mb-accent-primary-glow);
}

.btn-project-action-save:hover {
  background: #9d74f7;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--mb-accent-primary-glow);
}

.btn-project-action-secondary {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f1f5f9;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 14px;
  border-radius: 9px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-project-action-secondary:hover {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.3);
  color: #ffffff;
}

/* Save As Form */
.project-save-as-form {
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-medium);
  border-radius: 12px;
  padding: 14px 16px;
  margin-bottom: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

.project-form-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
  margin-bottom: 8px;
}

.project-form-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-project-cancel {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #94a3b8;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 14px;
  min-height: 38px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.btn-project-cancel:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
}

.project-list-section-header {
  margin-top: 18px;
  margin-bottom: 12px;
}

.project-list-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.project-list-heading {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #94a3b8;
}

/* Search Bar in Project Manager */
.project-search-box {
  position: relative;
  display: flex;
  align-items: center;
  min-width: 240px;
  max-width: 320px;
  flex: 1;
}

.project-search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 12px;
  color: #64748b;
  pointer-events: none;
}

.project-search-input {
  width: 100%;
  background: var(--mb-bg-surface-2);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 8px;
  padding: 7px 28px 7px 32px;
  color: #f8fafc;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12px;
  outline: none;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.project-search-input:focus {
  border-color: var(--mb-accent-primary);
  background: var(--mb-bg-surface-3);
  box-shadow: 0 0 0 2px var(--mb-accent-primary-glow);
}

.btn-clear-search {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 11px;
  cursor: pointer;
  padding: 2px 4px;
  border-radius: 4px;
  line-height: 1;
}

.btn-clear-search:hover {
  color: #f8fafc;
  background: rgba(255, 255, 255, 0.1);
}

.project-search-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 28px 16px;
  background: var(--mb-bg-surface-2);
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 12px;
}

.project-search-empty-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 93, 143, 0.08);
  border: 1px solid rgba(255, 93, 143, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 10px;
  color: #ff5d8f;
}

.project-search-empty-title {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 700;
  color: #f8fafc;
  margin: 0 0 6px 0;
}

.project-search-empty-text {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 13px;
  color: #cbd5e1;
  margin: 0 0 4px 0;
}

.project-search-empty-subtext {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 12px;
  color: #64748b;
  margin: 0 0 14px 0;
}

.btn-project-reset-search {
  background: var(--mb-accent-primary-glow);
  border: 1px solid var(--mb-border-active);
  color: var(--mb-accent-primary);
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-project-reset-search:hover {
  background: var(--mb-accent-primary);
  color: #ffffff;
}

.project-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 32px 20px;
  background: var(--mb-bg-surface-2);
  border: 1px dashed rgba(255, 255, 255, 0.14);
  border-radius: 12px;
}

.project-empty-icon-wrap {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(56, 189, 248, 0.08);
  border: 1px solid rgba(56, 189, 248, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 12px;
  color: #38bdf8;
}

.project-empty-title {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  margin: 0 0 6px 0;
}

.project-empty-desc {
  font-family: 'Plus Jakarta Sans', system-ui, sans-serif;
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
  max-width: 420px;
  margin: 0 0 14px 0;
}

.project-empty-action-hint {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-empty-focus-draft {
  background: var(--mb-accent-primary-glow);
  border: 1px solid var(--mb-border-active);
  color: var(--mb-accent-primary);
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 6px 14px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-empty-focus-draft:hover {
  background: var(--mb-accent-primary);
  color: #ffffff;
  box-shadow: 0 0 12px var(--mb-accent-primary-glow);
}

.project-row-title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.row-active-project {
  background: rgba(139, 92, 246, 0.06) !important;
  border-color: rgba(139, 92, 246, 0.35) !important;
  box-shadow: none !important;
}

.active-pill-badge {
  font-family: 'Geist Mono', monospace;
  font-size: 9.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.06);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.12);
  letter-spacing: 0.03em;
}

.project-modal-title {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 18px;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
  letter-spacing: -0.02em;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.project-quota-badge {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 500;
  padding: 3px 10px;
  border-radius: 9999px;
  background: rgba(255, 255, 255, 0.04);
  color: #94a3b8;
  border: 1px solid rgba(255, 255, 255, 0.08);
  display: inline-flex;
  align-items: center;
  line-height: 1.2;
  white-space: nowrap;
}

.project-quota-badge.quota-pro {
  color: #c4b5fd;
  background: rgba(139, 92, 246, 0.08);
  border-color: rgba(139, 92, 246, 0.2);
}

.project-quota-badge.quota-full {
  color: #f87171;
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.2);
}

.project-save-section {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  align-items: center;
}

.project-name-input {
  flex: 1;
  min-width: 0;
  background: var(--mb-bg-surface-2);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  padding: 9px 12px;
  min-height: 38px;
  box-sizing: border-box;
  color: #ffffff;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 13px;
  outline: none;
  transition: all 0.15s ease;
}

.project-name-input:focus {
  border-color: var(--mb-accent-primary);
  box-shadow: 0 0 0 2px var(--mb-accent-primary-glow);
}

.btn-project-save-primary {
  background: var(--mb-accent-primary);
  border: none;
  color: #ffffff;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  padding: 9px 16px;
  min-height: 38px;
  border-radius: 8px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  box-sizing: border-box;
  white-space: nowrap;
  transition: all 0.2s ease;
  box-shadow: 0 2px 10px var(--mb-accent-primary-glow);
}
.btn-project-save-primary:hover {
  background: #9d74f7;
  transform: translateY(-1px);
  box-shadow: 0 4px 16px var(--mb-accent-primary-glow);
}

.project-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 290px;
  overflow-y: auto;
  padding: 2px 0;
  margin: 0;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.project-list-row {
  background: var(--mb-bg-surface-2);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.project-list-row:hover {
  background: var(--mb-bg-surface-3);
  border-color: rgba(255, 255, 255, 0.16);
  transform: translateY(-1px);
}

.project-row-info {
  flex: 1;
  min-width: 0;
}

.project-row-title {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: #f8fafc;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-block;
  max-width: 260px;
}

.project-row-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 4px;
  flex-wrap: wrap;
}

.project-meta-chip {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px;
  font-weight: 500;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.07);
  color: #94a3b8;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.15s ease;
}

.project-meta-chip.chip-notes,
.project-meta-chip.chip-bpm,
.project-meta-chip.chip-theme {
  color: #94a3b8;
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.07);
}

.project-list-row:hover .project-meta-chip {
  color: #cbd5e1;
  border-color: rgba(255, 255, 255, 0.1);
}

.project-meta-chip.chip-date {
  display: none;
}
.project-row-actions {
  display: flex;
  align-items: center;
  gap: 5px;
  flex-shrink: 0;
}

.btn-project-load {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 5px 12px;
  min-height: 30px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: all 0.15s ease;
}

.btn-project-load:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

.btn-project-rename {
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #e2e8f0;
  padding: 6px 8px;
  min-height: 30px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.btn-project-rename:hover {
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.project-action-divider {
  width: 1px;
  height: 16px;
  background: rgba(255, 255, 255, 0.12);
  margin: 0 4px;
}

.btn-project-delete {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.25);
  color: #f87171;
  padding: 6px 8px;
  min-height: 30px;
  border-radius: 6px;
  font-size: 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
  transition: all 0.2s ease;
}

.btn-project-delete:hover {
  background: #ef4444;
  color: #ffffff;
  border-color: #ef4444;
  box-shadow: 0 2px 8px rgba(239, 68, 68, 0.35);
}

/* Pricing Modal Styles */
.pricing-plan-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
  margin-top: 20px;
}

.pricing-tier-card {
  background: var(--mb-bg-surface-2);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  position: relative;
}

.pricing-tier-card.featured-tier {
  border-color: #ec4899;
  background: linear-gradient(180deg, rgba(236, 72, 153, 0.1) 0%, var(--mb-bg-surface-2) 100%);
  box-shadow: 0 0 24px rgba(236, 72, 153, 0.2);
}

.tier-featured-pill {
  position: absolute;
  top: -12px;
  left: 50%;
  transform: translateX(-50%);
  background: #ec4899;
  color: #ffffff;
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  font-weight: 800;
  padding: 3px 10px;
  border-radius: 9999px;
  letter-spacing: 0.05em;
}

.tier-price {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 28px;
  font-weight: 800;
  color: #ffffff;
  margin: 8px 0;
}

.tier-price span {
  font-size: 13px;
  font-weight: 500;
  color: #94a3b8;
}

.tier-price-selector {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin: 10px 0;
}

.price-toggle-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 13px;
  color: #e2e8f0;
}

.savings-tag {
  background: rgba(34, 197, 94, 0.2);
  color: #4ade80;
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 700;
}

.tier-features {
  list-style: none;
  padding: 0;
  margin: 14px 0 20px 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 12px;
  color: #cbd5e1;
  flex: 1;
}

.btn-tier-action {
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
}

.btn-tier-pro {
  background: linear-gradient(135deg, #ec4899, #a855f7);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(236, 72, 153, 0.4);
}

.btn-tier-pro:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(236, 72, 153, 0.6);
}

.pricing-guarantee-note {
  text-align: center;
  font-size: 11px;
  color: #64748b;
  margin-top: 18px;
}

/* Export Video Modal Specifics */
.export-modal-card {
  max-width: 500px;
}

.export-modal-card .modal-close-btn {
  top: 20px;
  right: 20px;
}

.export-modal-header {
  text-align: center;
  margin-bottom: 20px;
}

.export-modal-title {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #f8fafc;
  margin: 0;
  letter-spacing: -0.02em;
  text-align: center;
}

.export-config-state {
  width: 100%;
  max-width: 460px;
  margin: 0 auto;
}

.export-instructions {
  text-align: center;
  margin: 12px 0 16px 0;
}

.export-instructions p {
  color: #94a3b8;
  font-size: 13px;
  line-height: 1.5;
  margin: 0;
}

.export-loop-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 10px 14px;
  margin-bottom: 12px;
  gap: 12px;
}

.export-loop-setting label {
  font-size: 13px;
  font-weight: 500;
  color: #e2e8f0;
  margin: 0;
}

.export-loop-select {
  background: #1e293b;
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 6px 12px;
  border-radius: 6px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease;
}

.export-loop-select:focus {
  border-color: #38bdf8;
  box-shadow: 0 0 0 2px rgba(56, 189, 248, 0.25);
}

.export-recording-state {
  text-align: center;
  padding: 24px 12px;
}

.export-spinner-pulse {
  width: 56px;
  height: 56px;
  margin: 0 auto 18px auto;
  border-radius: 50%;
  border: 4px solid rgba(56, 189, 248, 0.2);
  border-top-color: #38bdf8;
  animation: spinExport 1s linear infinite;
}

@keyframes spinExport {
  to { transform: rotate(360deg); }
}

.export-progress-desc {
  font-size: 13px;
  color: #cbd5e1;
  margin: 6px 0 14px 0;
  line-height: 1.5;
}

.export-progress-track {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  overflow: hidden;
  margin: 12px 0 8px 0;
}

.export-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #38bdf8 0%, #818cf8 100%);
  border-radius: 999px;
  transition: width 0.15s ease;
  box-shadow: 0 0 12px rgba(56, 189, 248, 0.5);
}

.export-progress-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: #94a3b8;
  font-family: 'Geist Mono', monospace;
  font-weight: 500;
  margin-bottom: 8px;
}

.btn-export-stop {
  margin-top: 16px;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fca5a5;
  padding: 10px 20px;
  border-radius: 10px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-export-stop:hover {
  background: #ef4444;
  color: #ffffff;
}

.export-preview-state {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: center;
}

.export-video-wrapper {
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000000;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.5);
}

.export-video-preview {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: contain;
}

.export-download-actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.btn-export-download {
  flex: 2;
  background: linear-gradient(135deg, var(--mb-accent-primary) 0%, #7c3aed 100%);
  color: #ffffff;
  padding: 12px 18px;
  border-radius: 10px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px var(--mb-accent-primary-glow);
  transition: all 0.2s ease;
}

.btn-export-download:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--mb-accent-primary-glow);
}

.btn-export-retry {
  flex: 1;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #cbd5e1;
  padding: 12px 16px;
  border-radius: 10px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-export-retry:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #ffffff;
}

.export-plan-status-card {
  background: var(--mb-bg-surface-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 16px;
}

.export-plan-status-card .status-badge {
  font-family: 'Geist Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  color: var(--mb-accent-primary);
  margin-bottom: 10px;
}

.export-plan-status-card.status-pro .status-badge {
  color: #f472b6;
}

.export-plan-status-card .status-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 13px;
  color: #cbd5e1;
}

.btn-export-upgrade-prompt {
  margin-top: 12px;
  width: 100%;
  background: rgba(236, 72, 153, 0.12);
  border: 1px solid rgba(236, 72, 153, 0.35);
  color: #f472b6;
  padding: 8px 12px;
  border-radius: 8px;
  font-size: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-export-upgrade-prompt:hover {
  background: rgba(236, 72, 153, 0.22);
}

.btn-export-start-primary {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, var(--mb-accent-primary) 0%, #7c3aed 100%);
  color: #ffffff;
  border: none;
  padding: 14px 20px;
  border-radius: 12px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: 0 4px 20px var(--mb-accent-primary-glow);
  transition: all 0.2s ease;
  margin-top: 14px;
}

.btn-export-start-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 28px var(--mb-accent-primary-glow);
}

/* ==========================================================================
   DAY 3: AUTHENTICATION & USER PROFILE MODALS
   ========================================================================== */

.auth-modal-card,
.profile-modal-card {
  background: var(--mb-bg-surface-2);
  border: 1px solid var(--mb-border-medium);
  border-radius: var(--mb-radius-lg);
  box-shadow: 0 20px 48px -8px rgba(0, 0, 0, 0.85), 0 0 0 1px var(--mb-border-subtle);
  width: 100%;
  max-width: 480px;
  padding: 30px;
  position: relative;
  max-height: 90vh;
  overflow-y: auto;
}

.auth-modal-header {
  text-align: center;
  margin-bottom: 22px;
}

.auth-modal-icon-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #f8fafc;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 12px;
  box-shadow: none;
}

.auth-modal-icon {
  font-size: 36px;
  margin-bottom: 8px;
}

.auth-modal-title {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 22px;
  font-weight: 800;
  color: #f8fafc;
  margin-bottom: 6px;
}

.auth-modal-subtitle {
  font-size: 13px;
  color: #94a3b8;
  line-height: 1.5;
}

.auth-tabs {
  display: flex;
  background: var(--mb-bg-surface-2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 20px;
  gap: 4px;
}

.auth-tab-btn {
  flex: 1;
  background: transparent;
  border: none;
  color: #94a3b8;
  padding: 10px 14px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-tab-btn:hover {
  color: #f8fafc;
}

.auth-tab-btn.active {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #ffffff;
  box-shadow: none;
}

.auth-error-banner {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  padding: 10px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 18px;
  line-height: 1.4;
  word-break: break-word;
}

.auth-success-banner {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #6ee7b7;
  padding: 12px 14px;
  border-radius: 10px;
  font-size: 13px;
  margin-bottom: 18px;
  line-height: 1.5;
  word-break: break-word;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-label,
.profile-label {
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  font-weight: 600;
  color: #cbd5e1;
}

.auth-input,
.profile-input {
  width: 100%;
  box-sizing: border-box;
  min-width: 0;
  min-height: 44px;
  background: var(--mb-bg-surface-2);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 11px 14px;
  color: #f8fafc;
  font-size: 14px;
  outline: none;
  transition: all 0.2s ease;
}

.auth-input:focus,
.profile-input:focus {
  border-color: #818cf8;
  box-shadow: 0 0 0 3px rgba(129, 140, 248, 0.25);
}

.btn-auth-submit {
  width: 100%;
  background: var(--mb-accent-primary);
  color: #ffffff;
  border: none;
  padding: 12px 18px;
  border-radius: 8px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: none;
  transition: all 0.15s ease;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-auth-submit:hover:not(:disabled) {
  opacity: 0.9;
  box-shadow: none;
}

.btn-auth-submit:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.auth-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 0.6s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.auth-modal-footer {
  margin-top: 20px;
  text-align: center;
  font-size: 13px;
  color: #94a3b8;
}

.auth-switch-link {
  background: none;
  border: none;
  color: var(--mb-accent-primary);
  font-weight: 600;
  cursor: pointer;
  text-decoration: underline;
  margin-left: 4px;
}

.auth-switch-link:hover {
  opacity: 0.85;
}

/* Google OAuth Button & Divider */
.auth-oauth-section {
  margin-bottom: 16px;
}

.btn-oauth-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #ffffff;
  color: #1f2937;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  padding: 10px 16px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.btn-oauth-google:hover:not(:disabled) {
  background: #f8fafc;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.btn-oauth-google:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  background: rgba(255, 255, 255, 0.6);
}

.oauth-google-icon {
  flex-shrink: 0;
}

.oauth-disabled-hint {
  font-size: 11px;
  color: #94a3b8;
  text-align: center;
  margin: 6px 0 0;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 18px 0 14px;
  gap: 10px;
}

.auth-divider-line {
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.12);
}

.auth-divider-text {
  font-size: 12px;
  color: #94a3b8;
  text-transform: lowercase;
  letter-spacing: 0.02em;
}

/* User Avatar in Header */
.user-avatar-img {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  border: 1.5px solid rgba(255, 255, 255, 0.4);
  display: inline-block;
}

#header-auth-icon .user-avatar-img,
#mobile-auth-icon .user-avatar-img {
  width: 18px;
  height: 18px;
}

/* Profile Modal Styles */
.profile-header-section {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.profile-avatar-wrap {
  width: 56px;
  height: 56px;
  min-width: 56px;
  background: #090d16;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #c4b5fd;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
  flex-shrink: 0;
}

.profile-avatar-wrap svg {
  width: 28px;
  height: 28px;
  display: block;
}

.profile-user-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
  flex: 1;
}

.profile-display-name {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 20px;
  font-weight: 800;
  color: #f8fafc;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-email {
  font-family: 'Geist Mono', monospace;
  font-size: 12px;
  color: #94a3b8;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-badge-row {
  display: flex;
  gap: 8px;
  margin-top: 6px;
  flex-wrap: wrap;
  align-items: center;
}

.user-tier-pill {
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 9999px;
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  font-weight: 600;
  padding: 2.5px 8px;
}

.user-tier-pill.tier-free {
  background: rgba(255, 255, 255, 0.05);
  color: #cbd5e1;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.user-tier-pill.tier-pro {
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.35);
  color: #c4b5fd;
}

.member-since-pill {
  font-family: 'Geist Mono', monospace;
  font-size: 10px;
  color: #64748b;
  padding: 2px 6px;
}

.profile-plan-box {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.profile-plan-box.plan-box-free {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: none;
}

.profile-plan-box.plan-box-pro {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12) 0%, rgba(124, 58, 237, 0.05) 100%);
  border: 1px solid rgba(139, 92, 246, 0.35);
  box-shadow: 0 4px 16px rgba(124, 58, 237, 0.08);
}

.profile-plan-box h4 {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 14px;
  font-weight: 800;
  color: #f8fafc;
  margin: 0 0 4px 0;
}

.profile-plan-box.plan-box-pro h4 {
  color: #c4b5fd;
}

.profile-plan-box p {
  font-size: 12px;
  color: #94a3b8;
  margin: 0;
  line-height: 1.4;
}

.btn-profile-upgrade {
  background: var(--mb-accent-primary);
  color: #ffffff;
  border: none;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition: all 0.15s ease;
  box-shadow: none;
}

.btn-profile-upgrade:hover {
  opacity: 0.9;
  box-shadow: none;
}

.profile-plan-status-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
}

.profile-plan-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  background: rgba(34, 197, 94, 0.15);
  border: 1px solid rgba(34, 197, 94, 0.35);
  border-radius: 9999px;
  color: #4ade80;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.btn-manage-subscription {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f1f5f9;
  padding: 8px 16px;
  border-radius: 8px;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  align-self: flex-start;
  transition: all 0.15s ease;
}

.btn-manage-subscription:hover:not(:disabled) {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.28);
  color: #ffffff;
}

.btn-manage-subscription:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.profile-feedback-text {
  font-size: 12px;
  color: #f87171;
  margin-top: 4px;
  line-height: 1.4;
}

.profile-modal-footer {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 16px;
}

.btn-profile-logout {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #e2e8f0;
  padding: 8px 16px;
  border-radius: 8px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-profile-logout:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

/* Profile Modal - Change Password Collapsible Section */
.profile-change-password-wrapper {
  margin-top: 14px;
  margin-bottom: 4px;
}

.profile-change-password-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  min-height: 44px;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: #cbd5e1;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
  text-align: left;
}

.profile-change-password-toggle:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  color: #ffffff;
}

.profile-change-password-toggle:focus-visible {
  outline: none;
  border-color: #818cf8;
  box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.25);
}

.profile-change-password-toggle-label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-change-password-icon {
  color: #94a3b8;
  flex-shrink: 0;
}

.profile-collapse-arrow {
  font-size: 12px;
  color: #94a3b8;
  transition: transform 0.2s ease;
  display: inline-block;
}

.profile-change-password-toggle.expanded .profile-collapse-arrow {
  transform: rotate(180deg);
}

.profile-change-password-section {
  margin-top: 10px;
  padding: 14px;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  box-sizing: border-box;
}

.profile-change-password-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.profile-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.profile-password-alert {
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 12.5px;
  line-height: 1.4;
  word-break: break-word;
  box-sizing: border-box;
}

.profile-password-alert-error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  color: #f87171;
}

.profile-password-alert-success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.35);
  color: #4ade80;
  margin-top: 8px;
}

.profile-password-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.btn-profile-password-cancel {
  min-height: 44px;
  padding: 10px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  color: #94a3b8;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
}

.btn-profile-password-cancel:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.2);
  color: #f1f5f9;
}

.btn-profile-password-save {
  min-height: 44px;
  padding: 10px 20px;
  background: var(--mb-accent-primary, #6366f1);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  box-sizing: border-box;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-profile-password-save:hover:not(:disabled) {
  opacity: 0.9;
}

.btn-profile-password-save:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* ==========================================================================
   14. METRICBALL TEMPLATE GALLERY (DAY 13B)
   ========================================================================== */

.template-gallery-header {
  margin-bottom: 22px;
  text-align: left;
}

.template-gallery-badge {
  display: inline-block;
  font-family: 'JetBrains Mono', monospace;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #818cf8;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  padding: 4px 10px;
  border-radius: 9999px;
  margin-bottom: 10px;
}

.template-gallery-title {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 24px;
  font-weight: 800;
  color: #f8fafc;
  margin: 0 0 6px 0;
  letter-spacing: -0.02em;
}

.template-gallery-subtitle {
  font-size: 13.5px;
  color: #94a3b8;
  margin: 0 0 16px 0;
  line-height: 1.5;
  max-width: 640px;
}

/* Filter Bar */
.template-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding-top: 4px;
}

.template-tab-btn {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: #94a3b8;
  padding: 6px 14px;
  border-radius: 9999px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.18s ease;
}

.template-tab-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #f1f5f9;
  border-color: rgba(255, 255, 255, 0.2);
}

.template-tab-btn.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: #818cf8;
  color: #ffffff;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

/* Gallery Grid */
.template-gallery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(248px, 1fr));
  gap: 18px;
  margin-top: 4px;
}

/* Template Card */
.template-card {
  background: var(--mb-bg-surface-2);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1),
              border-color 0.2s ease,
              box-shadow 0.2s ease,
              background-color 0.2s ease;
  cursor: pointer;
}

.template-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 255, 255, 0.25);
  box-shadow: 0 12px 28px -6px rgba(0, 0, 0, 0.6);
  background: var(--mb-bg-surface-3);
}

.template-card:focus-visible {
  outline: 2px solid #818cf8;
  outline-offset: 2px;
}

.template-card-selected {
  border-color: #6366f1;
  background: rgba(30, 41, 79, 0.85);
  box-shadow: 0 0 0 1px #6366f1, 0 8px 30px -4px rgba(99, 102, 241, 0.4);
}

.template-card-selected:hover {
  border-color: #818cf8;
  box-shadow: 0 0 0 1px #818cf8, 0 12px 34px -4px rgba(99, 102, 241, 0.5);
}

/* Selected Badge */
.template-selected-badge {
  position: absolute;
  top: 10px;
  right: 10px;
  background: #4f46e5;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 8px;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 4px;
  z-index: 5;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}

.template-selected-badge .badge-check {
  font-weight: 900;
}

/* Preview Area */
.template-preview-wrap {
  position: relative;
  width: 100%;
  height: 120px;
  background: var(--mb-bg-surface-1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.template-preview-screen {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.template-preview-svg {
  width: 100%;
  height: 100%;
  display: block;
}

.template-category-tag {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(4, 6, 14, 0.7);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
  text-transform: capitalize;
}

.template-category-tag .tag-icon {
  color: #818cf8;
}

/* Card Body */
.template-card-body {
  padding: 14px 14px 10px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
}

.template-card-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.template-card-name {
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 15px;
  font-weight: 700;
  color: #f8fafc;
  margin: 0;
  letter-spacing: -0.01em;
}

.template-card-desc {
  font-size: 12px;
  color: #94a3b8;
  margin: 0;
  line-height: 1.45;
  min-height: 34px;
}

/* Spec Chips */
.template-spec-chips {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.spec-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 600;
  color: #cbd5e1;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  padding: 2px 7px;
  border-radius: 6px;
}

.spec-chip .color-dot {
  width: 8px;
  height: 8px;
  border-radius: 9999px;
  box-shadow: 0 0 6px currentColor;
}

/* Card Footer */
.template-card-footer {
  padding: 0 14px 14px;
  margin-top: auto;
}

.btn-template-select {
  width: 100%;
  min-height: 38px;
  border-radius: 9px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(255, 255, 255, 0.07);
  color: #f1f5f9;
  font-family: 'Outfit', system-ui, sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.18s ease;
}

.btn-template-select:hover:not(:disabled) {
  background: rgba(99, 102, 241, 0.2);
  border-color: #818cf8;
  color: #ffffff;
  box-shadow: 0 2px 10px rgba(99, 102, 241, 0.3);
}

.btn-template-select.btn-template-active,
.btn-template-select:disabled {
  background: rgba(99, 102, 241, 0.25);
  border-color: #6366f1;
  color: #c7d2fe;
  cursor: default;
}

/* Empty State */
.template-gallery-empty {
  grid-column: 1 / -1;
  text-align: center;
  padding: 40px 20px;
  background: var(--mb-bg-surface-2);
  border: 1px dashed rgba(255, 255, 255, 0.12);
  border-radius: 16px;
}

.template-gallery-empty .empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.template-gallery-empty h3 {
  font-size: 16px;
  color: #f8fafc;
  margin: 0 0 4px 0;
}

.template-gallery-empty p {
  font-size: 13px;
  color: #94a3b8;
  margin: 0;
}

/* Responsive Overrides */
@media (max-width: 768px) {
  .template-gallery-card {
    padding: 20px 16px;
    border-radius: 16px;
    max-width: 100%;
  }

  .template-gallery-title {
    font-size: 20px;
  }

  .template-gallery-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .btn-template-select {
    min-height: 44px;
  }


  /* Profile Modal Change Password Responsive */
  .profile-change-password-toggle {
    min-height: 44px;
  }
  .profile-change-password-section {
    padding: 12px;
  }
  .btn-profile-password-cancel,
  .btn-profile-password-save {
    min-height: 44px;
  }
  /* Theme selector popover viewport constraint */
  .theme-selector-popover {
    position: fixed !important;
    top: 52px !important;
    right: 8px !important;
    left: auto !important;
    width: min(340px, calc(100vw - 16px)) !important;
    max-width: calc(100vw - 16px) !important;
    z-index: 10050 !important;
    box-sizing: border-box !important;
  }

  /* Note Contextual Popover Mobile Bottom Sheet */
  .stage-popover-backdrop {
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.65) !important;
    backdrop-filter: blur(4px) !important;
    -webkit-backdrop-filter: blur(4px) !important;
    z-index: 2999 !important;
    animation: popover-fade 0.15s ease-out !important;
  }

  .stage-note-popover {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    max-width: 100vw !important;
    border-radius: 20px 20px 0 0 !important;
    border: 1px solid var(--mb-border-subtle, rgba(255, 255, 255, 0.15)) !important;
    border-bottom: none !important;
    background: var(--mb-bg-surface-2, #161b26) !important;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.85) !important;
    max-height: 80dvh !important;
    overflow-y: auto !important;
    padding: 12px 18px max(28px, env(safe-area-inset-bottom, 28px)) 18px !important;
    transform: none !important;
    z-index: 3000 !important;
    animation: sheet-slide-up 0.22s cubic-bezier(0.16, 1, 0.3, 1) !important;
    box-sizing: border-box !important;
  }

  /* Stage containers scrolling containment */
  .stage-viewport-frame {
    overflow: hidden !important;
  }
  .stage-canvas-outer.chalkboard-container {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch !important;
    max-height: 100% !important;
    height: 100% !important;
  }
  body.mobile-sheet-open .floating-transport-dock {
    display: none !important;
  }
  body.mobile-sheet-open .mobile-workspace-tabs {
    pointer-events: none;
  }

  .stage-popover-drag-handle {
    display: block !important;
    width: 36px !important;
    height: 4px !important;
    border-radius: 2px !important;
    background: rgba(255, 255, 255, 0.25) !important;
    margin: 0 auto 10px auto !important;
  }

  .stage-popover-header {
    margin-bottom: 12px !important;
    padding-bottom: 10px !important;
  }

  .stage-popover-title {
    font-size: 15px !important;
  }

  .stage-popover-close-btn {
    min-width: 34px !important;
    min-height: 34px !important;
  }

  .stage-popover-select {
    height: 44px !important;
    font-size: 14px !important;
    padding: 0 12px !important;
  }

  .stage-popover-acc-btn {
    height: 44px !important;
    font-size: 14px !important;
  }

  .stage-popover-piano-btn {
    min-height: 44px !important;
    font-size: 13.5px !important;
  }

  .stage-popover-btn-secondary,
  .stage-popover-btn-danger {
    min-height: 44px !important;
    font-size: 13.5px !important;
  }
  /* Project Manager Mobile Flow & Polish */
  .project-modal-card {
    padding: 16px 14px !important;
    border-radius: 18px !important;
    width: min(92vw, 480px) !important;
    max-width: min(92vw, 480px) !important;
    max-height: min(84vh, 84dvh) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
  }
  .project-modal-card .modal-close-btn {
    top: 14px !important;
    right: 14px !important;
  }

  .project-modal-header {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 8px !important;
    padding-right: 36px !important;
  }

  .project-header-left {
    display: flex !important;
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 6px !important;
    width: 100% !important;
    min-width: 0 !important;
  }

  .project-modal-title {
    font-size: 16px !important;
    white-space: normal !important;
    line-height: 1.25 !important;
    word-break: break-word !important;
  }

  .project-quota-badge {
    font-size: 10.5px !important;
    padding: 2.5px 8px !important;
    white-space: normal !important;
    line-height: 1.2 !important;
  }

  .project-header-right {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 8px !important;
    width: 100% !important;
    margin-right: 0 !important;
    margin-top: 4px !important;
  }

  .btn-create-new-proj {
    width: 100% !important;
    justify-content: center !important;
  }

  .project-active-banner {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    padding: 10px 12px !important;
  }

  .project-active-info {
    display: flex !important;
    align-items: center !important;
    flex-wrap: wrap !important;
    gap: 6px !important;
  }

  .active-project-title {
    font-size: 14px !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    max-width: 100% !important;
  }

  .project-active-actions {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    width: 100% !important;
    justify-content: flex-start !important;
  }

  .project-active-actions .btn-project-action-save,
  .project-active-actions .btn-project-action-secondary {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
  }

  .project-form-row,
  .project-draft-input-row {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
    width: 100% !important;
  }

  .project-form-row .project-name-input,
  .project-draft-input-row .project-name-input {
    width: 100% !important;
    box-sizing: border-box !important;
  }

  .project-form-row .btn-project-save-primary,
  .project-draft-input-row .btn-project-save-primary,
  .project-form-row .btn-project-cancel,
  .project-draft-input-row .btn-project-cancel {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
  }

  .project-list-row {
    display: flex !important;
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    padding: 10px 12px !important;
    border-radius: 12px !important;
  }

  .project-row-info {
    width: 100% !important;
    min-width: 0 !important;
    flex: 1 1 auto !important;
  }

  .project-row-title-wrap {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 6px !important;
    width: 100% !important;
  }

  .project-row-title {
    font-size: 13.5px !important;
    font-weight: 700 !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    flex: 1 1 auto !important;
    min-width: 0 !important;
  }

  .active-pill-badge {
    font-size: 9px !important;
    padding: 2px 6px !important;
    white-space: nowrap !important;
    flex-shrink: 0 !important;
  }

  .project-row-meta {
    display: flex !important;
    align-items: center !important;
    flex-wrap: nowrap !important;
    gap: 6px !important;
    margin-top: 4px !important;
    overflow-x: auto !important;
    scrollbar-width: none !important;
    -webkit-overflow-scrolling: touch !important;
  }

  .project-row-meta::-webkit-scrollbar {
    display: none !important;
  }

  .project-meta-chip {
    white-space: nowrap !important;
    font-size: 10px !important;
    padding: 2px 6px !important;
    flex-shrink: 0 !important;
  }

  .project-meta-chip svg {
    width: 10px !important;
    height: 10px !important;
    flex-shrink: 0 !important;
  }

  .project-row-actions {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 6px !important;
    width: 100% !important;
    padding-top: 6px !important;
    border-top: 1px solid rgba(255, 255, 255, 0.06) !important;
  }

  .btn-project-load {
    flex: 1 1 auto !important;
    min-height: 32px !important;
    font-size: 12px !important;
    font-weight: 700 !important;
    justify-content: center !important;
    text-align: center !important;
  }

  .btn-project-rename,
  .btn-project-delete {
    flex: 0 0 34px !important;
    min-height: 32px !important;
    min-width: 34px !important;
    padding: 0 !important;
    justify-content: center !important;
  }

  .project-action-divider {
    display: none !important;
  }
  .project-search-box {
    min-width: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }

  .project-list-heading-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  /* Export Video Modal Mobile Flow & Polish */
  .export-modal-card {
    padding: 16px 14px !important;
    border-radius: 18px !important;
    width: min(92vw, 460px) !important;
    max-width: min(92vw, 460px) !important;
    max-height: min(84vh, 84dvh) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    box-sizing: border-box !important;
  }

  .export-modal-card .modal-close-btn {
    top: 14px !important;
    right: 14px !important;
  }

  .export-modal-header {
    text-align: left !important;
    margin-bottom: 12px !important;
    padding-right: 36px !important;
  }

  .export-modal-title {
    font-size: 17px !important;
    font-weight: 700 !important;
    text-align: left !important;
    line-height: 1.3 !important;
    white-space: normal !important;
    word-break: break-word !important;
  }

  .export-config-state {
    max-width: 100% !important;
  }

  .export-plan-status-card {
    padding: 12px !important;
    margin-bottom: 10px !important;
    border-radius: 12px !important;
  }

  .export-plan-status-card .status-details {
    font-size: 12px !important;
    gap: 4px !important;
  }

  .btn-export-upgrade-prompt {
    flex-direction: column !important;
    align-items: flex-start !important;
    gap: 4px !important;
    padding: 8px 10px !important;
    text-align: left !important;
    margin-top: 10px !important;
  }

  .btn-export-upgrade-prompt span {
    font-size: 11.5px !important;
    line-height: 1.3 !important;
  }

  .btn-export-upgrade-prompt .prompt-link {
    font-weight: 700 !important;
  }

  .export-instructions {
    margin: 8px 0 12px 0 !important;
  }

  .export-instructions p {
    font-size: 12px !important;
    line-height: 1.4 !important;
  }

  .export-loop-setting {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 6px !important;
    padding: 8px 12px !important;
    margin-bottom: 10px !important;
  }

  .export-loop-setting label {
    font-size: 12px !important;
  }

  .export-loop-select {
    width: 100% !important;
    box-sizing: border-box !important;
    font-size: 12px !important;
    padding: 8px 10px !important;
  }

  .btn-export-start-primary {
    width: 100% !important;
    padding: 12px 16px !important;
    font-size: 14px !important;
    min-height: 44px !important;
    margin-top: 10px !important;
    box-sizing: border-box !important;
    justify-content: center !important;
  }

  .export-download-actions {
    flex-direction: column !important;
    gap: 8px !important;
  }

  .btn-export-download,
  .btn-export-retry {
    width: 100% !important;
    min-height: 42px !important;
    box-sizing: border-box !important;
    justify-content: center !important;
    text-align: center !important;
  }
  /* Custom Builder Slots Mobile Spacing */
  .slots-container {
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 6px !important;
  }

  .slot-card {
    min-height: 44px;
  }

  /* Mobile bottom clearance & tight gap to control panel */
  .app-shell {
    padding-bottom: calc(64px + env(safe-area-inset-bottom, 8px)) !important;
  }
  .bento-sidebar-column {
    height: 100% !important;
    flex: 1 1 auto !important;
  }
  .bento-palette-card,
  .bento-card[data-mobile-workspace] {
    height: 100% !important;
    flex: 1 1 auto !important;
    margin-bottom: 2px !important;
  }
  .palette-sections-scroller {
    flex: 1 1 auto !important;
  }
}

@media (max-width: 480px) {
  .template-gallery-title {
    font-size: 18px;
  }

  .template-gallery-subtitle {
    font-size: 12.5px;
  }

  .template-preview-wrap {
    height: 105px;
  }

  .template-tab-btn {
    padding: 5px 10px;
    font-size: 11.5px;
  }


  /* Profile Modal Change Password Mobile Narrow */
  .profile-password-actions {
    flex-direction: column-reverse;
    gap: 8px;
    width: 100%;
  }
  .btn-profile-password-cancel,
  .btn-profile-password-save {
    width: 100%;
    min-height: 44px;
    text-align: center;
    justify-content: center;
  }
  .theme-selector-popover {
    z-index: 10050 !important;
  }
  /* Header compacting for ultra-narrow mobile viewports */
  .header-tool-btn span,
  .btn-pricing-accent:not(.mobile-header-upgrade-btn) span {
    display: none !important;
  }

  .header-tool-btn,
  .header-action-btn {
    padding: 3px 6px !important;
    min-width: 28px;
    justify-content: center;
  }

  .mobile-tab-btn {
    font-size: 11px !important;
    padding: 6px 4px !important;
    white-space: nowrap !important;
  }

  .brand-badge-pill {
    padding: 2px 5px !important;
    font-size: 10.5px !important;
  }

  .save-status-badge {
    font-size: 9.5px !important;
    padding: 2px 5px !important;
  }

  .mobile-metric-badge {
    font-size: 10px !important;
    padding: 0 8px !important;
  }

  .theme-selector-btn {
    padding: 0 6px !important;
    font-size: 10.5px !important;
  }

  /* Project Modal Narrow Input Stacking */
  .project-draft-input-row,
  .project-form-row {
    flex-direction: column !important;
    align-items: stretch !important;
    gap: 8px !important;
  }

  .project-draft-input-row .btn-project-save-primary,
  .project-draft-input-row .btn-project-cancel,
  .project-form-row .btn-project-save-primary,
  .project-form-row .btn-project-cancel {
    width: 100% !important;
    justify-content: center !important;
    text-align: center !important;
  }
}

/* ==========================================================================
   ADMIN PRESET MODAL & ROLE MANAGEMENT
   ========================================================================== */

.badge-admin {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.3));
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.btn-admin-trigger {
  border-color: rgba(239, 68, 68, 0.25) !important;
}

.btn-admin-trigger:hover {
  border-color: rgba(239, 68, 68, 0.5) !important;
  background: rgba(239, 68, 68, 0.1) !important;
  color: #fca5a5 !important;
}

.admin-modal-card {
  max-width: 720px;
}

.admin-modal-body {
  display: flex;
  flex-direction: column;
  gap: 18px;
  margin-top: 14px;
}

.admin-status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 12px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.03);
}

.admin-status-banner.status-active {
  background: rgba(239, 68, 68, 0.08);
  border-color: rgba(239, 68, 68, 0.3);
  color: #fecaca;
}

.admin-status-banner.status-guest {
  background: rgba(148, 163, 184, 0.06);
  border-color: rgba(148, 163, 184, 0.2);
  color: #cbd5e1;
}

.admin-status-info {
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.admin-status-dot.dot-active {
  background: #ef4444;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.6);
}

.admin-status-dot.dot-inactive {
  background: #94a3b8;
}

.btn-admin-role-toggle {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #f8fafc;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-admin-role-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.admin-feedback-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 12px;
  animation: fadeInModal 0.2s ease;
}

.admin-feedback-banner.success {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.admin-feedback-banner.error {
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #fca5a5;
}

.admin-action-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.admin-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.admin-card-title-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.admin-card-heading {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  color: #f1f5f9;
}

.admin-canvas-info-badge,
.admin-count-badge {
  background: rgba(99, 102, 241, 0.15);
  border: 1px solid rgba(99, 102, 241, 0.3);
  color: #a5b4fc;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 9999px;
}

.admin-preset-note-tag {
  font-size: 11px;
  color: #94a3b8;
  font-style: italic;
}

.admin-card-desc {
  margin: 0;
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
}

.admin-create-form-row {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-top: 4px;
}

.admin-text-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 10px;
  padding: 9px 12px;
  color: #f8fafc;
  font-size: 13px;
  font-family: inherit;
  outline: none;
  transition: border-color 0.15s ease;
}

.admin-text-input:focus {
  border-color: #6366f1;
}

.admin-text-input:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.admin-create-tier-toggle {
  display: inline-flex;
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
  flex-shrink: 0;
}

.btn-tier-segment {
  background: transparent;
  border: none;
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.btn-tier-segment:hover:not(:disabled) {
  color: #f8fafc;
}

.btn-tier-segment.active {
  background: #4f46e5;
  color: #ffffff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

.btn-tier-segment:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.admin-tier-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all 0.15s ease;
  line-height: 1.2;
}

.admin-tier-badge-btn.tier-free {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border-color: rgba(16, 185, 129, 0.3);
}

.admin-tier-badge-btn.tier-free:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: rgba(16, 185, 129, 0.5);
}

.admin-tier-badge-btn.tier-pro {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.35);
}

.admin-tier-badge-btn.tier-pro:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: rgba(245, 158, 11, 0.6);
}

.btn-admin-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #4f46e5, #6366f1);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  padding: 9px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-admin-primary:hover:not(:disabled) {
  filter: brightness(1.1);
  transform: translateY(-1px);
}

.btn-admin-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.admin-hint-warn {
  margin: 0;
  font-size: 11.5px;
  color: #fbbf24;
}

.admin-preset-items-container {
  max-height: 280px;
  overflow-y: auto;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  background: rgba(0, 0, 0, 0.2);
}

.admin-preset-list {
  display: flex;
  flex-direction: column;
}

.admin-preset-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  transition: background 0.15s ease;
}

.admin-preset-row:last-child {
  border-bottom: none;
}

.admin-preset-row:hover {
  background: rgba(255, 255, 255, 0.03);
}

.admin-preset-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.admin-preset-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.admin-preset-name {
  font-size: 13px;
  font-weight: 600;
  color: #f1f5f9;
}

.admin-preset-badge {
  font-size: 10.5px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  padding: 1px 6px;
  border-radius: 6px;
}

.admin-preset-subtext {
  font-size: 11px;
  color: #64748b;
}

.admin-preset-subtext code {
  font-family: monospace;
  font-size: 10.5px;
  color: #94a3b8;
}

.admin-preset-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}

.btn-admin-item-action {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #cbd5e1;
  font-size: 11px;
  font-weight: 500;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-admin-item-action:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
}

.btn-admin-load:hover {
  border-color: rgba(99, 102, 241, 0.4);
  color: #a5b4fc;
}

.btn-admin-update:hover {
  border-color: rgba(34, 197, 94, 0.4);
  color: #86efac;
}

.btn-admin-delete:hover {
  border-color: rgba(239, 68, 68, 0.4);
  color: #fca5a5;
}

.admin-inline-rename-form {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}

.admin-rename-input {
  flex: 1;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid #6366f1;
  color: #ffffff;
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12.5px;
}

.admin-rename-actions {
  display: flex;
  gap: 4px;
}

.btn-admin-small {
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.btn-admin-confirm-rename {
  background: #4f46e5;
  color: #ffffff;
}

.btn-admin-cancel-rename {
  background: rgba(255, 255, 255, 0.08);
  color: #94a3b8;
}

.admin-empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 30px 20px;
  text-align: center;
  gap: 6px;
}

.admin-empty-icon {
  font-size: 28px;
  margin-bottom: 4px;
}

.admin-empty-title {
  margin: 0;
  font-size: 13.5px;
  font-weight: 600;
  color: #f1f5f9;
}

.admin-empty-desc {
  margin: 0;
  font-size: 11.5px;
  color: #94a3b8;
  max-width: 440px;
  line-height: 1.5;
}

.btn-composer-admin-link {
  color: #fca5a5 !important;
  border-color: rgba(239, 68, 68, 0.3) !important;
}

.btn-composer-admin-link:hover {
  background: rgba(239, 68, 68, 0.1) !important;
}

.dev-dropdown-separator {
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
  margin: 4px 0;
}

.dev-dropdown-section-title {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #94a3b8;
  padding: 2px 8px;
}

.role-option-btn {
  background: none;
  border: none;
  color: #94a3b8;
  font-size: 11.5px;
  font-weight: 600;
  padding: 6px 10px;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  transition: all 0.15s ease;
}

.role-option-btn:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #f8fafc;
}

.role-option-btn.active {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  font-weight: 700;
}


/* ---- Locked Preset Mode & Interaction Protection ---- */
.playground-locked-disabled {
  opacity: 0.4 !important;
  cursor: not-allowed !important;
}

.playground-locked-disabled button,
.playground-locked-disabled input,
.playground-locked-disabled select,
.playground-locked-disabled .gp8-btn {
  cursor: not-allowed !important;
}

#stage.playground-locked-mode,
#editor.playground-locked-mode {
  cursor: default !important;
}

.preset-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--mb-bg-surface-2);
  border: 1px solid rgba(6, 182, 212, 0.35);
  border-radius: var(--mb-radius-full);
  padding: 3px 10px;
  font-size: 11.5px;
  font-weight: var(--mb-weight-semibold);
  color: #cffafe;
  box-shadow: 0 2px 8px rgba(6, 182, 212, 0.15);
}

.preset-status-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.btn-exit-preset {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #fca5a5;
  border-radius: var(--mb-radius-full);
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-exit-preset:hover {
  background: rgba(239, 68, 68, 0.35);
  color: #ffffff;
}

.btn-save-preset-badge {
  background: rgba(6, 182, 212, 0.25);
  border: 1px solid rgba(6, 182, 212, 0.5);
  color: #cffafe;
  border-radius: var(--mb-radius-full);
  padding: 2px 8px;
  font-size: 10.5px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-save-preset-badge:hover {
  background: rgba(6, 182, 212, 0.45);
  color: #ffffff;
}

/* ==========================================================================
   Standalone Public Pages Styles (Pricing, Terms, Privacy, Refunds)
   ========================================================================== */
.legal-page-body {
  background-color: var(--mb-bg-canvas, #0b0d0f);
  color: var(--mb-text-primary, #f8fafc);
  font-family: var(--mb-font-ui, 'Plus Jakarta Sans', system-ui, sans-serif);
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow-x: hidden;
  overflow-y: auto !important;
  -webkit-font-smoothing: antialiased;
}

.legal-page-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--mb-space-lg, 16px);
}

/* Navigation */
.legal-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--mb-space-lg, 16px) 0;
  border-bottom: 1px solid var(--mb-border-subtle, rgba(255, 255, 255, 0.07));
  margin-bottom: var(--mb-space-2xl, 32px);
}

.legal-nav-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--mb-text-primary, #f8fafc);
}

.legal-nav-brand-text {
  font-family: var(--mb-font-brand, 'Outfit', system-ui, sans-serif);
  font-size: var(--mb-text-xl, 18px);
  font-weight: 800;
  letter-spacing: -0.02em;
}

.btn-legal-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--mb-bg-surface-2, #1c2025);
  border: 1px solid var(--mb-border-medium, rgba(255, 255, 255, 0.14));
  border-radius: var(--mb-radius-full, 9999px);
  color: var(--mb-text-primary, #f8fafc);
  font-size: var(--mb-text-sm, 12px);
  font-weight: 600;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-legal-back:hover {
  background: var(--mb-bg-surface-3, #262c33);
  border-color: var(--mb-accent-primary, #d98b6e);
  transform: translateY(-1px);
}

/* Main Content Container */
.legal-main-content {
  flex: 1;
  max-width: 860px;
  margin: 0 auto;
  width: 100%;
  padding-bottom: var(--mb-space-3xl, 48px);
}

/* Header Banner */
.legal-doc-header {
  text-align: center;
  margin-bottom: var(--mb-space-2xl, 32px);
}

.legal-doc-title {
  font-family: var(--mb-font-brand, 'Outfit', system-ui, sans-serif);
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #ffffff;
  margin: 12px 0 8px 0;
}

.legal-doc-meta {
  font-size: var(--mb-text-sm, 12px);
  color: var(--mb-text-muted, #8492a6);
  font-family: var(--mb-font-mono, 'Geist Mono', monospace);
}

/* Body Text & Article */
.legal-doc-body {
  background: var(--mb-bg-surface-1, #14171a);
  border: 1px solid var(--mb-border-subtle, rgba(255, 255, 255, 0.07));
  border-radius: var(--mb-radius-lg, 18px);
  padding: var(--mb-space-2xl, 32px);
  box-shadow: var(--mb-shadow-card);
}

.legal-section {
  margin-bottom: 28px;
}

.legal-section:last-child {
  margin-bottom: 0;
}

.legal-section h2 {
  font-family: var(--mb-font-brand, 'Outfit', system-ui, sans-serif);
  font-size: 1.25rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  padding-bottom: 6px;
}

.legal-section p {
  font-size: var(--mb-text-md, 14px);
  line-height: 1.65;
  color: var(--mb-text-secondary, #cbd5e1);
  margin: 0 0 12px 0;
}

.legal-section ul,
.legal-section ol {
  padding-left: 20px;
  margin: 0 0 14px 0;
  color: var(--mb-text-secondary, #cbd5e1);
  font-size: var(--mb-text-md, 14px);
  line-height: 1.65;
}

.legal-section li {
  margin-bottom: 8px;
}

.legal-inline-link {
  color: var(--mb-accent-music, #06b6d4);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s ease;
}

.legal-inline-link:hover {
  color: #38bdf8;
}

.legal-contact-details {
  list-style: none;
  padding-left: 0 !important;
}

.legal-contact-details li {
  background: var(--mb-bg-surface-2, #1c2025);
  border: 1px solid var(--mb-border-subtle, rgba(255, 255, 255, 0.07));
  border-radius: var(--mb-radius-sm, 8px);
  padding: 10px 14px;
  margin-bottom: 8px;
  font-size: 13px;
}

/* Pricing Page Custom Layout */
.pricing-page-hero {
  text-align: center;
  margin-bottom: var(--mb-space-2xl, 32px);
}

.pricing-page-title {
  font-family: var(--mb-font-brand, 'Outfit', system-ui, sans-serif);
  font-size: 2.5rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  color: #ffffff;
  margin: 12px 0 8px 0;
}

.pricing-page-subtitle {
  font-size: var(--mb-text-lg, 16px);
  color: var(--mb-text-muted, #8492a6);
  max-width: 620px;
  margin: 0 auto;
  line-height: 1.5;
}

.pricing-page-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 24px;
}

@media (max-width: 768px) {
  .pricing-page-grid {
    grid-template-columns: 1fr;
  }
  .pricing-page-title {
    font-size: 1.85rem;
  }
}

/* FAQ Section */
.pricing-faq-section {
  margin-top: var(--mb-space-3xl, 48px);
}

.faq-section-title {
  font-family: var(--mb-font-brand, 'Outfit', system-ui, sans-serif);
  font-size: 1.75rem;
  font-weight: 700;
  color: #ffffff;
  text-align: center;
  margin-bottom: 28px;
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px;
}

@media (max-width: 768px) {
  .faq-grid {
    grid-template-columns: 1fr;
  }
}

.faq-item {
  background: var(--mb-bg-surface-1, #14171a);
  border: 1px solid var(--mb-border-subtle, rgba(255, 255, 255, 0.07));
  border-radius: var(--mb-radius-md, 14px);
  padding: 20px;
}

.faq-question {
  font-family: var(--mb-font-brand, 'Outfit', system-ui, sans-serif);
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 8px 0;
}

.faq-answer {
  font-size: 13px;
  line-height: 1.6;
  color: var(--mb-text-secondary, #cbd5e1);
  margin: 0;
}

/* CTA Banner */
.pricing-cta-card {
  margin-top: var(--mb-space-3xl, 48px);
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.15) 0%, rgba(236, 72, 153, 0.15) 100%);
  border: 1px solid rgba(139, 92, 246, 0.3);
  border-radius: var(--mb-radius-lg, 18px);
  padding: 36px 24px;
  text-align: center;
}

.pricing-cta-title {
  font-family: var(--mb-font-brand, 'Outfit', system-ui, sans-serif);
  font-size: 1.65rem;
  font-weight: 800;
  color: #ffffff;
  margin: 0 0 8px 0;
}

.pricing-cta-desc {
  color: var(--mb-text-secondary, #cbd5e1);
  font-size: 14px;
  margin: 0 0 20px 0;
}

.btn-legal-cta {
  display: inline-block;
  background: linear-gradient(135deg, #8b5cf6 0%, #ec4899 100%);
  color: #ffffff;
  font-family: var(--mb-font-brand, 'Outfit', system-ui, sans-serif);
  font-size: 14px;
  font-weight: 700;
  padding: 12px 28px;
  border-radius: var(--mb-radius-full, 9999px);
  text-decoration: none;
  box-shadow: 0 4px 18px rgba(139, 92, 246, 0.4);
  transition: all 0.2s ease;
}

.btn-legal-cta:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(139, 92, 246, 0.6);
}

/* Shared Standalone Footer */
.legal-page-footer {
  border-top: 1px solid var(--mb-border-subtle, rgba(255, 255, 255, 0.07));
  padding: var(--mb-space-xl, 24px) 0;
  margin-top: auto;
}

.legal-footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}

.legal-brand-name {
  font-family: var(--mb-font-brand, 'Outfit', system-ui, sans-serif);
  font-size: 14px;
  font-weight: 700;
  color: #ffffff;
}

.legal-footer-copyright,
.legal-footer-mor {
  font-size: 11px;
  color: var(--mb-text-muted, #8492a6);
  margin: 2px 0 0 0;
}

.legal-footer-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.legal-footer-nav a {
  color: var(--mb-text-muted, #8492a6);
  font-size: 12px;
  text-decoration: none;
  transition: color 0.15s ease;
}

.legal-footer-nav a:hover,
.legal-footer-nav a[aria-current="page"] {
  color: var(--mb-text-primary, #f8fafc);
}

/* Public Footer Link Bar in Main App */
.app-footer-bar {
  flex-shrink: 0;
  max-width: 1560px;
  width: 100%;
  margin: 0 auto;
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px 10px;
  border-top: 1px solid var(--mb-border-subtle, rgba(255, 255, 255, 0.07));
  font-size: 11px;
  color: var(--mb-text-muted, #8492a6);
  flex-wrap: wrap;
  gap: 8px;
  position: relative;
  z-index: 1;
}

.app-footer-links {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.app-footer-links a {
  color: var(--mb-text-muted, #8492a6);
  text-decoration: none;
  transition: color 0.15s ease;
}

.app-footer-links a:hover {
  color: var(--mb-text-primary, #f8fafc);
}

.app-footer-meta {
  font-size: 10.5px;
  color: var(--mb-text-dim, #546274);
}

@media (max-width: 768px) {
  .app-footer-bar {
    width: 100%;
    max-width: 100%;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 8px;
    padding: 16px 16px calc(76px + env(safe-area-inset-bottom, 12px));
    margin-top: 0;
    box-sizing: border-box;
  }
}

