/**
 * SonicFlow Design System
 * Concert-hall parchment aesthetic — tokens + components.
 * Square geometry (except true circles: vinyl, dots, pivots).
 */

/* ═══════════════════════════════════════════════════════════
   0. GENTLE FLOAT — buttons / cards (list stack uses JS float)
   ═══════════════════════════════════════════════════════════ */
@keyframes sf-gentle-float {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -3.5px, 0);
  }
}
@keyframes sf-gentle-float-sm {
  0%,
  100% {
    transform: translate3d(0, 0, 0);
  }
  50% {
    transform: translate3d(0, -2.5px, 0);
  }
}

/* Cards & panels — exclude main info card (#info-panel stays still) */
.glass-panel:not(#info-panel),
.sf-card-soft,
.neo-inset {
  animation: sf-gentle-float 6.2s ease-in-out infinite;
}
.glass-panel:not(#info-panel):nth-of-type(2n),
.sf-card-soft:nth-of-type(2n) {
  animation-delay: 0.55s;
  animation-duration: 6.8s;
}
.glass-panel:not(#info-panel):nth-of-type(3n),
.sf-card-soft:nth-of-type(3n) {
  animation-delay: 1.1s;
  animation-duration: 7.4s;
}
#info-panel.glass-panel {
  animation: none !important;
  transform: none !important;
}

/* Buttons (all families) */
.sf-btn:not(:disabled),
button.sf-btn:not(:disabled),
a.sf-btn,
.neo-button:not(:disabled),
.crate-btn:not(:disabled),
button.crate-btn:not(:disabled) {
  animation: sf-gentle-float-sm 4.6s ease-in-out infinite;
}
.sf-btn:nth-child(2n),
.neo-button:nth-child(2n),
.crate-btn:nth-child(2n) {
  animation-delay: 0.35s;
  animation-duration: 5s;
}
.sf-btn:nth-child(3n),
.neo-button:nth-child(3n),
.crate-btn:nth-child(3n) {
  animation-delay: 0.7s;
  animation-duration: 5.4s;
}
.sf-btn:nth-child(4n),
.neo-button:nth-child(4n),
.crate-btn:nth-child(4n) {
  animation-delay: 1.05s;
  animation-duration: 4.9s;
}

/* Hover: pause float so lift/scale reads cleanly */
.sf-btn:hover:not(:disabled),
button.sf-btn:hover:not(:disabled),
a.sf-btn:hover,
.neo-button:hover:not(:disabled),
.crate-btn:hover:not(:disabled),
.glass-panel:not(#info-panel):hover {
  animation-play-state: paused;
}

@media (prefers-reduced-motion: reduce) {
  .glass-panel,
  .sf-card-soft,
  .neo-inset,
  .sf-btn:not(:disabled),
  button.sf-btn:not(:disabled),
  a.sf-btn,
  .neo-button:not(:disabled),
  .crate-btn:not(:disabled),
  button.crate-btn:not(:disabled) {
    animation: none !important;
  }
}

/* Trial badge under crate controls */
.sf-trial-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0.35rem auto 0.15rem;
  padding: 0.28rem 0.7rem;
  font-size: 0.65rem;
  font-family: var(--sf-font-mono, ui-monospace, monospace);
  letter-spacing: 0.06em;
  color: var(--sf-burgundy, #6b2c3e) !important;
  background: rgba(255, 252, 247, 0.72) !important;
  border: 1px solid rgba(184, 151, 90, 0.4) !important;
  box-shadow: 0 4px 12px rgba(42, 33, 24, 0.08);
  white-space: nowrap;
  max-width: 100%;
}
.sf-trial-badge[data-mode="blocked"] {
  color: #8b2e2e !important;
  border-color: rgba(180, 80, 80, 0.45) !important;
}
.sf-trial-badge[data-mode="byok"] {
  color: #2d5a3d !important;
  border-color: rgba(80, 140, 100, 0.4) !important;
}

/* Local download icon buttons in detail panel */
.local-dl-audio,
.local-dl-script {
  color: var(--sf-burgundy, #6b2c3e) !important;
  background: rgba(255, 252, 247, 0.55) !important;
  border: 1px solid rgba(184, 151, 90, 0.35) !important;
  cursor: pointer;
}

/* ═══════════════════════════════════════════════════════════
   1. TOKENS
   ═══════════════════════════════════════════════════════════ */
:root {
  /* Surface */
  --sf-parchment: #f4efe4;
  --sf-parchment-deep: #ebe3d4;
  --sf-cream: #fbf7f0;
  --sf-surface: #f7f2e8;
  --sf-ink: #2a2118;
  --sf-ink-muted: #5c4f42;
  --sf-ink-faint: rgba(42, 33, 24, 0.42);

  /* Brand */
  --sf-burgundy: #6b2c3e;
  --sf-burgundy-deep: #4a1f2c;
  --sf-burgundy-soft: #7a3a4c;
  --sf-gold: #b8975a;
  --sf-gold-light: #d4bc84;
  --sf-gold-line: rgba(184, 151, 90, 0.42);
  --sf-gold-line-soft: rgba(184, 151, 90, 0.22);

  /* Semantic */
  --sf-success: #5c6b4a;
  --sf-success-bg: rgba(92, 107, 74, 0.1);
  --sf-danger: #8b2e2e;
  --sf-danger-bg: rgba(139, 46, 46, 0.08);
  --sf-warning: #8a6a2f;
  --sf-warning-bg: rgba(138, 106, 47, 0.1);

  /* Glass */
  --sf-glass-bg: linear-gradient(
      160deg,
      rgba(255, 255, 255, 0.4) 0%,
      rgba(255, 252, 247, 0.14) 48%,
      rgba(244, 239, 228, 0.16) 100%
    ),
    rgba(251, 247, 240, 0.14);
  --sf-glass-border: rgba(255, 255, 255, 0.55);
  --sf-glass-shadow:
    0 18px 44px rgba(42, 33, 24, 0.07),
    0 4px 12px rgba(74, 31, 44, 0.03),
    inset 0 1px 0 rgba(255, 255, 255, 0.7),
    inset 0 0 0 0.5px rgba(255, 255, 255, 0.28);

  /* Type */
  --sf-font-serif: "Cormorant Garamond", "LXGW WenKai Screen", serif;
  --sf-font-sans: "Inter", "LXGW WenKai Screen", sans-serif;
  --sf-font-mono: "JetBrains Mono", ui-monospace, monospace;
  --sf-tracking-btn: 0.12em;
  --sf-tracking-label: 0.18em;

  /* Motion */
  --sf-ease: cubic-bezier(0.25, 1, 0.5, 1);
  --sf-duration: 0.22s;
  --sf-duration-slow: 0.35s;

  /* Spacing rhythm (8pt) */
  --sf-space-1: 0.25rem;
  --sf-space-2: 0.5rem;
  --sf-space-3: 0.75rem;
  --sf-space-4: 1rem;
  --sf-space-5: 1.25rem;
  --sf-space-6: 1.5rem;
  --sf-space-8: 2rem;

  /* Legacy aliases used in inline styles */
  --parchment: var(--sf-parchment);
  --parchment-deep: var(--sf-parchment-deep);
  --cream: var(--sf-cream);
  --ink: var(--sf-ink);
  --ink-muted: var(--sf-ink-muted);
  --burgundy: var(--sf-burgundy);
  --burgundy-deep: var(--sf-burgundy-deep);
  --gold: var(--sf-gold);
  --gold-light: var(--sf-gold-light);
  --gold-line: var(--sf-gold-line);
}

/* ═══════════════════════════════════════════════════════════
   2. BUTTONS — four roles only
   ═══════════════════════════════════════════════════════════ */

/* Base */
.sf-btn,
.crate-btn,
.neo-button,
button.sf-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  margin: 0;
  border: 1px solid transparent;
  border-radius: 0 !important;
  font-family: var(--sf-font-serif);
  font-weight: 600;
  letter-spacing: var(--sf-tracking-btn);
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  text-decoration: none;
  isolation: isolate;
  overflow: hidden;
  transition:
    background var(--sf-duration) ease,
    border-color var(--sf-duration) ease,
    box-shadow var(--sf-duration) ease,
    color var(--sf-duration) ease,
    opacity var(--sf-duration) ease,
    transform 0.18s ease;
}

.sf-btn:focus-visible,
.crate-btn:focus-visible,
.neo-button:focus-visible {
  outline: 2px solid var(--sf-gold);
  outline-offset: 2px;
}

.sf-btn:disabled,
.crate-btn:disabled,
.neo-button:disabled,
.sf-btn[disabled] {
  opacity: 0.42;
  cursor: not-allowed;
  transform: none !important;
  pointer-events: none;
}

.sf-btn:active:not(:disabled),
.crate-btn:active:not(:disabled) {
  transform: scale(0.985);
}

/* Size */
.sf-btn,
.sf-btn-md {
  padding: 0.65rem 1.15rem;
  font-size: 0.8125rem;
}
.sf-btn-sm {
  padding: 0.4rem 0.85rem;
  font-size: 0.6875rem;
  letter-spacing: 0.1em;
}
.sf-btn-lg {
  padding: 0.8rem 1.35rem;
  font-size: 0.875rem;
}
.sf-btn-block {
  width: 100%;
}
.sf-btn-flex {
  flex: 1 1 0;
  min-width: 0;
}

/* Sheen (shared glass / primary chips) */
.sf-btn::before,
.crate-btn::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  background: linear-gradient(
    125deg,
    rgba(255, 255, 255, 0.38) 0%,
    rgba(255, 255, 255, 0.06) 28%,
    transparent 52%
  );
}
.sf-btn > *,
.crate-btn > :not(.silk-glass-peek) {
  position: relative;
  z-index: 1;
}

/* —— Primary: deep burgundy + gold edge —— */
.sf-btn-primary,
button.sf-btn-primary,
.crate-btn-dark,
button.crate-btn-dark,
#lib-play-btn,
#manage-bulk-download-btn,
#create-ep-btn.crate-btn-dark,
#settings-save-api-btn,
#settings-save-general-btn {
  color: var(--sf-cream) !important;
  background-color: #6b2c3e !important;
  background-image:
    linear-gradient(
      155deg,
      rgba(122, 58, 76, 0.98) 0%,
      rgba(74, 31, 44, 1) 100%
    ) !important;
  border: 1px solid rgba(212, 188, 132, 0.45) !important;
  box-shadow:
    0 8px 22px rgba(74, 31, 44, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.18) !important;
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
  opacity: 1 !important;
  visibility: visible !important;
}
.sf-btn-primary:hover:not(:disabled),
.crate-btn-dark:hover:not(:disabled),
#lib-play-btn:hover:not(:disabled),
#manage-bulk-download-btn:hover:not(:disabled) {
  background:
    linear-gradient(
      155deg,
      rgba(140, 70, 90, 0.96) 0%,
      rgba(90, 38, 54, 0.98) 100%
    ),
    var(--sf-burgundy-soft) !important;
  border-color: rgba(212, 188, 132, 0.55) !important;
  color: #fff !important;
}
/* Circular chips: disc shadow (hover lift defined above) */
.crate-btn.crate-btn-circle.crate-btn-dark,
.crate-btn.crate-btn-circle.crate-btn-glass {
  box-shadow:
    0 6px 14px rgba(42, 33, 24, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.28) !important;
}
.sf-btn-primary .material-symbols-outlined,
.crate-btn-dark .material-symbols-outlined {
  color: rgba(251, 247, 240, 0.95);
  font-size: 1.05em;
}

