/* ═══════════════════════════════════════════════════════════════
   AD&D 1e — Interface Web — app.css
   ═══════════════════════════════════════════════════════════════ */

:root {
  --bg:       #0d0d1a;
  --bg2:      #13132a;
  --bg3:      #1a1a35;
  --border:   #2e2e5a;
  --gold:     #c9a227;
  --gold-h:   #e8b830;
  --text:     #ddd8cc;
  --muted:    #888;
  --player:   #3a9bd5;
  --enemy:    #cc3333;
  --success:  #3a9a5c;
  --warn:     #d97706;
  --radius:   6px;
  --shadow:   0 4px 20px rgba(0,0,0,.5);
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────────────────── */
header {
  background: var(--bg2);
  border-bottom: 2px solid var(--gold);
  position: sticky; top: 0; z-index: 100;
}
.header-inner {
  max-width: 1280px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex; align-items: center; gap: 32px;
  height: 56px;
}
.brand { font-size: 1.2em; color: var(--gold); white-space: nowrap; }
.brand span { font-weight: 900; }

#main-nav { display: flex; gap: 4px; }
.nav-btn {
  background: none;
  border: none;
  color: var(--muted);
  padding: 8px 14px;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: all .15s;
}
.nav-btn:hover { background: var(--bg3); color: var(--text); }
.nav-btn.active { background: var(--gold); color: #000; font-weight: 700; }

/* ── Main / panels ───────────────────────────────────────────────── */
main { max-width: 1280px; margin: 0 auto; padding: 24px 20px 60px; }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

.panel-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 20px;
}
.panel-header h2 { font-size: 1.4em; color: var(--gold); }
.panel-header h3 { font-size: 1.1em; color: var(--gold); }

/* ── Buttons ─────────────────────────────────────────────────────── */
button { cursor: pointer; font-family: inherit; border-radius: var(--radius); border: none; transition: all .15s; }

.btn-primary {
  background: var(--gold); color: #000;
  padding: 8px 18px; font-weight: 700;
}
.btn-primary:hover { background: var(--gold-h); }

.btn-secondary {
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--border); padding: 7px 16px;
}
.btn-secondary:hover { border-color: var(--gold); color: var(--gold); }

.btn-ghost {
  background: none; color: var(--muted);
  border: 1px solid var(--border); padding: 7px 16px;
}
.btn-ghost:hover { color: var(--text); border-color: var(--text); }

.btn-danger {
  background: none; color: var(--enemy);
  border: 1px solid var(--enemy); padding: 5px 12px; font-size: 12px;
}
.btn-danger:hover { background: var(--enemy); color: #fff; }

.btn-lg { padding: 12px 28px; font-size: 15px; }
.full-width { width: 100%; }

/* ── Forms ───────────────────────────────────────────────────────── */
input, select, textarea {
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 10px;
  border-radius: var(--radius);
  font-family: inherit;
  font-size: 13px;
  width: 100%;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold);
}
input[type="number"] { appearance: textfield; }
input[type="radio"] { width: auto; }
textarea { resize: vertical; min-height: 72px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; font-weight: 600; }
.hint { font-size: 11px; color: var(--muted); margin-top: 4px; display: block; }

.input-with-btn { display: flex; gap: 6px; }
.input-with-btn input { flex: 1; }
.input-with-btn .btn-dice { flex-shrink: 0; font-size: 16px; padding: 0 12px; }

.field { display: flex; flex-direction: column; }
.field-grid { display: grid; gap: 16px; }
.two-col { grid-template-columns: 1fr 1fr; }

/* ── Wizard step 1 : layout portrait ─────────────────────────── */
.wizard-step1-body   { display: flex; gap: 24px; align-items: flex-start; }
.wizard-step1-fields { flex: 1; min-width: 0; }
.wizard-portrait-box {
  width: 140px; flex-shrink: 0;
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding-top: 4px;
}
.wizard-portrait-label {
  font-size: 11px; color: var(--muted); text-align: center;
  min-height: 16px; line-height: 1.3;
}
.wizard-portrait-placeholder {
  width: 128px; height: 128px;
  border: 2px dashed var(--border); border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 28px;
}
@media (max-width: 540px) {
  .wizard-step1-body { flex-direction: column; }
  .wizard-portrait-box { width: 100%; flex-direction: row; gap: 12px; }
}

