/* style.css - Core styling for Amy's CV Sound Studio - Aqua Theme */

.aqua-theme {
  --bg-color: #f0f0f0; /* Light gray for window backgrounds */
  --bg-light: #ffffff;
  --bg-lighter: #e8e8e8;
  --text-color: #333;
  --primary-color: #007aff; /* Aqua blue */
  --secondary-color: #5856d6; /* Aqua purple */
  --border-color: #b8b8b8;
  --font-main: 'Lato', 'Helvetica Neue', 'Segoe UI', system-ui, sans-serif;
  --font-mono: 'JetBrains Mono', 'Cascadia Code', 'Fira Code', monospace;

  --aqua-blue-start: #a3c9f5;
  --aqua-blue-end: #619de4;
  --aqua-blue-border: #4d7baf;

  --aqua-graphite-start: #e2e2e2;
  --aqua-graphite-end: #b4b4b4;
  --aqua-graphite-border: #919191;
}

body.dark-mode {
  --bg-color: #1e1e1e;
  --bg-light: #2d2d2d;
  --bg-lighter: #3c3c3c;
  --text-color: #d4d4d4;
  --primary-color: #4ec9b0;
  --secondary-color: #ce9178;
  --border-color: #444;

  --aqua-blue-start: #3a9d87;
  --aqua-blue-end: #4ec9b0;
  --aqua-blue-border: #2e7a67;

  --aqua-graphite-start: #555;
  --aqua-graphite-end: #444;
  --aqua-graphite-border: #333;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}



body{
  margin:0;
  font-family: var(--font-main);
  color: var(--text-color);
  overflow: hidden;
}

.aqua-theme, body.dark-mode {
  /* Brushed metal effect */
  background-color: #d2d2d2;
  background-image:
    linear-gradient(90deg, rgba(255,255,255,0.07) 50%, transparent 50%),
    linear-gradient(90deg, rgba(0,0,0,0.13) 50%, transparent 50%),
    linear-gradient(90deg, transparent 50%, rgba(255,255,255,0.17) 50%),
    linear-gradient(90deg, transparent 50%, rgba(0,0,0,0.19) 50%);
  background-size: 13px, 29px, 37px, 53px;
}

body.dark-mode {
  background-color: #333;
  background-image:
    linear-gradient(90deg, rgba(255,255,255,0.02) 50%, transparent 50%),
    linear-gradient(90deg, rgba(0,0,0,0.03) 50%, transparent 50%);
  background-size: 13px, 29px;
}

/* Professional Menu Bar */
#menuBar {
  background: linear-gradient(to bottom, #f6f6f6, #e0e0e0);
  border-bottom: 1px solid #a0a0a0;
  display: flex;
  align-items: center;
  position: relative;
  z-index: 1000;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.menu-item {
  position: relative;
  border-right: 1px solid #ccc;
}

body.dark-mode #menuBar {
  background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
  border-bottom: 1px solid #333;
  padding: 0;
}

.menu-label {
  display: block;
  padding: 8px 12px;
  color: #333;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
  user-select: none;
}

body.dark-mode .menu-item {
  border-right: 1px solid #333;
}

body.dark-mode .menu-label {
  color: #ccc;
}

.menu-item:hover .menu-label,
.menu-item.active .menu-label {
  background-color: rgba(0, 122, 255, 0.2);
}

.dropdown {
  color-scheme: light; /* Keep dropdowns light even in dark mode for Aqua feel */
  position: absolute;
  top: 100%;
  left: 0;
  background-color: #f9f9f9f0;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: 1px solid #bbb;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.15);
  min-width: 250px;
  max-height: 400px;
  overflow-y: auto;
  display: none;
  z-index: 1001;
  border-radius: 0 0 6px 6px;
  padding: 5px;
}

body.dark-mode .menu-item:hover .menu-label,
body.dark-mode .menu-item.active .menu-label {
  background: #333;
  color: #fff;
}

body.dark-mode .dropdown {
  color-scheme: dark;
  background: #1a1a1a;
  border: 1px solid #333;
}
.menu-item:hover .dropdown,
.menu-item.active .dropdown {
  display: block;
}

.dropdown-section {
  border-bottom: 1px solid #ddd;
}

body.dark-mode .dropdown-section {
  border-bottom: 1px solid #2a2a2a;
}

.dropdown-section:last-child {
  border-bottom: none;
}

.dropdown-header {
  padding: 6px 12px;
  background: #eee;
  color: #555;
  font-size: 11px;
  font-weight: bold;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid #ddd;
}

body.dark-mode .dropdown-header {
  background: #0f0f0f;
  color: var(--primary-color);
  border-bottom: 1px solid #2a2a2a;
}

.dropdown-item {
  padding: 8px 12px;
  color: #333;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.2s ease;
  border-radius: 4px;
  font-size: 13px;
}

body.dark-mode .dropdown-item {
  color: #ccc;
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover,
.dropdown-item.active {
  background-color: var(--primary-color);
  color: white;
}

body.dark-mode .dropdown-item:hover,
body.dark-mode .dropdown-item.active {
  background: var(--primary-color);
  color: #000;
}

.dropdown-item:hover .material-symbols-outlined,
.dropdown-item.active .material-symbols-outlined {
  color: white;
}

body.dark-mode .dropdown-item:hover .material-symbols-outlined,
body.dark-mode .dropdown-item.active .material-symbols-outlined {
  color: #000;
}
.dropdown-item .material-symbols-outlined {
  font-size: 16px;
  color: #666;
}

.dropdown-separator {
  height: 1px;
  background: #333;
  margin: 4px 0;
}

body.dark-mode .dropdown-separator {
  background: #444;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  color: inherit;
  font-size: 13px;
}

body.dark-mode .radio-option {
  color: #ccc;
}

.radio-option input[type="radio"] {
  margin: 0;
}

/* Music menu specific styling */
.music-item {
  padding: 8px 16px;
  color: #333;
  cursor: pointer;
  transition: all 0.2s ease;
  border-bottom: 1px solid #eee;
  font-size: 13px;
}

body.dark-mode .music-item {
  color: #ccc;
  border-bottom: 1px solid #222;
}

.music-item:hover {
  background: #e0e0e0;
  color: #000;
}

body.dark-mode .music-item:hover {
  background: #2a2a2a;
}
.music-item.playing {
  background: #0a4a6b;
  color: #4a9eff;
  font-weight: 500;
}

.music-item.playing::before {
  content: "♪ ";
  opacity: 0.8;
}

#musicDemoList:empty::after,
#musicSequenceList:empty::after {
  content: "None available";
  display: block;
  padding: 8px 16px;
  color: #666;
  font-style: italic;
  font-size: 12px;
}

/* Enhanced Content Layout */
#layout{
  display:flex;
  flex-direction:column;
  padding:12px;
  height: calc(100vh - 75px); /* Full height minus menu and status bar */
  box-sizing: border-box;
}

