/* Import Poppins font */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700;800&display=swap');

/* Basic reset */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: "Poppins", sans-serif;
}

/* Dark background */
body {
  background-color: #1e1e1e;
  color: #ccc;
  height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Dark mode scrollbars (WebKit-based and Firefox) */
* {
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: #555 #2e2e2e; /* Firefox: thumb track */
}
*::-webkit-scrollbar {
  width: 8px;
  background-color: #2e2e2e; /* scrollbar track background */
}
*::-webkit-scrollbar-track {
  background: #2e2e2e;
}
*::-webkit-scrollbar-thumb {
  background-color: #555;
  border-radius: 4px;
  border: 1px solid #2e2e2e;
}
*::-webkit-scrollbar-thumb:hover {
  background: #777;
}

/* Overlay for cookie consent */
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
.hidden {
  display: none !important;
}
.overlay-content {
  background-color: #2e2e2e;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
  max-width: 400px;
  color: #fff;
}

/* Top Navigation Bar */
#top-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background-color: #2a2a2a;
  border-bottom: 2px solid #444;
  padding: 8px 16px;
  height: 48px;
  flex-shrink: 0;
}

.nav-left {
  display: flex;
  gap: 8px;
}

.nav-right {
  display: flex;
  gap: 8px;
  align-items: center;
}

.nav-btn {
  padding: 8px 20px;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  border-radius: 4px;
  background: #3a3a3a;
  color: #ccc;
  transition: all 0.2s;
  font-weight: 500;
}

.nav-btn:hover {
  background: #4a4a4a;
  color: #fff;
}

.nav-btn.active {
  background: #5a5a7a;
  color: #fff;
}

.workspace-btn {
  background: #4a4a7e;
  color: #fff;
}

.workspace-btn:hover {
  background: #5a5a8e;
}

.impressum-nav-link {
  color: #999;
  text-decoration: none;
  font-size: 0.85rem;
  padding: 4px 8px;
  transition: color 0.2s;
}

.impressum-nav-link:hover {
  color: #ccc;
  text-decoration: underline;
}

/* View Containers */
.view-container {
  display: none;
  flex: 1;
  overflow: hidden;
}

.view-container.active {
  display: flex;
  flex-direction: column;
}

/* Main container layout */
#main-container,
#ideas-main-container {
  display: flex;
  width: 100%;
  height: 100%;
  flex: 1;
}

/* Left panel: lyric/ideas bubbles area */
#left-panel,
#ideas-left-panel {
  flex: 2;
  padding: 10px;
  background-color: #1f1f1f;
  overflow-y: auto;
  border-right: 1px solid #444;
  display: flex;
  flex-direction: column;
}

/* Middle panel: vertical layout */
#middle-panel,
#ideas-middle-panel {
  flex: 0 0 140px;
  border-right: 1px solid #444;
  padding: 10px;
  background-color: #2a2a2a;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Stats container at bottom of middle panel */
#stats-container,
#ideas-stats-container {
  margin-top: auto; /* push stats to the bottom */
  border-top: 1px solid #444;
  padding-top: 8px;
  font-size: 0.9rem;
}

/* Right panel */
#right-panel,
#ideas-right-panel {
  flex: 1;
  padding: 10px;
  background-color: #1f1f1f;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Right panel buttons */
.right-panel-btn {
  width: 100%;
  padding: 12px;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  border-radius: 4px;
  background: #3a3a3a;
  color: #fff;
  transition: background 0.2s;
}
.right-panel-btn:hover {
  background: #4a4a4a;
}

/* File list container */
#file-list-container,
#ideas-file-list-container {
  flex: 1;
  border: 1px solid #555;
  border-radius: 4px;
  padding: 10px;
  overflow-y: auto;
  background-color: #2b2b2b;
}
#file-list li,
#ideas-file-list li {
  list-style: none;
  margin: 5px 0;
  padding: 5px;
  border-radius: 3px;
  transition: background 0.2s;
}
#file-list li:hover,
#ideas-file-list li:hover {
  background-color: #3c3c3c;
}
#file-list li.active-file,
#ideas-file-list li.active-file {
  background-color: #4a5568;
  font-weight: bold;
  border-left: 3px solid #63b3ed;
}

/* File item container with flexbox layout */
.file-item-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

/* File name - clickable and takes up remaining space */
.file-item-name {
  flex: 1;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* State button - cycles through states */
.file-state-button {
  padding: 4px 10px;
  font-size: 0.8rem;
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: filter 0.2s;
  flex-shrink: 0;
  min-width: 75px;
  text-transform: capitalize;
}

.file-state-button:hover {
  filter: brightness(1.15);
}

.file-state-button:focus {
  outline: none;
}

/* State-specific colors (using toned down colors) */
.file-state-button[data-state="open"] {
  background-color: #3e5e3e; /* greenish */
}

.file-state-button[data-state="closed"] {
  background-color: #5e3e3e; /* reddish */
}

.file-state-button[data-state="scheduled"] {
  background-color: #5e4e3e; /* brownish/amber */
}

.file-state-button[data-state="published"] {
  background-color: #3e3e5e; /* blueish */
}

.file-state-button[data-state="idea"] {
  background-color: #5e2e5e; /* purplish */
}

.file-state-button[data-state="dungeon"] {
  background-color: #3e5e5e; /* teal/cyan */
}

/* File Search input wrapper */
.search-input-wrapper {
  position: relative;
  margin-bottom: 6px;
}

/* File Search input */
#fileSearchInput {
  padding: 8px;
  padding-right: 35px; /* Make room for the clear button */
  border: 1px solid #555;
  border-radius: 4px;
  background-color: #2b2b2b;
  color: #ccc;
  width: 100%;
  box-sizing: border-box;
}

