:root {
  --bg1: #0f1021;
  --bg2: #1b1c3a;
  --card: rgba(255,255,255,0.08);
  --card-border: rgba(255,255,255,0.15);
  --text: #f5f6fb;
  --muted: #c5c7d4;

  --accent1: #ff7aa5;  /* rose */
  --accent2: #6bc2ff;  /* bleu */
  --accent3: #fad564;  /* jaune */
  --success: #5ee190;
  --danger: #ff5c7a;

  --grad: linear-gradient(90deg, var(--accent1), var(--accent2));
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
[hidden] { display: none !important; }

body.theme-colorful {
  margin: 0;
  color: var(--text);
  background-image:
    linear-gradient(180deg, rgba(255,255,255,0.02), rgba(255,255,255,0) 40%),
    repeating-linear-gradient(45deg, rgba(255,255,255,0.03) 0 2px, transparent 2px 6px),
    linear-gradient(135deg, #0e1026, #1a1d44 55%, #0b0d1e);
  background-attachment: fixed;
  background-size: cover;
  font-family: "Poppins", system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

.muted { color: var(--muted); }
.small { font-size: 13px; }
.ok { color: var(--success); }
.ko { color: var(--danger); }

kbd {
  display: inline-block;
  min-width: 22px;
  padding: 1px 6px;
  border-radius: 6px;
  border: 1px solid var(--card-border);
  border-bottom-width: 2px;
  background: rgba(255,255,255,0.08);
  font-family: inherit;
  font-size: 12px;
  text-align: center;
  color: var(--text);
}

/* ================= En-tête ================= */
header {
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: blur(8px);
  background: linear-gradient(180deg, rgba(15,16,33,0.85), rgba(15,16,33,0.4) 70%, transparent);
  border-bottom: 1px solid var(--card-border);
}
.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}
header h1 {
  margin: 0;
  padding: 20px 0;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 0.3px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.save-status {
  font-size: 12px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.06);
  color: var(--muted);
  white-space: nowrap;
}
.save-status.ok { color: var(--success); border-color: rgba(94,225,144,0.35); }
.save-status.error { color: var(--danger); border-color: rgba(255,92,122,0.5); background: rgba(255,92,122,0.12); }

main {
  max-width: 1100px;
  margin: 20px auto 60px auto;
  padding: 0 20px;
}

/* ================= Boutons ================= */
button {
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.06));
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform .1s ease, box-shadow .2s ease, background .2s ease, opacity .2s ease;
}
button:hover:not(:disabled) {
  transform: translateY(-1px);
  background: linear-gradient(180deg, rgba(255,255,255,0.20), rgba(255,255,255,0.08));
  box-shadow: 0 10px 30px rgba(0,0,0,0.25);
}
button:active { transform: translateY(0); }
button:disabled { opacity: .4; cursor: not-allowed; }

button.primary {
  border: none;
  background: var(--grad);
  box-shadow: 0 8px 30px rgba(107,194,255,0.25);
}
button.primary:hover:not(:disabled) { background: var(--grad); filter: brightness(1.08); }
button.big { padding: 13px 22px; font-size: 16px; }
button.small-btn { padding: 6px 10px; font-size: 12px; border-radius: 9px; }

button.danger {
  border-color: rgba(255,92,122,0.5);
  background: rgba(255,92,122,0.15);
  color: #ffd0da;
}
button.danger:hover:not(:disabled) { background: rgba(255,92,122,0.3); }

/* ================= Navigation principale ================= */
.view-nav {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
  margin: 4px 0 4px;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: rgba(255,255,255,0.05);
}
.view-nav button {
  border: none;
  background: transparent;
  box-shadow: none;
  font-size: 15px;
  padding: 10px 18px;
}
.view-nav button.active,
.view-nav button.active:hover {
  background: var(--grad);
  box-shadow: 0 8px 30px rgba(107,194,255,0.25);
}
.view-nav .count {
  display: inline-block;
  min-width: 22px;
  margin-left: 6px;
  padding: 1px 7px;
  border-radius: 999px;
  font-size: 12px;
  background: rgba(0,0,0,0.25);
}

/* ================= Sections ================= */
.section {
  border: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.06));
  border-radius: 18px;
  padding: 18px;
  margin: 20px 0;
  box-shadow: 0 10px 40px rgba(0,0,0,0.25);
}
.section h2 {
  margin: 4px 2px 14px;
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
}
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.section-header h2 { margin-bottom: 10px; }

.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}
.controls.center { justify-content: center; }
.controls.end { justify-content: flex-end; }
.grow { flex: 1 1 220px; }

.hint {
  margin: 10px 0 0;
  font-size: 12px;
  color: var(--muted);
}
.section-header .hint { margin: 0 0 10px; }

.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 28px 16px;
  color: var(--muted);
  border: 1px dashed var(--card-border);
  border-radius: 14px;
}

/* ================= Barre arène / mode ================= */
.control-bar { padding: 16px 18px; }
.cb-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  align-items: flex-end;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .7px;
  color: var(--muted);
}
.field-label .muted { text-transform: none; letter-spacing: 0; font-weight: 500; font-size: 12px; }

.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 4px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: rgba(0,0,0,0.18);
}
.seg button {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 8px 14px;
  border-radius: 10px;
  color: var(--muted);
}
.seg button:hover:not(:disabled) { background: rgba(255,255,255,0.08); color: var(--text); box-shadow: none; }
.seg button.active,
.seg button.active:hover {
  background: var(--grad);
  color: var(--text);
  box-shadow: 0 6px 20px rgba(107,194,255,0.25);
}
.mode-desc {
  margin: 12px 2px 0;
  font-size: 13px;
  color: var(--muted);
}

