/* Daily Promo Co-Pilot v4 — Modern dark theme with top navigation */

:root {
  --bg-body: #121218;
  --bg-content: #1a1a24;
  --fg-text: #e0e0e0;
  --fg-accent: #61afef;
  --fg-accent2: #a78bfa;
  --fg-muted: #888888;
  --fg-success: #6abf69;
  --fg-warning: #e5c07b;
  --warning: #e5c07b;
  --warning-bg: rgba(229, 192, 123, 0.15);
  --fg-error: #e06c75;
  --bg-button: rgba(255,255,255,0.06);
  --bg-button-hover: rgba(255,255,255,0.12);
  --bg-entry: rgba(255,255,255,0.06);
  --fg-entry: #e0e0e0;
  --bg-card: rgba(255,255,255,0.04);
  --bg-card-border: rgba(255,255,255,0.06);
  --bg-help: rgba(255,255,255,0.04);
  --glass-blur: 12px;
  --radius: 10px;
  --radius-sm: 6px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

/* Utility classes */
.hidden { display: none !important; }

/* Warning/alert boxes */
.audio-warning {
  font-size: 12px;
  color: var(--warning);
  margin-top: 6px;
  padding: 8px 12px;
  background: var(--warning-bg);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--warning);
}

/* Prevent horizontal overflow on mobile */
html, body {
  max-width: 100%;
  overflow-x: hidden;
}

/* Scrollbar on right edge of viewport */
html {
  overflow-y: scroll;
  scrollbar-width: thin;
  scrollbar-color: rgba(97,175,239,0.3) transparent;
}
html::-webkit-scrollbar { width: 8px; }
html::-webkit-scrollbar-track { background: transparent; }
html::-webkit-scrollbar-thumb { background: rgba(97,175,239,0.3); border-radius: 4px; }
html::-webkit-scrollbar-thumb:hover { background: rgba(97,175,239,0.5); }

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-body);
  color: var(--fg-text);
  min-height: 100vh;
  width: 100%;
}

/* ---- Content Area ---- */
.content {
  margin-top: 0;
  padding: 24px 48px 48px;
  min-height: calc(100vh - 28px);
  transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1),
              margin-right 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ---- Panels ---- */
.panel { display: none; max-width: 1100px; }
.panel.active { display: block; }
.panel h2 {
  font-size: 24px;
  font-weight: 700;
  background: linear-gradient(90deg, var(--fg-accent), var(--fg-accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 6px;
}
.panel-desc { color: var(--fg-muted); font-size: 13px; margin-bottom: 16px; max-width: 700px; line-height: 1.5; }
.sub-heading { color: var(--fg-text); font-size: 14px; margin: 20px 0 8px; font-weight: 600; }

/* ---- Panel Info Box (collapsible tips) ---- */
/* ---- Page Guide Panels ---- */
.panel-info-box {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-left: 3px solid var(--fg-accent);
  border-radius: var(--radius-sm);
  margin-bottom: 18px;
  max-width: 780px;
  overflow: hidden;
}
.panel-info-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s;
}
.panel-info-header:hover { background: rgba(97, 175, 239, 0.06); }
.panel-info-icon { font-size: 14px; flex-shrink: 0; }
.panel-info-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--fg-accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  flex: 1;
}
.panel-info-chevron {
  font-size: 16px;
  font-weight: 700;
  color: var(--fg-accent);
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(97, 175, 239, 0.1);
  border: 1px solid rgba(97, 175, 239, 0.2);
  transition: transform 0.2s ease, background 0.2s ease;
  animation: chevron-glow 2.5s ease-in-out infinite;
  flex-shrink: 0;
}
.panel-info-header:hover .panel-info-chevron {
  background: rgba(97, 175, 239, 0.2);
  border-color: rgba(97, 175, 239, 0.35);
}
@keyframes chevron-glow {
  0%, 100% {
    box-shadow: 0 0 4px rgba(97, 175, 239, 0.15);
    filter: drop-shadow(0 0 2px rgba(97, 175, 239, 0.2));
  }
  50% {
    box-shadow: 0 0 10px rgba(97, 175, 239, 0.3);
    filter: drop-shadow(0 0 5px rgba(97, 175, 239, 0.4));
  }
}
.panel-info-box.collapsed .panel-info-chevron { transform: rotate(180deg); }
.panel-info-body {
  padding: 2px 16px 14px;
  max-height: 3000px;
  opacity: 1;
  overflow-y: auto;
  transition: max-height 0.4s ease, opacity 0.25s ease, padding 0.25s ease;
}
.panel-info-box.collapsed .panel-info-body {
  max-height: 0;
  opacity: 0;
  padding-top: 0;
  padding-bottom: 0;
  overflow: hidden;
}

/* Overview text */
.panel-info-overview {
  font-size: 12.5px;
  color: var(--fg-muted);
  line-height: 1.65;
  margin: 0 0 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

/* Sections within the guide */
.panel-info-section {
  margin-bottom: 14px;
}
.panel-info-section:last-child { margin-bottom: 0; }
.panel-info-section-title {
  font-size: 10.5px;
  font-weight: 700;
  color: rgba(255,255,255,0.55);
  text-transform: uppercase;
  letter-spacing: 1.2px;
  margin: 0 0 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
}

/* Badge grid */
.panel-info-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Individual guide item */
.panel-info-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 6px 0;
}
.panel-info-item .panel-info-desc {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.6;
  margin: 0;
  flex: 1;
}
.panel-info-item .panel-info-desc strong {
  color: rgba(255,255,255,0.8);
}

/* ---- Important Notice (warning-themed override of panel-info-box) ---- */
.panel-notice-warn {
  border-color: rgba(229, 192, 123, 0.25);
  border-left-color: #e5c07b;
  margin-bottom: 14px;
}
.panel-notice-warn .panel-info-header:hover { background: rgba(229, 192, 123, 0.06); }
.panel-notice-title-warn { color: #e5c07b; }
.panel-notice-chevron-warn {
  color: #e5c07b;
  background: rgba(229, 192, 123, 0.1);
  border-color: rgba(229, 192, 123, 0.2);
  animation: none;
}
.panel-notice-warn .panel-info-header:hover .panel-notice-chevron-warn {
  background: rgba(229, 192, 123, 0.2);
  border-color: rgba(229, 192, 123, 0.35);
}
.panel-notice-text {
  font-size: 13px;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.75);
  margin: 0;
}
.panel-notice-list {
  margin: 6px 0 0;
  padding-left: 18px;
  font-size: 13px;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.7);
}
.panel-notice-list li { margin-bottom: 2px; }

/* View DNA Panel button (glows when DNA is ready) */
.btn-view-dna {
  margin-top: 8px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.btn-view-dna.dna-ready-glow {
  animation: dna-btn-frost-glow 2s ease-in-out infinite;
  border-color: rgba(97, 175, 239, 0.4);
  color: var(--fg-accent);
}

/* Colorful badges */
.panel-info-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  flex-shrink: 0;
  min-width: 80px;
  justify-content: center;
  text-transform: uppercase;
}

/* Badge color variants */
.badge-blue {
  background: rgba(97, 175, 239, 0.15);
  color: #61afef;
  border: 1px solid rgba(97, 175, 239, 0.25);
}
.badge-purple {
  background: rgba(167, 139, 250, 0.15);
  color: #a78bfa;
  border: 1px solid rgba(167, 139, 250, 0.25);
}
.badge-green {
  background: rgba(80, 200, 140, 0.15);
  color: #50c88c;
  border: 1px solid rgba(80, 200, 140, 0.25);
}
.badge-orange {
  background: rgba(245, 166, 72, 0.15);
  color: #f5a648;
  border: 1px solid rgba(245, 166, 72, 0.25);
}
.badge-pink {
  background: rgba(240, 113, 160, 0.15);
  color: #f071a0;
  border: 1px solid rgba(240, 113, 160, 0.25);
}
.badge-teal {
  background: rgba(72, 199, 210, 0.15);
  color: #48c7d2;
  border: 1px solid rgba(72, 199, 210, 0.25);
}
.badge-gold {
  background: rgba(230, 200, 80, 0.15);
  color: #e6c850;
  border: 1px solid rgba(230, 200, 80, 0.25);
}
.badge-red {
  background: rgba(240, 90, 90, 0.15);
  color: #f05a5a;
  border: 1px solid rgba(240, 90, 90, 0.25);
}

/* Tips list */
.panel-info-tips {
  list-style: none;
  padding: 0;
  margin: 0;
}
.panel-info-tips li {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.6;
  padding: 3px 0 3px 18px;
  position: relative;
}
.panel-info-tips li::before {
  content: '\2727';
  position: absolute;
  left: 0;
  color: var(--fg-accent);
  font-size: 10px;
  top: 5px;
}
.panel-info-tips li strong {
  color: rgba(255,255,255,0.8);
}

/* ---- Style Breakdown Panel ---- */
.style-breakdown {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  padding: 18px 20px;
  margin-bottom: 18px;
  max-width: 780px;
}
.style-breakdown-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.style-breakdown-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--fg-accent);
  margin: 0;
  letter-spacing: 0.3px;
}
.style-breakdown-date {
  font-size: 11px;
  color: var(--fg-muted);
}
.style-breakdown-section {
  margin-bottom: 14px;
}
.style-breakdown-section:last-child { margin-bottom: 0; }
.style-breakdown-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  color: rgba(255,255,255,0.6);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin: 0 0 8px;
}
.style-breakdown-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 5px;
  font-size: 12px;
  flex-shrink: 0;
}
.style-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.style-tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 20px;
  line-height: 1.4;
}
.style-tag.tag-tone {
  background: rgba(167, 139, 250, 0.12);
  color: #c4b5fd;
  border: 1px solid rgba(167, 139, 250, 0.2);
}
.style-tag.tag-theme {
  background: rgba(97, 175, 239, 0.12);
  color: #93c5fd;
  border: 1px solid rgba(97, 175, 239, 0.2);
}
.style-tag.tag-motif {
  background: rgba(245, 166, 72, 0.12);
  color: #fbbf6a;
  border: 1px solid rgba(245, 166, 72, 0.2);
}
.style-tag.tag-vibe {
  background: rgba(72, 199, 210, 0.1);
  color: #6ee7d0;
  border: 1px solid rgba(72, 199, 210, 0.15);
}
.style-tag.tag-avoid {
  background: rgba(240, 90, 90, 0.1);
  color: #fca5a5;
  border: 1px solid rgba(240, 90, 90, 0.18);
}
.style-voice-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.style-voice-list li {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.6;
  padding: 3px 0 3px 18px;
  position: relative;
}
.style-voice-list li::before {
  content: '\201C';
  position: absolute;
  left: 0;
  color: rgba(80, 200, 140, 0.6);
  font-size: 16px;
  font-weight: 700;
  top: 1px;
}
.style-breakdown-sources {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255,255,255,0.04);
  font-size: 11px;
  color: var(--fg-muted);
}

/* ---- Buttons ---- */
.btn-row { display: flex; gap: 8px; margin-bottom: 14px; flex-wrap: wrap; }

.btn-primary {
  background: linear-gradient(135deg, var(--fg-accent), var(--fg-accent2));
  color: #1a1a2e;
  border: none;
  border-radius: 8px;
  padding: 10px 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(97, 175, 239, 0.25);
  font-family: inherit;
}
.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 16px rgba(97, 175, 239, 0.35);
}
.btn-large { padding: 14px 40px; font-size: 16px; border-radius: var(--radius); }

.btn-secondary {
  background: var(--bg-button);
  color: var(--fg-text);
  border: 1px solid var(--bg-card-border);
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
.btn-secondary:hover { background: var(--bg-button-hover); border-color: rgba(255,255,255,0.12); }

/* DNA Refresh Button Glow */
.btn-secondary.dna-btn-glow {
  animation: dna-btn-frost-glow 2s ease-in-out infinite;
  border-color: rgba(97, 175, 239, 0.4);
  color: var(--fg-accent);
}
@keyframes dna-btn-frost-glow {
  0%, 100% {
    box-shadow: 0 0 4px rgba(97, 175, 239, 0.15), 0 0 10px rgba(97, 175, 239, 0.08);
    background: rgba(97, 175, 239, 0.08);
  }
  50% {
    box-shadow: 0 0 8px rgba(97, 175, 239, 0.3), 0 0 20px rgba(97, 175, 239, 0.15);
    background: rgba(97, 175, 239, 0.15);
  }
}

/* Tutorial Glow Badge-Button */
.btn-tutorial-glow {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 4px 10px;
  border-radius: 4px;
  white-space: nowrap;
  text-transform: uppercase;
  text-decoration: none;
  cursor: pointer;
  margin: 10px 0 12px;
  color: #c084fc;
  background: rgba(192, 132, 252, 0.12);
  border: 1px solid rgba(192, 132, 252, 0.35);
  animation: tutorial-neon-pulse 2s ease-in-out infinite;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.btn-tutorial-glow:hover {
  transform: translateY(-1px);
  background: rgba(192, 132, 252, 0.22);
  box-shadow: 0 0 16px rgba(192, 132, 252, 0.5), 0 0 32px rgba(168, 85, 247, 0.25);
}
@keyframes tutorial-neon-pulse {
  0%, 100% {
    box-shadow: 0 0 4px rgba(192, 132, 252, 0.2), 0 0 10px rgba(168, 85, 247, 0.1);
    border-color: rgba(192, 132, 252, 0.35);
  }
  50% {
    box-shadow: 0 0 10px rgba(192, 132, 252, 0.45), 0 0 24px rgba(168, 85, 247, 0.2);
    border-color: rgba(192, 132, 252, 0.6);
  }
}

.btn-accent {
  background: var(--fg-success);
  color: #1a1a2e;
  border: none;
  border-radius: 8px;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
.btn-accent:hover { opacity: 0.9; transform: translateY(-1px); }

.btn-small {
  background: var(--bg-button);
  color: var(--fg-text);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s ease;
  font-family: inherit;
}
.btn-small:hover { background: var(--bg-button-hover); }

.btn-delete {
  background: none;
  border: none;
  color: var(--fg-error);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  transition: color 0.15s;
}
.btn-delete:hover { color: #ff9999; }
.copy-btn { margin-top: 4px; }

/* ---- Inputs ---- */
.input-field {
  width: 100%;
  background: var(--bg-entry);
  color: var(--fg-entry);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.input-field:focus {
  outline: none;
  border-color: var(--fg-accent);
  box-shadow: 0 0 0 2px rgba(97, 175, 239, 0.15);
}

.input-small {
  width: 70px;
  background: var(--bg-entry);
  color: var(--fg-entry);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 14px;
}

.input-select {
  background: var(--bg-entry);
  color: var(--fg-entry);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 14px;
  font-family: inherit;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2361afef' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}
.input-select option {
  background: #1a1a2e;
  color: #e0e0e0;
  padding: 8px;
}
.input-select:focus { outline: none; border-color: var(--fg-accent); }

/* Fix for select dropdowns in all browsers */
select.input-field,
#studio-controls select,
.studio-music-section select {
  background-color: var(--bg-entry);
  color: var(--fg-entry);
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2361afef' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  padding-right: 30px;
  cursor: pointer;
}
select.input-field option,
#studio-controls select option,
.studio-music-section select option {
  background-color: #1a1a2e;
  color: #e0e0e0;
}

/* ---- Options & Checkboxes ---- */
.options-row { display: flex; gap: 16px; margin-bottom: 12px; flex-wrap: wrap; align-items: center; }
.option-label { color: var(--fg-text); font-size: 14px; display: flex; align-items: center; gap: 6px; }
.checkbox-label { color: var(--fg-text); font-size: 14px; display: flex; align-items: center; gap: 4px; cursor: pointer; }
.checkbox-row { display: flex; gap: 12px; flex-wrap: wrap; }

/* ---- Content Type Dropdown ---- */
.content-dropdown {
  position: relative;
  display: inline-block;
}

.content-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  background: var(--bg-button);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  color: var(--fg-text);
  font-size: 14px;
  cursor: pointer;
  min-width: 140px;
  justify-content: space-between;
  transition: all 0.2s;
}

.content-dropdown-btn:hover {
  border-color: var(--fg-accent);
  background: var(--bg-card);
}

.content-dropdown-btn .dropdown-arrow {
  font-size: 10px;
  opacity: 0.6;
  transition: transform 0.2s;
}

.content-dropdown.open .dropdown-arrow {
  transform: rotate(180deg);
}

.content-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 4px;
  min-width: 160px;
  background: #1a1a2e;
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  z-index: 100;
  display: none;
  padding: 6px 0;
}

.content-dropdown.open .content-dropdown-menu {
  display: block;
}

.content-dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  color: var(--fg-text);
  font-size: 14px;
  transition: background 0.15s;
}

.content-dropdown-item:hover {
  background: rgba(97, 175, 239, 0.1);
}

.content-dropdown-item input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--fg-accent);
  cursor: pointer;
}

/* ---- Content Creator ---- */
.creator-grid { margin-bottom: 10px; }
.creator-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.creator-label {
  width: 80px;
  min-width: 80px;
  font-size: 13px;
  color: var(--fg-muted);
  text-align: right;
}
.creator-section-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--fg-accent);
  text-transform: uppercase;
  letter-spacing: 1px;
  padding: 8px 0 2px;
  margin-top: 4px;
  border-bottom: 1px solid rgba(97, 175, 239, 0.1);
}
.creator-output { margin-top: 20px; }

/* ---- Video Model Info Badges ---- */
.model-info-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding: 0;
}

.model-info-badges .model-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 4px;
  font-weight: 500;
  white-space: nowrap;
}

.model-info-badges .model-badge.pro {
  background: rgba(152, 195, 121, 0.15);
  color: var(--fg-success);
  border: 1px solid rgba(152, 195, 121, 0.25);
}

.model-info-badges .model-badge.con {
  background: rgba(224, 108, 117, 0.12);
  color: var(--fg-error);
  border: 1px solid rgba(224, 108, 117, 0.2);
}

.model-info-badges .model-badge.neutral {
  background: rgba(97, 175, 239, 0.12);
  color: var(--fg-accent);
  border: 1px solid rgba(97, 175, 239, 0.2);
}

/* ---- Creative Studio Controls ---- */
.studio-controls {
  margin: 16px 0;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid rgba(97, 175, 239, 0.15);
  border-radius: var(--radius);
  overflow: hidden;
}

.studio-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: rgba(97, 175, 239, 0.08);
  cursor: pointer;
  transition: background 0.15s;
}

.studio-header:hover {
  background: rgba(97, 175, 239, 0.12);
}

.studio-title {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-accent);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.studio-toggle {
  font-size: 12px;
  color: var(--fg-muted);
  transition: transform 0.2s;
}

.studio-controls.collapsed .studio-toggle {
  transform: rotate(-90deg);
}

.studio-controls.collapsed .studio-body {
  display: none;
}

