/* ========================================
   Piano Trainer - Premium Dark Theme
   ======================================== */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Mobile PWA-like experience */
html,
body {
  height: 100%;
  height: 100dvh;
  /* Dynamic viewport height for mobile */
  overflow: hidden;
  overscroll-behavior: none;
  touch-action: manipulation;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

/* Safe area for notch/rounded corners */
.app-container {
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}

:root {
  /* Colors */
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-tertiary: #1a1a25;
  --bg-card: rgba(25, 25, 35, 0.8);

  --accent-primary: #6366f1;
  --accent-secondary: #8b5cf6;
  --accent-gradient: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

  --success: #22c55e;
  --danger: #ef4444;
  --warning: #f59e0b;

  --text-primary: #ffffff;
  --text-secondary: #a1a1aa;
  --text-muted: #71717a;

  /* Piano Colors */
  --key-white: #f8fafc;
  --key-white-hover: #e2e8f0;
  --key-white-active: #6366f1;
  --key-black: #18181b;
  --key-black-hover: #27272a;
  --key-black-active: #8b5cf6;

  /* Note Colors */
  --note-left: #3b82f6;
  --note-right: #22c55e;
  --note-waiting: #f59e0b;

  /* Shadows */
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 16px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-glow: 0 0 20px rgba(99, 102, 241, 0.3);

  /* Borders */
  --border-color: rgba(255, 255, 255, 0.1);
  --border-radius: 12px;

  /* Transitions */
  --transition-fast: 0.15s ease;
  --transition-normal: 0.3s ease;
}

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
}

.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.app-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  position: relative;
}

.main-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

/* ========================================
   Header
   ======================================== */

/* Top Bar - Minimal header */
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.3);
  /* Match footer shadow effect */
  z-index: 100;
  /* Ensure shadow is visible over content */
}

/* Focus Active Top Bar Override */
body.focus-active .top-bar {
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent) !important;
  z-index: 2000 !important;
  /* Extremely high to ensure foreground priority */
  position: relative;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  /* Subtle border to keep structure */
}

.sub-header-controls {
  display: none;
  /* Hidden by default */
}

/* Show sub-header when music is loaded */
body.music-loaded .sub-header-controls {
  display: flex !important;
}

/* Show sub-header during tutorial */
body.tutorial-active .sub-header-controls {
  display: flex !important;
}

/* Hide sub-header in composer mode */
body.composer-mode .sub-header-controls {
  display: none !important;
}

.sub-header-controls {
  display: none;
  justify-content: center;
  align-items: center;
  width: 100%;
  position: absolute;
  top: 25px;
  /* Offset to sit below header (tighter fit) */
  left: 0;
  z-index: 50;
  pointer-events: auto;
}

/* Absolutes for Perfect Centering */
.sub-header-controls .segmented-control {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  margin: 0 !important;
}

/* Audio Filter Button - Positioned to the right of center */
.sub-header-controls .btn-audio-filter {
  position: absolute;
  left: 50%;
  transform: translateX(calc(100% + 75px)) translateY(-50%);
  /* 75px offset assumes half width of segmented control (~75px) + gap */
  /* Actually segmented control is wider. Let's try 90px offset from center */
  transform: translateX(85px) translateY(-50%);
  margin: 0 !important;
  top: 50%;
}

/* Clear Audio Button in Sub-Header - Positioned Far Left */
.sub-header-controls .btn-clear-audio {
  position: absolute !important;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
}

/* Markers Toggle in Sub-Header - Positioned Far Right */
.markers-toggle-sub {
  position: absolute !important;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
}

.file-controls {
  display: flex;
  gap: 6px;
}

.top-bar-left {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 12px;
  /* Slight gap between buttons */
}

.top-bar-center {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}

.header-score-stats {
  display: none;
  align-items: center;
  gap: 32px;
  opacity: 1;
  background: var(--bg-primary) !important;
  padding: 8px 13px 8px 13px;
  border-radius: 30px;
  border: 1px solid var(--border-color);
  transition: opacity 0.3s ease;
}

.header-score-stats.hidden {
  opacity: 0;
  pointer-events: none;
}

/* Header segmented control - visible when no music loaded */
.header-segmented {
  display: flex;
}

/* When music is loaded, swap visibility */
body.music-loaded .header-segmented {
  display: none;
}

body.music-loaded .header-score-stats {
  display: flex;
}

body.music-loaded .sub-header-controls {
  display: flex;
}

/* Also show stats when overlay is hidden (alternative trigger) */
.overlay-message.hidden~.header-score-stats,
body.music-loaded .header-score-stats {
  display: flex !important;
}

.score-stat {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  /* Larger font */
  font-weight: 500;
  color: var(--text-secondary);
}

.score-stat .score-icon {
  width: 18px;
  /* Larger icon */
  height: 18px;
}

.score-stat span {
  font-weight: 700;
  font-size: 16px;
  /* Larger value */
  color: white;
  /* Text is white */
}

/* Icons colored, text white */
.score-stat.correct .score-icon {
  color: var(--success);
}

.score-stat.missed .score-icon {
  color: var(--warning);
  /* Orange for Missed */
}

.score-stat.wrong .score-icon {
  color: #ef4444;
  /* Red for Wrong/Error */
}

.score-stat.precision .score-icon {
  color: var(--accent);
  /* Blue/Purple for precision */
}

/* Rank text always white */
#scoreRank {
  color: white !important;
}

/* Controls Toolbar - Below progress bar */
.controls-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-tertiary);
  border-top: 1px solid var(--border-color);
  position: relative;
}

.toolbar-left,
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 200px;
  flex-shrink: 0;
}

.toolbar-right {
  justify-content: flex-end;
}

.toolbar-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 8px;
}

.toolbar-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tempo-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 40px;
}

/* Tool buttons */
.btn-tool {
  width: 36px;
  height: 36px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  opacity: 1 !important;
  /* Force opacity to stay consistent */
  transition: background-color 0.2s, color 0.2s;
}

.btn-tool svg {
  width: 18px;
  height: 18px;
}

/* Main Play button - Large centered */
.play-btn-main {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: white;
  border: none;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.play-btn-main:hover:not(:disabled) {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.5);
}

.play-btn-main svg {
  width: 24px;
  height: 24px;
}

/* Light button active state */
.btn-light.active {
  background: #f59e0b !important;
  border-color: #f59e0b !important;
  color: white;
}

/* Train button active state */
.btn-train.active {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6) !important;
  border-color: #3b82f6 !important;
  color: white;
}

/* Blind mode button active state */
.btn-blind.active {
  background: #2864d7 !important;
  border-color: #2864d7 !important;
  color: white;
}

/* Loop Errors button active state */
.btn-loop-errors.active {
  background: #f59e0b !important;
  border-color: #f59e0b !important;
  color: white;
}

/* Blind mode - hide canvas content */
.canvas-container.blind-mode #notesCanvas {
  opacity: 0.05;
}

.canvas-container.blind-mode .overlay-message {
  display: none;
}

/* Sheet Music button active state */
.btn-sheet-music.active {
  background: #ef4444 !important;
  border-color: #ef4444 !important;
  color: white;
}

/* Canvas Container */
.canvas-container {
  position: relative;
  flex: 1;
  display: flex;
  overflow: hidden;
  background: black;
  /* Ensure dark background behind canvas */
}

/* Sheet Music Container */
.sheet-music-container {
  position: absolute;
  inset: 0;
  background: var(--bg-primary);
  display: flex;
  flex-direction: column;
  z-index: 5;
  overflow: hidden;
}

.sheet-music-container.hidden {
  display: none;
}

.sheet-music-container.empty-state {
  background: transparent !important;
  pointer-events: none;
}

.sheet-music-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.sheet-music-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
}

.sheet-music-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sheet-music-controls button {
  width: 28px;
  height: 28px;
  padding: 0;
  font-size: 16px;
  line-height: 1;
}

.sheet-music-controls #zoomLevel {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 40px;
  text-align: center;
}

.sheet-music-scroll {
  flex: 1;
  overflow: auto;
  background: white;
  margin: 10px;
  border-radius: 8px;
  box-shadow: var(--shadow-md);
}

#sheetMusicOutput {
  padding: 20px;
  min-height: 100%;
  background: white;
}

#sheetMusicOutput svg {
  width: 100% !important;
  height: auto !important;
  display: block;
}

.sheet-music-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 400px;
  text-align: center;
  background: rgba(10, 10, 15, 0.9);
  border-radius: 8px;
  margin: 20px;
}

.sheet-music-empty svg {
  width: 64px;
  height: 64px;
  color: rgba(255, 255, 255, 0.7);
  margin-bottom: 16px;
  animation: bounce 2s infinite;
}

.sheet-music-empty p {
  font-size: 18px;
  color: var(--text-secondary);
}

.sheet-music-empty .drop-hint {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 8px;
}

/* Arabic RTL Support */
html[lang="ar"] .translatable-text,
html[lang="ar"] p,
html[lang="ar"] h1,
html[lang="ar"] h2,
html[lang="ar"] h3,
html[lang="ar"] h4,
html[lang="ar"] span,
html[lang="ar"] button,
html[lang="ar"] input,
html[lang="ar"] label,
html[lang="ar"] .modal-content,
html[lang="ar"] .tutorial-step {
  direction: rtl;
  text-align: right;
}

/* Keep numbers LTR even in Arabic */
html[lang="ar"] .time-display,
html[lang="ar"] .tempo-value {
  direction: ltr;
  unicode-bidi: embed;
}

/* Ensure global layout doesn't flip */
html[lang="ar"] body {
  direction: ltr;
}

/* Header sections */
.header-section {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 12px;
  border-right: 1px solid var(--border-color);
}

.header-section:last-of-type {
  border-right: none;
}

.playback-controls {
  gap: 4px;
}

.tempo-section {
  gap: 8px;
}

.toggles-section {
  gap: 12px;
}

.toggle-item {
  display: flex;
  align-items: center;
  gap: 6px;
}

.section-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.tempo-value {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 40px;
}

/* Icon-only button style */
.icon-btn {
  width: 38px;
  height: 38px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
}

.icon-btn.btn-sm {
  width: 32px;
  height: 32px;
}

.icon-btn svg {
  width: 18px;
  height: 18px;
}

/* Play button - bigger */
.play-btn {
  width: 48px;
  height: 48px;
  border-radius: 50%;
}

.play-btn svg {
  width: 22px;
  height: 22px;
}

/* Reverb Control Expander */
.tool-expander {
  display: flex;
  align-items: center;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 2px;
  transition: all 0.2s ease;
}

.tool-expander:hover {
  border-color: var(--accent-primary);
}

.reverb-levels {
  display: flex;
  gap: 4px;
  width: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.2s ease;
}

.tool-expander:hover .reverb-levels,
.tool-expander.active .reverb-levels {
  width: 70px;
  /* Expands to show levels */
  opacity: 1;
  padding-left: 6px;
  padding-right: 4px;
}

.r-level {
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 4px;
  cursor: pointer;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.r-level:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

.r-level.active {
  background: var(--accent-primary);
  color: white;
}

/* Updated Tempo Control */
.tempo-compact {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 4px 10px;
}

.tempo-label {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent-secondary);
}

.tempo-input-wrapper {
  position: relative;
  display: flex;
  align-items: center;
}

