@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,400;12..96,700;12..96,800&family=Spline+Sans+Mono:wght@400;500&display=swap');

:root {
  /* Default Theme (now Light Mode, per user request) */
  --bg: #f9f8fc;
  --panel: rgba(255, 255, 255, 0.85);
  --panel-solid: #ffffff;
  --panel-darker: #f0ecf6;
  --btn-bg: #eae5f5;
  --ink: #1e1633;
  --dim: #7f749a;
  --hot: #e61c65;
  --glow: #009e85;
  --line: rgba(0, 0, 0, 0.08);
  --line-focus: rgba(230, 28, 101, 0.3);
  
  --shadow: 0 30px 80px -25px rgba(22, 18, 31, 0.12);
  --sidebar-shadow: 0 20px 50px rgba(22, 18, 31, 0.08);
  --inner-shadow: inset 0 0 20px rgba(22, 18, 31, 0.12);
  
  --speaker-0: #009e85;
  --speaker-1: #e61c65;
  --speaker-2: #c88600;
  --speaker-3: #7d49e3;
  
  --word-unlit: rgba(30, 22, 51, 0.25);
  --word-shadow: none;
  --panel-overlay: rgba(30, 22, 51, 0.04);
  --controls-bg: rgba(255, 255, 255, 0.92);
  --btn-hover-bg: rgba(30, 22, 51, 0.05);
}

body.dark-theme {
  --bg: #07040d;
  --panel: rgba(22, 18, 31, 0.75);
  --panel-solid: #16121f;
  --panel-darker: #090612;
  --btn-bg: #191428;
  --ink: #f4f0ff;
  --dim: #6d6385;
  --hot: #ff2e7e;
  --glow: #2effd5;
  --line: rgba(255, 255, 255, 0.08);
  --line-focus: rgba(255, 46, 126, 0.4);
  
  --shadow: 0 30px 80px -25px rgba(0, 0, 0, 0.8);
  --sidebar-shadow: 0 20px 50px rgba(0, 0, 0, 0.4);
  --inner-shadow: inset 0 0 20px rgba(0, 0, 0, 0.9);
  
  --speaker-0: #2effd5;
  --speaker-1: #ff2e7e;
  --speaker-2: #ffea30;
  --speaker-3: #b182ff;
  
  --word-unlit: rgba(244, 240, 255, 0.25);
  --word-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
  --panel-overlay: rgba(0, 0, 0, 0.25);
  --controls-bg: rgba(22, 18, 31, 0.9);
  --btn-hover-bg: rgba(255, 255, 255, 0.05);
}

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

html, body {
  min-height: 100%;
}

