/* ============================================================
   智曲AI — Design System v2.0
   "Warm Editorial" — Spotify / Apple Music quality
   Desktop-first layout with sidebar navigation
   ============================================================ */

/* ============================================================
   1. DESIGN TOKENS (CSS Custom Properties)
   ============================================================ */
:root {
  /* --- Color Palette --- */
  --color-accent: #FF5E3A;
  --color-accent-hover: #E55030;
  --color-accent-subtle: #FFF3EE;
  --color-accent-glow: rgba(255, 94, 58, 0.15);

  --color-bg: #FAF7F3;
  --color-bg-alt: #F5F1EB;
  --color-surface: #FFFFFF;
  --color-surface-hover: #F9F7F4;

  --color-text-primary: #2D1B10;
  --color-text-secondary: #8C8278;
  --color-text-tertiary: #B8AFA5;
  --color-text-inverse: #FFFFFF;

  --color-border: #EBE7E0;
  --color-border-light: #F2EFEB;

  --color-success: #1D9E75;
  --color-success-subtle: #E8F5F0;
  --color-warning: #EF9F27;
  --color-warning-subtle: #FFF8EC;
  --color-danger: #E24B4A;
  --color-danger-subtle: #FDECEC;

  /* --- Typography --- */
  --font-sans: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'SF Pro Text',
    'Helvetica Neue', 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'SF Mono', 'JetBrains Mono', 'Fira Code', monospace;

  --text-3xl: 2.5rem;      /* 40px — Hero heading */
  --text-2xl: 2rem;        /* 32px — Page titles */
  --text-xl: 1.5rem;       /* 24px — Section headers */
  --text-lg: 1.25rem;      /* 20px — Card titles */
  --text-base: 1rem;       /* 16px — Body */
  --text-sm: 0.875rem;     /* 14px — Meta */
  --text-xs: 0.75rem;      /* 12px — Captions */
  --text-2xs: 0.6875rem;   /* 11px — Labels */

  --leading-tight: 1.15;
  --leading-snug: 1.3;
  --leading-normal: 1.6;
  --leading-relaxed: 1.75;

  --tracking-tight: -0.02em;
  --tracking-normal: 0;
  --tracking-wide: 0.04em;

  /* --- Spacing (8px grid) --- */
  --space-1: 0.25rem;   /* 4px */
  --space-2: 0.5rem;    /* 8px */
  --space-3: 0.75rem;   /* 12px */
  --space-4: 1rem;      /* 16px */
  --space-5: 1.25rem;   /* 20px */
  --space-6: 1.5rem;    /* 24px */
  --space-8: 2rem;      /* 32px */
  --space-10: 2.5rem;   /* 40px */
  --space-12: 3rem;     /* 48px */
  --space-16: 4rem;     /* 64px */
  --space-20: 5rem;     /* 80px */

  /* --- Border Radius --- */
  --radius-sm: 0.5rem;     /* 8px */
  --radius-md: 0.75rem;    /* 12px — Inputs */
  --radius-lg: 1rem;       /* 16px — Cards */
  --radius-xl: 1.5rem;     /* 24px — Modals */
  --radius-2xl: 2rem;      /* 32px */
  --radius-full: 9999px;   /* Pills */

  /* --- Shadows --- */
  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.03);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.06);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.08);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.12);
  --shadow-card: 0 2px 12px rgba(0, 0, 0, 0.04), 0 0 0 1px var(--color-border-light);

  /* --- Layout --- */
  --sidebar-width: 240px;
  --sidebar-collapsed-width: 72px;
  --player-height: 80px;
  --player-height-mobile: 64px;
  --content-max-width: 1400px;
  --header-height: 60px;

  /* --- Transitions --- */
  --transition-fast: 150ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-base: 250ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-slow: 400ms cubic-bezier(0.4, 0, 0.2, 1);
  --transition-spring: 350ms cubic-bezier(0.34, 1.56, 0.64, 1);

  /* --- Z-Index --- */
  --z-sidebar: 100;
  --z-header: 200;
  --z-player: 300;
  --z-overlay: 400;
  --z-modal: 500;
  --z-toast: 600;
  --z-tooltip: 700;
}

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

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text-primary);
  background: var(--color-bg);
  min-height: 100vh;
  overflow-x: hidden;
}

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

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  font-size: inherit;
  color: inherit;
}

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

input,
textarea,
select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

ul, ol {
  list-style: none;
}

::selection {
  background: var(--color-accent-subtle);
  color: var(--color-accent);
}

/* ============================================================
   3. TYPOGRAPHY
   ============================================================ */
.text-3xl  { font-size: var(--text-3xl);  line-height: var(--leading-tight);  letter-spacing: var(--tracking-tight); }
.text-2xl  { font-size: var(--text-2xl);  line-height: var(--leading-tight);  letter-spacing: var(--tracking-tight); }
.text-xl   { font-size: var(--text-xl);   line-height: var(--leading-snug);   letter-spacing: -0.01em; }
.text-lg   { font-size: var(--text-lg);   line-height: var(--leading-snug); }
.text-base { font-size: var(--text-base); line-height: var(--leading-normal); }
.text-sm   { font-size: var(--text-sm);   line-height: var(--leading-normal); }
.text-xs   { font-size: var(--text-xs);   line-height: var(--leading-normal); }
.text-2xs  { font-size: var(--text-2xs);  line-height: var(--leading-normal); }

.font-light    { font-weight: 300; }
.font-normal   { font-weight: 400; }
.font-medium   { font-weight: 500; }
.font-semibold { font-weight: 600; }
.font-bold     { font-weight: 700; }
.font-extrabold { font-weight: 800; }

.text-primary   { color: var(--color-text-primary); }
.text-secondary { color: var(--color-text-secondary); }
.text-tertiary  { color: var(--color-text-tertiary); }
.text-accent    { color: var(--color-accent); }
.text-success   { color: var(--color-success); }
.text-warning   { color: var(--color-warning); }
.text-danger    { color: var(--color-danger); }
.text-inverse   { color: var(--color-text-inverse); }

.text-center  { text-align: center; }
.text-left    { text-align: left; }
.text-right   { text-align: right; }

.truncate {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.leading-tight   { line-height: var(--leading-tight); }
.leading-normal  { line-height: var(--leading-normal); }
.leading-relaxed { line-height: var(--leading-relaxed); }

/* ============================================================
   4. LAYOUT — App Shell (desktop-first)
   ============================================================ */
.app-shell {
  display: flex;
  min-height: 100vh;
  position: relative;
}

/* --- Sidebar --- */
.app-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--color-surface);
  border-right: 1px solid var(--color-border-light);
  z-index: var(--z-sidebar);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  transition: width var(--transition-base);
}

/* --- Main Content Area --- */
.app-main {
  flex: 1;
  margin-left: var(--sidebar-width);
  padding-bottom: calc(var(--player-height) + var(--space-8));
  min-height: 100vh;
  transition: margin-left var(--transition-base);
}

.app-content {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: var(--space-8) var(--space-10);
}

/* --- Right Panel (optional, for large screens) --- */
.app-right-panel {
  display: none;
  width: 320px;
  background: var(--color-surface);
  border-left: 1px solid var(--color-border-light);
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  overflow-y: auto;
  padding: var(--space-6);
  z-index: var(--z-sidebar);
}

@media (min-width: 1400px) {
  .app-right-panel { display: block; }
  .app-main { margin-right: 320px; }
}

/* --- Top Header (within main content) --- */
.app-header {
  position: sticky;
  top: 0;
  z-index: var(--z-header);
  background: rgba(250, 247, 243, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: var(--space-4) var(--space-10);
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-fast);
}

.app-header.scrolled {
  border-bottom-color: var(--color-border-light);
}

.app-header-inner {
  max-width: var(--content-max-width);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.header-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ============================================================
   5. NAVIGATION SIDEBAR
   ============================================================ */
.sidebar-brand {
  padding: var(--space-6);
  display: flex;
  align-items: center;
  gap: var(--space-3);
  border-bottom: 1px solid var(--color-border-light);
  flex-shrink: 0;
}

.sidebar-logo {
  width: 36px;
  height: 36px;
  background: var(--color-accent);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-logo svg {
  width: 20px;
  height: 20px;
  fill: #FFFFFF;
}

.sidebar-brand-text {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
}

.sidebar-nav {
  flex: 1;
  padding: var(--space-4) var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

.nav-item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  color: var(--color-text-secondary);
  font-size: var(--text-sm);
  font-weight: 500;
  transition: all var(--transition-fast);
  position: relative;
  white-space: nowrap;
  overflow: hidden;
}

.nav-item:hover {
  background: var(--color-bg-alt);
  color: var(--color-text-primary);
}

.nav-item.active {
  background: var(--color-accent-subtle);
  color: var(--color-accent);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 20px;
  background: var(--color-accent);
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.nav-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.75;
  transition: stroke var(--transition-fast);
}

.nav-item.active .nav-icon svg {
  stroke: var(--color-accent);
}

.nav-label {
  opacity: 1;
  transition: opacity var(--transition-fast);
}

/* Sidebar footer */
.sidebar-footer {
  padding: var(--space-4) var(--space-3);
  border-top: 1px solid var(--color-border-light);
  flex-shrink: 0;
}

.sidebar-footer .nav-item {
  font-size: var(--text-xs);
}

/* ============================================================
   6. BOTTOM TAB BAR (Mobile)
   ============================================================ */
.mobile-tab-bar {
  display: none;
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 56px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--color-border);
  z-index: var(--z-player);
  padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab-bar-inner {
  display: flex;
  height: 100%;
  max-width: 500px;
  margin: 0 auto;
}

.tab-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  color: var(--color-text-tertiary);
  font-size: var(--text-2xs);
  font-weight: 500;
  transition: color var(--transition-fast);
}

.tab-bar-item.active {
  color: var(--color-accent);
}

.tab-bar-icon {
  width: 22px;
  height: 22px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.tab-bar-icon svg {
  width: 22px;
  height: 22px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* ============================================================
   7. MINI PLAYER BAR (Persistent bottom bar)
   ============================================================ */
.mini-player {
  position: fixed;
  bottom: 0;
  left: var(--sidebar-width);
  right: 0;
  height: var(--player-height);
  background: var(--color-surface);
  border-top: 1px solid var(--color-border-light);
  z-index: var(--z-player);
  transition: left var(--transition-base);
  box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.04);
}

.mini-player-inner {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 var(--space-6);
  max-width: var(--content-max-width);
  margin: 0 auto;
  gap: var(--space-4);
}

.mini-player-cover {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-alt);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.mini-player-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.mini-player-cover svg {
  width: 24px;
  height: 24px;
  fill: var(--color-text-tertiary);
}

.mini-player-info {
  flex: 1;
  min-width: 0;
}

.mini-player-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mini-player-artist {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.mini-player-controls {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
}

.mini-player-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-primary);
  transition: all var(--transition-fast);
}

.mini-player-btn:hover {
  background: var(--color-bg-alt);
  color: var(--color-accent);
}

.mini-player-btn.play {
  width: 40px;
  height: 40px;
  background: var(--color-accent);
  color: var(--color-text-inverse);
}

.mini-player-btn.play:hover {
  background: var(--color-accent-hover);
  transform: scale(1.08);
}

.mini-player-progress {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--color-border);
}