.studio-body {
  padding: 16px;
}

.studio-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

.studio-row:last-of-type {
  margin-bottom: 0;
}

.studio-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.studio-label .label-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-text);
}

.studio-label .label-range {
  font-size: 11px;
  color: var(--fg-muted);
  font-style: italic;
}

.studio-slider-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

.studio-slider {
  flex: 1;
  height: 6px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(to right,
    rgba(97, 175, 239, 0.3) 0%,
    rgba(97, 175, 239, 0.6) 50%,
    rgba(255, 149, 0, 0.6) 100%
  );
  border-radius: 3px;
  cursor: pointer;
}

.studio-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  background: var(--fg-accent);
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.1s;
}

.studio-slider::-webkit-slider-thumb:hover {
  transform: scale(1.15);
}

.studio-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  background: var(--fg-accent);
  border: 2px solid #fff;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.slider-value {
  min-width: 32px;
  text-align: right;
  font-size: 12px;
  font-family: 'Consolas', 'Courier New', monospace;
  color: var(--fg-accent);
}

.studio-hint {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.5;
}

/* Mobile responsive studio controls */
@media (max-width: 768px) {
  .studio-body {
    padding: 12px;
  }

  .studio-row {
    margin-bottom: 16px;
  }

  .studio-label {
    flex-direction: column;
    gap: 2px;
  }

  .studio-label .label-range {
    font-size: 10px;
  }

  .studio-slider {
    height: 8px;
  }

  .studio-slider::-webkit-slider-thumb {
    width: 20px;
    height: 20px;
  }
}

/* Mode hint text */
.mode-hint {
  font-size: 12px;
  color: var(--fg-muted);
  font-style: italic;
  margin-left: 8px;
  white-space: nowrap;
}

@media (max-width: 768px) {
  .mode-hint {
    display: none;
  }
}

/* ---- Storyboard "needs song" badge ---- */
.sb-needs-song-badge {
  margin: 2px 0 6px 0;
  padding-left: 2px;
}

/* ---- Storyboard Phase Indicator ---- */
.sb-phase-indicator {
  display: flex;
  align-items: center;
  margin-bottom: 20px;
  padding: 14px 20px;
  background: linear-gradient(135deg, rgba(97,175,239,0.06) 0%, rgba(167,139,250,0.06) 100%);
  border: 1px solid rgba(97, 175, 239, 0.15);
  border-radius: var(--radius);
}
.sb-phase-step {
  display: flex;
  align-items: center;
  gap: 10px;
  opacity: 0.3;
  transition: opacity 0.3s;
}
.sb-phase-step.active { opacity: 1; }
.sb-phase-step.completed { opacity: 0.75; }
.sb-phase-num {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(97, 175, 239, 0.12);
  border: 2px solid rgba(97, 175, 239, 0.25);
  color: var(--fg-accent);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.3s;
}
.sb-phase-step.active .sb-phase-num {
  background: var(--fg-accent);
  color: var(--bg-main);
  border-color: var(--fg-accent);
  box-shadow: 0 0 12px rgba(97, 175, 239, 0.4);
}
.sb-phase-step.completed .sb-phase-num {
  background: rgba(80, 200, 140, 0.2);
  border-color: rgba(80, 200, 140, 0.5);
  color: #50c88c;
}
.sb-phase-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-muted);
  white-space: nowrap;
}
.sb-phase-step.active .sb-phase-label {
  color: var(--fg-text);
  text-shadow: 0 0 8px rgba(97, 175, 239, 0.3);
}
.sb-phase-step.completed .sb-phase-label { color: rgba(80, 200, 140, 0.85); }
.sb-phase-connector {
  flex: 1;
  height: 2px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 1px;
  margin: 0 14px;
  min-width: 24px;
  position: relative;
}
.sb-phase-step.completed + .sb-phase-connector {
  background: rgba(80, 200, 140, 0.3);
}
@media (max-width: 600px) {
  .sb-phase-indicator { padding: 10px 12px; }
  .sb-phase-label { display: none; }
  .sb-phase-connector { min-width: 12px; margin: 0 8px; }
  .sb-phase-num { width: 26px; height: 26px; }
}

/* Audio-driven model bypassed indicator */
.sb-model-wrapper {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.sb-bypassed-badge {
  background: linear-gradient(135deg, #f7a600, #ff6b35);
  color: #1a1a2e;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
  animation: pulse-badge 2s ease-in-out infinite;
}
@keyframes pulse-badge {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}
.sb-bypassed-notice {
  color: #f7a600 !important;
  font-size: 12px !important;
  margin-top: 6px;
  padding: 8px 12px;
  background: rgba(247, 166, 0, 0.1);
  border: 1px solid rgba(247, 166, 0, 0.3);
  border-radius: 6px;
  line-height: 1.4;
}
.sb-model-bypassed .input-select {
  opacity: 0.5;
  pointer-events: none;
}
.output-section {
  margin-bottom: 14px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 14px;
}
.output-section.hidden { display: none; }

/* ---- Progress bar ---- */
.sb-progress-wrapper { margin: 14px 0; }
.sb-progress-wrapper.hidden { display: none; }
.sb-progress-wrapper .progress-bar { margin: 0; }
.progress-bar {
  height: 36px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  overflow: hidden;
  position: relative;
  margin: 14px 0;
  border: 1px solid rgba(255,255,255,0.08);
}
.progress-bar.hidden { display: none; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--fg-accent), var(--fg-accent2));
  opacity: 0.5;
  transition: width 0.5s ease;
  width: 0;
}
.progress-text {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  font-size: 13px;
  color: var(--fg-text);
  white-space: nowrap;
}

/* Progress bar complete state */
.progress-bar.complete {
  border-color: var(--fg-success);
}
.progress-bar.complete .progress-fill {
  background: linear-gradient(90deg, var(--fg-success), #2ecc71);
  opacity: 0.6;
}
.progress-bar.complete .progress-text {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: calc(100% - 24px);
}
.progress-bar .complete-text {
  color: var(--fg-success);
  font-weight: 500;
}
.progress-bar .close-status-btn {
  background: transparent;
  border: none;
  color: var(--fg-muted);
  font-size: 18px;
  cursor: pointer;
  padding: 0 4px;
  line-height: 1;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.progress-bar .close-status-btn:hover {
  opacity: 1;
  color: var(--fg-text);
}

/* ---- Progress indicator with LED glow effect ---- */
.progress-indicator {
  position: absolute;
  top: 50%;
  right: 12px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 500;
  z-index: 2;
}

/* Realistic LED light effect */
.pulse-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  position: relative;
  /* Bright core with gradient for 3D dome effect */
  background: radial-gradient(
    circle at 35% 35%,
    #fff7e0 0%,
    #ffcc00 25%,
    #ff9500 60%,
    #cc6600 100%
  );
  /* Multi-layer glow: inner bright + mid glow + outer bloom */
  box-shadow:
    inset 0 -2px 4px rgba(0, 0, 0, 0.3),
    0 0 3px 1px #ffcc00,
    0 0 8px 3px rgba(255, 170, 0, 0.8),
    0 0 16px 6px rgba(255, 149, 0, 0.5),
    0 0 28px 10px rgba(255, 149, 0, 0.25);
  animation: led-pulse 1.8s ease-in-out infinite;
}

.pulse-dot.complete {
  background: radial-gradient(
    circle at 35% 35%,
    #e0ffe0 0%,
    #7aff7a 25%,
    #34c759 60%,
    #1a8f3c 100%
  );
  box-shadow:
    inset 0 -2px 4px rgba(0, 0, 0, 0.3),
    0 0 3px 1px #7aff7a,
    0 0 8px 3px rgba(52, 199, 89, 0.8),
    0 0 16px 6px rgba(52, 199, 89, 0.5),
    0 0 28px 10px rgba(52, 199, 89, 0.25);
  animation: led-pulse-green 2s ease-in-out infinite;
}

@keyframes led-pulse {
  0%, 100% {
    box-shadow:
      inset 0 -2px 4px rgba(0, 0, 0, 0.3),
      0 0 3px 1px #ffcc00,
      0 0 8px 3px rgba(255, 170, 0, 0.7),
      0 0 16px 6px rgba(255, 149, 0, 0.4),
      0 0 28px 10px rgba(255, 149, 0, 0.2);
    transform: scale(1);
  }
  50% {
    box-shadow:
      inset 0 -2px 4px rgba(0, 0, 0, 0.2),
      0 0 4px 2px #ffdd44,
      0 0 12px 5px rgba(255, 170, 0, 0.9),
      0 0 24px 10px rgba(255, 149, 0, 0.6),
      0 0 40px 16px rgba(255, 149, 0, 0.3);
    transform: scale(1.05);
  }
}

@keyframes led-pulse-green {
  0%, 100% {
    box-shadow:
      inset 0 -2px 4px rgba(0, 0, 0, 0.3),
      0 0 3px 1px #7aff7a,
      0 0 8px 3px rgba(52, 199, 89, 0.7),
      0 0 16px 6px rgba(52, 199, 89, 0.4),
      0 0 28px 10px rgba(52, 199, 89, 0.2);
  }
  50% {
    box-shadow:
      inset 0 -2px 4px rgba(0, 0, 0, 0.2),
      0 0 4px 2px #90ff90,
      0 0 12px 5px rgba(52, 199, 89, 0.9),
      0 0 24px 10px rgba(52, 199, 89, 0.5),
      0 0 40px 16px rgba(52, 199, 89, 0.25);
  }
}

.progress-label {
  color: #ffaa00;
  text-transform: lowercase;
  text-shadow: 0 0 8px rgba(255, 170, 0, 0.5);
}

.progress-label.complete {
  color: #4ade80;
  text-shadow: 0 0 8px rgba(52, 199, 89, 0.5);
}

.progress-counter {
  color: var(--fg-text);
  font-variant-numeric: tabular-nums;
}

/* Progress row with cancel button */
.progress-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 4px;
}
.progress-row .progress-text {
  position: static;
  transform: none;
  flex: 1;
}
.btn-cancel {
  background: transparent;
  border: 1px solid var(--fg-error);
  color: var(--fg-error);
  padding: 4px 12px;
  font-size: 11px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-cancel:hover:not(:disabled) {
  background: var(--fg-error);
  color: white;
}
.btn-cancel:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

/* Pending status (queue) */
.pulse-dot.pending {
  background: radial-gradient(
    circle at 35% 35%,
    #fff9e0 0%,
    #e5c07b 25%,
    #c9a448 60%,
    #9a7b30 100%
  );
  box-shadow:
    inset 0 -2px 4px rgba(0, 0, 0, 0.3),
    0 0 3px 1px #e5c07b,
    0 0 8px 3px rgba(229, 192, 123, 0.7),
    0 0 16px 6px rgba(229, 192, 123, 0.4),
    0 0 28px 10px rgba(229, 192, 123, 0.2);
  animation: led-pulse-yellow 1.8s ease-in-out infinite;
}
.progress-label.pending {
  color: #e5c07b;
  text-shadow: 0 0 8px rgba(229, 192, 123, 0.5);
}
@keyframes led-pulse-yellow {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.1); opacity: 0.85; }
}

/* Generation Status Panel */
.generation-status-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, rgba(152, 195, 121, 0.12), rgba(152, 195, 121, 0.06));
  border: 1px solid rgba(152, 195, 121, 0.3);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-top: 12px;
}
.generation-status-panel.hidden { display: none; }
.gen-status-content {
  display: flex;
  align-items: center;
  gap: 10px;
}
.gen-status-icon {
  font-size: 18px;
}
.gen-status-text {
  color: var(--fg-success);
  font-weight: 500;
}
.gen-status-link {
  color: var(--fg-accent);
  cursor: pointer;
  text-decoration: underline;
}
.gen-status-link:hover {
  color: var(--fg-text);
}
.gen-status-close {
  background: transparent;
  border: none;
  color: var(--fg-muted);
  font-size: 20px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
}
.gen-status-close:hover {
  color: var(--fg-text);
}

/* ---- Feedback ---- */
.feedback-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  font-size: 13px;
}
.feedback-row.hidden { display: none; }

.btn-feedback {
  border: none;
  border-radius: var(--radius-sm);
  padding: 6px 16px;
  font-size: 12px;
  cursor: pointer;
  font-weight: 600;
  transition: opacity 0.15s;
  font-family: inherit;
}
.btn-feedback.worked { background: var(--fg-success); color: #1a1a2e; }
.btn-feedback.neutral { background: var(--fg-warning); color: #1a1a2e; }
.btn-feedback.didnt { background: var(--fg-error); color: #1a1a2e; }
.btn-feedback:hover { opacity: 0.85; }

/* ---- Output Areas ---- */
.output-area {
  background: var(--bg-card);
  color: var(--fg-text);
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--bg-card-border);
  white-space: pre-wrap;
  word-break: break-word;
  min-height: 120px;
  line-height: 1.6;
}
.output-area.small { min-height: 40px; max-height: 200px; overflow-y: auto; font-size: 12px; color: var(--fg-muted); }
.output-area.error-area { color: var(--fg-error); min-height: 40px; }

/* ---- Lyrics ---- */
.lyrics-textarea {
  width: 100%;
  min-height: 160px;
  background: var(--bg-card);
  color: var(--fg-text);
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 13px;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: var(--radius);
  resize: vertical;
  margin-bottom: 14px;
}
.lyrics-textarea:focus { outline: none; border-color: var(--fg-accent); box-shadow: 0 0 0 2px rgba(97, 175, 239, 0.15); }

/* ---- Image / Video Display ---- */
.image-display {
  background: var(--bg-card);
  color: var(--fg-muted);
  text-align: center;
  padding: 24px;
  border-radius: var(--radius);
  margin-bottom: 12px;
  min-height: 200px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.image-display img {
  max-width: 100%;
  max-height: 512px;
  border-radius: var(--radius-sm);
}

.video-display {
  background: var(--bg-card);
  border-radius: var(--radius);
  margin-bottom: 12px;
  text-align: center;
  padding: 8px;
}
.video-display:empty { display: none; }
.video-display video {
  max-width: 100%;
  max-height: 480px;
  border-radius: var(--radius-sm);
}

/* ---- Upload Zone ---- */
.upload-zone {
  border: 2px dashed rgba(97, 175, 239, 0.25);
  border-radius: 12px;
  padding: 32px;
  text-align: center;
  cursor: pointer;
  transition: all 0.25s ease;
  color: var(--fg-muted);
  background: rgba(97, 175, 239, 0.02);
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--fg-accent);
  background: rgba(97, 175, 239, 0.06);
  transform: translateY(-1px);
}
.upload-zone p { margin-bottom: 4px; }

/* ---- Media Tabs ---- */
.media-tabs {
  display: flex;
  gap: 4px;
  margin: 16px 0 12px;
}
.media-tab {
  background: var(--bg-button);
  color: var(--fg-text);
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 8px 20px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: inherit;
}
.media-tab.active {
  background: linear-gradient(135deg, var(--fg-accent), var(--fg-accent2));
  color: #1a1a2e;
  font-weight: 600;
}
.media-tab:hover:not(.active) { background: var(--bg-button-hover); }

/* ---- Media Grid ---- */
.media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}
.media-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 14px;
  transition: border-color 0.2s;
}
.media-card:hover { border-color: rgba(97, 175, 239, 0.2); }
.media-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.media-filename { font-size: 13px; font-weight: 600; color: var(--fg-text); }
.media-card-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.media-card-actions { display: flex; gap: 6px; margin: 8px 0; }
.media-transcript {
  font-size: 12px;
  color: var(--fg-muted);
  padding: 8px;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm);
  margin-top: 6px;
  white-space: pre-wrap;
  line-height: 1.4;
}

.tag {
  font-size: 11px;
  background: rgba(97, 175, 239, 0.1);
  color: var(--fg-accent);
  padding: 2px 8px;
  border-radius: 10px;
}
.badge {
  font-size: 11px;
  background: rgba(106, 191, 105, 0.1);
  color: var(--fg-success);
  padding: 2px 8px;
  border-radius: 10px;
}
.badge.analyzed { background: rgba(97, 175, 239, 0.1); color: var(--fg-accent); }
.badge.success { background: rgba(106, 191, 105, 0.15); color: var(--fg-success); }

/* ---- Song Analysis ---- */
.media-song-analysis {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 6px 0;
  flex-wrap: wrap;
}
.song-structure {
  font-size: 11px;
  color: var(--fg-muted);
  font-style: italic;
}

/* ---- Lyrics Modal ---- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.modal-content {
  background: var(--bg-panel);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  max-width: 600px;
  width: 100%;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.lyrics-modal-content {
  max-width: 700px;
}
.keyframe-library-modal-content {
  max-width: 560px;
}
.keyframe-library-modal-content .ref-images-list {
  gap: 10px;
}
.keyframe-library-modal-content .ref-image-item {
  cursor: pointer;
  border: 2px solid transparent;
  border-radius: 6px;
  transition: border-color 0.2s, transform 0.15s;
}
.keyframe-library-modal-content .ref-image-item:hover {
  border-color: var(--fg-accent);
  transform: scale(1.04);
}
.modal-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--bg-card-border);
}
.modal-header h3 {
  margin: 0;
  flex: 1;
  font-size: 18px;
  color: var(--fg-text);
}
.modal-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}
.modal-close:hover { color: var(--fg-text); }

.lyrics-structure {
  padding: 12px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--bg-card-border);
}
.lyrics-structure h4 {
  margin: 0 0 10px 0;
  font-size: 13px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.structure-timeline {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.structure-section {
  display: flex;
  flex-direction: column;
  padding: 6px 10px;
  background: rgba(97, 175, 239, 0.1);
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--fg-accent);
}
.structure-section.verse { border-color: #61afef; }
.structure-section.chorus { border-color: #98c379; background: rgba(106, 191, 105, 0.1); }
.structure-section.bridge { border-color: #e5c07b; background: rgba(229, 192, 123, 0.1); }
.structure-section.intro,
.structure-section.outro { border-color: #c678dd; background: rgba(198, 120, 221, 0.1); }
.section-type {
  font-size: 11px;
  font-weight: 600;
  text-transform: capitalize;
  color: var(--fg-text);
}
.section-time {
  font-size: 10px;
  color: var(--fg-muted);
}

.lyrics-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}
.lyrics-content pre {
  margin: 0;
  white-space: pre-wrap;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.8;
  color: var(--fg-text);
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 12px 20px;
  border-top: 1px solid var(--bg-card-border);
}
.modal-body {
  padding: 16px 20px;
}
.modal-body .form-group {
  margin-bottom: 16px;
}
.modal-body .form-group:last-child {
  margin-bottom: 0;
}
.modal-desc {
  color: var(--fg-muted);
  font-size: 13px;
  margin-bottom: 16px;
}

/* Lyric video modal */
.lyric-video-modal-content {
  max-width: 500px;
}
.lyric-video-modal-content .checkbox-label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 14px;
  color: var(--fg-text);
}
.lyric-video-modal-content .checkbox-label input[type="checkbox"] {
  width: 16px;
  height: 16px;
  accent-color: var(--fg-accent);
}