/* ================= Arène ================= */
.arena-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.arena-title { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.arena-title h2 { margin: 0; }

.pill {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  background: rgba(107,194,255,0.15);
  color: var(--accent2);
  border: 1px solid rgba(107,194,255,0.3);
}

.duel {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 18px;
}
.duel-header {
  grid-column: 1 / -1;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: -4px;
}
.round-pill {
  padding: 6px 14px;
  border-radius: 999px;
  background: var(--grad);
  font-weight: 700;
  font-size: 14px;
}

.vs {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 1px;
  background: var(--grad);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  user-select: none;
}

.choice {
  position: relative;
  height: 100%;
  border: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.05));
  border-radius: 18px;
  padding: 18px;
  text-align: center;
  cursor: pointer;
  overflow: hidden;
  user-select: none;
  transition: transform .15s ease, box-shadow .25s ease, border-color .2s ease, opacity .2s ease;
  box-shadow: 0 12px 40px rgba(0,0,0,0.25);
}
.choice:hover { transform: translateY(-3px); border-color: rgba(107,194,255,0.6); }

.choice > img {
  width: 220px;
  max-width: 100%;
  height: 300px;
  object-fit: cover;
  border-radius: 12px;
  border: 3px solid rgba(255,255,255,0.35);
  box-shadow: 0 12px 40px rgba(0,0,0,0.35);
  display: block;
  margin: 0 auto 10px auto;
}
.choice h3 { margin: 12px 0 4px; font-size: 20px; }
.choice p { margin: 0; opacity: 0.85; }

.key-hint {
  position: absolute;
  bottom: 12px;
  left: 12px;
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 9px;
  font-size: 16px;
  font-weight: 700;
  background: rgba(0,0,0,0.35);
  border: 1px solid var(--card-border);
  color: var(--muted);
}
.choice[data-side="1"] .key-hint { left: auto; right: 12px; }

/* Carte choisie au clic */
.choice.winner-click {
  transform: scale(1.03);
  border-color: var(--success);
  box-shadow: 0 0 0 3px var(--success), 0 16px 50px rgba(94,225,144,0.35);
}
.duel.picked .choice:not(.winner-click) { opacity: .45; }

.key-hints {
  margin: 16px 0 0;
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}
.session-votes { margin-left: auto; font-weight: 600; color: var(--accent3); }

/* 2v2 */
.team-title { margin-bottom: 12px; }
.members { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }
.member-card {
  border: 1px solid var(--card-border);
  border-radius: 12px;
  padding: 10px;
  width: 160px;
  background: linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.06));
}
.member-card img {
  width: 140px; height: 180px; max-width: 100%; object-fit: cover;
  border-radius: 10px; border: 3px solid rgba(255,255,255,0.35);
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
  display: block; margin: 0 auto 8px;
}
.member-card h4 { margin: 6px 0 0; font-size: 16px; }
.member-card p { margin: 2px 0 0; opacity: .9; font-size: 13px; }

@media (max-width: 700px) {
  .duel { grid-template-columns: 1fr; }
  .vs { text-align: center; font-size: 22px; }
  .choice > img { height: 240px; }
}

/* ================= Badges & étiquettes ================= */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent2), var(--accent1));
  color: #0b0c17;
}
.tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(250,213,100,0.18);
  color: var(--accent3);
  margin-left: 6px;
  vertical-align: middle;
}

/* ================= Tableaux ================= */
.table-wrap {
  overflow: auto;
  border-radius: 12px;
  border: 1px solid var(--card-border);
}
table {
  width: 100%;
  border-collapse: collapse;
  min-width: 520px;
}
thead th {
  text-align: left;
  font-weight: 700;
  padding: 12px;
  background: linear-gradient(180deg, rgba(255,255,255,0.22), rgba(255,255,255,0.12));
  position: sticky;
  top: 0;
}
tbody td {
  padding: 10px 12px;
  border-top: 1px solid var(--card-border);
  vertical-align: middle;
}
tbody tr:hover { background: rgba(255,255,255,0.06); }
tbody tr.clickable { cursor: pointer; }
tbody tr.is-paused { opacity: .55; }
td.empty { text-align: center; color: var(--muted); }
table th.rank-col, table td.rank-col {
  text-align: center;
  white-space: nowrap;
  width: 1%;
  font-weight: 700;
  color: var(--muted);
  font-size: 15px;
}
.thumb {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.35);
  box-shadow: 0 4px 14px rgba(0,0,0,0.25);
  display: block;
}

/* ================= Champs de formulaire ================= */
.import-input {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.06));
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  outline: none;
  transition: background .2s ease, box-shadow .2s ease, border-color .15s ease;
}
.import-input:focus { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(107,194,255,0.2); }
.import-input::placeholder { color: var(--muted); opacity: .9; }

select.import-input {
  appearance: none;
  -webkit-appearance: none;
  background-image:
    linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.06)),
    url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="%23c5c7d4"><path d="M7 10l5 5 5-5z"/></svg>');
  background-repeat: no-repeat, no-repeat;
  background-position: 0 0, right 12px center;
  padding-right: 36px;
}
select.import-input option { background: var(--bg2); color: var(--text); }

input[type="file"].import-input {
  color: var(--muted);
  border-style: dashed;
  background: rgba(255,255,255,0.05);
}
input[type="file"].import-input::file-selector-button {
  margin-right: 12px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.14), rgba(255,255,255,0.06));
  color: var(--text);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
}

/* ================= Configuration Défi / Tournoi ================= */
.tour-options {
  display: flex;
  flex-wrap: wrap;
  gap: 16px 28px;
  align-items: flex-end;
}
.opt { display: flex; flex-direction: column; gap: 6px; }
.opt.check { flex-direction: row; align-items: center; gap: 10px; cursor: pointer; padding-bottom: 10px; }
.opt.check input { width: 18px; height: 18px; accent-color: var(--accent2); }