/* —— Secondary: frosted glass —— */
.sf-btn-secondary,
button.sf-btn-secondary,
.crate-btn-glass,
button.crate-btn-glass,
#settings-btn.crate-btn-glass,
#sponsor-btn.crate-btn-glass {
  color: var(--sf-burgundy) !important;
  background-color: rgba(255, 252, 247, 0.55) !important;
  background-image:
    linear-gradient(
      155deg,
      rgba(255, 255, 255, 0.62) 0%,
      rgba(255, 252, 247, 0.28) 55%,
      rgba(251, 247, 240, 0.22) 100%
    ) !important;
  border: 1px solid rgba(255, 255, 255, 0.65) !important;
  box-shadow:
    0 8px 22px rgba(42, 33, 24, 0.08),
    inset 0 1px 0 rgba(255, 255, 255, 0.85),
    inset 0 0 0 0.5px rgba(184, 151, 90, 0.14) !important;
  backdrop-filter: blur(16px) saturate(150%) brightness(1.04);
  -webkit-backdrop-filter: blur(16px) saturate(150%) brightness(1.04);
  opacity: 1 !important;
  visibility: visible !important;
}
.sf-btn-secondary:hover:not(:disabled),
.crate-btn-glass:hover:not(:disabled) {
  color: var(--sf-burgundy-deep) !important;
  border-color: rgba(184, 151, 90, 0.45) !important;
  background:
    linear-gradient(
      155deg,
      rgba(255, 255, 255, 0.58) 0%,
      rgba(251, 247, 240, 0.22) 100%
    ),
    rgba(255, 252, 247, 0.16) !important;
}
.sf-btn-secondary .material-symbols-outlined,
.crate-btn-glass .material-symbols-outlined {
  color: var(--sf-burgundy);
  font-size: 1.05em;
}