/* Clear search button */
.clear-search-btn {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  font-size: 16px;
  line-height: 1;
  opacity: 0.8;
  transition: opacity 0.2s;
}

.clear-search-btn:hover {
  opacity: 1;
}

/* Song Title input */
#songTitle {
  padding: 8px;
  border: 1px solid #555;
  border-radius: 4px;
  background-color: #2b2b2b;
  color: #ccc;
}

/* Ideas page file search input */
#ideasFileSearchInput {
  padding: 8px;
  padding-right: 35px; /* Make room for the clear button */
  border: 1px solid #555;
  border-radius: 4px;
  background-color: #2b2b2b;
  color: #ccc;
  width: 100%;
  box-sizing: border-box;
}

/* Ideas page song title input */
#ideasSongTitle {
  padding: 8px;
  border: 1px solid #555;
  border-radius: 4px;
  background-color: #2b2b2b;
  color: #ccc;
}

/* File filter buttons */
.file-filter-btn {
  padding: 4px 8px;
  font-size: 0.75rem;
  color: #fff;
  border: none;
  border-radius: 3px;
  cursor: pointer;
  transition: filter 0.2s, opacity 0.2s;
  flex-shrink: 0;
  min-width: 50px;
  text-transform: capitalize;
  opacity: 0.6;
}

.file-filter-btn:hover {
  filter: brightness(1.15);
}

.file-filter-btn.active {
  opacity: 1;
  filter: brightness(1.2);
}

.file-filter-btn[data-filter="all"] {
  background-color: #4a4a4a;
}

.file-filter-btn[data-filter="open"] {
  background-color: #3e5e3e; /* greenish - same as file state */
}

.file-filter-btn[data-filter="closed"] {
  background-color: #5e3e3e; /* reddish - same as file state */
}

.file-filter-btn[data-filter="scheduled"] {
  background-color: #5e4e3e; /* brownish/amber - same as file state */
}

.file-filter-btn[data-filter="published"] {
  background-color: #3e3e5e; /* blueish - same as file state */
}

.file-filter-btn[data-filter="idea"] {
  background-color: #5e2e5e; /* purplish - same as file state */
}

.file-filter-btn[data-filter="dungeon"] {
  background-color: #3e5e5e; /* teal/cyan - same as file state */
}

/* The container for lyric/ideas bubbles */
#lyric-bubbles-container,
#ideas-bubbles-container {
  padding: 5px;
  position: relative;
  flex: 1;
  overflow-y: auto;
}

/* Lyric Bubbles */
.lyric-bubble {
  border: 2px solid #555;
  border-radius: 8px;
  padding: 6px;
  margin-bottom: 10px;
  background-color: #2e2e2e; /* base bubble color if not overridden */
  position: relative;
  color: #ccc;
  padding-right: 20px; /* extra right padding for the remove X & no scroll conflict */
}

/* Bubble color by type */
.Intro {
  background-color: #2e2e3e;
}
.Verse {
  background-color: #2e3e2e;
}
.Pre-Chorus {
  background-color: #3e4e5e;
}
.Post-Chorus {
  background-color: #5e2e5e;
}
.Chorus {
  background-color: #3e2e2e;
}
.Hook {
  background-color: #2e5e5e;
}
.Bridge {
  background-color: #3e3e2e;
}
.Outro {
  background-color: #533e5e;
}
.Instrumental-Intro {
  background-color: #5e4e2e;
}
.Instrumental-Break {
  background-color: #4e5e2e;
}
.Custom {
  background-color: #5e5e5e;
}

/* The bubble creation buttons: bigger so "Instrumental Intro" & "Instrumental Break" fit on one line */
.bubble-btn,
.ideas-bubble-btn {
  width: 160px; /* increased to accommodate longer text */
  padding: 12px;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  border-radius: 4px;
  color: #fff;
  transition: filter 0.2s;
}
.bubble-btn:hover,
.ideas-bubble-btn:hover {
  filter: brightness(1.1);
}
.bubble-btn:disabled,
.bubble-btn.disabled,
.ideas-bubble-btn:disabled,
.ideas-bubble-btn.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  filter: grayscale(0.5);
}
.bubble-btn:disabled:hover,
.bubble-btn.disabled:hover,
.ideas-bubble-btn:disabled:hover,
.ideas-bubble-btn.disabled:hover {
  filter: grayscale(0.5);
}

/* Specific bubble-creation button colors */
.Intro-btn {
  background-color: #3e3e5e;
}
.Verse-btn {
  background-color: #3e5e3e;
}
.Pre-Chorus-btn {
  background-color: #4e5e6c;
}
.Post-Chorus-btn {
  background-color: #6e3e6e;
}
.Chorus-btn {
  background-color: #5e3e3e;
}
.Hook-btn {
  background-color: #3e6e6e;
}
.Bridge-btn {
  background-color: #5e5e3e;
}
.Outro-btn {
  background-color: #6c5e83;
}
.Instrumental-Intro-btn {
  background-color: #7e5e3e;
}
.Instrumental-Break-btn {
  background-color: #6e7e3e;
}
.Custom-btn {
  background-color: #777777;
}

/* Bubble header */
.bubble-header {
  font-weight: bold;
  margin-bottom: 4px;
  color: #fff;
}

/* Bubble text area:
   - fill entire bubble width
   - slightly brighter than bubble background
   - auto-resize, no scroll
*/
.bubble-text {
  width: 100%;
  border: none;
  outline: none;
  padding: 0;
  background-color: rgba(255,255,255,0.05);
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  overflow-y: hidden;
  margin-top: 2px;
  position: relative;
  z-index: 2;
}
.bubble-text.readonly {
  cursor: default;
  opacity: 0.8;
  background-color: transparent;
}

