/* ============================================================================
   LoreForge — Design System unique
   Toutes les pages partagent ce fichier. Aucune couleur en dur hors variables.
   Sommaire :
     1. Variables (:root)
     2. Reset & base
     3. Typographie
     4. Utilitaires de mise en page
     5. Composants : boutons, badges, cards, barres (hp/xp), dés, formulaires,
        tables, modales, flash, tabs, sidebar, drawer, pagination, lang-switcher
     6. Header applicatif
     7. Placeholders d'images
     8. Layout : Public
     9. Layout : Hub / Jeu
    10. Layout : Studio (barre d'onglets)
    11. Layout : Admin (sidebar rouge)
    12. Écrans spécifiques (scénario, bestiaire, scène, combat, wizard, auth)
    13. Responsive
============================================================================ */

/* ============================ 1. VARIABLES ============================ */
:root {
  /* Palette de base */
  --bg: #1c1b22;              /* fond anthracite */
  --bg-deep: #161520;         /* fond plus profond (canvas, header sombre) */
  --surface: #26242e;         /* surfaces / cards */
  --surface-2: #2f2d38;       /* surface surélevée (inputs, hover de card) */
  --surface-3: #37343f;       /* surface encore plus haute */
  --line: #3a3743;            /* bordures subtiles */
  --line-strong: #4a4653;     /* bordures marquées */

  /* Texte */
  --text: #e8e4dc;            /* texte principal, crème */
  --text-soft: #b9b3aa;       /* texte secondaire */
  --text-muted: #7d7871;      /* texte tertiaire / méta */
  --text-faint: #565159;      /* désactivé */

  /* Accent ambre */
  --accent: #d9a441;
  --accent-hover: #e6b558;
  --accent-press: #c48f2e;
  --accent-soft: rgba(217, 164, 65, 0.14);
  --accent-line: rgba(217, 164, 65, 0.45);
  --on-accent: #211d14;       /* texte sur fond ambre */

  /* Accent admin rouge */
  --admin: #a33c3c;
  --admin-hover: #b64a4a;
  --admin-deep: #3a1e22;      /* fond sidebar admin */
  --admin-deep-2: #2c1a1e;
  --admin-soft: rgba(163, 60, 60, 0.16);

  /* États sémantiques */
  --danger: #c25353;
  --danger-hover: #d06767;
  --danger-soft: rgba(194, 83, 83, 0.15);
  --success: #5c9a63;
  --success-soft: rgba(92, 154, 99, 0.16);
  --warning: #d9a441;
  --info: #6f8fb0;

  /* Barres de jauge */
  --hp: #b23f3f;              /* points de vie */
  --hp-track: #3a2626;
  --xp: #4d7ea8;             /* expérience */
  --xp-track: #26303a;

  /* Badges de langue */
  --lang-fr: #7a91b8;
  --lang-en: #9a8bb5;

  /* Typographie */
  --font-title: "Cinzel", "Trajan Pro", "Cormorant Garamond", "Times New Roman", Georgia, serif;
  --font-body: "Inter", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "SFMono-Regular", "JetBrains Mono", "Consolas", ui-monospace, monospace;

  /* Rayons & ombres */
  --r-sm: 4px;
  --r-md: 7px;
  --r-lg: 12px;
  --r-pill: 999px;
  --shadow-1: 0 1px 2px rgba(0,0,0,0.4);
  --shadow-2: 0 6px 20px rgba(0,0,0,0.45);
  --shadow-3: 0 16px 48px rgba(0,0,0,0.55);

  /* Espacements */
  --sp-1: 4px;
  --sp-2: 8px;
  --sp-3: 12px;
  --sp-4: 16px;
  --sp-5: 24px;
  --sp-6: 32px;
  --sp-7: 48px;

  --header-h: 60px;
  --maxw: 1240px;
}

/* ============================ 2. RESET & BASE ============================ */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

img { display: block; max-width: 100%; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

button { font-family: inherit; cursor: pointer; }

ul, ol { margin: 0; padding: 0; list-style: none; }

hr { border: none; border-top: 1px solid var(--line); margin: var(--sp-4) 0; }

::selection { background: var(--accent-soft); color: var(--text); }

/* Barre de défilement discrète */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: var(--r-pill); border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-faint); }

/* Focus visible pour l'accessibilité */
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.visually-hidden {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); white-space: nowrap; border: 0;
}

/* ============================ 3. TYPOGRAPHIE ============================ */
h1, h2, h3, h4, h5, .title {
  font-family: var(--font-title);
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  letter-spacing: 0.01em;
}

.title-hero {
  font-family: var(--font-title);
  font-size: clamp(38px, 5vw, 60px);
  font-weight: 700;
  line-height: 1.05;
  letter-spacing: 0.015em;
}

.eyebrow {
  font-family: var(--font-title);
  font-size: 12px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--accent);
}

.section-title {
  font-family: var(--font-title);
  font-size: 20px;
  font-weight: 600;
}

.muted { color: var(--text-muted); }
.soft  { color: var(--text-soft); }
.mono  { font-family: var(--font-mono); font-size: 12px; }

.text-danger  { color: var(--danger); }
.text-success { color: var(--success); }
.text-accent  { color: var(--accent); }

/* ============================ 4. UTILITAIRES ============================ */
.container { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--sp-5); }
.stack   { display: flex; flex-direction: column; }
.row     { display: flex; align-items: center; }
.between { display: flex; align-items: center; justify-content: space-between; }
.wrap    { flex-wrap: wrap; }
.grow    { flex: 1 1 auto; }
.gap-1 { gap: var(--sp-1); } .gap-2 { gap: var(--sp-2); }
.gap-3 { gap: var(--sp-3); } .gap-4 { gap: var(--sp-4); }
.gap-5 { gap: var(--sp-5); } .gap-6 { gap: var(--sp-6); }
.mt-2 { margin-top: var(--sp-2); } .mt-3 { margin-top: var(--sp-3); }
.mt-4 { margin-top: var(--sp-4); } .mt-5 { margin-top: var(--sp-5); }
.mb-4 { margin-bottom: var(--sp-4); }
.mt-6 { margin-top: var(--sp-6); } .mt-7 { margin-top: var(--sp-7); }
.pb-6 { padding-bottom: var(--sp-6); } .pb-7 { padding-bottom: var(--sp-7); }
.spacer-lg { height: var(--sp-7); }
.center { align-items: center; }
.link-more {
  font-size: 13px; color: var(--text-soft);
  display: inline-flex; align-items: center; gap: 4px;
}
.link-more:hover { color: var(--accent); }

.divider { height: 1px; background: var(--line); border: 0; }

/* Icône SVG générique */
.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.7; }
.icon-sm { width: 15px; height: 15px; }
.icon-lg { width: 22px; height: 22px; }

/* ============================ 5. COMPOSANTS ============================ */

