/* General Styles & Custom Design System */
:root {
  --bg-primary: #0b0f19;
  --bg-secondary: rgba(17, 24, 39, 0.7);
  --bg-tertiary: #1f2937;
  --accent-color: #ff2e93;
  --accent-glow: rgba(255, 46, 147, 0.4);
  --text-primary: #f3f4f6;
  --text-secondary: #9ca3af;
  --text-muted: #6b7280;
  --border-color: rgba(255, 255, 255, 0.08);
  --glass-bg: rgba(17, 24, 39, 0.6);
  --glass-border: rgba(255, 255, 255, 0.05);
  --glass-blur: blur(12px);
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --shadow-lg: 0 10px 25px -5px rgba(0, 0, 0, 0.3), 0 8px 10px -6px rgba(0, 0, 0, 0.3);
  --radius-lg: 12px;
  --radius-md: 8px;
  --radius-sm: 4px;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Layout */
.app-container {
  display: grid;
  grid-template-rows: 60px 1fr auto;
  height: 100vh;
  width: 100vw;
}

/* Header styling */
.app-header {
  background-color: rgba(11, 15, 25, 0.85);
  backdrop-filter: var(--glass-blur);
  border-bottom: 1px solid var(--border-color);
  padding: 0 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 100;
}

.logo-section {
  display: flex;
  align-items: center;
  gap: 10px;
}

.logo-icon {
  color: var(--accent-color);
  font-size: 28px;
  text-shadow: 0 0 10px var(--accent-glow);
}

.logo-section h1 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #fff 30%, var(--accent-color) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

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

.filename-display {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  background: rgba(255, 255, 255, 0.05);
  padding: 6px 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

/* Workspace */
.app-workspace {
  display: grid;
  grid-template-columns: 450px 1fr;
  height: 100%;
  overflow: hidden;
}

/* Sidebar Styling */
.sidebar-panel {
  background-color: var(--bg-secondary);
  backdrop-filter: var(--glass-blur);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  height: 100%;
  overflow: hidden;
  z-index: 90;
}

.tabs-header {
  display: flex;
  border-bottom: 1px solid var(--border-color);
  background: rgba(0, 0, 0, 0.2);
}

.tab-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-secondary);
  padding: 14px 8px;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: all 0.2s ease;
  border-bottom: 2px solid transparent;
}

.tab-btn:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.02);
}

.tab-btn.active {
  color: var(--accent-color);
  border-bottom-color: var(--accent-color);
  background: rgba(255, 46, 147, 0.03);
}

.tab-content-container {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.tab-content {
  display: none;
  flex-direction: column;
  gap: 20px;
}

.tab-content.active {
  display: flex;
}

/* Settings Group & Cards */
.settings-group {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.settings-group h3 {
  font-size: 0.9rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-secondary);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  padding-bottom: 8px;
  margin-bottom: 4px;
}

.settings-subsection {
  border: 1px solid rgba(255, 255, 255, 0.04);
  background: rgba(0, 0, 0, 0.15);
  border-radius: var(--radius-md);
  padding: 16px;
  margin-top: 14px;
  margin-bottom: 4px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.settings-subsection h4 {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent-color);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  padding-bottom: 6px;
  margin-bottom: 2px;
}

/* Control Elements */
label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
}

textarea {
  width: 100%;
  height: 120px;
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 10px;
  font-family: inherit;
  font-size: 0.85rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.2s;
}

textarea:focus {
  border-color: var(--accent-color);
}

select {
  width: 100%;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: border-color 0.2s;
}