.mini-player-progress-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: 0 1px 1px 0;
  transition: width 0.3s linear;
}

/* ============================================================
   8. BUTTONS
   ============================================================ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-6);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: all var(--transition-fast);
  position: relative;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  white-space: nowrap;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: transparent;
  transition: background var(--transition-fast);
  border-radius: inherit;
}

.btn:active::after {
  background: rgba(0, 0, 0, 0.06);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

.btn-primary {
  background: var(--color-accent);
  color: var(--color-text-inverse);
  box-shadow: 0 2px 8px var(--color-accent-glow);
}

.btn-primary:hover {
  background: var(--color-accent-hover);
  box-shadow: 0 4px 16px var(--color-accent-glow);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px var(--color-accent-glow);
}

.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}

.btn-secondary:hover {
  background: var(--color-bg-alt);
  border-color: var(--color-text-tertiary);
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-secondary);
}

.btn-ghost:hover {
  background: var(--color-bg-alt);
  color: var(--color-text-primary);
}

.btn-icon {
  width: 40px;
  height: 40px;
  padding: 0;
  border-radius: 50%;
  background: var(--color-surface);
  color: var(--color-text-primary);
  border: 1px solid var(--color-border);
}

.btn-icon:hover {
  background: var(--color-bg-alt);
  border-color: var(--color-text-tertiary);
}

.btn-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.btn-lg {
  padding: var(--space-4) var(--space-8);
  font-size: var(--text-base);
  border-radius: var(--radius-lg);
}

.btn-sm {
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-xs);
  border-radius: var(--radius-sm);
}

.btn-full {
  width: 100%;
}

.btn-danger {
  background: var(--color-danger);
  color: var(--color-text-inverse);
}

.btn-danger:hover {
  background: #D43D3C;
}

/* ============================================================
   9. CARDS
   ============================================================ */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
  transition: all var(--transition-base);
  border: 1px solid transparent;
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: var(--color-border-light);
}

.card-interactive {
  cursor: pointer;
}

.card-interactive:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

.card-interactive:active {
  transform: translateY(0);
  box-shadow: var(--shadow-sm);
}

.card-compact {
  padding: var(--space-4);
}

.card-flush {
  padding: 0;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-4);
}

.card-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-primary);
}

.card-subtitle {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

/* --- Song Card (compact row) --- */
.song-card {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  background: transparent;
  transition: all var(--transition-fast);
  cursor: pointer;
}

.song-card:hover {
  background: var(--color-bg-alt);
}

.song-card.active {
  background: var(--color-accent-subtle);
}

.song-card-cover {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-alt);
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.song-card-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.song-card-info {
  flex: 1;
  min-width: 0;
}

.song-card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-card-meta {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}

.song-card-dot {
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--color-text-tertiary);
}

.song-card-play {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--color-accent-subtle);
  color: var(--color-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--transition-fast);
  opacity: 0;
}

.song-card:hover .song-card-play,
.song-card.active .song-card-play {
  opacity: 1;
}

.song-card-play:hover {
  background: var(--color-accent);
  color: var(--color-text-inverse);
}

.song-card-play svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* --- Stat Card --- */
.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  border: 1px solid var(--color-border-light);
  text-align: center;
  transition: all var(--transition-base);
}

.stat-card:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

.stat-card-value {
  font-size: var(--text-2xl);
  font-weight: 800;
  color: var(--color-text-primary);
  letter-spacing: var(--tracking-tight);
}

.stat-card-label {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

/* --- Inspiration Card --- */
.inspiration-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-5);
  border: 1px solid var(--color-border-light);
  cursor: pointer;
  transition: all var(--transition-base);
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
}

.inspiration-card:hover {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.inspiration-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: var(--text-lg);
}

.inspiration-card-body {
  flex: 1;
  min-width: 0;
}

.inspiration-card-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
}

.inspiration-card-desc {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
  line-height: var(--leading-normal);
}

.inspiration-card-arrow {
  color: var(--color-text-tertiary);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.inspiration-card:hover .inspiration-card-arrow {
  transform: translateX(3px);
  color: var(--color-accent);
}

/* ============================================================
   10. CHIPS (Genre / Mood / Instrument)
   ============================================================ */
.chip-group {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
}

.chip-group-scroll {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  padding-bottom: var(--space-1);
  scrollbar-width: none;
}

.chip-group-scroll::-webkit-scrollbar {
  display: none;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-full);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  color: var(--color-text-secondary);
  font-size: var(--text-xs);
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: all var(--transition-fast);
  user-select: none;
}

.chip:hover {
  background: var(--color-bg-alt);
  border-color: var(--color-text-tertiary);
  color: var(--color-text-primary);
}

.chip.active {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
  color: var(--color-accent);
}

.chip.disabled {
  opacity: 0.4;
  pointer-events: none;
}

/* ============================================================
   11. FORM INPUTS
   ============================================================ */
.form-group {
  margin-bottom: var(--space-6);
}

.form-label {
  display: block;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.form-hint {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-top: var(--space-1);
}

.form-error {
  font-size: var(--text-xs);
  color: var(--color-danger);
  margin-top: var(--space-1);
}

/* Text Input */
.input {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  outline: none;
  transition: all var(--transition-fast);
}

.input::placeholder {
  color: var(--color-text-tertiary);
}

.input:hover {
  border-color: var(--color-text-tertiary);
}

.input:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
}

.input.error {
  border-color: var(--color-danger);
}

.input.error:focus {
  box-shadow: 0 0 0 3px rgba(226, 75, 74, 0.15);
}

/* Textarea */
.textarea {
  width: 100%;
  min-height: 120px;
  padding: var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-base);
  color: var(--color-text-primary);
  outline: none;
  resize: vertical;
  transition: all var(--transition-fast);
  line-height: var(--leading-relaxed);
}

.textarea::placeholder {
  color: var(--color-text-tertiary);
}

.textarea:hover {
  border-color: var(--color-text-tertiary);
}

.textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 20px 4px var(--color-accent-glow);
}

/* Input with icon */
.input-with-icon {
  position: relative;
}

.input-with-icon .input {
  padding-left: var(--space-10);
}

.input-with-icon .input-icon {
  position: absolute;
  left: var(--space-3);
  top: 50%;
  transform: translateY(-50%);
  width: 20px;
  height: 20px;
  color: var(--color-text-tertiary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.input-with-icon .input:focus ~ .input-icon {
  color: var(--color-accent);
}

/* Input with character count */
.input-with-count {
  position: relative;
}

.char-count {
  position: absolute;
  bottom: var(--space-2);
  right: var(--space-3);
  font-size: var(--text-2xs);
  color: var(--color-text-tertiary);
  transition: color var(--transition-fast);
}

.char-count.warning {
  color: var(--color-warning);
}

.char-count.danger {
  color: var(--color-danger);
}

/* --- Range Slider --- */
.range-slider {
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.range-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
  transition: all var(--transition-fast);
}

.range-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 16px var(--color-accent-glow);
}

.range-slider::-moz-range-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--color-surface);
  border: 2px solid var(--color-accent);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  cursor: pointer;
}

.range-slider:focus::-webkit-slider-thumb {
  box-shadow: 0 0 0 4px var(--color-accent-glow);
}

/* --- Toggle Switch --- */
.toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
  user-select: none;
}

.toggle-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-track {
  position: relative;
  width: 48px;
  height: 28px;
  border-radius: 14px;
  background: var(--color-border);
  transition: background var(--transition-fast);
  flex-shrink: 0;
}

.toggle-track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--color-surface);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.12);
  transition: transform var(--transition-spring);
}

.toggle-input:checked + .toggle-track {
  background: var(--color-accent);
}

.toggle-input:checked + .toggle-track::after {
  transform: translateX(20px);
}

.toggle-input:focus-visible + .toggle-track {
  box-shadow: 0 0 0 3px var(--color-accent-glow);
}

.toggle-label {
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  font-weight: 500;
}

/* --- Select --- */
.select {
  width: 100%;
  height: 44px;
  padding: 0 var(--space-10) 0 var(--space-4);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  outline: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23B8AFA5' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right var(--space-3) center;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.select:hover {
  border-color: var(--color-text-tertiary);
}

