:root {
  --bg: #0b0b12;
  --panel: #14141f;
  --card: #1a1a28;
  --line: #2a2a3d;
  --text: #ecebf5;
  --muted: #8d8ba6;
  --accent: #ff3d81;
  --accent2: #7c4dff;
  --ok: #2ed191;
  --err: #ff5470;
  --radius: 14px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #2a1240 0%, transparent 60%), var(--bg);
  color: var(--text);
}
h2 { font-size: 15px; margin: 0 0 12px; display: flex; align-items: center; gap: 8px; }
h3 { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 14px 0 6px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
button, input, select { font: inherit; color: inherit; }

/* brand */
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; letter-spacing: -.02em; }
.brand-large { font-size: 30px; justify-content: center; }
.brand-mark {
  width: 26px; height: 26px; border-radius: 8px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  box-shadow: 0 0 22px rgba(255, 61, 129, .55);
  animation: beat 0.5s ease-out infinite;
}
.brand-large .brand-mark { width: 36px; height: 36px; border-radius: 11px; }
@keyframes beat { 0% { transform: scale(1.15); } 100% { transform: scale(1); } }
@media (prefers-reduced-motion: reduce) { .brand-mark, .pulse { animation: none !important; } }

/* buttons */
.btn {
  border: 1px solid var(--line); background: var(--card); padding: 8px 14px; border-radius: 10px;
  cursor: pointer; text-decoration: none; display: inline-flex; align-items: center; gap: 6px;
  transition: transform .08s, background .15s, border-color .15s;
}
.btn:hover:not(:disabled) { border-color: #4a4a68; }
.btn:active:not(:disabled) { transform: scale(.97); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent2)); border: 0; font-weight: 600; color: #fff; }
.btn-danger { background: var(--err); }
.btn-ghost { background: transparent; }
.btn-round { width: 44px; height: 44px; border-radius: 50%; justify-content: center; padding: 0; font-size: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); border: 0; color: #fff; flex: none; }

/* login */
.login-body { display: grid; place-items: center; padding: 24px; }
.login-card {
  width: min(380px, 100%); background: rgba(26, 26, 40, .85); border: 1px solid var(--line);
  border-radius: 20px; padding: 36px 30px; box-shadow: 0 30px 80px rgba(0, 0, 0, .5); backdrop-filter: blur(10px);
}
.login-sub { text-align: center; color: var(--muted); margin: 6px 0 24px; }
.login-form { display: grid; gap: 14px; }
.login-form label { display: grid; gap: 6px; font-size: 13px; color: var(--muted); }
.login-form input {
  background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 11px 12px; color: var(--text);
}
.login-form input:focus { outline: 2px solid var(--accent2); outline-offset: 0; border-color: transparent; }
.login-form .btn { justify-content: center; padding: 12px; margin-top: 6px; }
.login-error { background: rgba(255, 84, 112, .12); border: 1px solid rgba(255, 84, 112, .4); color: #ffb3c0;
  padding: 10px 12px; border-radius: 10px; margin: 0 0 16px; }

