@font-face { font-family: 'Raiter Onest'; font-style: normal; font-display: swap; font-weight: 100 900; src: url('../assets/fonts/onest-cyrillic.woff2') format('woff2-variations'); unicode-range: U+0400-052F,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }
@font-face { font-family: 'Raiter Onest'; font-style: normal; font-display: swap; font-weight: 100 900; src: url('../assets/fonts/onest-latin.woff2') format('woff2-variations'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Raiter Manrope'; font-style: normal; font-display: swap; font-weight: 200 800; src: url('../assets/fonts/manrope-cyrillic.woff2') format('woff2-variations'); unicode-range: U+0400-052F,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }
@font-face { font-family: 'Raiter Manrope'; font-style: normal; font-display: swap; font-weight: 200 800; src: url('../assets/fonts/manrope-latin.woff2') format('woff2-variations'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Raiter Golos'; font-style: normal; font-display: swap; font-weight: 400 900; src: url('../assets/fonts/golos-text-cyrillic.woff2') format('woff2-variations'); unicode-range: U+0400-052F,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }
@font-face { font-family: 'Raiter Golos'; font-style: normal; font-display: swap; font-weight: 400 900; src: url('../assets/fonts/golos-text-latin.woff2') format('woff2-variations'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Raiter Plex'; font-style: normal; font-display: swap; font-weight: 100 700; src: url('../assets/fonts/ibm-plex-sans-cyrillic.woff2') format('woff2-variations'); unicode-range: U+0400-052F,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }
@font-face { font-family: 'Raiter Plex'; font-style: normal; font-display: swap; font-weight: 100 700; src: url('../assets/fonts/ibm-plex-sans-latin.woff2') format('woff2-variations'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Raiter Noto Serif'; font-style: normal; font-display: swap; font-weight: 100 900; src: url('../assets/fonts/noto-serif-cyrillic.woff2') format('woff2-variations'); unicode-range: U+0400-052F,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F; }
@font-face { font-family: 'Raiter Noto Serif'; font-style: normal; font-display: swap; font-weight: 100 900; src: url('../assets/fonts/noto-serif-latin.woff2') format('woff2-variations'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }

:root {
  color-scheme: dark;
  --bg: #0d0f0c;
  --bg-soft: #11140f;
  --surface: #151813;
  --surface-2: #1b1f18;
  --surface-3: #22271e;
  --paper: #eff0e8;
  --paper-text: #20231c;
  --text: #f1f3eb;
  --muted: #969e8b;
  --faint: #68705f;
  --line: rgba(227, 235, 215, 0.11);
  --line-strong: rgba(227, 235, 215, 0.2);
  --accent: #c8ff36;
  --accent-soft: rgba(200, 255, 54, 0.12);
  --accent-ink: #171a12;
  --danger: #ff7b6f;
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
  --radius-lg: 22px;
  --radius-md: 14px;
  --radius-sm: 9px;
  --rhyme-saturation: 72%;
  --rhyme-lightness: 42%;
  --font-ui: Inter, "Segoe UI", Arial, sans-serif;
  --font-editor: "Segoe UI", Inter, Arial, sans-serif;
}

html[data-editor-font="onest"] { --font-editor: 'Raiter Onest', 'Segoe UI', sans-serif; }
html[data-editor-font="manrope"] { --font-editor: 'Raiter Manrope', 'Segoe UI', sans-serif; }
html[data-editor-font="golos"] { --font-editor: 'Raiter Golos', 'Segoe UI', sans-serif; }
html[data-editor-font="plex"] { --font-editor: 'Raiter Plex', 'Segoe UI', sans-serif; }
html[data-editor-font="noto-serif"] { --font-editor: 'Raiter Noto Serif', Georgia, serif; }
html[data-editor-font="georgia"] { --font-editor: Georgia, 'Times New Roman', serif; }
html[data-editor-font="courier"] { --font-editor: 'Courier New', Courier, monospace; }
html[data-editor-font="trebuchet"] { --font-editor: 'Trebuchet MS', Arial, sans-serif; }

html[data-theme="editorial"] {
  color-scheme: light;
  --bg: #ddd7cb;
  --bg-soft: #e7e1d5;
  --surface: #f4f0e7;
  --surface-2: #ebe5da;
  --surface-3: #dfd8cc;
  --paper: #fffdf8;
  --paper-text: #171713;
  --text: #1c1b17;
  --muted: #6e6960;
  --faint: #8c8578;
  --line: rgba(28, 27, 23, 0.12);
  --line-strong: rgba(28, 27, 23, 0.22);
  --accent: #2450ff;
  --accent-soft: rgba(36, 80, 255, 0.1);
  --accent-ink: #ffffff;
  --danger: #c8442f;
  --shadow: 0 24px 80px rgba(66, 53, 34, 0.14);
  --rhyme-saturation: 68%;
  --rhyme-lightness: 38%;
}

html[data-theme="nocturne"] {
  color-scheme: dark;
  --bg: #090914;
  --bg-soft: #0d0d1c;
  --surface: #121126;
  --surface-2: #19172f;
  --surface-3: #211d3d;
  --paper: #17152b;
  --paper-text: #f5f1ff;
  --text: #f4f0ff;
  --muted: #a79dc1;
  --faint: #71678b;
  --line: rgba(218, 205, 255, 0.12);
  --line-strong: rgba(218, 205, 255, 0.22);
  --accent: #916bff;
  --accent-soft: rgba(145, 107, 255, 0.13);
  --accent-ink: #ffffff;
  --danger: #ff718f;
  --shadow: 0 28px 100px rgba(0, 0, 0, 0.42);
  --rhyme-saturation: 76%;
  --rhyme-lightness: 68%;
}

html[data-theme="blackout"] {
  color-scheme: dark;
  --bg: #020306;
  --bg-soft: #04060a;
  --surface: #06080d;
  --surface-2: #090c13;
  --surface-3: #0b0e16;
  --paper: #03050a;
  --paper-text: #f7f8fc;
  --text: #f7f8fc;
  --muted: #8992a8;
  --faint: #50596e;
  --line: rgba(174, 190, 234, 0.1);
  --line-strong: rgba(174, 190, 234, 0.2);
  --accent: #667fff;
  --accent-soft: rgba(102, 127, 255, 0.13);
  --accent-ink: #ffffff;
  --danger: #ff657c;
  --shadow: 0 34px 120px rgba(0, 0, 0, 0.72);
  --rhyme-saturation: 78%;
  --rhyme-lightness: 70%;
  --typing-glow: #667fff;
}

html[data-theme="blackout"] body { background: #020306; }

html[data-theme="azure"] {
  color-scheme: light;
  --bg: #dceeff;
  --bg-soft: #eaf4ff;
  --surface: #f7fbff;
  --surface-2: #edf6ff;
  --surface-3: #dcecff;
  --paper: #fbfdff;
  --paper-text: #142033;
  --text: #111c2e;
  --muted: #5f6f88;
  --faint: #8494ab;
  --line: rgba(32, 69, 119, 0.12);
  --line-strong: rgba(32, 69, 119, 0.22);
  --accent: #667fff;
  --accent-soft: rgba(102, 127, 255, 0.12);
  --accent-ink: #ffffff;
  --danger: #c54562;
  --shadow: 0 28px 90px rgba(52, 99, 156, 0.18);
  --rhyme-saturation: 70%;
  --rhyme-lightness: 38%;
  --typing-glow: #667fff;
}

* { box-sizing: border-box; }

html { min-width: 320px; background: var(--bg); }

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background:
    radial-gradient(circle at 78% -10%, var(--accent-soft), transparent 28rem),
    linear-gradient(145deg, var(--bg-soft), var(--bg));
  color: var(--text);
  font-family: var(--font-ui);
  -webkit-font-smoothing: antialiased;
  transition: background 260ms ease, color 220ms ease;
}

button, input, textarea, select { font: inherit; }

button { color: inherit; }

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
summary:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

button, summary { -webkit-tap-highlight-color: transparent; }

h1, h2, h3, p { margin: 0; }
h1 { font-size: clamp(22px, 2vw, 34px); font-weight: 520; letter-spacing: -0.045em; }
h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.02em; }
h3 { font-size: 14px; font-weight: 600; }

.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;
}

.app-shell {
  position: relative;
  isolation: isolate;
  width: min(1920px, 100%);
  min-height: 100vh;
  margin: 0 auto;
  padding: 14px;
}

.brand-intro {
  --intro-bg: #090c12;
  --intro-ink: #f7f8fc;
  --intro-duration: 3400ms;
  --intro-reveal-duration: 850ms;
  position: fixed;
  z-index: 2000;
  inset: 0;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: transparent;
  color: var(--intro-ink);
  opacity: 1;
  isolation: isolate;
}

.brand-intro[hidden] { display: none; }
.brand-intro.is-active { opacity: 1; }
.brand-intro.is-revealing { pointer-events: none; }
.brand-intro-canvas { position: absolute; z-index: 1; inset: 0; width: 100%; height: 100%; }
.brand-intro-curtains { position: absolute; z-index: 0; inset: 0; display: flex; pointer-events: none; }
.brand-intro-curtains i { width: 51%; height: 100%; background: var(--intro-bg); transform: translateX(0); transition: transform var(--intro-reveal-duration) cubic-bezier(0.22, 0.8, 0.24, 1); }
.brand-intro.is-revealing .brand-intro-curtains i:first-child { transform: translateX(-104%); }
.brand-intro.is-revealing .brand-intro-curtains i:last-child { transform: translateX(104%); }
.brand-intro-liquid { position: absolute; z-index: 2; inset: 0; display: grid; place-items: center; pointer-events: none; }
.brand-intro-liquid i { position: absolute; width: min(48vw, 620px); height: min(36vw, 470px); border-radius: 42% 58% 63% 37% / 54% 41% 59% 46%; background: conic-gradient(from 100deg, rgb(102 127 255 / 4%), rgb(102 127 255 / 28%), rgb(130 72 255 / 13%), rgb(102 127 255 / 4%)); opacity: 0; filter: blur(16px); mix-blend-mode: screen; }
.brand-intro-liquid i:nth-child(2) { width: min(34vw, 440px); height: min(50vw, 650px); animation-direction: reverse !important; }
.brand-intro.is-active .brand-intro-liquid i { animation: brand-liquid 2600ms 380ms cubic-bezier(0.2, 0.66, 0.28, 1) both; }
.brand-intro.is-revealing .brand-intro-liquid i:first-child { transform: translateX(-75vw) rotate(-70deg) scale(1.25); opacity: 0; transition: transform var(--intro-reveal-duration) ease-in, opacity var(--intro-reveal-duration) ease; }
.brand-intro.is-revealing .brand-intro-liquid i:last-child { transform: translateX(75vw) rotate(70deg) scale(1.25); opacity: 0; transition: transform var(--intro-reveal-duration) ease-in, opacity var(--intro-reveal-duration) ease; }
.brand-intro.is-revealing .brand-intro-liquid i { animation: none !important; }
.brand-intro-reveal { position: absolute; z-index: 5; left: 50%; top: 50%; width: 8vmin; aspect-ratio: 1; border: 1px solid rgb(194 205 255 / 76%); border-radius: 50%; opacity: 0; transform: translate(-50%, -50%) scale(0.1); box-shadow: 0 0 44px rgb(102 127 255 / 24%), inset 0 0 24px rgb(102 127 255 / 12%); pointer-events: none; }
.brand-intro.is-revealing .brand-intro-reveal { animation: brand-reveal-ring var(--intro-reveal-duration) cubic-bezier(0.14, 0.78, 0.22, 1) both; }
.brand-intro.is-revealing .brand-intro-logo { animation: brand-logo-release var(--intro-reveal-duration) ease-in both; }
.brand-intro.is-revealing .brand-intro-skip { animation: none !important; opacity: 0; transition: opacity 120ms ease; }
.brand-intro-logo { position: relative; z-index: 4; width: min(68vw, 620px); height: auto; color: var(--intro-ink); }
.brand-intro-logo #writer-r { stroke-dasharray: 380; stroke-dashoffset: 380; }
.brand-intro-logo #rhythm-line { stroke-dasharray: 130; stroke-dashoffset: 130; }
.brand-intro-logo #writer-wordmark path { stroke-dasharray: 260; stroke-dashoffset: 260; }
.brand-intro.is-active .brand-intro-logo #writer-r { animation: brand-mark-draw 950ms 700ms cubic-bezier(0.18, 0.78, 0.25, 1) forwards; }
.brand-intro.is-active .brand-intro-logo #rhythm-line { animation: brand-mark-draw 620ms 1180ms cubic-bezier(0.18, 0.78, 0.25, 1) forwards; }
.brand-intro.is-active .brand-intro-logo #writer-wordmark path { animation: brand-mark-draw 760ms 1800ms cubic-bezier(0.2, 0.74, 0.3, 1) forwards; }
.brand-intro.is-active .brand-intro-logo #writer-wordmark path:nth-child(2) { animation-delay: 1860ms; }
.brand-intro.is-active .brand-intro-logo #writer-wordmark path:nth-child(3) { animation-delay: 1920ms; }
.brand-intro.is-active .brand-intro-logo #writer-wordmark path:nth-child(4) { animation-delay: 1980ms; }
.brand-intro.is-active .brand-intro-logo #writer-wordmark path:nth-child(5) { animation-delay: 2040ms; }
.brand-intro.is-active .brand-intro-logo #writer-wordmark path:nth-child(6) { animation-delay: 2100ms; }

.brand-intro-waves, .brand-intro-flow { position: absolute; z-index: 2; inset: 0; pointer-events: none; }
.brand-intro-waves i { position: absolute; width: 45vmax; height: 45vmax; border: 1px solid rgb(102 127 255 / 38%); border-radius: 50%; opacity: 0; box-shadow: 0 0 32px rgb(102 127 255 / 12%), inset 0 0 26px rgb(102 127 255 / 8%); }
.brand-intro-waves i:nth-child(1) { left: -38vmax; top: -32vmax; --wave-x: 35vw; --wave-y: 31vh; }
.brand-intro-waves i:nth-child(2) { right: -38vmax; top: -30vmax; --wave-x: -35vw; --wave-y: 30vh; }
.brand-intro-waves i:nth-child(3) { left: -37vmax; bottom: -34vmax; --wave-x: 34vw; --wave-y: -33vh; }
.brand-intro-waves i:nth-child(4) { right: -37vmax; bottom: -33vmax; --wave-x: -34vw; --wave-y: -32vh; }
.brand-intro.is-active .brand-intro-waves i { animation: brand-wave 1500ms 180ms cubic-bezier(0.14, 0.72, 0.28, 1) both; }
.brand-intro.is-active .brand-intro-waves i:nth-child(2) { animation-delay: 260ms; }
.brand-intro.is-active .brand-intro-waves i:nth-child(3) { animation-delay: 340ms; }
.brand-intro.is-active .brand-intro-waves i:nth-child(4) { animation-delay: 420ms; }

.brand-intro-flow i { position: absolute; left: 50%; top: 50%; width: min(70vw, 900px); height: 1px; background: linear-gradient(90deg, transparent, #667fff 25%, #f7f8fc 50%, #667fff 75%, transparent); opacity: 0; transform-origin: center; }
.brand-intro-flow i:nth-child(1) { transform: translate(-50%, -50%); }
.brand-intro-flow i:nth-child(2) { transform: translate(-50%, -50%) rotate(58deg); }
.brand-intro-flow i:nth-child(3) { transform: translate(-50%, -50%) rotate(-58deg); }
.brand-intro.is-active .brand-intro-flow i { animation: brand-flow 1700ms 520ms ease-out both; }

.brand-intro-skip { position: absolute; z-index: 6; right: 24px; bottom: 22px; border: 1px solid rgb(102 127 255 / 36%); border-radius: 999px; padding: 8px 13px; background: rgb(9 12 18 / 58%); color: #f7f8fc; font-size: 10px; cursor: pointer; opacity: 0; }
.brand-intro.is-active .brand-intro-skip { animation: brand-skip-in 280ms 1100ms ease forwards; }

html[data-theme="editorial"] .brand-intro,
html[data-theme="azure"] .brand-intro { --intro-bg: #eaf4ff; --intro-ink: #090c12; }

@keyframes brand-mark-draw { to { stroke-dashoffset: 0; } }
@keyframes brand-liquid {
  0% { opacity: 0; transform: scale(0.35) rotate(-36deg); }
  32% { opacity: 0.72; }
  68% { opacity: 0.48; transform: scale(1.05) rotate(34deg); }
  100% { opacity: 0.26; transform: scale(0.88) rotate(82deg); }
}
@keyframes brand-reveal-ring {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.1); }
  16% { opacity: 0.95; }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(28); }
}
@keyframes brand-logo-release {
  0%, 28% { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.075); }
}
@keyframes brand-wave {
  0% { opacity: 0; transform: translate(0, 0) scale(1); }
  28% { opacity: 0.7; }
  100% { opacity: 0; transform: translate(var(--wave-x), var(--wave-y)) scale(0.13); }
}
@keyframes brand-flow {
  0% { opacity: 0; clip-path: inset(0 50% 0 50%); }
  34% { opacity: 0.72; }
  72% { opacity: 0.34; clip-path: inset(0 0 0 0); }
  100% { opacity: 0; clip-path: inset(0 0 0 0); }
}
@keyframes brand-skip-in { to { opacity: 0.72; } }

.product-bar, .workspace { position: relative; z-index: 1; }

.ambient-scene {
  position: fixed;
  z-index: 0;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.ambient-scene > i { position: absolute; display: block; opacity: 0; will-change: transform, opacity; }
.ambient-orbit { width: 58vmin; height: 58vmin; top: -24vmin; right: -10vmin; border: 1px solid var(--line-strong); border-radius: 50%; animation: ambient-orbit 34s linear infinite; }
.ambient-wave { width: 48vw; height: 36vh; left: -12vw; bottom: -12vh; border-radius: 46% 54% 62% 38% / 54% 38% 62% 46%; background: var(--accent-soft); filter: blur(46px); animation: ambient-wave 28s ease-in-out infinite alternate; }
.ambient-glow { width: 34vmax; height: 34vmax; right: 8vw; bottom: -22vmax; border-radius: 50%; background: radial-gradient(circle, var(--accent-soft), transparent 66%); animation: ambient-glow 42s ease-in-out infinite; }
.blackout-ink,
.blackout-filament,
.blackout-spectrum { opacity: 0; }

html[data-theme="signal"] .ambient-orbit { opacity: 0.34; box-shadow: 0 0 0 12vmin color-mix(in srgb, var(--accent) 2%, transparent), 0 0 0 24vmin color-mix(in srgb, var(--accent) 1.5%, transparent); }
html[data-theme="signal"] .ambient-wave { opacity: 0.12; }
html[data-theme="signal"] .ambient-glow { opacity: 0.17; }
html[data-theme="editorial"] .ambient-orbit { opacity: 0.1; border-radius: 41% 59% 46% 54% / 56% 39% 61% 44%; }
html[data-theme="editorial"] .ambient-wave { opacity: 0.22; filter: blur(64px); }
html[data-theme="editorial"] .ambient-glow { opacity: 0.13; }
html[data-theme="nocturne"] .ambient-orbit { opacity: 0.28; border-color: color-mix(in srgb, var(--accent) 34%, transparent); box-shadow: inset 0 0 5vmin var(--accent-soft); }
html[data-theme="nocturne"] .ambient-wave { opacity: 0.15; }
html[data-theme="nocturne"] .ambient-glow { opacity: 0.36; }
html[data-theme="blackout"] .ambient-orbit { opacity: 0.18; border-color: rgb(102 127 255 / 26%); box-shadow: 0 0 0 12vmin rgb(102 127 255 / 1.5%), inset 0 0 7vmin rgb(102 127 255 / 5%); }
html[data-theme="blackout"] .ambient-wave { opacity: 0.07; background: #667fff; filter: blur(90px); }
html[data-theme="blackout"] .ambient-glow { opacity: 0.12; }
html[data-theme="blackout"] .blackout-ink {
  width: 54vmax;
  height: 42vmax;
  border-radius: 44% 56% 62% 38% / 52% 38% 62% 48%;
  background: conic-gradient(from 124deg, transparent, rgb(43 66 168 / 54%), rgb(102 127 255 / 18%), transparent 66%);
  filter: blur(76px);
  mix-blend-mode: screen;
  opacity: 0.11;
  animation: blackout-ink-drift 26s ease-in-out infinite alternate;
}
html[data-theme="blackout"] .blackout-ink-a { left: -34vmax; top: -18vmax; }
html[data-theme="blackout"] .blackout-ink-b { right: -38vmax; bottom: -24vmax; animation-delay: -12s; animation-direction: alternate-reverse; }
html[data-theme="blackout"] .blackout-filament {
  left: 7vw;
  top: 9vh;
  width: 1px;
  height: 78vh;
  background: linear-gradient(transparent, rgb(102 127 255 / 42%), rgb(224 229 255 / 58%), transparent);
  filter: drop-shadow(0 0 8px rgb(102 127 255 / 42%));
  opacity: 0.15;
  animation: blackout-filament-pulse 18s ease-in-out infinite;
}
html[data-theme="blackout"] .blackout-spectrum {
  left: 18vw;
  right: 18vw;
  top: 86px;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgb(102 127 255 / 48%), rgb(237 240 255 / 64%), rgb(102 127 255 / 48%), transparent);
  filter: drop-shadow(0 0 9px rgb(102 127 255 / 34%));
  opacity: 0.14;
  transform-origin: center;
  animation: blackout-spectrum-breathe 22s ease-in-out infinite;
}
html[data-theme="azure"] .ambient-orbit { opacity: 0.16; border-color: rgb(102 127 255 / 28%); }
html[data-theme="azure"] .ambient-wave { opacity: 0.28; background: rgb(102 127 255 / 18%); filter: blur(70px); }
html[data-theme="azure"] .ambient-glow { opacity: 0.18; }

@keyframes ambient-orbit { to { transform: rotate(360deg) scale(1.08); } }
@keyframes ambient-wave { to { transform: translate3d(18vw, -8vh, 0) rotate(16deg) scale(1.12); } }
@keyframes ambient-glow { 50% { transform: translate3d(-12vw, -8vh, 0) scale(1.16); opacity: 0.18; } }
@keyframes blackout-ink-drift {
  0% { transform: translate3d(-2vw, -2vh, 0) rotate(-8deg) scale(0.92); }
  100% { transform: translate3d(10vw, 7vh, 0) rotate(24deg) scale(1.12); }
}
@keyframes blackout-filament-pulse {
  0%, 100% { transform: translateY(-8vh) scaleY(0.38); opacity: 0.04; }
  48%, 58% { transform: translateY(7vh) scaleY(1); opacity: 0.16; }
}
@keyframes blackout-spectrum-breathe {
  0%, 100% { transform: scaleX(0.48); opacity: 0.05; }
  50% { transform: scaleX(1); opacity: 0.16; }
}

body.is-typing .ambient-scene > i { animation-duration: 90s !important; }
body.is-background-paused .ambient-scene > i { animation-play-state: paused !important; }
body.is-typing .blackout-ink,
body.is-typing .blackout-filament,
body.is-typing .blackout-spectrum { opacity: 0.045 !important; animation-duration: 54s !important; }
body.is-background-paused .blackout-ink,
body.is-background-paused .blackout-filament,
body.is-background-paused .blackout-spectrum { animation-play-state: paused !important; }

.product-bar {
  z-index: 20;
  min-height: 68px;
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(180px, 300px) auto auto auto;
  align-items: center;
  gap: 14px;
  padding: 8px 10px 18px;
}

.brand {
  width: max-content;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: inherit;
  text-decoration: none;
  border: 0;
  padding: 0;
  background: transparent;
  cursor: pointer;
}

.brand-logo { display: block; width: 150px; height: auto; }
.brand-logo-compact { display: none; width: 38px; height: 38px; }
.brand-logo-light { display: none; }
html[data-theme="editorial"] .brand-logo-dark,
html[data-theme="azure"] .brand-logo-dark { display: none; }
html[data-theme="editorial"] .brand-logo.brand-logo-light,
html[data-theme="azure"] .brand-logo.brand-logo-light { display: block; }

.brand-mark {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 750;
  transform: rotate(-8deg);
  box-shadow: 0 0 0 5px var(--accent-soft);
}

.brand > span:last-child { display: grid; gap: 2px; }
.brand strong { font-size: 17px; letter-spacing: 0.09em; }
.brand small { color: var(--muted); font-size: 9px; letter-spacing: 0.15em; text-transform: uppercase; }

.project-name input,
input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  padding: 10px 11px;
  outline: none;
  transition: border-color 160ms ease, background 160ms ease, box-shadow 160ms ease;
}

input:hover, select:hover, textarea:hover { border-color: var(--line-strong); }
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.project-name input {
  height: 38px;
  text-align: center;
  background: transparent;
  font-weight: 560;
}

.theme-switcher {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
}

.theme-switcher button {
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  padding: 7px 9px;
  font-size: 10px;
  cursor: pointer;
}

.theme-switcher button[aria-pressed="true"] {
  background: var(--accent);
  color: var(--accent-ink);
}

.theme-switcher .custom-accent-button {
  position: relative;
  display: grid;
  width: 29px;
  height: 29px;
  padding: 0;
  place-items: center;
  border: 1px solid var(--line-strong);
  background:
    linear-gradient(var(--surface), var(--surface)) padding-box,
    conic-gradient(from 90deg, #ff485f, #ffdf4a, #2fd879, #4da3ff, #a76bff, #ff485f) border-box;
  color: var(--text);
  font-size: 18px;
  line-height: 1;
}
.theme-switcher .custom-accent-button.is-active::after {
  content: "";
  position: absolute;
  inset: 4px;
  border-radius: 50%;
  background: var(--custom-accent);
}
.theme-switcher .custom-accent-button.is-active > span:first-child { opacity: 0; }
.accent-palette {
  position: absolute;
  z-index: 70;
  top: calc(100% + 10px);
  right: 0;
  width: min(310px, calc(100vw - 24px));
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 16px;
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 24px 70px rgb(0 0 0 / 24%);
  backdrop-filter: blur(18px);
}
.accent-palette-head,
.accent-hex-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.accent-palette-head { margin-bottom: 10px; text-align: left; }
.accent-palette-head strong,
.accent-palette-head small { display: block; }
.accent-palette-head small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.accent-palette-head button {
  padding: 5px 7px;
  border: 1px solid var(--line);
  background: transparent;
  color: var(--muted);
}
.accent-spectrum-wrap { position: relative; }
.accent-spectrum {
  display: block;
  width: 100%;
  height: 150px;
  border-radius: 11px;
  cursor: crosshair;
}
.accent-spectrum-cursor {
  position: absolute;
  width: 13px;
  height: 13px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #000, 0 2px 8px rgb(0 0 0 / 35%);
  transform: translate(-50%, -50%);
  opacity: 0;
  pointer-events: none;
}
.accent-spectrum-cursor.is-visible { opacity: 1; }
.accent-hex-control { margin-top: 10px; color: var(--muted); font-size: 9px; }
.accent-hex-control input { width: 104px; height: 31px; padding: 5px 8px; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; text-transform: lowercase; }

.top-actions { display: flex; gap: 7px; }
.word-download-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.word-download-icon {
  width: 16px;
  height: 16px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.word-download-button:disabled { cursor: wait; opacity: .62; }

.button,
.icon-button {
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  background: var(--surface-3);
  color: var(--text);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: transform 150ms ease, border-color 150ms ease, background 150ms ease;
}

.button:hover, .icon-button:hover { transform: translateY(-1px); border-color: var(--line-strong); }
.button:active, .icon-button:active { transform: translateY(0); }
.button-primary { background: var(--accent); color: var(--accent-ink); }
.button-secondary { background: var(--text); color: var(--bg); }
.button-ghost { background: transparent; border-color: var(--line); }
.button[disabled] { opacity: 0.5; cursor: wait; transform: none; }
.full { width: 100%; }

.workspace {
  display: grid;
  grid-template-columns: 294px minmax(480px, 1fr) 382px;
  gap: 10px;
  min-height: calc(100vh - 96px);
  transition: grid-template-columns 520ms cubic-bezier(0.22, 0.8, 0.24, 1);
}

.workspace.tools-collapsed { grid-template-columns: 62px minmax(480px, 1fr) 382px; }
.workspace.assistant-collapsed { grid-template-columns: 294px minmax(480px, 1fr) 62px; }
.workspace.tools-collapsed.assistant-collapsed { grid-template-columns: 62px minmax(480px, 1fr) 62px; }

.tool-panel,
.context-panel,
.editor-zone {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: var(--shadow);
}

html[data-theme="blackout"] .tool-panel,
html[data-theme="blackout"] .context-panel,
html[data-theme="blackout"] .editor-zone {
  background: linear-gradient(145deg, rgb(11 15 24 / 96%), rgb(5 7 12 / 98%));
  border-color: rgb(158 176 232 / 12%);
  box-shadow: 0 30px 110px rgb(0 0 0 / 72%), inset 0 1px 0 rgb(255 255 255 / 2.5%);
}
html[data-theme="blackout"] .editor-zone::before {
  content: '';
  position: absolute;
  z-index: 4;
  left: 8%;
  right: 8%;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, #667fff, #f7f8fc, #667fff, transparent);
  opacity: 0.24;
  filter: drop-shadow(0 0 8px rgb(102 127 255 / 36%));
  pointer-events: none;
}
html[data-theme="blackout"] .button,
html[data-theme="blackout"] .icon-button {
  background-image: linear-gradient(108deg, transparent 36%, rgb(255 255 255 / 4%), transparent 64%);
  background-size: 240% 100%;
  transition: background-position 480ms ease, transform 180ms ease, border-color 180ms ease;
}
html[data-theme="blackout"] .button:hover,
html[data-theme="blackout"] .icon-button:hover { background-position: 100% 0; }

.tool-panel,
.context-panel {
  position: relative;
  max-height: calc(100vh - 98px);
  overflow: hidden;
  transition: max-height 520ms cubic-bezier(0.22, 0.8, 0.24, 1), border-color 320ms ease, box-shadow 320ms ease;
}

.panel-heading {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 15px;
  border-bottom: 1px solid var(--line);
}

.panel-heading > div { display: flex; align-items: center; gap: 9px; }
.section-index { color: var(--accent); font-size: 9px; letter-spacing: 0.12em; }

.icon-button {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 50%;
  font-size: 20px;
}

.tool-panel-body,
.context-panel-body {
  height: calc(100% - 66px);
  transition: opacity 320ms ease, transform 520ms cubic-bezier(0.22, 0.8, 0.24, 1), filter 420ms ease, clip-path 520ms cubic-bezier(0.22, 0.8, 0.24, 1);
}

.tool-panel-body,
.context-content {
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--line-strong) transparent;
}

.context-panel-body { display: flex; min-width: 300px; flex-direction: column; overflow: hidden; }
.context-content { flex: 1; min-height: 0; }
.panel-heading-actions { display: flex; align-items: center; gap: 9px; }

.tool-panel.is-collapsed .panel-heading h2,
.tool-panel.is-collapsed .section-index,
.context-panel.is-collapsed .panel-heading h2,
.context-panel.is-collapsed .section-index,
.context-panel.is-collapsed .assistant-orbit { width: 0; opacity: 0; overflow: hidden; }
.tool-panel.is-collapsed .panel-heading { padding-inline: 15px; justify-content: center; }
.tool-panel.is-collapsed .icon-button { transform: rotate(180deg); }
.context-panel.is-collapsed .panel-heading { padding-inline: 15px; justify-content: center; }
.context-panel.is-collapsed .icon-button { transform: rotate(180deg); }

.tool-panel.is-collapsing .tool-panel-body,
.tool-panel.is-collapsed .tool-panel-body {
  opacity: 0;
  transform: translateX(-18px) scale(0.98);
  filter: blur(3px);
  clip-path: inset(0 100% 0 0 round var(--radius-lg));
}
.context-panel.is-collapsing .context-panel-body,
.context-panel.is-collapsed .context-panel-body {
  opacity: 0;
  transform: translateX(18px) scale(0.98);
  filter: blur(3px);
  clip-path: inset(0 0 0 100% round var(--radius-lg));
}
.tool-panel.is-expanding .tool-panel-body,
.context-panel.is-expanding .context-panel-body { animation: panel-content-return 520ms cubic-bezier(0.22, 0.8, 0.24, 1) both; }
.tool-panel.is-collapsed .tool-panel-body,
.context-panel.is-collapsed .context-panel-body { visibility: hidden; }

.panel-motion-edge {
  position: absolute;
  z-index: 5;
  top: 10%;
  bottom: 10%;
  width: 1px;
  border-radius: 999px;
  background: linear-gradient(transparent, var(--accent), #f7f8fc, var(--accent), transparent);
  opacity: 0;
  filter: drop-shadow(0 0 8px var(--accent));
  pointer-events: none;
}
.tool-panel .panel-motion-edge { right: 7px; }
.context-panel .panel-motion-edge { left: 7px; }
.is-collapsing > .panel-motion-edge { animation: panel-edge-collapse 520ms ease both; }
.is-expanding > .panel-motion-edge { animation: panel-edge-expand 520ms ease both; }

@keyframes panel-edge-collapse {
  0%, 100% { opacity: 0; transform: scaleY(0.18); }
  55% { opacity: 0.9; transform: scaleY(1); }
}
@keyframes panel-edge-expand {
  0% { opacity: 0.85; transform: scaleY(1); }
  100% { opacity: 0; transform: scaleY(0.18); }
}
@keyframes panel-content-return {
  from { opacity: 0; filter: blur(3px); }
  to { opacity: 1; filter: blur(0); }
}

.control-section {
  display: grid;
  gap: 11px;
  padding: 15px;
  border-bottom: 1px solid var(--line);
}

.section-title,
.control-section summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.section-title span,
.summary-meta {
  color: var(--faint);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.control-section summary { list-style: none; cursor: pointer; font-size: 13px; font-weight: 600; }
.control-section summary::-webkit-details-marker { display: none; }
.control-section summary::after { content: '+'; color: var(--accent); font-size: 18px; font-weight: 400; }
.control-section[open] summary::after { content: '−'; }
.details-body { display: grid; gap: 10px; padding-top: 12px; }

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.02em;
}

select, input, textarea { font-size: 12px; }
.two-column-controls { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.three-column-controls { display: grid; grid-template-columns: 0.7fr 1.2fr 0.8fr; gap: 7px; }

.switch-row {
  grid-template-columns: auto 1fr;
  align-items: start;
  gap: 9px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
}

.switch-row input { width: 14px; height: 14px; margin: 2px 0 0; accent-color: var(--accent); box-shadow: none; }
.switch-row span { display: grid; gap: 2px; color: var(--text); }
.switch-row strong { font-size: 11px; }
.switch-row small { color: var(--muted); font-size: 9px; line-height: 1.35; }

.status-box,
.advice-card {
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 10px;
  line-height: 1.5;
}

.beat-player-card {
  position: relative;
  isolation: isolate;
  display: grid;
  gap: 10px;
  min-height: 92px;
  padding: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: calc(var(--radius-sm) + 2px);
  background: color-mix(in srgb, var(--surface-2) 90%, transparent);
}

.beat-player-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.beat-brand-mark { width: 24px; height: 24px; flex: 0 0 auto; opacity: 0.72; }
.beat-player-head > div { display: grid; gap: 3px; min-width: 0; }
.beat-player-head strong { overflow: hidden; color: var(--text); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.beat-clear { width: 27px; height: 27px; flex: 0 0 auto; }
.beat-player-card audio { position: relative; z-index: 1; width: 100%; height: 34px; filter: saturate(0.72); }
.beat-embed { position: relative; z-index: 1; aspect-ratio: 16 / 9; overflow: hidden; border-radius: var(--radius-sm); background: #050505; }
.beat-embed iframe { width: 100%; height: 100%; border: 0; }
.beat-player-status { position: relative; z-index: 1; margin: 0; color: var(--muted); font-size: 9px; line-height: 1.4; }

.beat-contour { position: absolute; z-index: -1; inset: -55%; opacity: 0.38; pointer-events: none; }
.beat-contour i { position: absolute; inset: 18%; border: 1px solid color-mix(in srgb, var(--accent) 46%, transparent); border-radius: 42% 58% 63% 37% / 54% 38% 62% 46%; animation: beat-contour 13s linear infinite; }
.beat-contour i:nth-child(2) { inset: 24%; animation-duration: 17s; animation-direction: reverse; opacity: 0.65; }
.beat-contour i:nth-child(3) { inset: 31%; animation-duration: 21s; opacity: 0.42; }
.beat-player-card.is-playing .beat-contour { opacity: 0.76; }
.beat-player-card.is-playing .beat-contour i { animation-duration: 7s; }

@keyframes beat-contour { to { transform: rotate(360deg) scale(1.06); } }

.hint { color: var(--muted); font-size: 10px; line-height: 1.55; }
.corpus-input { min-height: 118px; resize: vertical; }
.saved-list { display: grid; gap: 7px; }
.project-quota {
  width: max-content;
  padding: 4px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 8px;
  font-weight: 750;
  letter-spacing: .04em;
}
.saved-project-row { display: grid; grid-template-columns: minmax(0, 1fr) 30px 30px; gap: 5px; }

.saved-project {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--text);
  padding: 9px 10px;
  text-align: left;
  cursor: pointer;
  font-size: 11px;
}
.saved-project-delete {
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--muted);
  cursor: pointer;
  font-size: 15px;
}
.saved-project-delete:hover { border-color: color-mix(in srgb, var(--danger) 55%, var(--line)); color: var(--danger); }
.saved-project-download {
  display: grid;
  width: 30px;
  min-height: 30px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: transparent;
  color: var(--accent);
  cursor: pointer;
}
.saved-project-download:hover { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 9%, transparent); }
.saved-project-download svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 1.8; }

.editor-zone {
  position: relative;
  display: grid;
  grid-template-rows: auto minmax(480px, 1fr) auto;
  overflow: hidden;
  background: var(--paper);
  color: var(--paper-text);
}

.editor-toolbar {
  position: relative;
  z-index: 2;
  min-height: 88px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 17px 190px 17px 20px;
  border-bottom: 1px solid color-mix(in srgb, var(--paper-text) 12%, transparent);
}

.eyebrow {
  margin-bottom: 4px;
  color: var(--accent);
  font-size: 8px;
  font-weight: 650;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

html[data-theme="editorial"] .editor-toolbar .eyebrow { color: var(--accent); }
.editor-badges { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 6px; }

.status-pill,
.live-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid color-mix(in srgb, var(--paper-text) 13%, transparent);
  border-radius: 999px;
  padding: 6px 8px;
  color: color-mix(in srgb, var(--paper-text) 62%, transparent);
  font-size: 9px;
  white-space: nowrap;
}

.live-pill i { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.editor-font-control {
  position: relative;
  display: grid;
  grid-template-columns: auto minmax(110px, 150px);
  align-items: center;
  gap: 8px;
  margin-left: auto;
  color: color-mix(in srgb, var(--paper-text) 52%, transparent);
  font-size: 9px;
}
.editor-font-select {
  min-width: 150px;
  min-height: 34px;
  padding: 7px 32px 7px 10px;
  border: 1px solid color-mix(in srgb, var(--paper-text) 14%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--paper) 84%, transparent);
  color: var(--paper-text);
  cursor: pointer;
  font-family: var(--font-editor);
  touch-action: manipulation;
}
.editor-font-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.character-limit { margin-left: auto; color: color-mix(in srgb, var(--paper-text) 55%, transparent); font-size: 9px; font-variant-numeric: tabular-nums; }
.character-limit.is-near { color: #d4902e; }
.character-limit.is-full { color: var(--danger); font-weight: 750; }
.academy-promo {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  overflow: hidden;
  padding: 13px;
  border: 1px solid color-mix(in srgb, var(--accent) 32%, var(--line));
  border-radius: 15px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 15%, var(--surface)), var(--surface-2));
  color: var(--text);
  text-decoration: none;
}
.academy-promo-orbit { display: grid; width: 48px; height: 48px; flex: 0 0 auto; place-items: center; border: 1px solid color-mix(in srgb, var(--accent) 55%, transparent); border-radius: 50%; color: var(--accent); font-size: 13px; font-weight: 850; box-shadow: 0 0 26px color-mix(in srgb, var(--accent) 24%, transparent); }
.academy-promo > span:last-child { display: grid; gap: 3px; }
.academy-promo small { color: var(--accent); font-size: 7px; font-weight: 800; letter-spacing: .12em; }
.academy-promo strong { font-size: 10px; line-height: 1.3; }
.academy-promo em { color: var(--muted); font-size: 8px; font-style: normal; line-height: 1.35; }

.editor-stack { position: relative; min-height: 480px; overflow: hidden; }

#lyricsInput,
#highlightLayer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  border: 0;
  border-radius: 0;
  padding: clamp(28px, 5vw, 70px) clamp(24px, 6vw, 90px);
  overflow: auto;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  tab-size: 2;
  font-family: var(--font-editor);
  font-size: clamp(18px, 1.55vw, 25px);
  font-weight: 430;
  line-height: 1.78;
  letter-spacing: -0.018em;
}

#highlightLayer {
  z-index: 1;
  pointer-events: none;
  color: var(--paper-text);
  background: transparent;
  scrollbar-width: none;
}

#highlightLayer::-webkit-scrollbar { display: none; }

#lyricsInput {
  z-index: 2;
  resize: none;
  background: transparent;
  color: transparent;
  caret-color: var(--paper-text);
  box-shadow: none;
}

#lyricsInput::placeholder { color: color-mix(in srgb, var(--paper-text) 32%, transparent); }
#lyricsInput::selection { background: color-mix(in srgb, var(--accent) 24%, transparent); }

.rhyme-span {
  background: transparent;
  text-decoration-line: underline;
  text-decoration-style: solid;
  text-decoration-thickness: calc(1px + var(--rhyme-strength) * 0.9px);
  text-decoration-color: hsl(var(--rhyme-hue) var(--rhyme-saturation) var(--rhyme-lightness) / var(--rhyme-state-alpha, var(--rhyme-alpha)));
  text-underline-offset: 0.27em;
  text-decoration-skip-ink: auto;
  text-shadow: 0 1px 8px hsl(var(--rhyme-hue) var(--rhyme-saturation) var(--rhyme-lightness) / 5%);
  transition: text-decoration-color 180ms ease, text-shadow 180ms ease;
}

.rhyme-span[data-state="overview"] { --rhyme-state-alpha: 36%; }
.rhyme-span[data-state="active"] {
  --rhyme-state-alpha: 80%;
  text-decoration-thickness: calc(1.2px + var(--rhyme-strength) * 0.8px);
  text-shadow: 0 0 10px hsl(var(--rhyme-hue) var(--rhyme-saturation) var(--rhyme-lightness) / 18%);
}
.rhyme-span[data-state="muted"] { --rhyme-state-alpha: 15%; }
.rhyme-span[data-state="deep"] {
  --rhyme-state-alpha: 24%;
  text-decoration-style: dotted;
  text-decoration-thickness: 1px;
}

.typing-glyph {
  display: inline-block;
  min-width: 0;
  vertical-align: baseline;
  will-change: opacity, filter, transform, text-shadow;
  animation: typing-glyph 340ms cubic-bezier(0.16, 0.78, 0.24, 1) both;
}

@keyframes typing-glyph {
  0% { opacity: 0.08; filter: blur(2px); transform: translate3d(0, 0.16em, 0) scale(0.98); text-shadow: 0 0 18px var(--typing-glow, var(--accent)); }
  42% { opacity: 1; filter: blur(0); transform: translate3d(0, 0, 0) scale(1); text-shadow: 0 0 9px var(--typing-glow, var(--accent)); }
  100% { opacity: 1; filter: blur(0); transform: translate3d(0, 0, 0) scale(1); text-shadow: none; }
}

.editor-footer {
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-top: 1px solid color-mix(in srgb, var(--paper-text) 12%, transparent);
}

.beat-capsule {
  position: fixed;
  z-index: 12;
  bottom: 16px;
  left: calc(var(--beat-capsule-left, 0px) + 18px);
  right: auto;
  isolation: isolate;
  width: calc(var(--beat-capsule-width, 100vw) - 36px);
  min-height: 78px;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(150px, 190px) minmax(180px, 1fr) auto;
  align-items: center;
  gap: 16px;
  padding: 11px 13px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 36%, var(--line-strong));
  border-radius: 24px;
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 88%, transparent), color-mix(in srgb, var(--surface-2) 82%, transparent));
  color: var(--text);
  box-shadow: 0 22px 64px color-mix(in srgb, var(--bg) 54%, transparent), inset 0 1px 0 color-mix(in srgb, #fff 8%, transparent);
  backdrop-filter: blur(22px) saturate(1.18);
  transition: min-height 360ms cubic-bezier(0.22, 0.78, 0.22, 1), border-radius 360ms ease, transform 240ms ease, box-shadow 240ms ease;
}
.beat-capsule::before {
  content: '';
  position: absolute;
  z-index: -1;
  inset: 0;
  border-radius: inherit;
  background: linear-gradient(100deg, transparent 12%, color-mix(in srgb, var(--accent) 13%, transparent) 48%, transparent 78%);
  opacity: 0.45;
  transform: translateX(-62%);
  pointer-events: none;
}
.beat-capsule.is-playing::before { animation: beat-capsule-scan 4.8s linear infinite; }
.beat-capsule.is-playing { box-shadow: 0 24px 72px color-mix(in srgb, var(--accent) 16%, transparent), inset 0 1px 0 color-mix(in srgb, #fff 10%, transparent); }
.beat-capsule-aura {
  position: absolute;
  z-index: -2;
  left: 18%;
  right: 18%;
  bottom: -38px;
  height: 62px;
  border-radius: 50%;
  background: color-mix(in srgb, var(--accent) 20%, transparent);
  filter: blur(26px);
  opacity: 0.42;
  pointer-events: none;
  transition: opacity 220ms ease;
}
.beat-capsule-source { min-width: 0; display: flex; align-items: center; gap: 10px; }
.beat-capsule-art {
  position: relative;
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 42%, transparent);
  border-radius: 13px;
  background: conic-gradient(from 220deg, var(--accent), color-mix(in srgb, var(--accent) 18%, var(--surface-3)), var(--surface), var(--accent));
  box-shadow: inset 0 0 18px color-mix(in srgb, #fff 12%, transparent), 0 0 22px color-mix(in srgb, var(--accent) 19%, transparent);
}
.beat-capsule-art::before,
.beat-capsule-art i { content: ''; position: absolute; inset: 8px; border: 1px solid color-mix(in srgb, #fff 46%, transparent); border-radius: 43% 57% 62% 38% / 54% 39% 61% 46%; }
.beat-capsule-art i { inset: 13px; opacity: 0.65; transform: rotate(42deg); }
.beat-capsule.is-playing .beat-capsule-art::before { animation: beat-art-orbit 5.8s linear infinite; }
.beat-capsule-copy { min-width: 0; display: grid; gap: 3px; }
.beat-capsule-copy small { color: var(--accent); font-size: 8px; font-weight: 750; letter-spacing: 0.13em; }
.beat-capsule-copy strong { overflow: hidden; color: var(--text); font-size: 10px; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
.beat-waveform-panel { min-width: 0; display: grid; gap: 4px; }
.beat-waveform-track {
  position: relative;
  height: 36px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--line-strong) 66%, transparent);
  border-radius: 12px;
  background: color-mix(in srgb, var(--bg) 34%, transparent);
  cursor: ew-resize;
  touch-action: none;
}
.beat-waveform-track:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
#beatWaveform { display: block; width: 100%; height: 100%; }
.beat-waveform-cursor {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 0;
  width: 1px;
  border-radius: 2px;
  background: #fff;
  box-shadow: 0 0 9px var(--accent), 0 0 18px color-mix(in srgb, var(--accent) 54%, transparent);
  transform: translateX(-50%);
  pointer-events: none;
}
.beat-time-row { display: grid; grid-template-columns: auto 1fr auto; gap: 8px; color: var(--muted); font-size: 8px; font-variant-numeric: tabular-nums; }
#beatCapsuleStatus { overflow: hidden; text-align: center; text-overflow: ellipsis; white-space: nowrap; }
.beat-capsule-controls { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.beat-transport-button,
.beat-capsule-collapse,
.beat-play-button {
  display: inline-grid;
  place-items: center;
  min-width: 30px;
  height: 30px;
  border: 1px solid color-mix(in srgb, var(--line-strong) 76%, transparent);
  border-radius: 10px;
  background: color-mix(in srgb, var(--surface-3) 72%, transparent);
  color: var(--text);
  font-size: 8px;
  cursor: pointer;
  transition: transform 160ms ease, border-color 160ms ease, background 160ms ease;
}
.beat-transport-button:hover,
.beat-capsule-collapse:hover { border-color: color-mix(in srgb, var(--accent) 58%, transparent); transform: translateY(-1px); }
.beat-transport-button:disabled,
.beat-play-button:disabled { cursor: default; opacity: 0.34; transform: none; }
.beat-play-button {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border-color: color-mix(in srgb, var(--accent) 68%, transparent);
  background: var(--accent);
  color: var(--accent-ink);
  box-shadow: 0 0 24px color-mix(in srgb, var(--accent) 32%, transparent);
  font-size: 11px;
}
.beat-play-button:not(:disabled):hover { transform: scale(1.045); }
.beat-loop-button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.beat-volume-control { width: 62px; display: grid; gap: 2px; color: var(--muted); font-size: 7px; text-transform: uppercase; }
.beat-volume-control input { width: 100%; height: 12px; padding: 0; accent-color: var(--accent); }
.beat-capsule-collapse { min-width: 26px; width: 26px; border-radius: 50%; }
.beat-capsule.is-empty .beat-waveform-track { opacity: 0.48; cursor: default; }
.beat-capsule.is-limited .beat-waveform-track { opacity: 0.6; }
.beat-capsule.has-error { border-color: color-mix(in srgb, var(--danger) 58%, var(--line)); }
.beat-capsule.has-error .beat-capsule-copy small { color: var(--danger); }
.beat-capsule.is-seeking .beat-waveform-track { border-color: color-mix(in srgb, var(--accent) 68%, transparent); }
.beat-capsule.is-collapsed {
  width: min(520px, calc(100% - 36px));
  right: calc(var(--beat-capsule-right, 0px) + 18px);
  left: auto;
  min-height: 36px;
  grid-template-columns: minmax(120px, 1fr) auto;
  gap: 8px;
  padding-block: 4px;
  border-radius: 18px;
}
.beat-capsule.is-collapsed .beat-capsule-art,
.beat-capsule.is-collapsed .beat-waveform-panel,
.beat-capsule.is-collapsed .beat-volume-control,
.beat-capsule.is-collapsed #beatSkipBack,
.beat-capsule.is-collapsed #beatSkipForward,
.beat-capsule.is-collapsed #beatLoop { display: none; }
.beat-capsule.is-collapsed .beat-capsule-controls { grid-column: 2; }
.beat-capsule.is-collapsed .beat-play-button { width: 30px; height: 30px; }
html[data-theme="editorial"] .beat-capsule,
html[data-theme="azure"] .beat-capsule {
  background: linear-gradient(135deg, color-mix(in srgb, var(--surface) 88%, #fff), color-mix(in srgb, var(--surface-2) 78%, transparent));
  box-shadow: 0 20px 56px color-mix(in srgb, var(--accent) 10%, transparent), inset 0 1px 0 rgb(255 255 255 / 72%);
}
html[data-theme="blackout"] .beat-capsule {
  border-color: rgb(118 144 255 / 38%);
  background: linear-gradient(135deg, rgb(8 12 22 / 88%), rgb(2 4 9 / 94%));
  box-shadow: 0 28px 82px rgb(0 0 0 / 72%), 0 0 44px rgb(102 127 255 / 10%), inset 0 1px 0 rgb(255 255 255 / 5%);
}
body.is-typing .beat-capsule::before,
body.is-typing .beat-capsule-aura { opacity: 0.1; }
@keyframes beat-capsule-scan { from { transform: translateX(-68%); } to { transform: translateX(78%); } }
@keyframes beat-art-orbit { to { transform: rotate(360deg); } }

.line-stats { display: flex; flex-wrap: wrap; gap: 6px; }
.metric-inline { display: inline-flex; align-items: baseline; gap: 4px; color: color-mix(in srgb, var(--paper-text) 55%, transparent); font-size: 9px; }
.metric-inline strong { color: var(--paper-text); font-size: 11px; }
.privacy-note { color: color-mix(in srgb, var(--paper-text) 42%, transparent); font-size: 9px; }

.sound-sculpture {
  position: absolute;
  z-index: 3;
  top: 9px;
  right: 20px;
  width: 142px;
  height: 70px;
  pointer-events: none;
  perspective: 500px;
  opacity: 0.92;
}

.signal-object,
.editorial-object,
.nocturne-object { position: absolute; inset: 0; display: none; transform-style: preserve-3d; }
html[data-theme="signal"] .signal-object,
html[data-theme="editorial"] .editorial-object,
html[data-theme="nocturne"] .nocturne-object { display: block; }

.signal-object i {
  position: absolute;
  inset: 10px 30px;
  border: 1px solid color-mix(in srgb, var(--accent) 70%, transparent);
  border-radius: 50%;
  box-shadow: inset 0 0 18px var(--accent-soft), 0 0 18px var(--accent-soft);
  animation: phoneme-ring 11s linear infinite;
}
.signal-object i:nth-child(2) { inset: 18px 20px; transform: rotateX(62deg); animation-direction: reverse; animation-duration: 8s; }
.signal-object i:nth-child(3) { inset: 26px 48px; background: var(--accent); border: 0; filter: blur(0.4px); animation-duration: 6s; }

.editorial-object i {
  position: absolute;
  width: 62px;
  height: 52px;
  left: 38px;
  top: 8px;
  border-radius: 36% 64% 70% 30% / 45% 32% 68% 55%;
  background: linear-gradient(135deg, #92a8ff, var(--accent) 48%, #ff8060);
  box-shadow: 0 14px 28px color-mix(in srgb, var(--accent) 22%, transparent);
  animation: editorial-form 10s ease-in-out infinite;
}
.editorial-object i:nth-child(2) { width: 34px; height: 34px; left: 76px; top: 27px; opacity: 0.55; animation-delay: -3s; }
.editorial-object i:nth-child(3) { width: 20px; height: 20px; left: 27px; top: 34px; opacity: 0.35; animation-delay: -6s; }

.nocturne-object i {
  position: absolute;
  width: 58px;
  height: 58px;
  left: 42px;
  top: 5px;
  border-radius: 50%;
  background: conic-gradient(from 30deg, #ff6f9d, var(--accent), #3de0c5, #ff6f9d);
  box-shadow: 0 0 34px color-mix(in srgb, var(--accent) 40%, transparent);
  animation: nocturne-sphere 12s linear infinite;
}
.nocturne-object i:nth-child(2) { inset: 15px 22px; width: auto; height: auto; background: transparent; border: 1px solid rgba(255,255,255,0.44); transform: rotateX(70deg); }
.nocturne-object i:nth-child(3) { width: 12px; height: 12px; left: 92px; top: 10px; background: #3de0c5; animation-duration: 5s; }

@keyframes phoneme-ring { to { transform: rotateX(360deg) rotateZ(360deg); } }
@keyframes editorial-form { 50% { transform: translateY(5px) rotate(12deg) scale(1.08); border-radius: 61% 39% 42% 58% / 58% 63% 37% 42%; } }
@keyframes nocturne-sphere { to { transform: rotate(360deg) rotateY(360deg); } }

.context-heading { min-height: 66px; }
.assistant-orbit { width: 24px; height: 24px; border: 1px solid var(--accent); border-radius: 50%; box-shadow: inset 0 0 0 6px var(--accent-soft); }

.context-tabs {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 3px;
  padding: 8px;
  border-bottom: 1px solid var(--line);
}

.context-tabs button {
  min-width: 0;
  border: 0;
  border-radius: 7px;
  padding: 8px 4px;
  background: transparent;
  color: var(--muted);
  font-size: 9px;
  cursor: pointer;
}

.context-tabs button[aria-selected="true"] { background: var(--accent-soft); color: var(--accent); }
.context-content { height: calc(100% - 115px); }
.context-view { display: none; padding: 15px; }
.context-view.is-active { display: block; }
.view-intro { margin-bottom: 14px; }
.view-intro h3 { font-size: 18px; letter-spacing: -0.035em; }

.suggestions,
.continuation-list,
.bucket,
.stats-grid { display: grid; gap: 8px; }

.bucket { margin-bottom: 16px; }
.bucket > p, .chip-block > p { margin-bottom: 6px; color: var(--faint); font-size: 8px; letter-spacing: 0.12em; text-transform: uppercase; }

.suggestion-card,
.continuation-card,
.stat,
.metric {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface-2);
}

.suggestion-card { display: grid; gap: 7px; padding: 11px; }
.suggestion-card > div { display: flex; align-items: baseline; justify-content: space-between; gap: 9px; }
.suggestion-card strong { font-size: 13px; }
.suggestion-card span, .suggestion-card small { color: var(--muted); font-size: 9px; line-height: 1.45; }

.chip {
  width: max-content;
  border: 0;
  border-radius: 999px;
  padding: 6px 9px;
  background: var(--accent-soft);
  color: var(--accent);
  cursor: pointer;
  font-size: 9px;
}

.continuation-card {
  display: grid;
  gap: 9px;
  padding: 12px;
  transition: border-color 150ms ease, transform 150ms ease;
}
.continuation-card:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.continuation-card blockquote { margin: 0; font-size: 14px; line-height: 1.5; }
.continuation-meta { display: flex; flex-wrap: wrap; gap: 5px; color: var(--muted); font-size: 8px; }
.source-badge { border-radius: 999px; padding: 3px 6px; background: var(--accent-soft); color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; }
.continuation-actions { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.score-ring { color: var(--muted); font-size: 9px; }

.assistant-status { margin-bottom: 10px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.assistant-status.is-error { color: var(--danger); }

.stats-grid { grid-template-columns: 1fr 1fr; }
.stat { display: grid; gap: 5px; padding: 11px; }
.stat span, .metric span { color: var(--muted); font-size: 9px; }
.stat strong { font-size: 21px; font-weight: 560; }
.metric { display: flex; justify-content: space-between; gap: 8px; padding: 9px; }
.metric strong { font-size: 11px; }

body.is-typing .sound-sculpture *,
body.is-typing .beat-contour * { animation-play-state: paused !important; }

@media (max-width: 1320px) {
  .workspace { grid-template-columns: 270px minmax(440px, 1fr) 340px; }
  .workspace.tools-collapsed { grid-template-columns: 62px minmax(440px, 1fr) 340px; }
  .workspace.assistant-collapsed { grid-template-columns: 270px minmax(440px, 1fr) 62px; }
  .workspace.tools-collapsed.assistant-collapsed { grid-template-columns: 62px minmax(440px, 1fr) 62px; }
  .product-bar { grid-template-columns: minmax(150px, 1fr) minmax(170px, 260px) auto auto; }
  .theme-switcher { grid-column: 1 / -1; grid-row: 2; width: max-content; justify-self: center; }
}

@media (max-width: 1080px) {
  .product-bar { grid-template-columns: 1fr minmax(180px, 300px) auto auto; }
  .theme-switcher { grid-column: 1 / -1; width: max-content; justify-self: center; }
  .workspace, .workspace.tools-collapsed { grid-template-columns: 250px minmax(0, 1fr); }
  .tool-panel { grid-row: 1 / span 2; max-height: none; }
  .context-panel { grid-column: 2; max-height: 640px; }
  .context-panel.is-collapsed { max-height: 66px; }
  .editor-zone { min-height: 720px; }
}

@media (max-width: 760px) {
  .app-shell { padding: 8px; }
  .product-bar { grid-template-columns: 1fr auto; padding: 7px 4px 12px; }
  .project-name { grid-column: 1 / -1; grid-row: 2; }
  .theme-switcher { grid-column: 1 / -1; grid-row: 3; max-width: 100%; }
  .top-actions { grid-column: 2; grid-row: 1; }
  .top-actions .word-download-button { display: inline-flex; width: 38px; padding-inline: 10px; }
  .word-download-button span { display: none; }
  .access-gate { grid-column: 1 / -1; grid-row: 4; justify-self: end; }
  .workspace, .workspace.tools-collapsed { display: flex; flex-direction: column; min-height: auto; }
  .tool-panel, .context-panel { max-height: none; }
  .context-panel { order: 0; }
  .tool-panel { order: 1; }
  .tool-panel.is-collapsed, .context-panel.is-collapsed { max-height: 66px; }
  .tool-panel.is-collapsed .panel-heading h2, .tool-panel.is-collapsed .section-index,
  .context-panel.is-collapsed .panel-heading h2, .context-panel.is-collapsed .section-index { width: auto; opacity: 1; }
  .tool-panel.is-collapsed .panel-heading { justify-content: space-between; }
  .context-panel.is-collapsed .panel-heading { justify-content: space-between; }
  .editor-zone { order: -1; min-height: 680px; }
  .editor-toolbar { padding-right: 112px; }
  .sound-sculpture { right: 8px; width: 100px; opacity: 0.72; }
  .editor-badges .live-pill { display: none; }
  #lyricsInput, #highlightLayer { padding: 30px 22px; font-size: 19px; }
  .privacy-note { display: none; }
  .ambient-wave { display: none !important; }
  .ambient-orbit { opacity: 0.1 !important; }
  .beat-capsule {
    bottom: calc(8px + env(safe-area-inset-bottom));
    left: calc(var(--beat-capsule-left, 0px) + 12px);
    right: auto;
    width: calc(var(--beat-capsule-width, 100vw) - 24px);
    min-height: 104px;
    margin: 0;
    grid-template-columns: minmax(108px, 0.72fr) minmax(150px, 1.28fr);
    grid-template-rows: auto auto;
    gap: 8px 10px;
    padding: 9px 10px;
    border-radius: 20px;
  }
  .beat-capsule-source { min-width: 0; }
  .beat-waveform-panel { grid-column: 2; min-width: 0; }
  .beat-capsule-controls { grid-column: 1 / -1; justify-content: center; }
  .beat-volume-control { width: min(90px, 18vw); }
  .beat-capsule.is-collapsed {
    width: min(310px, calc(100% - 24px));
    right: calc(var(--beat-capsule-right, 0px) + 12px);
    left: auto;
    min-height: 52px;
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-rows: auto;
  }
  .beat-capsule.is-collapsed .beat-capsule-controls { grid-column: 2; }
}

@media (max-width: 460px) {
  .top-actions .button-ghost { display: none; }
  .top-actions .word-download-button { display: inline-flex; }
  .brand-logo { display: none !important; }
  .brand-logo-compact.brand-logo-dark { display: block; }
  html[data-theme="editorial"] .brand-logo-compact.brand-logo-dark,
  html[data-theme="azure"] .brand-logo-compact.brand-logo-dark { display: none; }
  html[data-theme="editorial"] .brand-logo-compact.brand-logo-light,
  html[data-theme="azure"] .brand-logo-compact.brand-logo-light { display: block; }
  .theme-switcher { width: 100%; }
  .theme-switcher button { flex: 1; }
  .editor-toolbar { min-height: 82px; gap: 8px; padding: 13px 70px 13px 12px; }
  .editor-font-control { grid-template-columns: minmax(86px, 100px); gap: 0; font-size: 0; }
  .editor-font-control select { min-height: 30px; padding: 7px 8px; font-size: 10px; }
  .editor-badges { display: none; }
  .sound-sculpture { width: 72px; transform: scale(0.74); transform-origin: right center; }
  .three-column-controls, .two-column-controls { grid-template-columns: 1fr; }
  .editor-footer { align-items: flex-start; }
  .context-tabs { grid-template-columns: 1fr 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .beat-capsule {
    left: calc(var(--beat-capsule-left, 0px) + 8px);
    right: auto;
    width: calc(var(--beat-capsule-width, 100vw) - 16px);
    grid-template-columns: 92px minmax(0, 1fr);
  }
  .beat-capsule.is-collapsed { right: calc(var(--beat-capsule-right, 0px) + 8px); left: auto; }
  .beat-capsule-art { width: 30px; height: 30px; }
  .beat-capsule-copy small { display: none; }
  .beat-volume-control { display: none; }
  .beat-capsule-controls { gap: 6px; }
  .beat-transport-button { width: 30px; height: 30px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; }
  .sound-sculpture, .sound-sculpture *, .beat-contour, .beat-contour * { animation: none !important; }
  .ambient-scene, .ambient-scene * { animation: none !important; }
  .blackout-ink, .blackout-filament, .blackout-spectrum { animation: none !important; opacity: 0.045 !important; }
  .typing-glyph { animation: none !important; }
  .brand-intro.is-reduced-motion { animation-duration: 350ms !important; }
  .brand-intro.is-reduced-motion .brand-intro-canvas,
  .brand-intro.is-reduced-motion .brand-intro-liquid,
  .brand-intro.is-reduced-motion .brand-intro-waves,
  .brand-intro.is-reduced-motion .brand-intro-flow { display: none; }
  .brand-intro.is-reduced-motion .brand-intro-logo path { animation: none !important; stroke-dashoffset: 0 !important; }
  .brand-intro.is-reduced-motion .brand-intro-logo { animation: brand-reduced-reveal 350ms ease both; }
  .beat-capsule, .beat-capsule *, .beat-capsule::before { animation: none !important; }
}

@keyframes brand-reduced-reveal { from { opacity: 0; } to { opacity: 1; } }
.mini-app-nav { display: none; }

@media (max-width: 760px) {
  html { overflow-x: hidden; }
  body { overflow-x: hidden; }
  .app-shell { width: 100%; max-width: 100vw; padding: 6px; }
  .product-bar {
    position: sticky;
    z-index: 42;
    top: 0;
    gap: 7px;
    padding: 7px 6px 9px;
    border-radius: 0 0 16px 16px;
    background: color-mix(in srgb, var(--bg) 90%, transparent);
    box-shadow: 0 10px 28px rgb(0 0 0 / 10%);
    backdrop-filter: blur(18px);
  }
  .brand { min-width: 42px; min-height: 42px; }
  .project-name input { min-height: 42px; font-size: 14px; }
  .top-actions { gap: 5px; }
  .top-actions .button { min-height: 42px; }
  .theme-switcher { overflow-x: auto; justify-content: flex-start; padding-bottom: 2px; scrollbar-width: none; }
  .theme-switcher::-webkit-scrollbar { display: none; }
  .theme-switcher button { flex: 0 0 auto; min-height: 36px; }
  .workspace { gap: 8px; }
  .editor-zone, .tool-panel, .context-panel { width: 100%; min-width: 0; border-radius: 18px; }
  .editor-zone { min-height: min(690px, calc(100dvh - 128px)); }
  .editor-toolbar { align-items: flex-start; }
  .editor-font-control { z-index: 20; }
  .editor-font-control { display: block; width: 124px; }
  .editor-font-control > span { display: none; }
  .editor-font-select { width: 100%; min-width: 124px; min-height: 42px; font-size: 13px; }
  #lyricsInput, #highlightLayer { min-height: 480px; padding: 28px 18px 150px; line-height: 1.62; }
  .editor-footer { gap: 8px; padding-inline: 14px; }
  .character-limit { order: -1; margin: 0; padding: 5px 8px; border-radius: 999px; background: color-mix(in srgb, var(--paper-text) 6%, transparent); }
  .tool-panel-body, .context-panel-body { max-height: none; }
  .control-section { padding: 14px; }
  button, a, input, select, summary { touch-action: manipulation; }
  .saved-project-row { grid-template-columns: minmax(0, 1fr) 42px 42px; }
  .saved-project, .saved-project-download, .saved-project-delete { min-height: 42px; }
  .academy-promo { padding: 15px; }
  .paywall, .telegram-login-modal { align-items: end; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .paywall-card, .telegram-login-card { max-height: calc(100dvh - 16px); overflow-y: auto; padding: 24px 18px; border-radius: 24px; }
  .paywall-card h2 { padding-right: 55px; font-size: clamp(25px, 8vw, 34px); }
  .paywall-benefits { grid-template-columns: 1fr; }
  .paywall-benefits li { grid-template-columns: 120px 1fr; align-items: center; }
  .paywall-emoji:nth-child(2), .paywall-emoji:nth-child(3) { display: none; }
}

body.is-telegram-mini-app {
  --tg-safe-area-top: 0px;
  --tg-safe-area-right: 0px;
  --tg-safe-area-bottom: 0px;
  --tg-safe-area-left: 0px;
  min-height: 100dvh;
  background: var(--tg-theme-bg-color, var(--bg));
}
body.is-telegram-mini-app .app-shell {
  min-height: 100dvh;
  padding: var(--tg-safe-area-top) var(--tg-safe-area-right) calc(78px + var(--tg-safe-area-bottom)) var(--tg-safe-area-left);
}
body.is-telegram-mini-app .product-bar {
  top: var(--tg-safe-area-top);
  grid-template-columns: auto minmax(0, 1fr) auto;
  grid-template-rows: auto auto;
  margin: 0;
  padding: 7px 9px;
  border: 0;
  border-bottom: 1px solid var(--line);
  border-radius: 0;
}
body.is-telegram-mini-app .brand { grid-column: 1; grid-row: 1; }
body.is-telegram-mini-app .project-name { grid-column: 1 / -1; grid-row: 2; }
body.is-telegram-mini-app .top-actions { grid-column: 3; grid-row: 1; }
body.is-telegram-mini-app .top-actions #newProjectBtn { display: none; }
body.is-telegram-mini-app .theme-switcher { display: none; }
body.is-telegram-mini-app .access-gate { grid-column: 2; grid-row: 1; min-width: 0; justify-self: end; }
body.is-telegram-mini-app .account-trigger { min-width: 42px; width: 42px; padding: 5px; }
body.is-telegram-mini-app .account-trigger-copy,
body.is-telegram-mini-app .account-trigger-chevron,
body.is-telegram-mini-app .account-login-trigger span { display: none; }
body.is-telegram-mini-app .account-login-trigger { width: 42px; min-width: 42px; padding: 9px; }
body.is-telegram-mini-app .workspace,
body.is-telegram-mini-app .workspace.tools-collapsed { display: block; min-height: 0; padding: 6px; }
body.is-telegram-mini-app .editor-zone,
body.is-telegram-mini-app .tool-panel,
body.is-telegram-mini-app .context-panel { display: none; min-height: calc(100dvh - 158px - var(--tg-safe-area-bottom)); border-radius: 18px; }
body.is-telegram-mini-app[data-mini-view="editor"] .editor-zone,
body.is-telegram-mini-app[data-mini-view="projects"] .tool-panel,
body.is-telegram-mini-app[data-mini-view="tools"] .tool-panel,
body.is-telegram-mini-app[data-mini-view="assistant"] .context-panel { display: block; }
body.is-telegram-mini-app[data-mini-view="projects"] #leftPanelBody > :not(.projects-section):not(.academy-promo) { display: none; }
body.is-telegram-mini-app[data-mini-view="tools"] .projects-section,
body.is-telegram-mini-app[data-mini-view="tools"] .academy-promo { display: none; }
body.is-telegram-mini-app .panel-heading { display: none; }
body.is-telegram-mini-app .tool-panel-body,
body.is-telegram-mini-app .context-panel-body { max-height: none; padding-top: 8px; }
body.is-telegram-mini-app[data-mini-view="editor"] .editor-toolbar { padding: 13px 76px 13px 13px; }
body.is-telegram-mini-app[data-mini-view="editor"] #lyricsInput,
body.is-telegram-mini-app[data-mini-view="editor"] #highlightLayer { min-height: calc(100dvh - 245px - var(--tg-safe-area-bottom)); padding-bottom: 125px; }
body.is-telegram-mini-app:not([data-mini-view="editor"]) .beat-capsule { display: none; }
body.is-telegram-mini-app[data-mini-view="editor"] .beat-capsule {
  bottom: calc(76px + var(--tg-safe-area-bottom));
}
body.is-telegram-mini-app .mini-app-nav {
  position: fixed;
  z-index: 45;
  right: var(--tg-safe-area-right);
  bottom: var(--tg-safe-area-bottom);
  left: var(--tg-safe-area-left);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  min-height: 68px;
  padding: 6px 8px;
  border-top: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  box-shadow: 0 -12px 34px rgb(0 0 0 / 18%);
  backdrop-filter: blur(20px);
}
body.is-telegram-mini-app .mini-app-nav button {
  display: grid;
  min-height: 54px;
  place-items: center;
  gap: 2px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}
body.is-telegram-mini-app .mini-app-nav button span { font-size: 19px; line-height: 1; }
body.is-telegram-mini-app .mini-app-nav button small { font-size: 8px; font-weight: 700; }
body.is-telegram-mini-app .mini-app-nav button[aria-pressed="true"] { background: color-mix(in srgb, var(--accent) 14%, transparent); color: var(--accent); }
body.is-telegram-mini-app .paywall,
body.is-telegram-mini-app .telegram-login-modal { padding-top: calc(8px + var(--tg-safe-area-top)); padding-bottom: calc(8px + var(--tg-safe-area-bottom)); }

@media (prefers-reduced-motion: reduce) {
  .paywall-emoji { animation: none !important; }
}
/* Account and subscription access are controlled by the backend; this layer only explains the state. */
.access-gate { position: relative; display: flex; align-items: center; margin-left: auto; }
.access-dot { display: inline-block; width: 7px; height: 7px; flex: 0 0 auto; border-radius: 50%; background: #d7a946; }
.access-dot.is-active { background: #58d69b; box-shadow: 0 0 12px #58d69b; }
.account-login-trigger { min-height: 38px; white-space: nowrap; }
.account-popover { position: relative; }
.account-trigger {
  display: flex;
  min-width: 170px;
  min-height: 42px;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 150ms ease, background 150ms ease;
}
.account-trigger:hover,
.account-trigger[aria-expanded="true"] { border-color: var(--line-strong); background: var(--surface-2); }
.account-trigger-mark {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #35b8f3, #168bc5);
  color: #fff;
  box-shadow: 0 8px 20px rgb(34 158 217 / 22%);
}
.account-trigger-mark .telegram-mark { width: 17px; height: 17px; fill: currentColor; }
.account-trigger-copy { display: grid; min-width: 0; gap: 2px; flex: 1; }
.account-trigger-copy strong { overflow: hidden; font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.account-trigger-copy small { display: flex; align-items: center; gap: 5px; color: var(--muted); font-size: 8px; white-space: nowrap; }
.account-trigger-chevron { color: var(--muted); font-size: 13px; transition: transform 150ms ease; }
.account-trigger[aria-expanded="true"] .account-trigger-chevron { transform: rotate(180deg); }
.account-menu {
  position: absolute;
  z-index: 80;
  top: calc(100% + 8px);
  right: 0;
  display: grid;
  width: 230px;
  gap: 4px;
  padding: 9px;
  border: 1px solid var(--line-strong);
  border-radius: 15px;
  background: color-mix(in srgb, var(--surface) 96%, transparent);
  box-shadow: 0 22px 64px rgb(0 0 0 / 28%);
  backdrop-filter: blur(18px);
}
.account-menu[hidden] { display: none; }
.account-menu-status { display: flex; align-items: center; gap: 9px; margin-bottom: 4px; padding: 9px; border-radius: 10px; background: var(--surface-2); }
.account-menu-status div { display: grid; gap: 2px; }
.account-menu-status strong { font-size: 10px; }
.account-menu-status small { color: var(--muted); font-size: 8px; letter-spacing: .08em; }
.account-menu > button {
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 10px;
  text-align: left;
}
.account-menu > button:hover { background: var(--surface-2); }
.account-menu > .account-menu-logout { margin-top: 3px; border-top: 1px solid var(--line); border-radius: 0 0 9px 9px; color: var(--danger); }
.paywall, .telegram-login-modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px; background: rgb(5 8 12 / .68); backdrop-filter: blur(13px); }
.paywall[hidden] { display: none; }
.paywall-card, .telegram-login-card { position: relative; width: min(100%, 480px); padding: 32px; border: 1px solid rgb(255 255 255 / .16); border-radius: 24px; background: #151b20; color: #f4f7f8; box-shadow: 0 24px 80px rgb(0 0 0 / .42); }
.paywall-card h2, .telegram-login-card h2 { margin: 8px 0 12px; font-size: clamp(25px, 4vw, 36px); }.paywall-card p, .telegram-login-card p { color: #bac4c9; line-height: 1.55; }.paywall-card .button { margin: 16px 8px 0 0; }.close-login { position: absolute; top: 12px; right: 12px; }
.paywall-card { width: min(100%, 660px); overflow: hidden; background: radial-gradient(circle at 90% 5%, rgb(102 127 255 / 22%), transparent 35%), #11161d; }
.paywall-card::before { position: absolute; inset: 0 0 auto; height: 3px; content: ""; background: linear-gradient(90deg, #667fff, #b772ff, #54d6ff); }
.paywall-lead { max-width: 540px; margin-bottom: 18px; }
.paywall-price { display: flex; align-items: baseline; gap: 7px; margin: 8px 0 20px; }
.paywall-price strong { color: #fff; font-size: clamp(34px, 7vw, 52px); letter-spacing: -.055em; }
.paywall-price span { color: #aeb7c2; font-size: 13px; }
.paywall-benefits { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; margin: 0; padding: 0; list-style: none; }
.paywall-benefits li { display: grid; gap: 4px; padding: 13px; border: 1px solid rgb(255 255 255 / 9%); border-radius: 14px; background: rgb(255 255 255 / 4%); }
.paywall-benefits b { color: #fff; font-size: 12px; }
.paywall-benefits span { color: #aeb7c2; font-size: 10px; line-height: 1.45; }
.paywall-card .paywall-primary-cta { width: 100%; min-height: 54px; margin: 18px 0 10px; border: 0; border-radius: 15px; background: linear-gradient(135deg, #667fff, #8f64ff); color: #fff; box-shadow: 0 14px 34px rgb(102 127 255 / 32%); font-size: 13px; font-weight: 850; letter-spacing: .06em; }
.paywall-existing { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; color: #8f9aa7; font-size: 9px; }
.paywall-existing .telegram-auth-button { min-height: 34px; margin: 0; padding: 7px 11px; border-radius: 10px; font-size: 9px; }
.paywall-refresh { border: 0; background: transparent; color: #aeb7c2; cursor: pointer; font-size: 9px; text-decoration: underline; text-underline-offset: 3px; }
.paywall-emojis { position: absolute; inset: 0; pointer-events: none; }
.paywall-emoji { position: absolute; font-size: 25px; filter: drop-shadow(0 8px 14px rgb(0 0 0 / 30%)); animation: paywall-float 3.6s ease-in-out infinite; }
.paywall-emoji:nth-child(1) { top: 22px; right: 28px; }
.paywall-emoji:nth-child(2) { top: 104px; right: 22px; animation-delay: -.9s; }
.paywall-emoji:nth-child(3) { top: 24px; right: 120px; animation-delay: -1.7s; }
@keyframes paywall-float { 0%, 100% { transform: translate3d(0, 0, 0) rotate(-4deg); } 50% { transform: translate3d(0, -9px, 0) rotate(5deg); } }

.telegram-auth-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid rgb(255 255 255 / 18%);
  background: linear-gradient(135deg, #2aabee 0%, #229ed9 100%);
  color: #fff;
  box-shadow: 0 10px 28px rgb(34 158 217 / 28%);
  text-decoration: none;
  font-weight: 750;
  transition: transform 160ms ease, box-shadow 160ms ease, filter 160ms ease;
}

.telegram-auth-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 14px 34px rgb(34 158 217 / 36%);
  filter: saturate(1.08);
}

.telegram-auth-button:active { transform: translateY(0); }
.telegram-auth-button .telegram-mark { width: 18px; height: 18px; flex: 0 0 auto; fill: currentColor; }
.telegram-auth-button-large { min-height: 46px; padding: 12px 18px; border-radius: 14px; }

.telegram-app-auth-card {
  position: relative;
  width: min(100%, 520px);
  overflow: hidden;
  background:
    radial-gradient(circle at 85% 0%, rgb(42 171 238 / 16%), transparent 38%),
    #111820;
}

.telegram-app-auth-card::before {
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  content: "";
  background: linear-gradient(90deg, #2aabee, #70d5ff);
}

.telegram-app-auth-card strong { color: #fff; }

.telegram-auth-hero {
  display: grid;
  width: 72px;
  height: 72px;
  margin-bottom: 18px;
  place-items: center;
  border-radius: 24px;
  background: linear-gradient(145deg, #35b8f3, #168bc5);
  box-shadow: 0 18px 44px rgb(34 158 217 / 32%);
  transform: rotate(-4deg);
}

.telegram-auth-hero .telegram-mark { width: 38px; height: 38px; fill: #fff; transform: rotate(4deg); }

.telegram-auth-status {
  margin: 20px 0 14px;
  padding: 12px 14px;
  border: 1px solid rgb(112 213 255 / 18%);
  border-radius: 14px;
  background: rgb(42 171 238 / 8%);
  color: #d9e6ec;
  line-height: 1.45;
}

.telegram-auth-hint { display: block; margin-top: 14px; color: #81919a; line-height: 1.45; }
.telegram-app-auth-card [data-telegram-retry] { margin-top: 10px; }
@media (max-width: 900px) { .access-gate { justify-self: end; margin-left: 0; }.product-bar { flex-wrap: wrap; } }

@media (max-width: 760px) {
  .paywall, .telegram-login-modal { align-items: end; padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); }
  .paywall-card, .telegram-login-card {
    max-height: calc(100dvh - 16px);
    overflow-x: hidden;
    overflow-y: auto;
    padding: 24px 18px;
    border-radius: 24px;
  }
  .paywall-card h2 { padding-right: 42px; font-size: clamp(25px, 8vw, 34px); }
  .paywall-benefits { grid-template-columns: 1fr; }
  .paywall-benefits li { grid-template-columns: 108px minmax(0, 1fr); align-items: center; }
  .paywall-emoji:nth-child(2), .paywall-emoji:nth-child(3) { display: none; }
}