.select:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
}

/* --- Form Footer --- */
.form-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: var(--space-3);
  border-top: 1px solid var(--color-border-light);
  margin-top: var(--space-4);
}

.form-footer-left {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

/* --- API Key Input --- */
.api-key-input {
  position: relative;
}

.api-key-input .input {
  padding-right: var(--space-10);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  letter-spacing: 0.05em;
}

.api-key-toggle {
  position: absolute;
  right: var(--space-1);
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary);
  transition: color var(--transition-fast);
}

.api-key-toggle:hover {
  color: var(--color-text-primary);
}

/* ============================================================
   12. MODALS
   ============================================================ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: var(--z-overlay);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: var(--space-6);
  animation: fadeIn 0.2s ease-out;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: var(--shadow-xl);
  animation: modalSlideUp 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-sm {
  max-width: 380px;
}

.modal-lg {
  max-width: 640px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-6) var(--space-6) 0;
}

.modal-title {
  font-size: var(--text-lg);
  font-weight: 700;
  color: var(--color-text-primary);
}

.modal-close {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary);
  transition: all var(--transition-fast);
}

.modal-close:hover {
  background: var(--color-bg-alt);
  color: var(--color-text-primary);
}

.modal-body {
  padding: var(--space-6);
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--space-3);
  padding: 0 var(--space-6) var(--space-6);
}

/* ============================================================
   13. TOAST NOTIFICATIONS
   ============================================================ */
.toast-container {
  position: fixed;
  top: var(--space-6);
  right: var(--space-6);
  z-index: var(--z-toast);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-5);
  background: var(--color-surface);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--color-border-light);
  font-size: var(--text-sm);
  color: var(--color-text-primary);
  pointer-events: auto;
  animation: toastSlideIn 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-width: 380px;
}

.toast.toast-exit {
  animation: toastSlideOut 0.25s ease-in forwards;
}

.toast-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.toast-success .toast-icon { color: var(--color-success); }
.toast-warning .toast-icon { color: var(--color-warning); }
.toast-error .toast-icon { color: var(--color-danger); }
.toast-info .toast-icon { color: var(--color-accent); }

.toast-content {
  flex: 1;
  min-width: 0;
}

.toast-title {
  font-weight: 600;
  font-size: var(--text-sm);
}

.toast-message {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 2px;
}

/* ============================================================
   14. PROGRESS BARS
   ============================================================ */

/* --- Playback Progress --- */
.progress-bar {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

.progress-times {
  font-size: var(--text-2xs);
  color: var(--color-text-tertiary);
  min-width: 36px;
  font-variant-numeric: tabular-nums;
}

.progress-track {
  flex: 1;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  position: relative;
  cursor: pointer;
  transition: height var(--transition-fast);
}

.progress-track:hover {
  height: 6px;
}

.progress-fill {
  height: 100%;
  background: var(--color-accent);
  border-radius: inherit;
  position: relative;
  transition: width 0.1s linear;
}

.progress-thumb {
  position: absolute;
  right: -6px;
  top: 50%;
  transform: translateY(-50%) scale(0);
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--color-accent);
  box-shadow: 0 2px 8px var(--color-accent-glow);
  transition: transform var(--transition-fast);
}

.progress-track:hover .progress-thumb {
  transform: translateY(-50%) scale(1);
}

/* --- Generation Progress --- */
.generation-progress {
  width: 100%;
  height: 6px;
  background: var(--color-border);
  border-radius: 3px;
  overflow: hidden;
}

.generation-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--color-accent), #FF7B5E);
  border-radius: inherit;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.generation-steps {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-3);
}

.generation-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  flex: 1;
  position: relative;
}

.generation-step::before {
  content: '';
  position: absolute;
  top: 12px;
  left: 0;
  right: 100%;
  height: 2px;
  background: var(--color-border);
  z-index: 0;
  transition: right var(--transition-base);
}

.generation-step:first-child::before {
  display: none;
}

.generation-step.completed::before {
  right: 0;
  background: var(--color-accent);
}

.generation-step-icon {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-border);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  transition: all var(--transition-base);
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.generation-step.completed .generation-step-icon {
  background: var(--color-accent);
  color: var(--color-text-inverse);
}

.generation-step.active .generation-step-icon {
  background: var(--color-accent-subtle);
  border: 2px solid var(--color-accent);
  color: var(--color-accent);
  animation: pulse 2s ease-in-out infinite;
}

.generation-step-label {
  font-size: var(--text-2xs);
  color: var(--color-text-tertiary);
  text-align: center;
  transition: color var(--transition-fast);
}

.generation-step.completed .generation-step-label,
.generation-step.active .generation-step-label {
  color: var(--color-text-primary);
}

/* ============================================================
   15. LYRICS DISPLAY
   ============================================================ */
.lyrics-panel {
  padding: var(--space-6);
  max-height: 400px;
  overflow-y: auto;
  mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
}

.lyric-line {
  padding: var(--space-2) var(--space-4);
  border-radius: var(--radius-sm);
  font-size: var(--text-lg);
  color: var(--color-text-tertiary);
  text-align: center;
  transition: all var(--transition-base);
  cursor: pointer;
  line-height: var(--leading-relaxed);
}

.lyric-line:hover {
  color: var(--color-text-secondary);
}

.lyric-line.active {
  color: var(--color-accent);
  font-weight: 600;
  font-size: calc(var(--text-lg) + 0.125rem);
  background: var(--color-accent-subtle);
}

.lyric-line.past {
  color: var(--color-border);
}

/* ============================================================
   16. LOADING SKELETONS & SHIMMER
   ============================================================ */
.skeleton {
  background: var(--color-border-light);
  border-radius: var(--radius-sm);
  position: relative;
  overflow: hidden;
}

.skeleton::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.5) 50%,
    transparent 100%
  );
  animation: shimmer 2s ease-in-out infinite;
}

.skeleton-text {
  height: 14px;
  margin-bottom: var(--space-2);
}

.skeleton-text:last-child {
  width: 60%;
}

.skeleton-title {
  height: 20px;
  width: 70%;
  margin-bottom: var(--space-3);
}

.skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.skeleton-cover {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
}

/* --- Song Card Skeleton --- */
.song-skeleton {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-4);
}

.song-skeleton-cover {
  width: 48px;
  height: 48px;
  border-radius: var(--radius-sm);
}

.song-skeleton-info {
  flex: 1;
}

.song-skeleton-info .skeleton-text {
  width: 60%;
}

.song-skeleton-info .skeleton-text + .skeleton-text {
  width: 40%;
  margin-top: var(--space-2);
}

/* ============================================================
   17. EMPTY STATES
   ============================================================ */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: var(--space-16) var(--space-6);
  text-align: center;
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-6);
}

.empty-state-icon svg {
  width: 36px;
  height: 36px;
  color: var(--color-text-tertiary);
}

.empty-state-title {
  font-size: var(--text-lg);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-2);
}

.empty-state-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-6);
  max-width: 360px;
  line-height: var(--leading-relaxed);
}

/* ============================================================
   18. CUSTOM SCROLLBAR
   ============================================================ */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: var(--color-border);
  border-radius: 3px;
  transition: background var(--transition-fast);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--color-text-tertiary);
}

/* Firefox */
* {
  scrollbar-width: thin;
  scrollbar-color: var(--color-border) transparent;
}

/* ============================================================
   19. PAGE: HOME / INSPIRATION (灵感)
   ============================================================ */
.inspiration-page {
  padding: var(--space-6) 0;
}

/* Hero Section */
.hero-section {
  margin-bottom: var(--space-10);
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-4);
  background: var(--color-accent-subtle);
  border-radius: var(--radius-full);
  color: var(--color-accent);
  font-size: var(--text-xs);
  font-weight: 600;
  margin-bottom: var(--space-5);
}

.hero-badge-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--color-accent);
  animation: pulse 2s ease-in-out infinite;
}

.hero-heading {
  font-size: var(--text-3xl);
  font-weight: 800;
  color: var(--color-text-primary);
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  margin-bottom: var(--space-3);
}

.hero-heading em {
  font-style: normal;
  color: var(--color-accent);
}

.hero-subtitle {
  font-size: var(--text-base);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
  max-width: 560px;
}

/* Quick Input Area */
.quick-input {
  margin-bottom: var(--space-8);
}

.quick-input-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-card);
  overflow: hidden;
  transition: all var(--transition-base);
}

.quick-input-card:focus-within {
  border-color: var(--color-accent);
  box-shadow: var(--shadow-lg), 0 0 0 3px var(--color-accent-glow);
}

.quick-input-textarea {
  width: 100%;
  min-height: 100px;
  padding: var(--space-5);
  border: none;
  background: transparent;
  font-size: var(--text-base);
  color: var(--color-text-primary);
  outline: none;
  resize: none;
  line-height: var(--leading-relaxed);
}

.quick-input-textarea::placeholder {
  color: var(--color-text-tertiary);
}

.quick-input-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-border-light);
  background: var(--color-bg-alt);
}

.quick-input-count {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
}

.quick-input-submit {
  padding: var(--space-2) var(--space-5);
  background: var(--color-accent);
  color: var(--color-text-inverse);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: all var(--transition-fast);
}

.quick-input-submit:hover {
  background: var(--color-accent-hover);
  transform: scale(1.02);
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-5);
}

.section-header-title {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
}

.section-header-action {
  font-size: var(--text-sm);
  color: var(--color-accent);
  font-weight: 500;
  transition: opacity var(--transition-fast);
}

.section-header-action:hover {
  opacity: 0.8;
}

/* Genre Quick Picks */
.genre-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-10);
}

.genre-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-4) var(--space-2);
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  cursor: pointer;
  transition: all var(--transition-base);
}