/* Highlight overlay for matching text */
.highlight-overlay {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  background-color: transparent;
  color: transparent;
  overflow: hidden;
  z-index: 1;
  white-space: pre-wrap;
  word-wrap: break-word;
}

.text-highlight {
  background-color: rgba(255, 235, 59, 0.5);
  color: inherit;
  padding: 0;
  margin: 0;
  border-radius: 2px;
}

/* Bubble "X" remove button at top right, in red */
.delete-bubble {
  position: absolute;
  top: 6px;
  right: 6px;
  cursor: pointer;
  font-weight: bold;
  background: none;
  border: none;
  font-size: 18px;
  color: #f00; /* red */
}

/* Dragging style */
.drop-indicator {
  position: absolute;
  left: 5px;
  right: 5px;
  height: 3px;
  background-color: #4CAF50;
  pointer-events: none;
  z-index: 1000;
  box-shadow: 0 0 5px rgba(76, 175, 80, 0.8);
}

/* Mode toggle button */
.mode-toggle-btn {
  width: 160px;
  padding: 12px;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  border-radius: 4px;
  color: #fff;
  background-color: #4a4a7e;
  transition: all 0.2s;
  font-weight: bold;
  margin-bottom: 10px;
}

.mode-toggle-btn:hover {
  filter: brightness(1.1);
}

.mode-toggle-btn.metadata-mode {
  background-color: #7e4a4a;
}

/* Metadata container */
#metadata-container,
#ideas-metadata-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0; /* Important for flex children to properly shrink */
}

#metadata-textarea,
#ideas-metadata-textarea {
  flex: 1;
  width: 100%;
  padding: 20px;
  background-color: #1f1f1f;
  color: #fff;
  border: none;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.6;
  resize: none; /* Disable manual resize */
  overflow-y: auto; /* Enable scrolling when content exceeds height */
  outline: none;
}

#metadata-textarea::placeholder {
  color: #888;
}

/* ========================================
   WHITEBOARD VIEW STYLES
   ======================================== */

#whiteboard-view {
  flex-direction: row;
  position: relative;
  background-color: #1e1e1e;
}

#whiteboard-sidebar {
  width: 280px;
  background-color: #2a2a2a;
  border-right: 2px solid #444;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#whiteboard-header {
  padding: 16px;
  border-bottom: 1px solid #444;
}

#whiteboard-header h3 {
  color: #fff;
  margin: 0 0 12px 0;
  font-size: 1.2rem;
}

#whiteboard-list {
  list-style: none;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
  position: relative;
}

#whiteboard-list li {
  padding: 12px;
  margin-bottom: 4px;
  background-color: #3a3a3a;
  border: 1px solid #555;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  color: #ccc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  position: relative;
}

#whiteboard-list li:hover {
  background-color: #4a4a4a;
  border-color: #777;
}

#whiteboard-list li.active {
  background-color: #5a5a7a;
  border-color: #7a7a9a;
  color: #fff;
}

#whiteboard-list li.dragging {
  opacity: 0.5;
  cursor: move;
}

.whiteboard-color-indicator {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid #555;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.whiteboard-color-indicator:hover {
  border-color: #fff;
  transform: scale(1.1);
}

.whiteboard-item-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Color picker for whiteboards */
.whiteboard-color-picker {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  background-color: #2e2e2e;
  border: 2px solid #555;
  border-radius: 6px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.whiteboard-color-option {
  width: 32px;
  height: 32px;
  border: 2px solid #555;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.whiteboard-color-option:hover {
  border-color: #fff;
  transform: scale(1.1);
}

.whiteboard-color-option.selected {
  border-color: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

#whiteboard-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
  cursor: default;
  flex: 1;
}

#whiteboard-canvas-inner {
  position: absolute;
  width: 50000px;
  height: 50000px;
  transform-origin: 0 0;
  /* Light grey grid background - thicker lines */
  background-image:
    linear-gradient(to right, rgba(100, 100, 100, 0.25) 2px, transparent 2px),
    linear-gradient(to bottom, rgba(100, 100, 100, 0.25) 2px, transparent 2px);
  background-size: 90px 90px; /* Grid size: half of standard sticky note height (180px / 2) */
}

/* Center marker - red cross behind sticky notes */
#whiteboard-canvas-inner::before {
  content: '';
  position: absolute;
  left: 25000px;
  top: 25000px;
  width: 80px;
  height: 80px;
  transform: translate(-50%, -50%);
  background:
    linear-gradient(to right, rgba(255, 60, 60, 0.6) 0%, rgba(255, 60, 60, 0.6) 100%),
    linear-gradient(to bottom, rgba(255, 60, 60, 0.6) 0%, rgba(255, 60, 60, 0.6) 100%);
  background-size: 4px 100%, 100% 4px;
  background-position: center center;
  background-repeat: no-repeat;
  pointer-events: none;
  z-index: 0;
}

.floating-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 60px;
  height: 60px;
  padding: 0;
  font-size: 2rem;
  font-weight: bold;
  line-height: 1;
  background-color: #5a5a7a;
  color: #fff;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  transition: all 0.2s;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
}

.floating-btn:hover {
  background-color: #6a6a8a;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5);
}

#whiteboard-settings {
  position: fixed;
  top: 60px;
  left: 20px;
  background-color: #2a2a2a;
  border: 2px solid #555;
  border-radius: 8px;
  padding: 12px 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
  z-index: 100;
}

.whiteboard-setting-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: #ccc;
  font-size: 0.95rem;
  user-select: none;
}

