:root {
  --bg: #0b0d12; --panel: #131720; --panel2: #1a1f2b; --line: #262c3a;
  --text: #e9edf5; --muted: #8b93a7; --accent: #c6ff3d; --accent-ink: #10140a;
  --danger: #ff5a5f;
  --c-zone: #f2f4f8; --c-hardpoint: #ffd23f; --c-spawn: #4cc9f0; --c-bomb: #ff5a5f; --c-other: #b388ff;
  --r: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 Inter, system-ui, sans-serif; }
a { color: inherit; }
h1, h2, h3, .brand, .chip, button, .tab { font-family: 'Barlow Condensed', sans-serif; letter-spacing: .02em; }
h1 { font-size: clamp(30px, 5vw, 44px); line-height: 1; margin: 0; text-transform: uppercase; }
h2 { font-size: 22px; margin: 0; text-transform: uppercase; }

.top { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 24px; padding: 12px 24px;
  background: rgba(11,13,18,.85); backdrop-filter: blur(10px); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 8px; font-size: 24px; font-weight: 800; text-decoration: none; }
.brand-mark { width: 14px; height: 14px; background: var(--accent); transform: rotate(45deg); }
.brand-sub { color: var(--accent); }
.top nav { display: flex; gap: 4px; flex: 1; }
.top nav a { padding: 6px 14px; border-radius: 8px; text-decoration: none; font-family: 'Barlow Condensed'; font-size: 18px;
  font-weight: 700; text-transform: uppercase; color: var(--muted); }
.top nav a.on { color: var(--accent-ink); background: var(--accent); }