/* ---- Content Library ---- */
.library-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.library-filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.library-filters select {
  padding: 6px 10px;
  font-size: 13px;
  background: var(--bg-input);
  border: 1px solid var(--bg-input-border);
  color: var(--fg-text);
  border-radius: var(--radius-sm);
}
.library-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}
#library-count {
  font-size: 13px;
  color: var(--fg-muted);
}
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}
.library-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color 0.2s, transform 0.2s;
}
.library-card:hover {
  border-color: rgba(97, 175, 239, 0.3);
  transform: translateY(-2px);
}
.library-card-preview {
  width: 100%;
  height: 160px;
  object-fit: cover;
  background: var(--bg-input);
  display: block;
}
.library-card-text-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  font-size: 12px;
  color: var(--fg-muted);
  text-align: center;
  line-height: 1.4;
}
.library-card-body {
  padding: 12px;
}
.library-card-types {
  display: flex;
  gap: 4px;
  margin-bottom: 6px;
}
.library-card-types .badge {
  font-size: 10px;
  padding: 2px 6px;
}
.badge-image { background: rgba(97, 175, 239, 0.1); color: var(--fg-accent); }
.badge-video { background: rgba(216, 86, 164, 0.1); color: var(--fg-accent2); }
.badge-caption { background: rgba(106, 191, 105, 0.1); color: var(--fg-success); }
.library-card-theme {
  font-size: 13px;
  font-weight: 600;
  color: var(--fg-text);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.library-card-date {
  font-size: 11px;
  color: var(--fg-muted);
  margin-bottom: 8px;
}
.library-card-rating {
  margin-bottom: 10px;
}
.star-rating {
  display: flex;
  gap: 2px;
}
.star-rating .star {
  font-size: 18px;
  color: var(--fg-muted);
  cursor: pointer;
  transition: color 0.15s, transform 0.15s;
}
.star-rating .star:hover {
  transform: scale(1.2);
}
.star-rating .star.active {
  color: #f5c842;
}
.library-card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.library-card-actions .btn-sm {
  font-size: 11px;
  padding: 4px 8px;
}
.btn-sm.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.2);
}
.btn-sm.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
}

/* Video preview container and overlay */
.library-video-container {
  position: relative;
  width: 100%;
  height: 160px;
  cursor: pointer;
}
.library-video-container video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.library-video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.3);
  opacity: 0;
  transition: opacity 0.2s;
}
.library-video-container:hover .library-video-overlay {
  opacity: 1;
}
.library-video-overlay .play-icon {
  font-size: 36px;
  color: white;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
}

/* Video Lazy Loading Placeholder */
.video-lazy-placeholder {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 120px;
  background: linear-gradient(135deg, var(--bg-button), var(--bg-entry));
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
}
.video-lazy-placeholder::before {
  content: "▶";
  font-size: 32px;
  color: var(--fg-muted);
  opacity: 0.5;
  animation: video-placeholder-pulse 1.5s ease-in-out infinite;
}
@keyframes video-placeholder-pulse {
  0%, 100% { transform: scale(1); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 0.8; }
}
.video-lazy-placeholder.loading::after {
  content: "";
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 40px;
  height: 4px;
  background: var(--bg-card-border);
  border-radius: 2px;
  overflow: hidden;
}
.video-lazy-placeholder.loading::after {
  background: linear-gradient(90deg, var(--fg-accent) 30%, var(--bg-card-border) 50%, var(--fg-accent) 70%);
  background-size: 200% 100%;
  animation: video-loading-bar 1.5s ease-in-out infinite;
}
@keyframes video-loading-bar {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}
/* Hide placeholder once video loads */
video.lazy-loaded + .video-lazy-placeholder,
.library-video-container video:not(.video-lazy) + .library-video-overlay .video-lazy-placeholder {
  display: none;
}

/* Full-screen video preview modal */
.video-preview-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.video-preview-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
}
.video-preview-content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.video-preview-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: transparent;
  border: none;
  color: white;
  font-size: 24px;
  cursor: pointer;
  padding: 8px;
  opacity: 0.7;
  transition: opacity 0.2s;
}
.video-preview-close:hover {
  opacity: 1;
}
.video-preview-player {
  max-width: 90vw;
  max-height: 75vh;
  border-radius: 8px;
  background: black;
}
.video-preview-actions {
  margin-top: 16px;
}
.video-preview-actions .btn {
  background: var(--fg-accent);
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 14px;
}
.video-preview-actions .btn:hover {
  filter: brightness(1.1);
}
.video-preview-actions .btn-accent {
  background: var(--fg-accent2);
  margin-left: 8px;
}

/* Lip-sync modal styles */
.lipsync-modal-content {
  background: var(--bg-content);
  border-radius: var(--radius);
  padding: 24px;
  max-width: 560px;
  width: 90vw;
  max-height: 90vh;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(97,175,239,0.2) transparent;
}
.lipsync-modal-content::-webkit-scrollbar { width: 6px; }
.lipsync-modal-content::-webkit-scrollbar-track { background: transparent; }
.lipsync-modal-content::-webkit-scrollbar-thumb { background: rgba(97,175,239,0.2); border-radius: 3px; }
.lipsync-modal-content h3 {
  margin: 0 0 8px 0;
  color: var(--fg-text);
}
.lipsync-preview {
  margin: 16px 0;
}
.lipsync-preview-video {
  width: 100%;
  max-height: 220px;
  border-radius: var(--radius-sm);
  background: black;
}
.lipsync-form .form-group {
  margin-bottom: 16px;
}
.lipsync-form .form-group label {
  display: block;
  margin-bottom: 6px;
  font-weight: 500;
  color: var(--fg-text);
}
.lipsync-form .form-group input[type="file"] {
  width: 100%;
  padding: 8px;
  background: var(--bg-entry);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  color: var(--fg-text);
}
.lipsync-form .form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
}
.lipsync-form .status-msg {
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  font-size: 13px;
}
.lipsync-form .status-msg.error {
  background: rgba(224, 108, 117, 0.2);
  color: var(--fg-error);
}
.lipsync-form .status-msg.success {
  background: rgba(106, 191, 105, 0.2);
  color: var(--fg-success);
}
/* Audio source tabs */
.lipsync-audio-tabs {
  display: flex;
  gap: 0;
  margin-bottom: 12px;
  border-bottom: 1px solid var(--bg-card-border);
}
.lipsync-audio-tab {
  padding: 8px 16px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}
.lipsync-audio-tab:hover { color: var(--fg-text); }
.lipsync-audio-tab.active {
  color: var(--fg-accent);
  border-bottom-color: var(--fg-accent);
}
.lipsync-audio-panel { display: none; }
.lipsync-audio-panel.active { display: block; }
/* Waveform editor inside lip-sync modal */
.lipsync-waveform-editor {
  margin-top: 10px;
  padding: 12px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius-sm);
  border: 1px solid rgba(97, 175, 239, 0.12);
}
.lipsync-waveform-container {
  position: relative;
  height: 64px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  overflow: hidden;
  cursor: crosshair;
}
.lipsync-waveform-canvas {
  width: 100%;
  height: 100%;
  display: block;
}
.lipsync-waveform-selection {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
}
.lipsync-waveform-selection .selection-region,
.lipsync-waveform-selection .selection-handle {
  pointer-events: auto;
}
.lipsync-waveform-playhead {
  position: absolute;
  top: 0; bottom: 0;
  width: 2px;
  background: #ff6b6b;
  pointer-events: none;
  display: none;
  box-shadow: 0 0 6px rgba(255, 107, 107, 0.5);
}
.lipsync-waveform-playhead::before {
  content: '';
  position: absolute;
  top: -4px; left: -4px;
  width: 10px; height: 10px;
  background: #ff6b6b;
  border-radius: 50%;
}
.lipsync-clip-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}
.lipsync-clip-controls .btn-icon {
  width: 28px; height: 28px;
  font-size: 12px;
}
.lipsync-clip-info {
  display: flex;
  gap: 16px;
  margin-top: 8px;
  font-size: 11px;
  color: var(--fg-muted);
}
.lipsync-clip-info span {
  font-family: 'Consolas', 'Courier New', monospace;
  color: var(--fg-accent);
}
.lipsync-clip-info label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--fg-muted);
  display: block;
  margin-bottom: 1px;
}

#library-pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}
#library-pagination span {
  font-size: 13px;
  color: var(--fg-muted);
}
.insights-box {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 16px;
  font-size: 13px;
  line-height: 1.5;
}
.insights-box p {
  margin: 0 0 6px 0;
}
.insights-box p:last-child {
  margin-bottom: 0;
}
.insight-good {
  color: var(--fg-success);
}
.insight-warn {
  color: #f5c842;
}
.empty-state {
  text-align: center;
  color: var(--fg-muted);
  padding: 40px 20px;
  font-size: 14px;
}

/* Creator panel star rating */
#creator-rating {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
#creator-rating .star-rating {
  font-size: 22px;
}

/* ---- Social Profiles ---- */
.profiles-list { margin-top: 16px; }
.profile-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}
.profile-card-header {
  display: flex;
  gap: 10px;
  align-items: center;
  margin-bottom: 8px;
}
.profile-platform {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  color: var(--fg-accent);
  background: rgba(97, 175, 239, 0.1);
  padding: 2px 10px;
  border-radius: 10px;
}
.profile-username { font-size: 14px; color: var(--fg-text); }
.profile-bio { font-size: 13px; color: var(--fg-muted); margin-bottom: 8px; line-height: 1.4; }
.profile-patterns {
  display: flex;
  gap: 16px;
  font-size: 12px;
  color: var(--fg-muted);
  margin-bottom: 6px;
}
.profile-analysis {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.6;
  padding: 10px 12px;
  margin-top: 8px;
  background: rgba(0,0,0,0.2);
  border-radius: var(--radius-sm);
  max-height: 300px;
  overflow-y: auto;
}
.profile-analysis b {
  color: var(--fg-text);
  font-weight: 600;
}

/* ---- Persona Status ---- */
.persona-status {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin: 10px 0;
}
.status-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 14px 22px;
  text-align: center;
  min-width: 85px;
}
.status-count {
  display: block;
  font-size: 26px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--fg-accent), var(--fg-accent2));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}
.status-label { display: block; font-size: 11px; color: var(--fg-muted); margin-top: 2px; }

/* ---- Timeline ---- */
.timeline { margin: 10px 0; }
.timeline-entry {
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  border-left: 2px solid var(--fg-accent);
  margin-left: 8px;
  margin-bottom: 4px;
  font-size: 13px;
}
.timeline-date { color: var(--fg-muted); min-width: 80px; }
.timeline-trigger { color: var(--fg-accent); min-width: 100px; }
.timeline-summary { color: var(--fg-text); }

/* ---- Feedback History ---- */
.feedback-list { margin: 10px 0; }
.feedback-entry {
  display: flex;
  gap: 12px;
  padding: 8px 14px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  font-size: 12px;
  align-items: center;
}
.feedback-entry.worked { border-left: 3px solid var(--fg-success); }
.feedback-entry.neutral { border-left: 3px solid var(--fg-warning); }
.feedback-entry.didnt_work { border-left: 3px solid var(--fg-error); }
.feedback-date { color: var(--fg-muted); min-width: 80px; }
.feedback-type { color: var(--fg-accent); min-width: 100px; }
.feedback-rating { font-weight: 600; min-width: 80px; }
.feedback-preview { color: var(--fg-muted); flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- Setup / Settings Form ---- */
.setup-form { max-width: 600px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; color: var(--fg-text); font-size: 14px; margin-bottom: 4px; }
.key-row { display: flex; gap: 6px; }
.key-row .input-field { flex: 1; }
.hint { font-size: 11px; color: var(--fg-muted); }
.status-msg { margin-top: 8px; font-size: 14px; }
.status-msg.success { color: var(--fg-success); }
.status-msg.error { color: var(--fg-error); }
.fg-muted { color: var(--fg-muted); }
.trend-updated { font-size: 12px; color: var(--fg-muted); margin-bottom: 8px; }

/* ---- Help Section ---- */
.help-section { margin-top: 28px; }
.help-card {
  background: var(--bg-help);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-bottom: 12px;
}
.help-card h4 { color: var(--fg-text); font-size: 14px; margin-bottom: 8px; }
.help-card ol { padding-left: 20px; font-size: 13px; line-height: 1.7; color: var(--fg-text); }
.help-card p { font-size: 12px; color: var(--fg-muted); margin-top: 8px; }

/* ---- Reference Images List ---- */
/* ---- Reference Images Thumbnail Grid ---- */
.ref-images-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding: 8px;
  background: var(--bg-entry);
  border-radius: var(--radius-sm);
  border: 1px solid var(--bg-card-border);
  scrollbar-width: thin;
  scrollbar-color: rgba(97, 175, 239, 0.15) transparent;
}
.ref-images-list::-webkit-scrollbar { width: 4px; }
.ref-images-list::-webkit-scrollbar-track { background: transparent; }
.ref-images-list::-webkit-scrollbar-thumb {
  background: rgba(97, 175, 239, 0.2);
  border-radius: 2px;
}
.ref-image-item {
  position: relative;
  cursor: pointer;
  border-radius: 6px;
  border: 2px solid transparent;
  overflow: hidden;
  transition: all 0.2s ease;
  aspect-ratio: 1;
  background: var(--bg-card);
}
.ref-image-item:hover {
  border-color: rgba(97, 175, 239, 0.3);
  box-shadow: 0 0 8px rgba(97, 175, 239, 0.15);
}
.ref-image-item.selected {
  border-color: var(--fg-accent);
  box-shadow: 0 0 12px rgba(97, 175, 239, 0.3);
}
.ref-image-item .ref-thumb {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  border-radius: 4px;
}
.ref-image-item .ref-img-name {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 2px 4px;
  font-size: 8px;
  color: #fff;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.75));
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}
.ref-image-item .ref-selected-check {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--fg-accent);
  color: #fff;
  font-size: 11px;
  display: none;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}
.ref-image-item.selected .ref-selected-check {
  display: flex;
}
.ref-image-item .ref-analyzed-dot {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--fg-accent);
  box-shadow: 0 0 4px rgba(97, 175, 239, 0.5);
}
.ref-image-item .ref-analyzed-dot.not-analyzed {
  background: var(--fg-warning);
  box-shadow: 0 0 4px rgba(229, 192, 123, 0.4);
}
@media (max-width: 768px) {
  .ref-images-list {
    grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
    gap: 6px;
    padding: 6px;
    max-height: 160px;
  }
  .ref-image-item .ref-img-name {
    font-size: 7px;
  }
}

/* ---- Character Reference Section ---- */
.char-ref-section {
  margin: 12px 0;
}
.char-ref-upload {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.char-ref-list {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  min-height: 80px;
  padding: 12px;
  background: var(--bg-entry);
  border-radius: var(--radius-sm);
  border: 1px solid var(--bg-card-border);
}
.char-ref-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 8px;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  border: 2px solid var(--fg-accent);
}
.char-ref-item img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  border-radius: 6px;
}
.char-ref-item .char-ref-name {
  font-size: 11px;
  max-width: 80px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--fg-muted);
}
.char-ref-item .char-ref-delete {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--fg-error);
  color: white;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}
.char-ref-item .char-ref-delete:hover {
  background: #ff4444;
}

