:root{
  --bg:#0b0b0c;
  --panel:#141417cc;
  --panel-border:#2a2a2e;
  --text:#e6e6ea;
  --muted:#a9a9b3;
  --accent:#ffd166;
  --shadow:0 6px 22px rgba(0,0,0,.45);
  --radius:12px;
  --gap:10px;
}

*{ box-sizing:border-box; }
html,body{ height:100%; margin:0; }
body{
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Inter, sans-serif;
}

/* Canvas fills viewport; prevents horizontal overflow */
canvas{
  display:block;
  width: 100vw;
  height: 50vh; /* top half */
  max-width: 100vw;
  max-height: 50vh;
}

/* Controls panel fixed to bottom half */

.ui{
  position:absolute;
  top:50vh;
  left:0;
  width:100vw;
  height:50vh;

  display:flex;
  flex-direction: column;
  align-items: stretch;
  gap: var(--gap);

  padding: 8px 10px;
  background: var(--panel);
  border:1px solid var(--panel-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(6px);
  z-index: 10;

  overflow-y: auto;
  overflow-x: hidden;
}

/* View tabs */
.view-tabs{
  display:flex;
  justify-content:center;
  gap:8px;
}
.view-tab{
  padding:4px 12px;
  border:1px solid var(--panel-border);
  border-radius:8px;
  background:#1a1a1f;
  cursor:pointer;
  user-select:none;
}
.view-tab.active{
  background:var(--accent);
  color:#000;
}

/* Groups */
.group{
  display:flex;
  align-items:center;
  gap:8px;
  padding: 4px 6px;
  border-radius: 10px;
  border:1px solid transparent;
  flex-wrap: wrap;
}
.group:focus-within{
  border-color: #2d2d34;
  box-shadow: inset 0 0 0 1px #2d2d34;
}
.title{
  font-weight:700;
  font-size:11px;
  letter-spacing:.02em;
  color: var(--muted);
  margin-right: 2px;
  text-transform: uppercase;
}
.control-row{ display:flex; align-items:center; gap:6px; flex-wrap:nowrap; white-space:nowrap; }
.mode-row{ display:flex; align-items:center; gap:6px; flex-wrap:wrap; }

.group span{ user-select:none; }
.group .label{ font-weight:600; color: var(--muted); margin-right: 4px; }

/* Horizontal sliders */
.slider{
  appearance: none;
  width: 140px;
  height: 4px;
  border-radius: 999px;
  background: #2a2a31;
  outline: none;
}
.slider::-webkit-slider-thumb{
  appearance: none;
  width: 14px; height: 14px; border-radius:50%;
  background: var(--accent);
  border: 0;
  box-shadow: 0 0 0 3px #00000033;
}
.slider::-moz-range-thumb{
  width: 14px; height: 14px; border-radius:50%;
  background: var(--accent);
  border: 0;
  box-shadow: 0 0 0 3px #00000033;
}
select, .play-btn, .view-tab { font: inherit; }

/* Mode toggle */
.mode-toggle{
  position:relative;
  width:40px;
  height:20px;
  background:#2a2a31;
  border-radius:10px;
  cursor:pointer;
  flex-shrink:0;
}
.mode-toggle .mode-knob{
  position:absolute;
  top:2px;
  left:2px;
  width:16px;
  height:16px;
  border-radius:50%;
  background:var(--accent);
  transition:left .15s;
}
.mode-toggle.seq .mode-knob{ left:22px; }

/* Play button */
.play-btn{
  width: 40px; height:40px;
  border-radius: 10px;
  border:1px solid var(--panel-border);
  background:#1a1a1f;
  color:#fff;
  font-size: 18px;
  line-height: 1;
  cursor:pointer;
  box-shadow: var(--shadow);
}
.play-btn:hover{ background:#1f1f25; }
.play-btn:active{ transform: translateY(1px); }

/* Harmonic grid (compact) */
.hgrid{
  display:grid;
  grid-template-columns: repeat(auto-fill, minmax(52px, 1fr));
  gap:6px;
  width:100%;
}
.hcol{
  display:flex;
  flex-direction:column;
  align-items:center;
  gap:4px;
  padding:6px 4px;
  background:#141419;
  border:1px solid #212129;
  border-radius:10px;
  min-width:52px;
}
.hcol:hover{ border-color:#2b2b33; }
.hcol > span:first-child{ font-size:11px; color:var(--muted); }

/* Vertical partial sliders — 0.75× previous height (16vh → 12vh) */
.vslider{
  writing-mode: bt-lr;
  -webkit-appearance: slider-vertical;
  appearance: slider-vertical;
  width: 22px;
  height: 12vh; /* reduced from 16vh */
  background: linear-gradient(#2a2a31, #2a2a31) no-repeat center/5px 100%;
  border-radius: 10px;
  outline:none;
  accent-color: var(--accent);
}
.vslider::-webkit-slider-thumb{
  -webkit-appearance: none;
  width: 18px; height: 18px; border-radius:7px;
  background: var(--accent);
  border:0;
  box-shadow: 0 1px 0 1px #00000040;
}
.vslider::-moz-range-thumb{
  width: 18px; height: 18px; border-radius:7px;
  background: var(--accent);
  border:0;
  box-shadow: 0 1px 0 1px #00000040;
}

/* Audition highlight */
.vslider.auditioning{
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  background: #1b1b22;
  box-shadow: 0 0 5px 1px rgba(255, 209, 102, 0.3);
}

.hz{
  font-size:10px;
  color:#cfcfd8;
  opacity:.9;
}

/* Small screens */
@media (max-width: 960px){
  .slider{ width:130px; }
  .vslider{ height: 11vh; width: 20px; }
}
@media (max-width: 640px){
  body{ font-size:13px; }
  .slider{ width:120px; }
  .vslider{ height: 10vh; width: 20px; }
  .title{ font-size:10px; }
}
@media (max-width: 480px){
  .slider{ width:100px; }
}
@media (max-width: 360px){
  .slider{ width:80px; }
  .vslider{ height: 9vh; width: 18px; }
}
