:root {
  --bg: #0b0b10;
  --panel: #111118;
  --card: #16161f;
  --card-2: #1c1c27;
  --line: #262633;
  --line-2: #32324a;
  --text: #ececf3;
  --muted: #8d8da3;
  --faint: #5d5d73;
  --accent: #ff3d7f;
  --accent-2: #7c5cff;
  --ok: #3ddc97;
  --warn: #ffb347;
  --radius: 12px;
  --left: 330px;
  --right: 340px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 13px/1.45 Inter, system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
kbd {
  font: 600 11px/1 Inter, sans-serif; padding: 2px 6px; border-radius: 5px;
  background: var(--card-2); border: 1px solid var(--line-2); border-bottom-width: 2px;
}
[hidden] { display: none !important; }

/* ---------------------------------------------------------- barre du haut */
.topbar {
  height: 52px; display: flex; align-items: center; gap: 16px; padding: 0 14px;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 8px; font-size: 17px; letter-spacing: -0.02em; min-width: 180px; color: inherit; text-decoration: none; }
.brand-accent { background: linear-gradient(135deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo {
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 8px; font-size: 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: white;
}
.brand-sub { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em; margin-left: 2px; }
.top-mid { display: flex; align-items: center; gap: 6px; flex: 1; }
.top-right { display: flex; align-items: center; gap: 10px; }
.pill {
  padding: 4px 10px; border-radius: 99px; font-size: 11.5px; font-weight: 600;
  background: var(--card-2); color: var(--muted); border: 1px solid var(--line-2); white-space: nowrap;
}
.pill.ok { color: var(--ok); border-color: rgba(61, 220, 151, 0.35); }
.pill.off { color: var(--warn); border-color: rgba(255, 179, 71, 0.35); }

.menu { position: relative; }
.menu-list {
  position: absolute; top: 36px; left: 0; z-index: 50; min-width: 260px; padding: 6px;
  background: var(--card-2); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: 0 18px 40px rgba(0,0,0,.5);
}
.menu-list button { display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 7px; }
.menu-list button:hover { background: rgba(255,255,255,.06); }
.menu-list hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }

/* ---------------------------------------------------------- boutons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--card-2); font-weight: 600; white-space: nowrap; text-decoration: none; transition: .15s;
}
.btn:hover { border-color: #4a4a66; background: #232331; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: linear-gradient(135deg, var(--accent), #ff5c5c); border-color: transparent; color: white; }
.btn-primary:hover { filter: brightness(1.08); background: linear-gradient(135deg, var(--accent), #ff5c5c); border-color: transparent; }
.btn-ghost { background: transparent; }
.btn-sm { height: 30px; padding: 0 10px; font-size: 12.5px; }
.btn-xs { height: 26px; padding: 0 8px; font-size: 11.5px; border-radius: 7px; }
.btn-block { width: 100%; }
.btn.danger { color: #ff7a7a; }
.icon-btn {
  width: 34px; height: 34px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--card-2);
  display: grid; place-items: center; font-size: 16px;
}
.icon-btn.sm { width: 28px; height: 28px; font-size: 14px; border-radius: 7px; }
.icon-btn:hover { background: #232331; }
.link { background: none; border: 0; color: var(--muted); text-decoration: underline; padding: 0; }

/* ---------------------------------------------------------- mise en page */
.app { display: grid; grid-template-columns: var(--left) 1fr var(--right); height: calc(100vh - 52px); }
.panel { background: var(--panel); overflow-y: auto; overflow-x: hidden; }
.panel.left { border-right: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.panel.right { border-left: 1px solid var(--line); }
.panel::-webkit-scrollbar, .lines::-webkit-scrollbar, .controls::-webkit-scrollbar { width: 8px; }
.panel::-webkit-scrollbar-thumb, .lines::-webkit-scrollbar-thumb { background: #2a2a38; border-radius: 8px; }

.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 9px; }
.card.grow { flex: 1; min-height: 260px; }
.card-title { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 13.5px; }
.card-title.pad { padding: 12px 14px 4px; }
.step {
  width: 20px; height: 20px; border-radius: 6px; display: grid; place-items: center; font-size: 11px;
  background: rgba(255, 61, 127, 0.14); color: var(--accent);
}
.spacer { flex: 1; }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; flex-wrap: wrap; }
.row.center { justify-content: center; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.hint { color: var(--muted); font-size: 12px; margin: 0; }
label { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
label.check { flex-direction: row; align-items: center; gap: 8px; color: var(--text); }
label.check.small { font-size: 12px; color: var(--muted); }
input[type=text], input[type=search], input[type=number], select, textarea {
  width: 100%; background: #0e0e14; border: 1px solid var(--line-2); border-radius: 8px; padding: 7px 9px; outline: none;
}
input[type=number] { width: 70px; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-2); }
textarea { resize: vertical; min-height: 120px; line-height: 1.5; }
input[type=checkbox] { accent-color: var(--accent); }

/* ---------------------------------------------------------- dépôt audio */
.drop {
  border: 1.5px dashed var(--line-2); border-radius: 10px; padding: 16px; text-align: center; cursor: pointer;
  transition: .15s; color: var(--text); display: block;
}
.drop:hover, .drop.over { border-color: var(--accent); background: rgba(255, 61, 127, 0.05); }
.drop small { color: var(--muted); }
.drop-icon { font-size: 22px; color: var(--accent); }
.drop.has-file { padding: 10px 12px; text-align: left; border-style: solid; }
.file-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------- onglets */
.tabs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 3px; background: #0e0e14; padding: 3px; border-radius: 9px; }
.tabs button { border: 0; background: none; padding: 6px 2px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 12px; }
.tabs button.on { background: var(--card-2); color: var(--text); }
.tab-body { display: flex; flex-direction: column; gap: 8px; }

.progress .bar { height: 6px; background: #0e0e14; border-radius: 6px; overflow: hidden; }
.progress .bar i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-2), var(--accent)); transition: width .3s; }
.progress-row { display: flex; justify-content: space-between; margin-top: 5px; color: var(--muted); font-size: 12px; }

.results { display: flex; flex-direction: column; gap: 5px; max-height: 260px; overflow-y: auto; }
.result {
  text-align: left; border: 1px solid var(--line); background: #0e0e14; border-radius: 8px; padding: 7px 9px;
  display: flex; flex-direction: column; gap: 2px;
}
.result:hover { border-color: var(--accent-2); }
.result b { font-size: 12.5px; }
.result small { color: var(--muted); }
.badge { display: inline-block; font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 5px; margin-left: 4px; }
.badge.sync { background: rgba(61, 220, 151, .15); color: var(--ok); }
.badge.plain { background: rgba(255, 179, 71, .15); color: var(--warn); }

/* ---------------------------------------------------------- liste des lignes */
.tools { display: flex; flex-direction: column; gap: 6px; padding: 8px; background: #0e0e14; border-radius: 9px; }
.tool-row { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; color: var(--muted); font-size: 11.5px; }
.tool-row > span { margin-right: 4px; }
.lines { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; margin: 0 -4px; padding: 0 4px; min-height: 120px; }
.line {
  display: grid; grid-template-columns: 62px 1fr auto; align-items: start; gap: 6px; padding: 6px 6px; border-radius: 8px;
  border: 1px solid transparent;
}
.line:hover { background: rgba(255,255,255,.03); }
.line.active { background: rgba(124, 92, 255, .14); border-color: rgba(124, 92, 255, .35); }
.line.sel { border-color: rgba(255, 61, 127, .5); }
.line-time {
  font: 600 11px/1 ui-monospace, Consolas, monospace; color: var(--muted); background: #0e0e14; border: 1px solid var(--line);
  border-radius: 6px; padding: 5px 4px; text-align: center;
}
.line-time:hover { color: var(--text); border-color: var(--accent-2); }
.line-text { outline: none; padding: 2px 3px; border-radius: 5px; word-break: break-word; font-size: 13px; }
.line-text:focus { background: #0e0e14; box-shadow: 0 0 0 1px var(--accent-2); }
.line-text .low { text-decoration: underline wavy rgba(255, 159, 67, .8); text-underline-offset: 3px; }
.line-actions { display: flex; gap: 2px; opacity: 0; transition: .15s; }
.line:hover .line-actions, .line.active .line-actions { opacity: 1; }
.line-actions button { width: 22px; height: 22px; border: 0; border-radius: 5px; background: none; color: var(--muted); font-size: 12px; padding: 0; }
.line-actions button:hover { background: rgba(255,255,255,.08); color: var(--text); }
.empty { color: var(--faint); text-align: center; padding: 24px 12px; font-size: 12.5px; }

/* ---------------------------------------------------------- scène */
.stage { display: flex; flex-direction: column; min-width: 0; background: #09090d; }
.stage-bar { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 8px; }
.seg { display: inline-flex; background: #0e0e14; border: 1px solid var(--line); border-radius: 9px; padding: 2px; gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 10px; border-radius: 7px; color: var(--muted); font-weight: 600; font-size: 12px; }
.seg button.on { background: var(--card-2); color: var(--text); box-shadow: 0 1px 0 rgba(255,255,255,.05) inset; }
.viewport { flex: 1; min-height: 0; display: grid; place-items: center; padding: 6px 16px 12px; position: relative; }
#preview { border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.6), 0 0 0 1px rgba(255,255,255,.06); background: #000; }
.transport { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border-top: 1px solid var(--line); background: var(--panel); flex-wrap: wrap; }
.play {
  width: 38px; height: 38px; border-radius: 50%; border: 0; font-size: 14px; color: white;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
}
.time { font: 700 14px ui-monospace, Consolas, monospace; }
.dur { color: var(--muted); font: 12px ui-monospace, Consolas, monospace; }
.range-info { color: var(--warn); font-size: 11.5px; }
.vol { display: flex; align-items: center; gap: 4px; color: var(--muted); }
.vol input { width: 70px; }
.timeline-wrap { height: 150px; border-top: 1px solid var(--line); position: relative; }
#timeline { display: block; touch-action: none; }

/* ---------------------------------------------------------- styles (préréglages) */
.presets { display: grid; grid-template-columns: repeat(3, 1fr); gap: 7px; padding: 8px 12px 12px; }
.preset {
  position: relative; border: 1.5px solid var(--line); border-radius: 10px; overflow: hidden; background: #000; padding: 0;
  display: flex; flex-direction: column; text-align: left; transition: .15s;
}
.preset:hover { border-color: #4b4b66; transform: translateY(-1px); }
.preset.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.preset canvas { width: 100%; display: block; }
.preset .p-name { font-size: 10.5px; font-weight: 600; padding: 5px 6px; background: var(--card); color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.preset .p-tag { position: absolute; top: 4px; left: 4px; font-size: 9px; font-weight: 700; padding: 1px 5px; border-radius: 4px; background: rgba(0,0,0,.6); color: #fff; }
.preset .p-del { position: absolute; top: 3px; right: 3px; width: 18px; height: 18px; border-radius: 5px; border: 0; background: rgba(0,0,0,.65); color: #fff; font-size: 11px; line-height: 1; display: none; }
.preset:hover .p-del { display: block; }
.presets-sep { grid-column: 1 / -1; color: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; margin-top: 4px; }

/* ---------------------------------------------------------- réglages */
.controls { padding: 0 12px 30px; }
.sec { border-top: 1px solid var(--line); }
.sec summary {
  list-style: none; cursor: pointer; padding: 12px 2px; font-weight: 700; display: flex; align-items: center; gap: 8px; user-select: none;
}
.sec summary::-webkit-details-marker { display: none; }
.sec summary::after { content: '▸'; margin-left: auto; color: var(--muted); transition: .15s; }
.sec[open] summary::after { transform: rotate(90deg); }
.sec-icon { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 6px; background: var(--card-2); font-size: 11px; color: var(--accent); }
.sec-body { display: flex; flex-direction: column; gap: 10px; padding: 0 2px 14px; }
.ctl { display: flex; flex-direction: column; gap: 5px; }
.ctl.inline { flex-direction: row; align-items: center; justify-content: space-between; }
.ctl-label { flex-direction: row; justify-content: space-between; align-items: center; color: var(--muted); font-size: 12px; gap: 8px; }
.ctl-val { color: var(--text); font: 600 11px ui-monospace, Consolas, monospace; }
.ctl input[type=range] { width: 100%; accent-color: var(--accent); height: 18px; }
.seg.ctl-seg, .ctl .seg { display: flex; width: 100%; }
.ctl .seg button { flex: 1; padding: 5px 4px; }
.color-wrap { display: flex; align-items: center; gap: 6px; }
.color-wrap input[type=color] { width: 30px; height: 26px; border: 1px solid var(--line-2); border-radius: 7px; background: none; padding: 1px; cursor: pointer; }
.color-wrap .hex { width: 78px; font: 11px ui-monospace, Consolas, monospace; padding: 5px 6px; }
.switch { position: relative; width: 32px; height: 18px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch i { position: absolute; inset: 0; background: #2a2a3a; border-radius: 20px; transition: .15s; }
.switch i::after { content: ''; position: absolute; width: 14px; height: 14px; left: 2px; top: 2px; background: #fff; border-radius: 50%; transition: .15s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { left: 16px; }
.ctl-toggle .ctl-label { justify-content: flex-start; color: var(--text); }
.font-btn {
  width: 100%; text-align: left; padding: 8px 10px; font-size: 16px; background: #0e0e14; border: 1px solid var(--line-2); border-radius: 8px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.font-btn::after { content: ' ▾'; font: 12px Inter; color: var(--muted); }
.media-box { display: flex; flex-direction: column; gap: 6px; }
.covers { display: flex; flex-wrap: wrap; gap: 6px; }
.cover-item { position: relative; width: 52px; height: 52px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line-2); }
.cover-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cover-item button { position: absolute; top: 2px; right: 2px; width: 16px; height: 16px; border: 0; border-radius: 4px; background: rgba(0,0,0,.7); color: #fff; font-size: 11px; line-height: 1; padding: 0; display: none; }
.cover-item:hover button { display: block; }
.cover-add { width: 52px; height: 52px; border-radius: 8px; border: 1.5px dashed var(--line-2); background: none; color: var(--muted); font-size: 20px; }
.cover-add:hover { border-color: var(--accent); color: var(--accent); }
.media-thumb { display: flex; gap: 8px; align-items: center; font-size: 12px; color: var(--muted); }
.media-thumb img, .media-thumb video { width: 42px; height: 42px; object-fit: cover; border-radius: 6px; background: #000; }

/* ---------------------------------------------------------- sélecteur de police */
.font-picker {
  position: fixed; z-index: 100; width: 340px; height: 500px; display: flex; flex-direction: column; gap: 7px; padding: 10px;
  background: var(--card-2); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 24px 60px rgba(0,0,0,.6);
}
.fp-head { display: flex; gap: 6px; }
.fp-tabs { display: flex; flex-wrap: wrap; gap: 3px; }
.fp-tabs button { border: 1px solid var(--line); background: none; border-radius: 6px; padding: 2px 7px; font-size: 11px; color: var(--muted); }
.fp-tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.fp-list { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.fp-item { text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 7px; display: flex; flex-direction: column; }
.fp-item:hover { background: rgba(255,255,255,.06); }
.fp-item.on { background: rgba(255, 61, 127, .15); }
.fp-name { font-size: 19px; line-height: 1.25; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fp-item small { color: var(--muted); font-size: 10.5px; }

/* ---------------------------------------------------------- dialogues */
.dialog { border: 1px solid var(--line-2); background: var(--card); color: var(--text); border-radius: 16px; padding: 0; width: min(480px, 94vw); box-shadow: 0 30px 80px rgba(0,0,0,.7); }
.dialog::backdrop { background: rgba(0,0,0,.6); backdrop-filter: blur(3px); }
.dialog-body { padding: 20px; display: flex; flex-direction: column; gap: 12px; }
.dialog h2 { margin: 0 0 4px; font-size: 18px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 4px; }
#ex-video { width: 100%; max-height: 50vh; border-radius: 10px; background: #000; margin-bottom: 8px; }
.kbd-table { border-collapse: collapse; font-size: 12.5px; }
.kbd-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.kbd-table td:first-child { white-space: nowrap; }

/* ---------------------------------------------------------- tap */
.tap-overlay { position: fixed; inset: 0; z-index: 80; background: rgba(5,5,9,.86); backdrop-filter: blur(6px); display: grid; place-items: center; }
.tap-box { width: min(720px, 92vw); text-align: center; display: flex; flex-direction: column; gap: 14px; align-items: center; }
.tap-progress { color: var(--muted); font-weight: 600; }
.tap-prev { color: var(--faint); font-size: 18px; min-height: 26px; }
.tap-current { font-size: 34px; font-weight: 800; min-height: 48px; letter-spacing: -0.02em; }
.tap-current .w-on { color: var(--accent); }
.tap-next { color: var(--muted); font-size: 18px; min-height: 26px; }
.tap-btn {
  width: 150px; height: 150px; border-radius: 50%; border: 0; color: #fff; font-size: 30px; font-weight: 900; margin: 10px;
  background: radial-gradient(circle at 30% 30%, #ff6a9b, var(--accent) 60%, #b3155a); box-shadow: 0 16px 50px rgba(255, 61, 127, .45);
  display: flex; flex-direction: column; align-items: center; justify-content: center; transition: transform .06s;
}
.tap-btn small { font-size: 11px; font-weight: 600; opacity: .8; }
.tap-btn.down { transform: scale(.94); }

/* ---------------------------------------------------------- notifications */
#toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast {
  background: #20202c; border: 1px solid var(--line-2); padding: 10px 16px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0,0,0,.5);
  opacity: 0; transform: translateY(8px); transition: .25s; max-width: 520px; text-align: center;
}
.toast.show { opacity: 1; transform: none; }
.toast-ok { border-color: rgba(61, 220, 151, .5); }
.toast-err { border-color: rgba(255, 90, 90, .6); }

@media (max-width: 1250px) {
  :root { --left: 290px; --right: 300px; }
  .presets { grid-template-columns: repeat(2, 1fr); }
}

/* ---------------------------------------------------------- plans (Free / Pro) */
#account-slot { display: flex; }
.preset .p-pro, .pro-chip {
  font-size: 9px; font-weight: 800; letter-spacing: 0.06em; padding: 1px 5px; border-radius: 4px;
  color: #1a1206; background: linear-gradient(135deg, #ffd36b, #ff8a4c);
}
.preset .p-pro { position: absolute; top: 4px; right: 4px; }
.pro-chip { margin-left: 6px; vertical-align: 1px; }
body.is-pro .p-pro, body.is-pro .pro-chip { display: none; }
.quota { margin: 0; font-size: 12px; color: var(--muted); }
.quota.empty { color: var(--warn); }
.quota .link { font-size: inherit; }
