/* =====================================================================
   NADESP — thème "tvspk"
   Toutes les couleurs sont ici : modifier ce bloc suffit à changer le thème.
   ===================================================================== */
/* Polices hébergées localement (licence SIL OFL, voir /fonts) */
@font-face { font-family: 'Teko'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/teko-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Teko'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/teko-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Teko'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/teko-latin-700-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 400; font-display: swap; src: url('/fonts/inter-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 500; font-display: swap; src: url('/fonts/inter-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 600; font-display: swap; src: url('/fonts/inter-latin-600-normal.woff2') format('woff2'); }
@font-face { font-family: 'Inter'; font-style: normal; font-weight: 700; font-display: swap; src: url('/fonts/inter-latin-700-normal.woff2') format('woff2'); }

:root {
  --bg: #0A0A0B;
  --surface: #141416;
  --surface-2: #1C1C1F;
  --surface-3: #232327;
  --border: #2A2A2E;
  --accent: #C80000;
  --accent-hover: #E01010;
  --accent-dark: #980606;
  --accent-deep: #770202;
  --accent-glow: rgba(200, 0, 0, .35);
  --silver: #C0C0C0;
  --chip-rim: #C8C8C8;
  --text: #EDEDED;
  --text-muted: #9A9A9A;
  --twitch: #9146FF;
  --smoke: #B8B8B8;
  --molotov: #FF7A00;
  --flash: #FFFFFF;
  --he: #5FBF3A;
  --ok: #3FB950;
  --danger: #FF4D4D;
  --radius: 5px;
  --font-title: 'Teko', 'Saira Condensed', 'Arial Narrow', sans-serif;
  --font-body: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --topbar-h: 64px;
  --scratch: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cg stroke='%23fff' stroke-width='.6' opacity='.5' fill='none'%3E%3Cpath d='M12 40 L90 18'/%3E%3Cpath d='M40 120 L150 90'/%3E%3Cpath d='M120 30 L200 60'/%3E%3Cpath d='M20 190 L110 160'/%3E%3Cpath d='M140 180 L210 150'/%3E%3Cpath d='M70 70 L95 140'/%3E%3Cpath d='M160 110 L175 200'/%3E%3C/g%3E%3C/svg%3E");
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--font-body);
  -webkit-font-smoothing: antialiased;
  display: flex; flex-direction: column;
  min-height: 100dvh;
}
a { color: var(--accent-hover); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: #fff; }

/* ---------- Titres façon panneaux tvspk ---------- */
.title, h1, h2, h3 {
  font-family: var(--font-title);
  font-weight: 700; text-transform: uppercase; font-style: italic;
  letter-spacing: .02em; line-height: 1; margin: 0;
}
h1 { font-size: 40px; } h2 { font-size: 30px; } h3 { font-size: 22px; }
.muted { color: var(--text-muted); }
.sub { color: var(--text-muted); font-style: italic; font-size: 13px; }

/* ---------- Barre du haut ---------- */
.topbar {
  position: sticky; top: 0; z-index: 50;
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 16px;
  padding: 0 16px;
  background: linear-gradient(180deg, #000 0%, var(--surface) 100%);
  border-bottom: 1px solid var(--border);
}
.topbar::after { /* fin liseré rouge */
  content: ''; position: absolute; left: 0; right: 0; bottom: -1px; height: 2px;
  background: linear-gradient(90deg, transparent, var(--accent) 20%, var(--accent) 80%, transparent);
  opacity: .7;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none !important; }
.brand-logo { width: 44px; height: 44px; filter: drop-shadow(0 0 8px rgba(200,0,0,.35)); transition: transform .4s; }
.brand:hover .brand-logo { transform: rotate(60deg); }
.brand-text { display: flex; flex-direction: column; line-height: .85; }
.brand-name { font-family: var(--font-title); font-weight: 700; font-style: italic; font-size: 32px; letter-spacing: .04em; }
.brand-sub { font-style: italic; color: var(--text-muted); font-size: 12px; padding-left: 2px; }
.topnav { margin-left: auto; display: flex; align-items: center; gap: 6px; }
.navlink {
  font-family: var(--font-title); font-size: 21px; font-style: italic; text-transform: uppercase; letter-spacing: .03em;
  color: var(--text-muted); padding: 6px 10px; border-radius: var(--radius); border-left: 3px solid transparent;
  text-decoration: none !important; display: inline-flex; align-items: center; gap: 6px;
}
.navlink:hover { color: var(--text); background: var(--surface-2); }
.navlink.active { color: var(--text); border-left-color: var(--accent); background: var(--surface-2); }
.navlink svg { width: 18px; height: 18px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; object-fit: cover; background: var(--surface-3); border: 2px solid var(--border); flex: none; }
.avatar.sm { width: 22px; height: 22px; border-width: 1px; }
.avatar-fallback { display: inline-grid; place-items: center; font-family: var(--font-title); font-size: 18px; color: var(--silver); }
.avatar.sm.avatar-fallback { font-size: 13px; }

.app { flex: 1; width: 100%; }
.page { max-width: 1200px; margin: 0 auto; padding: 24px 16px 48px; }

/* ---------- En-tête de section façon panneau Twitch ---------- */
.panel-head {
  position: relative; overflow: hidden;
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; margin: 28px 0 16px;
  background: linear-gradient(90deg, #000 0%, var(--surface-2) 100%);
  border-radius: var(--radius);
  border-left: 3px solid var(--accent);
}
.panel-head::before { /* texture diagonale + rayures métal */
  content: ''; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(135deg, rgba(255,255,255,.022) 0 2px, transparent 2px 7px);
  opacity: 1;
}
.panel-head::after { /* rayures « métal usé » du crâne, très discrètes */
  content: ''; position: absolute; inset: 0; pointer-events: none; background: var(--scratch); opacity: .07;
}
.panel-head .ph-icon {
  position: relative; width: 38px; height: 38px; display: grid; place-items: center; color: var(--silver);
  padding-right: 14px; border-right: 1px solid #3a3a3f; box-sizing: content-box;
}
.panel-head .ph-icon svg { width: 30px; height: 30px; }
.panel-head .ph-text { position: relative; display: flex; flex-direction: column; gap: 2px; }
.panel-head .ph-title { font-size: 30px; }
.panel-head .ph-sub { color: var(--text-muted); font-style: italic; font-size: 13px; }
.panel-head .ph-right { position: relative; margin-left: auto; display: flex; gap: 8px; align-items: center; }
.panel-head:first-child { margin-top: 0; }

/* ---------- Boutons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 16px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--text); cursor: pointer;
  font-family: var(--font-title); font-size: 19px; font-style: italic; text-transform: uppercase; letter-spacing: .03em; line-height: 1;
  transition: background .15s, box-shadow .15s, border-color .15s, color .15s; white-space: nowrap;
  text-decoration: none !important;
}
.btn svg { width: 18px; height: 18px; flex: none; }
.btn:hover { border-color: #444; background: var(--surface-3); box-shadow: 0 0 14px var(--accent-glow); }
.btn:disabled { opacity: .45; cursor: not-allowed; box-shadow: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger); }
.btn.danger:hover { background: rgba(255,77,77,.1); }
.btn.twitch { background: var(--twitch); border-color: var(--twitch); color: #fff; }
.btn.twitch:hover { box-shadow: 0 0 14px rgba(145,70,255,.5); }
.btn.ghost { background: transparent; }
.btn.sm { padding: 6px 10px; font-size: 16px; }
.btn.icon { padding: 8px; }
.btn.block { width: 100%; }
.iconbtn {
  width: 36px; height: 36px; display: inline-grid; place-items: center; border-radius: var(--radius);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--text); cursor: pointer;
}
.iconbtn:hover { box-shadow: 0 0 12px var(--accent-glow); }
.iconbtn svg { width: 18px; height: 18px; }

/* ---------- Formulaires ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field > label, .label {
  font-family: var(--font-title); font-size: 18px; font-style: italic; text-transform: uppercase; letter-spacing: .03em; color: var(--silver);
}
.field .hint { font-size: 12px; color: var(--text-muted); font-style: italic; }
.input, select.input, textarea.input {
  width: 100%; padding: 10px 12px; border-radius: var(--radius);
  background: #0E0E10; border: 1px solid var(--border); color: var(--text); outline: none;
}
.input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(200,0,0,.18); }
textarea.input { min-height: 90px; resize: vertical; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.check { display: flex; gap: 10px; align-items: center; cursor: pointer; user-select: none; }
.check input { width: 18px; height: 18px; accent-color: var(--accent); }
.error-text { color: var(--danger); font-size: 13px; }

/* Choix (types, camps, techniques) */
.choices { display: flex; flex-wrap: wrap; gap: 8px; }
.choice {
  display: inline-flex; align-items: center; gap: 6px; padding: 7px 12px; cursor: pointer; user-select: none;
  border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); color: var(--text-muted);
  font-size: 14px; font-weight: 500; transition: all .15s;
}
.choice:hover { color: var(--text); border-color: #444; }
.choice.on { color: var(--text); border-color: var(--accent); background: rgba(200,0,0,.14); box-shadow: inset 3px 0 0 var(--accent); }
.choice svg { width: 18px; height: 18px; }
.choice.type-choice { font-family: var(--font-title); font-size: 19px; font-style: italic; text-transform: uppercase; padding: 8px 14px; }

/* ---------- Jeton (motif du logo tvspk) ---------- */
.chip-svg { display: block; width: 100%; height: auto; }
.spinner { width: 42px; height: 42px; animation: spin 1.1s linear infinite; filter: drop-shadow(0 0 8px var(--accent-glow)); }
.spinner.sm { width: 22px; height: 22px; }
@keyframes spin { to { transform: rotate(360deg); } }
.loading { display: grid; place-items: center; padding: 60px 0; gap: 12px; color: var(--text-muted); font-style: italic; }

/* ---------- Accueil : grille de cartes ---------- */
.map-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 18px; }
.map-card {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 10px;
  padding: 18px 12px 14px; border-radius: 8px; background: var(--surface); border: 1px solid var(--border);
  color: var(--text); text-decoration: none !important; transition: transform .2s, box-shadow .2s, border-color .2s;
}
.map-card:hover { transform: translateY(-3px); border-color: #3a1010; box-shadow: 0 8px 26px rgba(0,0,0,.5), 0 0 18px var(--accent-glow); }
.map-card:hover .token { transform: rotate(30deg); }
.map-card:hover .token .token-center { transform: rotate(-30deg); }
.token { position: relative; width: 120px; height: 120px; transition: transform .45s cubic-bezier(.2,.8,.2,1); }
.token .token-center {
  position: absolute; inset: 22%; border-radius: 50%; overflow: hidden; display: grid; place-items: center;
  background: radial-gradient(circle at 35% 30%, #2a2a2e, #0c0c0d); border: 2px solid rgba(0,0,0,.6);
  transition: transform .45s cubic-bezier(.2,.8,.2,1);
}
.token .token-center img { width: 100%; height: 100%; object-fit: cover; filter: saturate(.7) brightness(.9); }
.token .token-center span { font-family: var(--font-title); font-weight: 700; font-style: italic; font-size: 34px; color: var(--silver); }
.token .token-icon {
  position: absolute; inset: 17%; width: 66%; height: 66%; object-fit: contain;
  filter: drop-shadow(0 3px 6px rgba(0,0,0,.8)); transition: transform .45s cubic-bezier(.2,.8,.2,1);
}
.map-card:hover .token .token-icon { transform: rotate(-30deg) scale(1.08); }
.map-card .map-name { font-size: 26px; }
.map-card.inactive { opacity: .72; }
.map-card.inactive .token { filter: grayscale(.8); }
.map-counts { display: flex; gap: 10px; font-size: 13px; color: var(--text-muted); }
.map-counts span { display: inline-flex; align-items: center; gap: 3px; }
.map-counts svg { width: 14px; height: 14px; }
.badge {
  display: inline-flex; align-items: center; gap: 4px; padding: 2px 8px; border-radius: 3px;
  font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--text-muted); border: 1px solid var(--border);
}
.badge.red { background: var(--accent-deep); color: #fff; border-color: var(--accent-dark); }
.badge.t { background: #3b2a12; color: #EDB35C; border-color: #5a3f18; }
.badge.ct { background: #10263d; color: #7FB7F0; border-color: #1a3d5f; }
.badge svg { width: 13px; height: 13px; }
.map-card .badge.mine { position: absolute; top: 10px; right: 10px; }

/* ---------- Page carte ---------- */
.mapview { display: flex; flex-direction: column; height: calc(100dvh - var(--topbar-h)); }
.map-toolbar {
  display: flex; align-items: center; gap: 10px; padding: 10px 14px; flex-wrap: wrap;
  background: linear-gradient(90deg, #000, var(--surface)); border-bottom: 1px solid var(--border);
}
.map-toolbar .map-title { font-size: 32px; margin-right: 6px; }
.seg { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface-2); }
.seg button {
  border: 0; background: transparent; color: var(--text-muted); padding: 7px 12px; cursor: pointer;
  font-family: var(--font-title); font-size: 18px; font-style: italic; text-transform: uppercase; line-height: 1;
}
.seg button + button { border-left: 1px solid var(--border); }
.seg button.on { background: var(--accent); color: #fff; }
.seg button:hover:not(.on) { color: var(--text); }
.filterbar { display: flex; gap: 8px; padding: 8px 14px; overflow-x: auto; align-items: center; background: var(--surface); border-bottom: 1px solid var(--border); scrollbar-width: thin; }
.filterbar .sep { width: 1px; align-self: stretch; background: var(--border); flex: none; }
.filterbar .choice { flex: none; padding: 5px 10px; font-size: 13px; }
.filterbar select.input { width: auto; padding: 5px 8px; font-size: 13px; flex: none; }
.toggle-chip.on { color: var(--text); border-color: var(--silver); background: var(--surface-3); box-shadow: none; }

.map-body { flex: 1; display: flex; min-height: 0; position: relative; }
.map-stage { flex: 1; position: relative; min-width: 0; background: radial-gradient(circle at 50% 45%, #141416 0%, #060607 70%); overflow: hidden; }
.map-svg { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; user-select: none; -webkit-user-select: none; }
.map-svg.panning { cursor: grabbing; }
.map-svg.placing { cursor: crosshair; }
.map-zoom { position: absolute; right: 12px; bottom: 12px; display: flex; flex-direction: column; gap: 6px; z-index: 2; }
.floor-switch { position: absolute; left: 12px; top: 12px; z-index: 2; }
.wizard-banner {
  position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 3;
  display: flex; align-items: center; gap: 12px; padding: 8px 10px 8px 16px; border-radius: var(--radius);
  background: rgba(10,10,11,.92); border: 1px solid var(--accent); box-shadow: 0 0 20px var(--accent-glow);
  max-width: calc(100% - 24px);
}
.wizard-banner .step { font-family: var(--font-title); font-size: 22px; font-style: italic; text-transform: uppercase; }
.wizard-banner .step b { color: var(--accent-hover); }
.map-empty-hint { position: absolute; left: 12px; bottom: 12px; z-index: 2; font-size: 13px; color: var(--text-muted); font-style: italic; background: rgba(0,0,0,.6); padding: 4px 10px; border-radius: 3px; }

/* Éléments SVG de la carte */
.zone-label { font-family: var(--font-title); font-weight: 600; font-size: 22px; fill: #fff; paint-order: stroke; stroke: rgba(0,0,0,.85); stroke-width: 5px; stroke-linejoin: round; text-transform: uppercase; letter-spacing: .5px; pointer-events: none; }
.zone-label.editable { pointer-events: all; cursor: move; fill: #ffd9d9; }
.zone-label.editable.selected { fill: var(--accent-hover); }
.marker { cursor: pointer; }
.marker .ring { transition: filter .15s; }
.marker:hover .ring, .marker.selected .ring { filter: drop-shadow(0 0 6px rgba(200,0,0,.9)); }
.marker .count-bg { fill: var(--accent); stroke: #000; stroke-width: 1.5; }
.marker .count-text { font: 700 13px var(--font-body); fill: #fff; text-anchor: middle; dominant-baseline: central; pointer-events: none; }
.throw-dot { cursor: pointer; }
.traj { stroke: #fff; fill: none; opacity: .85; pointer-events: none; }   /* épaisseur gérée par la carte selon le zoom */
.traj-glow { stroke: var(--accent); opacity: .25; fill: none; pointer-events: none; }

/* ---------- Panneau latéral (fiche, listes, formulaire) ---------- */
.side-panel {
  width: 420px; max-width: 100%; flex: none; display: flex; flex-direction: column; min-height: 0;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: -10px 0 30px rgba(0,0,0,.4);
}
.side-head {
  display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--border);
  background: linear-gradient(90deg, #000, var(--surface-2));
}
.side-head .title { font-size: 26px; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side-head .type-dot { width: 30px; height: 30px; flex: none; }
.side-body { flex: 1; overflow-y: auto; padding: 14px; }
.side-foot { padding: 12px 14px; border-top: 1px solid var(--border); display: flex; gap: 8px; flex-wrap: wrap; background: var(--surface-2); }

.nade-list { display: flex; flex-direction: column; gap: 6px; }
.nade-item {
  display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: var(--radius); cursor: pointer;
  background: var(--surface-2); border: 1px solid var(--border); border-left: 3px solid transparent; text-align: left; width: 100%; color: var(--text);
}
.nade-item:hover { border-left-color: var(--accent); box-shadow: 0 0 12px var(--accent-glow); }
.nade-item .ni-icon { width: 28px; height: 28px; flex: none; }
.nade-item .ni-main { flex: 1; min-width: 0; }
.nade-item .ni-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nade-item .ni-meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.nade-item img.ni-thumb { width: 64px; height: 40px; object-fit: cover; border-radius: 3px; flex: none; }

.media-box { border-radius: var(--radius); overflow: hidden; background: #000; border: 1px solid var(--border); margin-bottom: 12px; }
.media-box video { display: block; width: 100%; aspect-ratio: 16/9; max-height: 360px; background: #000; }
.media-box .video-err { padding: 14px; font-size: 13px; color: var(--text-muted); }
.media-box iframe { display: block; width: 100%; height: 520px; border: 0; background: #fff; }
.shots { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.shot { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); background: #000; cursor: zoom-in; aspect-ratio: 16/10; }
.shot img { width: 100%; height: 100%; object-fit: cover; display: block; }
.shot .shot-label { position: absolute; left: 6px; top: 6px; font-family: var(--font-title); font-style: italic; font-size: 16px; text-transform: uppercase; padding: 1px 7px; background: rgba(0,0,0,.75); border-left: 2px solid var(--accent); }
.shot.single { grid-column: 1 / -1; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; font-size: 14px; margin: 10px 0; }
.kv dt { color: var(--text-muted); }
.kv dd { margin: 0; display: flex; gap: 6px; flex-wrap: wrap; }
.notes { white-space: pre-wrap; background: #0E0E10; border: 1px solid var(--border); border-left: 3px solid var(--silver); padding: 10px 12px; border-radius: var(--radius); font-size: 14px; }
.author-line { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-muted); margin-bottom: 12px; }
.author-line b { color: var(--text); }
.votes { display: flex; gap: 8px; margin: 12px 0; }
.vote { flex: 1; }
.vote.on.up { border-color: var(--ok); color: var(--ok); background: rgba(63,185,80,.1); }
.vote.on.down { border-color: var(--danger); color: var(--danger); background: rgba(255,77,77,.1); }

/* Traitement vidéo : planche d'images */
.dropzone {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; text-align: center;
  padding: 18px; border: 2px dashed #3a3a3f; border-radius: var(--radius); background: #0E0E10; cursor: pointer; color: var(--text-muted);
}
.dropzone:hover, .dropzone.over { border-color: var(--accent); color: var(--text); }
.dropzone svg { width: 28px; height: 28px; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.progress > div { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent-dark), var(--accent-hover)); transition: width .2s; }
.frames { display: grid; grid-template-columns: repeat(auto-fill, minmax(92px, 1fr)); gap: 6px; max-height: 300px; overflow-y: auto; padding: 2px; }
.frame { position: relative; border-radius: 3px; overflow: hidden; border: 2px solid transparent; cursor: pointer; aspect-ratio: 16/10; background: #000; }
.frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame:hover { border-color: #555; }
.frame.pose { border-color: var(--accent); }
.frame.cross { border-color: var(--silver); }
.frame .tag { position: absolute; left: 3px; bottom: 3px; font: 700 10px var(--font-body); padding: 1px 5px; border-radius: 2px; background: var(--accent); color: #fff; }
.frame.cross .tag { background: var(--silver); color: #000; }
.frame .num { position: absolute; right: 3px; top: 2px; font-size: 10px; color: #fff; text-shadow: 0 0 3px #000; }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 12px; }
.tab {
  border: 0; background: transparent; color: var(--text-muted); padding: 8px 12px; cursor: pointer; border-bottom: 2px solid transparent;
  font-family: var(--font-title); font-size: 19px; font-style: italic; text-transform: uppercase;
}
.tab.on { color: var(--text); border-bottom-color: var(--accent); }
.thumb-row { display: flex; gap: 8px; flex-wrap: wrap; }
.thumb { position: relative; width: 120px; aspect-ratio: 16/10; border-radius: 3px; overflow: hidden; border: 1px solid var(--border); background: #000; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .x { position: absolute; top: 3px; right: 3px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.8); color: #fff; cursor: pointer; display: grid; place-items: center; }
.thumb .x svg { width: 12px; height: 12px; }
.callout-box { padding: 10px 12px; border-radius: var(--radius); background: rgba(200,0,0,.1); border: 1px solid var(--accent-dark); font-size: 14px; margin-bottom: 12px; }
.callout-box.info { background: var(--surface-2); border-color: var(--border); }
details.more { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 14px; }
details.more summary { cursor: pointer; font-family: var(--font-title); font-size: 18px; font-style: italic; text-transform: uppercase; color: var(--silver); }
details.more[open] summary { margin-bottom: 10px; }

/* ---------- Admin ---------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: 8px; padding: 16px; }
.table-wrap { overflow-x: auto; }
table.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-family: var(--font-title); font-weight: 600; font-style: italic; font-size: 17px; text-transform: uppercase; color: var(--text-muted); padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 8px 10px; border-bottom: 1px solid #1f1f23; vertical-align: middle; }
.table tr:hover td { background: #121214; }
.radar-thumb { width: 44px; height: 44px; border-radius: 4px; object-fit: cover; background: #000; border: 1px solid var(--border); display: block; }
.radar-thumb.empty { display: grid; place-items: center; color: var(--text-muted); font-size: 11px; }
.status-toggle.active { color: var(--ok); border-color: rgba(63,185,80,.5); }
.zones-layout { display: grid; grid-template-columns: 1fr 320px; gap: 16px; }
.zones-stage { position: relative; aspect-ratio: 1; background: #060607; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.zone-list { display: flex; flex-direction: column; gap: 4px; max-height: 70vh; overflow-y: auto; }
.zone-row { display: flex; gap: 6px; align-items: center; padding: 5px 6px; border-radius: 4px; border: 1px solid transparent; background: var(--surface-2); }
.zone-row.unplaced { border-style: dashed; border-color: #3a3a3f; cursor: grab; }
.zone-row.selected { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent); }
.zone-row input { flex: 1; min-width: 0; background: transparent; border: 0; padding: 4px; outline: none; }
.zone-row input:focus { background: #0E0E10; }
.zone-row .iconbtn { width: 28px; height: 28px; }
.zone-row .iconbtn svg { width: 14px; height: 14px; }
.list-title { font-family: var(--font-title); font-style: italic; text-transform: uppercase; font-size: 18px; color: var(--silver); margin: 12px 0 6px; }

/* ---------- Connexion ---------- */
.login {
  min-height: 100dvh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at 50% 30%, rgba(200,0,0,.18), transparent 55%), var(--bg);
}
.login-card { width: 100%; max-width: 420px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 16px; }
.login-logo { width: 180px; height: 180px; filter: drop-shadow(0 0 30px rgba(200,0,0,.45)); animation: float 6s ease-in-out infinite; }
@keyframes float { 50% { transform: translateY(-6px) rotate(4deg); } }
.login-title { font-size: 72px; letter-spacing: .05em; }
.login-card .sub { font-size: 15px; margin-top: -10px; }
.login-box { width: 100%; padding: 20px; background: var(--surface); border: 1px solid var(--border); border-radius: 8px; border-top: 3px solid var(--accent); }
.gsi-wrap { display: flex; justify-content: center; min-height: 44px; }

/* ---------- Pied de page ---------- */
.footer {
  display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 14px 16px;
  background: linear-gradient(90deg, #000, var(--surface)); border-top: 1px solid var(--border); font-size: 13px; color: var(--text-muted);
}
.footer .socials { display: flex; gap: 6px; }
.footer .socials a { width: 32px; height: 32px; display: grid; place-items: center; border-radius: var(--radius); color: var(--silver); border: 1px solid var(--border); background: var(--surface-2); }
.footer .socials a:hover { color: #fff; box-shadow: 0 0 12px var(--accent-glow); text-decoration: none; }
.footer .socials svg { width: 16px; height: 16px; }
.footer .spacer { flex: 1; }
body.fullpage .footer { display: none !important; }

/* ---------- Toasts et fenêtres ---------- */
.toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; width: max-content; max-width: calc(100% - 24px); }
.toast { pointer-events: all; padding: 10px 16px; border-radius: var(--radius); background: #111; border: 1px solid var(--border); border-left: 3px solid var(--silver); box-shadow: 0 8px 24px rgba(0,0,0,.5); animation: tin .2s ease-out; display: flex; gap: 12px; align-items: center; }
.toast.error { border-left-color: var(--danger); }
.toast.ok { border-left-color: var(--ok); }
@keyframes tin { from { transform: translateY(10px); opacity: 0; } }
.modal-back { position: fixed; inset: 0; z-index: 150; background: rgba(0,0,0,.72); display: grid; place-items: center; padding: 16px; animation: fin .15s; }
@keyframes fin { from { opacity: 0; } }
.modal { width: 100%; max-width: 460px; background: var(--surface); border: 1px solid var(--border); border-top: 3px solid var(--accent); border-radius: 8px; padding: 18px; box-shadow: 0 20px 60px rgba(0,0,0,.6); max-height: 90dvh; overflow-y: auto; }
.modal h3 { margin-bottom: 12px; font-size: 26px; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; flex-wrap: wrap; }
.lightbox { position: fixed; inset: 0; z-index: 160; background: rgba(0,0,0,.92); display: grid; place-items: center; padding: 16px; cursor: zoom-out; }
.lightbox img { max-width: 100%; max-height: 100%; border-radius: 4px; }

/* ---------- Phase 2 ---------- */
.tool-group { display: flex; gap: 4px; }
.filterbar .search { width: 190px; flex: none; padding: 5px 10px; font-size: 13px; }
.filterbar.more { background: #111113; }
.badge.warn { background: #3a2a05; color: #F2B84B; border-color: #5c430b; }
.badge.ok { background: #0f2e18; color: var(--ok); border-color: #1d4d2a; }
.star { color: #F2B84B; }
.callout-box.warn { background: #2a2006; border-color: #5c430b; }
.flags-row { display: flex; gap: 6px; margin-bottom: 12px; flex-wrap: wrap; }
.btn.flag { flex: 1; font-size: 15px; padding: 7px 8px; }
.btn.flag.on { color: #fff; border-color: var(--accent); background: rgba(200,0,0,.2); }
.btn.flag[data-flag="fav"].on { color: #F2B84B; border-color: #8a6a1c; background: rgba(242,184,75,.1); }
.btn.flag[data-flag="mastered"].on { color: var(--ok); border-color: #1d4d2a; background: rgba(63,185,80,.1); }
.console { display: flex; align-items: center; gap: 8px; background: #050506; border: 1px solid var(--border); border-left: 3px solid var(--accent); border-radius: var(--radius); padding: 6px 6px 6px 10px; margin: 10px 0; }
.console code { flex: 1; font-size: 12px; color: #9fe39f; overflow-x: auto; white-space: nowrap; }
.notes a, .c-body a { word-break: break-all; }
.comments { display: flex; flex-direction: column; gap: 8px; }
.comment { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; }
.comment .c-head { font-size: 12px; display: flex; gap: 6px; align-items: center; }
.comment .c-body { white-space: pre-wrap; }
.c-del { margin-left: auto; background: none; border: 0; color: var(--text-muted); cursor: pointer; padding: 2px; }
.c-del svg { width: 12px; height: 12px; }
.c-del:hover { color: var(--danger); }
.stat-tiles { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 10px; }
.tile { background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; text-align: center; display: flex; flex-direction: column; }
.tile b { font-family: var(--font-title); font-size: 32px; line-height: 1; }
.tile span { font-size: 12px; color: var(--text-muted); }
.bar-row { display: flex; align-items: center; gap: 8px; font-size: 13px; margin: 4px 0; }
.bar-label { width: 120px; flex: none; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar { flex: 1; height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.bar > div { height: 100%; background: var(--accent); border-radius: 4px; }
.progress.big { height: 10px; }
.map-card .progress { width: 80%; height: 5px; }
.map-card .prog-label { font-size: 11px; color: var(--text-muted); margin-top: -6px; }
.pb-item { display: flex; gap: 8px; align-items: flex-start; padding: 8px 0; border-bottom: 1px solid #1f1f23; }
.pb-num { width: 26px; height: 26px; flex: none; border-radius: 50%; background: #fff; color: #0A0A0B; font-weight: 700; display: grid; place-items: center; margin-top: 8px; }
.pb-ctl { display: flex; flex-direction: column; gap: 4px; }
.pb-ctl .iconbtn { width: 28px; height: 28px; }
.pb-ctl .iconbtn svg { width: 14px; height: 14px; }
.pb-meta { font-size: 13px; color: var(--text-muted); margin-top: 4px; }
.pb-meta b { color: var(--text); }
.nade-item.compact { padding: 6px 8px; }
.input.sm { padding: 6px 8px; font-size: 13px; }
.input.sm[data-player] { width: 150px; flex: none; }
kbd { display: inline-block; min-width: 22px; padding: 1px 6px; border: 1px solid #3a3a3f; border-bottom-width: 2px; border-radius: 4px; background: var(--surface-2); font: 600 12px var(--font-body); text-align: center; }
.kv.keys { grid-template-columns: auto 1fr; align-items: center; }
.kv.keys dt { white-space: nowrap; }
.live-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 3px; background: var(--accent); color: #fff !important;
  font: 700 italic 17px var(--font-title); text-transform: uppercase; letter-spacing: .04em; text-decoration: none !important; animation: livepulse 2s infinite; }
.live-badge::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: #fff; }
@keyframes livepulse { 50% { box-shadow: 0 0 18px var(--accent-glow); } }
.offline-bar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 120; background: #2a2006; color: #F2B84B; text-align: center; font-size: 13px; padding: 6px; border-top: 1px solid #5c430b; }
.feed-grid { display: grid; grid-template-columns: 1fr 340px; gap: 18px; }
.lb-row { display: grid; grid-template-columns: 34px 36px 1fr repeat(4, 64px); align-items: center; gap: 8px; padding: 8px 10px; border-bottom: 1px solid #1f1f23; }
.lb-row.head { font: 600 italic 15px var(--font-title); text-transform: uppercase; color: var(--text-muted); }
.lb-row .rank { font: 700 italic 24px var(--font-title); color: var(--silver); text-align: center; }
.lb-row:nth-child(2) .rank { color: #F2B84B; } .lb-row:nth-child(3) .rank { color: #cfd3d8; } .lb-row:nth-child(4) .rank { color: #cd7f32; }
.lb-row .num { text-align: right; font-variant-numeric: tabular-nums; }
.lb-row.me { background: rgba(200,0,0,.08); }
.pb-card { display: flex; gap: 12px; align-items: center; }
.pb-card img { width: 44px; height: 44px; object-fit: contain; }
.backup-row { display: flex; gap: 10px; align-items: center; padding: 6px 0; border-bottom: 1px solid #1f1f23; font-size: 14px; }

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .zones-layout { grid-template-columns: 1fr; }
}
@media (max-width: 760px) {
  :root { --topbar-h: 56px; }
  .brand-logo { width: 36px; height: 36px; }
  .brand-name { font-size: 26px; }
  .navlink .lbl { display: none; }
  .navlink { padding: 6px 8px; }
  h1 { font-size: 32px; }
  .panel-head .ph-title { font-size: 24px; }
  .map-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .token { width: 96px; height: 96px; }
  .map-card .map-name { font-size: 22px; }
  .map-toolbar { padding: 8px 10px; gap: 8px; }
  .map-toolbar .map-title { font-size: 26px; }
  .map-toolbar .seg button { font-size: 16px; padding: 6px 8px; }
  .filterbar { padding: 6px 10px; }
  /* Le panneau devient une feuille plein écran sur téléphone */
  .side-panel { position: absolute; inset: 0; width: 100%; z-index: 5; border-left: 0; }
  .side-panel.sheet { top: auto; height: 55%; border-top: 2px solid var(--accent); border-radius: 12px 12px 0 0; }
  .media-box iframe { height: 460px; }
  .wizard-banner { left: 8px; right: 8px; transform: none; max-width: none; padding: 6px 8px 6px 12px; flex-wrap: wrap; }
  .tool-group .iconbtn[data-tool="keys"] { display: none; }
  .tool-group .iconbtn { width: 32px; height: 32px; }
  .filterbar .search { width: 140px; }
  .feed-grid { grid-template-columns: 1fr; }
  .lb-row { grid-template-columns: 28px 30px 1fr 48px 48px; }
  .lb-row .hide-m { display: none; }
  .input.sm[data-player] { width: 110px; }
}
@media (max-width: 480px) {
  .brand-text { display: none; }
  .topnav { gap: 2px; }
  .navlink { padding: 6px; }
  .wizard-banner .step { font-size: 18px; flex: 1; line-height: 1.1; }
  .floor-switch { top: auto; bottom: 12px; }
}