.tempo-input {
  width: 50px;
  background: transparent;
  border: 1px solid var(--accent-primary);
  color: white;
  border-radius: 4px;
  padding: 2px 4px;
  font-size: 12px;
  text-align: center;
}

.tempo-input.hidden {
  display: none;
}

.tempo-slider-compact {
  width: 80px;
  height: 4px;
  border-radius: 2px;
  appearance: none;
  background: rgba(255, 255, 255, 0.1);
}

.tempo-slider-compact::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  border: 2px solid var(--bg-primary);
}

.tempo-value-compact {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-primary);
  min-width: 40px;
  text-align: right;
  cursor: pointer;
}

/* Tempo UI Controls inside Expander */
.tempo-ui-controls {
  display: flex;
  align-items: center;
  gap: 2px;
  width: 0;
  overflow: hidden;
  opacity: 0;
  transition: all 0.2s ease;
}

.tool-expander:hover .tempo-ui-controls {
  width: 110px;
  /* Adjust width to fit content */
  opacity: 1;
  padding: 0 6px;
}

.tempo-number-input {
  width: 36px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--text-muted);
  color: white;
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  padding: 2px;
  -moz-appearance: textfield;
  appearance: textfield;
}

.tempo-number-input::-webkit-outer-spin-button,
.tempo-number-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.tempo-number-input:focus {
  outline: none;
  border-bottom-color: var(--accent-primary);
}

.tempo-unit-label {
  font-size: 10px;
  color: var(--text-muted);
  margin-right: 2px;
}

.tempo-step-btn {
  width: 18px;
  height: 18px;
  border-radius: 4px;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  font-size: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.tempo-step-btn:hover {
  background: rgba(255, 255, 255, 0.2);
  color: white;
}

/* Standard Button Style (matches Reverb/Tool Expander) */
.btn-standard {
  background: var(--bg-primary) !important;
  border: 1px solid var(--border-color) !important;
  border-radius: 10px !important;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.btn-standard:hover:not(:disabled) {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  background: var(--bg-primary);
  /* Ensure bg doesn't change to tertiary */
}

.btn-standard.active {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
}

/* Blind Button Icon Toggle */
#blindBtn .eye-closed {
  display: none;
}

#blindBtn .eye-open {
  display: block;
}

#blindBtn.active .eye-closed {
  display: block;
}

#blindBtn.active .eye-open {
  display: none;
}

/* Light Button Icon Toggle */
#lightBtn .light-on {
  display: none;
}

#lightBtn .light-off {
  display: block;
}

#lightBtn.active .light-on {
  display: block;
}

#lightBtn.active .light-off {
  display: none;
}

/* ========================================
   Buttons
   ======================================== */
.btn {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-icon {
  font-size: 16px;
}

.btn-primary {
  background: var(--accent-gradient);
  color: white;
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #16a34a;
  transform: translateY(-2px);
}

.btn-danger {
  background: var(--danger);
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #dc2626;
  transform: translateY(-2px);
}

/* ========================================
   Toggle Switch
   ======================================== */

.illumination-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-left: 1px solid var(--border-color);
  border-right: 1px solid var(--border-color);
}

.toggle-label {
  font-size: 13px;
  color: var(--text-secondary);
  white-space: nowrap;
}

.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--bg-primary);
  border: 1px solid var(--border-color);
  transition: 0.3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 2px;
  bottom: 2px;
  background-color: var(--text-muted);
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked+.toggle-slider {
  background: linear-gradient(135deg, #ef4444, #f97316);
  border-color: #ef4444;
}

.toggle-switch.training input:checked+.toggle-slider {
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  border-color: #3b82f6;
}

.toggle-switch input:checked+.toggle-slider:before {
  background-color: white;
  transform: translateX(20px);
}

.toggle-switch input:focus+.toggle-slider {
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.3);
}

.training-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-right: 1px solid var(--border-color);
}

/* ========================================
   Markers Panel
   ======================================== */

.markers-panel {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(26, 26, 36, 0.95);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  min-width: 140px;
  backdrop-filter: blur(10px);
  z-index: 10;
}

.markers-title {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.markers-title svg {
  width: 14px;
  height: 14px;
}

.marker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  background: var(--bg-primary);
  border-radius: 4px;
  margin-bottom: 6px;
  opacity: 0.5;
  transition: opacity 0.2s, background 0.2s;
}

.marker-item.active {
  opacity: 1;
  background: rgba(59, 130, 246, 0.2);
  border: 1px solid rgba(59, 130, 246, 0.4);
}

.marker-label {
  width: 20px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--accent-gradient);
  color: white;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 700;
}

.marker-item:nth-child(3) .marker-label {
  background: linear-gradient(135deg, #f97316, #ef4444);
}

.marker-time {
  flex: 1;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-primary);
}

.marker-delete {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 16px;
  padding: 0 4px;
  opacity: 0;
  transition: opacity 0.2s, color 0.2s;
}

.marker-item:hover .marker-delete,
.marker-item.active .marker-delete {
  opacity: 1;
}

.marker-delete:hover {
  color: var(--danger);
}

.loop-status {
  font-size: 11px;
  color: var(--text-muted);
  text-align: center;
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid var(--border-color);
}

.loop-status.active {
  color: var(--success);
}

.btn-secondary {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover:not(:disabled) {
  background: #2a2a3a;
  transform: translateY(-2px);
}

.btn-accent {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: white;
}

.btn-accent:hover:not(:disabled) {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
  transform: translateY(-2px);
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.3);
}

.device-status {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: #323237;
  border-radius: 20px;
  font-size: 13px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

.status-dot.connected {
  background: var(--success);
  box-shadow: 0 0 10px var(--success);
}

.status-dot.disconnected {
  background: var(--text-muted);
  animation: none;
}

@keyframes pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

/* ========================================
   Song Info Bar
   ======================================== */

.song-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 24px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

.song-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
}

.song-progress {
  display: flex;
  align-items: center;
  gap: 12px;
}

.progress-bar {
  width: 200px;
  height: 6px;
  background: var(--bg-primary);
  border-radius: 3px;
  overflow: hidden;
}

.progress-fill {
  width: 0%;
  height: 100%;
  background: var(--accent-gradient);
  transition: width 0.1s linear;
}

.time-display {
  font-size: 12px;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}

/* ========================================
   Canvas Container (Falling Notes)
   ======================================== */

.canvas-container {
  flex: 1;
  position: relative;
  background: linear-gradient(180deg, var(--bg-primary) 0%, var(--bg-secondary) 100%);
  overflow: hidden;
}

#notesCanvas {
  width: 100%;
  height: 100%;
  display: block;
}

.top-bar-center {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.top-bar-right {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  align-items: center;
}

.overlay-message {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(10, 10, 15, 0.9);
  backdrop-filter: blur(5px);
  transition: opacity var(--transition-normal);
}

.overlay-message.hidden {
  opacity: 0;
  pointer-events: none;
}

.message-content {
  text-align: center;
  margin-top: 35px;
}

.message-icon {
  font-size: 64px;
  margin-bottom: 16px;
  animation: bounce 3s infinite;
}

@keyframes bounce {

  0%,
  100% {
    transform: translateY(0);
  }

  50% {
    transform: translateY(-10px);
  }
}

/* Overlay Branding */
.overlay-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 24px;
}

.overlay-logo {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.overlay-title {
  font-family: 'Playfair Display', serif;
  font-size: 50px;
  font-weight: 700;
  color: white;
  letter-spacing: -0.5px;
  opacity: 0.7;
}

.message-content p {
  font-size: 18px;
  color: var(--text-secondary);
}

/* ========================================
   Virtual Piano
   ======================================== */

.piano-container {
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
  overflow-x: auto;
}

.piano {
  display: block;
  /* Changed from flex to block to act as relative container */
  position: relative;
  width: 100%;
  height: 120px;
  margin: 0 auto;
}

.white-keys-container {
  display: flex;
  width: 100%;
  height: 100%;
}

.key {
  position: relative;
  cursor: pointer;
  transition: all var(--transition-fast);
  box-sizing: border-box;
  /* Critical for border calculation */
}

.key-white {
  /* Removed fixed width */
  flex: 1;
  /* Distribute space evenly */
  height: 120px;
  background: var(--key-white);
  border: 1px solid #cbd5e1;
  border-right: none;
  /* Prevent double borders */
  border-radius: 0 0 6px 6px;
  z-index: 1;
}

.key-white:last-child {
  border-right: 1px solid #cbd5e1;
  /* Add border to last key */
}

.key-white:hover {
  background: var(--key-white-hover);
}

.key-white.active {
  background: var(--key-white-active);
  transform: scaleY(0.98);
  transform-origin: top;
}

.key-white.correct {
  background: var(--success);
}

.key-white.wrong {
  background: var(--danger);
}

.key-white.waiting {
  background: var(--note-waiting);
}

.key-black {
  position: absolute;
  top: 0;
  /* Align to top of piano container */
  /* width is set by JS percentages */
  height: 75px;
  background: var(--key-black);
  border-radius: 0 0 4px 4px;
  z-index: 2;
  /* margin-left removed to rely on JS percentage positioning */
}

.key-black:hover {
  background: var(--key-black-hover);
}

.key-black.active {
  background: var(--key-black-active);
  height: 73px;
}

.key-black.correct {
  background: var(--success);
}

.key-black.wrong {
  background: var(--danger);
}

.key-black.waiting {
  background: var(--note-waiting);
}

/* ========================================
   Score Panel
   ======================================== */



/* ========================================
   Results Modal
   ======================================== */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
  z-index: 1000;
}

.modal.visible {
  opacity: 1;
  pointer-events: all;
}

.modal-content {
  background: var(--bg-card);
  border-radius: var(--border-radius);
  text-align: center;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  transform: scale(0.9);
  transition: transform var(--transition-normal);
}

.modal.visible .modal-content {
  transform: scale(1);
}

.modal-content h2 {
  font-size: 28px;
  margin-bottom: 24px;
}

.results-score {
  font-size: 72px;
  font-weight: 800;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 24px;
}

.results-details {
  margin-bottom: 32px;
}

.result-row {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 16px;
  color: var(--text-secondary);
}

.result-row span:last-child {
  font-weight: 600;
  color: var(--text-primary);
}

/* ========================================
   Scrollbar
   ======================================== */

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

/* ========================================
   Conversion Modal
   ======================================== */

.conversion-modal {
  min-width: 400px;
}

.conversion-subtitle {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 24px;
}

.conversion-progress {
  margin-bottom: 24px;
}