/* ---- Loading Overlay ---- */
.loading {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}
.loading.hidden { display: none; }
.spinner {
  width: 44px; height: 44px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: var(--fg-accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading p { color: var(--fg-text); margin-top: 12px; font-size: 14px; }

/* ---- Status Bar ---- */
.status-bar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  background: linear-gradient(135deg, #1a1a2e, #16213e);
  color: var(--fg-muted);
  font-size: 12px;
  padding: 5px 12px;
  z-index: 200;
  height: 28px;
  border-top: 1px solid rgba(97, 175, 239, 0.08);
}

/* ---- Inline Errors ---- */
.generation-error {
  background: rgba(224, 108, 117, 0.08);
  border: 1px solid rgba(224, 108, 117, 0.4);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--fg-error);
  font-size: 13px;
  margin: 8px 0;
}
.error-prominent {
  background: rgba(224, 108, 117, 0.1);
  border: 1px solid var(--fg-error);
  border-radius: var(--radius-sm);
  padding: 12px;
  color: var(--fg-error);
}

/* ---- Persona Indicator ---- */
.persona-indicator {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 12px;
  margin: 10px 0;
}
.persona-indicator.active {
  background: rgba(106, 191, 105, 0.1);
  color: var(--fg-success);
}
.persona-indicator.inactive {
  background: rgba(136, 136, 136, 0.08);
  color: var(--fg-muted);
}
.persona-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.persona-dot.active { background: var(--fg-success); }
.persona-dot.inactive { background: var(--fg-muted); }

/* ---- Collapsible Sections ---- */
.collapsible-header {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 6px 0;
  user-select: none;
}
.collapsible-header .arrow {
  font-size: 12px;
  transition: transform 0.2s;
  color: var(--fg-muted);
}
.collapsible-header .arrow.collapsed { transform: rotate(-90deg); }
.collapsible-body.collapsed { display: none; }

/* ---- Reference Upload ---- */
.ref-upload-row {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.ref-upload-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.ref-upload-btn input[type="file"] {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  opacity: 0;
  cursor: pointer;
}
.ref-filename {
  font-size: 12px;
  color: var(--fg-accent);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.ref-clear {
  background: none;
  border: none;
  color: var(--fg-error);
  cursor: pointer;
  font-size: 14px;
  padding: 0 4px;
}

/* ---- File Size Badge ---- */
.file-size-badge {
  font-size: 11px;
  color: var(--fg-muted);
  padding: 2px 6px;
  background: rgba(255,255,255,0.04);
  border-radius: 3px;
}
.file-size-badge.warning {
  color: var(--fg-warning);
  background: rgba(229, 192, 123, 0.1);
}

/* ---- Mobile Responsive ---- */
@media (max-width: 768px) {
  .content {
    padding: 16px 12px 48px;
  }

  .panel { max-width: 100%; overflow-x: hidden; }

  /* Options row: keep horizontal but wrap nicely */
  .options-row {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 12px 16px;
    width: 100%;
    align-items: center;
  }

  /* Checkbox row: horizontal with proper spacing */
  .checkbox-row {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 8px 16px;
    align-items: center;
  }

  /* Checkbox labels: ensure text is ALWAYS visible on mobile */
  .checkbox-label {
    min-width: fit-content;
    white-space: nowrap;
    gap: 8px;
    padding: 4px 0;
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    color: var(--fg-text) !important;
    font-size: 14px !important;
    visibility: visible !important;
  }

  /* Checkbox inputs: ensure minimum size for touch targets */
  .checkbox-label input[type="checkbox"],
  .checkbox-row input[type="checkbox"] {
    min-width: 20px;
    min-height: 20px;
    flex-shrink: 0;
    margin-right: 8px;
  }

  /* Creator row with checkbox: keep horizontal layout */
  .creator-row:has(.checkbox-label) {
    flex-direction: row !important;
    align-items: center !important;
  }

  /* Option labels: prevent overflow */
  .option-label {
    flex-shrink: 0;
    white-space: nowrap;
  }

  /* Creator rows: stack vertically with proper alignment */
  .creator-row {
    flex-direction: column;
    align-items: stretch;
    width: 100%;
    gap: 6px;
  }
  .creator-label {
    width: auto;
    text-align: left;
    margin-bottom: 2px;
  }

  .media-grid { grid-template-columns: 1fr; }
  .feedback-entry { flex-wrap: wrap; }

  /* Ensure form elements don't overflow */
  .input-field, .input-select, textarea, input, select {
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
  }

  /* Fix btn-row on mobile */
  .btn-row {
    width: 100%;
    flex-wrap: wrap;
  }
  .btn-row button, .btn-row .btn-primary, .btn-row .btn-secondary {
    flex: 1 1 auto;
    min-width: 120px;
  }

  /* Ensure output areas don't overflow */
  .output-area { max-width: 100%; word-wrap: break-word; overflow-wrap: break-word; }

  /* Reference upload row fix */
  .ref-upload-row { flex-wrap: wrap; }

  /* Model wrapper (video model + bypassed badge) */
  .sb-model-wrapper {
    flex-wrap: wrap;
    gap: 6px;
  }

  /* Bypassed notice: full width on mobile */
  .sb-bypassed-notice {
    width: 100%;
    margin-top: 8px;
  }

  /* Sub-heading spacing */
  .sub-heading {
    margin-top: 16px;
  }

  /* Native audio header: stack vertically on mobile */
  .kling-audio-header,
  .veo-settings-header {
    flex-direction: column !important;
    align-items: flex-start !important;
    justify-content: flex-start !important;
    gap: 6px !important;
  }

  /* Checkbox label row: allow wrapping, override nowrap */
  .kling-audio-header .checkbox-label,
  .veo-settings-header .checkbox-label {
    display: flex !important;
    flex-direction: row !important;
    flex-wrap: wrap !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 6px !important;
    width: auto !important;
    white-space: normal !important;
  }

  /* Text inside checkbox labels: allow wrapping */
  .kling-audio-header .checkbox-label span,
  .veo-settings-header .checkbox-label span {
    white-space: normal !important;
  }

  /* Badges: smaller on mobile, allow wrapping to next line */
  .kling-audio-header .kling-audio-badge,
  .veo-settings-header .veo-badge {
    font-size: 10px !important;
    padding: 2px 6px !important;
    margin-left: 0 !important;
    white-space: nowrap !important;
  }

  /* Persona badge: on its own line below */
  .kling-audio-header .persona-influence-badge,
  .veo-settings-header .persona-influence-badge {
    font-size: 10px !important;
    padding: 2px 6px !important;
    margin-left: 0 !important;
    white-space: nowrap !important;
  }

  /* Music duration mode: stack radio buttons vertically on mobile */
  .music-duration-mode {
    flex-direction: column !important;
    gap: 10px !important;
    align-items: flex-start !important;
  }

  .music-duration-mode label {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    white-space: nowrap !important;
  }
}

/* ---- Auth & Subscription Screens ---- */
.auth-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  justify-content: center;
  background: var(--bg-body);
  overflow-y: auto;
  padding: 24px 16px;
}
.auth-overlay.hidden { display: none; }

/* Stacked layout wrapper — video + login card same width */
.auth-layout {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
  width: 100%;
  max-width: 400px;
  margin: auto;
}

/* Preview video panel — inherits layout max-width */
.auth-preview {
  width: 100%;
}
.auth-preview-inner {
  position: relative;
  width: 100%;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  border: 1px solid rgba(97, 175, 239, 0.2);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.4), 0 0 60px rgba(97, 175, 239, 0.08);
}
.auth-preview-inner video {
  width: 100%;
  display: block;
}
.auth-preview-inner video[src=""],
.auth-preview-inner video:not([src]) {
  display: none;
}
.auth-preview-empty {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--fg-muted);
  font-size: 0.9rem;
}
.auth-preview-empty.hidden { display: none; }
.auth-preview-empty-icon {
  font-size: 2rem;
  opacity: 0.3;
}
.auth-preview-caption {
  text-align: center;
  color: var(--fg-muted);
  font-size: 0.8rem;
  margin-top: 12px;
  opacity: 0.7;
}

/* ---- Login Feature Badges ---- */

.auth-feature-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-top: 14px;
  padding: 0 4px;
}

.auth-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 5px 12px;
  border-radius: 20px;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.3px;
  white-space: nowrap;
  border: 1px solid;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.auth-badge:hover {
  transform: translateY(-2px);
}

.auth-badge-blue {
  color: #7ec8f0;
  background: rgba(97, 175, 239, 0.12);
  border-color: rgba(97, 175, 239, 0.25);
  box-shadow: 0 0 8px rgba(97, 175, 239, 0.1);
}
.auth-badge-blue:hover { box-shadow: 0 0 14px rgba(97, 175, 239, 0.25); }

.auth-badge-purple {
  color: #b09cf5;
  background: rgba(167, 139, 250, 0.12);
  border-color: rgba(167, 139, 250, 0.25);
  box-shadow: 0 0 8px rgba(167, 139, 250, 0.1);
}
.auth-badge-purple:hover { box-shadow: 0 0 14px rgba(167, 139, 250, 0.25); }

.auth-badge-teal {
  color: #5ec4b6;
  background: rgba(94, 196, 182, 0.12);
  border-color: rgba(94, 196, 182, 0.25);
  box-shadow: 0 0 8px rgba(94, 196, 182, 0.1);
}
.auth-badge-teal:hover { box-shadow: 0 0 14px rgba(94, 196, 182, 0.25); }

.auth-badge-green {
  color: #7ccf8e;
  background: rgba(124, 207, 142, 0.12);
  border-color: rgba(124, 207, 142, 0.25);
  box-shadow: 0 0 8px rgba(124, 207, 142, 0.1);
}
.auth-badge-green:hover { box-shadow: 0 0 14px rgba(124, 207, 142, 0.25); }

.auth-badge-orange {
  color: #e8a86d;
  background: rgba(232, 168, 109, 0.12);
  border-color: rgba(232, 168, 109, 0.25);
  box-shadow: 0 0 8px rgba(232, 168, 109, 0.1);
}
.auth-badge-orange:hover { box-shadow: 0 0 14px rgba(232, 168, 109, 0.25); }

.auth-badge-pink {
  color: #e88aaf;
  background: rgba(232, 138, 175, 0.12);
  border-color: rgba(232, 138, 175, 0.25);
  box-shadow: 0 0 8px rgba(232, 138, 175, 0.1);
}
.auth-badge-pink:hover { box-shadow: 0 0 14px rgba(232, 138, 175, 0.25); }

.auth-badge-gold {
  color: #e8cf6d;
  background: rgba(232, 207, 109, 0.12);
  border-color: rgba(232, 207, 109, 0.25);
  box-shadow: 0 0 8px rgba(232, 207, 109, 0.1);
}
.auth-badge-gold:hover { box-shadow: 0 0 14px rgba(232, 207, 109, 0.25); }

.auth-badge-red {
  color: #f07878;
  background: rgba(240, 120, 120, 0.12);
  border-color: rgba(240, 120, 120, 0.25);
  box-shadow: 0 0 8px rgba(240, 120, 120, 0.1);
}
.auth-badge-red:hover { box-shadow: 0 0 14px rgba(240, 120, 120, 0.25); }

/* Admin preview video management */
.admin-preview-video-box { margin-bottom: 8px; }
.admin-preview-video-box.hidden { display: none; }
.admin-preview-meta {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-top: 4px;
}
.admin-hint {
  font-size: 0.8rem;
  color: var(--fg-muted);
  margin-bottom: 12px;
}

/* Subscription paywall - blurred backdrop */
.auth-overlay.subscription-paywall {
  background: rgba(10, 12, 18, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  justify-content: center;
  align-items: center;
}

.auth-overlay.subscription-paywall .auth-card {
  background: rgba(20, 25, 35, 0.95);
  border: 1px solid rgba(97, 175, 239, 0.3);
  box-shadow:
    0 0 40px rgba(97, 175, 239, 0.15),
    0 20px 60px rgba(0, 0, 0, 0.5);
  max-width: 420px;
}

.auth-overlay.subscription-paywall h1 {
  font-size: 1.75rem;
  margin-bottom: 12px;
}

.auth-overlay.subscription-paywall .auth-subtitle {
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 24px;
}

.auth-card {
  background: var(--bg-content);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 20px 32px 40px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  margin: auto;
}
.auth-card h1 {
  color: var(--fg-accent);
  font-size: 1.5rem;
  margin-bottom: 8px;
}

/* Frosted Glass Logo Container - 3:2 aspect ratio */
.auth-logo-container {
  position: relative;
  width: 280px;
  height: 187px;
  margin: 0 auto 24px;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(20, 25, 35, 0.6);
  box-shadow:
    0 4px 24px rgba(0, 0, 0, 0.3),
    inset 0 0 0 1px rgba(150, 180, 220, 0.15);
}

.auth-logo {
  position: relative;
  z-index: 2;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
}

/* Realistic frost particles creeping from edges */
.auth-logo-frost-particles {
  position: absolute;
  inset: 0;
  z-index: 3;
  pointer-events: none;
  border-radius: 16px;
  /* Frost crystal clusters in corners */
  background:
    /* Top-left corner frost crystals */
    radial-gradient(circle at 5% 8%, rgba(200, 220, 255, 0.6) 0%, rgba(200, 220, 255, 0.3) 2%, transparent 4%),
    radial-gradient(circle at 8% 5%, rgba(180, 210, 255, 0.5) 0%, transparent 3%),
    radial-gradient(circle at 3% 15%, rgba(220, 235, 255, 0.4) 0%, transparent 3%),
    radial-gradient(circle at 12% 3%, rgba(190, 215, 255, 0.5) 0%, transparent 2%),
    radial-gradient(circle at 6% 20%, rgba(200, 225, 255, 0.35) 0%, transparent 2%),
    radial-gradient(circle at 15% 8%, rgba(210, 225, 255, 0.4) 0%, transparent 2.5%),
    radial-gradient(circle at 2% 25%, rgba(180, 205, 240, 0.3) 0%, transparent 2%),
    /* Top-right corner frost crystals */
    radial-gradient(circle at 95% 6%, rgba(190, 215, 255, 0.55) 0%, rgba(190, 215, 255, 0.25) 2%, transparent 4%),
    radial-gradient(circle at 92% 12%, rgba(200, 220, 255, 0.45) 0%, transparent 3%),
    radial-gradient(circle at 98% 18%, rgba(180, 210, 255, 0.4) 0%, transparent 2.5%),
    radial-gradient(circle at 88% 5%, rgba(210, 230, 255, 0.5) 0%, transparent 2%),
    radial-gradient(circle at 96% 22%, rgba(195, 220, 255, 0.35) 0%, transparent 2%),
    /* Bottom-left corner frost crystals */
    radial-gradient(circle at 4% 92%, rgba(200, 220, 255, 0.5) 0%, rgba(200, 220, 255, 0.2) 2%, transparent 3.5%),
    radial-gradient(circle at 10% 96%, rgba(185, 210, 255, 0.45) 0%, transparent 2.5%),
    radial-gradient(circle at 6% 85%, rgba(210, 225, 255, 0.4) 0%, transparent 2%),
    radial-gradient(circle at 15% 94%, rgba(195, 215, 255, 0.35) 0%, transparent 2%),
    radial-gradient(circle at 2% 80%, rgba(180, 205, 240, 0.3) 0%, transparent 2%),
    /* Bottom-right corner frost crystals */
    radial-gradient(circle at 96% 94%, rgba(195, 218, 255, 0.5) 0%, rgba(195, 218, 255, 0.2) 2%, transparent 3.5%),
    radial-gradient(circle at 90% 98%, rgba(205, 225, 255, 0.45) 0%, transparent 2.5%),
    radial-gradient(circle at 94% 88%, rgba(185, 210, 255, 0.4) 0%, transparent 2%),
    radial-gradient(circle at 85% 95%, rgba(200, 220, 255, 0.35) 0%, transparent 2%),
    radial-gradient(circle at 98% 82%, rgba(175, 200, 235, 0.3) 0%, transparent 2%),
    /* Scattered frost specks along edges */
    radial-gradient(circle at 25% 2%, rgba(200, 220, 255, 0.25) 0%, transparent 1.5%),
    radial-gradient(circle at 40% 3%, rgba(190, 215, 255, 0.2) 0%, transparent 1%),
    radial-gradient(circle at 60% 2%, rgba(205, 225, 255, 0.22) 0%, transparent 1.2%),
    radial-gradient(circle at 75% 3%, rgba(195, 218, 255, 0.2) 0%, transparent 1%),
    radial-gradient(circle at 2% 40%, rgba(200, 220, 255, 0.22) 0%, transparent 1.2%),
    radial-gradient(circle at 3% 60%, rgba(190, 215, 255, 0.2) 0%, transparent 1%),
    radial-gradient(circle at 97% 45%, rgba(205, 225, 255, 0.22) 0%, transparent 1.2%),
    radial-gradient(circle at 98% 65%, rgba(195, 218, 255, 0.2) 0%, transparent 1%),
    radial-gradient(circle at 30% 98%, rgba(200, 220, 255, 0.22) 0%, transparent 1.2%),
    radial-gradient(circle at 55% 97%, rgba(190, 215, 255, 0.2) 0%, transparent 1%),
    radial-gradient(circle at 70% 98%, rgba(205, 225, 255, 0.22) 0%, transparent 1.2%);
}

/* Subtle glassy shine - very light */
.auth-logo-container::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: 4;
  border-radius: 16px;
  background: linear-gradient(
    145deg,
    rgba(255, 255, 255, 0.06) 0%,
    rgba(255, 255, 255, 0.02) 40%,
    transparent 60%
  );
  pointer-events: none;
}

/* Soft outer glow */
.auth-logo-container::after {
  content: '';
  position: absolute;
  inset: -3px;
  z-index: 1;
  border-radius: 19px;
  background: radial-gradient(
    ellipse at center,
    rgba(97, 175, 239, 0.15) 0%,
    rgba(97, 175, 239, 0.05) 50%,
    transparent 70%
  );
  filter: blur(6px);
}

.auth-subtitle {
  color: var(--fg-muted);
  font-size: 0.95rem;
  margin-top: 0;
  margin-bottom: 28px;
}
.auth-card input[type="email"],
.auth-card input[type="password"],
.auth-card input[type="text"] {
  width: 100%;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: var(--bg-entry);
  color: var(--fg-entry);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
}
.auth-card input:focus {
  outline: none;
  border-color: var(--fg-accent);
}
.btn-primary {
  display: inline-block;
  width: 100%;
  padding: 12px;
  background: var(--fg-accent);
  color: #000;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}
.btn-primary:hover { opacity: 0.85; }

.btn-secondary {
  display: inline-block;
  padding: 10px;
  background: var(--bg-button);
  color: var(--fg-text);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-secondary:hover { background: var(--bg-button-hover); }

.auth-toggle {
  margin-top: 16px;
  color: var(--fg-muted);
  font-size: 0.85rem;
}
.auth-toggle a {
  color: var(--fg-accent);
  text-decoration: none;
}
.auth-toggle a:hover { text-decoration: underline; }

.auth-error {
  background: rgba(224, 108, 117, 0.15);
  color: var(--fg-error);
  border: 1px solid rgba(224, 108, 117, 0.3);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}

.auth-divider {
  display: flex;
  align-items: center;
  margin: 16px 0;
  color: var(--fg-muted);
  font-size: 0.8rem;
}
.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--bg-card-border);
}
.auth-divider span { padding: 0 12px; }

@media (max-width: 768px) {
  .auth-overlay { padding: 16px 12px; }
  .auth-preview { max-width: 100%; }
  .auth-card { padding: 28px 20px; max-width: 100%; }
  .auth-feature-badges { gap: 6px; margin-top: 10px; }
  .auth-badge { font-size: 0.65rem; padding: 4px 9px; }
}

/* ---- Tutorial Overlay ---- */
.tutorial-overlay {
  position: fixed;
  inset: 0;
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
}
.tutorial-overlay.hidden { display: none; }

.tutorial-card {
  background: var(--bg-content);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 32px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
}

.tutorial-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 24px;
  cursor: pointer;
  transition: color 0.2s;
}
.tutorial-close:hover { color: var(--fg-text); }

.tutorial-header {
  text-align: center;
  margin-bottom: 24px;
}
.tutorial-header h2 {
  color: var(--fg-accent);
  font-size: 1.5rem;
  margin-bottom: 8px;
}
.tutorial-header p {
  color: var(--fg-muted);
  font-size: 0.95rem;
}

/* Progress steps */
.tutorial-progress {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 28px;
  flex-wrap: wrap;
}
.tutorial-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: opacity 0.2s;
}
.tutorial-step:hover { opacity: 0.8; }
.tutorial-step span {
  font-size: 11px;
  color: var(--fg-muted);
}
.tutorial-step.active span { color: var(--fg-accent); }
.tutorial-step.completed span { color: var(--fg-success); }

.step-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--bg-button);
  border: 2px solid var(--bg-card-border);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  color: var(--fg-muted);
  transition: all 0.2s;
}
.tutorial-step.active .step-circle {
  border-color: var(--fg-accent);
  color: var(--fg-accent);
  background: rgba(97, 175, 239, 0.1);
}
.tutorial-step.completed .step-circle {
  border-color: var(--fg-success);
  background: var(--fg-success);
  color: #000;
}
.tutorial-step.completed .step-circle::after {
  content: '\2713';
}

.tutorial-connector {
  width: 24px;
  height: 2px;
  background: var(--bg-card-border);
  margin: 0 4px;
}
.tutorial-connector.completed { background: var(--fg-success); }

/* Step content */
.tutorial-content {
  padding: 20px;
  background: rgba(255,255,255,0.02);
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
}
.tutorial-content.hidden { display: none; }

.tutorial-content h3 {
  color: var(--fg-text);
  font-size: 1.1rem;
  margin-bottom: 12px;
}
.tutorial-content > p {
  color: var(--fg-muted);
  font-size: 0.9rem;
  margin-bottom: 16px;
  line-height: 1.5;
}

