/* ==========================================================================
   SPINGU MUSIC - Studio Web Application Stylesheet
   Design Language: Dark Cyber Studio, Glassmorphism, Neon Music Accents
   ========================================================================== */

:root {
  /* Color Palette - HSL Tailored Studio Dark */
  --bg-darkest: #07080c;
  --bg-dark: #0d0f15;
  --bg-surface: #141822;
  --bg-surface-elevated: #1a202e;
  --bg-card: rgba(22, 27, 39, 0.75);
  --bg-card-hover: rgba(30, 37, 53, 0.85);
  
  /* Borders & Dividers */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-card: rgba(255, 255, 255, 0.12);
  --border-focus: rgba(168, 85, 247, 0.6);
  --border-glow: rgba(168, 85, 247, 0.35);

  /* Primary Brand Neon Colors (Electric Violet & Hot Fuchsia) */
  --accent-purple: #9333ea;
  --accent-purple-light: #a855f7;
  --accent-pink: #ec4899;
  --accent-gradient: linear-gradient(135deg, #9333ea 0%, #ec4899 100%);
  --accent-gradient-hover: linear-gradient(135deg, #a855f7 0%, #f472b6 100%);
  --accent-glow: 0 0 25px rgba(168, 85, 247, 0.4);

  /* Status Colors */
  --status-connected: #10b981;
  --status-connected-glow: 0 0 12px rgba(16, 185, 129, 0.6);
  --status-connecting: #f59e0b;
  --status-disconnected: #ef4444;
  --status-disconnected-glow: 0 0 12px rgba(239, 68, 68, 0.6);

  /* Typography */
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --font-heading: 'Outfit', -apple-system, sans-serif;
  --font-body: 'Plus Jakarta Sans', -apple-system, sans-serif;

  /* Shadows & Glass */
  --glass-backdrop: blur(16px);
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 8px 24px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, 0.6);
  --shadow-glow: 0 0 30px rgba(147, 51, 234, 0.25);
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;
}

/* Reset & Base Setup */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background-color: var(--bg-darkest);
  color: var(--text-main);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  background-image: 
    radial-gradient(circle at 15% 10%, rgba(147, 51, 234, 0.08) 0%, transparent 45%),
    radial-gradient(circle at 85% 80%, rgba(236, 72, 153, 0.06) 0%, transparent 45%);
  background-attachment: fixed;
}

/* ==========================================================================
   Top Navigation Header
   ========================================================================== */
.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 28px;
  background: rgba(13, 15, 21, 0.85);
  backdrop-filter: var(--glass-backdrop);
  -webkit-backdrop-filter: var(--glass-backdrop);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-left {
  display: flex;
  align-items: center;
  gap: 16px;
}

.logo-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-icon-pulse {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: var(--shadow-glow);
  animation: pulse-glow 3s infinite ease-in-out;
}

@keyframes pulse-glow {
  0%, 100% { transform: scale(1); box-shadow: 0 0 15px rgba(147, 51, 234, 0.4); }
  50% { transform: scale(1.04); box-shadow: 0 0 25px rgba(236, 72, 153, 0.6); }
}

.brand-text {
  display: flex;
  flex-direction: column;
}

.brand-title {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.5px;
  color: #ffffff;
  line-height: 1.1;
}

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

.brand-sub {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 600;
  letter-spacing: 0.8px;
}

.genre-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(147, 51, 234, 0.12);
  border: 1px solid rgba(147, 51, 234, 0.3);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-purple-light);
}

.nav-landing-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  color: #cbd5e1;
  text-decoration: none;
  transition: all 0.2s ease;
}

.nav-landing-link:hover {
  background: rgba(147, 51, 234, 0.2);
  border-color: var(--accent-purple-light);
  color: #ffffff;
  transform: translateY(-1px);
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* License Status Pill Button */
.license-badge-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
  color: #fbbf24;
  border-radius: var(--radius-lg);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.license-badge-btn:hover {
  background: rgba(245, 158, 11, 0.25);
  border-color: #f59e0b;
  transform: translateY(-1px);
}

.license-badge-btn.active-vip {
  background: rgba(147, 51, 234, 0.2);
  border-color: var(--accent-purple);
  color: #c084fc;
  box-shadow: 0 0 12px rgba(147, 51, 234, 0.3);
}

/* Live Bridge Status Card */
.bridge-status-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  transition: all 0.2s ease;
}

.bridge-status-card:hover {
  border-color: var(--border-card);
}

.status-indicator-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background-color: var(--status-connecting);
  box-shadow: 0 0 8px var(--status-connecting);
  transition: all 0.3s ease;
}

.status-indicator-dot.connected {
  background-color: var(--status-connected);
  box-shadow: var(--status-connected-glow);
}

