/* dragon.css — Le Donjon du Dragon : thème « taverne & profondeurs ».
   Palette : braises (#e0623d), or ancien (#e8c257), pierre sombre (#120c08). */

:root {
  --bg-deep: #120c08;
  --bg-mid: #1d1410;
  --panel: #241a12;
  --panel-2: #2c2016;
  --border: #4a3a26;
  --border-gold: #8a6d35;
  --gold: #e8c257;
  --ember: #e0623d;
  --blood: #c03434;
  --leaf: #57c26b;
  --frost: #4da3ff;
  --arcane: #a97ff2;
  --text: #efe7d5;
  --text-dim: #a89880;
  --parchment: #efe3c2;
  --parchment-ink: #2a2018;
  --shadow: 0 10px 40px rgba(0, 0, 0, 0.55);
}

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

html, body { height: 100%; }

body {
  font-family: Georgia, 'Palatino Linotype', 'Times New Roman', serif;
  color: var(--text);
  background:
    radial-gradient(ellipse 90% 45% at 50% 118%, rgba(224, 98, 61, 0.16) 0%, transparent 60%),
    radial-gradient(ellipse 70% 40% at 50% -12%, #2c1c10 0%, transparent 62%),
    linear-gradient(180deg, var(--bg-mid) 0%, var(--bg-deep) 100%);
  background-attachment: fixed;
  min-height: 100vh;
}

button { font-family: inherit; }
input {
  font-family: inherit;
  background: #171009;
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  font-size: 1rem;
}
input:focus { outline: 2px solid var(--border-gold); outline-offset: 1px; }

.hidden { display: none !important; }

/* ── Écrans ─────────────────────────────────────────────────────────────── */
.screen { display: none; min-height: 100vh; }
.screen.active { display: block; }

.panel {
  background: linear-gradient(180deg, var(--panel-2) 0%, var(--panel) 100%);
  border: 1px solid var(--border-gold);
  border-radius: 14px;
  box-shadow: var(--shadow), inset 0 1px 0 rgba(232, 194, 87, 0.12);
}

/* ── Boutons ────────────────────────────────────────────────────────────── */
.btn {
  cursor: pointer;
  border: 1px solid var(--border-gold);
  border-radius: 10px;
  background: linear-gradient(180deg, #3a2c1c, #2a1e12);
  color: var(--text);
  font-size: 1rem;
  padding: 0.65rem 1.15rem;
  transition: transform 0.08s ease, box-shadow 0.15s ease, filter 0.15s ease;
}
.btn:hover { filter: brightness(1.15); box-shadow: 0 0 14px rgba(232, 194, 87, 0.25); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; filter: none; box-shadow: none; }

.btn-primary {
  background: linear-gradient(180deg, #f0cd6b, #c99b35);
  color: #241503;
  font-weight: bold;
  border-color: #f5dd9a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.25);
}
.btn-ghost { background: transparent; border-color: var(--border); color: var(--text-dim); }
.btn-icon { padding: 0.45rem 0.6rem; font-size: 1.05rem; line-height: 1; }

/* ── Accueil ────────────────────────────────────────────────────────────── */
.home-inner {
  max-width: 560px;
  margin: 0 auto;
  padding: 3.2rem 1.2rem 2rem;
  text-align: center;
}

.home-crest {
  font-size: 4.6rem;
  filter: drop-shadow(0 0 26px rgba(224, 98, 61, 0.65));
  animation: crest-breathe 3.6s ease-in-out infinite;
}
@keyframes crest-breathe {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 18px rgba(224, 98, 61, 0.45)); }
  50% { transform: scale(1.06); filter: drop-shadow(0 0 34px rgba(224, 98, 61, 0.8)); }
}

.game-title {
  font-size: clamp(2.1rem, 7vw, 3.3rem);
  letter-spacing: 0.04em;
  margin-top: 0.4rem;
  background: linear-gradient(180deg, #f7e19a 20%, #c9963a 75%, #8a6d35);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  text-shadow: 0 6px 30px rgba(232, 194, 87, 0.22);
}

.tagline { color: var(--text-dim); font-style: italic; margin: 0.4rem 0 1.6rem; }

.home-box {
  padding: 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  text-align: left;
}
.field { display: flex; flex-direction: column; gap: 0.3rem; font-size: 0.92rem; color: var(--text-dim); }
.join-row { display: flex; gap: 0.6rem; }
.join-row input { width: 7.5rem; text-transform: uppercase; letter-spacing: 0.35em; text-align: center; }
.join-row .btn { flex: 1; }

.lore {
  margin: 1.6rem auto 0;
  max-width: 460px;
  color: var(--text-dim);
  font-size: 0.95rem;
  line-height: 1.55;
}
.lore strong { color: var(--gold); }
.home-footer { margin-top: 1.6rem; color: var(--text-dim); font-size: 0.85rem; }
.hub-link { color: var(--text-dim); }
.hub-link:hover { color: var(--gold); }

/* ── Salon ──────────────────────────────────────────────────────────────── */
.lobby-inner { max-width: 860px; margin: 0 auto; padding: 2.6rem 1.2rem; text-align: center; }
.lobby-title { font-size: 1.9rem; color: var(--gold); }
.lobby-hint { color: var(--text-dim); margin: 0.5rem 0 0.7rem; }
.lobby-code {
  font-size: 2.6rem;
  letter-spacing: 0.5em;
  padding: 0.4rem 0 0.4rem 0.5em;
  color: var(--gold);
  border: 1px dashed var(--border-gold);
  border-radius: 12px;
  max-width: 330px;
  margin: 0 auto 1rem;
  user-select: all;
}
.lobby-players { list-style: none; display: flex; flex-wrap: wrap; gap: 0.6rem; justify-content: center; margin-bottom: 1.4rem; }
.lobby-players li {
  padding: 0.45rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--panel);
  font-size: 0.95rem;
}
.lobby-players .p-host { border-color: var(--gold); }
.lobby-players .p-off { opacity: 0.5; }
.lobby-players .p-cls { color: var(--gold); }

.lobby-sub { margin: 0.4rem 0 0.8rem; color: var(--text-dim); font-weight: normal; letter-spacing: 0.06em; }

.class-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
  gap: 0.8rem;
  margin-bottom: 1.5rem;
}
.class-card {
  cursor: pointer;
  text-align: left;
  padding: 0.9rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  color: var(--text);
  transition: transform 0.1s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
}
.class-card:hover { transform: translateY(-3px); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.5); border-color: var(--cls-color, var(--gold)); }
.class-card.mine { border-color: var(--cls-color, var(--gold)); box-shadow: 0 0 0 2px var(--cls-color, var(--gold)), 0 8px 22px rgba(0,0,0,0.5); }
.class-card.taken { opacity: 0.55; cursor: not-allowed; }
.class-head { display: flex; align-items: center; gap: 0.55rem; }
.class-symbol { font-size: 1.9rem; filter: drop-shadow(0 0 8px var(--cls-color, transparent)); }
.class-name { font-size: 1.15rem; color: var(--cls-color, var(--gold)); }
.class-title { font-size: 0.8rem; color: var(--text-dim); font-style: italic; }
.class-desc { font-size: 0.84rem; color: var(--text-dim); margin-top: 0.5rem; line-height: 1.4; }
.class-stats { display: flex; gap: 0.7rem; margin-top: 0.55rem; font-size: 0.82rem; color: var(--text); }
.class-taken-by { position: absolute; top: 0.5rem; right: 0.6rem; font-size: 0.75rem; color: var(--gold); }