/* Checklist */
.tutorial-checklist {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
}
.checklist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-button);
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  transition: all 0.2s;
}
.checklist-item.completed {
  border-color: var(--fg-success);
  background: rgba(106, 191, 105, 0.08);
}
.check-icon {
  font-size: 16px;
  color: var(--fg-muted);
  min-width: 20px;
  text-align: center;
}
.checklist-item.completed .check-icon {
  color: var(--fg-success);
}
.checklist-item.completed .check-icon::after {
  content: '\2713';
}
.checklist-item span {
  font-size: 0.9rem;
  color: var(--fg-text);
}

.tutorial-hint {
  font-size: 0.85rem;
  color: var(--fg-muted);
  font-style: italic;
  margin-top: 12px;
}

/* Actions */
.tutorial-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.tutorial-actions .btn-primary,
.tutorial-actions .btn-secondary {
  flex: 1;
  min-width: 120px;
  text-align: center;
}
.tutorial-actions .btn-success {
  background: var(--fg-success);
}

/* Footer */
.tutorial-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-top: 16px;
  border-top: 1px solid var(--bg-card-border);
  font-size: 0.85rem;
}
.tutorial-footer a {
  color: var(--fg-muted);
  text-decoration: none;
}
.tutorial-footer a:hover {
  color: var(--fg-accent);
  text-decoration: underline;
}

/* Tutorial Choice Cards (Frost Bites vs BYOK) */
.tutorial-choice-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 20px 0;
}
.choice-card {
  background: var(--bg-card);
  border: 2px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 24px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}
.choice-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}
.choice-card.selected {
  border-width: 2px;
}
.choice-card.frost-choice {
  border-color: rgba(97, 175, 239, 0.3);
}
.choice-card.frost-choice:hover,
.choice-card.frost-choice.selected {
  border-color: #61afef;
  background: linear-gradient(135deg, rgba(97, 175, 239, 0.1), rgba(97, 175, 239, 0.05));
}
.choice-card.byok-choice {
  border-color: rgba(152, 195, 121, 0.3);
}
.choice-card.byok-choice:hover,
.choice-card.byok-choice.selected {
  border-color: #98c379;
  background: linear-gradient(135deg, rgba(152, 195, 121, 0.1), rgba(152, 195, 121, 0.05));
}
.choice-card .choice-icon {
  font-size: 2.5rem;
  margin-bottom: 12px;
}
.choice-card h4 {
  margin: 0 0 8px 0;
  font-size: 1.1rem;
  color: var(--fg-text);
}
.choice-card > p {
  margin: 0 0 12px 0;
  font-size: 0.9rem;
  color: var(--fg-muted);
}
.choice-benefits {
  list-style: none;
  padding: 0;
  margin: 0;
  text-align: left;
  font-size: 0.85rem;
}
.choice-benefits li {
  padding: 4px 0;
  color: var(--fg-muted);
}
.choice-benefits li::before {
  content: "✓ ";
  color: var(--fg-success);
}

/* Tutorial Mode Status */
.tutorial-mode-status {
  background: var(--bg-button);
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  margin-top: 16px;
  text-align: center;
  font-size: 0.95rem;
  color: var(--fg-text);
}

/* Tutorial DNA Visual - Helix Flowchart */
.tutorial-dna-visual {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 16px;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.08), rgba(97, 175, 239, 0.08));
  border-radius: var(--radius);
  margin: 16px 0;
  position: relative;
  overflow: hidden;
}

/* DNA Helix Container */
.dna-helix {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0;
  position: relative;
}

/* Input nodes on alternating sides */
.dna-input {
  display: flex;
  align-items: center;
  gap: 12px;
  position: relative;
  padding: 8px 0;
}
.dna-input:nth-child(odd) { flex-direction: row; }
.dna-input:nth-child(even) { flex-direction: row-reverse; }

.dna-input .dna-node {
  background: var(--bg-button);
  border: 2px solid;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
}
.dna-input:nth-child(1) .dna-node { border-color: #e06c75; color: #e06c75; }
.dna-input:nth-child(2) .dna-node { border-color: #61afef; color: #61afef; }
.dna-input:nth-child(3) .dna-node { border-color: #98c379; color: #98c379; }

/* Helix connectors - curved lines */
.dna-connector {
  width: 40px;
  height: 2px;
  background: linear-gradient(90deg, var(--fg-muted), transparent);
  position: relative;
}
.dna-input:nth-child(even) .dna-connector {
  background: linear-gradient(90deg, transparent, var(--fg-muted));
}

/* Center spine - stops before the arrow/result */
.dna-spine {
  position: absolute;
  left: 50%;
  top: 0;
  height: calc(100% - 70px);
  width: 3px;
  background: linear-gradient(180deg, #e06c75, #61afef, #98c379, #a78bfa);
  transform: translateX(-50%);
  border-radius: 2px;
}

/* Arrow pointing down */
.dna-arrow {
  font-size: 1.5rem;
  color: #a78bfa;
  margin: 8px 0;
  animation: dna-arrow-pulse 1.5s ease-in-out infinite;
}
@keyframes dna-arrow-pulse {
  0%, 100% { transform: translateY(0); opacity: 0.7; }
  50% { transform: translateY(4px); opacity: 1; }
}

/* Result node */
.dna-result {
  background: linear-gradient(135deg, #a78bfa, #61afef);
  border-radius: 24px;
  padding: 12px 24px;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  box-shadow: 0 4px 20px rgba(167, 139, 250, 0.3);
  animation: dna-glow 2s ease-in-out infinite;
}
@keyframes dna-glow {
  0%, 100% { box-shadow: 0 4px 20px rgba(167, 139, 250, 0.3); }
  50% { box-shadow: 0 4px 30px rgba(167, 139, 250, 0.5), 0 0 40px rgba(97, 175, 239, 0.2); }
}

/* Description labels */
.dna-desc {
  font-size: 0.7rem;
  color: var(--fg-muted);
  max-width: 80px;
  text-align: center;
  line-height: 1.2;
}

/* Tutorial Feature Grid (Storyboard features) */
.tutorial-feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
  margin: 16px 0;
}
.feature-mini {
  background: var(--bg-button);
  border-radius: var(--radius-sm);
  padding: 16px 12px;
  text-align: center;
}
.feature-mini .feature-icon {
  font-size: 1.5rem;
  margin-bottom: 8px;
}
.feature-mini .feature-label {
  font-size: 0.85rem;
  color: var(--fg-muted);
}

@media (max-width: 600px) {
  .tutorial-card {
    margin: 12px;
    padding: 20px;
  }
  .tutorial-progress {
    gap: 4px;
  }
  .tutorial-connector {
    width: 12px;
  }
  .step-circle {
    width: 28px;
    height: 28px;
    font-size: 12px;
  }
  .tutorial-actions {
    flex-direction: column;
  }
  .tutorial-choice-cards {
    grid-template-columns: 1fr;
  }
  .choice-card {
    padding: 20px 16px;
  }
  .tutorial-feature-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ---- Account Panel ---- */
.account-section {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
}
.account-info-grid {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.account-info-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: var(--bg-button);
  border-radius: var(--radius-sm);
}
.account-label {
  color: var(--fg-muted);
  font-size: 0.9rem;
}
.account-value {
  color: var(--fg-text);
  font-weight: 500;
}
.account-value.active {
  color: var(--fg-success);
}
.account-value.trial {
  color: var(--fg-warning);
}
.account-value.inactive {
  color: var(--fg-error);
}

/* ---- API Key Mode Toggle ---- */
.api-mode-section {
  background: linear-gradient(135deg, rgba(97, 175, 239, 0.08), rgba(167, 139, 250, 0.08));
  border-color: rgba(97, 175, 239, 0.2);
}

.api-mode-toggle-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
}

.api-mode-info {
  flex: 1;
}

.api-mode-desc {
  color: var(--fg-muted);
  font-size: 0.85rem;
  margin: 0;
}

.api-mode-switch {
  display: flex;
  gap: 8px;
  background: rgba(0, 0, 0, 0.2);
  padding: 4px;
  border-radius: var(--radius);
}

.api-mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 12px 20px;
  background: transparent;
  border: 2px solid transparent;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 100px;
}

.api-mode-btn .mode-icon {
  font-size: 1.5rem;
}

.api-mode-btn .mode-label {
  font-weight: 600;
  font-size: 0.85rem;
  color: var(--fg-text);
}

.api-mode-btn .mode-hint {
  font-size: 0.7rem;
  color: var(--fg-muted);
}

.api-mode-btn:hover {
  background: rgba(255, 255, 255, 0.05);
}

.api-mode-btn.active {
  background: var(--bg-card);
  border-color: var(--fg-accent);
  box-shadow: 0 0 12px rgba(97, 175, 239, 0.3);
}

.api-mode-btn.active .mode-label {
  color: var(--fg-accent);
}

#api-mode-frost.active {
  border-color: #61afef;
}

#api-mode-frost.active .mode-icon {
  color: #61afef;
}

#api-mode-byok.active {
  border-color: #e5c07b;
}

#api-mode-byok.active .mode-icon {
  color: #e5c07b;
}

.api-mode-status {
  margin-top: 12px;
  padding: 10px 14px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
}

.api-mode-status p {
  margin: 0;
  color: var(--fg-muted);
}

.api-mode-status .frost-mode {
  color: #61afef;
}

.api-mode-status .byok-mode {
  color: #e5c07b;
}

.api-mode-status .warning {
  color: var(--fg-warning);
}

@media (max-width: 600px) {
  .api-mode-toggle-container {
    flex-direction: column;
    text-align: center;
  }

  .api-mode-switch {
    width: 100%;
  }

  .api-mode-btn {
    flex: 1;
    padding: 10px;
  }
}

/* ---- Forgot Password ---- */
.auth-forgot {
  margin-top: 12px;
  text-align: center;
  font-size: 0.85rem;
}
.auth-forgot a {
  color: var(--fg-muted);
  text-decoration: none;
}
.auth-forgot a:hover {
  color: var(--fg-accent);
  text-decoration: underline;
}

/* Auth Links (About/Explore on login page) */
.auth-link-btn {
  padding: 12px 28px;
  background: linear-gradient(135deg, rgba(97, 175, 239, 0.15), rgba(167, 139, 250, 0.15));
  color: #e6e6e6;
  border: 1px solid rgba(97, 175, 239, 0.4);
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.3s ease;
  box-shadow: 0 0 15px rgba(97, 175, 239, 0.1), inset 0 1px 0 rgba(255, 255, 255, 0.05);
  position: relative;
  overflow: hidden;
}
.auth-link-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
  transition: left 0.5s ease;
}
.auth-link-btn:hover::before {
  left: 100%;
}
.auth-link-btn:hover {
  color: #fff;
  border-color: rgba(167, 139, 250, 0.6);
  background: linear-gradient(135deg, rgba(97, 175, 239, 0.25), rgba(167, 139, 250, 0.25));
  box-shadow: 0 0 25px rgba(97, 175, 239, 0.2), 0 0 40px rgba(167, 139, 250, 0.15), inset 0 1px 0 rgba(255, 255, 255, 0.1);
  transform: translateY(-2px);
}
.auth-link-btn-compact {
  display: inline-block;
  margin-top: 12px;
  padding: 6px 48px;
  font-size: 0.78rem;
}

.auth-success {
  background: rgba(106, 191, 105, 0.15);
  color: var(--fg-success);
  border: 1px solid rgba(106, 191, 105, 0.3);
  border-radius: var(--radius-sm);
  padding: 8px 12px;
  margin-bottom: 16px;
  font-size: 0.85rem;
}

/* ---- LoRA Training ---- */
.lora-section {
  margin-top: 16px;
}

.lora-models {
  margin-bottom: 20px;
}

.lora-model-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-entry);
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  border: 1px solid transparent;
}

.lora-model-item.active {
  border-color: var(--fg-success);
  background: rgba(106, 191, 105, 0.1);
}

.lora-model-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lora-model-name {
  font-weight: 600;
  color: var(--fg-text);
}

.lora-model-trigger {
  font-size: 0.85rem;
  color: var(--fg-muted);
}

.lora-model-trigger code {
  background: var(--bg-card);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--fg-accent);
}

.lora-model-date {
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.lora-model-actions .btn-active {
  background: var(--fg-success);
  color: var(--bg-body);
}

.lora-gender-setting {
  margin: 16px 0;
  padding: 12px 16px;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lora-gender-setting label {
  font-weight: 500;
  white-space: nowrap;
}

.lora-gender-setting select {
  min-width: 150px;
}

.lora-gender-setting .hint {
  flex: 1;
  min-width: 200px;
}

.lora-training-form {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 20px;
}

.lora-images-preview {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.lora-preview-thumb {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.lora-preview-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.lora-preview-more {
  width: 60px;
  height: 60px;
  border-radius: var(--radius-sm);
  background: var(--bg-entry);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  color: var(--fg-muted);
}

.lora-upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.lora-training-form .form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

@media (max-width: 600px) {
  .lora-training-form .form-row {
    grid-template-columns: 1fr;
  }
}

#lora-training-status {
  margin-top: 12px;
}

#lora-training-status.info {
  color: var(--fg-accent);
}

#lora-training-status.success {
  color: var(--fg-success);
}

#lora-training-status.error {
  color: var(--fg-error);
}

/* ---- Voice Clone (ElevenLabs) ---- */
.voice-clone-section {
  margin-top: 16px;
}

.voice-clone-status {
  margin-bottom: 16px;
}

.voice-clone-active {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: rgba(106, 191, 105, 0.1);
  border: 1px solid var(--fg-success);
  border-radius: var(--radius-sm);
}

.voice-name {
  font-weight: 600;
  color: var(--fg-text);
}

.voice-clone-form {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 20px;
}

.voice-samples-selection {
  margin-bottom: 16px;
}

.voice-samples-selection label {
  display: block;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--fg-text);
}

.voice-samples-list {
  max-height: 200px;
  overflow-y: auto;
  background: var(--bg-entry);
  border-radius: var(--radius-sm);
  padding: 8px;
}

.voice-sample-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  cursor: pointer;
  border-radius: var(--radius-sm);
}

.voice-sample-item:hover {
  background: rgba(97, 175, 239, 0.1);
}

.voice-sample-item input {
  margin: 0;
}

.voice-sample-name {
  flex: 1;
  font-size: 13px;
  color: var(--fg-text);
}

.voice-sample-duration {
  font-size: 12px;
  color: var(--fg-muted);
}

.voice-test-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--bg-card-border);
}

.voice-test-section h4 {
  margin: 0 0 12px 0;
  font-size: 14px;
  color: var(--fg-muted);
}

#voice-clone-training-status {
  margin-top: 12px;
}

/* Voice Settings Grid (TTS parameters) */
.voice-settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.voice-setting {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.voice-setting label {
  font-size: 13px;
  color: var(--fg-muted);
  display: flex;
  justify-content: space-between;
}

.voice-setting label span {
  font-weight: 600;
  color: var(--fg-accent);
}

.voice-setting input[type="range"] {
  width: 100%;
  height: 8px;
  -webkit-appearance: none;
  appearance: none;
  background: linear-gradient(90deg, rgba(97, 175, 239, 0.3), rgba(97, 175, 239, 0.15));
  border-radius: 4px;
  cursor: pointer;
  outline: none;
}

.voice-setting input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #61afef, #4d8fd4);
  border-radius: 50%;
  cursor: grab;
  border: 2px solid var(--bg-card);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}

.voice-setting input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 10px rgba(97, 175, 239, 0.4);
}

.voice-setting input[type="range"]::-webkit-slider-thumb:active {
  cursor: grabbing;
}

.voice-setting input[type="range"]::-moz-range-thumb {
  width: 20px;
  height: 20px;
  background: linear-gradient(135deg, #61afef, #4d8fd4);
  border-radius: 50%;
  cursor: grab;
  border: 2px solid var(--bg-card);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.voice-setting input[type="range"]::-moz-range-track {
  height: 8px;
  background: linear-gradient(90deg, rgba(97, 175, 239, 0.3), rgba(97, 175, 239, 0.15));
  border-radius: 4px;
}

.voice-setting .hint {
  font-size: 11px;
  color: var(--fg-muted);
  opacity: 0.7;
}

/* ============================================
   Voiceover & Dubbing Modals (Overlay Style)
   ============================================ */
.video-preview-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.video-preview-overlay .video-preview-backdrop {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
}

.video-preview-overlay .video-preview-content {
  position: relative;
  z-index: 1;
  background: var(--bg-card);
  border-radius: 16px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}

.video-preview-overlay .video-preview-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--fg-muted);
  font-size: 20px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
}

.video-preview-overlay .video-preview-close:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--fg-text);
}

/* Voiceover Modal Content */
.voiceover-modal-content {
  max-width: 520px;
  width: 100%;
  padding: 24px;
}

.voiceover-modal-content h3 {
  margin: 0 0 8px;
  padding-right: 40px;
  color: var(--fg-text);
  font-size: 20px;
}

.voiceover-modal-content > .hint {
  margin-bottom: 20px;
  display: block;
}

.voiceover-form .form-group {
  margin-bottom: 16px;
}

.voiceover-form label {
  display: block;
  margin-bottom: 6px;
  font-size: 13px;
  color: var(--fg-muted);
}

/* Modal voice settings grid */
.voiceover-modal-content .voice-settings-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
  background: var(--bg-dark);
  padding: 16px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.voiceover-modal-content .voice-setting {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.voiceover-modal-content .voice-setting label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--fg-text);
  margin-bottom: 0;
}

.voiceover-modal-content .voice-setting label span {
  color: var(--fg-accent);
  font-weight: 600;
}

.voiceover-modal-content .btn-row {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-light);
}

/* ---- Audio Studio ---- */
.audio-studio {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  margin: 16px 0;
  overflow: hidden;
}

.studio-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 1px solid var(--bg-card-border);
  background: var(--bg-secondary);
}

.studio-tab {
  flex: 1;
  min-width: 120px;
  padding: 12px 16px;
  border: none;
  background: transparent;
  color: var(--fg-muted);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.studio-tab:hover {
  background: var(--bg-card);
  color: var(--fg-primary);
}

.studio-tab.active {
  background: var(--bg-card);
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.studio-tab .tab-icon {
  font-size: 20px;
}

.studio-tab .tab-label {
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.studio-panels {
  padding: 0;
}

.studio-panel {
  display: none;
  padding: 20px;
}

.studio-panel.active {
  display: block;
}

.studio-panel .panel-header {
  margin-bottom: 16px;
}

.studio-panel .panel-header h4 {
  margin: 0 0 4px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--fg-primary);
}

.studio-panel .panel-header .hint {
  margin: 0;
  font-size: 13px;
  color: var(--fg-muted);
}

.studio-panel .panel-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.studio-panel .form-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
}

.studio-panel .form-row.four-col {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.studio-panel .form-group {
  flex: 1;
  min-width: 150px;
}

.studio-panel .form-group.flex-2 {
  flex: 2;
  min-width: 300px;
}

.studio-panel .form-group label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-secondary);
  margin-bottom: 6px;
}

.studio-panel .range-val {
  color: var(--accent);
  font-weight: 600;
}