.chip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 8px;
  margin-top: 4px;
}
.chip {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 10px 6px 6px;
  border-radius: 12px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.04);
  cursor: pointer;
  opacity: .5;
  transition: opacity .15s ease, border-color .15s ease, background .15s ease;
}
.chip.on { opacity: 1; border-color: rgba(107,194,255,0.55); background: rgba(107,194,255,0.1); }
.chip input { display: none; }
.chip img { width: 34px; height: 34px; border-radius: 8px; object-fit: cover; flex: none; }
.chip .nm { flex: 1; min-width: 0; font-size: 14px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chip .elo { font-size: 12px; color: var(--muted); }

/* ================= Tableau du tournoi ================= */
.bracket {
  display: flex;
  gap: 18px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.b-round {
  display: flex;
  flex-direction: column;
  min-width: 170px;
  flex: 1 0 170px;
}
.b-round h4 {
  margin: 0 0 10px;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--accent2);
  text-align: center;
}
.b-matches {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  gap: 10px;
}
.b-match {
  border: 1px solid var(--card-border);
  border-radius: 10px;
  background: rgba(255,255,255,0.05);
  overflow: hidden;
}
.b-match.current {
  border-color: var(--accent3);
  box-shadow: 0 0 0 2px rgba(250,213,100,0.35);
}
.b-match.bye { opacity: .55; }
.b-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: 13px;
  min-height: 32px;
}
.b-slot + .b-slot { border-top: 1px solid var(--card-border); }
.b-slot .seed { font-size: 11px; color: var(--muted); min-width: 16px; }
.b-slot .nm { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.b-slot.win { font-weight: 700; background: rgba(94,225,144,0.12); }
.b-slot.lose { opacity: .45; text-decoration: line-through; }
.b-slot.tbd, .b-slot.empty { color: var(--muted); font-style: italic; }
.champion-col { flex: 0 0 170px; }

/* ================= Vainqueur du tournoi ================= */
.champion { text-align: center; padding: 10px 0; }
.champion .trophy { font-size: 56px; animation: pop .6s ease; }
.champion img {
  width: 200px;
  height: 260px;
  object-fit: cover;
  border-radius: 16px;
  border: 4px solid var(--accent3);
  box-shadow: 0 0 60px rgba(250,213,100,0.35);
  display: block;
  margin: 8px auto 12px;
}
.champion h2 { font-size: 32px; margin: 0; }
.champion > p { margin: 6px 0 18px; }
.podium-rest {
  display: flex;
  justify-content: center;
  gap: 14px 30px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.podium-rest div { display: flex; flex-direction: column; gap: 2px; }
.podium-rest span { font-size: 12px; color: var(--muted); }
@keyframes pop { 0% { transform: scale(.3); opacity: 0; } 70% { transform: scale(1.15); } 100% { transform: scale(1); } }

/* ================= Résultats du Défi ================= */
.big-score { text-align: center; font-size: 1.3em; font-weight: 700; margin: -6px 0 20px; }
.gauntlet-results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
}
.gauntlet-column h3 {
  margin-top: 0;
  border-bottom: 2px solid var(--card-border);
  padding-bottom: 8px;
  margin-bottom: 12px;
  font-size: 18px;
}

/* ================= Onglet Données ================= */
.data-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 20px;
  align-items: start;
}
.data-card > p { margin: 0 0 14px; }
.data-card .hint { margin: 12px 0 14px; }
.kv { display: grid; gap: 6px; }
.kv div {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 12px;
  border-radius: 10px;
  background: rgba(0,0,0,0.15);
  font-size: 14px;
}
.kv span { color: var(--muted); }
@media (max-width: 760px) { .data-grid { grid-template-columns: 1fr; } }
.danger-zone { border-color: rgba(255,92,122,0.35); grid-column: 1 / -1; }
.danger-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
}
.danger-row + .danger-row { border-top: 1px solid var(--card-border); }
.danger-row p { margin: 4px 0 0; }