/* —— Ghost / outline —— */
.sf-btn-ghost {
  color: var(--sf-ink-muted) !important;
  background: rgba(251, 247, 240, 0.35) !important;
  border: 1px solid var(--sf-gold-line-soft) !important;
  box-shadow: none !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.sf-btn-ghost:hover:not(:disabled) {
  color: var(--sf-burgundy) !important;
  border-color: rgba(107, 44, 62, 0.28) !important;
  background: rgba(251, 247, 240, 0.65) !important;
}
.sf-btn-ghost::before {
  opacity: 0.35;
}

/* —— Danger —— */
.sf-btn-danger,
#lib-delete-btn.sf-btn-danger,
#manage-bulk-delete-btn {
  color: var(--sf-burgundy) !important;
  background: rgba(251, 247, 240, 0.4) !important;
  border: 1px solid rgba(107, 44, 62, 0.28) !important;
  box-shadow: none !important;
}
.sf-btn-danger:hover:not(:disabled),
#lib-delete-btn:hover:not(:disabled),
#manage-bulk-delete-btn:hover:not(:disabled) {
  color: var(--sf-danger) !important;
  background: var(--sf-danger-bg) !important;
  border-color: rgba(139, 46, 46, 0.4) !important;
}

/* —— Icon square —— */
.sf-btn-icon,
.neo-button {
  width: 3rem;
  height: 3rem;
  padding: 0 !important;
  flex-shrink: 0;
  color: var(--sf-ink-muted);
  background: var(--sf-cream) !important;
  border: 1px solid rgba(184, 151, 90, 0.32) !important;
  box-shadow: none !important;
  letter-spacing: 0;
}
.sf-btn-icon::before,
.neo-button::before {
  opacity: 0.25;
}
.sf-btn-icon:hover:not(:disabled),
.neo-button:hover:not(:disabled) {
  background: var(--sf-parchment-deep) !important;
  border-color: rgba(107, 44, 62, 0.28) !important;
  color: var(--sf-burgundy);
}
.sf-btn-icon:active:not(:disabled),
.neo-button:active:not(:disabled) {
  background: rgba(107, 44, 62, 0.08) !important;
  transform: none;
}
.sf-btn-icon.sf-btn-danger,
.neo-button.sf-btn-danger {
  color: var(--sf-burgundy);
  border-color: rgba(184, 151, 90, 0.28) !important;
}
.sf-btn-icon.sf-btn-danger:hover:not(:disabled) {
  color: var(--sf-danger);
  background: var(--sf-danger-bg) !important;
  border-color: rgba(139, 46, 46, 0.35) !important;
}