select:focus {
  border-color: var(--accent-color);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.btn-primary {
  background-color: var(--accent-color);
  color: white;
  box-shadow: 0 4px 12px var(--accent-glow);
}

.btn-primary:hover:not(:disabled) {
  background-color: #ff52a7;
  transform: translateY(-1px);
}

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

.btn-secondary:hover:not(:disabled) {
  background-color: rgba(255, 255, 255, 0.08);
}

.btn-accent {
  background: linear-gradient(135deg, #a855f7 0%, var(--accent-color) 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(168, 85, 247, 0.3);
}

.btn-accent:hover:not(:disabled) {
  opacity: 0.95;
  transform: translateY(-1px);
}

.btn-danger {
  background-color: #ef4444;
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background-color: #f87171;
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-secondary);
}

.btn-text:hover {
  color: var(--text-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.75rem;
}

.btn-full {
  width: 100%;
}

.btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

/* Control Row Styling */
.control-row {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.control-row.checkbox-row {
  flex-direction: row;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  margin-top: 4px;
}

.control-row.checkbox-row input {
  cursor: pointer;
}

/* Color Picker Wrapper */
.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 12px;
  background-color: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 12px;
}

.color-picker-wrapper input[type="color"] {
  -webkit-appearance: none;
  border: none;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  background: none;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker-wrapper input[type="color"]::-webkit-color-swatch {
  border: 2px solid rgba(255, 255, 255, 0.2);
  border-radius: 50%;
}

.color-value {
  font-size: 0.8rem;
  font-family: monospace;
  color: var(--text-secondary);
}

/* Slider with Value Display */
.slider-with-value {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider-with-value input[type="range"] {
  flex: 1;
}

.slider-with-value span {
  display: none;
}

/* Custom sliders style */
input[type="range"] {
  -webkit-appearance: none;
  background: var(--bg-tertiary);
  height: 6px;
  border-radius: 3px;
  outline: none;
}

input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-color);
  cursor: pointer;
  box-shadow: 0 0 8px var(--accent-glow);
  transition: transform 0.1s;
}

input[type="range"]::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

/* Tap Sync Indicator panel */
.tap-indicator {
  background: rgba(255, 46, 147, 0.1);
  border: 1px dashed var(--accent-color);
  border-radius: var(--radius-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  animation: pulse-glow 2s infinite alternate;
}

.tap-indicator span {
  font-size: 0.85rem;
}

#tap-current-line {
  font-weight: 700;
  color: var(--accent-color);
}

#tap-next-line {
  color: var(--text-secondary);
  font-style: italic;
}

/* Help text */
.help-text {
  font-size: 0.75rem;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* Lyric List Editor */
.lyric-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.lyric-items-list {
  max-height: 250px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-right: 4px;
}

.empty-state {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  padding: 24px 0;
}

.lyric-item-row {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: rgba(255, 255, 255, 0.02);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px 10px;
  transition: all 0.2s;
}

.lyric-item-row:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background-color: rgba(255, 255, 255, 0.04);
}

.lyric-item-row.active {
  border-color: var(--accent-color);
  background-color: rgba(255, 46, 147, 0.05);
}

.lyric-item-index {
  font-size: 0.75rem;
  font-weight: bold;
  color: var(--text-muted);
  min-width: 20px;
}

.lyric-item-text {
  flex: 1;
  font-size: 0.8rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text-primary);
}

.lyric-item-times {
  display: flex;
  align-items: center;
  gap: 4px;
}

.time-input-field {
  width: 55px;
  background-color: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 3px 4px;
  font-size: 0.75rem;
  font-family: monospace;
  text-align: center;
  outline: none;
}

.time-input-field:focus {
  border-color: var(--accent-color);
}

.time-dash {
  color: var(--text-muted);
  font-size: 0.7rem;
}

/* Scrollbar Styles */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.15);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Center Player Preview Panel */
.player-panel {
  background-color: #0d1220;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  gap: 16px;
  overflow: hidden;
}

.video-container {
  position: relative;
  width: 100%;
  max-width: 900px;
  aspect-ratio: 16/9;
  background-color: black;
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg), 0 0 40px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

#player-canvas {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}

/* Player Bar Controls */
.player-bar {
  width: 100%;
  max-width: 900px;
  background-color: var(--bg-secondary);
  backdrop-filter: var(--glass-blur);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 12px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
}

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

.btn-icon {
  background: none;
  border: none;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.1s, color 0.2s;
  outline: none;
}

.btn-icon:hover:not(:disabled) {
  color: var(--accent-color);
  transform: scale(1.1);
}

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

.material-icons-round.md-36 {
  font-size: 36px;
}