/* ================= Onglet Joueurs ================= */
.toolbar input[type="search"] { flex: 1 1 240px; }
.player-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 14px;
  margin-top: 14px;
}
.pcard {
  display: flex;
  gap: 14px;
  padding: 12px;
  border: 1px solid var(--card-border);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,0.12), rgba(255,255,255,0.05));
  cursor: pointer;
  transition: transform .15s ease, box-shadow .25s ease, border-color .2s ease;
  outline: none;
}
.pcard:hover, .pcard:focus-visible {
  transform: translateY(-2px);
  border-color: var(--accent2);
  box-shadow: 0 12px 40px rgba(0,0,0,0.3);
}
.pcard.paused { opacity: .55; }
.pcard.paused:hover { opacity: .85; }
.pcard img {
  width: 84px;
  height: 112px;
  flex: none;
  object-fit: cover;
  border-radius: 10px;
  border: 2px solid rgba(255,255,255,0.3);
}
.pcard-body { flex: 1; min-width: 0; }
.pcard-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 10px; margin-top: 10px; }
.pcard-stats div { display: flex; flex-direction: column; }
.pcard-stats .k { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.pcard-stats .v { font-size: 16px; font-weight: 700; }
.winbar { height: 5px; margin-top: 8px; border-radius: 99px; background: rgba(255,92,122,0.35); overflow: hidden; }
.winbar.none { background: rgba(255,255,255,0.1); }
.winbar span { display: block; height: 100%; background: var(--success); }
.pcard .tag { margin: 8px 0 0; }

/* ================= Fiche joueur ================= */
.player-dialog {
  width: min(860px, 94vw);
  max-height: 90vh;
  padding: 0;
  border: 1px solid var(--card-border);
  border-radius: 20px;
  background: linear-gradient(160deg, #1d2050, #0f1021 70%);
  color: var(--text);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.player-dialog::backdrop { background: rgba(5,6,15,0.7); backdrop-filter: blur(4px); }
.pd { padding: 22px; }
.pd-head { display: flex; gap: 18px; align-items: center; margin-bottom: 16px; }
.pd-head img {
  width: 110px; height: 148px; object-fit: cover; flex: none;
  border-radius: 12px; border: 3px solid rgba(255,255,255,0.35);
}
.pd-head h2 { margin: 0 0 8px; font-size: 26px; }
.pd-close { margin-left: auto; align-self: flex-start; width: 38px; height: 38px; padding: 0; }
.pd-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 14px; margin-bottom: 14px; }
.pd-block {
  border: 1px solid var(--card-border);
  border-radius: 14px;
  padding: 14px;
  margin-bottom: 14px;
  background: rgba(255,255,255,0.05);
}
.pd-grid .pd-block { margin-bottom: 0; }
.pd-block h3 {
  margin: 0 0 10px;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
  color: var(--accent2);
}
.stat-table { min-width: 0; font-size: 14px; }
.stat-table thead th { padding: 6px 8px; font-size: 12px; position: static; background: rgba(255,255,255,0.08); }
.stat-table tbody td { padding: 6px 8px; }
.spark { width: 100%; height: 80px; display: block; }
.spark polyline { fill: none; stroke: var(--accent2); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round; vector-effect: non-scaling-stroke; }
.spark circle { fill: var(--accent1); }
.spark line.base { stroke: rgba(255,255,255,0.2); stroke-dasharray: 4 4; vector-effect: non-scaling-stroke; }
.spark-legend { display: flex; justify-content: space-between; font-size: 12px; color: var(--muted); margin-top: 4px; }
.highlights { margin-top: 12px; display: grid; gap: 6px; font-size: 14px; }
.highlights div { display: flex; justify-content: space-between; gap: 10px; }
.highlights .k { color: var(--muted); }
.recent { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.recent li { display: flex; align-items: center; gap: 10px; font-size: 14px; }
.recent .desc { flex: 1; }
.recent .res {
  flex: none; width: 24px; height: 24px;
  display: grid; place-items: center;
  border-radius: 7px; font-weight: 700; font-size: 12px;
  background: rgba(255,255,255,0.08);
}
.recent .delta { font-weight: 700; font-variant-numeric: tabular-nums; }
.dialog-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.dialog-actions .danger { margin-left: auto; }

/* ================= Notifications ================= */
.toasts {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 100;
  max-width: min(420px, calc(100vw - 40px));
}
.toast {
  padding: 12px 16px;
  border-radius: 12px;
  background: #23264f;
  border: 1px solid var(--card-border);
  border-left: 4px solid var(--success);
  box-shadow: 0 10px 30px rgba(0,0,0,0.4);
  font-size: 14px;
  animation: toast-in .2s ease;
  transition: opacity .4s ease, transform .4s ease;
}
.toast.error { border-left-color: var(--danger); }
.toast.out { opacity: 0; transform: translateY(8px); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } }

/* ================= Mode plein écran ================= */
.pres-hud { display: none; }

body.presenting header,
body.presenting .view-nav,
body.presenting #controlBar,
body.presenting #rankingSection,
body.presenting #bracketSection,
body.presenting .arena-head,
body.presenting .key-hints { display: none !important; }

body.presenting main {
  max-width: none;
  margin: 0;
  padding: 74px 3vw 20px;
}
body.presenting .pres-hud {
  display: flex;
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 50;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 3vw;
  background: rgba(15,16,33,0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--card-border);
}
.pres-keys { font-size: 13px; color: var(--muted); }
body.presenting .section { margin: 0 0 20px; }
body.presenting .arena {
  min-height: calc(100vh - 100px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  border: none;
  background: transparent;
  box-shadow: none;
}
body.presenting .duel { gap: 3vw; }
body.presenting .choice { padding: 2.5vh 2vw; }
body.presenting .choice > img { width: min(32vw, 440px); height: 58vh; }
body.presenting .choice h3 { font-size: clamp(22px, 2.6vw, 40px); }
body.presenting .choice p { font-size: clamp(14px, 1.3vw, 20px); }
body.presenting .member-card { width: min(15vw, 220px); }
body.presenting .member-card img { width: 100%; height: 38vh; }
body.presenting .member-card h4 { font-size: clamp(16px, 1.6vw, 26px); }
body.presenting .vs { font-size: clamp(32px, 4vw, 64px); }
body.presenting .key-hint { width: 42px; height: 42px; font-size: 22px; }
body.presenting .round-pill { font-size: 18px; padding: 8px 18px; }
body.presenting .duel-header { margin-bottom: 1vh; font-size: 16px; }

/* ================= Séparateur dans la barre des modes ================= */
.seg-sep {
  width: 1px;
  align-self: stretch;
  margin: 4px 4px;
  background: var(--card-border);
}

/* ================= Trophées (icônes) ================= */
.trophies {
  display: inline-flex;
  gap: 2px;
  font-size: 14px;
  vertical-align: middle;
  line-height: 1;
}
.trophies small { font-size: 11px; color: var(--muted); margin-left: 2px; align-self: center; }
.card-trophies { min-height: 20px; margin-top: 6px; }
.card-trophies .trophies { font-size: 18px; }
.pcard .trophies { margin-top: 4px; font-size: 15px; display: flex; }

/* ================= Mode Carré ================= */
.duel.quad {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
}
.duel.quad .choice { padding: 12px; }
.duel.quad .choice > img { width: 100%; height: 230px; }
.duel.quad .choice h3 { font-size: 17px; margin-top: 8px; }
@media (max-width: 900px) { .duel.quad { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
body.presenting .duel.quad .choice > img { width: 100%; height: 50vh; }

/* ================= Mode À l'aveugle ================= */
.choice h3.masked { letter-spacing: 4px; color: var(--muted); }
.choice.revealed h3 { animation: reveal .35s ease; }
@keyframes reveal { from { opacity: 0; transform: translateY(6px); } }

/* ================= Mode Roi ================= */
.choice.is-king {
  border-color: rgba(250,213,100,0.6);
  box-shadow: 0 0 0 1px rgba(250,213,100,0.4), 0 12px 50px rgba(250,213,100,0.15);
}
.choice.is-king > img { border-color: var(--accent3); }
.crown {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 34px;
  filter: drop-shadow(0 4px 10px rgba(250,213,100,0.6));
  z-index: 2;
  animation: float 2.4s ease-in-out infinite;
}
.choice:has(.crown) > img { margin-top: 18px; }
@keyframes float { 50% { transform: translate(-50%, -4px); } }

/* ================= Notification de trophée ================= */
.toast.trophy {
  border-left-color: var(--accent3);
  background: linear-gradient(90deg, rgba(250,213,100,0.18), #23264f 60%);
  font-weight: 600;
}

/* ================= Fiche : trophées ================= */
.pd-trophies {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 8px;
}
.pd-trophy {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--card-border);
  background: rgba(0,0,0,0.15);
  opacity: .5;
}
.pd-trophy.got { opacity: 1; border-color: rgba(250,213,100,0.45); background: rgba(250,213,100,0.08); }
.pd-trophy .ic { font-size: 22px; flex: none; }
.pd-trophy strong { display: block; font-size: 13px; }
.pd-trophy small { display: block; font-size: 11px; color: var(--muted); line-height: 1.3; }

/* ================= Onglet Palmarès ================= */
.records-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.record {
  display: flex;
  gap: 14px;
  align-items: center;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
}
.record.empty { opacity: .5; }
.r-icon {
  flex: none;
  width: 48px; height: 48px;
  display: grid; place-items: center;
  font-size: 26px;
  border-radius: 12px;
  background: rgba(0,0,0,0.2);
}
.r-body { display: flex; flex-direction: column; min-width: 0; }
.r-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px; color: var(--accent2); }
.r-holder { font-size: 17px; font-weight: 700; margin-top: 2px; }
.r-detail { font-size: 13px; color: var(--muted); }

.tour-wins { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.tour-wins li {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 12px;
  background: rgba(0,0,0,0.15);
  flex-wrap: wrap;
}
.tour-wins img { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; }
.tw-trophy { font-size: 20px; }

.trophy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 12px;
}
.trophy-card {
  padding: 14px;
  border-radius: 14px;
  border: 1px solid var(--card-border);
  background: rgba(255,255,255,0.04);
}
.trophy-card.got { border-color: rgba(250,213,100,0.45); background: rgba(250,213,100,0.06); }
.t-head { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; }
.t-icon { font-size: 30px; filter: grayscale(1); opacity: .5; }
.trophy-card.got .t-icon { filter: none; opacity: 1; }
.t-head strong { display: block; }
.t-head small { display: block; font-size: 12px; color: var(--muted); }
.t-holders { display: flex; flex-wrap: wrap; gap: 6px; }
.holder {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 999px;
  background: rgba(250,213,100,0.15);
  color: var(--accent3);
}

/* ================= Onglet Stats ================= */
#view-stats { --pos: #3987e5; --neg: #e66767; }

.stat-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin: 20px 0;
}
.stat-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 16px;
  border-radius: 16px;
  border: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.05));
}
.st-label { font-size: 12px; color: var(--muted); }
.st-value { font-size: 30px; font-weight: 700; line-height: 1.15; }
.st-sub { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.meter { height: 6px; border-radius: 99px; background: rgba(57,135,229,0.22); overflow: hidden; margin: 4px 0 2px; }
.meter span { display: block; height: 100%; background: #3987e5; border-radius: 99px; }

.viz-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0 20px;
}
@media (max-width: 860px) { .viz-grid { grid-template-columns: 1fr; } }
.viz-card h2 { margin-bottom: 2px; }
.viz-sub { margin: 0 2px 12px; font-size: 12px; color: var(--muted); }
.viz { width: 100%; overflow-x: auto; }
.viz svg { display: block; overflow: visible; font-family: inherit; }
.viz text { fill: var(--text); }
.viz text.ax { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.viz text.lbl { font-size: 12px; fill: #dfe0ea; }
.viz text.val { font-size: 11px; font-weight: 600; fill: var(--muted); font-variant-numeric: tabular-nums; }
.viz text.cell { font-size: 11px; font-weight: 700; fill: #ffffff; pointer-events: none; }
.viz text.inside { font-size: 12px; font-weight: 700; fill: #ffffff; pointer-events: none; }
.viz .hov { cursor: default; }
.viz .hov:hover path, .viz .hov:hover rect:not([fill="transparent"]), .viz .hov:hover circle { filter: brightness(1.2); }
.viz .hov:hover text.lbl { fill: #ffffff; }

.viz-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
}
.viz-legend span { display: inline-flex; align-items: center; gap: 6px; }
.viz-legend .sw { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }

.lchip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  font-size: 12px;
  border-radius: 999px;
  background: rgba(255,255,255,0.04);
  color: var(--muted);
}
.lchip.on { color: var(--text); background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.3); }
.lchip .lk { width: 14px; height: 3px; border-radius: 2px; border: 1px solid rgba(255,255,255,0.25); }
.lchip.on .lk { border: none; }

.viz-tip {
  position: fixed;
  z-index: 200;
  display: none;
  pointer-events: none;
  min-width: 140px;
  max-width: 300px;
  padding: 10px 12px;
  border-radius: 12px;
  background: #15172f;
  border: 1px solid var(--card-border);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
  font-size: 13px;
}
.tt-title { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.tt-row { display: flex; align-items: center; gap: 8px; padding: 2px 0; }
.tt-row strong { font-variant-numeric: tabular-nums; }
.tt-key { width: 12px; height: 3px; border-radius: 2px; flex: none; }
.tt-label { color: var(--muted); font-size: 12px; }

/* =====================================================================
   NOUVEAUTÉS : tags, arènes, photos, création de joueurs
   ===================================================================== */

/* ---------- Puces de tag ---------- */
.tag-chips { display: inline-flex; flex-wrap: wrap; gap: 4px; vertical-align: middle; }
.tag-chip {
  --c: #8a8ca8;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  color: var(--text);
  background: color-mix(in srgb, var(--c) 22%, transparent);
  border: 1px solid color-mix(in srgb, var(--c) 55%, transparent);
  white-space: nowrap;
}
.tag-chip::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: var(--c); flex: none; }
.tag-chip.sm { font-size: 11px; padding: 1px 8px; }
.tag-chip.lg { font-size: 15px; padding: 5px 14px; }
.tag-chip.xl { font-size: 26px; padding: 4px 18px; vertical-align: middle; }
.tag-chip.more::before { display: none; }
.tag-chip.btn { cursor: pointer; font-family: inherit; opacity: .55; background: transparent; }
.tag-chip.btn:hover { opacity: .85; transform: none; box-shadow: none; }
.tag-chip.btn.on { opacity: 1; background: color-mix(in srgb, var(--c) 30%, transparent); }
.tag-chip .x {
  border: none; background: transparent; box-shadow: none; padding: 0 0 0 2px;
  color: var(--muted); font-size: 14px; line-height: 1; cursor: pointer;
}
.tag-chip .x:hover { color: var(--danger); transform: none; background: transparent; box-shadow: none; }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* ---------- Sélecteur de tags ---------- */
.tag-picker { display: flex; flex-direction: column; gap: 6px; }
.tp-group { display: flex; flex-wrap: wrap; align-items: center; gap: 5px; }
.tp-fam { --c: var(--muted); font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--c); min-width: 70px; }
.tp-new { width: 220px; max-width: 100%; padding: 6px 10px; font-size: 13px; border-radius: 9px; }

/* ---------- Barre arène / mode ---------- */
.field-link { margin-left: 8px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--accent2); text-decoration: none; }
.field-link:hover { text-decoration: underline; }
.seg .count {
  display: inline-block; min-width: 18px; margin-left: 4px; padding: 0 6px;
  border-radius: 999px; font-size: 11px; background: rgba(0,0,0,0.25);
}
.seg.small button { padding: 6px 11px; font-size: 13px; }
.mode-options { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--card-border); }
.mode-options a { color: var(--accent2); }

