:root {
  --bg: #12101a;
  --bg-soft: #1a1725;
  --card: #1e1b2b;
  --card-2: #241f33;
  --line: #2e2940;
  --text: #ece9f5;
  --muted: #8f89a8;
  --pink: #ff9ecb;
  --blue: #7fd8ff;
  --gold: #ffd479;
  --green: #9be59b;
  --radius: 18px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 20px 16px 40px;
  background:
    radial-gradient(1100px 500px at 12% -10%, #241d38 0%, transparent 60%),
    radial-gradient(900px 460px at 92% 0%, #1b2a3a 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  min-height: 100vh;
}

main { max-width: 980px; margin: 0 auto; }
.hidden { display: none !important; }
.muted { color: var(--muted); }

/* ------------------------------------------------------------- portail */

.gate {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); z-index: 20; padding: 20px;
}
.gate-card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 32px; max-width: 380px; text-align: center;
}
.gate-card h1 { font-size: 40px; margin: 0 0 12px; }
.gate-card p { margin: 6px 0; }
#gate-form { display: flex; gap: 8px; margin-top: 18px; }
#gate-key {
  flex: 1; padding: 10px 12px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg-soft); color: var(--text);
}
#gate-form button {
  padding: 10px 16px; border-radius: 10px; border: 0; cursor: pointer;
  background: var(--pink); color: #24132a; font-weight: 600;
}

/* -------------------------------------------------------------- entete */

.header {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; flex-wrap: wrap; margin-bottom: 22px;
}
.title { display: flex; align-items: center; gap: 12px; }
.title h1 { font-size: 26px; margin: 0; font-weight: 600; letter-spacing: .3px; }
.heart { color: var(--pink); font-size: 26px; animation: beat 2.6s ease-in-out infinite; }
@keyframes beat {
  0%, 100% { transform: scale(1); }
  8% { transform: scale(1.18); }
  16% { transform: scale(1); }
}
.header-side { display: flex; align-items: center; gap: 10px; }
.day { color: var(--gold); font-weight: 600; }