/* ── Table ───────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th {
  background: var(--bg3); color: var(--gold);
  text-align: left; padding: 10px 12px;
  font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  border-bottom: 1px solid var(--border);
}
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.data-table tr:hover td { background: var(--bg3); }
.data-table .actions { display: flex; gap: 6px; }

/* ── Card ────────────────────────────────────────────────────────── */
.card {
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}
.card h3 { color: var(--gold); margin-bottom: 14px; font-size: 1em; }

/* ── Badge ───────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
}
.badge-success { background: #1a3d26; color: #4caf82; }
.badge-danger  { background: #3d1a1a; color: #e57373; }
.badge-warn    { background: #3d2e10; color: #ffb74d; }
.badge-info    { background: #1a2a3d; color: #64b5f6; }
.badge-neutral { background: var(--bg3); color: var(--muted); }

.stat-chip {
  display: inline-block;
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 12px;
  margin: 2px;
}

/* ── Loading / empty ─────────────────────────────────────────────── */
.hidden  { display: none !important; }
.loading { color: var(--muted); padding: 40px; text-align: center; font-style: italic; }
.empty   { color: var(--muted); padding: 32px; text-align: center; }

/* ── Center ──────────────────────────────────────────────────────── */
.center-row { display: flex; justify-content: center; }

/* ═══════════════════════════════════════════════════════════════════
   WIZARD (Création de personnage)
   ═══════════════════════════════════════════════════════════════════ */
.wizard { max-width: 820px; }

.wizard-steps {
  display: flex; gap: 4px; margin-bottom: 28px;
  border-bottom: 1px solid var(--border); padding-bottom: 12px;
}
.wstep {
  padding: 6px 14px;
  border-radius: var(--radius);
  font-size: 12px; font-weight: 600; color: var(--muted);
  cursor: default;
}
.wstep.active { background: var(--gold); color: #000; }
.wstep.done   { color: var(--success); }

.wizard-page { display: none; }
.wizard-page.active { display: block; }

.wizard-nav {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--border);
}

/* Dice */
.dice-toolbar { display: flex; gap: 10px; margin-bottom: 20px; flex-wrap: wrap; align-items: center; }
.btn-dice {
  background: var(--bg3); color: var(--gold);
  border: 1px solid var(--gold); padding: 4px 10px; font-size: 11px;
  white-space: nowrap;
}
.btn-dice:hover { background: var(--gold); color: #000; }
.btn-dice:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  filter: grayscale(60%);
}
.btn-dice:disabled:hover { background: var(--bg3); color: var(--gold); }

/* Pool de redistribution */
#ability-pool-badge { margin-left: auto; font-size: 12px; padding: 4px 10px; }

.abilities-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.ab-row {
  display: grid;
  grid-template-columns: 110px 1fr 190px;
  align-items: center; gap: 8px;
}
.ab-row label { color: var(--text); font-size: 13px; font-weight: 600; margin: 0; }

/* Contrôles ▼/▲ */
.ab-controls { display: flex; gap: 4px; align-items: center; }
.ab-controls input[type="number"] {
  width: 58px !important; text-align: center; padding: 6px 4px; flex-shrink: 0;
}
.btn-ab-adj {
  background: var(--bg3); color: var(--text);
  border: 1px solid var(--border); padding: 5px 9px;
  font-size: 12px; line-height: 1; flex-shrink: 0;
}
.btn-ab-adj:hover { border-color: var(--gold); color: var(--gold); }

/* Bonus de caractéristique */
.ab-bonus { font-size: 11px; color: var(--muted); }

/* Ligne invalide (prérequis non satisfait) */
.ab-row.ab-invalid label              { color: var(--enemy); }
.ab-row.ab-invalid .ab-controls input { border-color: var(--enemy) !important; color: var(--enemy) !important; }
.ab-row.ab-invalid .ab-bonus          { color: var(--enemy) !important; }