/* Crate footer — circular action chips, spaced, no bar/strip behind */
#crate-footer-btns {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 1.5rem;
  flex-wrap: nowrap;
  width: 100%;
  background: transparent !important;
  box-shadow: none !important;
  border: none !important;
  isolation: isolate;
}
#crate-footer-btns::before,
#crate-footer-btns::after {
  display: none !important;
  content: none !important;
}
.crate-btn {
  flex: 0 0 auto;
  min-width: 0;
  font-family: var(--sf-font-serif);
  letter-spacing: 0.1em;
  background-clip: padding-box;
}
/* Round discs (overrides global square UI) */
.crate-btn.crate-btn-circle,
.crate-btn.crate-btn-circle::before {
  border-radius: 50% !important;
}
.crate-btn.crate-btn-circle {
  width: 3.15rem;
  height: 3.15rem;
  padding: 0;
  flex-direction: column;
  gap: 0;
  font-size: 0;
  font-weight: 600;
  line-height: 1;
  overflow: hidden;
  box-shadow:
    0 6px 16px rgba(42, 33, 24, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.35) !important;
  transition:
    background 0.28s ease,
    border-color 0.28s ease,
    box-shadow 0.28s ease,
    color 0.22s ease,
    transform 0.22s cubic-bezier(0.25, 1, 0.5, 1);
}
.crate-btn.crate-btn-circle .material-symbols-outlined {
  font-size: 1.35rem !important;
  line-height: 1;
  font-variation-settings: "FILL" 0, "wght" 400, "GRAD" 0, "opsz" 24;
  transition: transform 0.22s cubic-bezier(0.25, 1, 0.5, 1);
}
.crate-btn.crate-btn-circle .crate-btn-label {
  display: none !important;
}
/* All crate chips icon-only, uniform size */
.crate-btn.crate-btn-circle.crate-btn-icon-only {
  width: 3.15rem;
  height: 3.15rem;
  gap: 0;
}
.crate-btn.crate-btn-circle.crate-btn-icon-only .material-symbols-outlined {
  font-size: 1.4rem !important;
}
/* Sponsor uses filled glyph */
#sponsor-btn .material-symbols-outlined {
  font-variation-settings: "FILL" 1, "wght" 400, "GRAD" 0, "opsz" 24;
}
/* Soft hover lift + icon nudge (pause float so transform isn't fighting animation) */
.crate-btn.crate-btn-circle:hover:not(:disabled) {
  animation-play-state: paused;
  transform: translateY(-3px) scale(1.04);
  box-shadow:
    0 12px 24px rgba(42, 33, 24, 0.14),
    inset 0 1px 0 rgba(255, 255, 255, 0.4) !important;
}
.crate-btn.crate-btn-circle:hover:not(:disabled) .material-symbols-outlined {
  transform: scale(1.08);
}
.crate-btn.crate-btn-circle:active:not(:disabled) {
  animation-play-state: paused;
  transform: translateY(0) scale(0.96);
}
@media (prefers-reduced-motion: reduce) {
  #info-panel.sponsor-mode .sponsor-panel-qr {
    animation: none !important;
  }
  .crate-btn.crate-btn-circle:hover:not(:disabled) {
    transform: none;
  }
}