.lobby-buttons { display: flex; gap: 0.8rem; justify-content: center; margin-top: 0.4rem; }
.lobby-note { margin-top: 0.9rem; color: var(--text-dim); font-size: 0.88rem; }

/* ── Barre du haut ──────────────────────────────────────────────────────── */
.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.5rem 0.9rem;
  background: rgba(18, 12, 8, 0.92);
  border-bottom: 1px solid var(--border-gold);
  position: sticky;
  top: 0;
  z-index: 20;
}
.topbar-title { font-size: 1.02rem; color: var(--gold); white-space: nowrap; }
.floor-info { color: var(--text); font-size: 0.95rem; }
.gold-info { color: var(--gold); font-size: 0.95rem; }
.xp-info { color: var(--text-dim); font-size: 0.88rem; }
.topbar-actions { margin-left: auto; display: flex; gap: 0.4rem; }

/* ── Plateau de jeu global ──────────────────────────────────────────────── */
.game-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 0.9rem;
  padding: 0.9rem;
  max-width: 1240px;
  margin: 0 auto;
}

.stage { min-width: 0; }
.view { display: none; animation: view-in 0.35s ease; }
.view.active { display: block; }
@keyframes view-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.stage-title { text-align: center; color: var(--gold); font-size: 1.6rem; margin: 0.6rem 0 0.3rem; }
.ambiance { text-align: center; color: var(--text-dim); font-style: italic; margin-bottom: 1.1rem; }
.stage-hint { text-align: center; color: var(--text-dim); font-size: 0.85rem; margin-top: 1rem; }

