/* ————————————————————————————————————————————————————————————————
   Carnet de Teyvat — un carnet de guilde sur papier, calqué sur la feuille Google :
   bandeaux à la couleur de l'élément, libellés verticaux, cellules de tableur.
   ———————————————————————————————————————————————————————————————— */

@font-face { font-family: 'Archivo'; src: url('/fonts/archivo.woff2') format('woff2'); font-weight: 100 900; font-stretch: 62% 125%; font-style: normal; font-display: swap; }
@font-face { font-family: 'Archivo'; src: url('/fonts/archivo-italic.woff2') format('woff2'); font-weight: 100 900; font-stretch: 62% 125%; font-style: italic; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('/fonts/fraunces.woff2') format('woff2'); font-weight: 100 900; font-style: normal; font-display: swap; }
@font-face { font-family: 'Fraunces'; src: url('/fonts/fraunces-italic.woff2') format('woff2'); font-weight: 100 900; font-style: italic; font-display: swap; }

/* ——— Jetons ——— */
:root {
  --paper: #f2ebdd;
  --paper-2: #e7dcc8;
  --sheet: #fdfaf4;
  --cell-alt: #f1ebe0;
  --ink: #1f1a15;
  --ink-2: #4f463b;
  --ink-3: #82786a;
  --rule: #d3c6b1;
  --rule-2: #b4a58d;
  --frame: #2b241d;
  --dot: rgba(70, 52, 30, 0.13);
  --dark-cell: #3d3730;
  --hatch: rgba(255, 255, 255, 0.06);
  --shadow-hard: rgba(43, 36, 29, 0.85);
  --scrim: rgba(31, 26, 21, 0.38);

  --ok: #2f9e55;
  --bad: #c42d1f;
  --warn: #b7791f;
  --parfait: #1d7a3b;
  --bon: #c2e5ad;
  --bon-ink: #22501a;
  --changer: #c8352b;
  --prio: #c8352b;
  --second: #2f6fd6;
  --option: #4b4540;
  --gold: #b9871f;
  --focus: #1b6fe0;

  --c0: #d9d1c4; --c0-ink: #3d362e;
  --c1: #f3a59a; --c1-ink: #5c160f;
  --c2: #f2b46e; --c2-ink: #5a3005;
  --c3: #e9d36b; --c3-ink: #4d3f05;
  --c4: #a5d69c; --c4-ink: #1f4a17;
  --c5: #8fb8f2; --c5-ink: #10356b;
  --c6: #c8a3f2; --c6-ink: #3b1468;

  --font: 'Archivo', 'Segoe UI', system-ui, sans-serif;
  --serif: 'Fraunces', Georgia, 'Times New Roman', serif;
  --top-h: 52px;
  --tabs-h: 44px;
  color-scheme: light;
}

:root[data-theme='dark'] {
  --paper: #17151a;
  --paper-2: #211e24;
  --sheet: #1f1c21;
  --cell-alt: #252228;
  --ink: #ece4d6;
  --ink-2: #c4b9a8;
  --ink-3: #8f8577;
  --rule: #3b363d;
  --rule-2: #544d55;
  --frame: #9a8f80;
  --dot: rgba(236, 228, 214, 0.07);
  --dark-cell: #0f0e11;
  --hatch: rgba(255, 255, 255, 0.04);
  --shadow-hard: rgba(0, 0, 0, 0.75);
  --scrim: rgba(0, 0, 0, 0.55);

  --ok: #3fb46a;
  --bad: #ff6b5c;
  --parfait: #2b8f4b;
  --bon: #2f5a25;
  --bon-ink: #d4f0c4;
  --changer: #c8392e;
  --second: #3a78e0;
  --option: #5e5650;
  --focus: #5b9bff;

  --c0: #3f3a36; --c0-ink: #ddd3c5;
  --c1: #7a2e26; --c1-ink: #ffd9d3;
  --c2: #7a4b17; --c2-ink: #ffe2bd;
  --c3: #6b5d16; --c3-ink: #fff0b0;
  --c4: #2f5a2a; --c4-ink: #d4f5cb;
  --c5: #24467a; --c5-ink: #d3e4ff;
  --c6: #4f2d7a; --c6-ink: #ecdcff;
  color-scheme: dark;
}