.status-indicator-dot.disconnected {
  background-color: var(--status-disconnected);
  box-shadow: var(--status-disconnected-glow);
}

.bridge-info-text {
  display: flex;
  flex-direction: column;
}

.bridge-label {
  font-size: 12px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.2;
}

.bridge-backend-meta {
  font-size: 10px;
  color: var(--text-muted);
}

.btn-bridge-manage {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-bridge-manage:hover {
  background: rgba(147, 51, 234, 0.2);
  border-color: var(--accent-purple);
  color: #ffffff;
}

.btn-colab-launch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  background: #1e293b;
  border: 1px solid #334155;
  color: #f1f5f9;
  border-radius: var(--radius-lg);
  font-size: 13px;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-colab-launch:hover {
  background: #334155;
  border-color: #64748b;
  transform: translateY(-1px);
}

/* ==========================================================================
   Notification Bar
   ========================================================================== */
.notification-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 24px;
  background: linear-gradient(90deg, rgba(147, 51, 234, 0.2) 0%, rgba(236, 72, 153, 0.2) 100%);
  border-bottom: 1px solid rgba(147, 51, 234, 0.3);
  font-size: 13px;
  font-weight: 600;
}

.notification-content {
  display: flex;
  align-items: center;
  gap: 10px;
}

.btn-close-notification {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 18px;
  cursor: pointer;
}

/* ==========================================================================
   Main Layout & Navigation Tabs
   ========================================================================== */
.main-container {
  max-width: 1440px;
  margin: 0 auto;
  padding: 24px 28px;
}

.studio-tabs {
  display: flex;
  gap: 8px;
  background: var(--bg-surface);
  padding: 6px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.tab-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: var(--radius-md);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.tab-btn:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.05);
}

.tab-btn.active {
  background: var(--accent-gradient);
  color: #ffffff;
  box-shadow: 0 4px 16px rgba(147, 51, 234, 0.35);
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.25s ease forwards;
}

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

/* Studio Workspace Grid */
.studio-grid {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 1080px) {
  .studio-grid {
    grid-template-columns: 1fr;
  }
}

/* Panel Cards */
.panel-card {
  background: var(--bg-card);
  backdrop-filter: var(--glass-backdrop);
  -webkit-backdrop-filter: var(--glass-backdrop);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 24px;
  box-shadow: var(--shadow-md);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 4px;
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 800;
  color: #ffffff;
  line-height: 1.2;
}

.panel-subtitle {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ==========================================================================
   Form Controls, Inputs, Presets
   ========================================================================== */
.control-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.control-row {
  display: flex;
  gap: 14px;
}

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

.label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.field-label {
  font-size: 13px;
  font-weight: 700;
  color: #e2e8f0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.label-hint {
  font-size: 11px;
  color: var(--text-dim);
  font-weight: 500;
}

.btn-text-action {
  background: none;
  border: none;
  color: var(--accent-purple-light);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  transition: opacity 0.2s;
}

.btn-text-action:hover {
  opacity: 0.8;
  text-decoration: underline;
}

/* Preset Pills Grid */
.preset-pill-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.preset-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  cursor: pointer;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  transition: all 0.2s ease;
}

.preset-pill:hover {
  background: var(--bg-surface-elevated);
  border-color: rgba(147, 51, 234, 0.4);
  transform: translateY(-1px);
}

.preset-pill.active {
  background: rgba(147, 51, 234, 0.15);
  border-color: var(--accent-purple);
  color: #ffffff;
  box-shadow: 0 0 16px rgba(147, 51, 234, 0.25);
}

.pill-icon {
  font-size: 16px;
}

/* Inputs & Textareas */
.custom-input,
.custom-select,
.custom-textarea {
  width: 100%;
  background: var(--bg-dark);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: #ffffff;
  font-family: var(--font-body);
  font-size: 14px;
  transition: border-color 0.2s, box-shadow 0.2s;
  outline: none;
}

.custom-textarea {
  resize: vertical;
  line-height: 1.6;
}

.lyrics-area {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 13px;
  line-height: 1.7;
  background: #090b10;
}

.custom-input:focus,
.custom-select:focus,
.custom-textarea:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px var(--border-glow);
}

/* Custom Checkbox */
.flex-center-checkbox {
  display: flex;
  align-items: center;
  margin-top: 24px;
}

.custom-checkbox-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  user-select: none;
}

.custom-checkbox {
  position: absolute;
  opacity: 0;
  cursor: pointer;
}

