/* ═══════════════════════════════════════════════════════════
   XIXOU-SORTS v1.1 — Encyclopédie des Sorts Dofus Rétro
   ═══════════════════════════════════════════════════════════ */
.xs-sorts-app {
  --bg:   #0d0d10;
  --bg2:  #141418;
  --bg3:  #1a1a20;
  --bg4:  #222230;
  --bg5:  #2c2c38;
  --gold: #c9a44a;
  --gd2:  #a07e2e;
  --gd3:  #e2c36b;
  --gg1:  rgba(201,164,74,.10);
  --gg2:  rgba(201,164,74,.05);
  --tx:   #d0ccc2;
  --tx2:  #807a6e;
  --tx3:  #f2eedf;
  --bd:   #24242e;
  --bd2:  #30303c;
  --earth:  #c49a2a;
  --fire:   #e04030;
  --water:  #2899e0;
  --air:    #58c058;
  --neutral:#b0a898;
  --ok:   #48b848;
  --ko:   #c83838;
  --r:  8px;
  --r2: 5px;
}

.xs-sorts-app *, .xs-sorts-app *::before, .xs-sorts-app *::after { box-sizing: border-box; margin: 0; padding: 0; }
.xs-sorts-app {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 15px; line-height: 1.55; color: var(--tx);
  -webkit-font-smoothing: antialiased; background: var(--bg);
}
.xs-sorts-app button { font-family: inherit; border: none; cursor: pointer; }
.xs-sorts-app img { display: block; }

/* ═══ LAYOUT ═══ */
.xs-grid {
  display: grid;
  grid-template-columns: 260px minmax(0,1fr) 400px;
  gap: 16px;
  max-width: 1520px;
  margin: 0 auto;
  padding: 20px 16px 50px;
}

/* ═══ LOADING ═══ */
.xs-loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 100px 20px; color: var(--tx2); font-size: 16px; grid-column: 1 / -1; }
.xs-spin { width: 22px; height: 22px; border: 2px solid var(--bd2); border-top-color: var(--gold); border-radius: 50%; animation: xsS .5s linear infinite; }
@keyframes xsS { to { transform: rotate(360deg); } }

/* ═══ PANEL ═══ */
.xs-panel { background: var(--bg2); border: 1px solid var(--bd); border-radius: var(--r); }
.xs-ptitle {
  font-size: 10px; font-weight: 800; color: var(--gold);
  text-transform: uppercase; letter-spacing: 2.5px;
  padding: 14px 16px 10px; border-bottom: 1px solid var(--bd);
}

/* ═══ LEFT SIDEBAR ═══ */
.xs-left {
  position: sticky; top: 16px; align-self: start;
  display: flex; flex-direction: column; gap: 12px;
  max-height: calc(100vh - 32px);
}

/* Search */
.xs-search { position: relative; padding: 12px 14px; }
.xs-search input {
  width: 100%; padding: 10px 14px 10px 38px;
  background: var(--bg3); border: 1px solid var(--bd); border-radius: var(--r2);
  color: var(--tx); font-size: 14px; font-family: inherit; outline: none;
  transition: border-color .2s, box-shadow .2s;
}
.xs-search input:focus { border-color: var(--gd2); box-shadow: 0 0 0 3px var(--gg1); }
.xs-search input::placeholder { color: var(--tx2); }
.xs-search-clear {
  position: absolute; right: 22px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--tx2); font-size: 16px;
  cursor: pointer; padding: 4px 6px; line-height: 1;
  transition: color .15s;
}
.xs-search-clear:hover { color: var(--tx3); }
.xs-search-svg {
  position: absolute; left: 26px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; opacity: .3; pointer-events: none; stroke: currentColor;
}

/* Element chips */
.xs-filters { padding: 6px 14px 12px; }
.xs-flabel { display: block; font-size: 10px; font-weight: 700; color: var(--tx2); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 8px; }
.xs-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.xs-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 11px; background: var(--bg3); border: 1px solid var(--bd);
  border-radius: 18px; font-size: 12px; font-weight: 600; color: var(--tx2);
  transition: all .18s; user-select: none;
}
.xs-chip:hover { border-color: var(--bd2); color: var(--tx); }
.xs-chip.on { background: var(--gg1); border-color: var(--gd2); color: var(--gold); }
.xs-chip img { width: 16px; height: 16px; border-radius: 2px; }