.studio-panel .panel-actions {
  display: flex;
  gap: 12px;
  padding-top: 8px;
}

.studio-panel .panel-actions .btn-primary.loading {
  position: relative;
  color: transparent;
  pointer-events: none;
}

.studio-panel .panel-actions .btn-primary.loading::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 16px;
  height: 16px;
  margin: -8px 0 0 -8px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top-color: white;
  border-radius: 50%;
  animation: spinner 0.6s linear infinite;
}

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

.studio-panel .empty-state {
  text-align: center;
  padding: 24px;
  color: var(--fg-muted);
}

.studio-panel .empty-state .hint {
  margin-top: 8px;
}

.studio-panel .preview-section {
  background: var(--bg-secondary);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 8px;
}

.studio-panel .preview-section label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-secondary);
  margin-bottom: 8px;
}

/* Studio Status & Output */
.studio-status {
  padding: 12px 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--bg-card-border);
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.studio-status.info {
  color: var(--accent);
}

.studio-status.success {
  color: var(--color-success);
}

.studio-status.error {
  color: var(--color-error);
}

.studio-status::before {
  content: "";
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: currentColor;
  animation: pulse 1.5s ease-in-out infinite;
}

.studio-status.success::before,
.studio-status.error::before {
  animation: none;
}

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

.studio-output {
  padding: 20px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--bg-card-border);
}

.studio-output .output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.studio-output .output-header h4 {
  margin: 0;
  font-size: 15px;
  font-weight: 600;
  color: var(--fg-primary);
}

.studio-output .output-actions {
  display: flex;
  gap: 12px;
  margin-top: 12px;
}

/* Script preview in audio output */
.script-preview {
  font-size: 14px;
  line-height: 1.6;
  color: var(--fg-secondary);
  white-space: pre-wrap;
  word-wrap: break-word;
  background: var(--bg-card);
  padding: 12px;
  border-radius: var(--radius);
  margin-top: 12px;
}

/* Responsive adjustments for Audio Studio */
@media (max-width: 768px) {
  .studio-tabs {
    overflow-x: auto;
    flex-wrap: nowrap;
  }

  .studio-tab {
    min-width: 80px;
    padding: 10px 12px;
  }

  .studio-tab .tab-label {
    font-size: 10px;
  }

  .studio-panel .form-row {
    flex-direction: column;
  }

  .studio-panel .form-group.flex-2 {
    min-width: 100%;
  }
}

/* ---- Video Analysis for Creative DNA ---- */
.video-analysis-section {
  margin-top: 16px;
}

.video-analysis-list {
  max-height: 300px;
  overflow-y: auto;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 12px;
  margin-bottom: 16px;
}

.video-analysis-item {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-entry);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
}

.video-analysis-item:last-child {
  margin-bottom: 0;
}

.video-filename {
  flex: 1;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-text);
  min-width: 150px;
}

.video-analysis-details {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  width: 100%;
  margin-top: 6px;
}

.energy-badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
}

.energy-badge.high {
  background: rgba(229, 123, 123, 0.15);
  color: #e57b7b;
}

.energy-badge.medium {
  background: rgba(229, 192, 123, 0.15);
  color: #e5c07b;
}

.energy-badge.low {
  background: rgba(97, 175, 239, 0.15);
  color: var(--fg-accent);
}

.video-analysis-details .themes {
  font-size: 11px;
  color: var(--fg-muted);
  font-style: italic;
}

#video-analysis-status {
  margin-top: 12px;
}

/* ---- Studio Controls ---- */
#studio-controls {
  background: rgba(97, 175, 239, 0.03);
  border: 1px solid rgba(97, 175, 239, 0.1);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 8px;
}

.studio-control {
  margin-bottom: 18px;
}

.studio-control:last-of-type {
  margin-bottom: 12px;
}

.studio-label {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  font-weight: 500;
  color: var(--fg-text);
  margin-bottom: 6px;
  cursor: help;
}

.studio-value {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  color: var(--fg-accent);
  background: rgba(97, 175, 239, 0.1);
  padding: 2px 8px;
  border-radius: 4px;
  min-width: 40px;
  text-align: center;
}

.studio-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg,
    rgba(97, 175, 239, 0.2) 0%,
    rgba(97, 175, 239, 0.4) 50%,
    rgba(167, 139, 250, 0.5) 100%
  );
  outline: none;
  cursor: pointer;
}

.studio-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--fg-accent), var(--fg-accent2));
  cursor: grab;
  border: 2px solid var(--bg-content);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s, box-shadow 0.15s;
}

.studio-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
  box-shadow: 0 3px 10px rgba(97, 175, 239, 0.4);
}

.studio-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.05);
}

.studio-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--fg-accent), var(--fg-accent2));
  cursor: grab;
  border: 2px solid var(--bg-content);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.studio-slider::-moz-range-track {
  height: 8px;
  border-radius: 4px;
  background: linear-gradient(90deg,
    rgba(97, 175, 239, 0.2) 0%,
    rgba(97, 175, 239, 0.4) 50%,
    rgba(167, 139, 250, 0.5) 100%
  );
}

.studio-labels {
  display: flex;
  justify-content: space-between;
  font-size: 10px;
  color: var(--fg-muted);
  margin-top: 4px;
  padding: 0 2px;
}

.studio-reset-row {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
  text-align: center;
}

/* Music selection controls */
.studio-music-section {
  border-top: 1px solid rgba(97, 175, 239, 0.15);
  padding-top: 16px;
  margin-top: 16px;
}

.studio-music-section select {
  margin-top: 6px;
}

.studio-music-timing {
  margin-top: 12px;
  padding: 12px;
  background: rgba(97, 175, 239, 0.05);
  border-radius: var(--radius);
  border: 1px solid rgba(97, 175, 239, 0.1);
}

.music-timing-row {
  display: flex;
  gap: 12px;
}

.music-timing-field {
  flex: 1;
}

.music-timing-field label {
  display: block;
  font-size: 11px;
  color: var(--fg-muted);
  margin-bottom: 4px;
}

.music-timing-field .input-small {
  width: 100%;
  padding: 6px 10px;
  font-size: 13px;
}

.music-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 10px;
  font-size: 11px;
  color: var(--fg-muted);
}

.music-info .btn-tiny {
  padding: 4px 10px;
  font-size: 11px;
  background: rgba(97, 175, 239, 0.15);
  border: 1px solid rgba(97, 175, 239, 0.3);
  color: var(--fg-accent);
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}

.music-info .btn-tiny:hover {
  background: rgba(97, 175, 239, 0.25);
}

/* ---- Audio Waveform Editor ---- */
.music-editor {
  margin-top: 12px;
  padding: 16px;
  background: rgba(0, 0, 0, 0.3);
  border-radius: var(--radius);
  border: 1px solid rgba(97, 175, 239, 0.15);
  /* Constrain width for zoom scrolling to work */
  overflow: hidden;
  max-width: 100%;
  box-sizing: border-box;
}

/* Waveform Audio Options */
.waveform-audio-options {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 24px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.audio-option-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.audio-option-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-right: 4px;
}

.audio-option-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.radio-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--fg-text);
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s;
}

.radio-label:hover {
  background: rgba(97, 175, 239, 0.1);
}

.radio-label input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--fg-accent);
}

.radio-label span {
  white-space: nowrap;
}

.input-select-sm {
  padding: 4px 8px;
  font-size: 13px;
  min-width: 80px;
}

/* Mobile responsive for audio options */
@media (max-width: 768px) {
  .waveform-audio-options {
    flex-direction: column;
    gap: 12px;
  }

  .audio-option-group {
    width: 100%;
  }

  .audio-option-controls {
    gap: 8px;
  }

  .radio-label {
    padding: 6px 10px;
    font-size: 14px;
  }

  .radio-label input[type="radio"] {
    width: 18px;
    height: 18px;
  }

  /* Larger touch targets for mobile waveform handles */
  .selection-handle {
    width: 24px !important;
    min-width: 24px;
    touch-action: none;
  }

  .selection-handle.left {
    margin-left: -12px;
  }

  .selection-handle.right {
    margin-right: -12px;
  }

  .selection-region {
    touch-action: none;
  }

  .waveform-playhead {
    touch-action: none;
  }

  /* Larger hit area pseudo-element on mobile */
  .selection-handle::before {
    content: '';
    position: absolute;
    top: -10px;
    bottom: -10px;
    left: -10px;
    right: -10px;
    background: transparent;
  }
}

.waveform-container {
  position: relative;
  height: 80px;
  background: rgba(0, 0, 0, 0.4);
  border-radius: 4px;
  overflow: hidden;
  cursor: crosshair;
  touch-action: none; /* Prevent page scroll when dragging on mobile */
}

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

.waveform-selection {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.selection-region {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(97, 175, 239, 0.25);
  border-left: 2px solid var(--fg-accent);
  border-right: 2px solid var(--fg-accent);
  pointer-events: auto;
  cursor: move;
  z-index: 15; /* Below handles (20) but above waveform */
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

.selection-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  background: var(--fg-accent);
  cursor: ew-resize;
  pointer-events: auto;
  opacity: 0.9;
  transition: opacity 0.15s, box-shadow 0.15s;
  /* Contrasting border lines for clear boundary indication */
  border-left: 2px solid #fff;
  border-right: 2px solid #fff;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 0 8px rgba(97, 175, 239, 0.5);
}

.selection-handle:hover {
  opacity: 1;
  box-shadow:
    0 0 0 1px rgba(0, 0, 0, 0.5),
    0 0 12px rgba(97, 175, 239, 0.8),
    0 0 20px rgba(97, 175, 239, 0.4);
}

.selection-handle.left {
  border-radius: 4px 0 0 4px;
  border-right: none;
  /* Strong left edge indicator */
  border-left: 3px solid #fff;
}

.selection-handle.right {
  border-radius: 0 4px 4px 0;
  border-left: none;
  /* Strong right edge indicator */
  border-right: 3px solid #fff;
}

.selection-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 2px;
  height: 24px;
  background: rgba(255, 255, 255, 0.7);
  border-radius: 1px;
}

.waveform-playhead {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 2px;
  background: #ff6b6b;
  pointer-events: auto;
  display: none;
  box-shadow: 0 0 6px rgba(255, 107, 107, 0.5);
  cursor: ew-resize;
  z-index: 15;
}

/* Larger hit area for easier dragging */
.waveform-playhead::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  left: -8px;
  width: 18px;
  cursor: ew-resize;
}

.waveform-playhead::before {
  content: '';
  position: absolute;
  top: -6px;
  left: -6px;
  width: 14px;
  height: 14px;
  background: #ff6b6b;
  border-radius: 50%;
  box-shadow: 0 0 8px rgba(255, 107, 107, 0.6);
  cursor: ew-resize;
}

.waveform-playhead:hover::before {
  transform: scale(1.2);
  box-shadow: 0 0 12px rgba(255, 107, 107, 0.8);
}

.waveform-playhead.dragging {
  box-shadow: 0 0 10px rgba(255, 107, 107, 0.8);
}

.waveform-playhead.dragging::before {
  transform: scale(1.3);
  box-shadow: 0 0 15px rgba(255, 107, 107, 1);
}

/* ---- Waveform Zoom Controls ---- */
.waveform-zoom-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  padding: 6px 10px;
  background: rgba(0, 0, 0, 0.25);
  border-radius: 4px;
}

.btn-zoom {
  width: 24px !important;
  height: 24px !important;
  font-size: 16px !important;
  font-weight: bold;
  border-radius: 4px !important;
}

.zoom-slider {
  flex: 1;
  max-width: 120px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(97, 175, 239, 0.2);
  border-radius: 2px;
  outline: none;
}

.zoom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  background: var(--fg-accent);
  border-radius: 50%;
  cursor: pointer;
  transition: transform 0.1s;
}

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

.zoom-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  background: var(--fg-accent);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.zoom-level {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 11px;
  color: var(--fg-accent);
  min-width: 28px;
  text-align: center;
}

.btn-text {
  padding: 4px 8px;
  font-size: 10px;
  background: rgba(97, 175, 239, 0.1);
  border: 1px solid rgba(97, 175, 239, 0.25);
  border-radius: 4px;
  color: var(--fg-muted);
  cursor: pointer;
  transition: all 0.15s;
}

.btn-text:hover {
  background: rgba(97, 175, 239, 0.2);
  color: var(--fg-accent);
}

/* ---- Scrollable Waveform Viewport ---- */
.waveform-viewport {
  position: relative;
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  border-radius: 4px;
  scrollbar-width: thin;
  scrollbar-color: rgba(97, 175, 239, 0.4) rgba(0, 0, 0, 0.3);
  /* Prevent viewport from expanding with content */
  flex-shrink: 0;
  box-sizing: border-box;
}

/* When zoomed, the container expands beyond viewport */
.waveform-viewport .waveform-container {
  min-width: 100%;
  width: auto;
  overflow: visible;
  /* Container width is set via JS based on zoom level */
}

.waveform-viewport::-webkit-scrollbar {
  height: 8px;
}

.waveform-viewport::-webkit-scrollbar-track {
  background: rgba(0, 0, 0, 0.3);
  border-radius: 4px;
}

.waveform-viewport::-webkit-scrollbar-thumb {
  background: rgba(97, 175, 239, 0.4);
  border-radius: 4px;
}

.waveform-viewport::-webkit-scrollbar-thumb:hover {
  background: rgba(97, 175, 239, 0.6);
}

/* ---- Improved Selection Handles ---- */
.selection-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 14px;
  background: linear-gradient(180deg, var(--fg-accent) 0%, rgba(97, 175, 239, 0.8) 100%);
  cursor: ew-resize;
  pointer-events: auto;
  opacity: 1;
  transition: opacity 0.15s, width 0.1s, box-shadow 0.15s;
  z-index: 20; /* Higher z-index to ensure handles are always on top */
  box-shadow: 0 0 8px rgba(97, 175, 239, 0.4);
  touch-action: none; /* Prevent browser touch handling on handles */
  -webkit-user-select: none;
  user-select: none;
}

.selection-handle:hover {
  width: 18px;
  box-shadow: 0 0 12px rgba(97, 175, 239, 0.7), 0 0 20px rgba(97, 175, 239, 0.3);
}

.selection-handle.left {
  border-radius: 6px 0 0 6px;
  margin-left: -7px;
}

.selection-handle.right {
  border-radius: 0 6px 6px 0;
  margin-left: -7px;
}

.selection-handle::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 3px;
  height: 28px;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 2px;
  box-shadow: 0 0 4px rgba(255, 255, 255, 0.5);
}

/* Handle time tooltip */
.handle-time {
  position: absolute;
  top: -24px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: var(--fg-accent);
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 3px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
  z-index: 20;
  border: 1px solid rgba(97, 175, 239, 0.3);
}

.selection-handle:hover .handle-time,
.selection-handle.dragging .handle-time {
  opacity: 1;
}

/* ---- Waveform Grid Lines ---- */
.waveform-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 1;
}

.waveform-grid-line {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 1px;
  background: rgba(255, 255, 255, 0.08);
}

.waveform-grid-line.major {
  background: rgba(255, 255, 255, 0.15);
}

.waveform-grid-line .grid-time {
  position: absolute;
  bottom: 2px;
  left: 2px;
  font-size: 8px;
  color: rgba(255, 255, 255, 0.4);
  font-family: 'Consolas', 'Courier New', monospace;
}

/* ---- Precise Time Display ---- */
.selection-field-precise span {
  font-size: 13px;
  letter-spacing: 0.5px;
}

.time-precise {
  min-width: 50px;
}

.waveform-timeline {
  position: relative;
  height: 16px;
  padding: 4px 0;
  font-size: 10px;
  color: var(--fg-muted);
  user-select: none;
}

.waveform-timeline span {
  position: absolute;
  transform: translateX(-50%);
  white-space: nowrap;
}

.waveform-timeline span:first-child {
  transform: translateX(0);
}

.waveform-timeline span:last-child {
  transform: translateX(-100%);
}

.music-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 8px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.btn-icon {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(97, 175, 239, 0.15);
  border: 1px solid rgba(97, 175, 239, 0.3);
  border-radius: 50%;
  color: var(--fg-accent);
  font-size: 12px;
  cursor: pointer;
  transition: background 0.15s, transform 0.1s;
}

.btn-icon:hover {
  background: rgba(97, 175, 239, 0.25);
  transform: scale(1.05);
}

.btn-icon:active {
  transform: scale(0.95);
}

.music-time {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 12px;
  color: var(--fg-text);
}

.music-time-sep {
  color: var(--fg-muted);
  margin: 0 2px;
}

.music-selection-info {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  padding: 10px;
  background: rgba(97, 175, 239, 0.05);
  border-radius: 4px;
}

.selection-field {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.selection-field label {
  font-size: 10px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.selection-field span {
  font-family: 'Consolas', 'Courier New', monospace;
  font-size: 14px;
  color: var(--fg-accent);
}

.music-duration-mode {
  display: flex;
  gap: 20px;
  margin-top: 12px;
  font-size: 13px;
}

.music-duration-mode label {
  display: flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  color: var(--fg-text);
}

.music-duration-mode input[type="radio"] {
  accent-color: var(--fg-accent);
}

/* ---- Music Video Mode ---- */
.music-video-mode-section {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(97, 175, 239, 0.15);
}

.music-video-toggle {
  margin-bottom: 12px;
}

.music-video-toggle .toggle-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: var(--fg-text);
}

.music-video-toggle .toggle-label:hover {
  color: var(--fg-accent);
}

.music-video-toggle input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--fg-accent);
  cursor: pointer;
}

.music-video-toggle .toggle-text {
  flex: 1;
}

.music-video-toggle .toggle-badge {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 10px;
  background: linear-gradient(135deg, #e5c07b, #d19a66);
  color: var(--bg-primary);
}

.music-video-options {
  padding: 14px;
  background: rgba(229, 192, 123, 0.08);
  border: 1px solid rgba(229, 192, 123, 0.2);
  border-radius: var(--radius);
  animation: fadeIn 0.2s ease-out;
}

.music-video-info {
  font-size: 12px;
  color: var(--fg-muted);
  line-height: 1.5;
  margin-bottom: 14px;
  padding: 10px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
}

.music-video-option-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 12px;
}

.music-video-option-group:last-child {
  margin-bottom: 0;
}

.music-video-option-group label {
  font-size: 11px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.music-video-option-group select,
.music-video-option-group input[type="text"] {
  width: 100%;
}

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

/* ---- Text Overlay Editor ---- */
.studio-text-section {
  border-top: 1px solid rgba(97, 175, 239, 0.15);
  padding-top: 16px;
  margin-top: 16px;
}

.text-overlay-editor {
  margin-top: 8px;
}

.text-overlay-editor .input-field {
  margin-bottom: 12px;
}

.text-overlay-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  margin-bottom: 12px;
}