.whiteboard-setting-item input[type="checkbox"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.whiteboard-setting-item:hover {
  color: #fff;
}

.sticky-note {
  position: absolute;
  min-width: 100px;
  min-height: 100px;
  background-color: #3a3a3a;
  border: 2px solid #555;
  border-radius: 6px;
  padding: 8px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
  cursor: default;
  display: flex;
  flex-direction: column;
  resize: both;
  overflow: auto;
}

.sticky-note:hover {
  border-color: #777;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.4);
}

.sticky-note.selected {
  border-color: #5a5a7a;
  box-shadow: 0 0 0 3px rgba(90, 90, 122, 0.5), 0 6px 12px rgba(0, 0, 0, 0.4);
}

.sticky-note-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
  padding-bottom: 4px;
  border-bottom: 1px solid #555;
  cursor: default;
}

.sticky-note-handle {
  color: #888;
  font-size: 1.3rem;
  user-select: none;
  flex: 1;
  cursor: move;
  font-weight: bold;
}

.sticky-note-color-btn {
  background: none;
  border: none;
  font-size: 16px;
  cursor: pointer;
  padding: 0 4px;
  width: 24px;
  height: 20px;
  line-height: 20px;
  transition: transform 0.2s;
}

.sticky-note-color-btn:hover {
  transform: scale(1.2);
}

.sticky-note-delete {
  background: none;
  border: none;
  color: #f00;
  font-size: 20px;
  font-weight: bold;
  cursor: pointer;
  padding: 0;
  width: 20px;
  height: 20px;
  line-height: 20px;
}

.sticky-note-delete:hover {
  color: #ff4444;
}

/* Color picker for sticky notes */
.sticky-color-picker {
  position: absolute;
  top: 35px;
  right: 8px;
  background-color: #2e2e2e;
  border: 2px solid #555;
  border-radius: 6px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.sticky-color-option {
  width: 32px;
  height: 32px;
  border: 2px solid #555;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.sticky-color-option:hover {
  border-color: #fff;
  transform: scale(1.1);
}

.sticky-color-option.selected {
  border-color: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.sticky-note-content {
  flex: 1;
  width: 100%;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: inherit;
  font-size: 14px;
  resize: none;
  overflow-y: auto;
  line-height: 1.4;
}

/* Random Sticky Note Viewer Button - positioned above the add sticky note button */
.random-sticky-btn {
  bottom: 110px; /* Position well above the add sticky note button at bottom: 30px */
  z-index: 10;
}

/* Random Sticky Note Popup */
.random-sticky-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.random-sticky-popup-content {
  background-color: #2e2e2e;
  border-radius: 12px;
  width: 90%;
  max-width: 600px;
  max-height: 80vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.8);
  border: 2px solid #555;
}

.random-sticky-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  padding: 20px;
  border-bottom: 2px solid #444;
  position: relative;
}

.random-sticky-nav-btn {
  width: 60px;
  height: 60px;
  font-size: 1.5rem;
  cursor: pointer;
  border: 2px solid #555;
  border-radius: 8px;
  background: #3a3a3a;
  color: #fff;
  transition: all 0.2s;
  font-weight: bold;
}

.random-sticky-nav-btn:hover {
  background: #4a4a4a;
  border-color: #777;
  transform: scale(1.05);
}

.random-sticky-nav-btn:active {
  transform: scale(0.95);
}

.random-sticky-close-btn {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  font-size: 1.8rem;
  cursor: pointer;
  border: none;
  border-radius: 50%;
  background: #555;
  color: #fff;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.random-sticky-close-btn:hover {
  background: #777;
  transform: scale(1.1);
}

.random-sticky-textarea {
  flex: 1;
  width: 100%;
  padding: 30px;
  background: transparent;
  border: none;
  outline: none;
  color: #fff;
  font-family: inherit;
  font-size: 18px;
  resize: none;
  overflow-y: auto;
  line-height: 1.6;
  min-height: 300px;
}

.random-sticky-textarea::placeholder {
  color: #777;
}

/* ========================================
   RHYME POPUP MODAL
   ======================================== */

/* Overlay background */
.rhyme-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3000;
}

/* Large modal content box */
.rhyme-popup-content {
  background-color: #2e2e2e;
  border-radius: 12px;
  width: 90%;
  max-width: 1200px;
  height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.9);
  border: 2px solid #555;
  overflow: hidden;
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: #555 #2e2e2e; /* Firefox: thumb track */
}

/* Dark scrollbar for popup content */
.rhyme-popup-content::-webkit-scrollbar {
  width: 8px;
  background-color: #2e2e2e;
}

.rhyme-popup-content::-webkit-scrollbar-track {
  background: #2e2e2e;
}

.rhyme-popup-content::-webkit-scrollbar-thumb {
  background-color: #555;
  border-radius: 4px;
  border: 1px solid #2e2e2e;
}

.rhyme-popup-content::-webkit-scrollbar-thumb:hover {
  background: #777;
}

/* Dark scrollbar for all elements inside popup */
.rhyme-popup-content *,
.rhyme-popup-content *::-webkit-scrollbar {
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: #555 #2e2e2e; /* Firefox: thumb track */
}

.rhyme-popup-content *::-webkit-scrollbar {
  width: 8px;
  background-color: #2e2e2e;
}

.rhyme-popup-content *::-webkit-scrollbar-track {
  background: #2e2e2e;
}

.rhyme-popup-content *::-webkit-scrollbar-thumb {
  background-color: #555;
  border-radius: 4px;
  border: 1px solid #2e2e2e;
}

.rhyme-popup-content *::-webkit-scrollbar-thumb:hover {
  background: #777;
}

/* Header with title and close button */
.rhyme-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  border-bottom: 2px solid #444;
  background: #3a3a3a;
  flex-shrink: 0;
}

.rhyme-popup-title {
  color: #fff;
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
}

/* Close button */
.rhyme-popup-close-btn {
  width: 40px;
  height: 40px;
  font-size: 1.8rem;
  cursor: pointer;
  border: none;
  border-radius: 50%;
  background: #555;
  color: #fff;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex-shrink: 0;
}