.checkbox-box {
  width: 20px;
  height: 20px;
  border-radius: 6px;
  border: 1.5px solid var(--border-subtle);
  background: var(--bg-dark);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.custom-checkbox:checked + .checkbox-box {
  background: var(--accent-gradient);
  border-color: var(--accent-purple);
}

.custom-checkbox:checked + .checkbox-box::after {
  content: "✓";
  color: #ffffff;
  font-size: 13px;
  font-weight: 800;
}

.checkbox-text {
  font-size: 13px;
  font-weight: 600;
  color: #cbd5e1;
}

/* Range Sliders & Quick Duration Chips */
.slider-label-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}

.quick-dur-container {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.btn-quick-dur {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.btn-quick-dur:hover {
  background: rgba(147, 51, 234, 0.2);
  border-color: var(--accent-purple);
  color: #ffffff;
  transform: translateY(-1px);
}

.btn-quick-dur.active {
  background: linear-gradient(135deg, rgba(147, 51, 234, 0.4) 0%, rgba(236, 72, 153, 0.4) 100%);
  border-color: var(--accent-purple-light);
  color: #ffffff;
  box-shadow: 0 0 10px rgba(147, 51, 234, 0.3);
}

.slider-value-badge {
  font-size: 12px;
  font-weight: 700;
  padding: 3px 8px;
  background: rgba(147, 51, 234, 0.15);
  border: 1px solid rgba(147, 51, 234, 0.3);
  color: var(--accent-purple-light);
  border-radius: var(--radius-sm);
}

.custom-range {
  -webkit-appearance: none;
  width: 100%;
  height: 6px;
  background: var(--bg-surface-elevated);
  border-radius: 4px;
  outline: none;
  margin: 10px 0;
}

.custom-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--accent-purple-light);
  cursor: pointer;
  box-shadow: 0 0 10px var(--accent-purple);
  transition: transform 0.15s ease;
}

.custom-range::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Advanced Accordion */
.advanced-accordion {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  background: var(--bg-surface);
  overflow: hidden;
}

.accordion-header {
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  user-select: none;
  list-style: none;
}

.accordion-header::-webkit-details-marker {
  display: none;
}

.accordion-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-main);
}

.accordion-arrow {
  font-size: 11px;
  color: var(--text-dim);
  transition: transform 0.2s ease;
}

.advanced-accordion[open] .accordion-arrow {
  transform: rotate(180deg);
}

.accordion-body {
  padding: 16px;
  background: var(--bg-dark);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* Primary Action Buttons */
.action-btn-wrapper {
  margin-top: 8px;
}

.btn-generate-main {
  width: 100%;
  padding: 16px 24px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-lg);
  color: #ffffff;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  box-shadow: 0 6px 24px rgba(147, 51, 234, 0.4);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.btn-generate-main:hover:not(:disabled) {
  background: var(--accent-gradient-hover);
  transform: translateY(-2px);
  box-shadow: 0 10px 32px rgba(147, 51, 234, 0.6);
}

.btn-generate-main:active:not(:disabled) {
  transform: translateY(0);
}

.btn-generate-main:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  filter: grayscale(0.4);
}

.btn-main-text {
  font-family: var(--font-heading);
  font-size: 17px;
  font-weight: 800;
  letter-spacing: 0.5px;
}

.btn-sub-text {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.8);
  font-weight: 500;
}

/* ==========================================================================
   Right Panel: Stage, Waveform & Master Audio Player
   ========================================================================== */
.studio-stage {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.stage-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.stage-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
}

.status-pulse-circle {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--status-connected);
  box-shadow: var(--status-connected-glow);
}

.stage-timer {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-pink);
  background: rgba(236, 72, 153, 0.15);
  padding: 4px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(236, 72, 153, 0.3);
}

/* Master Player Card */
.master-player-card {
  background: linear-gradient(180deg, #161b27 0%, #11141e 100%);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  padding: 20px;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.player-top-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.track-meta {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.track-tag-badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent-purple-light);
  background: rgba(147, 51, 234, 0.15);
  padding: 3px 8px;
  border-radius: 4px;
}

.track-title-text {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
}

.track-params-text {
  font-size: 12px;
  color: var(--text-dim);
}

.player-actions-row {
  display: flex;
  gap: 8px;
}

.icon-btn {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-btn:hover:not(:disabled) {
  background: var(--bg-surface-elevated);
  color: #ffffff;
  border-color: var(--border-card);
}

.icon-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Waveform Canvas */
.waveform-container {
  position: relative;
  width: 100%;
  height: 145px;
  background: #08090d;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
}

#waveform-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.waveform-seek-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ec4899;
  box-shadow: 0 0 8px #ec4899;
  pointer-events: none;
  left: 0%;
  transition: left 0.05s linear;
}

/* ==========================================================================
   Real-Time AI Multi-Phase Progress Overlay & Watchdog HUD
   ========================================================================== */
.waveform-loader-overlay {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(8, 10, 16, 0.92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 14px 22px;
  z-index: 15;
}

.loader-content-box {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.loader-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
}

.loader-phase-pill {
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--accent-pink);
  background: rgba(236, 72, 153, 0.15);
  border: 1px solid rgba(236, 72, 153, 0.35);
  padding: 3px 10px;
  border-radius: 20px;
  box-shadow: 0 0 10px rgba(236, 72, 153, 0.2);
}

.loader-timer-pill {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.3);
  padding: 3px 9px;
  border-radius: 20px;
}