main { max-width: 1280px; margin: 0 auto; padding: 28px 24px 80px; }
.head { display: flex; align-items: end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.head p { margin: 6px 0 0; color: var(--muted); }

button, .btn { cursor: pointer; border: 0; border-radius: 8px; padding: 9px 16px; font-size: 17px; font-weight: 700;
  text-transform: uppercase; background: var(--accent); color: var(--accent-ink); }
button.ghost { background: transparent; color: var(--text); border: 1px solid var(--line); }
button.ghost:hover { border-color: var(--muted); }
button.danger { background: transparent; color: var(--danger); border: 1px solid #5a2530; }
button.small { padding: 5px 12px; font-size: 15px; }
button:disabled { opacity: .5; cursor: default; }

.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tab { background: var(--panel); color: var(--muted); border: 1px solid var(--line); padding: 6px 14px; font-size: 16px; }
.tab.on { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }

.chip { display: inline-block; font-size: 13px; font-weight: 700; text-transform: uppercase; padding: 2px 8px; border-radius: 5px;
  background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
.chip.Hardpoint { color: #ffd23f; border-color: #5c4d18; }
.chip.Search { color: #ff8a8d; border-color: #5a2530; }
.chip.Hijack { color: #4cc9f0; border-color: #1c4a5a; }

/* ---- Grille maps ---- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; text-decoration: none;
  display: flex; flex-direction: column; transition: border-color .15s, transform .15s; }
a.card:hover { border-color: var(--accent); transform: translateY(-2px); }
.thumb { aspect-ratio: 1; background: #0e1118 center/contain no-repeat;
  background-image: repeating-linear-gradient(45deg, #121620 0 10px, #0e1118 10px 20px); display: grid; place-items: center; color: var(--muted); }
.thumb img { width: 100%; height: 100%; object-fit: contain; }
.card-body { padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; }
.card-body h2 { font-size: 24px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.meta { color: var(--muted); font-size: 13px; }

/* ---- Vue map ---- */
.map-layout { display: grid; grid-template-columns: 1fr 300px; gap: 18px; align-items: start; }
.viewer { position: relative; background: #07090d; border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  height: min(78vh, 900px); touch-action: none; user-select: none; cursor: grab; }
.viewer.editing { cursor: crosshair; outline: 2px solid var(--accent); outline-offset: -2px; }
.viewer.panning { cursor: grabbing; }
.stage { position: absolute; left: 0; top: 0; transform-origin: 0 0; }
.stage img { display: block; pointer-events: none; -webkit-user-drag: none; }
.co { position: absolute; transform: translate(-50%, -50%) scale(var(--inv, 1)); transform-origin: center; white-space: nowrap;
  font: 700 13px/1 Inter, sans-serif; padding: 4px 7px; border-radius: 5px; color: #0b0d12; background: var(--c);
  box-shadow: 0 1px 0 rgba(0,0,0,.6), 0 0 0 1px rgba(0,0,0,.35); pointer-events: auto; }
[data-cat=zone] { --c: var(--c-zone); } [data-cat=hardpoint] { --c: var(--c-hardpoint); }
[data-cat=spawn] { --c: var(--c-spawn); } [data-cat=bomb] { --c: var(--c-bomb); }
[data-cat=other] { --c: var(--c-other); }
.co[data-cat=bomb] { color: #fff; }
/* Zones : rectangle + nom centré dedans (la taille du texte suit la zone) */
.zn { position: absolute; display: flex; align-items: center; justify-content: center; text-align: center;
  border: calc(2px * var(--inv, 1)) solid var(--c); border-radius: calc(4px * var(--inv, 1));
  background: color-mix(in srgb, var(--c) 16%, transparent); color: #fff; font-family: 'Barlow Condensed', sans-serif;
  font-weight: 700; line-height: 1; text-transform: uppercase; overflow: hidden; pointer-events: auto;
  text-shadow: 0 0 calc(4px * var(--inv, 1)) #000, 0 0 calc(2px * var(--inv, 1)) #000; transition: background .12s; }
.zn span { padding: 0 4%; overflow-wrap: anywhere; pointer-events: none; }
.zn:hover { background: color-mix(in srgb, var(--c) 30%, transparent); }
.zn.ghost { border-style: dashed; pointer-events: none; }
.zn.sel { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 22%, transparent); overflow: visible; }
.hd { position: absolute; width: calc(12px * var(--inv, 1)); height: calc(12px * var(--inv, 1)); background: var(--accent);
  border: calc(2px * var(--inv, 1)) solid #0b0d12; border-radius: 50%; }
.hd[data-h=nw] { left: 0; top: 0; transform: translate(-50%, -50%); cursor: nwse-resize; }
.hd[data-h=se] { right: 0; bottom: 0; transform: translate(50%, 50%); cursor: nwse-resize; }
.hd[data-h=ne] { right: 0; top: 0; transform: translate(50%, -50%); cursor: nesw-resize; }
.hd[data-h=sw] { left: 0; bottom: 0; transform: translate(-50%, 50%); cursor: nesw-resize; }
.viewer.editing .co, .viewer.editing .zn { cursor: move; }
.viewer.editing[data-tool=pan], .viewer.editing.space { cursor: grab; }
.viewer.editing[data-tool=pan] .zn, .viewer.editing.space .zn, .viewer.editing[data-tool=pan] .co { cursor: grab; }
.viewer.editing[data-tool=point] { cursor: text; }
.co.sel { outline: 2px solid var(--accent); outline-offset: 2px; }
.co.hidden, .zn.hidden { display: none; }
.tools { position: absolute; left: 10px; top: 10px; z-index: 2; display: flex; gap: 4px; background: rgba(19,23,32,.92);
  border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.tools button { background: transparent; color: var(--muted); padding: 5px 10px; font-size: 15px; }
.tools button.on { background: var(--accent); color: var(--accent-ink); }
.zoom { position: absolute; right: 10px; top: 10px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.zoom button { width: 36px; height: 36px; padding: 0; font-size: 20px; background: rgba(19,23,32,.9); color: var(--text); border: 1px solid var(--line); }
.empty { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: var(--muted); padding: 20px; }
.hint { position: absolute; left: 10px; bottom: 10px; z-index: 2; font-size: 12px; color: var(--muted);
  background: rgba(11,13,18,.85); padding: 4px 8px; border-radius: 6px; }

.side { display: flex; flex-direction: column; gap: 14px; }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 14px; }
.panel h3 { margin: 0 0 10px; font-size: 17px; text-transform: uppercase; color: var(--muted); }
.legend label { display: flex; align-items: center; gap: 8px; padding: 3px 0; cursor: pointer; }
.dot { width: 12px; height: 12px; border-radius: 3px; background: var(--c); }
.colist { max-height: 300px; overflow: auto; display: flex; flex-direction: column; gap: 2px; font-size: 14px; }
.colist div { padding: 3px 6px; border-radius: 5px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.colist div:hover, .colist div.sel { background: var(--panel2); }
.status { font-size: 13px; color: var(--muted); min-height: 1.2em; }

/* ---- Formulaires ---- */
label.f { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); margin-bottom: 10px; }
input, select, textarea { font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 7px; padding: 8px 10px; width: 100%; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); }
textarea { min-height: 80px; resize: vertical; }
.checks { display: flex; gap: 12px; flex-wrap: wrap; color: var(--text); font-size: 14px; }
.checks input { width: auto; }
.row { display: flex; gap: 8px; flex-wrap: wrap; }
.row > * { flex: 1; min-width: 120px; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 14px; }

dialog { background: var(--panel); color: var(--text); border: 1px solid var(--line); border-radius: 14px; padding: 22px; width: min(560px, calc(100vw - 32px)); max-height: 90vh; }
dialog::backdrop { background: rgba(0,0,0,.65); }
dialog h2 { margin-bottom: 14px; }
.err { color: var(--danger); font-size: 14px; min-height: 1.2em; }

/* ---- Classes ---- */
.cgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.cls { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); padding: 16px; display: flex; flex-direction: column; gap: 10px; position: relative; }
.cls .role { position: absolute; top: 14px; right: 14px; }
.cls h2 { font-size: 26px; padding-right: 80px; }
.cls .weapon { font-family: 'Barlow Condensed'; font-size: 20px; font-weight: 700; color: var(--accent); text-transform: uppercase; }
.cls ul { margin: 0; padding: 0; list-style: none; display: grid; gap: 4px; }
.cls li { display: flex; gap: 8px; font-size: 14px; }
.cls li::before { content: ''; width: 6px; height: 6px; margin-top: 8px; background: var(--accent); transform: rotate(45deg); flex: none; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; font-size: 14px; }
.kv dt { color: var(--muted); } .kv dd { margin: 0; }
.sect { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: 4px; }
.notes { font-size: 14px; color: #c3c9d6; white-space: pre-wrap; border-top: 1px solid var(--line); padding-top: 10px; }
.blank { text-align: center; color: var(--muted); padding: 60px 20px; border: 1px dashed var(--line); border-radius: var(--r); }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translate(-50%, 20px); background: var(--panel2); border: 1px solid var(--line);
  padding: 10px 16px; border-radius: 8px; opacity: 0; transition: .2s; pointer-events: none; z-index: 50; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (max-width: 900px) {
  .map-layout { grid-template-columns: 1fr; }
  .viewer { height: 70vh; }
}
@media (max-width: 600px) {
  .top { padding: 10px 16px; gap: 12px; }
  .brand-sub { display: none; }
  main { padding: 20px 16px 60px; }
  .cgrid { grid-template-columns: 1fr; }
}

/* ---- Module classe (format création de classe) ---- */
dialog.wide { width: min(860px, calc(100vw - 32px)); }
.cgrid { grid-template-columns: repeat(auto-fill, minmax(min(100%, 540px), 1fr)); }
.lo { background: linear-gradient(160deg, #161b26 0%, #10141c 60%); border: 1px solid var(--line); border-radius: 14px;
  padding: 18px; display: flex; flex-direction: column; gap: 10px; position: relative; overflow: hidden; }
.lo::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px; background: linear-gradient(90deg, var(--accent), transparent 70%); }
.lo.editing { padding: 14px; background: #0f131b; }
.lo-head { display: flex; justify-content: space-between; align-items: start; gap: 12px; }
.lo-head h2 { font-size: 30px; line-height: 1.05; margin-top: 6px; }
.chip.on { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.lo-top { display: grid; grid-template-columns: 1.6fr 1fr; gap: 10px; }
.lo-side { display: grid; gap: 10px; align-content: start; }
.lo-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.lo-label { font: 700 12px/1 Inter, sans-serif; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }

.slot { display: flex; gap: 10px; align-items: center; min-width: 0; background: rgba(255,255,255,.03); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; }
.slot > div { min-width: 0; flex: 1; }
.slot.is-empty { border-style: dashed; opacity: .55; }
.slot-k { font: 600 11px/1.2 Inter, sans-serif; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); }
.slot-v { display: block; font: 700 18px/1.15 'Barlow Condensed', sans-serif; text-transform: uppercase; overflow-wrap: anywhere; }
.slot-v.big { font-size: 30px; color: var(--accent); }
.slot-v.empty { color: var(--muted); }
.ic { width: 26px; height: 26px; flex: none; fill: var(--muted); }
.slot:not(.is-empty) .ic { fill: var(--text); }
.slot.primary { flex-direction: column; align-items: stretch; gap: 10px; background: rgba(198,255,61,.04); border-color: #34401c; }
.slot-head { display: flex; gap: 10px; align-items: center; }
.slot.primary .slot-head .ic { width: 34px; height: 34px; fill: var(--accent); }
.atts { display: grid; gap: 5px; }
.att { display: grid; grid-template-columns: 112px 1fr; gap: 8px; align-items: center; font-size: 14px; }
.att-k { font: 600 11px/1.2 Inter, sans-serif; text-transform: uppercase; letter-spacing: .06em; color: var(--muted);
  border-left: 2px solid var(--accent); padding-left: 7px; }
.att-v { font-weight: 600; }
.apex { display: flex; gap: 10px; align-items: center; border-radius: 8px; padding: 8px 10px;
  background: linear-gradient(90deg, rgba(255,179,0,.16), rgba(255,179,0,.03)); border: 1px solid #5c4410; }
.apex .ic { fill: #ffb300; width: 22px; height: 22px; }
.apex .slot-k { color: #ffcf66; }
.apex.is-empty { display: none; }
.lo.editing .apex.is-empty { display: flex; }
.perks .ic { fill: #ffd23f !important; }
.perks .tier1 { border-top: 2px solid #4cc9f0; } .perks .tier2 { border-top: 2px solid #ffd23f; } .perks .tier3 { border-top: 2px solid #ff5a5f; }
.slot-in { margin-top: 3px; padding: 5px 8px; font: 700 16px/1.2 'Barlow Condensed', sans-serif; text-transform: uppercase; }
.slot-in.big { font-size: 22px; color: var(--accent); }
.lo.editing .att select, .lo.editing .att input { padding: 5px 8px; font-size: 14px; }
.lo.editing .slot.is-empty { opacity: 1; border-style: solid; }
.lo .notes { margin-top: 4px; }

@media (max-width: 640px) {
  .lo-top { grid-template-columns: 1fr; }
  .lo-row { grid-template-columns: 1fr 1fr; }
  .att { grid-template-columns: 96px 1fr; }
}
