/* ===== Thème Arcane ===== */
:root {
  --bg-top: #2a1670; --bg-bottom: #070620; --glow: #7b4dff;
  --panel: #14134a; --panel-2: #1f1c68;
  --line: #4040a8; --trim: #ff6bb8; --trim-hi: #ffd6ec; --trim-lo: #a02c74;
  --accent: #38e1ff; --text: #efecff; --muted: #aaa6e0;
}
:root {
  --horde: #ff5a4d; --alliance: #4aa3ff; --ok: #5fd9a6; --err: #ff8070;
  --hexshape: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%);
}

* { box-sizing: border-box; }
html { background: var(--bg-bottom); color-scheme: dark; }
body {
  margin: 0; min-height: 100vh; color: var(--text);
  font: 400 16px/1.55 "Barlow", system-ui, sans-serif;
  background:
    radial-gradient(900px 440px at 50% -80px, color-mix(in srgb, var(--glow) 55%, transparent), transparent 70%),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='56' height='100' viewBox='0 0 56 100'%3E%3Cpath d='M28 66L0 50L0 16L28 0L56 16L56 50L28 66L28 100' fill='none' stroke='%2370b0ff' stroke-opacity='.08'/%3E%3Cpath d='M28 0L28 34L0 50L0 84L28 100L56 84L56 50L28 34' fill='none' stroke='%2370b0ff' stroke-opacity='.08'/%3E%3C/svg%3E"),
    linear-gradient(var(--bg-top), var(--bg-bottom) 70%);
  background-attachment: fixed, scroll, fixed;
}
main { max-width: 1040px; margin: 0 auto; padding: 1rem 1.25rem 4rem; }
a { color: inherit; }
code { background: color-mix(in srgb, var(--bg-bottom) 70%, transparent); padding: .1rem .4rem; border-radius: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---- en-tête */
.top { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  max-width: 1040px; margin: 0 auto; padding: 1.8rem 1.25rem .9rem;
  border-bottom: 1px solid; border-image: linear-gradient(90deg, transparent, var(--trim), transparent) 1; }
.brand { font: 700 2.1rem/1.1 "Cinzel", Georgia, serif; letter-spacing: .04em; text-decoration: none;
  color: var(--trim); background: linear-gradient(180deg, var(--trim-hi), var(--trim) 60%, var(--trim-lo));
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
  filter: drop-shadow(0 0 14px color-mix(in srgb, var(--accent) 45%, transparent)); }

/* ---- éléments communs */
.flash { padding: .7rem 1rem; margin: 1rem 0 0; background: var(--panel); border: 1px solid var(--line); border-left: 4px solid; }
.flash.ok { border-left-color: var(--ok); } .flash.error { border-left-color: var(--err); }

button { font: 600 .95rem "Barlow", sans-serif; cursor: pointer; padding: .55rem 1.2rem; color: var(--trim-hi);
  background: linear-gradient(180deg, var(--panel-2), var(--panel)); border: 1px solid var(--trim); border-radius: 2px;
  transition: box-shadow .15s, filter .15s; }
button:hover { filter: brightness(1.2); box-shadow: 0 0 16px color-mix(in srgb, var(--accent) 55%, transparent); }
button.ghost { background: transparent; color: var(--text); border-color: var(--line); }
button.ghost:hover { border-color: var(--accent); }
button.danger:hover { border-color: var(--err); color: var(--err); box-shadow: none; }
input { font: inherit; padding: .55rem .8rem; min-width: 12rem; color: var(--text);
  background: color-mix(in srgb, var(--bg-bottom) 65%, transparent);
  border: 1px solid var(--line); border-bottom: 2px solid var(--trim-lo); border-radius: 2px; }
input:focus { outline: none; border-bottom-color: var(--accent); box-shadow: 0 6px 16px -8px var(--accent); }

/* cadres : coins dorés */
.toolbar, .identity, .gear, .podium-card { position: relative; background: linear-gradient(180deg, var(--panel-2), var(--panel));
  border: 1px solid var(--line); }
.toolbar::before, .identity::before, .gear::before, .podium-card::before,
.toolbar::after, .identity::after, .gear::after, .podium-card::after {
  content: ""; position: absolute; width: 16px; height: 16px; pointer-events: none; }
.toolbar::before, .identity::before, .gear::before, .podium-card::before {
  top: -1px; left: -1px; border-top: 2px solid var(--trim); border-left: 2px solid var(--trim); }
.toolbar::after, .identity::after, .gear::after, .podium-card::after {
  bottom: -1px; right: -1px; border-bottom: 2px solid var(--trim); border-right: 2px solid var(--trim); }

.horde { --faction: var(--horde); } .alliance { --faction: var(--alliance); }

/* hexagone de niveau */
.hex { --s: 56px; position: relative; display: grid; place-items: center; flex: none;
  width: var(--s); height: calc(var(--s) * 1.1547);
  background: linear-gradient(160deg, var(--trim-hi), var(--trim), var(--trim-lo)); clip-path: var(--hexshape); }
.hex::before { content: ""; position: absolute; inset: 3px; clip-path: var(--hexshape);
  background: linear-gradient(180deg, var(--panel-2), var(--bg-bottom)); }
.hex span { position: relative; font: 700 calc(var(--s) * .4)/1 "Cinzel", serif; color: var(--trim-hi); }
.hex.sm { --s: 38px; } .hex.lg { --s: 76px; }

.faction { display: inline-flex; align-items: center; gap: .45rem; font-weight: 600; color: var(--faction); }
.faction::before { content: ""; width: .55rem; height: .55rem; background: currentColor; transform: rotate(45deg); }

/* ---- barre d'outils */
.toolbar { display: flex; flex-wrap: wrap; gap: 1rem 1.5rem; align-items: center; justify-content: space-between;
  padding: 1rem 1.2rem; margin: 1.4rem 0 1.6rem; }
.add-form { display: flex; gap: .6rem; align-items: center; flex-wrap: wrap; }
.add-form label { color: var(--muted); }
.toolbar form { margin: 0; }
.filters { display: flex; gap: .4rem; }
.filters a { text-decoration: none; padding: .35rem .9rem; border: 1px solid var(--line); border-radius: 2px; color: var(--muted); }
.filters a:hover { color: var(--text); border-color: var(--accent); }
.filters a.on { color: var(--trim-hi); border-color: var(--trim); background: color-mix(in srgb, var(--accent) 18%, transparent); }
.filters a.horde.on { border-color: var(--horde); } .filters a.alliance.on { border-color: var(--alliance); }

/* ---- podium */
.podium { display: grid; grid-template-columns: 1fr 1.18fr 1fr; gap: 1.1rem; align-items: end; margin-bottom: 1.6rem; }
.podium-card { display: grid; justify-items: center; gap: .3rem; padding: 1.5rem 1rem 1.4rem; text-decoration: none;
  box-shadow: inset 0 3px 0 var(--faction); transition: transform .15s, box-shadow .15s; }
.podium-card:hover { transform: translateY(-3px); }
.pos-1 { order: 2; padding-block: 2.2rem 1.9rem; border-color: var(--trim);
  box-shadow: inset 0 3px 0 var(--faction), 0 0 40px color-mix(in srgb, var(--accent) 35%, transparent); }
.pos-2 { order: 1; } .pos-3 { order: 3; }
.podium-rank { font: 700 1.1rem "Cinzel", serif; color: var(--trim); }
.pos-1 .podium-rank { font-size: 1.6rem; }
.podium-name { font: 700 1.4rem/1.2 "Cinzel", serif; margin-top: .4rem; overflow-wrap: anywhere; text-align: center; }
.podium-sub { color: var(--muted); }
.podium-guild { color: var(--muted); font-style: italic; font-size: .9rem; }
.podium-card .faction { margin-top: .4rem; font-size: .9rem; }

/* ---- liste (rang 4 et suivants) */
.ranking { width: 100%; border-collapse: separate; border-spacing: 0 .4rem; }
.ranking th { text-align: left; font-weight: 500; color: var(--muted); padding: .2rem 1rem; }
.ranking td { padding: .5rem 1rem; background: color-mix(in srgb, var(--panel-2) 88%, var(--panel));
  border-block: 1px solid var(--line); }
.ranking td:first-child { border-left: 3px solid var(--faction); }
.ranking td:last-child { border-right: 1px solid var(--line); }
.ranking tbody tr:hover td { background: color-mix(in srgb, var(--accent) 16%, var(--panel-2)); }
.rank { width: 4rem; color: var(--trim); font: 700 1.15rem "Cinzel", serif; }
.char { font-weight: 600; font-size: 1.1rem; text-decoration: none; }
.char:hover { text-decoration: underline; }
.row-guild { color: var(--muted); font-size: .9rem; margin-left: .5rem; }
.stale { color: var(--err); font-size: .8rem; margin-left: .5rem; border-bottom: 1px dotted var(--err); }
.lvl { display: flex; align-items: center; gap: .7rem; white-space: nowrap; }
.lvl-bar { display: inline-block; width: 90px; height: 5px; background: color-mix(in srgb, var(--bg-bottom) 70%, transparent); overflow: hidden; }
.lvl-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--trim)); }
.hint { color: var(--muted); font-size: .9rem; margin-top: .8rem; }
.empty { color: var(--muted); padding: 2rem 0; }