/* layout */
.topbar { display: flex; justify-content: space-between; align-items: center; padding: 12px 22px;
  border-bottom: 1px solid var(--line); background: rgba(11, 11, 18, .7); backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.topbar form { margin: 0; }
.user { color: var(--muted); }
.layout { display: grid; grid-template-columns: 360px 1fr; gap: 18px; padding: 18px; max-width: 1600px; margin: 0 auto; }
@media (max-width: 960px) { .layout { grid-template-columns: 1fr; } }
.panel { display: grid; gap: 14px; align-content: start; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.step { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); font-size: 12px; color: #fff; }

/* drop zones */
.drops { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.drop { border: 1.5px dashed #3a3a55; border-radius: 12px; padding: 14px 10px; text-align: center; cursor: pointer;
  display: grid; gap: 2px; transition: border-color .15s, background .15s; min-width: 0; }
.drop:hover, .drop:focus-visible, .drop-over { border-color: var(--accent); background: rgba(255, 61, 129, .06); outline: none; }
.drop-done { border-style: solid; border-color: rgba(46, 209, 145, .55); }
.drop-icon svg { width: 26px; height: 26px; fill: none; stroke: var(--accent); stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.drop-title { font-weight: 600; }
.drop-name { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.analysis { margin-top: 12px; display: grid; gap: 6px; }
.progress { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.progress div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent2)); transition: width .2s; }

/* effects */
.presets { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1px solid var(--line); background: var(--bg); border-radius: 999px; padding: 5px 11px; cursor: pointer; font-size: 12px; }
.chip:hover { border-color: var(--accent); }
.fx { display: grid; grid-template-columns: auto 1fr 110px; align-items: center; gap: 10px; padding: 5px 0; }
.fx-label { color: var(--muted); }
.fx-on .fx-label { color: var(--text); }
.fx input[type=range] { opacity: .35; }
.fx-on input[type=range] { opacity: 1; }
.switch { position: relative; width: 34px; height: 20px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; background: #33334a; border-radius: 999px; transition: background .15s; }
.switch span::after { content: ""; position: absolute; width: 14px; height: 14px; left: 3px; top: 3px; border-radius: 50%;
  background: #fff; transition: transform .15s; }
.switch input:checked + span { background: linear-gradient(135deg, var(--accent), var(--accent2)); }
.switch input:checked + span::after { transform: translateX(14px); }
.switch input:focus-visible + span { outline: 2px solid var(--accent2); outline-offset: 2px; }
input[type=range] { accent-color: var(--accent); width: 100%; }

.row { display: grid; grid-template-columns: 1fr 1.4fr; align-items: center; gap: 10px; margin: 8px 0; color: var(--muted); }
.row.slider { grid-template-columns: 1fr auto; }
.row.slider input { grid-column: 1 / -1; }
.row output { color: var(--text); font-variant-numeric: tabular-nums; }
select, input[type=number] { background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 8px; min-width: 0; }
input[type=number] { width: 80px; }

/* stage */
.stage { display: grid; gap: 14px; align-content: start; min-width: 0; }
.viewport { position: relative; background: #000; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line);
  height: min(68vh, 760px); display: grid; place-items: center; }
#canvas { display: block; }
.placeholder { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted);
  background: radial-gradient(circle at 50% 45%, #1d1230 0%, #000 70%); }
.placeholder-inner { display: grid; gap: 18px; justify-items: center; }
.pulse { width: 90px; height: 90px; border-radius: 50%; background: linear-gradient(135deg, var(--accent), var(--accent2));
  animation: pulse 0.5s ease-out infinite; box-shadow: 0 0 60px rgba(255, 61, 129, .5); }
@keyframes pulse { 0% { transform: scale(1.18); opacity: 1; } 100% { transform: scale(.92); opacity: .75; } }
.rec-badge { position: absolute; top: 12px; left: 12px; background: rgba(0, 0, 0, .6); color: var(--err);
  padding: 4px 10px; border-radius: 999px; font-weight: 700; font-size: 12px; }

.transport { display: grid; grid-template-columns: auto auto auto 1fr; align-items: center; gap: 14px; padding: 10px 14px; }
.time { font-variant-numeric: tabular-nums; color: var(--muted); min-width: 92px; }
.bpm { font-weight: 700; background: var(--bg); border-radius: 999px; padding: 4px 10px; font-size: 12px; }
.bpm:empty { display: none; }
.timeline { width: 100%; height: 56px; background: var(--bg); border-radius: 8px; cursor: pointer; touch-action: none; }
@media (max-width: 640px) { .transport { grid-template-columns: auto 1fr auto; } .timeline { grid-column: 1 / -1; } }

.export-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; color: var(--muted); }
.export-row label { display: flex; align-items: center; gap: 6px; }
.export-row #export { margin-left: auto; }
.downloads { display: grid; gap: 12px; margin-top: 10px; }
.download { display: grid; grid-template-columns: 200px 1fr; gap: 14px; align-items: center; background: var(--bg);
  border-radius: 12px; padding: 10px; }
.download video { width: 100%; max-height: 200px; border-radius: 8px; background: #000; }
.download-meta { display: grid; gap: 8px; justify-items: start; }

/* toasts */
.toast { position: fixed; bottom: 22px; left: 50%; transform: translateX(-50%); background: var(--card);
  border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; z-index: 50; box-shadow: 0 10px 30px rgba(0,0,0,.5);
  transition: opacity .5s; max-width: calc(100vw - 40px); }
.toast-error { border-color: var(--err); }
.toast-ok { border-color: var(--ok); }
.toast-out { opacity: 0; }