/* ---------- Cartes de duel : tags, bandeau de camp ---------- */
.card-meta { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; min-height: 22px; margin-top: 8px; }
.card-meta .trophies { font-size: 17px; }
.side-banner {
  --c: #8a8ca8;
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 2;
  padding: 4px 14px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: var(--c); color: #fff; box-shadow: 0 6px 20px rgba(0,0,0,0.35); white-space: nowrap;
}
.choice:has(.side-banner) > img { margin-top: 22px; }
.war-score { display: inline-flex; align-items: center; gap: 12px; font-size: 22px; }
.war-score strong { font-size: 30px; min-width: 28px; text-align: center; }
.war-pick { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.war-pick select { flex: 1 1 220px; }
.small-vs { font-size: 22px; }
.mvps { display: flex; justify-content: center; gap: 16px; flex-wrap: wrap; margin: 18px 0; }
.mvp { display: flex; align-items: center; gap: 10px; padding: 8px 14px 8px 8px; border-radius: 14px; background: rgba(0,0,0,0.2); border: 1px solid var(--card-border); }
.mvp img { width: 46px; height: 60px; object-fit: cover; border-radius: 8px; }
.mvp span { display: flex; flex-direction: column; text-align: left; }
.mvp small { color: var(--muted); font-size: 11px; }
.champion .war-score { margin-top: 10px; }
.tag-filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 8px 0 10px; }
.rk-name { font-weight: 600; }
#rankingTable .tag-chips { margin-top: 4px; }