/* ── Portes ─────────────────────────────────────────────────────────────── */
.doors { display: flex; gap: 1.1rem; justify-content: center; flex-wrap: wrap; margin-top: 1.4rem; }
.door {
  cursor: pointer;
  width: 200px;
  padding: 1.5rem 1rem 1.1rem;
  border-radius: 100px 100px 14px 14px; /* arche de pierre */
  border: 2px solid var(--border);
  background:
    linear-gradient(180deg, #2e2114 0%, #1d1410 78%),
    radial-gradient(ellipse at 50% 0%, rgba(232, 194, 87, 0.12), transparent 70%);
  color: var(--text);
  text-align: center;
  transition: transform 0.12s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  position: relative;
}
.door:hover { transform: translateY(-5px); border-color: var(--gold); box-shadow: 0 14px 30px rgba(0, 0, 0, 0.55), 0 0 22px rgba(232, 194, 87, 0.22); }
.door.voted-mine { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.door-icon { font-size: 2.7rem; display: block; filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.6)); }
.door-name { display: block; font-size: 1.08rem; color: var(--gold); margin: 0.55rem 0 0.3rem; }
.door-desc { display: block; font-size: 0.82rem; color: var(--text-dim); line-height: 1.35; min-height: 3.2em; }
.door-votes { display: flex; gap: 0.3rem; justify-content: center; margin-top: 0.6rem; min-height: 1.6rem; flex-wrap: wrap; }
.vote-chip {
  width: 1.55rem; height: 1.55rem;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 0.72rem;
  background: var(--cls-color, #555);
  color: #120c08;
  font-weight: bold;
  border: 1px solid rgba(255, 255, 255, 0.35);
}

/* ── Combat ─────────────────────────────────────────────────────────────── */
.combat-head { display: flex; align-items: baseline; justify-content: space-between; margin: 0.2rem 0.2rem 0.45rem; }
.combat-name { color: var(--gold); font-size: 1.2rem; }
.combat-round { color: var(--text-dim); font-size: 0.88rem; }

.initiative {
  display: flex; gap: 0.35rem; align-items: center;
  padding: 0.3rem 0.2rem 0.5rem;
  overflow-x: auto;
}
.init-chip {
  flex: 0 0 auto;
  width: 2.1rem; height: 2.1rem;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.05rem;
  background: #171009;
  border: 2px solid var(--border);
  transition: transform 0.2s ease, border-color 0.2s ease;
  position: relative;
}
.init-chip.hero { border-color: var(--cls-color, var(--border)); }
.init-chip.active { transform: scale(1.22); border-color: var(--gold); box-shadow: 0 0 12px rgba(232, 194, 87, 0.55); }
.init-chip.dead { opacity: 0.3; filter: grayscale(1); }
.init-arrow { color: var(--text-dim); font-size: 0.8rem; flex: 0 0 auto; }

.board-wrap { position: relative; }
#board {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 12px;
  border: 2px solid var(--border-gold);
  box-shadow: var(--shadow);
  cursor: pointer;
  touch-action: manipulation;
}

.board-tip {
  position: absolute;
  pointer-events: none;
  background: rgba(18, 12, 8, 0.95);
  border: 1px solid var(--border-gold);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
  font-size: 0.8rem;
  line-height: 1.4;
  max-width: 230px;
  z-index: 12;
  box-shadow: var(--shadow);
}
.board-tip .tip-name { color: var(--gold); }
.board-tip .tip-line { color: var(--text-dim); }