.material-icons-round.md-24 {
  font-size: 24px;
}

.time-display {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-secondary);
  display: flex;
  gap: 6px;
  user-select: none;
  margin-right: 16px;
}

.time-divider {
  color: var(--text-muted);
}

.audio-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  max-width: 110px;
  margin-left: auto;
}

.icon-muted {
  font-size: 20px;
  color: var(--text-secondary);
}

#volume-control {
  flex: 1;
  min-width: 0; /* Allow the range slider to shrink in flexbox */
}

#playback-speed {
  width: 110px;
  padding: 6px 12px;
  font-size: 0.8rem;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
}

/* Export Dropdown styling */
.dropdown-export {
  position: relative;
  display: inline-block;
}

#btn-export {
  white-space: nowrap;
}

#btn-export .dropdown-arrow {
  margin-left: 4px;
  font-size: 18px;
  transition: transform 0.2s ease;
}

.dropdown-export.open #btn-export .dropdown-arrow {
  transform: rotate(180deg);
}

.dropdown-export .dropdown-menu {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 8px;
  background-color: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg), 0 10px 30px rgba(0, 0, 0, 0.4);
  z-index: 1000;
  min-width: 180px;
  overflow: hidden;
  display: none; /* Controlled via show class */
  flex-direction: column;
  padding: 4px 0;
}

.dropdown-export .dropdown-menu.show {
  display: flex;
  animation: dropdown-fade-in 0.2s ease;
}

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

.dropdown-export .dropdown-item {
  background: none;
  border: none;
  color: var(--text-primary);
  padding: 10px 16px;
  text-align: left;
  font-size: 0.85rem;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  width: 100%;
  transition: background-color 0.2s, color 0.2s;
}

.dropdown-export .dropdown-item:hover {
  background-color: var(--accent-color);
  color: white;
}

/* Export overlay spinner */
.recording-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(11, 15, 25, 0.9);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: opacity 0.3s;
}

.overlay-content {
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.spinner {
  font-size: 48px;
  color: var(--accent-color);
  animation: spin 1.5s linear infinite;
  text-shadow: 0 0 10px var(--accent-glow);
}

.overlay-content h2 {
  font-size: 1.5rem;
  font-weight: bold;
}

.overlay-content p {
  color: var(--text-secondary);
  font-family: monospace;
}

/* Bottom Timeline */
.app-timeline {
  background-color: rgba(11, 15, 25, 0.95);
  border-top: 1px solid var(--border-color);
  display: grid;
  grid-template-rows: 40px 1fr;
  padding: 0 20px 16px 20px;
  overflow: hidden;
  z-index: 90;
}

.timeline-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  user-select: none;
}

.timeline-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.timeline-title span {
  font-size: 18px;
}

.timeline-zoom {
  display: flex;
  align-items: center;
  gap: 8px;
}

.timeline-zoom span {
  font-size: 18px;
  color: var(--text-muted);
}

.timeline-zoom input[type="range"] {
  width: 100px;
}

.timeline-track-container {
  width: 100%;
  height: auto;
  overflow-x: auto;
  overflow-y: hidden;
  background-color: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  position: relative;
  user-select: none;
}

.timeline-ruler {
  position: sticky;
  top: 0;
  height: 24px;
  background-color: #0b0f19;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  pointer-events: auto;
  cursor: pointer;
  font-family: monospace;
  font-size: 0.7rem;
  color: var(--text-muted);
  z-index: 15;
}

/* Grid lines for ruler ticks */
.ruler-tick {
  position: absolute;
  bottom: 0;
  width: 1px;
  height: 6px;
  background-color: rgba(255, 255, 255, 0.15);
  pointer-events: none;
}

.ruler-tick.major {
  height: 12px;
  background-color: rgba(255, 255, 255, 0.3);
}

.ruler-label {
  position: absolute;
  top: 2px;
  transform: translateX(-50%);
  pointer-events: none;
}

.timeline-track {
  position: relative;
  left: 0;
  width: 100%; /* Will be dynamically expanded in JS based on duration & zoom */
  cursor: pointer;
}