/* Play control (player bar) — cream face, brand edge */
#pp-btn {
  background: var(--sf-cream) !important;
  color: var(--sf-burgundy) !important;
  border: 1px solid rgba(184, 151, 90, 0.38) !important;
  box-shadow: none !important;
  border-radius: 0 !important;
}
#pp-btn:hover:not(:disabled) {
  background: var(--sf-parchment-deep) !important;
  border-color: rgba(107, 44, 62, 0.3) !important;
}
#pp-btn:disabled {
  opacity: 0.45;
}

/* ═══════════════════════════════════════════════════════════
   3. PANELS / SURFACES
   ═══════════════════════════════════════════════════════════ */
.glass-panel {
  background: var(--sf-glass-bg);
  backdrop-filter: blur(18px) saturate(140%) brightness(1.03);
  -webkit-backdrop-filter: blur(18px) saturate(140%) brightness(1.03);
  border: 1px solid var(--sf-glass-border);
  box-shadow: var(--sf-glass-shadow);
  border-radius: 0 !important;
}

.sf-surface-inset,
.neo-inset {
  background: var(--sf-parchment);
  border: 1px solid var(--sf-gold-line-soft);
  box-shadow: none;
  border-radius: 0 !important;
}

.sf-card-soft {
  background: rgba(255, 255, 255, 0.22);
  border: 1px solid rgba(184, 151, 90, 0.18);
  border-radius: 0 !important;
}

/* ═══════════════════════════════════════════════════════════
   4. FORMS
   ═══════════════════════════════════════════════════════════ */
.sf-input,
.sf-select,
.sf-textarea,
#info-create-panel input,
#info-create-panel textarea,
#info-create-panel select {
  width: 100%;
  min-width: 0;
  font-family: var(--sf-font-sans);
  font-size: 0.8125rem;
  color: var(--sf-ink);
  background: rgba(255, 255, 255, 0.32) !important;
  border: 1px solid rgba(184, 151, 90, 0.28) !important;
  border-radius: 0 !important;
  outline: none;
  transition:
    border-color var(--sf-duration) ease,
    box-shadow var(--sf-duration) ease,
    background var(--sf-duration) ease;
}
#info-create-panel input,
#info-create-panel textarea {
  padding: 0.75rem 0.85rem;
}
#info-create-panel select {
  padding: 0.5rem 0.65rem;
  font-family: var(--sf-font-mono);
  font-size: 0.75rem;
}
#info-create-panel input:focus,
#info-create-panel textarea:focus,
#info-create-panel select:focus,
.sf-input:focus,
.sf-select:focus,
.sf-textarea:focus {
  border-color: rgba(107, 44, 62, 0.45) !important;
  box-shadow: 0 0 0 2px rgba(107, 44, 62, 0.1);
  background: rgba(255, 255, 255, 0.48) !important;
}
#info-create-panel input::placeholder,
#info-create-panel textarea::placeholder {
  color: rgba(92, 79, 66, 0.42);
}