/* --- Boutons --- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--sp-2);
  font-family: var(--font-body);
  font-size: 14px; font-weight: 600;
  line-height: 1;
  padding: 10px 18px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text);
  transition: background .15s, border-color .15s, color .15s, transform .05s;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px); }
.btn .icon { width: 16px; height: 16px; }

.btn--primary {
  background: var(--accent); color: var(--on-accent);
  border-color: var(--accent);
  font-family: var(--font-title); letter-spacing: 0.04em;
  text-transform: uppercase; font-size: 13px;
}
.btn--primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn--primary:active { background: var(--accent-press); }

.btn--secondary {
  background: transparent; color: var(--text);
  border-color: var(--line-strong);
  font-family: var(--font-title); letter-spacing: 0.04em;
  text-transform: uppercase; font-size: 13px;
}
.btn--secondary:hover { border-color: var(--accent-line); color: var(--accent); }

.btn--ghost { background: transparent; border-color: transparent; color: var(--text-soft); }
.btn--ghost:hover { background: var(--surface-2); color: var(--text); }

.btn--danger {
  background: var(--danger); color: #fff; border-color: var(--danger);
}
.btn--danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }

.btn--admin { background: var(--admin); color: #fff; border-color: var(--admin); }
.btn--admin:hover { background: var(--admin-hover); border-color: var(--admin-hover); }

.btn[disabled], .btn--disabled {
  background: var(--surface); color: var(--text-faint);
  border-color: var(--line); cursor: not-allowed; opacity: .8;
}
.btn[disabled]:active, .btn--disabled:active { transform: none; }

.btn--sm { padding: 6px 12px; font-size: 12px; }
.btn--lg { padding: 13px 26px; font-size: 15px; }
.btn--block { display: flex; width: 100%; }

/* Bouton icône carré */
.btn-icon {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; padding: 0;
  border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--line);
  color: var(--text-soft); transition: background .15s, color .15s, border-color .15s;
}
.btn-icon:hover { background: var(--surface-3); color: var(--text); border-color: var(--line-strong); }
.btn-icon--active { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.btn-icon--danger:hover { color: var(--danger); border-color: var(--danger); }

/* --- Badges --- */
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 600;
  padding: 3px 8px; border-radius: var(--r-sm);
  background: var(--surface-3); color: var(--text-soft);
  letter-spacing: 0.02em;
}
.badge--lang { padding: 2px 6px; font-size: 10.5px; font-weight: 700; }
.badge--fr { color: var(--lang-fr); background: rgba(122,145,184,0.14); }
.badge--en { color: var(--lang-en); background: rgba(154,139,181,0.14); }
.badge--solo { color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); }
.badge--players { background: transparent; color: var(--text-soft); padding-left: 0; }
.badge--draft { color: var(--text-muted); background: var(--surface-3); }
.badge--published { color: var(--success); background: var(--success-soft); }
.badge--new { color: var(--info); background: rgba(111,143,176,0.16); }
.badge--progress { color: var(--warning); background: var(--accent-soft); }
.badge--resolved { color: var(--success); background: var(--success-soft); }
.badge--cr { color: var(--accent); font-family: var(--font-mono); background: transparent; font-size: 13px; }

/* --- Cards --- */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.card--pad { padding: var(--sp-4); }

/* Carte de monde (catalogue / accueil) */
.world-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
  transition: border-color .15s, transform .15s, box-shadow .15s;
  cursor: pointer;
  display: flex; flex-direction: column;
}
.world-card:hover {
  border-color: var(--accent-line);
  transform: translateY(-3px);
  box-shadow: var(--shadow-2);
}
.world-card__cover {
  position: relative;
  aspect-ratio: 4 / 3;
}
.world-card__cover .badge--solo {
  position: absolute; top: 8px; right: 8px;
}
.world-card__body { padding: 10px 12px 12px; }
.world-card__title {
  font-family: var(--font-title); font-size: 15px; font-weight: 600;
  margin-bottom: 2px;
}
.world-card__tagline { font-size: 12.5px; color: var(--text-muted); font-style: italic; }
.world-card__meta { display: flex; align-items: center; gap: 8px; margin-top: 8px; }

/* Featured (accueil) — plus compacte */
.feature-card .world-card__cover { aspect-ratio: 16 / 9; }

/* --- Barres HP / XP --- */
.hp-bar, .xp-bar {
  position: relative;
  height: 7px;
  border-radius: var(--r-pill);
  overflow: hidden;
}
.hp-bar { background: var(--hp-track); }
.xp-bar { background: var(--xp-track); }
.hp-bar__fill { height: 100%; background: var(--hp); border-radius: inherit; transition: width .3s; }
.xp-bar__fill { height: 100%; background: var(--xp); border-radius: inherit; transition: width .3s; }
.gauge-label {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text-muted); margin-bottom: 3px;
}

/* --- Résultat de dé --- */
.dice-result {
  display: inline-flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center;
}
.dice-result__die {
  position: relative;
  width: 132px; height: 132px;
  display: grid; place-items: center;
  background-image: url("../img/d20_black.webp");
  background-size: contain; background-position: center; background-repeat: no-repeat;
}
/* Jet raté : dé rouge (aligné avec l'accent danger). */
.dice-result__die--fail { background-image: url("../img/d20_red.webp"); }
/* Le dé illustré EST un D20 : le libellé texte devient superflu. */
.dice-result__d20 { display: none; }
.dice-result__value {
  font-family: var(--font-title); font-size: 34px; font-weight: 700; color: var(--text);
  text-shadow: 0 2px 6px rgba(0, 0, 0, 0.75);
}
.dice-result__label { font-family: var(--font-title); font-size: 13px; margin-top: 8px; }
.dice-result__label--success { color: var(--success); }
.dice-result__label--fail { color: var(--danger); }
.dice-result__caption { font-size: 12px; color: var(--text-muted); margin-top: 2px; }

/* --- Formulaires --- */
.form-group { margin-bottom: var(--sp-4); }
.form-label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-soft); margin-bottom: 6px; letter-spacing: 0.01em;
}
.form-input, .form-select, .form-textarea {
  width: 100%;
  font-family: var(--font-body); font-size: 14px;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-md);
  padding: 9px 12px;
  transition: border-color .15s, background .15s;
}
.form-input::placeholder, .form-textarea::placeholder { color: var(--text-muted); }
.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--accent-line); background: var(--surface-3); outline: none;
}
.form-textarea { resize: vertical; min-height: 78px; line-height: 1.5; }
.form-select {
  appearance: none; padding-right: 34px; cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237d7871' stroke-width='2'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 12px center;
}
.form-hint { font-size: 11.5px; color: var(--text-muted); margin-top: 5px; }
.form-label--flush { margin: 0; }
.form-error { color: var(--danger); }

/* Champ avec icône (recherche) */
.form-search { position: relative; }
.form-search .icon {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--text-muted); pointer-events: none;
}
.form-search .form-input { padding-left: 38px; }

/* Upload avec aperçu */
.form-upload {
  display: flex; align-items: center; gap: var(--sp-3);
}
.form-upload__preview {
  width: 72px; height: 54px; flex: none;
  border-radius: var(--r-md); overflow: hidden;
  border: 1px solid var(--line-strong);
}
.form-upload__preview--wide { width: 128px; height: 72px; }
.form-upload__preview img { width: 100%; height: 100%; object-fit: cover; }
.form-upload__side { display: flex; flex-direction: column; gap: 4px; }

/* Segments / choix multiples */
.stat-stepper { display: flex; align-items: center; gap: 10px; }
.stat-stepper__btn {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line-strong);
  color: var(--text); font-size: 18px; line-height: 1;
  display: grid; place-items: center;
}
.stat-stepper__btn:hover { border-color: var(--accent-line); color: var(--accent); }
.stat-stepper__val { font-family: var(--font-mono); font-size: 18px; min-width: 28px; text-align: center; }