/* Spell list — paginated */
.xs-list { flex: 1; overflow: hidden; min-height: 0; display: flex; flex-direction: column; }
.xs-lcount { padding: 8px 16px; font-size: 12px; color: var(--tx2); border-bottom: 1px solid var(--bd); flex-shrink: 0; }
.xs-litems { flex: 1; overflow-y: auto; overflow-x: hidden; }
.xs-litems::-webkit-scrollbar { width: 4px; }
.xs-litems::-webkit-scrollbar-thumb { background: var(--bd2); border-radius: 2px; }

.xs-litem {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 14px; cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .15s;
}
.xs-litem:hover { background: rgba(255,255,255,.025); }
.xs-litem.on { background: var(--gg1); border-left-color: var(--gold); }
.xs-lico { width: 30px; height: 30px; border-radius: 5px; background: var(--bg4); flex-shrink: 0; overflow: hidden; }
.xs-lico img { width: 100%; height: 100%; object-fit: contain; }
.xs-lname { font-size: 13px; font-weight: 600; color: var(--tx); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.xs-lmeta { font-size: 11px; color: var(--tx2); display: flex; align-items: center; gap: 4px; }
.xs-ldot { display: inline-block; width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; }

/* Pagination */
.xs-pager {
  display: flex; justify-content: center; align-items: center; gap: 4px;
  padding: 10px; border-top: 1px solid var(--bd); flex-shrink: 0;
}
.xs-pager button {
  padding: 4px 10px; background: var(--bg3); border: 1px solid var(--bd);
  border-radius: 4px; font-size: 12px; font-weight: 600; color: var(--tx2);
  transition: all .15s;
}
.xs-pager button:hover { border-color: var(--bd2); color: var(--tx); }
.xs-pager button.on { background: var(--gg1); border-color: var(--gd2); color: var(--gold); }
.xs-pager button:disabled { opacity: .3; cursor: default; }
.xs-pager-info { font-size: 11px; color: var(--tx2); margin: 0 6px; }

/* ═══ CENTER: SPELL CARD ═══ */
.xs-center { align-self: start; }
.xs-card {
  background: var(--bg2); border: 1px solid var(--bd); border-radius: var(--r);
  overflow: hidden; box-shadow: 0 8px 40px rgba(0,0,0,.5);
}

/* Header */
.xs-hdr {
  padding: 18px 24px 16px;
  background: linear-gradient(165deg, #1c1a14 0%, var(--bg2) 100%);
  border-bottom: 1px solid var(--gd2);
  position: relative;
}
.xs-hdr::after {
  content: ''; position: absolute; bottom: -1px; left: 8%; right: 8%; height: 1px;
  background: linear-gradient(90deg, transparent, rgba(201,164,74,.4), transparent);
}

.xs-hdr-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.xs-lvl-label { font-size: 11px; color: var(--tx2); font-weight: 700; text-transform: uppercase; letter-spacing: .8px; }
.xs-lvls { display: flex; gap: 3px; }
.xs-lvl {
  width: 34px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg3); border: 1px solid var(--bd); border-radius: 5px;
  color: var(--tx2); font-size: 14px; font-weight: 700; transition: all .12s;
}
.xs-lvl:hover { border-color: var(--gd2); color: var(--tx); }
.xs-lvl.on {
  background: linear-gradient(135deg, var(--gold), var(--gd2));
  border-color: var(--gold); color: #15120c;
  box-shadow: 0 0 16px rgba(201,164,74,.3);
}

.xs-ident { display: flex; gap: 16px; align-items: center; }
.xs-sico {
  width: 66px; height: 66px; border: 2px solid var(--gd2); border-radius: 12px;
  background: linear-gradient(135deg, #28241a, #18160f);
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  box-shadow: 0 0 24px rgba(201,164,74,.08); overflow: hidden;
}
.xs-sico img { width: 50px; height: 50px; }

.xs-sinfo { flex: 1; min-width: 0; }
.xs-nrow { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; }
.xs-sname { font-size: 22px; font-weight: 700; color: var(--tx3); letter-spacing: -.2px; }
.xs-sid { font-size: 13px; color: var(--tx2); font-weight: 400; }

.xs-srow { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; gap: 8px; flex-wrap: wrap; }
.xs-reqlvl { font-size: 14px; color: var(--tx2); }
.xs-reqlvl strong { color: var(--tx3); }
.xs-badges { display: flex; gap: 8px; }
.xs-bdg {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 12px; border-radius: 16px;
  font-size: 13px; font-weight: 700; white-space: nowrap; border: 1px solid;
}
.xs-bdg-po { background: rgba(201,164,74,.06); border-color: rgba(201,164,74,.2); color: var(--gold); }
.xs-bdg-pa { background: rgba(40,153,224,.06); border-color: rgba(40,153,224,.2); color: #5eace4; }

/* Body */
.xs-body { padding: 22px 24px; }

.xs-desc {
  font-size: 14px; color: var(--tx); font-style: italic; line-height: 1.7;
  padding: 12px 18px; background: var(--gg2);
  border-left: 3px solid var(--gd2);
  border-radius: 0 var(--r2) var(--r2) 0; margin-bottom: 18px;
}

.xs-states { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 20px; }
.xs-state { padding: 10px 14px; background: var(--bg3); border-radius: var(--r2); border: 1px solid var(--bd); }
.xs-state-l { font-size: 10px; font-weight: 800; color: var(--tx2); text-transform: uppercase; letter-spacing: .5px; margin-bottom: 3px; }
.xs-state-v { font-size: 13px; color: var(--tx); }

.xs-stitle {
  font-size: 12px; font-weight: 800; color: var(--gold);
  text-transform: uppercase; letter-spacing: 2px;
  margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1px solid rgba(201,164,74,.12);
}

/* Effects */
.xs-effects { margin-bottom: 22px; }
.xs-etabs { display: flex; gap: 2px; }
.xs-etab {
  padding: 8px 20px; font-size: 12px; font-weight: 700;
  border-radius: var(--r2) var(--r2) 0 0;
  border: 1px solid var(--bd); border-bottom: none;
  color: var(--tx2); background: var(--bg4);
  text-transform: uppercase; letter-spacing: .6px;
  transition: all .18s;
}
.xs-etab:hover { color: var(--tx); }
.xs-etab.on { background: var(--bg3); color: var(--gold); border-color: var(--bd2); }

.xs-ebox {
  background: var(--bg3); border: 1px solid var(--bd2);
  border-radius: 0 var(--r2) var(--r2) var(--r2);
}

.xs-erow {
  display: flex; align-items: center; padding: 11px 14px; gap: 10px;
  border-bottom: 1px solid rgba(255,255,255,.025);
  transition: background .1s;
}
.xs-erow:last-child { border-bottom: none; }
.xs-erow:hover { background: rgba(255,255,255,.018); }
.xs-eico { width: 22px; height: 22px; flex-shrink: 0; object-fit: contain; }
.xs-etxt { flex: 1; font-size: 14px; color: var(--tx); }
.xs-earea {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 10px; background: rgba(201,164,74,.05);
  border: 1px solid rgba(201,164,74,.1); border-radius: 4px;
  font-size: 11px; font-weight: 700; color: var(--gold); white-space: nowrap;
}
.xs-earea img { width: 14px; height: 14px; opacity: .5; }

/* Chars */
.xs-cgrid {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 1px; background: var(--bd);
  border: 1px solid var(--bd); border-radius: var(--r2); overflow: hidden;
}
.xs-citem {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: var(--bg3); font-size: 13px;
}
.xs-clabel { color: var(--tx2); }
.xs-cval { font-weight: 700; color: var(--tx); }
.xs-bool {
  width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; line-height: 1;
}
.xs-byes { background: rgba(72,184,72,.1); color: var(--ok); }
.xs-bno  { background: rgba(200,56,56,.08); color: var(--ko); }

/* ═══ RIGHT: PREVIEW (ISOMETRIC GRID) ═══ */
.xs-right { position: sticky; top: 16px; align-self: start; }
.xs-prev {
  background: var(--bg2); border: 1px solid var(--bd); border-radius: var(--r);
  padding: 16px; box-shadow: 0 6px 28px rgba(0,0,0,.4);
}
.xs-prev-title {
  font-size: 10px; font-weight: 800; color: var(--gold);
  text-transform: uppercase; letter-spacing: 2.5px;
  margin-bottom: 14px; padding-bottom: 8px;
  border-bottom: 1px solid rgba(201,164,74,.1);
}

/* Isometric grid — interlocking diamond cells like Solomonk/Dofus */
.xs-pgrid {
  position: relative;
  margin: 0 auto;
}
.xs-prow { /* not used in absolute layout */ }
.xs-pc {
  position: absolute;
  clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%);
  background: rgba(255,255,255,.06);
  flex-shrink: 0;
  cursor: crosshair;
  transition: background .08s;
  z-index: 1;
}
.xs-pc:hover { background: rgba(255,255,255,.18); z-index: 2; }
.xs-pc.rng {
  background: rgba(65,140,215,.40);
}
.xs-pc.rng:hover { background: rgba(65,140,215,.65); z-index: 2; }
.xs-pc.me {
  background: var(--gold);
  z-index: 3;
}

/* AoE hover highlighting */
.xs-pc.aoe-target {
  background: rgba(220,90,40,.75) !important;
  z-index: 4;
}
.xs-pc.aoe {
  background: rgba(220,130,50,.50) !important;
  z-index: 2;
}

/* Hover tooltip */
.xs-tip {
  position: absolute; z-index: 10;
  background: rgba(0,0,0,.88); color: #eee;
  font-size: 11px; font-weight: 600; padding: 3px 8px;
  border-radius: 4px; white-space: nowrap;
  pointer-events: none; transform: translateX(-50%);
}

/* Legend + info */
.xs-pleg {
  display: flex; gap: 18px; justify-content: center;
  margin-top: 14px; font-size: 11px; color: var(--tx2);
}
.xs-pleg-i { display: flex; align-items: center; gap: 6px; }
.xs-pleg-d { width: 14px; height: 9px; clip-path: polygon(50% 0%, 100% 50%, 50% 100%, 0% 50%); }
.xs-pleg-d.rng { background: rgba(65,140,215,.50); }
.xs-pleg-d.me  { background: var(--gold); }

.xs-pinfo { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--bd); }
.xs-pirow { display: flex; justify-content: space-between; align-items: center; padding: 5px 0; font-size: 13px; }
.xs-pil { color: var(--tx2); }
.xs-piv { font-weight: 700; color: var(--tx3); }
.xs-pie { font-weight: 700; }
.xs-pie[data-e="terre"]  { color: var(--earth); }
.xs-pie[data-e="feu"]    { color: var(--fire); }
.xs-pie[data-e="eau"]    { color: var(--water); }
.xs-pie[data-e="air"]    { color: var(--air); }
.xs-pie[data-e="neutre"] { color: var(--neutral); }

/* Empty / placeholder */
.xs-empty { text-align: center; padding: 80px 20px; color: var(--tx2); }
.xs-empty-ico { font-size: 44px; margin-bottom: 10px; opacity: .2; }
.xs-empty-txt { font-size: 15px; }
.xs-nolvl { padding: 36px 20px; text-align: center; color: var(--tx2); font-size: 14px; line-height: 1.8; }
.xs-nolvl-ico { font-size: 30px; margin-bottom: 8px; opacity: .25; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 1340px) { .xs-grid { grid-template-columns: 230px minmax(0,1fr) 340px; } }
@media (max-width: 1080px) { .xs-grid { grid-template-columns: minmax(0,1fr) 320px; } .xs-left { display: none; } }
@media (max-width: 768px) {
  .xs-grid { grid-template-columns: 1fr; padding: 10px; gap: 10px; }
  .xs-right { position: static; }
  .xs-states { grid-template-columns: 1fr; }
  .xs-cgrid { grid-template-columns: 1fr; }
}

.xs-sorts-app ::-webkit-scrollbar { width: 4px; }
.xs-sorts-app ::-webkit-scrollbar-track { background: transparent; }
.xs-sorts-app ::-webkit-scrollbar-thumb { background: var(--bd2); border-radius: 2px; }