:root {
  --page: #1e1e1f;
  --panel: #2f2f31;
  --panel-2: #3a3a3c;
  --sunk: #232324;   /* recessed areas: meters, tracks */
  --line: #4a4a4d;   /* hairline borders */
  --line-2: #565659;
  --txt: #e6e6e8;
  --dim: #9a9a9f;
  --faint: #6c6c70;
  --accent: #74d18a; /* muted green */
  --accent-dim: #4b8b5d;
  --rec: #e0584f;
  --mono: "SFMono-Regular", ui-monospace, "Menlo", "Consolas", monospace;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px 12px;
  background: var(--page);
  font-family: var(--mono);
  color: var(--txt);
}

/* ---------- the unit ---------- */
.unit {
  position: relative;
  width: 380px;
  max-width: 100%;
  background: var(--panel);
  border: 1px solid #141415;
  border-radius: 6px;
  padding: 18px 16px 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,.35);
}

/* ---------- top readouts ---------- */
.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0 2px 14px;
}
.clock {
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0;
  font-variant-numeric: tabular-nums;
  color: var(--txt);
}
.lcd {
  font-size: 11px;
  padding: 6px 10px;
  color: var(--accent);
  background: var(--sunk);
  border-radius: 3px;
  border: 1px solid var(--line);
  max-width: 175px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* ---------- transport ---------- */
.transport {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 12px;
}
.tbtn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 12px 4px 8px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  color: var(--txt);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.tbtn:hover:not(:disabled) { background: #454547; }
.tbtn:active:not(:disabled) { background: #4d4d4f; }
.tbtn:disabled { opacity: .38; cursor: not-allowed; }
.tbtn.playing { border-color: var(--accent); }
.tlabel { font-size: 9px; letter-spacing: .5px; color: var(--dim); }

/* draw attention to LOAD until a file is present (flat border pulse, no glow) */
@keyframes loadPulse {
  0%,100% { border-color: var(--line); }
  50%     { border-color: var(--accent); }
}
.unit.idle #btnLoad { animation: loadPulse 2s ease-in-out infinite; }

.glyph { width: 18px; height: 18px; display: block; position: relative; }
.glyph.play { border-left: 12px solid var(--txt); border-top: 7px solid transparent; border-bottom: 7px solid transparent; width: 0; margin-left: 3px; }
.tbtn.playing .glyph.play { border: none; }
.tbtn.playing .glyph.play::before, .tbtn.playing .glyph.play::after {
  content:""; position:absolute; top:1px; width:5px; height:16px; background:var(--accent);
}
.tbtn.playing .glyph.play::before { left:2px; } .tbtn.playing .glyph.play::after { left:11px; }
.glyph.stop { background: var(--txt); border-radius: 1px; }
.glyph.load::before { content:"↑"; position:absolute; inset:0; font-size:18px; line-height:18px; text-align:center; }
.glyph.save::before { content:"↓"; position:absolute; inset:0; font-size:18px; line-height:18px; text-align:center; }
#btnRender .glyph.save::before { color: var(--accent); }

/* ---------- tabs ---------- */
.tabs { display:flex; gap:4px; margin-bottom:12px; }
.tab {
  flex:1; padding:8px; font-size:11px; letter-spacing:1px;
  background:var(--sunk); color:var(--dim); border:1px solid var(--line);
  border-radius:3px; cursor:pointer; transition:background .12s, color .12s;
}
.tab:hover { color:var(--txt); }
.tab.active { color:#151516; background:var(--accent); border-color:var(--accent); }

/* ---------- meters ---------- */
.meters {
  position: relative;
  background:var(--sunk); border:1px solid var(--line); border-radius:3px;
  padding:11px 11px 7px; margin-bottom:14px;
}
.meter-hint {
  position:absolute; inset:0; z-index:2;
  display:none; align-items:center; justify-content:center;
  font-size:11px; letter-spacing:1px; color:var(--dim);
  background:var(--sunk); border-radius:3px;
}
.meter-hint span { color:var(--accent); font-size:14px; margin-right:6px; }
.unit.idle .meter-hint { display:flex; }
.unit.dragging .meter-hint { display:none; }
.meter-row { display:flex; align-items:center; gap:9px; margin-bottom:6px; }
.ch { font-size:11px; font-weight:500; width:11px; color:var(--dim); }
.bar {
  flex:1; height:11px; border-radius:2px; overflow:hidden; position:relative;
  background: repeating-linear-gradient(90deg, #2f2f31 0 3px, #202021 3px 5px);
}
.bar i {
  position:absolute; left:0; top:0; bottom:0; width:0%;
  background: linear-gradient(90deg, var(--accent) 0%, var(--accent) 62%, #d3c65a 80%, var(--rec) 100%);
  transition: width .05s linear;
}
.scale { display:flex; justify-content:space-between; font-size:9px; color:var(--faint); padding:0 1px; }

/* ---------- faders ---------- */
.faders { display:grid; grid-template-columns:repeat(4,1fr); gap:8px; }
.fader { display:flex; flex-direction:column; align-items:center; gap:8px; }
.cap {
  width:40px; height:38px; display:flex; align-items:center; justify-content:center;
  font-size:18px; color:var(--dim);
  background:var(--panel-2); border:1px solid var(--line); border-radius:3px;
}
.slider {
  -webkit-appearance:none; appearance:none;
  writing-mode: vertical-lr;
  direction: rtl;
  width:10px; height:150px;
  background:
    linear-gradient(90deg, transparent 44%, var(--sunk) 44%, var(--sunk) 56%, transparent 56%),
    repeating-linear-gradient(0deg, var(--line) 0 1px, transparent 1px 15px);
  cursor:pointer;
}
.slider::-webkit-slider-thumb {
  -webkit-appearance:none; appearance:none;
  width:30px; height:12px; border-radius:2px;
  background: #c7c7cb;
  border:1px solid #0c0c0d;
}
.slider::-webkit-slider-thumb:hover { background:#dcdce0; }
.slider::-moz-range-thumb {
  width:30px; height:12px; border-radius:2px; border:1px solid #0c0c0d;
  background:#c7c7cb;
}
.readout {
  font-size:11px; padding:5px 8px; min-width:56px; text-align:center;
  background:var(--sunk); border:1px solid var(--line); border-radius:3px; color:var(--txt);
  font-variant-numeric: tabular-nums;
}
.pname { font-size:9px; letter-spacing:.5px; color:var(--dim); }

/* ---------- progress ---------- */
.progress {
  position:relative; margin-top:14px; height:20px; border-radius:3px;
  background:var(--sunk); border:1px solid var(--line); overflow:hidden;
  display:none; align-items:center; justify-content:center;
}
.progress.on { display:flex; }
.progress i { position:absolute; left:0; top:0; bottom:0; width:0%; background:var(--accent-dim); }
.progress span { position:relative; font-size:10px; letter-spacing:1px; color:var(--txt); }

/* ---------- url panel ---------- */
.urlpanel { margin-top:12px; display:flex; flex-wrap:wrap; gap:6px; }
.urlpanel[hidden] { display:none; }
.urlpanel input {
  flex:1; min-width:180px; padding:9px 10px; font-family:var(--mono); font-size:12px;
  background:var(--sunk); color:var(--txt); border:1px solid var(--line); border-radius:3px;
}
.urlpanel button {
  padding:9px 16px; background:var(--panel-2); color:var(--txt);
  border:1px solid var(--line); border-radius:3px; cursor:pointer; font-size:11px; letter-spacing:1px;
}
.urlpanel button:hover { background:#454547; }
.urlpanel .hint { flex-basis:100%; font-size:10px; color:var(--faint); margin:2px 0 0; line-height:1.4; }

/* ---------- dropzone ---------- */
.dropzone {
  position:absolute; inset:0; border-radius:6px;
  background:rgba(20,20,21,.94);
  border:1px dashed var(--accent);
  display:flex; align-items:center; justify-content:center; z-index:5;
  opacity:0; visibility:hidden;
  transition:opacity .12s ease, visibility .12s;
}
.dropzone.show { opacity:1; visibility:visible; }
.dz-inner { text-align:center; color:var(--txt); }
.dz-icon { font-size:34px; color:var(--accent); }
.dz-title { font-size:16px; letter-spacing:3px; margin-top:6px; }
.dz-sub { font-size:10px; color:var(--dim); margin-top:8px; letter-spacing:.5px; }

.foot { font-size:10px; color:var(--faint); letter-spacing:.5px; margin:0; }