.loader-center-group {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
}

.loader-anim-circle {
  position: relative;
  width: 44px;
  height: 44px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.spinner-ring {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 3px solid rgba(168, 85, 247, 0.2);
  border-top-color: var(--accent-purple-light);
  border-right-color: var(--accent-pink);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loader-percent-badge {
  font-family: var(--font-heading);
  font-size: 12px;
  font-weight: 800;
  color: #ffffff;
  z-index: 2;
}

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

.loader-text-group {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.loader-stage-heading {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.loader-sub-detail {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Progress Track & Animated Glow Fill */
.loader-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.loader-progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #9333ea, #ec4899, #f43f5e);
  border-radius: 4px;
  box-shadow: 0 0 14px rgba(236, 72, 153, 0.7);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Watchdog: Slow / Stuck Warning Box */
.loader-slow-warning {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.35);
  border-radius: 8px;
  padding: 5px 12px;
  gap: 10px;
  animation: fadeInSlow 0.3s ease;
}

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

.slow-warning-left {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}

.slow-warning-icon {
  font-size: 13px;
  flex-shrink: 0;
}

.slow-warning-text {
  font-size: 11px;
  font-weight: 600;
  color: #fbbf24;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-cancel-gen {
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(239, 68, 68, 0.45);
  color: #f87171;
  border-radius: 6px;
  padding: 3px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-cancel-gen:hover {
  background: rgba(239, 68, 68, 0.35);
  color: #ffffff;
  border-color: #ef4444;
}

/* Player Timeline */
.player-timeline {
  display: flex;
  align-items: center;
  gap: 12px;
}

.time-current, .time-total {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 36px;
}

.timeline-bar-bg {
  flex: 1;
  height: 6px;
  background: var(--bg-surface-elevated);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.timeline-bar-fill {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  border-radius: 3px;
}

/* Player Bottom Controls */
.player-controls-bottom {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.controls-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.btn-player-play-large {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent-gradient);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 18px rgba(147, 51, 234, 0.5);
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.btn-player-play-large:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(236, 72, 153, 0.6);
}

.btn-player-step {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
}

.btn-player-step:hover {
  background: var(--bg-surface-elevated);
  color: #ffffff;
}

.volume-control-group {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
}

.volume-slider {
  width: 80px;
  height: 4px;
  background: var(--bg-surface-elevated);
  border-radius: 2px;
  -webkit-appearance: none;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ffffff;
  cursor: pointer;
}

/* Multi-track Deck */
.track-deck-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.deck-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 700;
  color: #cbd5e1;
}

.track-cards-grid {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.track-card-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: all 0.2s ease;
}

.track-card-item:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--border-card);
  transform: translateX(4px);
}

.track-card-item.active-playing {
  border-color: var(--accent-purple);
  background: rgba(147, 51, 234, 0.1);
}

.track-card-left {
  display: flex;
  align-items: center;
  gap: 12px;
}

.track-card-play-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent-gradient);
  border: none;
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: transform 0.15s;
}

.track-card-play-btn:hover {
  transform: scale(1.1);
}

.track-card-meta {
  display: flex;
  flex-direction: column;
}

.track-card-name {
  font-weight: 700;
  font-size: 14px;
  color: #ffffff;
}

.track-card-sub {
  font-size: 11px;
  color: var(--text-dim);
}

.track-card-download-btn {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.track-card-download-btn:hover {
  background: var(--bg-dark);
  color: #ffffff;
  border-color: var(--border-card);
}

/* Empty State */
.empty-deck-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 36px 20px;
  text-align: center;
  background: rgba(13, 15, 21, 0.5);
  border: 1px dashed var(--border-subtle);
  border-radius: var(--radius-lg);
}

.empty-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.empty-text-title {
  font-size: 14px;
  font-weight: 700;
  color: #cbd5e1;
}

.empty-text-sub {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
  max-width: 320px;
}

/* Colab Info Box */
.colab-info-box {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(147, 51, 234, 0.08);
  border: 1px solid rgba(147, 51, 234, 0.25);
  border-radius: var(--radius-md);
  font-size: 12px;
  line-height: 1.5;
  color: #cbd5e1;
}

.info-box-icon {
  font-size: 18px;
  color: var(--accent-purple-light);
}

/* ==========================================================================
   Tab 2: Remix Dropzone
   ========================================================================== */
.upload-dropzone {
  border: 2px dashed rgba(147, 51, 234, 0.35);
  border-radius: var(--radius-lg);
  background: rgba(13, 15, 21, 0.6);
  padding: 32px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
}

.upload-dropzone:hover {
  border-color: var(--accent-purple-light);
  background: rgba(147, 51, 234, 0.05);
}

.file-hidden-input {
  display: none;
}

.dropzone-icon {
  font-size: 36px;
  margin-bottom: 10px;
}

.dropzone-title {
  font-size: 15px;
  font-weight: 700;
  color: #ffffff;
}

.dropzone-hint {
  font-size: 12px;
  color: var(--text-dim);
  margin-top: 4px;
}

.selected-file-badge {
  display: inline-block;
  margin-top: 10px;
  padding: 4px 12px;
  background: rgba(16, 185, 129, 0.2);
  border: 1px solid var(--status-connected);
  color: var(--status-connected);
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 12px;
}

.upload-dropzone.drag-over {
  border-color: var(--accent-purple);
  background: rgba(147, 51, 234, 0.15);
  transform: scale(1.01);
}

.remix-source-player {
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.4));
}