/* ---------- Onglet Joueurs : ajout ---------- */
.add-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
@media (max-width: 1000px) { .add-grid { grid-template-columns: 1fr; } }
.add-card {
  display: flex; flex-direction: column;
  padding: 16px; border-radius: 16px;
  border: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
}
.add-card h3 { margin: 0 0 10px; font-size: 16px; }
.add-card > p { margin: 0 0 12px; }
.add-card code { font-size: 12px; background: rgba(0,0,0,0.25); padding: 1px 5px; border-radius: 5px; }
.add-card textarea { resize: vertical; font-family: inherit; line-height: 1.5; flex: 1; min-height: 120px; }
button.full { width: 100%; }
.one-player { display: flex; gap: 12px; align-items: stretch; }
.one-fields { flex: 1; display: flex; flex-direction: column; gap: 8px; justify-content: center; min-width: 0; }
.photo-drop {
  position: relative; flex: none;
  width: 96px; height: 128px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  text-align: center; font-size: 12px; color: var(--muted);
  border: 2px dashed var(--card-border); border-radius: 12px;
  background: rgba(255,255,255,0.04); cursor: pointer; overflow: hidden;
  transition: border-color .15s ease, background .15s ease;
}
.photo-drop:hover, .photo-drop.drag, .bulk-drop:hover, .bulk-drop.drag { border-color: var(--accent2); background: rgba(107,194,255,0.08); }
.photo-drop small { font-size: 10px; }
.photo-drop.has-photo { border-style: solid; padding: 0; }
.photo-drop img { width: 100%; height: 100%; object-fit: cover; }
.dz-actions { position: absolute; bottom: 4px; left: 4px; right: 4px; display: flex; gap: 4px; justify-content: center; }
.dz-actions .small-btn { padding: 3px 7px; font-size: 11px; background: rgba(10,12,30,0.8); }
.dz-icon { font-size: 26px; }
.bulk-drop {
  margin-top: 12px; flex: 1; min-height: 120px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px;
  text-align: center; color: var(--muted);
  border: 2px dashed var(--card-border); border-radius: 14px;
  background: rgba(255,255,255,0.04); cursor: pointer;
  transition: border-color .15s ease, background .15s ease;
}
.bulk-drop.busy { cursor: progress; border-color: var(--accent3); }
.bulk-drop strong { color: var(--text); }