.progress-bar-large {
  width: 100%;
  height: 12px;
  background: var(--bg-primary);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill-large {
  width: 0%;
  height: 100%;
  background: var(--accent-gradient);
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 13px;
  color: var(--text-secondary);
  text-align: center;
}

.conversion-result {
  margin-bottom: 24px;
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: 8px;
}

.conversion-result.hidden {
  display: none;
}

.result-info {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  font-size: 14px;
}

.result-info span:last-child {
  font-weight: 600;
  color: var(--success);
}

.conversion-buttons {
  display: flex;
  gap: 12px;
  margin-top: 16px;
}

.conversion-buttons .btn {
  flex: 1;
}

/* ========================================
   SVG Icon Styles
   ======================================== */

.logo-icon {
  width: 32px;
  height: 32px;
  color: var(--accent);
}

.btn svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.btn-outline {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-outline:hover:not(:disabled) {
  background: var(--bg-tertiary);
  border-color: var(--text-muted);
}

.btn-outline svg {
  opacity: 0.8;
}

.btn-outline:hover:not(:disabled) svg {
  opacity: 1;
}

.btn-divider {
  width: 1px;
  height: 24px;
  background: var(--border-color);
  margin: 0 4px;
}

.btn-record.recording {
  border-color: var(--danger);
  animation: pulse-record 1s infinite;
}

.btn-record.recording svg circle:last-child {
  fill: var(--danger);
}

@keyframes pulse-record {

  0%,
  100% {
    box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.4);
  }

  50% {
    box-shadow: 0 0 0 8px rgba(239, 68, 68, 0);
  }
}

.btn-danger-outline {
  border-color: var(--danger);
  color: var(--danger);
}

.btn-danger-outline:hover:not(:disabled) {
  background: rgba(239, 68, 68, 0.1);
}

/* ========================================
   Full Width Progress Bar
   ======================================== */

.full-progress-container {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  background: var(--bg-secondary);
  border-top: 1px solid var(--border-color);
}

.full-progress-container .song-name {
  flex-shrink: 0;
  font-size: 13px;
  color: var(--text-secondary);
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.full-progress-container .time-display {
  flex-shrink: 0;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
  color: var(--text-muted);
}

.full-progress-bar {
  flex: 1;
  position: relative;
  height: 8px;
  background: var(--bg-primary);
  border-radius: 4px;
  cursor: pointer;
  transition: height 0.2s;
}

.full-progress-bar:hover {
  height: 12px;
}

.full-progress-fill {
  width: 0%;
  height: 100%;
  background: var(--accent-gradient);
  border-radius: 4px;
  transition: width 0.1s linear;
  pointer-events: none;
}

.full-progress-handle {
  position: absolute;
  top: 50%;
  left: 0%;
  transform: translate(-50%, -50%);
  width: 16px;
  height: 16px;
  background: white;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}

.full-progress-bar:hover .full-progress-handle {
  opacity: 1;
}

/* ========================================
   Message Icon (SVG)
   ======================================== */

.message-icon {
  width: 64px;
  height: 64px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

/* ========================================
   Recording Modal
   ======================================== */

/* Enhanced Recording Modal Styles (Matching Category/Settings) */
.recording-modal {
  min-width: 380px;
  max-width: 380px;
  background: #1a1a2e;
  /* Darker background like settings */
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  padding: 0;
  overflow: hidden;
  text-align: center;
}

.recording-modal h2 {
  font-size: 18px;
  font-weight: 600;
  padding: 20px 24px;
  margin: 0;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: white;
  text-align: center;
  /* Centered title for this modal looks better */
}

/* Compact Recording Stats */
.recording-stats {
  padding: 24px 24px 20px;
  /* Add padding here since modal has 0 padding */
  display: flex;
  justify-content: center;
  gap: 24px;
  margin-bottom: 0;
  background: rgba(255, 255, 255, 0.02);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.recording-stats span {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.recording-stats strong {
  color: white;
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

/* Playback & Action Buttons */
.recording-playback {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.recording-playback.hidden {
  display: none;
}

.playback-buttons {
  display: flex;
  gap: 10px;
  margin-bottom: 8px;
}

.playback-buttons .btn {
  flex: 1;
  padding: 12px;
  font-size: 13px;
  border-radius: 8px;
  justify-content: center;
  /* Center icon and text */
}

.playback-buttons .btn svg {
  width: 16px;
  height: 16px;
  margin-right: 6px;
}

.playback-buttons .btn-primary {
  background: linear-gradient(135deg, var(--accent-primary), #8b5cf6);
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.playback-buttons .btn-primary:hover {
  box-shadow: 0 6px 15px rgba(99, 102, 241, 0.4);
  transform: translateY(-2px);
}

/* Export buttons specific style */
.playback-buttons .btn-outline {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
}

.playback-buttons .btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border-color: rgba(255, 255, 255, 0.2);
}

/* Discard Button */
#discardRecordingBtn {
  width: 100%;
  justify-content: center;
  padding: 12px;
  border-radius: 8px;
  color: #f87171;
  border-color: rgba(248, 113, 113, 0.3);
  background: rgba(248, 113, 113, 0.05);
  transition: all 0.2s;
}

#discardRecordingBtn:hover {
  background: rgba(248, 113, 113, 0.15);
  border-color: #f87171;
  color: white;
}

#discardRecordingBtn svg {
  width: 16px;
  height: 16px;
  margin-right: 6px;
}

/* ========================================
   Song Info Bar Adjustments
   ======================================== */

.song-info-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 24px;
  background: var(--bg-tertiary);
  border-bottom: 1px solid var(--border-color);
}

/* ========================================
   Collapsible Markers Panel
   ======================================== */

.markers-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 12px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  overflow: hidden;
  position: absolute;
  top: 20px;
  right: 16px;
  /* Align with header padding (16px) */
  z-index: 10;
  min-width: 200px;
}

/* Markers panel hidden by default, shown when .visible class is added */
.markers-panel {
  display: none;
}

.markers-panel.visible {
  display: block;
}

.markers-toggle {
  display: none;
  /* Toggle button is now in sub-header */
}

.markers-toggle:hover {
  color: var(--text-primary);
}

/* Train Button Active (colored when ON) */
#trainBtn.active {
  background: var(--accent-primary) !important;
  color: white !important;
  border-color: var(--accent-primary) !important;
}

.markers-close {
  position: absolute;
  top: 8px;
  right: 8px;
  background: none;
  border: none;
  color: #ef4444;
  /* Red color */
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  padding: 0;
  z-index: 20;
}

.markers-close:hover {
  color: #dc2626;
  /* Darker red on hover */
}

.markers-content {
  display: flex;
  flex-direction: column;
  gap: 10px;
  transition: opacity 0.2s ease;
  opacity: 1;
}

/* ========================================
   Icon Protection (VexFlow Overlay Fix)
   ======================================== */

.btn svg path,
.btn-tool svg path,
.icon-btn svg path,
.marker-delete svg path,
.markers-toggle svg path,
.markers-close svg path {
  stroke: currentColor !important;
  opacity: 1 !important;
  /* Prevent VexFlow or other libs from graying out icons */
}

/* ========================================
   Progress Graph
   ======================================== */


.progress-graph-container {
  width: 100%;
  height: 200px;
  background: var(--bg-secondary);
  border-radius: 8px;
  padding: 10px;
  margin-top: 15px;
  position: relative;
}

.progress-graph-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

/* ========================================
   Focus Mode
   ======================================== */

/* Instead of hiding top-bar completely, we make it transparent to keep stats visible if we want */
/* But user said "centré au milieu de l'écran". */

body.focus-active .top-bar {
  background: transparent;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
  border-bottom: none;
  pointer-events: none;
  z-index: 2000;
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
}

/* Hide Left side */
/* Hide Left side (visibility hidden to keep layout) */
body.focus-active .top-bar-left {
  visibility: hidden !important;
}

/* Right side: Keep container visible for layout, but hide Status */
body.focus-active .top-bar-right {
  display: flex !important;
  pointer-events: auto;
  /* Allow clicking the button */
}

body.focus-active .device-status,
body.focus-active .update-container {
  display: none !important;
}

/* Hide hand controls in Focus Mode */
body.focus-active .sub-header-controls {
  display: none !important;
}

/* Hide header segmented control in Focus Mode */
body.focus-active .header-segmented {
  display: none !important;
}

/* Transform Focus Button to Floating Circle in Focus Mode */
body.focus-active #focusBtn {
  /* Keep standard position (in flow) */
  position: static !important;
  /* Ensure it stays on top if needed, though parent has z-index */
  z-index: 3001;
  /* Optional: maintain active appearance if desired, but don't move it */
  border-color: var(--accent-primary) !important;
  color: var(--accent-primary) !important;
  background: rgba(99, 102, 241, 0.1) !important;
}

body.focus-active #focusBtn:hover {
  background: var(--bg-secondary) !important;
  transform: none !important;
  /* Remove scale transform to match standard button behavior if needed, or keep? Standard buttons usually don't scale this much. Let's keep hover bg change though. */
}

/* Shift Markers Panel (Loop Button) down in Focus Mode */
body.focus-active .markers-panel {
  top: 70px !important;
  right: 20px !important;
  z-index: 2999;
}

/* Hide stats in focus mode as requested */
body.focus-active .header-score-stats {
  display: none !important;
}

/* Hide other panels */
body.focus-active .controls-toolbar,
body.focus-active .history-panel,
body.focus-active .sidebar-left,
body.focus-active .sidebar-right {
  display: none !important;
}

body.focus-active .app-body {
  height: 100vh;
}

body.focus-active .main-content {
  border: none;
}

/* Remove old exit btn styles */
.focus-exit-btn {
  display: none;
}

/* Settings Modal Specifics */
.settings-group {
  margin-bottom: 20px;
}

.settings-group label {
  display: block;
  margin-bottom: 8px;
  color: #d1d5db;
  font-size: 0.9em;
}

.color-picker-wrapper {
  display: flex;
  align-items: center;
  gap: 10px;
  background: #1f2937;
  padding: 8px;
  border-radius: 6px;
  border: 1px solid #374151;
}

input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  border: none;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  background: none;
  cursor: pointer;
}

input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 4px;
}

.modal-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* Exercises Panel Navigation */
.back-btn {
  background: none;
  border: none;
  color: #9ca3af;
  cursor: pointer;
  padding: 8px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
}

.back-btn.hidden {
  display: none;
}

.exercises-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 16px;
  max-height: 60vh;
  overflow-y: auto;
}

.exercises-list.hidden {
  display: none;
}

.exercise-item {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 16px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 16px;
}

.exercise-item:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-2px);
}

.exercise-icon {
  width: 48px;
  height: 48px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.exercise-icon svg {
  width: 24px;
  height: 24px;
}

.exercise-info {
  flex: 1;
}

.exercise-name {
  font-size: 1rem;
  font-weight: 600;
  color: white;
  margin-bottom: 4px;
}

.exercise-description {
  font-size: 0.85rem;
  color: #9ca3af;
  margin-bottom: 8px;
}

.exercise-meta {
  display: flex;
  gap: 12px;
  font-size: 0.75rem;
}

.exercise-difficulty {
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 500;
}

.exercise-difficulty.beginner {
  background: rgba(34, 197, 94, 0.2);
  color: #22c55e;
}

.exercise-difficulty.intermediate {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.exercise-difficulty.advanced {
  background: rgba(239, 68, 68, 0.2);
  color: #ef4444;
}

.exercise-bpm {
  color: #6b7280;
}

.exercise-play-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--primary);
  border: none;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}

.exercise-play-btn:hover {
  transform: scale(1.1);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.5);
}

/* Premium Locked Exercises */
.exercise-item.exercise-locked {
  position: relative;
  opacity: 0.7;
  cursor: not-allowed;
}

.exercise-item.exercise-locked::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(0, 0, 0, 0.3), rgba(0, 0, 0, 0.1));
  border-radius: 12px;
  pointer-events: none;
  z-index: 1;
}

.exercise-item.exercise-locked:hover {
  transform: none;
  background: rgba(255, 255, 255, 0.05);
}