.remix-preset-chip {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  padding: 5px 11px;
  border-radius: 20px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.remix-preset-chip:hover {
  background: rgba(147, 51, 234, 0.2);
  border-color: var(--accent-purple);
  color: #ffffff;
  transform: translateY(-1px);
}

/* Remix Processing State Card */
.remix-processing-card {
  background: var(--bg-surface);
  border: 1px solid rgba(147, 51, 234, 0.3);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(147, 51, 234, 0.15);
  animation: pulseCard 2.5s infinite ease-in-out;
}

@keyframes pulseCard {
  0%, 100% { border-color: rgba(147, 51, 234, 0.3); }
  50% { border-color: rgba(147, 51, 234, 0.7); }
}

.remix-processing-anim {
  display: flex;
  justify-content: center;
  align-items: flex-end;
  gap: 6px;
  height: 48px;
  margin-bottom: 16px;
}

.remix-processing-anim .vu-bar {
  width: 6px;
  background: var(--accent-gradient);
  border-radius: 3px;
  animation: vuJump 1.2s infinite ease-in-out;
}

.remix-processing-anim .vu-bar:nth-child(1) { height: 18px; animation-delay: 0.1s; }
.remix-processing-anim .vu-bar:nth-child(2) { height: 36px; animation-delay: 0.25s; }
.remix-processing-anim .vu-bar:nth-child(3) { height: 48px; animation-delay: 0.4s; }
.remix-processing-anim .vu-bar:nth-child(4) { height: 32px; animation-delay: 0.15s; }
.remix-processing-anim .vu-bar:nth-child(5) { height: 22px; animation-delay: 0.3s; }

@keyframes vuJump {
  0%, 100% { transform: scaleY(0.4); opacity: 0.7; }
  50% { transform: scaleY(1.0); opacity: 1; filter: brightness(1.3); }
}

.remix-processing-title {
  font-size: 16px;
  font-weight: 700;
  color: #ffffff;
  margin-bottom: 6px;
}

.remix-processing-sub {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 18px;
}

.remix-progress-bar-bg {
  width: 100%;
  max-width: 380px;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  margin: 0 auto 16px auto;
  overflow: hidden;
}

.remix-progress-bar-fill {
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 4px;
  transition: width 0.4s ease;
}

.remix-meta-badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  color: #a78bfa;
  background: rgba(147, 51, 234, 0.12);
  border: 1px solid rgba(147, 51, 234, 0.3);
  padding: 4px 12px;
  border-radius: 12px;
}

/* Remix Error Card */
.remix-error-card {
  background: rgba(239, 68, 68, 0.08);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-lg);
  padding: 24px;
  text-align: center;
}

.remix-error-card .error-icon {
  font-size: 32px;
  margin-bottom: 8px;
}

.remix-error-card .error-title {
  font-size: 16px;
  font-weight: 700;
  color: #f87171;
  margin-bottom: 6px;
}

.remix-error-card .error-msg {
  font-size: 13px;
  color: var(--text-dim);
  margin-bottom: 16px;
  line-height: 1.4;
}

.remix-error-card .error-actions {
  display: flex;
  justify-content: center;
  gap: 10px;
}

.remix-card-item {
  border-left: 3px solid var(--accent-purple);
}

.spin-anim {
  display: inline-block;
  animation: rotateSpin 1s infinite linear;
}

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

.loading-pulse {
  opacity: 0.85;
  cursor: wait !important;
}

/* ==========================================================================
   Tab 3: Prompt Assistant Output
   ========================================================================== */