body {
  position: relative;
  background:
    radial-gradient(1000px 600px at 80% -15%, rgba(255, 46, 126, 0.06), transparent 70%),
    radial-gradient(800px 700px at 10% 110%, rgba(46, 255, 213, 0.05), transparent 70%),
    var(--bg);
  color: var(--ink);
  font-family: 'Bricolage Grotesque', sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 30px 20px 60px;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

body.dark-theme {
  background:
    radial-gradient(1000px 600px at 80% -15%, rgba(255, 46, 126, 0.15), transparent 70%),
    radial-gradient(800px 700px at 10% 110%, rgba(46, 255, 213, 0.1), transparent 70%),
    var(--bg);
}

/* Header Styles */
header {
  text-align: center;
  margin-bottom: 20px;
}

h1 {
  font-size: clamp(2.8rem, 8vw, 4.8rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 0.95;
  background: linear-gradient(100deg, var(--hot) 20%, var(--glow) 80%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  filter: drop-shadow(0 2px 10px rgba(255, 46, 126, 0.2));
}

header p {
  font-family: 'Spline Sans Mono', monospace;
  color: var(--dim);
  font-size: 0.85rem;
  margin-top: 12px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* Quick Demo Bar */
.quick-demo-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--line);
  padding: 8px 16px;
  border-radius: 30px;
  margin-bottom: 24px;
  font-size: 0.85rem;
  backdrop-filter: blur(10px);
}

.quick-demo-bar span {
  color: var(--dim);
}

.demo-btn {
  background: linear-gradient(90deg, var(--hot), #d21f66);
  color: white;
  border: none;
  font-family: 'Bricolage Grotesque', sans-serif;
  font-weight: 700;
  font-size: 0.8rem;
  padding: 6px 16px;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 4px 12px rgba(255, 46, 126, 0.3);
}

.demo-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(255, 46, 126, 0.5);
  background: linear-gradient(90deg, #ff4c92, var(--hot));
}

.demo-btn:active {
  transform: translateY(1px);
}

/* App Grid Layout */
.app-container {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  width: min(1200px, 100%);
  margin-bottom: 30px;
}

@media (max-width: 950px) {
  .app-container {
    grid-template-columns: 1fr;
  }
}

/* Main Player Column */
.main-player {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* Stage & Video Frame */
.stage {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
  position: relative;
  transition: border-color 0.2s ease;
}

.stage.dragover {
  border-color: var(--glow);
  box-shadow: 0 0 20px rgba(46, 255, 213, 0.3), 0 30px 80px -25px rgba(0, 0, 0, 0.8);
}

.video-wrap {
  position: relative;
  background: #020105;
  aspect-ratio: 16/9;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Karaoke Caption Panel (Below Video) */
.karaoke-wrap {
  border-top: 1px solid var(--line);
  background: var(--panel-darker);
  min-height: 90px;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  padding: 15px 30px;
  overflow: hidden;
  box-shadow: inset 0 0 20px rgba(0, 0, 0, 0.9);
}

.karaoke-wrap.hidden {
  display: none !important;
}

/* Karaoke Bouncing Dot */
.bouncing-dot {
  position: absolute;
  width: 13px;
  height: 13px;
  border-radius: 50%;
  pointer-events: none;
  transform: translate(-50%, -100%);
  margin-top: -12px; /* Position it above the active word */
  transition: left 0.18s cubic-bezier(0.25, 0.8, 0.25, 1.25), top 0.18s cubic-bezier(0.25, 0.8, 0.25, 1.25);
  opacity: 0;
  z-index: 10;
}

.bouncing-dot.active {
  opacity: 1;
  animation: dot-hop 0.4s ease-in-out infinite alternate;
}

/* Speaker Bouncing Dot Colors */
.bouncing-dot.speaker-0 { background: var(--speaker-0); box-shadow: 0 4px 10px rgba(0, 158, 133, 0.25); }
.bouncing-dot.speaker-1 { background: var(--speaker-1); box-shadow: 0 4px 10px rgba(230, 28, 101, 0.25); }
.bouncing-dot.speaker-2 { background: var(--speaker-2); box-shadow: 0 4px 10px rgba(200, 134, 0, 0.25); }
.bouncing-dot.speaker-3 { background: var(--speaker-3); box-shadow: 0 4px 10px rgba(125, 73, 227, 0.25); }

@keyframes dot-hop {
  from { transform: translate(-50%, -100%) translateY(0); }
  to { transform: translate(-50%, -100%) translateY(-8px); }
}

/* Caption Layer */
.caption {
  width: 100%;
  text-align: center;
  pointer-events: none;
  z-index: 8;
}

.caption .line {
  display: inline-block;
  font-size: clamp(0.95rem, 2.2vw, 1.35rem); /* Diminished size for readability outside video */
  font-weight: 700;
  line-height: 1.4;
  letter-spacing: -0.01em;
}

.caption .word {
  display: inline-block;
  margin: 0 0.15em;
  color: var(--word-unlit);
  transition: color 0.15s ease, text-shadow 0.15s ease, transform 0.1s ease;
  text-shadow: var(--word-shadow);
}

/* Speaker Lit Word Colors */
.caption .word.lit.speaker-0 { color: var(--speaker-0); text-shadow: var(--word-shadow); }
.caption .word.lit.speaker-1 { color: var(--speaker-1); text-shadow: var(--word-shadow); }
.caption .word.lit.speaker-2 { color: var(--speaker-2); text-shadow: var(--word-shadow); }
.caption .word.lit.speaker-3 { color: var(--speaker-3); text-shadow: var(--word-shadow); }

/* Empty/Upload Prompt State */
.empty {
  position: absolute;
  inset: 0;
  background: rgba(12, 10, 20, 0.9);
  color: var(--dim);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  z-index: 9;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.empty.hidden {
  opacity: 0;
  pointer-events: none;
}

.drag-icon {
  font-size: 3rem;
  margin-bottom: 12px;
  animation: float-pulse 2s ease-in-out infinite alternate;
}

@keyframes float-pulse {
  from { transform: translateY(0) scale(1); filter: drop-shadow(0 0 5px rgba(255, 46, 126, 0.3)); }
  to { transform: translateY(-8px) scale(1.05); filter: drop-shadow(0 0 15px rgba(255, 46, 126, 0.6)); }
}

.empty h3 {
  color: var(--ink);
  font-size: 1.3rem;
  margin-bottom: 6px;
}

.empty p {
  font-size: 0.95rem;
  max-width: 320px;
  line-height: 1.4;
  margin-bottom: 12px;
}

.supported-formats {
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.72rem;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
  padding: 4px 10px;
  border-radius: 6px;
  color: var(--glow);
}

/* Custom Video Controls Panel */
.controls-panel {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
  background: var(--controls-bg);
  backdrop-filter: blur(10px);
}

/* Scrub Bar Container */
.scrub-container {
  position: relative;
  padding: 0 16px;
  margin-top: -3px; /* Hang slightly over border */
}

/* Custom progress bar slider */
#progress-bar {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
  transition: height 0.15s ease;
}

#progress-bar:hover {
  height: 8px;
}

#progress-bar::-webkit-slider-runnable-track {
  width: 100%;
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(to right, var(--hot) var(--buffered-width, 0%), rgba(255, 255, 255, 0.15) 0%);
}

#progress-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--glow);
  box-shadow: 0 0 10px var(--glow), 0 0 20px rgba(46, 255, 213, 0.4);
  margin-top: -4px;
  transition: transform 0.15s;
}

#progress-bar:hover::-webkit-slider-thumb {
  transform: scale(1.25);
}

/* Time tooltip when hovering scrub bar */
.progress-hover-time {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: var(--bg);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.72rem;
  padding: 2px 6px;
  border-radius: 4px;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s ease, transform 0.15s ease;
  z-index: 15;
}

.scrub-container:hover .progress-hover-time {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Main Buttons Row */
.buttons-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
}

.control-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 6px;
  border-radius: 8px;
  transition: all 0.2s ease;
}

