/* Wikiclash — Mes decks et éditeur « carte des liens » (README §5.6). */
.dk-main { padding: clamp(14px, 2.6vh, 24px) var(--pad-x) clamp(10px, 2vh, 18px); min-height: 0; }
.err { color: var(--err); }
.ok { color: var(--ok); }

/* ---------- liste ---------- */
.dk-list { display: flex; flex-direction: column; gap: clamp(12px, 2.6vh, 24px); height: 100%; min-height: 0; }
.dk-lh { display: flex; align-items: baseline; justify-content: space-between; gap: 16px; border-bottom: 1px solid var(--ln); padding-bottom: 6px; }
.dk-lh .wc-h1 { border: 0; padding: 0; }
.dk-lh .n { font-size: 13px; color: var(--mut); }
.dk-tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(200px, 22vw, 260px), 1fr)); gap: clamp(12px, 1.6vw, 20px); align-content: start; overflow-y: auto; scrollbar-width: none; min-height: 0; padding: 8px 6px; }
.dk-tile { display: flex; flex-direction: column; gap: 8px; border: 1px solid var(--ln); border-top: 4px solid var(--ln2); background: var(--bg); padding: 12px; cursor: pointer; text-align: left; color: var(--ink); transition: transform 160ms ease, box-shadow 160ms ease; outline: none; }
.dk-tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); }
.dk-tile.on { outline: 2px solid var(--link); outline-offset: 2px; }
.dk-tile.act { border-top-color: var(--ok); }
.dk-tile .hd { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.dk-tile .nm { font-family: var(--serif); font-size: 22px; line-height: 1.1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dk-tile .tag { font-size: 11px; font-weight: 600; color: var(--ok); border: 1px solid var(--ok); padding: 0 6px; white-space: nowrap; }
.dk-tile .ct { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--sub); }
.dk-tile .bar { flex: 1; height: 2px; background: var(--bg3); }
.dk-tile .bar i { display: block; height: 100%; }
.dk-tile .cb { display: flex; gap: 1px; height: 5px; }
.dk-tile .wc-infobox { font-size: 12px; }
.dk-tile .ac { display: flex; gap: 8px; flex-wrap: wrap; }
.dk-tile .ac .btn { font-size: 13px; padding: 5px 12px; }
.dk-tile .ac .btn:disabled { opacity: .5; cursor: default; }
.dk-tile .lk { display: flex; gap: 14px; font-size: 12px; }
.dk-tile .lk button { border: 0; background: none; padding: 0; font: inherit; color: var(--link); cursor: pointer; }
.dk-tile .lk button.err { color: var(--err); }
.dk-tile .lk button:disabled { color: var(--mut); cursor: default; }
.dk-tile .lk button:not(:disabled):hover { text-decoration: underline; }
.dk-new { align-items: center; justify-content: center; border-style: dashed; border-top: 1px dashed var(--ln); background: var(--bg2); min-height: 180px; font: inherit; }
.dk-new span { font-family: var(--serif); font-size: 22px; color: var(--link); }
.dk-new em { font-style: normal; font-size: 12px; color: var(--mut); }

/* ---------- éditeur ---------- */
.dk-ed { display: grid; grid-template-columns: clamp(200px, 20vw, 280px) minmax(0, 1fr) clamp(210px, 21vw, 290px); gap: clamp(18px, 2.4vw, 36px); height: 100%; min-height: 0; }
.dk-left, .dk-mid, .dk-right { display: flex; flex-direction: column; gap: clamp(8px, 1.8vh, 14px); min-height: 0; min-width: 0; }
.dk-name { display: flex; flex-direction: column; gap: 2px; border-bottom: 1px solid var(--ln); padding-bottom: 6px; }
.dk-name .r { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.dk-name .nm { border: 0; background: none; padding: 0; font-family: var(--serif); font-size: clamp(24px, 4.2vh, 34px); line-height: 1.05; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; text-align: left; min-width: 0; }
.dk-name .nm:hover { color: var(--link); }
.dk-name .ct { font-size: 13px; white-space: nowrap; }
.dk-name .bar { height: 2px; background: var(--bg3); margin-top: 4px; }
.dk-name .bar i { display: block; height: 100%; transition: width 400ms var(--ease-soft); }
.dk-left .wc-infobox { font-size: 12px; }
.dk-cats { display: flex; flex-direction: column; gap: 4px; }
.dk-cats .b { display: flex; height: 6px; gap: 1px; }
.dk-cats .b i { transition: flex 400ms ease; }
.dk-cats .l { display: flex; flex-wrap: wrap; gap: 2px 10px; font-size: 11px; color: var(--sub); }
.dk-cats .l span { display: flex; align-items: center; gap: 4px; white-space: nowrap; }
.dk-cats .l i { width: 6px; height: 6px; }
.dk-rows, .dk-coll { display: flex; flex-direction: column; min-height: 0; border-top: 1px solid var(--bg3); flex: 1; }
.dk-row, .dk-crow { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; align-items: center; gap: 8px; padding: clamp(2px, .6vh, 5px) 6px; border: 0; border-bottom: 1px solid var(--bg3); background: var(--bg); cursor: pointer; text-align: left; color: var(--ink); transition: background 120ms ease; flex: none; }
.dk-row > i, .dk-crow > i { width: 8px; height: 8px; }
.dk-row .t { font-family: var(--serif); font-size: clamp(14px, 2.3vh, 16px); color: var(--link); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dk-row .d { font-size: 12px; color: var(--mut); white-space: nowrap; }
.dk-row.iso .t, .dk-row.iso .d { color: var(--err); }
.dk-row.on { background: var(--sel); }
.dk-row.on .t { color: var(--ink); }
.dk-row.hov:not(.on), .dk-row:hover:not(.on) { background: var(--bg2); }
.dk-row:focus-visible, .dk-crow:focus-visible { outline: 2px solid var(--link); outline-offset: -2px; }

.dk-mh { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--ln); padding-bottom: 6px; }
.dk-mh .t { font-family: var(--serif); font-size: clamp(20px, 3.4vh, 26px); line-height: 1; white-space: nowrap; }
.dk-mh .h { font-size: 12px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dk-graph { position: relative; flex: 1; min-height: 0; overflow: hidden; background: var(--bg); border: 1px solid var(--bg3); }
.dk-graph .eg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.dk-graph line { stroke: var(--ln); transition: stroke 200ms ease, stroke-opacity 200ms ease; }
.dk-graph line.hl { stroke: var(--link); }
.dk-graph line[data-ge] { stroke: var(--link); stroke-opacity: .8; }
.dk-node { position: absolute; left: 0; top: 0; display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: grab; touch-action: none; z-index: 2; transition: opacity 220ms ease; }
.dk-node i { width: var(--s); height: var(--s); border-radius: 50%; background: var(--bg); border: 2px solid var(--rc); box-shadow: 0 0 0 3px var(--bg); transition: background 200ms ease, border-color 200ms ease; }
.dk-node span { font-family: var(--serif); font-size: var(--fs); line-height: 1; color: var(--link); background: color-mix(in srgb, var(--bg) 88%, transparent); padding: 1px 4px; white-space: nowrap; text-underline-offset: 3px; }
.dk-node.iso span { color: var(--err); }
.dk-node.foc { z-index: 5; }
.dk-node.foc span { font-weight: 600; text-decoration: underline; }
.dk-node.sel i { background: var(--ink); border-color: var(--ink); }
.dk-node.sel span { color: var(--ink); font-weight: 600; text-decoration: none; }
.dk-node.dim { opacity: .28; }
.dk-el { position: absolute; left: 0; top: 0; z-index: 4; font-family: var(--serif); font-style: italic; font-size: 12px; color: var(--link); background: color-mix(in srgb, var(--bg) 92%, transparent); padding: 0 4px; white-space: nowrap; pointer-events: none; }
.dk-ghost { position: absolute; left: 0; top: 0; z-index: 6; display: flex; flex-direction: column; align-items: center; gap: 4px; pointer-events: none; }
.dk-ghost[hidden] { display: none; }
.dk-ghost i { width: 14px; height: 14px; border-radius: 50%; background: var(--bg); border: 2px dashed var(--link); }
.dk-ghost span { font-family: var(--serif); font-size: 15px; line-height: 1; color: var(--link); background: color-mix(in srgb, var(--bg) 90%, transparent); padding: 1px 4px; white-space: nowrap; }
.dk-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-family: var(--serif); font-style: italic; font-size: 18px; color: var(--mut); pointer-events: none; }
.dk-empty[hidden] { display: none; }
.dk-ins { --rc: var(--ln); position: absolute; left: 12px; bottom: 12px; z-index: 50; width: min(300px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 6px; background: var(--bg); border: 1px solid var(--ln); border-top: 4px solid var(--rc); box-shadow: var(--shadow-card); padding: 10px 12px; opacity: 0; transform: translateY(10px); pointer-events: none; transition: opacity 220ms ease, transform 300ms var(--ease-soft); }
.dk-ins.on { opacity: 1; transform: none; pointer-events: auto; }
.dk-ins .hd { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.dk-ins .nm { font-family: var(--serif); font-size: 22px; line-height: 1.05; min-width: 0; overflow-wrap: break-word; }
.dk-ins .rr { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--rc); font-weight: 600; white-space: nowrap; }
.dk-ins .rr i { width: 7px; height: 7px; background: var(--rc); }
.dk-ins .sb { font-size: 12px; color: var(--mut); border-bottom: 1px solid var(--bg3); padding-bottom: 5px; }
.dk-ins .rl { display: flex; flex-direction: column; gap: 2px; max-height: 120px; overflow-y: auto; scrollbar-width: none; }
.dk-ins .rl button { display: flex; align-items: baseline; gap: 6px; border: 0; background: none; padding: 0; cursor: pointer; text-align: left; min-width: 0; }
.dk-ins .rl .t { font-family: var(--serif); font-size: 15px; color: var(--link); white-space: nowrap; }
.dk-ins .rl .v { font-size: 12px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dk-ins .rl p { margin: 0; font-size: 13px; }
.dk-ins .ac { display: flex; gap: 8px; align-items: center; padding-top: 2px; }
.dk-ins .ac .btn { font-size: 12px; padding: 4px 10px; color: var(--err); }
.dk-legend { display: flex; gap: 18px; align-items: center; font-size: 12px; color: var(--sub); flex-wrap: nowrap; min-height: 18px; white-space: nowrap; overflow: hidden; }
.dk-legend span { display: flex; align-items: center; gap: 6px; }
.dk-legend i { width: 22px; background: var(--ln); }
.dk-legend i.l1 { height: 1px; } .dk-legend i.l3 { height: 4px; }
.dk-legend b { font-family: var(--serif); font-weight: 400; font-size: 14px; color: var(--err); }
.dk-legend .wc-toast { margin-left: auto; overflow: hidden; text-overflow: ellipsis; }

.dk-filters { display: flex; flex-wrap: wrap; gap: 2px 12px; }
.dk-filters button { border: 0; background: none; padding: 0; font-family: var(--serif); font-size: 15px; color: var(--link); cursor: pointer; text-underline-offset: 3px; }
.dk-filters button.on { color: var(--ink); text-decoration: underline; }
.dk-filters button:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
.dk-crow .tx { display: flex; flex-direction: column; min-width: 0; }
.dk-crow .t { font-family: var(--serif); font-size: clamp(14px, 2.3vh, 16px); color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dk-crow .s { font-size: 11px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dk-crow b { font-size: 13px; font-weight: 600; white-space: nowrap; }
.dk-crow b.p { color: var(--link); } .dk-crow b.z { color: var(--err); } .dk-crow b.u { color: var(--mut); }
.dk-crow:hover { background: var(--sel); }
.dk-crow.full { cursor: not-allowed; }
.dk-coll .mut { font-size: 13px; color: var(--mut); margin: 8px 0; }
.dk-off { color: var(--mut); background: var(--bg3); border-color: var(--ln2); cursor: default; }
.wc-top [data-top-right] .btn { font-size: 13px; padding: 6px 14px; }
@media (prefers-reduced-motion: reduce) { .dk-name .bar i, .dk-cats .b i { transition: none; } }

/* ---------- éditeur v2 : collection en cartes entières au centre, carte des liens + aperçu à droite ---------- */
.dk-ed { grid-template-columns: clamp(190px, 17vw, 260px) minmax(0, 1fr) clamp(270px, 27vw, 400px); }
.dk-tools { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dk-tools .dk-filters { flex: 1; min-width: 0; }
.dk-tools .wc-input { width: clamp(120px, 12vw, 180px); padding: 4px 8px; font-size: 13px; flex: none; }
.dk-sub { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.dk-sub .wc-toast { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.dk-cgrid { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(clamp(112px, 15vh, 160px), 1fr)); gap: clamp(10px, 1.4vw, 16px); align-content: start; padding: 8px 6px 12px 4px; border-top: 1px solid var(--bg3); }
.dk-cgrid > .mut { grid-column: 1 / -1; }
.dk-cc { position: relative; cursor: pointer; outline: none; transition: transform 160ms ease; }
.dk-cc .wcard { width: 100%; }
.dk-cc:hover { transform: translateY(-3px); }
.dk-cc.on .wc-in { outline: 2px solid var(--link); outline-offset: 2px; }
.dk-cc .gain { position: absolute; top: -6px; right: -6px; z-index: 4; min-width: 26px; text-align: center; background: var(--bg); border: 1px solid currentColor; font-size: 12px; font-weight: 700; padding: 1px 5px; pointer-events: none; }
.dk-cc .gain.p { color: var(--link); } .dk-cc .gain.z { color: var(--err); } .dk-cc .gain.u { color: var(--mut); }
.dk-cc .add { position: absolute; left: 50%; top: 46%; z-index: 4; transform: translate(-50%, calc(-50% + 6px)); opacity: 0; border: 1px solid var(--link); background: var(--link); color: var(--on); font-size: 12px; font-weight: 700; padding: 3px 10px; cursor: pointer; white-space: nowrap; transition: opacity 140ms ease, transform 160ms ease; box-shadow: var(--shadow-card); }
.dk-cc:hover .add, .dk-cc.on .add, .dk-cc .add:focus-visible { opacity: 1; transform: translate(-50%, -50%); }
.dk-cc .add:disabled { background: var(--bg3); border-color: var(--ln2); color: var(--mut); cursor: not-allowed; }
.dk-cc.full { cursor: default; }

.dk-right { gap: 8px; }
.dk-right .dk-graph { flex: 0 0 auto; height: clamp(130px, 26vh, 280px); }
.dk-right .dk-legend { gap: 12px; font-size: 11px; }
.dk-graph.compact .dk-node span { display: none; }
.dk-graph.compact .dk-node.foc span, .dk-graph.compact .dk-node.sel span, .dk-graph.compact .dk-node.nb span, .dk-graph.compact .dk-node.gr span { display: block; }
.dk-graph.compact .dk-el { font-size: 11px; }
.dk-prev { --rc: var(--ln); flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 6px; border: 1px solid var(--ln); border-top: 4px solid var(--rc); background: var(--bg); padding: 10px 12px; overflow: hidden; }
.dk-prev .dk-pe { margin: auto 0; font-family: var(--serif); font-style: italic; font-size: 15px; color: var(--mut); text-align: center; }
.dk-prev .hd { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.dk-prev .nm { font-family: var(--serif); font-size: clamp(18px, 3vh, 22px); line-height: 1.05; min-width: 0; overflow-wrap: break-word; }
.dk-prev .rr { display: flex; align-items: center; gap: 5px; font-size: 11px; color: var(--rc); font-weight: 600; white-space: nowrap; }
.dk-prev .rr i { width: 7px; height: 7px; background: var(--rc); }
.dk-prev .sb { font-size: 12px; color: var(--mut); border-bottom: 1px solid var(--bg3); padding-bottom: 5px; }
.dk-prev .rl { display: flex; flex-direction: column; gap: 2px; flex: none; max-height: 30%; overflow-y: auto; scrollbar-width: none; }
.dk-prev .rl button { display: flex; align-items: baseline; gap: 6px; border: 0; background: none; padding: 0; cursor: pointer; text-align: left; min-width: 0; }
.dk-prev .rl .t { font-family: var(--serif); font-size: 14px; color: var(--link); white-space: nowrap; }
.dk-prev .rl .v { font-size: 11px; color: var(--mut); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dk-prev .rl .mut, .dk-prev p { margin: 0; font-size: 12px; }
.dk-prev .wc-lkbox { flex: 1; min-height: 0; }
.dk-prev .ac { display: flex; gap: 10px; align-items: center; flex: none; padding-top: 4px; }
.dk-prev .ac .btn { font-size: 12px; padding: 4px 10px; }
.dk-prev .ac .btn-l { color: var(--err); }
@media (max-height: 640px) { .dk-right .dk-graph { height: clamp(110px, 24vh, 150px); } .dk-right .dk-legend { display: none; } }
@media (max-height: 640px) { .dk-prev .rl { max-height: 48px; } .dk-prev { padding: 8px 10px; gap: 4px; } .dk-prev .sb { padding-bottom: 3px; } }
@media (max-height: 699px) {
  .dk-right.pinned .dk-graph, .dk-right.pinned .dk-legend, .dk-right.pinned > .dk-mh { display: none; }
}
.dk-prev .rl { max-height: 22%; }
.dk-cc .gain.c { color: var(--sub); }
/* aperçu de la carte au survol (liste du deck, graphe) */
.dk-hover { position: fixed; z-index: 80; pointer-events: none; opacity: 0; transform: scale(.97); transition: opacity 140ms ease, transform 180ms var(--ease-soft); filter: drop-shadow(0 18px 28px rgba(var(--shr), .35)); }
.dk-hover.on { opacity: 1; transform: none; }
.dk-hover .wcard { width: 100%; }
@media (prefers-reduced-motion: reduce) { .dk-hover { transition: none; } }
/* taille des cartes, étapes « partir d'une carte » */
.dk-tools .r { display: flex; gap: 10px; align-items: center; flex: none; }
.dk-size button { padding: 3px 9px; font-size: 12px; }
.dk-cgrid { grid-template-columns: repeat(auto-fill, minmax(var(--dkw, 150px), 1fr)); }
.dk-grp { grid-column: 1 / -1; margin: 6px 0 0; font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--sub); border-bottom: 1px solid var(--bg3); padding-bottom: 4px; }
.dk-grp:first-child { margin-top: 0; }
.dk-grp.start { letter-spacing: 0; text-transform: none; font-family: var(--serif); font-style: italic; font-size: 16px; color: var(--link); border: 0; padding: 0 0 4px; }
.dk-cc.far { opacity: .5; transition: opacity 160ms ease, transform 160ms ease; }
.dk-cc.far:hover, .dk-cc.far.on { opacity: 1; }
/* zoom du graphe */
.dk-zoom { position: absolute; top: 8px; right: 8px; z-index: 7; display: flex; flex-direction: column; border: 1px solid var(--ln); background: var(--bg); box-shadow: var(--shadow-card); }
.dk-zoom button { width: 26px; height: 26px; border: 0; background: none; color: var(--link); font-size: 16px; line-height: 1; cursor: pointer; }
.dk-zoom button + button { border-top: 1px solid var(--bg3); }
.dk-zoom button:hover { background: var(--sel); }
.dk-zoom button:focus-visible { outline: 2px solid var(--link); outline-offset: -2px; }
.dk-graph { cursor: grab; }
.dk-graph.panning { cursor: grabbing; }
/* carte des liens agrandie : elle couvre toute la zone de l'éditeur */
.dk-ed { position: relative; }
.dk-ed.gmax .dk-graph { position: absolute; inset: 0; z-index: 30; height: auto; box-shadow: var(--shadow-modal); }
/* changement de taille des cartes : sortie, puis entrée en cascade (comme Mes cartes) */
.dk-cgrid.dk-out .dk-cc { opacity: 0; transform: translateX(calc(var(--dir, 1) * -28px)); transition: opacity 200ms ease, transform 200ms ease; }
.dk-cgrid.dk-enter .dk-cc { opacity: 0; transform: translateX(calc(var(--dir, 1) * 28px)); transition: none; }
.dk-cgrid.dk-enter.dk-in .dk-cc { opacity: 1; transform: none; transition: opacity 260ms ease var(--d), transform 360ms var(--ease-soft) var(--d); }
.dk-cgrid.dk-enter.dk-in .dk-cc.far { opacity: .5; }
@media (prefers-reduced-motion: reduce) { .dk-cgrid.dk-out .dk-cc, .dk-cgrid.dk-enter .dk-cc { transition: none; transform: none; opacity: 1; } }
.dk-prev .rh { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; font-size: 12px; font-weight: 600; color: var(--ink); }
.dk-prev .rh em { font-style: normal; font-weight: 400; font-size: 11px; color: var(--mut); white-space: nowrap; }
.dk-cmpb { align-self: flex-start; border: 0; background: none; padding: 0; color: var(--link); font: inherit; font-size: 13px; cursor: pointer; }
.dk-cmpb:hover { text-decoration: underline; }
.dk-cmpb:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; }