.btn-copy-prompt {
  background: var(--accent-gradient);
  border: none;
  color: #ffffff;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-copy-prompt:hover {
  opacity: 0.9;
}

.prompt-result-area {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 12px;
  line-height: 1.6;
}

/* Google Gemini Free Tier Card in Tab 3 */
.gemini-key-card {
  background: linear-gradient(135deg, rgba(37, 99, 235, 0.1) 0%, rgba(147, 51, 234, 0.12) 50%, rgba(236, 72, 153, 0.08) 100%);
  border: 1px solid rgba(147, 51, 234, 0.35);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.gemini-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.gemini-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 700;
  color: #60a5fa;
  background: rgba(37, 99, 235, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.3);
  padding: 3px 10px;
  border-radius: var(--radius-sm);
}

.btn-get-gemini-key {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(90deg, #2563eb 0%, #7c3aed 100%);
  border: none;
  border-radius: var(--radius-sm);
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3);
}

.btn-get-gemini-key:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37, 99, 235, 0.5);
  color: #ffffff;
}

.gemini-input-row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.gemini-input-row .custom-input {
  flex: 1;
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 12px;
  padding: 8px 12px;
}

.btn-icon-key {
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-md);
  padding: 8px 11px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-icon-key:hover {
  color: #ffffff;
  border-color: var(--accent-purple);
}

.btn-save-key {
  background: rgba(147, 51, 234, 0.25);
  border: 1px solid var(--accent-purple);
  color: #ffffff;
  border-radius: var(--radius-md);
  padding: 8px 16px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  white-space: nowrap;
}

.btn-save-key:hover {
  background: var(--accent-purple);
}

.gemini-model-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: var(--radius-md);
  padding: 8px 12px;
}

.gemini-model-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.gemini-model-label {
  font-size: 11px;
  font-weight: 700;
  color: #94a3b8;
}

.gemini-model-select {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(56, 189, 248, 0.4);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
  transition: all 0.2s;
}

.gemini-model-select:hover, .gemini-model-select:focus {
  border-color: #60a5fa;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}


.gemini-model-badge {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 11px;
  font-weight: 700;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.35);
  padding: 2px 8px;
  border-radius: 4px;
}

.btn-refresh-models {
  background: rgba(37, 99, 235, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #93c5fd;
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
}

.btn-refresh-models:hover {
  background: rgba(37, 99, 235, 0.4);
  color: #ffffff;
  border-color: #60a5fa;
  transform: translateY(-1px);
}


.gemini-key-hint {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-size: 11px;
  color: var(--text-dim);
}

.status-indicator-tag {
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
}

.status-indicator-tag.status-active {
  background: rgba(16, 185, 129, 0.2);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.4);
}

.status-indicator-tag.status-offline {
  background: rgba(148, 163, 184, 0.1);
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.2);
}

/* Quick Ideas Row */
.quick-ideas-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.idea-chip {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.idea-chip:hover {
  background: rgba(147, 51, 234, 0.2);
  border-color: var(--accent-purple);
  color: #ffffff;
  transform: translateY(-1px);
}

/* ==========================================================================
   Tab 4: Keygen & License Management Styling
   ========================================================================== */
.generated-key-box {
  background: rgba(147, 51, 234, 0.12);
  border: 1.5px solid var(--accent-purple);
  border-radius: var(--radius-md);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  animation: fadeIn 0.3s ease;
}

.key-box-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.key-box-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}

.key-tier-badge {
  font-size: 11px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 4px;
  background: var(--accent-gradient);
  color: #ffffff;
}

.key-display-row {
  display: flex;
  gap: 8px;
}

.key-output-text {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #a855f7;
  background: #090b10;
  border-color: rgba(168, 85, 247, 0.4);
}

.btn-copy-key {
  padding: 0 16px;
  background: var(--accent-purple);
  border: none;
  border-radius: var(--radius-md);
  color: #ffffff;
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  transition: opacity 0.2s;
}

.btn-copy-key:hover {
  opacity: 0.9;
}

.key-box-meta {
  font-size: 11px;
  color: var(--text-dim);
}

.current-license-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.license-status-icon {
  font-size: 32px;
}

.license-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.license-card-title {
  font-size: 15px;
  font-weight: 800;
  color: #ffffff;
}

.license-card-key {
  font-family: 'SF Mono', Consolas, monospace;
  font-size: 13px;
  color: var(--accent-purple-light);
  word-break: break-all;
}

.license-card-meta {
  font-size: 12px;
  color: var(--text-dim);
}

.key-activate-input {
  font-family: 'SF Mono', Consolas, monospace;
  letter-spacing: 1px;
}

/* ==========================================================================
   Tab 5: History Shelf
   ========================================================================== */