.control-btn:hover {
  background: var(--btn-hover-bg);
  color: var(--hot);
}

.control-btn .icon {
  width: 22px;
  height: 22px;
  fill: currentColor;
}

.control-btn .icon.hidden {
  display: none;
}

.time-display {
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.8rem;
  color: var(--dim);
  letter-spacing: 0.05em;
  user-select: none;
}

/* Volume control block */
.volume-container {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 8px;
}

#volume-bar {
  -webkit-appearance: none;
  appearance: none;
  width: 80px;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.1);
  outline: none;
  cursor: pointer;
}

#volume-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--ink);
  transition: transform 0.1s;
}

#volume-bar:hover::-webkit-slider-thumb {
  transform: scale(1.3);
  background: var(--glow);
}

/* Select dropdown */
.speed-container {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-left: auto; /* Push speed control to the right */
}

.control-label {
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.72rem;
  color: var(--dim);
  text-transform: uppercase;
}

.custom-select {
  background: var(--btn-bg);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.78rem;
  padding: 6px 10px;
  border-radius: 6px;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

.custom-select:hover, .custom-select:focus {
  border-color: var(--hot);
}

/* Sync timing shifting dashboard */
.sync-shifting-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel-overlay);
  border-top: 1px solid var(--line);
  padding: 8px 18px;
}

.sync-label {
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.72rem;
  color: var(--dim);
}

.shift-buttons {
  display: flex;
  align-items: center;
  gap: 6px;
}

.shift-btn {
  background: var(--btn-bg);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 4px 10px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
}

.shift-btn:hover {
  border-color: var(--hot);
  color: var(--hot);
}

.shift-btn.reset {
  font-size: 0.85rem;
  padding: 2px 8px;
  line-height: 1.2;
}

.shift-btn.reset:hover {
  border-color: var(--glow);
  color: var(--glow);
}

.current-shift {
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--glow);
  padding: 0 4px;
}

/* File Loaders Row */
.file-loaders-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
}