/* Timeline Playhead line */
.timeline-playhead {
  position: absolute;
  top: -24px;
  bottom: 0;
  width: 2px;
  background-color: #ef4444;
  z-index: 20;
  pointer-events: auto;
  cursor: ew-resize;
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.8);
}

.timeline-playhead::after {
  content: '';
  position: absolute;
  top: 0;
  left: -8px; /* Offset to center the 18px click target over the 2px line */
  width: 18px;
  height: 100%;
  background: transparent;
  cursor: ew-resize;
}

.timeline-playhead::before {
  content: '';
  position: absolute;
  top: 0;
  left: -5px;
  width: 12px;
  height: 12px;
  background-color: #ef4444;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-135deg);
}

.timeline-block {
  position: absolute;
  background: linear-gradient(135deg, rgba(255, 46, 147, 0.2) 0%, rgba(168, 85, 247, 0.2) 100%);
  border: 1px solid rgba(255, 46, 147, 0.5);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  padding: 0 8px;
  overflow: hidden;
  cursor: grab;
  z-index: 2;
  transition: background-color 0.15s, border-color 0.15s;
}

.timeline-block.lyric-block {
  top: 9px;
  height: 46px;
}

.timeline-block:hover {
  background: linear-gradient(135deg, rgba(255, 46, 147, 0.35) 0%, rgba(168, 85, 247, 0.35) 100%);
  border-color: rgba(255, 46, 147, 0.8);
}

.timeline-block.active {
  background: linear-gradient(135deg, rgba(255, 46, 147, 0.5) 0%, rgba(168, 85, 247, 0.5) 100%);
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(255, 46, 147, 0.4);
}

.timeline-block-text {
  font-size: 0.75rem;
  color: white;
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  width: 100%;
  pointer-events: none;
}

/* Drag Handles for resizing */
.timeline-block-handle {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 6px;
  background-color: rgba(255, 255, 255, 0.15);
  cursor: ew-resize;
  transition: background-color 0.15s;
}

.timeline-block-handle:hover {
  background-color: rgba(255, 255, 255, 0.6);
}

.timeline-block-handle.left {
  left: 0;
  border-top-left-radius: var(--radius-md);
  border-bottom-left-radius: var(--radius-md);
}

.timeline-block-handle.right {
  right: 0;
  border-top-right-radius: var(--radius-md);
  border-bottom-right-radius: var(--radius-md);
}

.timeline-marquee {
  position: absolute;
  background-color: rgba(255, 46, 147, 0.15);
  border: 1.5px dashed var(--accent-color);
  border-radius: var(--radius-sm);
  pointer-events: none;
  z-index: 1005;
  display: none;
  box-shadow: 0 0 8px rgba(255, 46, 147, 0.2);
}

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


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

@keyframes pulse-glow {
  from { box-shadow: 0 0 4px rgba(255, 46, 147, 0.2); }
  to { box-shadow: 0 0 12px rgba(255, 46, 147, 0.5); }
}

/* Styled text input fields inside the settings sidebar panels */
.text-input-styled {
  width: 100%;
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 0.85rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.text-input-styled:focus {
  border-color: var(--accent-color);
  box-shadow: 0 0 8px rgba(255, 46, 147, 0.25);
}

/* Timeline shaded region for the intro track visual guide */
.timeline-intro-region {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(168, 85, 247, 0.08); /* Transparent purple tint */
  border-right: 2px dashed rgba(168, 85, 247, 0.4);
  pointer-events: none; /* Let seek clicks pass through */
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.timeline-intro-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(168, 85, 247, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  pointer-events: none;
  user-select: none;
}

/* Tap Sync Previous Line Guide */
.tap-prev-line {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Bulk Offset Container */
.bulk-offset-container {
  display: flex;
  align-items: center;
  gap: 8px;
  background-color: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  margin-bottom: 12px;
}

.bulk-offset-container.hidden {
  display: none !important;
}

/* Lyric Item Checkbox */
.lyric-item-checkbox {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: var(--accent-color);
}

/* Draggable Break Item */
.draggable-break-item {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.12) 0%, rgba(255, 46, 147, 0.12) 100%);
  border: 1px dashed var(--accent-color);
  border-radius: var(--radius-md);
  padding: 10px;
  cursor: grab;
  user-select: none;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.draggable-break-item:hover {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.22) 0%, rgba(255, 46, 147, 0.22) 100%);
  border-style: solid;
  transform: translateY(-1px);
}