/* --- Table (admin) --- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.table thead th {
  text-align: left; font-weight: 600; font-size: 11.5px;
  letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-muted); padding: 10px 14px;
  border-bottom: 1px solid var(--line);
}
.table tbody td { padding: 12px 14px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table tbody tr:hover { background: var(--surface-2); }
.table tbody tr:last-child td { border-bottom: none; }
.table__id { font-family: var(--font-mono); color: var(--text-muted); }
.table__actions { display: flex; gap: 6px; }

/* --- Modale --- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(10,9,14,0.68);
  display: none; align-items: center; justify-content: center;
  padding: var(--sp-5);
}
.modal-overlay.is-open { display: flex; }
.modal {
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-lg); box-shadow: var(--shadow-3);
  width: 100%; max-width: 460px; max-height: 88vh; overflow: auto;
}
.modal__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-5);
  border-bottom: 1px solid var(--line);
}
.modal__title { font-family: var(--font-title); font-size: 17px; display: flex; align-items: center; gap: 8px; }
.modal__body { padding: var(--sp-5); }
.modal__footer { padding: var(--sp-4) var(--sp-5); border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: var(--sp-3); }
.modal__close { background: none; border: none; color: var(--text-muted); padding: 4px; border-radius: var(--r-sm); }
.modal__close:hover { color: var(--text); background: var(--surface-2); }

/* --- Flash / alertes --- */
.flash {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: 11px var(--sp-4);
  border-radius: var(--r-md);
  border: 1px solid var(--line-strong);
  background: var(--surface-2);
  font-size: 13.5px;
  border-left-width: 3px;
}
.flash .icon { margin-top: 1px; }
.flash--success { border-left-color: var(--success); }
.flash--success .icon { color: var(--success); }
.flash--danger { border-left-color: var(--danger); }
.flash--danger .icon { color: var(--danger); }
.flash--warning { border-left-color: var(--warning); }
.flash--warning .icon { color: var(--warning); }
.flash--info { border-left-color: var(--info); }
.flash--info .icon { color: var(--info); }
.flash__close { margin-left: auto; background: none; border: none; color: var(--text-muted); padding: 2px; }

/* --- Tabs --- */
.tabs {
  display: flex; gap: 2px;
  border-bottom: 1px solid var(--line);
}
.tabs__tab {
  background: none; border: none;
  padding: 11px 16px;
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  color: var(--text-muted);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px; transition: color .15s, border-color .15s;
  /* Chaque onglet reste sur une seule ligne et ne se comprime pas. */
  white-space: nowrap; flex: none;
}
.tabs__tab:hover { color: var(--text); }
.tabs__tab.is-active { color: var(--accent); border-bottom-color: var(--accent); }
.tab-panel { display: none; }
.tab-panel.is-active { display: block; }

/* --- Sidebar (admin) --- */
.sidebar {
  display: flex; flex-direction: column;
  width: 232px; flex: none;
  background: var(--admin-deep);
  border-right: 1px solid rgba(163,60,60,0.3);
}
.sidebar__brand {
  display: flex; align-items: center; gap: 8px;
  padding: var(--sp-4) var(--sp-5);
  font-family: var(--font-title); font-size: 18px;
  border-bottom: 1px solid rgba(163,60,60,0.25);
}
.sidebar__brand .brand-mark { color: var(--admin); }
.sidebar__nav { padding: var(--sp-4) var(--sp-3); display: flex; flex-direction: column; gap: 2px; flex: 1; }
.sidebar__link {
  display: flex; align-items: center; gap: 11px;
  padding: 10px 14px; border-radius: var(--r-md);
  color: var(--text-soft); font-size: 14px; font-weight: 500;
}
.sidebar__link:hover { background: var(--admin-deep-2); color: var(--text); }
.sidebar__link.is-active {
  background: var(--admin-soft); color: #e6a2a2;
  box-shadow: inset 3px 0 0 var(--admin);
}
.sidebar__foot { padding: var(--sp-4) var(--sp-3); border-top: 1px solid rgba(163,60,60,0.2); }
.sidebar__foot .sidebar__link { color: var(--danger); }

/* --- Drawer (mobile) --- */
.drawer-backdrop {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(10,9,14,0.6); display: none;
}
.drawer-backdrop.is-open { display: block; }
.drawer {
  position: fixed; top: 0; right: 0; z-index: 90;
  height: 100%; width: min(340px, 88vw);
  background: var(--surface); border-left: 1px solid var(--line-strong);
  box-shadow: var(--shadow-3);
  transform: translateX(100%); transition: transform .25s ease;
  overflow-y: auto;
}
.drawer.is-open { transform: translateX(0); }
.drawer__header {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4); border-bottom: 1px solid var(--line);
}
.drawer__body { padding: var(--sp-4); }

/* --- Pagination --- */
.pagination { display: flex; align-items: center; gap: 4px; justify-content: center; }
.pagination__item {
  min-width: 34px; height: 34px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: var(--r-md);
  background: transparent; border: 1px solid transparent;
  color: var(--text-soft); font-size: 14px; font-weight: 500;
}
.pagination__item:hover { background: var(--surface-2); color: var(--text); }
.pagination__item.is-active {
  background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line);
}
.pagination__item[disabled] { color: var(--text-faint); cursor: not-allowed; }
.pagination__ellipsis { color: var(--text-muted); padding: 0 4px; }

/* --- Lang switcher --- */
.lang-switcher { display: inline-flex; align-items: center; gap: 2px; }
.lang-switcher__btn {
  background: none; border: none;
  color: var(--text-muted); font-size: 12.5px; font-weight: 600;
  padding: 4px 7px; border-radius: var(--r-sm); letter-spacing: 0.03em;
}
.lang-switcher__btn:hover { color: var(--text); }
.lang-switcher__btn.is-active { color: var(--accent); background: var(--accent-soft); }
.lang-switcher__sep { color: var(--line-strong); }

/* --- Avatar --- */
.avatar {
  width: 32px; height: 32px; border-radius: var(--r-pill);
  overflow: hidden; flex: none; border: 1px solid var(--line-strong);
  background: var(--surface-3);
}
.avatar--sm { width: 26px; height: 26px; }
.avatar--lg { width: 44px; height: 44px; border-radius: var(--r-md); }
.avatar--square { border-radius: var(--r-md); }

/* ============================ 6. HEADER APPLICATIF ============================ */
.app-header {
  height: var(--header-h);
  display: flex; align-items: center;
  padding: 0 var(--sp-5);
  background: var(--bg-deep);
  border-bottom: 1px solid var(--line);
  gap: var(--sp-5);
}
.brand {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--font-title); font-size: 19px; font-weight: 700;
  color: var(--text); letter-spacing: 0.02em;
}
.brand:hover { color: var(--text); }
.brand-mark {
  width: 26px; height: 26px; color: var(--accent); flex: none;
}
.app-header__nav { display: flex; align-items: center; gap: var(--sp-5); }
.app-header__nav a { color: var(--text-soft); font-size: 14px; }
.app-header__nav a:hover, .app-header__nav a.is-active { color: var(--text); }
.app-header__right { margin-left: auto; display: flex; align-items: center; gap: var(--sp-4); }