/* ═══════════════════════════════════════════════════════════
   5. CHIPS / TABS / BADGES
   ═══════════════════════════════════════════════════════════ */
.sf-chip,
.tag,
#info-create-panel .tag {
  display: inline-flex;
  align-items: center;
  padding: 0.3rem 0.7rem;
  font-size: 0.75rem;
  font-family: var(--sf-font-sans);
  color: var(--sf-ink-muted);
  background: rgba(255, 255, 255, 0.32);
  border: 1px solid rgba(184, 151, 90, 0.2);
  border-radius: 0 !important;
  cursor: pointer;
  transition:
    border-color var(--sf-duration) ease,
    color var(--sf-duration) ease,
    background var(--sf-duration) ease;
}
.sf-chip:hover,
.tag:hover,
#info-create-panel .tag:hover {
  color: var(--sf-burgundy);
  border-color: rgba(107, 44, 62, 0.35);
  background: rgba(107, 44, 62, 0.06);
}

.sf-tab,
.input-tab,
.info-lang-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 !important;
  font-family: var(--sf-font-mono);
  transition:
    background var(--sf-duration) ease,
    color var(--sf-duration) ease,
    border-color var(--sf-duration) ease;
}
.input-tab {
  padding: 0.4rem 0.9rem;
  font-size: 0.75rem;
  font-weight: 500;
  font-family: var(--sf-font-sans);
  color: var(--sf-ink-muted);
  background: transparent;
  border: 1px solid transparent;
}
.input-tab:hover {
  background: rgba(255, 255, 255, 0.35);
  color: var(--sf-ink);
}
.input-tab.active {
  background: rgba(255, 255, 255, 0.45);
  border-color: rgba(184, 151, 90, 0.32);
  color: var(--sf-burgundy);
}
.info-lang-tab {
  padding: 0.2rem 0.5rem;
  font-size: 9px;
  font-weight: 700;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.35);
  color: var(--sf-ink-muted);
}
.info-lang-tab.active,
.info-lang-tab.bg-primary {
  background: var(--sf-burgundy) !important;
  color: var(--sf-cream) !important;
  border-color: rgba(212, 188, 132, 0.3);
}

.sf-badge,
#info-status {
  display: inline-flex;
  align-items: center;
  padding: 0.15rem 0.55rem;
  font-family: var(--sf-font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--sf-burgundy);
  background: rgba(107, 44, 62, 0.08);
  border: 1px solid rgba(107, 44, 62, 0.18);
  border-radius: 0 !important;
}

.list-badge-new {
  background: var(--sf-burgundy) !important;
  color: var(--sf-cream) !important;
  border: 1px solid rgba(212, 188, 132, 0.35);
  border-radius: 0 !important;
  font-family: var(--sf-font-mono);
  letter-spacing: 0.04em;
}

/* ═══════════════════════════════════════════════════════════
   6. PROGRESS / STAGE LIGHTS
   ═══════════════════════════════════════════════════════════ */
.gen-progress-track {
  width: 100%;
  height: 0.5rem;
  border-radius: 0 !important;
  background: rgba(42, 33, 24, 0.08);
  border: 1px solid var(--sf-gold-line-soft);
  overflow: hidden;
  box-shadow: inset 0 1px 2px rgba(42, 33, 24, 0.05);
}
.gen-progress-fill,
#p-bar {
  height: 100%;
  border-radius: 0 !important;
  background: linear-gradient(
    90deg,
    var(--sf-burgundy-deep) 0%,
    var(--sf-burgundy) 40%,
    var(--sf-gold) 100%
  ) !important;
  box-shadow: 0 0 10px rgba(184, 151, 90, 0.28);
  transition: width 0.45s ease;
}