.file-btn {
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.78rem;
  font-weight: 500;
  padding: 12px 18px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--btn-bg);
  color: var(--ink);
  cursor: pointer;
  transition: all 0.2s ease;
}

.file-btn:hover {
  border-color: var(--hot);
  box-shadow: 0 4px 12px rgba(255, 46, 126, 0.15);
}

.file-btn:active {
  transform: scale(0.97);
}

.file-btn input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.file-btn.ok {
  border-color: var(--glow);
  color: var(--glow);
  background: rgba(46, 255, 213, 0.05);
  box-shadow: 0 0 10px rgba(46, 255, 213, 0.1);
}

.tag {
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.75rem;
  color: var(--dim);
  margin-left: auto;
}

/* Next Lyric Line Panel */
.next-cue-panel {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 16px 20px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
}

.next-cue-panel h2 {
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--dim);
  margin-bottom: 8px;
}

.preview-wrapper {
  display: flex;
  flex-direction: column;
}

.preview {
  color: var(--dim);
  font-weight: 700;
  font-size: 1.15rem;
  transition: color 0.2s ease;
  min-height: 1.6rem;
}

.preview.live {
  color: var(--hot);
  text-shadow: 0 0 8px rgba(255, 46, 126, 0.3);
}

.countdown-bar-container {
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 2px;
  margin-top: 10px;
  overflow: hidden;
}

.countdown-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--hot), var(--glow));
  transition: width 0.05s linear;
}

/* Sidebar - Timeline */
.timeline-sidebar {
  background: var(--panel-solid);
  border: 1px solid var(--line);
  border-radius: 20px;
  display: flex;
  flex-direction: column;
  max-height: 600px;
  box-shadow: var(--sidebar-shadow);
}

@media (max-width: 950px) {
  .timeline-sidebar {
    max-height: 380px;
  }
}

.sidebar-header {
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.sidebar-header h3 {
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--ink);
}

.cue-count {
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.72rem;
  color: var(--dim);
  background: rgba(255, 255, 255, 0.04);
  padding: 2px 8px;
  border-radius: 12px;
  border: 1px solid var(--line);
}

.cue-list {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
}

/* Custom scrollbars */
.cue-list::-webkit-scrollbar {
  width: 6px;
}

.cue-list::-webkit-scrollbar-track {
  background: transparent;
}

.cue-list::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
}

.cue-list::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.cue-placeholder {
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.75rem;
  color: var(--dim);
  text-align: center;
  margin-top: 40px;
  line-height: 1.6;
  padding: 0 10px;
}

.cue-item {
  padding: 11px 14px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.015);
  border: 1px solid rgba(255, 255, 255, 0.03);
  margin-bottom: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.cue-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.2);
}

/* Speaker Active Cue Item Styles */
.cue-item.speaker-0.active {
  background: rgba(0, 210, 180, 0.08);
  border-color: var(--speaker-0);
  box-shadow: 0 0 10px rgba(0, 210, 180, 0.06);
}
.cue-item.speaker-1.active {
  background: rgba(255, 46, 126, 0.08);
  border-color: var(--speaker-1);
  box-shadow: 0 0 10px rgba(255, 46, 126, 0.06);
}
.cue-item.speaker-2.active {
  background: rgba(200, 134, 0, 0.08);
  border-color: var(--speaker-2);
  box-shadow: 0 0 10px rgba(200, 134, 0, 0.06);
}
.cue-item.speaker-3.active {
  background: rgba(125, 73, 227, 0.08);
  border-color: var(--speaker-3);
  box-shadow: 0 0 10px rgba(125, 73, 227, 0.06);
}

.cue-item.speaker-0.active .cue-time { color: var(--speaker-0); }
.cue-item.speaker-1.active .cue-time { color: var(--speaker-1); }
.cue-item.speaker-2.active .cue-time { color: var(--speaker-2); }
.cue-item.speaker-3.active .cue-time { color: var(--speaker-3); }

.cue-time {
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.7rem;
  color: var(--dim);
  display: block;
  margin-bottom: 4px;
}

.cue-item.active .cue-time {
  color: var(--glow);
}

.cue-text {
  font-size: 0.88rem;
  font-weight: 500;
  line-height: 1.35;
  color: rgba(244, 240, 255, 0.8);
  transition: color 0.15s;
}

