/* ==========================================================================
   AI VOICE STUDIO — style.css
   --------------------------------------------------------------------------
   1.  Design tokens (dark + light themes)
   2.  Reset & base
   3.  Utilities
   4.  Background FX
   5.  Boot / loading screen
   6.  Buttons & form controls
   7.  Header & navigation
   8.  Hero
   9.  Alerts
   10. Cards & studio layout
   11. Editor
   12. Now playing / progress
   13. Stats
   14. Transport & sliders
   15. Presets
   16. Voice library
   17. My library (history / saved)
   18. Sections: features, about, install CTA
   19. Footer
   20. Modal & toasts
   21. Responsive breakpoints
   22. Motion / print / high-contrast preferences
   ========================================================================== */

/* ============ 1. DESIGN TOKENS ============ */
:root {
  /* Brand ramp */
  --blue-400: #4f8cff;
  --blue-500: #2f6bff;
  --violet-400: #8b5cf6;
  --violet-500: #7c3aed;
  --pink-400: #d946ef;
  --cyan-400: #22d3ee;

  --grad-brand: linear-gradient(135deg, #4f8cff 0%, #7c3aed 55%, #d946ef 100%);
  --grad-brand-soft: linear-gradient(135deg, rgba(79,140,255,.22), rgba(124,58,237,.22));
  --grad-text: linear-gradient(100deg, #6ea8ff 0%, #a78bfa 45%, #e879f9 100%);

  /* Radii */
  --r-xs: 8px;
  --r-sm: 12px;
  --r-md: 16px;
  --r-lg: 22px;
  --r-xl: 30px;
  --r-pill: 999px;

  /* Motion */
  --t-fast: 140ms cubic-bezier(.4, 0, .2, 1);
  --t-base: 260ms cubic-bezier(.4, 0, .2, 1);
  --t-slow: 520ms cubic-bezier(.22, 1, .36, 1);

  /* Type */
  --font-display: "Outfit", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;

  /* Layout */
  --header-h: 68px;
  --maxw: 1320px;
}

/* ---- Dark theme (default) ---- */
[data-theme="dark"] {
  --bg: #070b16;
  --bg-2: #0b0f1e;
  --surface: rgba(255, 255, 255, .045);
  --surface-2: rgba(255, 255, 255, .07);
  --surface-3: rgba(255, 255, 255, .10);
  --stroke: rgba(255, 255, 255, .10);
  --stroke-strong: rgba(255, 255, 255, .18);
  --text: #eef1f8;
  --text-2: #a9b2c9;
  --text-3: #6f7a95;
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, .35);
  --shadow-md: 0 14px 40px rgba(0, 0, 0, .45);
  --shadow-lg: 0 30px 80px rgba(0, 0, 0, .55);
  --glow: 0 0 0 1px rgba(124, 58, 237, .35), 0 18px 50px rgba(79, 140, 255, .25);
  --blur: 18px;
  --success: #34d399;
  --warn: #fbbf24;
  --danger: #fb7185;
  --track: rgba(255, 255, 255, .12);
  --scheme: dark;
}

/* ---- Light theme ---- */
[data-theme="light"] {
  --bg: #eef2fb;
  --bg-2: #f7f9ff;
  --surface: rgba(255, 255, 255, .72);
  --surface-2: rgba(255, 255, 255, .88);
  --surface-3: rgba(255, 255, 255, 1);
  --stroke: rgba(15, 23, 42, .10);
  --stroke-strong: rgba(15, 23, 42, .18);
  --text: #10162b;
  --text-2: #4a5570;
  --text-3: #7a8399;
  --shadow-sm: 0 4px 14px rgba(23, 33, 66, .08);
  --shadow-md: 0 14px 38px rgba(23, 33, 66, .12);
  --shadow-lg: 0 28px 70px rgba(23, 33, 66, .16);
  --glow: 0 0 0 1px rgba(124, 58, 237, .22), 0 18px 44px rgba(79, 140, 255, .20);
  --blur: 16px;
  --success: #059669;
  --warn: #b45309;
  --danger: #e11d48;
  --track: rgba(15, 23, 42, .12);
  --scheme: light;
}

/* ============ 2. RESET & BASE ============ */
*, *::before, *::after { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-padding-top: calc(var(--header-h) + 14px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.6;
  color: var(--text);
  background: var(--bg);
  color-scheme: var(--scheme);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--t-base), color var(--t-base);
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: -.02em;
  margin: 0 0 .5em;
}

p { margin: 0 0 1em; }
p:last-child { margin-bottom: 0; }

a { color: inherit; text-decoration: none; }

img, svg { max-width: 100%; display: block; }

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

::selection { background: rgba(124, 58, 237, .45); color: #fff; }

/* Scrollbars */
* { scrollbar-width: thin; scrollbar-color: var(--stroke-strong) transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
  background: var(--stroke-strong);
  border-radius: var(--r-pill);
  border: 2px solid transparent;
  background-clip: content-box;
}
*::-webkit-scrollbar-thumb:hover { background: var(--violet-400); background-clip: content-box; }

/* Focus rings — visible for keyboard users only */
:focus-visible {
  outline: 2px solid var(--violet-400);
  outline-offset: 3px;
  border-radius: var(--r-xs);
}

/* ============ 3. UTILITIES ============ */
.container {
  width: 100%;
  max-width: var(--maxw);
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 40px);
}

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

.skip-link {
  position: fixed;
  top: -100px; left: 16px;
  z-index: 200;
  padding: 12px 20px;
  background: var(--grad-brand);
  color: #fff;
  border-radius: var(--r-sm);
  font-weight: 600;
  transition: top var(--t-fast);
}
.skip-link:focus { top: 16px; }

.grad-text {
  background: var(--grad-text);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

.eyebrow {
  display: inline-block;
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .16em;
  text-transform: uppercase;
  color: var(--violet-400);
  margin-bottom: 10px;
}

.link-btn {
  background: none;
  border: 0;
  padding: 0;
  color: var(--text-2);
  font-size: .88rem;
  font-weight: 600;
  cursor: pointer;
  transition: color var(--t-fast);
}
.link-btn:hover { color: var(--violet-400); }

.hint { font-size: .76rem; color: var(--text-3); }

/* ============ 4. BACKGROUND FX ============ */
.bg-fx {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at 80% -10%, rgba(124, 58, 237, .18), transparent 60%),
    radial-gradient(900px 600px at 0% 10%, rgba(79, 140, 255, .16), transparent 60%),
    var(--bg);
}

.bg-fx__blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(90px);
  opacity: .45;
  will-change: transform;
}
.bg-fx__blob--1 {
  width: 46vw; height: 46vw; min-width: 320px; min-height: 320px;
  top: -12%; left: -8%;
  background: radial-gradient(circle, var(--blue-500), transparent 68%);
  animation: float1 26s ease-in-out infinite;
}
.bg-fx__blob--2 {
  width: 40vw; height: 40vw; min-width: 300px; min-height: 300px;
  top: 18%; right: -10%;
  background: radial-gradient(circle, var(--violet-500), transparent 68%);
  animation: float2 32s ease-in-out infinite;
}
.bg-fx__blob--3 {
  width: 36vw; height: 36vw; min-width: 260px; min-height: 260px;
  bottom: -14%; left: 34%;
  background: radial-gradient(circle, var(--pink-400), transparent 70%);
  opacity: .28;
  animation: float3 38s ease-in-out infinite;
}
[data-theme="light"] .bg-fx__blob { opacity: .30; }