.rhyme-popup-close-btn:hover {
  background: #777;
  transform: scale(1.1);
}

.rhyme-popup-close-btn:active {
  transform: scale(0.95);
}

/* Iframe container */
.rhyme-popup-iframe {
  flex: 1;
  width: 100%;
  border: none;
  background: #fff;
  scrollbar-width: thin; /* Firefox */
  scrollbar-color: #555 #2e2e2e; /* Firefox: thumb track */
}

/* Dark scrollbar for iframe */
.rhyme-popup-iframe::-webkit-scrollbar {
  width: 8px;
  background-color: #2e2e2e;
}

.rhyme-popup-iframe::-webkit-scrollbar-track {
  background: #2e2e2e;
}

.rhyme-popup-iframe::-webkit-scrollbar-thumb {
  background-color: #555;
  border-radius: 4px;
  border: 1px solid #2e2e2e;
}

.rhyme-popup-iframe::-webkit-scrollbar-thumb:hover {
  background: #777;
}

/* ========================================
   NOTES VIEW STYLES
   ======================================== */

#notes-view {
  flex-direction: row;
}

#notes-sidebar {
  width: 280px;
  background-color: #2a2a2a;
  border-right: 2px solid #444;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#notes-header {
  padding: 16px;
  border-bottom: 1px solid #444;
}

#notes-header h3 {
  color: #fff;
  margin: 0 0 12px 0;
  font-size: 1.2rem;
}

.sidebar-btn {
  width: 100%;
  padding: 10px;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  border-radius: 4px;
  background: #4a4a7e;
  color: #fff;
  transition: background 0.2s;
  font-weight: 500;
}

.sidebar-btn:hover {
  background: #5a5a8e;
}

#notes-list {
  list-style: none;
  padding: 8px;
  overflow-y: auto;
  flex: 1;
  position: relative;
}

#notes-list li {
  padding: 12px;
  margin-bottom: 4px;
  background-color: #3a3a3a;
  border: 1px solid #555;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  color: #ccc;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  position: relative;
}

#notes-list li:hover {
  background-color: #4a4a4a;
  border-color: #777;
}

#notes-list li.active {
  background-color: #5a5a7a;
  border-color: #7a7a9a;
  color: #fff;
}

#notes-list li.dragging {
  opacity: 0.5;
  cursor: move;
}

.note-color-indicator {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 2px solid #555;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.note-color-indicator:hover {
  border-color: #fff;
  transform: scale(1.1);
}

.note-item-text {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Color picker for notes */
.note-color-picker {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  background-color: #2e2e2e;
  border: 2px solid #555;
  border-radius: 6px;
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.5);
  z-index: 1000;
}

.note-color-option {
  width: 32px;
  height: 32px;
  border: 2px solid #555;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s;
  padding: 0;
}

.note-color-option:hover {
  border-color: #fff;
  transform: scale(1.1);
}

.note-color-option.selected {
  border-color: #fff;
  box-shadow: 0 0 8px rgba(255, 255, 255, 0.6);
}

.note-item-actions {
  display: flex;
  gap: 4px;
  opacity: 0;
  transition: opacity 0.2s;
}

#notes-list li:hover .note-item-actions {
  opacity: 1;
}

.note-action-btn {
  background: none;
  border: none;
  color: #ccc;
  font-size: 0.85rem;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 3px;
  transition: all 0.2s;
}

.note-action-btn:hover {
  background-color: #555;
  color: #fff;
}

.note-action-btn.delete:hover {
  background-color: #f00;
  color: #fff;
}

#notes-editor-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  background-color: #1f1f1f;
  position: relative;
}

#notes-toolbar {
  padding: 16px;
  background-color: #2a2a2a;
  border-bottom: 2px solid #444;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}

#note-title-input {
  flex: 1;
  padding: 10px;
  font-size: 1.1rem;
  font-weight: 600;
  background-color: #3a3a3a;
  border: 1px solid #555;
  border-radius: 4px;
  color: #fff;
  outline: none;
}

#note-title-input:focus {
  border-color: #7a7aff;
}

.notes-toolbar-actions {
  display: flex;
  gap: 8px;
}

.toolbar-btn {
  padding: 10px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  border-radius: 4px;
  background: #4a4a4a;
  color: #fff;
  transition: background 0.2s;
}

.toolbar-btn:hover {
  background: #5a5a5a;
}

.toolbar-btn.delete-btn {
  background: #7a3a3a;
}

.toolbar-btn.delete-btn:hover {
  background: #9a4a4a;
}

#note-content {
  flex: 1;
  padding: 20px;
  font-size: 1rem;
  line-height: 1.6;
  background-color: #1f1f1f;
  border: none;
  outline: none;
  color: #fff;
  resize: none;
  font-family: inherit;
}

/* Emoji Floating Button - specific to notes view */
.emoji-floating-btn {
  position: absolute;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  font-size: 1.8rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Emoji Picker */
#emoji-picker-panel {
  position: absolute;
  bottom: 100px;
  right: 30px;
  width: 320px;
  height: 400px;
  background-color: #2e2e2e;
  border: 2px solid #555;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  z-index: 1000;
}

#emoji-categories {
  display: flex;
  padding: 8px;
  background-color: #3a3a3a;
  border-bottom: 1px solid #555;
  gap: 4px;
  overflow-x: auto;
}

.emoji-category {
  padding: 8px 12px;
  font-size: 1.2rem;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
}

.emoji-category:hover {
  background: #4a4a4a;
}

.emoji-category.active {
  background: #5a5a7a;
}

#emoji-grid {
  flex: 1;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  overflow-y: auto;
  align-content: start;
}

.emoji-item {
  font-size: 1.5rem;
  padding: 8px;
  text-align: center;
  cursor: pointer;
  border-radius: 4px;
  transition: background 0.2s;
  user-select: none;
}