.draggable-break-item:active {
  cursor: grabbing;
}

/* Timeline Break Block */
.timeline-block.break-block {
  top: 74px;
  height: 46px;
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.22) 0%, rgba(79, 70, 229, 0.22) 100%);
  border: 1px solid rgba(168, 85, 247, 0.55);
}

.timeline-block.break-block:hover {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.35) 0%, rgba(79, 70, 229, 0.35) 100%);
  border-color: rgba(168, 85, 247, 0.85);
}

.timeline-block.break-block.active {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.55) 0%, rgba(79, 70, 229, 0.55) 100%);
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.45);
}

/* Timeline Image Block */
.timeline-block.image-block {
  top: 139px;
  height: 46px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.22) 0%, rgba(5, 150, 105, 0.22) 100%);
  border: 1px solid rgba(16, 185, 129, 0.55);
}

.timeline-block.image-block:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.35) 0%, rgba(5, 150, 105, 0.35) 100%);
  border-color: rgba(16, 185, 129, 0.85);
}

.timeline-block.image-block.active {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.55) 0%, rgba(5, 150, 105, 0.55) 100%);
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(16, 185, 129, 0.45);
}

/* Timeline Text Block */
.timeline-block.text-block {
  height: 46px;
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.22) 0%, rgba(37, 99, 235, 0.22) 100%);
  border: 1px solid rgba(59, 130, 246, 0.55);
}

.timeline-block.text-block:hover {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.35) 0%, rgba(37, 99, 235, 0.35) 100%);
  border-color: rgba(59, 130, 246, 0.85);
}

.timeline-block.text-block.active {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.55) 0%, rgba(37, 99, 235, 0.55) 100%);
  border-color: #ffffff;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.45);
}

/* Timeline Toolbar */
.timeline-tools-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 4px 8px;
}

.draggable-toolbar-item {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: grab;
  user-select: none;
  transition: all 0.2s ease;
}

.draggable-toolbar-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: var(--accent-color);
}

.draggable-toolbar-item:active {
  cursor: grabbing;
}

.draggable-toolbar-item span.material-icons-round {
  font-size: 14px;
}

/* Image Assets gallery list */
.image-assets-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(80px, 1fr));
  gap: 12px;
  max-height: 250px;
  overflow-y: auto;
  padding: 4px 0;
}

.image-asset-card {
  position: relative;
  aspect-ratio: 1;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: grab;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.25s, box-shadow 0.25s;
}

.image-asset-card:hover {
  border-color: var(--accent-color);
  box-shadow: 0 0 10px rgba(255, 46, 147, 0.15);
}

.image-asset-card img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s cubic-bezier(0.25, 1, 0.5, 1);
}

.image-asset-card:hover img {
  transform: scale(1.08);
}

.image-asset-title {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(to top, rgba(11, 15, 25, 0.9) 0%, rgba(11, 15, 25, 0.6) 100%);
  backdrop-filter: blur(2px);
  color: var(--text-secondary);
  font-size: 0.65rem;
  padding: 6px 4px 4px 4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  transition: color 0.2s, background-color 0.2s;
  z-index: 1;
}

.image-asset-card:hover .image-asset-title {
  color: var(--text-primary);
  background: linear-gradient(to top, rgba(11, 15, 25, 0.95) 0%, rgba(11, 15, 25, 0.75) 100%);
}

.btn-delete-asset {
  position: absolute;
  top: 4px;
  right: 4px;
  background: rgba(239, 68, 68, 0.9);
  color: white;
  border: none;
  border-radius: 50%;
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 13px;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity 0.2s, transform 0.2s, background-color 0.2s;
  z-index: 2;
}

.image-asset-card:hover .btn-delete-asset {
  opacity: 1;
  transform: scale(1);
}

