:root {
  --bg: #091222;
  --surface: #121f36;
  --surface-2: #0f1d33;
  --line: #294870;
  --text: #d9ebff;
  --muted: #8bb0d8;
  --accent: #36c8ff;
  --accent-2: #4e79ff;
  --glow: 0 0 0 1px rgba(84, 196, 255, 0.28), 0 0 18px rgba(53, 177, 255, 0.22);
  --danger: #ef476f;
  --radius: 16px;
  --shadow-card: 0 14px 34px rgba(1, 7, 18, 0.55);
  --slider-note-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffffff' d='M14 3v10.2a3.6 3.6 0 1 1-2-3.2V6.2l8-1.8v7.8a3.6 3.6 0 1 1-2-3.2V6.9l-4 .9z'/%3E%3C/svg%3E");
  --font-ui: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
  --font-display: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI Variable Display", "Segoe UI", Roboto, "Noto Sans", Arial, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--text);
  font-family: var(--font-ui);
  font-size: 17px;
  background:
    radial-gradient(130% 90% at 12% -8%, rgba(51, 159, 255, 0.2) 0%, transparent 46%),
    radial-gradient(120% 80% at 110% -10%, rgba(63, 103, 255, 0.16) 0%, transparent 52%),
    linear-gradient(180deg, #0a1324 0%, #081224 100%);
  padding-bottom: 86px;
  min-width: 320px;
}
button,
input,
select,
textarea {
  font-family: inherit;
}
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    linear-gradient(rgba(92, 145, 220, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(92, 145, 220, 0.08) 1px, transparent 1px);
  background-size: 44px 44px, 44px 44px;
  mask-image: radial-gradient(circle at 50% 20%, rgba(0, 0, 0, 0.75), transparent 92%);
  z-index: -1;
}
body.drag-scroll-lock {
  overflow: hidden;
  touch-action: none;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
  gap: 10px 14px;
  padding: 11px 14px;
  border: 1px solid #2e4f7a;
  border-radius: 0 0 18px 18px;
  background: rgba(12, 24, 44, 0.86);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px rgba(2, 9, 22, 0.58), inset 0 -1px 0 rgba(98, 183, 255, 0.25);
  position: sticky;
  top: 0;
  z-index: 1000;
}
.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.topbar-brand {
  display: grid;
  gap: 0;
  min-width: 0;
}
.topbar h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: clamp(27px, 3.2vw, 36px);
  line-height: 1.03;
  letter-spacing: 0.15px;
  font-weight: 700;
  color: #d8f1ff;
  text-shadow: 0 0 10px rgba(56, 196, 255, 0.22);
}
.topbar p {
  margin: 1px 0 0;
  color: var(--muted);
  font-size: clamp(12px, 1.2vw, 15px);
  font-weight: 500;
}
.topbar-panel-title {
  margin-top: 0;
  display: inline-flex;
  align-items: center;
  width: fit-content;
  padding: 6px 14px;
  border: 1px solid rgba(85, 182, 245, 0.62);
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(16, 36, 63, 0.96), rgba(10, 24, 44, 0.96));
  color: #eaf8ff;
  font-size: clamp(16px, 2vw, 20px);
  font-weight: 700;
  letter-spacing: 0.3px;
  box-shadow:
    inset 0 1px 0 rgba(169, 229, 255, 0.18),
    0 0 0 1px rgba(59, 172, 247, 0.16);
}
.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid #3f6ea8;
  background: linear-gradient(180deg, #19335b, #132a4c);
  color: #b9e6ff;
  font-size: 22px;
  line-height: 1;
  padding: 0;
  cursor: pointer;
  box-shadow: 0 8px 16px rgba(4, 14, 28, 0.55), inset 0 0 0 1px rgba(90, 185, 255, 0.28);
}

.status-wrap {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
  align-items: center;
}
.chip {
  border: 1px solid #31567f;
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.1px;
  color: #9ec5ef;
  background: linear-gradient(180deg, rgba(22, 41, 69, 0.92), rgba(16, 31, 56, 0.92));
}
.chip.ok {
  color: #128a57;
  border-color: #7ad2ac;
  background: #ebfff6;
}
.chip.warn {
  color: #8c6308;
  border-color: #e5c374;
  background: #fff8e7;
}
.chip.bad {
  color: #b53a58;
  border-color: #ef9db1;
  background: #fff0f4;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  min-height: calc(100vh - 132px);
}

.sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(84vw, 320px);
  z-index: 1200;
  padding: 14px;
  border-right: 1px solid #345884;
  background: linear-gradient(180deg, rgba(13, 25, 46, 0.98), rgba(9, 19, 37, 0.98));
  transition: transform 180ms ease, opacity 180ms ease;
  overflow: hidden;
  transform: translateX(-108%);
  opacity: 0;
  pointer-events: none;
  box-shadow: 10px 0 30px rgba(14, 27, 49, 0.25);
  padding-top: 62px;
}
.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(9, 18, 31, 0.32);
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}
.sidebar-open .sidebar {
  transform: translateX(0);
  opacity: 1;
  pointer-events: auto;
}
.sidebar-open .sidebar-backdrop {
  opacity: 1;
  pointer-events: auto;
}
.sidebar-open {
  overflow: hidden;
}
.sidebar-close-btn {
  position: absolute;
  top: 18px;
  left: 14px;
  width: 34px;
  height: 34px;
  padding: 0;
  border-radius: 10px;
  border: 1px solid #4d83b7;
  background: linear-gradient(180deg, rgba(25, 49, 80, 0.96), rgba(16, 34, 58, 0.96));
  color: #d8efff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow:
    inset 0 1px 0 rgba(194, 236, 255, 0.22),
    0 6px 14px rgba(2, 10, 24, 0.42);
}
.sidebar-close-btn:hover {
  border-color: #69cfff;
  box-shadow:
    0 0 0 1px rgba(97, 209, 255, 0.34),
    0 8px 16px rgba(3, 11, 24, 0.46);
}
.sidebar-close-btn:active {
  transform: translateY(1px) scale(0.98);
}
.tab {
  width: 100%;
  margin-bottom: 10px;
  text-align: left;
  border-radius: 12px;
  border: 1px solid #33567f;
  background: linear-gradient(180deg, rgba(21, 39, 66, 0.95), rgba(16, 31, 54, 0.95));
  color: #9ec7f2;
  padding: 11px 13px;
  font-size: 22px;
  cursor: pointer;
  font-weight: 700;
}
.tab.active {
  background: linear-gradient(120deg, #1f5fd9, #35c6ff);
  border-color: #49d2ff;
  color: #f7fdff;
  box-shadow: 0 10px 24px rgba(29, 169, 255, 0.3);
}

main {
  width: min(1120px, 100%);
  margin: 0 auto;
  padding: 16px 16px 18px;
}
.panel { display: none; }
.panel.active { display: block; }
h2 {
  margin: 0 0 14px;
  font-size: clamp(28px, 3vw, 40px);
  line-height: 1.08;
  color: #bfe6ff;
  text-shadow: 0 0 14px rgba(80, 196, 255, 0.18);
}
.panel > h2 {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.block-grid { display: grid; gap: 16px; }
.card {
  border: 1px solid #2d4d77;
  border-radius: var(--radius);
  background:
    linear-gradient(180deg, rgba(17, 33, 58, 0.92), rgba(13, 27, 49, 0.9));
  padding: 14px;
  box-shadow: var(--shadow-card), inset 0 0 0 1px rgba(82, 164, 234, 0.2);
}
summary {
  cursor: pointer;
  font-weight: 700;
  margin-bottom: 10px;
  font-size: clamp(19px, 2vw, 29px);
  color: #bbe4ff;
  letter-spacing: 0.2px;
}
details.card {
  transition: transform 150ms ease, box-shadow 180ms ease;
}
details.card[open] {
  box-shadow: 0 18px 36px rgba(1, 8, 20, 0.65), inset 0 0 0 1px rgba(86, 180, 255, 0.22);
}
details.card[open] > summary {
  color: #ddf5ff;
}

.panel.active .card {
  animation: none;
}
@keyframes card-rise {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.grid { display: grid; gap: 16px; }
.grid.one { grid-template-columns: 1fr; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.span-two { grid-column: 1 / -1; }
#connect .grid {
  max-width: 980px;
  margin: 0 auto;
}
#connect .card {
  min-height: 420px;
  padding: 26px 20px;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  text-align: left;
}
#connect .card h3 {
  margin: 0;
  font-size: clamp(28px, 4vw, 40px);
  text-align: center;
}
.output-control-card .grid {
  max-width: 1120px;
  margin: 0 auto;
}
.output-control-card label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  color: #abd3ff;
  font-weight: 700;
}
.output-control-card input[type="range"] {
  height: 24px;
}
.output-control-card input[type="range"]::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #14335b 0%, #224678 45%, #2e6ab0 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(92, 178, 255, 0.45);
}
.output-control-card input[type="range"]::-webkit-slider-thumb {
  width: 26px;
  height: 26px;
  margin-top: -4px;
  border-radius: 8px;
  border: 1px solid #9adfff;
  background: linear-gradient(180deg, #f7feff 0%, #c9efff 38%, #5ab4ff 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    0 0 0 2px rgba(86, 194, 255, 0.3),
    0 2px 8px rgba(7, 17, 33, 0.6);
}
.output-control-card input[type="range"]::-moz-range-track {
  height: 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, #14335b 0%, #224678 45%, #2e6ab0 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    inset 0 -1px 0 rgba(0, 0, 0, 0.45),
    inset 0 0 0 1px rgba(92, 178, 255, 0.45);
}
.output-control-card input[type="range"]::-moz-range-thumb {
  width: 26px;
  height: 26px;
  border: 1px solid #9adfff;
  border-radius: 8px;
  background: linear-gradient(180deg, #f7feff 0%, #c9efff 38%, #5ab4ff 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.85),
    0 0 0 2px rgba(86, 194, 255, 0.3),
    0 2px 8px rgba(7, 17, 33, 0.6);
}

label {
  display: grid;
  gap: 6px;
  color: var(--muted);
}
.range-live-value {
  justify-self: start;
  margin-top: 2px;
  padding: 2px 8px;
  border: 1px solid #3f6da0;
  border-radius: 999px;
  background: linear-gradient(180deg, rgba(17, 34, 58, 0.96), rgba(12, 24, 44, 0.96));
  color: #f2fbff;
  font-size: 12px;
  font-weight: 800;
  line-height: 1.4;
  box-shadow: inset 0 0 0 1px rgba(79, 171, 235, 0.32);
}
.output-control-card label {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  column-gap: 10px;
  row-gap: 6px;
  align-items: center;
}
.output-control-card label > input[type="range"] {
  grid-column: 1 / -1;
  grid-row: 2;
}
.output-control-card .range-live-value {
  grid-column: 2;
  grid-row: 1;
  justify-self: end;
  align-self: end;
  margin: 0;
  min-width: 58px;
  text-align: center;
  padding: 3px 10px;
}
.phase-wrap {
  display: grid;
  gap: 8px;
}
.sub-segment-toggle {
  position: relative;
  width: 100%;
  min-height: 52px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border: 1px solid #3b6795;
  border-radius: 12px;
  background:
    radial-gradient(120% 90% at 50% 0%, rgba(72, 178, 248, 0.18), transparent 62%),
    linear-gradient(180deg, rgba(15, 31, 55, 0.98), rgba(10, 22, 41, 0.98));
  box-shadow:
    inset 0 1px 0 rgba(170, 229, 255, 0.15),
    inset 0 0 0 1px rgba(77, 164, 232, 0.22);
  overflow: hidden;
}
.sub-segment-knob {
  position: absolute;
  top: 4px;
  left: 4px;
  width: calc(50% - 6px);
  height: calc(100% - 8px);
  border-radius: 8px;
  border: 1px solid #9de3ff;
  background:
    radial-gradient(130% 120% at 30% 20%, rgba(228, 250, 255, 0.72), rgba(121, 212, 255, 0.42) 45%, rgba(75, 183, 255, 0.45) 100%),
    linear-gradient(180deg, #b6ecff 0%, #6accff 55%, #43abff 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.88),
    0 0 0 1px rgba(86, 195, 255, 0.35),
    0 0 12px rgba(70, 183, 255, 0.32);
  transition: transform 180ms ease;
  z-index: 1;
}
.sub-segment-label {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 14px;
  line-height: 1.1;
  color: #82a6cc;
  letter-spacing: 0.25px;
  transition: color 120ms ease, text-shadow 120ms ease, opacity 120ms ease;
  z-index: 2;
  pointer-events: none;
}
.mode-label-stereo,
.phase-label-0 {
  grid-column: 1;
}
.mode-label-mono,
.phase-label-180 {
  grid-column: 2;
}
.sub-segment-label.is-active {
  color: #f5fdff;
  text-shadow: 0 0 10px rgba(84, 205, 255, 0.36);
  opacity: 1;
}
.sub-segment-toggle .sub-segment-label:not(.is-active) {
  opacity: 0.78;
}
.sub-segment-toggle[aria-pressed="false"] .sub-segment-knob {
  transform: translateX(0);
}
.sub-segment-toggle[aria-pressed="true"] .sub-segment-knob {
  transform: translateX(calc(100% + 4px));
}
.sub-segment-state {
  color: #9bc4ea;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.2px;
  padding-left: 4px;
}
.mic-fx-card .dyn-faders.fx-four {
  grid-template-columns: repeat(4, minmax(92px, 1fr));
}
.mic-fx-card .dyn-fader {
  min-height: 360px;
}
.mic-fx-card .dyn-fader-rail {
  height: 300px;
}
.mic-fx-card .dyn-fader input[type="range"] {
  width: 280px;
}
.mic-switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: #cde8ff;
  font-weight: 700;
}
.tiny-toggle {
  position: relative;
  min-width: 86px;
  height: 34px;
  border-radius: 999px;
  border: 1px solid #3f6f9f;
  padding: 2px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  background: linear-gradient(180deg, rgba(16, 28, 48, 0.95), rgba(10, 20, 37, 0.95));
  box-shadow: inset 0 0 0 1px rgba(68, 119, 169, 0.35);
}
.tiny-toggle-knob {
  position: absolute;
  top: 3px;
  left: 4px;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  border: 1px solid #5f86ac;
  background: linear-gradient(180deg, #6f8db0, #4f6f94);
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.16);
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease, border-color 150ms ease;
}
.tiny-toggle[aria-pressed="true"] {
  border-color: #53d6a8;
  background: linear-gradient(180deg, rgba(13, 54, 54, 0.98), rgba(10, 40, 42, 0.98));
  box-shadow:
    inset 0 0 0 1px rgba(97, 230, 183, 0.4),
    0 0 12px rgba(70, 223, 170, 0.22);
}
.tiny-toggle[aria-pressed="true"] .tiny-toggle-knob {
  transform: translateX(52px);
  border-color: #8ce9c8;
  background: linear-gradient(180deg, #f0fff8, #bdf7de);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.95),
    0 0 12px rgba(124, 245, 203, 0.75);
}
.tiny-toggle-text {
  display: none;
}
select, input[type="text"], input[type="number"], button {
  border: 1px solid #355b87;
  border-radius: 12px;
  color: #f3f9ff;
  background: linear-gradient(180deg, rgba(23, 42, 70, 0.96), rgba(14, 29, 52, 0.95));
  padding: 8px 10px;
  box-shadow: inset 0 0 0 1px rgba(90, 170, 239, 0.2);
}
select:focus, input[type="text"]:focus, input[type="number"]:focus {
  outline: none;
  border-color: #58cfff;
  box-shadow: var(--glow);
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  padding: 0;
  background: transparent;
  border: 0;
  cursor: pointer;
  touch-action: none;
}
input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1a3d66, #244f85 40%, #2f76b6 100%);
  box-shadow:
    inset 0 0 0 1px rgba(82, 167, 237, 0.4),
    inset 0 1px 2px rgba(255, 255, 255, 0.2);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 34px;
  height: 34px;
  margin-top: -13px;
  border: 2px solid #cbf3ff;
  border-radius: 10px;
  background: linear-gradient(180deg, #ecfdff 0%, #9addff 45%, #4fb5ff 100%);
  box-shadow:
    0 0 0 2px rgba(60, 184, 255, 0.38),
    0 6px 12px rgba(6, 15, 28, 0.5);
}
input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #1a3d66, #244f85 40%, #2f76b6 100%);
  box-shadow:
    inset 0 0 0 1px rgba(82, 167, 237, 0.4),
    inset 0 1px 2px rgba(255, 255, 255, 0.2);
}
input[type="range"]::-moz-range-thumb {
  width: 34px;
  height: 34px;
  border: 2px solid #cbf3ff;
  border-radius: 10px;
  background: linear-gradient(180deg, #ecfdff 0%, #9addff 45%, #4fb5ff 100%);
  box-shadow:
    0 0 0 2px rgba(60, 184, 255, 0.38),
    0 6px 12px rgba(6, 15, 28, 0.5);
}
button { cursor: pointer; }
button,
select,
input[type="text"],
input[type="number"],
input[type="range"],
.band-chip,
.tab {
  transition: border-color 140ms ease, box-shadow 160ms ease, transform 120ms ease, background 180ms ease, color 160ms ease;
}
.locked-control,
input[readonly].locked-control {
  opacity: 0.58;
  color: #64748b;
  background: #eef2f5;
  cursor: not-allowed;
}
button:hover {
  border-color: #64d6ff;
  box-shadow: 0 0 0 1px rgba(100, 214, 255, 0.4), 0 10px 18px rgba(4, 12, 26, 0.45);
}
button:active,
.band-chip:active,
.tab:active {
  transform: translateY(1px) scale(0.99);
}
input[type="range"]:active {
  transform: scale(1.01);
}
input[type="range"]:focus-visible::-webkit-slider-thumb {
  box-shadow:
    0 0 0 2px rgba(60, 184, 255, 0.38),
    0 0 0 5px rgba(74, 193, 255, 0.22),
    0 6px 12px rgba(6, 15, 28, 0.5);
}
input[type="range"]:focus-visible::-moz-range-thumb {
  box-shadow:
    0 0 0 2px rgba(60, 184, 255, 0.38),
    0 0 0 5px rgba(74, 193, 255, 0.22),
    0 6px 12px rgba(6, 15, 28, 0.5);
}
button.danger {
  background: linear-gradient(180deg, rgba(81, 27, 45, 0.96), rgba(57, 18, 32, 0.96));
  border-color: #ef7f9a;
  color: #ffd5e0;
}

.eq-graph {
  position: relative;
  height: 130px;
  border: 1px solid #243759;
  border-radius: 14px;
  background:
    repeating-linear-gradient(to right, rgba(255,255,255,0.08) 0 1px, transparent 1px 11%),
    repeating-linear-gradient(to top, rgba(255,255,255,0.08) 0 1px, transparent 1px 20%),
    radial-gradient(100% 70% at 50% 0%, rgba(95, 146, 241, 0.22), transparent 60%),
    linear-gradient(180deg, #1d2f4d, #152541 78%);
  margin-bottom: 12px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), inset 0 -10px 24px rgba(0, 0, 0, 0.28);
  touch-action: none;
}
.eq-graph.v41 {
  height: 360px;
  border-radius: 14px;
}
.eq-panel {
  border: 1px solid #35608f;
  border-radius: 14px;
  padding: 12px;
  background:
    radial-gradient(120% 85% at 50% 0%, rgba(74, 188, 255, 0.28), transparent 58%),
    linear-gradient(180deg, rgba(16, 32, 58, 0.96), rgba(11, 25, 47, 0.96));
  box-shadow:
    inset 0 1px 0 rgba(168, 224, 255, 0.18),
    0 8px 24px rgba(2, 10, 24, 0.55);
  overflow-x: clip;
}
.eq-chart {
  display: grid;
  grid-template-columns: 72px 1fr;
  gap: 10px;
}
.db-axis {
  display: grid;
  grid-template-rows: repeat(12, 1fr);
  color: #88b8ea;
  font-size: 12px;
  padding-top: 6px;
  font-weight: 600;
}
.freq-row {
  margin-top: 8px;
  position: relative;
  height: 16px;
  color: #8ebdf2;
  font-size: 12px;
  font-weight: 600;
  overflow: hidden;
}
.freq-row span {
  white-space: nowrap;
}
.pregain-row {
  margin-top: 12px;
  display: grid;
  grid-template-columns: 1fr 80px;
  gap: 10px;
  align-items: end;
}
.pregain-row label { color: #2d4468; }
.pregain-box {
  background: #fff;
  border: 1px solid #b6c7e3;
  border-radius: 10px;
  text-align: center;
  padding: 7px 6px;
  color: #2d4468;
  font-weight: 700;
}
.band-chip-row {
  margin-top: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.band-chip {
  border: 1px solid #3c6997;
  border-radius: 999px;
  padding: 6px 12px;
  background: linear-gradient(180deg, rgba(26, 45, 73, 0.95), rgba(18, 34, 61, 0.95));
  color: #9ecffc;
  font-weight: 700;
  transition: transform 120ms ease, box-shadow 120ms ease;
}
.band-chip.active {
  background: linear-gradient(180deg, #2dbbff, #3b74ff);
  color: #f7fdff;
  border-color: #58d4ff;
  box-shadow: 0 0 0 1px rgba(94, 206, 255, 0.52), 0 10px 22px rgba(36, 133, 255, 0.35);
}
.band-chip:active {
  transform: translateY(1px);
}
.eq-table {
  margin-top: 12px;
  border: 1px solid #32597f;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(16, 31, 54, 0.95), rgba(12, 24, 45, 0.95));
  overflow-x: auto;
  overflow-y: hidden;
  box-shadow: inset 0 1px 0 rgba(140, 207, 255, 0.2);
}
.eq-table-head,
.eq-table-row {
  min-width: 680px;
}
.eq-table-head,
.eq-table-row {
  display: grid;
  grid-template-columns: 60px 80px 1fr 1fr 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
}
.eq-table-head {
  background: linear-gradient(180deg, rgba(37, 69, 106, 0.95), rgba(30, 57, 90, 0.95));
  font-weight: 600;
  color: #d0ecff;
}
.eq-table-row + .eq-table-row { border-top: 1px solid rgba(77, 126, 176, 0.42); }
.eq-table-row span { color: #e8f5ff; }
.eq-cell {
  display: grid;
  gap: 4px;
  min-width: 0;
}
.eq-cell-label {
  display: none;
  color: #6482ac;
  font-size: 10px;
  font-weight: 700;
  line-height: 1.1;
}
.eq-cell-value {
  color: #f3f9ff;
  font-weight: 700;
}
.eq-table-row select,
.eq-table-row input {
  width: 100%;
  border: 1px solid #3a628f;
  border-radius: 9px;
  padding: 7px 10px;
  color: #d9ecff;
  background: linear-gradient(180deg, rgba(20, 38, 64, 0.96), rgba(13, 28, 50, 0.95));
}

.dynamics-wrap {
  display: grid;
  gap: 12px;
}
.dyn-card {
  border: 1px solid #2f537b;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(16, 31, 54, 0.95), rgba(12, 24, 44, 0.95));
  padding: 10px;
}
.dyn-card h4 {
  margin: 0 0 5px;
  color: #a9d8ff;
  font-size: 14px;
}
.dyn-faders {
  display: grid;
  grid-template-columns: repeat(6, minmax(92px, 1fr));
  gap: 12px;
  align-items: start;
  justify-items: center;
  justify-content: center;
  padding: 8px 6px;
  border: 1px solid rgba(80, 164, 235, 0.55);
  border-radius: 14px;
  background:
    radial-gradient(120% 92% at 50% 0%, rgba(54, 154, 236, 0.2), transparent 64%),
    linear-gradient(180deg, rgba(14, 31, 56, 0.98) 0%, rgba(10, 23, 42, 0.98) 60%, rgba(8, 18, 34, 0.98) 100%);
  box-shadow:
    inset 0 1px 0 rgba(141, 213, 255, 0.2),
    inset 0 -6px 14px rgba(0, 0, 0, 0.42),
    0 8px 20px rgba(2, 10, 24, 0.46);
  overflow: hidden;
}
.dsp-runtime-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding: 8px 10px;
  border: 1px solid rgba(75, 166, 235, 0.45);
  border-radius: 10px;
  background: rgba(10, 28, 51, 0.78);
  color: #bfe5ff;
  font-size: 12px;
  font-weight: 700;
}
.dsp-runtime-header .tiny-toggle {
  flex: 0 0 auto;
}
.shared-dsp-note {
  color: #bfe5ff;
  font-size: 13px;
  line-height: 1.55;
}
.dyn-fader {
  display: grid;
  grid-template-rows: auto 1fr;
  justify-items: center;
  gap: 8px;
  color: #1e446b;
  font-size: 12px;
  font-weight: 700;
  padding: 8px 6px 6px;
  border: 1px solid #9fd2ea;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(234, 250, 255, 0.85));
  width: 100%;
  max-width: 174px;
  min-height: 455px;
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    0 2px 8px rgba(56, 126, 156, 0.18);
}
.dyn-card-eq .dyn-fader {
  border: 0;
  background: transparent;
  box-shadow: none;
  border-radius: 0;
}
.dyn-card-eq .dyn-fader-rail {
  border: 0;
  background: transparent;
  box-shadow: none;
}
.dyn-fader-value {
  justify-self: center;
  margin-top: 4px;
  padding: 3px 10px;
  border: 1px solid #8fb0d4;
  border-radius: 10px;
  background: linear-gradient(180deg, #f4f9ff 0%, #d7e5f5 100%);
  color: #0a1d33 !important;
  font-size: 13px;
  font-weight: 900 !important;
  letter-spacing: 0.2px;
  text-shadow: none !important;
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 1px 2px rgba(8, 19, 36, 0.25);
}
.dyn-card-eq .dyn-fader-value {
  border: 1px solid rgba(91, 181, 244, 0.62);
  background: linear-gradient(180deg, rgba(16, 37, 66, 0.98), rgba(10, 25, 47, 0.98));
  color: #f3fbff !important;
  -webkit-text-fill-color: #f3fbff !important;
  box-shadow:
    inset 0 1px 0 rgba(167, 226, 255, 0.16),
    0 0 10px rgba(52, 161, 247, 0.24);
}
.dyn-card:not(.dyn-card-eq) .dyn-fader .dyn-fader-value {
  color: #0a1d33 !important;
  -webkit-text-fill-color: #0a1d33 !important;
}
.dyn-card-eq .dyn-fader .dyn-fader-value {
  color: #f6fdff !important;
  -webkit-text-fill-color: #f6fdff !important;
  text-shadow: 0 0 9px rgba(72, 188, 255, 0.32) !important;
}
.dyn-fader > span {
  display: block;
  width: 100%;
  text-align: center;
  justify-self: center;
  color: #2f5f8e;
  letter-spacing: 0.5px;
  text-shadow: none;
  font-size: 13px;
}
.dyn-card-eq .dyn-fader > span {
  color: #d6eeff;
  text-shadow: 0 0 10px rgba(52, 161, 247, 0.18);
}
.dyn-fader-rail {
  position: relative;
  width: 88%;
  max-width: 116px;
  height: 390px;
  border-radius: 10px;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.65), rgba(255,255,255,0.2)),
    linear-gradient(180deg, #bce8f8 0%, #a7def3 100%);
  border: 1px solid rgba(122, 184, 213, 0.65);
  overflow: hidden;
  margin-top: 2px;
}
.dyn-fader input[type="range"] {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-90deg);
  transform-origin: center center;
  width: 360px;
  height: 28px;
  margin: 0;
}
.dyn-fader input[type="range"]::-webkit-slider-runnable-track {
  height: 12px;
  border-radius: 2px;
  background: linear-gradient(90deg, #3f7298 0%, #4a88b6 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 0 rgba(20, 56, 88, 0.35),
    inset 0 0 0 1px rgba(107, 157, 196, 0.45);
}
.dyn-card-eq .dyn-fader input[type="range"]::-webkit-slider-runnable-track {
  background: linear-gradient(90deg, #112f52 0%, #1b4c7c 58%, #2576b6 100%);
  box-shadow:
    inset 0 1px 0 rgba(160, 219, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.46),
    inset 0 0 0 1px rgba(84, 170, 235, 0.48);
}
.dyn-fader input[type="range"]::-webkit-slider-thumb {
  width: 34px;
  height: 20px;
  margin-top: -4px;
  border-radius: 2px;
  border: 1px solid #8fb5d8;
  background: linear-gradient(180deg, #f2f8ff 0%, #d7e8fa 35%, #9ebfdf 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.75),
    0 1px 3px rgba(7, 17, 33, 0.5);
}
.dyn-card-eq .dyn-fader input[type="range"]::-webkit-slider-thumb {
  border: 1px solid #b8edff;
  background: linear-gradient(180deg, #f2fdff 0%, #93deff 45%, #4cb6ff 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    0 0 0 2px rgba(74, 188, 255, 0.3),
    0 2px 8px rgba(2, 11, 23, 0.66);
}
.dyn-fader input[type="range"]::-moz-range-track {
  height: 12px;
  border-radius: 2px;
  background: linear-gradient(90deg, #3f7298 0%, #4a88b6 100%);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.25),
    inset 0 -1px 0 rgba(20, 56, 88, 0.35),
    inset 0 0 0 1px rgba(107, 157, 196, 0.45);
}
.dyn-card-eq .dyn-fader input[type="range"]::-moz-range-track {
  background: linear-gradient(90deg, #112f52 0%, #1b4c7c 58%, #2576b6 100%);
  box-shadow:
    inset 0 1px 0 rgba(160, 219, 255, 0.18),
    inset 0 -1px 0 rgba(0, 0, 0, 0.46),
    inset 0 0 0 1px rgba(84, 170, 235, 0.48);
}
.dyn-fader input[type="range"]::-moz-range-thumb {
  width: 34px;
  height: 20px;
  border: 1px solid #8fb5d8;
  border-radius: 2px;
  background: linear-gradient(180deg, #f2f8ff 0%, #d7e8fa 35%, #9ebfdf 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.75),
    0 1px 3px rgba(7, 17, 33, 0.5);
}
.dyn-card-eq .dyn-fader input[type="range"]::-moz-range-thumb {
  border: 1px solid #b8edff;
  background: linear-gradient(180deg, #f2fdff 0%, #93deff 45%, #4cb6ff 100%);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,0.9),
    0 0 0 2px rgba(74, 188, 255, 0.3),
    0 2px 8px rgba(2, 11, 23, 0.66);
}

.drc-layout {
  display: grid;
  grid-template-columns: 1.45fr 1fr;
  gap: 10px;
  align-items: stretch;
}
.drc-graph {
  border: 1px solid #3b6693;
  border-radius: 8px;
  background:
    repeating-linear-gradient(to right, rgba(120, 155, 208, 0.14) 0 1px, transparent 1px 12.5%),
    repeating-linear-gradient(to top, rgba(120, 155, 208, 0.14) 0 1px, transparent 1px 12.5%),
    linear-gradient(180deg, #182d52 0%, #142646 55%, #10203c 100%);
  height: 455px;
  min-height: 455px;
  max-height: 455px;
  padding: 5px;
}
.drc-graph svg {
  width: 100%;
  height: 100%;
}
.drc-axis {
  stroke: #7fb8f2;
  stroke-width: 0.72;
}
.drc-ref {
  stroke: #74c7ff;
  stroke-width: 0.65;
  stroke-dasharray: 2.2 2.2;
  opacity: 0.85;
}
#drc-curve,
#drc-curve-r {
  fill: none;
  stroke: #47d1ff;
  stroke-width: 0.85;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 2px rgba(122, 184, 255, 0.45));
}
.drc-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 8px;
  align-content: start;
}
.drc-controls label {
  color: #8ebce9;
  font-size: 12px;
  font-weight: 600;
}
.drc-controls label input,
.drc-controls label select {
  margin-top: 1px;
  height: 28px;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid #3b628f;
  background: linear-gradient(180deg, rgba(20, 38, 64, 0.96), rgba(13, 28, 50, 0.95));
  box-shadow: none;
  color: #d8ebff;
  opacity: 1;
}
.drc-label {
  fill: #bfe6ff;
  font-size: 3.8px;
  font-weight: 700;
}
.drc-tick {
  fill: #90c4f5;
  font-size: 3.2px;
  font-weight: 600;
}
.drc-tick-x {
  text-anchor: middle;
}
.drc-tick-y {
  text-anchor: end;
}
.drc-controls label input:disabled,
.drc-controls label select:disabled {
  opacity: 1;
  color: #19345a;
  background: #ffffff;
  cursor: not-allowed;
}
.eq-zero-line {
  position: absolute;
  left: 0;
  right: 0;
  top: 50%;
  height: 1px;
  background: rgba(178, 211, 255, 0.52);
  pointer-events: none;
}
.eq-graph svg {
  width: 100%;
  height: 100%;
}
.eq-graph polyline,
.eq-graph path {
  fill: none;
  stroke: #7bb8ff;
  stroke-width: 0.6;
  vector-effect: non-scaling-stroke;
  stroke-linecap: round;
  stroke-linejoin: round;
  filter: drop-shadow(0 0 2px rgba(82, 153, 255, 0.55));
}
#eq-points-l .eq-point-core,
#eq-points-r .eq-point-core,
#eq-points-sub .eq-point-core,
#eq-points-mic1 .eq-point-core,
#eq-points-mic2 .eq-point-core,
#eq-points-mic .eq-point-core {
  fill: #ffd84a;
  stroke: #8b5a00;
  stroke-width: 1.1;
  vector-effect: non-scaling-stroke;
  filter: drop-shadow(0 0 5px rgba(255, 206, 65, 0.85));
}
#eq-points-l .eq-point-hit,
#eq-points-r .eq-point-hit,
#eq-points-sub .eq-point-hit,
#eq-points-mic1 .eq-point-hit,
#eq-points-mic2 .eq-point-hit,
#eq-points-mic .eq-point-hit {
  fill: transparent;
  stroke: transparent;
  stroke-width: 0;
  cursor: grab;
  touch-action: none;
  pointer-events: all;
}
#eq-points-l .eq-point-hit.dragging + .eq-point-core,
#eq-points-r .eq-point-hit.dragging + .eq-point-core,
#eq-points-sub .eq-point-hit.dragging + .eq-point-core,
#eq-points-mic1 .eq-point-hit.dragging + .eq-point-core,
#eq-points-mic2 .eq-point-hit.dragging + .eq-point-core {
  fill: #ffe884;
  cursor: grabbing;
}
.eq-point-tag {
  fill: #ecf7ff;
  paint-order: stroke;
  stroke: rgba(7, 14, 26, 0.88);
  stroke-width: 0.48;
  vector-effect: non-scaling-stroke;
  pointer-events: none;
  letter-spacing: 0.015em;
}
.eq-point-tag-title {
  font-size: 1.34px;
  font-weight: 700;
}
.eq-point-tag-sub {
  font-size: 1.2px;
  font-weight: 600;
  fill: #d4ecff;
}

.eq-sliders {
  display: grid;
  grid-template-columns: repeat(9, minmax(0, 1fr));
  gap: 8px;
}
.eq-sliders label {
  text-align: center;
  font-size: 12px;
  color: #4f6180;
}
.eq-sliders input[type="range"] {
  transform: rotate(-90deg);
  width: 70px;
  margin: 30px auto 20px;
  padding: 0;
}

.meter {
  height: 14px;
  border-radius: 999px;
  overflow: hidden;
  border: 1px solid #b8c4d9;
  background: #ecf2fc;
}
.meter span {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #22c89a, #4da2ff);
}

.note {
  color: var(--muted);
  padding: 16px;
  border: 1px dashed #b7c4d8;
  border-radius: 12px;
  background: #fff;
}

.row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.connect-row {
  justify-content: center;
  flex: 1;
  align-items: center;
}
#btn-ble-toggle {
  min-height: 128px;
  width: min(100%, 460px);
  padding: 24px 36px;
  border-radius: 20px;
  font-size: 36px;
  font-weight: 700;
}
.ble-link-state {
  margin: 0;
  padding-top: 12px;
  border-top: 1px solid rgba(86, 168, 239, 0.28);
  text-align: center;
  font-size: 15px;
  font-weight: 600;
  color: #9dc8ef;
}
.ble-link-state.ok {
  color: #8ff1c9;
}
.ble-link-state.bad {
  color: #ffb5c5;
}
.system-log-card h3 {
  margin-bottom: 10px;
}
.system-log-actions {
  justify-content: flex-end;
  margin-bottom: 8px;
}
#btn-log-clear {
  min-height: 34px;
  padding: 6px 12px;
  border-radius: 10px;
  font-weight: 700;
}
.rx-log-box {
  margin: 0;
  min-height: 220px;
  max-height: 320px;
  overflow: auto;
  padding: 10px 12px;
  border: 1px solid #2f527c;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(8, 20, 38, 0.96), rgba(7, 16, 31, 0.96));
  color: #b7f0d2;
  font-size: 12px;
  line-height: 1.45;
  font-family: Consolas, "Courier New", monospace;
  white-space: pre-wrap;
  word-break: break-word;
  box-shadow: inset 0 0 0 1px rgba(102, 199, 255, 0.14);
}
.mt-10 { margin-top: 10px; }
.bottom-bar {
  position: fixed;
  left: 12px;
  right: 12px;
  bottom: 10px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border: 1px solid #335a86;
  border-radius: 14px;
  background: rgba(11, 22, 41, 0.93);
  backdrop-filter: blur(8px);
  box-shadow: 0 16px 30px rgba(3, 9, 21, 0.65), inset 0 1px 0 rgba(89, 174, 238, 0.25);
}

.pwa-bar {
  position: fixed;
  left: 14px;
  right: 14px;
  bottom: 78px;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px;
  border: 1px solid #3a638f;
  border-radius: 12px;
  background: linear-gradient(180deg, rgba(19, 37, 63, 0.95), rgba(13, 26, 47, 0.95));
  box-shadow: 0 12px 24px rgba(3, 9, 20, 0.62), inset 0 1px 0 rgba(104, 192, 255, 0.22);
}
.pwa-bar.is-hidden {
  display: none !important;
}
.pwa-text {
  color: #b7ddff;
  font-weight: 600;
  font-size: 14px;
}
.pwa-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.pwa-install-btn,
.pwa-close-btn {
  border-radius: 10px;
  padding: 8px 12px;
  font-weight: 700;
}
.pwa-install-btn {
  color: #f5fcff;
  background: linear-gradient(120deg, #1f63e6, #2ec5ff);
  border: 1px solid #58d4ff;
}
.pwa-close-btn {
  color: #abd8ff;
  background: linear-gradient(180deg, rgba(21, 41, 69, 0.95), rgba(15, 29, 52, 0.95));
  border: 1px solid #3c6996;
}
.save-btn {
  min-width: 84px;
  font-weight: 600;
  color: #f5fcff;
  background: linear-gradient(120deg, #1f64e8, #39cbff);
  border-color: #5bd9ff;
  box-shadow: 0 10px 20px rgba(26, 139, 245, 0.35);
}
.bottom-status {
  display: flex;
  gap: 8px;
  align-items: center;
}

@media (max-width: 1279px) {
  body {
    font-size: 16px;
  }
  .topbar {
    gap: 9px 12px;
    padding: 10px 12px;
  }
  .topbar h1 {
    font-size: 28px;
  }
  .topbar p {
    font-size: 13px;
  }
  .topbar-panel-title {
    font-size: 17px;
    padding: 5px 12px;
  }
  .status-wrap {
    gap: 6px;
  }
  .chip {
    padding: 4px 8px;
    font-size: 10px;
  }
  .tab {
    font-size: 18px;
    padding: 10px 11px;
  }
  main {
    padding: 14px;
  }
  h2 {
    font-size: 30px;
  }
  summary {
    font-size: 24px;
  }
  .grid.two,
  .grid.three,
  .drc-layout {
    grid-template-columns: 1fr;
  }
  .eq-chart {
    grid-template-columns: 58px 1fr;
    gap: 8px;
  }
  .db-axis {
    font-size: 11px;
  }
  .eq-graph.v41 {
    height: 300px;
  }
  .eq-table-head,
  .eq-table-row {
    min-width: 680px;
  }
  .dyn-faders {
    grid-template-columns: repeat(3, minmax(140px, 1fr));
    gap: 10px;
  }
  .dyn-fader {
    max-width: none;
    min-height: 400px;
  }
  .dyn-fader-rail {
    height: 330px;
    max-width: 110px;
  }
  .dyn-fader input[type="range"] {
    width: 306px;
  }
  .drc-graph {
    height: 320px;
    min-height: 320px;
    max-height: 320px;
  }
}

@media (max-width: 762px) {
  html,
  body {
    overflow-x: hidden;
  }
  body {
    font-size: 14px;
    padding-bottom: 76px;
  }
  .topbar {
    border-radius: 0 0 14px 14px;
    grid-template-columns: 1fr;
    align-items: stretch;
    gap: 7px;
    padding: 9px 10px;
  }
  .topbar-left,
  .status-wrap {
    width: 100%;
  }
  .topbar-left {
    align-items: center;
  }
  .topbar h1 {
    font-size: 22px;
  }
  .topbar p {
    font-size: 11px;
  }
  .topbar-panel-title {
    margin-top: 0;
    font-size: 16px;
    padding: 5px 10px;
  }
  .status-wrap {
    justify-content: flex-start;
  }
  .chip {
    font-size: 9px;
    padding: 3px 6px;
  }
  .sidebar {
    width: min(52vw, 260px);
    padding-top: 54px;
  }
  .sidebar-close-btn {
    top: 12px;
    left: 11px;
    width: 30px;
    height: 30px;
    font-size: 14px;
    border-radius: 9px;
  }
  .tab {
    font-size: 15px;
    border-radius: 10px;
    padding: 9px 11px;
  }
  main {
    padding: 10px 8px 12px;
  }
  h2 {
    font-size: 22px;
    margin-bottom: 8px;
  }
  summary {
    font-size: 16px;
    margin-bottom: 7px;
  }
  .card {
    padding: 9px;
    border-radius: 12px;
  }
  .sub-segment-toggle {
    min-height: 46px;
    padding: 7px 9px;
    gap: 8px;
    border-radius: 12px;
  }
  .sub-segment-knob {
    top: 4px;
    left: 4px;
    width: calc(50% - 6px);
    height: calc(100% - 8px);
  }
  .sub-segment-label {
    font-size: 12px;
  }
  .sub-segment-state {
    font-size: 10px;
  }
  .mic-fx-card .dyn-fader {
    min-height: 234px;
  }
  .mic-fx-card .dyn-fader-rail {
    height: 166px;
  }
  .mic-fx-card .dyn-fader input[type="range"] {
    width: 156px;
  }
  .mic-fx-card .dyn-faders.fx-four {
    grid-template-columns: repeat(4, minmax(74px, 1fr));
  }
  .tiny-toggle {
    min-width: 78px;
    height: 30px;
    padding: 2px;
  }
  .tiny-toggle-knob {
    width: 22px;
    height: 22px;
    top: 3px;
    left: 3px;
  }
  .tiny-toggle[aria-pressed="true"] .tiny-toggle-knob {
    transform: translateX(50px);
  }
  #connect .card {
    min-height: 360px;
    padding: 22px 14px 18px;
  }
  #btn-ble-toggle {
    min-height: 108px;
    width: min(100%, 380px);
    font-size: 31px;
    padding: 20px 24px;
  }
  .block-grid,
  .grid,
  .dynamics-wrap,
  .drc-controls {
    gap: 12px;
  }
  .output-control-card .grid {
    max-width: none;
    margin: 0;
  }
  .output-control-card label {
    grid-template-columns: minmax(0, 1fr) auto;
    row-gap: 6px;
    column-gap: 8px;
    align-items: center;
  }
  .output-control-card label > input[type="range"] {
    grid-column: 1 / -1;
    grid-row: 2;
  }
  .output-control-card .range-live-value {
    grid-column: 2;
    grid-row: 1;
    justify-self: end;
    min-width: 52px;
  }
  .eq-panel {
    padding: 8px;
  }
  .eq-chart {
    grid-template-columns: 42px 1fr;
    gap: 6px;
  }
  .db-axis {
    font-size: 9px;
    padding-top: 4px;
  }
  .eq-graph.v41 {
    height: 205px;
    border-radius: 12px;
  }
  .freq-row {
    height: 14px;
    font-size: 10px;
  }
  .band-chip-row {
    display: grid;
    grid-template-rows: repeat(2, minmax(34px, auto));
    grid-auto-flow: column;
    grid-auto-columns: minmax(58px, 1fr);
    gap: 6px;
    overflow: hidden;
  }
  .band-chip {
    width: 100%;
    padding: 6px 4px;
    font-size: 12px;
    text-align: center;
  }
  .eq-table {
    overflow: hidden;
    border: 0;
    background: transparent;
    box-shadow: none;
  }
  .eq-table-head {
    min-width: 0;
    display: grid;
    grid-template-columns: 36px 56px minmax(72px, 1fr) minmax(58px, 0.9fr) minmax(52px, 0.8fr);
    gap: 4px;
    padding: 4px 2px 6px;
    background: transparent;
    color: #5f7ea7;
    font-size: 9px;
    font-weight: 700;
  }
  .eq-table-row {
    min-width: 0;
    grid-template-columns: 36px 56px minmax(72px, 1fr) minmax(58px, 0.9fr) minmax(52px, 0.8fr);
    gap: 4px;
    padding: 6px 2px;
    border: 0;
    border-radius: 0;
    background: transparent;
  }
  .eq-table-row + .eq-table-row {
    border-top: 1px solid #d4e1f1;
    margin-top: 0;
    padding-top: 8px;
  }
  .eq-cell-label {
    display: none;
  }
  .eq-cell-band {
    grid-column: auto;
    display: block;
    padding-bottom: 0;
    border-bottom: 0;
  }
  .eq-cell-band .eq-cell-value {
    font-size: 12px;
    font-weight: 800;
    color: #dff3ff;
    line-height: 30px;
  }
  .eq-table-row select,
  .eq-table-row input {
    height: 28px;
    padding: 4px 5px;
    font-size: 10px;
    border-radius: 8px;
  }
  .dyn-card-eq {
    padding: 6px 4px;
  }
  .dyn-faders {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    align-items: start;
    justify-items: center;
    gap: 4px;
    padding: 6px 4px;
    overflow: hidden;
    border-radius: 12px;
    border: 1px solid rgba(80, 164, 235, 0.55);
    background:
      radial-gradient(120% 92% at 50% 0%, rgba(54, 154, 236, 0.22), transparent 64%),
      linear-gradient(180deg, rgba(14, 31, 56, 0.98) 0%, rgba(10, 23, 42, 0.98) 60%, rgba(8, 18, 34, 0.98) 100%);
    box-shadow:
      inset 0 1px 0 rgba(141, 213, 255, 0.2),
      inset 0 -5px 12px rgba(0, 0, 0, 0.42),
      0 8px 18px rgba(2, 10, 24, 0.42);
  }
  .dyn-fader {
    gap: 4px;
    padding: 6px 2px 4px;
    min-height: 234px;
    border-radius: 9px;
    width: 100%;
    max-width: none;
    flex: none;
  }
  .dyn-fader > span {
    font-size: 9px;
    letter-spacing: 0.1px;
  }
  .dyn-fader-rail {
    width: 100%;
    max-width: 36px;
    height: 166px;
  }
  .dyn-fader input[type="range"] {
    width: 156px;
    height: 18px;
  }
  .dyn-fader input[type="range"]::-webkit-slider-thumb {
    width: 16px;
    height: 12px;
    margin-top: 0;
  }
  .dyn-fader input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 12px;
  }
  .dyn-fader-value {
    padding: 2px 5px;
    font-size: 10px;
  }
  .drc-graph {
    height: 240px;
    min-height: 240px;
    max-height: 240px;
  }
  .drc-controls label {
    font-size: 10px;
  }
  .drc-controls label input,
  .drc-controls label select {
    height: 30px;
    font-size: 12px;
  }
  .pwa-bar {
    left: 10px;
    right: 10px;
    bottom: 70px;
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }
  .pwa-actions {
    justify-content: flex-end;
  }
  .bottom-bar {
    left: 8px;
    right: 8px;
    bottom: 8px;
    height: 54px;
    padding: 7px 9px;
    border-radius: 12px;
  }
  .bottom-status {
    gap: 6px;
  }
}

@media (max-width: 420px) {
  .topbar-panel-title {
    font-size: 15px;
    padding: 4px 10px;
  }
  .topbar h1 {
    font-size: 24px;
  }
  .topbar p {
    font-size: 12px;
  }
  main,
  .panel,
  .card,
  .eq-panel,
  .eq-chart,
  .dynamics-wrap,
  .dyn-card,
  .drc-layout {
    min-width: 0;
  }
  main {
    padding: 8px;
  }
  .card {
    padding: 9px;
  }
  .eq-panel {
    padding: 8px;
  }
  .eq-chart {
    grid-template-columns: 34px minmax(0, 1fr);
    gap: 4px;
  }
  .db-axis {
    font-size: 8px;
  }
  .freq-row {
    font-size: 9px;
  }
  .band-chip-row {
    grid-auto-columns: minmax(54px, 1fr);
    gap: 5px;
  }
  .band-chip {
    padding: 5px 3px;
    font-size: 11px;
  }
  .eq-table-head,
  .eq-table-row {
    grid-template-columns: 32px 52px minmax(64px, 1fr) minmax(52px, 0.9fr) minmax(48px, 0.8fr);
    gap: 3px;
  }
  .eq-table-row select,
  .eq-table-row input {
    height: 26px;
    padding: 2px 3px;
    font-size: 10px;
  }
  .sub-segment-toggle {
    min-height: 42px;
    padding: 6px 8px;
  }
  .sub-segment-knob {
    top: 3px;
    left: 3px;
    width: calc(50% - 5px);
    height: calc(100% - 6px);
  }
  .sub-segment-label {
    font-size: 11px;
  }
  .sub-segment-state {
    font-size: 9px;
  }
  .mic-fx-card .dyn-fader {
    min-height: 214px;
  }
  .mic-fx-card .dyn-fader-rail {
    height: 150px;
  }
  .mic-fx-card .dyn-fader input[type="range"] {
    width: 140px;
  }
  .mic-fx-card .dyn-faders.fx-four {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .tiny-toggle {
    min-width: 70px;
    height: 28px;
    padding: 2px;
  }
  .tiny-toggle-knob {
    width: 18px;
    height: 18px;
    top: 3px;
    left: 3px;
  }
  .tiny-toggle[aria-pressed="true"] .tiny-toggle-knob {
    transform: translateX(44px);
  }
  #connect .card {
    min-height: 320px;
    padding: 18px 12px 14px;
  }
  #btn-ble-toggle {
    min-height: 96px;
    width: min(100%, 320px);
    font-size: 28px;
    padding: 16px 18px;
  }
  .ble-link-state {
    font-size: 14px;
  }
  .dyn-fader {
    min-height: 214px;
    padding: 5px 1px 4px;
  }
  .dyn-fader-rail {
    max-width: 30px;
    height: 150px;
  }
  .dyn-fader input[type="range"] {
    width: 140px;
    height: 16px;
  }
  .dyn-fader input[type="range"]::-webkit-slider-thumb {
    width: 14px;
    height: 10px;
    margin-top: 1px;
  }
  .dyn-fader input[type="range"]::-moz-range-thumb {
    width: 14px;
    height: 10px;
  }
  .dyn-fader > span {
    font-size: 8.5px;
  }
  .dyn-fader-value {
    font-size: 9px;
    padding: 1px 4px;
  }
  .bottom-bar {
    height: 56px;
  }
}

/* ========================================================================== */
/* 2026-08-31 Calm light interface                                            */
/* ========================================================================== */

:root {
  color-scheme: light;
  --bg: #eef3f7;
  --surface: #ffffff;
  --surface-2: #f7fafc;
  --surface-3: #edf3f6;
  --line: #d7e1e7;
  --line-strong: #bdccd5;
  --text: #263640;
  --muted: #6f838f;
  --accent: #3f9f91;
  --accent-strong: #318679;
  --accent-soft: rgba(63, 159, 145, 0.12);
  --blue: #568eb8;
  --danger: #c95f70;
  --shadow-card: 0 8px 24px rgba(61, 82, 96, 0.08);
  --glow: 0 0 0 3px rgba(63, 159, 145, 0.15);
}

html {
  background: var(--bg);
  scrollbar-color: #aebfc9 #edf2f5;
}

body {
  color: var(--text);
  background:
    radial-gradient(900px 480px at 8% -10%, rgba(111, 178, 193, 0.13), transparent 64%),
    linear-gradient(180deg, #f7fafc 0%, #edf3f7 100%);
}

body::before {
  opacity: 0.32;
  background:
    linear-gradient(rgba(91, 127, 145, 0.055) 1px, transparent 1px),
    linear-gradient(90deg, rgba(91, 127, 145, 0.055) 1px, transparent 1px);
}

::selection {
  color: #173630;
  background: #c7ebe4;
}

.topbar {
  border-bottom-color: rgba(111, 137, 151, 0.2);
  background: rgba(250, 252, 253, 0.9);
  box-shadow: 0 8px 24px rgba(67, 87, 99, 0.08);
}

.topbar-panel-title {
  color: #30434e;
}

.icon-btn,
.sidebar-close-btn {
  border-color: #cbd8df;
  color: #45616f;
  background: #ffffff;
}

.icon-btn:hover,
.sidebar-close-btn:hover {
  border-color: #83bdb4;
  color: #287c70;
  background: #f2faf8;
}

.sidebar-backdrop {
  background: rgba(56, 72, 82, 0.28);
}

.sidebar {
  border-right-color: #d5e0e6;
  background: linear-gradient(180deg, #fbfcfd 0%, #f0f5f8 100%);
  box-shadow: 18px 0 48px rgba(61, 79, 90, 0.16);
}

.sidebar::before {
  content: "ĐIỀU KHIỂN DSP";
  color: #78909d;
}

.tab {
  color: #607580;
}

.tab:hover {
  border-color: #d7e4e8;
  color: #344b57;
  background: #f0f6f8;
}

.tab.active {
  border-color: rgba(63, 159, 145, 0.28);
  color: #276f65;
  background: rgba(63, 159, 145, 0.11);
}

.tab.active::before {
  box-shadow: none;
}

.card,
details.card,
details.card[open] {
  border-color: #dce5ea;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow-card);
}

details.card:hover {
  border-color: #c7d6de;
}

h2,
h3,
summary,
details[open] > summary {
  color: #2d414c;
}

summary::after {
  content: "⌄";
  color: #8297a2;
}

details[open] > summary::after {
  color: var(--accent);
}

label,
.output-control-card label,
.drc-controls label {
  color: #617681;
}

.output-control-card {
  background:
    linear-gradient(100deg, rgba(63, 159, 145, 0.07), transparent 48%),
    rgba(255, 255, 255, 0.96);
}

.output-control-card summary {
  color: #2e5f59;
}

select,
input[type="text"],
input[type="number"],
button {
  border-color: var(--line-strong);
  color: #30444f;
  background: #fbfdfe;
}

select:hover,
input[type="text"]:hover,
input[type="number"]:hover {
  border-color: #95abb7;
}

button:hover {
  border-color: #78b4aa;
  color: #246f64;
  background: #f1faf8;
}

.range-live-value,
.output-control-card .range-live-value,
.dyn-card-eq .dyn-fader-value,
.dyn-card-eq .dyn-fader .dyn-fader-value {
  border-color: rgba(63, 159, 145, 0.27);
  color: #28796e !important;
  -webkit-text-fill-color: #28796e !important;
  background: #eff9f7;
}

.eq-panel,
.dyn-card,
.dyn-faders,
.eq-table {
  border-color: #dce5ea;
  background: #f8fafb;
}

.eq-graph,
.eq-graph.v41,
.drc-graph {
  border-color: #d3dfe5;
  background:
    repeating-linear-gradient(to right, rgba(101, 132, 148, 0.1) 0 1px, transparent 1px 11%),
    repeating-linear-gradient(to top, rgba(101, 132, 148, 0.1) 0 1px, transparent 1px 20%),
    linear-gradient(180deg, #ffffff 0%, #f4f8fa 100%);
}

.db-axis,
.freq-row {
  color: #708793;
}

.eq-zero-line {
  background: rgba(74, 135, 177, 0.42);
}

.eq-graph polyline,
.eq-graph path {
  stroke: #4f8fb8;
  filter: none;
}

.band-chip {
  border-color: #cfdae0;
  color: #657b87;
  background: #f6f9fa;
}

.band-chip.active {
  border-color: rgba(63, 159, 145, 0.48);
  color: #28786d;
  background: #eaf7f4;
}

.eq-table-head,
.dsp-runtime-header {
  border-color: #dbe4e9;
  color: #617681;
  background: #edf3f6;
}

.eq-table-row + .eq-table-row {
  border-top-color: #e2e9ed;
}

.eq-table-row span,
.eq-cell-value {
  color: #405762;
}

.eq-table-row select,
.eq-table-row input,
.drc-controls label input,
.drc-controls label select {
  border-color: #ccd9df;
  color: #354b56;
  background: #ffffff;
}

.dyn-fader,
.dyn-card-eq .dyn-fader {
  color: #465e69;
  background: #edf3f5;
}

.dyn-fader > span,
.dyn-card-eq .dyn-fader > span {
  color: #607783;
}

.dyn-fader-rail,
.dyn-card-eq .dyn-fader-rail {
  background: #e3ebef;
  box-shadow: inset 0 0 0 1px #d4e0e5;
}

.tiny-toggle,
.sub-segment-toggle {
  border-color: #c7d4db;
  background: #e8eef1;
}

.tiny-toggle-knob {
  background: #9aabb4;
}

.tiny-toggle[aria-pressed="true"] {
  border-color: rgba(63, 159, 145, 0.5);
  background: #dff2ee;
}

.tiny-toggle[aria-pressed="true"] .tiny-toggle-knob {
  background: #4cae9f;
}

.sub-segment-label {
  color: #718590;
}

.sub-segment-label.is-active {
  color: #28776c;
}

.shared-dsp-note,
.system-note {
  color: #687d88;
  background: rgba(63, 159, 145, 0.055);
}

/* Dải an toàn hiển thị nhẹ dưới mỗi ô để người mới biết nên nhập bao nhiêu. */
.control-range-hint {
  grid-column: 1 / -1;
  display: block;
  margin-top: -2px;
  color: #82929a;
  font-size: 10px;
  font-weight: 500;
  line-height: 1.25;
  letter-spacing: .01em;
}
.eq-cell > .control-range-hint {
  grid-column: 1;
  text-align: left;
}

.system-control-card {
  display: flex;
  min-height: 228px;
  flex-direction: column;
  gap: 14px;
}

.system-control-card h3,
.system-control-card p {
  margin: 0;
}

.system-control-card label {
  display: grid;
  gap: 8px;
}

.system-control-card select,
.reset-defaults-btn {
  width: 100%;
  min-height: 46px;
}

.system-note {
  padding: 10px 12px;
  border-left: 3px solid #8dc7be;
  border-radius: 7px;
  font-size: 13px;
  line-height: 1.5;
}

.reset-card {
  border-color: #e5d9dc;
}

.reset-defaults-btn {
  margin-top: auto;
  border-color: #d8aab2;
  color: #a7485a;
  background: #fff7f8;
  font-weight: 750;
}

.reset-defaults-btn:hover {
  border-color: #c77b89;
  color: #94394b;
  background: #fff0f3;
}

.reset-defaults-btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.save-note {
  border-left-color: #8fb2c8;
  background: #f2f7fa;
}

#connect .card {
  border-color: #d5e5e2;
  background:
    radial-gradient(500px 260px at 50% 35%, rgba(63, 159, 145, 0.08), transparent 70%),
    rgba(255, 255, 255, 0.96);
}

#btn-ble-toggle {
  border-color: #72b6ab;
  color: #ffffff;
  background: #4b9f92;
  box-shadow: 0 12px 24px rgba(58, 125, 115, 0.16);
}

#btn-ble-toggle:hover {
  color: #ffffff;
  background: #3f8f83;
}

.ble-link-state {
  border-top-color: #dfe7eb;
  color: #70848f;
}

.ble-link-state.ok {
  color: #2f8477;
}

.ble-link-state.bad {
  color: #b45465;
}

.rx-log-box {
  border-color: #cad8de;
  color: #315f59;
  background: #f3f8f8;
}

.bottom-bar {
  border-color: rgba(164, 181, 191, 0.46);
  background: rgba(250, 252, 253, 0.93);
  box-shadow: 0 12px 30px rgba(59, 78, 90, 0.14);
}

.save-btn {
  border-color: #66aa9f;
  color: #ffffff;
  background: #4b9f92;
}

.save-btn:hover {
  color: #ffffff;
  background: #3f8f83;
}

.chip {
  border-color: #cbd7de;
  color: #657985;
  background: #f4f7f9;
}

.chip.ok {
  border-color: #9dcfc2;
  color: #28786b;
  background: #eaf7f3;
}

.chip.warn {
  border-color: #dcc384;
  color: #8b6815;
  background: #fff8e8;
}

.chip.bad {
  border-color: #e1a9b4;
  color: #aa4a5d;
  background: #fff1f4;
}

.pwa-bar {
  border-color: #b9d8d2;
  background: rgba(250, 252, 253, 0.97);
}

.pwa-text {
  color: #617681;
}

@media (max-width: 762px) {
  .system-control-card {
    min-height: 0;
  }

  .system-control-card select,
  .reset-defaults-btn {
    min-height: 44px;
  }
}

/* ========================================================================== */
/* Visual refresh v10                                                         */
/* CSS-only skin: control IDs, DOM structure and BLE behavior stay unchanged. */
/* ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #0b1119;
  --surface: #121b26;
  --surface-2: #0f1721;
  --surface-3: #172332;
  --line: #273749;
  --line-strong: #36506a;
  --text: #edf4f7;
  --muted: #95a8b8;
  --accent: #55c7b4;
  --accent-strong: #36ad9a;
  --accent-soft: rgba(85, 199, 180, 0.14);
  --blue: #69a9e8;
  --danger: #f07288;
  --radius: 16px;
  --shadow-card: 0 12px 30px rgba(0, 0, 0, 0.22);
  --glow: 0 0 0 3px rgba(85, 199, 180, 0.15);
  --font-ui: "Segoe UI Variable Text", "Segoe UI", Inter, system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Noto Sans", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", Inter, system-ui, -apple-system, BlinkMacSystemFont, Roboto, "Noto Sans", Arial, sans-serif;
}

html {
  background: var(--bg);
  scrollbar-color: #41566c #0b121b;
}

body {
  color: var(--text);
  font-size: 16px;
  line-height: 1.5;
  background:
    radial-gradient(900px 520px at 8% -12%, rgba(53, 114, 151, 0.16), transparent 62%),
    radial-gradient(720px 440px at 102% 4%, rgba(46, 132, 116, 0.1), transparent 60%),
    linear-gradient(180deg, #0d141e 0%, #0a1018 100%);
  padding-bottom: 92px;
}

body::before {
  opacity: 0.28;
  background:
    linear-gradient(rgba(123, 157, 184, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(123, 157, 184, 0.06) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: linear-gradient(to bottom, #000 0%, transparent 78%);
}

::selection {
  color: #061411;
  background: #7cdfce;
}

.topbar {
  min-height: 64px;
  padding: 10px clamp(12px, 3vw, 28px);
  border: 0;
  border-bottom: 1px solid rgba(101, 133, 157, 0.22);
  border-radius: 0;
  background: rgba(11, 17, 25, 0.9);
  backdrop-filter: blur(18px) saturate(120%);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.2);
}

.topbar-left {
  width: min(1180px, 100%);
  margin: 0 auto;
  gap: 12px;
}

.topbar-panel-title {
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: #f3f8fa;
  font-size: clamp(17px, 2vw, 20px);
  font-weight: 680;
  letter-spacing: 0.01em;
  box-shadow: none;
}

.icon-btn,
.sidebar-close-btn {
  border: 1px solid var(--line);
  color: #d8e5eb;
  background: #151f2b;
  box-shadow: none;
}

.icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  font-size: 21px;
}

.icon-btn:hover,
.sidebar-close-btn:hover {
  border-color: rgba(85, 199, 180, 0.65);
  color: #effbf8;
  background: #192934;
  box-shadow: 0 0 0 3px rgba(85, 199, 180, 0.09);
}

.sidebar-backdrop {
  background: rgba(2, 7, 12, 0.62);
  backdrop-filter: blur(3px);
}

.sidebar {
  width: min(82vw, 292px);
  padding: 70px 14px 18px;
  border-right: 1px solid var(--line);
  background: linear-gradient(180deg, #111a25 0%, #0d151f 100%);
  box-shadow: 18px 0 54px rgba(0, 0, 0, 0.34);
}

.sidebar::before {
  content: "DSP CONTROL";
  position: absolute;
  top: 23px;
  left: 62px;
  color: #8498a8;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.16em;
}

.sidebar-close-btn {
  top: 15px;
  left: 14px;
  width: 36px;
  height: 36px;
  border-radius: 11px;
}

.tab {
  position: relative;
  margin-bottom: 6px;
  padding: 11px 13px 11px 17px;
  border: 1px solid transparent;
  border-radius: 11px;
  color: #9fb0bd;
  background: transparent;
  font-size: 16px;
  font-weight: 650;
  box-shadow: none;
}

.tab::before {
  content: "";
  position: absolute;
  left: 5px;
  top: 50%;
  width: 3px;
  height: 18px;
  border-radius: 99px;
  background: transparent;
  transform: translateY(-50%);
}

.tab:hover {
  border-color: rgba(99, 132, 157, 0.2);
  color: #d9e5ea;
  background: rgba(102, 139, 166, 0.08);
  box-shadow: none;
}

.tab.active {
  border-color: rgba(85, 199, 180, 0.26);
  color: #eafffb;
  background: rgba(85, 199, 180, 0.12);
  box-shadow: none;
}

.tab.active::before {
  background: var(--accent);
  box-shadow: 0 0 12px rgba(85, 199, 180, 0.4);
}

main {
  width: min(1180px, 100%);
  padding: 24px clamp(12px, 2.5vw, 26px) 28px;
}

.block-grid,
.grid,
.dynamics-wrap {
  gap: 16px;
}

.card {
  padding: 18px;
  border: 1px solid rgba(91, 119, 141, 0.25);
  border-radius: var(--radius);
  background: rgba(18, 27, 38, 0.92);
  box-shadow: var(--shadow-card);
}

details.card,
details.card[open] {
  box-shadow: var(--shadow-card);
}

details.card:hover {
  border-color: rgba(111, 146, 172, 0.36);
}

summary {
  position: relative;
  display: flex;
  align-items: center;
  min-height: 30px;
  margin-bottom: 14px;
  padding-right: 28px;
  color: #dce8ed;
  font-size: clamp(17px, 2vw, 21px);
  font-weight: 680;
  letter-spacing: 0.005em;
  list-style: none;
}

summary::-webkit-details-marker {
  display: none;
}

summary::marker {
  content: "";
}

summary::after {
  content: "⌄";
  position: absolute;
  right: 2px;
  top: 1px;
  color: #8296a6;
  font-size: 21px;
  font-weight: 500;
  transition: transform 160ms ease, color 160ms ease;
}

details[open] > summary {
  color: #f0f6f8;
}

details[open] > summary::after {
  color: var(--accent);
  transform: rotate(180deg);
}

h3 {
  color: #e5eef2;
  font-size: clamp(18px, 2vw, 22px);
  letter-spacing: 0.005em;
}

label,
.output-control-card label,
.drc-controls label {
  color: #9fb1bf;
  font-weight: 600;
}

.output-control-card {
  background:
    linear-gradient(100deg, rgba(85, 199, 180, 0.075), transparent 44%),
    rgba(18, 27, 38, 0.94);
}

.output-control-card summary {
  color: #dff7f2;
}

.range-live-value,
.output-control-card .range-live-value,
.dyn-card-eq .dyn-fader-value,
.dyn-card-eq .dyn-fader .dyn-fader-value {
  border: 1px solid rgba(85, 199, 180, 0.28);
  border-radius: 8px;
  color: #dcfaf4 !important;
  -webkit-text-fill-color: #dcfaf4 !important;
  background: rgba(85, 199, 180, 0.09);
  text-shadow: none !important;
  box-shadow: none;
}

select,
input[type="text"],
input[type="number"],
button {
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  color: #e8f0f4;
  background: #172331;
  box-shadow: none;
}

select:hover,
input[type="text"]:hover,
input[type="number"]:hover {
  border-color: #49647c;
}

select:focus,
input[type="text"]:focus,
input[type="number"]:focus,
button:focus-visible {
  outline: none;
  border-color: var(--accent);
  box-shadow: var(--glow);
}

button:hover {
  border-color: rgba(85, 199, 180, 0.65);
  background: #1a2a35;
  box-shadow: none;
}

input[type="range"]::-webkit-slider-runnable-track,
.output-control-card input[type="range"]::-webkit-slider-runnable-track {
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #28434b 0%, #398879 52%, #55c7b4 100%);
  box-shadow: inset 0 0 0 1px rgba(135, 177, 177, 0.16);
}

input[type="range"]::-moz-range-track,
.output-control-card input[type="range"]::-moz-range-track {
  height: 7px;
  border-radius: 999px;
  background: linear-gradient(90deg, #28434b 0%, #398879 52%, #55c7b4 100%);
  box-shadow: inset 0 0 0 1px rgba(135, 177, 177, 0.16);
}

input[type="range"]::-webkit-slider-thumb,
.output-control-card input[type="range"]::-webkit-slider-thumb {
  width: 24px;
  height: 24px;
  margin-top: -8px;
  border: 2px solid #c8f4eb;
  border-radius: 50%;
  background: #49bba7;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.34);
}

input[type="range"]::-moz-range-thumb,
.output-control-card input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 22px;
  border: 2px solid #c8f4eb;
  border-radius: 50%;
  background: #49bba7;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.34);
}

.eq-panel {
  padding: 14px;
  border: 1px solid rgba(93, 124, 148, 0.25);
  border-radius: 14px;
  background: #0e1721;
  box-shadow: none;
}

.eq-chart {
  grid-template-columns: 58px minmax(0, 1fr);
  gap: 10px;
}

.eq-graph,
.eq-graph.v41 {
  height: 300px;
  border: 1px solid #25384a;
  border-radius: 12px;
  background:
    repeating-linear-gradient(to right, rgba(148, 178, 201, 0.075) 0 1px, transparent 1px 11%),
    repeating-linear-gradient(to top, rgba(148, 178, 201, 0.075) 0 1px, transparent 1px 20%),
    linear-gradient(180deg, #111e2b 0%, #0d1721 100%);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.025);
}

.db-axis,
.freq-row {
  color: #7f95a7;
}

.eq-zero-line {
  background: rgba(102, 169, 218, 0.5);
}

.eq-graph polyline,
.eq-graph path {
  stroke: #71b3ed;
  filter: drop-shadow(0 0 3px rgba(79, 155, 220, 0.32));
}

.band-chip-row {
  gap: 7px;
}

.band-chip {
  min-width: 46px;
  padding: 6px 11px;
  border: 1px solid #304356;
  border-radius: 9px;
  color: #91a7b8;
  background: #141f2b;
  box-shadow: none;
}

.band-chip.active {
  border-color: rgba(85, 199, 180, 0.54);
  color: #e7fffa;
  background: rgba(85, 199, 180, 0.15);
  box-shadow: none;
}

.eq-table {
  border: 1px solid rgba(93, 124, 148, 0.25);
  border-radius: 12px;
  background: #111a25;
  box-shadow: none;
}

.eq-table-head {
  color: #9eb1bf;
  background: #182431;
}

.eq-table-row + .eq-table-row {
  border-top-color: rgba(93, 124, 148, 0.2);
}

.eq-table-row span,
.eq-cell-value {
  color: #dce7ec;
}

.eq-table-row select,
.eq-table-row input {
  border-color: #2e4256;
  color: #e0eaf0;
  background: #111c28;
}

.dyn-card {
  padding: 12px;
  border: 1px solid rgba(93, 124, 148, 0.25);
  border-radius: 14px;
  background: #0f1823;
}

.dsp-runtime-header {
  padding: 9px 11px;
  border: 1px solid rgba(93, 124, 148, 0.24);
  border-radius: 10px;
  color: #a9bbc7;
  background: #131f2b;
  font-weight: 600;
}

.dyn-faders {
  gap: 8px;
  padding: 10px 8px;
  border: 1px solid rgba(93, 124, 148, 0.22);
  border-radius: 12px;
  background: #0c151f;
  box-shadow: none;
}

.dyn-fader,
.dyn-card-eq .dyn-fader {
  min-height: 342px;
  max-width: 160px;
  padding: 8px 5px 6px;
  border: 0;
  border-radius: 9px;
  color: #c8d6dd;
  background: rgba(33, 49, 63, 0.46);
  box-shadow: none;
}

.dyn-fader > span,
.dyn-card-eq .dyn-fader > span {
  min-height: 34px;
  color: #a8bac6;
  font-size: 11px;
  line-height: 1.25;
  letter-spacing: 0.01em;
  text-shadow: none;
}

.dyn-fader-rail,
.dyn-card-eq .dyn-fader-rail {
  width: 58px;
  height: 256px;
  border: 0;
  border-radius: 8px;
  background: #101b27;
  box-shadow: inset 0 0 0 1px rgba(91, 119, 141, 0.18);
}

.dyn-fader input[type="range"] {
  width: 232px;
  height: 22px;
}

.dyn-fader input[type="range"]::-webkit-slider-runnable-track,
.dyn-card-eq .dyn-fader input[type="range"]::-webkit-slider-runnable-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #274a49, #4bbba6);
  box-shadow: inset 0 0 0 1px rgba(143, 209, 196, 0.16);
}

.dyn-fader input[type="range"]::-moz-range-track,
.dyn-card-eq .dyn-fader input[type="range"]::-moz-range-track {
  height: 8px;
  border-radius: 999px;
  background: linear-gradient(90deg, #274a49, #4bbba6);
  box-shadow: inset 0 0 0 1px rgba(143, 209, 196, 0.16);
}

.dyn-fader input[type="range"]::-webkit-slider-thumb,
.dyn-card-eq .dyn-fader input[type="range"]::-webkit-slider-thumb {
  width: 24px;
  height: 16px;
  margin-top: -4px;
  border: 1px solid #c8f4eb;
  border-radius: 5px;
  background: #52c5b1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.dyn-fader input[type="range"]::-moz-range-thumb,
.dyn-card-eq .dyn-fader input[type="range"]::-moz-range-thumb {
  width: 22px;
  height: 14px;
  border: 1px solid #c8f4eb;
  border-radius: 5px;
  background: #52c5b1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.35);
}

.drc-layout {
  gap: 14px;
}

.drc-graph {
  height: 360px;
  min-height: 360px;
  max-height: 360px;
  border: 1px solid #2a3d50;
  border-radius: 11px;
  background:
    repeating-linear-gradient(to right, rgba(127, 158, 184, 0.09) 0 1px, transparent 1px 12.5%),
    repeating-linear-gradient(to top, rgba(127, 158, 184, 0.09) 0 1px, transparent 1px 12.5%),
    #101b27;
}

.drc-controls {
  gap: 10px;
}

.drc-controls label input,
.drc-controls label select {
  height: 38px;
  padding: 7px 9px;
  border: 1px solid #2e4357;
  border-radius: 9px;
  color: #e0e9ee;
  background: #141f2b;
}

.tiny-toggle {
  min-width: 76px;
  height: 32px;
  border: 1px solid #34495d;
  background: #111b26;
  box-shadow: none;
}

.tiny-toggle-knob {
  width: 24px;
  height: 24px;
  border: 0;
  background: #6f8494;
  box-shadow: none;
}

.tiny-toggle[aria-pressed="true"] {
  border-color: rgba(85, 199, 180, 0.55);
  background: rgba(85, 199, 180, 0.16);
  box-shadow: none;
}

.tiny-toggle[aria-pressed="true"] .tiny-toggle-knob {
  transform: translateX(42px);
  border: 0;
  background: #76d9c8;
  box-shadow: 0 0 0 3px rgba(85, 199, 180, 0.12);
}

.sub-segment-toggle {
  border-color: #30475b;
  background: #111c28;
  box-shadow: none;
}

.sub-segment-knob {
  border-color: rgba(85, 199, 180, 0.5);
  background: rgba(85, 199, 180, 0.22);
  box-shadow: none;
}

.sub-segment-label {
  color: #879ba9;
}

.sub-segment-label.is-active {
  color: #e8fbf7;
  text-shadow: none;
}

.shared-dsp-note {
  border-left: 3px solid var(--accent);
  color: #a9bbc7;
  background: rgba(85, 199, 180, 0.06);
}

#connect .card {
  min-height: 380px;
  padding: 28px;
  border-color: rgba(85, 199, 180, 0.2);
  background:
    radial-gradient(500px 260px at 50% 35%, rgba(85, 199, 180, 0.09), transparent 70%),
    rgba(18, 27, 38, 0.94);
}

#btn-ble-toggle {
  min-height: 104px;
  border: 1px solid rgba(85, 199, 180, 0.55);
  border-radius: 16px;
  color: #eafffb;
  background: #17453f;
  font-size: clamp(25px, 4vw, 32px);
  box-shadow: 0 14px 28px rgba(0, 0, 0, 0.18);
}

#btn-ble-toggle:hover {
  background: #1b554c;
}

.ble-link-state {
  border-top-color: rgba(93, 124, 148, 0.2);
  color: #94a8b7;
}

.ble-link-state.ok {
  color: #79d8c7;
}

.ble-link-state.bad {
  color: #f194a5;
}

.rx-log-box {
  border: 1px solid #25394b;
  border-radius: 11px;
  color: #a9dccd;
  background: #09121a;
  box-shadow: none;
}

.bottom-bar {
  left: max(12px, env(safe-area-inset-left));
  right: max(12px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  height: 62px;
  padding: 8px 11px;
  border: 1px solid rgba(92, 122, 145, 0.3);
  border-radius: 15px;
  background: rgba(14, 22, 31, 0.92);
  backdrop-filter: blur(18px) saturate(120%);
  box-shadow: 0 14px 38px rgba(0, 0, 0, 0.34);
}

.save-btn {
  min-width: 102px;
  min-height: 42px;
  border-color: rgba(85, 199, 180, 0.62);
  color: #edfffb;
  background: #21675c;
  font-weight: 750;
  box-shadow: none;
}

.save-btn:hover {
  background: #26776a;
}

.chip {
  padding: 5px 9px;
  border: 1px solid #34495c;
  color: #9fb0bd;
  background: #131e29;
  font-size: 10px;
  box-shadow: none;
}

.chip.ok {
  border-color: rgba(85, 199, 180, 0.4);
  color: #75d7c5;
  background: rgba(85, 199, 180, 0.1);
}

.chip.warn {
  border-color: rgba(235, 190, 103, 0.42);
  color: #e8c77e;
  background: rgba(235, 190, 103, 0.1);
}

.chip.bad {
  border-color: rgba(240, 114, 136, 0.42);
  color: #f39aae;
  background: rgba(240, 114, 136, 0.1);
}

.pwa-bar {
  border-color: rgba(85, 199, 180, 0.34);
  background: rgba(17, 28, 38, 0.96);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.3);
}

.pwa-text {
  color: #b3c3cc;
}

.pwa-install-btn {
  border-color: rgba(85, 199, 180, 0.55);
  color: #eafffb;
  background: #21675c;
}

.pwa-close-btn {
  border-color: #354b5e;
  color: #a9bbc6;
  background: #172330;
}

@media (max-width: 1279px) {
  main {
    padding: 18px 14px 24px;
  }

  .eq-graph.v41 {
    height: 270px;
  }

  .dyn-faders {
    grid-template-columns: repeat(4, minmax(92px, 1fr));
  }

  .dyn-fader,
  .dyn-card-eq .dyn-fader {
    min-height: 320px;
  }

  .dyn-fader-rail,
  .dyn-card-eq .dyn-fader-rail {
    height: 236px;
  }

  .dyn-fader input[type="range"] {
    width: 214px;
  }

  .drc-graph {
    height: 300px;
    min-height: 300px;
    max-height: 300px;
  }
}

@media (max-width: 762px) {
  body {
    font-size: 14px;
    padding-bottom: 80px;
  }

  .topbar {
    min-height: 58px;
    padding: 8px 10px;
    border-radius: 0;
  }

  .topbar-panel-title {
    font-size: 16px;
  }

  .icon-btn {
    width: 40px;
    height: 40px;
  }

  .sidebar {
    width: min(78vw, 278px);
  }

  .tab {
    padding: 10px 12px 10px 17px;
    font-size: 15px;
  }

  main {
    padding: 12px 8px 18px;
  }

  .block-grid,
  .grid,
  .dynamics-wrap {
    gap: 10px;
  }

  .card {
    padding: 11px;
    border-radius: 13px;
  }

  summary {
    min-height: 26px;
    margin-bottom: 10px;
    font-size: 16px;
  }

  .eq-panel {
    padding: 8px;
  }

  .eq-chart {
    grid-template-columns: 38px minmax(0, 1fr);
    gap: 5px;
  }

  .eq-graph.v41 {
    height: 218px;
  }

  .band-chip-row {
    grid-template-rows: repeat(2, minmax(32px, auto));
    grid-auto-columns: minmax(54px, 1fr);
  }

  .band-chip {
    min-width: 0;
    border-radius: 8px;
  }

  .eq-table-head,
  .eq-table-row {
    color: #8ea2b0;
  }

  .eq-table-row + .eq-table-row {
    border-top-color: rgba(93, 124, 148, 0.2);
  }

  .dyn-card,
  .dyn-card-eq {
    padding: 7px;
  }

  .dyn-faders,
  .mic-fx-card .dyn-faders.fx-four,
  .mic-fx-card .dyn-faders.fx-six {
    grid-template-columns: repeat(4, minmax(62px, 1fr));
    gap: 5px;
    padding: 7px 5px;
    overflow: visible;
  }

  .dyn-fader,
  .dyn-card-eq .dyn-fader,
  .mic-fx-card .dyn-fader {
    min-height: 238px;
    padding: 6px 2px 5px;
    background: rgba(33, 49, 63, 0.36);
  }

  .dyn-fader > span,
  .dyn-card-eq .dyn-fader > span {
    min-height: 29px;
    font-size: 9px;
  }

  .dyn-fader-rail,
  .dyn-card-eq .dyn-fader-rail,
  .mic-fx-card .dyn-fader-rail {
    width: 34px;
    max-width: 34px;
    height: 164px;
  }

  .dyn-fader input[type="range"],
  .mic-fx-card .dyn-fader input[type="range"] {
    width: 146px;
    height: 18px;
  }

  .dyn-fader-value {
    padding: 2px 5px;
    font-size: 9px;
  }

  .dsp-runtime-header {
    gap: 8px;
    padding: 7px 8px;
    font-size: 10px;
  }

  .drc-layout {
    gap: 10px;
  }

  .drc-graph {
    height: 230px;
    min-height: 230px;
    max-height: 230px;
  }

  .drc-controls {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }

  #connect .card {
    min-height: 330px;
    padding: 20px 13px;
  }

  #btn-ble-toggle {
    min-height: 94px;
    font-size: 27px;
  }

  .bottom-bar {
    left: 8px;
    right: 8px;
    bottom: max(7px, env(safe-area-inset-bottom));
    height: 58px;
    border-radius: 14px;
  }

  .save-btn {
    min-width: 88px;
    min-height: 40px;
  }
}

@media (max-width: 420px) {
  .eq-chart {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .eq-graph.v41 {
    height: 200px;
  }

  .dyn-faders,
  .mic-fx-card .dyn-faders.fx-four,
  .mic-fx-card .dyn-faders.fx-six {
    grid-template-columns: repeat(3, minmax(66px, 1fr));
  }

  .dyn-fader,
  .dyn-card-eq .dyn-fader,
  .mic-fx-card .dyn-fader {
    min-height: 224px;
  }

  .dyn-fader-rail,
  .dyn-card-eq .dyn-fader-rail,
  .mic-fx-card .dyn-fader-rail {
    height: 150px;
  }

  .dyn-fader input[type="range"],
  .mic-fx-card .dyn-fader input[type="range"] {
    width: 134px;
  }

  .tiny-toggle {
    min-width: 70px;
    height: 28px;
  }

  .tiny-toggle-knob {
    width: 20px;
    height: 20px;
  }

  .tiny-toggle[aria-pressed="true"] .tiny-toggle-knob {
    transform: translateX(42px);
  }

  .bottom-status {
    gap: 5px;
  }

  .chip {
    padding: 4px 6px;
    font-size: 9px;
  }
}

/* Final light-theme authority: keep this block last. */
:root {
  color-scheme: light;
  --bg: #eef3f7;
  --surface: #ffffff;
  --surface-2: #f7fafc;
  --surface-3: #edf3f6;
  --line: #d7e1e7;
  --line-strong: #bdccd5;
  --text: #263640;
  --muted: #6f838f;
  --accent: #3f9f91;
  --accent-strong: #318679;
  --accent-soft: rgba(63, 159, 145, 0.12);
  --danger: #c95f70;
  --shadow-card: 0 8px 24px rgba(61, 82, 96, 0.08);
  --glow: 0 0 0 3px rgba(63, 159, 145, 0.15);
}

html { background: var(--bg); scrollbar-color: #aebfc9 #edf2f5; }
body {
  color: var(--text);
  background: radial-gradient(900px 480px at 8% -10%, rgba(111, 178, 193, 0.13), transparent 64%), linear-gradient(180deg, #f7fafc, #edf3f7);
}
.topbar { border-bottom-color: #dce5ea; background: rgba(250, 252, 253, 0.92); box-shadow: 0 8px 24px rgba(67, 87, 99, 0.08); }
.topbar-panel-title { color: #30434e; }
.icon-btn, .sidebar-close-btn { border-color: #cbd8df; color: #45616f; background: #fff; }
.sidebar { border-right-color: #d5e0e6; background: linear-gradient(180deg, #fbfcfd, #f0f5f8); box-shadow: 18px 0 48px rgba(61, 79, 90, 0.16); }
.sidebar::before { content: "ĐIỀU KHIỂN DSP"; color: #78909d; }
.tab { color: #607580; }
.tab:hover { border-color: #d7e4e8; color: #344b57; background: #f0f6f8; }
.tab.active { border-color: rgba(63, 159, 145, 0.28); color: #276f65; background: rgba(63, 159, 145, 0.11); }
.card, details.card, details.card[open] { border-color: #dce5ea; background: rgba(255,255,255,.95); box-shadow: var(--shadow-card); }
h2, h3, summary, details[open] > summary { color: #2d414c; }
summary::after { content: "⌄"; color: #8297a2; }
label, .output-control-card label, .drc-controls label { color: #617681; }
.output-control-card { background: linear-gradient(100deg, rgba(63,159,145,.07), transparent 48%), #fff; }
.output-control-card summary { color: #2e5f59; }
select, input[type="text"], input[type="number"], button { border-color: var(--line-strong); color: #30444f; background: #fbfdfe; }
.range-live-value, .output-control-card .range-live-value, .dyn-card-eq .dyn-fader-value { border-color: rgba(63,159,145,.27); color: #28796e !important; -webkit-text-fill-color: #28796e !important; background: #eff9f7; }
.eq-panel, .dyn-card, .dyn-faders, .eq-table { border-color: #dce5ea; background: #f8fafb; }
.eq-graph, .eq-graph.v41, .drc-graph { border-color: #d3dfe5; background: repeating-linear-gradient(to right, rgba(101,132,148,.1) 0 1px, transparent 1px 11%), repeating-linear-gradient(to top, rgba(101,132,148,.1) 0 1px, transparent 1px 20%), linear-gradient(180deg, #fff, #f4f8fa); }
.db-axis, .freq-row { color: #708793; }
.band-chip { border-color: #cfdae0; color: #657b87; background: #f6f9fa; }
.band-chip.active { border-color: rgba(63,159,145,.48); color: #28786d; background: #eaf7f4; }
.eq-table-head, .dsp-runtime-header { border-color: #dbe4e9; color: #617681; background: #edf3f6; }
.eq-table-row select, .eq-table-row input, .drc-controls label input, .drc-controls label select { border-color: #ccd9df; color: #354b56; background: #fff; }
.dyn-fader, .dyn-card-eq .dyn-fader { color: #465e69; background: #edf3f5; }
.dyn-fader > span, .dyn-card-eq .dyn-fader > span { color: #607783; }
.dyn-fader-rail, .dyn-card-eq .dyn-fader-rail { background: #e3ebef; box-shadow: inset 0 0 0 1px #d4e0e5; }
.tiny-toggle, .sub-segment-toggle { border-color: #c7d4db; background: #e8eef1; }
.sub-segment-label { color: #718590; }
.sub-segment-label.is-active { color: #28776c; }
#connect .card { border-color: #d5e5e2; background: radial-gradient(500px 260px at 50% 35%, rgba(63,159,145,.08), transparent 70%), #fff; }
#btn-ble-toggle, .save-btn { border-color: #66aa9f; color: #fff; background: #4b9f92; box-shadow: none; }
#btn-ble-toggle:hover, .save-btn:hover { color: #fff; background: #3f8f83; }
.ble-link-state { border-top-color: #dfe7eb; color: #70848f; }
.ble-link-state.ok { color: #2f8477; }
.ble-link-state.bad { color: #b45465; }
.rx-log-box { border-color: #cad8de; color: #315f59; background: #f3f8f8; }
.bottom-bar { border-color: rgba(164,181,191,.46); background: rgba(250,252,253,.94); box-shadow: 0 12px 30px rgba(59,78,90,.14); }
.chip { border-color: #cbd7de; color: #657985; background: #f4f7f9; }
.chip.ok { border-color: #9dcfc2; color: #28786b; background: #eaf7f3; }
.chip.warn { border-color: #dcc384; color: #8b6815; background: #fff8e8; }
.chip.bad { border-color: #e1a9b4; color: #aa4a5d; background: #fff1f4; }

/* Slider do biến trở vật lý điều khiển: vẫn hiển thị giá trị nhưng giảm độ nổi
 * bật để phân biệt với các tham số có thể chỉnh từ giao diện. */
.hardware-owned-control {
  opacity: 0.48;
  filter: saturate(0.65);
  cursor: not-allowed;
}
.hardware-owned-control input[type="range"] {
  cursor: not-allowed;
}
.hardware-owned-note {
  display: block;
  margin-top: 3px;
  color: #74829a;
  font-size: 10px;
  font-weight: 500;
}

/* Visual refresh 2026-09: soft studio-console theme.
 * Layout, IDs and interaction states are intentionally unchanged. */
:root {
  --bg: #f3f6f8;
  --surface: #ffffff;
  --surface-2: #f8fafb;
  --surface-3: #eef3f5;
  --line: #dbe4e8;
  --line-strong: #c5d2d8;
  --text: #263943;
  --muted: #71838d;
  --accent: #278f83;
  --accent-strong: #1f766c;
  --accent-soft: rgba(39, 143, 131, .11);
  --shadow-card: 0 10px 28px rgba(43, 65, 76, .075);
  --shadow-float: 0 14px 34px rgba(43, 65, 76, .13);
}

html { background: var(--bg); }
body {
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(820px 420px at 8% -12%, rgba(84, 177, 165, .12), transparent 68%),
    linear-gradient(180deg, #f9fbfc 0%, #f1f5f7 100%);
  letter-spacing: .01em;
}

.topbar {
  min-height: 64px;
  border-bottom: 1px solid #dce6ea;
  background: rgba(255, 255, 255, .88);
  box-shadow: 0 5px 22px rgba(45, 69, 81, .07);
  backdrop-filter: blur(14px);
}
.topbar-left { gap: 13px; }
.topbar-panel-title { font-size: 16px; font-weight: 720; color: #29404a; }
.icon-btn, .sidebar-close-btn {
  border: 1px solid #cdd9de;
  border-radius: 11px;
  color: #47616b;
  background: #fff;
  box-shadow: 0 2px 8px rgba(54, 77, 87, .05);
}
.icon-btn:hover, .sidebar-close-btn:hover {
  border-color: #9bc9c1;
  color: var(--accent-strong);
  background: #f1faf8;
}

.sidebar {
  width: 238px;
  border-right: 1px solid #dce6ea;
  background: linear-gradient(180deg, #ffffff 0%, #f2f7f8 100%);
  box-shadow: 16px 0 38px rgba(50, 73, 83, .10);
}
.sidebar::before {
  content: "ĐIỀU KHIỂN DSP";
  margin: 5px 8px 12px;
  color: #78909a;
  font-size: 10px;
  font-weight: 760;
  letter-spacing: .15em;
}
.tab {
  min-height: 42px;
  margin: 3px 9px;
  padding: 0 13px;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #637983;
  font-size: 13px;
  font-weight: 610;
  text-align: left;
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}
.tab:hover { border-color: #d4e5e3; color: #315a57; background: #f0f8f7; transform: translateX(1px); }
.tab.active {
  border-color: #b9ddd7;
  color: #1f7168;
  background: linear-gradient(90deg, rgba(39,143,131,.16), rgba(39,143,131,.055));
  box-shadow: inset 3px 0 0 #3aa496;
}
.tab.active::before { background: #3aa496; box-shadow: 0 0 0 4px rgba(58,164,150,.12); }

main {
  max-width: 1420px;
  padding: 28px clamp(16px, 3.2vw, 46px) 92px;
}
.panel > h2 {
  margin: 0 0 19px;
  color: #263f49;
  font-size: clamp(20px, 2.3vw, 27px);
  font-weight: 760;
  letter-spacing: -.025em;
}
.block-grid, .grid { gap: 18px; }
.card, details.card, details.card[open] {
  border: 1px solid #dce6e9;
  border-radius: 15px;
  background: rgba(255,255,255,.94);
  box-shadow: var(--shadow-card);
}
.card { padding: 18px; }
details.card { overflow: hidden; }
details.card > summary {
  padding: 16px 19px;
  border-bottom: 1px solid transparent;
  color: #304952;
  font-size: 14px;
  font-weight: 730;
}
details.card[open] > summary { border-bottom-color: #e6edef; background: linear-gradient(90deg, #fbfdfd, #f6faf9); }
details.card > :not(summary) { padding-left: 19px; padding-right: 19px; }
summary::after { color: #7b929a; }
h3 { color: #304a54; font-size: 14px; font-weight: 720; }
label { color: #607883; font-size: 12px; font-weight: 600; }

select, input[type="text"], input[type="number"] {
  min-height: 36px;
  border: 1px solid #cbd9de;
  border-radius: 9px;
  color: #30454e;
  background: #fcfefe;
  transition: border-color .16s ease, box-shadow .16s ease, background .16s ease;
}
select:focus, input[type="text"]:focus, input[type="number"]:focus {
  border-color: #65afa5;
  outline: none;
  box-shadow: 0 0 0 3px rgba(39,143,131,.13);
  background: #fff;
}
button {
  border-radius: 9px;
  font-weight: 650;
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease, background .16s ease;
}
button:hover { transform: translateY(-1px); }
button:active { transform: translateY(0); }
button:focus-visible, input:focus-visible, select:focus-visible {
  outline: 3px solid rgba(39,143,131,.18);
  outline-offset: 1px;
}

input[type="range"] { accent-color: var(--accent); }
input[type="range"]::-webkit-slider-runnable-track { height: 5px; border-radius: 999px; background: #dce8e8; }
input[type="range"]::-webkit-slider-thumb { width: 17px; height: 17px; margin-top: -6px; border: 3px solid #fff; border-radius: 50%; background: #3aa496; box-shadow: 0 2px 7px rgba(31, 96, 88, .27); }
input[type="range"]::-moz-range-track { height: 5px; border-radius: 999px; background: #dce8e8; }
input[type="range"]::-moz-range-thumb { width: 13px; height: 13px; border: 3px solid #fff; border-radius: 50%; background: #3aa496; box-shadow: 0 2px 7px rgba(31, 96, 88, .27); }
.range-live-value, .output-control-card .range-live-value, .dyn-card-eq .dyn-fader-value {
  min-width: 48px;
  border: 1px solid #bfe0da;
  border-radius: 7px;
  color: #21766c !important;
  -webkit-text-fill-color: #21766c !important;
  background: #eff9f7;
  font-weight: 720;
}

.output-control-card { border-color: #cfe4e0 !important; background: linear-gradient(120deg, rgba(64,168,153,.075), transparent 45%), #fff !important; }
.shared-dsp-note { border-color: #d2e3e4; color: #5d747d; background: #f7fbfb; }
.eq-panel, .dyn-card, .dyn-faders, .eq-table { border-color: #dfe8eb; background: #f8fbfb; }
.eq-graph, .eq-graph.v41, .drc-graph { border-color: #d3e0e4; border-radius: 10px; background-color: #fff; }
.band-chip { border-color: #d0dde1; border-radius: 8px; color: #647b84; background: #f7fafb; }
.band-chip:hover, .band-chip.active { border-color: #83c2b8; color: #236f66; background: #eaf7f4; }
.tiny-toggle, .sub-segment-toggle { border-color: #c9d9dc; background: #e8f0f1; }
.tiny-toggle[aria-pressed="true"], .sub-segment-toggle[aria-pressed="true"] { border-color: #70b8ad; background: #bfe3dc; }

#connect .card { border-color: #cfe5e1; background: radial-gradient(520px 260px at 50% 30%, rgba(62,166,151,.09), transparent 72%), #fff; }
#btn-ble-toggle, .save-btn { min-height: 42px; border: 1px solid #5ca99e; color: #fff; background: linear-gradient(135deg, #3da193, #2c887d); box-shadow: 0 6px 14px rgba(39,143,131,.18); }
#btn-ble-toggle:hover, .save-btn:hover { border-color: #388e83; background: linear-gradient(135deg, #348f83, #23766c); box-shadow: 0 8px 17px rgba(39,143,131,.23); }
.ble-link-state { border-top-color: #e0eaec; color: #74868e; }
.ble-link-state.ok { color: #287e73; }
.ble-link-state.bad { color: #b45868; }
.rx-log-box { border-color: #cfe0e2; border-radius: 9px; color: #315e59; background: #f3f9f8; }
.bottom-bar { border-color: rgba(178,196,201,.65); border-radius: 15px; background: rgba(255,255,255,.92); box-shadow: var(--shadow-float); backdrop-filter: blur(12px); }
.chip { border-radius: 999px; border-color: #d2dfe3; color: #667b83; background: #f6f9fa; }
.chip.ok { border-color: #a7d6cc; color: #28786e; background: #eaf8f4; }
.chip.warn { border-color: #e5d09a; color: #856516; background: #fff9e9; }
.chip.bad { border-color: #e3b1ba; color: #a64c5d; background: #fff2f4; }

.hardware-owned-control { opacity: .46; filter: saturate(.62); }
.hardware-owned-control input[type="range"] { cursor: not-allowed; }
.hardware-owned-note { color: #7a8d94; }

/* Compact range bounds on phone screens; they remain readable but do not
 * compete with the primary control labels. */
@media (max-width: 760px) {
  .control-range-hint { font-size: 8.5px; line-height: 1.15; }
}

@media (max-width: 760px) {
  .topbar { min-height: 58px; }
  main { padding: 20px 13px 86px; }
  .panel > h2 { margin-bottom: 14px; font-size: 21px; }
  .card { padding: 14px; border-radius: 13px; }
  details.card > summary { padding: 14px; }
  details.card > :not(summary) { padding-left: 14px; padding-right: 14px; }
}

/* Connection gate: the DSP workspace is inaccessible until BLE is ready. */
.connect-gate { display: none; }
body.connection-gate-active { padding-bottom: 0; }
body.connection-gate-active .topbar,
body.connection-gate-active .layout { display: none !important; }
body.connection-gate-active .bottom-bar,
body.connection-gate-active .pwa-bar { display: none !important; }
body.connection-gate-active .connect-gate {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 28px 18px;
}
.connect-gate-card {
  width: min(100%, 520px);
  max-width: calc(100vw - 36px);
  min-width: 0;
  padding: clamp(28px, 6vw, 52px) clamp(22px, 6vw, 58px);
  text-align: center;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--surface);
  box-shadow: var(--shadow-card);
  overflow: hidden;
}
.connect-gate-logo { display: block; margin: 0 auto 16px; border-radius: 18px; }
.connect-gate-kicker { margin: 0 0 8px; color: var(--muted); font-size: 11px; font-weight: 750; letter-spacing: .16em; }
.connect-gate-card h1 { margin: 0; color: var(--text); font-size: clamp(26px, 5vw, 36px); }
.connect-gate-description { margin: 12px auto 24px; max-width: 360px; color: var(--muted); line-height: 1.5; }
.connect-gate-button { width: min(100%, 400px); min-width: 0; min-height: 46px; font-size: 16px; font-weight: 750; }
.connect-gate-card .ble-link-state { margin: 18px 0 0; overflow-wrap: anywhere; }
.connect-gate-hint { margin: 18px 0 0; color: var(--muted); font-size: 12px; }
.topbar-connection { margin-left: auto; display: flex; align-items: center; gap: 9px; }
.topbar-ble-state { color: var(--muted); font-size: 12px; font-weight: 700; }
.topbar-ble-state.ok { color: #16866f; }
.topbar-disconnect { min-height: 32px; padding: 0 11px; font-size: 12px; }
.topbar-disconnect:disabled { display: none; }

/* Product UI refinement 2026-09-05.
 * These rules are intentionally appended so they override the older theme
 * experiments above without changing layout hooks used by app.js. */
.app-identity {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex: 0 1 auto;
  min-width: 0;
  color: #2d5e59;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .08em;
  white-space: nowrap;
}
.app-identity img {
  display: block;
  width: 34px;
  height: 34px;
  border: 1px solid #d5e4e3;
  border-radius: 9px;
  object-fit: cover;
  box-shadow: 0 2px 7px rgba(54, 83, 91, .12);
}
.topbar-brand { min-width: 0; }
.topbar-panel-title {
  max-width: min(40vw, 260px);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
details.card:not([open]) > summary { margin-bottom: 0; }
#connect .card { min-height: 250px; }
.dsp-runtime-header > span { line-height: 1.35; }

@media (max-width: 760px) {
  .app-identity { gap: 6px; font-size: 10px; letter-spacing: .05em; }
  .app-identity img { width: 30px; height: 30px; border-radius: 8px; }
  .topbar-panel-title { max-width: 43vw; }
  #connect .card { min-height: 260px; }
}

@media (max-width: 520px) {
  .app-identity span { display: none; }
  .topbar-panel-title { max-width: 55vw; }
  /* Two columns give each mobile fader a usable touch target. */
  .dyn-faders,
  .mic-fx-card .dyn-faders.fx-four,
  .mic-fx-card .dyn-faders.fx-six {
    grid-template-columns: repeat(2, minmax(110px, 1fr));
    gap: 8px;
    padding: 8px 7px;
  }
  .dyn-fader,
  .dyn-card-eq .dyn-fader,
  .mic-fx-card .dyn-fader {
    min-height: 218px;
    padding: 7px 4px 6px;
  }
  .dyn-fader > span,
  .dyn-card-eq .dyn-fader > span {
    min-height: 32px;
    font-size: 10px;
  }
  .dyn-fader-rail,
  .dyn-card-eq .dyn-fader-rail,
  .mic-fx-card .dyn-fader-rail {
    width: 42px;
    max-width: 42px;
    height: 150px;
  }
  .dyn-fader input[type="range"],
  .mic-fx-card .dyn-fader input[type="range"] {
    width: 138px;
  }
  .dyn-fader-value { min-width: 44px; font-size: 10px; }
}

/* Correct UTF-8 labels from an older theme override. */
.sidebar::before { content: "ĐIỀU KHIỂN DSP"; }
summary::after { content: "⌄"; }

/* High-contrast light-theme authority. Older dark-theme declarations remain
 * above for history, so lock all user-facing text to readable light-theme
 * colours here. */
body { color: #172c35; }
.topbar-panel-title,
h2,
h3,
summary,
details[open] > summary { color: #1d343e; }
.app-identity { color: #174f49; }
.tab { color: #354f5a; }
.tab.active { color: #155f57; }
label,
.output-control-card label,
.drc-controls label,
.shared-dsp-note,
.system-note,
.ble-link-state,
.pwa-text { color: #3f5964; }
.db-axis,
.freq-row,
.eq-table-head,
.dsp-runtime-header,
.sub-segment-state { color: #425d68; }
.eq-table-row span,
.eq-cell-value,
.eq-cell-band .eq-cell-value { color: #203943 !important; }
.eq-cell-label { color: #607985 !important; }
.dyn-fader,
.dyn-card-eq .dyn-fader { color: #263f49; }
.dyn-fader > span,
.dyn-card-eq .dyn-fader > span { color: #304b56 !important; }
select,
input[type="text"],
input[type="number"],
.eq-table-row select,
.eq-table-row input,
.drc-controls label input,
.drc-controls label select { color: #18313b; }
.band-chip { color: #405b66; }
.band-chip.active { color: #145f56; }
.range-live-value,
.output-control-card .range-live-value,
.dyn-card-eq .dyn-fader-value { color: #145e56 !important; -webkit-text-fill-color: #145e56 !important; }
.chip { color: #344e59; }
.rx-log-box { color: #1f4f49; }
.hardware-owned-control {
  opacity: 1;
  filter: none;
  color: #4b626d;
}
.hardware-owned-control input[type="range"] { opacity: .52; }
.hardware-owned-note { color: #445c67; }

/* Flatten the nested fader tiles: the surrounding card and the slider rail
 * provide enough separation, so individual faders stay visually light. */
.dyn-faders {
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 8px 4px;
}
.dyn-fader,
.dyn-card-eq .dyn-fader,
.mic-fx-card .dyn-fader {
  border: 0;
  background: transparent;
  box-shadow: none;
}
.dyn-fader-rail,
.dyn-card-eq .dyn-fader-rail,
.mic-fx-card .dyn-fader-rail {
  border: 1px solid #cfdee2;
  background: #e7eff1;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.55);
}
.dyn-card-eq .dyn-fader .dyn-fader-value,
.dyn-card:not(.dyn-card-eq) .dyn-fader .dyn-fader-value {
  border-color: #b8dcd5 !important;
  color: #145e56 !important;
  -webkit-text-fill-color: #145e56 !important;
  background: #eaf7f4 !important;
  text-shadow: none !important;
  box-shadow: none !important;
}
.panel details.card > summary,
.panel details.card[open] > summary {
  color: #1d343e !important;
}
.dyn-card,
.dyn-card-eq {
  border: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding: 4px 0 !important;
}

@media (max-width: 760px) {
  /* Mobile previously inherited a translucent dark fader tile from an older
   * theme. Use an opaque light tile so dark labels remain legible. */
  .dyn-faders,
  .mic-fx-card .dyn-faders.fx-four,
  .mic-fx-card .dyn-faders.fx-six {
    border: 0;
    background: transparent;
    box-shadow: inset 0 0 0 1px rgba(82, 116, 128, .04);
  }
  .dyn-fader,
  .dyn-card-eq .dyn-fader,
.mic-fx-card .dyn-fader { background: transparent; }
}

/* MCU user modes and slow power telemetry (BLE protocol 0x0f/0x10/0x85). */
.system-card-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}
.system-card-heading h3 { margin-bottom: 0; }
.user-mode-status {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-align: right;
}
.user-mode-status[data-state="ok"] { color: #16866f; }
.user-mode-status[data-state="bad"] { color: #b42318; }
.user-mode-status[data-state="pending"] { color: #8a5a00; }
.user-mode-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
}
.user-mode-row {
  min-width: 0;
  padding: 12px;
  border-right: 1px solid var(--line);
}
.user-mode-row:last-child { border-right: 0; }
.user-mode-row strong {
  display: block;
  margin-bottom: 9px;
  color: var(--text);
  font-size: 13px;
}
.user-mode-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  margin-top: 12px;
}
.user-mode-actions button {
  width: 100%;
  min-height: 34px;
  padding: 6px 8px;
  font-size: 11px;
}
.user-mode-actions button.is-active {
  border-color: #16866f;
  color: #0f6b59;
  background: #e8f7f2;
}
.startup-level-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
.startup-level-card > button {
  width: 100%;
  min-height: 38px;
}
.startup-level-card.is-hardware-owned {
  background: #f5f8f9;
}
.startup-level-card.is-hardware-owned select,
.startup-level-card.is-hardware-owned button {
  opacity: .52;
}
.power-status-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--line);
}
.power-status-grid > div {
  min-width: 0;
  padding: 11px 12px;
  background: var(--surface);
}
.power-status-grid dt {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
}
.power-status-grid dd {
  margin: 0;
  color: var(--text);
  font-size: 14px;
  font-weight: 750;
}
.power-status-grid dd[data-state="ok"] { color: #16866f; }
.power-status-grid dd[data-state="bad"] { color: #b42318; }
.power-status-grid dd[data-state="off"] { color: var(--muted); }

@media (max-width: 900px) {
  .user-mode-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .user-mode-row { border-bottom: 1px solid var(--line); }
  .user-mode-row:nth-child(2n) { border-right: 0; }
  .user-mode-row:last-child { border-bottom: 0; }
}
@media (max-width: 520px) {
  .system-card-heading { align-items: flex-start; flex-direction: column; gap: 5px; }
  .user-mode-status { text-align: left; }
  .user-mode-list { grid-template-columns: 1fr; }
  .user-mode-row { border-right: 0; }
  .power-status-grid { grid-template-columns: 1fr; }
  .user-mode-actions { grid-template-columns: 1fr; }
  .startup-level-grid { grid-template-columns: 1fr; }
}