.btn-clear-history {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-dim);
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-clear-history:hover {
  border-color: var(--status-disconnected);
  color: var(--status-disconnected);
}

.history-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ==========================================================================
   Modal Dialog (Bridge Settings)
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: var(--glass-backdrop);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}

.modal-card {
  width: 100%;
  max-width: 540px;
  background: var(--bg-dark);
  border: 1px solid var(--border-card);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: modalPop 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalPop {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 800;
  color: #ffffff;
}

.modal-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  line-height: 1;
}

.modal-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.modal-status-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.status-badge-circle {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--status-connecting);
}

.status-badge-title {
  font-size: 13px;
  font-weight: 700;
  color: #ffffff;
}

.status-badge-desc {
  font-size: 11px;
  color: var(--text-muted);
}

.guide-steps-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 16px;
  background: rgba(147, 51, 234, 0.08);
  border: 1px solid rgba(147, 51, 234, 0.25);
  border-radius: var(--radius-md);
}

.guide-step-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 12px;
  color: #cbd5e1;
}

.step-number {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-purple);
  color: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 800;
  flex-shrink: 0;
}

.guide-step-item a {
  color: var(--accent-purple-light);
  text-decoration: underline;
}

.modal-form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.input-hint {
  font-size: 11px;
  color: var(--text-dim);
}

.modal-footer {
  padding: 16px 24px;
  background: var(--bg-surface);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-modal-test {
  padding: 10px 18px;
  background: transparent;
  border: 1px solid var(--border-card);
  color: var(--text-main);
  border-radius: var(--radius-md);
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}

.btn-modal-test:hover {
  background: rgba(255, 255, 255, 0.05);
}

.btn-modal-save {
  padding: 10px 20px;
  background: var(--accent-gradient);
  border: none;
  color: #ffffff;
  border-radius: var(--radius-md);
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 14px rgba(147, 51, 234, 0.4);
  transition: all 0.2s;
}

.btn-modal-save:hover {
  box-shadow: 0 6px 20px rgba(147, 51, 234, 0.6);
}

/* ==========================================================================
   Error & Diagnostic Troubleshooting Modal
   ========================================================================== */
.diagnostic-modal-card {
  max-width: 600px;
  border: 1px solid rgba(244, 63, 94, 0.4);
  box-shadow: 0 0 40px rgba(244, 63, 94, 0.2);
}

.diagnostic-error-banner {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: rgba(239, 68, 68, 0.12);
  border: 1px solid rgba(239, 68, 68, 0.35);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 18px;
}

.diag-err-icon {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 2px;
}

.diag-err-content {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.diag-err-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 800;
  color: #f87171;
}

.diag-err-desc {
  font-size: 12px;
  color: #cbd5e1;
  line-height: 1.5;
  word-break: break-word;
}

.diag-section-title {
  font-family: var(--font-heading);
  font-size: 14px;
  font-weight: 800;
  color: #ffffff;
  margin-bottom: 12px;
}

.diag-steps-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.diag-step-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  transition: border-color 0.2s;
}

.diag-step-card:hover {
  border-color: rgba(255, 255, 255, 0.2);
}

.diag-step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(244, 63, 94, 0.2);
  border: 1px solid rgba(244, 63, 94, 0.5);
  color: #f43f5e;
  font-size: 12px;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.diag-step-body {
  font-size: 12px;
  color: #94a3b8;
  line-height: 1.5;
}

.diag-step-body strong {
  color: #f1f5f9;
  display: block;
  margin-bottom: 2px;
}

/* ==========================================================================
   Footer
   ========================================================================== */
.app-footer {
  margin-top: 40px;
  padding: 24px 28px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  font-size: 13px;
  color: var(--text-dim);
}