.emoji-item:hover {
  background-color: #4a4a4a;
}

/* ========================================
   SETTINGS VIEW STYLES
   ======================================== */

#settings-view {
  background-color: #1e1e1e;
  overflow-y: auto;
}

#settings-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 40px 20px;
}

#settings-container h1 {
  color: #fff;
  font-size: 2rem;
  margin: 0 0 30px 0;
  border-bottom: 2px solid #444;
  padding-bottom: 12px;
}

.settings-message {
  background-color: #3a3a2a;
  border: 2px solid #7a7a3a;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 20px;
  color: #fff;
}

.settings-message p {
  margin: 8px 0;
}

.settings-section {
  background-color: #2a2a2a;
  border: 1px solid #444;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 24px;
}

.settings-section h2 {
  color: #fff;
  font-size: 1.4rem;
  margin: 0 0 20px 0;
  border-bottom: 1px solid #444;
  padding-bottom: 8px;
}

.settings-item {
  margin-bottom: 20px;
}

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

.settings-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
  user-select: none;
}

.settings-label input[type="checkbox"] {
  cursor: pointer;
  width: 18px;
  height: 18px;
}

.settings-label:hover {
  color: #aaf;
}

.settings-label-block {
  display: block;
  margin-bottom: 12px;
}

.settings-title {
  color: #fff;
  font-size: 1rem;
  font-weight: 500;
}

.settings-radio-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-left: 8px;
}

.settings-radio-label {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: #ccc;
  font-size: 0.95rem;
  user-select: none;
}

.settings-radio-label input[type="radio"] {
  cursor: pointer;
  width: 16px;
  height: 16px;
}

.settings-radio-label:hover {
  color: #fff;
}

.settings-description {
  color: #999;
  font-size: 0.85rem;
  margin: 8px 0 0 0;
  line-height: 1.4;
}

.settings-select {
  width: 100%;
  max-width: 300px;
  padding: 8px 12px;
  background-color: #2b2b2b;
  border: 1px solid #555;
  border-radius: 4px;
  color: #fff;
  font-size: 1rem;
  cursor: pointer;
  margin-top: 8px;
}

.settings-select:hover {
  border-color: #777;
}

.settings-select:focus {
  outline: none;
  border-color: #63b3ed;
}

.settings-slider {
  width: 100%;
  max-width: 300px;
  height: 6px;
  margin-top: 8px;
  background: #2b2b2b;
  border-radius: 3px;
  outline: none;
  -webkit-appearance: none;
  cursor: pointer;
}

.settings-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  background: #63b3ed;
  border-radius: 50%;
  cursor: pointer;
  transition: background 0.2s;
}

.settings-slider::-webkit-slider-thumb:hover {
  background: #4a9fd8;
}

.settings-slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  background: #63b3ed;
  border-radius: 50%;
  cursor: pointer;
  border: none;
  transition: background 0.2s;
}

.settings-slider::-moz-range-thumb:hover {
  background: #4a9fd8;
}

.settings-slider::-moz-range-track {
  background: #2b2b2b;
  border-radius: 3px;
}

#settings-content.locked {
  opacity: 0.5;
  pointer-events: none;
}

/* ========== Backup Progress Modal ========== */
.backup-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000;
  transition: opacity 0.3s;
}

.backup-modal.hidden {
  display: none;
}

.backup-modal-content {
  background-color: #2a2a2a;
  border: 2px solid #555;
  border-radius: 8px;
  padding: 30px;
  width: 450px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

.backup-modal-content h3 {
  margin: 0 0 20px 0;
  color: #fff;
  font-size: 1.3rem;
  text-align: center;
}

.backup-progress-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.backup-progress-bar {
  width: 100%;
  height: 24px;
  background-color: #1a1a1a;
  border: 1px solid #555;
  border-radius: 12px;
  overflow: hidden;
  position: relative;
}

.backup-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #4a9eff, #6bb6ff);
  transition: width 0.3s ease;
  width: 0%;
  border-radius: 12px;
  box-shadow: 0 0 10px rgba(74, 158, 255, 0.5);
}

.backup-progress-text {
  color: #ccc;
  font-size: 0.95rem;
  text-align: center;
  margin: 0;
}

/* ===========================
   Spotify Analytics Styles
   =========================== */

#spotify-container {
  padding: 20px;
  height: 100%;
  overflow-y: auto;
  background-color: #1e1e1e;
}

#spotify-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #3a3a3a;
}

#spotify-header h1 {
  color: #fff;
  font-size: 1.8rem;
  margin: 0;
}

.spotify-controls {
  display: flex;
  gap: 15px;
  align-items: center;
}

.spotify-btn {
  padding: 10px 20px;
  font-size: 0.95rem;
  cursor: pointer;
  border: none;
  border-radius: 6px;
  background: #3e4e5e;
  color: #fff;
  transition: all 0.2s;
  font-weight: 500;
}

.spotify-btn:hover {
  background: #4e5e6e;
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(62, 78, 94, 0.4);
}

.data-status {
  padding: 8px 16px;
  background: #2a2a2a;
  border-radius: 4px;
  font-size: 0.9rem;
  color: #aaa;
  border: 1px solid #3a3a3a;
}

.data-status.loaded {
  background: #2e3e2e;
  color: #8fbc8f;
  border-color: #3e5e3e;
}

/* Time Controls */
.time-controls {
  margin: 20px 0;
  padding: 15px;
  background: #2a2a2a;
  border-radius: 8px;
  border: 1px solid #3a3a3a;
}

.control-group {
  margin-bottom: 15px;
}

.control-group:last-child {
  margin-bottom: 0;
}

.control-group label {
  display: block;
  margin-bottom: 8px;
  color: #ccc;
  font-weight: 500;
  font-size: 0.95rem;
}