/* ---- fiche personnage */
.back { color: var(--muted); text-decoration: none; display: inline-block; margin: 1.2rem 0 .8rem; }
.back::before { content: "‹ "; } .back:hover { color: var(--trim-hi); }
.sheet { display: grid; grid-template-columns: 310px 1fr; gap: 1.5rem; align-items: start; margin-top: .5rem; }
.identity, .gear { padding: 1.5rem; }
.identity { box-shadow: inset 0 3px 0 var(--faction), 0 0 34px color-mix(in srgb, var(--faction) 18%, transparent); }
.identity-head { display: flex; gap: 1rem; align-items: center; margin-bottom: .6rem; }
.identity h1 { font: 700 1.55rem/1.15 "Cinzel", serif; margin: 0 0 .3rem; overflow-wrap: break-word; }
.identity-head > div { min-width: 0; }
.identity .hex.lg { --s: 64px; }
.subtitle { margin: 0; color: var(--text); }
.guild { margin: .2rem 0 0; color: var(--muted); font-style: italic; }
.portrait { width: 100%; max-height: 260px; object-fit: cover; object-position: top; margin-bottom: 1rem; border: 1px solid var(--trim-lo); }
.facts { margin: 1.3rem 0; display: grid; gap: .6rem; }
.facts div { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: .4rem; }
.facts dt { color: var(--muted); } .facts dd { margin: 0; font-weight: 600; }
.actions { display: flex; gap: .6rem; }
.main-col { display: grid; gap: 1.5rem; min-width: 0; }
.extras { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.5rem; }
.gear h2 { font: 700 1.25rem "Cinzel", serif; color: var(--trim); margin: 0 0 1rem; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.slots ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; align-content: start; }
.slots li { display: grid; grid-template-columns: 1fr auto; align-content: start; padding: .5rem .7rem;
  background: color-mix(in srgb, var(--bg-bottom) 55%, transparent); border: 1px solid var(--line);
  border-left: 3px solid var(--line); }