.bg-fx__grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, .028) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, .028) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 75%);
  -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 20%, transparent 75%);
}
[data-theme="light"] .bg-fx__grid {
  background-image:
    linear-gradient(rgba(15, 23, 42, .05) 1px, transparent 1px),
    linear-gradient(90deg, rgba(15, 23, 42, .05) 1px, transparent 1px);
}

@keyframes float1 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(6%, 8%) scale(1.12); } }
@keyframes float2 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(-8%, 6%) scale(1.08); } }
@keyframes float3 { 0%,100% { transform: translate(0,0) scale(1); } 50% { transform: translate(4%, -10%) scale(1.15); } }

/* ============ 5. BOOT / LOADING SCREEN ============ */
.boot {
  position: fixed;
  inset: 0;
  z-index: 300;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 26px;
  background: var(--bg);
  transition: opacity var(--t-slow), visibility var(--t-slow);
}
.boot.is-hidden { opacity: 0; visibility: hidden; pointer-events: none; }

.boot__orb {
  position: relative;
  width: 92px; height: 92px;
  display: grid;
  place-items: center;
}
.boot__orb span {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
  border-top-color: var(--blue-400);
  border-right-color: var(--violet-400);
  animation: spin 1.15s linear infinite;
}
.boot__orb span:nth-child(2) { inset: 14px; animation-duration: 1.6s; animation-direction: reverse; border-top-color: var(--pink-400); border-right-color: var(--cyan-400); }
.boot__orb span:nth-child(3) { inset: 28px; animation-duration: 2.1s; border-top-color: var(--violet-400); border-right-color: transparent; }

@keyframes spin { to { transform: rotate(360deg); } }

.boot__text {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 600;
  color: var(--text-2);
  letter-spacing: .02em;
  animation: pulseText 1.8s ease-in-out infinite;
}
@keyframes pulseText { 0%,100% { opacity: .55; } 50% { opacity: 1; } }