.exercise-item.exercise-locked .exercise-play-btn {
  background: #6b7280;
}

.exercise-item.exercise-locked .exercise-play-btn:hover {
  transform: none;
  box-shadow: none;
}

.lock-overlay {
  position: absolute;
  top: 50%;
  right: 60px;
  transform: translateY(-50%);
  color: #f59e0b;
  z-index: 2;
  opacity: 0.8;
}

.premium-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: linear-gradient(135deg, #f59e0b, #d97706);
  color: white;
  font-size: 9px;
  font-weight: 700;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  vertical-align: middle;
}

.premium-badge svg {
  width: 10px;
  height: 10px;
}

/* Premium Toast Notification */
.premium-toast {
  position: fixed;
  bottom: 100px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: linear-gradient(135deg, #1f2937, #111827);
  border: 1px solid #f59e0b;
  color: white;
  padding: 12px 20px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  z-index: 10000;
  opacity: 0;
  transition: all 0.3s ease;
}

.premium-toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.premium-toast svg {
  color: #f59e0b;
  flex-shrink: 0;
}

.premium-toast strong {
  color: #f59e0b;
}

/* Enforce Focus Button size to match Loop Button (40px) for vertical alignment */
#focusBtn {
  width: 40px;
  height: 40px;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Specifically hidden state */
.focus-exit-btn.hidden {
  display: none !important;
}

.focus-exit-btn svg {
  width: 20px;
  height: 20px;
}

/* Special Header Buttons (History & Exercises) - Neutral by default */
.btn-special {
  color: var(--text-primary);
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
}

.btn-special:hover {
  background: var(--bg-secondary);
  border-color: var(--text-muted);
}

.btn-special.active {
  color: white !important;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(139, 92, 246, 0.4));
  border-color: rgba(99, 102, 241, 0.6);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

/* ========================================
   Drop Zone Overlay
   ======================================== */

.drop-zone-overlay {
  position: absolute;
  inset: 0;
  background: rgba(99, 102, 241, 0.15);
  backdrop-filter: blur(5px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 100;
  border: 3px dashed rgba(99, 102, 241, 0.6);
  border-radius: 16px;
  margin: 20px;
}

.drop-zone-overlay.active {
  display: flex;
}

.drop-zone-content {
  text-align: center;
  color: white;
}

.drop-zone-content svg {
  color: var(--accent-primary);
  margin-bottom: 16px;
}

.drop-zone-content h3 {
  font-size: 1.5rem;
  margin-bottom: 8px;
  color: white;
}

.drop-zone-content p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.drop-hint {
  font-size: 0.8rem !important;
  color: var(--text-muted) !important;
  margin-top: 8px;
}

/* ========================================
   Smart Loop Button
   ======================================== */

.btn-smart-loop {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 10px 12px;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(234, 88, 12, 0.2));
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 8px;
  color: #f59e0b;
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-top: 12px;
}

.btn-smart-loop:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.3), rgba(234, 88, 12, 0.3));
  border-color: rgba(245, 158, 11, 0.6);
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.2);
}

.btn-smart-loop.active {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.4), rgba(234, 88, 12, 0.4));
  border-color: #f59e0b;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.3);
}

.btn-smart-loop svg {
  flex-shrink: 0;
}

/* ========================================
   Instrument Selector
   ======================================== */

.settings-modal {
  max-width: 500px;
}

.instrument-selector {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.instrument-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 16px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 2px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s;
}

.instrument-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.2);
}

.instrument-btn.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: white;
}

.instrument-icon {
  width: 32px;
  height: 32px;
  stroke: currentColor;
  opacity: 0.9;
}

.instrument-btn span:last-child {
  font-size: 0.8rem;
  font-weight: 500;
}

/* ========================================
   Focus Button Train Style
   ======================================== */

#focusBtn.btn-train {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3));
  border: 1px solid rgba(99, 102, 241, 0.5);
  color: white;
}

#focusBtn.btn-train:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.4), rgba(139, 92, 246, 0.4));
  border-color: rgba(99, 102, 241, 0.7);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

/* ========================================
   Compact Tempo Control
   ======================================== */

.tempo-compact {
  display: flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 4px 10px;
  margin: 0 8px;
}

.tempo-slider-compact {
  width: 60px;
  height: 4px;
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  cursor: pointer;
}

.tempo-slider-compact::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  background: var(--accent-primary);
  border-radius: 50%;
  cursor: pointer;
}

.tempo-slider-compact::-moz-range-thumb {
  width: 12px;
  height: 12px;
  background: var(--accent-primary);
  border-radius: 50%;
  cursor: pointer;
  border: none;
}

.tempo-value-compact {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-secondary);
  min-width: 36px;
  text-align: center;
}

/* ========================================
   Reverb Button
   ======================================== */

#reverbBtn.active {
  background: linear-gradient(135deg, rgb(70 246 59 / 30%), rgb(121 235 37 / 30%));
  border-color: rgb(59 246 122 / 60%);
  color: #ffffff;
  box-shadow: 0 0 12px rgb(59 246 99 / 30%);
}

/* ========================================
   Composer Toolbar
   ======================================== */

.composer-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 16px;
  background: linear-gradient(180deg, var(--bg-tertiary) 0%, var(--bg-secondary) 100%);
  border-bottom: 1px solid var(--border-color);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 90;
}

.composer-toolbar.hidden {
  display: none;
}

/* Hide composer toolbar in focus mode */
body.focus-active .composer-toolbar {
  display: none;
}

.composer-toolbar-content {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  position: relative;
}

.composer-instruments-group {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Time Signature Selector Group */
.composer-time-signature-group {
  position: absolute;
  left: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.composer-time-select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  padding: 8px 32px 8px 12px;
  cursor: pointer;
  transition: all 0.2s ease;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
}

.composer-time-select:hover {
  border-color: var(--accent-primary);
  background-color: rgba(99, 102, 241, 0.05);
}

.composer-time-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

/* Dropdown options styling */
.composer-time-select option {
  background: #1f2937;
  color: #f3f4f6;
  padding: 8px 12px;
}

.composer-clear-all-btn {
  position: absolute;
  right: 0;
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(220, 38, 38, 0.1);
  border: 1px solid rgba(220, 38, 38, 0.3);
  color: #ef4444;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.composer-clear-all-btn:hover {
  background: rgba(220, 38, 38, 0.2);
  border-color: rgba(220, 38, 38, 0.5);
  transform: translateY(-1px);
}

.composer-clear-all-btn svg {
  width: 14px;
  height: 14px;
}

/* Composer Save Section */
.composer-save-section {
  position: absolute;
  right: 80px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.project-name-input {
  width: 180px;
  padding: 6px 12px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 6px;
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.project-name-input:focus {
  border-color: var(--accent-primary);
}

.project-name-input::placeholder {
  color: var(--text-muted);
}

.composer-save-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #22c55e;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
}

.composer-save-btn:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.5);
  transform: translateY(-1px);
}

.composer-save-btn svg {
  width: 14px;
  height: 14px;
}

/* ========================================
   Effects Selection UI
   ======================================== */

.effect-info {
  margin-bottom: 20px;
  color: var(--text-secondary);
  font-size: 14px;
}

.effect-radio-group {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 16px;
  margin-top: 10px;
}

.effect-radio-card {
  position: relative;
  cursor: pointer;
}

.effect-radio-card input[type="radio"] {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.effect-card-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: var(--bg-tertiary);
  border: 2px solid var(--border-color);
  border-radius: 12px;
  transition: all 0.2s ease;
  height: 100%;
}

.effect-radio-card input[type="radio"]:checked+.effect-card-content {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.1);
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.2);
}

.effect-icon {
  width: 48px;
  height: 48px;
  margin-bottom: 12px;
  color: var(--text-secondary);
  transition: all 0.2s ease;
}

.effect-radio-card input[type="radio"]:checked+.effect-card-content .effect-icon {
  transform: scale(1.1);
}

.effect-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  text-align: center;
}

/* Effect Specific Colors */
.effect-icon.none {
  color: #9ca3af;
}

.effect-icon.particles {
  color: #f472b6;
}

.effect-icon.glow {
  color: #fbbf24;
}

.effect-icon.sparkle {
  color: #60a5fa;
}

.effect-icon.wave {
  color: #34d399;
}

.effect-icon.fire {
  color: #f87171;
}

.effect-icon.rainbow {
  color: #c084fc;
}

.effect-icon.lightning {
  color: #fbbf24;
}

.effect-icon.ice {
  color: #22d3ee;
}

.effect-icon.bubble {
  color: #a5b4fc;
}

.effect-icon.matrix {
  color: #22c55e;
}

.effect-icon.galaxy {
  color: #a855f7;
}

.effect-icon.eclipse {
  color: #f43f5e;
}

.effect-icon.neon {
  color: #e879f9;
}

.effect-icon.pixel {
  color: #fb923c;
}

.effect-icon.slime {
  color: #84cc16;
}

.effect-icon.gold {
  color: #fcd34d;
}

.effect-icon.hex {
  color: #2dd4bf;
}

.effect-icon.wind {
  color: #94a3b8;
}

.effect-icon.candy {
  color: #fb7185;
}

.effect-icon.glowworm {
  color: #a3e635;
}

.effect-icon.paper {
  color: #d4d4d8;
}

.effect-icon.confetti {
  color: #f472b6;
}

.effect-icon.plasma {
  color: #c026d3;
}

.effect-icon.aurora {
  color: #06b6d4;
}

.effect-icon.smoke {
  color: #78716c;
}

.effect-icon.crystal {
  color: #818cf8;
}

.effect-icon.lava {
  color: #dc2626;
}

.effect-icon.ocean {
  color: #0ea5e9;
}

.effect-icon.cosmic {
  color: #7c3aed;
}

.effect-icon.hologram {
  color: #14b8a6;
}

.effect-icon.retro {
  color: #f97316;
}

.effect-icon.rainbow-new {
  background: linear-gradient(135deg, #ef4444, #f59e0b, #eab308, #22c55e, #3b82f6, #8b5cf6);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.effect-radio-card:hover .effect-card-content {
  border-color: var(--text-secondary);
  transform: translateY(-2px);
}

.composer-instrument-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.composer-instrument-btn svg {
  width: 20px;
  height: 20px;
}

.composer-instrument-btn:hover {
  border-color: var(--accent-primary);
  color: var(--text-primary);
  background: rgba(99, 102, 241, 0.1);
}

.composer-instrument-btn.active {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

/* Instrument-specific active colors */
.composer-instrument-btn.active[data-instrument="piano"] {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(37, 99, 235, 0.2));
  border-color: #3b82f6;
  color: #3b82f6;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.3);
}

.composer-instrument-btn.active[data-instrument="guitar"] {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.2));
  border-color: #f59e0b;
  color: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.composer-instrument-btn.active[data-instrument="drums"] {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.2), rgba(220, 38, 38, 0.2));
  border-color: #ef4444;
  color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.composer-instrument-btn.active[data-instrument="trumpet"] {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(22, 163, 74, 0.2));
  border-color: #22c55e;
  color: #22c55e;
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.3);
}

.composer-instrument-btn.active[data-instrument="synth"] {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.2), rgba(124, 58, 237, 0.2));
  border-color: #8b5cf6;
  color: #8b5cf6;
  box-shadow: 0 0 12px rgba(139, 92, 246, 0.3);
}