/* ============================ 7. PLACEHOLDERS D'IMAGES ============================ */
/* Rectangles dégradés — seront remplacés par de vrais <img>. */
.ph {
  width: 100%; height: 100%;
  background:
    linear-gradient(135deg, rgba(255,255,255,0.02) 0 25%, transparent 25% 50%, rgba(255,255,255,0.02) 50% 75%, transparent 75%) 0 0 / 14px 14px,
    linear-gradient(160deg, #2a2732, #201d28 55%, #171420);
  display: grid; place-items: center;
}
.ph::after {
  content: attr(data-ph);
  font-family: var(--font-mono); font-size: 10px;
  color: var(--text-faint); letter-spacing: .04em;
  padding: 2px 6px;
}
/* Variantes d'ambiance pour varier les vignettes */
.ph--dusk   { background: linear-gradient(160deg, #3a2f2a, #241a1c 60%, #16121a); }
.ph--mist   { background: linear-gradient(160deg, #2b3540, #1f2730 60%, #161b22); }
.ph--forest { background: linear-gradient(160deg, #263028, #1a231c 60%, #131912); }
.ph--ember  { background: linear-gradient(160deg, #43312a, #2a1d1a 60%, #1a1315); }
.ph--ruin   { background: linear-gradient(160deg, #34303a, #23202a 60%, #17151d); }
.ph--stone  { background: linear-gradient(160deg, #313038, #232229 60%, #17161c); }
.ph--gold   { background: linear-gradient(160deg, #4a3c24, #2e2618 60%, #1b1710); }
.ph::after, .ph { border-radius: inherit; }

/* Vraie image remplaçant un placeholder .ph dans un fond de hero/scène */
.hero__bg img, .scene-hero__bg img,
.world-card__cover img, .select-card__img img { width: 100%; height: 100%; object-fit: cover; }

/* ============================ 8. LAYOUT PUBLIC ============================ */
.page-public { min-height: 100%; display: flex; flex-direction: column; }
.page-public main { flex: 1; }

/* Hero accueil */
.hero {
  position: relative;
  border-radius: var(--r-lg);
  overflow: hidden;
  min-height: 340px;
  display: flex; align-items: center;
  margin-top: var(--sp-5);
}
.hero__bg { position: absolute; inset: 0; z-index: 0; }
.hero__bg::before {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(100deg, rgba(20,18,26,0.94) 30%, rgba(20,18,26,0.5) 70%, rgba(20,18,26,0.2));
}
.hero__content { position: relative; z-index: 1; padding: var(--sp-7) var(--sp-6); max-width: 560px; }
.hero__subtitle { color: var(--text-soft); font-size: 16px; margin: var(--sp-4) 0 var(--sp-5); max-width: 420px; }
.hero__cta { display: flex; gap: var(--sp-3); flex-wrap: wrap; }

/* Grilles de cartes */
.world-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
}
.feature-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: var(--sp-4);
}

/* Barre de filtres catalogue */
.filter-bar {
  display: flex; align-items: center; gap: var(--sp-3);
  flex-wrap: wrap;
}
.filter-bar .form-search { flex: 1 1 300px; }
.filter-bar .form-select { width: auto; min-width: 130px; }

/* ============================ 9. LAYOUT HUB / JEU ============================ */
.page-app { min-height: 100%; display: flex; flex-direction: column; }
.page-app main { flex: 1; }

.hub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-5);
}
.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  overflow: hidden;
}
.panel__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4) var(--sp-4) var(--sp-3);
}
.panel__title { font-family: var(--font-title); font-size: 16px; display: flex; align-items: center; gap: 8px; }
.panel__title .icon { color: var(--accent); }
.panel__body { padding: 0 var(--sp-4) var(--sp-4); }
.panel__foot { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line); }

/* Ligne de partie (Mes parties) */
.party-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3); border-radius: var(--r-md);
  border: 1px solid var(--line);
  background: var(--surface-2);
}
.party-row + .party-row { margin-top: var(--sp-3); }
.party-row__info { flex: 1; min-width: 0; }
.party-row__title { font-family: var(--font-title); font-size: 14.5px; }
.party-row__meta { font-size: 12px; color: var(--text-muted); }
.party-row__hp { width: 96px; }

/* Ligne de monde (Mes mondes) */
.world-row {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: var(--sp-3); border-radius: var(--r-md);
  border: 1px solid var(--line); background: var(--surface-2);
}
.world-row + .world-row { margin-top: var(--sp-3); }
.world-row__thumb { width: 52px; height: 40px; border-radius: var(--r-sm); overflow: hidden; flex: none; }
.world-row__info { flex: 1; min-width: 0; }
.world-row__title { font-family: var(--font-title); font-size: 14.5px; }
.world-row__meta { font-size: 12px; color: var(--text-muted); }

/* ============================ 10. LAYOUT STUDIO ============================ */
.page-studio { height: 100vh; display: flex; flex-direction: column; overflow: hidden; }
.studio-topbar {
  display: flex; align-items: center; gap: var(--sp-4);
  padding: 0 var(--sp-4); height: 52px; flex: none;
  background: var(--bg-deep); border-bottom: 1px solid var(--line);
}
.studio-topbar__title { font-family: var(--font-title); font-size: 14px; color: var(--text-soft); }
.studio-topbar__actions { margin-left: auto; display: flex; align-items: center; gap: var(--sp-2); }
.studio-save-state { font-size: 11.5px; color: var(--text-muted); }

/* Barre d'onglets du studio */
.studio-tabs {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px;
  padding: 0 var(--sp-4); min-height: 44px; flex: none;
  background: var(--surface); border-bottom: 1px solid var(--line);
  /* Aucun overflow : les onglets ne défilent pas et ne sont jamais rognés
     (s'ils manquent de place, la barre passe à la ligne). L'ancien overflow-x
     coupait le soulignement jaune de l'onglet actif. */
}
.studio-tabs .tabs__tab { padding: 12px 14px; }

.studio-body { flex: 1; display: flex; min-height: 0; }

/* Rail d'outils vertical */
.tool-rail {
  width: 56px; flex: none;
  background: var(--bg-deep); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; align-items: center;
  padding: var(--sp-3) 0; gap: var(--sp-1);
}
.tool-rail__btn {
  width: 40px; height: 40px; border-radius: var(--r-md);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: transparent; border: none; color: var(--text-muted);
  font-size: 8.5px;
}
.tool-rail__btn:hover { background: var(--surface-2); color: var(--text); }
.tool-rail__btn.is-active { background: var(--accent-soft); color: var(--accent); }
.tool-rail__zoom { margin-top: auto; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.tool-rail__zoom-val { font-family: var(--font-mono); font-size: 10px; color: var(--text-muted); }

/* Canvas de scénario */
.canvas {
  flex: 1; position: relative; overflow: hidden;
  background-color: var(--bg-deep);
  background-image:
    radial-gradient(circle, rgba(255,255,255,0.045) 1px, transparent 1px);
  background-size: 24px 24px;
}
.canvas__edges { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 1; }
.canvas__edges path { fill: none; stroke: var(--line-strong); stroke-width: 1.6; }
.canvas__edges .edge-label {
  font-family: var(--font-body); font-size: 11px; fill: var(--text-muted);
}

/* Couche transformée (pan + zoom) qui porte les nœuds. Les arêtes (SVG) restent
   en espace écran et sont recalculées à chaque pan/zoom. */
.canvas { cursor: grab; }
.canvas.is-panning { cursor: grabbing; }
.canvas__world {
  position: absolute; top: 0; left: 0; transform-origin: 0 0; z-index: 2;
  width: 0; height: 0;
}
.canvas__world .scene-node { cursor: default; }

/* Contrôles de zoom (coin bas-droit du canvas) */
.canvas__zoom {
  position: absolute; right: 12px; bottom: 12px; z-index: 5;
  display: flex; gap: 4px; align-items: stretch;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-md); padding: 3px; box-shadow: var(--shadow-1);
}
.canvas__zoom-btn {
  min-width: 30px; height: 28px; padding: 0 8px;
  display: inline-flex; align-items: center; justify-content: center;
  background: transparent; color: var(--text); border: 0; border-radius: var(--r-sm);
  font-size: 16px; line-height: 1; cursor: pointer;
}
.canvas__zoom-btn:hover { background: var(--surface-2, rgba(255,255,255,0.06)); }
.canvas__zoom-level { min-width: 52px; font-size: 12px; font-variant-numeric: tabular-nums; }

/* Nœuds de scène (réutilisables sur Drawflow) */
.scene-node {
  position: absolute; z-index: 2;
  width: 148px;
  background: var(--surface);
  border: 1.5px solid var(--line-strong);
  border-radius: var(--r-md);
  overflow: hidden;
  box-shadow: var(--shadow-1);
  transition: border-color .15s, box-shadow .15s;
}
.scene-node:hover { box-shadow: var(--shadow-2); }
.scene-node__head { padding: 7px 9px 5px; }
.scene-node__title { font-family: var(--font-title); font-size: 12px; line-height: 1.25; }
.scene-node__thumb { height: 62px; position: relative; }
.scene-node__icons {
  position: absolute; bottom: 5px; left: 6px; display: flex; gap: 5px;
}
.scene-node__icon {
  width: 20px; height: 20px; border-radius: var(--r-sm);
  background: rgba(20,18,26,0.8); display: grid; place-items: center;
  color: var(--text-soft);
}
.scene-node--start   { border-color: var(--success); }
.scene-node--start .scene-node__head { color: var(--success); }
.scene-node--combat  { border-color: var(--danger); }
.scene-node--ending  { border-color: var(--accent); }
.scene-node--ending .scene-node__head { color: var(--accent); }
.scene-node--orphan  { border-style: dashed; border-color: var(--warning); opacity: .9; }
.scene-node--orphan .scene-node__head { color: var(--warning); }
.scene-node.is-selected { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft), var(--shadow-2); }

/* Minimap */
.minimap {
  position: absolute; bottom: 14px; left: 14px; z-index: 3;
  width: 148px; height: 96px;
  background: rgba(22,21,32,0.85); border: 1px solid var(--line);
  border-radius: var(--r-sm); overflow: hidden;
}
.minimap__node { position: absolute; background: var(--line-strong); border-radius: 1px; }

/* Panneau latéral d'édition (scénario) */
.editor-panel {
  width: 336px; flex: none;
  background: var(--surface); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; overflow: hidden;
}
.editor-panel__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-4); border-bottom: 1px solid var(--line);
}
.editor-panel__title { font-family: var(--font-title); font-size: 15px; }
.editor-panel__body { padding: var(--sp-4); overflow-y: auto; flex: 1; }

/* Liste des sorties/choix */
.choice-list { display: flex; flex-direction: column; gap: var(--sp-2); }
.choice-item {
  display: flex; align-items: flex-start; gap: 9px;
  padding: 9px 10px; border-radius: var(--r-md);
  background: var(--surface-2); border: 1px solid var(--line);
}
.choice-item__ic {
  width: 24px; height: 24px; border-radius: var(--r-sm); flex: none;
  background: var(--surface-3); display: grid; place-items: center; color: var(--text-soft);
}
.choice-item__body { flex: 1; min-width: 0; }
.choice-item__label { font-size: 13px; font-weight: 600; }
.choice-item__meta { font-size: 11px; color: var(--text-muted); }
.choice-item__actions { display: flex; gap: 2px; }
.choice-add {
  width: 100%; text-align: center; padding: 9px; margin-top: var(--sp-2);
  background: transparent; border: 1px dashed var(--line-strong);
  border-radius: var(--r-md); color: var(--text-soft); font-size: 13px;
}
.choice-add:hover { border-color: var(--accent-line); color: var(--accent); }

/* Bandeau d'avertissement mobile studio */
.studio-warning {
  display: none;
  padding: var(--sp-3) var(--sp-4);
  background: var(--accent-soft); border-bottom: 1px solid var(--accent-line);
  color: var(--accent); font-size: 13px;
  align-items: center; gap: 8px;
}

/* ============================ 11. LAYOUT ADMIN ============================ */
.page-admin { height: 100vh; display: flex; overflow: hidden; }
.admin-main { flex: 1; display: flex; flex-direction: column; overflow: hidden; }
.admin-topbar {
  height: var(--header-h); flex: none;
  display: flex; align-items: center;
  padding: 0 var(--sp-5);
  background: var(--admin-deep-2);
  border-bottom: 1px solid rgba(163,60,60,0.3);
}
.admin-topbar .brand-mark { color: var(--admin); }
.admin-content { flex: 1; overflow-y: auto; padding: var(--sp-5); }

/* Cartes de statistiques */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-4); }
.stat-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--sp-4);
}
.stat-card__label {
  font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-muted); display: flex; align-items: center; justify-content: space-between;
}
.stat-card__value { font-family: var(--font-title); font-size: 30px; font-weight: 700; margin-top: 6px; }
.stat-card__delta { font-size: 12px; margin-top: 2px; }
.stat-card__delta--up { color: var(--success); }
.stat-card__delta--down { color: var(--danger); }
.stat-card__icon { color: var(--text-faint); }
.stat-card--admin .stat-card__icon { color: var(--admin); }