#right{
  display:flex;
  flex-direction:column;
  gap:8px;
  background: var(--bg-color);
  border-radius: 8px;
  border: 1px solid var(--border-color);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
  flex: 1; /* Allow this to grow */
  overflow: hidden; /* Contain children */
}

body.dark-mode #right {
  background: #111;
  border: 1px solid #222;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
}

#panes {
    height: 100%;
    overflow-y: auto; /* Allow panes container to scroll */
}

#panes > section {
    padding: 16px;
    box-sizing: border-box;
}

/* General input and textarea styling */
textarea,
input[type="text"] {
  background-color: var(--bg-light);
  color: var(--text-color);
  border: 1px solid var(--border-color);
  padding: 8px;
  border-radius: 4px;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.1);
  font-family: var(--font-mono);
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

#asm{width:100%;height:55vh;font-family:ui-monospace,SFMono-Regular,Menlo,Consolas,monospace;font-size:13px}
#bytes{width:100%}
.row{display:flex;gap:8px;align-items:center}
#status{font-size:12px;opacity:.8}
#muteBtn.muted{opacity:.6}

/* Clean Top Bar */
#topbar {
  background: linear-gradient(to bottom, #f6f6f6, #e0e0e0);
  padding: 3px 10px;
  border-bottom: 1px solid #a0a0a0;
}

#topbar #status {
  margin: 0;
  font-size: 11px;
  color: #555;
}

body.dark-mode #topbar {
  background: #1a1a1a;
  border-bottom: 1px solid #333;
}

body.dark-mode #topbar #status {
  color: #9ef;
}

/* Dark Mode Toggle Switch */
.theme-switch-wrapper {
  display: flex;
  align-items: center;
  margin-left: auto;
  padding-right: 16px;
  gap: 8px;
  color: #555;
}

body.dark-mode .theme-switch-wrapper {
  color: #999;
}

.theme-switch {
  position: relative;
  display: inline-block;
  width: 34px;
  height: 20px;
}