.slot-name { grid-column: 1 / -1; font-size: .8rem; color: var(--muted); }
.item-name { font-weight: 600; line-height: 1.25; }
.item-name a { text-decoration: none; } .item-name a:hover { text-decoration: underline; }
.ilvl { color: var(--muted); font-size: .85rem; align-self: end; }
.ench { grid-column: 1 / -1; font-size: .8rem; color: var(--ok); }
li.empty .item-name { color: color-mix(in srgb, var(--muted) 60%, transparent); font-weight: 400; font-style: italic; }
.q-poor { border-left-color: #9d9d9d !important; } .q-common { border-left-color: #fff !important; }
.q-uncommon { border-left-color: #1eff00 !important; } .q-rare { border-left-color: #0070dd !important; }
.q-epic { border-left-color: #a335ee !important; } .q-legendary { border-left-color: #ff8000 !important; }
.q-uncommon .item-name { color: #1eff00; } .q-rare .item-name { color: #5aa9ff; }
.q-epic .item-name { color: #c780ff; } .q-legendary .item-name { color: #ff8000; } .q-poor .item-name { color: #9d9d9d; }
.talents { font: 700 1.8rem "Cinzel", serif; margin: 0 0 .6rem; color: var(--trim-hi); }
.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: .35rem; }
.plain li { display: flex; justify-content: space-between; border-bottom: 1px solid var(--line); padding-bottom: .3rem; }
.plain span { color: var(--muted); }

@media (max-width: 820px) {
  .podium { grid-template-columns: 1fr; }
  .pos-1, .pos-2, .pos-3 { order: 0; }
  .sheet, .slots { grid-template-columns: 1fr; }
  .ranking th:nth-child(5), .ranking td:nth-child(5) { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
  .podium-card:hover { transform: none; }
}

.note { color: var(--muted); font-size: .9rem; margin: -.4rem 0 1rem; }

/* ---- fiche : 3 colonnes (infos | modèle 3D | équipement) */
main.wide { max-width: 1360px; }
.sheet { grid-template-columns: 270px minmax(300px, 1fr) 430px; align-items: stretch; }
.side { margin-top: 3.5rem; }            /* le centre dépasse en haut, comme sur la maquette */
.model-panel { position: relative; min-height: 700px; padding: 0; overflow: hidden;
  background: radial-gradient(420px 320px at 50% 62%, color-mix(in srgb, var(--glow) 38%, transparent), var(--bg-bottom) 78%); }
.model-stage { position: absolute; inset: 0; }
.model-stage canvas { display: block; width: 100% !important; height: 100% !important; }
.model-status { position: absolute; inset: auto 1rem 1.2rem; margin: 0; text-align: center; color: var(--muted); }
.slots { grid-template-columns: 1fr 1fr; }
.slots ul:nth-child(3) { grid-column: 1 / -1; grid-template-columns: repeat(3, 1fr); }
@media (max-width: 1100px) {
  .sheet { grid-template-columns: 1fr; }
  .side { margin-top: 0; }
  .model-panel { min-height: 520px; order: -1; }
}
@media (max-width: 820px) { .slots, .slots ul:nth-child(3) { grid-template-columns: 1fr; } }

body.wide .top { max-width: 1360px; }
.identity-head { flex-direction: column; text-align: center; gap: .7rem; margin-bottom: 1rem; }
.facts dd { text-align: right; }

.model-log { margin-top: 1.5rem; padding: 1rem; max-height: 340px; overflow: auto; white-space: pre-wrap; word-break: break-all;
  font: 12px/1.45 ui-monospace, Consolas, monospace; color: var(--text);
  background: color-mix(in srgb, var(--bg-bottom) 80%, transparent); border: 1px solid var(--line); user-select: all; }
