/* Stratfupédie — identité de l'accueil Stratfu : prune profond, rose Wakfu,
   cyan stasis. Chaque catégorie garde la couleur des conventions du site ;
   c'est elle qui colore le fil, les nœuds et les fiches. */
:root {
  --nuit: #14060f;
  --prune: #2a0b22;
  --panneau: rgba(34, 10, 29, .72);
  --panneau-vif: rgba(52, 15, 44, .82);
  --bord: rgba(255, 79, 168, .2);
  --texte: #f6e9f2;
  --attenue: #b394a9;
  --rose: #ff4fa8;
  --cyan: #2fe0f0;

  --k: #f0c040;   /* classe : lumière */
  --e: #a855f7;   /* état : air */
  --c: #3b82f6;   /* sort de classe */
  --s: #ef4444;   /* sort de monstre */
  --m: #84cc16;   /* monstre */
  --o: #e2be92;   /* objet : mythique */
  --d: #00d4f0;   /* donjon : stasis */
}

* { box-sizing: border-box; }
html { background: var(--nuit); }
body {
  margin: 0; min-height: 100vh; color: var(--texte);
  font: 500 16px/1.45 'Rajdhani', system-ui, sans-serif;
  background:
    radial-gradient(ellipse 70% 55% at 78% 8%, rgba(255, 79, 168, .16), transparent 70%),
    radial-gradient(ellipse 55% 45% at 6% 92%, rgba(47, 224, 240, .08), transparent 70%),
    linear-gradient(180deg, var(--prune) 0%, var(--nuit) 62%);
  background-attachment: fixed;
}
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; border-radius: 6px; }