.btn-delete-asset:hover {
  background: rgba(220, 38, 38, 1);
}

.image-asset-card:active {
  cursor: grabbing;
}

/* Timeline shaded region for the outro track visual guide */
.timeline-outro-region {
  position: absolute;
  top: 0;
  bottom: 0;
  background: rgba(239, 68, 68, 0.08); /* Transparent red tint */
  border-left: 2px dashed rgba(239, 68, 68, 0.4);
  pointer-events: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.timeline-outro-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: rgba(239, 68, 68, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.15em;
  pointer-events: none;
  user-select: none;
}

/* Modal Dialog Overlay & Panels */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(11, 15, 25, 0.75);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  transition: opacity 0.3s ease;
}

.modal-content {
  background: rgba(17, 24, 39, 0.85);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 420px;
  max-height: 95vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: var(--shadow-lg), 0 0 30px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  gap: 20px;
  animation: modal-enter 0.3s cubic-bezier(0.16, 1, 0.3, 1);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 12px;
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.modal-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 16px;
  margin-top: 4px;
}

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

/* Multi-Singer Singers List and Rows */
.singers-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding-right: 4px;
}

.singer-row {
  display: grid;
  grid-template-columns: 24px 1fr 75px 24px;
  gap: 6px;
  align-items: center;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 6px;
}

.singer-color-picker-wrapper {
  position: relative;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.singer-color-picker-wrapper input[type="color"] {
  position: absolute;
  width: 150%;
  height: 150%;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0;
  margin: 0;
  outline: none;
}

.singer-row input[type="text"] {
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  padding: 4px 6px;
  font-size: 0.8rem;
  width: 100%;
}

.singer-row input[type="text"]:focus {
  border-color: var(--accent-color);
  background: rgba(0, 0, 0, 0.4);
}

.singer-row select {
  padding: 4px 6px;
  font-size: 0.75rem;
  background-color: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  color: var(--text-primary);
  width: 100%;
}

.btn-delete-singer {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2px;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.btn-delete-singer:hover {
  color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.btn-delete-singer:disabled {
  opacity: 0.3;
  cursor: not-allowed;
  color: var(--text-muted) !important;
  background: none !important;
}

/* Lyric list singer Badge */
.lyric-singer-badge {
  width: 75px;
  padding: 3px;
  font-size: 0.7rem;
  background-color: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-primary);
  outline: none;
  cursor: pointer;
}

/* Timeline Lanes and lane headers */
.timeline-lane-row {
  position: absolute;
  left: 0;
  right: 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background-color: rgba(255, 255, 255, 0.01);
  pointer-events: none;
}

.timeline-lane-header {
  position: sticky;
  left: 0;
  display: flex;
  align-items: center;
  padding: 0 10px;
  width: 120px;
  background-color: #0b0f19;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: var(--text-secondary);
  font-size: 0.75rem;
  font-weight: 600;
  z-index: 25;
  pointer-events: auto;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.timeline-corner-header {
  position: sticky;
  left: 0;
  top: 0;
  width: 120px;
  height: 24px;
  background-color: #0b0f19;
  border-right: 1px solid rgba(255, 255, 255, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  z-index: 26;
  margin-bottom: -24px;
  pointer-events: auto;
}

/* Timeline Selection & Context Menu */
.timeline-block.selected {
  outline: 2px solid #ffffff;
  outline-offset: -1px;
  box-shadow: 0 0 12px rgba(255, 255, 255, 0.8), inset 0 0 8px rgba(255, 255, 255, 0.3) !important;
  z-index: 10 !important;
}

.context-menu {
  min-width: 150px;
  background: rgba(15, 15, 20, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 4px 0;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(12px);
  animation: contextMenuFadeIn 0.12s ease;
}

.context-menu-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.8rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background 0.15s;
}

.context-menu-item .material-icons-round {
  font-size: 16px;
}

.context-menu-item:hover {
  background: rgba(255, 255, 255, 0.08);
}

.context-menu-item.danger {
  color: #ef4444;
}

.context-menu-item.danger:hover {
  background: rgba(239, 68, 68, 0.15);
}

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

/* Lyric Page Break list styling */
.lyric-page-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 14px 0 6px 0;
  color: var(--text-muted);
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  width: 100%;
}

.lyric-page-divider::before,
.lyric-page-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.08);
  margin: 0 10px;
}

.btn-page-break {
  color: var(--text-muted);
  opacity: 0.45;
  transition: all 0.2s ease;
}

.btn-page-break:hover:not(:disabled) {
  opacity: 0.9;
  color: var(--text-primary);
}

.btn-page-break.active {
  color: var(--accent-color) !important;
  opacity: 1 !important;
  text-shadow: 0 0 6px var(--accent-glow);
}

/* Timeline Lyric Page Start block indicator */
.timeline-block.lyric-block.page-start {
  border-left: 4px solid #ffffff !important;
}

/* Make Edit Lyric modal wider by 150% (420px * 1.5 = 630px) */
#edit-lyric-modal .modal-content {
  max-width: 630px;
}