.pill {
  padding: 5px 13px; border-radius: 999px; font-size: 13px;
  border: 1px solid var(--line); background: var(--card); color: var(--muted);
}
.pill.live { color: var(--green); border-color: #2f5240; background: #16241c; }
.pill.paused { color: var(--muted); }

/* -------------------------------------------------------------- cartes */

.card {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; margin-bottom: 18px;
}
.card h2 {
  font-size: 14px; text-transform: uppercase; letter-spacing: 1.4px;
  color: var(--muted); margin: 0 0 16px; font-weight: 600;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 14px;
}
.card-head h2 { margin: 0; }

/* ------------------------------------------------------------- joueurs */

.players { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
@media (max-width: 720px) { .players { grid-template-columns: 1fr; } }

.player {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 20px; position: relative; overflow: hidden;
}
.player::before {
  content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: var(--accent);
}
.player.pink { --accent: var(--pink); }
.player.blue { --accent: var(--blue); }

.player-head { display: flex; align-items: center; gap: 12px; margin-bottom: 4px; }
.avatar {
  width: 42px; height: 42px; border-radius: 12px; background: var(--card-2);
  image-rendering: pixelated; border: 1px solid var(--line);
}
.player-name { font-size: 18px; font-weight: 600; color: var(--accent); }
.player-state { font-size: 13px; }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; }
.dot.on { background: var(--green); box-shadow: 0 0 8px var(--green); }
.dot.off { background: #4a4560; }

.hearts { margin: 12px 0 4px; letter-spacing: 1px; font-size: 13px; }
.hearts .full { color: #ff6b81; }
.hearts .empty { color: #3a3550; }

.player-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px 14px; margin-top: 14px;
  font-size: 13px;
}
.player-grid div { display: flex; justify-content: space-between; gap: 8px; }
.player-grid span:first-child { color: var(--muted); }
.pos {
  margin-top: 12px; font-size: 13px; color: var(--muted);
  background: var(--bg-soft); border-radius: 10px; padding: 8px 11px;
  display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap;
}
.pos b { color: var(--text); font-weight: 500; }

/* ----------------------------------------------------- statistiques duo */

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
@media (max-width: 720px) { .stats { grid-template-columns: 1fr 1fr; } }
.stat {
  background: var(--bg-soft); border-radius: 14px; padding: 14px; text-align: center;
}
.stat .value { font-size: 20px; font-weight: 600; color: var(--gold); }
.stat .label { font-size: 12px; color: var(--muted); margin-top: 2px; }

/* -------------------------------------------------------------- carte */

.map-tools { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tabs { display: flex; background: var(--bg-soft); border-radius: 999px; padding: 3px; }
.tab {
  border: 0; background: transparent; color: var(--muted); cursor: pointer;
  padding: 6px 14px; border-radius: 999px; font-size: 13px; font-family: inherit;
}
.tab.active { background: var(--card-2); color: var(--text); }
.ghost {
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: 13px;
  font-family: inherit;
}
.ghost:hover { color: var(--text); }

.map-wrap { position: relative; border-radius: 14px; overflow: hidden; background: #0d0b14; }
#map { display: block; width: 100%; height: 380px; cursor: grab; touch-action: none; }
#map:active { cursor: grabbing; }
.map-hint {
  position: absolute; right: 10px; bottom: 8px; font-size: 11px; color: #5d5878;
  pointer-events: none;
}

.legend {
  display: flex; flex-wrap: wrap; gap: 14px; margin-top: 14px;
  font-size: 12px; color: var(--muted);
}
.legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }

/* ------------------------------------------------------------- succes */

.advancements { display: flex; flex-direction: column; gap: 14px; }
.adv { }
.adv-top {
  display: flex; justify-content: space-between; align-items: baseline;
  margin-bottom: 7px; font-size: 14px;
}
.adv-top .count { color: var(--muted); font-size: 12px; }
.bar {
  height: 9px; border-radius: 999px; background: var(--bg-soft);
  overflow: hidden; display: flex;
}
.bar .seg { height: 100%; }
.bar .both { background: var(--gold); }
.bar .pink { background: var(--pink); }
.bar .blue { background: var(--blue); }

/* -------------------------------------------------------------- pied */

.footer {
  display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  font-size: 12px; color: var(--muted); padding: 4px 4px 0;
}

/* ------------------------------------------------------ carte : tuiles */

.map-progress {
  position: absolute; left: 10px; bottom: 8px; font-size: 11px;
  color: var(--gold); pointer-events: none;
}

/* ------------------------------------------------ succes : constellation */

.tree-wrap {
  margin-top: 18px; max-height: 520px; overflow: auto; position: relative;
  border-radius: 14px; background: #0d0b14; padding: 14px;
}
.tree-wrap::-webkit-scrollbar { width: 8px; height: 8px; }
.tree-wrap::-webkit-scrollbar-thumb { background: #2e2940; border-radius: 8px; }

#tree svg { display: block; }
#tree .link { stroke-width: 2.5; fill: none; opacity: .8; }

#tree .node { cursor: help; }
#tree .node image {
  image-rendering: pixelated;
  pointer-events: none;
}
/* La pastille porte la couleur de qui l'a obtenu ; l'icône reste lisible. */
#tree .node .slot {
  opacity: .22;
  transition: opacity .15s ease;
}
#tree .node:hover .slot { opacity: .5; }
#tree .node.both .slot { opacity: .34; filter: url(#glow); }
#tree .node.none .slot { opacity: .16; }
#tree .node.none image { opacity: .38; }

#tree .label {
  font-size: 9.5px; fill: #7b7597; pointer-events: none;
  text-anchor: middle; transition: fill .15s ease;
}
#tree .node:hover .label { fill: #ece9f5; }
#tree .node.both .label { fill: #ffd479; }

.tree-tip {
  position: absolute; z-index: 5; pointer-events: none;
  max-width: 250px; padding: 10px 12px; border-radius: 12px;
  background: #171426; border: 1px solid var(--line);
  box-shadow: 0 10px 26px rgba(0, 0, 0, .55);
  opacity: 0; transition: opacity .12s ease;
}
.tree-tip.shown { opacity: 1; }
.tree-tip .tip-title { font-weight: 600; font-size: 14px; margin-bottom: 3px; }
.tree-tip .tip-desc { font-size: 12px; color: var(--muted); line-height: 1.45; }
.tree-tip .tip-state { font-size: 11px; margin-top: 7px; }

.adv-legend {
  display: flex; gap: 14px; flex-wrap: wrap; margin-top: 12px;
  font-size: 12px; color: var(--muted);
}
.adv-legend i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 6px; }

/* ====================================================== onglet Serveur */

.check {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--muted); cursor: pointer;
}
.check input { accent-color: var(--pink); }