.stage-lights {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem 0.55rem;
}
.stage-light {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.2rem;
  min-width: 2.4rem;
  user-select: none;
}
.stage-dot {
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50% !important;
  background: rgba(42, 33, 24, 0.1);
  border: 1.5px solid rgba(184, 151, 90, 0.3);
  transition:
    background 0.3s ease,
    box-shadow 0.3s ease,
    border-color 0.3s ease;
}
.stage-light .stage-label {
  font-family: var(--sf-font-mono);
  font-size: 9px;
  color: rgba(42, 33, 24, 0.4);
  letter-spacing: 0.02em;
  text-align: center;
  max-width: 3rem;
  line-height: 1.1;
}
.stage-light.active .stage-dot {
  background: var(--sf-burgundy-soft);
  border-color: var(--sf-gold-light);
  box-shadow:
    0 0 0 2px rgba(107, 44, 62, 0.18),
    0 0 10px rgba(196, 169, 106, 0.5);
  animation: sf-lamp-pulse 1.4s ease-in-out infinite;
}
.stage-light.active .stage-label {
  color: var(--sf-burgundy);
  font-weight: 700;
}
.stage-light.done .stage-dot {
  background: var(--sf-gold);
  border-color: rgba(138, 115, 72, 0.8);
  box-shadow: 0 0 4px rgba(160, 138, 85, 0.35);
}
.stage-light.done .stage-label {
  color: rgba(42, 33, 24, 0.55);
}
.stage-light.err .stage-dot {
  background: var(--sf-danger);
  border-color: #6e2424;
  box-shadow: 0 0 8px rgba(139, 46, 46, 0.4);
}
.stage-light.err .stage-label {
  color: var(--sf-danger);
  font-weight: 700;
}
@keyframes sf-lamp-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 1;
  }
  50% {
    transform: scale(1.1);
    opacity: 0.92;
  }
}

.gen-log-box {
  max-height: 11rem;
  overflow-y: auto;
  border-radius: 0 !important;
  border: 1px solid var(--sf-gold-line-soft);
  background: rgba(42, 33, 24, 0.035);
  padding: 0.5rem 0.65rem;
  font-family: var(--sf-font-mono);
  font-size: 10px;
  line-height: 1.45;
  color: rgba(42, 33, 24, 0.68);
}
.gen-log-entry {
  padding: 0.2rem 0;
  border-bottom: 1px solid rgba(42, 33, 24, 0.05);
}
.gen-log-entry:last-child {
  border-bottom: none;
}
.gen-log-entry .log-msg-row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.25rem 0.4rem;
}
.gen-log-entry .log-pct {
  color: var(--sf-burgundy);
  font-weight: 700;
  min-width: 2.2rem;
}
.gen-log-entry .log-stage {
  color: var(--sf-gold-dark, #8a7348);
  font-weight: 600;
}
.gen-log-entry .log-time {
  margin-left: auto;
  opacity: 0.45;
  font-size: 9px;
}
.gen-log-entry.success .log-pct,
.gen-log-entry.success .log-stage {
  color: #2d6a4f;
}
.gen-log-entry.warn {
  opacity: 0.9;
}
.gen-log-entry.error {
  color: var(--sf-danger, #8b2e2e);
}
.gen-log-detail {
  opacity: 0.65;
  font-size: 9px;
  margin-top: 0.2rem;
  padding-left: 0.45rem;
  border-left: 2px solid rgba(184, 151, 90, 0.25);
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 4.5rem;
  overflow: hidden;
}
.stage-light[data-stage="unified_polish"] .stage-label {
  letter-spacing: 0;
}

/* ═══════════════════════════════════════════════════════════
   7. TOAST
   ═══════════════════════════════════════════════════════════ */
.sf-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 100;
  padding: 0.75rem 1.25rem;
  font-family: var(--sf-font-serif);
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.03em;
  border-radius: 0 !important;
  border: 1px solid rgba(212, 188, 132, 0.38);
  box-shadow: 0 12px 32px rgba(42, 33, 24, 0.16);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  max-width: min(22rem, calc(100vw - 2rem));
}
.sf-toast-info {
  background: var(--sf-burgundy);
  color: var(--sf-cream);
}
.sf-toast-error {
  background: var(--sf-burgundy-deep);
  color: var(--sf-cream);
  border-color: rgba(212, 188, 132, 0.28);
}
.sf-toast-success {
  background: var(--sf-ink);
  color: var(--sf-gold-light);
}

/* ═══════════════════════════════════════════════════════════
   8. LABELS / TYPOGRAPHY HELPERS
   ═══════════════════════════════════════════════════════════ */
.sf-label,
.label-caps {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: var(--sf-tracking-label);
  text-transform: uppercase;
  color: rgba(107, 44, 62, 0.55);
  font-family: var(--sf-font-serif);
}

.sf-title {
  font-family: var(--sf-font-serif);
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--sf-ink);
}

