:root {
  --bg: #0c0d10;
  --panel: #16181f;
  --panel-2: #1b1e27;
  --text: #dfe3ea;
  --muted: #9aa3b2;
  --accent: #e9c46a;
  --accent-2: #3a86ff;
  --border: #2a2f3a;
  --shadow: rgba(0,0,0,0.35);
}
* { box-sizing: border-box; }
html, body {
  height: 100%;
  margin: 0;
  color: var(--text);
  background: radial-gradient(1200px 600px at 50% 25%, #1a1e27 0%, #0a0b0f 70%);
  font-family: Inter, -apple-system, Segoe UI, Roboto, Helvetica, Arial, "Apple Color Emoji","Segoe UI Emoji", sans-serif;
}
a {
  color: var(--muted);
}
#firmware-name {
  line-height: 20pt;
  font-size: 13px;
}
#firmware-name a {
    font-size: 10px;
}
.app {
  max-width: 980px;
  margin: 28px auto 48px;
  padding: 0 16px;
}
.topbar {
  display: grid;
  grid-template-columns: auto auto auto auto auto auto;
  gap: 12px;
  align-items: center;
  margin-bottom: 22px;
}
.topbar .title {
  font-weight: 700;
  letter-spacing: 0.3px;
  color: var(--text);
}
.topbar .spacer { height: 1px; background: linear-gradient(90deg, transparent, var(--border), transparent); grid-column: 1 / -1; }
.topbar .fullrow { grid-column: 1 / -1; }
label.small {
  font-size: 12px;
  color: var(--muted);
  margin-right: 6px;
}
select, button {
  background: var(--panel);
  color: var(--text);
  border: 1px solid var(--border);
  padding: 10px 12px;
  border-radius: 10px;
  outline: none;
  font-size: 14px;
  transition: border-color .15s ease, box-shadow .15s ease;
}
select:focus, button:focus { border-color: var(--accent-2); box-shadow: 0 0 0 3px rgba(58,134,255,.15); }
button {
  cursor: pointer;
  padding: 10px 14px;
}
#status {
  font-size: 12px;
  color: var(--muted);
}

/* Pedal panel */
.device {
  width: 460px;
  margin: 0 auto;
  padding: 22px 22px 20px;
  border-radius: 18px;
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--border);
  box-shadow:
    0 16px 40px var(--shadow),
    inset 0 2px 0 rgba(255,255,255,0.03),
    inset 0 -2px 0 rgba(0,0,0,0.35);
}
.brand {
  display: flex; justify-content: center; gap: 10px; align-items: baseline;
  margin: 2px 0 18px;
  color: #f5f7fb;
  letter-spacing: .2px;
}
.brand .name { font-size: 20px; font-weight: 800; }
.brand .model { font-weight: 600; color: var(--accent); }
.gold-lines {
  height: 1px;
  background: linear-gradient(90deg, transparent, #c7a155 15%, #e6c273, #c7a155 85%, transparent);
  margin: 12px 0 18px;
}

.grid {
  display: grid;
  gap: 18px 24px;
}
.row-3-knobs { grid-template-columns: repeat(3, 1fr); }
.row-3 { grid-template-columns: repeat(3, 1fr); }
.row-2 { grid-template-columns: repeat(3, 1fr); margin-top: 10px; }
.col-1 { grid-column: 1; }
.col-3 { grid-column: 3; }

.control { text-align: center; }

/* Knob (flat UI dial) */
.knob {
  user-select: none;
}
.knob .dial {
  --angle: -45deg; /* visual default; will be updated via JS */
  width: 88px; height: 88px;
  margin: 0 auto 10px;
  border-radius: 50%;
  background: radial-gradient(120px 120px at 50% 40%, #1b1e27 0%, #12141a 65%);
  border: 1px solid var(--border);
  position: relative;
  box-shadow: inset 0 8px 18px rgba(255,255,255,0.03), inset 0 -10px 20px rgba(0,0,0,0.55);
}
.knob .dial::before {
  /* dial rim */
  content: "";
  position: absolute;
  inset: 8px;
  border-radius: 50%;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,0) 60%);
}
.knob .tick {
  position: absolute;
  left: 50%; top: 50%;
  width: 0; height: 0;
  transform: translate(-50%,-50%) rotate(var(--angle));
  transform-origin: 50% 50%;
}
.knob .tick i {
  display: block;
  width: 3px; height: 18px;
  position: relative;
  left: -1.5px;
  background: #f0f2f7;
  border-radius: 2px;
  transform: translateY(-28px);
  box-shadow: 0 0 0 1px rgba(255,255,255,0.05);
}
.knob .value {
  font-size: 12px; color: var(--muted);
  margin-top: 2px;
}
.label {
  margin-top: 8px;
  font-size: 13px; font-weight: 600; letter-spacing: .3px;
  color: #f0f2f7;
}