.cue-item.active .cue-text {
  color: var(--ink);
  font-weight: 700;
}

/* Footer Section */
.howto {
  width: min(1200px, 100%);
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 24px;
}

.howto h3 {
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.85rem;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 12px;
  letter-spacing: 0.05em;
}

.howto ul {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}

.howto li {
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.78rem;
  color: var(--dim);
  line-height: 1.6;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--line);
  padding: 12px 16px;
  border-radius: 8px;
}

.howto b {
  color: var(--ink);
  display: block;
  margin-bottom: 4px;
}

.howto code {
  background: var(--btn-bg);
  border: 1px solid var(--line);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--glow);
  font-size: 0.75rem;
}

/* Bande Rythmo (Dubbing Panel) styling */
.rythmo-wrap {
  border-top: 1px solid var(--line);
  background: var(--panel-darker);
  height: 110px;
  width: 100%;
  position: relative;
  overflow: hidden;
  box-shadow: var(--inner-shadow);
}

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

.rythmo-wrap.hidden {
  display: none !important;
}

/* Dubbing Studio Panel styling */
.dubbing-panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  background: var(--panel-overlay);
  border-top: 1px solid var(--line);
  padding: 8px 18px;
  gap: 8px;
}

.dubbing-buttons {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.dub-btn {
  background: var(--btn-bg);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 6px 12px;
  border-radius: 5px;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: center;
  gap: 6px;
}

.dub-btn:hover:not(:disabled) {
  border-color: var(--hot);
  color: var(--hot);
}

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

.dub-btn.recording {
  border-color: var(--hot);
  color: var(--hot);
  box-shadow: 0 0 10px rgba(255, 46, 126, 0.3);
  animation: pulse-border 1.5s infinite alternate;
}

.rec-dot {
  width: 8px;
  height: 8px;
  background: #ff2e7e;
  border-radius: 50%;
  display: inline-block;
  transition: transform 0.2s;
}

.dub-btn.recording .rec-dot {
  animation: pulse-dot 1s infinite alternate;
}

@keyframes pulse-dot {
  from { transform: scale(1); opacity: 0.5; }
  to { transform: scale(1.3); opacity: 1; }
}

@keyframes pulse-border {
  from { border-color: rgba(255, 46, 126, 0.4); }
  to { border-color: rgba(255, 46, 126, 1); }
}

.dub-status {
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.72rem;
  color: var(--dim);
  margin-left: 5px;
}

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

/* Whisper Auto-transcription spinner & progress */
@keyframes spin {
  to { transform: rotate(360deg); }
}
.whisper-spinner {
  border: 3px solid rgba(255, 46, 126, 0.15);
  border-top: 3px solid var(--hot);
  border-radius: 50%;
  width: 36px;
  height: 36px;
  animation: spin 1s linear infinite;
  margin-bottom: 10px;
}

/* Theme Toggle Button */
.theme-toggle-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  background: var(--panel-solid);
  border: 1px solid var(--line);
  color: var(--ink);
  font-family: 'Spline Sans Mono', monospace;
  font-size: 0.72rem;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: 20px;
  cursor: pointer;
  z-index: 100;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  box-shadow: var(--sidebar-shadow);
}

.theme-toggle-btn:hover {
  border-color: var(--hot);
  transform: translateY(-1px);
}

@media (max-width: 768px) {
  .theme-toggle-btn {
    position: static;
    margin-top: 10px;
    margin-bottom: 10px;
  }
}

/* =====================================================
   v5 — Éditeur de répliques, transcription, export vidéo
   ===================================================== */

.cue-item { position: relative; }
.cue-edit-btn {
  position: absolute; top: 6px; right: 6px;
  background: var(--btn-bg); border: 1px solid var(--line); border-radius: 6px;
  font-size: 0.75rem; padding: 2px 6px; cursor: pointer; opacity: 0;
  transition: opacity 0.15s ease;
}
.cue-item:hover .cue-edit-btn, .cue-item:focus-within .cue-edit-btn, .cue-item.active .cue-edit-btn { opacity: 1; }
@media (hover: none) { .cue-edit-btn { opacity: 1; } }