.genre-card:hover {
  border-color: var(--color-accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.genre-card:active {
  transform: translateY(0);
}

.genre-card-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--text-lg);
  transition: background var(--transition-fast);
}

.genre-card:hover .genre-card-icon {
  background: var(--color-accent-subtle);
}

.genre-card-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--color-text-secondary);
}

/* Recent Songs */
.recent-songs {
  margin-bottom: var(--space-10);
}

/* Inspiration Cards Grid */
.inspiration-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: var(--space-4);
}

/* ============================================================
   20. PAGE: CREATE / COMPOSE (创作)
   ============================================================ */
.create-page {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: var(--space-8);
  padding: var(--space-6) 0;
}

/* Mode Toggle */
.mode-toggle {
  display: flex;
  background: var(--color-bg-alt);
  border-radius: var(--radius-full);
  padding: var(--space-1);
  margin-bottom: var(--space-6);
}

.mode-toggle-btn {
  flex: 1;
  padding: var(--space-2) var(--space-5);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
  text-align: center;
}

.mode-toggle-btn.active {
  background: var(--color-surface);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-sm);
}

/* Create Form Left */
.create-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
}

.create-form-section {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
}

.create-form-section-title {
  font-size: var(--text-base);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-4);
}

/* Duration Slider */
.duration-slider-group {
  margin-top: var(--space-4);
}

.duration-value {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-2);
}

.duration-label {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.duration-number {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  font-variant-numeric: tabular-nums;
}

/* Preview Panel Right */
.create-preview {
  position: sticky;
  top: calc(var(--header-height) + var(--space-6));
  align-self: flex-start;
}

.create-preview-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  padding: var(--space-6);
  box-shadow: var(--shadow-card);
  text-align: center;
}

.create-preview-title {
  font-size: var(--text-base);
  font-weight: 600;
  margin-bottom: var(--space-6);
}

.preview-cover {
  width: 100%;
  max-width: 200px;
  aspect-ratio: 1;
  margin: 0 auto var(--space-4);
  border-radius: var(--radius-lg);
  background: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.preview-cover svg {
  width: 80px;
  height: 80px;
  color: var(--color-text-tertiary);
}

.preview-cover.generating {
  animation: coverPulse 2s ease-in-out infinite;
}

.preview-status {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-4);
}

.preview-waveform {
  width: 100%;
  height: 40px;
  margin: var(--space-3) 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.preview-waveform-bar {
  width: 3px;
  border-radius: 1.5px;
  background: var(--color-accent);
  animation: waveformAnim 1.2s ease-in-out infinite;
}

/* Generation Progress Detail */
.generation-detail {
  text-align: left;
  padding: var(--space-4) 0;
}

.generation-message {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-top: var(--space-3);
  text-align: center;
}

/* ============================================================
   21. PAGE: PLAYER (播放)
   ============================================================ */
.player-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-8) var(--space-6);
  max-width: 600px;
  margin: 0 auto;
}

.player-cover-large {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 1;
  border-radius: var(--radius-xl);
  margin-bottom: var(--space-8);
  overflow: hidden;
  box-shadow: var(--shadow-xl);
  position: relative;
  background: var(--color-bg-alt);
}

.player-cover-large img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.player-cover-fallback {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--color-accent-subtle), var(--color-bg-alt));
}

.player-cover-fallback svg {
  width: 80px;
  height: 80px;
  color: var(--color-accent);
  opacity: 0.6;
}

.player-info {
  text-align: center;
  margin-bottom: var(--space-8);
  width: 100%;
}

.player-song-title {
  font-size: var(--text-2xl);
  font-weight: 700;
  color: var(--color-text-primary);
  letter-spacing: -0.01em;
  margin-bottom: var(--space-1);
}

.player-song-artist {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
}

.player-song-genre {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  margin-top: var(--space-3);
  padding: var(--space-1) var(--space-3);
  background: var(--color-bg-alt);
  border-radius: var(--radius-full);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
}

.player-progress-area {
  width: 100%;
  margin-bottom: var(--space-6);
}

.player-controls-area {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-8);
  margin-bottom: var(--space-8);
}

.player-ctrl-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  transition: all var(--transition-fast);
}

.player-ctrl-btn:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-alt);
}

.player-ctrl-btn svg {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.player-play-btn {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-spring);
  box-shadow: 0 4px 20px var(--color-accent-glow);
}

.player-play-btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px var(--color-accent-glow);
}

.player-play-btn:active {
  transform: scale(0.96);
}

.player-play-btn svg {
  width: 28px;
  height: 28px;
  fill: currentColor;
}

.player-extra-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-6);
}

.player-action-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary);
  transition: all var(--transition-fast);
}

.player-action-btn:hover {
  color: var(--color-accent);
  background: var(--color-accent-subtle);
}

.player-action-btn.active {
  color: var(--color-accent);
}

.player-action-btn svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

/* Lyrics toggle */
.player-lyrics-toggle {
  margin-top: var(--space-6);
  width: 100%;
}

/* ============================================================
   21b. PLAYER PAGE — Extended Styles (Full-Screen Player)
   ============================================================ */

/* Gradient Background Layer */
.player-gradient-bg {
  position: fixed;
  inset: 0;
  z-index: -2;
  background: linear-gradient(
    160deg,
    var(--player-bg-start, #8E8E93) 0%,
    var(--player-bg-end, #636366) 50%,
    #1a1a1a 100%
  );
  opacity: 0.35;
  transition: background 0.8s ease;
}

/* Background Blur Cover */
.player-bg-blur {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: linear-gradient(
    180deg,
    rgba(250, 247, 243, 0.92) 0%,
    rgba(250, 247, 243, 0.98) 100%
  );
}

/* Content */
.player-content {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 800px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Top Bar */
.player-top-bar {
  width: 100%;
  display: flex;
  align-items: center;
  padding: var(--space-4) 0;
  margin-bottom: var(--space-4);
}

.player-back-btn {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-secondary);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.player-back-btn:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-alt);
}

.player-back-btn svg {
  width: 22px;
  height: 22px;
}

.player-top-title {
  flex: 1;
  text-align: center;
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.player-top-spacer {
  width: 40px;
}

/* Cover Area */
.player-cover-area {
  display: flex;
  justify-content: center;
  margin-bottom: var(--space-10);
}

/* Cover Pulse Ring */
.player-cover-pulse {
  position: absolute;
  inset: -12px;
  border-radius: inherit;
  border: 2px solid var(--player-bg-start, var(--color-accent));
  opacity: 0;
  transition: opacity 0.5s ease;
  pointer-events: none;
}

.player-cover-pulse.active {
  opacity: 0.3;
  animation: coverPulseRing 2.5s ease-in-out infinite;
}

@keyframes coverPulseRing {
  0% { transform: scale(1); opacity: 0.3; }
  50% { transform: scale(1.06); opacity: 0.1; }
  100% { transform: scale(1); opacity: 0.3; }
}

/* Cover Character Fallback */
.player-cover-char {
  font-size: 5rem;
  font-weight: 700;
  color: white;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.2);
  line-height: 1;
  user-select: none;
}

.player-cover-large.is-playing .player-cover-fallback {
  animation: coverPulse 3s ease-in-out infinite;
}

/* Song Change Animation */
.player-page.song-changing {
  animation: songFadeSwitch 0.4s ease;
}

@keyframes songFadeSwitch {
  0% { opacity: 1; }
  40% { opacity: 0.3; }
  60% { opacity: 0.3; }
  100% { opacity: 1; }
}

/* Progress Bar — Enhanced */
.player-progress-bar {
  position: relative;
  width: 100%;
  height: 4px;
  background: var(--color-border);
  border-radius: 2px;
  cursor: pointer;
  transition: height 0.15s ease;
}

.player-progress-bar.hover,
.player-progress-bar:hover {
  height: 6px;
}

.player-progress-buffered {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--color-border);
  border-radius: 2px;
  opacity: 0.5;
  transition: width 0.3s linear;
}

.player-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  background: var(--color-accent);
  border-radius: 2px;
  transition: width 0.1s linear;
  z-index: 1;
}

.player-progress-thumb {
  position: absolute;
  top: 50%;
  width: 14px;
  height: 14px;
  background: var(--color-accent);
  border: 2px solid var(--color-surface);
  border-radius: 50%;
  transform: translate(-50%, -50%) scale(0);
  transition: transform 0.15s ease, left 0.1s linear;
  z-index: 2;
  box-shadow: 0 1px 6px rgba(0, 0, 0, 0.15);
}

.player-progress-bar:hover .player-progress-thumb,
.player-progress-bar.hover .player-progress-thumb,
.player-progress-thumb.dragging {
  transform: translate(-50%, -50%) scale(1);
}

.player-progress-times {
  display: flex;
  justify-content: space-between;
  margin-top: var(--space-2);
}

.player-time-current,
.player-time-duration {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  font-variant-numeric: tabular-nums;
}

/* Controls — Shuffle/Loop Active States */
.player-ctrl-btn.active {
  color: var(--color-accent);
}

.player-ctrl-btn.mode-single {
  color: var(--color-accent);
}

.player-ctrl-btn.mode-order {
  color: var(--color-text-secondary);
}

/* Loop Badge (single mode "1") */
.loop-badge {
  position: absolute;
  top: 4px;
  right: 4px;
  font-size: 9px;
  font-weight: 700;
  color: var(--color-accent);
  line-height: 1;
}

.player-ctrl-btn {
  position: relative;
}

/* Play Button Loading State */
.player-play-btn.loading {
  opacity: 0.6;
  pointer-events: none;
}

/* Lyrics Panel */
.player-lyrics-panel {
  width: 100%;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease;
  opacity: 0;
  margin-top: 0;
}