.footer-content {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.footer-content a {
  color: var(--accent-purple-light);
  text-decoration: none;
}

.footer-divider {
  color: var(--border-subtle);
}

.footer-badge {
  background: rgba(16, 185, 129, 0.15);
  color: var(--status-connected);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

/* ==========================================================================
   Mobile-Friendly & Responsive Layout (Handphone & Tablet)
   ========================================================================== */
@media (max-width: 768px) {
  /* Header adjustments */
  .app-header {
    padding: 10px 14px;
    gap: 10px;
  }

  .header-left {
    gap: 8px;
  }

  .brand-title {
    font-size: 17px;
  }

  .brand-sub {
    font-size: 10px;
  }

  .genre-badge {
    display: none; /* Sembunyikan badge genre di header pada HP agar ringkas */
  }

  .header-right {
    gap: 6px;
  }

  .license-badge-btn {
    padding: 6px 10px;
    font-size: 11px;
  }

  .bridge-status-card {
    padding: 5px 8px;
    gap: 6px;
  }

  .bridge-backend-meta {
    display: none; /* Sembunyikan teks panjang 'Google Colab T4 GPU' pada layar HP */
  }

  .bridge-label {
    font-size: 11px;
    max-width: 110px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .btn-bridge-manage .btn-text {
    display: none; /* Tampilkan icon gear saja di HP */
  }

  .btn-colab-launch span {
    display: none; /* Tampilkan icon Colab saja di HP */
  }

  .btn-colab-launch {
    padding: 6px 10px;
  }

  /* Main Workspace & Horizontal Swipe Tabs */
  .main-container {
    padding: 12px 10px;
  }

  .studio-tabs {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    gap: 6px;
    padding: 6px;
    margin-bottom: 16px;
  }

  .studio-tabs::-webkit-scrollbar {
    display: none;
  }

  .tab-btn {
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 12px;
    white-space: nowrap;
  }

  /* Studio Grid: Stacked 1 Column on Mobile */
  .studio-grid {
    grid-template-columns: 1fr;
    gap: 16px;
  }

  .panel-card {
    padding: 16px 14px;
    border-radius: var(--radius-lg);
  }

  .panel-title {
    font-size: 19px;
  }

  .panel-subtitle {
    font-size: 12px;
  }

  /* Presets & Form Controls */
  .preset-pill-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .preset-pill {
    padding: 10px 12px;
    font-size: 12px;
  }

  .control-row {
    flex-direction: column;
    gap: 12px;
  }

  .custom-input, .custom-textarea, .custom-select {
    font-size: 14px; /* Mencegah auto-zoom Safari di iPhone */
  }

  /* Main Generate Action Button */
  .btn-generate-main {
    padding: 14px 18px;
  }

  .btn-main-text {
    font-size: 16px;
  }

  .btn-sub-text {
    font-size: 10px;
  }

  /* Stage & Master Player Card */
  .master-player-card {
    padding: 16px 12px;
    border-radius: var(--radius-lg);
    gap: 14px;
  }

  .player-top-info {
    flex-direction: column;
    gap: 10px;
  }

  .player-actions-row {
    align-self: flex-end;
  }

  .track-title-text {
    font-size: 16px;
  }

  .track-params-text {
    font-size: 11px;
  }

  /* Waveform & Real-time Progress HUD */
  .waveform-container {
    height: 135px;
  }

  .loader-content-box {
    gap: 6px;
  }

  .loader-anim-circle {
    width: 38px;
    height: 38px;
  }

  .loader-percent-badge {
    font-size: 11px;
  }

  .loader-stage-heading {
    font-size: 13px;
  }

  .loader-sub-detail {
    font-size: 10px;
  }

  .loader-slow-warning {
    flex-direction: column;
    align-items: stretch;
    gap: 6px;
    padding: 8px 10px;
  }

  .btn-cancel-gen {
    width: 100%;
    text-align: center;
    padding: 6px 0;
  }

  /* Player Bottom Controls */
  .player-controls-bottom {
    flex-direction: column;
    gap: 12px;
    align-items: stretch;
  }

  .controls-left {
    justify-content: center;
    width: 100%;
  }

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

  .volume-control-group {
    justify-content: center;
    width: 100%;
    padding-top: 6px;
    border-top: 1px solid var(--border-subtle);
  }

  .volume-slider {
    width: 140px;
  }

  /* Track Cards List */
  .track-card-item {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
    padding: 12px;
  }

  .track-card-left {
    width: 100%;
  }

  .track-card-download-btn {
    width: 100%;
    text-align: center;
    padding: 8px 0;
  }

  /* Modal Windows on Mobile */
  .modal-backdrop {
    padding: 12px;
  }

  .modal-card {
    max-height: 92vh;
    border-radius: var(--radius-lg);
  }

  .modal-header, .modal-body, .modal-footer {
    padding: 14px 16px;
  }

  .modal-footer {
    flex-direction: column;
    gap: 8px;
  }

  .btn-modal-test, .btn-modal-save {
    width: 100%;
    text-align: center;
    padding: 12px;
  }

  /* Footer on Mobile */
  .app-footer {
    padding: 20px 14px;
    margin-top: 24px;
    font-size: 11px;
  }

  /* Gemini Card Mobile */
  .gemini-card-header {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .btn-get-gemini-key {
    width: 100%;
    justify-content: center;
    padding: 8px 12px;
  }

  .gemini-input-row {
    flex-wrap: wrap;
  }

  .gemini-input-row .custom-input {
    width: 100%;
    flex: none;
  }

  .btn-save-key {
    flex: 1;
    text-align: center;
  }

  .gemini-model-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .gemini-model-select {
    width: 100%;
    max-width: 100%;
  }

  .btn-refresh-models {
    width: 100%;
    justify-content: center;
    padding: 8px 10px;
  }
}