.cue-item.editing { cursor: default; border-color: var(--hot); background: var(--panel-solid); }
.cue-editor { display: flex; flex-direction: column; gap: 6px; }
.cue-editor textarea {
  width: 100%; resize: vertical; font: inherit; font-size: 0.85rem; color: var(--ink);
  background: var(--panel-darker); border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px;
}
.ed-times { display: flex; align-items: center; justify-content: space-between; gap: 6px; font-size: 0.72rem; color: var(--dim); }
.ed-times input {
  width: 84px; margin-left: 4px; font-family: "Spline Sans Mono", monospace; font-size: 0.75rem; color: var(--ink);
  background: var(--panel-darker); border: 1px solid var(--line); border-radius: 5px; padding: 3px 5px;
}
.ed-actions { display: flex; flex-wrap: wrap; gap: 5px; }
.ed-btn {
  font: inherit; font-size: 0.7rem; padding: 4px 8px; border-radius: 6px; cursor: pointer;
  background: var(--btn-bg); color: var(--ink); border: 1px solid var(--line);
}
.ed-btn:hover { border-color: var(--hot); }
.ed-save { background: var(--glow); color: #fff; border-color: transparent; }
.ed-delete { margin-left: auto; }

.editor-toolbar { display: flex; gap: 6px; margin-top: 4px; }
.editor-toolbar .dub-btn { flex: 1; justify-content: center; font-size: 0.68rem; padding: 5px 8px; }
.whisper-device { font-size: 0.62rem; color: var(--dim); text-align: center; }
.autosave-note { font-size: 0.66rem; color: var(--dim); line-height: 1.4; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; }
.autosave-note:empty { display: none; }
.autosave-action {
  font: inherit; font-weight: 700; color: var(--ink); cursor: pointer;
  background: none; border: 1px solid var(--line); border-radius: 6px; padding: 2px 7px;
}
.autosave-action:hover { border-color: var(--dim); }

.whisper-progress-container {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 30px 20px; text-align: center; gap: 12px; color: var(--dim); height: 100%;
}
.whisper-status { font-size: 0.85rem; font-weight: bold; color: var(--ink); }
.whisper-substatus { font-size: 0.72rem; color: var(--dim); }
.whisper-bar-bg { width: 100%; height: 6px; background: var(--panel-overlay); border-radius: 3px; overflow: hidden; margin-top: 5px; }
.whisper-bar { width: 0%; height: 100%; background: linear-gradient(90deg, var(--glow), var(--hot)); transition: width 0.3s ease; }
.whisper-note { font-size: 0.65rem; color: var(--dim); line-height: 1.3; margin-top: 10px; }

.dub-btn-accent {
  background: linear-gradient(135deg, var(--glow), var(--hot)); color: #fff; border-color: transparent; text-decoration: none;
}
.dub-btn-accent:disabled { background: var(--btn-bg); color: var(--dim); }

.export-dialog {
  margin: auto; position: fixed; inset: 0; height: fit-content; max-height: calc(100vh - 32px); overflow: auto;
  width: min(460px, calc(100vw - 32px)); border: 1px solid var(--line); border-radius: 16px;
  background: var(--panel-solid); color: var(--ink); padding: 20px 22px; box-shadow: var(--shadow);
}
.export-dialog::backdrop { background: rgba(10, 6, 20, 0.55); backdrop-filter: blur(3px); }
.export-dialog h3 { margin: 0 0 8px; }
.export-dialog fieldset { border: 1px solid var(--line); border-radius: 10px; margin: 10px 0; padding: 8px 12px; }
.export-dialog legend { font-size: 0.72rem; color: var(--dim); padding: 0 4px; }
.export-dialog label { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; margin: 4px 0; }
.export-volume input { flex: 1; }
.export-note { font-size: 0.78rem; color: var(--dim); margin: 6px 0; }
.export-bar-bg { height: 8px; border-radius: 4px; background: var(--panel-overlay); overflow: hidden; }
.export-bar { width: 0%; height: 100%; background: linear-gradient(90deg, var(--glow), var(--hot)); transition: width 0.3s ease; }
.export-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 12px; }

kbd {
  font-family: "Spline Sans Mono", monospace; font-size: 0.75em; padding: 1px 5px;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--panel-solid);
}