.composer-instrument-btn.active[data-instrument="saxophone"] {
  background: linear-gradient(135deg, rgba(251, 191, 36, 0.2), rgba(245, 158, 11, 0.2));
  border-color: #f59e0b;
  color: #f59e0b;
  box-shadow: 0 0 12px rgba(245, 158, 11, 0.3);
}

.composer-instrument-btn.active[data-instrument="violin"] {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.2), rgba(219, 39, 119, 0.2));
  border-color: #ec4899;
  color: #ec4899;
  box-shadow: 0 0 12px rgba(236, 72, 153, 0.3);
}

.composer-instrument-btn.active[data-instrument="flute"] {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.2), rgba(8, 145, 178, 0.2));
  border-color: #06b6d4;
  color: #06b6d4;
  box-shadow: 0 0 12px rgba(6, 182, 212, 0.3);
}

.composer-instrument-btn.active[data-instrument="bass"] {
  background: linear-gradient(135deg, rgba(168, 85, 247, 0.2), rgba(147, 51, 234, 0.2));
  border-color: #a855f7;
  color: #a855f7;
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.3);
}

/* Composer Clear All Button */
.composer-clear-all-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 8px;
  color: #ef4444;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.composer-clear-all-btn svg {
  width: 16px;
  height: 16px;
}

.composer-clear-all-btn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: #ef4444;
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.composer-clear-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: transparent;
  border: 1px solid rgba(239, 68, 68, 0.5);
  border-radius: 8px;
  color: #ef4444;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.composer-clear-btn:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: #ef4444;
}

/* Composer Mode Body State */
body.composer-mode .canvas-container {
  cursor: crosshair;
}

body.composer-mode #composerBtn {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2)) !important;
  border-color: var(--accent-primary) !important;
  color: var(--accent-primary) !important;
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.3);
}

/* Hide top-bar-center content in composer mode */
body.composer-mode .top-bar-center .segmented-control,
body.composer-mode .top-bar-center .header-score-stats {
  display: none !important;
}

/* Hide segmented controls when no music is loaded (overlay message visible) - except during tutorial */
body:not(.music-loaded):not(.tutorial-active) .sub-header-controls .segmented-control,
body:not(.music-loaded):not(.tutorial-active) .header-segmented {
  display: none !important;
}

/* Hide header-segmented during tutorial (keep it hidden) */
body.tutorial-active .header-segmented {
  display: none !important;
}

/* Show subheader elements during tutorial */
body.tutorial-active .sub-header-controls .segmented-control,
body.tutorial-active .sub-header-controls .btn-clear-audio,
body.tutorial-active #clearAudioBtn {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}

/* Composer notes on canvas - editable states */
.composer-mode .note-hover {
  cursor: grab;
}

.composer-mode .note-dragging {
  cursor: grabbing;
}

.composer-mode .note-resize-top,
.composer-mode .note-resize-bottom {
  cursor: ns-resize;
}

/* Record Button Expansion Animation */
.btn-record {
  position: relative;
  display: flex !important;
  align-items: center;
  justify-content: center;
  overflow: visible;
  transition: all 0.3s ease;
}

.btn-record svg {
  margin-left: 8px;
}

/* Clear Audio Button - Subtle Red */
#clearAudioBtn {
  display: none;
  /* Hidden by default */
  color: #f87171;
  /* Light red text */
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.2);
}

#clearAudioBtn:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
  color: #ef4444;
}

#clearAudioBtn.visible {
  display: flex;
}

/* Audio Filter Button */
.btn-audio-filter {
  margin-left: 8px;
  transition: all 0.2s ease;
}

.btn-audio-filter.active {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-audio-filter.active:hover {
  background: rgba(99, 102, 241, 0.3);
}

.btn-record .record-label {
  display: inline-block;
  width: 0;
  overflow: hidden;
  opacity: 0;
  white-space: nowrap;
  font-size: 0.75rem;
  font-weight: 600;
  color: #ef4444;
  transition: all 0.3s ease;
  margin-left: 0;
}

.btn-record.recording {
  background: rgba(239, 68, 68, 0.15) !important;
  border-color: #ef4444 !important;
  padding-right: 12px;
}

.btn-record.recording svg {
  color: #ef4444;
}

.btn-record.recording svg circle {
  fill: #ef4444;
  stroke: #ef4444;
}

.btn-record.recording .record-label {
  width: 70px;
  opacity: 1;
  margin-left: 8px;
}

/* Pulsing animation for recording indicator */
@keyframes recording-pulse {

  0%,
  100% {
    opacity: 1;
  }

  50% {
    opacity: 0.5;
  }
}

.btn-record.recording svg circle:last-child {
  animation: recording-pulse 1s ease-in-out infinite;
}

/* Composer Download Button in Header */
.btn-composer-download {
  display: flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.2), rgba(139, 92, 246, 0.2));
  border: 1px solid var(--accent-primary);
  color: var(--accent-primary);
  padding: 8px 16px;
  border-radius: 8px;
  font-weight: 600;
  transition: all 0.2s ease;
}

.btn-composer-download:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3));
  box-shadow: 0 0 12px rgba(99, 102, 241, 0.4);
}

.btn-composer-download svg {
  width: 18px;
  height: 18px;
}

.btn-composer-download.hidden {
  display: none;
}

/* Show download button in composer mode */
body.composer-mode .btn-composer-download {
  display: flex !important;
}

/* Export Panel Modal */
.composer-export-modal .composer-export-panel {
  text-align: center;
  padding: 24px;
  max-width: 600px;
}

.composer-export-panel h3 {
  margin-bottom: 8px;
  color: var(--text-primary);
}

.composer-export-panel .export-info {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 20px;
}


/* Category Modal Input Styling */
.category-modal input[type="text"] {
  width: 100%;
  padding: 10px 14px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  margin-top: 8px;
  margin-bottom: 16px;
  outline: none;
  transition: border-color 0.2s;
}

.category-modal input[type="text"]:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.composer-export-panel .export-buttons {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-bottom: 16px;
}

.btn-export {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 16px 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  color: var(--text-primary);
  transition: all 0.2s ease;
  min-width: 80px;
}

.btn-export:hover {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.btn-export svg {
  width: 24px;
  height: 24px;
}

.btn-export span {
  font-size: 12px;
  font-weight: 600;
}

/* Icon Picker in Category Modal */
.icon-picker {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 8px;
  max-height: 200px;
  overflow-y: auto;
  padding: 4px;
  margin-top: 8px;
}

.icon-picker-btn {
  width: 40px;
  height: 40px;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.icon-picker-btn:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--accent-secondary);
}

.icon-picker-btn.selected {
  background: rgba(99, 102, 241, 0.2);
  border-color: var(--accent-primary);
  color: var(--accent-primary);
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.3);
}

.icon-picker-btn svg {
  width: 20px;
  height: 20px;
  stroke-width: 2px;
}

/* ========================================
   Enhanced Settings Modal
   ======================================== */

.settings-modal-enhanced {
  background: #1e1e24;
  width: 780px;
  max-width: 95vw;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalFadeIn 0.3s ease;
}

.settings-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
}

.settings-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: white;
  margin: 0;
  letter-spacing: 0.5px;
}

.close-settings-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  transition: color 0.2s;
}

.close-settings-btn:hover {
  color: white;
}

.settings-body {
  padding: 24px;
  overflow-y: auto;
  max-height: 60vh;
}

.settings-section {
  margin-bottom: 8px;
}

.settings-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  color: var(--accent-primary);
  font-size: 13px;
  text-transform: uppercase;
  font-weight: 700;
  letter-spacing: 1px;
}

.settings-section-title svg {
  width: 16px;
  height: 16px;
}

.settings-row {
  margin-bottom: 20px;
}

.settings-label {
  display: flex;
  flex-direction: column;
  margin-bottom: 8px;
}

.settings-label span:first-child {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.settings-sublabel {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

.settings-label-simple {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 10px;
}

.settings-control {
  display: flex;
  align-items: center;
  gap: 16px;
}

/* Volume Slider */
.volume-control {
  background: rgba(255, 255, 255, 0.03);
  padding: 12px 16px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.volume-slider {
  flex: 1;
  -webkit-appearance: none;
  appearance: none;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  outline: none;
  width: 100%;
}

.volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent-primary);
  cursor: pointer;
  border: 2px solid #fff;
  box-shadow: 0 0 10px rgba(99, 102, 241, 0.5);
  transition: transform 0.1s;
}

.volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.1);
}

.volume-value {
  font-size: 14px;
  font-weight: 700;
  color: white;
  min-width: 40px;
  text-align: right;
}

/* Instrument Grid */
.instrument-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.instrument-btn-enhanced {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
}

.instrument-btn-enhanced:hover {
  background: rgba(255, 255, 255, 0.06);
  border-color: rgba(255, 255, 255, 0.1);
  color: white;
  transform: translateY(-2px);
}

.instrument-btn-enhanced.active {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-primary);
  color: white;
  box-shadow: 0 4px 12px rgba(99, 102, 241, 0.2);
}

.inst-icon {
  font-size: 20px;
}

.instrument-btn-enhanced span:last-child {
  font-size: 12px;
  font-weight: 500;
}

.settings-divider {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.1), transparent);
  margin: 24px 0;
}

/* Color Picker */
.color-picker-enhanced {
  display: flex;
  align-items: center;
  gap: 12px;
}

.color-picker-enhanced input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  background: none;
  overflow: hidden;
}

.color-picker-enhanced input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker-enhanced input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 8px;
  border: 2px solid rgba(255, 255, 255, 0.2);
}

.color-preview {
  flex: 1;
  height: 40px;
  border-radius: 8px;
  opacity: 0.5;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  transition: background-color 0.3s ease;
}

.settings-footer {
  padding: 20px 24px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.btn-save-settings {
  min-width: 120px;
}

/* SVG Instrument Icons */
.instrument-btn-enhanced .inst-icon {
  width: 24px;
  height: 24px;
}

/* Toggle Row */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Toggle Switch */
.toggle-switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
  flex-shrink: 0;
}

.toggle-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.toggle-slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255, 255, 255, 0.1);
  transition: 0.3s;
  border-radius: 24px;
}

.toggle-slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}

.toggle-switch input:checked+.toggle-slider {
  background: var(--accent-primary);
}

.toggle-switch input:checked+.toggle-slider:before {
  transform: translateX(20px);
}

/* Settings Subsection Title */
.settings-subsection-title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin: 16px 0 12px 0;
}

/* Thin Divider */
.settings-divider-thin {
  height: 1px;
  background: rgba(255, 255, 255, 0.05);
  margin: 16px 0;
}

/* Settings Tabs */
.settings-tabs {
  display: flex;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0 12px;
  background: rgba(0, 0, 0, 0.1);
  overflow-x: auto;
  flex-shrink: 0;
}