.player-lyrics-panel.open {
  max-height: 400px;
  opacity: 1;
  margin-top: var(--space-6);
}

.player-lyrics-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--color-border-light);
  margin-bottom: var(--space-4);
}

.player-lyrics-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-secondary);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
}

.player-lyrics-close {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary);
  border-radius: 50%;
  transition: all var(--transition-fast);
}

.player-lyrics-close:hover {
  color: var(--color-text-primary);
  background: var(--color-bg-alt);
}

.player-lyrics-close svg {
  width: 16px;
  height: 16px;
}

/* Lyrics Scroll Container */
.player-lyrics-scroll {
  max-height: 320px;
  overflow-y: auto;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  padding: var(--space-4) 0;

  /* Fade edges */
  mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 10%, black 90%, transparent 100%);
}

.player-lyrics-body {
  padding: var(--space-8) 0;
}

.player-lyrics-placeholder {
  text-align: center;
  color: var(--color-text-tertiary);
  font-size: var(--text-sm);
  padding: var(--space-8) 0;
}

/* Lyric Section Header */
.player-lyric-section {
  text-align: center;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--color-text-tertiary);
  letter-spacing: var(--tracking-wide);
  text-transform: uppercase;
  padding: var(--space-6) 0 var(--space-2);
}

/* Lyric Line */
.player-lyric-line {
  text-align: center;
  padding: var(--space-2) var(--space-4);
  font-size: var(--text-lg);
  line-height: var(--leading-snug);
  color: var(--color-text-tertiary);
  transition: color 0.3s ease, transform 0.3s ease;
  cursor: pointer;
  min-height: 2.4em;
  display: flex;
  justify-content: center;
  align-items: center;
}

.player-lyric-line:hover {
  color: var(--color-text-secondary);
}

.player-lyric-line.active {
  color: var(--color-text-primary);
  transform: scale(1.04);
  font-weight: 600;
}

.player-lyric-line.past {
  color: var(--color-text-tertiary);
  opacity: 0.5;
}

/* Per-character lyric highlighting */
.lyric-sung {
  color: var(--color-accent);
}

.lyric-unsung {
  color: inherit;
}

/* Empty State */
.player-empty-state .player-content {
  justify-content: center;
  min-height: 70vh;
}

.player-empty-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.player-empty-icon {
  width: 120px;
  height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary);
  opacity: 0.4;
  margin-bottom: var(--space-8);
}

.player-empty-icon svg {
  width: 80px;
  height: 80px;
}

.player-empty-title {
  font-size: var(--text-xl);
  font-weight: 600;
  color: var(--color-text-primary);
  margin-bottom: var(--space-3);
}

.player-empty-desc {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  margin-bottom: var(--space-8);
}

.player-empty-btn {
  padding: var(--space-3) var(--space-8);
  background: var(--color-accent);
  color: var(--color-text-inverse);
  border-radius: var(--radius-full);
  font-size: var(--text-sm);
  font-weight: 600;
  transition: all var(--transition-fast);
  box-shadow: 0 4px 16px var(--color-accent-glow);
}

.player-empty-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 24px var(--color-accent-glow);
}

.player-empty-btn:active {
  transform: translateY(0);
}

/* ============================================================
   22. PAGE: LIBRARY / MANUSCRIPTS (手稿)
   ============================================================ */
.library-page {
  padding: var(--space-6) 0;
}

/* View Toggle */
.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--space-6);
  gap: var(--space-4);
  flex-wrap: wrap;
}

.library-search {
  flex: 1;
  min-width: 200px;
  max-width: 360px;
}

.view-toggle {
  display: flex;
  background: var(--color-bg-alt);
  border-radius: var(--radius-sm);
  padding: var(--space-1);
}

.view-toggle-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-tertiary);
  transition: all var(--transition-fast);
}

.view-toggle-btn.active {
  background: var(--color-surface);
  color: var(--color-text-primary);
  box-shadow: var(--shadow-xs);
}

.view-toggle-btn svg {
  width: 18px;
  height: 18px;
}

/* Filter Chips */
.library-filters {
  margin-bottom: var(--space-6);
}

/* Grid View */
.song-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: var(--space-4);
}

.song-grid-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  border: 1px solid var(--color-border-light);
  cursor: pointer;
  transition: all var(--transition-base);
}

.song-grid-card:hover {
  border-color: var(--color-border);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.song-grid-card:active {
  transform: scale(0.985);
}

.song-grid-cover {
  width: 100%;
  aspect-ratio: 1;
  border-radius: var(--radius-md);
  background: var(--color-bg-alt);
  margin-bottom: var(--space-3);
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.song-grid-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.song-grid-cover-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.song-grid-card:hover .song-grid-cover-overlay {
  opacity: 1;
}

.song-grid-play-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
  transition: transform var(--transition-spring);
}

.song-grid-card:hover .song-grid-play-btn {
  transform: scale(1.05);
}

.song-grid-title {
  font-size: var(--text-sm);
  font-weight: 600;
  color: var(--color-text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.song-grid-meta {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

/* List View */
.song-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}

/* ============================================================
   23. PAGE: PROFILE / ME (我)
   ============================================================ */
.profile-page {
  padding: var(--space-6) 0;
}

.profile-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: var(--space-10) 0;
  margin-bottom: var(--space-8);
}

.profile-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: var(--color-bg-alt);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: var(--space-4);
  position: relative;
  border: 3px solid var(--color-surface);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

.profile-avatar svg {
  width: 44px;
  height: 44px;
  color: var(--color-text-tertiary);
}

.profile-avatar-edit {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--color-accent);
  color: var(--color-text-inverse);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 3px solid var(--color-surface);
  transition: transform var(--transition-fast);
}

.profile-avatar-edit:hover {
  transform: scale(1.1);
}

.profile-avatar-edit svg {
  width: 14px;
  height: 14px;
}

.profile-name {
  font-size: var(--text-xl);
  font-weight: 700;
  color: var(--color-text-primary);
  margin-bottom: var(--space-1);
}

.profile-bio {
  font-size: var(--text-sm);
  color: var(--color-text-secondary);
  max-width: 320px;
  text-align: center;
  line-height: var(--leading-relaxed);
}

/* Stats */
.profile-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: var(--space-3);
  margin-bottom: var(--space-8);
}

/* Menu List */
.menu-list {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  overflow: hidden;
  box-shadow: var(--shadow-card);
}

.menu-list-group {
  padding: 0;
}

.menu-list-group + .menu-list-group {
  border-top: 1px solid var(--color-border-light);
}

.menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-5);
  cursor: pointer;
  transition: background var(--transition-fast);
}

.menu-item:hover {
  background: var(--color-bg-alt);
}

.menu-item:active {
  background: var(--color-bg-alt);
}

.menu-item-left {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  flex: 1;
  min-width: 0;
}

.menu-item-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.menu-item-icon svg {
  width: 20px;
  height: 20px;
}

.menu-item-icon.orange { background: var(--color-accent-subtle); color: var(--color-accent); }
.menu-item-icon.green  { background: var(--color-success-subtle); color: var(--color-success); }
.menu-item-icon.amber  { background: var(--color-warning-subtle); color: var(--color-warning); }
.menu-item-icon.red    { background: var(--color-danger-subtle); color: var(--color-danger); }
.menu-item-icon.gray   { background: var(--color-bg-alt); color: var(--color-text-tertiary); }

.menu-item-text {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-primary);
}

.menu-item-extra {
  font-size: var(--text-xs);
  color: var(--color-text-tertiary);
  margin-right: var(--space-2);
}

.menu-item-arrow {
  color: var(--color-text-tertiary);
  flex-shrink: 0;
  transition: transform var(--transition-fast);
}

.menu-item:hover .menu-item-arrow {
  transform: translateX(2px);
}

/* ============================================================
   24. PAGE: SETTINGS (设置)
   ============================================================ */
.settings-page {
  padding: var(--space-6) 0;
  max-width: 640px;
}

.settings-section {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border-light);
  box-shadow: var(--shadow-card);
  margin-bottom: var(--space-6);
  overflow: hidden;
}

.settings-section-header {
  padding: var(--space-5) var(--space-6);
  border-bottom: 1px solid var(--color-border-light);
}

.settings-section-title {
  font-size: var(--text-base);
  font-weight: 700;
  color: var(--color-text-primary);
}

.settings-section-desc {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: var(--space-1);
}

.settings-section-body {
  padding: var(--space-6);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
  gap: var(--space-4);
}

.settings-row + .settings-row {
  border-top: 1px solid var(--color-border-light);
}

.settings-row-label {
  font-size: var(--text-sm);
  font-weight: 500;
  color: var(--color-text-primary);
}

.settings-row-desc {
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  margin-top: 2px;
}

.settings-info-box {
  background: var(--color-bg-alt);
  border-radius: var(--radius-md);
  padding: var(--space-4);
  font-size: var(--text-xs);
  color: var(--color-text-secondary);
  line-height: var(--leading-relaxed);
}

.settings-info-box a {
  color: var(--color-accent);
  text-decoration: underline;
}

/* Danger Zone */
.settings-danger-zone {
  border: 1px solid var(--color-danger);
}

.settings-danger-zone .settings-section-header {
  color: var(--color-danger);
}

/* ============================================================
   25. ANIMATIONS — KEYFRAMES
   ============================================================ */
