
@import url('https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=VT323&family=DM+Sans:wght@300;400;500;600&display=swap');

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

:root {
  --bg: #011;
  --surface: linear-gradient(180deg, #223333 0%, #112222 100%);
  --surface2: #050505;
  --surface3: #0a1414;
  --border: #224444;
  --border-light: #599;
  --border-dark: #112222;
  --accent: #00e201;
  --accent-green: #00e201;
  --accent-cyan: #00ffff;
  --accent-orange: #ff6600;
  --text: #cccccc;
  --text-bright: #ffffff;
  --muted: #a61;
  --display-bg: #000000;
  --display-text: #00e201;
  --titlebar-bg: linear-gradient(180deg, #334444 0%, #223333 100%);
  --btn-face: #445555;
  --btn-face-hover: #556666;
  --btn-pressed: #112222;
}

html, body { height: 100%; margin: 0; }
body {
  font-family: 'DM Sans', sans-serif;
  background: var(--bg);
  color: var(--text);
  overflow: hidden;
  background-image:
    radial-gradient(ellipse at 50% 0%, rgba(0,226,1,0.03) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 100%, rgba(0,255,255,0.02) 0%, transparent 50%);
  font-size: 13px;
}

/* ---- app shell ---- */
.app { display: flex; flex-direction: column; height: 100vh; }

/* ---- top bar (titlebar + toolbar + LEDs) ---- */
.titlebar {
  background: var(--titlebar-bg);
  border-bottom: 1px solid var(--border-dark);
  padding: 4px 10px;
  display: flex; align-items: center; gap: 12px;
}
.titlebar h1 {
  /*font-family: 'VT323', monospace; font-size: 22px; font-weight: 400;
  margin: 0; color: var(--text-bright); text-transform: uppercase; letter-spacing: 1px;
  text-shadow: 0 0 5px rgba(0,226,1,0.4);*/
  text-indent:-99999px; font-size: 0px;
  background-image: url(../song-parts-logo.png);
  background-repeat: no-repeat; background-size: contain;
  width: 150px; height: 50px;
}
.titlebar h2{font-size: 14px; line-height: 16px; margin:6px 0 0 0;}
.titlebar .by {margin-top: -20px;}
.titlebar .by, .titlebar .by a { font-family: VT323, monospace; font-size: 12px;
 color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }

.toolbar {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  background: linear-gradient(180deg, #1a2727 0%, #0e1818 100%);
  border-bottom: 1px solid var(--border);
  padding: 5px 10px;
}
.toolbar .sep { width: 1px; height: 22px; background: var(--border); margin: 0 4px; }
.toolbar .field { display: flex; align-items: center; gap: 4px; }
.toolbar label { font-family: 'Space Mono'; font-size: 10px; color: var(--muted); text-transform: uppercase; }
.toolbar input[type=text] {
  background: var(--display-bg); color: var(--display-text); border: 1px inset var(--border-dark);
  font-family: 'VT323', monospace; font-size: 15px; padding: 2px 6px; width: 130px;
}

/* file input as button */
.file-btn { position: relative; overflow: hidden; }
.file-btn input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; }

/* ---- LED displays ---- */
.led-bar { display: flex; gap: 8px; margin-left: auto; }
.led {
  background: var(--display-bg); border: 2px inset var(--border-dark); border-radius: 2px;
  padding: 2px 8px; min-width: 56px; text-align: center;
}
.led .led-label { font-family: 'Space Mono'; font-size: 8px; color: var(--muted); letter-spacing: 1px; display: block; }
.led .led-val {
  font-family: 'VT323', monospace; font-size: 18px; line-height: 1; color: var(--display-text);
  text-shadow: 0 0 6px rgba(0,226,1,0.5);
}
.led .led-val.on { color: var(--accent-orange); text-shadow: 0 0 6px rgba(255,102,0,0.6); animation: blink 1s steps(2) infinite; }
@keyframes blink { 50% { opacity: 0.45; } }

/**/

.icon-play, .icon-pause, .icon-stop, .icon-random, .icon-loop, .icon-duplicate, .icon-plus, .icon-minus, .icon-delete, .icon-undo, .icon-redo {width: 16px; height:11px; display:inline-block; background-repeat: no-repeat no-repeat;
background-position: center center;
background-size: contain;}

.icon-random {    width: 16px;
    height: 21px;
    margin-left: -2px;
    vertical-align: top;}

.icon-play {background-image: url("data:image/svg+xml,%3Csvg width='800px' height='800px' viewBox='-0.5 0 8 8' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg transform='translate(-427.000000, -3765.000000)' fill='%23ccc'%3E%3Cg id='icons' transform='translate(56.000000, 160.000000)'%3E%3Cpolygon id='play-%5B%231001%5D' points='371 3605 371 3613 378 3609'%3E%3C/polygon%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.rack-gen-btn .icon-play {background-image: url("data:image/svg+xml,%3Csvg width='800px' height='800px' viewBox='-0.5 0 8 8' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg transform='translate(-427.000000, -3765.000000)' fill='%2300e201'%3E%3Cg id='icons' transform='translate(56.000000, 160.000000)'%3E%3Cpolygon id='play-%5B%231001%5D' points='371 3605 371 3613 378 3609'%3E%3C/polygon%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
height:9px; transform: rotate(180deg);}

.icon-pause {background-image: url("data:image/svg+xml,%3Csvg width='800px' height='800px' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M7 1H2V15H7V1Z' fill='%23ccc'/%3E%3Cpath d='M14 1H9V15H14V1Z' fill='%23ccc'/%3E%3C/svg%3E");
}

.icon-stop {background-image: url("data:image/svg+xml,%3Csvg width='800px' height='800px' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Crect x='1' y='1' width='14' height='14' fill='%23ccc'/%3E%3C/svg%3E");
}

.icon-random {background-image: url("data:image/svg+xml,%3Csvg width='800px' height='800px' viewBox='0 0 512 512' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg id='icon' fill='%23ccc' transform='translate(46.976875, 46.976875)'%3E%3Cpath d='M379.689791,38.3564581 L379.689791,379.689791 L38.3564581,379.689791 L38.3564581,38.3564581 L379.689791,38.3564581 Z M283.689791,251.689791 C266.016679,251.689791 251.689791,266.016679 251.689791,283.689791 C251.689791,301.362903 266.016679,315.689791 283.689791,315.689791 C301.362903,315.689791 315.689791,301.362903 315.689791,283.689791 C315.689791,266.016679 301.362903,251.689791 283.689791,251.689791 Z M209.023125,177.023125 C191.350013,177.023125 177.023125,191.350013 177.023125,209.023125 C177.023125,226.696237 191.350013,241.023125 209.023125,241.023125 C226.696237,241.023125 241.023125,226.696237 241.023125,209.023125 C241.023125,191.350013 226.696237,177.023125 209.023125,177.023125 Z M134.356458,102.356458 C116.683346,102.356458 102.356458,116.683346 102.356458,134.356458 C102.356458,152.02957 116.683346,166.356458 134.356458,166.356458 C152.02957,166.356458 166.356458,152.02957 166.356458,134.356458 C166.356458,116.683346 152.02957,102.356458 134.356458,102.356458 Z' id='Combined-Shape' transform='translate(209.023125, 209.023125) rotate(-345.000000) translate(-209.023125, -209.023125) '%3E%3C/path%3E%3C/g%3E%3C/svg%3E");
}

.icon-loop {background-image: url("data:image/svg+xml,%3Csvg fill='%23ccc' width='800px' height='800px' viewBox='0 0 8 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 0v2h1v-1h4v2h-1l1.5 2.5 1.5-2.5h-1v-3h-6zm.5 2.5l-1.5 2.5h1v3h6v-2h-1v1h-4v-2h1l-1.5-2.5z' /%3E%3C/svg%3E");}

.icon-duplicate {background-image: url("data:image/svg+xml,%3Csvg width='800px' height='800px' viewBox='0 0 24 24' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M5 3h12v4h4v14H7v-4H3V3h2zm10 4V5H5v10h2V7h8zM9 17v2h10V9H9v8z' fill='%230ff'/%3E%3C/svg%3E");
}

.icon-plus {background-image: url("data:image/svg+xml,%3Csvg width='800px' height='800px' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M10 1H6V6L1 6V10H6V15H10V10H15V6L10 6V1Z' fill='%23ccc'/%3E%3C/svg%3E");}
.icon-minus {background-image: url("data:image/svg+xml,%3Csvg width='800px' height='800px' viewBox='0 0 16 16' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 10L1 6L15 6V10L1 10Z' fill='%23ccc'/%3E%3C/svg%3E");}

.icon-delete {background-image: url("data:image/svg+xml,%3Csvg width='800px' height='800px' viewBox='0 -0.5 21 21' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg stroke='none' stroke-width='1' fill='none' fill-rule='evenodd'%3E%3Cg transform='translate(-179.000000, -360.000000)' fill='%23f00'%3E%3Cg transform='translate(56.000000, 160.000000)'%3E%3Cpath d='M130.35,216 L132.45,216 L132.45,208 L130.35,208 L130.35,216 Z M134.55,216 L136.65,216 L136.65,208 L134.55,208 L134.55,216 Z M128.25,218 L138.75,218 L138.75,206 L128.25,206 L128.25,218 Z M130.35,204 L136.65,204 L136.65,202 L130.35,202 L130.35,204 Z M138.75,204 L138.75,200 L128.25,200 L128.25,204 L123,204 L123,206 L126.15,206 L126.15,220 L140.85,220 L140.85,206 L144,206 L144,204 L138.75,204 Z'%3E%3C/path%3E%3C/g%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  height: 9px;
}

.icon-undo {background-image: url("data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='800px' height='800px' viewBox='0 0 32 32' xml:space='preserve'%3E%3Cpath fill='%23ccc' d='M28,8v20H4v-4h20V12h-6.071l3.657,3.66l-2.828,2.83l-8.485-8.484l8.485-8.485l2.828,2.826L17.929,8H28z' /%3E%3C/svg%3E");}
.icon-redo {background-image: url("data:image/svg+xml,%3Csvg version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' width='800px' height='800px' viewBox='0 0 32 32' xml:space='preserve'%3E%3Cpath fill='%23ccc' d='M28,24v4H4V8h10.071l-3.657-3.654l2.828-2.826l8.485,8.485l-8.485,8.484l-2.828-2.83L14.071,12H8v12H28z '/%3E%3C/svg%3E");}


/* ---- buttons ---- */
button {
  border: 3px outset var(--border-light); padding: 4px 10px; border-radius: 2px; cursor: pointer;
  font-family: 'VT323', monospace; font-size: 15px; background: var(--btn-face); color: var(--text);
  box-shadow: 2px 2px 3px rgba(0,0,0,0.3); transition: all .08s; line-height: 1;
}
button:hover:not(:disabled) { background: var(--btn-face-hover); border-color: var(--accent); color: var(--accent); }
button:active:not(:disabled) { transform: translateY(1px); border-style: inset; box-shadow: inset 1px 1px 3px rgba(0,0,0,0.4); }
button.active { border-style: inset; background: var(--btn-pressed); color: var(--accent); border-color: var(--accent); }
button:disabled { opacity: 0.4; cursor: default; }
button.danger:hover { border-color: #ff4444; color: #ff4444; }
button.mini { font-size: 12px; padding: 1px 5px; border-width: 2px; box-shadow: none; }

.chord-actions button.mini { width: 25px;
    height: 20px;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0;}
button.mini[data-act="up"] .icon-play {transform: rotate(-90deg); width: 8px; height: 8px;}
button.mini[data-act="down"] .icon-play {transform: rotate(90deg); width: 8px; height: 8px;}
button.mini[data-act="dur-"] span, button.mini[data-act="dur+"] span {width: 8px; height: 8px;}

.chip { font-size: 13px; padding: 2px 7px; margin: 2px; border-width: 2px; box-shadow: none; }

/* transport buttons */
.transport button { min-width: 40px; font-size: 16px; }
#btnPlay.active { color: var(--accent-green); }

/* ---- selects & ranges ---- */
select {
  background: var(--btn-face); color: var(--text); border: 2px outset var(--border);
  font-family: 'VT323', monospace; font-size: 14px; padding: 2px 4px; border-radius: 2px;
}
select:hover { border-color: var(--accent); }
input[type=range] { -webkit-appearance: none; appearance: none; height: 6px; background: linear-gradient(180deg,#111,#222); border: 1px inset var(--border-dark);  width: 100%; }
input[type=range]::-webkit-slider-thumb { -webkit-appearance: none; width: 12px; height: 16px; background: var(--btn-face); border: 2px outset var(--border-light); border-radius: 2px; cursor: pointer; }
input[type=range]::-webkit-slider-thumb:hover { background: var(--btn-face-hover); border-color: var(--accent); }
input[type=range]::-moz-range-thumb { width: 12px; height: 16px; background: var(--btn-face); border: 2px outset var(--border-light); border-radius: 2px; cursor: pointer; }

.mini-range { width: 70px; }
.toolbar .val { font-family: 'VT323'; color: var(--display-text); font-size: 14px; min-width: 34px; }

/* ---- columns ---- */
.workspace { flex: 1; display: flex; overflow: hidden; min-height: 0; }
.col { display: flex; flex-direction: column; min-height: 0; overflow: hidden; }
#leftCol { width: 260px; border-right: 1px solid var(--border); }
#rightCol { width: 300px; border-left: 1px solid var(--border); }
#leftCol, #rightCol{background:var(--surface);}
#centerCol { flex: 1; min-width: 0; }
.col-resizer { width: 5px; cursor: col-resize; background: var(--border-dark); flex: 0 0 auto; }
.col-resizer:hover { background: var(--accent); }

.col-head {
  font-family: 'VT323', monospace; font-size: 15px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--text-bright); background: var(--titlebar-bg); padding: 4px 8px;
  border-bottom: 1px solid var(--border-dark); text-shadow: 0 0 4px rgba(0,226,1,0.3);
}
.col-scroll { overflow-y: auto; padding: 8px; flex: 1; min-height: 0; }

/* ---- chord rack ---- */
.chord-controls { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.chord-controls .row { display: flex; gap: 4px; align-items: center; }
.chord-controls input[type=text] {
  flex: 1; background: var(--display-bg); color: var(--display-text); border: 1px inset var(--border-dark);
  font-family: 'VT323'; font-size: 16px; padding: 2px 6px;
}
.chord-controls .lbl { font-family: 'Space Mono'; font-size: 10px; color: var(--muted); width: 34px; }
#chordPalette { display: flex; flex-wrap: wrap; margin: 4px 0; }

.chord-card {
  background: var(--surface); border: 1px solid var(--muted); border-radius: 2px;
  padding: 6px; margin-bottom: 6px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.chord-head { display: flex; justify-content: space-between; align-items: baseline; }
.chord-sym { font-family: 'VT323'; font-size: 22px; color: var(--accent-cyan); cursor: pointer; text-shadow: 0 0 5px rgba(0,255,255,0.3); }
.chord-sym:hover { color: var(--text-bright); }
.led-mini { font-family: 'VT323'; font-size: 13px; color: var(--display-text); background: #000; padding: 0 4px; border: 1px inset var(--border-dark); }
.chord-notes { font-family: 'Space Mono'; font-size: 11px; color: var(--muted); margin: 3px 0; letter-spacing: 1px; }
.chord-actions { display: flex; gap: 3px; }

/* ---- center: transport + tracks + roll ---- */
.transport {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  background: linear-gradient(180deg,#1a2727,#0e1818); border-bottom: 1px solid var(--border); padding: 5px 8px;
}
.transport .field { display: flex; align-items: center; gap: 3px; }
.transport label { font-family: 'Space Mono'; font-size: 9px; color: var(--muted); text-transform: uppercase; }
.transport .field .val {
  background: var(--display-bg);
  color: var(--display-text);
  border: 1px inset var(--border-dark);
  font-family: 'VT323', monospace;
  font-size: 15px;
  padding: 1px 6px;
  min-width: 40px;
  display: inline-block;
  text-align: center;
  text-shadow: 0 0 4px rgba(0,226,1,0.4);
}
.tool-btn.active { border-color: var(--accent-cyan); color: var(--accent-cyan); }

#trackStrip {
  display: flex; gap: 6px; flex-wrap: wrap; padding: 6px 8px; background: #081010;
  border-bottom: 1px solid var(--border); max-height: 110px; overflow-y: auto;
}
.track-chip {
  display: flex; align-items: center; gap: 4px; background: var(--surface);
  border: 1px solid var(--border); border-radius: 2px; padding: 3px 5px; cursor: pointer;
}
.track-chip.active { border-color: var(--accent-cyan); box-shadow: 0 0 6px rgba(0,255,255,0.25); }
.track-dot { width: 9px; height: 9px; border-radius: 50%; box-shadow: 0 0 4px currentColor; }
.track-name { font-family: 'VT323'; font-size: 15px; color: var(--text-bright); max-width: 90px; overflow: hidden; white-space: nowrap; }
.track-mode { font-size: 11px; padding: 0 2px; }
.track-btns { display: flex; gap: 1px; }
.tg { font-family: 'Space Mono'; font-size: 9px; padding: 1px 4px; border-width: 1px; box-shadow: none; min-width: 0; }
.tg.on.m { background: var(--accent-orange); color: #000; border-color: var(--accent-orange); }
.tg.on.s { background: #ffcc00; color: #000; border-color: #ffcc00; }
.tg.on.l { background: #ff4444; color: #000; border-color: #ff4444; }
.tg.on.v { background: var(--accent-green); color: #000; border-color: var(--accent-green); }
.track-add { display: flex; gap: 2px; align-items: center; flex-wrap: wrap; }

#prWrap { position: relative; flex: 1; min-height: 0; background: #000; box-shadow: inset 0 0 20px rgba(0,0,0,0.6); overflow-x: auto; overflow-y: hidden; }
/* canvases are sized to their full intrinsic content width in JS and overflow the wrapper (which scrolls horizontally) */
#prCanvas, #prPlayhead { position: absolute; top: 0; left: 0; }
#prPlayhead { z-index: 2; }
#prVel { display: none; }

/* ---- generator rack ---- */
.rack-module {
  background: var(--surface); border: 1px solid var(--muted); 
  margin-bottom: 10px; box-shadow: 2px 2px 4px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.04);
}
.rack-title {
  font-family: 'VT323'; font-size: 15px; letter-spacing: 1px; color: var(--accent-cyan);
  background: linear-gradient(180deg,#2a3a3a,#1a2a2a); padding: 3px 8px;
  border-bottom: 1px solid var(--border-dark); text-shadow: 0 0 4px rgba(0,226,1,0.3);
}
.rack-body { padding: 7px 8px; }
.ctl { margin-bottom: 6px; }
.ctl label { display: flex; justify-content: space-between; font-family: 'Space Mono'; font-size: 10px; color: var(--muted); text-transform: uppercase; margin-bottom: 2px; }
.ctl .val { font-family: 'VT323'; font-size: 14px; color: var(--display-text); }
.ctl select { width: 100%; }
.rack-gen-btn { width: 100%; margin-top: 4px; color: var(--accent-green); border-color: var(--border-light);  /*background: var(--muted);*/ background: #060;}
.rack-gen-btn:hover { color: #000; background: var(--accent-green); border-color: var(--accent-green); }

.op-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.op-btn { font-size: 13px; padding: 4px 4px; }
.ver-row { display: flex; gap: 4px; margin-bottom: 6px; }
.ver-btn { flex: 1; font-size: 18px; }
.ver-btn.active { border-color: var(--accent-cyan); color: var(--accent-cyan); background: var(--btn-pressed); }
.ver-btn.empty { opacity: 0.5; }
.snap-list { margin-top: 6px; }
.snap-row { display: flex; align-items: center; justify-content: space-between; gap: 4px; font-family: 'Space Mono'; font-size: 10px; color: var(--text); padding: 2px 0; border-bottom: 1px solid var(--border-dark); }
.snap-row em { color: var(--muted); font-style: normal; }
.snap-row .icon-loop {width: 8px; height: 8px;}

.empty-hint { font-family: 'Space Mono'; font-size: 11px; color: var(--muted); padding: 10px; text-align: center; }

/* scrollbars */
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: var(--surface2); border: 1px inset var(--border-dark); }
::-webkit-scrollbar-thumb { background: var(--btn-face); border: 1px outset var(--border); }
::-webkit-scrollbar-thumb:hover { background: var(--btn-face-hover); border-color: var(--accent); }

.scope-field select { width: 100%; }
#autosaveStatus { font-family: 'Space Mono'; font-size: 9px; color: var(--accent-green); }

/* ---- custom dropdown (replaces native <select>) ---- */
select.cs-native { display: none !important; }

.custom-select { position: relative; display: inline-block; vertical-align: middle; max-width: 100%; }
.ctl > .custom-select, .scope-field > .custom-select { display: block; width: 100%; }
/* inline chord-rack dropdowns size to their content (no truncation); the row
   wraps if a long mode name (e.g. MELODICMINOR) needs more room */
.chord-controls .row { flex-wrap: wrap; }
.chord-controls .row .custom-select { max-width: 100%; }

.custom-select-trigger {
  position: relative;
  width: 100%;
  text-align: left;
  padding: 3px 22px 3px 8px;
  background: var(--btn-face);
  border: 3px outset var(--border-light);
  border-radius: 2px;
  color: var(--text);
  font-family: 'VT323', monospace;
  font-size: 14px;
  letter-spacing: 1px;
  text-transform: uppercase;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
  box-shadow: 2px 2px 3px rgba(0,0,0,0.3);
  cursor: pointer;
}
.custom-select-trigger::after {
      content: '';
    position: absolute;
    right: 6px;
    top: 50%;
    pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg width='800px' height='800px' viewBox='-0.5 0 8 8' version='1.1' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink'%3E%3Cg transform='translate(-427.000000, -3765.000000)' fill='%2300e201'%3E%3Cg id='icons' transform='translate(56.000000, 160.000000)'%3E%3Cpolygon id='play-%5B%231001%5D' points='371 3605 371 3613 378 3609'%3E%3C/polygon%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-size: contain;
    transform: translateY(-50%) rotate(90deg) ;
    width: 7px;
    height: 7px;
}
.custom-select-trigger:hover { background: var(--btn-face-hover); border-color: var(--accent); color: var(--accent); }
.custom-select.open .custom-select-trigger { border-style: inset; border-color: var(--accent); color: var(--accent); }
.custom-select.open .custom-select-trigger::after { transform: translateY(-50%) rotate(-90deg); margin-top:-1px;}

/* compact variants for dense areas */
.track-chip .custom-select-trigger { font-size: 13px; padding: 1px 16px 1px 5px; letter-spacing: 0; border-width: 2px; box-shadow: none; }
.transport .custom-select-trigger, .toolbar .custom-select-trigger { font-size: 15px; padding: 2px 20px 2px 6px; }

/* portalled panel (position:fixed -> never clipped by scroll containers) */
.custom-select-dropdown {
  position: fixed; z-index: 1000;
  min-width: 120px; width: max-content; max-width: 360px;
  max-height: 300px; overflow-y: auto; overflow-x: hidden;
  background: var(--surface); border: 1px solid var(--border);
  box-shadow: 0 6px 20px rgba(0,0,0,0.5);
  opacity: 0; transform: translateY(-4px); visibility: hidden; pointer-events: none;
  transition: opacity .12s ease, transform .12s ease;
}
.custom-select-dropdown.open { opacity: 1; transform: none; visibility: visible; pointer-events: auto; border:1px solid var(--accent);}

.cs-search { position: sticky; top: 0; padding: 6px; background: var(--surface3); border-bottom: 1px solid var(--border-dark); }
.cs-search input {
  width: 100%; background: var(--display-bg); color: var(--display-text);
  border: 1px inset var(--border-dark); font-family: 'VT323', monospace; font-size: 15px; padding: 2px 6px;
}

.custom-option {
  font-family: 'VT323', monospace; font-size: 14px; letter-spacing: 1px; text-transform: uppercase;
  padding: 6px 12px; cursor: pointer; color: var(--text); white-space: nowrap;
}
.custom-option:hover, .custom-option.hi {
  background: rgba(0,226,1,0.08); color: var(--accent); text-shadow: 0 0 4px rgba(0,226,1,0.3);
}
.custom-option.selected { background: rgba(0,226,1,0.15); color: var(--accent); }
.custom-option.disabled { opacity: 0.45; cursor: default; }

/* ---- help modal ---- */
.modal-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.65);
  align-items: center; justify-content: center;
}
.modal-overlay.open { display: flex; }
.modal-window {
  width: min(680px, 92vw); max-height: 84vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border: 1px solid var(--accent);
  
  box-shadow: 0 10px 50px rgba(0,0,0,0.7), inset 0 1px 0 rgba(255,255,255,0.05);
}
.modal-titlebar {
  display: flex; align-items: center;
  background: var(--titlebar-bg);
  border-bottom: 1px solid var(--border-dark);
  border-radius: 3px 3px 0 0;
  padding: 4px 8px;
}
.modal-title {
  font-family: 'VT323', monospace; font-size: 18px; letter-spacing: 1px;
  color: var(--accent); text-shadow: 0 0 4px rgba(0,226,1,0.4);

}
.modal-close {
  margin-left: auto; min-width: 0; padding: 1px 5px; font-size: 13px;
  border-width: 2px;
}
.modal-close:hover { border-color: #ff4444; color: #ff4444; }
.modal-body {
  overflow-y: auto; padding: 12px 16px;
  font-family: 'DM Sans', sans-serif; font-size: 13px; line-height: 1.5; color: var(--text);
}
.help-intro { color: var(--muted2); margin: 0 0 12px; }
.help-section { margin-bottom: 30px; background:var(--surface); border: 1px solid var(--border-light);}
.help-section h3 {
  font-family: 'VT323', monospace; font-size: 21px; letter-spacing: 1px;
  color: var(--accent-green); /*text-shadow: 0 0 5px rgba(0,226,1,0.35);*/
  margin: 0 0 5px; padding-bottom: 2px; border-bottom: 1px solid var(--border-dark);
  background:var(--surface); padding: 5px 10px; text-transform: uppercase;
}
.help-section ul { margin: 0; padding: 10px 10px 10px 25px; }
.help-section li { margin-bottom: 4px; }
.modal-body code, .modal-body kbd {
  font-family: 'Space Mono', monospace; font-size: 11px;
  background: var(--display-bg); color: var(--display-text);
  border: 1px solid var(--border-dark); border-radius: 2px; padding: 0 4px;
}
.modal-body b { color: var(--text-bright); }

.modal-body .green-text{padding-left: 10px; color:var(--accent); }
.modal-body .green-text a{color:var(--accent); }

.modal-body .icon-play.up {transform: rotate(-90deg); width: 8px; height: 8px;}
.modal-body .icon-play.down {transform: rotate(90deg); width: 8px; height: 8px;}
.modal-body .icon-play, .modal-body .icon-pause, .modal-body .icon-stop, .modal-body .icon-duplicate, .modal-body .icon-delete {filter:brightness(2);}
.help-section .sw {
  display: inline-block; width: 9px; height: 9px; /*border-radius: 2px;*/
  margin: 0 2px -1px 6px; /*box-shadow: 0 0 3px currentColor;*/
}
.sw.cy { background: #00ffff; } .sw.gr { background: #00e201; }
.sw.or { background: #ff6600; } .sw.wh { background: #ffffff; }
.sw.bl { background: #3399ff; } .sw.ye { background: #e6c800; } .sw.rd { background: #ff3c28; }