/* ═══════════════════════════════════════════════════════════
   9. SCROLLBAR
   ═══════════════════════════════════════════════════════════ */
::-webkit-scrollbar {
  width: 5px;
  height: 5px;
}
::-webkit-scrollbar-track {
  background: rgba(42, 33, 24, 0.03);
}
::-webkit-scrollbar-thumb {
  background: rgba(184, 151, 90, 0.35);
  border-radius: 0;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(107, 44, 62, 0.35);
}
.no-scrollbar {
  scrollbar-width: thin;
  scrollbar-color: rgba(184, 151, 90, 0.35) transparent;
}

/* ═══════════════════════════════════════════════════════════
   10. FILE DROP / MISC
   ═══════════════════════════════════════════════════════════ */
.file-drop-zone {
  border: 1px dashed rgba(184, 151, 90, 0.4) !important;
  background: rgba(255, 255, 255, 0.18) !important;
  border-radius: 0 !important;
  transition:
    border-color var(--sf-duration) ease,
    background var(--sf-duration) ease;
}
.file-drop-zone:hover {
  border-color: rgba(107, 44, 62, 0.45) !important;
  background: rgba(107, 44, 62, 0.04) !important;
}

/* Waveform bars stay square */
.waveform-bar {
  border-radius: 0 !important;
  background: linear-gradient(to top, var(--sf-burgundy), var(--sf-gold-light));
}

/* Player progress + transport chips */
.sf-play-progress-fill {
  background: linear-gradient(
    90deg,
    var(--sf-burgundy) 0%,
    var(--sf-gold) 100%
  ) !important;
  border-radius: 0 !important;
}
.sf-play-progress-knob {
  width: 0.55rem;
  height: 0.55rem;
  background: var(--sf-cream);
  border: 1px solid rgba(184, 151, 90, 0.45);
  box-shadow: 0 1px 3px rgba(42, 33, 24, 0.18);
  border-radius: 50% !important;
}
#progress-bar-track {
  border-radius: 0 !important;
  background: rgba(42, 33, 24, 0.1) !important;
}
#replay-btn,
#forward-btn {
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--sf-ink-muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 0 !important;
  transition:
    background var(--sf-duration) ease,
    color var(--sf-duration) ease,
    border-color var(--sf-duration) ease;
}
#replay-btn:hover:not(:disabled),
#forward-btn:hover:not(:disabled) {
  color: var(--sf-burgundy);
  background: rgba(255, 255, 255, 0.4);
  border-color: var(--sf-gold-line-soft);
}
#replay-btn:disabled,
#forward-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
#spd-btn {
  font-family: var(--sf-font-mono);
  border: 1px solid var(--sf-gold-line-soft);
  background: rgba(255, 255, 255, 0.28);
  color: var(--sf-ink-muted);
  border-radius: 0 !important;
  transition:
    background var(--sf-duration) ease,
    border-color var(--sf-duration) ease,
    color var(--sf-duration) ease;
}
#spd-btn:hover {
  color: var(--sf-burgundy);
  border-color: rgba(107, 44, 62, 0.28);
  background: rgba(255, 255, 255, 0.45);
}
.spd-option {
  font-family: var(--sf-font-mono);
  color: var(--sf-ink-muted);
}
.spd-option:hover {
  background: rgba(107, 44, 62, 0.08) !important;
  color: var(--sf-burgundy);
}

/* Panel section labels */
#info-create-panel label,
#info-generating-panel label {
  font-family: var(--sf-font-mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 10px;
  color: rgba(92, 79, 66, 0.55);
}

/* Script area in generate panel */
#script-area {
  border-radius: 0 !important;
  border-color: var(--sf-gold-line-soft) !important;
  background: rgba(42, 33, 24, 0.035) !important;
}

@media (prefers-reduced-motion: reduce) {
  .stage-light.active .stage-dot {
    animation: none;
  }
  .sf-btn,
  .crate-btn,
  .neo-button {
    transition: none;
  }
}