.turn-banner {
  position: absolute;
  left: 50%; top: 42%;
  transform: translate(-50%, -50%);
  padding: 0.7rem 1.6rem;
  font-size: 1.35rem;
  color: var(--gold);
  background: rgba(18, 12, 8, 0.88);
  border: 1px solid var(--border-gold);
  border-radius: 12px;
  pointer-events: none;
  z-index: 11;
  animation: banner-pop 1.6s ease forwards;
  text-align: center;
  white-space: nowrap;
}
@keyframes banner-pop {
  0% { opacity: 0; transform: translate(-50%, -50%) scale(0.7); }
  12% { opacity: 1; transform: translate(-50%, -50%) scale(1.05); }
  20% { transform: translate(-50%, -50%) scale(1); }
  78% { opacity: 1; }
  100% { opacity: 0; transform: translate(-50%, -56%); }
}

.action-bar {
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
  align-items: stretch;
  margin-top: 0.65rem;
  min-height: 3.4rem;
}
.act-btn {
  cursor: pointer;
  position: relative;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 0.1rem;
  min-width: 4.6rem;
  padding: 0.4rem 0.6rem;
  border-radius: 10px;
  border: 1px solid var(--border-gold);
  background: linear-gradient(180deg, #3a2c1c, #241a12);
  color: var(--text);
  font-size: 0.78rem;
  transition: filter 0.15s ease, transform 0.08s ease, box-shadow 0.2s ease;
}
.act-btn .act-icon { font-size: 1.25rem; line-height: 1; }
.act-btn:hover:not(:disabled) { filter: brightness(1.2); }
.act-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.act-btn.selected { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold), 0 0 16px rgba(232, 194, 87, 0.4); }
.act-btn .cd-badge {
  position: absolute; top: -0.45rem; right: -0.35rem;
  background: var(--blood);
  color: #fff;
  border-radius: 50%;
  width: 1.35rem; height: 1.35rem;
  font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid #7d1f1f;
}
.act-btn.endturn { margin-left: auto; border-color: var(--border); background: linear-gradient(180deg, #2c2016, #1d1410); }
.action-note {
  width: 100%;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.85rem;
  font-style: italic;
  align-self: center;
  padding: 0.6rem 0;
}

/* ── Parchemin des événements ──────────────────────────────────────────── */
.parchment {
  max-width: 620px;
  margin: 1.2rem auto;
  background:
    radial-gradient(ellipse at 18% 8%, rgba(140, 100, 40, 0.16), transparent 55%),
    radial-gradient(ellipse at 85% 92%, rgba(140, 100, 40, 0.2), transparent 55%),
    linear-gradient(180deg, #f2e6c8, #e6d5ab);
  color: var(--parchment-ink);
  border-radius: 8px 22px 10px 26px;
  padding: 1.9rem 2rem;
  box-shadow: var(--shadow), inset 0 0 60px rgba(120, 84, 30, 0.22);
  text-align: center;
  position: relative;
}
.event-icon { font-size: 3rem; }
.event-title { font-size: 1.65rem; margin: 0.45rem 0 0.6rem; color: #4c3312; }
.event-text { font-size: 1.03rem; line-height: 1.6; font-style: italic; color: #43331c; }
.event-scout { margin-top: 0.9rem; font-size: 0.92rem; color: #6b5330; }
.event-scout strong { color: #4c3312; }
.event-choices { display: flex; flex-direction: column; gap: 0.55rem; margin-top: 1rem; }
.event-choice {
  cursor: pointer;
  padding: 0.7rem 1rem;
  border-radius: 10px;
  border: 1.5px solid #a3854e;
  background: linear-gradient(180deg, #efe0bc, #e2cf9f);
  color: var(--parchment-ink);
  font-size: 0.98rem;
  font-family: inherit;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
  text-align: left;
  display: flex; justify-content: space-between; gap: 0.7rem; align-items: center;
}
.event-choice:hover:not(:disabled) { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(76, 51, 18, 0.35); }
.event-choice:disabled { opacity: 0.55; cursor: not-allowed; }
.choice-check { font-size: 0.8rem; color: #8a6018; white-space: nowrap; }
.event-result {
  margin-top: 1.1rem;
  padding: 0.9rem 1rem;
  border-top: 1px dashed #a3854e;
  font-size: 1rem;
  font-style: italic;
  color: #43331c;
  animation: view-in 0.4s ease;
}
.event-result.res-success { color: #3d5c22; }
.event-result.res-failure { color: #7d2e1c; }

/* ── Feu de camp ────────────────────────────────────────────────────────── */
.camp-options { display: flex; gap: 1rem; justify-content: center; flex-wrap: wrap; margin-top: 1rem; }
.camp-card {
  cursor: pointer;
  width: 230px;
  padding: 1.3rem 1rem;
  border-radius: 14px;
  border: 1px solid var(--border-gold);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  color: var(--text);
  display: flex; flex-direction: column; align-items: center; gap: 0.35rem;
  transition: transform 0.12s ease, box-shadow 0.25s ease;
}
.camp-card:hover:not(:disabled) { transform: translateY(-4px); box-shadow: 0 12px 26px rgba(0,0,0,0.5), 0 0 18px rgba(232,194,87,0.2); }
.camp-card:disabled { opacity: 0.5; cursor: not-allowed; }
.camp-card.chosen { border-color: var(--gold); box-shadow: 0 0 0 2px var(--gold); }
.camp-icon { font-size: 2.4rem; }
.camp-name { font-size: 1.15rem; color: var(--gold); }
.camp-desc { font-size: 0.85rem; color: var(--text-dim); }
.camp-status { list-style: none; margin: 1.3rem auto 0; max-width: 380px; text-align: left; }
.camp-status li { padding: 0.3rem 0.2rem; color: var(--text-dim); font-size: 0.92rem; border-bottom: 1px solid rgba(74, 58, 38, 0.4); }
.camp-status .done { color: var(--text); }

/* ── Boutique ───────────────────────────────────────────────────────────── */
.shop-stock {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.7rem;
  margin-top: 0.9rem;
}
.shop-item {
  position: relative;
  padding: 0.8rem 0.85rem;
  border-radius: 12px;
  border: 1px solid var(--rarity, var(--border));
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  display: flex; flex-direction: column; gap: 0.3rem;
}
.shop-item.sold { opacity: 0.4; }
.shop-item .it-head { display: flex; align-items: center; gap: 0.5rem; }
.shop-item .it-icon { font-size: 1.5rem; }
.shop-item .it-name { color: var(--rarity, var(--text)); font-size: 0.98rem; }
.shop-item .it-desc { color: var(--text-dim); font-size: 0.8rem; line-height: 1.35; min-height: 2.4em; }
.shop-item .it-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 0.25rem; }
.shop-item .it-price { color: var(--gold); font-size: 0.95rem; }
.shop-item .btn { padding: 0.35rem 0.8rem; font-size: 0.85rem; }
.hero-pick {
  position: absolute; inset: 0;
  background: rgba(18, 12, 8, 0.96);
  border-radius: 12px;
  display: flex; flex-direction: column; gap: 0.35rem;
  align-items: stretch; justify-content: center;
  padding: 0.7rem;
  z-index: 5;
}
.hero-pick .btn { font-size: 0.85rem; padding: 0.4rem 0.6rem; }
.shop-footer { display: flex; align-items: center; gap: 0.9rem; justify-content: center; margin-top: 1.3rem; flex-wrap: wrap; }
.shop-ready-note { color: var(--text-dim); font-size: 0.88rem; }

/* ── Colonne latérale ──────────────────────────────────────────────────── */
.sidebar {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  min-width: 0;
}

.party { display: flex; flex-direction: column; gap: 0.45rem; }
.hero-frame {
  display: grid;
  grid-template-columns: 3rem 1fr;
  gap: 0.15rem 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel-2), var(--panel));
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}
.hero-frame:hover { border-color: var(--border-gold); }
.hero-frame.active-turn { border-color: var(--gold); box-shadow: 0 0 10px rgba(232, 194, 87, 0.4); animation: frame-pulse 1.6s ease-in-out infinite; }
@keyframes frame-pulse {
  0%, 100% { box-shadow: 0 0 8px rgba(232, 194, 87, 0.3); }
  50% { box-shadow: 0 0 18px rgba(232, 194, 87, 0.6); }
}
.hero-frame.is-ko { filter: grayscale(0.8); }
.hero-portrait {
  grid-row: span 2;
  width: 3rem; height: 3rem;
  border-radius: 50%;
  border: 2.5px solid var(--cls-color, var(--border));
  display: flex; align-items: center; justify-content: center;
  font-size: 1.5rem;
  background: radial-gradient(circle at 35% 30%, #3a2c1c, #171009);
  align-self: center;
  position: relative;
}
.hero-portrait .ko-mark { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1.3rem; background: rgba(0,0,0,0.55); border-radius: 50%; }
.hero-head { display: flex; align-items: baseline; gap: 0.45rem; min-width: 0; }
.hero-name { font-size: 0.95rem; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hero-cls { font-size: 0.75rem; color: var(--cls-color, var(--text-dim)); white-space: nowrap; }
.hero-off { font-size: 0.75rem; }
.hero-bars { display: flex; flex-direction: column; gap: 0.22rem; }
.hp-bar { height: 0.62rem; border-radius: 5px; background: #171009; border: 1px solid #3a2c1c; overflow: hidden; }
.hp-fill { height: 100%; border-radius: 4px; background: linear-gradient(90deg, #63c96b, #2e9e4f); transition: width 0.45s ease, background 0.3s ease; }
.hp-fill.low { background: linear-gradient(90deg, #e0a23d, #c97a35); }
.hp-fill.crit { background: linear-gradient(90deg, #e05c3d, #b03024); }
.hero-sub { display: flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; color: var(--text-dim); min-height: 1rem; flex-wrap: wrap; }
.hero-conds { letter-spacing: 0.1em; }
.talent-alert {
  position: absolute; top: -0.4rem; right: -0.3rem;
  background: var(--gold); color: #241503;
  font-size: 0.68rem; font-weight: bold;
  border-radius: 999px;
  padding: 0.12rem 0.45rem;
  animation: frame-pulse 1.4s ease-in-out infinite;
}

.log-title { color: var(--text-dim); font-size: 0.85rem; letter-spacing: 0.08em; margin-top: 0.2rem; }
.log {
  flex: 1;
  min-height: 180px;
  max-height: 46vh;
  overflow-y: auto;
  background: rgba(23, 16, 9, 0.85);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  font-size: 0.83rem;
  line-height: 1.45;
}
.log p { margin-bottom: 0.28rem; color: var(--text-dim); }
.log p strong { color: var(--text); }
.log .l-major { color: var(--gold); margin: 0.4rem 0 0.3rem; }
.log .l-chat { color: var(--text); }
.log .l-chat .chat-name { color: var(--gold); }
.log .l-crit { color: #f0cd6b; }
.log .l-bad { color: #e08573; }
.log .l-good { color: #7fd68a; }

.chat-row { display: flex; gap: 0.4rem; }
.chat-row input { flex: 1; font-size: 0.88rem; padding: 0.45rem 0.6rem; }

/* ── Dés ────────────────────────────────────────────────────────────────── */
.dice-layer {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  background: radial-gradient(ellipse at center, rgba(10, 6, 3, 0.55), rgba(10, 6, 3, 0.25) 70%, transparent);
}
.dice-box { text-align: center; animation: view-in 0.18s ease; }
.dice-label { font-size: 1.15rem; color: var(--text); text-shadow: 0 2px 10px #000; margin-bottom: 0.5rem; }
.dice-label .dl-who { color: var(--gold); }

.d20 { position: relative; width: 130px; height: 130px; margin: 0 auto; }
.d20 svg { width: 100%; height: 100%; overflow: visible; }
.d20-shape {
  fill: url(#d20grad);
  fill: #3a2c1c;
  stroke: var(--gold);
  stroke-width: 3;
  filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.7));
  transition: stroke 0.15s ease, fill 0.15s ease;
}
.d20-inner { fill: none; stroke: rgba(232, 194, 87, 0.45); stroke-width: 1.5; }
.dice-num {
  position: absolute;
  inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 2.9rem;
  font-weight: bold;
  color: var(--text);
  text-shadow: 0 2px 8px #000;
}
.d20.rolling { animation: dice-roll 0.12s linear infinite; }
@keyframes dice-roll {
  0% { transform: rotate(-9deg) translate(-3px, 1px); }
  25% { transform: rotate(6deg) translate(3px, -2px); }
  50% { transform: rotate(-5deg) translate(-2px, 2px); }
  75% { transform: rotate(8deg) translate(2px, 1px); }
  100% { transform: rotate(-9deg) translate(-3px, 1px); }
}
.d20.out-crit .d20-shape { stroke: #ffe89a; fill: #7d5a12; }
.d20.out-crit { animation: crit-burst 0.5s ease; filter: drop-shadow(0 0 30px rgba(240, 205, 107, 0.95)); }
@keyframes crit-burst {
  0% { transform: scale(1); }
  40% { transform: scale(1.35); }
  100% { transform: scale(1); }
}
.d20.out-fumble .d20-shape { stroke: #e05c3d; fill: #571d12; }
.d20.out-fumble { animation: fumble-shake 0.4s ease; }
@keyframes fumble-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-7px); }
  50% { transform: translateX(6px); }
  75% { transform: translateX(-4px); }
}
.d20.out-hit .d20-shape, .d20.out-success .d20-shape { stroke: #7fd68a; }
.d20.out-miss .d20-shape, .d20.out-failure .d20-shape { stroke: #8a8a8a; fill: #241a12; }

.dice-detail { margin-top: 0.55rem; font-size: 1rem; color: var(--text-dim); text-shadow: 0 2px 8px #000; }
.dice-verdict { font-size: 1.35rem; margin-top: 0.25rem; text-shadow: 0 2px 10px #000; min-height: 1.7rem; }
.dice-verdict.v-crit { color: #ffe89a; font-size: 1.6rem; }
.dice-verdict.v-hit, .dice-verdict.v-success { color: #7fd68a; }
.dice-verdict.v-miss, .dice-verdict.v-failure { color: #b9aa90; }
.dice-verdict.v-fumble { color: #e05c3d; }

/* ── Fin de partie / modales ────────────────────────────────────────────── */
.overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(8, 5, 3, 0.82);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  overflow-y: auto;
}
.end-box { max-width: 560px; width: 100%; text-align: center; padding: 1.8rem 1.6rem; animation: view-in 0.4s ease; }
.end-crest { font-size: 3.6rem; }
.end-title { font-size: 1.9rem; color: var(--gold); margin: 0.5rem 0 0.4rem; }
.end-sub { color: var(--text-dim); margin-bottom: 1rem; }
.end-stats { margin: 0.8rem 0 1.2rem; }
.end-stats table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.end-stats th, .end-stats td { padding: 0.4rem 0.45rem; border-bottom: 1px solid rgba(74, 58, 38, 0.5); text-align: center; }
.end-stats th { color: var(--text-dim); font-weight: normal; font-size: 0.78rem; }
.end-stats td:first-child { text-align: left; }
.end-stats .mvp { color: var(--gold); }
.end-run-stats { display: flex; justify-content: center; gap: 1.3rem; margin-top: 0.8rem; color: var(--text-dim); font-size: 0.88rem; flex-wrap: wrap; }
.end-run-stats strong { color: var(--text); }

.sheet-box, .help-box {
  max-width: 640px;
  width: 100%;
  max-height: 88vh;
  overflow-y: auto;
  padding: 1.5rem 1.4rem;
  text-align: left;
}
.help-title { color: var(--gold); text-align: center; margin-bottom: 0.9rem; }
.help-content h3 { color: var(--gold); margin: 1.1rem 0 0.4rem; font-size: 1.05rem; }
.help-content p, .help-content li { color: var(--text-dim); font-size: 0.9rem; line-height: 1.5; }
.help-content ul { padding-left: 1.2rem; }
.help-content strong { color: var(--text); }
.help-content .h-cls { color: var(--cls-color, var(--gold)); }
.help-box .btn, .sheet-box .btn { display: block; margin: 1.1rem auto 0; }

/* fiche de héros */
.sheet-head { display: flex; align-items: center; gap: 0.9rem; margin-bottom: 0.7rem; }
.sheet-portrait { font-size: 2.6rem; filter: drop-shadow(0 0 12px var(--cls-color, transparent)); }
.sheet-name { font-size: 1.4rem; color: var(--text); }
.sheet-cls { color: var(--cls-color, var(--gold)); font-size: 0.95rem; }
.sheet-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 0.45rem; margin: 0.7rem 0; }
.sheet-stat {
  background: rgba(23, 16, 9, 0.7);
  border: 1px solid var(--border);
  border-radius: 9px;
  padding: 0.45rem 0.55rem;
  text-align: center;
}
.sheet-stat .ss-label { display: block; font-size: 0.7rem; color: var(--text-dim); letter-spacing: 0.06em; }
.sheet-stat .ss-val { font-size: 1.12rem; color: var(--text); }
.sheet-section { margin-top: 0.9rem; }
.sheet-section h4 { color: var(--gold); font-size: 0.95rem; margin-bottom: 0.4rem; }
.sheet-skill { display: flex; gap: 0.55rem; padding: 0.4rem 0.2rem; border-bottom: 1px solid rgba(74, 58, 38, 0.4); font-size: 0.86rem; }
.sheet-skill .sk-icon { font-size: 1.2rem; }
.sheet-skill .sk-name { color: var(--text); }
.sheet-skill .sk-desc { color: var(--text-dim); }
.sheet-items { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.sheet-chip {
  border: 1px solid var(--rarity, var(--border));
  color: var(--rarity, var(--text-dim));
  border-radius: 999px;
  padding: 0.25rem 0.7rem;
  font-size: 0.82rem;
}
.talent-pick { border: 1px solid var(--gold); border-radius: 12px; padding: 0.8rem; margin-top: 0.7rem; background: rgba(232, 194, 87, 0.06); }
.talent-pick h4 { color: var(--gold); margin-bottom: 0.5rem; }
.talent-options { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.talent-btn {
  flex: 1 1 180px;
  cursor: pointer;
  padding: 0.65rem 0.8rem;
  border-radius: 10px;
  border: 1px solid var(--border-gold);
  background: linear-gradient(180deg, #3a2c1c, #241a12);
  color: var(--text);
  text-align: left;
  font-size: 0.86rem;
  transition: transform 0.1s ease, box-shadow 0.2s ease;
}
.talent-btn:hover { transform: translateY(-2px); box-shadow: 0 0 14px rgba(232, 194, 87, 0.3); }
.talent-btn .t-name { color: var(--gold); display: block; margin-bottom: 0.15rem; }

/* ── Toasts ─────────────────────────────────────────────────────────────── */
.toasts {
  position: fixed;
  top: 3.4rem;
  left: 50%;
  transform: translateX(-50%);
  z-index: 70;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  align-items: center;
  pointer-events: none;
}
.toast {
  background: rgba(18, 12, 8, 0.95);
  border: 1px solid var(--border-gold);
  color: var(--text);
  border-radius: 10px;
  padding: 0.5rem 1rem;
  font-size: 0.92rem;
  box-shadow: var(--shadow);
  animation: toast-in 0.25s ease;
  max-width: min(92vw, 480px);
  text-align: center;
}
.toast.t-err { border-color: var(--blood); color: #f0b9a9; }
.toast.t-gold { border-color: var(--gold); color: var(--gold); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-8px); } to { opacity: 1; transform: none; } }
.toast.hide { transition: opacity 0.4s ease; opacity: 0; }

/* ── Responsive ─────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .game-wrap { grid-template-columns: 1fr; }
  .sidebar { order: 2; }
  .log { max-height: 30vh; min-height: 120px; }
  .party { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .topbar { flex-wrap: wrap; gap: 0.4rem 0.8rem; }
  .topbar-name { display: none; }
}
@media (max-width: 560px) {
  .door { width: 46%; min-width: 150px; }
  .camp-card { width: 100%; }
  .dice-label { font-size: 0.98rem; }
  .d20 { width: 100px; height: 100px; }
  .dice-num { font-size: 2.3rem; }
}