/* Bandeau de déploiement */

.deploy-banner {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 12px 14px; border-radius: 14px; margin-bottom: 14px;
  background: var(--bg-soft); border: 1px solid var(--line);
}
.deploy-banner.pending { border-color: #6b5a2a; background: #241f14; }
.deploy-banner.restarting { border-color: #6b2a3a; background: #241419; }
.deploy-banner.ok { border-color: #2f5240; background: #16241c; }
.deploy-banner .dot-big {
  width: 10px; height: 10px; border-radius: 50%; flex: 0 0 auto;
  background: var(--green); box-shadow: 0 0 10px var(--green);
}
.deploy-banner.pending .dot-big { background: var(--gold); box-shadow: 0 0 10px var(--gold); }
.deploy-banner.restarting .dot-big {
  background: #ff7a90; box-shadow: 0 0 10px #ff7a90;
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
.deploy-banner .txt { flex: 1; min-width: 200px; }
.deploy-banner .txt b { display: block; font-size: 15px; margin-bottom: 2px; }
.deploy-banner .txt span { font-size: 12.5px; color: var(--muted); }

/* Paires clé / valeur */

.kv { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 18px; font-size: 13px; }
@media (max-width: 720px) { .kv { grid-template-columns: 1fr; } }
.kv .row {
  display: flex; justify-content: space-between; gap: 10px;
  padding: 5px 0; border-bottom: 1px solid rgba(255, 255, 255, .04);
}
.kv .row span:first-child { color: var(--muted); }
.kv .row span:last-child { text-align: right; }
.kv .row b { font-weight: 500; }
.kv .off { color: #ff7a90; }
.kv .on { color: var(--green); }

/* Jauges */

.gauges { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 720px) { .gauges { grid-template-columns: 1fr; } }
.gauge { background: var(--bg-soft); border-radius: 14px; padding: 14px; }
.gauge .top {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 12px; color: var(--muted); margin-bottom: 8px;
}
.gauge .top b { color: var(--text); font-size: 15px; font-weight: 600; }
.gauge .track { height: 8px; border-radius: 999px; background: #100e1a; overflow: hidden; }
.gauge .fill { height: 100%; border-radius: 999px; transition: width .4s ease; }
.gauge .fill.good { background: var(--green); }
.gauge .fill.warn { background: var(--gold); }
.gauge .fill.bad { background: #ff7a90; }
.gauge .sub { font-size: 11px; color: var(--muted); margin-top: 6px; }

/* Console */

.console {
  height: 340px; overflow-y: auto; border-radius: 14px;
  background: #0a0910; border: 1px solid var(--line);
  padding: 12px 14px; font-size: 12px; line-height: 1.55;
  font-family: "Cascadia Mono", "SF Mono", Consolas, monospace;
  white-space: pre-wrap; word-break: break-word;
}
.console::-webkit-scrollbar { width: 8px; }
.console::-webkit-scrollbar-thumb { background: #2e2940; border-radius: 8px; }
.console .l { display: block; color: #9a94b5; }
.console .l.warn { color: var(--gold); }
.console .l.error { color: #ff8a9c; }
.console .l.plugin { color: var(--blue); }
.console .empty { color: var(--muted); font-style: italic; }