@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes modalSlideUp {
  from {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes modalSlideDown {
  from {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateY(20px) scale(0.96);
  }
}

@keyframes toastSlideIn {
  from {
    opacity: 0;
    transform: translateX(30px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes toastSlideOut {
  from {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  to {
    opacity: 0;
    transform: translateX(30px) scale(0.96);
  }
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes coverPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

@keyframes waveformAnim {
  0%, 100% { height: 8px; }
  50% { height: 32px; }
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes scaleIn {
  from {
    opacity: 0;
    transform: scale(0.9);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

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

@keyframes musicBar1 { 0%,100% { height: 8px; } 50% { height: 28px; } }
@keyframes musicBar2 { 0%,100% { height: 20px; } 50% { height: 6px; } }
@keyframes musicBar3 { 0%,100% { height: 12px; } 50% { height: 36px; } }
@keyframes musicBar4 { 0%,100% { height: 32px; } 50% { height: 10px; } }
@keyframes musicBar5 { 0%,100% { height: 16px; } 50% { height: 30px; } }

/* --- Enhanced Keyframes (v2 polish) --- */
@keyframes badgeBreath {
  0%, 100% { box-shadow: 0 0 0 0 var(--color-accent-glow); transform: scale(1); }
  50%      { box-shadow: 0 0 0 6px rgba(255, 94, 58, 0); transform: scale(1.015); }
}

@keyframes chipPop {
  0%   { transform: scale(1.08); }
  60%  { transform: scale(0.97); }
  100% { transform: scale(1); }
}

@keyframes dotBreath {
  0%, 100% { transform: scale(1);   box-shadow: 0 0 0 0 currentColor; opacity: 1; }
  50%      { transform: scale(1.2); box-shadow: 0 0 0 4px rgba(0,0,0,0); opacity: 0.7; }
}

@keyframes playBtnGlow {
  0%, 100% { box-shadow: 0 4px 18px var(--color-accent-glow); }
  50%      { box-shadow: 0 6px 28px rgba(255, 94, 58, 0.35); }
}

@keyframes resultCoverPulse {
  0%, 100% { transform: scale(1);    box-shadow: 0 8px 32px rgba(255, 94, 58, 0.18); }
  50%      { transform: scale(1.02); box-shadow: 0 12px 44px rgba(255, 94, 58, 0.28); }
}

@keyframes checkDraw {
  from { stroke-dashoffset: 24; }
  to   { stroke-dashoffset: 0; }
}

@keyframes stepComplete {
  0%   { transform: scale(1); }
  50%  { transform: scale(1.18); }
  100% { transform: scale(1); }
}

/* Animation Utility Classes */
.animate-fade-in     { animation: fadeIn 0.3s ease-out; }
.animate-slide-up    { animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1); }
.animate-slide-down  { animation: slideDown 0.3s ease-out; }
.animate-scale-in    { animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.animate-pulse       { animation: pulse 2s ease-in-out infinite; }
.animate-spin        { animation: spin 1s linear infinite; }

/* Staggered animations for lists */
.stagger-list > * {
  opacity: 0;
  animation: slideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) forwards;
}

.stagger-list > *:nth-child(1) { animation-delay: 0.05s; }
.stagger-list > *:nth-child(2) { animation-delay: 0.1s; }
.stagger-list > *:nth-child(3) { animation-delay: 0.15s; }
.stagger-list > *:nth-child(4) { animation-delay: 0.2s; }
.stagger-list > *:nth-child(5) { animation-delay: 0.25s; }
.stagger-list > *:nth-child(6) { animation-delay: 0.3s; }
.stagger-list > *:nth-child(7) { animation-delay: 0.35s; }
.stagger-list > *:nth-child(8) { animation-delay: 0.4s; }
.stagger-list > *:nth-child(9) { animation-delay: 0.45s; }
.stagger-list > *:nth-child(10) { animation-delay: 0.5s; }

/* ============================================================
   26. UTILITY CLASSES
   ============================================================ */

/* Flexbox */
.flex            { display: flex; }
.inline-flex     { display: inline-flex; }
.flex-col        { flex-direction: column; }
.flex-row        { flex-direction: row; }
.flex-wrap       { flex-wrap: wrap; }
.flex-1          { flex: 1; }
.flex-shrink-0   { flex-shrink: 0; }
.flex-grow       { flex-grow: 1; }

.items-start    { align-items: flex-start; }
.items-center   { align-items: center; }
.items-end      { align-items: flex-end; }
.items-stretch  { align-items: stretch; }
.items-baseline { align-items: baseline; }

.justify-start    { justify-content: flex-start; }
.justify-center   { justify-content: center; }
.justify-end      { justify-content: flex-end; }
.justify-between  { justify-content: space-between; }
.justify-around   { justify-content: space-around; }

.self-start  { align-self: flex-start; }
.self-center { align-self: center; }
.self-end    { align-self: flex-end; }

/* Spacing */
.gap-1 { gap: var(--space-1); }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.gap-5 { gap: var(--space-5); }
.gap-6 { gap: var(--space-6); }
.gap-8 { gap: var(--space-8); }

.m-0  { margin: 0; }
.mx-auto { margin-left: auto; margin-right: auto; }

.mt-1 { margin-top: var(--space-1); }
.mt-2 { margin-top: var(--space-2); }
.mt-3 { margin-top: var(--space-3); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mt-8 { margin-top: var(--space-8); }

.mb-1 { margin-bottom: var(--space-1); }
.mb-2 { margin-bottom: var(--space-2); }
.mb-3 { margin-bottom: var(--space-3); }
.mb-4 { margin-bottom: var(--space-4); }
.mb-6 { margin-bottom: var(--space-6); }
.mb-8 { margin-bottom: var(--space-8); }

.ml-1 { margin-left: var(--space-1); }
.ml-2 { margin-left: var(--space-2); }
.ml-3 { margin-left: var(--space-3); }
.ml-4 { margin-left: var(--space-4); }
.ml-auto { margin-left: auto; }

.mr-1 { margin-right: var(--space-1); }
.mr-2 { margin-right: var(--space-2); }
.mr-3 { margin-right: var(--space-3); }
.mr-4 { margin-right: var(--space-4); }

.p-0  { padding: 0; }
.p-2  { padding: var(--space-2); }
.p-3  { padding: var(--space-3); }
.p-4  { padding: var(--space-4); }
.p-5  { padding: var(--space-5); }
.p-6  { padding: var(--space-6); }
.p-8  { padding: var(--space-8); }

.px-3 { padding-left: var(--space-3); padding-right: var(--space-3); }
.px-4 { padding-left: var(--space-4); padding-right: var(--space-4); }
.px-6 { padding-left: var(--space-6); padding-right: var(--space-6); }

.py-2 { padding-top: var(--space-2); padding-bottom: var(--space-2); }
.py-3 { padding-top: var(--space-3); padding-bottom: var(--space-3); }
.py-4 { padding-top: var(--space-4); padding-bottom: var(--space-4); }
.py-6 { padding-top: var(--space-6); padding-bottom: var(--space-6); }

/* Width / Height */
.w-full  { width: 100%; }
.h-full  { height: 100%; }
.w-auto  { width: auto; }
.h-auto  { height: auto; }
.min-w-0 { min-width: 0; }

/* Display */
.hidden  { display: none; }
.block   { display: block; }
.inline  { display: inline; }

/* Position */
.relative { position: relative; }
.absolute { position: absolute; }
.fixed    { position: fixed; }
.sticky   { position: sticky; }
.inset-0  { top: 0; right: 0; bottom: 0; left: 0; }

/* Overflow */
.overflow-hidden  { overflow: hidden; }
.overflow-auto    { overflow: auto; }
.overflow-y-auto  { overflow-y: auto; }
.overflow-x-auto  { overflow-x: auto; }

/* Borders */
.rounded-none { border-radius: 0; }
.rounded-sm   { border-radius: var(--radius-sm); }
.rounded-md   { border-radius: var(--radius-md); }
.rounded-lg   { border-radius: var(--radius-lg); }
.rounded-xl   { border-radius: var(--radius-xl); }
.rounded-full { border-radius: var(--radius-full); }

.border        { border: 1px solid var(--color-border); }
.border-light  { border: 1px solid var(--color-border-light); }
.border-none   { border: none; }
.border-t      { border-top: 1px solid var(--color-border-light); }
.border-b      { border-bottom: 1px solid var(--color-border-light); }

/* Opacity */
.opacity-0   { opacity: 0; }
.opacity-50  { opacity: 0.5; }
.opacity-75  { opacity: 0.75; }
.opacity-100 { opacity: 1; }

/* Pointer Events */
.pointer-events-none { pointer-events: none; }

/* User Select */
.select-none { user-select: none; -webkit-user-select: none; }
.select-auto { user-select: auto; -webkit-user-select: auto; }

/* Visibility */
.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;
}

/* ============================================================
   27. RESPONSIVE — Tablet (768px - 1024px)
   ============================================================ */
@media (max-width: 1023px) {
  :root {
    --sidebar-width: var(--sidebar-collapsed-width);
  }

  /* Collapse sidebar to icons only */
  .sidebar-brand-text,
  .nav-label,
  .sidebar-footer .nav-label {
    opacity: 0;
    width: 0;
    overflow: hidden;
    pointer-events: none;
  }

  .nav-item {
    justify-content: center;
    padding: var(--space-3);
  }

  .sidebar-brand {
    justify-content: center;
    padding: var(--space-4);
  }

  .nav-item.active::before {
    display: none;
  }

  .mini-player {
    left: var(--sidebar-collapsed-width);
  }

  /* Create page: stack vertically */
  .create-page {
    grid-template-columns: 1fr;
  }

  .create-preview {
    position: static;
  }

  .inspiration-grid {
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  }

  .app-content {
    padding: var(--space-6);
  }

  .genre-grid {
    grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  }
}

/* ============================================================
   27b. RESPONSIVE — Tablet Only (768px – 1023px)
       Refinements that apply ONLY to tablets, not to mobile.
   ============================================================ */
@media (min-width: 768px) and (max-width: 1023px) {

  /* Content padding — between desktop and mobile */
  .app-content {
    padding: var(--space-5);
  }

  /* Player — optimized for tablet landscape/portrait */
  .player-cover-large {
    max-width: 280px;
  }

  .player-cover-area {
    margin-bottom: var(--space-8);
  }

  .player-song-title {
    font-size: var(--text-2xl);
  }

  .player-controls-area {
    gap: var(--space-8);
  }

  .player-lyrics-panel.open {
    max-height: 320px;
  }

  .player-lyrics-scroll {
    max-height: 260px;
  }

  .player-action-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .player-ctrl-btn {
    min-width: 44px;
    min-height: 44px;
  }

  .player-play-btn {
    min-width: 64px;
    min-height: 64px;
  }

  /* Library / Song Grid — 3-4 columns on tablet */
  .song-grid {
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: var(--space-4);
  }

  /* Inspiration Grid — 2 columns */
  .inspiration-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  /* Genre Grid */
  .genre-grid {
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  }

  /* Create page refinements */
  .create-form-section {
    padding: var(--space-5);
  }

  .create-preview {
    padding: var(--space-5);
  }

  /* Settings */
  .settings-page {
    max-width: 580px;
  }

  /* Modals — wider on tablet than mobile */
  .modal {
    max-width: 560px;
  }

  /* Profile stats — 3 columns */
  .profile-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
  }
}

/* ============================================================
   28. RESPONSIVE — Mobile (< 768px)
   ============================================================ */
@media (max-width: 767px) {
  /* Hide sidebar, show bottom tab bar */
  .app-sidebar {
    display: none;
  }

  .app-main {
    margin-left: 0;
    padding-bottom: calc(var(--player-height-mobile) + 56px + var(--space-4));
  }

  .app-header {
    padding: var(--space-3) var(--space-4);
  }

  .hero-heading {
    font-size: var(--text-2xl);
  }

  .app-content {
    padding: var(--space-4);
  }

  .mobile-tab-bar {
    display: block;
  }

  .mini-player {
    left: 0;
    bottom: 56px;
    height: var(--player-height-mobile);
  }

  .mini-player-inner {
    padding: 0 var(--space-4);
    gap: var(--space-3);
  }

  .mini-player-cover {
    width: 40px;
    height: 40px;
  }

  .mini-player-btn {
    width: 32px;
    height: 32px;
  }

  .mini-player-btn.play {
    width: 36px;
    height: 36px;
  }

  /* Create page */
  .create-page {
    grid-template-columns: 1fr;
  }

  .create-form-section {
    padding: var(--space-4);
  }

  /* Library */
  .song-grid {
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: var(--space-3);
  }

  .library-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .library-search {
    max-width: none;
  }

  /* Player */
  .player-cover-large {
    max-width: 240px;
    border-radius: var(--radius-lg);
    margin-bottom: var(--space-6);
  }

  .player-controls-area {
    gap: var(--space-6);
  }

  .player-play-btn {
    width: 60px;
    height: 60px;
  }

  .player-play-btn svg {
    width: 24px;
    height: 24px;
  }

  .player-ctrl-btn {
    width: 40px;
    height: 40px;
  }

  .player-song-title {
    font-size: var(--text-xl);
  }

  /* Player Extended — Mobile */
  .player-cover-char {
    font-size: 3.5rem;
  }

  .player-cover-area {
    margin-bottom: var(--space-6);
  }

  .player-lyric-line {
    font-size: var(--text-base);
    padding: var(--space-1) var(--space-2);
  }

  .player-lyrics-panel.open {
    max-height: 300px;
  }

  .player-lyrics-scroll {
    max-height: 240px;
  }

  .player-extra-actions {
    gap: var(--space-4);
  }

  /* Profile */
  .profile-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-2);
  }

  .stat-card {
    padding: var(--space-3);
  }

  .stat-card-value {
    font-size: var(--text-xl);
  }

  /* Inspiration */
  .inspiration-grid {
    grid-template-columns: 1fr;
  }

  .genre-grid {
    grid-template-columns: repeat(auto-fill, minmax(64px, 1fr));
    gap: var(--space-2);
  }

  /* Modals */
  .modal {
    max-width: calc(100vw - 32px);
    max-height: 80vh;
    border-radius: var(--radius-lg);
  }

  .modal-body {
    padding: var(--space-4);
  }

  .modal-header {
    padding: var(--space-4) var(--space-4) 0;
  }

  .modal-footer {
    padding: 0 var(--space-4) var(--space-4);
  }

  /* Toast */
  .toast-container {
    top: var(--space-4);
    right: var(--space-4);
    left: var(--space-4);
  }

  .toast {
    max-width: none;
  }

  /* Settings */
  .settings-page {
    max-width: none;
  }
}

/* ============================================================
   29. RESPONSIVE — Large Desktop (>1400px)
   ============================================================ */
@media (min-width: 1400px) {
  .inspiration-grid {
    grid-template-columns: repeat(3, 1fr);
  }

  .song-grid {
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  }

  .create-page {
    grid-template-columns: 1fr 420px;
  }
}

/* ============================================================
   30. REDUCED MOTION
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ============================================================
   31. PRINT STYLES
   ============================================================ */
@media print {
  .app-sidebar,
  .mini-player,
  .mobile-tab-bar,
  .app-header,
  .modal-overlay,
  .toast-container {
    display: none !important;
  }

  .app-main {
    margin: 0;
    padding: 0;
  }

  body {
    background: #fff;
    color: #000;
  }
}

/* ============================================================
   32. POLISH — Home (Hero / Genre / Song Card / Inspiration)
   ============================================================ */

/* --- 32.1 Hero --- */
/* Hero 背景：微妙噪点纹理（SVG filter via data URI） */
.hero-section::before {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0.18 0 0 0 0 0.10 0 0 0 0 0.06 0 0 0 0.5 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.35'/%3E%3C/svg%3E");
  background-size: 220px 220px;
  opacity: 0.45;
  mix-blend-mode: multiply;
  border-radius: inherit;
}

/* Hero 内容 z-index 提升 */
.hero-section > * {
  position: relative;
  z-index: 1;
}

/* Hero 标题渐变文字 */
.hero-heading .hero-heading-gradient {
  background: linear-gradient(135deg, var(--color-text-primary) 0%, var(--color-accent) 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
  display: inline;
  /* 渐变回退（无 background-clip 支持时） */
  background-color: var(--color-text-primary);
}

@supports (-webkit-background-clip: text) {
  .hero-heading .hero-heading-gradient {
    background-color: transparent;
  }
}

/* Hero Badge 呼吸脉冲 */
.hero-badge {
  animation: badgeBreath 2.6s ease-in-out infinite;
  box-shadow: 0 0 0 0 var(--color-accent-glow);
}

.hero-badge-dot {
  position: relative;
}

.hero-badge-dot::after {
  content: '';
  position: absolute;
  inset: -3px;
  border-radius: 50%;
  border: 1.5px solid var(--color-accent);
  opacity: 0;
  animation: dotRipple 2s ease-out infinite;
}

@keyframes dotRipple {
  0%   { transform: scale(0.6); opacity: 0.6; }
  100% { transform: scale(2.2); opacity: 0; }
}

/* Quick Input 卡片：focus 渐变边框 */
.quick-input-card {
  position: relative;
  isolation: isolate;
  /* 替换原 border，使其能容纳渐变 */
  border: 1px solid var(--color-border-light);
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.quick-input-card::before {
  content: '';
  position: absolute;
  inset: -1px;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(135deg, var(--color-accent) 0%, #FF8C66 50%, var(--color-accent) 100%);
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
          mask-composite: exclude;
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
  z-index: -1;
}

.quick-input-card:focus-within {
  border-color: transparent;
  box-shadow: var(--shadow-lg);
}

.quick-input-card:focus-within::before {
  opacity: 1;
}

/* 浮动音符 — 进一步分层（更细腻的尺寸与透明度） */
.floating-note,
.floating-note-double {
  will-change: transform, opacity;
}

@media (prefers-reduced-motion: reduce) {
  .floating-note,
  .floating-note-double {
    animation: none !important;
    opacity: 0.25;
  }
  .hero-badge { animation: none; }
  .hero-badge-dot::after { animation: none; }
}

/* --- 32.2 Genre 芯片 (Home) 增强 --- */
#genre-scroll .chip {
  position: relative;
  transition:
    transform var(--transition-spring),
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast);
  transform-origin: center;
}

#genre-scroll .chip > span:first-child {
  /* 流派彩色圆点：呼吸光效 */
  animation: dotBreath 2.4s ease-in-out infinite;
  box-shadow: 0 0 0 0 currentColor;
}

#genre-scroll .chip:hover {
  background: var(--color-bg-alt);
  border-color: var(--color-text-tertiary);
  color: var(--color-text-primary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
  transform: translateY(-1px);
}

#genre-scroll .chip.active {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
  color: var(--color-accent);
  animation: chipPop 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

#genre-scroll .chip.active > span:first-child {
  /* 选中时圆点更明显 */
  box-shadow: 0 0 0 3px var(--color-accent-subtle);
}

@media (prefers-reduced-motion: reduce) {
  #genre-scroll .chip > span:first-child,
  #genre-scroll .chip.active {
    animation: none !important;
  }
}

/* --- 32.3 Recent Songs 卡片 (Home) 增强 --- */
.song-grid-card {
  position: relative;
  overflow: hidden; /* 用于裁切封面放大 */
}

.song-grid-card .song-grid-cover {
  overflow: hidden; /* 内部封面放大裁切 */
}

.song-grid-card .song-grid-cover::before {
  /* 暗角效果 (radial-gradient overlay) */
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 1;
  background: radial-gradient(
    ellipse at center,
    transparent 40%,
    rgba(0, 0, 0, 0.18) 100%
  );
  transition: opacity var(--transition-base);
}

/* 封面字符在悬停时缓慢放大 */
.song-grid-card .song-grid-cover > span {
  transition: transform 600ms cubic-bezier(0.22, 1, 0.36, 1);
  will-change: transform;
}

.song-grid-card:hover .song-grid-cover > span {
  transform: scale(1.05);
}

/* 播放覆盖按钮 — 延迟出现 (0.15s) */
.song-grid-cover-overlay {
  /* 覆盖 base .song-grid-cover-overlay (opacity 0) */
  transition: opacity 250ms cubic-bezier(0.4, 0, 0.2, 1) 150ms;
}

.song-grid-card .song-grid-play-btn {
  /* 基础缩放：隐藏时略缩小 */
  transform: scale(0.85);
  transition: transform var(--transition-spring), background var(--transition-fast);
}

.song-grid-card:hover .song-grid-play-btn {
  transform: scale(1);
}

/* 标题截断渐隐效果 */
.song-grid-card .song-grid-title {
  position: relative;
  display: block;
  max-width: 100%;
  padding-right: 0;
  mask-image: linear-gradient(to right, #000 88%, transparent 100%);
  -webkit-mask-image: linear-gradient(to right, #000 88%, transparent 100%);
}

/* --- 32.4 Inspiration 卡片 (Home) 增强 --- */
.inspiration-card {
  position: relative;
  padding-left: calc(var(--space-5) + 4px);
  overflow: hidden;
}

.inspiration-card::before {
  /* 左侧竖线装饰 */
  content: '';
  position: absolute;
  left: 0;
  top: var(--space-4);
  bottom: var(--space-4);
  width: 4px;
  border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  background: var(--inspiration-accent, var(--color-accent));
  opacity: 0.85;
  transition:
    width var(--transition-base),
    background var(--transition-base),
    opacity var(--transition-base);
}

.inspiration-card:hover {
  padding-left: calc(var(--space-5) + 6px);
}

.inspiration-card:hover::before {
  width: 6px;
  background: var(--inspiration-accent-hover, var(--color-accent-hover));
  opacity: 1;
}

.inspiration-card .inspiration-card-icon {
  /* 微微透出主题色 */
  color: var(--inspiration-accent, var(--color-accent));
}

/* ============================================================
   33. POLISH — Create Page (Form / Preview / Progress / Result)
   ============================================================ */

/* --- 33.1 表单分区之间的淡色分割线 --- */
/* 只给 create-form 直接子级 .create-form-section 之间的缝隙加分割线（除第一个） */
.create-form > .create-form-section:not(:first-child) {
  border-top: 1px solid var(--color-border-light);
  padding-top: var(--space-6);
  margin-top: var(--space-2);
}

/* 输入 focus 边框：渐变（通过 ::after 模拟） */
.create-form-section .input,
.create-form-section .textarea {
  position: relative;
  transition:
    border-color var(--transition-base),
    box-shadow var(--transition-base),
    background var(--transition-base);
}

.create-form-section .input:hover,
.create-form-section .textarea:hover {
  border-color: var(--color-text-tertiary);
}

.create-form-section .input:focus,
.create-form-section .textarea:focus {
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px var(--color-accent-glow);
  background: var(--color-surface);
}

/* Textarea 字符计数器（右下角） */
.textarea-with-count {
  position: relative;
}

.textarea-with-count .textarea {
  padding-bottom: var(--space-8);
}

.textarea-count {
  position: absolute;
  right: var(--space-3);
  bottom: var(--space-2);
  font-size: var(--text-2xs);
  color: var(--color-text-tertiary);
  font-variant-numeric: tabular-nums;
  pointer-events: none;
  letter-spacing: 0.02em;
  transition: color var(--transition-fast);
}

.textarea-count.warning { color: var(--color-warning); }
.textarea-count.danger  { color: var(--color-danger); }

/* 芯片弹性动画（genre / mood / instrument chip 选中态） */
.create-form .chip,
.create-form .genre-chip,
.create-form .lang-chip {
  transform-origin: center;
  transition:
    transform var(--transition-spring),
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    box-shadow var(--transition-fast);
}

.create-form .chip.active,
.create-form .genre-chip.active,
.create-form .lang-chip.active {
  animation: chipPop 320ms cubic-bezier(0.34, 1.56, 0.64, 1);
}

.create-form .genre-chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.create-form .chip:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.04);
}

@media (prefers-reduced-motion: reduce) {
  .create-form .chip.active,
  .create-form .genre-chip.active,
  .create-form .lang-chip.active {
    animation: none !important;
  }
}

/* --- 33.2 预览面板：固定顶部装饰条 --- */
.create-preview-card {
  position: relative;
  overflow: hidden;
}

.create-preview-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(90deg, var(--color-accent) 0%, #FF8C66 60%, transparent 100%);
  z-index: 1;
}

/* Prompt 文本：等宽字体 */
#prompt-preview-text,
.prompt-preview-text {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: var(--leading-relaxed);
  text-align: left !important;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--color-text-secondary);
  padding: var(--space-3);
  background: var(--color-bg-alt);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--color-accent);
}

/* 预览字符计数 */
.preview-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--space-2);
  font-size: var(--text-2xs);
  color: var(--color-text-tertiary);
}

