    /* [BLOCK_01: Core Styles & Themes] */
    :root {
      --bg-main: #000; --bg-lyrics: #181818; --bg-controls: #222;
      --text-main: #fff; --border: #333; --btn-bg: #333; --accent: #f1c40f; 
    }
    [data-theme="light"] {
      --bg-main: #eee; --bg-lyrics: #ffffff; --bg-controls: #f8f8f8;
      --text-main: #1a1a1a; --border: #ddd; --btn-bg: #e0e0e0; --accent: #e67e22;
    }
    * { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
    body, html { margin: 0; padding: 0; height: 100%; width: 100%; font-family: -apple-system, sans-serif; background: var(--bg-main); color: var(--text-main); overflow: hidden; }
    
    /* Disable native text selection */
    .lyric-section {
      -webkit-user-select: none;
      user-select: none;
    }
    
     .word.selected {
       background: rgba(241,196,15,0.35);
       border-radius: 6px;
    }

    #login-overlay {
  position: fixed !important;
  inset: 0 !important;
  width: 100vw;
  height: 100vh;
}

    /* [BLOCK_02: Visual Components - Enhanced for Audio Poster] */
    .main-app { display: flex; flex-direction: column; height: 100vh; }
    .video-section { 
      flex: 0 0 auto; 
      background: #000; 
      display: flex; 
      flex-direction: column; 
      align-items: center; 
      justify-content: center; 
      position: relative;
      border-bottom: 1px solid var(--border);
      min-height: 0;
    }

    #audio-poster {
      width: 100%;
      max-height: 50vh;
      object-fit: cover;
      display: none;
    }

    #now-playing-title { 
      width: 100%; 
      text-align: center; 
      font-size: 26px;
      font-weight: bold; 
      color: #fff;
      padding: 12px; 
      overflow: hidden; 
      text-overflow: ellipsis; 
      white-space: nowrap; 
      z-index: 10;
      background: transparent;
    }

    .poster-active #now-playing-title {
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%, -50%);
      background: transparent; 
      color: #fff;
      pointer-events: none;
    }

    video { 
      width: 100%; 
      max-height: 50vh; 
      object-fit: contain; 
      display: none; 
      background: #000; 
    }

    .lyric-section { flex: 1; overflow-y: auto; background: var(--bg-lyrics); padding: 20px; text-align: center; scroll-behavior: smooth; }
    .lyric-line { margin: 25px 0; transition: 0.4s; opacity: 0.15; position: relative; } 
    /* ===== Sentence mode ===== */
:not(.chunk-mode) .lyric-line.active-line {
  opacity: 1;
  transform: scale(1.02);
}

/* ===== Chunk mode ===== */
.chunk-mode .lyric-line {
  opacity: 1;              /* sentence no longer controls dimming */
}

.chunk-mode .chunk {
  opacity: 0.15;           /* all chunks dim by default */
  transition: 0.4s;
}

.chunk-mode .chunk.active-line {
  opacity: 1;
  transform: scale(1.02);
 
}
   
    .word { display: inline-block; font-size: 26px; padding: 2px 4px; cursor: pointer; border-radius: 6px; color: var(--text-main); }
    
    .chunk {
  display: inline;
  white-space: normal;
}

