:root {
  --bg: #07060d;
  --bg-2: #0e0c18;
  --surface: rgba(22, 19, 38, 0.62);
  --surface-2: rgba(255, 255, 255, 0.045);
  --line: rgba(255, 255, 255, 0.08);
  --line-2: rgba(255, 255, 255, 0.14);
  --text: #f3f1fa;
  --muted: #9a95b3;
  --dim: #635e7d;
  --violet: #8b7bff;
  --pink: #ff5c8a;
  --amber: #ffb547;
  --grad: linear-gradient(120deg, var(--violet) 0%, var(--pink) 55%, var(--amber) 100%);
  --radius: 18px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --display: "Space Grotesk", var(--font);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--violet); outline-offset: 3px; border-radius: 8px; }

/* ------------------------------------------------------------ background */
.bg { position: fixed; inset: 0; z-index: -1; overflow: hidden; pointer-events: none; }
.blob {
  position: absolute; width: 52vmax; height: 52vmax; border-radius: 50%;
  filter: blur(90px); opacity: .32; mix-blend-mode: screen;
  animation: drift 26s var(--ease) infinite alternate;
}
.b1 { background: radial-gradient(circle, var(--violet), transparent 65%); top: -22vmax; left: -12vmax; }
.b2 { background: radial-gradient(circle, var(--pink), transparent 65%); top: 10vmax; right: -22vmax; animation-delay: -8s; opacity: .22; }
.b3 { background: radial-gradient(circle, var(--amber), transparent 65%); bottom: -30vmax; left: 20vmax; animation-delay: -16s; opacity: .14; }
@keyframes drift {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(6vmax, 4vmax) scale(1.08); }
  100% { transform: translate(-4vmax, 7vmax) scale(.95); }
}
.grain {
  position: absolute; inset: 0; opacity: .05;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

.glass {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  backdrop-filter: blur(22px) saturate(140%);
  -webkit-backdrop-filter: blur(22px) saturate(140%);
  box-shadow: 0 20px 60px -30px rgba(0, 0, 0, .8), inset 0 1px 0 rgba(255, 255, 255, .05);
}

/* ------------------------------------------------------------ topbar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px clamp(16px, 4vw, 40px);
  background: linear-gradient(to bottom, rgba(7, 6, 13, .85), rgba(7, 6, 13, 0));
  backdrop-filter: blur(8px);
}
.brand { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; }
.brand-name { font: 700 20px var(--display); letter-spacing: -.02em; }
.brand-mark { display: grid; gap: 3px; width: 22px; }
.brand-mark i { display: block; height: 4px; border-radius: 2px; transform-origin: left; animation: mark 3.2s var(--ease) infinite; }
.brand-mark i:nth-child(1) { background: var(--pink); }
.brand-mark i:nth-child(2) { background: var(--amber); width: 70%; animation-delay: -.6s; }
.brand-mark i:nth-child(3) { background: var(--violet); width: 85%; animation-delay: -1.2s; }
@keyframes mark { 0%, 100% { transform: scaleX(1); } 50% { transform: scaleX(.55); } }
.topbar-right { display: flex; align-items: center; gap: 10px; }
.device-pill {
  font-size: 12px; color: var(--muted); padding: 5px 10px; border-radius: 99px;
  border: 1px solid var(--line); background: var(--surface-2);
}
.device-pill::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: #34d399; margin-right: 7px; box-shadow: 0 0 10px #34d399; }

/* ------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 10px 16px; border-radius: 12px; border: 1px solid var(--line-2);
  background: var(--surface-2); font-weight: 500; font-size: 14px;
  transition: transform .2s var(--ease), background .2s, border-color .2s, box-shadow .3s;
}
.btn:hover { background: rgba(255, 255, 255, .09); transform: translateY(-1px); }
.btn:active { transform: translateY(0) scale(.98); }
.btn.small { padding: 7px 12px; font-size: 13px; }
.btn.ghost { background: transparent; }
.btn.ghost:hover { background: var(--surface-2); }
.btn.primary {
  border: 0; color: #12081a; font-weight: 600;
  background: var(--grad); background-size: 160% 100%;
  box-shadow: 0 8px 30px -8px rgba(255, 92, 138, .6);
}
.btn.primary:hover { background-position: 100% 0; box-shadow: 0 10px 36px -6px rgba(255, 92, 138, .75); }
.btn:disabled { opacity: .5; pointer-events: none; }
.btn.danger { border-color: rgba(255, 92, 92, .45); color: #ff9a9a; background: rgba(255, 92, 92, .08); }
.btn.danger:hover { background: rgba(255, 92, 92, .16); border-color: rgba(255, 92, 92, .7); }
.progress-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.lib-stop { color: #ff9a9a; border-color: rgba(255, 92, 92, .3); }
.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn {
  display: grid; place-items: center; width: 38px; height: 38px; border-radius: 11px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  transition: color .2s, background .2s;
}
.icon-btn:hover { color: var(--text); background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }

/* ------------------------------------------------------------ views */
main { width: min(1180px, 100%); margin: 0 auto; padding: 0 clamp(16px, 4vw, 40px) 80px; }
.view { animation: enter .6s var(--ease) both; }
@keyframes enter { from { opacity: 0; transform: translateY(14px); filter: blur(4px); } to { opacity: 1; transform: none; filter: none; } }

.eyebrow { margin: 0 0 10px; font-size: 12px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.muted { color: var(--muted); }

/* ------------------------------------------------------------ hero / upload */
.hero { text-align: center; padding: clamp(40px, 9vh, 96px) 0 34px; }
.hero h1 {
  margin: 0; font: 700 clamp(40px, 7.4vw, 84px)/1.02 var(--display); letter-spacing: -.04em;
}
.grad { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; background-size: 200% 100%; animation: shine 8s ease-in-out infinite alternate; }
@keyframes shine { to { background-position: 100% 0; } }
.lead { max-width: 620px; margin: 22px auto 0; color: var(--muted); font-size: clamp(15px, 1.6vw, 18px); }

.dropzone {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 18px;
  max-width: 760px; margin: 0 auto; padding: 46px 24px; cursor: pointer;
  border-radius: 26px; background: var(--surface); text-align: center;
  backdrop-filter: blur(22px); -webkit-backdrop-filter: blur(22px);
  transition: transform .35s var(--ease), box-shadow .35s;
  isolation: isolate;
}
.dropzone::before {
  content: ""; position: absolute; inset: 0; border-radius: inherit; padding: 1.5px; z-index: -1;
  background: conic-gradient(from var(--ang, 0deg), var(--violet), var(--pink), var(--amber), var(--violet));
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor; mask-composite: exclude;
  opacity: .35; transition: opacity .3s;
  animation: spin 6s linear infinite;
}
@property --ang { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes spin { to { --ang: 360deg; } }
.dropzone:hover, .dropzone.drag { transform: translateY(-3px); box-shadow: 0 30px 80px -30px rgba(139, 123, 255, .55); }
.dropzone:hover::before, .dropzone.drag::before { opacity: 1; }
.dropzone.drag { transform: scale(1.015); }
.dz-text { display: grid; gap: 4px; }
.dz-text strong { font: 600 20px var(--display); }
.dz-text span { color: var(--muted); font-size: 14px; }
.dz-text u { text-decoration-color: var(--pink); text-underline-offset: 3px; color: var(--text); }
.dz-bars { display: flex; align-items: flex-end; gap: 5px; height: 46px; }
.dz-bars i {
  width: 7px; border-radius: 4px; background: var(--grad); background-size: 100% 300%;
  animation: eq 1.3s ease-in-out infinite;
}
.dz-bars i:nth-child(1) { animation-delay: -.2s; }
.dz-bars i:nth-child(2) { animation-delay: -.9s; }
.dz-bars i:nth-child(3) { animation-delay: -.4s; }
.dz-bars i:nth-child(4) { animation-delay: -1.1s; }
.dz-bars i:nth-child(5) { animation-delay: -.6s; }
.dz-bars i:nth-child(6) { animation-delay: -.1s; }
.dz-bars i:nth-child(7) { animation-delay: -.75s; }
@keyframes eq { 0%, 100% { height: 22%; } 50% { height: 100%; } }

/* link YouTube */
.link-form {
  display: flex; align-items: center; gap: 10px; max-width: 760px; margin: 14px auto 0;
  padding: 6px 6px 6px 14px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface-2);
  transition: border-color .2s, box-shadow .2s;
}
.link-form:focus-within { border-color: rgba(255, 92, 92, .55); box-shadow: 0 0 0 4px rgba(255, 92, 92, .1); }
.yt-ico { flex: none; width: 22px; height: 22px; fill: none; stroke: #ff5c5c; stroke-width: 1.8; }
.yt-ico .fill { fill: #ff5c5c; stroke: none; }
.link-form input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 14px; padding: 8px 0; }
.link-form input::placeholder { color: var(--dim); }
.link-form .btn { flex: none; }
.link-note { max-width: 760px; margin: 6px auto 0; padding: 0 14px; font-size: 12px; color: var(--dim); }
.badge.yt { color: #ff8a8a; border-color: rgba(255, 92, 92, .35); }

.models { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 14px; max-width: 760px; margin: 22px auto 0; }
.models .model { grid-column: span 2; }
.models .model.hq { grid-column: span 3; }
.model.hq { background: linear-gradient(135deg, rgba(255, 92, 138, .07), rgba(139, 123, 255, .06)); }
.badge-hq {
  font: 600 10px var(--font); font-style: normal; letter-spacing: .06em; text-transform: uppercase;
  padding: 2px 7px; margin-left: 6px; border-radius: 99px; vertical-align: 2px;
  background: var(--grad); color: #12081a;
}
.quality {
  display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap;
  max-width: 760px; margin: 14px auto 0; padding: 12px 14px 12px 18px;
  border-radius: 16px; border: 1px solid var(--line); background: var(--surface-2);
}
.quality strong { font: 600 15px var(--display); display: block; }
.quality span { font-size: 13px; color: var(--muted); }
.quality .seg { min-width: 290px; }
.model {
  position: relative; text-align: left; padding: 16px 16px 14px; border-radius: 16px;
  border: 1px solid var(--line); background: var(--surface-2);
  transition: border-color .25s, background .25s, transform .25s var(--ease);
}
.model:hover { transform: translateY(-2px); border-color: var(--line-2); }
.model[aria-checked="true"] { border-color: rgba(139, 123, 255, .7); background: rgba(139, 123, 255, .1); box-shadow: 0 0 0 4px rgba(139, 123, 255, .12); }
.model h4 { margin: 0 0 4px; font: 600 15px var(--display); display: flex; justify-content: space-between; align-items: center; }
.model h4 .dot { width: 16px; height: 16px; border-radius: 50%; border: 1.5px solid var(--line-2); display: grid; place-items: center; transition: .2s; }
.model[aria-checked="true"] h4 .dot { border-color: var(--violet); }
.model[aria-checked="true"] h4 .dot::after { content: ""; width: 8px; height: 8px; border-radius: 50%; background: var(--violet); }
.model p { margin: 0 0 10px; font-size: 13px; color: var(--muted); line-height: 1.4; }
.model { display: flex; flex-direction: column; }
.stem-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-bottom: 10px; }
.stem-tag {
  display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 6px; border-radius: 99px;
  font-size: 11.5px; font-weight: 500; color: var(--text);
  background: color-mix(in srgb, var(--c) 13%, transparent); border: 1px solid color-mix(in srgb, var(--c) 30%, transparent);
}
.stem-tag i { width: 6px; height: 6px; border-radius: 50%; background: var(--c); }
.model-foot { margin-top: auto; display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; }
.other-hint { font-size: 11.5px; color: var(--dim); line-height: 1.35; }
.other-hint b { color: var(--muted); font-weight: 600; }
.time-pill {
  flex: none; font-size: 11.5px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted);
  padding: 2px 8px; border-radius: 99px; border: 1px solid var(--line-2); background: rgba(0, 0, 0, .2);
}

/* ------------------------------------------------------------ progress */
.progress-card {
  max-width: 520px; margin: clamp(40px, 10vh, 110px) auto 0; padding: 38px 28px 26px;
  display: flex; flex-direction: column; align-items: center; text-align: center;
}
.ring { position: relative; width: 168px; height: 168px; }
.ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring circle { fill: none; stroke-width: 7; }
.ring-track { stroke: rgba(255, 255, 255, .07); }
.ring-fill {
  stroke: url(#ring-grad); stroke-linecap: round;
  stroke-dasharray: 326.73; stroke-dashoffset: 326.73;
  transition: stroke-dashoffset .6s var(--ease);
  filter: drop-shadow(0 0 8px rgba(255, 92, 138, .5));
}
.ring-label { position: absolute; inset: 0; display: grid; place-content: center; grid-auto-flow: column; align-items: baseline; font: 700 44px var(--display); letter-spacing: -.03em; }
.ring-label small { font-size: 18px; color: var(--muted); margin-left: 2px; }
.ring.indeterminate svg { animation: rot 1.4s linear infinite; }
@keyframes rot { to { transform: rotate(270deg); } }
.progress-card h2 { margin: 22px 0 4px; font: 600 22px var(--display); word-break: break-word; }
.stage { margin: 0; color: var(--muted); }
.stage::after { content: ""; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.4s steps(4) infinite; }
@keyframes dots { 0% { content: ""; } 25% { content: "."; } 50% { content: ".."; } 75% { content: "..."; } }
.stem-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin: 22px 0 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; padding: 6px 12px 6px 9px; border-radius: 99px;
  font-size: 13px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted);
}
.chip i { width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 10px var(--c); animation: pulse 1.6s ease-in-out infinite; }
.chip:nth-child(2) i { animation-delay: .2s; } .chip:nth-child(3) i { animation-delay: .4s; }
.chip:nth-child(4) i { animation-delay: .6s; } .chip:nth-child(5) i { animation-delay: .8s; } .chip:nth-child(6) i { animation-delay: 1s; }
@keyframes pulse { 50% { opacity: .3; transform: scale(.7); } }
.hint { font-size: 13px; color: var(--dim); margin: 10px 0 18px; }
.error-text { color: #ff8aa8; }

/* ------------------------------------------------------------ mixer */
.song-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; padding: 34px 0 20px; }
.song-title { margin: 0; font: 700 clamp(26px, 4vw, 40px)/1.1 var(--display); letter-spacing: -.03em; word-break: break-word; }
.song-actions { display: flex; gap: 10px; }

.transport {
  position: sticky; top: 66px; z-index: 10;
  display: flex; align-items: center; gap: 14px; padding: 12px 16px; margin-bottom: 16px;
}
.play {
  flex: none; display: grid; place-items: center; width: 52px; height: 52px; border-radius: 50%; border: 0;
  background: var(--grad); color: #12081a; box-shadow: 0 8px 26px -6px rgba(255, 92, 138, .65);
  transition: transform .2s var(--ease), box-shadow .3s;
}
.play:hover { transform: scale(1.06); }
.play:active { transform: scale(.96); }
.play:disabled { filter: grayscale(1); opacity: .4; }
.play svg { width: 22px; height: 22px; fill: currentColor; }
.play .i-pause, .play.playing .i-play { display: none; }
.play.playing .i-pause { display: block; }
.time { font: 500 14px var(--display); font-variant-numeric: tabular-nums; color: var(--muted); white-space: nowrap; }
.time #t-cur { color: var(--text); }
.time .sep { margin: 0 5px; opacity: .5; }
.overview { position: relative; flex: 1; height: 40px; min-width: 80px; cursor: pointer; border-radius: 8px; overflow: hidden; touch-action: none; }
.overview canvas { width: 100%; height: 100%; display: block; }
.overview-head { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: #fff; box-shadow: 0 0 10px #fff; border-radius: 1px; pointer-events: none; }
.master { display: flex; align-items: center; gap: 8px; color: var(--muted); }
.master input { width: 110px; }

/* metronomo */
.metro {
  display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap;
  padding: 10px 16px; margin: -4px 0 16px; border-radius: 14px;
}
.metro.disabled > :not(.metro-status) { opacity: .4; pointer-events: none; }
.metro-toggle {
  display: inline-flex; align-items: center; gap: 7px; padding: 7px 12px; border-radius: 10px;
  border: 1px solid var(--line-2); background: transparent; font-weight: 600; font-size: 13px; color: var(--muted);
  transition: all .2s var(--ease);
}
.metro-toggle svg { width: 17px; height: 17px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.metro-toggle:hover { color: var(--text); }
.metro-toggle.on { color: #12081a; background: var(--amber); border-color: var(--amber); box-shadow: 0 0 18px -4px rgba(255, 181, 71, .8); }
.beat-led { width: 12px; height: 12px; border-radius: 50%; background: rgba(255, 255, 255, .1); flex: none; }
.beat-led.flash { animation: led .25s ease-out; }
.beat-led.flash.accent { animation-name: led-accent; }
@keyframes led { from { background: #fff; box-shadow: 0 0 14px #fff; } to { background: rgba(255, 255, 255, .1); box-shadow: none; } }
@keyframes led-accent { from { background: var(--amber); box-shadow: 0 0 18px var(--amber); transform: scale(1.3); } to { background: rgba(255, 255, 255, .1); box-shadow: none; transform: none; } }
.metro-tempo { display: flex; align-items: baseline; gap: 4px; }
.metro-tempo strong { font: 700 22px var(--display); font-variant-numeric: tabular-nums; letter-spacing: -.02em; min-width: 2.2ch; }
.metro-tempo small { font-size: 11px; color: var(--muted); letter-spacing: .08em; }
.metro-field { display: flex; align-items: center; gap: 8px; }
.metro-field label { font-size: 12px; color: var(--dim); }
.metro-field.vol input { width: 90px; --c: var(--amber); }
.seg.mini { padding: 3px; gap: 2px; border-radius: 10px; }
.seg.mini button { padding: 5px 9px; font-size: 12.5px; border-radius: 7px; flex: none; }
.nudge { display: flex; gap: 4px; }
.nudge button {
  width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line-2); background: transparent;
  font-size: 16px; line-height: 1; color: var(--muted); transition: .15s;
}
.nudge button:hover { color: var(--text); border-color: rgba(255, 255, 255, .3); }
.metro-status { margin-left: auto; font-size: 12px; color: var(--dim); }

/* conteggio iniziale a schermo */
.countin {
  position: fixed; left: 50%; top: 50%; z-index: 30; pointer-events: none;
  font: 700 clamp(90px, 16vw, 180px)/1 var(--display); color: #fff; opacity: 0;
  transform: translate(-50%, -50%) scale(.8); text-shadow: 0 0 60px rgba(255, 255, 255, .35);
}
.countin.accent { color: var(--amber); text-shadow: 0 0 70px rgba(255, 181, 71, .6); }
.countin.show { animation: count .5s var(--ease) forwards; }
@keyframes count {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(1.25); }
  25% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
  100% { opacity: 0; transform: translate(-50%, -50%) scale(.9); }
}

.tracks { display: grid; gap: 10px; }
.track {
  --c: #999;
  display: grid; grid-template-columns: 290px minmax(0, 1fr); align-items: stretch;
  border-radius: 16px; overflow: hidden;
  border: 1px solid var(--line); background: var(--surface);
  backdrop-filter: blur(18px); -webkit-backdrop-filter: blur(18px);
  animation: enter .55s var(--ease) both; animation-delay: calc(var(--i) * 60ms);
  transition: opacity .3s, border-color .3s;
}
.track:hover { border-color: var(--line-2); }
.track.silent .wave, .track.silent .t-name { opacity: .32; filter: saturate(.3); }
.track.loading .wave::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .06), transparent);
  background-size: 50% 100%; background-repeat: no-repeat; animation: shimmer 1.2s infinite;
}
@keyframes shimmer { from { background-position: -50% 0; } to { background-position: 150% 0; } }

.t-ctrl { display: grid; grid-template-columns: auto 1fr auto; gap: 8px 12px; align-items: center; padding: 14px 16px; border-right: 1px solid var(--line); position: relative; }
.t-ctrl::before { content: ""; position: absolute; left: 0; top: 14px; bottom: 14px; width: 3px; border-radius: 0 3px 3px 0; background: var(--c); box-shadow: 0 0 14px var(--c); }
.t-icon { width: 36px; height: 36px; border-radius: 11px; display: grid; place-items: center; background: color-mix(in srgb, var(--c) 16%, transparent); color: var(--c); }
.t-icon svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.t-name { font: 600 15px var(--display); transition: opacity .3s; }
.t-name small { display: block; font: 400 12px var(--font); color: var(--dim); }
.t-btns { display: flex; gap: 6px; }
.ms {
  width: 30px; height: 30px; border-radius: 9px; border: 1px solid var(--line-2); background: transparent;
  font: 700 12px var(--display); color: var(--muted); transition: all .18s var(--ease);
}
.ms:hover { color: var(--text); border-color: rgba(255, 255, 255, .3); }
.ms.mute.on { background: #ff5c5c; border-color: #ff5c5c; color: #1a0606; box-shadow: 0 0 16px -2px rgba(255, 92, 92, .7); }
.ms.solo.on { background: var(--amber); border-color: var(--amber); color: #1a1006; box-shadow: 0 0 16px -2px rgba(255, 181, 71, .7); }
.t-sliders { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr auto; gap: 6px 10px; align-items: center; font-size: 12px; color: var(--dim); }
.t-sliders output { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 46px; text-align: right; }
.meter { grid-column: 1 / -1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, .06); overflow: hidden; }
.meter i { display: block; height: 100%; width: 100%; background: linear-gradient(90deg, var(--c), color-mix(in srgb, var(--c) 40%, #fff)); transform-origin: left; transform: scaleX(0); }

.wave { position: relative; min-height: 112px; cursor: pointer; touch-action: none; transition: opacity .3s, filter .3s; }
.wave canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.wave .played { position: absolute; inset: 0 auto 0 0; width: 0; overflow: hidden; pointer-events: none; }
.wave .played canvas { width: var(--w); }
.wave .head { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: #fff; opacity: .85; pointer-events: none; box-shadow: 0 0 10px rgba(255, 255, 255, .6); }

/* volume nel tempo */
.ms.auto { display: grid; place-items: center; position: relative; }
.ms.auto svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.ms.auto.on, .track.show-lane .ms.auto { color: var(--c); border-color: color-mix(in srgb, var(--c) 60%, transparent); background: color-mix(in srgb, var(--c) 14%, transparent); }
.ms.auto.has::after { content: ""; position: absolute; top: -3px; right: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--c); box-shadow: 0 0 8px var(--c); }
.lane-label, .lane { display: none; border-top: 1px solid var(--line); }
.track.show-lane .lane-label { display: flex; }
.track.show-lane .lane { display: block; }
.lane-label {
  align-items: center; justify-content: space-between; gap: 8px; padding: 8px 16px;
  font-size: 12px; color: var(--muted); border-right: 1px solid var(--line);
  animation: enter .35s var(--ease) both;
}
.lane-reset { font-size: 12px; padding: 4px 9px; border-radius: 8px; border: 1px solid var(--line-2); background: transparent; color: var(--muted); transition: .2s; }
.lane-reset:hover:not(:disabled) { color: var(--text); border-color: rgba(255, 255, 255, .3); }
.lane-reset:disabled { opacity: .35; cursor: default; }
.lane { position: relative; height: 76px; cursor: crosshair; touch-action: none; background: rgba(0, 0, 0, .18); animation: enter .35s var(--ease) both; }
.lane.over-pt { cursor: grab; }
.lane:active { cursor: grabbing; }
.lane-svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.lane-unity { stroke: rgba(255, 255, 255, .12); stroke-dasharray: 3 4; }
.lane-fill { fill: color-mix(in srgb, var(--c) 12%, transparent); }
.lane-line { fill: none; stroke: var(--c); stroke-width: 2; stroke-linejoin: round; filter: drop-shadow(0 0 4px color-mix(in srgb, var(--c) 60%, transparent)); }
.lane-pt { fill: #fff; stroke: var(--c); stroke-width: 2.5; transition: r .15s; }
.lane-pt:hover { r: 7; }
.lane-hint { fill: var(--dim); font: 500 11.5px var(--font); text-anchor: middle; pointer-events: none; }
.lane .head { position: absolute; top: 0; bottom: 0; left: 0; width: 2px; background: #fff; opacity: .5; pointer-events: none; }
.lane-tip {
  position: absolute; z-index: 2; pointer-events: none; white-space: nowrap;
  padding: 3px 8px; border-radius: 7px; font: 600 11.5px var(--font); font-variant-numeric: tabular-nums;
  background: rgba(10, 8, 18, .92); border: 1px solid var(--line-2); color: var(--text);
}
.ico.inline { width: 13px; height: 13px; vertical-align: -2px; }

/* range inputs */
input[type="range"] { -webkit-appearance: none; appearance: none; background: transparent; height: 22px; margin: 0; cursor: pointer; --p: 66%; --c2: var(--c, var(--violet)); }
input[type="range"]::-webkit-slider-runnable-track { height: 4px; border-radius: 2px; background: linear-gradient(90deg, var(--c2) var(--p), rgba(255, 255, 255, .1) var(--p)); }
input[type="range"]::-moz-range-track { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .1); }
input[type="range"]::-moz-range-progress { height: 4px; border-radius: 2px; background: var(--c2); }
input[type="range"]::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 14px; margin-top: -5px; border-radius: 50%; background: #fff; border: 0; box-shadow: 0 2px 8px rgba(0, 0, 0, .5); transition: transform .15s; }
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: #fff; border: 0; }
input[type="range"]:active::-webkit-slider-thumb { transform: scale(1.25); }
input[type="range"].pan { --c2: rgba(255, 255, 255, .1); }
input[type="range"].pan::-webkit-slider-runnable-track { background: linear-gradient(90deg, rgba(255,255,255,.1) calc(min(var(--p), 50%)), var(--c) calc(min(var(--p), 50%)), var(--c) calc(max(var(--p), 50%)), rgba(255,255,255,.1) calc(max(var(--p), 50%))); }

.kbd-hint { text-align: center; color: var(--dim); font-size: 12.5px; margin-top: 22px; }
kbd { font: 500 11px var(--font); padding: 2px 6px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--surface-2); color: var(--muted); margin: 0 2px; }

/* ------------------------------------------------------------ library drawer */
.scrim { position: fixed; inset: 0; z-index: 40; background: rgba(4, 3, 8, .55); backdrop-filter: blur(3px); animation: fade .3s; }
@keyframes fade { from { opacity: 0; } }
.drawer {
  position: fixed; z-index: 41; top: 12px; right: 12px; bottom: 12px; width: min(400px, calc(100vw - 24px));
  display: flex; flex-direction: column; padding: 18px; background: rgba(16, 14, 28, .92);
  transform: translateX(calc(100% + 24px)); transition: transform .45s var(--ease);
}
.drawer.open { transform: none; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.drawer-head h3 { margin: 0; font: 600 20px var(--display); }
.lib-list { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: grid; gap: 8px; align-content: start; }
.lib-item {
  display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 10px;
  padding: 12px 12px 12px 14px; border-radius: 13px; border: 1px solid var(--line); background: var(--surface-2);
  transition: background .2s, border-color .2s, transform .2s var(--ease);
}
.lib-item:hover { background: rgba(255, 255, 255, .07); border-color: var(--line-2); transform: translateX(-2px); }
.lib-item.current { border-color: rgba(139, 123, 255, .6); }
.lib-open { all: unset; cursor: pointer; display: grid; gap: 3px; min-width: 0; }
.lib-open strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.lib-open span { font-size: 12.5px; color: var(--muted); display: flex; gap: 8px; align-items: center; }
.lib-open .stems-bar { display: flex; gap: 3px; }
.lib-open .stems-bar i { width: 12px; height: 4px; border-radius: 2px; background: var(--c); }
.lib-actions { display: flex; align-items: center; gap: 2px; }
.lib-ren { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--dim); opacity: 0; transition: .2s; }
.lib-ren svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.lib-item:hover .lib-ren, .lib-ren:focus-visible { opacity: 1; }
.lib-ren:hover { color: var(--text); border-color: var(--line-2); }
@media (hover: none) { .lib-ren { opacity: 1; } }
.lib-rename {
  min-width: 0; width: 100%; padding: 7px 10px; border-radius: 9px; font-weight: 600;
  border: 1px solid rgba(139, 123, 255, .7); background: rgba(0, 0, 0, .35); outline: none;
  box-shadow: 0 0 0 4px rgba(139, 123, 255, .15);
}
.lib-del { font-size: 12px; padding: 6px 9px; border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--dim); transition: .2s; }
.lib-del:hover { color: #ff8aa8; border-color: rgba(255, 138, 168, .3); }
.lib-del.confirm { color: #1a0606; background: #ff5c5c; }
.lib-empty { color: var(--muted); text-align: center; padding: 40px 10px; }
.badge { font-size: 11px; padding: 1px 7px; border-radius: 99px; border: 1px solid var(--line-2); }
.badge.err { color: #ff8aa8; border-color: rgba(255, 138, 168, .35); }
.badge.run { color: var(--amber); border-color: rgba(255, 181, 71, .35); }

/* ------------------------------------------------------------ modal */
.modal { width: min(480px, calc(100vw - 32px)); padding: 26px; color: var(--text); background: rgba(18, 16, 31, .96); }
.modal::backdrop { background: rgba(4, 3, 8, .6); backdrop-filter: blur(4px); }
.modal[open] { animation: pop .35s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }
.modal h3 { margin: 0 0 4px; font: 600 22px var(--display); }
.modal .muted { margin: 0 0 18px; font-size: 14px; }
fieldset { border: 0; padding: 0; margin: 0 0 16px; }
legend { font-size: 12px; letter-spacing: .1em; text-transform: uppercase; color: var(--dim); font-weight: 600; margin-bottom: 8px; }
.seg { display: flex; padding: 4px; gap: 4px; border-radius: 12px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); }
.seg button { flex: 1; padding: 8px 10px; border-radius: 9px; border: 0; background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 500; transition: all .2s var(--ease); }
.seg button:hover { color: var(--text); }
.seg button.on { background: rgba(255, 255, 255, .1); color: var(--text); box-shadow: 0 2px 10px rgba(0, 0, 0, .3), inset 0 1px 0 rgba(255, 255, 255, .08); }
.check { display: flex; align-items: center; gap: 10px; font-size: 14px; color: var(--muted); cursor: pointer; margin: 4px 0 22px; }
.check input { position: absolute; opacity: 0; }
.switch { flex: none; width: 36px; height: 21px; border-radius: 99px; background: rgba(255, 255, 255, .12); position: relative; transition: background .25s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 15px; height: 15px; border-radius: 50%; background: #fff; transition: transform .25s var(--ease); }
.check input:checked + .switch { background: var(--violet); }
.check input:checked + .switch::after { transform: translateX(15px); }
.check input:focus-visible + .switch { outline: 2px solid var(--violet); outline-offset: 2px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.spinner { display: none; width: 15px; height: 15px; border-radius: 50%; border: 2px solid rgba(18, 8, 26, .3); border-top-color: #12081a; animation: rot2 .7s linear infinite; }
.busy .spinner { display: inline-block; }
@keyframes rot2 { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------ toast */
.toast {
  position: fixed; left: 50%; bottom: 24px; z-index: 60; max-width: calc(100vw - 32px);
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  padding: 12px 18px; border-radius: 14px; font-size: 14px;
  background: rgba(24, 21, 40, .95); border: 1px solid var(--line-2); box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
  transition: transform .4s var(--ease), opacity .4s;
}
.toast.show { transform: translate(-50%, 0); opacity: 1; }
.toast.error { border-color: rgba(255, 92, 92, .5); }

/* ------------------------------------------------------------ responsive */
@media (max-width: 860px) {
  .models { grid-template-columns: 1fr; }
  .models .model, .models .model.hq { grid-column: auto; }
  .quality .seg { min-width: 0; width: 100%; }
  .track { grid-template-columns: 1fr; }
  .t-ctrl { border-right: 0; border-bottom: 1px solid var(--line); }
  .lane-label { border-right: 0; }
  .wave { min-height: 84px; }
  .transport { flex-wrap: wrap; top: 60px; }
  .overview { order: 5; flex-basis: 100%; height: 34px; }
  .master { margin-left: auto; }
  .master input { width: 90px; }
  .song-actions { width: 100%; }
  .song-actions .btn { flex: 1; justify-content: center; }
  .device-pill { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}

/* ---- caricamento delle tracce nel mixer */
.overview { position: relative; }
.load-status {
  position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: center; gap: 7px;
  padding: 0 14px; border-radius: inherit; background: color-mix(in srgb, var(--bg-2) 88%, transparent);
  font: 500 12.5px var(--font); color: var(--muted); z-index: 2;
}
.load-status[hidden] { display: none; }
.load-bar { height: 4px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.load-bar i { display: block; height: 100%; width: 0; background: var(--grad); border-radius: inherit; transition: width .25s var(--ease); }
.load-status.error { color: var(--pink); }
.wave-status {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%); z-index: 1;
  font: 500 12px var(--font); color: var(--muted); pointer-events: none;
}
.track:not(.loading) .wave-status { display: none; }

/* ---- barra studio: velocità, tonalità, loop A–B */
.practice {
  display: flex; align-items: center; gap: 10px 18px; flex-wrap: wrap;
  padding: 10px 16px; margin: -6px 0 16px; border-radius: 14px;
}
.stepper { display: flex; align-items: center; gap: 2px; padding: 3px; border-radius: 10px; background: rgba(0, 0, 0, .3); border: 1px solid var(--line); }
.stepper button { border: 0; background: transparent; color: var(--muted); border-radius: 7px; height: 26px; transition: .15s; }
.stepper button:not(.val) { width: 26px; font-size: 16px; line-height: 1; }
.stepper button:hover:not(:disabled) { color: var(--text); background: rgba(255, 255, 255, .06); }
.stepper .val { min-width: 52px; font: 600 13px var(--font); font-variant-numeric: tabular-nums; color: var(--text); }
.stepper .val.changed { color: var(--violet); }
.stepper button:disabled { opacity: .35; }
.practice-sep { width: 1px; height: 24px; background: var(--line-2); }
.loop-toggle.on { color: #0c0820; background: var(--violet); border-color: var(--violet); box-shadow: 0 0 18px -4px rgba(139, 123, 255, .85); }
.nudge.ab button { font: 600 12.5px var(--font); }
.nudge.ab button.set { color: var(--violet); border-color: rgba(139, 123, 255, .5); }
.loop-range { font-size: 12.5px; color: var(--dim); font-variant-numeric: tabular-nums; }
.loop-range.active { color: var(--text); }
.practice.busy .stepper { opacity: .7; }
.loop-region {
  position: absolute; top: 0; bottom: 0; pointer-events: none; z-index: 1;
  background: rgba(139, 123, 255, .16); border-left: 2px solid var(--violet); border-right: 2px solid var(--violet);
}
.loop-region.off { background: rgba(255, 255, 255, .05); border-color: rgba(255, 255, 255, .25); }
.wave .loop-shade { position: absolute; top: 0; bottom: 0; pointer-events: none; background: rgba(139, 123, 255, .07); border-left: 1px dashed rgba(139, 123, 255, .5); border-right: 1px dashed rgba(139, 123, 255, .5); }
.wave .loop-shade[hidden] { display: none; }
@media (max-width: 860px) { .practice-sep { display: none; } .loop-range { flex-basis: 100%; } }

/* ---- effetti della traccia (pannello FX) */
.ms.fx { font: 700 10.5px var(--font); letter-spacing: .04em; width: auto; padding: 0 7px; }
.ms.fx.active { color: var(--c); border-color: color-mix(in srgb, var(--c) 60%, transparent); }
.track.show-fx .ms.fx { color: #0c0820; background: var(--c); border-color: var(--c); }
.fx-panel { display: none; grid-column: 1 / -1; border-top: 1px solid var(--line); padding: 14px 16px 16px; background: rgba(0, 0, 0, .16); }
.track.show-fx .fx-panel { display: block; animation: enter .35s var(--ease) both; }
.fx-head { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-bottom: 12px; }
.fx-preset-wrap { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--dim); }
.fx-preset {
  background: rgba(0, 0, 0, .35); color: var(--text); border: 1px solid var(--line-2); border-radius: 9px;
  padding: 6px 10px; font: 500 13px var(--font); min-width: 190px;
}
.fx-bypass {
  padding: 6px 12px; border-radius: 9px; border: 1px solid var(--line-2); background: transparent;
  color: var(--muted); font: 500 12.5px var(--font); transition: .2s;
}
.fx-bypass:hover { color: var(--text); }
.fx-bypass.on { color: #12081a; background: var(--amber); border-color: var(--amber); }
.fx-note { margin-left: auto; font-size: 11.5px; color: var(--dim); }
.fx-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.fx-panel.bypassed .fx-grid { opacity: .45; filter: saturate(.3); }
.fx-card { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px 12px; background: var(--surface-2); transition: opacity .2s; }
.fx-card.wide { grid-column: span 2; }
.fx-card.off .fx-params, .fx-card.off .fx-curve { opacity: .55; }
.fx-card header { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.fx-card h4 { margin: 0; font: 600 13.5px var(--display); }
.fx-hint { margin: 3px 0 8px; font-size: 11.5px; color: var(--dim); line-height: 1.35; }
.fx-curve { display: block; width: 100%; height: 120px; margin: 6px 0 10px; border-radius: 8px; background: rgba(0, 0, 0, .3); }
.fx-params { display: grid; gap: 6px 14px; }
.fx-card.wide .fx-params { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); }
.fx-param { display: grid; grid-template-columns: auto 74px 1fr 62px; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); }
.fx-param:not(:has(.fx-sub)) { grid-template-columns: 82px 1fr 62px; }
.fx-param input[type=range] { --c: var(--violet); width: 100%; }
.fx-param output { text-align: right; font-variant-numeric: tabular-nums; color: var(--text); font-size: 12px; }
.fx-sub { accent-color: var(--violet); margin: 0; }
.fx-switch { position: relative; display: inline-flex; cursor: pointer; }
.fx-switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.fx-rtype { margin: 0 0 8px; width: max-content; }
@media (max-width: 860px) { .fx-card.wide { grid-column: auto; } .fx-note { margin-left: 0; } }
.fx-switch input:checked + .switch { background: var(--violet); }
.fx-switch input:checked + .switch::after { transform: translateX(15px); }
.fx-switch input:focus-visible + .switch { outline: 2px solid var(--violet); outline-offset: 2px; }