.text-option-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.text-option-group label {
  font-size: 11px;
  color: var(--fg-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.text-option-group .input-field {
  margin-bottom: 0;
}

.input-color {
  width: 100%;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: var(--bg-entry);
  cursor: pointer;
  padding: 2px;
}

.input-color::-webkit-color-swatch-wrapper {
  padding: 2px;
}

.input-color::-webkit-color-swatch {
  border-radius: 4px;
  border: none;
}

.text-overlay-timing {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  padding: 10px;
  background: rgba(97, 175, 239, 0.05);
  border-radius: 4px;
}

.text-overlay-timing label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--fg-text);
  cursor: pointer;
}

.text-overlay-timing input[type="checkbox"] {
  accent-color: var(--fg-accent);
}

@media (max-width: 480px) {
  .text-overlay-options {
    grid-template-columns: 1fr;
  }
}

/* ---- Kling Audio Settings ---- */
.kling-audio-section {
  background: rgba(139, 92, 246, 0.05);
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 8px;
}

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

.kling-audio-header .checkbox-label {
  font-weight: 500;
  gap: 8px;
}

.kling-audio-badge {
  font-size: 11px;
  color: var(--fg-warning);
  background: rgba(229, 192, 123, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
  margin-left: 8px;
}

.kling-audio-body {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(139, 92, 246, 0.15);
}

.audio-field {
  margin-bottom: 12px;
}

.audio-field:last-child {
  margin-bottom: 0;
}

.audio-field label {
  display: block;
  font-size: 12px;
  color: var(--fg-text);
  margin-bottom: 4px;
  font-weight: 500;
}

.audio-field .optional-tag {
  font-weight: 400;
  color: var(--fg-muted);
  font-size: 11px;
}

.audio-field .input-field {
  width: 100%;
  font-size: 13px;
}

.audio-field textarea.input-field {
  resize: vertical;
  min-height: 50px;
}

.audio-field-hint {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 4px;
  font-style: italic;
}

.audio-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Audio Channel Controls */
.audio-channel {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(139, 92, 246, 0.1);
  border-radius: var(--radius);
  padding: 10px;
  margin-bottom: 10px;
}

.audio-channel:last-child {
  margin-bottom: 0;
}

.audio-channel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.audio-channel-header .checkbox-label {
  font-weight: 500;
  font-size: 13px;
}

.audio-channel-body {
  margin-top: 10px;
  transition: opacity 0.2s ease;
}

.audio-volume-control {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-muted);
}

.audio-volume-control label {
  margin: 0;
}

.input-field-sm {
  padding: 4px 8px;
  font-size: 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-color);
  background: var(--input-bg);
  color: var(--fg-text);
}

.persona-influence-badge {
  font-size: 11px;
  color: var(--fg-accent);
  background: rgba(98, 114, 164, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
  cursor: help;
}

/* ---- Veo 3.1 Settings ---- */
.veo-settings-section {
  background: rgba(66, 153, 225, 0.05);
  border: 1px solid rgba(66, 153, 225, 0.2);
  border-radius: var(--radius);
  padding: 12px;
  margin-top: 8px;
}

.veo-settings-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.veo-settings-title {
  font-weight: 500;
  font-size: 14px;
  color: var(--fg-text);
}

.veo-badge {
  font-size: 11px;
  color: #4299e1;
  background: rgba(66, 153, 225, 0.15);
  padding: 2px 8px;
  border-radius: 4px;
}

.veo-settings-body {
  padding-top: 12px;
  border-top: 1px solid rgba(66, 153, 225, 0.15);
}

.veo-field-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

.veo-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.veo-field label {
  font-size: 12px;
  color: var(--fg-text);
  font-weight: 500;
}

.veo-field .checkbox-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-weight: 500;
}

.veo-field-hint {
  font-size: 11px;
  color: var(--fg-muted);
  font-style: italic;
}

.veo-field-full {
  margin-bottom: 12px;
}

.veo-field-full label {
  display: block;
  font-size: 12px;
  color: var(--fg-text);
  font-weight: 500;
  margin-bottom: 4px;
}

.veo-field-full .optional-label {
  font-weight: 400;
  color: var(--fg-muted);
  font-size: 11px;
}

.veo-field-full .input-field {
  width: 100%;
  font-size: 13px;
}

.veo-field-full .veo-field-hint {
  margin-top: 4px;
}

@media (max-width: 480px) {
  .veo-field-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 480px) {
  .audio-field-row {
    grid-template-columns: 1fr;
  }

  .audio-channel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .audio-volume-control {
    margin-left: 24px;
  }
}

/* Hide controls when not applicable */
#studio-character-row.hidden,
#studio-motion-row.hidden,
#studio-quality-row.hidden {
  display: none;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  #studio-controls {
    padding: 12px;
  }

  .studio-slider::-webkit-slider-thumb {
    width: 22px;
    height: 22px;
  }

  .studio-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
  }
}

/* =========================================================================
   Prompt Preview Panel
   ========================================================================= */

.prompt-preview-panel {
  margin-top: 16px;
  padding: 20px;
  background: rgba(97, 175, 239, 0.08);
  border: 1px solid rgba(97, 175, 239, 0.3);
  border-radius: var(--radius);
}

.prompt-preview-panel.hidden {
  display: none;
}

.preview-header {
  margin-bottom: 16px;
}

.preview-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--fg-accent);
  margin-bottom: 4px;
}

.preview-hint {
  font-size: 12px;
  color: var(--fg-muted);
}

.preview-section {
  margin-bottom: 16px;
}

.preview-section.hidden {
  display: none;
}

.preview-section label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--fg-text);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.preview-textarea {
  width: 100%;
  padding: 12px;
  background: var(--bg-entry);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  color: var(--fg-entry);
  font-family: inherit;
  font-size: 14px;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s;
}

.preview-textarea:focus {
  outline: none;
  border-color: var(--fg-accent);
}

.preview-textarea::placeholder {
  color: var(--fg-muted);
}

.preview-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.preview-actions .btn-primary {
  flex: 1;
  min-width: 150px;
}

.preview-actions .btn-secondary {
  flex: 0 0 auto;
}

@media (max-width: 600px) {
  .preview-actions {
    flex-direction: column;
  }

  .preview-actions button {
    width: 100%;
  }
}

/* ---- Share Buttons (Library cards) ---- */

.btn-share {
  background: rgba(122, 162, 247, 0.1);
  color: #7aa2f7;
  border: 1px solid rgba(122, 162, 247, 0.2);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-share:hover {
  background: rgba(122, 162, 247, 0.2);
  border-color: rgba(122, 162, 247, 0.4);
}

.btn-shared {
  background: rgba(158, 206, 106, 0.1);
  color: #9ece6a;
  border: 1px solid rgba(158, 206, 106, 0.2);
  padding: 4px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-shared:hover {
  background: rgba(247, 118, 142, 0.1);
  color: #f7768e;
  border-color: rgba(247, 118, 142, 0.3);
}

/* ============================================
   Storyboard Panel Styles
   ============================================ */

/* Timeline: horizontal scrollable strip */
.sb-timeline {
  display: flex;
  gap: 12px;
  overflow-x: auto;
  padding: 16px 4px;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  align-items: center;
}

.sb-timeline::-webkit-scrollbar { height: 6px; }
.sb-timeline::-webkit-scrollbar-track { background: transparent; }
.sb-timeline::-webkit-scrollbar-thumb {
  background: rgba(97, 175, 239, 0.3);
  border-radius: 3px;
}

/* Scene card in timeline */
.sb-scene-card {
  flex: 0 0 180px;
  scroll-snap-align: start;
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s, transform 0.2s, box-shadow 0.2s;
  position: relative;
}

.sb-scene-card:hover {
  border-color: rgba(97, 175, 239, 0.3);
  transform: translateY(-2px);
}

.sb-scene-card.selected {
  border-color: var(--fg-accent);
  box-shadow: 0 0 12px rgba(97, 175, 239, 0.25);
}

.sb-scene-card img {
  width: 100%;
  height: 120px;
  object-fit: cover;
  display: block;
}

.sb-kf-placeholder {
  width: 100%;
  height: 120px;
  background: rgba(255, 80, 80, 0.15);
  color: rgba(255, 120, 120, 0.8);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

.sb-kf-missing {
  border-color: rgba(255, 80, 80, 0.4);
}

.sb-scene-card-info {
  padding: 8px 10px;
}

.sb-scene-card-num {
  font-size: 11px;
  color: var(--fg-accent);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sb-scene-card-mood {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Transition connector between cards */
.sb-transition-connector {
  flex: 0 0 32px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: var(--fg-muted);
  font-size: 10px;
  gap: 2px;
}

.sb-conn-icon {
  font-size: 16px;
  line-height: 1;
}

.sb-conn-label {
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

/* Scene editor */
.sb-scene-editor {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
}

.sb-editor-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 16px;
}

.sb-editor-image img {
  width: 100%;
  border-radius: 6px;
  margin-bottom: 8px;
  display: block;
}

.sb-keyframe-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.sb-keyframe-actions .btn-small {
  text-align: center;
  font-size: 11px;
  padding: 4px 10px;
}

.sb-editor-fields label {
  display: block;
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 8px;
  margin-bottom: 4px;
}

.sb-editor-fields label:first-child {
  margin-top: 0;
}

.sb-editor-inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* Transition indicator */
.sb-transition-indicator {
  margin-top: 12px;
  padding: 8px 12px;
  background: rgba(97, 175, 239, 0.06);
  border-radius: 6px;
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.sb-transition-label {
  color: var(--fg-muted);
}

.sb-transition-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sb-transition-badge.t-continuity {
  background: rgba(106, 191, 105, 0.15);
  color: #6abf69;
}
.sb-transition-badge.t-ai_interpolation {
  background: rgba(97, 175, 239, 0.15);
  color: var(--fg-accent);
}
.sb-transition-badge.t-smooth {
  background: rgba(86, 182, 194, 0.15);
  color: #56b6c2;
}
.sb-transition-badge.t-morph {
  background: rgba(198, 120, 221, 0.15);
  color: #c678dd;
}

.sb-transition-score {
  font-size: 11px;
  color: var(--fg-muted);
}

/* ---- Price Preview Panel ---- */
.price-preview-panel {
  background: linear-gradient(135deg, rgba(97, 175, 239, 0.08), rgba(167, 139, 250, 0.08));
  border: 1px solid rgba(97, 175, 239, 0.25);
  border-radius: var(--radius);
  padding: 16px;
  margin-top: 16px;
  margin-bottom: 8px;
}

.price-preview-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.price-label {
  font-size: 13px;
  color: var(--fg-muted);
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.price-value {
  font-size: 28px;
  font-weight: 700;
  color: #f0f0f0;
  text-shadow: 0 0 20px rgba(97, 175, 239, 0.5);
}

.price-value.warning {
  color: var(--fg-warning);
  text-shadow: 0 0 20px rgba(229, 192, 123, 0.5);
}

.price-value.error {
  color: var(--fg-error);
  text-shadow: 0 0 20px rgba(224, 108, 117, 0.5);
}

.price-breakdown {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.price-breakdown .price-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  font-size: 12px;
}

.price-item-label {
  color: var(--fg-muted);
}

.price-item-value {
  color: var(--fg-text);
  font-weight: 600;
}

.price-balance {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
}

.balance-label {
  color: var(--fg-muted);
}

.balance-value {
  font-weight: 600;
  color: var(--fg-success);
}

.balance-value.low {
  color: var(--fg-warning);
}

.balance-value.insufficient {
  color: var(--fg-error);
  font-weight: 700;
}

.balance-value.error {
  color: var(--fg-muted);
  font-style: italic;
}

/* Mode Badge */
.price-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.price-mode-badge.frost-badge {
  background: linear-gradient(135deg, rgba(97, 175, 239, 0.2), rgba(97, 175, 239, 0.1));
  border: 1px solid rgba(97, 175, 239, 0.4);
  color: #61afef;
}
.price-mode-badge.frost-badge::before {
  content: "❄";
  font-size: 10px;
}
.price-mode-badge.byok-badge {
  background: transparent;
  border: 1px solid rgba(152, 195, 121, 0.5);
  color: #98c379;
}
.price-mode-badge.byok-badge::before {
  content: "🔑";
  font-size: 10px;
}

/* Price Estimate */
.price-estimate {
  font-size: 13px;
  color: var(--fg-muted);
}
.price-estimate .price-value {
  font-size: 22px;
  margin-left: 4px;
}

/* Balance Row with Color Coding */
.price-balance-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 13px;
}
.balance-status {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  font-weight: 500;
}
.balance-status.sufficient {
  background: rgba(152, 195, 121, 0.15);
  color: #98c379;
}
.balance-status.low {
  background: rgba(229, 192, 123, 0.15);
  color: #e5c07b;
}
.balance-status.insufficient {
  background: rgba(224, 108, 117, 0.15);
  color: #e06c75;
}

/* Insufficient funds warning */
.price-insufficient-warning {
  margin-top: 10px;
  padding: 10px 12px;
  background: rgba(224, 108, 117, 0.12);
  border: 1px solid rgba(224, 108, 117, 0.3);
  border-radius: var(--radius-sm);
  color: var(--fg-error);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.price-insufficient-warning a {
  color: var(--fg-accent);
  text-decoration: underline;
}

/* ---- Inline Cost Badge (lightweight per-feature estimate) ---- */
.cost-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  font-family: 'Courier New', monospace;
  background: linear-gradient(135deg, rgba(97, 175, 239, 0.12), rgba(167, 139, 250, 0.08));
  border: 1px solid rgba(97, 175, 239, 0.25);
  color: rgba(97, 175, 239, 0.9);
  white-space: nowrap;
  vertical-align: middle;
  margin-left: 8px;
  transition: opacity 0.2s ease;
}
.cost-badge::before {
  content: "❄";
  font-size: 9px;
}
.cost-badge.byok {
  background: transparent;
  border-color: rgba(152, 195, 121, 0.3);
  color: rgba(152, 195, 121, 0.7);
}
.cost-badge.byok::before {
  content: "🔑";
}
.btn-row .cost-badge,
.panel-actions .cost-badge,
.options-row .cost-badge {
  margin-left: auto;
}
.tts-action-card .cost-badge {
  margin-left: auto;
  flex-shrink: 0;
}

/* ---------------------------------------------------------------------------
   Help / Support Chat (User Panel)
--------------------------------------------------------------------------- */

.help-chat-container {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 200px);
  max-height: 600px;
  max-width: 700px;
  margin: 0 auto;
  border: 1px solid var(--border-light);
  border-radius: 10px;
  overflow: hidden;
  background: var(--bg-card);
}

.help-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.help-msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.5;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.help-msg.user {
  align-self: flex-end;
  background: var(--fg-accent);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.help-msg.admin {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.08);
  color: var(--fg-text);
  border-bottom-left-radius: 4px;
}

.help-msg .msg-time {
  display: block;
  font-size: 10px;
  margin-top: 4px;
  opacity: 0.6;
}

.help-input-area {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--border-light);
  background: rgba(0, 0, 0, 0.2);
}

.help-input {
  flex: 1;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-light);
  border-radius: 8px;
  padding: 8px 12px;
  color: var(--fg-text);
  font-size: 13px;
  font-family: inherit;
  resize: none;
}

.help-input:focus {
  outline: none;
  border-color: var(--fg-accent);
}

.help-input-area .btn-primary {
  align-self: flex-end;
  width: auto;
  flex-shrink: 0;
  padding: 8px 20px;
  font-size: 13px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--fg-accent), var(--fg-accent2));
  color: #1a1a2e;
  font-weight: 600;
}

/* Nav sidebar unread badge for Help */
.nav-help-badge {
  position: absolute;
  top: 2px;
  right: 2px;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: #e06c75;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ---------------------------------------------------------------------------
   Floating Support Chat Window
--------------------------------------------------------------------------- */

.support-chat-window {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 400px;
  height: 520px;
  background: var(--bg-card);
  border: 1px solid var(--border-light);
  border-radius: 14px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(97, 175, 239, 0.08);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 9000;
  animation: supportChatSlideIn 0.25s ease-out;
}

.support-chat-window.hidden {
  display: none;
}

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

.support-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0;
  background: rgba(0, 0, 0, 0.3);
  border-bottom: 1px solid var(--border-light);
  flex-shrink: 0;
}

.support-chat-tabs {
  display: flex;
  flex: 1;
}

.support-tab {
  flex: 1;
  padding: 12px 8px;
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color 0.2s, border-color 0.2s;
  position: relative;
}

.support-tab:hover {
  color: var(--fg-text);
}

.support-tab.active {
  color: var(--fg-accent);
  border-bottom-color: var(--fg-accent);
}

.support-tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  background: #e06c75;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 700;
  color: #fff;
  margin-left: 4px;
  vertical-align: middle;
}

.support-tab-badge.hidden {
  display: none;
}

.support-chat-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 22px;
  cursor: pointer;
  padding: 8px 14px;
  line-height: 1;
  transition: color 0.2s;
}

.support-chat-close:hover {
  color: var(--fg-text);
}