/* ============ 6. BUTTONS & FORM CONTROLS ============ */
.btn {
  --btn-bg: var(--surface-2);
  --btn-fg: var(--text);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 11px 18px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-pill);
  background: var(--btn-bg);
  color: var(--btn-fg);
  font-family: var(--font-display);
  font-weight: 600;
  font-size: .93rem;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: transform var(--t-fast), box-shadow var(--t-base), background var(--t-base), border-color var(--t-base), opacity var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.btn:hover:not(:disabled) { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--stroke-strong); }
.btn:active:not(:disabled) { transform: translateY(0) scale(.98); }
.btn:disabled { opacity: .38; cursor: not-allowed; }

.btn--primary {
  --btn-bg: var(--grad-brand);
  --btn-fg: #fff;
  border-color: transparent;
  box-shadow: 0 10px 30px rgba(96, 76, 255, .35);
}
.btn--primary:hover:not(:disabled) { box-shadow: 0 16px 44px rgba(96, 76, 255, .5); }

.btn--soft { --btn-bg: var(--surface-2); backdrop-filter: blur(var(--blur)); }
.btn--ghost { --btn-bg: transparent; }
.btn--ghost:hover:not(:disabled) { background: var(--surface-2); }

.btn--lg { padding: 15px 28px; font-size: 1rem; }
.btn--sm { padding: 8px 14px; font-size: .82rem; }
.btn--reset { grid-column: 1 / -1; justify-self: start; }

.btn--speak { min-width: 148px; position: relative; overflow: hidden; }
.btn--speak::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(110deg, transparent 20%, rgba(255, 255, 255, .28) 50%, transparent 80%);
  transform: translateX(-120%);
  animation: shimmer 3.6s ease-in-out infinite;
}
@keyframes shimmer { 0%, 60% { transform: translateX(-120%); } 100% { transform: translateX(120%); } }

.icon-btn {
  display: grid;
  place-items: center;
  width: 42px; height: 42px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-sm);
  background: var(--surface);
  backdrop-filter: blur(var(--blur));
  color: var(--text-2);
  cursor: pointer;
  transition: all var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.icon-btn:hover { color: var(--text); background: var(--surface-3); transform: translateY(-2px); }

/* Theme icon swap */
.ico { transition: opacity var(--t-base), transform var(--t-base); }
[data-theme="dark"] .ico--sun,
[data-theme="light"] .ico--moon { display: none; }

/* Selects & search inputs */
select,
input[type="search"],
input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--text);
  font-size: .88rem;
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
}
select { cursor: pointer; appearance: none; padding-right: 34px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%238b5cf6' stroke-width='3' stroke-linecap='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
}
select option { background: var(--bg-2); color: var(--text); }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--violet-400);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, .22);
}

/* Range sliders */
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 26px;
  background: transparent;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 7px;
  border-radius: var(--r-pill);
  background:
    linear-gradient(90deg, var(--blue-400), var(--violet-400)) 0 / var(--fill, 50%) 100% no-repeat,
    var(--track);
}
input[type="range"]::-moz-range-track {
  height: 7px;
  border-radius: var(--r-pill);
  background: var(--track);
}
input[type="range"]::-moz-range-progress {
  height: 7px;
  border-radius: var(--r-pill);
  background: linear-gradient(90deg, var(--blue-400), var(--violet-400));
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px; height: 20px;
  margin-top: -6.5px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--violet-400);
  box-shadow: 0 3px 12px rgba(124, 58, 237, .55);
  transition: transform var(--t-fast), box-shadow var(--t-fast);
}
input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  border: 3px solid var(--violet-400);
  box-shadow: 0 3px 12px rgba(124, 58, 237, .55);
}
input[type="range"]:hover::-webkit-slider-thumb { transform: scale(1.18); }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.05); box-shadow: 0 0 0 8px rgba(124, 58, 237, .18); }

/* ============ 7. HEADER & NAV ============ */
.header {
  position: sticky;
  top: 0;
  z-index: 100;
  height: var(--header-h);
  display: flex;
  align-items: center;
  border-bottom: 1px solid transparent;
  transition: background var(--t-base), border-color var(--t-base), backdrop-filter var(--t-base);
}
.header.is-stuck {
  background: color-mix(in srgb, var(--bg) 72%, transparent);
  backdrop-filter: blur(var(--blur)) saturate(160%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(160%);
  border-bottom-color: var(--stroke);
}
.header__inner {
  display: flex;
  align-items: center;
  gap: 18px;
  width: 100%;
}

.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.12rem;
  letter-spacing: -.02em;
  margin-right: auto;
}
.brand__logo {
  display: grid;
  place-items: center;
  width: 40px; height: 40px;
  border-radius: 13px;
  background: var(--grad-brand);
  color: #fff;
  box-shadow: 0 8px 22px rgba(96, 76, 255, .45);
  transition: transform var(--t-base);
}
.brand:hover .brand__logo { transform: rotate(-8deg) scale(1.06); }