/* Sparkline zone */
.sparkline { height: 26px; color: var(--success); }

/* ============================ 12. ÉCRANS SPÉCIFIQUES ============================ */

/* --- Bestiaire --- */
.bestiary { display: flex; gap: var(--sp-4); }
.bestiary__list {
  width: 260px; flex: none;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
  display: flex; flex-direction: column;
}
.bestiary__search { padding: var(--sp-3); border-bottom: 1px solid var(--line); display: flex; gap: 8px; }
.monster-item {
  display: flex; align-items: center; gap: var(--sp-3);
  padding: 9px var(--sp-3); border-bottom: 1px solid var(--line);
  cursor: pointer;
}
.monster-item:hover { background: var(--surface-2); }
.monster-item.is-active { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.monster-item__thumb { width: 36px; height: 36px; border-radius: var(--r-sm); overflow: hidden; flex: none; }
.monster-item__name { font-size: 13.5px; font-weight: 600; }
.monster-item__lvl { font-size: 11px; color: var(--text-muted); }

.bestiary__detail {
  flex: 1; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--sp-5);
}
.monster-detail__top { display: flex; gap: var(--sp-5); }
.monster-detail__portrait {
  width: 168px; height: 210px; flex: none;
  border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line-strong);
}
.monster-detail__title { font-family: var(--font-title); font-size: 26px; }
.stat-table { width: 100%; font-size: 13.5px; }
.stat-table td { padding: 6px 0; border-bottom: 1px solid var(--line); }
.stat-table td:first-child { color: var(--text-muted); width: 44%; }
.stat-table td:last-child { text-align: right; font-family: var(--font-mono); }
.capacity {
  display: flex; align-items: flex-start; gap: var(--sp-3);
  padding: var(--sp-3) 0; border-bottom: 1px solid var(--line);
}
.capacity__text { flex: 1; font-size: 13.5px; }
.capacity__text b { color: var(--accent); }
.capacity__actions { display: flex; gap: 4px; }

/* --- Écran de scène (jeu) --- */
.game-layout { display: flex; gap: var(--sp-4); }
.scene-main { flex: 1; min-width: 0; }
.scene-hero {
  border-radius: var(--r-lg); overflow: hidden; position: relative;
  min-height: 230px; display: flex; align-items: flex-end;
  border: 1px solid var(--line);
}
.scene-hero__bg { position: absolute; inset: 0; }
.scene-hero__bg::after {
  content: ""; position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(20,18,26,0.1), rgba(20,18,26,0.92));
}
.scene-hero__content { position: relative; z-index: 1; padding: var(--sp-6); width: 100%; }
.scene-hero__title { font-family: var(--font-title); font-size: 28px; text-align: center; }
.scene-narrative {
  color: var(--text-soft); font-size: 15.5px; line-height: 1.65;
  max-width: 640px; margin: var(--sp-4) auto 0; text-align: center;
}

