:root {
  --bg: #0b0c10;
  --panel: #12131a;
  --panel-2: #1b1d27;
  --panel-3: #272b38;
  --line: #2b2f3c;
  --line-2: #3d4254;
  --text: #e7e9ef;
  --muted: #9aa0b3;
  --accent: #5865f2;
  --accent-h: #6a76f4;
  --danger: #ef5b5b;
  --ok: #43b581;
  --radius: 10px;
  --mono: ui-monospace, "Cascadia Code", Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font: 13.5px/1.55 "Montserrat", "Segoe UI", system-ui, -apple-system, sans-serif;
  display: grid; grid-template-rows: auto minmax(0, 1fr) auto; overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
.ic { flex: none; display: block; }
.grow { flex: 1; }
[hidden] { display: none !important; }

/* barre du haut */
.top {
  display: flex; align-items: center; gap: 12px; padding: 12px 22px;
  border-bottom: 1px solid var(--line); background: var(--panel);
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; letter-spacing: .2px; margin-right: 8px; white-space: nowrap; flex: none; }
.logo { width: 20px; height: 20px; border-radius: 6px; background: var(--accent); position: relative; flex: none; }
.logo::before, .logo::after { content: ""; position: absolute; left: 4px; height: 3px; border-radius: 2px; background: #fff; }
.logo::before { top: 5px; width: 12px; }
.logo::after { top: 11px; width: 8px; opacity: .7; }
.doc-name-wrap { min-width: 0; flex: 0 1 240px; }
.doc-name {
  width: 240px; max-width: 100%; height: 38px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; padding: 0 11px; font-weight: 600;
}
.doc-name::placeholder { color: var(--muted); font-weight: 500; }
.doc-name:focus { outline: none; border-color: var(--accent); }
.save-status { font-size: 12px; color: var(--muted); font-family: var(--mono); white-space: nowrap; }
.save-status.ok::before { content: ""; display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--ok); margin-right: 6px; }
.save-status.err { color: var(--danger); }

.btn {
  display: inline-flex; align-items: center; gap: 8px; height: 38px; padding: 0 16px; border-radius: 9px;
  border: 1px solid var(--line-2); background: var(--panel-2); font-weight: 600; white-space: nowrap;
}
.btn:hover:not(:disabled) { background: var(--panel-3); }
.btn:disabled { opacity: .55; cursor: default; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover:not(:disabled) { background: var(--accent-h); }
.btn.danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.file { cursor: pointer; }
.tool {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 7px;
  border: 0; background: transparent; color: var(--muted);
}
.tool:hover:not(:disabled) { background: var(--panel-3); color: var(--text); }
.tool.danger:hover:not(:disabled) { background: rgba(239, 91, 91, .15); color: var(--danger); }
.tool:disabled { opacity: .3; cursor: default; }
.link { border: 0; background: none; padding: 0; color: var(--muted); font-size: 12px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }
.link:hover { color: var(--text); }

/* mise en page */
.tabs { display: none; }
.main { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); min-height: 0; }
.pane { min-height: 0; display: flex; flex-direction: column; }
.editor-pane { border-right: 1px solid var(--line); background: var(--panel); container-type: inline-size; container-name: ed; }
.scroll { overflow-y: auto; flex: 1; min-height: 0; }
#editor { padding: 30px 32px 72px; display: flex; flex-direction: column; gap: 32px; }

/* panneau d'envoi (étape 3) */
.dock {
  display: grid; grid-template-columns: auto minmax(220px, 520px) auto; justify-content: start; align-items: center;
  gap: 8px 14px; padding: 16px 22px; border-top: 1px solid var(--line-2); background: var(--panel);
}
.dock-step { display: flex; align-items: center; gap: 8px; }
.dock-step b { font-size: 14px; }
.hook-field {
  display: flex; align-items: center; min-width: 0;
  background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; padding-right: 3px;
}
.hook-field:focus-within { border-color: var(--accent); }
.hook-field input { flex: 1; min-width: 0; height: 42px; border: 0; background: transparent; padding: 0 11px; font-family: var(--mono); font-size: 13px; }
.hook-field input:focus { outline: none; }
.dock-actions { display: flex; gap: 8px; }
.dock-actions .btn { height: 42px; }
.send-info { grid-column: 2 / -1; color: var(--muted); font-size: 12px; min-height: 18px; }
.send-info.err { color: var(--danger); }
.send-info .link { color: #aab2ff; margin-left: 4px; }

.preview-pane { background: #313338; }
.preview-label { display: flex; align-items: center; gap: 12px; padding: 14px 22px; border-bottom: 1px solid #26282c; }
.preview-label b { font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: #dbdee1; }
.preview-label span { font-size: 12px; color: #949ba4; }
.zoom { margin-left: auto; display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: #949ba4; }
.zoom select { appearance: none; background: #1e1f22; border: 1px solid #26282c; border-radius: 6px; color: #dbdee1; height: 26px; padding: 0 22px 0 8px; font-size: 12px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%23949ba4' stroke-width='3'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 7px center; }
.zoom select:focus { outline: none; border-color: var(--accent); }
.preview { padding: 18px 16px 40px; }

/* étapes & sections */
.sec { display: flex; flex-direction: column; gap: 20px; }
.sec + .sec { border-top: 1px solid var(--line-2); padding-top: 34px; }
.step { display: flex; align-items: flex-start; gap: 14px; }
.step-n {
  flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--accent); color: #fff;
  display: grid; place-items: center; font-size: 13px; font-weight: 700; margin-top: 0;
}
.step-t { flex: 1; min-width: 0; }
.step-t h2 { margin: 0; font-size: 18px; font-weight: 700; line-height: 28px; }
.step-t p { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; line-height: 1.6; }
.step-tools { display: flex; gap: 12px; padding-top: 5px; flex: none; }
.inline-grip { letter-spacing: -2px; color: var(--text); }
.dock-step b { font-size: 14px; }

.help { background: rgba(88, 101, 242, .09); border: 1px solid rgba(88, 101, 242, .4); border-radius: 12px; padding: 16px 18px; }
.help-t { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.help ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 9px; color: #c8ccda; font-size: 12.5px; line-height: 1.6; }

.modes { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.mode-card {
  display: flex; flex-direction: column; gap: 5px; text-align: left; padding: 16px 18px; border-radius: 12px;
  background: var(--panel-2); border: 1px solid var(--line-2); color: var(--text);
}
.mode-card b { font-size: 14px; font-weight: 700; }
.mode-card span { font-size: 12px; color: var(--muted); line-height: 1.5; }
.mode-card:hover { border-color: #4a5068; }
.mode-card.on { border-color: var(--accent); background: rgba(88, 101, 242, .12); box-shadow: 0 0 0 1px var(--accent) inset; }
.mode-card.on span { color: #b9bfd3; }

.empty { border: 1px dashed #4b5166; border-radius: 12px; padding: 28px 20px; text-align: center; color: var(--muted); line-height: 1.6; }
.empty.small { padding: 12px; font-size: 13px; }
.add-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin-bottom: -4px; }

/* champs */
.card { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 12px; padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.card.grid2, .grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid2.align { align-items: end; }
.fld { display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.fld-l { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; color: #b4bacb; font-weight: 600; min-height: 16px; }
.fld-h { font-size: 11.5px; color: #7d849a; line-height: 1.5; }
.cnt { font-style: normal; font-family: var(--mono); font-weight: 500; }
.cnt.over { color: var(--danger); }
.fld input[type=text], .fld input[type=url], .fld input[type=password], .fld input[type=datetime-local], .fld select, .fld textarea, #imp-msg, .modal textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: 9px; padding: 10px 12px; min-width: 0;
}
.fld textarea, .modal textarea { resize: vertical; min-height: 60px; line-height: 1.45; field-sizing: content; }
.fld input:focus, .fld select:focus, .fld textarea:focus, #imp-msg:focus, .modal textarea:focus { outline: none; border-color: var(--accent); }
.fld select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b91a1' stroke-width='3'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 28px; }
.color-row { display: flex; gap: 8px; }
.color-row input[type=color] { width: 40px; height: 36px; padding: 2px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--bg); cursor: pointer; }
.color-row input[type=text] { flex: 1; font-family: var(--mono); background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; min-width: 0; }
.color-row input[type=text]:focus { outline: none; border-color: var(--accent); }
.chk { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; min-height: 36px; }
.chk input { position: absolute; opacity: 0; pointer-events: none; }
.chk .box { width: 18px; height: 18px; border-radius: 5px; border: 1px solid var(--line-2); background: var(--bg); display: grid; place-items: center; color: transparent; flex: none; }
.chk input:checked + .box { background: var(--accent); border-color: var(--accent); color: #fff; }
.chk input:focus-visible + .box { outline: 2px solid var(--accent); outline-offset: 2px; }
.stack-v { display: flex; flex-direction: column; }
.note { margin: 0; font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); font-weight: 500; }

/* blocs */
.stack { display: flex; flex-direction: column; gap: 14px; }
.blk { --k: var(--line-2); background: var(--panel-2); border: 1px solid var(--line-2); border-left: 4px solid var(--k); border-radius: 12px; position: relative; box-shadow: 0 1px 2px rgba(0, 0, 0, .3); transition: border-color .15s, background .15s; }
.blk.collapsed:hover { border-color: color-mix(in srgb, var(--k) 45%, var(--line-2)); }
.blk:not(.collapsed) { border-color: color-mix(in srgb, var(--k) 60%, var(--line-2)); box-shadow: 0 6px 22px rgba(0, 0, 0, .35); }
.blk:not(.collapsed) > .blk-h { border-bottom: 1px solid var(--line-2); border-radius: 8px 8px 0 0; background: color-mix(in srgb, var(--k) 10%, transparent); }
.nested .blk { background: var(--panel); }
.nested .blk:not(.collapsed) { background: var(--panel); }
.k-container { --k: #8b7cf6; }
.k-title { --k: #e879f9; }
.k-text { --k: #8b91a1; }
.k-section { --k: #38bdf8; }
.k-separator { --k: #64748b; }
.k-gallery { --k: #f59e0b; }
.k-actions { --k: #43b581; }
.k-embed { --k: #5865f2; }
.blk.dragging { opacity: .4; }
.blk.drop-before::before, .blk.drop-after::after {
  content: ""; position: absolute; left: 0; right: 0; height: 3px; border-radius: 2px; background: var(--accent);
}
.blk.drop-before::before { top: -7px; }
.blk.drop-after::after { bottom: -7px; }
.blk-h { display: flex; align-items: center; gap: 10px; min-height: 50px; padding: 6px 10px 6px 8px; cursor: pointer; user-select: none; }
.blk-h:hover { background: rgba(255, 255, 255, .02); border-radius: var(--radius); }
.grip { color: var(--muted); cursor: grab; display: grid; place-items: center; width: 18px; height: 24px; }
.grip:hover { color: var(--text); }
.chev { color: var(--muted); display: grid; transition: transform .15s; }
.collapsed .chev { transform: rotate(-90deg); }
.chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; padding: 5px 11px; border-radius: 7px; white-space: nowrap;
  background: color-mix(in srgb, var(--k) 20%, var(--panel-3)); color: color-mix(in srgb, var(--k) 40%, #fff);
}
.dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.blk-sum { flex: 1; min-width: 0; color: #aeb4c6; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.blk-tools { display: inline-flex; gap: 1px; }
.blk-h .blk-tools { opacity: 0; transition: opacity .12s; }
.blk-h:hover .blk-tools, .blk:focus-within > .blk-h .blk-tools, .blk:not(.collapsed) > .blk-h .blk-tools { opacity: 1; }
@media (hover: none) { .blk-h .blk-tools { opacity: 1; } }
.blk-b { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 16px; }
.collapsed > .blk-b { display: none; }
.nested { display: flex; flex-direction: column; gap: 12px; margin-left: 4px; padding: 4px 0 4px 20px; border-left: 2px solid var(--line-2); }
.group { display: flex; flex-direction: column; gap: 14px; padding-top: 18px; margin-top: 4px; border-top: 1px solid var(--line-2); }
.group-t { font-size: 12px; font-weight: 700; color: #c9cedc; text-transform: uppercase; letter-spacing: .07em; }
.sub-row { display: flex; flex-direction: column; gap: 12px; padding: 14px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 10px; }
.sub-row-h { display: flex; align-items: center; justify-content: space-between; }
.sub-n { font-size: 12px; font-weight: 700; color: var(--muted); }
.add {
  display: inline-flex; align-items: center; gap: 7px; align-self: flex-start; height: 36px; padding: 0 14px; border-radius: 9px;
  border: 1px dashed #4b5166; background: transparent; color: #b4bacb; font-weight: 600; font-size: 12.5px;
}
.add:hover:not(:disabled) { border-color: var(--accent); color: var(--text); background: rgba(88, 101, 242, .08); }
.add:disabled { opacity: .4; cursor: default; }
.palette { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.palette-l { font-size: 12px; color: var(--muted); font-weight: 600; margin-right: 4px; }
.add.pill { border-style: solid; background: var(--panel-2); border-color: var(--line-2); }
.add.pill { border-style: solid; background: var(--panel-2); border-color: color-mix(in srgb, var(--k, var(--line-2)) 45%, var(--line-2)); }
.add.pill .ic { color: color-mix(in srgb, var(--k, var(--muted)) 75%, #fff); }

/* lignes compactes */
.irow { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.irow-n { flex: none; width: 20px; height: 20px; border-radius: 6px; background: var(--panel-3); color: var(--muted); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.irow-tools { display: inline-flex; margin-left: auto; flex: none; }
.bare { flex: 1 1 100px; min-width: 0; height: 40px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 9px; padding: 0 12px; }
.bare.w2 { flex: 2 1 140px; }
.bare.auto { flex: none; }
.bare:focus { outline: none; border-color: var(--accent); }
select.bare { appearance: none; padding-right: 28px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238b91a1' stroke-width='3'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; }
.rowline { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; padding: 2px 0; }
.rl-l { font-size: 12px; font-weight: 600; color: var(--muted); }
.rowline .color-row input[type=text] { width: 96px; flex: none; height: 34px; padding: 0 10px; }
.rowline .color-row input[type=color] { height: 34px; }
.irow .chk, .rowline .chk { min-height: 28px; }
.txt-row { display: flex; align-items: flex-start; gap: 6px; }
.txt-row .fld { flex: 1; }
.sub-row .fld textarea { min-height: 44px; }

/* aperçu Discord */
.dc-msg { display: flex; gap: 14px; font-family: "gg sans", "Noto Sans", "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif; letter-spacing: -0.017em; color: #dbdee1; font-size: 16px; line-height: 1.375; }
.dc-avatar { flex: none; width: 40px; height: 40px; border-radius: 50%; background-size: cover; background-position: center; margin-top: 2px; }
.dc-avatar-default { background: #5865f2; display: grid; place-items: center; font-weight: 700; color: #fff; }
.dc-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.dc-head { display: flex; align-items: center; gap: 6px; }
.dc-name { font-weight: 500; color: #f2f3f5; }
.dc-tag { font-size: 10px; font-weight: 600; background: #5865f2; color: #fff; padding: 1px 5px; border-radius: 4px; line-height: 15px; }
.dc-time { font-size: 12px; color: #949ba4; margin-left: 4px; }
.dc-empty { color: #949ba4; font-size: 14px; padding: 10px 0; }
.dc-content { word-wrap: break-word; }
.dc-line { min-height: 1.375em; word-wrap: break-word; overflow-wrap: anywhere; }
.dc-h { font-weight: 700; margin: 8px 0 4px; overflow-wrap: anywhere; }
.dc-h1 { font-size: 1.5em; line-height: 1.25; }
.dc-h2 { font-size: 1.25em; line-height: 1.25; }
.dc-h3 { font-size: 1em; }
.dc-sub { font-size: 12px; color: #949ba4; line-height: 1.33; }
.dc-list { margin: 4px 0; padding-left: 24px; }
.dc-list li { padding: 2px 0; }
.dc-quote .dc-list { margin: 0; }
.dc-li-sub { margin-left: 16px; }
.dc-quote { margin: 2px 0; padding: 0 8px 0 12px; border-left: 4px solid #4e5058; border-radius: 2px; }
.dc-code { font-family: Consolas, "Andale Mono WT", monospace; font-size: .875em; background: #1e1f22; border: 1px solid #1a1b1e; border-radius: 4px; padding: 0 .2em; }
.dc-pre { margin: 6px 0; background: #2b2d31; border: 1px solid #1e1f22; border-radius: 4px; padding: 7px 10px; font-size: .875em; line-height: 1.2; overflow-x: auto; }
.dc-pre code { font-family: Consolas, "Andale Mono WT", monospace; white-space: pre; }
.dc-body a { color: #00a8fc; text-decoration: none; }
.dc-body a:hover { text-decoration: underline; }
.dc-mention { color: #c9cdfb; background: rgba(88, 101, 242, .3); border-radius: 3px; padding: 0 2px; font-weight: 500; }
.dc-time-chip { background: rgba(78, 80, 88, .6); border-radius: 3px; padding: 0 2px; }
.dc-emoji { width: 1.375em; height: 1.375em; vertical-align: bottom; }
.dc-spoiler { background: #1e1f22; color: transparent; border-radius: 3px; cursor: pointer; }
.dc-spoiler.revealed { background: rgba(255, 255, 255, .1); color: inherit; }

.dc-embed { max-width: 520px; background: #2b2d31; border: 1px solid rgba(255, 255, 255, .06); border-left: 4px solid var(--c); border-radius: 4px; }
.dc-embed-in { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; padding: 8px 16px 16px 12px; margin-top: 0; }
.dc-embed-main { grid-column: 1; min-width: 0; padding-top: 8px; }
.dc-e-author { display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 600; margin-bottom: 4px; color: #f2f3f5; }
.dc-e-author-icon, .dc-e-footer-icon { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.dc-e-title { font-size: 16px; font-weight: 600; margin-bottom: 8px; color: #f2f3f5; overflow-wrap: anywhere; }
.dc-e-desc { font-size: 14px; margin-bottom: 8px; }
.dc-e-fields { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 8px; margin-top: 8px; }
.dc-e-field { grid-column: 1 / -1; min-width: 0; }
.dc-e-field.inline { grid-column: span 4; }
.dc-e-fname { font-size: 14px; font-weight: 600; margin-bottom: 2px; color: #f2f3f5; }
.dc-e-fval { font-size: 14px; }
.dc-e-thumb { grid-column: 2; grid-row: 1; width: 80px; max-height: 80px; border-radius: 4px; object-fit: cover; margin-top: 8px; }
.dc-e-image { grid-column: 1 / -1; margin-top: 4px; }
.dc-e-image img { max-width: 100%; max-height: 300px; border-radius: 4px; display: block; }
.dc-e-footer { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-size: 12px; color: #dbdee1; margin-top: 4px; }

.dc-cont { max-width: 600px; background: #2b2d31; border: 1px solid #3f4147; border-radius: 8px; padding: 16px; display: flex; flex-direction: column; gap: 8px; position: relative; }
.dc-cont.accent { border-left: 4px solid var(--c); padding-left: 13px; }
.dc-cont.is-spoiler > * { filter: blur(18px); pointer-events: none; }
.dc-cont.is-spoiler::after { content: "SPOILER"; position: absolute; inset: 0; display: grid; place-items: center; font-size: 12px; font-weight: 700; letter-spacing: .1em; color: #fff; background: rgba(30, 31, 34, .45); border-radius: 8px; cursor: pointer; }
.dc-cont.is-spoiler.revealed > * { filter: none; pointer-events: auto; }
.dc-cont.is-spoiler.revealed::after { display: none; }
.dc-text { font-size: 14px; }
.dc-body > .dc-text { max-width: 600px; }
.dc-sep.s1 { height: 8px; }
.dc-sep.s2 { height: 16px; }
.dc-sep.line { height: 1px; margin: 4px 0; background: #3f4147; }
.dc-sep.line.s2 { margin: 8px 0; }
.dc-body > .dc-sep { max-width: 600px; }
.dc-section { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dc-section-txt { flex: 1; min-width: 0; }
.dc-section-acc { flex: none; }
.dc-thumb { width: 85px; height: 85px; border-radius: 8px; overflow: hidden; background: #1e1f22; position: relative; }
.dc-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dc-gallery { display: grid; gap: 4px; border-radius: 8px; overflow: hidden; max-width: 600px; }
.dc-gi { position: relative; overflow: hidden; background: #1e1f22; aspect-ratio: 16 / 10; }
.dc-gi img { width: 100%; height: 100%; object-fit: cover; display: block; }
.dc-gallery.g1 .dc-gi { aspect-ratio: auto; max-height: 340px; }
.dc-gallery.g1 .dc-gi img { height: auto; max-height: 340px; object-fit: contain; }
.dc-gallery.g2 { grid-template-columns: 1fr 1fr; }
.dc-gallery.g3 { grid-template-columns: 2fr 1fr; }
.dc-gallery.g3 .dc-gi:first-child { grid-row: span 2; aspect-ratio: auto; }
.dc-gallery.g4 { grid-template-columns: 1fr 1fr; }
.dc-gallery.g5 { grid-template-columns: repeat(6, 1fr); }
.dc-gallery.g5 .dc-gi:nth-child(-n+2) { grid-column: span 3; }
.dc-gallery.g5 .dc-gi:nth-child(n+3) { grid-column: span 2; }
.dc-gallery.g6 { grid-template-columns: repeat(3, 1fr); }
.dc-gi.spo img, .dc-thumb.spo img { filter: blur(24px); cursor: pointer; }
.dc-gi.spo.revealed img, .dc-thumb.spo.revealed img { filter: none; }
img.broken { visibility: hidden; }
.dc-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.dc-btn { display: inline-flex; align-items: center; gap: 8px; min-height: 32px; padding: 2px 16px; border-radius: 8px; background: #4e5058; color: #fff !important; font-size: 14px; font-weight: 500; text-decoration: none !important; }
.dc-btn:hover { background: #6d6f78; }

/* bibliothèque */
.drawer-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); opacity: 0; pointer-events: none; transition: opacity .18s; z-index: 30; }
.drawer-back.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; bottom: 0; left: 0; width: min(400px, 92vw); background: var(--panel); border-right: 1px solid var(--line);
  transform: translateX(-100%); transition: transform .2s ease; z-index: 31; display: flex; flex-direction: column;
}
.drawer.open { transform: none; }
.drawer-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px 4px; }
.drawer-h h2, .modal-h h2 { margin: 0; font-size: 16px; }
.drawer-p { margin: 0; padding: 0 16px 6px; color: var(--muted); font-size: 13px; }
.drawer-new { display: flex; gap: 8px; padding: 8px 16px; }
.lib-search { margin: 4px 16px 8px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 8px; padding: 8px 10px; }
.lib-search:focus { outline: none; border-color: var(--accent); }
.lib-list { flex: 1; overflow-y: auto; padding: 4px 10px 16px; display: flex; flex-direction: column; gap: 4px; }
.lib-item { display: flex; align-items: center; gap: 8px; padding: 10px 10px 10px 12px; border-radius: 9px; cursor: pointer; border: 1px solid transparent; }
.lib-item:hover { background: var(--panel-2); }
.lib-item.current { background: var(--panel-2); border-color: var(--line-2); }
.lib-main { flex: 1; min-width: 0; }
.lib-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-meta { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 2px; }
.tag { font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 5px; background: var(--panel-3); }
.tag.v2 { background: rgba(88, 101, 242, .22); color: #aab2ff; }
.sent { color: var(--ok); }
.lib-tools { display: flex; opacity: 0; }
.lib-item:hover .lib-tools, .lib-item.current .lib-tools { opacity: 1; }
.lib-empty { padding: 24px 12px; color: var(--muted); text-align: center; }

/* modales & toasts */
.modal-back { position: fixed; inset: 0; background: rgba(0, 0, 0, .6); display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { width: min(460px, 100%); max-height: 90vh; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: 0 24px 60px rgba(0, 0, 0, .5); }
.modal.wide { width: min(720px, 100%); }
.modal-h { display: flex; align-items: center; justify-content: space-between; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.modal-b { padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.modal-p { margin: 0; color: var(--muted); }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; align-items: center; }
.modal-actions.left { justify-content: flex-start; }
.imp-sec { display: flex; flex-direction: column; gap: 10px; }
.imp-sec + .imp-sec { border-top: 1px solid var(--line); padding-top: 14px; }
.imp-sec h3 { margin: 0; font-size: 14px; }
#json-area, #imp-json { font-family: var(--mono); font-size: 12.5px; }
.toasts { position: fixed; bottom: 86px; left: 50%; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; z-index: 60; align-items: center; width: max-content; max-width: 92vw; }
.toast { display: flex; align-items: center; gap: 14px; background: var(--panel-3); border: 1px solid var(--line-2); padding: 10px 14px; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .45); animation: pop .18s ease; }
.toast.error { border-color: var(--danger); }
.toast button { border: 0; background: transparent; color: #aab2ff; font-weight: 700; padding: 0; }
@keyframes pop { from { transform: translateY(8px); opacity: 0; } }

/* s'adapte à la largeur du panneau d'édition, pas à celle de la fenêtre */
@container ed (max-width: 520px) {
  .grid2, .card.grid2 { grid-template-columns: 1fr; }
  .grid2.align { align-items: stretch; }
  .modes { grid-template-columns: 1fr; }
  .step-tools { display: none; }
  #editor { padding: 16px 14px 40px; }
}

@media (max-width: 900px) {
  body { grid-template-rows: auto auto minmax(0, 1fr) auto; }
  .tabs { display: flex; gap: 4px; padding: 6px 16px; background: var(--bg); border-bottom: 1px solid var(--line); }
  .tabs button { flex: 1; height: 34px; border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 8px; font-weight: 600; color: var(--muted); }
  .tabs button.on { background: var(--accent); border-color: var(--accent); color: #fff; }
  .main { grid-template-columns: 1fr; }
  body[data-view="editor"] .preview-pane, body[data-view="preview"] .editor-pane { display: none; }
  .top { flex-wrap: wrap; }
  .brand-t { display: none; }
  .doc-name-wrap { flex: 1 1 140px; }
  .doc-name { width: 100%; }
  .top .btn:not(.discord) span { display: none; }
  .top .btn:not(.discord) { padding: 0 9px; }
  .btn.discord span { display: none; }
  .btn.discord { padding: 0 9px; }
  .acc-btn span { display: none; }
  .acc-btn { padding: 0 4px; }
  .dock { grid-template-columns: auto minmax(0, 1fr); }
  .dock-actions { grid-column: 1 / -1; }
  .dock-actions .btn { flex: 1; justify-content: center; }
  .send-info { grid-column: 1 / -1; }
  .toasts { bottom: 150px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* barre de défilement personnalisée */
::-webkit-scrollbar { width: 12px; height: 12px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: #2f3340; border-radius: 10px; border: 3px solid transparent; background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background: #454a5c; background-clip: content-box; border: 3px solid transparent; }
::-webkit-scrollbar-thumb:active { background: var(--accent); background-clip: content-box; border: 3px solid transparent; }
::-webkit-scrollbar-corner { background: transparent; }
.preview-pane ::-webkit-scrollbar-thumb { background: #1e1f22; background-clip: content-box; }
.preview-pane ::-webkit-scrollbar-thumb:hover { background: #111214; background-clip: content-box; }
@supports not selector(::-webkit-scrollbar) {
  * { scrollbar-width: thin; scrollbar-color: #3a3e4d transparent; }
}

/* barre de mise en forme */
.fmt-wrap { display: flex; flex-direction: column; min-width: 0; flex: 1; }
.fmtbar { display: flex; flex-wrap: wrap; align-items: center; gap: 2px; padding: 3px; background: var(--panel-3); border: 1px solid var(--line-2); border-bottom: 0; border-radius: 8px 8px 0 0; }
.fmt-wrap .fld textarea { border-radius: 0 0 8px 8px; }
.fmt { min-width: 26px; height: 24px; padding: 0 7px; border: 0; border-radius: 6px; background: transparent; color: #c3c8d6; font-size: 12px; font-weight: 600; }
.fmt:hover { background: var(--line-2); color: #fff; }
.fmt.f-bold { font-weight: 800; }
.fmt.f-italic { font-style: italic; }
.fmt.f-underline { text-decoration: underline; }
.fmt.f-strike { text-decoration: line-through; }
.fmt-sep { width: 1px; height: 14px; background: var(--line-2); margin: 0 4px; }
.lbl-above { margin-bottom: 5px; }

/* explication du bloc Section */
.sec-help { display: flex; align-items: center; gap: 12px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line); border-radius: 9px; }
.sec-help p { margin: 0; font-size: 12.5px; color: var(--muted); }
.sec-help b { color: var(--text); }
.sec-diagram { flex: none; display: flex; gap: 4px; width: 104px; height: 40px; }
.sec-diagram span { display: grid; place-items: center; font-size: 10px; font-weight: 700; border-radius: 5px; }
.sd-t { flex: 1; background: var(--panel-3); color: var(--muted); }
.sd-a { flex: none; width: 34px; background: color-mix(in srgb, #38bdf8 25%, var(--panel-3)); color: #7dd3fc; }

/* compte Discord */
.account { position: relative; }
.btn.discord { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.discord:hover:not(:disabled) { background: var(--accent-h); }
.acc-btn { display: inline-flex; align-items: center; gap: 8px; height: 34px; padding: 0 12px 0 4px; border-radius: 999px; border: 1px solid var(--line-2); background: var(--panel-2); font-weight: 600; max-width: 200px; }
.acc-btn:hover { background: var(--panel-3); }
.acc-btn img { width: 26px; height: 26px; border-radius: 50%; object-fit: cover; }
.acc-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu { position: absolute; right: 0; top: calc(100% + 8px); width: 260px; padding: 12px; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: 0 16px 40px rgba(0, 0, 0, .5); z-index: 40; display: flex; flex-direction: column; gap: 6px; }
.menu-h { font-weight: 700; }
.menu-p { margin: 0 0 6px; font-size: 12.5px; color: var(--muted); }
.menu-i { height: 34px; border-radius: 8px; border: 1px solid var(--line-2); background: var(--panel-2); font-weight: 600; }
.menu-i:hover { background: rgba(239, 91, 91, .15); border-color: var(--danger); color: var(--danger); }
.lib-account { margin: 0 16px 6px; }
.la { padding: 9px 11px; border-radius: 9px; background: var(--panel-2); border: 1px solid var(--line); font-size: 12.5px; color: var(--muted); }
.la.ok { border-color: rgba(67, 181, 129, .45); color: #b9c4bf; }
.la b { color: var(--text); }
.la small { display: block; margin-top: 3px; color: #6f7587; }
.la .link { color: #aab2ff; text-align: left; }
.steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 10px; color: #c8ccda; }
.steps a { color: #aab2ff; }
.steps code, .modal code { font-family: var(--mono); font-size: 12.5px; background: var(--bg); border: 1px solid var(--line-2); border-radius: 5px; padding: 1px 6px; }
.copyline { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.copyline code { flex: 1; min-width: 0; padding: 7px 10px; overflow-x: auto; white-space: nowrap; }

/* guide des tailles d'image */
.sz-table { width: 100%; border-collapse: collapse; }
.sz-table td { padding: 9px 8px; border-top: 1px solid var(--line); vertical-align: middle; }
.sz-table tr:first-child td { border-top: 0; }
.sz-vis { width: 84px; }
.sz-box { display: block; margin: 0 auto; border-radius: 4px; background: color-mix(in srgb, var(--accent) 35%, var(--panel-3)); border: 1px solid var(--accent); }
.sz-note { display: block; font-size: 12px; color: var(--muted); margin-top: 1px; }
.sz-dim { font-family: var(--mono); font-weight: 700; white-space: nowrap; }
.tips { background: var(--bg); border: 1px solid var(--line); border-radius: 10px; padding: 12px 14px; font-size: 13px; color: #c8ccda; }
.tips ul { margin: 6px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; }
.note .link, .sec-help .link { color: #aab2ff; font-size: inherit; }
@media (max-width: 560px) { .sz-table td:nth-child(4) { display: none; } .sz-vis { width: 70px; } }

/* menu Outils */
.more { position: relative; }
.menu.tools { width: 290px; padding: 6px; gap: 2px; }
.menu-item { display: grid; grid-template-columns: 20px 1fr; align-items: center; gap: 10px; width: 100%; text-align: left; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; }
.menu-item:hover { background: var(--panel-3); }
.menu-item .ic { color: var(--muted); }
.menu-item:hover .ic { color: var(--text); }
.mi-txt { display: flex; flex-direction: column; min-width: 0; }
.mi-txt b { font-size: 13.5px; }
.mi-txt small { font-size: 12px; color: var(--muted); }