.nav {
  display: flex;
  align-items: center;
  gap: 4px;
}
.nav__link {
  padding: 9px 15px;
  border-radius: var(--r-pill);
  font-size: .92rem;
  font-weight: 600;
  color: var(--text-2);
  background: none;
  border: 0;
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
}
.nav__link:hover, .nav__link.is-active { color: var(--text); background: var(--surface-2); }
.nav__link--btn {
  color: #fff;
  background: var(--grad-brand);
  box-shadow: 0 8px 22px rgba(96, 76, 255, .32);
}
.nav__link--btn:hover { color: #fff; background: var(--grad-brand); transform: translateY(-1px); }

.header__actions { display: flex; align-items: center; gap: 8px; }

.icon-btn--menu { display: none; flex-direction: column; gap: 4px; }
.icon-btn--menu span {
  width: 18px; height: 2px;
  background: currentColor;
  border-radius: 2px;
  transition: transform var(--t-fast), opacity var(--t-fast);
}
.icon-btn--menu[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.icon-btn--menu[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.icon-btn--menu[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

/* ============ 8. HERO ============ */
.hero {
  text-align: center;
  padding-block: clamp(48px, 8vw, 96px) clamp(32px, 5vw, 56px);
}
.hero__badge {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 8px 16px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-pill);
  background: var(--surface);
  backdrop-filter: blur(var(--blur));
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 22px;
  animation: fadeUp .7s var(--t-slow) both;
}
.hero__badge .dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 rgba(52, 211, 153, .7);
  animation: ping 2s infinite;
}
@keyframes ping {
  70% { box-shadow: 0 0 0 9px rgba(52, 211, 153, 0); }
  100% { box-shadow: 0 0 0 0 rgba(52, 211, 153, 0); }
}

.hero__title {
  font-size: clamp(2.1rem, 6.2vw, 4.3rem);
  font-weight: 800;
  margin-bottom: 18px;
  animation: fadeUp .7s .08s var(--t-slow) both;
}
.hero__sub {
  max-width: 720px;
  margin: 0 auto 30px;
  font-size: clamp(.98rem, 2.2vw, 1.14rem);
  color: var(--text-2);
  animation: fadeUp .7s .16s var(--t-slow) both;
}
.hero__cta {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-bottom: 44px;
  animation: fadeUp .7s .24s var(--t-slow) both;
}

.hero__stats {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 14px;
  max-width: 780px;
  margin-inline: auto;
  animation: fadeUp .7s .32s var(--t-slow) both;
}
.hero__stats li {
  padding: 18px 12px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  background: var(--surface);
  backdrop-filter: blur(var(--blur));
  transition: transform var(--t-base), border-color var(--t-base);
}
.hero__stats li:hover { transform: translateY(-4px); border-color: var(--stroke-strong); }
.hero__stats strong {
  display: block;
  font-family: var(--font-display);
  font-size: 1.6rem;
  background: var(--grad-text);
  -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.hero__stats span { font-size: .78rem; color: var(--text-3); }

@keyframes fadeUp { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: none; } }

/* ============ 9. ALERTS ============ */
.alert {
  display: block;
  padding: 15px 18px;
  border-radius: var(--r-md);
  border: 1px solid;
  font-size: .9rem;
  margin-bottom: 18px;
  backdrop-filter: blur(var(--blur));
  animation: fadeUp .4s both;
}
.alert strong { display: block; margin-bottom: 3px; font-family: var(--font-display); }
.alert--danger { border-color: rgba(251, 113, 133, .45); background: rgba(251, 113, 133, .11); color: var(--danger); }
.alert--warn { border-color: rgba(251, 191, 36, .45); background: rgba(251, 191, 36, .10); color: var(--warn); }

/* ============ 10. CARDS & STUDIO LAYOUT ============ */
.studio { padding-block: 10px 40px; }

.studio__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}
.col { display: grid; gap: 22px; min-width: 0; }

.card {
  position: relative;
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  background: var(--surface);
  backdrop-filter: blur(var(--blur)) saturate(150%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(150%);
  box-shadow: var(--shadow-md);
  padding: clamp(16px, 2.4vw, 24px);
  transition: border-color var(--t-base), box-shadow var(--t-base), transform var(--t-base);
  overflow: hidden;
}
.card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .35), transparent);
  opacity: .6;
}
.card:hover { border-color: var(--stroke-strong); box-shadow: var(--shadow-lg); }

.card__head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}
.card__title {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 0;
  font-size: 1.02rem;
  font-weight: 700;
}
.card__title svg { color: var(--violet-400); flex: none; }
.card__head-actions, .card__head .pill, .card__head .link-btn { margin-left: auto; }