/* Boutons de choix narratif */
.choices { display: flex; flex-direction: column; gap: var(--sp-3); margin-top: var(--sp-5); }
.choice-btn {
  display: flex; align-items: center; gap: var(--sp-3);
  width: 100%; text-align: left;
  padding: 15px var(--sp-4);
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-md); color: var(--text);
  font-size: 15px; transition: border-color .15s, background .15s;
}
.choice-btn:hover { border-color: var(--accent-line); background: var(--surface-2); }
.choice-btn__ic { color: var(--accent); flex: none; }
.choice-btn__sub { display: block; font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.choice-btn--roll .choice-btn__ic { color: var(--accent); }
.choice-btn--locked {
  color: var(--text-faint); border-color: var(--line);
  background: var(--surface); cursor: not-allowed;
}
.choice-btn--locked .choice-btn__ic { color: var(--text-faint); }
.choice-btn--locked:hover { border-color: var(--line); background: var(--surface); }

/* Barre latérale personnage */
.char-sidebar {
  width: 300px; flex: none;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); overflow: hidden;
}
.char-header { display: flex; gap: var(--sp-3); padding: var(--sp-4); }
.char-header__portrait { width: 60px; height: 74px; border-radius: var(--r-md); overflow: hidden; flex: none; }
.char-header__name { font-family: var(--font-title); font-size: 18px; }
.char-header__cls { font-size: 12.5px; color: var(--text-muted); }
.char-section { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line); }
.char-section__title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-muted); margin-bottom: var(--sp-2);
  display: flex; align-items: center; justify-content: space-between;
}
.char-resources { display: flex; gap: var(--sp-4); font-size: 13px; }
.char-resources b { font-family: var(--font-mono); color: var(--accent); }

/* Grille d'inventaire */
.inv-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.inv-slot {
  aspect-ratio: 1; border-radius: var(--r-sm);
  background: var(--surface-2); border: 1px solid var(--line);
  display: grid; place-items: center; position: relative;
  color: var(--text-soft);
}
.inv-slot--empty { background: var(--bg-deep); }
.inv-slot__badge {
  position: absolute; bottom: 1px; right: 3px;
  font-family: var(--font-mono); font-size: 9px; color: var(--accent);
}

/* Liste de quêtes */
.quest { display: flex; gap: 9px; padding: 7px 0; }
.quest__dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); margin-top: 6px; flex: none; }
.quest__title { font-size: 13px; font-weight: 600; }
.quest__desc { font-size: 12px; color: var(--text-muted); }

/* Barre d'action bas de scène/combat */
.action-bar {
  display: flex; gap: var(--sp-3); justify-content: center;
  padding: var(--sp-4);
}
.action-bar .btn { min-width: 110px; }

/* Barre d'icônes bas (scène joueur) */
.icon-bar { display: flex; gap: var(--sp-2); }

/* --- Écran de combat --- */
.combat-layout { display: flex; gap: var(--sp-4); min-height: calc(100vh - 150px); }
.combat-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.combat-stage {
  flex: 1; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: var(--sp-5); position: relative;
  display: flex; flex-direction: column; align-items: center;
}
.initiative {
  display: flex; align-items: center; gap: var(--sp-2);
  flex-wrap: wrap; justify-content: center;
}
.init-token { display: flex; flex-direction: column; align-items: center; gap: 3px; }
.init-token__av { position: relative; }
.init-token__num {
  position: absolute; top: -4px; right: -6px;
  min-width: 18px; height: 18px; padding: 0 4px;
  border-radius: var(--r-pill);
  background: var(--surface-3); border: 1px solid var(--line-strong);
  font-family: var(--font-mono); font-size: 10px;
  display: grid; place-items: center; color: var(--text);
}
.init-token__name { font-size: 10px; color: var(--text-muted); }
.init-token.is-turn .avatar { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
.init-token.is-turn .init-token__num { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

.combat-arena {
  display: flex; align-items: flex-end; justify-content: center; gap: var(--sp-6);
  flex: 1; width: 100%; margin: var(--sp-4) 0;
}
.combatant { display: flex; flex-direction: column; align-items: center; gap: var(--sp-2); }
.combatant__portrait { width: 92px; height: 118px; border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line-strong); }
.combatant__name { font-family: var(--font-title); font-size: 14px; }
.combatant__hp { width: 90px; }
.combatant--enemy .combatant__portrait { width: 78px; height: 100px; }

.combat-center { display: flex; flex-direction: column; align-items: center; margin: 0 var(--sp-4); }

/* Journal de combat */
.combat-log {
  width: 288px; flex: none;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); display: flex; flex-direction: column; overflow: hidden;
}
.combat-log__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line);
}
.combat-log__title { font-family: var(--font-title); font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; }
.combat-log__body { flex: 1; overflow-y: auto; padding: var(--sp-3) var(--sp-4); font-size: 13px; }
.log-entry { padding: 5px 0; border-bottom: 1px solid var(--line); }
.log-entry:last-child { border-bottom: none; }
.log-entry b { font-weight: 600; }
.log-entry--dmg { color: var(--danger); }
.log-entry--success { color: var(--text-soft); }
.log-entry--enemy { color: var(--danger); }
.combat-log__foot { padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line); }

/* Actions & états de combat (phase 7) — complète le design du mockup 07 */
.combat-btn__ic { display: inline-flex; vertical-align: middle; }
#combat-menu-host { display: flex; justify-content: center; }
.combat-menu {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: var(--sp-2); margin-top: var(--sp-3); max-width: 620px;
}
.combatant[role="button"] { cursor: pointer; }
.combatant.is-target .combatant__portrait {
  border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft);
}
.combatant.is-down, .init-token.is-down { opacity: 0.45; }
.combat-outcome { width: 100%; max-width: 480px; text-align: center; }
.combat-outcome__title { font-family: var(--font-title); font-size: 26px; margin-bottom: var(--sp-2); }

/* --- Wizard création perso --- */
.wizard { max-width: 860px; margin: 0 auto; }
.wizard-steps {
  display: flex; align-items: center; gap: 0;
  margin: var(--sp-5) 0 var(--sp-6);
}
.wizard-step { display: flex; align-items: center; gap: var(--sp-2); flex: 1; }
.wizard-step__num {
  width: 30px; height: 30px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  background: var(--surface-2); border: 1px solid var(--line-strong);
  font-family: var(--font-mono); font-size: 13px; color: var(--text-muted);
}
.wizard-step__label { font-size: 13px; color: var(--text-muted); }
.wizard-step__line { flex: 1; height: 1px; background: var(--line); margin: 0 var(--sp-3); }
.wizard-step.is-active .wizard-step__num { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }
.wizard-step.is-active .wizard-step__label { color: var(--text); }
.wizard-step.is-done .wizard-step__num { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.wizard-step.is-done .wizard-step__label { color: var(--text-soft); }

.choice-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
.select-card {
  background: var(--surface); border: 1.5px solid var(--line-strong);
  border-radius: var(--r-lg); overflow: hidden; cursor: pointer;
  transition: border-color .15s, transform .15s;
}
.select-card:hover { border-color: var(--accent-line); transform: translateY(-2px); }
.select-card.is-selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent-soft); }
.select-card__img { height: 130px; }
.select-card__body { padding: var(--sp-3) var(--sp-4); }
.select-card__name { font-family: var(--font-title); font-size: 16px; }
.select-card__desc { font-size: 12.5px; color: var(--text-muted); margin-top: 3px; }