/* ---------- Onglet Joueurs : liste ---------- */
.pcard-body h4 { margin: 0 0 6px; font-size: 16px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pcard .tag-chips { margin-bottom: 2px; }
.bulk-bar {
  position: sticky; top: 74px; z-index: 5;
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px;
  margin: 12px 0; padding: 10px 14px; border-radius: 14px;
  background: #2b2e63; border: 1px solid rgba(107,194,255,0.45);
  box-shadow: 0 10px 30px rgba(0,0,0,0.35);
}
.bulk-bar select { padding: 6px 30px 6px 10px; font-size: 13px; }
.bulk-bar strong { margin-right: 6px; }
.ptable { margin-top: 0; }
.ptable td, .ptable th { padding: 8px 10px; }
.ptable th.cb, .ptable td.cb { width: 1%; text-align: center; }
.ptable input[type=checkbox] { width: 17px; height: 17px; accent-color: var(--accent2); cursor: pointer; }
.ptable tr.selected { background: rgba(107,194,255,0.10); }
.ptable .thumb { width: 42px; height: 56px; cursor: pointer; }
.ptable .thumb.drag { outline: 2px solid var(--accent2); }
.cell-input {
  width: 100%; min-width: 120px;
  padding: 6px 8px; border-radius: 8px;
  border: 1px solid transparent; background: transparent;
  color: var(--text); font-family: inherit; font-size: 14px; font-weight: 600;
}
.cell-input:hover { border-color: var(--card-border); }
.cell-input:focus { outline: none; border-color: var(--accent2); background: rgba(0,0,0,0.25); }
.tags-cell { min-width: 220px; }
.tags-cell .tag-chip { margin: 2px 2px 2px 0; }
.add-tag {
  appearance: none; -webkit-appearance: none;
  width: 30px; height: 24px; padding: 0; text-align: center;
  border-radius: 999px; border: 1px dashed var(--card-border);
  background: transparent; color: var(--muted); font-family: inherit; font-size: 14px; cursor: pointer;
}
.add-tag:hover { border-color: var(--accent2); color: var(--text); }
.add-tag option { background: var(--bg2); color: var(--text); }

/* ---------- Fiche joueur ---------- */
.pd-head { align-items: flex-start; }
.pd-photo { position: relative; flex: none; width: 120px; height: 160px; border-radius: 12px; overflow: hidden; cursor: pointer; border: 3px solid rgba(255,255,255,0.35); }
.pd-photo.drag { border-color: var(--accent2); }
.pd-photo img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pd-photo-actions { position: absolute; bottom: 4px; left: 4px; right: 4px; display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; opacity: 0; transition: opacity .15s ease; }
.pd-photo:hover .pd-photo-actions { opacity: 1; }
.pd-photo-actions .small-btn { padding: 3px 7px; font-size: 11px; background: rgba(10,12,30,0.85); }
.pd-main { flex: 1; min-width: 0; }
.pd-name {
  width: 100%; padding: 4px 8px; margin: 0 0 4px -8px;
  font-family: inherit; font-size: 26px; font-weight: 700; color: var(--text);
  background: transparent; border: 1px solid transparent; border-radius: 10px;
}
.pd-name:hover { border-color: var(--card-border); }
.pd-name:focus { outline: none; border-color: var(--accent2); background: rgba(0,0,0,0.25); }
.pd-sub { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.arena-rank { display: inline-block; margin-right: 10px; }
.pd-head .pd-close { margin-left: 0; }

/* ---------- Recadrage ---------- */
.crop-dialog {
  padding: 0; border: 1px solid var(--card-border); border-radius: 20px;
  background: linear-gradient(160deg, #1d2050, #0f1021 70%); color: var(--text);
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
}
.crop-dialog::backdrop { background: rgba(5,6,15,0.75); backdrop-filter: blur(4px); }
.crop-body { padding: 22px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.crop-body h2 { margin: 0; font-size: 20px; }
.crop-body p { margin: 0 0 4px; }
#cropCanvas { width: 300px; height: 400px; border-radius: 14px; cursor: grab; touch-action: none; box-shadow: 0 0 0 3px rgba(255,255,255,0.25), 0 20px 50px rgba(0,0,0,0.5); }
#cropCanvas:active { cursor: grabbing; }
.crop-zoom { display: flex; align-items: center; gap: 10px; width: 300px; }
.crop-zoom input { flex: 1; accent-color: var(--accent2); }
.crop-body .controls { width: 100%; margin-top: 6px; }

/* ---------- Onglet Tags & arènes ---------- */
.family-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 14px; }
@media (max-width: 520px) { .family-grid { grid-template-columns: 1fr; } }
.family-card {
  --c: #8a8ca8;
  padding: 14px; border-radius: 16px;
  border: 1px solid color-mix(in srgb, var(--c) 45%, transparent);
  border-top: 4px solid var(--c);
  background: linear-gradient(180deg, color-mix(in srgb, var(--c) 10%, transparent), rgba(255,255,255,0.03));
}
.fam-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.fam-head h3 { margin: 4px 0; font-size: 16px; }
.fam-name { flex: 1; font-size: 17px; font-weight: 700; }
.color-pick { display: flex; gap: 3px; }
.swatch { width: 16px; height: 16px; padding: 0; border-radius: 50%; border: 2px solid transparent; box-shadow: none; }
.swatch:hover { transform: scale(1.15); box-shadow: none; }
.swatch.on { border-color: #fff; }
.tag-rows { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.tag-row { display: flex; align-items: center; gap: 8px; padding: 2px 4px; border-radius: 10px; }
.tag-row:hover { background: rgba(255,255,255,0.04); }
.tag-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.tag-row .tag-name { flex: 1; font-weight: 600; min-width: 80px; }
.tag-count { white-space: nowrap; min-width: 70px; text-align: right; }
.tag-row select { padding: 5px 28px 5px 8px; font-size: 12px; max-width: 130px; background-position: 0 0, right 8px center; }
.add-tag-input { width: 100%; padding: 7px 10px; font-size: 13px; }

.arena-list { display: flex; flex-direction: column; gap: 8px; }
.arena-card {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 14px;
  border: 1px solid var(--card-border); background: rgba(255,255,255,0.05);
}
.arena-card.fixed { background: rgba(107,194,255,0.07); }
.arena-main { flex: 1; display: flex; flex-direction: column; min-width: 200px; }
.arena-count { font-weight: 700; font-variant-numeric: tabular-nums; }
.arena-editor {
  margin-top: 16px; padding: 16px; border-radius: 16px;
  border: 1px solid rgba(107,194,255,0.45); background: rgba(107,194,255,0.06);
}
.arena-editor h3 { margin: 0 0 12px; }
.arena-editor .opt input { max-width: 360px; }
.inline-select { display: inline-block; padding: 4px 30px 4px 10px; margin: 0 4px; font-size: 12px; text-transform: none; letter-spacing: 0; }
.arena-preview { margin: 14px 0; padding: 10px 12px; border-radius: 10px; background: rgba(0,0,0,0.2); font-size: 14px; }

/* ---------- Stats par tag ---------- */
.tag-table { min-width: 640px; }
.tag-table td, .tag-table th { padding: 9px 12px; }
.pct-cell { display: flex; align-items: center; gap: 8px; }
.pct-cell .meter { width: 70px; margin: 0; }
.viz-grid.tight { gap: 0 24px; margin-top: 18px; }
.viz-card-inner { margin-top: 18px; }
.viz-card-inner h3 { margin: 0 0 2px; font-size: 15px; }
button.tag-dot { width: 14px; height: 14px; padding: 0; border: 2px solid rgba(255,255,255,0.25); border-radius: 50%; box-shadow: none; cursor: pointer; }
button.tag-dot:hover { transform: scale(1.2); box-shadow: none; }

/* ---------- Mode en ligne : bandeaux d'alerte ---------- */
.alert-bar {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 150;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px;
  width: min(860px, calc(100vw - 32px));
  padding: 14px 18px; border-radius: 16px;
  background: #3a2340; border: 1px solid rgba(255,92,122,0.6);
  box-shadow: 0 20px 60px rgba(0,0,0,0.55);
}
.alert-bar span { flex: 1 1 320px; font-size: 14px; }
.save-status.conflict { color: var(--danger); border-color: rgba(255,92,122,0.5); background: rgba(255,92,122,0.12); }

/* ---------- Connexion (mode en ligne) ---------- */
.remote-only { display: none !important; }
body.remote.authed .remote-only { display: block !important; }
body.remote.authed .header-actions .remote-only { display: inline-flex !important; }
.header-actions { display: flex; align-items: center; gap: 8px; }
.logout-btn { align-items: center; gap: 6px; font-size: 12px; padding: 6px 12px; border-radius: 999px; background: rgba(255,255,255,0.06); }
.auth-screen {
  position: fixed; inset: 0; z-index: 300;
  display: grid; place-items: center; padding: 20px;
  background:
    radial-gradient(1200px 600px at 20% 10%, rgba(255,122,165,0.18), transparent 60%),
    radial-gradient(1000px 600px at 90% 90%, rgba(107,194,255,0.18), transparent 60%),
    linear-gradient(135deg, #0e1026, #1a1d44 55%, #0b0d1e);
}
.auth-card {
  width: min(420px, 100%);
  padding: 30px 28px; border-radius: 22px;
  border: 1px solid var(--card-border);
  background: linear-gradient(180deg, rgba(255,255,255,0.10), rgba(255,255,255,0.04));
  box-shadow: 0 30px 80px rgba(0,0,0,0.5);
  text-align: center;
}
.auth-logo { font-size: 46px; }
.auth-card h1 {
  margin: 4px 0 6px; font-size: 26px; font-weight: 800;
  background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.auth-card form, .account-form { display: flex; flex-direction: column; gap: 12px; text-align: left; margin-top: 14px; }
.auth-card label, .account-form label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--muted); }
.auth-card label.check { flex-direction: row; align-items: center; gap: 8px; cursor: pointer; }
.auth-card label.check input { width: 17px; height: 17px; accent-color: var(--accent2); }
.auth-card .import-input { font-size: 15px; padding: 11px 13px; }
.auth-error { min-height: 18px; margin: 0; color: #ffb3c1; font-size: 13px; }
.account-form { margin-top: 6px; }