.chunk br {
  display: block;
  height: 0;
}
    .timestamp {
  font-size: 12px;
  opacity: 0.4;
  margin-right: 6px;
  font-weight: normal;
}

    .word.highlight { color: var(--accent) !important; font-weight: bold; }
    .word.blurred { filter: blur(5px); opacity: 0.3 !important; }
    .word.revealed { filter: blur(0) !important; opacity: 1 !important; color: var(--accent) !important; }
    .ai-btn { background: none; border: none; font-size: 18px; cursor: pointer; margin-left: 10px; opacity: 0.4; color: var(--accent); vertical-align: middle; }
    
    .control-section { background: var(--bg-controls); border-top: 1px solid var(--border); padding: 10px 12px 15px; display: flex; flex-direction: column; gap: 12px; }
    .row { display: flex; justify-content: space-between; align-items: center; width: 100%; gap: 8px; }
    .btn-ui { background: var(--btn-bg); border: none; color: var(--text-main); font-size: 18px; cursor: pointer; width: 44px; height: 44px; border-radius: 8px; display: flex; align-items: center; justify-content: center; }
    .btn-ui.active { color: var(--accent); border: 1px solid var(--accent); }
    select { background: var(--btn-bg); color: var(--text-main); border: 1px solid var(--border); padding: 8px; border-radius: 8px; font-size: 14px; flex-grow: 1; height: 44px; }
    
    .overlay { display: none; position: fixed; inset: 0; background: var(--bg-main); z-index: 2000; overflow-y: auto; padding: 20px; }
    .modal { display: none; position: fixed; z-index: 3000; left: 0; top: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.85); }
    .modal-content { background: var(--bg-controls); margin: 5% auto; padding: 20px; border: 1px solid var(--accent); width: 95%; max-width: 650px; border-radius: 15px; display: flex; flex-direction: column; max-height: 85vh; color: var(--text-main); position: relative; 
}
    #ai-response-text { flex-grow: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; padding: 10px; }
    .bubble { padding: 14px 18px; border-radius: 15px; line-height: 1.6; font-size: 15px; word-wrap: break-word; }
    .bubble-ai { align-self: flex-start; background: var(--bg-main); border: 1px solid var(--border); border-bottom-left-radius: 2px; }
    .bubble-user { align-self: flex-end; background: var(--accent); color: #000; border-bottom-right-radius: 2px; }
    .nb-entry { background: var(--bg-controls); padding: 15px; border-radius: 8px; margin-bottom: 15px; border-left: 4px solid var(--accent); text-align: left; }
    .nb-word { font-size: 20px; font-weight: bold; color: var(--accent); display: block; }
    .nb-context { font-size: 14px; opacity: 0.8; cursor: pointer; display: block; margin: 10px 0; font-style: italic; }
    .nb-source { font-size: 11px; opacity: 0.4; display: block; margin-top: 5px; font-style: normal; }
    .nb-actions { display: flex; gap: 10px; }
    .nb-btn { background: var(--btn-bg); border: 1px solid var(--border); color: var(--text-main); padding: 6px 12px; border-radius: 4px; cursor: pointer; font-size: 12px; }
    #toast { visibility: hidden; position: fixed; left: 50%; bottom: 120px; transform: translateX(-50%); background: var(--accent); color: #000; padding: 10px 20px; border-radius: 8px; font-weight: bold; z-index: 4000; }
    #toast.show { visibility: visible; }
    .loading-dots:after { content: ' .'; animation: dots 1.5s steps(5, end) infinite; }
    @keyframes dots { 0%, 20% { color: rgba(0,0,0,0); } 40% { color: var(--text-main); } 60% { text-shadow: .5em 0 0 var(--text-main); } 80%, 100% { text-shadow: .5em 0 0 var(--text-main), 1em 0 0 var(--text-main); } }
    
/* ===== Option 2: Semantic control rows (override safely) ===== */

/* Shared control-row behavior */
.control-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

/* Library row: selector + favourites */
/* Library row: selector left, actions right, NO wrapping */
#now-playing-title-bar {
  flex: 1;
  padding: 8px 12px;
  background: var(--btn-bg);
  border-radius: 8px;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.library-row {
  justify-content: space-between;
  flex-wrap: nowrap;
}

/* Let the song selector shrink instead of wrapping */
.library-row #song-selector {
  flex: 1 1 auto;
  min-width: 0;
}

/* Keep fav buttons fixed */
.library-row .btn-ui {
  flex: 0 0 auto;
}


/* Transport row: playback controls */
 /* Transport row: spread controls to gain horizontal room (Firefox-safe) */
.transport-row {
  justify-content: space-between;
  flex-wrap: nowrap;
}

/* Group transport buttons visually tighter */
.transport-row .btn-ui {
  margin: 0;
}


/* Prevent buttons / selects from shrinking */
.control-row .btn-ui,
.control-row select {
  flex: 0 0 auto;
}

#fav-toggle-btn {
  font-size: 18px;
  transition: transform 0.2s, color 0.2s;
  color: #aaa; /* default (not favourited) */
}

#fav-toggle-btn.fav-active {
  color: gold;
  transform: scale(1.2);
}

@keyframes fadeInLogin {
  from {
    opacity: 0;
    transform: translateY(15px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ===== Sidebar Layout ===== */

.app-container {
  display: flex;
  height: 100vh;
  width: 100%;
}

.sidebar {
  width: 260px;
  background: #111;
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 15px;
}

.main-app {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* Sidebar Elements */

.sidebar h3 {
  font-size: 14px;
  margin: 14px 0 8px;
  opacity: 0.6;
}

.sidebar-item {
  padding: 8px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  margin-bottom: 4px;
  transition: 0.2s;
}

.sidebar-item:hover {
  background: var(--btn-bg);
}

.sidebar-item.active {
  background: var(--accent);
  color: #000;
  font-weight: bold;
}

/* ===== Mobile Menu Toggle Button ===== */

.menu-toggle {
  display: none;
  position: fixed;
  top: 15px;
  left: 15px;
  z-index: 5000;
  background: #222;
  color: white;
  border: none;
  padding: 10px 14px;
  font-size: 20px;
  border-radius: 6px;
}

/* ===== Mobile Layout Rules ===== */

@media (max-width: 768px) {

  .sidebar {
    position: fixed;
    left: -260px;
    top: 0;
    height: 100%;
    transition: 0.3s ease;
    z-index: 4000;
  }

  .sidebar.open {
  left: 0;
  box-shadow: 4px 0 20px rgba(0,0,0,0.5);
}

  .menu-toggle {
    display: block;
  }

  .app-container {
    flex-direction: column;
  }
}