/* --- Auth --- */
.auth-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: var(--sp-5);
  background:
    radial-gradient(1200px 500px at 50% -10%, rgba(217,164,65,0.08), transparent 60%),
    var(--bg);
}
.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface); border: 1px solid var(--line-strong);
  border-radius: var(--r-lg); box-shadow: var(--shadow-3);
  overflow: hidden;
}
.auth-card__head { padding: var(--sp-6) var(--sp-6) var(--sp-3); text-align: center; }
.auth-card__brand { display: inline-flex; align-items: center; gap: 9px; font-family: var(--font-title); font-size: 22px; }
.auth-card__body { padding: 0 var(--sp-6) var(--sp-6); }
.auth-tabs { display: flex; margin-bottom: var(--sp-5); border: 1px solid var(--line); border-radius: var(--r-md); overflow: hidden; }
.auth-tabs__tab {
  flex: 1; padding: 10px; background: var(--surface-2); border: none;
  color: var(--text-muted); font-weight: 600; font-size: 14px;
}
.auth-tabs__tab.is-active { background: var(--accent-soft); color: var(--accent); }

/* ============================ 13. RESPONSIVE ============================ */
.mobile-only { display: none; }

@media (max-width: 1024px) {
  .world-grid, .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .hub-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .choice-grid { grid-template-columns: 1fr; }
  /* Studio desktop-first : avertissement sous 1024px */
  .studio-warning { display: flex; }
}

@media (max-width: 860px) {
  .app-header { gap: var(--sp-3); padding: 0 var(--sp-4); }
  .app-header__nav { display: none; }
  .bestiary { flex-direction: column; }
  .bestiary__list { width: 100%; }
  .monster-detail__top { flex-direction: column; }
  .monster-detail__portrait { width: 100%; height: 220px; }

  /* Jeu : la barre latérale personnage devient un drawer */
  .char-sidebar, .combat-log { display: none; }
  .mobile-only { display: inline-flex; }
  .game-layout, .combat-layout { flex-direction: column; }

  /* Admin : la sidebar devient un drawer */
  .sidebar { display: none; }
}

@media (max-width: 560px) {
  .world-grid, .feature-grid { grid-template-columns: 1fr; }
  .stat-grid { grid-template-columns: 1fr; }
  .filter-bar .form-select { flex: 1 1 45%; min-width: 0; }
  .hero__content { padding: var(--sp-5) var(--sp-4); }
  .action-bar { flex-wrap: wrap; }
  .action-bar .btn { flex: 1 1 40%; min-width: 0; }
  .combat-arena { gap: var(--sp-4); }
}

/* ========================= 14. CENTRE D'AIDE (phase 10) ========================= */
.help-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); }
.help-card { display: block; color: inherit; text-decoration: none; transition: border-color .15s ease; }
.help-card:hover { border-color: var(--accent-line); }
.help-card__icon {
  display: inline-flex; width: 40px; height: 40px; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent);
  align-items: center; justify-content: center; margin-bottom: var(--sp-3);
}

.help-grid { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: var(--sp-6); align-items: start; }
.help-nav { position: sticky; top: 24px; display: flex; flex-direction: column; gap: 2px; }
.help-nav__back { color: var(--text-muted); font-size: 13px; margin-bottom: var(--sp-3); text-decoration: none; }
.help-nav__back:hover { color: var(--text); }
.help-nav__link { padding: 8px 12px; border-radius: 8px; color: var(--text-soft); text-decoration: none; }
.help-nav__link:hover { background: var(--surface); color: var(--text); }
.help-nav__link.is-active { background: var(--accent-soft); color: var(--accent); }

.help-article { max-width: 760px; }
.help-article h1 { font-family: var(--font-title); font-size: 26px; margin-bottom: var(--sp-2); }
.help-article .lead { color: var(--text-soft); margin-bottom: var(--sp-5); font-size: 15px; }
.help-article h2 {
  font-family: var(--font-title); font-size: 20px; margin: var(--sp-6) 0 var(--sp-3);
  padding-bottom: 6px; border-bottom: 1px solid var(--line); scroll-margin-top: 24px;
}
.help-article h3 { font-family: var(--font-title); font-size: 16px; margin: var(--sp-4) 0 var(--sp-2); scroll-margin-top: 24px; }
.help-article p { margin-bottom: var(--sp-3); line-height: 1.65; color: var(--text-soft); }
.help-article ul, .help-article ol { margin: 0 0 var(--sp-3) 20px; color: var(--text-soft); line-height: 1.65; }
.help-article li { margin-bottom: 4px; }
.help-article strong { color: var(--text); }
.help-article code { background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 1px 5px; font-size: 13px; }
.help-article table { width: 100%; border-collapse: collapse; margin-bottom: var(--sp-4); font-size: 14px; }
.help-article th, .help-article td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); color: var(--text-soft); vertical-align: top; }
.help-article th { color: var(--text); font-weight: 600; }
.help-tip {
  background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 10px;
  padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4); color: var(--text-soft);
}

.prompt-block { position: relative; margin-bottom: var(--sp-5); }
.prompt-block pre {
  background: var(--bg-deep); border: 1px solid var(--line); border-radius: 10px;
  padding: var(--sp-4); padding-top: 44px; overflow-x: auto;
  font-size: 13px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.prompt-block__copy { position: absolute; top: 10px; right: 10px; }

/* Aide contextuelle : petit « ? » discret à côté d'un titre */
.help-hint {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; margin-left: 6px;
  border: 1px solid var(--line-strong); color: var(--text-muted);
  font-size: 12px; text-decoration: none; vertical-align: 2px;
}
.help-hint:hover { color: var(--accent); border-color: var(--accent-line); }

@media (max-width: 900px) {
  .help-cards { grid-template-columns: 1fr; }
  .help-grid { grid-template-columns: 1fr; }
  .help-nav { position: static; flex-direction: row; flex-wrap: wrap; }
}

/* ========================= 15. CAMPAGNE TEMPS RÉEL (phase 11) ========================= */
.cmp__topbar { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.cmp__paused {
  background: var(--accent-soft); border: 1px solid var(--accent-line); color: var(--text);
  border-radius: 10px; padding: var(--sp-3) var(--sp-4); margin-bottom: var(--sp-4); text-align: center;
}
.cmp__grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--sp-4); align-items: start; }
.cmp__main { display: flex; flex-direction: column; gap: var(--sp-4); min-width: 0; }
.cmp__side { display: flex; flex-direction: column; gap: var(--sp-4); position: sticky; top: 16px; }
.cmp__dmbar { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.cmp__h { font-family: var(--font-title); font-size: 15px; margin-bottom: var(--sp-2); }

.cmp__images { display: flex; gap: var(--sp-2); overflow-x: auto; margin-bottom: var(--sp-3); }
.cmp__image { max-height: 200px; border-radius: 8px; border: 1px solid var(--line); }
.cmp__scene-title { font-family: var(--font-title); font-size: 22px; margin-bottom: var(--sp-2); }
.cmp__scene-body { color: var(--text-soft); line-height: 1.65; white-space: pre-wrap; }

.cmp__choices { display: flex; flex-direction: column; gap: var(--sp-2); }
.cmp__choice {
  display: flex; align-items: center; gap: var(--sp-3); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: var(--sp-3);
}
.cmp__choice.is-disabled { opacity: 0.5; }
.cmp__choice--ro { background: var(--surface-2); }
.cmp__choice-label { flex: 1; min-width: 0; }
.cmp__check { width: 18px; height: 18px; flex: none; }
.cmp__roller { display: flex; align-items: center; gap: var(--sp-2); font-size: 13px; color: var(--text-soft); margin-bottom: var(--sp-2); }

.cmp__votebox { border-color: var(--accent-line); }
.cmp__vote-row { display: flex; align-items: center; gap: var(--sp-3); padding: 6px 0; border-bottom: 1px solid var(--line); }
.cmp__vote-row:last-child { border-bottom: 0; }
.cmp__tally { color: var(--text-muted); font-size: 13px; white-space: nowrap; }

.cmp__grant { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-2); align-items: end; }
.cmp__grant [data-cmp-grant-target] { grid-column: 1 / -1; }
.cmp__grant > button { grid-column: 1 / -1; }
.cmp__grant-field { display: flex; flex-direction: column; gap: 2px; font-size: 12px; color: var(--text-muted); }