.button-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.control-btn {
  padding: 8px 16px;
  font-size: 0.9rem;
  cursor: pointer;
  border: 1px solid #3a3a3a;
  border-radius: 4px;
  background: #2e2e2e;
  color: #ccc;
  transition: all 0.2s;
  font-weight: 400;
}

.control-btn:hover {
  background: #3a3a3a;
  border-color: #4a4a4a;
}

.control-btn.active {
  background: #3e4e5e;
  color: #fff;
  border-color: #5e6e7e;
  font-weight: 500;
}

/* Charts Container */
.charts-container {
  margin: 20px 0;
}

.chart-wrapper {
  margin-bottom: 30px;
  padding: 20px;
  background: #2a2a2a;
  border-radius: 8px;
  border: 1px solid #3a3a3a;
}

.chart-wrapper h3 {
  margin: 0 0 15px 0;
  color: #fff;
  font-size: 1.2rem;
  font-weight: 500;
}

.chart-wrapper canvas {
  max-height: 400px;
}

/* Changes Container */
.changes-container {
  margin: 30px 0;
  padding: 20px;
  background: #2a2a2a;
  border-radius: 8px;
  border: 1px solid #3a3a3a;
}

.changes-container h2 {
  margin: 0 0 10px 0;
  color: #fff;
  font-size: 1.4rem;
  font-weight: 500;
}

.changes-description {
  margin: 0 0 20px 0;
  color: #aaa;
  font-size: 0.9rem;
  line-height: 1.5;
}

#changes-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.change-entry {
  padding: 12px 15px;
  background: #1e1e1e;
  border-radius: 6px;
  border-left: 4px solid #5e3e3e;
}

.change-entry.positive {
  border-left-color: #3e5e3e;
}

.change-entry.negative {
  border-left-color: #5e3e3e;
}

.change-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.change-date {
  font-weight: 500;
  color: #fff;
  font-size: 0.95rem;
}

.change-count {
  font-size: 0.85rem;
  color: #888;
}

.change-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  font-size: 0.9rem;
}

.change-item {
  display: flex;
  justify-content: space-between;
  color: #ccc;
}

.change-item .label {
  color: #aaa;
}

.change-item .value {
  font-weight: 500;
}

.change-item .value.positive {
  color: #8fbc8f;
}

.change-item .value.negative {
  color: #d98989;
}

.no-changes {
  text-align: center;
  padding: 30px;
  color: #888;
  font-size: 0.95rem;
}

/* =====================================
   M-THEORY VIEW STYLES
   ===================================== */

#mtheory-view {
  background: #1e1e1e;
  overflow-y: auto;
  padding: 20px;
}

#mtheory-content {
  max-width: 1400px;
  margin: 0 auto;
  width: 100%;
}

.mtheory-header {
  text-align: center;
  margin-bottom: 40px;
  padding: 20px;
  background: #2a2a2a;
  border-radius: 8px;
  border: 1px solid #444;
}

.mtheory-header h2 {
  color: #fff;
  font-size: 2rem;
  margin-bottom: 10px;
  font-weight: 600;
}

.mtheory-header p {
  color: #aaa;
  font-size: 1rem;
}

/* Scale Info Display */
.scale-info {
  background: #2a2a2a;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 30px;
  border: 2px solid #5a5a7a;
  text-align: center;
}

.scale-info h3 {
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: 10px;
  font-weight: 600;
}

.scale-notes {
  color: #aaa;
  font-size: 1.2rem;
  letter-spacing: 2px;
  font-weight: 500;
}

/* Scale Buttons Container */
.scale-buttons-container {
  margin-bottom: 30px;
}

.scale-section {
  margin-bottom: 30px;
}

.scale-section h3 {
  color: #fff;
  font-size: 1.3rem;
  margin-bottom: 15px;
  padding-left: 10px;
  font-weight: 600;
}

.scale-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 10px;
  padding: 10px;
  background: #2a2a2a;
  border-radius: 8px;
}

.scale-btn {
  padding: 12px 16px;
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  border: 2px solid #444;
  border-radius: 6px;
  background: #3a3a3a;
  color: #ccc;
  transition: all 0.2s ease;
}

.scale-btn:hover {
  background: #4a4a4a;
  color: #fff;
  border-color: #5a5a7a;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.scale-btn.active {
  background: #5a5a7a;
  color: #fff;
  border-color: #7a7a9a;
  box-shadow: 0 4px 12px rgba(90, 90, 122, 0.4);
}

/* Piano Roll Container */
.piano-container {
  background: #2a2a2a;
  padding: 40px 20px;
  border-radius: 8px;
  overflow-x: auto;
  margin-top: 30px;
  border: 1px solid #444;
}

.piano-roll {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  min-width: 800px;
  height: 200px;
  position: relative;
  margin: 0 auto;
  max-width: 1200px;
}

/* Piano Keys */
.piano-key {
  position: relative;
  cursor: pointer;
  transition: all 0.15s ease;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding-bottom: 8px;
}

.white-key {
  width: 50px;
  height: 200px;
  background: #f5f5f5;
  border: 2px solid #333;
  border-radius: 0 0 4px 4px;
  margin: 0 1px;
  z-index: 1;
}

.white-key:hover {
  background: #e8e8e8;
  transform: translateY(-2px);
}

.black-key {
  width: 30px;
  height: 120px;
  background: #1a1a1a;
  border: 2px solid #000;
  border-radius: 0 0 4px 4px;
  margin: 0 -16px;
  z-index: 2;
  position: relative;
}

.black-key:hover {
  background: #2a2a2a;
  transform: translateY(-2px);
}

/* Highlighted Keys (in scale) */
.piano-key.highlighted {
  animation: pulse 0.3s ease;
}