.preview-char-count {
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}

/* --- 33.3 进度系统 --- */
.generation-progress {
  position: relative;
  background: var(--color-bg-alt);
}

.generation-progress-fill {
  background: linear-gradient(90deg, var(--color-accent) 0%, #FF8C66 100%) !important;
  position: relative;
  overflow: hidden;
}

.generation-progress-fill::after {
  /* 光泽扫光（subtle shimmer） */
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.35) 50%,
    transparent 100%
  );
  animation: progressShimmer 1.8s linear infinite;
  transform: translateX(-100%);
}

@keyframes progressShimmer {
  0%   { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .generation-progress-fill::after { animation: none; }
}

/* 阶段步骤：完成时的打勾动画 */
.generation-step.completed .generation-step-icon {
  animation: stepComplete 360ms cubic-bezier(0.34, 1.56, 0.64, 1);
  position: relative;
  background: var(--color-accent);
  color: var(--color-text-inverse);
  box-shadow: 0 2px 8px var(--color-accent-glow);
}

.generation-step.completed .generation-step-icon {
  /* 隐藏原数字（如果存在） */
  font-size: 0;
  color: transparent;
}

.generation-step.completed .generation-step-icon::before {
  /* 用 CSS 绘制一个简易打勾 */
  content: '';
  width: 12px;
  height: 6px;
  border-left: 2px solid var(--color-text-inverse);
  border-bottom: 2px solid var(--color-text-inverse);
  transform: rotate(-45deg) translate(1px, -1px);
  animation: checkDraw 320ms cubic-bezier(0.65, 0, 0.35, 1) forwards;
}

@media (prefers-reduced-motion: reduce) {
  .generation-step.completed .generation-step-icon {
    animation: none;
  }
  .generation-step.completed .generation-step-icon::before {
    animation: none;
  }
}

/* 百分比数字 tabular-nums */
.progress-pct {
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--color-accent) 0%, #FF8C66 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

@supports not (-webkit-background-clip: text) {
  .progress-pct {
    background: none;
    -webkit-text-fill-color: var(--color-accent);
    color: var(--color-accent);
  }
}

/* --- 33.4 结果卡片 --- */
.result-cover {
  position: relative;
  animation: resultCoverPulse 3.2s ease-in-out infinite;
}

.result-cover::after {
  /* 内部暗角（增强封面深度） */
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(
    ellipse at center,
    transparent 55%,
    rgba(0, 0, 0, 0.22) 100%
  );
  border-radius: inherit;
}

.result-cover-char {
  position: relative;
  z-index: 1;
}

@media (prefers-reduced-motion: reduce) {
  .result-cover { animation: none; }
}

/* 播放按钮 — 呼吸发光 */
.result-play-btn {
  position: relative;
  animation: playBtnGlow 2.4s ease-in-out infinite;
}

.result-play-btn::before {
  /* 额外发光环 */
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: inherit;
  box-shadow: 0 0 0 0 var(--color-accent-glow);
  opacity: 0.6;
  pointer-events: none;
  animation: playBtnGlow 2.4s ease-in-out infinite;
}

@media (prefers-reduced-motion: reduce) {
  .result-play-btn,
  .result-play-btn::before {
    animation: none !important;
  }
}

/* 副按钮（下载 / 完成）悬停色变 */
.result-secondary-btn {
  position: relative;
  transition:
    background var(--transition-fast),
    border-color var(--transition-fast),
    color var(--transition-fast),
    transform var(--transition-fast);
}

.result-secondary-btn:hover {
  background: var(--color-accent-subtle);
  border-color: var(--color-accent);
  color: var(--color-accent);
  transform: translateY(-1px);
}

.result-secondary-btn:active {
  transform: translateY(0);
}

/* ============================================================
   34. POLISH — Reduced Motion Overrides (component-level)
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .hero-section::before,
  .quick-input-card::before,
  .create-preview-card::before,
  .hero-heading .hero-heading-gradient,
  .progress-pct {
    /* 移除装饰性背景动画 */
    animation: none !important;
  }
}

/* ============================================================
   35. OFFLINE BANNER — 网络状态提示
   ============================================================ */
.offline-banner {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  background: #DC3545;
  color: #fff;
  font-size: 0.8125rem;
  font-weight: 600;
  text-align: center;
  box-shadow: 0 2px 8px rgba(220, 53, 69, 0.3);
  animation: offlineBannerSlideIn 0.3s ease-out;
}

.offline-banner-icon {
  font-size: 1rem;
  flex-shrink: 0;
}

@keyframes offlineBannerSlideIn {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}