.cmp__party { display: flex; flex-direction: column; gap: var(--sp-3); }
.cmp__member-top { display: flex; align-items: center; gap: var(--sp-2); }
.cmp__dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.cmp__dot.is-on { background: #5fbf78; box-shadow: 0 0 6px rgba(95,191,120,0.6); }
.cmp__dot.is-off { background: var(--line-strong); }
.cmp__pname { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp__pmeta { color: var(--text-muted); font-size: 12px; }
.cmp__hp { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin-top: 4px; }
.cmp__hp-fill { height: 100%; background: linear-gradient(90deg, #a33c3c, #cf6b4a); }

.cmp__feedwrap { display: flex; flex-direction: column; }
.cmp__feed { max-height: 340px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; font-size: 14px; padding-right: 4px; }
.cmp__msg { color: var(--text); }
.cmp__narr { color: var(--text-soft); font-style: italic; border-left: 2px solid var(--accent-line); padding-left: var(--sp-2); }
.cmp__sys { color: var(--text-muted); font-size: 13px; }
.cmp__sys.is-ok { color: #7fc98f; }
.cmp__sys.is-ko { color: #d98a6a; }
.cmp__scene-mark { color: var(--accent); font-size: 13px; font-weight: 600; }
.cmp__chat { display: flex; gap: var(--sp-2); margin-top: var(--sp-3); }
.cmp__chat .form-input { flex: 1; }
.cmp__combat { border-color: var(--accent-line); }

.party-row--btn { width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--line); cursor: pointer; }
.party-row--btn:hover { border-color: var(--accent-line); }

@media (max-width: 860px) {
  .cmp__grid { grid-template-columns: 1fr; }
  .cmp__side { position: static; }
  .cmp__feed { max-height: 260px; }
}

/* --- Combat de groupe (phase 12) --- */
.cmp__combat { display: flex; flex-direction: column; gap: var(--sp-3); }
.cmp__cbt-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-2); }
.cmp__cbt-round { font-family: var(--font-title); font-size: 18px; }
.cmp__cbt-turn { color: var(--accent); font-weight: 600; }
.cmp__init { display: flex; flex-wrap: wrap; gap: 6px; }
.cmp__init-pill { font-size: 12px; padding: 3px 9px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); }
.cmp__init-pill--pc { border-color: var(--accent-line); }
.cmp__init-pill--monster { border-color: rgba(163,60,60,0.5); }
.cmp__init-pill.is-turn { background: var(--accent); color: var(--on-accent); font-weight: 700; }
.cmp__init-pill.is-dead { opacity: 0.4; text-decoration: line-through; }
.cmp__sides { display: grid; grid-template-columns: 1fr 1fr; gap: var(--sp-3); }
.cmp__side-col { display: flex; flex-direction: column; gap: 6px; }
.cmp__cbt-unit { display: grid; grid-template-columns: 1fr 70px 46px; align-items: center; gap: var(--sp-2); font-size: 13px; }
.cmp__cbt-unit.is-dead { opacity: 0.45; text-decoration: line-through; }
.cmp__cbt-unit.is-mine .cmp__cbt-name { color: var(--accent); font-weight: 600; }
.cmp__cbt-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cmp__cbt-hp { color: var(--text-muted); font-size: 12px; text-align: right; }
.cmp__cbt-actions { display: flex; flex-direction: column; gap: var(--sp-2); background: var(--surface); border: 1px solid var(--accent-line); border-radius: 10px; padding: var(--sp-3); }
.cmp__cbt-dm { display: flex; align-items: center; gap: var(--sp-3); flex-wrap: wrap; }
.cmp__cbt-log { max-height: 160px; overflow-y: auto; display: flex; flex-direction: column; gap: 3px; font-size: 13px; border-top: 1px solid var(--line); padding-top: var(--sp-2); }
.cmp__logline { color: var(--text-soft); }
.cmp__logline.is-success { color: #7fc98f; }
.cmp__logline.is-dmg, .cmp__logline.is-enemy { color: #d98a6a; }
.cmp__logline.is-down { color: var(--accent); font-weight: 600; }
.cmp__logline.is-start { color: var(--text-muted); font-style: italic; }
@media (max-width: 560px) { .cmp__sides { grid-template-columns: 1fr; } }

/* --- Badges de difficulté (phase 13) --- */
.badge--diff { border: 1px solid var(--line-strong); }
.badge--diff-easy   { color: #7fc98f; border-color: rgba(127,201,143,0.5); }
.badge--diff-medium { color: var(--text-soft); }
.badge--diff-hard   { color: #e0a94a; border-color: var(--accent-line); }
.badge--diff-heroic { color: #d98a6a; border-color: rgba(217,138,106,0.6); }

/* --- Heatmap de l'éditeur de scènes (phase 13) --- */
.scene-node--heat { box-shadow: inset 0 0 0 2px rgba(217, 164, 65, calc(0.1 + 0.85 * var(--heat, 0))), 0 0 12px rgba(217, 164, 65, calc(0.5 * var(--heat, 0))); }
.scene-node__heat { position: absolute; bottom: 4px; left: 6px; right: 6px; font-size: 11px; color: var(--text); background: rgba(0,0,0,0.45); border-radius: 4px; padding: 1px 4px; text-align: center; }
.tool-rail__btn.is-active { background: var(--accent-soft); color: var(--accent); }
.heat-legend { position: absolute; top: 12px; left: 50%; transform: translateX(-50%); z-index: 5; background: var(--surface-2); border: 1px solid var(--accent-line); border-radius: 999px; padding: 4px 14px; font-size: 13px; color: var(--text-soft); }

/* ========================= 16. COMMUNAUTÉ (phase 14) ========================= */
.notif-bell { position: relative; display: inline-flex; align-items: center; color: var(--text-soft); padding: 4px; }
.notif-bell:hover { color: var(--text); }
.notif-bell__count { position: absolute; top: -2px; right: -4px; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 999px; background: var(--accent); color: var(--on-accent); font-size: 10px; font-weight: 700; display: flex; align-items: center; justify-content: center; }
.notif__btn { width: 100%; text-align: left; display: flex; align-items: center; gap: var(--sp-3); background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: var(--sp-3) var(--sp-4); cursor: pointer; color: inherit; }
.notif__btn:hover { border-color: var(--accent-line); }
.notif--unread .notif__btn { background: var(--surface-2); }
.notif__dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: none; }
.notif__text { flex: 1; }
.notif__date { font-size: 12px; white-space: nowrap; }
.review-agg { color: var(--text-soft); }
.review-stars { color: var(--accent); letter-spacing: 1px; }
.badge--rating { color: var(--accent); }
.review { border: 1px solid var(--line); border-radius: 10px; padding: var(--sp-3) var(--sp-4); background: var(--surface); }
.review-author { font-weight: 600; }
.profile-head { display: flex; align-items: center; gap: var(--sp-4); }
.avatar--xl { width: 72px; height: 72px; }