/* Palettes d'élément : bandeau, lavis des cellules, encre des libellés. */
[data-el] { --el: #cbc1b0; --el-wash: #efe8dc; --el-ink: #463d32; --el-deep: #a99d89; --el-text: #1f1a15; }
[data-el='pyro'] { --el: #ef8f7b; --el-wash: #fbe5de; --el-ink: #8a2717; --el-deep: #d8644d; }
[data-el='hydro'] { --el: #74a6ee; --el-wash: #e0ebfc; --el-ink: #18478f; --el-deep: #4d84d6; }
[data-el='anemo'] { --el: #7ccab4; --el-wash: #ddf2ea; --el-ink: #155c4a; --el-deep: #4aa98f; }
[data-el='electro'] { --el: #b49de2; --el-wash: #ece4f8; --el-ink: #4c2c86; --el-deep: #8a6acb; }
[data-el='dendro'] { --el: #a2cf6e; --el-wash: #e8f3da; --el-ink: #3a5e15; --el-deep: #76ad42; }
[data-el='cryo'] { --el: #9ed8e8; --el-wash: #e1f4f9; --el-ink: #1b5f70; --el-deep: #62b8d0; }
[data-el='geo'] { --el: #e8bd5c; --el-wash: #f8eccf; --el-ink: #74500d; --el-deep: #cf9d2c; }

:root[data-theme='dark'] [data-el] { --el: #4a443c; --el-wash: #29262a; --el-ink: #e2d8c8; --el-deep: #5c544a; --el-text: #f3ece0; }
:root[data-theme='dark'] [data-el='pyro'] { --el: #8e3a2c; --el-wash: #2e1f1d; --el-ink: #ffc3b6; --el-deep: #a9493a; }
:root[data-theme='dark'] [data-el='hydro'] { --el: #2f5996; --el-wash: #1b2333; --el-ink: #bcd5ff; --el-deep: #3c6db5; }
:root[data-theme='dark'] [data-el='anemo'] { --el: #2a7563; --el-wash: #1a2a27; --el-ink: #b4ecdc; --el-deep: #348a75; }
:root[data-theme='dark'] [data-el='electro'] { --el: #5e4894; --el-wash: #241f31; --el-ink: #dccdff; --el-deep: #7258b0; }
:root[data-theme='dark'] [data-el='dendro'] { --el: #4c7224; --el-wash: #20271a; --el-ink: #d0efab; --el-deep: #5d8a2d; }
:root[data-theme='dark'] [data-el='cryo'] { --el: #2b6f82; --el-wash: #1a272c; --el-ink: #c0edf8; --el-deep: #35859b; }
:root[data-theme='dark'] [data-el='geo'] { --el: #8a6420; --el-wash: #2b2519; --el-ink: #fbe0a6; --el-deep: #a67a29; }

/* ——— Base ——— */
*, *::before, *::after { box-sizing: border-box; }
html { height: 100%; -webkit-text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100%;
  font: 400 14px/1.4 var(--font);
  color: var(--ink);
  background-color: var(--paper);
  background-image: radial-gradient(var(--dot) 0.9px, transparent 1.1px);
  background-size: 22px 22px;
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; background: none; border: 0; padding: 0; }
button:disabled { cursor: default; }
a { color: inherit; }
img { display: block; max-width: 100%; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
::selection { background: color-mix(in srgb, var(--focus) 28%, transparent); }

.ico { width: 18px; height: 18px; flex: none; }
.glyph { width: 1em; height: 1em; flex: none; }
.seal { width: 28px; height: 28px; flex: none; }
.loading { color: var(--ink-3); font-style: italic; padding: 40px; text-align: center; }
.note { font: italic 400 13px/1.5 var(--serif); color: var(--ink-2); border-left: 3px solid var(--rule-2); padding: 4px 10px; }

/* ——— Boutons ——— */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 34px; padding: 6px 14px;
  border: 1.5px solid var(--frame); border-radius: 2px;
  background: var(--sheet); color: var(--ink);
  font: 700 12.5px/1 var(--font); font-stretch: 88%; letter-spacing: 0.06em; text-transform: uppercase;
  text-decoration: none; white-space: nowrap;
  transition: transform 0.08s, box-shadow 0.08s, background-color 0.15s;
}
.btn:hover:not(:disabled) { box-shadow: 3px 3px 0 var(--shadow-hard); transform: translate(-1px, -1px); }
.btn:active:not(:disabled) { box-shadow: none; transform: none; }
.btn:disabled { opacity: 0.45; }
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-danger { background: var(--changer); border-color: var(--changer); color: #fff; }
.btn-ghost { background: transparent; border-color: var(--rule-2); }
.btn-small { min-height: 28px; padding: 4px 10px; font-size: 11.5px; }
.btn-wide { width: 100%; min-height: 40px; }
.btn .ico { width: 15px; height: 15px; }

.icon-btn {
  display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 2px; color: var(--ink-2);
}
.icon-btn:hover { background: color-mix(in srgb, var(--ink) 8%, transparent); color: var(--ink); }
.link-btn { display: inline-flex; align-items: center; gap: 6px; font: 600 12.5px var(--font); color: var(--ink-2); text-decoration: underline; text-underline-offset: 3px; }
.link-btn .ico { width: 15px; height: 15px; }

/* ——— Champs ——— */
.stack { display: grid; gap: 14px; }
.field { display: grid; gap: 5px; }
.field-label { font: 700 11px/1.2 var(--font); font-stretch: 85%; letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-2); }
.field-hint { font: italic 400 12.5px/1.4 var(--serif); color: var(--ink-3); }
.field-input {
  width: 100%; min-height: 38px; padding: 7px 10px;
  background: var(--sheet); border: 1.5px solid var(--rule-2); border-radius: 2px;
}
.field-input:focus { outline: none; border-color: var(--focus); box-shadow: inset 0 0 0 1px var(--focus); }

/* ——— Barre du haut ——— */
.topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; gap: 22px;
  height: var(--top-h); padding: 0 16px 0 18px;
  background: var(--paper);
  border-bottom: 2px solid var(--frame);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--ink); }
.brand-seal { width: 26px; height: 26px; }
.brand-seal path:last-child { fill: var(--changer); }
.brand-name { font: 600 19px/1 var(--serif); letter-spacing: -0.01em; white-space: nowrap; }
.brand-name i { font-weight: 400; font-size: 15px; color: var(--ink-2); }
.nav { display: flex; align-self: stretch; gap: 4px; }
.nav-btn {
  display: flex; align-items: center; gap: 7px; padding: 0 12px;
  font: 800 13px/1 var(--font); font-stretch: 82%; letter-spacing: 0.07em; text-transform: uppercase; color: var(--ink-3);
  border-bottom: 3px solid transparent; margin-bottom: -2px;
}
.nav-btn:hover { color: var(--ink); }
.nav-btn.is-on { color: var(--ink); border-bottom-color: var(--changer); }
.nav-btn .ico { width: 17px; height: 17px; }
.top-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.sync { font: 500 12px/1 var(--font); color: var(--ink-3); }
.sync span { display: inline-flex; align-items: center; gap: 6px; }
.sync .ico { width: 15px; height: 15px; }
.sync-run { color: var(--warn); }
.sync-run .ico { animation: spin 1.4s linear infinite; }
.sync-err { color: var(--bad); }
@keyframes spin { to { transform: rotate(360deg); } }
.live { display: inline-flex; align-items: center; gap: 6px; font: 600 11.5px/1 var(--font); color: var(--ink-3); }
.live::before { content: ''; width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.live-live::before { background: var(--ok); }
.live-retry::before { background: var(--warn); }
.live-down::before { background: var(--bad); }
.user-btn {
  display: inline-flex; align-items: center; gap: 8px; height: 32px; padding: 0 12px;
  border: 1.5px solid var(--rule-2); border-radius: 2px; font: 700 12.5px var(--font);
}
.user-btn:hover { border-color: var(--frame); }
.user-btn .ico { width: 16px; height: 16px; }

/* Appli de bureau : la barre sert de poignée et laisse la place aux boutons de fenêtre. */
.is-desktop .topbar {
  -webkit-app-region: drag;
  padding-right: calc(100vw - env(titlebar-area-x, 0px) - env(titlebar-area-width, calc(100vw - 140px)) + 10px);
}
.is-desktop .topbar button, .is-desktop .topbar a, .is-desktop .topbar input { -webkit-app-region: no-drag; }

/* ——— Zone principale + onglets joueurs ——— */
.main { min-height: calc(100vh - var(--top-h) - var(--tabs-h)); padding: 26px 28px 60px; }
.tabs {
  position: sticky; bottom: 0; z-index: 30;
  display: flex; align-items: stretch; gap: 0; height: var(--tabs-h);
  background: var(--paper-2); border-top: 2px solid var(--frame);
}
.tab-add { width: 46px; display: grid; place-items: center; color: var(--ink-2); border-right: 1px solid var(--rule-2); }
.tab-add:hover { color: var(--ink); background: var(--sheet); }
.tab-list { display: flex; overflow-x: auto; scrollbar-width: thin; }
.tab {
  position: relative; display: flex; align-items: center; gap: 7px; padding: 0 18px;
  font: 700 13px/1 var(--font); font-stretch: 90%; letter-spacing: 0.02em; text-transform: uppercase; color: var(--ink-2);
  border-right: 1px solid var(--rule-2); white-space: nowrap;
}
.tab::after { content: ''; position: absolute; left: 10px; right: 10px; bottom: 6px; height: 2px; background: var(--who, var(--ink-3)); opacity: 0.85; }
.tab:hover { background: color-mix(in srgb, var(--sheet) 60%, transparent); color: var(--ink); }
.tab.is-on { background: var(--sheet); color: var(--ink); margin-top: -2px; border-top: 2px solid var(--frame); border-left: 2px solid var(--frame); border-right: 2px solid var(--frame); }
.tab.is-on::after { height: 4px; bottom: 0; left: 0; right: 0; opacity: 1; }
.tab-me { font: italic 500 11px var(--serif); text-transform: none; letter-spacing: 0; color: var(--ink-3); }
.tab-online { width: 7px; height: 7px; border-radius: 50%; background: var(--ok); }
.tab-credit { margin-left: auto; align-self: center; padding: 0 16px; font: italic 400 12px var(--serif); color: var(--ink-3); text-decoration: none; white-space: nowrap; }
.tab-credit:hover { color: var(--ink); text-decoration: underline; }

/* ——— En-tête de fiche ——— */
.sheet-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; max-width: 1500px; margin: 0 auto 26px; }
.sheet-title { display: grid; gap: 2px; }
.sheet-kicker { font: italic 400 15px/1 var(--serif); color: var(--ink-2); }
.sheet-name { margin: 0; font: 650 44px/1 var(--serif); letter-spacing: -0.02em; }
.sheet-meta { font: 600 12px var(--font); letter-spacing: 0.06em; text-transform: uppercase; color: var(--ink-3); margin-top: 6px; }
.lock {
  display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px;
  border: 1.5px dashed var(--rule-2); border-radius: 2px; font: 600 12.5px var(--font); color: var(--ink-2);
}
.lock:hover { border-style: solid; border-color: var(--frame); color: var(--ink); }
.lock.is-open { border-style: solid; border-color: var(--warn); color: var(--warn); }

.empty { max-width: 560px; margin: 50px auto; padding: 28px 30px; border: 2px solid var(--frame); background: var(--sheet); box-shadow: 6px 6px 0 var(--shadow-hard); }
.empty-title { margin: 0 0 6px; font: 650 24px/1.15 var(--serif); }
.empty-text { margin: 0 0 18px; color: var(--ink-2); }

/* ——— Équipes ——— */
.teams { max-width: 1500px; margin: 0 auto; }
.team { margin-bottom: 46px; scroll-margin-top: calc(var(--top-h) + 62px); }
/* Bandeau « Aller à » : collé sous la barre du haut, comme des onglets d'intercalaire. */
.jump {
  position: sticky; top: var(--top-h); z-index: 20;
  display: flex; align-items: center; gap: 8px; overflow-x: auto; scrollbar-width: none;
  margin: -10px -28px 22px; padding: 8px 28px;
  background: var(--paper); border-bottom: 1.5px solid var(--frame);
}
.jump-k { flex: none; font: italic 500 13px var(--serif); color: var(--ink-3); }
.jump-chip {
  flex: none; display: flex; align-items: center; gap: 8px; height: 34px; padding: 0 10px 0 0;
  border: 1.5px solid var(--frame); background: var(--sheet);
  transition: transform 0.08s, box-shadow 0.08s;
}
.jump-chip:hover { box-shadow: 3px 3px 0 var(--shadow-hard); transform: translate(-1px, -1px); }
.jump-num {
  align-self: stretch; display: grid; place-items: center; min-width: 30px;
  background: var(--ink); color: var(--paper); font: italic 900 17px/1 var(--font); font-stretch: 70%;
}
.jump-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font: italic 800 14px/1 var(--font); font-stretch: 75%; text-transform: uppercase; }
.jump-avs { display: flex; }
.jump-avs img, .jump-av-empty { width: 22px; height: 22px; margin-left: -5px; border: 1.5px solid var(--sheet); border-radius: 50%; background: var(--paper-2); object-fit: cover; }
.jump-avs > :first-child { margin-left: 0; }
.jump-chip.is-here { background: var(--ink); color: var(--paper); }
.jump-chip.is-here .jump-num { background: var(--prio); }
.jump-chip.is-here .jump-avs img, .jump-chip.is-here .jump-av-empty { border-color: var(--ink); }
.team-head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding-bottom: 8px; margin-bottom: 14px; border-bottom: 4px solid var(--frame);
}
.team-title { flex: 1 1 380px; display: flex; align-items: baseline; gap: 12px; margin: 0; min-width: 0; }
.team-num, .team-dash, .team-name { font: italic 900 32px/1.05 var(--font); font-stretch: 70%; text-transform: uppercase; letter-spacing: 0; }
.team-num { white-space: nowrap; }
.team-dash { color: var(--ink-3); }
.team-name {
  flex: 1; min-width: 120px; padding: 0 4px; margin: 0; border: 0; background: transparent;
  text-transform: none; border-bottom: 2px solid transparent;
}
.team-name::placeholder { color: var(--ink-3); opacity: 0.7; }
.team-name:hover:not([readonly]) { border-bottom-color: var(--rule-2); }
.team-name:focus { outline: none; border-bottom-color: var(--focus); }
.team-sum { display: flex; gap: 6px; flex-wrap: wrap; }
.sum { padding: 4px 8px; border: 1.5px solid currentColor; font: 700 11px/1 var(--font); font-stretch: 88%; letter-spacing: 0.06em; text-transform: uppercase; }
.sum-ok { color: var(--ok); }
.sum-bad { color: var(--bad); }
.sum-ready { color: var(--ink-2); border-style: dotted; }
.team-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px; }
.card-slot {
  display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 220px;
  border: 2px dashed var(--rule-2); color: var(--ink-3);
  font: italic 800 18px var(--font); font-stretch: 80%; text-transform: uppercase; letter-spacing: 0.03em;
  background: color-mix(in srgb, var(--sheet) 40%, transparent);
}
.card-slot:hover:not(:disabled) { border-color: var(--frame); color: var(--ink); background: var(--sheet); }
.slot-plus { display: grid; place-items: center; width: 40px; height: 40px; border: 2px solid currentColor; }
.add-team {
  display: flex; align-items: center; justify-content: center; gap: 10px; width: 100%; padding: 18px;
  border: 2px dashed var(--rule-2); color: var(--ink-2);
  font: italic 900 20px var(--font); font-stretch: 72%; text-transform: uppercase;
}
.add-team:hover { border-color: var(--frame); color: var(--ink); background: var(--sheet); }

/* ——— Carte personnage ——— */
.card {
  position: relative;
  display: grid; grid-template-columns: minmax(0, 1fr) 106px;
  background: var(--sheet); border: 2px solid var(--frame);
  min-width: 0;
}
.card::after {
  content: ''; position: absolute; top: -2px; right: -2px; width: 10px; height: 10px;
  background: var(--ok); opacity: 0; pointer-events: none;
}
.card.just-saved::after { animation: saved 1.1s ease-out; }
@keyframes saved { 0% { opacity: 1; } 70% { opacity: 1; } 100% { opacity: 0; } }
.card-main { min-width: 0; display: grid; grid-template-rows: auto auto auto; }

.vlabel {
  writing-mode: vertical-rl; transform: rotate(180deg);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--el); color: var(--el-text);
  border-left: 1.5px solid var(--frame);
  font: italic 900 13px/1 var(--font); font-stretch: 78%; letter-spacing: 0.1em; text-transform: uppercase;
  user-select: none;
}

/* PERSO */
.c-head { display: grid; grid-template-columns: 24px 136px minmax(0, 1fr); border-bottom: 2px solid var(--frame); min-height: 158px; }
.c-portrait { position: relative; margin: 0; overflow: hidden; background: var(--el-wash); border-right: 1.5px solid var(--frame); }
/* Le portrait remplit l'en-tête sans en dicter la hauteur. */
.c-portrait img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.c-portrait img.is-card { object-position: 50% 24%; transform: scale(1.7); transform-origin: 50% 24%; }
.c-portrait img.is-avatar { object-fit: contain; padding: 10px; }
.c-portrait-empty { display: grid; place-items: center; height: 100%; color: var(--el-deep); font-size: 54px; }
.stamp {
  position: absolute; left: 50%; bottom: 16px; translate: -50% 0; rotate: -11deg;
  padding: 3px 10px 2px; border: 4px double var(--parfait); color: var(--parfait);
  background: color-mix(in srgb, var(--sheet) 82%, transparent);
  font: italic 900 22px/1 var(--font); font-stretch: 70%; letter-spacing: 0.08em; text-transform: uppercase;
  opacity: 0; scale: 1.6; transition: opacity 0.25s, scale 0.25s cubic-bezier(0.3, 1.6, 0.5, 1);
  pointer-events: none;
}
.card.is-ready .stamp { opacity: 0.94; scale: 1; }

.c-id { display: grid; grid-auto-rows: min-content; align-content: start; min-width: 0; }
.c-band { display: flex; align-items: center; background: var(--el); border-bottom: 1.5px solid var(--frame); min-height: 46px; }
.c-name {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 10px; min-width: 0; padding: 6px 4px;
  font: italic 900 28px/1 var(--font); font-stretch: 68%; letter-spacing: 0.01em; text-transform: uppercase; color: var(--el-text);
}
.c-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.c-name .glyph { width: 20px; height: 20px; color: var(--el-ink); }
:root[data-theme='dark'] .c-name .glyph { color: var(--el-text); }
.c-name:hover span { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 4px; }
.c-menu { color: var(--el-text); margin-right: 4px; }
.c-role {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px; min-height: 26px;
  background: var(--el-wash); border-bottom: 1px solid var(--rule);
  font: italic 500 13px/1.2 var(--serif); color: var(--el-ink); text-align: left;
}
.c-role:hover { background: color-mix(in srgb, var(--el) 35%, var(--el-wash)); }
.c-role .ico { width: 14px; height: 14px; margin-left: auto; }
.c-role-k { font: 800 10px/1 var(--font); font-style: normal; font-stretch: 85%; letter-spacing: 0.1em; text-transform: uppercase; color: var(--ink-3); }
.c-row { display: flex; align-items: stretch; min-height: 31px; border-bottom: 1px solid var(--rule); }
.c-row:last-child { border-bottom: 0; }
.c-k {
  display: flex; align-items: center; justify-content: flex-end; flex: 0 0 104px; padding: 0 10px;
  background: var(--el-wash); border-right: 1px solid var(--rule);
  font: 700 12px/1 var(--font); font-stretch: 88%; letter-spacing: 0.04em; text-transform: uppercase; color: var(--el-ink);
}

/* Cellules (listes et saisies) façon tableur */
.cell-select {
  appearance: none; -webkit-appearance: none;
  width: 100%; min-width: 0; height: 100%; min-height: 26px; padding: 3px 22px 3px 8px;
  border: 0; border-radius: 0; background: transparent;
  background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(-45deg, transparent 50%, currentColor 50%);
  background-size: 4px 4px, 4px 4px; background-position: right 11px center, right 7px center; background-repeat: no-repeat;
  font: 700 12.5px/1.1 var(--font); font-stretch: 90%; text-align: center; text-align-last: center;
  cursor: pointer; text-overflow: ellipsis;
}
.cell-select:focus { outline: none; box-shadow: inset 0 0 0 2px var(--focus); }
.cell-select:disabled { opacity: 1; cursor: default; background-image: none; padding-right: 8px; }
.cell-select option { background: var(--sheet); color: var(--ink); font-weight: 500; }
.cell-input {
  width: 100%; min-width: 0; height: 100%; min-height: 24px; padding: 2px 8px;
  border: 0; border-radius: 0; background: transparent; text-align: center;
  font: 500 13px/1.1 var(--font);
}
.cell-input.num { font-weight: 600; }
.cell-input:focus { outline: none; box-shadow: inset 0 0 0 2px var(--focus); background: var(--sheet); }
.cell-input::placeholder { color: var(--ink-3); opacity: 0.55; font-style: italic; }
.cell-input.is-bad { box-shadow: inset 0 0 0 2px var(--bad); animation: shake 0.3s; }
@keyframes shake { 25% { translate: -3px 0; } 75% { translate: 3px 0; } }
.cell-pick {
  flex: 1; display: flex; align-items: center; gap: 8px; min-width: 0; padding: 3px 10px;
  font: 700 13px/1.15 var(--font); font-stretch: 90%; text-align: left;
}
.cell-pick span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cell-pick:hover:not(:disabled) { background: color-mix(in srgb, var(--el-wash) 70%, transparent); }
.cell-pick:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--focus); }
.cell-pick.is-empty { color: var(--ink-3); font-style: italic; font-weight: 500; }
.pick-img { width: 22px; height: 22px; object-fit: contain; flex: none; }

.c-row .chip-cons { flex: 0 0 82px; margin: 3px 6px 3px auto; min-height: 24px; border: 1.5px solid color-mix(in srgb, var(--ink) 25%, transparent); }
.c-row .chip-refine { flex: 0 0 54px; border-left: 1px solid var(--rule); color: var(--ink-2); }
.c-row .chip-stat { flex: 0 0 84px; margin: 3px 0 3px 6px; min-height: 24px; border: 1.5px solid var(--rule-2); }
.c-row .cell-input.num { flex: 1; font-size: 14px; }
.chip-cons[data-v='0'] { background-color: var(--c0); color: var(--c0-ink); }
.chip-cons[data-v='1'] { background-color: var(--c1); color: var(--c1-ink); }
.chip-cons[data-v='2'] { background-color: var(--c2); color: var(--c2-ink); }
.chip-cons[data-v='3'] { background-color: var(--c3); color: var(--c3-ink); }
.chip-cons[data-v='4'] { background-color: var(--c4); color: var(--c4-ink); }
.chip-cons[data-v='5'] { background-color: var(--c5); color: var(--c5-ink); }
.chip-cons[data-v='6'] { background-color: var(--c6); color: var(--c6-ink); }

/* STATS */
.band {
  display: flex; align-items: center; gap: 10px; min-height: 34px; padding: 0 8px 0 14px;
  background: var(--el); color: var(--el-text);
  border-bottom: 1.5px solid var(--frame);
}
.band-title { flex: 1; text-align: center; font: italic 900 22px/1 var(--font); font-stretch: 70%; letter-spacing: 0.03em; text-transform: uppercase; }
.band-btn {
  display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 8px;
  border: 1.5px solid color-mix(in srgb, var(--el-text) 45%, transparent); border-radius: 2px;
  font: 800 10.5px/1 var(--font); font-stretch: 85%; letter-spacing: 0.08em; text-transform: uppercase; color: var(--el-text);
}
.band-btn:hover { background: color-mix(in srgb, var(--sheet) 45%, transparent); }
.band-btn.is-static { cursor: default; }
.band-btn .ico { width: 14px; height: 14px; }
.with-vlabel { display: grid; grid-template-columns: 24px minmax(0, 1fr); }
.c-stats { border-bottom: 2px solid var(--frame); }

.stats-table, .arte-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
.stats-table th, .stats-table td, .arte-table th, .arte-table td { padding: 0; border: 1px solid var(--rule); height: 26px; }
.stats-table tr > :first-child, .arte-table tr > :first-child { border-left: 0; }
.stats-table tr > :last-child, .arte-table tr > :last-child { border-right: 0; }
.stats-table thead th, .arte-table thead th {
  height: 26px; background: var(--el-wash); color: var(--el-ink);
  font: italic 600 12.5px/1 var(--serif); letter-spacing: 0;
}
.stats-table thead tr > *:first-child, .arte-table thead th { border-top: 0; }
.s-corner { width: 64px; }
.s-gap-h { width: 23%; }
.stats-table thead .s-gap-h { background: var(--ok); color: #fff; font-family: var(--font); font-style: italic; font-weight: 800; font-stretch: 85%; text-transform: none; }
.s-label {
  position: relative; background: var(--sheet);
  font: 800 13px/1 var(--font); font-stretch: 85%; letter-spacing: 0.04em; text-align: center;
}
.row-x { position: absolute; left: 2px; top: 50%; translate: 0 -50%; display: none; width: 16px; height: 16px; color: var(--ink-3); }
.row-x .ico { width: 12px; height: 12px; }
.s-row:hover .row-x { display: grid; place-items: center; }
.s-gap { text-align: center; font: 800 12.5px/1 var(--font); font-stretch: 88%; }
.gap-ok { background: var(--ok); color: #fff; }
.gap-none { background: color-mix(in srgb, var(--ok) 78%, var(--sheet)); color: #fff; }
.gap-missing { color: var(--bad); background: color-mix(in srgb, var(--bad) 7%, var(--sheet)); }
.gap-unknown { color: var(--warn); }
/* « Pas d'objectif » : cellule sombre hachurée, comme les cases noircies de la feuille. */
.s-row.no-target .s-min .cell-input:not(:focus),
.s-row.no-target.no-cur .s-cur .cell-input:not(:focus) {
  background: var(--dark-cell) repeating-linear-gradient(135deg, transparent 0 6px, var(--hatch) 6px 7px);
  color: transparent;
}
.s-row.no-target .s-min .cell-input:not(:focus):hover { color: #cfc6b8; }
.row-add { display: flex; align-items: center; gap: 6px; padding: 5px 10px 5px 34px; background: var(--cell-alt); border-top: 1px solid var(--rule); font: italic 400 12px var(--serif); color: var(--ink-3); }
@media (hover: hover) {
  .row-add { display: none; }
  .card:hover .row-add, .card:focus-within .row-add { display: flex; }
}
.mini { padding: 2px 7px; border: 1px solid var(--rule-2); border-radius: 2px; font: 700 11px var(--font); font-stretch: 88%; color: var(--ink-2); }
.mini:hover { border-color: var(--frame); color: var(--ink); }

/* Set d'artefact */
.band-set { justify-content: space-between; padding-left: 10px; }
.band-set .band-title { flex: 0 0 auto; font-size: 20px; }
.set-chips { flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px; min-width: 0; }
.set-chip {
  display: inline-flex; align-items: center; gap: 7px; min-width: 0; max-width: 100%; height: 26px; padding: 0 12px 0 6px;
  border-radius: 13px; background: var(--el-deep); color: #fff;
  font: 700 12.5px/1 var(--font); font-stretch: 88%;
}
:root[data-theme='dark'] .set-chip { background: color-mix(in srgb, var(--el-deep) 70%, #000); }
.set-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.set-chip.is-empty { background: transparent; border: 1.5px dashed color-mix(in srgb, var(--el-text) 50%, transparent); color: var(--el-text); font-style: italic; padding-left: 12px; }
.set-chip:hover:not(:disabled) { filter: brightness(1.08); }
.set-chip .pick-img { width: 20px; height: 20px; }
.set-plus { font: 900 16px var(--font); }
.band-tools { display: flex; gap: 4px; }

.arte-table thead th { font-family: var(--font); font-style: normal; font-weight: 800; font-stretch: 85%; font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.a-main td { background: var(--sheet); height: 28px; }
.a-fixed { display: block; text-align: center; font: 800 12.5px/1 var(--font); font-stretch: 88%; }
.a-main-sel { font-weight: 800; }
.a-sub td { height: 23px; }
.a-sub.even td { background: var(--cell-alt); }
.a-sub-sel { font-weight: 600; font-size: 12px; min-height: 22px; background-image: none; padding-right: 8px; }
.a-sub-sel:hover:not(:disabled) { background-image: linear-gradient(45deg, transparent 50%, currentColor 50%), linear-gradient(-45deg, transparent 50%, currentColor 50%); padding-right: 22px; }
/* Sous-stat + sa valeur : « TC | 10,5 % », séparés par un filet comme deux cases de tableur. */
.a-sub-cell { display: flex; height: 100%; }
.a-sub-cell .a-sub-sel { flex: 1 1 auto; }
.a-val { flex: 0 0 52%; padding: 2px 3px; border-left: 1px dashed var(--rule); font-size: 12px; font-variant-numeric: tabular-nums; }
.a-val::placeholder { font-size: 11px; }
.a-mainval td { height: 18px; text-align: center; background: var(--sheet); font: 700 10.5px/1 var(--font); font-stretch: 85%; color: var(--el-ink); }
.s-cur { position: relative; }
.s-art {
  position: absolute; left: 5px; top: 50%; translate: 0 -50%; pointer-events: none;
  font: italic 600 10.5px/1 var(--serif); color: var(--el-ink); white-space: nowrap;
}
.s-art:empty { display: none; }
.s-cur .cell-input:focus + .s-art, .s-row.no-target.no-cur .s-art { display: none; }
.a-note td { height: 22px; background: var(--cell-alt); }
.a-note .cell-input { font: italic 400 12px var(--serif); }
.a-status td { height: 26px; }
.chip-status { font: 800 10.5px/1 var(--font); font-stretch: 78%; letter-spacing: 0.03em; text-transform: uppercase; background-image: none; padding: 3px 4px; }
.chip-status:hover:not(:disabled) { filter: brightness(1.06); }
.chip-status[data-v='parfait'] { background-color: var(--parfait); color: #fff; }
.chip-status[data-v='bon'] { background-color: var(--bon); color: var(--bon-ink); }
.chip-status[data-v='changer'] { background-color: var(--changer); color: #fff; }

/* Aptitudes */
.c-talents { display: grid; grid-template-columns: 22px minmax(0, 1fr); border-left: 2px solid var(--frame); }
.vlabel-talents { position: relative; }
.vlabel-btn { display: grid; place-items: center; width: 20px; height: 20px; color: var(--el-text); transform: rotate(90deg); }
.vlabel-btn .ico { width: 14px; height: 14px; }
.t-list { display: grid; grid-auto-rows: 1fr; }
.talent { display: grid; grid-template-rows: auto 1fr auto auto; border-bottom: 1.5px solid var(--frame); min-height: 0; }
.talent:last-child { border-bottom: 0; }
.t-label { padding: 6px 4px 4px; text-align: center; font: 800 10.5px/1 var(--font); font-stretch: 85%; letter-spacing: 0.08em; text-transform: uppercase; color: var(--el-ink); background: var(--el-wash); border-bottom: 1px solid var(--rule); }
.t-icon { display: grid; place-items: center; padding: 8px 0; background: var(--el-deep); min-height: 64px; }
.t-icon img { width: 50px; height: 50px; object-fit: contain; filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.35)); }
.t-icon .glyph { width: 38px; height: 38px; color: #fff; }
.chip-lvl, .chip-prio { min-height: 25px; border-top: 1px solid var(--rule); font-size: 11.5px; padding-left: 4px; padding-right: 16px; background-position: right 8px center, right 4px center; }
.chip-lvl { color: var(--ink-2); }
.chip-lvl[data-v='1'], .chip-lvl[data-v='2'], .chip-lvl[data-v='3'], .chip-lvl[data-v='4'], .chip-lvl[data-v='5'] { color: var(--bad); }
.chip-lvl[data-v='6'], .chip-lvl[data-v='7'], .chip-lvl[data-v='8'] { color: var(--warn); }
.chip-lvl[data-v='9'], .chip-lvl[data-v='10'] { background-color: var(--ok); color: #fff; }
.chip-prio { color: var(--ink-3); font-size: 11px; }
.chip-prio[data-v='prio'] { background-color: var(--prio); color: #fff; }
.chip-prio[data-v='second'] { background-color: var(--second); color: #fff; }
.chip-prio[data-v='option'] { background-color: var(--option); color: #fff; }

.card.is-ro .cell-pick, .card.is-ro .set-chip { cursor: default; }

/* ——— Collection ——— */
.collection { max-width: 1500px; margin: 0 auto; }
.coll-tools { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.coll-search { width: 220px; }
.coll-body { display: grid; gap: 30px; margin-top: 18px; }
.coll-h { display: flex; align-items: center; gap: 10px; margin: 0 0 12px; padding-bottom: 6px; border-bottom: 3px solid var(--el); font: italic 900 24px/1 var(--font); font-stretch: 70%; text-transform: uppercase; color: var(--ink); }
.coll-h .glyph { width: 22px; height: 22px; color: var(--el-deep); }
.coll-count { margin-left: auto; font: 600 13px var(--font); font-style: normal; color: var(--ink-3); }
.coll-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 10px; }
.coll-tile { display: grid; gap: 4px; justify-items: center; padding: 6px 4px 8px; border: 1.5px solid transparent; }
.coll-tile:hover { border-color: var(--frame); background: var(--sheet); }
.coll-av { position: relative; width: 78px; height: 78px; border: 2px solid var(--frame); background: var(--el-wash); }
.coll-tile.r5 .coll-av { background: color-mix(in srgb, var(--gold) 28%, var(--el-wash)); }
.coll-av img { width: 100%; height: 100%; object-fit: cover; }
.coll-tile.is-missing .coll-av { border-color: var(--rule-2); border-style: dashed; }
.coll-tile.is-missing .coll-av img { filter: grayscale(1) contrast(0.8); opacity: 0.55; }
.coll-cons { position: absolute; right: -2px; bottom: -2px; padding: 2px 4px; background: var(--ink); color: var(--paper); font: 800 10.5px/1 var(--font); }
.coll-name { font: 700 12px/1.15 var(--font); font-stretch: 88%; text-align: center; }
.coll-tile.is-missing .coll-name { color: var(--ink-3); font-weight: 500; }
.coll-who { display: flex; gap: 2px; min-height: 16px; }
.who { display: inline-grid; place-items: center; width: 16px; height: 16px; background: var(--who); color: #fff; font: 800 9.5px/1 var(--font); }
.owned { display: grid; justify-items: center; }
.owned .card { width: min(760px, 100%); }

/* ——— Choix d'un perso ——— */
.picker { display: grid; gap: 14px; }
.picker-tools { display: flex; gap: 10px; flex-wrap: wrap; }
.picker-search { flex: 1 1 240px; }
.seg { display: inline-flex; border: 1.5px solid var(--frame); }
.seg-btn { padding: 7px 12px; font: 700 12px/1 var(--font); font-stretch: 88%; letter-spacing: 0.04em; text-transform: uppercase; color: var(--ink-2); }
.seg-btn + .seg-btn { border-left: 1.5px solid var(--frame); }
.seg-btn.is-on { background: var(--ink); color: var(--paper); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 10px; border: 1.5px solid var(--rule-2); font: 700 12px/1 var(--font); font-stretch: 90%; color: var(--ink-2); }
.chip .glyph { width: 14px; height: 14px; color: var(--el-deep); }
.chip:hover { border-color: var(--frame); color: var(--ink); }
.chip.is-on { border-color: var(--frame); background: var(--el, var(--ink)); color: var(--el-text, var(--paper)); }
.chip.is-on:not([data-el]) { background: var(--ink); color: var(--paper); }
.chip.is-on .glyph { color: inherit; }
.picker-suggest-title { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font: italic 500 14px var(--serif); color: var(--ink-2); }
.picker-suggest-row { display: flex; gap: 8px; flex-wrap: wrap; padding: 10px; background: var(--el-wash, var(--cell-alt)); border: 1.5px dashed var(--rule-2); }
.picker-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(88px, 1fr)); gap: 8px; max-height: 50vh; overflow-y: auto; padding: 2px; }
.pick { position: relative; display: grid; justify-items: center; gap: 4px; padding: 6px 4px; border: 1.5px solid transparent; }
.pick:hover:not(:disabled) { border-color: var(--frame); background: var(--sheet); }
.pick-av { width: 64px; height: 64px; border: 2px solid var(--frame); background: var(--el-wash); display: grid; place-items: center; overflow: hidden; }
.pick-av img { width: 100%; height: 100%; object-fit: cover; }
.pick-av .glyph { width: 30px; height: 30px; color: var(--el-deep); }
.pick-name { font: 700 11.5px/1.15 var(--font); font-stretch: 88%; text-align: center; }
.pick-owned { position: absolute; top: 4px; right: 8px; padding: 2px 4px; background: var(--ink); color: var(--paper); font: 800 10px/1 var(--font); }
.pick:not(.is-owned) .pick-av { border-style: dashed; border-color: var(--rule-2); }
.pick.is-taken { opacity: 0.35; }
.picker-none { grid-column: 1 / -1; font: italic 400 14px var(--serif); color: var(--ink-3); }

/* ——— Panneau Gazette ——— */
.drawer {
  position: fixed; inset: 0 0 0 auto; margin: 0; padding: 0;
  width: min(600px, 100vw); height: 100%; max-width: none; max-height: none; overflow-y: auto;
  background: var(--paper); color: var(--ink); border: 0; border-left: 2px solid var(--frame);
  translate: 100% 0; transition: translate 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
}
/* « none » et pas « 0 0 » : un translate actif décalerait les menus ouverts dans le panneau. */
.drawer.is-open { translate: none; }
.drawer::backdrop { background: var(--scrim); opacity: 0; transition: opacity 0.2s; }
.drawer.is-open::backdrop { opacity: 1; }
.drawer-close { position: absolute; top: 12px; right: 12px; background: var(--paper); }
.drawer-body { display: grid; gap: 20px; padding: 18px 26px 32px; min-height: 100%; }
.gz-mast { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 46px 6px 0; border-top: 4px double var(--frame); border-bottom: 1px solid var(--frame); }
.gz-mast-l { font: 700 13px/1 var(--serif); letter-spacing: 0.22em; text-transform: uppercase; font-variant: small-caps; }
.gz-mast-r { font: italic 400 12.5px var(--serif); color: var(--ink-2); }
.gz-head { display: flex; gap: 16px; align-items: center; }
.gz-av { width: 76px; height: 76px; border: 2px solid var(--frame); background: var(--el-wash); object-fit: cover; }
.gz-name { display: flex; align-items: center; gap: 10px; margin: 0; font: italic 650 40px/1 var(--serif); letter-spacing: -0.02em; }
.gz-glyph { width: 28px; height: 28px; color: var(--el-deep); }
.gz-meta { margin: 6px 0 0; font: 600 12px/1.4 var(--font); letter-spacing: 0.03em; color: var(--ink-2); }
.gz-tabs { display: flex; flex-wrap: wrap; gap: 0; border-bottom: 2px solid var(--frame); }
.gz-tab { padding: 8px 14px; margin-bottom: -2px; border: 2px solid transparent; font: italic 800 15px/1 var(--font); font-stretch: 78%; text-transform: uppercase; color: var(--ink-3); }
.gz-tab:hover { color: var(--ink); }
.gz-tab.is-on { border-color: var(--frame); border-bottom-color: var(--paper); background: var(--paper); color: var(--ink); }
.gz-build { display: grid; gap: 16px; }
.gz-role { margin: 0; font: italic 900 20px/1 var(--font); font-stretch: 75%; text-transform: uppercase; color: var(--el-ink); }
.gz-info { position: relative; border: 2px solid var(--frame); background: var(--sheet); }
.gz-info img { width: 100%; height: auto; }
.gz-info-hint { position: absolute; right: 8px; bottom: 8px; display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; background: var(--ink); color: var(--paper); font: 700 11px var(--font); letter-spacing: 0.05em; text-transform: uppercase; opacity: 0; transition: opacity 0.15s; }
.gz-info:hover .gz-info-hint, .gz-info:focus-visible .gz-info-hint { opacity: 1; }
.gz-info-hint .ico { width: 14px; height: 14px; }
.gz-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.gz-h { margin: 0 0 8px; padding-bottom: 4px; border-bottom: 1.5px solid var(--frame); font: 800 12px/1 var(--font); font-stretch: 85%; letter-spacing: 0.1em; text-transform: uppercase; }
.gz-h-big { font: italic 900 22px/1 var(--font); font-stretch: 72%; letter-spacing: 0.02em; border-bottom-width: 3px; }
.rank { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.rank-item { display: grid; grid-template-columns: 22px 1fr; gap: 8px; align-items: start; }
.rank-n { display: grid; place-items: center; width: 22px; height: 22px; background: var(--ink); color: var(--paper); font: 800 11px var(--font); }
.rank-item:first-child .rank-n { background: var(--gold); color: #fff; }
.rank-alts { display: grid; gap: 4px; }
.rank-alt { display: flex; align-items: center; gap: 8px; font: 600 13px/1.2 var(--font); }
.rank-img { width: 26px; height: 26px; object-fit: contain; flex: none; }
.rank-sub { display: block; font-weight: 500; font-size: 11px; color: var(--ink-3); }
.rank-text { font: italic 400 13px var(--serif); color: var(--ink-2); }
.gz-syns { display: grid; gap: 18px; }
.gz-syn { display: grid; gap: 10px; }
.gz-syn-img { border: 1.5px solid var(--frame); }
.gz-syn-img img { width: 100%; height: auto; }
.syn-teams { display: grid; gap: 8px; }
.syn-team { display: flex; align-items: center; gap: 10px; padding: 6px 8px; background: var(--sheet); border: 1.5px solid var(--rule-2); }
.syn-team .btn { margin-left: auto; }
.syn-avs { display: flex; flex-wrap: wrap; gap: 4px; }
.av { display: block; width: 40px; height: 40px; border: 1.5px solid var(--frame); background: var(--el-wash); }
.av img { width: 100%; height: 100%; object-fit: cover; }
.tier { display: inline-grid; place-items: center; min-width: 40px; padding: 3px 5px; font: 800 10px/1 var(--font); letter-spacing: 0.08em; border: 1.5px solid currentColor; }
.tier-top { color: var(--gold); }
.tier-good { color: var(--ok); }
.tier-ok { color: var(--ink-3); }
.tier-alt { color: var(--ink-3); border-style: dotted; }
.syn-slots { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.syn-slot { display: grid; gap: 6px; align-content: start; padding: 8px; background: var(--sheet); border: 1.5px solid var(--rule-2); }
.syn-slot-title { font: italic 800 14px/1 var(--font); font-stretch: 78%; text-transform: uppercase; }
.syn-tier { display: grid; grid-template-columns: auto 1fr; gap: 6px; align-items: start; }
.syn-tier .av { width: 32px; height: 32px; }
.gz-foot { display: flex; flex-wrap: wrap; gap: 8px; padding-top: 14px; border-top: 1.5px solid var(--frame); }

/* Loupe sur l'infographie */
.pop-loupe { padding: 10px; }
.loupe { display: grid; gap: 8px; }
.loupe-head { display: grid; gap: 2px; }
.loupe-head strong { font: italic 900 16px/1 var(--font); font-stretch: 75%; text-transform: uppercase; }
.loupe-kicker { font: italic 400 12px var(--serif); color: var(--ink-3); }
.crop { background-repeat: no-repeat; border: 1.5px solid var(--frame); background-color: #f3ecdf; }
.viewer { max-height: 78vh; overflow: auto; cursor: zoom-in; }
.viewer-img { width: 100%; height: auto; }
.viewer.is-zoomed { cursor: zoom-out; }
.viewer.is-zoomed .viewer-img { width: auto; max-width: none; }

/* ——— Fenêtres, panneaux, menus ——— */
.dlg {
  width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 40px); padding: 0;
  border: 2px solid var(--frame); border-radius: 2px; background: var(--paper); color: var(--ink);
  box-shadow: 8px 8px 0 var(--shadow-hard);
}
.dlg-wide { width: min(980px, calc(100vw - 24px)); }
.dlg::backdrop { background: var(--scrim); }
.dlg[open] { display: flex; flex-direction: column; animation: dlg-in 0.16s ease-out; }
@keyframes dlg-in { from { translate: 0 8px; opacity: 0; } }
.dlg-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding: 16px 18px 12px 22px; border-bottom: 1.5px solid var(--frame); }
.dlg-kicker { font: italic 400 13px var(--serif); color: var(--ink-3); }
.dlg-title { margin: 2px 0 0; font: 650 24px/1.1 var(--serif); letter-spacing: -0.01em; }
.dlg-body { padding: 18px 22px; overflow-y: auto; }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; padding: 12px 18px; border-top: 1.5px solid var(--frame); background: var(--paper-2); }
.dlg-text { margin: 0; color: var(--ink-2); }

.pop {
  position: fixed; z-index: 80; min-width: 200px; max-width: calc(100vw - 16px);
  background: var(--paper); border: 1.5px solid var(--frame); box-shadow: 5px 5px 0 var(--shadow-hard);
}
.cb { width: 340px; display: grid; }
.cb-search { width: 100%; padding: 10px 12px; border: 0; border-bottom: 1.5px solid var(--frame); background: var(--sheet); }
.cb-search:focus { outline: none; box-shadow: inset 0 -2px 0 var(--focus); }
.cb-list { max-height: min(52vh, 420px); overflow-y: auto; padding: 4px 0; }
.cb-sec { padding: 10px 12px 4px; font: italic 500 12.5px var(--serif); color: var(--ink-3); border-top: 1px solid var(--rule); }
.cb-sec:first-child { border-top: 0; }
.cb-opt { display: flex; align-items: center; gap: 10px; width: 100%; padding: 5px 12px; text-align: left; }
.cb-opt.is-active { background: var(--paper-2); }
.cb-opt.is-current .cb-label { text-decoration: underline; text-decoration-thickness: 2px; }
.cb-img { width: 30px; height: 30px; object-fit: contain; flex: none; }
.cb-img-empty { display: block; }
.cb-text { display: grid; min-width: 0; flex: 1; }
.cb-label { font: 700 13px/1.2 var(--font); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cb-sub { font: 500 11px/1.2 var(--font); color: var(--ink-3); }
.cb-badge { padding: 2px 6px; border: 1.5px solid var(--ink-2); font: 800 10.5px/1 var(--font); color: var(--ink-2); }
.cb-badge.is-gold { border-color: var(--gold); background: var(--gold); color: #fff; }
.cb-empty { padding: 14px 12px; font: italic 400 13px var(--serif); color: var(--ink-3); }
.cb-clear { width: 100%; padding: 8px 12px; border-top: 1.5px solid var(--frame); text-align: left; font: 700 12px var(--font); color: var(--bad); }
.menu { display: grid; padding: 4px 0; min-width: 220px; }
.menu-item { display: flex; align-items: center; gap: 10px; padding: 8px 14px; text-align: left; font: 600 13px var(--font); }
.menu-item:hover { background: var(--paper-2); }
.menu-item.is-danger { color: var(--bad); }
.menu-item .ico { width: 16px; height: 16px; color: var(--ink-3); }
.menu-item.is-danger .ico { color: var(--bad); }

.toasts { position: fixed; right: 18px; bottom: calc(var(--tabs-h) + 16px); z-index: 90; display: grid; gap: 8px; justify-items: end; }
.toast { max-width: 380px; padding: 10px 14px; background: var(--ink); color: var(--paper); border-left: 6px solid var(--ink-3); box-shadow: 4px 4px 0 var(--shadow-hard); font: 600 13px/1.35 var(--font); animation: toast-in 0.18s ease-out; }
.toast-ok { border-left-color: var(--ok); }
.toast-error { border-left-color: var(--changer); }
.toast.out { opacity: 0; translate: 10px 0; transition: opacity 0.25s, translate 0.25s; }
@keyframes toast-in { from { opacity: 0; translate: 0 8px; } }

/* ——— Couverture (connexion) ——— */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(340px, 460px); }
.is-desktop .auth { -webkit-app-region: drag; }
.is-desktop .auth input, .is-desktop .auth button, .is-desktop .auth label { -webkit-app-region: no-drag; }
.auth-cover {
  display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 60px clamp(28px, 7vw, 110px);
  background-color: #1f1a15; color: #f3ecdf;
  background-image: radial-gradient(rgba(243, 236, 223, 0.08) 1px, transparent 1.2px); background-size: 22px 22px;
}
:root[data-theme='dark'] .auth-cover { background-color: #0d0c0f; }
.auth-seal { width: 62px; height: 62px; color: #f3ecdf; }
.auth-seal path:last-child { fill: var(--changer); }
.auth-title { display: grid; margin: 0; font: italic 650 clamp(54px, 8vw, 104px)/0.88 var(--serif); letter-spacing: -0.035em; }
.auth-title small { font: italic 400 0.36em/1.2 var(--serif); letter-spacing: 0; padding-left: 0.2em; color: rgba(243, 236, 223, 0.65); }
.auth-sub { max-width: 440px; margin: 0; font: 400 17px/1.5 var(--serif); color: rgba(243, 236, 223, 0.82); }
.auth-points { list-style: none; padding: 0; margin: 10px 0 0; display: grid; gap: 10px; }
.auth-points li { display: flex; align-items: center; gap: 12px; font: 600 13px var(--font); letter-spacing: 0.04em; text-transform: uppercase; color: rgba(243, 236, 223, 0.85); }
.auth-points .ico { color: #f0a090; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; gap: 22px; padding: 48px 40px; background: var(--paper); border-left: 2px solid var(--frame); }
.auth-tabs { display: flex; border-bottom: 2px solid var(--frame); }
.auth-tab { flex: 1; padding: 10px 6px; margin-bottom: -2px; font: italic 900 17px/1 var(--font); font-stretch: 75%; text-transform: uppercase; color: var(--ink-3); border-bottom: 4px solid transparent; }
.auth-tab.is-on { color: var(--ink); border-bottom-color: var(--changer); }
.auth-error { min-height: 1.4em; margin: 0; color: var(--bad); font: 600 13px var(--font); }
.code-input { font: 700 16px/1 var(--font); letter-spacing: 0.12em; text-transform: uppercase; }
.code-input[readonly] { background: var(--paper-2); }
.who-pick { display: grid; gap: 6px; margin: 0; padding: 0; border: 0; }
.radio { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1.5px solid var(--rule-2); font: 600 13.5px var(--font); cursor: pointer; }
.radio:has(input:checked) { border-color: var(--frame); background: var(--sheet); }
.radio input { accent-color: var(--ink); }
.radio-dot { width: 12px; height: 12px; background: var(--who); }

.fatal { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 14px; padding: 30px; text-align: center; }
.fatal-seal { width: 56px; height: 56px; }
.fatal h1 { margin: 0; font: 650 32px var(--serif); }
.fatal p { margin: 0; color: var(--ink-2); }

/* ——— Paramètres ——— */
.settings { display: grid; gap: 26px; }
.set-sec { display: grid; gap: 12px; }
.set-h { margin: 0; padding-bottom: 6px; border-bottom: 2px solid var(--frame); font: italic 900 20px/1 var(--font); font-stretch: 74%; text-transform: uppercase; }
.set-sub { margin: 0; font: 800 12px/1 var(--font); letter-spacing: 0.09em; text-transform: uppercase; color: var(--ink-2); }
.set-block { display: grid; gap: 8px; padding: 14px; background: var(--sheet); border: 1.5px solid var(--rule-2); }
.set-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.set-k { min-width: 110px; font: 700 12px var(--font); letter-spacing: 0.05em; text-transform: uppercase; color: var(--ink-3); }
.set-help { margin: 0; font: italic 400 13px/1.45 var(--serif); color: var(--ink-3); }
.set-err { color: var(--bad); }
.set-form { display: grid; grid-template-columns: 1fr 1fr auto; gap: 10px; align-items: end; }
.set-actions { padding-top: 4px; }
.swatches { display: flex; gap: 6px; }
.swatch { width: 26px; height: 26px; background: var(--sw); border: 2px solid transparent; outline: 1.5px solid var(--rule-2); }
.swatch.is-on { border-color: var(--paper); outline: 2px solid var(--frame); }
.invite { padding: 6px 12px; background: var(--paper); border: 1.5px dashed var(--frame); font: 800 16px/1 var(--font); letter-spacing: 0.12em; }
.set-table { width: 100%; border-collapse: collapse; }
.set-table th { text-align: left; font: 800 11px var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: var(--ink-3); padding: 6px 8px; border-bottom: 1.5px solid var(--frame); }
.set-table td { padding: 7px 8px; border-bottom: 1px solid var(--rule); vertical-align: middle; }
.set-cell-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.tag { margin-left: 6px; padding: 1px 5px; border: 1.5px solid var(--gold); color: var(--gold); font: 800 10px var(--font); text-transform: uppercase; letter-spacing: 0.06em; }
.set-free { display: grid; gap: 8px; margin-top: 10px; }
.set-about p { margin: 0; color: var(--ink-2); }

/* ——— Écrans plus étroits ——— */
@media (max-width: 1279px) {
  .team-grid { grid-template-columns: minmax(0, 760px); justify-content: center; }
}
@media (min-width: 2400px) {
  .teams { max-width: none; }
  .team-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 860px) {
  .topbar { gap: 12px; padding-left: 12px; }
  .brand-name { display: none; }
  .sync, .live { display: none; }
  .main { padding: 18px 12px 40px; }
  .jump { margin: -8px -12px 18px; padding: 8px 12px; }
  .jump-k { display: none; }
  .auth { grid-template-columns: 1fr; }
  .auth-cover { padding: 40px 28px; }
  .gz-cols { grid-template-columns: 1fr; }
  .set-form { grid-template-columns: 1fr; }
  .tab-credit { display: none; }
}
@media (max-width: 640px) {
  .card { grid-template-columns: minmax(0, 1fr); }
  .c-head { grid-template-columns: 22px 96px minmax(0, 1fr); }
  .c-k { flex-basis: 84px; padding: 0 6px; font-size: 11px; }
  .c-name { font-size: 22px; }
  .c-talents { grid-template-columns: 22px minmax(0, 1fr); border-left: 0; border-top: 2px solid var(--frame); }
  .t-list { grid-template-columns: repeat(3, minmax(0, 1fr)); grid-auto-rows: auto; }
  .talent { border-bottom: 0; border-right: 1.5px solid var(--frame); }
  .talent:last-child { border-right: 0; }
  .vlabel-talents { writing-mode: vertical-rl; }
  .team-num, .team-dash, .team-name { font-size: 24px; }
  .sheet-name { font-size: 34px; }
  .s-corner { width: 44px; }
  .stats-table thead th { font-size: 11px; }
  .arte-table .cell-select { font-size: 11px; padding-left: 2px; padding-right: 2px; }
  .nav-btn { padding: 0 8px; font-size: 12px; }
  .user-btn span { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ——— Ajout groupé ——— */
.many-count { align-self: center; font: italic 500 14px var(--serif); color: var(--ink-2); }
.pick-tick {
  position: absolute; top: 2px; right: 6px; display: none; place-items: center; width: 20px; height: 20px;
  background: var(--ink); color: var(--paper); border: 2px solid var(--paper);
}
.pick-tick .ico { width: 13px; height: 13px; }
.pick-many.is-chosen { border-color: var(--frame); background: var(--sheet); box-shadow: 3px 3px 0 var(--shadow-hard); }
.pick-many.is-chosen .pick-av { border-style: solid; border-color: var(--el-deep, var(--frame)); }
.pick-many.is-chosen .pick-tick { display: grid; }
.pick-many.is-taken .pick-name::after { content: ' ✓'; }