.support-chat-subtitle {
  text-align: center;
  font-size: 11px;
  color: var(--fg-muted);
  padding: 8px 12px 0;
  font-weight: 500;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

.support-chat-body {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

.support-chat-body.active {
  display: flex;
}

.support-chat-body .help-messages {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  height: auto;
  max-height: none;
}

.support-chat-body .help-input-area {
  flex-shrink: 0;
}

/* Announcements list */
.support-announcements-list {
  flex: 1;
  overflow-y: auto;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.announcement-card {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 12px 14px;
  transition: border-color 0.2s;
}

.announcement-card.unread {
  border-left: 3px solid var(--fg-accent);
  background: rgba(97, 175, 239, 0.06);
}

.announcement-title {
  font-weight: 600;
  font-size: 14px;
  color: var(--fg-text);
  margin-bottom: 6px;
}

.announcement-body {
  font-size: 13px;
  line-height: 1.5;
  color: var(--fg-muted);
  white-space: pre-wrap;
  word-wrap: break-word;
}

.announcement-time {
  font-size: 10px;
  color: var(--fg-muted);
  opacity: 0.6;
  margin-top: 8px;
}

/* Mobile: full width */
@media (max-width: 480px) {
  .support-chat-window {
    width: calc(100vw - 16px);
    height: calc(100vh - 100px);
    bottom: 8px;
    right: 8px;
    border-radius: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .support-chat-window {
    animation: none;
  }
}

/* ---- Insufficient Balance Modal ---- */
.balance-modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: balanceModalFadeIn 0.2s ease;
}
@keyframes balanceModalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.balance-modal {
  background: var(--bg-card, #1a1b2e);
  border: 1px solid rgba(97, 175, 239, 0.3);
  border-radius: 16px;
  padding: 28px 32px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 8px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(97, 175, 239, 0.1);
  text-align: center;
}
.balance-modal-icon {
  font-size: 40px;
  margin-bottom: 12px;
}
.balance-modal h3 {
  color: var(--fg-text, #e0e8ff);
  font-size: 18px;
  margin: 0 0 16px;
}
.balance-modal-details {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 20px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 10px;
  padding: 14px 16px;
}
.balance-modal-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
}
.balance-modal-row .label {
  color: var(--fg-muted, #8b8fa3);
}
.balance-modal-row .value {
  font-family: 'Courier New', monospace;
  font-weight: 600;
  color: var(--fg-text, #e0e8ff);
}
.balance-modal-row .value.shortfall {
  color: #e06c75;
}
.balance-modal-row .value.balance {
  color: rgba(97, 175, 239, 0.9);
}
.balance-modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}
.balance-modal-actions .btn-primary {
  background: linear-gradient(135deg, #61afef, #a78bfa);
  border: none;
  padding: 10px 24px;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
  transition: opacity 0.2s;
}
.balance-modal-actions .btn-primary:hover { opacity: 0.85; }
.balance-modal-actions .btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 10px 20px;
  border-radius: 10px;
  color: var(--fg-muted, #8b8fa3);
  cursor: pointer;
  font-size: 14px;
  transition: all 0.2s;
}
.balance-modal-actions .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--fg-text, #e0e8ff);
}

/* Info text above timeline */
.sb-info-text {
  font-size: 13px;
  color: var(--fg-muted);
  margin-bottom: 4px;
}

/* Saved storyboards list */
.sb-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 8px;
}

.sb-list-card {
  background: var(--bg-card);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 12px;
  cursor: pointer;
  transition: border-color 0.2s;
}

.sb-list-card:hover {
  border-color: rgba(97, 175, 239, 0.3);
}

.sb-list-card .sb-list-title {
  font-weight: 600;
  color: var(--fg-accent);
  font-size: 14px;
}

.sb-list-card .sb-list-prompt {
  font-size: 12px;
  color: var(--fg-secondary);
  margin-top: 2px;
  font-style: italic;
  opacity: 0.7;
}

.sb-list-card .sb-list-meta {
  font-size: 12px;
  color: var(--fg-muted);
  margin-top: 4px;
}

.sb-list-card .sb-list-status {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 4px;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .sb-timeline {
    gap: 8px;
    padding: 12px 0;
  }
  .sb-scene-card {
    flex: 0 0 140px;
  }
  .sb-scene-card img {
    height: 90px;
  }
  .sb-editor-grid {
    grid-template-columns: 1fr;
  }
  .sb-editor-image {
    display: flex;
    gap: 8px;
    align-items: flex-start;
  }
  .sb-editor-image img {
    max-width: 120px;
  }
  .sb-editor-inline {
    grid-template-columns: 1fr;
  }
  .sb-list {
    grid-template-columns: 1fr;
  }
}

/* ---- Voice-to-Prompt Recording ---- */
.voice-input-container {
  position: relative;
  display: flex;
  align-items: stretch;
}
.voice-input-container textarea,
.voice-input-container input[type="text"] {
  flex: 1;
  padding-right: 44px;
}
.voice-input-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-button);
  border: 1px solid var(--bg-card-border);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--fg-muted);
  transition: all 0.2s ease;
}
.voice-input-btn:hover {
  background: var(--fg-accent);
  color: white;
  border-color: var(--fg-accent);
}
.voice-input-btn svg {
  width: 16px;
  height: 16px;
}

/* Voice recording overlay */
.voice-recording-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}
.voice-recording-content {
  background: var(--bg-panel);
  border: 1px solid var(--bg-card-border);
  border-radius: var(--radius);
  padding: 32px 48px;
  text-align: center;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5);
}
.voice-recording-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 16px;
}
.voice-recording-pulse {
  width: 16px;
  height: 16px;
  background: #e06c75;
  border-radius: 50%;
  animation: voicePulse 1s ease-in-out infinite;
}
@keyframes voicePulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.3); opacity: 0.7; }
}
.voice-recording-text {
  color: var(--fg-text);
  font-size: 18px;
  font-weight: 500;
}
.voice-recording-time {
  font-size: 48px;
  font-weight: 300;
  color: var(--fg-accent);
  margin: 16px 0 24px;
  font-variant-numeric: tabular-nums;
}
.voice-recording-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
}
.voice-recording-actions .btn-primary,
.voice-recording-actions .btn-secondary {
  min-width: 140px;
}

/* ============================================
   Voice Recording Modal
   ============================================ */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  padding: 20px;
}
.modal-overlay.hidden {
  display: none;
}
.modal-content {
  background: var(--bg-card);
  border-radius: 16px;
  max-width: 700px;
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
}
.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-light);
}
.modal-header h3 {
  margin: 0;
  font-size: 20px;
  color: var(--fg-text);
}
.modal-close {
  background: none;
  border: none;
  color: var(--fg-muted);
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}
.modal-close:hover {
  color: var(--fg-text);
}
.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}
.recording-intro {
  color: var(--fg-muted);
  margin-bottom: 24px;
  line-height: 1.5;
}

/* Recording Controls */
.recording-controls {
  background: var(--bg-dark);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  margin-bottom: 24px;
}
.recording-timer {
  font-size: 48px;
  font-weight: 300;
  color: var(--fg-text);
  font-variant-numeric: tabular-nums;
  margin-bottom: 16px;
}
.recording-timer.recording {
  color: #ef4444;
}
.recording-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
}
.btn-record {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #ef4444;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-record:hover {
  background: #dc2626;
}
.btn-record:disabled {
  background: #666;
  cursor: not-allowed;
}
.record-icon {
  width: 12px;
  height: 12px;
  background: white;
  border-radius: 50%;
}
.btn-record.recording .record-icon {
  animation: recordPulse 1s infinite;
}
@keyframes recordPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
.btn-stop {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--fg-accent);
  color: var(--bg-dark);
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-stop:hover {
  filter: brightness(1.1);
}
.stop-icon {
  width: 12px;
  height: 12px;
  background: var(--bg-dark);
  border-radius: 2px;
}
.recording-status {
  margin-top: 12px;
  color: var(--fg-muted);
  font-size: 14px;
}
.recording-status.error {
  color: #ef4444;
}
.recording-status.success {
  color: var(--fg-accent);
}

/* Script Container */
.script-container {
  background: var(--bg-dark);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 24px;
}
.script-container h4 {
  margin: 0 0 12px;
  color: var(--fg-text);
  display: flex;
  align-items: center;
  gap: 8px;
}
.script-time {
  font-size: 12px;
  font-weight: 400;
  color: var(--fg-muted);
}
.script-text {
  max-height: 300px;
  overflow-y: auto;
  padding-right: 12px;
  line-height: 1.8;
  font-size: 16px;
  color: var(--fg-text);
}
.script-text p {
  margin: 0 0 16px;
}
.script-text p:last-child {
  margin-bottom: 0;
}

/* Recording Preview */
.recording-preview {
  background: var(--bg-dark);
  border-radius: 12px;
  padding: 20px;
}
.recording-preview.hidden {
  display: none;
}
.recording-preview h4 {
  margin: 0 0 12px;
  color: var(--fg-text);
}
.recording-preview audio {
  width: 100%;
  margin-bottom: 16px;
}
.recording-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
}

/* Voice Clone Options Row */
.voice-clone-options {
  display: flex;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-light);
}
.voice-clone-options .btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.voice-clone-options .icon {
  font-size: 18px;
}

/* ============================================
   TTS Section Improvements
   ============================================ */
.tts-settings-section {
  background: var(--bg-dark);
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 16px;
}
.settings-toggle-label {
  display: block;
  font-weight: 500;
  color: var(--fg-text);
  margin-bottom: 12px;
}
.settings-toggle-label .hint {
  font-weight: 400;
}

/* TTS Action Cards */
.tts-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}
.tts-action-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-dark);
  border: 1px solid var(--border-light);
  border-radius: 10px;
  padding: 14px 16px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.tts-action-card:hover {
  border-color: var(--fg-accent);
  background: rgba(var(--accent-rgb), 0.08);
}
.tts-action-card .action-icon {
  font-size: 24px;
  flex-shrink: 0;
}
.tts-action-card .action-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.tts-action-card .action-info strong {
  color: var(--fg-text);
  font-size: 14px;
  white-space: nowrap;
}
.tts-action-card .action-info span {
  color: var(--fg-muted);
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 700px) {
  .tts-actions {
    grid-template-columns: 1fr;
  }
}

/* ---------------------------------------------------------------------------
   Frost Bites / Financial Panel
--------------------------------------------------------------------------- */

.fb-icon {
  color: #61afef;
  text-shadow: 0 0 8px rgba(97, 175, 239, 0.5);
}

#panel-financial h2 .fb-icon {
  font-size: 1.2em;
  margin-right: 8px;
}

.financial-balance-card {
  background: linear-gradient(135deg, rgba(97, 175, 239, 0.15), rgba(167, 139, 250, 0.1));
  border: 1px solid rgba(97, 175, 239, 0.3);
  border-radius: 16px;
  padding: 24px;
  text-align: center;
  margin-bottom: 32px;
  box-shadow: 0 0 30px rgba(97, 175, 239, 0.1);
}

.balance-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.balance-label {
  font-size: 14px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255, 255, 255, 0.6);
}

.balance-amount {
  font-size: 48px;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.balance-amount .fb-icon {
  font-size: 40px;
}

.balance-sub {
  margin-top: 8px;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.5);
}

.financial-section {
  margin-bottom: 32px;
}

.fb-purchase-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.fb-purchase-btn {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 20px 16px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.fb-purchase-btn:hover {
  background: rgba(97, 175, 239, 0.1);
  border-color: rgba(97, 175, 239, 0.3);
  transform: translateY(-2px);
  box-shadow: 0 4px 20px rgba(97, 175, 239, 0.15);
}

.fb-purchase-btn.popular {
  border-color: rgba(97, 175, 239, 0.4);
  background: rgba(97, 175, 239, 0.08);
}

.fb-popular-tag {
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  padding: 2px 8px;
  background: linear-gradient(135deg, #61afef, #a78bfa);
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #fff;
}

.fb-amount {
  font-size: 20px;
  font-weight: 600;
  color: #fff;
}

.fb-price {
  font-size: 14px;
  color: rgba(255, 255, 255, 0.5);
}

.fb-purchase-btn.custom {
  border-style: dashed;
}

.fb-custom-input {
  margin-top: 16px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
}

.fb-custom-input label {
  display: block;
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 8px;
}

.fb-custom-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fb-currency {
  font-size: 18px;
  color: rgba(255, 255, 255, 0.5);
}

.fb-custom-row input {
  flex: 1;
  padding: 10px 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  color: #fff;
  font-size: 16px;
}

.fb-custom-row input:focus {
  outline: none;
  border-color: rgba(97, 175, 239, 0.5);
}

.fb-usage-list,
.fb-transaction-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 12px;
}

.fb-usage-item,
.fb-transaction-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px;
  font-size: 13px;
}

.fb-usage-item .usage-service {
  display: flex;
  align-items: center;
  gap: 8px;
}

.fb-usage-item .usage-service-icon {
  width: 24px;
  height: 24px;
  background: rgba(97, 175, 239, 0.2);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}

.fb-usage-item .usage-details {
  color: rgba(255, 255, 255, 0.5);
  font-size: 11px;
}

.fb-usage-item .usage-cost {
  font-weight: 600;
  color: #e06c75;
}

.fb-transaction-item .tx-type {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
}

.fb-transaction-item .tx-type.purchase {
  background: rgba(106, 191, 105, 0.2);
  color: #6abf69;
}

.fb-transaction-item .tx-type.usage {
  background: rgba(224, 108, 117, 0.2);
  color: #e06c75;
}

.fb-transaction-item .tx-type.adjustment {
  background: rgba(97, 175, 239, 0.2);
  color: #61afef;
}

.fb-transaction-item .tx-desc {
  flex: 1;
  margin-left: 12px;
  color: rgba(255, 255, 255, 0.7);
}

.fb-transaction-item .tx-amount {
  font-weight: 600;
}

.fb-transaction-item .tx-amount.positive {
  color: #6abf69;
}

.fb-transaction-item .tx-amount.negative {
  color: #e06c75;
}

.fb-transaction-item .tx-date {
  margin-left: 12px;
  color: rgba(255, 255, 255, 0.4);
  font-size: 11px;
}

.fb-usage-empty {
  padding: 24px;
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
  font-size: 13px;
}

@media (max-width: 600px) {
  .fb-purchase-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .balance-amount {
    font-size: 36px;
  }
}

/* ---------------------------------------------------------------------------
   User Job Queue
--------------------------------------------------------------------------- */

.jobs-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.jobs-filter-group {
  display: flex;
  gap: 4px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 3px;
}

.jobs-filter-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.5);
  background: transparent;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.jobs-filter-btn:hover {
  color: rgba(255, 255, 255, 0.8);
  background: rgba(255, 255, 255, 0.06);
}

.jobs-filter-btn.active {
  color: #fff;
  background: rgba(97, 175, 239, 0.2);
}

.user-job-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.jobs-empty-state {
  text-align: center;
  padding: 48px 24px;
  color: rgba(255, 255, 255, 0.4);
}

.jobs-empty-icon {
  display: block;
  font-size: 40px;
  margin-bottom: 12px;
  opacity: 0.4;
}

.jobs-empty-state p {
  font-size: 13px;
  line-height: 1.6;
  max-width: 320px;
  margin: 0 auto;
}

/* Job card */
.user-job-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 14px 16px;
  transition: background 0.2s ease, border-color 0.2s ease;
}

.user-job-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.1);
}

.user-job-card.queued {
  border-left: 3px solid #c678dd;
}

.user-job-card.running {
  border-left: 3px solid #61afef;
}

.user-job-card.done {
  border-left: 3px solid #6abf69;
}

.user-job-card.failed {
  border-left: 3px solid #e06c75;
}

.user-job-card.pending {
  border-left: 3px solid #e5c07b;
}

.user-job-card.cancelled {
  border-left: 3px solid rgba(255, 255, 255, 0.2);
  opacity: 0.6;
}

.user-job-main {
  display: flex;
  align-items: center;
  gap: 12px;
}

.user-job-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}

.user-job-status-dot.awaiting_funds {
  background: #c678dd;
  animation: jobPulse 2s infinite;
}

.user-job-status-dot.pending {
  background: #e5c07b;
}

.user-job-status-dot.in_progress {
  background: #61afef;
  animation: jobPulse 1.5s infinite;
}

.user-job-status-dot.completed {
  background: #6abf69;
}

.user-job-status-dot.failed {
  background: #e06c75;
}

.user-job-status-dot.cancelled {
  background: rgba(255, 255, 255, 0.3);
}

@keyframes jobPulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.user-job-info {
  flex: 1;
  min-width: 0;
}

.user-job-type {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-job-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 3px;
  font-size: 11px;
}

.user-job-status-label {
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 10px;
}

.user-job-card.queued .user-job-status-label { color: #c678dd; }
.user-job-card.pending .user-job-status-label { color: #e5c07b; }
.user-job-card.running .user-job-status-label { color: #61afef; }
.user-job-card.done .user-job-status-label { color: #6abf69; }
.user-job-card.failed .user-job-status-label { color: #e06c75; }
.user-job-card.cancelled .user-job-status-label { color: rgba(255, 255, 255, 0.4); }

.user-job-time {
  color: rgba(255, 255, 255, 0.35);
}

.user-job-cost {
  color: #e5c07b;
  font-weight: 600;
}

.user-job-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

/* Status badge in details modal */
.user-job-status-badge {
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.user-job-status-badge.queued { background: rgba(198, 120, 221, 0.15); color: #c678dd; }
.user-job-status-badge.pending { background: rgba(229, 192, 123, 0.15); color: #e5c07b; }
.user-job-status-badge.running { background: rgba(97, 175, 239, 0.15); color: #61afef; }
.user-job-status-badge.done { background: rgba(106, 191, 105, 0.15); color: #6abf69; }
.user-job-status-badge.failed { background: rgba(224, 108, 117, 0.15); color: #e06c75; }
.user-job-status-badge.cancelled { background: rgba(255, 255, 255, 0.08); color: rgba(255, 255, 255, 0.4); }

@media (max-width: 600px) {
  .jobs-toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .jobs-filter-group {
    overflow-x: auto;
  }

  .user-job-main {
    flex-wrap: wrap;
  }

  .user-job-actions {
    width: 100%;
    justify-content: flex-end;
    margin-top: 8px;
  }
}

/* ---------------------------------------------------------------------------
   Toast Notifications
--------------------------------------------------------------------------- */

.toast-container {
  position: fixed;
  bottom: 40px;
  right: 16px;
  display: flex;
  flex-direction: column-reverse;
  gap: 10px;
  z-index: 10001;
  pointer-events: none;
  max-height: calc(100vh - 80px);
  overflow: hidden;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 300px;
  max-width: 420px;
  background: linear-gradient(135deg, rgba(30, 30, 46, 0.95), rgba(26, 26, 36, 0.95));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-left: 3px solid #98c379;
  border-radius: var(--radius);
  padding: 14px 16px;
  backdrop-filter: blur(12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  animation: toastSlideIn 0.35s ease-out;
  position: relative;
  overflow: hidden;
}

.toast.dismissing {
  animation: toastSlideOut 0.3s ease-in forwards;
}

.toast-icon {
  font-size: 20px;
  flex-shrink: 0;
}

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

.toast-title {
  font-size: 13px;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 2px;
}

.toast-message {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.5);
  line-height: 1.4;
}

.toast-action {
  flex-shrink: 0;
  background: rgba(97, 175, 239, 0.15);
  color: #61afef;
  border: 1px solid rgba(97, 175, 239, 0.3);
  border-radius: 6px;
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s;
}

.toast-action:hover {
  background: rgba(97, 175, 239, 0.25);
}

.toast-close {
  flex-shrink: 0;
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.4);
  font-size: 18px;
  cursor: pointer;
  padding: 0 0 0 4px;
  line-height: 1;
  transition: color 0.2s;
}

.toast-close:hover {
  color: rgba(255, 255, 255, 0.8);
}

.toast-timer {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: #98c379;
  border-radius: 0 0 0 var(--radius);
  animation: toastTimer var(--toast-duration, 12s) linear forwards;
}

@keyframes toastSlideIn {
  from { transform: translateX(120%); opacity: 0; }
  to   { transform: translateX(0);    opacity: 1; }
}

@keyframes toastSlideOut {
  from { transform: translateX(0);    opacity: 1; }
  to   { transform: translateX(120%); opacity: 0; }
}

@keyframes toastTimer {
  from { width: 100%; }
  to   { width: 0%; }
}

@media (max-width: 600px) {
  .toast-container {
    left: 8px;
    right: 8px;
    bottom: 36px;
  }

  .toast {
    min-width: unset;
    max-width: unset;
  }
}
