/* ===== Палитры-пресеты ===== */
/* Регистрируем цвета как настоящие <color>, чтобы браузер умел их плавно анимировать */
@property --c1    { syntax: '<color>'; inherits: true; initial-value: #2ff3ff; }
@property --c2    { syntax: '<color>'; inherits: true; initial-value: #3a6bff; }
@property --c3    { syntax: '<color>'; inherits: true; initial-value: #c45bff; }
@property --body1 { syntax: '<color>'; inherits: true; initial-value: #2f63ff; }
@property --body2 { syntax: '<color>'; inherits: true; initial-value: #0a1a66; }

:root {
  --bg: #04050c;
  --text: #e8f4ff;
  --muted: #8ea3cc;
  --c1: #2ff3ff;   /* основной неон */
  --c2: #3a6bff;   /* глубокий акцент */
  --c3: #c45bff;   /* горячий акцент (пики) */
  --body1: #2f63ff;
  --body2: #0a1a66;
  --bass: 0;
  --font-display: "Russo One", "Exo 2", sans-serif;
  --font-body: "Exo 2", system-ui, sans-serif;
}
body[data-preset="synth"] { --c1: #ff4fe8; --c2: #7b3dff; --c3: #ffd23d; --body1: #8a33ff; --body2: #260a55; }
body[data-preset="toxic"] { --c1: #8dff3a; --c2: #10c4a4; --c3: #f2ff3c; --body1: #149a76; --body2: #05322a; }
body[data-preset="mack"]  { --c1: #ff7040; --c2: #ff2a55; --c3: #ffd23d; --body1: #d8262f; --body2: #46060c; }

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background:
    radial-gradient(90% 60% at 50% 115%, color-mix(in srgb, var(--c2) 22%, transparent), transparent 70%),
    radial-gradient(60% 40% at 50% -10%, color-mix(in srgb, var(--c3) 10%, transparent), transparent 70%),
    var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  overflow: hidden;
  /* Интерфейс перекрашивается чуть позже, когда цветовая волна из центра докатится до краёв */
  transition:
    --c1 .8s ease .3s, --c2 .8s ease .3s, --c3 .8s ease .3s,
    --body1 .9s ease .4s, --body2 .9s ease .4s;
}
body.preload, body.preload * { transition: none !important; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: 0; }
svg { display: block; }
[hidden] { display: none !important; }

.app {
  height: 100vh;
  height: 100dvh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  gap: 14px;
  padding: 14px 20px 30px;
}

/* ===== Шапка ===== */
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 12px; }
.logo { width: 74px; height: 28px; overflow: visible; filter: drop-shadow(0 0 6px var(--c1)); }
.logo .wing { fill: color-mix(in srgb, var(--c2) 35%, transparent); stroke: var(--c1); stroke-width: 2.5; stroke-linejoin: round; }
.logo .fin { stroke: var(--c1); stroke-width: 3; stroke-linecap: round; }
.logo .stripe { stroke: var(--c3); stroke-width: 2; stroke-linecap: round; }
h1 {
  font-family: var(--font-display); font-weight: 400; font-size: 23px;
  letter-spacing: .08em; text-transform: uppercase; line-height: 1;
}
h1 span { color: var(--c1); text-shadow: 0 0 10px var(--c1), 0 0 24px var(--c2); }
.tag { font-size: 12px; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }

.presets { display: flex; gap: 8px; flex-wrap: wrap; }
.presets button {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 14px; border-radius: 999px;
  font-weight: 600; font-size: 14px; letter-spacing: .04em;
  border: 1px solid rgba(255,255,255,.1);
  background: rgba(255,255,255,.04);
  color: var(--muted);
  transition: .2s;
}
.presets button:hover { color: var(--text); border-color: rgba(255,255,255,.25); }
.presets button i { width: 10px; height: 10px; border-radius: 50%; }
.presets [data-preset="neon"] i  { background: #2ff3ff; box-shadow: 0 0 8px #2ff3ff; }
.presets [data-preset="synth"] i { background: #ff4fe8; box-shadow: 0 0 8px #ff4fe8; }
.presets [data-preset="toxic"] i { background: #8dff3a; box-shadow: 0 0 8px #8dff3a; }
.presets [data-preset="mack"] i  { background: #ff7040; box-shadow: 0 0 8px #ff7040; }
.presets button.active {
  color: var(--text);
  border-color: var(--c1);
  box-shadow: 0 0 14px color-mix(in srgb, var(--c1) 35%, transparent), inset 0 0 10px color-mix(in srgb, var(--c1) 15%, transparent);
}

/* ===== Сцена ===== */
.stage {
  position: relative; min-height: 0;
  border-radius: 22px; overflow: hidden;
  background: #03040a;
  border: 1px solid color-mix(in srgb, var(--c1) 22%, transparent);
  box-shadow: 0 0 40px color-mix(in srgb, var(--c2) 18%, transparent), inset 0 0 60px rgba(0,0,0,.6);
}
#viz { position: absolute; inset: 0; width: 100%; height: 100%; }

.hud {
  position: absolute; top: 12px; left: 12px; right: 12px;
  display: flex; justify-content: space-between; align-items: flex-start; gap: 12px;
  pointer-events: none;
  z-index: 2;
}
.hud > * { pointer-events: auto; }
.hud-right { display: flex; align-items: center; gap: 10px; flex: none; }

/* Переключатель режимов */
.modes {
  display: flex; padding: 3px; border-radius: 12px;
  background: rgba(6,10,26,.6);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.1);
  overflow-x: auto; scrollbar-width: none;
  min-width: 0;
}
.modes::-webkit-scrollbar { display: none; }
.modes button {
  padding: 7px 12px; border-radius: 9px; flex: none;
  font-family: var(--font-display); font-size: 11px; letter-spacing: .1em; text-transform: uppercase;
  color: var(--muted); transition: color .2s, background .2s, box-shadow .2s;
}
.modes button:hover { color: var(--text); }
.modes button.active {
  color: #021018; background: var(--c1);
  box-shadow: 0 0 14px color-mix(in srgb, var(--c1) 60%, transparent);
}

/* Темп */
.bpm {
  --pulse: 0;
  display: flex; align-items: baseline; gap: 6px;
  height: 40px; padding: 0 14px; border-radius: 12px;
  align-items: center;
  background: rgba(6,10,26,.6);
  backdrop-filter: blur(8px);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.1);
}
.bpm b { font-family: var(--font-display); font-weight: 400; font-size: 17px; color: var(--c1); min-width: 2.2em; text-align: right; font-variant-numeric: tabular-nums; text-shadow: 0 0 8px var(--c1); }
.bpm span { font-size: 11px; letter-spacing: .2em; color: var(--muted); }
.bpm-dot {
  width: 8px; height: 8px; border-radius: 50%; margin-right: 2px;
  background: var(--c1);
  opacity: calc(.2 + var(--pulse) * .8);
  transform: scale(calc(.8 + var(--pulse) * .5));
  box-shadow: 0 0 calc(var(--pulse) * 14px) var(--c1);
}

.hint {
  position: absolute; left: 16px; bottom: 12px; z-index: 1;
  font-size: 12px; color: var(--muted); opacity: .55; pointer-events: none;
}

.icon-btn {
  position: relative;
  width: 40px; height: 40px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  border: 1px solid rgba(255,255,255,.14);
  background: rgba(8,12,30,.55);
  backdrop-filter: blur(6px);
  transition: .2s;
}
.icon-btn.small { width: 34px; height: 34px; border-radius: 10px; }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn.small svg { width: 16px; height: 16px; }
.icon-btn:hover { border-color: var(--c1); color: var(--c1); box-shadow: 0 0 12px color-mix(in srgb, var(--c1) 40%, transparent); }
.icon-btn.on { color: var(--c1); border-color: color-mix(in srgb, var(--c1) 60%, transparent); box-shadow: inset 0 0 10px color-mix(in srgb, var(--c1) 25%, transparent); }
.icon-btn.off { opacity: .45; }
.repeat-one {
  position: absolute; right: 3px; bottom: 2px;
  font: 700 9px/1 var(--font-body); font-style: normal; color: var(--c1);
  display: none;
}
.icon-btn.one .repeat-one { display: block; }

/* Окно загрузки */
.dropzone {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  background: radial-gradient(circle at 50% 50%, rgba(3,4,10,.35), rgba(3,4,10,.75));
  transition: opacity .35s;
}
.dropzone.hidden { opacity: 0; pointer-events: none; }
.dropzone.drag .drop-card { border-color: var(--c1); transform: scale(1.03); box-shadow: 0 0 50px color-mix(in srgb, var(--c1) 45%, transparent); }
.drop-card {
  text-align: center; padding: 30px 36px; max-width: 420px; margin: 16px;
  border-radius: 22px;
  border: 1.5px dashed color-mix(in srgb, var(--c1) 55%, transparent);
  background: rgba(6,10,28,.7);
  backdrop-filter: blur(8px);
  transition: .25s;
}
.drop-icon {
  width: 60px; height: 60px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center;
  border: 2px solid var(--c1); color: var(--c1);
  box-shadow: 0 0 20px color-mix(in srgb, var(--c1) 50%, transparent);
}
.drop-icon svg { width: 28px; height: 28px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.drop-card h2 { font-family: var(--font-display); font-weight: 400; font-size: 18px; letter-spacing: .1em; text-transform: uppercase; }
.drop-card p { color: var(--muted); margin: 8px 0 18px; font-size: 16px; }
.drop-card small { display: block; margin-top: 14px; color: var(--muted); opacity: .6; letter-spacing: .15em; }
.drop-actions { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; }
.btn-neon {
  padding: 10px 24px; border-radius: 999px;
  font-weight: 700; font-size: 15px; letter-spacing: .08em; text-transform: uppercase;
  color: #021018;
  background: linear-gradient(90deg, var(--c1), color-mix(in srgb, var(--c1) 60%, var(--c3)));
  box-shadow: 0 0 22px color-mix(in srgb, var(--c1) 60%, transparent);
  transition: .2s;
}
.btn-neon:hover { transform: translateY(-1px); box-shadow: 0 0 34px var(--c1); }
.btn-ghost {
  padding: 10px 20px; border-radius: 999px;
  font-weight: 600; font-size: 15px; letter-spacing: .04em;
  border: 1px solid color-mix(in srgb, var(--c1) 45%, transparent);
  color: var(--text);
  transition: .2s;
}
.btn-ghost:hover { border-color: var(--c1); box-shadow: 0 0 16px color-mix(in srgb, var(--c1) 35%, transparent); }

/* ===== Боковая панель ===== */
.drawer {
  position: absolute; top: 62px; right: 12px; bottom: 12px; z-index: 3;
  width: 370px; max-width: calc(100% - 24px);
  display: flex; flex-direction: column;
  border-radius: 18px;
  background: rgba(6,9,24,.86);
  backdrop-filter: blur(16px);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c1) 25%, transparent), 0 20px 50px rgba(0,0,0,.6);
  transform: translateX(calc(100% + 30px));
  opacity: 0;
  transition: transform .45s cubic-bezier(.2,.9,.25,1), opacity .3s;
  overflow: hidden;
}
.drawer.open { transform: none; opacity: 1; }
.drawer-tabs {
  display: flex; align-items: center; gap: 4px;
  padding: 8px 8px 8px 10px;
  border-bottom: 1px solid rgba(255,255,255,.07);
}
.drawer-tabs button[data-tab] {
  padding: 8px 12px; border-radius: 10px;
  font-family: var(--font-display); font-size: 12px; letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); transition: .2s;
}
.drawer-tabs button[data-tab]:hover { color: var(--text); }
.drawer-tabs button[data-tab].active { color: var(--c1); background: color-mix(in srgb, var(--c1) 12%, transparent); }
.drawer-close {
  margin-left: auto; width: 32px; height: 32px; border-radius: 10px;
  display: grid; place-items: center; color: var(--muted);
}
.drawer-close:hover { color: var(--text); background: rgba(255,255,255,.06); }
.drawer-close svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.tab { display: none; flex: 1; min-height: 0; overflow-y: auto; padding: 14px; }
.tab.active { display: flex; flex-direction: column; gap: 14px; }
.tab::-webkit-scrollbar { width: 6px; }
.tab::-webkit-scrollbar-thumb { background: rgba(255,255,255,.15); border-radius: 6px; }

/* Плейлист */
.pl-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.pl-head > span { font-size: 13px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.pl-actions { display: flex; gap: 6px; }
.chip {
  padding: 6px 12px; border-radius: 999px;
  font-size: 13px; font-weight: 600;
  background: color-mix(in srgb, var(--c1) 16%, transparent);
  color: var(--c1);
  transition: .2s;
}
.chip:hover { background: color-mix(in srgb, var(--c1) 26%, transparent); }
.chip.ghost { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px rgba(255,255,255,.12); }
.chip.ghost:hover { color: var(--text); }
.chip.active { background: var(--c1); color: #021018; }

.pl-store { font-size: 12px; color: var(--muted); margin-top: -6px; }
.pl-store.cloud { color: color-mix(in srgb, var(--c1) 75%, var(--muted)); }
.pl-migrate {
  display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap;
  padding: 10px 12px; border-radius: 12px;
  font-size: 13px; line-height: 1.35;
  background: color-mix(in srgb, var(--c1) 8%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c1) 30%, transparent);
}
.pl-status { color: var(--c1); }
.pl-status.err { color: #ff7d97; }
.shared {
  display: grid; gap: 10px;
  padding: 12px; border-radius: 14px;
  background: rgba(255,255,255,.03);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
}
.shared-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.shared-head > span { font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.shared-empty { font-size: 13px; color: var(--muted); }
.pl-list { list-style: none; display: grid; gap: 4px; }
.pl-item {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto 28px; align-items: center; gap: 10px;
  padding: 6px; border-radius: 12px;
  cursor: pointer; transition: background .2s;
}
.pl-item:hover { background: rgba(255,255,255,.05); }
.pl-item.current { background: color-mix(in srgb, var(--c1) 12%, transparent); box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c1) 35%, transparent); }
.pl-thumb {
  position: relative;
  width: 44px; height: 44px; border-radius: 9px; overflow: hidden;
  background: linear-gradient(135deg, var(--c2), var(--body2));
  display: grid; place-items: center;
}
.pl-thumb img { width: 100%; height: 100%; object-fit: cover; }
.pl-thumb svg { width: 20px; height: 20px; fill: none; stroke: rgba(255,255,255,.7); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Анимированный эквалайзер на текущем треке */
.pl-eq { position: absolute; inset: 0; display: none; align-items: flex-end; justify-content: center; gap: 3px; padding: 10px; background: rgba(3,4,10,.55); }
.pl-eq i { width: 4px; height: 30%; background: var(--c1); border-radius: 2px; box-shadow: 0 0 6px var(--c1); }
.pl-item.current .pl-eq { display: flex; }
.playing .pl-item.current .pl-eq i { animation: eqbar .8s ease-in-out infinite alternate; }
.pl-eq i:nth-child(2) { animation-delay: -.3s !important; }
.pl-eq i:nth-child(3) { animation-delay: -.55s !important; }
@keyframes eqbar { from { height: 20%; } to { height: 95%; } }
.pl-meta { display: grid; min-width: 0; }
.pl-title { font-weight: 600; font-size: 15px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-item.current .pl-title { color: var(--c1); }
.pl-artist { font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-dur { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pl-del {
  width: 28px; height: 28px; border-radius: 8px;
  display: grid; place-items: center; color: var(--muted);
  opacity: 0; transition: .2s;
}
.pl-item:hover .pl-del, .pl-del:focus-visible { opacity: 1; }
.pl-del:hover { color: #ff6b8a; background: rgba(255,80,120,.12); }
.pl-del svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; }
.pl-empty {
  padding: 26px 18px; border-radius: 14px; text-align: center;
  font-size: 15px; line-height: 1.45; color: var(--muted);
  border: 1.5px dashed rgba(255,255,255,.12);
}

/* Магнитола-эквалайзер */
.headunit {
  padding: 14px; border-radius: 16px;
  background: linear-gradient(180deg, #0d1122, #070914);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), inset 0 2px 0 rgba(255,255,255,.06), 0 8px 20px rgba(0,0,0,.4);
  display: grid; gap: 14px;
}
.hu-screen {
  border-radius: 10px; padding: 8px 10px 4px;
  background: radial-gradient(120% 140% at 50% 0%, color-mix(in srgb, var(--c2) 22%, #03050c), #03050c);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--c1) 30%, transparent), inset 0 0 20px rgba(0,0,0,.7);
}
.hu-top { display: flex; justify-content: space-between; font-family: var(--font-display); font-size: 11px; letter-spacing: .18em; color: color-mix(in srgb, var(--c1) 60%, var(--muted)); }
.hu-top b { font-weight: 400; color: var(--c1); text-shadow: 0 0 8px var(--c1); }
#eqCurve { width: 100%; height: 70px; display: block; }

.eq-faders { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.eq-col { display: grid; justify-items: center; gap: 6px; }
.eq-val { font-size: 12px; font-weight: 700; color: var(--c1); font-variant-numeric: tabular-nums; min-height: 1em; }
.eq-col > span { font-size: 11px; letter-spacing: .08em; color: var(--muted); }
.eq-fader {
  position: relative;
  width: 34px; height: 132px; padding: 4px 6px; border-radius: 8px;
  display: flex; flex-direction: column; gap: 2px;
  background: #04060d;
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  cursor: ns-resize; touch-action: none;
}
.eq-fader:focus-visible { outline: 1px dashed var(--c1); outline-offset: 3px; }
.eq-fader i { flex: 1; border-radius: 2px; background: rgba(255,255,255,.06); transition: background .12s, box-shadow .12s; }
.eq-fader i.zero { background: rgba(255,255,255,.22); }
.eq-fader i.on { background: var(--c1); box-shadow: 0 0 6px var(--c1); }
.eq-fader i.on.neg { background: var(--c2); box-shadow: 0 0 6px var(--c2); }
.eq-fader i.on.hot { background: var(--c3); box-shadow: 0 0 6px var(--c3); }
.eq-presets { display: flex; flex-wrap: wrap; gap: 6px; }

.knobs { display: grid; gap: 14px; padding: 2px 4px; }
.knob { display: grid; gap: 6px; }
.knob span { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); display: flex; justify-content: space-between; gap: 8px; white-space: nowrap; }
.knob b { color: var(--c1); font-weight: 700; font-size: 13px; font-variant-numeric: tabular-nums; }

/* Источники */
.src-card {
  display: grid; grid-template-columns: 44px 1fr; gap: 12px; align-items: center;
  text-align: left; padding: 14px; border-radius: 14px;
  background: rgba(255,255,255,.03);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08);
  transition: .2s;
}
.src-card:hover { background: rgba(255,255,255,.06); }
.src-card svg {
  width: 44px; height: 44px; padding: 10px; border-radius: 12px;
  fill: none; stroke: var(--c1); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
  background: color-mix(in srgb, var(--c1) 10%, transparent);
}
.src-card b { display: block; font-size: 16px; }
.src-card small { display: block; margin-top: 2px; font-size: 13px; line-height: 1.35; color: var(--muted); }
.src-card.active { box-shadow: inset 0 0 0 1.5px var(--c1), 0 0 18px color-mix(in srgb, var(--c1) 25%, transparent); }
.src-card.active b { color: var(--c1); }
.src-note { font-size: 14px; line-height: 1.4; color: var(--muted); min-height: 1em; }
.src-note.error { color: #ff7d97; }

/* Прогресс и ползунки */
input[type="range"] { -webkit-appearance: none; appearance: none; width: 100%; background: transparent; cursor: pointer; }
input[type="range"]:focus-visible { outline: 1px dashed var(--c1); outline-offset: 4px; }
input[type="range"]::-webkit-slider-runnable-track { height: 6px; border-radius: 6px; background: var(--track-bg); }
input[type="range"]::-moz-range-track { height: 6px; border-radius: 6px; background: var(--track-bg); }
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; width: 14px; height: 14px; margin-top: -4px; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 3px var(--c1), 0 0 14px var(--c1);
}
input[type="range"]::-moz-range-thumb {
  width: 14px; height: 14px; border: 0; border-radius: 50%;
  background: #fff; box-shadow: 0 0 0 3px var(--c1), 0 0 14px var(--c1);
}
input[type="range"] {
  --p: 0%;
  --track-bg: linear-gradient(90deg, var(--c2), var(--c1) var(--p), rgba(255,255,255,.12) var(--p));
}
.progress::-webkit-slider-runnable-track { box-shadow: 0 0 10px color-mix(in srgb, var(--c1) 30%, transparent); }
.live .progress { pointer-events: none; --track-bg: repeating-linear-gradient(90deg, var(--c1) 0 10px, transparent 10px 18px); opacity: .5; }
.live .progress::-webkit-slider-thumb { opacity: 0; }

/* ===== Дека-кузов ===== */
.deck { position: relative; transition: opacity .4s, transform .4s; }

/* Неоновая подсветка днища — пульсирует от баса */
.underglow {
  position: absolute; left: 6%; right: 6%; bottom: -26px; height: 46px;
  background: radial-gradient(ellipse at center, var(--c1) 0%, color-mix(in srgb, var(--c1) 40%, transparent) 40%, transparent 72%);
  filter: blur(14px);
  opacity: calc(.3 + var(--bass) * .9);
  transform: scaleX(calc(.85 + var(--bass) * .2));
  pointer-events: none;
}

.car {
  position: relative;
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 18px;
  padding: 16px 26px 22px;
  border-radius: 34px 34px 60px 60px / 30px 30px 48px 48px;
  background:
    linear-gradient(180deg, rgba(255,255,255,.22) 0%, rgba(255,255,255,.04) 18%, transparent 40%),
    linear-gradient(180deg, var(--body1) 0%, var(--body2) 100%);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.35),
    inset 0 -14px 26px rgba(0,0,0,.5),
    0 0 0 1.5px color-mix(in srgb, var(--c1) 55%, transparent),
    0 10px 30px rgba(0,0,0,.6);
  overflow: hidden;
}
/* Неоновые «винилы» на кузове */
.car::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background:
    linear-gradient(105deg, transparent 6%, color-mix(in srgb, var(--c1) 40%, transparent) 7%, transparent 9%,
                            transparent 11%, color-mix(in srgb, var(--c1) 25%, transparent) 12%, transparent 13%),
    linear-gradient(-105deg, transparent 6%, color-mix(in srgb, var(--c1) 40%, transparent) 7%, transparent 9%,
                            transparent 11%, color-mix(in srgb, var(--c1) 25%, transparent) 12%, transparent 13%);
  opacity: .55;
}
.car > * { position: relative; }

/* Фары-кластеры: вспыхивают на ударах */
.lights { display: grid; grid-template-columns: repeat(3, 11px); gap: 5px; }
.lights i {
  width: 11px; height: 11px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #cfefff 45%, #7fb8ff);
  box-shadow: 0 0 6px #bfe6ff, 0 0 12px color-mix(in srgb, var(--c1) 50%, transparent);
  opacity: .75;
  transition: transform .25s, opacity .25s, box-shadow .25s;
}
.lights.flash i {
  opacity: 1; transform: scale(1.25);
  box-shadow: 0 0 10px #fff, 0 0 26px var(--c1), 0 0 44px var(--c1);
  transition: transform .04s, opacity .04s, box-shadow .04s;
}

/* Боковые LED-эквалайзеры */
.grille {
  width: 84px; height: 56px; border-radius: 8px;
  background: rgba(0,0,0,.45);
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.1), inset 0 4px 10px rgba(0,0,0,.6);
}

/* «Лобовое стекло» с управлением */
.cockpit {
  padding: 12px 16px 14px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(4,8,24,.88), rgba(4,8,24,.72));
  box-shadow: inset 0 0 0 1px rgba(255,255,255,.08), inset 0 8px 20px rgba(0,0,0,.5);
  display: grid; gap: 10px;
  min-width: 0;
}
.track-row { display: flex; align-items: center; gap: 12px; }
.cover {
  position: relative; flex: none;
  width: 54px; height: 54px; border-radius: 12px; overflow: hidden;
  display: grid; place-items: center;
  background: linear-gradient(135deg, var(--c2), var(--body2));
  box-shadow: 0 0 0 1px rgba(255,255,255,.12), 0 0 18px color-mix(in srgb, var(--c1) 30%, transparent);
}
.cover img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.cover svg { width: 24px; height: 24px; fill: none; stroke: rgba(255,255,255,.75); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.track { display: grid; min-width: 0; flex: 1; }
.track-label { font-size: 11px; letter-spacing: .3em; text-transform: uppercase; color: var(--muted); }
.live .track-label { color: #ff5d7a; text-shadow: 0 0 8px #ff5d7a; }
.track-title {
  font-weight: 700; font-size: 19px; line-height: 1.2;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.track-artist { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.time { font-weight: 600; font-size: 15px; color: var(--c1); white-space: nowrap; font-variant-numeric: tabular-nums; align-self: flex-end; }

.controls { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.transport { display: flex; align-items: center; gap: 8px; }

.play-btn {
  width: 52px; height: 52px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  color: #021018;
  background: radial-gradient(circle at 35% 30%, #fff, var(--c1) 60%);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--c1) 35%, transparent), 0 0 24px var(--c1);
  transition: transform .15s, box-shadow .2s;
}
.play-btn:hover { transform: scale(1.06); }
.play-btn svg { width: 22px; height: 22px; fill: currentColor; }
.play-btn .i-pause, .play-btn .i-stop { display: none; }
.playing .play-btn .i-play { display: none; }
.playing .play-btn .i-pause { display: block; }
.live .play-btn .i-play, .live .play-btn .i-pause { display: none; }
.live .play-btn .i-stop { display: block; }

.deck-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.deck-btn {
  position: relative;
  display: flex; align-items: center; gap: 7px;
  height: 38px; padding: 0 12px; border-radius: 11px;
  font-weight: 600; font-size: 14px;
  color: var(--muted);
  border: 1px solid rgba(255,255,255,.12);
  transition: .2s;
}
.deck-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.deck-btn:hover { color: var(--text); border-color: color-mix(in srgb, var(--c1) 50%, transparent); }
.deck-btn.active { color: var(--c1); border-color: var(--c1); box-shadow: 0 0 12px color-mix(in srgb, var(--c1) 30%, transparent); }
.badge {
  min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  display: grid; place-items: center;
  font: 700 11px/1 var(--font-body); font-style: normal;
  color: #021018; background: var(--c1);
}

/* «Улыбка» бампера */
.grin {
  position: absolute; left: 50%; bottom: 4px; width: 26%; height: 14px;
  transform: translateX(-50%);
  overflow: visible; pointer-events: none;
}
.grin path {
  fill: none; stroke: var(--c1); stroke-width: 3; stroke-linecap: round;
  vector-effect: non-scaling-stroke;
  opacity: calc(.25 + var(--bass) * .75);
  filter: drop-shadow(0 0 4px var(--c1));
}

/* ===== Полноэкранный режим ===== */
.app:fullscreen { padding: 0 0 26px; gap: 0; background: var(--bg); }
.app:fullscreen .topbar { display: none; }
.app:fullscreen .stage { border-radius: 0; border: 0; }
.app:fullscreen .deck { position: absolute; left: 20px; right: 20px; bottom: 26px; }
.app.idle .deck, .app.idle .hud, .app.idle .hint { opacity: 0; transform: translateY(20px); pointer-events: none; }
.app.idle { cursor: none; }
.hud, .hint { transition: opacity .4s, transform .4s; }

/* ===== Адаптив ===== */

/* Вырезы и «чёлки» телефонов */
@supports (padding: env(safe-area-inset-top)) {
  .app {
    padding-top: max(14px, env(safe-area-inset-top));
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
    padding-bottom: max(30px, calc(env(safe-area-inset-bottom) + 18px));
  }
}

/* Сенсорные экраны: кнопки удаления в плейлисте видны всегда, без наведения */
@media (hover: none) {
  .pl-del { opacity: 1; }
  .hint { display: none; }
}

/* Ноутбуки и планшеты в альбомной ориентации */
@media (max-width: 1100px) {
  .hint { display: none; }
  .deck-btn span { display: none; }
  .deck-btn { padding: 0 10px; }
}

/* Планшеты */
@media (max-width: 960px) {
  .grille { display: none; }
  .car { grid-template-columns: auto minmax(0, 1fr) auto; gap: 14px; padding: 14px 18px 22px; }
  .lights { grid-template-columns: repeat(2, 9px); gap: 4px; }
  .lights i { width: 9px; height: 9px; }
  .lights i:nth-child(n+5) { display: none; }
  .presets button { padding: 6px 12px; font-size: 13px; }
}

/* Телефоны */
@media (max-width: 640px) {
  .app { gap: 10px; }
  @supports (padding: env(safe-area-inset-top)) {
    .app {
      padding-top: max(10px, env(safe-area-inset-top));
      padding-left: max(10px, env(safe-area-inset-left));
      padding-right: max(10px, env(safe-area-inset-right));
      padding-bottom: max(22px, calc(env(safe-area-inset-bottom) + 14px));
    }
  }

  /* Шапка в одну строку: логотип слева, пресеты — цветными кружками справа */
  .topbar { flex-wrap: nowrap; gap: 10px; }
  .brand { gap: 8px; min-width: 0; }
  .logo { width: 44px; height: 18px; }
  h1 { font-size: 15px; letter-spacing: .05em; white-space: nowrap; }
  .tag { display: none; }
  .presets { gap: 6px; flex-wrap: nowrap; }
  .presets button { width: 32px; height: 32px; padding: 0; justify-content: center; }
  .presets button span { display: none; }
  .presets button i { width: 12px; height: 12px; }

  .stage { border-radius: 18px; }
  .hud { top: 8px; left: 8px; right: 8px; gap: 8px; }
  .modes button { padding: 7px 10px; font-size: 10px; }
  .bpm { height: 36px; padding: 0 10px; }
  .bpm b { font-size: 15px; min-width: 1.8em; }
  .bpm span { display: none; }
  .icon-btn { width: 36px; height: 36px; border-radius: 11px; }
  .drop-card { padding: 22px 18px; }
  .drop-card p { font-size: 15px; }

  /* Дека: одна колонка, кнопки в два ряда */
  .car { grid-template-columns: minmax(0, 1fr); padding: 10px 10px 20px; border-radius: 26px 26px 40px 40px / 22px 22px 34px 34px; }
  .lights { display: none; }
  .cockpit { padding: 10px 12px 12px; gap: 9px; }
  .cover { width: 46px; height: 46px; border-radius: 10px; }
  .track-title { font-size: 17px; }
  .track-artist { font-size: 13px; }
  .time { font-size: 13px; }
  .controls { justify-content: center; gap: 10px; }
  .transport { gap: 10px; }
  .play-btn { width: 50px; height: 50px; }
  .deck-btns { width: 100%; flex-wrap: nowrap; }
  .deck-btn { flex: 1; justify-content: center; height: 40px; padding: 0 6px; font-size: 13px; }
  .deck-btn span { display: inline; }
  .grin { width: 40%; }

  /* Панель выезжает снизу, как шторка */
  .drawer {
    position: fixed; z-index: 20;
    left: 0; right: 0; top: auto; bottom: 0;
    width: auto; max-width: none; max-height: 82dvh;
    border-radius: 22px 22px 0 0;
    padding-bottom: env(safe-area-inset-bottom);
    transform: translateY(105%);
    box-shadow: 0 -1px 0 color-mix(in srgb, var(--c1) 35%, transparent), 0 -20px 50px rgba(0,0,0,.7);
  }
  .drawer::before {
    content: ""; display: block; flex: none;
    width: 40px; height: 4px; margin: 8px auto 0; border-radius: 4px;
    background: rgba(255,255,255,.22);
  }
  .drawer-tabs button[data-tab] { padding: 8px 10px; font-size: 11px; }
  .eq-fader { width: 30px; height: 120px; }
  .pl-item { grid-template-columns: 44px minmax(0, 1fr) auto 32px; }
  .pl-del { width: 32px; height: 32px; }
}

/* Совсем узкие телефоны */
@media (max-width: 370px) {
  h1 span { display: none; }
  .deck-btn span { display: none; }
  .transport { gap: 6px; }
}

/* Телефон, повёрнутый горизонтально: сцена слева, дека справа */
@media (orientation: landscape) and (max-height: 520px) {
  .app {
    grid-template-columns: minmax(0, 1fr) min(330px, 44vw);
    grid-template-rows: minmax(0, 1fr);
    gap: 10px;
    padding: max(8px, env(safe-area-inset-top)) max(10px, env(safe-area-inset-right)) max(8px, env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-left));
  }
  .topbar { display: none; }
  .deck { align-self: center; }
  .underglow { bottom: -14px; }
  .car { grid-template-columns: minmax(0, 1fr); padding: 10px 10px 18px; border-radius: 24px; }
  .grille, .lights, .grin { display: none; }
  .cockpit { padding: 10px; gap: 8px; }
  .cover { width: 40px; height: 40px; }
  .track-title { font-size: 15px; }
  .track-label, .track-artist { display: none; }
  .controls { justify-content: center; gap: 8px; }
  .transport { gap: 6px; }
  .play-btn { width: 44px; height: 44px; }
  .deck-btns { width: 100%; flex-wrap: nowrap; }
  .deck-btn { flex: 1; justify-content: center; height: 36px; }
  .deck-btn span { display: none; }
  .hud { top: 8px; left: 8px; right: 8px; }
  .modes button { padding: 6px 9px; font-size: 10px; }
  .bpm span { display: none; }
  .drawer { top: 8px; bottom: 8px; right: 8px; width: min(360px, 60vw); }
  .eq-fader { height: 100px; }
}