/* ── En-tête ─────────────────────────────────────────────────────────── */
.sp-entete {
  display: flex; align-items: center; gap: 18px;
  padding: 14px clamp(16px, 4vw, 48px);
}
.sp-retour img { height: 34px; display: block; filter: drop-shadow(0 0 10px rgba(255, 79, 168, .35)); }
.sp-marque {
  display: inline-flex; align-items: center; gap: 12px; text-decoration: none;
  font: 400 clamp(22px, 2.6vw, 30px)/1 'Uncial Antiqua', serif; letter-spacing: .5px;
  background: linear-gradient(90deg, var(--rose), #ff8fcf 45%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.sp-livre { width: 40px; height: 33px; flex: none; overflow: visible; animation: sp-flotte 4.5s ease-in-out infinite; }
.sp-livre-page { fill: rgba(42, 11, 34, .9); stroke-width: 2.2; stroke-linejoin: round; }
.sp-livre-page.g { stroke: var(--rose); filter: drop-shadow(0 0 4px rgba(255, 79, 168, .7)); }
.sp-livre-page.d { stroke: var(--cyan); filter: drop-shadow(0 0 4px rgba(47, 224, 240, .7)); }
.sp-livre-dos { stroke: #fff; stroke-width: 1.6; opacity: .7; }
@keyframes sp-flotte { 0%, 100% { transform: translateY(0) rotate(-2deg); } 50% { transform: translateY(-4px) rotate(2deg); } }

/* ── Recherche ───────────────────────────────────────────────────────── */
.sp-page { padding: 0 clamp(16px, 4vw, 48px) 48px; max-width: 1360px; margin: 0 auto; }
.sp-recherche { padding: clamp(18px, 6vh, 64px) 0 18px; }
.sp-page.a-fiche .sp-recherche { padding-top: 10px; }
.sp-champ {
  position: relative; display: block; max-width: 760px;
  border-radius: 16px; padding: 2px;
  background: linear-gradient(100deg, var(--rose), rgba(255, 79, 168, .25) 40%, rgba(47, 224, 240, .25) 60%, var(--cyan));
  box-shadow: 0 0 34px rgba(255, 79, 168, .18), 0 0 54px rgba(47, 224, 240, .08);
}
.sp-visuel { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.sp-champ svg { position: absolute; left: 20px; top: 50%; width: 22px; height: 22px; transform: translateY(-50%); fill: var(--attenue); pointer-events: none; }
.sp-champ input {
  width: 100%; border: 0; border-radius: 14px; outline: none;
  padding: 18px 20px 18px 54px; background: #1b0817; color: var(--texte);
  font: 600 clamp(18px, 2.2vw, 22px)/1.2 'Rajdhani', sans-serif; letter-spacing: .3px;
}
.sp-champ input::placeholder { color: #7f6378; font-weight: 500; }
.sp-champ:focus-within { box-shadow: 0 0 0 1px rgba(47, 224, 240, .5), 0 0 40px rgba(47, 224, 240, .22); }
.sp-aide { margin: 12px 4px 0; color: var(--attenue); font-size: 15px; max-width: 760px; }
.sp-suggestions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.sp-suggestions button {
  border: 1px solid var(--bord); background: var(--panneau); border-radius: 999px;
  padding: 5px 13px; cursor: pointer; font-weight: 600; font-size: 14px;
  display: inline-flex; align-items: center; gap: 7px;
}
.sp-suggestions button:hover { border-color: rgba(47, 224, 240, .55); }

/* ── Le fil : chemin parcouru, un nœud par fiche ouverte ─────────────── */
.sp-fil {
  position: relative; display: flex; align-items: center; gap: 0;
  margin-top: 16px; overflow-x: auto; scrollbar-width: thin; padding: 4px 2px 6px;
}
.sp-noeud {
  position: relative; flex: none; display: inline-flex; align-items: center; gap: 8px;
  border: 0; background: none; cursor: pointer; padding: 4px 6px;
  font-weight: 600; font-size: 14px; color: var(--attenue); white-space: nowrap;
}
.sp-noeud + .sp-noeud::before {
  content: ''; width: 34px; height: 2px; margin-right: 6px;
  background: linear-gradient(90deg, var(--avant, var(--rose)), var(--ici, var(--cyan)));
  transform-origin: left; animation: sp-trace .35s ease-out;
}
.sp-noeud i { width: 11px; height: 11px; border-radius: 50%; background: var(--ici); box-shadow: 0 0 8px var(--ici); flex: none; }
.sp-noeud[aria-current="true"] { color: var(--texte); }
.sp-noeud[aria-current="true"] i { outline: 2px solid var(--texte); outline-offset: 2px; }
.sp-noeud:hover { color: var(--texte); }
@keyframes sp-trace { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* ── Corps : résultats + fiche ───────────────────────────────────────── */
.sp-corps { display: grid; grid-template-columns: minmax(260px, 380px) minmax(0, 1fr); gap: 22px; align-items: start; }
.sp-liste { position: sticky; top: 12px; max-height: calc(100vh - 24px); display: flex; flex-direction: column; min-height: 0; }
.sp-liste:empty, .sp-corps.vide .sp-liste { display: none; }
.sp-corps.vide { grid-template-columns: 1fr; }

.sp-filtres { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.sp-filtres button {
  border: 1px solid var(--bord); background: transparent; border-radius: 8px;
  padding: 3px 10px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--attenue);
}
.sp-filtres button b { font: 500 11px 'JetBrains Mono', monospace; margin-left: 4px; opacity: .8; }
.sp-filtres button[aria-selected="true"] { color: var(--texte); border-color: var(--cf, var(--rose)); background: color-mix(in srgb, var(--cf, var(--rose)) 14%, transparent); }

.sp-resultats { list-style: none; margin: 0; padding: 0 4px 0 0; overflow-y: auto; min-height: 0; scrollbar-width: thin; }
.sp-res {
  display: grid; grid-template-columns: 4px 34px 1fr; align-items: center; gap: 10px; width: 100%; text-align: left;
  border: 1px solid transparent; background: none; border-radius: 10px; padding: 8px 10px 8px 6px; cursor: pointer;
}
.sp-res::before { content: ''; align-self: stretch; border-radius: 4px; background: var(--cr); opacity: .85; }
.sp-res-ico, .sp-res > .sp-point { width: 34px; height: 34px; object-fit: contain; }
.sp-res > .sp-point { width: 10px; height: 10px; justify-self: center; border-radius: 50%; background: var(--cr); box-shadow: 0 0 6px var(--cr); }
.sp-res:hover, .sp-res[aria-current="true"] { background: var(--panneau); border-color: var(--bord); }
.sp-res strong { display: block; font-size: 16px; font-weight: 700; line-height: 1.2; }
.sp-res small { display: block; color: var(--attenue); font-size: 13px; line-height: 1.3; margin-top: 2px; }
.sp-res em { font: normal 600 10px/1 'JetBrains Mono', monospace; letter-spacing: .6px; text-transform: uppercase; color: var(--cr); margin-right: 6px; }
.sp-vide { color: var(--attenue); padding: 10px 8px; }

/* ── Fiche ───────────────────────────────────────────────────────────── */
.sp-fiche { min-width: 0; }
.sp-fiche:empty { display: none; }
.sp-tete {
  position: relative; display: flex; gap: 18px; align-items: center;
  padding: 20px 22px; border-radius: 18px; overflow: hidden;
  background: linear-gradient(135deg, color-mix(in srgb, var(--cf) 20%, var(--panneau-vif)), var(--panneau) 60%);
  border: 1px solid color-mix(in srgb, var(--cf) 45%, transparent);
}
.sp-tete img.sp-portrait { width: 84px; height: 84px; object-fit: contain; flex: none; filter: drop-shadow(0 6px 14px rgba(0, 0, 0, .5)); }
.sp-tete .sp-pastille { width: 54px; height: 54px; border-radius: 14px; flex: none; display: grid; place-items: center;
  background: color-mix(in srgb, var(--cf) 22%, transparent); border: 1px solid color-mix(in srgb, var(--cf) 60%, transparent);
  font: 400 26px 'Uncial Antiqua', serif; color: var(--cf); }
.sp-categorie { font: 600 11px/1 'JetBrains Mono', monospace; letter-spacing: 1.2px; text-transform: uppercase; color: var(--cf); }
.sp-tete h1 { margin: 6px 0 4px; font: 400 clamp(26px, 3.4vw, 40px)/1.05 'Uncial Antiqua', serif; }
.sp-meta { color: var(--attenue); font-size: 15px; }
.sp-meta b { font: 500 13px 'JetBrains Mono', monospace; color: var(--texte); }
.sp-desc { margin: 14px 2px 0; font-size: 17px; max-width: 70ch; }
.sp-variantes { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.sp-variantes button { border: 1px solid var(--bord); background: var(--panneau); border-radius: 8px; padding: 3px 10px; cursor: pointer; font-size: 13px; font-weight: 600; }
.sp-variantes button[aria-pressed="true"] { border-color: var(--cf); color: var(--cf); }
.sp-externe {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 12px; padding: 6px 12px; border-radius: 10px;
  text-decoration: none; font-weight: 700; font-size: 14px; border: 1px solid rgba(47, 224, 240, .45); color: var(--cyan);
}
.sp-externe:hover { background: rgba(47, 224, 240, .1); }

/* Blocs reliés : chacun pend d'un fil à la couleur de sa catégorie. */
.sp-bloc { position: relative; margin: 22px 0 0 10px; padding-left: 22px; }
.sp-bloc::before { content: ''; position: absolute; left: 0; top: 4px; bottom: 6px; width: 2px;
  background: linear-gradient(180deg, var(--cb), color-mix(in srgb, var(--cb) 10%, transparent)); border-radius: 2px; }
.sp-bloc h2 { margin: 0 0 8px; font: 700 13px/1 'JetBrains Mono', monospace; letter-spacing: 1px; text-transform: uppercase; color: var(--cb); }
.sp-bloc h2 span { color: var(--attenue); font-weight: 500; margin-left: 6px; }
.sp-items { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px 10px; }
.sp-item {
  position: relative; display: flex; align-items: center; gap: 10px; min-width: 0;
  border: 1px solid transparent; border-radius: 10px; padding: 6px 8px; background: none; text-align: left; cursor: pointer; width: 100%;
}
.sp-item::before { content: ''; position: absolute; left: -22px; top: 50%; width: 14px; height: 2px; background: color-mix(in srgb, var(--cb) 55%, transparent); }
.sp-items .sp-item::before { display: none; }
.sp-items li:nth-child(1) .sp-item::before { display: block; }
.sp-item:hover { background: var(--panneau); border-color: var(--bord); }
.sp-item img { width: 34px; height: 34px; object-fit: contain; flex: none; }
.sp-item .sp-point { width: 10px; height: 10px; border-radius: 50%; background: var(--cb); flex: none; margin: 0 6px; box-shadow: 0 0 6px var(--cb); }
.sp-item span { min-width: 0; }
.sp-item strong { display: block; font-size: 15px; font-weight: 700; line-height: 1.15; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-item small { display: block; color: var(--attenue); font-size: 13px; line-height: 1.25; }
.sp-item small b { font: 500 12px 'JetBrains Mono', monospace; color: var(--texte); }
.sp-item.statique { cursor: default; }
.sp-item.statique:hover { background: none; border-color: transparent; }
.sp-rien { color: var(--attenue); margin: 18px 0 0 32px; }

/* ── Accueil : le livre ouvert et l'emblème, la recherche centrée ────── */
.sp-heros { display: none; }
.sp-page.accueil .sp-heros {
  display: flex; flex-direction: column; align-items: center; padding-top: clamp(8px, 4vh, 40px);
}
.sp-page.accueil .sp-recherche { display: flex; flex-direction: column; align-items: center; padding-top: 22px; text-align: center; }
.sp-page.accueil .sp-champ, .sp-page.accueil .sp-aide { width: 100%; max-width: 680px; }
.sp-page.accueil .sp-suggestions { justify-content: center; }
.sp-page.accueil ~ * .sp-marque, body:has(.sp-page.accueil) .sp-marque { visibility: hidden; }
.sp-embleme {
  width: clamp(92px, 12vw, 132px); height: auto; position: relative; z-index: 1; margin-bottom: -26px;
  filter: drop-shadow(0 0 18px rgba(255, 79, 168, .55)) drop-shadow(0 0 40px rgba(47, 224, 240, .18));
  animation: sp-leve 5.5s ease-in-out infinite;
}
.sp-grand-livre { width: clamp(220px, 30vw, 330px); height: auto; overflow: visible; }
.sp-grand-livre path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.sp-grand-livre .g:not(.lignes) { fill: rgba(42, 11, 34, .85); stroke: url(#sp-g-rose); stroke-width: 2.6; filter: drop-shadow(0 0 8px rgba(255, 79, 168, .6)); }
.sp-grand-livre .d:not(.lignes) { fill: rgba(16, 26, 40, .85); stroke: url(#sp-g-cyan); stroke-width: 2.6; filter: drop-shadow(0 0 8px rgba(47, 224, 240, .55)); }
.sp-grand-livre .lignes.g { stroke: rgba(255, 79, 168, .45); stroke-width: 1.4; }
.sp-grand-livre .lignes.d { stroke: rgba(47, 224, 240, .45); stroke-width: 1.4; }
.sp-grand-livre .dos { stroke: #fff; stroke-width: 1.8; opacity: .75; }
.sp-titre {
  margin: 18px 0 0; font: 400 clamp(34px, 5.4vw, 64px)/1 'Uncial Antiqua', serif; letter-spacing: 1px;
  background: linear-gradient(90deg, var(--rose), #ffc2e4 48%, var(--cyan));
  -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 2px 18px rgba(255, 79, 168, .25));
}
@keyframes sp-leve { 0%, 100% { transform: translateY(0) rotate(-3deg); } 50% { transform: translateY(-12px) rotate(3deg); } }
.sp-suggestions .sp-point { width: 8px; height: 8px; border-radius: 50%; background: var(--cf); box-shadow: 0 0 6px var(--cf); }

.sp-fil[hidden] { display: none; }
.sp-page:not(.accueil) .sp-aide { display: none; }

/* Fiches détaillées reprises des pages existantes (monstre, cartes de sorts) :
   la hauteur suit le contenu, transmise par la page intégrée. */
.sp-cadre { display: block; width: 100%; height: 420px; margin-top: 16px; border: 0; background: transparent; }

/* ── Erreurs ─────────────────────────────────────────────────────────── */
.sp-erreur { color: #ffb4c8; padding: 14px; border: 1px solid rgba(255, 79, 168, .4); border-radius: 12px; background: var(--panneau); }

@media (max-width: 860px) {
  .sp-corps { grid-template-columns: 1fr; }
  .sp-liste { position: static; max-height: none; }
  .sp-page.a-fiche .sp-liste { display: none; }
  .sp-tete { padding: 16px; }
  .sp-tete img.sp-portrait { width: 62px; height: 62px; }
  .sp-items { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  .sp-livre, .sp-embleme { animation: none; }
  .sp-noeud + .sp-noeud::before { animation: none; }
}
