/* Icespire Table — thème sombre, mobile d'abord */
:root {
  --bg: #0f1218;
  --bg-2: #161a23;
  --panel: #1b202b;
  --panel-2: #222836;
  --line: #2e3647;
  --text: #e8ecf3;
  --muted: #9aa5b8;
  --faint: #6c7689;
  --accent: #8fd3ff;
  --accent-2: #5aa9e6;
  --accent-ink: #06202f;
  --good: #6fd08c;
  --warn: #f2c14e;
  --bad: #f0706a;
  --magic: #b79cff;
  --read-bg: #2a2418;
  --read-line: #c9a35b;
  --read-ink: #f3e6c8;
  --secret-bg: #23182a;
  --secret-line: #9b6bd6;
  --radius: 12px;
  --radius-s: 8px;
  --shadow: 0 6px 24px rgba(0, 0, 0, .35);
  --tap: 44px;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --serif: Georgia, "Times New Roman", serif;
  --fs: 16px;
  color-scheme: dark;
}
:root[data-text="grand"] { --fs: 18px; }
:root[data-text="tres-grand"] { --fs: 20px; }

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font: var(--fs)/1.45 var(--font); }
body { min-height: 100dvh; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
a { color: var(--accent); }
h1, h2, h3, h4 { margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 1.5rem; } h2 { font-size: 1.25rem; } h3 { font-size: 1.08rem; } h4 { font-size: .95rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }
p { margin: 0 0 .7em; }
small, .small { font-size: .85em; }
.muted { color: var(--muted); } .faint { color: var(--faint); }
.good { color: var(--good); } .bad { color: var(--bad); } .warn { color: var(--warn); } .magic { color: var(--magic); }
.hidden { display: none !important; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.nowrap { flex-wrap: nowrap; }
.col { display: flex; flex-direction: column; gap: 8px; }
.grow { flex: 1 1 auto; min-width: 0; }
.right { margin-left: auto; }
.center { text-align: center; }
.grid2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.grid3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px; }
.sep { height: 1px; background: var(--line); margin: 12px 0; border: 0; }
.boot { padding: 40px 16px; text-align: center; color: var(--muted); }
.scroll { overflow: auto; -webkit-overflow-scrolling: touch; }
kbd { background: var(--panel-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; font-size: .85em; }

/* Boutons */
button, .btn { font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-s);
  min-height: var(--tap); padding: 8px 14px; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  text-decoration: none; touch-action: manipulation; user-select: none; }
button:hover, .btn:hover { border-color: #46516a; }
button:active, .btn:active { transform: translateY(1px); }
button:disabled, .btn.disabled { opacity: .45; cursor: not-allowed; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn-primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 650; }
.btn-primary:hover { background: #a8ddff; }
.btn-good { background: #1f3b2a; border-color: #2f6b45; color: #bff0cf; }
.btn-bad { background: #3b1f22; border-color: #7a3036; color: #ffd0cc; }
.btn-warn { background: #3a3119; border-color: #7a6427; color: #ffe7a8; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--panel-2); }
.btn-small { min-height: 34px; padding: 4px 10px; font-size: .9em; }
.btn-big { min-height: 56px; font-size: 1.1em; padding: 10px 20px; }
.btn-block { width: 100%; }
.btn.on, button.on { background: #24384a; border-color: var(--accent-2); color: var(--accent); }
.icon-btn { min-width: var(--tap); padding: 6px; }

/* Champs */
input, select, textarea { font: inherit; color: var(--text); background: var(--bg-2); border: 1px solid var(--line); border-radius: var(--radius-s);
  min-height: var(--tap); padding: 8px 10px; width: 100%; }
textarea { min-height: 90px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 22px; height: 22px; min-height: 0; accent-color: var(--accent); }
input[type="range"] { padding: 0; accent-color: var(--accent); }
label { display: block; }
.field { display: flex; flex-direction: column; gap: 4px; margin-bottom: 10px; }
.field > span { font-size: .85em; color: var(--muted); }
.check { display: flex; align-items: center; gap: 8px; min-height: var(--tap); cursor: pointer; }

/* Panneaux */
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.panel + .panel { margin-top: 12px; }
.panel.tight { padding: 10px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.card.selectable { cursor: pointer; }
.card.selected { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.card h3 { margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 2px 9px; border-radius: 999px; background: var(--panel-2); border: 1px solid var(--line); font-size: .82em; white-space: nowrap; }
.chip.cond { background: #2b2233; border-color: #5d4373; }
.chip.good { background: #1d3326; border-color: #2f6b45; color: #bff0cf; }
.chip.bad { background: #3a1e21; border-color: #7a3036; color: #ffd0cc; }
.chip.warn { background: #382f17; border-color: #7a6427; color: #ffe7a8; }
.chip button { min-height: 0; padding: 0 0 0 4px; border: 0; background: none; }
.badge { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--bad); color: #fff; font-size: .75em; text-align: center; }

/* Encadrés « À lire » et « Secret » */
.read { background: var(--read-bg); border-left: 4px solid var(--read-line); color: var(--read-ink); border-radius: 0 var(--radius-s) var(--radius-s) 0;
  padding: 12px 14px; font-family: var(--serif); font-size: 1.05em; position: relative; margin: 8px 0; }
.read::before { content: "À LIRE AUX JOUEURS"; display: block; font: 700 .7rem var(--font); letter-spacing: .08em; color: var(--read-line); margin-bottom: 4px; }
.secret { background: var(--secret-bg); border-left: 4px solid var(--secret-line); border-radius: 0 var(--radius-s) var(--radius-s) 0; padding: 10px 14px; margin: 8px 0; }
.secret::before { content: "🔒 POUR LE MJ SEULEMENT"; display: block; font: 700 .7rem var(--font); letter-spacing: .08em; color: var(--secret-line); margin-bottom: 4px; }
.page-check { list-style: none; margin: 6px 0 0; padding: 0; font-weight: 400; }
.page-check li { padding: 3px 0 3px 8px; border-left: 3px solid var(--line, #555); margin: 3px 0; }
.page-check li.stop { border-left-color: var(--bad); }
.page-check li.warn { border-left-color: var(--warn, #d9a441); }
.page-check li .btn-small { padding: 0 6px; min-height: 0; }
.page-check.ok { margin-top: 6px; }
.danger-box { background: #2c1a1b; border-left: 4px solid var(--bad); padding: 8px 12px; border-radius: 0 var(--radius-s) var(--radius-s) 0; margin: 6px 0; }
.tip-box { background: #172532; border-left: 4px solid var(--accent-2); padding: 8px 12px; border-radius: 0 var(--radius-s) var(--radius-s) 0; margin: 6px 0; }

/* Bandeau « Maintenant » */
.now { background: linear-gradient(135deg, #18324a, #1b2333); border: 1px solid #2c5577; border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; }
.now h2 { font-size: .8rem; letter-spacing: .1em; text-transform: uppercase; color: var(--accent); margin: 0 0 6px; }
.now-item { display: flex; gap: 10px; align-items: flex-start; padding: 6px 0; border-top: 1px solid rgba(143, 211, 255, .12); }
.now-item:first-of-type { border-top: 0; }
.now-item .now-text { flex: 1 1 auto; }
.now-item .now-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.now.compact { padding: 6px 10px 6px 12px; margin-bottom: 8px; display: flex; align-items: center; gap: 12px; }
.now.compact h2 { margin: 0; flex: none; }
.now.compact .now-text { flex: 1 1 auto; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.now.compact .now-text:hover { color: #fff; }
.now.compact .now-actions { display: flex; gap: 6px; flex: none; flex-wrap: nowrap; align-items: center; }
@media (max-width: 900px) { .now.compact { flex-wrap: wrap; } .now.compact .now-text { flex-basis: 100%; white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; } }

/* Coquille MJ */
.gm-shell { display: grid; grid-template-columns: 220px 1fr; min-height: 100dvh; }
.gm-nav { background: var(--bg-2); border-right: 1px solid var(--line); padding: 10px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100dvh; overflow: auto; }
.amb-box { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; border-top: 1px solid var(--line); }
.amb-box select { min-height: 32px; padding: 2px 6px; font-size: .85rem; margin-top: 2px; }
.amb-box input[type=range] { width: 100%; }
.gm-nav .brand { font-weight: 800; letter-spacing: .02em; padding: 6px 8px 12px; }
.gm-nav .brand small { display: block; color: var(--muted); font-weight: 400; }
.gm-nav button { justify-content: flex-start; background: transparent; border-color: transparent; width: 100%; }
.gm-nav button.on { background: #1f2c3b; border-color: #2c5577; color: var(--accent); }
.gm-main { padding: 14px; min-width: 0; }
.gm-top { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 10px; }
.gm-two { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); gap: 12px; align-items: start; }
@media (max-width: 900px) {
  .gm-shell { grid-template-columns: 1fr; }
  .gm-nav { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 6px; }
  .gm-nav .brand { display: none; }
  .gm-nav button { width: auto; white-space: nowrap; }
  .gm-two { grid-template-columns: 1fr; }
}

/* Coquille joueur */
.pl-shell { display: flex; flex-direction: column; min-height: 100dvh; padding-bottom: calc(68px + env(safe-area-inset-bottom)); }
.pl-top { position: sticky; top: 0; z-index: 15; background: rgba(15, 18, 24, .96); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line);
  padding: 8px 12px calc(8px) 12px; padding-top: calc(8px + env(safe-area-inset-top)); display: flex; gap: 10px; align-items: center; }
.pl-top .who { flex: 1 1 auto; min-width: 0; }
.pl-top .who b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pl-main { padding: 12px; flex: 1 1 auto; max-width: 860px; width: 100%; margin: 0 auto; }
.pl-tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 15; display: grid; grid-template-columns: repeat(5, 1fr); background: #12161e; border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom); }
.pl-tabs button { border: 0; border-radius: 0; background: transparent; flex-direction: column; gap: 2px; min-height: 60px; font-size: .75rem; color: var(--muted); position: relative; }
.pl-tabs button .ico { font-size: 1.35rem; line-height: 1; }
.pl-tabs button.on { color: var(--accent); }
.pl-tabs button .badge { position: absolute; top: 6px; right: 22%; }
/* PC : les onglets Jeu / Fiche / Journal passent en haut, sous la barre du personnage (pas une barre de téléphone). */
@media (min-width: 900px) {
  .pl-shell { padding-bottom: 0; }
  .pl-top { order: 0; }
  .pl-tabs { order: 1; position: sticky; top: 49px; bottom: auto; display: flex; justify-content: center; gap: 4px; padding: 4px 12px;
    border-top: 0; border-bottom: 1px solid var(--line); background: rgba(15, 18, 24, .96); }
  .pl-tabs button { flex-direction: row; gap: 6px; min-height: 32px; padding: 4px 18px; font-size: .9rem; border-radius: var(--radius-s); }
  .pl-tabs button .ico { font-size: 1rem; }
  .pl-tabs button.on { background: rgba(143, 211, 255, .12); }
  .pl-tabs button .badge { position: static; }
  .pl-switch { order: 1; }
  .pl-main { order: 2; }
}
.turn-banner { background: linear-gradient(90deg, #4a3712, #2b2410); border: 1px solid #a0802e; color: #ffe7a8; border-radius: var(--radius); padding: 10px 12px; margin-bottom: 10px; font-weight: 650;
  animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 4px rgba(242, 193, 78, .18); } }

/* PV, pips */
.hpbar { height: 10px; border-radius: 6px; background: #2a2f3b; overflow: hidden; position: relative; }
.hpbar > i { position: absolute; inset: 0 auto 0 0; background: linear-gradient(90deg, #4cc276, #6fd08c); border-radius: 6px; transition: width .3s; }
.hpbar.mid > i { background: linear-gradient(90deg, #d8a53a, #f2c14e); }
.hpbar.low > i { background: linear-gradient(90deg, #c94a45, #f0706a); }
.hpbar > b { position: absolute; inset: 0 0 0 auto; background: rgba(143, 211, 255, .45); }
.pips { display: inline-flex; gap: 4px; }
.pip { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--accent-2); display: inline-block; }
.pip.full { background: var(--accent-2); }
.pip.used { border-color: var(--faint); background: transparent; opacity: .5; }
.econ { display: flex; gap: 6px; flex-wrap: wrap; }
.econ .chip.on { background: #1f3b2a; border-color: #2f6b45; color: #bff0cf; }
.econ .chip.off { opacity: .45; text-decoration: line-through; }

/* Fiche */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(84px, 1fr)); gap: 8px; }
.stat { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px; text-align: center; cursor: pointer; min-height: 70px; }
.stat .k { font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.stat .v { font-size: 1.5rem; font-weight: 750; line-height: 1.2; }
.stat .s { font-size: .78rem; color: var(--muted); }
.stat.static { cursor: default; }
.list { display: flex; flex-direction: column; }
.list > .li { display: flex; align-items: center; gap: 8px; padding: 8px 4px; border-bottom: 1px solid var(--line); min-height: var(--tap); }
.list > .li:last-child { border-bottom: 0; }
.li.clickable { cursor: pointer; }
.li.clickable:hover { background: rgba(255, 255, 255, .02); }
.li .mod { min-width: 44px; text-align: center; font-weight: 700; background: var(--panel-2); border-radius: 6px; padding: 4px 6px; }
.li .prof { color: var(--accent); }
.skills-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 0 14px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 10px; padding-bottom: 2px; }
.tabs button { white-space: nowrap; }

/* Bloc de stats de monstre */
.statblock { background: #1e1a14; border: 1px solid #5d4a2b; border-radius: var(--radius); padding: 12px; color: #efe3c9; }
.statblock h3 { color: #f2c98a; margin-bottom: 2px; }
.statblock .sb-line { font-size: .9em; }
.statblock .sb-abil { display: grid; grid-template-columns: repeat(6, 1fr); text-align: center; gap: 4px; margin: 8px 0; font-size: .85em; }
.statblock .sb-abil b { display: block; color: #f2c98a; font-size: .75em; }
.statblock .act { padding: 6px 0; border-top: 1px dashed #4a3d27; }
.statblock .act b { color: #f2c98a; }

/* Initiative */
.init-list { display: flex; flex-direction: column; gap: 6px; }
.init-row { display: grid; grid-template-columns: 34px 1fr auto; gap: 8px; align-items: center; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 6px 8px; cursor: pointer; }
.init-row.current { border-color: var(--warn); box-shadow: 0 0 0 1px var(--warn) inset; background: #2b2615; }
.init-row.dead { opacity: .45; }
.init-row .ini { font-weight: 800; text-align: center; color: var(--muted); }
.token-dot { width: 14px; height: 14px; border-radius: 50%; display: inline-block; vertical-align: middle; border: 2px solid rgba(0, 0, 0, .4); }

/* Modale */
.modal-back { position: fixed; inset: 0; background: rgba(5, 7, 10, .72); z-index: 60; display: flex; align-items: flex-end; justify-content: center; padding: 10px; }
@media (min-width: 700px) { .modal-back { align-items: center; } }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 16px; width: min(560px, 100%); max-height: 88dvh; overflow: auto; padding: 16px; box-shadow: var(--shadow); }
.modal.wide { width: min(900px, 100%); }
.modal h2 { margin-top: 0; }
.modal .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 12px; flex-wrap: wrap; }

/* Notifications */
.fog-sw .sw { display: inline-block; width: 12px; height: 12px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; border: 1px solid rgba(255, 255, 255, .35); }
.fog-row input[type=color] { width: 34px; height: 26px; padding: 0; border: 1px solid var(--line); background: none; }
table.keys td { padding: 4px 10px 4px 0; vertical-align: top; }
table.keys kbd { display: inline-block; min-width: 1.6em; text-align: center; padding: 1px 6px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; background: var(--panel-2); font: 600 .9em system-ui, sans-serif; }
.bag-head { margin: 8px 0 2px; font-weight: 700; color: var(--muted, #9aa3b2); border-bottom: 1px solid var(--line); padding-bottom: 2px; }
#tour { position: fixed; inset: 0; z-index: 88; pointer-events: none; }
#tour .tour-ring { position: fixed; border: 3px solid #f2c14e; border-radius: 10px; box-shadow: 0 0 0 9999px rgba(4, 6, 10, .55); transition: all .25s ease; }
#tour .tour-bubble { position: fixed; pointer-events: auto; background: var(--panel); border: 1px solid #f2c14e; border-radius: var(--radius-s); box-shadow: var(--shadow); padding: 12px 14px; max-width: calc(100vw - 32px); }
#tour .tour-bubble h3 { margin: 2px 0 6px; }
#tour .tour-bubble p { margin: 0 0 8px; }
#tour .tour-practice { font-weight: 700; color: #f2c14e; }
#tour .tour-practice.ok { color: var(--good); }
#tour .tour-actions { gap: 6px; }
@media (prefers-reduced-motion: reduce) { #tour .tour-ring { transition: none; } }
#journey { position: fixed; inset: 0; z-index: 85; display: flex; align-items: center; justify-content: center; background: rgba(4, 6, 10, .55); padding: 16px; cursor: pointer; }
#journey .jr-card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-s); box-shadow: var(--shadow); width: min(560px, 100%); padding: 12px 14px; }
#journey .jr-head { font-size: 1.1em; margin-bottom: 6px; }
#journey .jr-map svg { width: 100%; height: auto; max-height: 62vh; display: block; background: #10141c; border-radius: 6px; }
#journey .jr-foot { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-top: 6px; }
#journey .jr-day { font-weight: 800; font-size: 1.2em; color: #f2c14e; }
.skin-pick { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.skin-btn { border: 2px solid transparent; font-weight: 700; min-width: 84px; }
.skin-btn.on { border-color: #8fd3ff; box-shadow: 0 0 0 2px rgba(143, 211, 255, .35); }
#net-banner { position: fixed; z-index: 90; top: 0; left: 0; right: 0; padding: 8px 16px; background: #3a1d1f; color: #fff;
  border-bottom: 2px solid var(--bad); font-weight: 600; text-align: center; box-shadow: var(--shadow); }
#toasts { position: fixed; z-index: 80; right: 12px; bottom: 80px; display: flex; flex-direction: column; gap: 8px; max-width: min(380px, calc(100vw - 24px)); pointer-events: none; }
.toast { background: var(--panel-2); border: 1px solid var(--line); border-left: 4px solid var(--accent-2); border-radius: var(--radius-s); padding: 10px 12px; box-shadow: var(--shadow);
  pointer-events: auto; animation: slidein .2s ease-out; }
.toast.error { border-left-color: var(--bad); }
.toast.good { border-left-color: var(--good); }
.toast.tip { border-left-color: var(--magic); }
.toast b { display: block; }
@keyframes slidein { from { transform: translateY(10px); opacity: 0; } }

/* Dés */
#dice-layer { position: fixed; inset: 0; z-index: 70; pointer-events: none; display: flex; align-items: center; justify-content: center; }
/* Dés 3D (dice3d.js) : ils roulent sur toute la fenêtre, le résumé du jet s'affiche plus bas. */
canvas.dice3d { position: fixed; inset: 0; width: 100vw; height: 100vh; z-index: 69; pointer-events: none; display: none; }
canvas.dice3d.on { display: block; }
#dice-layer.d3 { align-items: flex-end; padding-bottom: 12vh; }
.die-show { pointer-events: none; background: rgba(10, 12, 18, .9); border: 1px solid var(--line); border-radius: 18px; padding: 18px 22px; text-align: center; min-width: 220px; box-shadow: var(--shadow);
  animation: pop .25s ease-out; }
.die-show .lbl { color: var(--muted); font-size: .9em; margin-bottom: 6px; }
.die-show .who { font-weight: 700; }
.die-show .faces { display: flex; gap: 10px; justify-content: center; margin: 8px 0; }
.die { width: 64px; height: 64px; display: grid; place-items: center; font-size: 1.7rem; font-weight: 800; color: #0b1520;
  background: linear-gradient(145deg, #dff3ff, #8fd3ff); clip-path: polygon(50% 0, 100% 25%, 100% 75%, 50% 100%, 0 75%, 0 25%); animation: tumble .7s cubic-bezier(.2, .7, .3, 1); }
.die.drop { opacity: .35; filter: grayscale(1); }
.die.nat20 { background: linear-gradient(145deg, #fff3c4, #f2c14e); }
.die.nat1 { background: linear-gradient(145deg, #ffd6d3, #f0706a); }
.die-show .total { font-size: 2.4rem; font-weight: 850; line-height: 1; }
.die-show .detail { color: var(--muted); font-size: .85em; }
.die-show .verdict { margin-top: 6px; font-weight: 750; font-size: 1.1em; }
@keyframes tumble { 0% { transform: rotate(-540deg) scale(.3); } 70% { transform: rotate(20deg) scale(1.1); } 100% { transform: rotate(0) scale(1); } }
@keyframes pop { from { transform: scale(.85); opacity: 0; } }
.rolls { display: flex; flex-direction: column; gap: 6px; }
.roll-row { display: grid; grid-template-columns: 1fr auto; gap: 8px; padding: 6px 8px; background: var(--panel-2); border-radius: var(--radius-s); font-size: .92em; }
.roll-row .tot { font-weight: 800; font-size: 1.15em; min-width: 36px; text-align: right; }
.roll-row.secret { background: var(--secret-bg); }
.dice-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.dice-pad button { min-height: 60px; font-size: 1.05em; font-weight: 700; }

/* Carte */
.map-wrap { position: relative; background: #07090d; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; touch-action: none; height: 62dvh; min-height: 320px; }
.map-wrap.full { height: calc(100dvh - 228px); }
.map-hint { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); background: rgba(10, 12, 18, .88); color: var(--text); border: 1px solid var(--line);
  padding: 6px 12px; border-radius: 999px; font-size: .85rem; pointer-events: none; white-space: nowrap; max-width: 92%; overflow: hidden; text-overflow: ellipsis; }
.map-wrap canvas { display: block; width: 100%; height: 100%; touch-action: none; }
/* Table 3D (board3d.js) : calque des noms par-dessus WebGL, barre de caméra et bascule 2D/3D (mapmode.js) */
.map-wrap canvas.b3-labels { position: absolute; inset: 0; pointer-events: none; box-shadow: inset 0 0 140px rgba(0, 0, 0, .5); }
.map-modebar { position: absolute; top: 52px; right: 8px; display: flex; flex-direction: column; gap: 4px; z-index: 2; }
.map-modebar .b3-btn { min-width: 34px; min-height: 34px; padding: 4px 8px; background: rgba(15, 18, 24, .85); border: 1px solid var(--line); color: var(--text); font-weight: 700; }
.map-modebar .b3-btn.on { border-color: #8fd3ff; color: #8fd3ff; }
.map-modebar .b3-switch { color: #f2c14e; }
@media (max-width: 520px) { .map-modebar .b3-btn { min-width: 40px; min-height: 40px; } }
.map-hud { position: absolute; left: 8px; right: 8px; bottom: 8px; display: flex; gap: 6px; flex-wrap: wrap; pointer-events: none; }
.map-hud > * { pointer-events: auto; }
.map-hud .chip { background: rgba(15, 18, 24, .85); }
.map-tools { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
/* Section Carte du MJ : outils rangés par onglets, une seule rangée d'outils à la fois */
.map-tabs { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; margin: 0 0 6px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.map-tabs .sep { width: 1px; align-self: stretch; background: var(--line); margin: 0 6px; }
.map-tabs .tab { position: relative; min-height: 36px; padding: 6px 12px; background: transparent; border: 1px solid transparent; border-radius: var(--radius-s); color: var(--muted); font-weight: 600; }
.map-tabs .tab:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.map-tabs .tab.on { color: var(--accent); background: #1f2c3b; border-color: #2c5577; }
.map-tabs .tab.busy::after { content: ""; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.sub-tabs { position: sticky; top: 0; z-index: 5; background: var(--bg); padding-top: 6px; margin-bottom: 10px; }
[hidden] { display: none !important; }
.map-manage { margin-top: 8px; }
.map-more { margin: -2px 0 6px; }
.map-more > summary { cursor: pointer; color: var(--muted); padding: 2px 0; }
.map-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); text-align: center; padding: 20px; }

/* Journal / log */
.log { display: flex; flex-direction: column; gap: 4px; font-size: .92em; }
.log .e { padding: 4px 8px; border-left: 3px solid var(--line); }
.log .e.success { border-left-color: var(--good); } .log .e.danger { border-left-color: var(--bad); }
.log .e.quest { border-left-color: var(--warn); } .log .e.combat { border-left-color: #c96a45; }
.log .e.spell { border-left-color: var(--magic); } .log .e.loot { border-left-color: #d4b25a; }
.log .e.private { background: var(--secret-bg); }
.log .e .t { color: var(--faint); font-size: .8em; margin-right: 6px; }

/* Région */
.region svg { width: 100%; height: auto; display: block; background: #121821; border-radius: var(--radius); border: 1px solid var(--line); }

/* Assistant de création */
.wizard-steps { display: flex; gap: 4px; overflow-x: auto; margin-bottom: 12px; }
.wizard-steps span { flex: 0 0 auto; padding: 4px 10px; border-radius: 999px; background: var(--panel-2); color: var(--muted); font-size: .8em; }
.wizard-steps span.on { background: var(--accent); color: var(--accent-ink); font-weight: 700; }
.wizard-steps span.done { color: var(--good); }
.wizard-nav { position: sticky; bottom: calc(68px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--bg) 30%); padding-top: 14px; display: flex; gap: 8px; }
.abil-assign { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.abil-assign .a { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 8px; }
.abil-assign .a b { display: block; }
.prompt-card { border: 2px solid var(--warn); }

/* QR */
.qr { background: #fff; padding: 10px; border-radius: 10px; display: inline-block; }
.qr svg { display: block; width: 180px; height: 180px; }

/* Impression et mouvements réduits */
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }

/* Joueur : écran de jeu tout-en-un */
.play { display: grid; gap: 10px; }
.play-map { position: relative; }
.map-wrap.play-wrap { height: 46dvh; min-height: 260px; }
.map-float { position: absolute; top: 8px; left: 8px; display: flex; gap: 6px; flex-wrap: wrap; z-index: 2; }
.map-float button { background: rgba(12, 15, 22, .88); backdrop-filter: blur(4px); min-height: 36px; }
.play-side { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.init-strip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 2px; scrollbar-width: thin; }
.ichip { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; padding: 4px 9px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); font-size: .85rem; }
.ichip.cur { border-color: var(--warn); background: rgba(242, 193, 78, .14); font-weight: 700; }
.ichip.me { box-shadow: inset 0 0 0 1px var(--accent); }
.ichip.dead { opacity: .45; text-decoration: line-through; }
.turn-line { background: rgba(242, 193, 78, .12); border: 1px solid rgba(242, 193, 78, .5); border-radius: var(--radius); padding: 8px 10px; }
.turn-line.wait { background: var(--panel); border-color: var(--line); }
.turn-line .econ { margin-top: 4px; }
.act-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.act-grid button { flex-direction: column; gap: 2px; min-height: 58px; padding: 6px 2px; font-size: .78rem; }
.act-grid button span { font-size: 1.25rem; line-height: 1; }
.mini-log .roll-row { padding: 4px 8px; }
.mini-log { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); max-height: 150px; overflow: auto; }
.play-tools button { flex: 1 1 0; font-size: .85rem; padding: 6px 4px; min-height: 40px; white-space: nowrap; }
.play-feed { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.play-feed .panel { margin: 0; }
.dice-pad.compact { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; }
.dice-pad.compact button { min-height: 38px; padding: 4px 0; font-size: .85rem; }
.feed-list { max-height: 42dvh; overflow: auto; margin-top: 6px; }
.feed-list .roll-row { padding: 4px 6px; }
.play { grid-template-areas: "map" "side" "feed"; }
.play-map { grid-area: map; } .play-side { grid-area: side; } .play-feed { grid-area: feed; }
@media (min-width: 900px) {
  .pl-main:has(.play) { max-width: none; padding: 8px 12px; }
  .play { grid-template-columns: minmax(0, 1.6fr) minmax(320px, 1fr); grid-template-areas: "map side" "map feed"; align-items: start; }
  .map-wrap.play-wrap { height: calc(100dvh - 150px); }
  .play-map { position: sticky; top: 64px; }
  .feed-list { max-height: 34dvh; }
}
@media (min-width: 1250px) {
  .play { grid-template-columns: minmax(0, 1.7fr) minmax(300px, .8fr) minmax(300px, .8fr); grid-template-areas: "map side feed"; }
  .play-side, .play-feed { max-height: calc(100dvh - 150px); overflow: auto; }
  .play-feed .feed { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 0; }
  .feed-list { max-height: none; flex: 1 1 auto; min-height: 200px; }
}

/* MJ : carte à gauche, combat à droite */
.gm-fight { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, 1fr); gap: 12px; align-items: start; }
.gm-fight .gm-two { display: block; }
.map-wrap.fight { height: calc(100dvh - 210px); min-height: 360px; position: sticky; top: 8px; }
@media (max-width: 1000px) { .gm-fight { grid-template-columns: 1fr; } .map-wrap.fight { height: 52dvh; position: relative; } }
.fight-guide { border-color: var(--warn); }

/* Joueur qui dirige aussi un compagnon : boutons pour passer de l'un à l'autre */
.pl-switch { display: flex; gap: 6px; padding: 6px 10px; overflow-x: auto; background: var(--bg-2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 4; }
.pl-switch button { min-height: 38px; padding: 4px 10px; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.pl-switch button.on { border-color: var(--accent); background: rgba(143, 211, 255, .12); }

/* Aide débutant : mots de règle cliquables, tutoriel */
.term { text-decoration: underline dotted; text-underline-offset: 3px; text-decoration-color: var(--accent, #8fd3ff); cursor: help; }
.term:focus-visible { outline: 2px solid var(--accent, #8fd3ff); outline-offset: 2px; border-radius: 3px; }
.tuto { text-align: center; padding: 6px 4px 0; }
.tuto-ico { font-size: 3rem; line-height: 1.1; margin-bottom: 4px; }
.tuto h2 { margin: 4px 0 8px; }
.tuto-text { font-size: 1.12rem; line-height: 1.6; text-align: left; margin: 0 auto; max-width: 34rem; }
.tuto-dots { display: flex; gap: 6px; justify-content: center; margin: 14px 0 4px; }
.tuto-dots span { width: 8px; height: 8px; border-radius: 50%; background: var(--line, #333); }
.tuto-dots span.on { background: var(--accent, #8fd3ff); }

/* Vue spectateur (#/spectateur) : grand écran d'abord (1920×1080, lisible en stream), aucun bouton.
   Styles limités aux classes .spec* (et à ce qui est dedans) : rien de global. */
.spec { display: flex; flex-direction: column; height: 100dvh; overflow: hidden; font-size: 1.15rem; }
.spec .hl { color: var(--warn); }
.spec-top { display: flex; align-items: center; gap: 14px; padding: 10px 24px; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.spec-title { font-size: 1.35rem; font-weight: 700; line-height: 1.2; }
.spec-sub { color: var(--muted); font-size: .9rem; }
.spec-top .chip { font-size: .85rem; padding: 3px 10px; }
.spec-badge { color: var(--muted); }
.spec-init { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); background: var(--panel); }
.spec-init .init-strip { flex: 1 1 auto; min-width: 0; border: 0; padding: 8px 12px; gap: 6px; }
.spec-init .ichip { min-width: 150px; flex: 0 0 auto; padding: 8px 16px; font-size: .9rem; }
.spec-init .ichip .nm { font-size: 1.1rem; }
.spec-init .ichip .token-dot { width: 12px; height: 12px; }
.spec-init .ichip.pc .nm { color: #cfe2ff; }
.spec-init .ichip.foe .nm { color: #ffd9da; }
.spec-turn { flex: 0 0 auto; display: flex; align-items: center; padding: 0 24px; border-left: 1px solid var(--line); font-size: 1.3rem; font-weight: 650; white-space: nowrap; }
.spec-body { display: grid; grid-template-columns: minmax(0, 1fr) 480px; flex: 1 1 auto; min-height: 0; }
.spec-map { position: relative; min-height: 0; }
.spec .map-wrap.spec-wrap { height: 100%; min-height: 0; border: 0; border-radius: 0; touch-action: auto; }
.spec-side { display: flex; flex-direction: column; min-height: 0; border-left: 1px solid var(--line); background: var(--bg-2); }
.spec-side h4 { margin: 0 0 8px; }
.spec-party { padding: 14px 18px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.spec-pc { padding: 8px 0; display: grid; gap: 4px; }
.spec-pc + .spec-pc { border-top: 1px solid var(--line); }
.spec-pc b { font-size: 1.1rem; }
.spec-pc.dead { opacity: .5; }
.spec-pc .hpbar { height: 10px; }
.spec-hp { font-weight: 800; font-size: 1.2rem; }
.spec-hp small { font-weight: 400; color: var(--muted); font-size: .75em; }
.spec-feed { padding: 14px 18px; flex: 1 1 auto; min-height: 0; overflow: hidden; -webkit-mask-image: linear-gradient(#000 75%, transparent); mask-image: linear-gradient(#000 75%, transparent); }
.spec-feed .log { font-size: .95rem; }
.spec-roll { display: flex; gap: 10px; align-items: baseline; padding: 6px 4px; border-bottom: 1px solid var(--line); font-size: .95rem; }
.spec-roll .tot { font-weight: 850; font-size: 1.3em; min-width: 40px; text-align: right; }
.spec-roll.fresh { background: rgba(143, 211, 255, .12); }
@media (max-width: 1100px) {
  .spec { height: auto; min-height: 100dvh; overflow: visible; font-size: 1rem; }
  .spec-top { padding: 8px 16px; flex-wrap: wrap; }
  .spec-init { flex-direction: column; }
  .spec-turn { border-left: 0; border-top: 1px solid var(--line); padding: 8px 16px; }
  .spec-body { grid-template-columns: 1fr; }
  .spec .map-wrap.spec-wrap { height: 60dvh; }
  .spec-side { border-left: 0; }
  .spec-feed { mask-image: none; -webkit-mask-image: none; }
}

/* ------------------------------------------------ outils de table (tabletools.js, tablegm.js) */
.tt-bar { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; margin: 6px 0; }
.tt-bar .btn-small { min-height: 36px; }
.play-map .tt-bar.compact { position: absolute; top: 8px; right: 8px; z-index: 2; margin: 0; max-width: calc(100% - 16px); justify-content: flex-end; }
.tt-bar.compact .btn-small { background: rgba(12, 15, 22, .88); backdrop-filter: blur(4px); }
.tt-bar.compact.open { background: rgba(12, 15, 22, .9); border: 1px solid var(--line); border-radius: var(--radius-s); padding: 6px; }
.play-map { position: relative; }
.tt-sw { display: inline-flex; gap: 4px; align-items: center; }
.tt-sw .sw { width: 24px; height: 24px; min-height: 0; padding: 0; border-radius: 50%; border: 2px solid var(--line); }
.tt-sw .sw.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--accent-2); }
.tt-w { display: inline-block; width: 18px; background: currentColor; border-radius: 2px; vertical-align: middle; }
.tt-hint { margin: 0 0 6px; }
.ico { display: inline-block; min-width: 1.1em; text-align: center; }
.warn-text { color: var(--warn); }
.table-wrap { overflow-x: auto; }
.table-wrap table { border-collapse: collapse; }
.table-wrap td, .table-wrap th { padding: 4px 8px; border-bottom: 1px solid var(--line); text-align: left; }

#tt-layer { position: fixed; inset: 0; pointer-events: none; z-index: 40; }
#tt-layer > * { pointer-events: auto; }
.tt-chat-btn { position: fixed; right: 14px; bottom: 14px; width: 52px; height: 52px; border-radius: 50%; font-size: 22px; box-shadow: var(--shadow); }
#tt-layer.is-player .tt-chat-btn { bottom: 76px; }
.tt-chat-btn .badge { position: absolute; top: -4px; right: -4px; }
.tt-chat { position: fixed; right: 14px; bottom: 76px; width: min(480px, calc(100vw - 28px)); max-height: min(78dvh, 720px); display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
#tt-layer.is-player .tt-chat { bottom: 138px; max-height: min(72dvh, 680px); }
.tt-chat-head { display: flex; align-items: center; gap: 6px; padding: 8px; border-bottom: 1px solid var(--line); }
.tt-chat-head .tabs { display: flex; gap: 4px; flex-wrap: wrap; flex: 1; }
.tt-chat-list { overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; min-height: 160px; }
.tt-msg { background: var(--panel-2); border-radius: var(--radius-s); padding: 6px 8px; overflow-wrap: anywhere; }
.tt-msg.mine { background: #1f3040; }
.tt-msg .who { font-weight: 650; }
.tt-msg .t { color: var(--faint); font-size: .8em; }
.tt-del { float: right; min-height: 0; padding: 0 4px; border: 0; background: none; color: var(--faint); }
.tt-chat-send { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); }
.tt-chat-send textarea { flex: 1; min-height: 64px; resize: vertical; }
.tt-curtain { position: fixed; inset: 0; display: grid; place-items: center; text-align: center; padding: 16px; background: rgba(5, 7, 11, .96); }
.tt-curtain-ico { font-size: 48px; }
.tt-handout { position: fixed; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding: 16px; background: rgba(5, 7, 11, .9); }
.tt-handout figure { margin: 0; max-width: 100%; max-height: calc(100dvh - 120px); display: flex; flex-direction: column; align-items: center; }
.tt-handout img { max-width: 100%; max-height: calc(100dvh - 160px); object-fit: contain; border-radius: var(--radius-s); }
.tt-handout figcaption { margin-top: 8px; font-family: var(--serif); color: var(--read-ink); }
.tt-music { position: fixed; left: 14px; bottom: 14px; box-shadow: var(--shadow); }
#tt-layer.is-player .tt-music { bottom: 76px; }
.tt-music-box { position: fixed; left: 14px; bottom: 14px; display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
.tt-music-box .tt-music { position: static; box-shadow: none; }
#tt-layer.is-player .tt-music-box { bottom: 76px; }
/* PC : les onglets du joueur sont en haut, rien à éviter en bas ; le volume n'apparaît qu'au survol. */
@media (min-width: 900px) {
  #tt-layer.is-player .tt-music, #tt-layer.is-player .tt-music-box, #tt-layer.is-player .tt-chat-btn { bottom: 14px; }
  #tt-layer.is-player .tt-chat { bottom: 76px; }
  .tt-music-box { padding-right: 4px; opacity: .85; }
  .tt-music-box input[type=range] { display: none; }
  .tt-music-box:hover, .tt-music-box:focus-within { opacity: 1; padding-right: 10px; }
  .tt-music-box:hover input[type=range], .tt-music-box:focus-within input[type=range] { display: block; }
}
.tt-amb-vol { width: 96px; }
@media (max-width: 600px) {
  .play-map .tt-bar.compact { top: 52px; right: 6px; }
}

/* Écran Jeu : « Le groupe », un carré par personnage (notes privées du joueur) */
.party-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px; margin-top: 6px; }
.party-sq { position: relative; aspect-ratio: 1; min-height: 0; padding: 6px 4px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  background: var(--panel-2); border: 2px solid var(--pc, var(--line)); border-radius: var(--radius-s); text-align: center; overflow: hidden; }
.party-sq:hover { filter: brightness(1.15); }
.party-ini { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--pc, #5ca8e0); color: #0b0f14; font-weight: 700; font-size: 1.2em; }
.party-name { font-weight: 650; font-size: .9em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.party-who { font-size: .75em; color: var(--faint); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.party-has { position: absolute; top: 3px; right: 4px; font-size: .8em; }

/* ---------------------------------------------------------------- table en plein écran (html.table-full)
   MJ, section Carte : la carte couvre l'écran, les onglets d'outils flottent dessus. Joueur : la carte seule. */
html.table-full { overflow: hidden; }
html.table-full .gm-nav, html.table-full .gm-main > .now, html.table-full .gm-main > .row { display: none; }
html.table-full .gm-shell { display: block; }
html.table-full .gm-main { padding: 0; }
html.table-full #sec-body > * { display: none; }
html.table-full #sec-body > .map-wrap.full { display: block; position: fixed; inset: 0; height: 100dvh; min-height: 0; border: 0; border-radius: 0; z-index: 30; }
html.table-full #sec-body > .map-tabs, html.table-full #sec-body > .map-tools, html.table-full #sec-body > .tt-bar,
html.table-full #sec-body > .turn-banner, html.table-full #sec-body > .tok-panel {
  position: fixed; z-index: 31; margin: 0; background: rgba(12, 15, 22, .84); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
html.table-full #sec-body > .map-tabs { display: flex; top: 8px; left: 8px; right: 8px; padding: 4px 6px; }
html.table-full #sec-body > .map-tools, html.table-full #sec-body > .tt-bar { display: flex; top: 62px; left: 8px; max-width: calc(100% - 70px); padding: 4px 6px; }
html.table-full #sec-body > .turn-banner { display: block; bottom: 14px; left: 50%; transform: translateX(-50%); max-width: min(720px, calc(100% - 140px)); animation: none; }
html.table-full #sec-body > .tok-panel { display: block; left: 8px; bottom: 8px; width: min(480px, calc(100% - 90px)); max-height: 56dvh; overflow: auto; padding: 10px 12px; }
html.table-full .map-wrap.full .map-modebar { top: 116px; }
html.table-full .play .play-map { position: fixed; inset: 0; z-index: 30; top: 0; }
html.table-full .play .play-map .map-wrap.play-wrap { height: 100dvh; min-height: 0; border: 0; border-radius: 0; }

/* Combat en plein écran (html.table-full.full-combat) : carte partout, guide du tour à gauche, initiative à droite. */
html.full-combat #sec-body { position: fixed; left: 8px; top: 8px; width: min(430px, 38vw); max-height: calc(100dvh - 16px); overflow-y: auto; z-index: 31; }
html.full-combat #sec-body > .pend-panel, html.full-combat #sec-body > .fight-guide, html.full-combat #sec-body > .turn-banner, html.full-combat #sec-body > .tt-bar {
  display: block; position: relative; z-index: 2; inset: auto; transform: none; max-width: none; margin: 0 0 8px;
  background: rgba(22, 26, 35, .9); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); }
html.full-combat #sec-body > .fight-guide { border-color: var(--warn); }
html.full-combat #sec-body > .tt-bar { display: flex; width: fit-content; padding: 4px 6px; }
html.full-combat #sec-body > .gm-fight { display: block; }
html.full-combat .gm-fight > .map-wrap.fight { position: fixed; inset: 0; height: 100dvh; min-height: 0; border: 0; border-radius: 0; z-index: 0; }
html.full-combat .gm-fight > div:last-child { position: fixed; right: 8px; top: 8px; bottom: 70px; width: min(400px, 34vw); overflow-y: auto; z-index: 2; }
html.full-combat .gm-fight .panel { background: rgba(22, 26, 35, .9); box-shadow: var(--shadow); }
html.full-combat .map-wrap.fight .map-modebar { top: 8px; right: calc(min(400px, 34vw) + 18px); }

/* ---------------------------------------------------------------- V2.0 : finition (titres, relief, profondeur)
   Polices du système seulement (aucune ressource externe : la CSP l'interdit et le jeu marche hors ligne). */
:root { --display: "Palatino Linotype", Palatino, "Book Antiqua", "Iowan Old Style", Georgia, serif; --ink-title: #f4f0e6; }
body { background: radial-gradient(1100px 620px at 78% -12%, #1b2740 0%, rgba(27, 39, 64, 0) 62%), var(--bg); background-attachment: fixed; }
h1, h2, .gm-nav .brand { font-family: var(--display); font-weight: 700; letter-spacing: .01em; color: var(--ink-title); }
h1 { font-size: 1.7rem; } h2 { font-size: 1.32rem; }
.now h2, .gm-nav .brand small { font-family: var(--font); }
.panel { background: linear-gradient(180deg, #1e2431, #191e28); border-color: #2a3243; box-shadow: inset 0 1px 0 rgba(255, 255, 255, .035), 0 8px 22px rgba(0, 0, 0, .2); }
button, .btn { transition: background-color .12s ease, border-color .12s ease, box-shadow .12s ease, color .12s ease; }
.btn-primary { background: linear-gradient(180deg, #abdfff, #7dc5f4); border-color: #a3d9ff;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .55), inset 0 -2px 0 rgba(6, 32, 47, .22), 0 2px 6px rgba(0, 0, 0, .35); }
.btn-primary:hover { background: linear-gradient(180deg, #c2e8ff, #92d1f9); }
.btn-primary:disabled { box-shadow: none; }
.gm-nav { background: linear-gradient(180deg, #151a24, #10141b); }
.gm-nav .brand { font-size: 1.15rem; }
.gm-nav button { border-radius: var(--radius-s); }
.gm-nav button.on { box-shadow: inset 3px 0 0 var(--accent); }
.map-tabs .tab.on { box-shadow: inset 0 -2px 0 var(--accent-2); }
.now { box-shadow: inset 0 1px 0 rgba(143, 211, 255, .12), 0 6px 18px rgba(0, 0, 0, .25); }

/* « Nouvelle version · Recharger » (core.js versionBanner) */
#ver-banner { white-space: nowrap; position: fixed; z-index: 89; top: 8px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 6px 14px; background: #1f2c3b; border: 1px solid #2c5577; border-radius: 999px; box-shadow: var(--shadow); font-size: .92em; }

/* Catalogue d'objets du MJ (gm.js objetsHtml) */
.item-list { display: flex; flex-direction: column; gap: 4px; }
.item-row { border: 1px solid var(--line); border-radius: var(--radius-s); background: rgba(255, 255, 255, .02); }
.item-row > summary { cursor: pointer; padding: 8px 10px; list-style: none; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.item-row > summary::-webkit-details-marker { display: none; }
.item-row > summary::before { content: "▸"; color: var(--faint); }
.item-row[open] > summary::before { content: "▾"; }
.item-row[open] { border-color: #2c5577; background: #172532; }
.item-row .item-card { padding: 0 12px 10px 28px; }

/* ---- Fiche imprimable (print.js) : aperçu plein écran blanc, puis seule la fiche à l'impression ---- */
#print-sheet { position: fixed; inset: 0; z-index: 9000; overflow: auto; background: #e9e6df; color: #111; }
#print-sheet .pr-bar { position: sticky; top: 0; display: flex; gap: 10px; align-items: center; padding: 10px 16px; background: #1b2230; color: #e8edf5; z-index: 1; }
#print-sheet .pr-bar span { flex: 1; font-size: .9rem; }
.pr-sheet { width: 210mm; min-height: 297mm; margin: 16px auto; padding: 12mm 13mm; background: #fff; color: #111; box-shadow: 0 2px 18px rgba(0,0,0,.25);
  font: 10pt/1.35 Georgia, "Times New Roman", serif; }
.pr-sheet h1 { font-size: 20pt; margin: 0; color: #111; }
.pr-sheet h2 { font-size: 11pt; margin: 0 0 4px; padding-bottom: 2px; border-bottom: 1.5px solid #6b1d1d; color: #6b1d1d; text-transform: uppercase; letter-spacing: .04em; }
.pr-sheet h3 { font-size: 10pt; margin: 6px 0 2px; color: #333; }
.pr-sheet p { margin: 3px 0; }
.pr-sheet ul { margin: 0; padding: 0; list-style: none; }
.pr-sheet li { margin: 0 0 3px; }
.pr-sheet i { color: #555; }
.pr-head { display: flex; justify-content: space-between; align-items: flex-end; border-bottom: 3px double #6b1d1d; padding-bottom: 6px; margin-bottom: 8px; }
.pr-meta { text-align: right; font-size: 9pt; color: #444; }
.pr-vitals { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; margin-bottom: 8px; }
.pr-vital, .pr-abil { border: 1px solid #999; border-radius: 6px; padding: 4px; text-align: center; break-inside: avoid; }
.pr-vital .k, .pr-abil .k { font-size: 7.5pt; text-transform: uppercase; color: #555; }
.pr-vital .v { font-size: 15pt; font-weight: bold; }
.pr-vital .s, .pr-abil .s { font-size: 8pt; color: #444; }
.pr-abils { display: grid; grid-template-columns: repeat(6, 1fr); gap: 5px; margin-bottom: 8px; }
.pr-abil .v { font-size: 17pt; font-weight: bold; }
.pr-save { font-size: 8pt; border-top: 1px dotted #aaa; margin-top: 3px; padding-top: 2px; }
.pr-cols { display: grid; grid-template-columns: 1fr 1.25fr; gap: 10px; }
.pr-block { margin-bottom: 8px; break-inside: avoid-page; }
.pr-skills li { display: flex; justify-content: space-between; border-bottom: 1px dotted #ccc; margin: 0; padding: 1px 0; }
.pr-table { width: 100%; border-collapse: collapse; font-size: 9pt; }
.pr-table th, .pr-table td { border-bottom: 1px solid #ccc; padding: 2px 3px; text-align: left; }
.pr-feats li, .pr-spell-list li { break-inside: avoid; font-size: 9pt; }
.pr-spells { border-top: 1px solid #ddd; padding-top: 6px; }
.pr-spell-list { columns: 2; column-gap: 12px; }
.pr-boxes { letter-spacing: 1px; font-family: "Segoe UI Symbol", sans-serif; }
.pr-note { font-size: 8pt; color: #555; }
.pr-foot { margin-top: 8px; font-size: 7.5pt; color: #777; text-align: center; }
@media print {
  @page { size: A4; margin: 0; }
  html.printing body > *:not(#print-sheet) { display: none !important; }
  html.printing, html.printing body { background: #fff !important; }
  #print-sheet { position: static; overflow: visible; background: #fff; }
  #print-sheet .pr-bar { display: none; }
  .pr-sheet { margin: 0; box-shadow: none; width: auto; min-height: 0; }
}