.pill {
  padding: 5px 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--stroke);
  background: var(--surface-2);
  font-size: .74rem;
  font-weight: 600;
  color: var(--text-2);
  white-space: nowrap;
}
.pill--save { color: var(--success); border-color: rgba(52, 211, 153, .35); background: rgba(52, 211, 153, .10); }
.pill.is-speaking { color: var(--blue-400); border-color: rgba(79, 140, 255, .45); background: rgba(79, 140, 255, .12); }
.pill.is-paused { color: var(--warn); border-color: rgba(251, 191, 36, .45); background: rgba(251, 191, 36, .12); }

/* ============ 11. EDITOR ============ */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 7px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  background: var(--surface-2);
  margin-bottom: 14px;
}
.tool {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--text-2);
  font-size: .82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.tool:hover:not(:disabled) { background: var(--surface-3); color: var(--text); transform: translateY(-1px); }
.tool:disabled { opacity: .35; cursor: not-allowed; }
.tool svg { flex: none; }
.tool--fav.is-active { color: var(--warn); }
.tool--fav.is-active svg { fill: var(--warn); }
.tool-sep { width: 1px; height: 20px; background: var(--stroke); margin-inline: 3px; }

.editor-wrap { position: relative; }
.editor {
  width: 100%;
  min-height: clamp(200px, 30vh, 320px);
  padding: 18px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.02rem;
  line-height: 1.75;
  resize: vertical;
  transition: border-color var(--t-fast), box-shadow var(--t-fast);
}
.editor::placeholder { color: var(--text-3); }
.editor-wrap:focus-within .editor__glow {
  opacity: 1;
}
.editor__glow {
  position: absolute;
  inset: -1px;
  border-radius: var(--r-md);
  pointer-events: none;
  opacity: 0;
  background: var(--grad-brand);
  filter: blur(18px);
  z-index: -1;
  transition: opacity var(--t-base);
}
.editor-wrap.is-dragover .editor {
  border-color: var(--violet-400);
  border-style: dashed;
  background: var(--grad-brand-soft);
}

/* ============ 12. NOW PLAYING ============ */
.now-playing {
  margin-top: 14px;
  padding: 14px 16px;
  border: 1px solid rgba(124, 58, 237, .35);
  border-radius: var(--r-md);
  background: var(--grad-brand-soft);
  animation: fadeUp .3s both;
}
.now-playing__head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}
.now-playing__label {
  font-family: var(--font-display);
  font-size: .78rem;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--violet-400);
}
.now-playing__count { margin-left: auto; font-size: .76rem; color: var(--text-2); font-variant-numeric: tabular-nums; }
.now-playing__text {
  margin: 0 0 10px;
  font-size: .95rem;
  color: var(--text);
  max-height: 4.6em;
  overflow: auto;
}

.eq { display: inline-flex; align-items: flex-end; gap: 2.5px; height: 16px; }
.eq i {
  display: block;
  width: 3px;
  border-radius: 2px;
  background: var(--violet-400);
  animation: eq 1s ease-in-out infinite;
}
.eq i:nth-child(1) { height: 6px;  animation-delay: 0s; }
.eq i:nth-child(2) { height: 14px; animation-delay: .15s; }
.eq i:nth-child(3) { height: 9px;  animation-delay: .3s; }
.eq i:nth-child(4) { height: 16px; animation-delay: .45s; }
.eq i:nth-child(5) { height: 7px;  animation-delay: .6s; }
@keyframes eq { 0%, 100% { transform: scaleY(.35); } 50% { transform: scaleY(1); } }
.eq.is-idle i { animation-play-state: paused; }

.progress {
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--track);
  overflow: hidden;
}
.progress__bar {
  height: 100%;
  width: 0%;
  border-radius: var(--r-pill);
  background: var(--grad-brand);
  transition: width .25s linear;
}

/* ============ 13. STATS ============ */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 9px;
  margin-top: 14px;
}
.stat {
  padding: 12px 10px;
  text-align: center;
  border: 1px solid var(--stroke);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  transition: border-color var(--t-fast), transform var(--t-fast);
}
.stat:hover { border-color: var(--stroke-strong); transform: translateY(-2px); }
.stat__val {
  display: block;
  font-family: var(--font-display);
  font-size: 1.16rem;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.stat__key { font-size: .7rem; color: var(--text-3); letter-spacing: .03em; }

/* ============ 14. TRANSPORT & SLIDERS ============ */
.transport {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-bottom: 20px;
}

.sliders {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px 22px;
  padding: 16px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  background: var(--surface-2);
}
.slider__top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 2px;
}
.slider__top label { font-size: .85rem; font-weight: 600; color: var(--text-2); }
.slider__top output {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: .88rem;
  color: var(--violet-400);
  font-variant-numeric: tabular-nums;
}
.slider__scale {
  display: flex;
  justify-content: space-between;
  font-size: .68rem;
  color: var(--text-3);
  margin-top: -2px;
}