/* Badge prérequis de classe dans le label */
.ab-prereq-badge {
  font-size: 10px; font-weight: 700;
  color: var(--muted); background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: 3px; padding: 1px 5px;
  margin-left: 4px; vertical-align: middle;
}
.ab-row.ab-invalid .ab-prereq-badge {
  background: #3d1a1a; border-color: var(--enemy); color: #ef9a9a;
}

/* Bandeau récapitulatif des prérequis de classe */
.class-prereqs-banner {
  background: var(--bg2); border: 1px solid var(--gold);
  border-radius: 6px; padding: 8px 14px;
  margin-bottom: 12px; font-size: 12px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.prereq-chip {
  padding: 2px 8px; border-radius: 3px; font-weight: 600; font-size: 11px;
}
.prereq-chip.ok   { background: #1a3d1a; border: 1px solid #4caf50; color: #a5d6a7; }
.prereq-chip.fail { background: #3d1a1a; border: 1px solid var(--enemy); color: #ef9a9a; }

/* Erreur race/classe inline */
.race-class-error {
  padding: 8px 12px; border-radius: var(--radius);
  background: #3d1a1a; border: 1px solid var(--enemy);
  color: #ef9a9a; font-size: 12px; margin-top: 8px;
}

/* Bandeau or étape 3 */
.gold-banner {
  display: flex; gap: 14px; align-items: center; flex-wrap: wrap;
  background: var(--bg2); border: 1px solid var(--gold);
  border-radius: 6px; padding: 10px 16px; margin-bottom: 16px; font-size: 13px;
}
.gold-banner label { margin: 0; font-size: 13px; color: var(--muted); font-weight: 400; display: inline; }
.gold-remaining        { color: var(--gold); font-weight: 700; font-size: 15px; }
.gold-remaining.low    { color: var(--warn); }
.gold-remaining.empty  { color: var(--enemy); }

/* Equipment step */
.equip-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.equip-col h3 { color: var(--gold); margin-bottom: 12px; font-size: .95em; }

.check-list { display: flex; flex-direction: column; gap: 6px; max-height: 380px; overflow-y: auto; }
.check-item {
  display: flex; align-items: flex-start; gap: 8px;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 4px; padding: 8px 10px; cursor: pointer;
}
.check-item:hover { border-color: var(--gold); }
.check-item input[type="checkbox"] { width: 14px; height: 14px; margin-top: 2px; accent-color: var(--gold); }
.check-item .item-label { font-weight: 600; font-size: 13px; }
.check-item .item-hint  { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* Spell limit badge */
#spell-count-badge { background: var(--bg3); color: var(--muted); font-size: 11px; margin-left: 6px; }
#spell-count-badge.full { background: #1a3d26; color: #4caf82; }

/* Feedback */
#create-feedback {
  padding: 12px 16px; border-radius: var(--radius);
  margin: 16px 0;
}
#create-feedback.success { background: #1a3d26; border: 1px solid var(--success); color: #6fcf97; }
#create-feedback.error   { background: #3d1a1a; border: 1px solid var(--enemy);   color: #e57373; }

/* ═══════════════════════════════════════════════════════════════════
   ARÈNE
   ═══════════════════════════════════════════════════════════════════ */
.setup-grid {
  display: grid; grid-template-columns: 1fr auto 1fr; gap: 20px; align-items: start;
}
.vs-badge {
  font-size: 2em; font-weight: 900; color: var(--gold);
  padding-top: 60px; text-align: center;
}
.preview-box {
  margin-top: 12px; padding: 10px 12px;
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 4px; font-size: 12px; line-height: 1.7;
}

/* Combat header */
.cbt-header {
  display: grid; grid-template-columns: 1fr auto 1fr;
  gap: 16px; align-items: center;
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 16px 20px; margin-bottom: 16px;
}
.cbt-fighter {}
.cbt-fighter.right { text-align: right; }
.cbt-name  { font-size: 1.1em; font-weight: 700; color: var(--player); }
.cbt-name.enemy { color: var(--enemy); }
.cbt-sub   { font-size: 11px; color: var(--muted); margin-bottom: 8px; }

.hp-bar-wrap { margin-top: 6px; }
.hp-bar {
  height: 22px; background: var(--bg3);
  border: 1px solid var(--border); border-radius: 3px; overflow: hidden;
}
.hp-fill {
  height: 100%; transition: width .4s ease;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: rgba(255,255,255,.8);
}
.hp-fill.player { background: linear-gradient(90deg, #1a5c2a, #2e9c4a); }
.hp-fill.enemy  { background: linear-gradient(90deg, #7a1a1a, #cc3333); }
.hp-fill.low    { background: linear-gradient(90deg, #7a3a1a, #c96020) !important; }
.hp-fill.critical { background: linear-gradient(90deg, #5a1a1a, #aa2020) !important; }
.hp-label { font-size: 11px; color: var(--muted); margin-top: 3px; text-align: center; }

.cbt-turn-col { text-align: center; }
.cbt-turn-label { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: 1px; }
.cbt-turn-num { font-size: 2.4em; font-weight: 900; color: var(--gold); line-height: 1; }
.cbt-initiative { font-size: 11px; color: var(--muted); margin-top: 4px; }

/* Combat body */
.cbt-body {
  display: grid; grid-template-columns: 1fr 220px; gap: 16px;
  min-height: 420px;
}
.cbt-log-col { display: flex; flex-direction: column; }
.log-title {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); margin-bottom: 6px;
}
.combat-log {
  flex: 1; background: #08080f; border: 1px solid var(--border);
  border-radius: 6px; padding: 12px; overflow-y: auto; max-height: 380px;
  font-family: 'Courier New', monospace; font-size: 12px; line-height: 1.8;
}
.log-entry   { padding: 1px 0; }
.log-player  { color: #4fc3f7; }
.log-enemy   { color: #ef9a9a; }
.log-hit     { color: #fff; font-weight: 700; }
.log-miss    { color: #666; }
.log-system  { color: var(--gold); font-style: italic; }
.log-turn-header {
  color: var(--gold); font-weight: 700;
  margin-top: 10px; margin-bottom: 4px;
  border-top: 1px solid #2a2a2a; padding-top: 6px;
}

.cbt-actions-col {
  display: flex; flex-direction: column; gap: 10px;
}
.btn-action {
  width: 100%; padding: 12px; font-size: 14px; font-weight: 700;
  border-radius: 6px; border: 2px solid transparent;
}
.btn-action.attack { background: #1a3a5a; color: #4fc3f7; border-color: #2a5a8a; }
.btn-action.attack:hover:not(:disabled) { background: #2a5a8a; }
.btn-action.spell  { background: #2a1a5a; color: #ce93d8; border-color: #4a2a8a; }
.btn-action.spell:hover:not(:disabled)  { background: #4a2a8a; }
.btn-action.flee   { background: #3a2a1a; color: #ffcc80; border-color: #6a4a2a; }
.btn-action.flee:hover:not(:disabled)   { background: #6a4a2a; }
.btn-action:disabled { opacity: .35; cursor: not-allowed; }

.action-submenu {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 6px; padding: 8px; display: flex; flex-direction: column; gap: 6px;
}
.submenu-item {
  background: var(--bg2); border: 1px solid var(--border);
  color: var(--text); padding: 7px 10px; border-radius: 4px;
  width: 100%; text-align: left; font-size: 12px;
}
.submenu-item:hover { border-color: var(--gold); color: var(--gold); }

.levelup-banner {
  background: linear-gradient(135deg, #1a3d00, #2d6600);
  border: 2px solid #6fcf97; border-radius: 6px;
  padding: 12px; text-align: center; color: #a5d6a7;
}
.levelup-banner .lu-title { font-size: 1em; font-weight: 700; color: #81c784; }

/* Fight over overlay */
.fight-over {
  position: absolute; inset: 0;
  background: rgba(0,0,0,.85); backdrop-filter: blur(4px);
  display: flex; align-items: center; justify-content: center;
  border-radius: 8px; z-index: 10;
}
#arena-combat { position: relative; }
.fight-over-card {
  background: var(--bg2); border: 2px solid var(--gold);
  border-radius: 12px; padding: 40px 48px; text-align: center;
  box-shadow: var(--shadow); position: relative;
}
/* Bouton × fermeture popup */
.fight-over-close {
  position: absolute; top: 12px; right: 12px;
  background: none; color: var(--muted); border: none;
  font-size: 18px; line-height: 1; padding: 4px 8px;
  border-radius: var(--radius); transition: color .15s, background .15s;
}
.fight-over-close:hover { color: var(--text); background: var(--bg3); }
.fight-over-icon  { font-size: 4em; margin-bottom: 8px; }
.fight-over-title { font-size: 1.8em; font-weight: 900; color: var(--gold); margin-bottom: 8px; }
.fight-over-detail { color: var(--muted); margin-bottom: 24px; font-size: 13px; line-height: 1.6; }
.fight-over-btns {
  display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
}

/* Bannière résumé compacte (quand l'overlay est fermé) */
.fight-summary-bar {
  background: var(--bg3);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
}

/* ── Cartes de sélection de personnage (Arène) ────────────────────── */
.arena-char-grid {
  display: flex; flex-direction: column; gap: 8px;
  max-height: 300px; overflow-y: auto;
  margin-bottom: 4px;
}
.arena-char-card {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--bg3); border: 2px solid var(--border);
  border-radius: 6px; padding: 10px 12px; cursor: pointer;
  transition: border-color .15s, background .15s;
}
.arena-char-card:hover { border-color: var(--gold); background: var(--bg2); }
.arena-char-card.selected {
  border-color: var(--gold); background: var(--bg2);
  box-shadow: 0 0 0 1px var(--gold);
}
.arena-char-card-name { font-weight: 700; font-size: 13px; color: var(--player); }
.arena-char-card-sub  { font-size: 11px; color: var(--muted); }
.arena-char-card-stats {
  display: flex; gap: 10px; font-size: 11px; color: var(--muted);
}
.arena-char-card-stats span { display: flex; align-items: center; gap: 3px; }

/* ═══════════════════════════════════════════════════════════════════
   BESTIAIRE
   ═══════════════════════════════════════════════════════════════════ */
.filter-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.filter-row input  { width: 220px; }
.filter-row select { width: 180px; }

.enemy-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
}
.enemy-card {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 8px; padding: 14px 16px; cursor: pointer;
  transition: border-color .15s;
}
.enemy-card:hover { border-color: var(--gold); }
.enemy-card.expanded { border-color: var(--gold); }
.enemy-card-header { display: flex; justify-content: space-between; align-items: flex-start; }
.enemy-card-name { font-weight: 700; font-size: 1em; color: var(--text); }
.enemy-card-cat  { font-size: 11px; color: var(--muted); margin-top: 2px; }
.enemy-card-stats { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }
.enemy-card-detail {
  margin-top: 12px; padding-top: 12px;
  border-top: 1px solid var(--border); display: none; font-size: 12px;
}
.enemy-card.expanded .enemy-card-detail { display: block; }
.enemy-detail-row { display: flex; gap: 6px; margin-bottom: 4px; }
.enemy-detail-row strong { color: var(--muted); min-width: 80px; }
.attack-chip {
  display: inline-block;
  background: #2a1a1a; border: 1px solid #5a2a2a;
  color: #ef9a9a; border-radius: 4px; padding: 2px 8px; font-size: 11px; margin: 2px;
}
.special-chip {
  display: inline-block;
  background: #1a1a3a; border: 1px solid #2a2a6a;
  color: #9fa8da; border-radius: 4px; padding: 2px 8px; font-size: 11px; margin: 2px;
}

/* ═══════════════════════════════════════════════════════════════════
   HISTORIQUE
   ═══════════════════════════════════════════════════════════════════ */
.history-log {
  background: #08080f; border: 1px solid var(--border);
  border-radius: 6px; padding: 16px; font-family: 'Courier New', monospace;
  font-size: 12px; line-height: 1.8; max-height: 500px; overflow-y: auto;
}

/* ═══════════════════════════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.75); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 20px;
}
.modal-box {
  background: var(--bg2); border: 1px solid var(--border);
  border-radius: 10px; width: 100%; max-width: 680px;
  max-height: 90vh; overflow-y: auto;
  box-shadow: var(--shadow); position: relative; padding: 28px;
}
.modal-close {
  position: absolute; top: 14px; right: 14px;
  background: none; color: var(--muted); border: none;
  font-size: 18px; line-height: 1; padding: 4px 8px;
}
.modal-close:hover { color: var(--text); }

.modal-title    { font-size: 1.5em; font-weight: 700; color: var(--gold); margin-bottom: 4px; }
.modal-subtitle { font-size: 13px; color: var(--muted); margin-bottom: 20px; }
.modal-section  { margin-top: 20px; }
.modal-section h4 {
  font-size: 11px; text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); margin-bottom: 10px;
  border-bottom: 1px solid var(--border); padding-bottom: 4px;
}
.ab-scores-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 8px; }
.ab-score-box {
  background: var(--bg3); border: 1px solid var(--border);
  border-radius: 6px; padding: 10px; text-align: center;
}
.ab-score-box .ab-val { font-size: 1.6em; font-weight: 900; color: var(--text); }
.ab-score-box .ab-lbl { font-size: 10px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.ab-score-box .ab-mod { font-size: 11px; color: var(--gold); }

.combat-history-entry {
  display: flex; gap: 10px; align-items: center;
  padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 12px;
}
.combat-history-entry:last-child { border: none; }

/* ═══════════════════════════════════════════════════════════════════
   TOASTS
   ═══════════════════════════════════════════════════════════════════ */
.toast-area {
  position: fixed; bottom: 20px; right: 20px;
  display: flex; flex-direction: column; gap: 8px; z-index: 300;
}
.toast {
  padding: 11px 18px; border-radius: 6px; font-size: 13px;
  max-width: 320px; box-shadow: var(--shadow);
  transform: translateX(120%); transition: transform .25s ease;
  border-left: 4px solid transparent;
}
.toast.show { transform: none; }
.toast.info    { background: var(--bg3); border-color: var(--gold);    color: var(--text); }
.toast.success { background: #1a3d26;   border-color: var(--success);  color: #a5d6a7; }
.toast.error   { background: #3d1a1a;   border-color: var(--enemy);    color: #ef9a9a; }

/* ═══════════════════════════════════════════════════════════════════
   AUTH — zone header, modales, jauge mdp
   ═══════════════════════════════════════════════════════════════════ */

/* Zone auth (header droite) */
#auth-zone {
  margin-left: auto;
  display: flex; align-items: center; gap: 8px;
  flex-shrink: 0;
}
.user-badge {
  color: var(--gold);
  font-weight: 600;
  font-size: 13px;
  white-space: nowrap;
  padding: 4px 8px;
  background: rgba(201,162,39,.1);
  border-radius: var(--radius);
  border: 1px solid rgba(201,162,39,.3);
}
.btn-sm { padding: 5px 12px; font-size: 12px; }

/* Modale auth */
.auth-modal { max-width: 440px; width: 95%; }
.auth-form h2 { color: var(--gold); margin-bottom: 20px; font-size: 1.25em; }

.auth-form .field { margin-bottom: 14px; }
.auth-form .field label {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .6px;
}
.auth-form .field input {
  width: 100%;
  background: var(--bg3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 9px 12px;
  border-radius: var(--radius);
  font-size: 14px;
  transition: border-color .15s;
}
.auth-form .field input:focus  { outline: none; border-color: var(--gold); }
.auth-form .field input.field-error { border-color: var(--enemy); }

/* Jauge de force du mot de passe */
.pwd-strength { margin-top: 8px; }
.pwd-strength-bar {
  display: flex; gap: 4px; margin-bottom: 5px;
}
.pwd-strength-bar span {
  flex: 1; height: 4px; border-radius: 2px;
  background: var(--border); transition: background .2s;
}
.pwd-strength-bar span.s1 { background: #cc3333; }
.pwd-strength-bar span.s2 { background: #d97706; }
.pwd-strength-bar span.s3 { background: #d97706; }
.pwd-strength-bar span.s4 { background: #3a9a5c; }
.pwd-strength-bar span.s5 { background: #3a9a5c; }

.pwd-strength-label { font-size: 11px; color: var(--muted); font-weight: 600; }

.pwd-rules { margin-top: 6px; display: flex; flex-direction: column; gap: 3px; }
.pwd-rules .rule { font-size: 11px; display: flex; align-items: center; gap: 5px; }
.pwd-rules .rule.ok   { color: #6fcf97; }
.pwd-rules .rule.fail { color: var(--muted); }

/* Messages d'erreur / succès dans la modale */
.auth-msg {
  padding: 8px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  margin-bottom: 14px;
  display: none;
}
.auth-msg.error   { background: rgba(204,51,51,.15); border: 1px solid var(--enemy); color: #ef9a9a; display: block; }
.auth-msg.success { background: rgba(58,154,92,.15);  border: 1px solid var(--success); color: #6fcf97; display: block; }

/* Footer de la modale auth */
.auth-footer {
  margin-top: 16px; text-align: center;
  font-size: 12px; color: var(--muted);
}
.auth-footer a {
  color: var(--gold); cursor: pointer; text-decoration: none;
}
.auth-footer a:hover { text-decoration: underline; }

/* Séparateur */
.auth-sep {
  display: flex; align-items: center; gap: 10px;
  margin: 14px 0; color: var(--muted); font-size: 11px;
}
.auth-sep::before, .auth-sep::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ═══════════════════════════════════════════════════════════════════
   Responsive
   ═══════════════════════════════════════════════════════════════════ */
@media (max-width: 700px) {
  .header-inner { flex-wrap: wrap; height: auto; padding: 10px; gap: 8px; }
  #main-nav { flex-wrap: wrap; justify-content: center; order: 2; width: 100%; }
  #auth-zone { order: 1; margin-left: auto; }
  .nav-btn { padding: 6px 10px; font-size: 12px; }
  .two-col, .abilities-grid, .equip-grid, .setup-grid, .cbt-body, .cbt-header { grid-template-columns: 1fr; }
  .vs-badge { padding-top: 0; }
  .filter-row input, .filter-row select { width: 100%; }
}

/* ═══════════════════════════════════════════════════════════════════
   Profile Panel
   ═══════════════════════════════════════════════════════════════════ */

.profile-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.55);
  z-index: 150;
}
.profile-panel {
  position: fixed;
  top: 0; right: 0;
  width: 380px; max-width: 100vw;
  height: 100vh;
  background: var(--bg2);
  border-left: 2px solid var(--gold);
  z-index: 151;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: -6px 0 24px rgba(0,0,0,.5);
}
.profile-panel.hidden  { display: none !important; }
.profile-overlay.hidden { display: none !important; }

.profile-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.profile-panel-header h3 { color: var(--gold); font-size: 1.05em; }
.profile-panel-close {
  background: none; border: none; color: var(--muted);
  font-size: 18px; cursor: pointer; padding: 4px 8px;
  border-radius: var(--radius); line-height: 1;
}
.profile-panel-close:hover { background: var(--bg3); color: var(--text); }

.profile-tabs {
  display: flex; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
}
.ptab {
  flex: 1; background: none; border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted); padding: 10px 6px;
  font-size: 12px; cursor: pointer; transition: all .15s;
}
.ptab:hover  { color: var(--text); background: var(--bg3); }
.ptab.active { color: var(--gold); border-bottom-color: var(--gold); font-weight: 600; }

.profile-content { flex: 1; overflow-y: auto; padding: 16px 20px; }
.profile-field { margin-bottom: 16px; }
.profile-field label {
  display: block; font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); margin-bottom: 6px;
}
.profile-value { color: var(--text); font-weight: 600; font-size: 14px; }
.profile-empty { color: var(--muted); text-align: center; padding: 32px 0; font-size: 13px; }

/* Characters list */
.profile-char-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px; border-radius: var(--radius);
  cursor: pointer; transition: background .15s; margin-bottom: 4px;
}
.profile-char-row:hover { background: var(--bg3); }
.profile-char-info { flex: 1; min-width: 0; }
.profile-char-info strong { display: block; font-size: 13px; color: var(--text); }
.profile-char-info span   { font-size: 11px; color: var(--muted); }
.profile-char-xp { font-size: 11px; color: var(--muted); white-space: nowrap; flex-shrink: 0; }

/* Fights list */
.profile-fight-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: var(--radius);
  border: 1px solid var(--border); margin-bottom: 6px; background: var(--bg3);
  cursor: pointer; transition: border-color .15s, background .15s;
}
.profile-fight-row:hover { border-color: var(--gold); background: rgba(201,162,39,.08); }
.profile-fight-icon { font-size: 18px; flex-shrink: 0; width: 24px; text-align: center; }
.profile-fight-info { flex: 1; min-width: 0; }
.profile-fight-info strong { display: block; font-size: 13px; color: var(--text); }
.profile-fight-info span   { font-size: 11px; color: var(--muted); }
.profile-fight-meta { text-align: right; font-size: 11px; color: var(--muted); flex-shrink: 0; }
.profile-fight-date { display: block; }

/* user-badge as clickable button */
button.user-badge {
  cursor: pointer;
  transition: background .15s, border-color .15s;
}
button.user-badge:hover {
  background: rgba(201,162,39,.22);
  border-color: var(--gold);
}

/* ═══════════════════════════════════════════════════════════════════
   Fight Intro Animation
   ═══════════════════════════════════════════════════════════════════ */

.fight-intro {
  position: fixed; inset: 0; z-index: 300;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center; gap: 0;
  overflow: hidden;
}
.fight-intro.hidden { display: none !important; }

.fi-fighter {
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  opacity: 0; min-width: 140px;
}
.fi-fighter img, .fi-fighter > div:first-child {
  width: 96px; height: 96px; border-radius: 12px;
  border: 3px solid var(--border);
  object-fit: cover; image-rendering: pixelated;
}
.fi-name { font-size: 16px; font-weight: 700; text-align: center; line-height: 1.2; }
.fi-sub  { font-size: 11px; color: var(--muted); text-align: center; }

.fi-left .fi-name  { color: var(--player); }
.fi-right .fi-name { color: var(--enemy); }
.fi-left img, .fi-left > div:first-child  { border-color: var(--player); }
.fi-right img, .fi-right > div:first-child { border-color: var(--enemy); }

.fi-vs {
  padding: 0 24px; opacity: 0;
}
.fi-vs-text {
  font-size: 42px; font-weight: 900; color: var(--gold);
  text-shadow: 0 0 20px rgba(201,162,39,.5), 0 0 40px rgba(201,162,39,.3);
  letter-spacing: 4px;
}

/* keyframes */
@keyframes fi-slide-left {
  0%   { opacity: 0; transform: translateX(-120px) scale(.8); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes fi-slide-right {
  0%   { opacity: 0; transform: translateX(120px) scale(.8); }
  100% { opacity: 1; transform: translateX(0) scale(1); }
}
@keyframes fi-vs-pop {
  0%   { opacity: 0; transform: scale(0); }
  60%  { opacity: 1; transform: scale(1.3); }
  100% { opacity: 1; transform: scale(1); }
}
@keyframes fi-flash-out {
  0%   { opacity: 1; }
  100% { opacity: 0; transform: scale(1.05); }
}

.fi-left.fi-animate  { animation: fi-slide-left .5s ease-out forwards; }
.fi-right.fi-animate { animation: fi-slide-right .5s ease-out .15s forwards; }
.fi-vs.fi-animate    { animation: fi-vs-pop .4s cubic-bezier(.34,1.56,.64,1) .45s forwards; }
.fight-intro.fi-out  { animation: fi-flash-out .35s ease-in forwards; }

@media (max-width: 500px) {
  .fi-fighter img, .fi-fighter > div:first-child { width: 72px; height: 72px; }
  .fi-name { font-size: 13px; }
  .fi-vs-text { font-size: 28px; }
  .fi-vs { padding: 0 14px; }
}