.theme-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: .4s;
  border-radius: 20px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 14px;
  width: 14px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: .4s;
  border-radius: 50%;
}

/* Floating Winamp-style Sound Player */
.floating-player {
  position: fixed;
  top: 60px;
  right: 20px; /* Default position */
  width: 420px;
  background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
  border: 2px solid #444;
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
  z-index: 2000;
  font-family: system-ui, sans-serif;
  user-select: none;
  resize: both; /* Re-enabled resizing */
  overflow: hidden;
  min-width: 350px;
  max-width: 600px;
}
input:checked + .slider {
  background-color: var(--primary-color);
}

input:checked + .slider:before {
  transform: translateX(14px);
}




.player-titlebar {
  background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 12px;
  border-bottom: 1px solid #555;
  cursor: move;
  border-radius: 6px 6px 0 0;
}

.player-title {
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
  font-size: 13px;
  font-weight: 600;
}

.player-icon {
  font-size: 16px;
}

.player-controls {
  display: flex;
  gap: 4px;
}

.minimize-btn, .close-btn {
  width: 16px;
  height: 14px;
  border: 1px solid #666;
  background: linear-gradient(180deg, #4a4a4a 0%, #3a3a3a 100%);
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  cursor: pointer;
  border-radius: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.minimize-btn:hover, .close-btn:hover {
  background: linear-gradient(180deg, #5a5a5a 0%, #4a4a4a 100%);
}

.close-btn:hover {
  background: linear-gradient(180deg, #cc4444 0%, #aa3333 100%);
}

.minimize-btn .material-symbols-outlined,
.close-btn .material-symbols-outlined {
  font-size: 12px;
  line-height: 1;
}

.player-content {
  padding: 12px;
  color: #ccc;
}

.transport-section {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid #333;
}

.current-track {
  flex: 1;
  font-size: 12px;
  color: #9ef;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.floating-player.minimized .player-content {
  display: none;
}

.floating-player.minimized {
  height: auto;
  left: auto; /* Allow right positioning */
  width: 279px;
  min-width: 279px;
  max-width: 279px;
  resize: none;
}

/* Minimized state compact controls */
.floating-player.minimized .player-titlebar {
  padding: 2px 4px;
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  grid-template-rows: auto;
  gap: 4px;
  align-items: center;
  height: 24px;
  background: linear-gradient(180deg, #3a3a3a 0%, #2a2a2a 100%);
}

.floating-player.minimized .player-title {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 9px;
  font-weight: 600;
  color: #fff;
  min-width: 0;
}

.floating-player.minimized .player-icon {
  font-size: 9px;
}

.floating-player.minimized .player-controls {
  grid-column: 4;
  grid-row: 1;
  gap: 1px;
}

/* Compact control buttons in minimized mode */
.minimized-controls {
  display: none;
  grid-column: 3;
  grid-row: 1;
  align-items: center;
  gap: 2px;
}

.floating-player.minimized .minimized-controls {
  display: flex;
}

.minimized-controls button {
  background: linear-gradient(180deg, #4a4a4a 0%, #3a3a3a 100%);
  border: 1px solid #555;
  color: #fff;
  padding: 1px 4px;
  font-size: 9px;
  cursor: pointer;
  border-radius: 1px;
  min-width: 16px;
  height: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.1s ease;
}

.minimized-controls button:hover {
  background: linear-gradient(180deg, #5a5a5a 0%, #4a4a4a 100%);
  border-color: #666;
}

.minimized-controls button:active {
  background: linear-gradient(180deg, #2a2a2a 0%, #1a1a1a 100%);
  border-color: #333;
}

.minimized-controls .material-symbols-outlined {
  font-size: 10px;
}

.minimized-controls button.muted {
  background: linear-gradient(180deg, #cc4444 0%, #aa3333 100%);
  border-color: #dd5555;
  color: #fcc;
}

/* Track info display in minimized mode - inline in center */
.minimized-track-info {
  display: none;
  grid-column: 2;
  grid-row: 1;
  padding: 1px 6px;
  background: #1a1a1a;
  border: 1px inset #333;
  border-radius: 1px;
  margin: 0 4px;
  overflow: hidden;
}

.floating-player.minimized .minimized-track-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
  height: 16px;
}

.mini-track-name {
  color: #0f0;
  font-size: 8px;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  letter-spacing: 0.3px;
  min-width: 0;
}

.mini-time {
  color: #0f0;
  font-size: 8px;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  min-width: 30px;
  text-align: right;
  letter-spacing: 0.3px;
}

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

.transport button {
  width: 36px;
  height: 36px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #2a2a2a;
  border: 1px solid #444;
  color: #ccc;
  transition: all 0.2s ease;
}

.transport button:hover {
  background: #333;
  border-color: #555;
  color: #fff;
}

.transport button.on{background:#0a4a6b;border-color:#4a9eff;color:#4a9eff}

/* Musical Mixer Interface */
#mixer{
  display: flex;
  gap: 8px;
  align-items: center;
  background: linear-gradient(135deg, #0f0f0f 0%, #1a1a1a 100%);
  padding: 8px 12px;
  border-radius: 6px;
  border: 1px solid #333;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.3);
  margin-bottom: 8px;
}

.chan {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  min-width: 65px;
  padding: 8px;
  background: #111;
  border-radius: 6px;
  border: 1px solid #252525;
  position: relative;
}

.chan.active {
  background: #1a2030;
  border-color: #334455;
  box-shadow: 0 0 8px rgba(77, 158, 255, 0.2);
}

.chan-header {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.chan-label {
  font-size: 11px;
  font-weight: bold;
  color: #ccc;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.chan-type {
  font-size: 8px;
  color: #777;
  font-style: italic;
}

.chan .mute {
  font-size: 9px;
  padding: 3px 8px;
  border-radius: 4px;
  background: #222;
  border: 1px solid #333;
  color: #ccc;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 32px;
  text-align: center;
  font-weight: 500;
}

.chan .mute:hover {
  background: #333;
  border-color: #444;
}

.chan .mute.active {
  background: #cc3333;
  color: white;
  border-color: #aa2222;
}

.musical-info {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 45px;
  justify-content: center;
}

.note-display {
  font-size: 13px;
  font-weight: bold;
  color: #4a9eff;
  font-family: ui-monospace, monospace;
  text-align: center;
  min-height: 16px;
  line-height: 1;
}

.freq-display {
  font-size: 9px;
  color: #9ef;
  font-family: ui-monospace, monospace;
  opacity: 0.8;
}

.hex-display {
  font-size: 8px;
  color: #666;
  font-family: ui-monospace, monospace;
  background: #0a0a0a;
  padding: 1px 3px;
  border-radius: 2px;
  border: 1px solid #222;
}

.vu {
  width: 16px !important;
  height: 40px !important;
  border-radius: 3px;
  background: #0a0a0a;
  border: 1px solid #222;
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.5);
}

/* Special styling for different channel types */
.chan[data-ch="1"] .chan-label { color: #4a9eff; }
.chan[data-ch="2"] .chan-label { color: #9eff4a; }
.chan[data-ch="3"] .chan-label { color: #ff9e4a; }
.chan[data-ch="0"] .chan-label { color: #ff4a9e; }

#sidbar #status{
  margin:0;
  font-size:11px;
  opacity:0.7;
  color:#999;
  text-align:center;
}

/* Compact Tracker Log */
#trackerLog{
  font-family:ui-monospace,monospace;
  font-size:9px;
  max-height:100px;
  overflow:auto;
  background: linear-gradient(180deg, #050505 0%, #0a0a0a 100%);
  border:1px solid #333;
  padding:6px;
  border-radius: 4px;
}
#trackerLog .row{display:grid;grid-template-columns:40px 36px 1fr;gap:10px;border-bottom:1px solid #111;padding:2px 0}
#trackerLog .t0{color:#8fd} .t1{color:#8f8} .t2{color:#ff8} .t3{color:#f88}

.transport button {
  background: none;
  border: 1px solid #555;
  border-radius: 4px;
  color: #eee;
  width: 40px; height: 40px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer;
}
.transport button:hover { background: #333; }

.notes-controls {
  padding: 8px;
  background: #1a1a1a;
  border-bottom: 1px solid #222;
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
#notesPane .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 6px;
  padding: 8px;
}
#notesPane .tabs {
  padding: 8px 8px 0 8px;
}

/* Advanced UI Components */

/* Sound Table Panel */
.sound-table-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #111;
  border-radius: 6px;
  overflow: hidden;
}

.panel-header {
  background: #1a1a1a;
  padding: 12px;
  border-bottom: 1px solid #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h3 {
  margin: 0;
  color: #9ef;
  font-size: 16px;
}

.actions {
  display: flex;
  gap: 6px;
}

.actions button {
  background: #333;
  border: 1px solid #555;
  color: #eee;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.actions button:hover {
  background: #444;
}

.pattern-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  max-height: 300px;
}

.pattern-item {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.pattern-item:hover {
  background: #222;
  border-color: #555;
}

.pattern-item.selected {
  background: #0a4a6b;
  border-color: #4a9eff;
}

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

.pattern-header .name {
  font-weight: bold;
  color: #fff;
}

.pattern-header .index {
  font-family: monospace;
  font-size: 11px;
  color: #9ef;
  background: #333;
  padding: 2px 4px;
  border-radius: 2px;
}

.pattern-meta {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: #aaa;
}

.pattern-desc {
  font-size: 11px;
  color: #888;
  margin-top: 4px;
  font-style: italic;
}

.pattern-details {
  background: #1a1a1a;
  border-top: 1px solid #333;
  padding: 12px;
}

.detail-header {
  font-weight: bold;
  color: #9ef;
  margin-bottom: 8px;
}

.detail-content label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
}

.detail-content input {
  background: #333;
  border: 1px solid #555;
  color: #fff;
  padding: 4px 6px;
  border-radius: 3px;
  margin-left: 6px;
  width: 200px;
}

.pattern-info {
  display: flex;
  gap: 12px;
  margin: 8px 0;
  font-size: 11px;
  color: #aaa;
}

/* Sequencer Panel */
.sequencer-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sequence-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sequence-controls select {
  background: #333;
  border: 1px solid #555;
  color: #fff;
  padding: 4px 8px;
  border-radius: 3px;
}

.sequence-editor {
  flex: 1;
  background: #1a1a1a;
  margin: 8px;
  border-radius: 4px;
  overflow: hidden;
}

.timeline-header {
  display: grid;
  grid-template-columns: 60px 80px 1fr 100px;
  background: #222;
  padding: 8px;
  border-bottom: 1px solid #333;
  font-size: 12px;
  font-weight: bold;
  color: #9ef;
}

.timeline-content {
  max-height: 300px;
  overflow-y: auto;
}

.timeline-row {
  display: grid;
  grid-template-columns: 60px 80px 1fr 100px;
  padding: 6px 8px;
  border-bottom: 1px solid #333;
  font-size: 11px;
  cursor: pointer;
}

.timeline-row:hover {
  background: #222;
}

.timeline-row.selected {
  background: #0a4a6b;
  color: #fff;
}

.timeline-footer {
  padding: 8px;
  background: #222;
  border-top: 1px solid #333;
  display: flex;
  gap: 8px;
}

.step-editor {
  background: #1a1a1a;
  margin: 8px;
  padding: 12px;
  border-radius: 4px;
}

.step-editor h4 {
  margin: 0 0 12px 0;
  color: #9ef;
}

.step-editor label {
  display: block;
  margin-bottom: 8px;
  color: #ddd;
}

.step-editor input {
  background: #333;
  border: 1px solid #555;
  color: #fff;
  padding: 4px 6px;
  border-radius: 3px;
  margin-left: 8px;
}

.channel-assignments {
  margin: 12px 0;
}

.channel-row {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}

.channel-row label {
  width: 100px;
  margin: 0;
  font-size: 12px;
}

.channel-select {
  background: #333;
  border: 1px solid #555;
  color: #fff;
  padding: 4px 6px;
  border-radius: 3px;
  width: 200px;
}

.step-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.no-sequence {
  padding: 20px;
  text-align: center;
  color: #666;
  font-style: italic;
}

/* Priority System Panel */
.priority-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ram-layout {
  flex: 1;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.ram-slot {
  background: #1a1a1a;
  border: 2px solid #333;
  border-radius: 6px;
  padding: 10px;
  transition: all 0.2s;
}

.ram-slot.music {
  border-left-color: #4a9eff;
}

.ram-slot.sfx {
  border-left-color: #ff4a4a;
}

.ram-slot.high {
  background: #2a1a1a;
}

.ram-slot:hover {
  background: #222;
  border-color: #555;
}

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

.slot-header .channel {
  font-weight: bold;
  color: #9ef;
}

.slot-header .address {
  font-family: monospace;
  color: #ff8;
}

.slot-header .priority {
  padding: 2px 4px;
  border-radius: 2px;
  font-size: 10px;
}

.slot-header .priority.low {
  background: #333;
  color: #9ef;
}

.slot-header .priority.high {
  background: #633;
  color: #fee;
}

.slot-content {
  min-height: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pattern-name {
  font-weight: bold;
  color: #fff;
  margin-bottom: 2px;
}

.pattern-size {
  font-size: 10px;
  color: #aaa;
}

.empty {
  color: #666;
  font-style: italic;
  text-align: center;
}

.priority-info {
  background: #1a1a1a;
  padding: 12px;
  border-top: 1px solid #333;
}

.priority-info h4 {
  margin: 0 0 8px 0;
  color: #9ef;
}

.priority-info ul {
  margin: 0;
  padding-left: 20px;
  font-size: 12px;
  color: #ccc;
}

.priority-info li {
  margin-bottom: 4px;
}

/* Export Panel */
.export-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 12px;
}

.export-options {
  margin: 12px 0;
}

.export-options label {
  display: block;
  margin-bottom: 6px;
  color: #ddd;
  font-size: 12px;
}

.export-options input[type="checkbox"] {
  margin-right: 8px;
}

.export-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

#exportOutput {
  flex: 1;
  background: #111;
  border: 1px solid #333;
  color: #fff;
  font-family: monospace;
  font-size: 11px;
  padding: 8px;
  border-radius: 4px;
  resize: vertical;
  min-height: 200px;
}
.duration-control {
    display: contents; /* Allows flex layout from parent */
}
.duration-btn {
    padding: 4px 8px;
}
.duration-btn.selected { background: #88f; color: #111; }

.notes-controls {
  padding: 8px;
  background: #1a1a1a;
  border-bottom: 1px solid #222;
  display: flex;
  gap: 8px;
  align-items: center;
}
#notesPane .grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
  gap: 6px;
  padding: 8px;
}
#notesPane .tabs {
  padding: 8px 8px 0 8px;
}

/* Advanced UI Components */

/* Sound Table Panel */
.sound-table-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  background: #111;
  border-radius: 6px;
  overflow: hidden;
}

.panel-header {
  background: #1a1a1a;
  padding: 12px;
  border-bottom: 1px solid #333;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.panel-header h3 {
  margin: 0;
  color: #9ef;
  font-size: 16px;
}

.actions {
  display: flex;
  gap: 6px;
}

.actions button {
  background: #333;
  border: 1px solid #555;
  color: #eee;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

.actions button:hover {
  background: #444;
}

.pattern-list {
  flex: 1;
  overflow-y: auto;
  padding: 8px;
  max-height: 300px;
}

.pattern-item {
  background: #1a1a1a;
  border: 1px solid #333;
  border-radius: 4px;
  padding: 8px;
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.pattern-item:hover {
  background: #222;
  border-color: #555;
}

.pattern-item.selected {
  background: #0a4a6b;
  border-color: #4a9eff;
}

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

.pattern-header .name {
  font-weight: bold;
  color: #fff;
}

.pattern-header .index {
  font-family: monospace;
  font-size: 11px;
  color: #9ef;
  background: #333;
  padding: 2px 4px;
  border-radius: 2px;
}

.pattern-meta {
  display: flex;
  gap: 8px;
  font-size: 11px;
  color: #aaa;
}

.pattern-desc {
  font-size: 11px;
  color: #888;
  margin-top: 4px;
  font-style: italic;
}

.pattern-details {
  background: #1a1a1a;
  border-top: 1px solid #333;
  padding: 12px;
}

.detail-header {
  font-weight: bold;
  color: #9ef;
  margin-bottom: 8px;
}

.detail-content label {
  display: block;
  margin-bottom: 6px;
  font-size: 12px;
}

.detail-content input {
  background: #333;
  border: 1px solid #555;
  color: #fff;
  padding: 4px 6px;
  border-radius: 3px;
  margin-left: 6px;
  width: 200px;
}

.pattern-info {
  display: flex;
  gap: 12px;
  margin: 8px 0;
  font-size: 11px;
  color: #aaa;
}

/* Sequencer Panel */
.sequencer-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.sequence-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}

.sequence-controls select {
  background: #333;
  border: 1px solid #555;
  color: #fff;
  padding: 4px 8px;
  border-radius: 3px;
}

.sequence-editor {
  flex: 1;
  background: #1a1a1a;
  margin: 8px;
  border-radius: 4px;
  overflow: hidden;
}

.timeline-header {
  display: grid;
  grid-template-columns: 60px 80px 1fr 100px;
  background: #222;
  padding: 8px;
  border-bottom: 1px solid #333;
  font-size: 12px;
  font-weight: bold;
  color: #9ef;
}

.timeline-content {
  max-height: 300px;
  overflow-y: auto;
}

.timeline-row {
  display: grid;
  grid-template-columns: 60px 80px 1fr 100px;
  padding: 6px 8px;
  border-bottom: 1px solid #333;
  font-size: 11px;
  cursor: pointer;
}

.timeline-row:hover {
  background: #222;
}

.timeline-row.selected {
  background: #0a4a6b;
  color: #fff;
}

.timeline-footer {
  padding: 8px;
  background: #222;
  border-top: 1px solid #333;
  display: flex;
  gap: 8px;
}

.step-editor {
  background: #1a1a1a;
  margin: 8px;
  padding: 12px;
  border-radius: 4px;
}

.step-editor h4 {
  margin: 0 0 12px 0;
  color: #9ef;
}

.step-editor label {
  display: block;
  margin-bottom: 8px;
  color: #ddd;
}

.step-editor input {
  background: #333;
  border: 1px solid #555;
  color: #fff;
  padding: 4px 6px;
  border-radius: 3px;
  margin-left: 8px;
}

.channel-assignments {
  margin: 12px 0;
}

.channel-row {
  display: flex;
  align-items: center;
  margin-bottom: 6px;
}

.channel-row label {
  width: 100px;
  margin: 0;
  font-size: 12px;
}

.channel-select {
  background: #333;
  border: 1px solid #555;
  color: #fff;
  padding: 4px 6px;
  border-radius: 3px;
  width: 200px;
}

.step-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.no-sequence {
  padding: 20px;
  text-align: center;
  color: #666;
  font-style: italic;
}

/* Priority System Panel */
.priority-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.ram-layout {
  flex: 1;
  padding: 12px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 8px;
  max-height: 400px;
  overflow-y: auto;
}

.ram-slot {
  background: #1a1a1a;
  border: 2px solid #333;
  border-radius: 6px;
  padding: 10px;
  transition: all 0.2s;
}

.ram-slot.music {
  border-left-color: #4a9eff;
}

.ram-slot.sfx {
  border-left-color: #ff4a4a;
}

.ram-slot.high {
  background: #2a1a1a;
}

.ram-slot:hover {
  background: #222;
  border-color: #555;
}

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

.slot-header .channel {
  font-weight: bold;
  color: #9ef;
}

.slot-header .address {
  font-family: monospace;
  color: #ff8;
}

.slot-header .priority {
  padding: 2px 4px;
  border-radius: 2px;
  font-size: 10px;
}

.slot-header .priority.low {
  background: #333;
  color: #9ef;
}

.slot-header .priority.high {
  background: #633;
  color: #fee;
}

.slot-content {
  min-height: 40px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.pattern-name {
  font-weight: bold;
  color: #fff;
  margin-bottom: 2px;
}

.pattern-size {
  font-size: 10px;
  color: #aaa;
}

.empty {
  color: #666;
  font-style: italic;
  text-align: center;
}

.priority-info {
  background: #1a1a1a;
  padding: 12px;
  border-top: 1px solid #333;
}

.priority-info h4 {
  margin: 0 0 8px 0;
  color: #9ef;
}

.priority-info ul {
  margin: 0;
  padding-left: 20px;
  font-size: 12px;
  color: #ccc;
}

.priority-info li {
  margin-bottom: 4px;
}

/* Export Panel */
.export-panel {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 12px;
}

.export-options {
  margin: 12px 0;
}

.export-options label {
  display: block;
  margin-bottom: 6px;
  color: #ddd;
  font-size: 12px;
}

.export-options input[type="checkbox"] {
  margin-right: 8px;
}

.export-actions {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

#exportOutput {
  flex: 1;
  background: #111;
  border: 1px solid #333;
  color: #fff;
  font-family: monospace;
  font-size: 11px;
  padding: 8px;
  border-radius: 4px;
  resize: vertical;
  min-height: 200px;
}



/* ========================================
   MUSIC LIBRARY FULL VIEW
   ======================================== */

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

.library-header h2 {
  margin: 0;
  font-size: 24px;
  color: #4ec9b0;
  font-weight: 600;
}

.library-stats {
  font-size: 14px;
  color: #888;
  margin: 0 20px;
}

.load-library-btn {
  background: #4ec9b0;
  color: #000;
  border: none;
  padding: 10px 20px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.load-library-btn:hover {
  background: #5dd9c0;
  transform: translateY(-1px);
}

.load-library-btn:disabled {
  background: #666;
  cursor: not-allowed;
  transform: none;
}

.library-search {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
}

#librarySearch {
  flex: 1;
  background: #2d2d2d;
  border: 1px solid #444;
  color: #fff;
  padding: 10px 15px;
  border-radius: 6px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}

#librarySearch:focus {
  border-color: #4ec9b0;
}

#libraryFilter {
  background: #2d2d2d;
  border: 1px solid #444;
  color: #fff;
  padding: 10px 15px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
  outline: none;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 16px;
  overflow-y: auto; /* Make this section scrollable */
  flex: 1; /* Allow it to fill remaining space */
}

.library-placeholder {
  grid-column: 1 / -1;
  text-align: center;
  padding: 60px 20px;
  color: #666;
}

.placeholder-icon {
  font-size: 64px;
  margin-bottom: 16px;
  opacity: 0.5;
}

.placeholder-text {
  font-size: 16px;
}

.game-card {
  background: linear-gradient(135deg, #2d2d2d 0%, #252525 100%);
  border: 1px solid #3a3a3a;
  border-radius: 8px;
  padding: 16px;
  transition: all 0.2s;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.game-card:hover {
  border-color: #4ec9b0;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(78, 201, 176, 0.2);
}

.game-card.expanded {
  grid-column: 1 / -1;
  cursor: default;
  transform: none;
}

.game-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.game-title {
  font-size: 18px;
  font-weight: 600;
  color: #fff;
  flex: 1;
}

.game-badges {
  display: flex;
  gap: 8px;
}

.game-badge {
  padding: 4px 10px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
}

.badge-music {
  background: #4ec9b055;
  color: #4ec9b0;
}

.badge-sfx {
  background: #ce917855;
  color: #ce9178;
}

.game-info {
  font-size: 13px;
  color: #888;
  margin-bottom: 12px;
}

.game-tracks {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 1px solid #333;
  display: none;
}

.game-card.expanded .game-tracks {
  display: block;
}

.track-section {
  margin-bottom: 16px;
}

.track-section-title {
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid #2d2d2d;
}

.track-section-title.music {
  color: #4ec9b0;
}

.track-section-title.sfx {
  color: #ce9178;
}

.track-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.track-item {
  background: #1e1e1e;
  border: 1px solid #2d2d2d;
  border-radius: 4px;
  padding: 10px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: all 0.15s;
  cursor: pointer;
}

.track-item:hover {
  background: #2a2a2a;
  border-color: #4ec9b0;
}

.track-item.playing {
  background: #4ec9b022;
  border-color: #4ec9b0;
}

.track-info-left {
  flex: 1;
}

.track-name {
  font-size: 14px;
  font-weight: 500;
  color: #fff;
  margin-bottom: 2px;
}

.track-details {
  font-size: 11px;
  color: #666;
}

.track-play-btn {
  background: #4ec9b0;
  border: none;
  color: #000;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  font-size: 16px;
}

.track-play-btn:hover {
  background: #5dd9c0;
  transform: scale(1.1);
}

.track-item.sfx .track-play-btn {
  background: #ce9178;
}

.track-item.sfx .track-play-btn:hover {
  background: #dea188;
}

.game-collapse-btn {
  background: #2d2d2d;
  border: 1px solid #444;
  color: #888;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  margin-top: 12px;
}

.game-collapse-btn:hover {
  background: #333;
  color: #fff;
}

.coleco-logo-img {
  max-width: 400px;
  width: 80%;
  max-width: 500px;
  margin-bottom: 30px;
  filter: drop-shadow(2px 4px 6px rgba(0,0,0,0.4));
}

/* ========================================
   WELCOME PANE
   ======================================== */

.welcome-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px;
  color: var(--text-color);
  text-align: center;
}

.coleco-logo-img {
  width: 90%;
  margin-bottom: 30px;
}

.quick-info-box {
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 15px 25px;
  max-width: 600px;
  box-shadow: 0 5px 20px rgba(0,0,0,0.15);
  font-size: 14px;
  text-align: left;
}

body.dark-mode .quick-info-box {
  background: #2d2d2d;
  border-color: #444;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
}

.quick-info-box h4 {
  margin: 0 0 12px 0;
  color: var(--primary-color);
  font-size: 16px;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 8px;
}

.quick-info-box ul {
  margin: 0;
  padding-left: 20px;
}

.quick-info-box li {
  margin-bottom: 8px;
}