/* Toggle (flat switch) */
.toggle .toggle-track {
  width: 88px; height: 36px; margin: 0 auto 8px;
  background: #0f1117;
  border: 1px solid var(--border);
  border-radius: 999px;
  position: relative;
  box-shadow: inset 0 6px 12px rgba(0,0,0,.5);
  transition: background .15s ease, border-color .15s ease;
}
.toggle .thumb {
  position: absolute; top: 50%; left: 6px;
  width: 28px; height: 28px; border-radius: 50%;
  background: linear-gradient(180deg, #dfe5f3, #aeb6c7);
  border: 1px solid #8992a3;
  transform: translateY(-50%);
  transition: left .18s ease, top .18s ease, transform .18s ease;
  box-shadow: 0 6px 14px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.8);
}
.toggle.on .toggle-track { background: #14365e; border-color: #1f4271; }
.toggle.on .thumb { left: calc(100% - 6px - 28px); background: linear-gradient(180deg, #b6d0ff, #7aa6ff); border-color: #6a90e0; }

/* Vertical toggle variant */
.toggle-vertical .toggle-track { width: 36px; height: 88px; }
.toggle-vertical .thumb { left: 50%; top: 6px; transform: translate(-50%, 0); }
.toggle-vertical.on .thumb { top: calc(100% - 6px - 28px); left: 50%; }

/* Small horizontal toggle for Shift */
.toggle.small { position: relative; top: 5px;}
.toggle.small .toggle-track { width: 64px; height: 28px; }
.toggle.small .thumb { width: 22px; height: 22px; }
.toggle.small.on .thumb { left: calc(100% - 6px - 22px); }

/* Pushbutton (momentary) */
.pushbutton .button {
  width: 56px; height: 56px; margin: 8px auto 8px;
  border-radius: 50%;
  background: radial-gradient(70px 70px at 50% 35%, #eaeef8 0%, #c9cfdd 60%, #b0b8c7 100%);
  border: 1px solid #8d95a6;
  box-shadow: 0 10px 24px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.8);
  transition: transform .06s ease, box-shadow .06s ease;
}
.pushbutton .button.active { transform: translateY(1px); box-shadow: 0 6px 16px rgba(0,0,0,.35), inset 0 0 0 rgba(255,255,255,0); }

/* Footswitch (latching) */
.footswitch .switch {
  width: 80px; height: 80px; margin: 20px auto 10px;
  border-radius: 50%;
  background: radial-gradient(72px 72px at 50% 35%, #e9edf8 0%, #c5ccdb 60%, #aab2c3 100%);
  border: 1px solid #8a92a3;
  box-shadow: 0 12px 28px rgba(0,0,0,.35), inset 0 1px 0 rgba(255,255,255,.85);
  position: relative;
  transition: transform .06s ease, box-shadow .06s ease;
}
.footswitch.on .switch { transform: translateY(1px); box-shadow: 0 8px 20px rgba(0,0,0,.35), inset 0 0 0 rgba(255,255,255,0); }
.footswitch .led {
  position: absolute; left: 50%; top: -25px; transform: translateX(-50%);
  width: 12px; height: 12px; border-radius: 50%;
  background: #303645; border: 1px solid #303645; box-shadow: 0 0 0 0 transparent;
  transition: background .15s ease, box-shadow .2s ease, border-color .15s ease;
}
/* Active (right) footswitch: off=dark (default), on=red */
.footswitch.on .led { background: #e0507a; border-color: #ff6f99; box-shadow: 0 0 12px 3px rgba(255,111,153,.55); }
/* Preset (left) footswitch: off=blue, on=red */
#footswitch-left.on .led { background: #e0507a; border-color: #ff6f99; box-shadow: 0 0 12px 3px rgba(255,111,153,.55); }
#footswitch-left .led { background: #57b5ff; border-color: #60b9ff; box-shadow: 0 0 12px 3px rgba(87,181,255,.55); }

.hint { font-size: 12px; color: var(--muted); text-align: center; margin-top: 16px; }

/* mode LED row */
.mode-leds { display:flex; justify-content:center; gap:12px; margin: 6px 0 20px; }
.mode-leds .dot {
  width: 12px; height: 12px; border-radius: 50%;
  background: #2b2f3a; border: 1px solid #31384a; box-shadow: inset 0 1px 0 rgba(255,255,255,.06);
  transition: background .12s ease, box-shadow .15s ease, border-color .12s ease;
}
.mode-leds .dot.on { background: #ffffff; border-color: #f6f7fb; box-shadow: 0 0 10px 3px rgba(255,255,255,.5); }

.status-row { text-align: center; align-self: center; }
.sys-buttons { display:flex; justify-content:center; gap:10px; margin: 12px 0 0; }
.sys-buttons button { padding: 8px 10px; font-size: 12px; }
#btn-debug { display: none; }
#btn-debug.visible { display: inline-block; }

/* Modal */
.modal-backdrop { 
  position: fixed; inset: 0; 
  background: rgba(0,0,0,0.5); 
  display: none; 
  align-items: center; 
  justify-content: center; 
  z-index: 1000; 
}
.modal-backdrop.open { display: flex; }
.modal {
  width: 460px;
  max-width: 95vw;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  box-shadow: 0 20px 50px var(--shadow);
}
.modal .header { 
  font-weight: 700; 
  text-align: center; 
  margin-bottom: 12px; 
}
.modal .body { 
  display: grid; 
  gap: 12px; 
}
.modal .row { 
  display: flex; 
  align-items: center; 
  justify-content: space-between; 
  gap: 10px; 
  min-height: 28px;
}