.settings-tab {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 22px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.settings-tab svg {
  width: 16px;
  height: 16px;
}

.settings-tab:hover {
  color: var(--text-secondary);
}

.settings-tab.active {
  color: var(--accent-primary);
  border-bottom-color: var(--accent-primary);
}

.settings-tab-content {
  display: none;
}

.settings-tab-content.active {
  display: block;
}

/* Particle Effect */
.key-particle {
  position: fixed;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  pointer-events: none;
  z-index: 9999;
}

/* Glow Effect */
.key-glow {
  position: relative;
  animation: keyGlow 0.4s ease-out;
}

.key-glow::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: var(--glow-color, #ffffff);
  opacity: 0.5;
  filter: blur(10px);
  border-radius: 0 0 4px 4px;
  animation: glowFade 0.4s ease-out forwards;
  pointer-events: none;
}

@keyframes keyGlow {
  0% {
    box-shadow: 0 0 20px var(--glow-color, #ffffff),
      0 0 40px var(--glow-color, #ffffff);
  }

  100% {
    box-shadow: none;
  }
}

@keyframes glowFade {
  0% {
    opacity: 0.6;
    transform: scaleY(1.5);
  }

  100% {
    opacity: 0;
    transform: scaleY(1);
  }
}

/* Settings Select Dropdown */
.settings-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  padding: 10px 14px;
  color: var(--text-primary);
  font-size: 13px;
  min-width: 180px;
  cursor: pointer;
  transition: all 0.2s ease;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 36px;
}

.settings-select:hover {
  border-color: rgba(255, 255, 255, 0.25);
  background-color: rgba(255, 255, 255, 0.08);
}

.settings-select:focus {
  outline: none;
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.settings-select option {
  background: #1a1a2e;
  color: var(--text-primary);
  padding: 8px;
}

/* Finger Number on Piano Keys */
.key-finger-number {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 14px;
  font-weight: 700;
  pointer-events: none;
  z-index: 5;
}

/* Left hand finger numbers - Blue */
.key-finger-number.left-hand {
  color: #3b82f6;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Right hand finger numbers - Red */
.key-finger-number.right-hand {
  color: #ef4444;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

.key-black .key-finger-number.left-hand {
  color: #60a5fa;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

.key-black .key-finger-number.right-hand {
  color: #f87171;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
}

/* Enhanced Category Modal Styles (Matching Settings) */
.category-modal {
  min-width: 420px;
  max-width: 420px;
  background: #1a1a2e;
  /* Darker background like settings */
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  padding: 0;
  overflow: hidden;
}

.category-modal h2 {
  font-size: 18px;
  font-weight: 600;
  padding: 20px 24px;
  margin: 0;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  color: white;
  text-align: left;
}

.category-modal .settings-group {
  padding: 0 24px;
  margin-top: 20px;
  text-align: left;
}

.category-modal input[type="text"] {
  width: 100%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  padding: 12px 16px;
  color: white;
  font-size: 14px;
  transition: all 0.2s ease;
}

.category-modal input[type="text"]:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 0 0 2px rgba(99, 102, 241, 0.2);
}

.icon-picker {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-top: 10px;
}

.icon-picker-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  aspect-ratio: 1;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 10px;
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.2s ease;
  padding: 0;
}

.icon-picker-btn svg {
  width: 24px;
  height: 24px;
  stroke-width: 1.5;
}

.icon-picker-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  transform: translateY(-2px);
}

.icon-picker-btn.selected {
  background: rgba(99, 102, 241, 0.15);
  border-color: var(--accent-primary);
  color: white;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.3);
}

.category-modal .modal-buttons {
  padding: 20px 24px;
  margin-top: 10px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

/* ========================================
   Upgrade Modal Styles
   ======================================== */

.upgrade-modal {
  min-width: 480px;
  max-width: 520px;
  background: linear-gradient(145deg, #1a1a2e 0%, #0f0f1a 100%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.5), 0 0 100px rgba(99, 102, 241, 0.15);
  padding: 0;
  overflow: hidden;
  text-align: center;
}

.upgrade-header {
  padding: 32px 24px 24px;
  background: linear-gradient(to bottom, rgba(99, 102, 241, 0.1), transparent);
}

.upgrade-badge {
  display: inline-block;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  font-size: 12px;
  font-weight: 800;
  padding: 6px 16px;
  border-radius: 20px;
  margin-bottom: 16px;
  letter-spacing: 1px;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.4);
}

.upgrade-header h2 {
  font-size: 24px;
  font-weight: 700;
  margin: 0 0 8px;
  color: white;
}

.upgrade-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  margin: 0;
}

.upgrade-features {
  padding: 16px 24px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  background: rgba(0, 0, 0, 0.2);
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 16px;
}

.upgrade-feature {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  font-size: 13px;
  color: var(--text-secondary);
}

.upgrade-feature svg {
  width: 18px;
  height: 18px;
  color: var(--success);
  flex-shrink: 0;
}

.upgrade-pricing {
  padding: 16px 24px;
}

.upgrade-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 4px;
}

.price-currency {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-secondary);
}

.price-amount {
  font-size: 36px;
  font-weight: 800;
  color: white;
  line-height: 1;
}

.price-period {
  font-size: 14px;
  color: var(--text-muted);
  margin-left: 2px;
}

.price-note {
  font-size: 13px;
  color: var(--text-muted);
  margin: 8px 0 0;
}

/* Upgrade Plans Grid */
.upgrade-plans {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 20px 24px;
}

.plan-card {
  position: relative;
  background: rgba(255, 255, 255, 0.03);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
  transition: all 0.3s ease;
  cursor: pointer;
}

.plan-card:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(255, 255, 255, 0.05);
}

.plan-card.selected {
  border-color: var(--accent-primary);
  background: rgba(99, 102, 241, 0.08);
  box-shadow: 0 0 20px rgba(99, 102, 241, 0.2);
}

.plan-popular {
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #22c55e, #16a34a);
  color: white;
  font-size: 10px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.plan-header {
  margin-bottom: 12px;
}

.plan-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.plan-card .plan-price {
  display: flex;
  align-items: baseline;
  justify-content: center;
  gap: 2px;
  margin-bottom: 8px;
}

.plan-card .price-currency {
  font-size: 18px;
}

.plan-card .price-amount {
  font-size: 32px;
}

.plan-card .price-period {
  font-size: 13px;
}

.plan-note {
  font-size: 12px;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.btn-plan {
  width: 100%;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 600;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

.btn-plan svg {
  width: 16px;
  height: 16px;
}

.promo-section {
  padding: 0 24px 16px;
}

.promo-input-group,
.license-input-group {
  display: flex;
  gap: 8px;
}

.promo-input-group input,
.license-input-group input {
  flex: 1;
  padding: 10px 14px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: rgba(255, 255, 255, 0.05);
  color: white;
  font-size: 14px;
}

.promo-input-group input::placeholder,
.license-input-group input::placeholder {
  color: var(--text-muted);
}

.promo-result,
.license-result {
  font-size: 13px;
  margin-top: 8px;
  min-height: 18px;
}

.promo-result.success,
.license-result.success {
  color: var(--success);
}

.promo-result.error,
.license-result.error {
  color: var(--danger);
}

.upgrade-actions {
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.btn-large {
  padding: 14px 24px;
  font-size: 16px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-large svg {
  width: 20px;
  height: 20px;
}

.license-activate {
  padding: 20px 24px;
  background: rgba(0, 0, 0, 0.2);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.license-activate p {
  font-size: 13px;
  color: var(--text-muted);
  margin: 0 0 12px;
}

/* ========================================
   MIDI Counter Badge
   ======================================== */

.midi-counter {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.08);
  font-size: 12px;
  color: var(--text-secondary);
  margin-left: 8px;
}

.midi-counter.warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.midi-counter.limit-reached {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* ========================================
   Locked Feature Overlay 
   ======================================== */

.locked-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 100;
  backdrop-filter: blur(4px);
  cursor: pointer;
  transition: all 0.2s;
}

.locked-overlay:hover {
  background: rgba(0, 0, 0, 0.9);
}

.locked-overlay svg {
  width: 48px;
  height: 48px;
  color: var(--accent-primary);
}

.locked-overlay span {
  font-size: 14px;
  color: var(--text-secondary);
}

.locked-overlay .unlock-btn {
  margin-top: 8px;
  padding: 8px 16px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

/* Trial Banner */
.trial-banner {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(90deg, #6366f1, #8b5cf6);
  padding: 10px 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  z-index: 1000;
  font-size: 14px;
  font-weight: 500;
  color: white;
}

.trial-banner button {
  padding: 6px 14px;
  background: white;
  border: none;
  border-radius: 6px;
  color: #6366f1;
  font-weight: 600;
  cursor: pointer;
}

.trial-banner .close-trial {
  position: absolute;
  right: 16px;
  background: transparent;
  color: white;
  opacity: 0.7;
}

/* ========================================
   Account Section in Settings
   ======================================== */

.account-section {
  margin-bottom: 20px;
}

.account-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 16px 20px;
}

.account-header {
  display: flex;
  align-items: center;
  gap: 14px;
}

.account-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.account-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  position: absolute;
}

.avatar-fallback {
  font-size: 20px;
  font-weight: 700;
  color: white;
}

.account-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.account-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
}

.account-email {
  font-size: 13px;
  color: var(--text-muted);
}

.btn-danger {
  color: #ef4444;
  border-color: rgba(239, 68, 68, 0.3);
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.1);
  border-color: rgba(239, 68, 68, 0.5);
}

.account-not-logged {
  justify-content: center;
  text-align: center;
  flex-direction: column;
  gap: 12px;
}

.account-not-logged p {
  color: var(--text-muted);
  margin: 0;
}

/* ========================================
   License Status in Settings
   ======================================== */

.license-status-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 16px;
}

.license-status-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.license-status-badge {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.license-status-badge.free {
  background: rgba(113, 113, 122, 0.2);
  color: #a1a1aa;
}

.license-status-badge.trial {
  background: rgba(245, 158, 11, 0.2);
  color: #f59e0b;
}

.license-status-badge.pro {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.3), rgba(139, 92, 246, 0.3));
  color: #a78bfa;
}

.license-status-info {
  font-size: 13px;
  color: var(--text-secondary);
}

.license-status-info strong {
  color: white;
}

/* Sign Up Required Prompt (License Tab) */
.license-signup-required {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 300px;
}

.signup-prompt-card {
  text-align: center;
  padding: 40px 30px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  max-width: 340px;
}

.signup-prompt-icon {
  margin-bottom: 20px;
  color: var(--accent-primary);
}

.signup-prompt-icon svg {
  width: 48px;
  height: 48px;
}

.signup-prompt-title {
  font-size: 20px;
  font-weight: 600;
  color: white;
  margin: 0 0 12px;
}

.signup-prompt-text {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
  margin: 0;
}

/* PRO Active Card */
.pro-active-card {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(22, 163, 74, 0.1));
  border: 1px solid rgba(34, 197, 94, 0.3);
  border-radius: 12px;
  padding: 24px;
  text-align: center;
  margin-bottom: 16px;
}