/* ============ 15. PRESETS ============ */
.presets { margin-top: 20px; }
.presets__head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 11px;
}
.presets__head h3 { margin: 0; font-size: .95rem; }
.presets__head .hint { margin-left: auto; }

.preset-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(122px, 1fr));
  gap: 9px;
}
.preset {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 13px 8px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: .8rem;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  transition: all var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.preset__emoji { font-size: 1.28rem; line-height: 1; }
.preset:hover { transform: translateY(-3px); border-color: var(--stroke-strong); color: var(--text); box-shadow: var(--shadow-sm); }
.preset.is-active {
  color: #fff;
  background: var(--grad-brand);
  border-color: transparent;
  box-shadow: 0 10px 26px rgba(96, 76, 255, .38);
}

/* ============ 16. VOICE LIBRARY ============ */
.voice-search {
  position: relative;
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}
.voice-search svg {
  position: absolute;
  left: 13px;
  color: var(--text-3);
  pointer-events: none;
}
.voice-search input { padding-left: 38px; }
.voice-search input::-webkit-search-cancel-button { filter: invert(.5); }

.filter-row {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}
.chip {
  padding: 7px 13px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text-2);
  font-size: .79rem;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.chip:hover { color: var(--text); border-color: var(--stroke-strong); }
.chip.is-active { color: #fff; background: var(--grad-brand); border-color: transparent; }

.voice-list {
  max-height: 420px;
  overflow-y: auto;
  display: grid;
  gap: 7px;
  padding-right: 4px;
  scroll-behavior: smooth;
}
.voice-list:focus-visible { outline-offset: 6px; }

.voice-group {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 7px 4px 5px;
  font-family: var(--font-display);
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .09em;
  text-transform: uppercase;
  color: var(--text-3);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--stroke);
}

.voice {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 12px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  cursor: pointer;
  text-align: left;
  width: 100%;
  transition: all var(--t-fast);
  -webkit-tap-highlight-color: transparent;
}
.voice:hover { border-color: var(--stroke-strong); transform: translateX(3px); background: var(--surface-3); }
.voice.is-selected {
  border-color: var(--violet-400);
  background: var(--grad-brand-soft);
  box-shadow: 0 0 0 1px rgba(124, 58, 237, .35);
}
.voice__flag {
  display: grid;
  place-items: center;
  width: 36px; height: 36px;
  flex: none;
  border-radius: 11px;
  background: var(--surface-3);
  font-size: 1.05rem;
}
.voice__body { min-width: 0; flex: 1; }
.voice__name {
  display: block;
  font-weight: 600;
  font-size: .89rem;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.voice__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 3px;
  font-size: .7rem;
  color: var(--text-3);
}
.voice__tag {
  padding: 1px 7px;
  border-radius: var(--r-pill);
  background: var(--surface-3);
  border: 1px solid var(--stroke);
}
.voice__tag--f { color: #f0abfc; border-color: rgba(240, 171, 252, .3); }
.voice__tag--m { color: #7dd3fc; border-color: rgba(125, 211, 252, .3); }
.voice__tag--local { color: var(--success); border-color: rgba(52, 211, 153, .3); }
[data-theme="light"] .voice__tag--f { color: #a21caf; }
[data-theme="light"] .voice__tag--m { color: #0369a1; }

.voice__star {
  flex: none;
  display: grid;
  place-items: center;
  width: 32px; height: 32px;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: all var(--t-fast);
}
.voice__star:hover { color: var(--warn); background: var(--surface-3); transform: scale(1.15); }
.voice__star.is-fav { color: var(--warn); }
.voice__star.is-fav svg { fill: var(--warn); }

.empty {
  padding: 30px 16px;
  text-align: center;
  color: var(--text-3);
  font-size: .87rem;
  border: 1px dashed var(--stroke);
  border-radius: var(--r-md);
}
.empty strong { display: block; color: var(--text-2); margin-bottom: 4px; }

.voice-foot {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--stroke);
}
.voice-foot .btn { flex: 1; }

/* Skeleton loaders (lazy voice loading) */
.skeleton {
  height: 60px;
  border-radius: var(--r-sm);
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shine 1.4s linear infinite;
}
@keyframes shine { to { background-position: -200% 0; } }

/* ============ 17. MY LIBRARY ============ */
.lib-list {
  display: grid;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  padding-right: 4px;
}
.lib-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 12px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  transition: all var(--t-fast);
}
.lib-item:hover { border-color: var(--stroke-strong); background: var(--surface-3); }
.lib-item__body { flex: 1; min-width: 0; cursor: pointer; background: none; border: 0; text-align: left; padding: 0; color: inherit; }
.lib-item__text {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  font-size: .85rem;
  color: var(--text);
  margin: 0 0 4px;
}
.lib-item__meta { font-size: .7rem; color: var(--text-3); display: flex; gap: 8px; flex-wrap: wrap; }
.lib-item__del {
  flex: none;
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border: 0;
  border-radius: var(--r-xs);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  transition: all var(--t-fast);
}
.lib-item__del:hover { color: var(--danger); background: rgba(251, 113, 133, .12); }

/* ============ 18. SECTIONS ============ */
.section { padding-block: clamp(48px, 8vw, 88px); }
.section__head { text-align: center; max-width: 760px; margin: 0 auto clamp(28px, 4vw, 46px); }
.section__title { font-size: clamp(1.7rem, 4.2vw, 2.7rem); margin-bottom: 12px; }
.section__sub { color: var(--text-2); margin: 0; }

.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
  gap: 16px;
}
.feature {
  padding: 24px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-lg);
  background: var(--surface);
  backdrop-filter: blur(var(--blur));
  transition: transform var(--t-base), border-color var(--t-base), box-shadow var(--t-base);
}
.feature:hover { transform: translateY(-6px); border-color: var(--stroke-strong); box-shadow: var(--shadow-lg); }
.feature__ico {
  display: grid;
  place-items: center;
  width: 48px; height: 48px;
  border-radius: 15px;
  background: var(--grad-brand-soft);
  border: 1px solid var(--stroke);
  font-size: 1.4rem;
  margin-bottom: 14px;
}
.feature h3 { font-size: 1.04rem; margin-bottom: 7px; }
.feature p { font-size: .89rem; color: var(--text-2); margin: 0; }

.about {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: 34px;
  align-items: start;
}
.about__text p { color: var(--text-2); }
.about__list { list-style: none; padding: 0; margin: 18px 0 0; display: grid; gap: 10px; }
.about__list li { display: flex; gap: 10px; align-items: center; font-size: .92rem; color: var(--text-2); }
.about__list span {
  display: grid; place-items: center;
  width: 22px; height: 22px; flex: none;
  border-radius: 50%;
  background: rgba(52, 211, 153, .16);
  color: var(--success);
  font-size: .72rem; font-weight: 700;
}
.about__panel { display: grid; gap: 14px; }
.mini-card {
  padding: 20px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-md);
  background: var(--surface);
  backdrop-filter: blur(var(--blur));
}
.mini-card h4 { font-size: .96rem; margin-bottom: 7px; color: var(--violet-400); }
.mini-card p { font-size: .86rem; color: var(--text-2); margin: 0; }