.white-key.highlighted {
  background: linear-gradient(to bottom, #8fa8ff 0%, #6a8fff 100%);
  border-color: #4a6fcf;
  box-shadow: 0 0 15px rgba(106, 143, 255, 0.6);
}

.white-key.highlighted:hover {
  background: linear-gradient(to bottom, #a0b8ff 0%, #7a9fff 100%);
}

.black-key.highlighted {
  background: linear-gradient(to bottom, #5a7acc 0%, #4a6abc 100%);
  border-color: #3a5aac;
  box-shadow: 0 0 15px rgba(90, 122, 204, 0.6);
}

.black-key.highlighted:hover {
  background: linear-gradient(to bottom, #6a8adc 0%, #5a7acc 100%);
}

/* Note Labels */
.note-label {
  font-size: 11px;
  font-weight: 600;
  color: #333;
  text-align: center;
  user-select: none;
}

.black-key .note-label {
  color: #fff;
}

.highlighted .note-label {
  color: #fff;
  font-weight: 700;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Pulse animation for key highlights */
@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.05);
  }
  100% {
    transform: scale(1);
  }
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .scale-buttons {
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 8px;
  }

  .white-key {
    width: 40px;
    height: 180px;
  }

  .black-key {
    width: 24px;
    height: 110px;
    margin: 0 -13px;
  }
}

@media (max-width: 768px) {
  #mtheory-content {
    padding: 10px;
  }

  .mtheory-header h2 {
    font-size: 1.5rem;
  }

  .scale-buttons {
    grid-template-columns: repeat(auto-fit, minmax(80px, 1fr));
    gap: 6px;
  }

  .scale-btn {
    padding: 10px 12px;
    font-size: 0.85rem;
  }

  .white-key {
    width: 35px;
    height: 160px;
  }

  .black-key {
    width: 20px;
    height: 100px;
    margin: 0 -11px;
  }

  .note-label {
    font-size: 9px;
  }
}

/* Challenge Mode Container */
.challenge-mode-container {
  margin-top: 40px;
  padding: 30px;
  background: #2a2a2a;
  border-radius: 8px;
  border: 2px solid #444;
  text-align: center;
}

.challenge-mode-title {
  color: #fff;
  font-size: 1.5rem;
  margin-bottom: 20px;
  font-weight: 600;
}

.challenge-mode-buttons {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Challenge Mode Button */
.challenge-mode-btn {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border: none;
  padding: 12px 28px;
  font-size: 16px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4);
  min-width: 140px;
}

.challenge-mode-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

/* Challenge Popup */
.challenge-popup {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.challenge-popup-content {
  background-color: #2e2e2e;
  border-radius: 12px;
  width: 90%;
  max-width: 900px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.9);
  border: 2px solid #555;
  overflow: hidden;
}

.challenge-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px;
  border-bottom: 2px solid #444;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
}

.challenge-header h3 {
  color: white;
  margin: 0;
  font-size: 20px;
  flex: 1;
}

.challenge-close-btn {
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: white;
  font-size: 28px;
  cursor: pointer;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  line-height: 1;
  padding: 0;
}

.challenge-close-btn:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(90deg);
}

.challenge-piano-container {
  padding: 30px 20px;
  background: #252525;
  display: flex;
  justify-content: center;
  overflow-x: auto;
}

.challenge-piano-container .piano-roll {
  margin: 0;
}

/* Selected keys in challenge mode */
.piano-key.selected {
  opacity: 0.8;
}

.white-key.selected {
  background: linear-gradient(to bottom, #fff9c4 0%, #ffe082 100%);
  border-color: #fbc02d;
  box-shadow: 0 0 20px rgba(251, 192, 45, 0.7);
}

.black-key.selected {
  background: linear-gradient(to bottom, #c9b458 0%, #b8a042 100%);
  border-color: #a89232;
  box-shadow: 0 0 20px rgba(201, 180, 88, 0.7);
}

.challenge-actions {
  display: flex;
  gap: 12px;
  padding: 20px 24px;
  justify-content: center;
  border-top: 1px solid #444;
}

.challenge-btn {
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.check-btn {
  background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(76, 175, 80, 0.4);
}

.check-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(76, 175, 80, 0.6);
}

.next-btn {
  background: linear-gradient(135deg, #2196f3 0%, #1976d2 100%);
  color: white;
  box-shadow: 0 4px 12px rgba(33, 150, 243, 0.4);
}

.next-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(33, 150, 243, 0.6);
}

.challenge-feedback {
  padding: 16px 24px;
  text-align: center;
  font-size: 18px;
  font-weight: 600;
  min-height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.challenge-feedback.correct {
  background: rgba(76, 175, 80, 0.2);
  color: #4caf50;
  border-top: 2px solid rgba(76, 175, 80, 0.4);
}

.challenge-feedback.incorrect {
  background: rgba(244, 67, 54, 0.2);
  color: #f44336;
  border-top: 2px solid rgba(244, 67, 54, 0.4);
}

/* Responsive adjustments for challenge popup */
@media (max-width: 768px) {
  .challenge-popup-content {
    width: 95%;
    max-width: 95%;
  }

  .challenge-header h3 {
    font-size: 16px;
  }

  .challenge-piano-container {
    padding: 20px 10px;
  }

  .challenge-btn {
    padding: 10px 20px;
    font-size: 14px;
  }

  .challenge-feedback {
    font-size: 16px;
    padding: 12px 16px;
  }

  .challenge-mode-container {
    padding: 20px;
    margin-top: 30px;
  }

  .challenge-mode-title {
    font-size: 1.2rem;
  }

  .challenge-mode-buttons {
    flex-direction: column;
  }

  .challenge-mode-btn {
    width: 100%;
    min-width: unset;
  }
  }
}