.pro-active-icon {
  width: 48px;
  height: 48px;
  background: linear-gradient(135deg, #22c55e, #16a34a);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
  font-size: 24px;
  color: white;
}

.pro-active-card h4 {
  color: #22c55e;
  font-size: 18px;
  margin-bottom: 8px;
}

.pro-active-card p {
  color: var(--text-secondary);
  font-size: 14px;
}

/* Library Sort Select */
.library-sort-select {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.library-sort-select:hover {
  border-color: rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.08);
}

.library-sort-select:focus {
  border-color: var(--accent-primary);
}

.library-sort-select option {
  background: #1a1a2e;
  color: white;
}

/* Hide composer actions in focus mode */
body.focus-active .composer-actions {
  display: none;
}

/* Composer Save Button */
.btn-composer-save {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 10px 12px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #22c55e;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  margin-left: 8px;
}

.btn-composer-save:hover {
  background: rgba(34, 197, 94, 0.2);
  border-color: rgba(34, 197, 94, 0.5);
  transform: translateY(-1px);
}

.btn-composer-save svg {
  width: 16px;
  height: 16px;
}

.btn-composer-save.hidden,
.btn-composer-download.hidden {
  display: none !important;
}

.composer-actions {
  display: flex;
  align-items: center;
}

/* Hide elements in focus mode */
body.focus-active .composer-actions,
body.focus-active #infoBtn {
  display: none !important;
}

/* Save Project Modal */
.modal-small {
  max-width: 400px;
}

/* Save Project Modal Overlay */
#saveProjectModal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

#saveProjectModal.visible {
  display: flex;
}

#saveProjectModal .modal-content {
  background: var(--bg-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  max-width: 400px;
  width: 90%;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  pointer-events: auto;
  position: relative;
  z-index: 10000;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.modal-header h3 {
  margin: 0;
  font-size: 18px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
}

.modal-close:hover {
  color: white;
}

.modal-body {
  padding: 20px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.form-group {
  margin-bottom: 16px;
}

.form-group:last-child {
  margin-bottom: 0;
}

.form-group label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text-secondary);
}

.form-input {
  width: 100%;
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--accent-primary);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 13px;
}

.btn-text {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
}

.btn-text:hover {
  color: white;
}

/* Tutorial Overlay */
.tutorial-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
}

.tutorial-overlay.active {
  display: flex;
}

.tutorial-tooltip {
  position: absolute;
  background: linear-gradient(135deg, var(--bg-secondary), var(--bg-tertiary));
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-radius: 16px;
  padding: 20px;
  max-width: 350px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(139, 92, 246, 0.2);
  z-index: 10001;
  animation: tooltipPulse 2s infinite;
}

@keyframes tooltipPulse {

  0%,
  100% {
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 30px rgba(139, 92, 246, 0.2);
  }

  50% {
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 40px rgba(139, 92, 246, 0.4);
  }
}

.tutorial-tooltip::before {
  content: '';
  position: absolute;
  width: 16px;
  height: 16px;
  background: var(--bg-secondary);
  border: 1px solid rgba(139, 92, 246, 0.4);
  border-right: none;
  border-bottom: none;
  transform: rotate(45deg);
  display: none;
}

/* Only show arrow when a direction class is present */
.tutorial-tooltip.arrow-top::before,
.tutorial-tooltip.arrow-bottom::before,
.tutorial-tooltip.arrow-left::before,
.tutorial-tooltip.arrow-right::before {
  display: block;
}

.tutorial-tooltip.arrow-top::before {
  top: -9px;
  left: var(--arrow-left, 50%);
  margin-left: -8px;
}

.tutorial-tooltip.arrow-bottom::before {
  bottom: -9px;
  left: var(--arrow-left, 50%);
  margin-left: -8px;
  transform: rotate(225deg);
}

.tutorial-tooltip.arrow-left::before {
  left: -9px;
  top: 50%;
  margin-top: -8px;
  transform: rotate(-45deg);
}

.tutorial-tooltip.arrow-right::before {
  right: -9px;
  top: 50%;
  margin-top: -8px;
  transform: rotate(135deg);
}

.tutorial-step-indicator {
  font-size: 12px;
  color: var(--accent-primary);
  font-weight: 600;
  margin-bottom: 8px;
}

.tutorial-content h4 {
  font-size: 16px;
  margin-bottom: 8px;
  color: white;
}

.tutorial-content p {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
  margin-bottom: 16px;
}

.tutorial-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.tutorial-actions .btn-sm {
  flex-shrink: 0;
}

.tutorial-actions #tutorialSkip {
  margin-left: auto;
}

/* Tutorial highlight */
.tutorial-highlight {
  position: relative;
  z-index: 10002;
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.5), 0 0 20px rgba(139, 92, 246, 0.3);
  border-radius: 8px;
  animation: highlightPulse 1.5s infinite;
}

@keyframes highlightPulse {

  0%,
  100% {
    box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.5), 0 0 20px rgba(139, 92, 246, 0.3);
  }

  50% {
    box-shadow: 0 0 0 6px rgba(139, 92, 246, 0.7), 0 0 30px rgba(139, 92, 246, 0.5);
  }
}

/* Info button active state */
#infoBtn.active {
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  color: white;
}

/* About Tab Styles */
.about-section {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 20px 0;
  color: var(--text-primary);
}

.about-logo-container {
  width: 64px;
  height: 64px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  border-radius: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 16px;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3);
}

.app-logo-large {
  width: 32px;
  height: 32px;
  color: white;
}

.app-branding h3 {
  font-size: 24px;
  margin: 0 0 4px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.app-version {
  color: var(--text-secondary);
  font-size: 14px;
  margin: 0 0 20px;
}

.about-info {
  margin: 8px 0;
  max-width: 400px;
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-secondary);
}

.about-links {
  display: flex;
  gap: 20px;
  margin: 12px 0;
  flex-wrap: wrap;
  justify-content: center;
}

.about-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-primary);
  text-decoration: none;
  font-size: 13px;
  transition: color 0.2s;
}

.about-link:hover {
  color: var(--accent-primary);
}

.about-copyright {
  color: var(--text-dim);
  font-size: 12px;
  margin-top: 16px;
}

.disable-link {
  opacity: 0.6;
  cursor: default;
  pointer-events: none;
}

/* ========================================
   Enhanced Settings Tabs UI
   ======================================== */

/* Appearance Section */
.appearance-section {
  margin-bottom: 16px;
}

.appearance-section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
}

.appearance-section-title svg {
  color: var(--accent-primary);
}

/* Color Cards */
.color-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.3s ease;
}

.color-card:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.12);
}

.color-card-left {
  border-left: 3px solid #3b82f6;
}

.color-card-right {
  border-left: 3px solid #22c55e;
}

.color-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.color-card-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.color-card-icon svg {
  width: 22px;
  height: 22px;
}

.color-card-icon.left {
  background: linear-gradient(135deg, rgba(59, 130, 246, 0.2), rgba(99, 102, 241, 0.15));
  color: #3b82f6;
}

.color-card-icon.right {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.2), rgba(16, 185, 129, 0.15));
  color: #22c55e;
}

.color-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.color-card-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-primary);
}

.color-card-subtitle {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Gradient Color Picker */
.color-gradient-picker {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.color-input-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.color-input-group label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-dim);
}

.color-input-group input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  padding: 0;
  background: none;
  overflow: hidden;
}

.color-input-group input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-input-group input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 10px;
  border: 2px solid rgba(255, 255, 255, 0.15);
}

.color-input-group input[type="color"]:hover::-webkit-color-swatch {
  border-color: rgba(255, 255, 255, 0.3);
}

/* Gradient Preview */
.gradient-preview {
  flex: 1;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(90deg, #3b82f6, #6366f1);
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: all 0.3s ease;
}

/* Gradient Toggle */
.gradient-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  font-size: 12px;
  color: var(--text-secondary);
  user-select: none;
}

.gradient-toggle input[type="checkbox"] {
  width: 14px;
  height: 14px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.gradient-toggle:hover span {
  color: var(--text-primary);
}

/* Visual Options Grid */
.visual-options-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.visual-option-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  transition: all 0.2s ease;
}

.visual-option-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.visual-option-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.visual-option-info>span:first-child {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-primary);
}

.visual-option-sub {
  font-size: 11px;
  color: var(--text-dim);
}

/* Mini Color Picker */
.color-picker-mini {
  display: flex;
  align-items: center;
  gap: 8px;
}

.color-picker-mini input[type="color"] {
  -webkit-appearance: none;
  appearance: none;
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  background: none;
  overflow: hidden;
}

.color-picker-mini input[type="color"]::-webkit-color-swatch-wrapper {
  padding: 0;
}

.color-picker-mini input[type="color"]::-webkit-color-swatch {
  border: none;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.15);
}

.color-mini-preview {
  width: 50px;
  height: 28px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  transition: background-color 0.3s ease;
}

/* Settings divider thin */
.settings-divider-thin {
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.08), transparent);
  margin: 16px 0;
}

/* Legacy compact color row support */
.appearance-colors-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 16px;
}

.appearance-colors-grid .settings-row {
  margin-bottom: 0;
}

.compact-color-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.compact-color-row .settings-label {
  flex: 1;
  margin-bottom: 0;
}

.compact-color-row .settings-label span:first-child {
  font-size: 13px;
}

.compact-color-row .color-picker-enhanced {
  width: auto;
}

.compact-color-row .color-preview {
  width: 80px;
  height: 32px;
}

.compact-color-row input[type="color"] {
  width: 32px;
  height: 32px;
}

/* Learning Tab Icons */
.learning-setting-item {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  margin-bottom: 12px;
  transition: all 0.2s ease;
}

.learning-setting-item:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: rgba(255, 255, 255, 0.1);
}

.learning-setting-icon {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.15), rgba(139, 92, 246, 0.15));
  color: var(--accent-primary);
}

.learning-setting-icon svg {
  width: 20px;
  height: 20px;
}

.learning-setting-icon.green {
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(22, 163, 74, 0.15));
  color: #22c55e;
}

.learning-setting-icon.amber {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.15), rgba(217, 119, 6, 0.15));
  color: #f59e0b;
}

.learning-setting-icon.cyan {
  background: linear-gradient(135deg, rgba(6, 182, 212, 0.15), rgba(8, 145, 178, 0.15));
  color: #06b6d4;
}

.learning-setting-content {
  flex: 1;
}

.learning-setting-content .settings-label {
  margin-bottom: 0;
}

/* Effects Tab Enhanced */
.effect-toggle-card {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  margin-bottom: 12px;
  transition: all 0.3s ease;
}

.effect-toggle-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(255, 255, 255, 0.15);
  transform: translateY(-1px);
}

.effect-toggle-card.particles-card {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.08), rgba(251, 113, 133, 0.05));
  border-color: rgba(236, 72, 153, 0.2);
}

.effect-toggle-card.particles-card:hover {
  background: linear-gradient(135deg, rgba(236, 72, 153, 0.12), rgba(251, 113, 133, 0.08));
  border-color: rgba(236, 72, 153, 0.35);
}

.effect-toggle-card.glow-card {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.08), rgba(139, 92, 246, 0.05));
  border-color: rgba(99, 102, 241, 0.2);
}

.effect-toggle-card.glow-card:hover {
  background: linear-gradient(135deg, rgba(99, 102, 241, 0.12), rgba(139, 92, 246, 0.08));
  border-color: rgba(99, 102, 241, 0.35);
}

