:root {
  --bg: #0b0c10; --panel: #13151b; --panel2: #191c24; --line: #262a35; --fg: #eceef3; --muted: #8c93a3;
  --red: #ff2d4a; --red2: #ff6a3d; --cyan: #22d3ee; --radius: 14px;
}
* { box-sizing: border-box; }
html { background: var(--bg); }
body {
  margin: 0; color: var(--fg); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(1200px 500px at 85% -10%, rgba(255, 45, 74, .14), transparent 60%),
    radial-gradient(900px 400px at -10% 10%, rgba(34, 211, 238, .07), transparent 60%), var(--bg);
  min-height: 100vh;
}
button, select, input { font: inherit; color: inherit; }
code { font: .9em ui-monospace, SFMono-Regular, Menlo, monospace; background: #1e2230; padding: 1px 5px; border-radius: 5px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

header.top { max-width: 1320px; margin: 0 auto; padding: 22px 20px 6px; display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.brand { display: flex; align-items: center; gap: 14px; }
.logo { width: 44px; height: 44px; fill: none; stroke: var(--red); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 0 10px rgba(255, 45, 74, .5)); }
h1 { margin: 0; font-size: 1.7rem; letter-spacing: -.02em; font-weight: 800; text-transform: uppercase; }
h1 span { color: var(--red); }
.brand p { margin: 2px 0 0; color: var(--muted); font-size: .92rem; }
.home { color: var(--muted); text-decoration: none; font-size: .9rem; border: 1px solid var(--line); padding: 6px 12px; border-radius: 999px; }
.home:hover { color: var(--fg); border-color: var(--red); }

main { max-width: 1320px; margin: 0 auto; padding: 10px 20px 40px; display: flex; flex-direction: column; gap: 16px; }

/* styles */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: flex; flex-direction: column; align-items: flex-start; gap: 1px; cursor: pointer;
  padding: 9px 14px; border-radius: 12px; border: 1px solid var(--line); background: var(--panel);
  transition: border-color .15s, background .15s, transform .1s;
}
.chip b { font-size: .95rem; }
.chip small { color: var(--muted); font-size: .75rem; }
.chip:hover { border-color: #3a4050; transform: translateY(-1px); }
.chip.on { border-color: var(--red); background: linear-gradient(180deg, rgba(255, 45, 74, .2), rgba(255, 45, 74, .06)); box-shadow: 0 0 0 1px var(--red) inset, 0 6px 24px rgba(255, 45, 74, .18); }
.chip.on small { color: #ffc2cb; }
.style-desc { margin: 10px 2px 0; color: var(--muted); font-size: .92rem; max-width: 900px; }

/* scène */
.stage { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 16px; }
@media (max-width: 980px) { .stage { grid-template-columns: 1fr; } }
.view, .bank, .group, .guide { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); }
.view { padding: 14px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.namebar { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; }
#name { flex: 1 1 260px; min-width: 0; background: transparent; border: 0; border-bottom: 1px dashed #3a4050; padding: 2px 0; font-size: 1.35rem; font-weight: 700; outline: none; }
#name:focus { border-bottom-color: var(--red); }
.meta { color: var(--muted); font-size: .85rem; font-variant-numeric: tabular-nums; }
.meta.warn { color: #ffb020; }
.canvas-wrap { position: relative; }
#spectro { display: block; width: 100%; height: 300px; border-radius: 10px; background: #000; }
#wave { display: block; width: 100%; height: 70px; border-radius: 8px; background: #0e1016; border: 1px solid var(--line); }
.legend { position: absolute; right: 10px; top: 8px; display: flex; gap: 12px; font-size: .75rem; color: #dfe3ea; }
.lg::before { content: ""; display: inline-block; width: 16px; height: 0; margin-right: 6px; vertical-align: middle; border-top: 2px solid var(--cyan); }
.lg.beat::before { border-top: 2px dashed #fff; }

.transport, .actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.actions .sep { flex: 1; }
button {
  cursor: pointer; padding: 8px 14px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2);
  transition: background .12s, border-color .12s, transform .08s;
}
button:hover { border-color: #3d4354; background: #1f2330; }
button:active { transform: translateY(1px); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.primary { background: var(--red); border-color: var(--red); color: #fff; font-weight: 700; }
button.primary:hover { background: #ff4760; }
button.big { padding: 9px 18px; }
button.accent { border-color: var(--cyan); color: var(--cyan); font-weight: 600; }
button.accent:hover { background: rgba(34, 211, 238, .1); }
button.toggle[aria-pressed="true"] { background: rgba(34, 211, 238, .15); border-color: var(--cyan); color: var(--cyan); }
.check, .vol { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); font-size: .88rem; }
.vol { margin-left: auto; }
.vol input { width: 110px; accent-color: var(--red); }
.check input { accent-color: var(--red); }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }

/* banque */
.bank { padding: 14px; display: flex; flex-direction: column; gap: 10px; max-height: 560px; }
.bank-head { display: flex; align-items: baseline; justify-content: space-between; }
.bank h2, .guide h2 { margin: 0; font-size: 1.05rem; }
#bankList { list-style: none; margin: 0; padding: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 4px; flex: 1; }
#bankList li { display: flex; align-items: center; gap: 6px; }
.mini { padding: 4px 9px; border-radius: 8px; font-size: .8rem; }
.mini.del { color: var(--muted); }
.mini.del:hover { color: var(--red); border-color: var(--red); }
.bname { flex: 1; min-width: 0; text-align: left; display: flex; flex-direction: column; padding: 5px 10px; border-radius: 8px; }
.bname span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; font-size: .9rem; }
.bname small { color: var(--muted); font-size: .75rem; }
.bank-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.filebtn { cursor: pointer; padding: 8px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--panel2); font-size: .95rem; }
.filebtn:hover { border-color: #3d4354; }
.filebtn input { display: none; }

/* potards */
.controls { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.group { padding: 12px 14px 14px; }
.group h3 { margin: 0 0 10px; font-size: .78rem; letter-spacing: .12em; text-transform: uppercase; color: var(--red2); }
.knobs { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 10px 6px; }
.knob, .sel { display: flex; flex-direction: column; align-items: center; gap: 2px; user-select: none; touch-action: none; outline: none; border-radius: 10px; padding: 4px 0; }
.knob { cursor: ns-resize; }
.knob:focus-visible { outline: 2px solid var(--cyan); }
.knob svg { width: 54px; height: 54px; }
.knob .track { fill: none; stroke: #2b303d; stroke-width: 4; stroke-linecap: round; }
.knob .val { fill: none; stroke: var(--red); stroke-width: 4; stroke-linecap: round; filter: drop-shadow(0 0 4px rgba(255, 45, 74, .55)); }
.knob .cap { fill: #1d212b; stroke: #353b4a; stroke-width: 1; }
.knob .ptr { stroke: #fff; stroke-width: 2.4; stroke-linecap: round; }
.knob.active .cap, .knob:hover .cap { stroke: var(--red); }
.k-value { font-size: .8rem; font-variant-numeric: tabular-nums; color: var(--fg); cursor: text; padding: 0 4px; border-radius: 4px; }
.k-value:hover { background: #222634; }
.k-label { font-size: .72rem; color: var(--muted); text-align: center; line-height: 1.2; }
.k-input { width: 76px; font-size: .8rem; padding: 1px 4px; background: #0e1016; border: 1px solid var(--cyan); border-radius: 4px; text-align: center; }
.sel { justify-content: center; }
.sel select { width: 100%; max-width: 130px; padding: 7px 6px; border-radius: 8px; background: var(--panel2); border: 1px solid var(--line); cursor: pointer; }
.sel select:hover { border-color: var(--red); }

/* guide */
.guide { padding: 16px 18px; }
.guide-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 18px; margin-top: 8px; }
.guide h3 { margin: 6px 0 6px; font-size: .95rem; color: var(--red2); }
.guide p { margin: 0 0 8px; color: #c5cad5; font-size: .9rem; }

#toast {
  position: fixed; left: 50%; bottom: 22px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none;
  background: #1e2230; border: 1px solid #3a4050; padding: 10px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5);
  transition: opacity .2s, transform .2s; max-width: 90vw;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }

.style-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.chaos { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); font-size: .88rem; margin-top: 8px; white-space: nowrap; }
.chaos input { width: 140px; accent-color: var(--red); }
#chaosVal { font-variant-numeric: tabular-nums; min-width: 3.2em; }
.filebtn.imp { border-color: #8b5cf6; color: #c4b5fd; }
.filebtn.imp:hover { background: rgba(139, 92, 246, .12); }
.view.drop { outline: 2px dashed #8b5cf6; outline-offset: -6px; }
#spectro.orig { box-shadow: 0 0 0 2px #8b5cf6; }
.import { border: 1px solid #3b2f63; background: linear-gradient(180deg, rgba(139, 92, 246, .1), rgba(139, 92, 246, .03)); border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; }
.import[hidden] { display: none; }
.imp-head { display: flex; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.imp-head b { color: #c4b5fd; }
.score { margin-left: auto; font-weight: 700; font-variant-numeric: tabular-nums; }
.score.good { color: #3ecf7a; } .score.mid { color: #ffb020; } .score.low { color: var(--red); }
.bar { height: 6px; border-radius: 3px; background: #23202f; overflow: hidden; }
#impBar { height: 100%; width: 0; background: linear-gradient(90deg, #8b5cf6, var(--cyan)); transition: width .3s; }
.imp-status { margin: 0; color: #cfd3dc; font-size: .88rem; }
.imp-actions { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.imp-actions .sep { flex: 1; }
#impAB.on { border-color: var(--cyan); color: var(--cyan); }
.group { min-width: 0; }