.install-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 20px;
  padding: clamp(24px, 4vw, 40px);
  border: 1px solid var(--stroke);
  border-radius: var(--r-xl);
  background:
    radial-gradient(600px 200px at 20% 0%, rgba(124, 58, 237, .22), transparent 70%),
    var(--surface);
  backdrop-filter: blur(var(--blur));
  box-shadow: var(--shadow-md);
}
.install-cta h2 { font-size: clamp(1.3rem, 3vw, 1.9rem); margin-bottom: 6px; }
.install-cta p { color: var(--text-2); margin: 0; font-size: .93rem; }
.install-cta > div { flex: 1 1 300px; }
.install-cta__note { flex-basis: 100%; font-size: .82rem !important; color: var(--text-3) !important; }

/* ============ 19. FOOTER ============ */
.footer {
  margin-top: 30px;
  border-top: 1px solid var(--stroke);
  background: color-mix(in srgb, var(--bg) 60%, transparent);
  backdrop-filter: blur(var(--blur));
  padding-block: 34px 26px;
}
.footer__inner { display: grid; gap: 20px; }
.footer__brand { display: flex; align-items: center; gap: 12px; }
.footer__brand strong { font-family: var(--font-display); font-size: 1.02rem; }
.footer__brand p { margin: 2px 0 0; font-size: .84rem; color: var(--text-3); }
.footer__nav { display: flex; flex-wrap: wrap; gap: 8px 20px; }
.footer__nav a, .footer__nav .link-btn { font-size: .88rem; color: var(--text-2); transition: color var(--t-fast); }
.footer__nav a:hover { color: var(--violet-400); }
.footer__copy {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--stroke);
  font-size: .8rem;
  color: var(--text-3);
}