.effect-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.effect-icon.particles {
  background: linear-gradient(135deg, #ec4899, #f43f5e);
  color: white;
  box-shadow: 0 4px 15px rgba(236, 72, 153, 0.3);
}

.effect-icon.glow {
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: white;
  box-shadow: 0 4px 15px rgba(99, 102, 241, 0.3);
}

.effect-icon svg {
  width: 24px;
  height: 24px;
}

.effect-content {
  flex: 1;
}

.effect-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.effect-description {
  font-size: 12px;
  color: var(--text-secondary);
}

/* Premium License PRO Card */
.license-pro-active-card {
  background: linear-gradient(135deg, rgba(139, 92, 246, 0.12), rgba(99, 102, 241, 0.08), rgba(34, 197, 94, 0.08));
  border: 1px solid rgba(139, 92, 246, 0.35);
  border-radius: 16px;
  padding: 28px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
  animation: license-glow 3s ease-in-out infinite;
}

@keyframes license-glow {

  0%,
  100% {
    box-shadow: 0 0 20px rgba(139, 92, 246, 0.15), 0 0 40px rgba(99, 102, 241, 0.1);
  }

  50% {
    box-shadow: 0 0 30px rgba(139, 92, 246, 0.25), 0 0 60px rgba(99, 102, 241, 0.15);
  }
}

.license-pro-active-card::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: linear-gradient(45deg, transparent 30%, rgba(255, 255, 255, 0.05) 50%, transparent 70%);
  animation: shimmer 4s ease-in-out infinite;
  pointer-events: none;
}

@keyframes shimmer {
  0% {
    transform: translateX(-100%) rotate(45deg);
  }

  100% {
    transform: translateX(100%) rotate(45deg);
  }
}

.license-pro-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #6366f1, #8b5cf6, #a855f7);
  padding: 8px 20px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  color: white;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 16px;
  box-shadow: 0 4px 20px rgba(139, 92, 246, 0.4);
}

.license-pro-badge svg {
  width: 18px;
  height: 18px;
}

.license-pro-title {
  font-size: 20px;
  font-weight: 700;
  color: white;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.license-pro-title svg {
  color: #22c55e;
}

.license-pro-message {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.license-pro-features {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-top: 16px;
}

.license-pro-feature {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.06);
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 11px;
  color: var(--text-primary);
}

.license-pro-feature svg {
  width: 12px;
  height: 12px;
  color: #22c55e;
}

/* Compact settings row spacing */
.settings-row-compact {
  margin-bottom: 12px;
}

.settings-row-inline {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.settings-row-inline .settings-label {
  margin-bottom: 0;
}

/* Storage Progress Bar */
.license-storage-section {
  padding: 16px;
  background: var(--bg-tertiary);
  border-radius: 12px;
  border: 1px solid var(--border-color);
}

.storage-progress-container {
  width: 100%;
  height: 8px;
  background: var(--bg-secondary);
  border-radius: 4px;
  overflow: hidden;
  margin: 12px 0;
}

.storage-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-primary), #a78bfa);
  border-radius: 4px;
  transition: width 0.3s ease;
}

.storage-details {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  color: var(--text-secondary);
}

.storage-details span {
  display: flex;
  align-items: center;
  gap: 4px;
}

/* ========================================
   Conversion Modal & Enhanced UI
   ======================================== */

.conversion-modal {
  background: rgba(20, 20, 30, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5), 0 0 30px rgba(99, 102, 241, 0.15);
  border-radius: 20px;
  padding: 40px 30px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  position: relative;
  overflow: hidden;
}

/* Subtle gradient border effect */
.conversion-modal::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(99, 102, 241, 0.5), transparent);
}

.conversion-subtitle {
  color: var(--text-secondary);
  font-size: 0.95rem;
  margin-top: 8px;
  margin-bottom: 30px;
}

.conversion-progress {
  margin: 30px 0;
}

.progress-bar-large {
  height: 12px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  overflow: hidden;
  position: relative;
  margin-bottom: 15px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.progress-fill-large {
  height: 100%;
  width: 0%;
  background: var(--accent-gradient);
  border-radius: 6px;
  position: relative;
  transition: width 0.3s ease;
  box-shadow: 0 0 15px rgba(99, 102, 241, 0.5);
}

/* Animated shine effect on progress bar */
.progress-fill-large::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  right: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.4), transparent);
  transform: translateX(-100%);
  animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
  100% {
    transform: translateX(100%);
  }
}

.progress-text {
  color: var(--text-primary);
  font-size: 0.9rem;
  font-weight: 500;
  min-height: 20px;
}

.conversion-result {
  animation: fadeIn 0.5s ease;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 12px;
  padding: 20px;
  margin-bottom: 25px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.result-info {
  display: flex;
  justify-content: space-between;
  margin-bottom: 12px;
  color: var(--text-secondary);
  font-size: 0.9rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.1);
  padding-bottom: 8px;
}

.result-info span:last-child {
  color: var(--text-primary);
  font-weight: 600;
  font-family: monospace;
  font-size: 1rem;
}

.conversion-buttons {
  display: flex;
  gap: 12px;
  margin-top: 20px;
  justify-content: center;
}

.conversion-buttons .btn {
  flex: 1;
}

#closeConversionBtn {
  margin-top: 10px;
  width: 100%;
  border-color: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

#closeConversionBtn:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-primary);
}

/* ========================================
   Mobile Responsive Styles
   ======================================== */

@media screen and (max-width: 768px),
(max-height: 500px) {

  /* Reduce piano height on mobile */
  .piano-wrapper,
  .piano-container {
    max-height: 100px !important;
    min-height: 80px !important;
    height: 100px !important;
  }

  /* Reduce key heights */
  .key-white {
    height: 90px !important;
  }

  .key-black {
    height: 55px !important;
  }

  /* Smaller toolbar on mobile */
  .top-bar {
    padding: 4px 8px !important;
    min-height: 40px !important;
    height: 40px !important;
  }

  .top-bar .btn {
    padding: 6px !important;
    min-width: 32px !important;
    min-height: 32px !important;
  }

  .top-bar svg {
    width: 18px !important;
    height: 18px !important;
  }

  /* Reduce bottom bar on mobile */
  .bottom-bar,
  .control-bar {
    padding: 4px 8px !important;
    min-height: 44px !important;
    gap: 6px !important;
  }

  /* Adjust falling notes area for mobile */
  .visualization-area {
    flex: 1 !important;
    min-height: 100px !important;
  }

  /* Make title smaller on mobile */
  .song-title {
    font-size: 14px !important;
    max-width: 120px !important;
  }

  /* Device status indicator smaller */
  .device-status {
    font-size: 11px !important;
    padding: 4px 8px !important;
  }
}

/* Extra small screens (landscape phone) */
@media screen and (max-height: 400px) {

  .piano-wrapper,
  .piano-container {
    max-height: 70px !important;
    min-height: 60px !important;
    height: 70px !important;
  }

  .key-white {
    height: 65px !important;
  }

  .key-black {
    height: 40px !important;
  }

  .top-bar {
    height: 36px !important;
    min-height: 36px !important;
  }
}

/* ========================================
   Auth Card Styles (Ported from login.html)
   ======================================== */

.auth-card {
  width: 100%;
  max-width: 420px;
  background: rgba(20, 20, 28, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 48px 40px;
  backdrop-filter: blur(20px);
  margin: 0 auto;
  text-align: center;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
  text-decoration: none;
}

.auth-logo .logo-icon {
  font-size: 32px;
  color: var(--blue, #3b82f6);
}

.auth-logo .logo-text {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: white;
  letter-spacing: -0.5px;
}

.auth-title {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: white;
  text-align: center;
  margin-bottom: 8px;
}

.auth-subtitle {
  font-size: 15px;
  color: #9ca3af;
  text-align: center;
  margin-bottom: 32px;
}

.btn-google {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: white;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-bottom: 16px;
}

.btn-google:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

.btn-google svg {
  width: 20px;
  height: 20px;
}

/* ========================================
   Auth Card Modal (Signup/Login Prompt)
   ======================================== */

.auth-modal-card {
  width: 100%;
  max-width: 420px;
  background: rgba(20, 20, 28, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 48px 40px;
  backdrop-filter: blur(20px);
  text-align: center;
}

.auth-logo {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 32px;
  text-decoration: none;
}

.auth-logo .logo-icon {
  font-size: 32px;
  color: var(--accent-primary);
}

.auth-logo .logo-text {
  font-family: 'Outfit', sans-serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.auth-title {
  font-family: 'Outfit', sans-serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--text-primary);
  text-align: center;
  margin-bottom: 12px;
}

.auth-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 32px;
  line-height: 1.5;
}

.auth-features {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 32px;
  text-align: left;
}

.auth-feature {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-secondary);
}

.auth-feature svg {
  width: 18px;
  height: 18px;
  color: var(--success);
  flex-shrink: 0;
}

.auth-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.auth-buttons .btn-primary {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--accent-primary), #4f46e5);
  color: var(--text-primary);
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  text-decoration: none;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.auth-buttons .btn-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.auth-buttons .btn-secondary {
  width: 100%;
  padding: 14px 24px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.auth-buttons .btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.25);
}

.auth-footer {
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-muted);
}

.auth-footer a {
  color: var(--accent-primary);
  text-decoration: none;
  font-weight: 500;
}

.auth-footer a:hover {
  text-decoration: underline;
}

/* Auth Form Styles */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.auth-form .form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  text-align: left;
}

.auth-form .form-group label {
  font-size: 14px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.8);
}

.auth-form .form-group input {
  width: 100%;
  padding: 14px 16px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text-primary);
  font-size: 15px;
  transition: all 0.2s ease;
}

.auth-form .form-group input:focus {
  outline: none;
  border-color: var(--accent-primary);
  background: rgba(255, 255, 255, 0.08);
}

.auth-form .form-group input::placeholder {
  color: rgba(255, 255, 255, 0.3);
}

.form-hint {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 4px;
}

.forgot-password {
  text-align: right;
  margin-top: -8px;
}

.forgot-password a {
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
}

.forgot-password a:hover {
  color: var(--accent-primary);
}

.checkbox-group {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-size: 13px;
  color: var(--text-secondary);
  text-align: left;
  cursor: pointer;
}

.checkbox-group input[type="checkbox"] {
  width: 18px;
  height: 18px;
  margin-top: 2px;
  accent-color: var(--accent-primary);
  cursor: pointer;
}

.checkbox-group a {
  color: var(--accent-primary);
  text-decoration: none;
}

.checkbox-group a:hover {
  text-decoration: underline;
}

.btn-auth-primary {
  width: 100%;
  padding: 16px 24px;
  background: linear-gradient(135deg, var(--accent-primary), #4f46e5);
  color: var(--text-primary);
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.btn-auth-primary:hover {
  transform: translateY(-2px);
  filter: brightness(1.1);
}

.btn-auth-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.btn-auth-primary.btn-success {
  background: linear-gradient(135deg, #22c55e, #16a34a);
}

.btn-auth-primary .spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s linear infinite;
  display: none;
}

.btn-auth-primary.loading .spinner {
  display: inline-block;
}

.btn-auth-primary.loading .btn-text {
  display: none;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 16px;
  margin: 16px 0;
}

.auth-divider::before,
.auth-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: rgba(255, 255, 255, 0.1);
}

.auth-divider span {
  font-size: 13px;
  color: var(--text-muted);
}

.auth-error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #f87171;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  text-align: center;
  display: none;
}

.auth-error:not(:empty) {
  display: block;
}

.auth-success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #4ade80;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 14px;
  text-align: center;
  display: none;
}

.auth-success:not(:empty) {
  display: block;
}

.auth-view {
  width: 100%;
}