/* --- TYPOGRAPHY & COLORS OPTIMIZATION STYLES --- */
.control-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.control-grid-2 .control-row {
  margin-top: 0 !important;
}

.control-row-horizontal {
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

.control-row-horizontal label {
  margin-bottom: 0 !important;
  flex-shrink: 0;
}

.control-row-horizontal .color-picker-wrapper {
  flex-grow: 1;
  max-width: 140px;
}

/* Align button group (combined text alignment buttons) */
.align-button-group {
  display: flex;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  background-color: var(--bg-tertiary);
  height: 36px;
}

.align-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  padding: 0;
}

.align-btn:not(:last-child) {
  border-right: 1px solid var(--border-color);
}

.align-btn:hover {
  background-color: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

.align-btn.active {
  background-color: var(--accent-color);
  color: white;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.2);
}

/* Audio Loader Bar layout below the player controls */
.audio-loader-bar {
  width: 100%;
  max-width: 900px;
  display: flex;
  align-items: stretch;
  gap: 16px;
}

.audio-loader-bar .filename-display {
  flex: 1;
  max-width: none; /* Expand to fill the remaining width */
  background-color: rgba(0, 0, 0, 0.4);
  font-family: monospace;
  display: inline-flex;
  align-items: center;
  padding: 10px 16px;
  min-width: 0; /* Allows container to shrink and trigger text truncation */
  overflow: visible;
  text-overflow: clip;
}

.audio-loader-bar .file-name-text {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
  flex-shrink: 1;
}

.audio-loader-bar .file-name-ext {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Modal Visual Timeline */
.modal-visual-timeline {
  display: flex;
  height: 34px;
  width: 100%;
  background-color: rgba(0, 0, 0, 0.4);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
}

.modal-visual-timeline .timeline-part {
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.7rem;
  font-weight: 600;
  color: white;
  transition: width 0.1s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.modal-visual-timeline .fade-in-part {
  background: linear-gradient(90deg, rgba(255, 46, 147, 0) 0%, rgba(255, 46, 147, 0.6) 100%);
  border-right: 1px dashed rgba(255, 255, 255, 0.3);
}

.modal-visual-timeline .hold-part {
  background-color: rgba(255, 46, 147, 0.4);
}

.modal-visual-timeline .fade-out-part {
  background: linear-gradient(90deg, rgba(255, 46, 147, 0.6) 0%, rgba(255, 46, 147, 0) 100%);
  border-left: 1px dashed rgba(255, 255, 255, 0.3);
}

.modal-visual-timeline.text-timeline .fade-in-part {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0) 0%, rgba(59, 130, 246, 0.6) 100%);
}

.modal-visual-timeline.text-timeline .hold-part {
  background-color: rgba(59, 130, 246, 0.4);
}

.modal-visual-timeline.text-timeline .fade-out-part {
  background: linear-gradient(90deg, rgba(59, 130, 246, 0.6) 0%, rgba(59, 130, 246, 0) 100%);
}

.timeline-time-labels {
  display: flex;
  justify-content: space-between;
  font-family: monospace;
  font-size: 0.75rem;
  color: var(--text-secondary);
  margin-top: 4px;
}