/* ============ 20. MODAL & TOASTS ============ */
.modal {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal[hidden] { display: none; }
.modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(3, 6, 15, .68);
  backdrop-filter: blur(6px);
  animation: fadeIn .2s both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.modal__box {
  position: relative;
  width: min(560px, 100%);
  max-height: 84vh;
  overflow-y: auto;
  padding: 24px;
  border: 1px solid var(--stroke-strong);
  border-radius: var(--r-lg);
  background: var(--bg-2);
  box-shadow: var(--shadow-lg);
  animation: popIn .28s var(--t-slow) both;
}
@keyframes popIn { from { opacity: 0; transform: translateY(18px) scale(.97); } to { opacity: 1; transform: none; } }

.modal__head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.modal__head h2 { margin: 0; font-size: 1.2rem; }
.modal__head .icon-btn { margin-left: auto; }

.kbd-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; }
.kbd-list li {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 13px;
  border: 1px solid var(--stroke);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  font-size: .87rem;
}
.kbd-list li span { flex: 1; color: var(--text-2); }
kbd {
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--stroke-strong);
  border-bottom-width: 2px;
  background: var(--surface-3);
  font-family: var(--font-body);
  font-size: .76rem;
  font-weight: 600;
  color: var(--text);
}

.toasts {
  position: fixed;
  right: 16px;
  bottom: 16px;
  z-index: 400;
  display: grid;
  gap: 9px;
  justify-items: end;
  max-width: min(360px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 16px;
  border: 1px solid var(--stroke-strong);
  border-radius: var(--r-md);
  background: var(--bg-2);
  box-shadow: var(--shadow-lg);
  font-size: .87rem;
  pointer-events: auto;
  animation: toastIn .3s var(--t-slow) both;
}
.toast.is-out { animation: toastOut .25s ease-in both; }
.toast__ico { flex: none; font-size: 1rem; line-height: 1.4; }
.toast--success { border-left: 3px solid var(--success); }
.toast--error { border-left: 3px solid var(--danger); }
.toast--warn { border-left: 3px solid var(--warn); }
.toast--info { border-left: 3px solid var(--blue-400); }
@keyframes toastIn { from { opacity: 0; transform: translateX(40px); } to { opacity: 1; transform: none; } }
@keyframes toastOut { to { opacity: 0; transform: translateX(40px); } }

/* ============ 21. RESPONSIVE ============ */
@media (max-width: 1100px) {
  .studio__grid { grid-template-columns: 1fr; }
  .about { grid-template-columns: 1fr; }
  .voice-list { max-height: 340px; }
}

@media (max-width: 860px) {
  :root { --header-h: 62px; }

  .icon-btn--menu { display: flex; }

  .nav {
    position: fixed;
    inset: var(--header-h) 12px auto 12px;
    flex-direction: column;
    align-items: stretch;
    gap: 4px;
    padding: 12px;
    border: 1px solid var(--stroke);
    border-radius: var(--r-lg);
    background: color-mix(in srgb, var(--bg-2) 94%, transparent);
    backdrop-filter: blur(var(--blur));
    box-shadow: var(--shadow-lg);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-12px);
    transition: all var(--t-base);
  }
  .nav.is-open { opacity: 1; visibility: visible; transform: none; }
  .nav__link { text-align: left; padding: 13px 15px; border-radius: var(--r-sm); }

  .hide-sm { display: none; }
  .tool span { display: none; }
  .tool { padding: 9px 11px; }
  .transport .btn { flex: 1 1 calc(50% - 5px); }
  .btn--speak { flex-basis: 100%; }
  .install-cta { flex-direction: column; align-items: stretch; text-align: center; }
  .install-cta .btn { width: 100%; }
}

@media (max-width: 560px) {
  body { font-size: 15px; }
  .card { border-radius: var(--r-md); }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .hero__stats { grid-template-columns: repeat(2, 1fr); }
  .filter-row { grid-template-columns: 1fr; }
  .preset-grid { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); }
  .preset { font-size: .74rem; padding: 11px 5px; }
  .toasts { left: 12px; right: 12px; justify-items: stretch; max-width: none; }
  .header__actions .icon-btn:not(.icon-btn--menu) { width: 38px; height: 38px; }
  #shortcutsBtn { display: none; }
  .kbd-list li { flex-wrap: wrap; }
  .editor { padding: 14px; font-size: .98rem; }
}

@media (max-width: 380px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .brand__text { font-size: .98rem; }
  #fullscreenBtn { display: none; }
}

/* Fullscreen mode tweak */
:fullscreen .header { position: sticky; }
:fullscreen body { background: var(--bg); }

/* ============ 22. PREFERENCES ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .bg-fx__blob { animation: none; }
}

@media (prefers-contrast: more) {
  :root { --stroke: rgba(255,255,255,.35); --stroke-strong: rgba(255,255,255,.55); }
  [data-theme="light"] { --stroke: rgba(15,23,42,.35); --stroke-strong: rgba(15,23,42,.55); }
  .card, .feature, .voice { backdrop-filter: none; }
}

@media print {
  .header, .footer, .bg-fx, .toasts, .modal, .boot,
  .card--voices, .card--controls, .card--library, .hero__cta, .install-cta { display: none !important; }
  body { background: #fff; color: #000; }
  .card { border: 1px solid #ccc; box-shadow: none; backdrop-filter: none; }
}
