/* ==========================================================================
   Noctis · Compagnon de table — interface tactile (téléphone et tablette)
   Reprend le système de design de Noctis (graphite + violet) ; chaque personnage a sa couleur (--accent).
   ========================================================================== */
/* Polices de Noctis intégrées (fonctionnent hors ligne) — licence SIL OFL, voir css/fonts */
@font-face { font-family: "Bricolage Grotesque"; src: url("fonts/BricolageGrotesque-Regular.ttf") format("truetype"); font-weight: 400 600; font-display: swap; }
@font-face { font-family: "Bricolage Grotesque"; src: url("fonts/BricolageGrotesque-Bold.ttf") format("truetype"); font-weight: 700 900; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-Regular.ttf") format("truetype"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "IBM Plex Mono"; src: url("fonts/IBMPlexMono-Bold.ttf") format("truetype"); font-weight: 600 700; font-display: swap; }
@font-face { font-family: "IBM Plex Serif"; src: url("fonts/IBMPlexSerif-Regular.ttf") format("truetype"); font-weight: 400 500; font-display: swap; }
@font-face { font-family: "IBM Plex Serif"; src: url("fonts/IBMPlexSerif-Italic.ttf") format("truetype"); font-weight: 400 500; font-style: italic; font-display: swap; }
@font-face { font-family: "IBM Plex Serif"; src: url("fonts/IBMPlexSerif-Bold.ttf") format("truetype"); font-weight: 600 800; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Regular.woff") format("woff"); font-weight: 300 450; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Medium.woff") format("woff"); font-weight: 451 550; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-SemiBold.woff") format("woff"); font-weight: 551 650; font-display: swap; }
@font-face { font-family: "Inter"; src: url("fonts/Inter-Bold.woff") format("woff"); font-weight: 651 900; font-display: swap; }
:root {
  --font-serif: "Alegreya", "IBM Plex Serif", Georgia, serif;
  --accent: #8b6cef;
  --accent-soft: color-mix(in srgb, var(--accent) 16%, transparent);
  --accent-line: color-mix(in srgb, var(--accent) 45%, transparent);
  --accent-text: color-mix(in srgb, var(--accent) 55%, white);
  --good: #5fc58c;
  --bad: #e0606a;
  --warn: #e8b36a;
  --tabbar-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --page-w: 1180px;
}
html { background: var(--ink-0); -webkit-text-size-adjust: 100%; }
body { overflow-x: hidden; overflow-y: auto; min-height: 100dvh; -webkit-tap-highlight-color: transparent; overscroll-behavior-y: none; }
body::before { position: fixed; }
#app { position: relative; z-index: 1; min-height: 100dvh; }
a { color: inherit; text-decoration: none; }
button { touch-action: manipulation; }
code { font: 500 .92em var(--font-mono); color: var(--text-2); }
.icon.lg { width: 30px; height: 30px; }
.reduce-motion * { animation-duration: .01s !important; transition-duration: .01s !important; }

.boot { min-height: 100dvh; display: grid; place-content: center; justify-items: center; gap: 14px; color: var(--text-3); font: 500 12px var(--font-mono); }
.boot img { width: 64px; height: 64px; animation: pulse 1.6s ease-in-out infinite; }
.empty-page { min-height: 70dvh; display: grid; place-content: center; justify-items: center; gap: 12px; padding: 24px; text-align: center; color: var(--text-2); }
.empty-page .icon { width: 34px; height: 34px; color: var(--accent); }

/* ---------- Pages ---------- */
.page { width: min(var(--page-w), 100%); margin: 0 auto; padding: calc(10px + var(--safe-t)) 16px calc(40px + var(--safe-b)); }
.page-top { display: flex; align-items: center; gap: 10px; margin: 0 -4px 14px; position: sticky; top: 0; z-index: 20; padding: calc(8px + var(--safe-t)) 4px 8px; margin-top: calc(-10px - var(--safe-t)); background: linear-gradient(var(--ink-0) 70%, transparent); }
.page-title h1 { margin: 0; font: 800 22px/1.1 var(--font-display); letter-spacing: -.02em; }
.page-title span { font: 500 11.5px var(--font-mono); color: var(--text-3); }
.credit { margin: 26px auto 0; max-width: 620px; text-align: center; font-size: 10.5px; line-height: 1.5; color: var(--text-4); }
.hint code { font-size: 11px; }

.card { position: relative; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(255, 255, 255, .018), transparent 40%), var(--ink-2); border-radius: 16px; padding: 14px; margin-bottom: 12px; }
.card-title { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font: 700 13px var(--font-display); letter-spacing: .01em; color: var(--text); }
.card-title .icon { color: var(--accent-text); }
.card-title .aside { margin-left: auto; font: 500 11px var(--font-mono); color: var(--text-3); }
.card-title .aside.link { color: var(--accent-text); }
.mini-head { margin: 14px 0 6px; font: 600 10.5px var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.muted-line { margin: 4px 0; padding: 10px 2px; font-size: 12.5px; color: var(--text-3); line-height: 1.5; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.chip { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 20px; border: 1px solid var(--line-2); background: var(--ink-1); font: 600 11px var(--font-ui); color: var(--text-2); }
.chip.on { border-color: var(--accent-line); color: var(--accent-text); background: var(--accent-soft); }
.chip.warn { border-color: rgba(232, 179, 106, .45); color: var(--warn); }
.src-tag { display: inline-flex; align-items: center; height: 16px; padding: 0 5px; margin-left: 6px; border-radius: 4px; font: 600 9.5px var(--font-mono); color: var(--accent-text); background: var(--accent-soft); vertical-align: 2px; }
.src-tag.hb { color: #9bdcb2; background: rgba(78, 154, 106, .14); }

.btn.primary { background: var(--accent); border-color: var(--accent); color: #0f0b1a; box-shadow: 0 6px 18px color-mix(in srgb, var(--accent) 25%, transparent); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 85%, white); border-color: transparent; }
.btn.glow { animation: glow 1.6s ease-in-out infinite; }
@keyframes glow { 50% { box-shadow: 0 0 0 5px var(--accent-soft); } }
.btn.danger-soft { color: #f0a3a8; border-color: rgba(191, 74, 82, .35); background: rgba(142, 44, 51, .12); }
.btn.good-soft { color: #9bdcb2; border-color: rgba(78, 154, 106, .35); background: rgba(78, 154, 106, .1); }
.danger-text { color: #ec9aa0 !important; }
.switch input:checked + span { background: var(--accent); }
.check input, input[type=range] { accent-color: var(--accent); }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field input, .field select { height: 42px; font-size: 15px; }
.field textarea { font-size: 15px; }

.seg { display: inline-flex; gap: 3px; padding: 3px; border-radius: 10px; background: var(--ink-1); border: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; max-width: 100%; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 0 0 auto; height: 32px; padding: 0 12px; border: 0; border-radius: 7px; background: transparent; color: var(--text-3); font: 600 12px var(--font-ui); }
.seg button.active { background: var(--ink-4); color: var(--accent-text); box-shadow: inset 0 0 0 1px var(--accent-line); }
.seg.wide { display: flex; }
.seg.wide button { flex: 1; }

.search { display: flex; align-items: center; gap: 8px; height: 42px; padding: 0 12px; border-radius: 11px; border: 1px solid var(--line-2); background: var(--ink-1); color: var(--text-3); flex: 1; min-width: 0; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--text); font-size: 15px; }
.search:focus-within { border-color: var(--accent); }
.filterbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 2px 0 12px; }

.stepper { display: inline-flex; align-items: center; gap: 4px; border: 1px solid var(--line-2); border-radius: 10px; padding: 2px; background: var(--ink-1); }
.stepper button { width: 34px; height: 32px; border: 0; border-radius: 8px; background: var(--ink-3); color: var(--text-2); display: grid; place-items: center; }
.stepper b { min-width: 30px; text-align: center; font: 700 15px var(--font-display); }

/* ---------- Feuilles (modales en bas d'écran) ---------- */
.modal-layer { grid-template-columns: minmax(0, 1fr); justify-items: center; }
.modal-layer.as-sheet .modal { display: flex; flex-direction: column; max-height: min(88dvh, 860px); }
.modal-layer.as-sheet .modal-body { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; }
.modal { overflow: hidden; }
.modal-body { overflow-y: auto; }
.modal-foot { flex-wrap: wrap; }
@media (max-width: 720px) {
  .modal-layer { place-items: end stretch; padding: 0; }
  .modal-layer .modal, .modal-layer .modal.wide { width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; border-bottom: 0; animation: sheet-up .26s var(--ease); display: flex; flex-direction: column; }
  .modal-layer .modal::before { content: ""; display: block; width: 40px; height: 4px; border-radius: 4px; background: var(--ink-5); margin: 8px auto 0; flex: 0 0 auto; }
  .modal-head { padding: 10px 16px 12px; }
  .modal-body { padding: 14px 16px; overflow-y: auto; }
  .modal-foot { padding: 12px 16px calc(12px + var(--safe-b)); }
  .modal-foot .btn { flex: 1 1 auto; height: 44px; }
  .toasts { left: 12px; right: 12px; bottom: calc(var(--tabbar-h) + 14px + var(--safe-b)); justify-items: center; }
  .toast { max-width: 100%; }
}
@keyframes sheet-up { from { transform: translateY(40px); opacity: 0; } }
.choose-list { display: grid; gap: 4px; }
.choose-list hr { border: 0; height: 1px; background: var(--line); margin: 6px 0; }
.choose-item { display: flex; align-items: center; gap: 12px; min-height: 50px; padding: 8px 12px; border-radius: 12px; border: 1px solid transparent; background: transparent; color: var(--text); text-align: left; }
.choose-item:hover, .choose-item:active { background: var(--ink-3); border-color: var(--line-2); }
.choose-item .icon { color: var(--accent-text); flex: 0 0 auto; }
.choose-item span { display: grid; gap: 2px; }
.choose-item b { font: 600 14px var(--font-ui); }
.choose-item small { font-size: 12px; color: var(--text-3); }
.choose-item.danger, .choose-item.danger .icon { color: #ec9aa0; }

.numpad-display { height: 64px; display: grid; place-items: center; margin-bottom: 12px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--ink-1); font: 800 34px var(--font-display); letter-spacing: -.02em; }
.numpad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.numpad button { height: 56px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--ink-3); color: var(--text); font: 700 22px var(--font-display); }
.numpad button:active { background: var(--ink-4); transform: scale(.98); }

/* ---------- Accueil ---------- */
.home { max-width: 980px; }
.home-top { display: flex; align-items: center; gap: 12px; padding: 8px 0 18px; }
.brand-mark img { width: 44px; height: 44px; display: block; border-radius: 12px; box-shadow: 0 0 0 1px var(--line-2), 0 10px 30px rgba(139, 108, 239, .18); }
.home-title { flex: 1; }
.home-title h1 { margin: 0; font: 800 26px/1 var(--font-display); letter-spacing: -.03em; }
.home-title span { font: 500 12px var(--font-mono); color: var(--accent-text); }
.install-hint { display: flex; align-items: center; gap: 10px; padding: 10px 12px; margin-bottom: 14px; border-radius: 12px; border: 1px solid var(--accent-line); background: var(--accent-soft); font-size: 12.5px; color: var(--text-2); }
.install-hint span { flex: 1; }
.home-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 6px 0 12px; }
.home-head h2 { margin: 0; font: 700 18px var(--font-display); }
.camp-head { display: flex; align-items: center; gap: 8px; margin: 18px 0 8px; font: 600 11px var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.char-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 10px; }
.char-card { position: relative; display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 18px; border: 1px solid var(--line); background: radial-gradient(120% 140% at 0% 0%, color-mix(in srgb, var(--accent) 14%, transparent), transparent 55%), var(--ink-2); transition: border-color .15s, transform .1s; }
.char-card:active { transform: scale(.99); }
.char-card:hover { border-color: var(--accent-line); }
.cc-portrait { width: 64px; height: 64px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; font: 800 20px var(--font-display); color: var(--accent-text); background: var(--ink-3) center / cover no-repeat; box-shadow: 0 0 0 2px var(--accent), 0 0 0 5px color-mix(in srgb, var(--accent) 18%, transparent); }
.cc-body { flex: 1; min-width: 0; display: grid; gap: 3px; }
.cc-body b { font: 700 17px/1.15 var(--font-display); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-body small { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cc-hp { height: 5px; border-radius: 4px; background: var(--ink-4); overflow: hidden; margin-top: 4px; }
.cc-hp i { display: block; height: 100%; background: linear-gradient(90deg, var(--good), #8fe0b2); border-radius: 4px; }
.cc-meta { font: 500 11px var(--font-mono); color: var(--text-3); }
.cc-todo { display: inline-flex; align-items: center; gap: 6px; font-style: normal; font-size: 12px; color: var(--accent-text); }
.cc-badge { position: absolute; top: 10px; right: 10px; display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 20px; background: var(--accent); color: #0f0b1a; font: 700 10.5px var(--font-ui); }
.welcome { display: grid; justify-items: center; gap: 12px; padding: 34px 20px; text-align: center; border-radius: 22px; border: 1px dashed var(--line-2); background: radial-gradient(80% 90% at 50% 0%, var(--accent-soft), transparent 70%); }
.welcome h3 { margin: 0; font: 800 22px var(--font-display); letter-spacing: -.02em; }
.welcome p { margin: 0; max-width: 460px; color: var(--text-2); line-height: 1.55; font-size: 14px; }
.welcome-mark { width: 64px; height: 64px; border-radius: 18px; display: grid; place-items: center; color: var(--accent-text); background: var(--accent-soft); border: 1px solid var(--accent-line); }
.home-tools { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; margin-top: 22px; }
.tool { display: grid; gap: 3px; justify-items: start; padding: 14px; border-radius: 16px; border: 1px solid var(--line); background: var(--ink-2); color: var(--text); text-align: left; }
.tool .icon { color: var(--accent-text); width: 22px; height: 22px; margin-bottom: 4px; }
.tool b { font: 700 14px var(--font-display); }
.tool span { font-size: 11.5px; color: var(--text-3); }
@media (min-width: 720px) { .home-tools { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Fiche : en-tête ---------- */
.char { min-height: 100dvh; padding-bottom: calc(var(--tabbar-h) + 24px + var(--safe-b)); }
.char-top { position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 8px; padding: calc(8px + var(--safe-t)) 10px 8px; background: rgba(11, 12, 14, .88); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--line); }
.char-top::after { content: ""; position: absolute; left: 0; right: 0; bottom: -1px; height: 1px; background: linear-gradient(90deg, transparent, var(--accent-line), transparent); }
.char-portrait { width: 40px; height: 40px; flex: 0 0 auto; border-radius: 50%; border: 0; display: grid; place-items: center; font: 800 14px var(--font-display); color: var(--accent-text); background: var(--ink-3) center / cover no-repeat; box-shadow: 0 0 0 2px var(--accent); }
.char-who { flex: 1; min-width: 0; }
.char-who h1 { margin: 0; font: 800 17px/1.15 var(--font-display); letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.char-who span { display: block; font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hp-pill { display: inline-flex; align-items: center; gap: 4px; height: 32px; padding: 0 10px; border-radius: 20px; border: 1px solid rgba(78, 154, 106, .35); background: rgba(78, 154, 106, .12); color: #9bdcb2; font: 600 12px var(--font-ui); flex: 0 0 auto; }
.hp-pill b { font: 800 15px var(--font-display); color: #c9f0d6; }
.hp-pill em { font-style: normal; color: #8fc3ff; margin-left: 2px; }
.hp-pill.mid { border-color: rgba(232, 179, 106, .4); background: rgba(232, 179, 106, .1); color: var(--warn); }
.hp-pill.mid b { color: #ffd9a3; }
.hp-pill.low { border-color: rgba(224, 96, 106, .45); background: rgba(224, 96, 106, .12); color: #f0a3a8; }
.hp-pill.low b { color: #ffc4c8; }
.edit-banner { display: flex; align-items: center; gap: 8px; margin: 10px 12px 0; padding: 8px 10px 8px 12px; border-radius: 12px; border: 1px solid var(--accent-line); background: var(--accent-soft); font-size: 12.5px; color: var(--text-2); }
.edit-banner .btn { margin-left: auto; }

.recap { margin: 12px 12px 0; padding: 12px 14px; border-radius: 14px; border: 1px solid var(--line-2); background: linear-gradient(135deg, var(--accent-soft), transparent 60%), var(--ink-2); cursor: pointer; }
.recap-head { display: flex; align-items: center; gap: 8px; color: var(--accent-text); font-size: 12px; }
.recap-head b { flex: 1; font: 600 11px var(--font-ui); letter-spacing: .1em; text-transform: uppercase; }
.recap p { margin: 6px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-2); }
.recap-quests { display: flex; gap: 6px; align-items: center; color: var(--text-3) !important; font-size: 12px !important; }

/* ---------- Fiche : mise en page ---------- */
.char-body { padding: 12px 12px 0; display: grid; gap: 12px; }
.vitals, .tab-main { min-width: 0; }
@media (max-width: 899px) {
  .char:not([data-tab="combat"]) .vitals { display: none; }
}
@media (min-width: 900px) {
  .char-body { grid-template-columns: 340px minmax(0, 1fr); align-items: start; max-width: var(--page-w); margin: 0 auto; padding: 16px 20px 0; gap: 16px; }
  .vitals { position: sticky; top: calc(70px + var(--safe-t)); max-height: calc(100dvh - 90px - var(--tabbar-h)); overflow-y: auto; scrollbar-width: thin; }
  .char-top { padding-left: max(16px, calc((100vw - var(--page-w)) / 2 + 16px)); padding-right: max(16px, calc((100vw - var(--page-w)) / 2 + 16px)); }
  .recap, .edit-banner { max-width: calc(var(--page-w) - 40px); margin-left: auto; margin-right: auto; }
}

/* Barre d'onglets */
.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: grid; grid-template-columns: repeat(6, 1fr); height: calc(var(--tabbar-h) + var(--safe-b)); padding-bottom: var(--safe-b); background: rgba(13, 14, 17, .94); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-top: 1px solid var(--line); }
.tabbar a { display: grid; place-content: center; justify-items: center; gap: 4px; color: var(--text-3); font: 600 10.5px var(--font-ui); position: relative; }
.tabbar a .icon { width: 22px; height: 22px; }
.tabbar a.active { color: var(--accent-text); }
.tabbar a.active::before { content: ""; position: absolute; top: 0; left: 26%; right: 26%; height: 2px; border-radius: 0 0 3px 3px; background: var(--accent); }
@media (min-width: 900px) {
  .tabbar { left: 50%; right: auto; transform: translateX(-50%); bottom: calc(12px + var(--safe-b)); width: min(720px, calc(100% - 32px)); height: 58px; padding: 0; border-radius: 18px; border: 1px solid var(--line-2); box-shadow: var(--shadow-2); }
  .tabbar a { grid-auto-flow: column; gap: 8px; font-size: 12.5px; }
  .tabbar a.active::before { top: auto; bottom: 0; border-radius: 3px 3px 0 0; }
}
.fab-dice { position: fixed; right: 16px; bottom: calc(var(--tabbar-h) + 14px + var(--safe-b)); z-index: 41; width: 58px; height: 58px; border-radius: 18px; border: 0; display: grid; place-items: center; color: #0f0b1a; background: var(--accent); box-shadow: 0 12px 30px color-mix(in srgb, var(--accent) 40%, transparent), 0 0 0 1px rgba(255, 255, 255, .1) inset; }
.fab-dice .icon { width: 30px; height: 30px; stroke-width: 1.8; }
.fab-dice:active { transform: scale(.94) rotate(-8deg); }
@media (min-width: 900px) { .fab-dice { bottom: calc(24px + var(--safe-b)); right: 24px; } }

/* ---------- Panneau vital ---------- */
.hp-card { padding: 12px; }
.hp-row { display: grid; grid-template-columns: 54px minmax(0, 1fr) 54px; gap: 8px; align-items: stretch; }
.hp-step { border-radius: 14px; border: 1px solid var(--line-2); background: var(--ink-3); color: var(--text-2); display: grid; place-items: center; }
.hp-step:active { background: var(--ink-4); transform: scale(.97); }
.hp-step .icon { width: 22px; height: 22px; }
.hp-big { border: 0; background: none; color: var(--text); display: flex; flex-wrap: wrap; align-items: baseline; justify-content: center; gap: 2px 6px; padding: 4px 0; }
.hp-now { font: 800 46px/1 var(--font-display); letter-spacing: -.03em; }
.hp-max { font: 600 18px var(--font-display); color: var(--text-3); }
.hp-temp { font: 700 12px var(--font-ui); color: #8fc3ff; padding: 2px 7px; border-radius: 20px; background: rgba(93, 141, 189, .16); }
.hp-big small { flex-basis: 100%; text-align: center; font-size: 10.5px; color: var(--text-4); letter-spacing: .02em; }
.hp-bar { position: relative; height: 8px; margin: 10px 2px 12px; border-radius: 6px; background: var(--ink-4); overflow: hidden; }
.hp-bar i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 6px; background: linear-gradient(90deg, var(--good), #8fe0b2); transition: width .3s var(--ease); }
.hp-bar b { position: absolute; right: 0; top: 0; bottom: 0; background: repeating-linear-gradient(45deg, #5d8dbd, #5d8dbd 4px, #7aa8d6 4px, #7aa8d6 8px); opacity: .85; }
.hp-actions { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.hp-actions .btn { height: 40px; }
.hp-card.dying { border-color: rgba(224, 96, 106, .5); animation: dying 1.8s ease-in-out infinite; }
.hp-card.dead { opacity: .8; filter: grayscale(.6); }
@keyframes dying { 50% { box-shadow: 0 0 0 4px rgba(224, 96, 106, .18); } }
.death { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); display: grid; gap: 8px; }
.death-row { display: flex; align-items: center; justify-content: space-between; font-size: 12.5px; color: var(--text-2); }
.dpips { display: flex; gap: 6px; }
.dpips i { width: 20px; height: 20px; border-radius: 50%; border: 2px solid var(--ink-5); }
.dpips.ok i.on { background: var(--good); border-color: var(--good); }
.dpips.ko i.on { background: var(--bad); border-color: var(--bad); }
.stable { display: flex; align-items: center; gap: 6px; margin: 0; color: var(--good); font-weight: 600; }
.dead-note { display: flex; gap: 8px; align-items: center; margin: 10px 0 0; color: #f0a3a8; font-size: 12.5px; }

.conc-card { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 10px 12px; border-color: rgba(95, 179, 166, .45); background: rgba(95, 179, 166, .08); }
.conc-card > div:first-child { display: flex; align-items: center; gap: 8px; font-size: 13px; color: #a9e3da; }
.conc-btns { display: flex; gap: 6px; }

.stat-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 66px; padding: 8px 4px; border-radius: 14px; border: 1px solid var(--line); background: var(--ink-2); color: var(--text); }
button.stat:active { background: var(--ink-3); }
.stat b { font: 800 22px/1 var(--font-display); letter-spacing: -.02em; }
.stat b small { font: 600 11px var(--font-ui); color: var(--text-3); margin-left: 2px; }
.stat span { font: 600 9.5px var(--font-ui); letter-spacing: .09em; text-transform: uppercase; color: var(--text-3); text-align: center; }

.cond-card { padding: 12px; }
.cond-head { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.cond-head h3 { display: flex; align-items: center; gap: 6px; margin: 0 auto 0 0; font: 700 13px var(--font-display); }
.cond-head h3 .icon { color: var(--accent-text); }
.chip-toggle { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 10px; border-radius: 20px; border: 1px solid var(--line-2); background: var(--ink-1); color: var(--text-3); font: 600 12px var(--font-ui); }
.chip-toggle.on { color: #ffd98a; border-color: rgba(224, 182, 94, .45); background: rgba(224, 182, 94, .1); }
.chip-toggle.danger { color: #ec9aa0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.cond-chip { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 8px 0 12px; border-radius: 20px; border: 1px solid color-mix(in srgb, var(--c) 55%, transparent); background: color-mix(in srgb, var(--c) 16%, transparent); color: color-mix(in srgb, var(--c) 45%, white); font: 600 12.5px var(--font-ui); }
.cond-chip em { font: 600 10.5px var(--font-mono); font-style: normal; opacity: .85; }
.cond-chip .icon { width: 14px; height: 14px; opacity: .7; }
.cond-pick { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 6px; margin: 8px 0 12px; }
.cond-opt { height: 44px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--ink-3); color: var(--text); font: 600 13px var(--font-ui); border-left: 4px solid var(--c); }
.cond-opt.on { background: color-mix(in srgb, var(--c) 18%, transparent); }

/* ---------- Mode de jet ---------- */
.rollmode { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 4px; padding: 4px; margin-bottom: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--ink-1); position: sticky; top: calc(58px + var(--safe-t)); z-index: 10; }
.rollmode button { height: 36px; border: 0; border-radius: 10px; background: transparent; color: var(--text-3); font: 600 12.5px var(--font-ui); }
.rollmode button.active { background: var(--ink-4); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-2); }
.rollmode button.active.adv { background: rgba(78, 154, 106, .18); color: #9bdcb2; box-shadow: inset 0 0 0 1px rgba(78, 154, 106, .5); }
.rollmode button.active.dis { background: rgba(224, 96, 106, .16); color: #f0a3a8; box-shadow: inset 0 0 0 1px rgba(224, 96, 106, .45); }

/* ---------- Tour de combat ---------- */
.turn-card.in-combat { border-color: var(--accent-line); background: radial-gradient(120% 100% at 100% 0%, var(--accent-soft), transparent 60%), var(--ink-2); }
.turn-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.turn-head h3 { display: flex; align-items: center; gap: 8px; margin: 0; font: 800 16px var(--font-display); }
.turn-head h3 .icon { color: var(--accent-text); }
.economy { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.eco { display: grid; justify-items: center; gap: 6px; padding: 10px 4px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--ink-1); color: var(--text-2); font: 600 11px/1.2 var(--font-ui); text-align: center; }
.eco i { width: 16px; height: 16px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.eco.used { color: var(--text-4); background: transparent; border-style: dashed; }
.eco.used i { background: transparent; box-shadow: inset 0 0 0 2px var(--ink-5); }
.turn-card .btn.block { height: 46px; font-size: 14px; }
.rest-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.rest-row .btn { height: 46px; }

/* ---------- Lignes d'entrées ---------- */
.rows { display: grid; gap: 2px; }
.row { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 4px 0; border-bottom: 1px solid rgba(255, 255, 255, .04); }
.row:last-child { border-bottom: 0; }
.row-main { flex: 1; min-width: 0; display: grid; gap: 2px; padding: 6px 2px; border: 0; background: none; color: var(--text); text-align: left; }
.row-main.static { cursor: default; }
.row-main b { font: 600 14px/1.25 var(--font-ui); }
.row-main small { font-size: 11.5px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-btns { display: flex; gap: 6px; flex: 0 0 auto; flex-wrap: wrap; justify-content: flex-end; }
.rbtn { display: inline-flex; align-items: center; gap: 5px; height: 38px; padding: 0 11px; border-radius: 11px; border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent-text); font: 700 13px var(--font-ui); white-space: nowrap; }
.rbtn:active { transform: scale(.96); }
.rbtn.dmg { border-color: rgba(224, 138, 60, .45); background: rgba(224, 138, 60, .12); color: #f3b47c; }
.rbtn.cast { border-color: var(--line-2); background: var(--ink-3); color: var(--text); }
.row.unprep .row-main b { color: var(--text-3); }
.prep { width: 28px; height: 28px; flex: 0 0 auto; border-radius: 50%; border: 2px solid var(--ink-5); background: transparent; color: #0f0b1a; display: grid; place-items: center; }
.prep.on { background: var(--accent); border-color: var(--accent); }
.mini-tag { display: inline-flex; align-items: center; height: 16px; padding: 0 5px; margin-left: 6px; border-radius: 4px; font: 700 9.5px var(--font-mono); vertical-align: 2px; color: var(--text-2); background: var(--ink-4); }
.mini-tag.c { color: #a9e3da; background: rgba(95, 179, 166, .16); }
.mini-tag.r { color: #ffd98a; background: rgba(224, 182, 94, .14); }
.mini-tag.a { color: var(--accent-text); background: var(--accent-soft); }
.add-row { margin-top: 6px; }
.add-row button { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 1px dashed var(--line-2); border-radius: 10px; background: none; color: var(--text-3); font: 600 12px var(--font-ui); }
.big-add { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin: 4px 0 12px; }
.big-add .btn { height: 44px; }
.empty-block { display: grid; justify-items: center; gap: 8px; padding: 28px 14px; text-align: center; color: var(--text-3); }
.empty-block .icon { width: 28px; height: 28px; color: var(--accent-text); }
.empty-block p { margin: 0; max-width: 360px; line-height: 1.5; font-size: 13px; }

.pips { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; max-width: 60%; }
.pips button { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--ink-5); background: transparent; padding: 0; }
.pips button.on { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.pips.big button { width: 28px; height: 28px; }
.uses-count { display: inline-flex; align-items: center; gap: 6px; }
.uses-count button { width: 34px; height: 34px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--ink-3); color: var(--text-2); display: grid; place-items: center; }
.uses-count b { font: 800 18px var(--font-display); }
.uses-count span { font-size: 12px; color: var(--text-3); }
.slot-summary { display: grid; gap: 6px; margin-bottom: 8px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.slot-line { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.slot-line span { font: 600 11px var(--font-ui); letter-spacing: .08em; text-transform: uppercase; color: var(--text-3); }

/* ---------- Onglet Fiche ---------- */
.level-card .lvl-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.lvl-top b { display: block; font: 800 20px var(--font-display); }
.lvl-top span { font-size: 12px; color: var(--text-3); }
.xp { width: 100%; display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 10px; margin-top: 12px; padding: 0; border: 0; background: none; color: var(--text-2); text-align: left; }
.xp-bar { grid-column: 1 / -1; height: 8px; border-radius: 6px; background: var(--ink-4); overflow: hidden; }
.xp-bar i { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-text)); border-radius: 6px; }
.xp span { font: 500 12px var(--font-mono); }
.xp em { display: inline-flex; align-items: center; gap: 4px; font-style: normal; font: 600 12px var(--font-ui); color: var(--accent-text); }

.abil-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
@media (min-width: 600px) { .abil-grid { grid-template-columns: repeat(6, 1fr); } }
.abil { display: grid; gap: 6px; padding: 8px; border-radius: 16px; border: 1px solid var(--line); background: var(--ink-2); }
.abil-main { display: grid; justify-items: center; gap: 1px; padding: 4px 0; border: 0; background: none; color: var(--text); }
.abil-main span { font: 700 10.5px var(--font-ui); letter-spacing: .12em; color: var(--text-3); }
.abil-main b { font: 800 28px/1.05 var(--font-display); letter-spacing: -.02em; }
.abil-main em { font-style: normal; font: 600 12px var(--font-mono); color: var(--text-3); padding: 1px 8px; border-radius: 20px; background: var(--ink-1); border: 1px solid var(--line); }
.abil-input { width: 100%; height: 36px; border-radius: 9px; border: 1px solid var(--accent-line); background: var(--ink-1); color: var(--text); text-align: center; font: 700 16px var(--font-display); }
.abil-save { display: flex; align-items: center; justify-content: center; gap: 6px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--ink-1); color: var(--text-2); font: 600 12px var(--font-ui); }
.abil-save.is-prof { color: var(--accent-text); border-color: var(--accent-line); }
.prof { width: 10px; height: 10px; flex: 0 0 auto; border-radius: 50%; border: 1.5px solid var(--ink-5); display: inline-block; }
.prof.p1 { background: var(--accent); border-color: var(--accent); }
.prof.p2 { background: var(--accent); border-color: var(--accent-text); box-shadow: 0 0 0 2px var(--accent-soft), inset 0 0 0 2px var(--ink-2); }
.prof.p05 { background: linear-gradient(90deg, var(--accent) 50%, transparent 50%); border-color: var(--accent); }
.skills { display: grid; grid-template-columns: 1fr; gap: 0 18px; }
@media (min-width: 600px) { .skills { grid-template-columns: 1fr 1fr; } }
.skill { display: flex; align-items: center; gap: 10px; min-height: 44px; border-bottom: 1px solid rgba(255, 255, 255, .04); }
.skill-main { flex: 1; display: flex; align-items: center; gap: 8px; height: 44px; padding: 0; border: 0; background: none; color: var(--text-2); text-align: left; }
.skill.pro .skill-main { color: var(--text); }
.skill-main .nm { flex: 1; font-size: 14px; }
.skill-main .ab { font: 600 10px var(--font-mono); color: var(--text-4); }
.skill-main b { min-width: 40px; text-align: right; font: 700 15px var(--font-display); }
.dot-btn { width: 32px; height: 32px; display: grid; place-items: center; border: 1px dashed var(--accent-line); border-radius: 8px; background: none; }
.mini-x { width: 32px; height: 32px; display: grid; place-items: center; border: 0; background: none; color: var(--text-3); }
.passives { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 12px; }
.passives span { font: 600 10.5px var(--font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.passives b { font-weight: 600; color: var(--text-2); }
.tagline { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px; align-items: start; padding: 8px 0; border-bottom: 1px solid rgba(255, 255, 255, .04); }
.tagline:last-child { border-bottom: 0; }
.tagline > span { font: 600 10.5px/2.3 var(--font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.tags { display: flex; flex-wrap: wrap; gap: 5px; }
.tag { display: inline-flex; align-items: center; gap: 4px; min-height: 28px; padding: 2px 10px; border-radius: 8px; background: var(--ink-1); border: 1px solid var(--line); font-size: 12.5px; color: var(--text-2); }
.tag button { display: grid; place-items: center; width: 20px; height: 20px; padding: 0; border: 0; background: none; color: var(--text-3); }
.tag.add { border-style: dashed; color: var(--accent-text); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
@media (min-width: 900px) { .form-grid { grid-template-columns: repeat(3, 1fr); } }
.edit-card { border-color: var(--accent-line); }
.bio-block h4 { margin: 12px 0 4px; font: 600 10.5px var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.bio-block p { margin: 0 0 6px; line-height: 1.55; color: var(--text-2); font-family: var(--font-serif); font-size: 15px; }
.bio-meta { margin: 0 0 6px; font-size: 12.5px; color: var(--text-3); }

/* ---------- Onglet Sorts ---------- */
.spell-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.lvl-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 4px; }
.lvl-head h3 { margin: 0; font: 700 14px var(--font-display); }
.slot-edit { display: inline-flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-3); }
.slot-edit input { width: 60px; height: 34px; border-radius: 8px; border: 1px solid var(--accent-line); background: var(--ink-1); color: var(--text); text-align: center; font-size: 15px; }

/* ---------- Onglet Sac ---------- */
.coins { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; }
.coin { display: grid; justify-items: center; gap: 5px; padding: 8px 2px; border-radius: 12px; border: 1px solid var(--line); background: var(--ink-1); color: var(--text); }
.coin i { width: 26px; height: 26px; display: grid; place-items: center; border-radius: 50%; font: 700 9.5px var(--font-ui); font-style: normal; color: #1a1408; box-shadow: inset 0 -2px 0 rgba(0, 0, 0, .2); }
.coin b { font: 700 14px var(--font-display); }
.coins-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 10px; font-size: 12px; color: var(--text-3); }
.weight-card { display: grid; gap: 8px; }
.wline { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--text-3); }
.wline b { color: var(--text-2); font-weight: 600; }
.wline b.over { color: var(--bad); }
.wbar { height: 7px; border-radius: 6px; background: var(--ink-4); overflow: hidden; }
.wbar i { display: block; height: 100%; background: var(--accent); }
.wbar i.over { background: var(--bad); }
.equip { width: 30px; height: 30px; flex: 0 0 auto; border-radius: 8px; border: 2px solid var(--ink-5); background: transparent; color: #0f0b1a; display: grid; place-items: center; }
.equip.on { background: var(--accent); border-color: var(--accent); }
.qty { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.qty button { width: 32px; height: 32px; border-radius: 9px; border: 1px solid var(--line); background: var(--ink-1); color: var(--text-3); display: grid; place-items: center; }
.qty b { min-width: 28px; text-align: center; font: 700 14px var(--font-display); }
.loot-coins { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 14px; }
.loot-coin { display: grid; justify-items: center; gap: 6px; }
.loot-coin i { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; font: 700 10px var(--font-ui); font-style: normal; color: #1a1408; }
.loot-coin input { width: 100%; height: 42px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--ink-1); color: var(--text); text-align: center; font-size: 16px; }

/* ---------- Détails d'entrée ---------- */
.sub-line { margin: 0 0 10px; font-size: 13px; color: var(--text-3); font-style: italic; }
.en { margin: -6px 0 10px; font: 500 11.5px var(--font-mono); color: var(--text-4); }
.facts { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; margin: 0 0 12px; }
.facts div { padding: 8px 10px; border-radius: 10px; background: var(--ink-1); border: 1px solid var(--line); }
.facts dt { font: 600 9.5px var(--font-ui); letter-spacing: .1em; text-transform: uppercase; color: var(--text-3); }
.facts dd { margin: 3px 0 0; font-size: 13px; color: var(--text); }
.prose { font-family: var(--font-serif); font-size: 15.5px; line-height: 1.6; color: var(--text-2); }
.prose p { margin: 0 0 10px; }
.prose p.li { padding-left: 16px; position: relative; }
.prose p.li::before { content: "•"; position: absolute; left: 3px; color: var(--accent-text); }
.prose h3, .prose h4, .prose h5 { font-family: var(--font-display); color: var(--text); margin: 16px 0 6px; font-size: 15px; }
.prose b { color: var(--text); }
.prose details { margin: 6px 0; padding: 8px 10px; border-radius: 10px; background: var(--ink-1); border: 1px solid var(--line); font-family: var(--font-ui); font-size: 14px; }
.prose details summary { cursor: pointer; font-weight: 600; color: var(--text); }
.prose details .lvl { display: inline-grid; place-items: center; width: 22px; height: 22px; margin-right: 8px; border-radius: 6px; background: var(--accent-soft); color: var(--accent-text); font: 700 11px var(--font-mono); }
.md-table { overflow-x: auto; margin: 8px 0 12px; -webkit-overflow-scrolling: touch; }
.md-table table { border-collapse: collapse; font-family: var(--font-ui); font-size: 12.5px; min-width: 100%; }
.md-table th, .md-table td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.md-table th { color: var(--text-3); font-weight: 600; }
.entry-rolls { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.entry-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.entry-uses { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 12px; padding: 10px 12px; border-radius: 12px; background: var(--ink-1); border: 1px solid var(--line); font-size: 12.5px; color: var(--text-3); }
.entry-tools { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.entry-form .field { margin-bottom: 12px; }
.fav-ic { color: #ffd98a; vertical-align: -2px; }
.mon-line { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; margin-bottom: 10px; }
.mon-line div { display: grid; justify-items: center; padding: 8px 4px; border-radius: 10px; background: var(--ink-1); border: 1px solid var(--line); text-align: center; }
.mon-line b { font: 700 15px var(--font-display); }
.mon-line span { font-size: 10.5px; color: var(--text-3); }
.mon-abil { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; margin-bottom: 10px; }
.mon-abil div { display: grid; justify-items: center; padding: 6px 2px; border-radius: 9px; background: var(--ink-1); }
.mon-abil span { font: 600 9.5px var(--font-ui); color: var(--text-3); }
.mon-abil b { font: 700 14px var(--font-display); }
.mon-abil em { font-style: normal; font-size: 11px; color: var(--text-3); }

/* ---------- Journal ---------- */
.journal-kinds { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-bottom: 10px; }
.journal-kinds button { position: relative; display: grid; justify-items: center; gap: 4px; padding: 10px 2px; border-radius: 12px; border: 1px solid var(--line); background: var(--ink-2); color: var(--text-3); font: 600 11px var(--font-ui); }
.journal-kinds button.active { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-soft); }
.journal-kinds em { position: absolute; top: 4px; right: 6px; font: 600 9.5px var(--font-mono); font-style: normal; color: var(--text-4); }
.journal-list { display: grid; gap: 8px; margin-bottom: 12px; }
@media (min-width: 900px) { .journal-list { grid-template-columns: 1fr 1fr; } }
.jcard { display: flex; gap: 12px; align-items: flex-start; padding: 12px; border-radius: 14px; border: 1px solid var(--line); background: var(--ink-2); color: var(--text); text-align: left; }
.jcard.quest.done { opacity: .65; }
.jcard.quest.failed { opacity: .55; }
.jcard.npc.hostile { border-left: 3px solid var(--bad); }
.jcard.npc.friend { border-left: 3px solid var(--good); }
.jbody { display: grid; gap: 3px; min-width: 0; }
.jbody b { display: flex; align-items: center; gap: 6px; font: 700 14.5px var(--font-display); }
.jbody small { font-size: 11.5px; color: var(--accent-text); }
.jbody p { margin: 2px 0 0; font-size: 13px; line-height: 1.5; color: var(--text-3); }
.jphoto { width: 52px; height: 52px; flex: 0 0 auto; border-radius: 12px; display: grid; place-items: center; color: var(--text-4); background: var(--ink-3) center / cover no-repeat; border: 1px solid var(--line-2); }
.jphoto.big { width: 88px; height: 88px; border-radius: 16px; }
.photo-row { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }

/* ---------- Résultat de jet ---------- */
.roll-pop { position: fixed; z-index: 250; left: 50%; bottom: calc(var(--tabbar-h) + 86px + var(--safe-b)); transform: translateX(-50%); width: min(420px, calc(100% - 24px)); padding: 12px 14px 14px; border-radius: 18px; border: 1px solid var(--line-2); background: rgba(21, 23, 26, .97); box-shadow: var(--shadow-3); animation: pop-in .22s var(--ease); }
.roll-pop.out { animation: pop-out .2s ease forwards; }
.roll-pop.crit-success { border-color: rgba(224, 182, 94, .6); box-shadow: var(--shadow-3), 0 0 40px rgba(224, 182, 94, .18); }
.roll-pop.crit-fail { border-color: rgba(224, 96, 106, .55); }
@keyframes pop-in { from { opacity: 0; transform: translate(-50%, 16px) scale(.97); } }
@keyframes pop-out { to { opacity: 0; transform: translate(-50%, 10px); } }
.rp-head { display: flex; align-items: center; gap: 8px; }
.rp-label { flex: 1; font: 600 13px var(--font-ui); color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rp-mode { font: 600 10.5px var(--font-ui); padding: 3px 8px; border-radius: 20px; background: var(--accent-soft); color: var(--accent-text); }
.rp-main { display: flex; align-items: center; gap: 14px; margin-top: 4px; }
.rp-total { font: 800 52px/1 var(--font-display); letter-spacing: -.03em; min-width: 64px; }
.crit-success .rp-total { color: #ffd98a; }
.crit-fail .rp-total { color: #f0a3a8; }
.rp-side { display: grid; gap: 6px; min-width: 0; }
.rp-dice { display: flex; flex-wrap: wrap; gap: 4px; }
.rp-formula { font: 500 11.5px var(--font-mono); color: var(--text-3); }
.rp-badge { margin-top: 8px; font: 700 12px var(--font-ui); letter-spacing: .06em; text-transform: uppercase; }
.rp-badge.good { color: #ffd98a; }
.rp-badge.bad { color: #f0a3a8; }
.rp-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.rp-actions .btn { height: 40px; flex: 1; }
@media (min-width: 900px) { .roll-pop { bottom: calc(96px + var(--safe-b)); } }
.die-chip { min-width: 26px; height: 26px; padding: 0 6px; display: grid; place-items: center; border-radius: 7px; border: 1px solid var(--line-2); background: var(--ink-1); font: 600 12px var(--font-ui); color: var(--text-2); }
.die-chip.max { color: var(--accent-text); border-color: var(--accent-line); }
.die-chip.min { color: var(--crimson-2); border-color: rgba(191, 74, 82, .4); }
.die-chip.dropped { opacity: .35; text-decoration: line-through; }
.die-chip.mod { border-style: dashed; background: transparent; }
.dice-stage { position: fixed; inset: 0; z-index: 240; pointer-events: none; overflow: hidden; }
.dice-canvas { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.dice-total { display: none; }

/* ---------- Plateau de dés ---------- */
.dice-pad { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin-bottom: 12px; }
.die-btn { position: relative; display: grid; justify-items: center; gap: 4px; padding: 12px 4px 10px; border-radius: 14px; border: 1px solid var(--line-2); background: var(--ink-3); color: var(--text); }
.die-btn.on { border-color: var(--accent); background: var(--accent-soft); }
.die-btn .icon { width: 26px; height: 26px; color: var(--accent-text); }
.die-btn b { font: 700 14px var(--font-display); }
.die-btn em { position: absolute; top: 6px; right: 8px; font: 700 11px var(--font-mono); font-style: normal; color: var(--accent-text); }
.dice-mod { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; font-size: 13px; color: var(--text-2); }
.dice-formula { margin: 4px 0 14px; padding: 12px; border-radius: 12px; background: var(--ink-1); border: 1px dashed var(--line-2); text-align: center; font: 600 16px var(--font-mono); color: var(--accent-text); }
.hist-head { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 4px; }
.hist-head h4 { display: flex; align-items: center; gap: 6px; margin: 0; font: 600 11px var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.hist { display: grid; gap: 4px; }
.hist-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 12px; background: var(--ink-1); border: 1px solid var(--line); }
.hist-row.crit { border-color: rgba(224, 182, 94, .5); }
.hist-row.fumble { border-color: rgba(224, 96, 106, .45); }
.hist-main { flex: 1; min-width: 0; display: grid; gap: 3px; }
.hist-main b { font-size: 13px; }
.hist-main small { font-size: 11px; color: var(--text-3); }
.hist-dice { display: flex; flex-wrap: wrap; gap: 3px; }
.hist-dice .die-chip { min-width: 22px; height: 22px; font-size: 11px; }
.hist-total { font: 800 24px var(--font-display); }

/* ---------- Compendium ---------- */
.comp-tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px 10px; padding: 0 16px; }
.comp-tabs::-webkit-scrollbar { display: none; }
.comp-tabs button { flex: 0 0 auto; display: inline-flex; align-items: center; gap: 6px; height: 38px; padding: 0 14px; border-radius: 20px; border: 1px solid var(--line-2); background: var(--ink-2); color: var(--text-3); font: 600 12.5px var(--font-ui); }
.comp-tabs button.active { color: var(--accent-text); border-color: var(--accent-line); background: var(--accent-soft); }
.comp-tools { display: grid; gap: 8px; margin-bottom: 10px; position: sticky; top: calc(56px + var(--safe-t)); z-index: 15; padding: 6px 0; background: var(--ink-0); }
.comp-filters { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.comp-filters select { flex: 0 0 auto; height: 36px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--ink-2); color: var(--text-2); font-size: 13px; }
.comp-count { margin: 0 0 6px; font: 500 11px var(--font-mono); color: var(--text-4); }
.comp-list { display: grid; gap: 0; }
@media (min-width: 900px) { .comp-list { grid-template-columns: 1fr 1fr; column-gap: 18px; } .comp-count { grid-column: 1 / -1; } }
.comp-row { display: flex; align-items: center; gap: 8px; border-bottom: 1px solid var(--line); }
.comp-open { flex: 1; min-width: 0; display: grid; gap: 2px; min-height: 56px; padding: 8px 2px; border: 0; background: none; color: var(--text); text-align: left; }
.comp-open b { font: 600 14.5px var(--font-ui); }
.comp-open small { font-size: 12px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.comp-add { width: 40px; height: 40px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 12px; border: 1px solid var(--accent-line); background: var(--accent-soft); color: var(--accent-text); }
.comp-add.done { background: var(--accent); color: #0f0b1a; }

/* ---------- Contenu, réglages ---------- */
.row.pack.off { opacity: .55; }
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--line); cursor: pointer; }
.set-row:last-child { border-bottom: 0; }
.set-row > span:first-child { display: grid; gap: 2px; }
.set-row b { font: 600 14px var(--font-ui); }
.set-row small { font-size: 12px; color: var(--text-3); }
.switch { width: 46px; height: 28px; }
.switch span::after { width: 22px; height: 22px; }
.switch input:checked + span::after { transform: translateX(18px); }
.danger-zone { border-color: rgba(191, 74, 82, .3); }
.hb-form { max-height: none; }
.hb-field input, .hb-field select, .hb-row input { height: 42px; font-size: 15px; }
.hb-field textarea, .hb-row textarea { font-size: 15px; }
@media (max-width: 720px) { .hb-grid { grid-template-columns: 1fr; } .hb-kinds { grid-template-columns: 1fr; } }
.look { display: flex; align-items: center; gap: 16px; margin-bottom: 16px; }
.look-portrait { width: 96px; height: 96px; flex: 0 0 auto; border-radius: 50%; display: grid; place-items: center; font: 800 28px var(--font-display); color: var(--accent-text); background: var(--ink-3) center / cover no-repeat; box-shadow: 0 0 0 3px var(--accent); }
.look-btns { display: flex; flex-wrap: wrap; gap: 6px; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; }
.swatch.on { border-color: #fff; box-shadow: 0 0 0 2px var(--ink-2), 0 0 0 4px rgba(255, 255, 255, .3); }
.qr-box { width: min(300px, 100%); margin: 6px auto 12px; padding: 10px; border-radius: 16px; background: #fff; }
.qr-box svg { display: block; width: 100%; height: auto; }
.qr-text { white-space: pre-wrap; margin: 0; padding: 10px 12px; border-radius: 12px; background: var(--ink-1); border: 1px solid var(--line); font: 500 11.5px/1.5 var(--font-mono); color: var(--text-2); }

/* ---------- Fiche vierge ---------- */
.blank-card { display: grid; justify-items: center; gap: 12px; margin: 24px 16px; padding: 30px 20px; text-align: center; border-radius: 22px; border: 1px dashed var(--accent-line); background: radial-gradient(80% 90% at 50% 0%, var(--accent-soft), transparent 70%), var(--ink-2); }
.blank-card h2 { margin: 0; font: 800 22px var(--font-display); }
.blank-card p { margin: 0; max-width: 420px; color: var(--text-2); line-height: 1.55; }
.blank-mark { width: 64px; height: 64px; display: grid; place-items: center; border-radius: 20px; color: var(--accent-text); background: var(--accent-soft); border: 1px solid var(--accent-line); }

/* ---------- Assistant de Noctis en plein écran sur téléphone ---------- */
.creator-layer, .creator-layer + * { --violet: var(--accent); }
.creator-layer { grid-template-columns: minmax(0, 1fr); }
@media (max-width: 720px) {
  .creator-layer { padding: 0; align-items: stretch; }
  .creator-head { flex-wrap: wrap; gap: 10px; padding-left: 14px; padding-right: 10px; }
  .creator-title { flex: 1; min-width: 0; }
  .creator-title h2 { font-size: 17px; }
  .creator-head-actions { margin-left: 0; gap: 4px; }
  .creator-level { font-size: 0; letter-spacing: 0; }
  .creator-level select { font-size: 13px; }
  .creator { width: 100%; height: 100dvh; max-height: none; border-radius: 0; padding-bottom: var(--safe-b); }
  .creator-head { padding-top: calc(12px + var(--safe-t)); }
  .creator-foot { padding-bottom: calc(12px + var(--safe-b)); }
  .creator-foot .btn { height: 42px; }
}

/* ---------- Impression ---------- */
#printRoot { display: none; }
@media print {
  @page { size: A4; margin: 12mm; }
  body.printing { background: #fff !important; color: #111 !important; overflow: visible; }
  body.printing::before, body.printing #app, body.printing .dice-stage, body.printing .toasts, body.printing .modal-layer, body.printing .roll-pop { display: none !important; }
  body.printing #printRoot { display: block; }
  .print-sheet { font: 10pt/1.35 "IBM Plex Sans", Arial, sans-serif; color: #111; }
  .print-sheet h1 { margin: 0; font: 800 20pt "Bricolage Grotesque", Arial, sans-serif; }
  .print-sheet h2 { margin: 10px 0 4px; padding-bottom: 2px; border-bottom: 1.5px solid #111; font: 700 10.5pt "Bricolage Grotesque", Arial, sans-serif; text-transform: uppercase; letter-spacing: .06em; }
  .print-sheet p { margin: 0 0 4px; }
  .ps-head { display: flex; gap: 12px; align-items: center; margin-bottom: 8px; }
  .ps-head img { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; }
  .ps-small { font-size: 8pt; color: #555; }
  .ps-core { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; margin: 6px 0; }
  .ps-core div { border: 1px solid #111; border-radius: 6px; padding: 4px; text-align: center; }
  .ps-core b { display: block; font-size: 13pt; }
  .ps-core span { font-size: 7.5pt; text-transform: uppercase; color: #444; }
  .ps-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
  .print-sheet table { width: 100%; border-collapse: collapse; }
  .print-sheet td, .print-sheet th { padding: 1.5px 3px; border-bottom: .5px solid #ccc; text-align: left; font-size: 9pt; }
  .ps-features p { font-size: 8.8pt; }
  .print-sheet section { break-inside: avoid-page; }
}
.muted-line .icon { display: inline-block; vertical-align: -3px; }
.filterbar .search { flex: 1 1 100%; }
@media (min-width: 900px) { .filterbar .search { flex: 1 1 260px; } }
.slot-choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; }
.slot-choice { display: grid; gap: 2px; justify-items: start; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--ink-2); color: var(--text); text-align: left; }
.slot-choice:hover:not(:disabled) { border-color: var(--violet); }
.slot-choice:disabled { opacity: .35; }
.slot-choice b { font: 700 14px var(--font-display); }
.slot-choice span { font-size: 11.5px; color: var(--text-3); }
.slot-choice em { font-style: normal; font: 600 12px var(--font-mono); color: var(--violet-2); }
.slot-choice.ritual { border-style: dashed; }
.slot-choice { min-height: 64px; }
.slot-choice:hover:not(:disabled) { border-color: var(--accent); }
.roll-pop { background: #16181c; }
@media (max-width: 720px) {
  .toasts { top: calc(10px + var(--safe-t)); bottom: auto; }
}
.dice-modal .seg.wide { margin-bottom: 14px; }

/* ---------- Version 1.1 ---------- */
.undo-btn { position: fixed; left: 50%; bottom: calc(var(--tabbar-h) + 22px + var(--safe-b)); z-index: 42; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; display: inline-flex; align-items: center; gap: 8px; height: 42px; padding: 0 16px; border-radius: 22px; border: 1px solid var(--line-2); background: var(--ink-3); color: var(--text); font: 600 13px var(--font-ui); box-shadow: var(--shadow-2); transition: opacity .2s, transform .2s var(--ease); }
.undo-btn.show { opacity: 1; transform: translate(-50%, 0); pointer-events: auto; }
.undo-btn .icon { color: var(--accent-text); transform: scaleX(-1); }
@media (min-width: 900px) { .undo-btn { bottom: calc(86px + var(--safe-b)); } }
.cond-chip { padding: 0; gap: 0; overflow: hidden; }
.cond-chip .cond-name { display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 6px 0 12px; border: 0; background: none; color: inherit; font: inherit; }
.cond-chip .cond-x { display: grid; place-items: center; width: 30px; height: 32px; border: 0; border-left: 1px solid color-mix(in srgb, var(--c) 35%, transparent); background: none; color: inherit; }
.cond-chip .cond-x .icon { width: 14px; height: 14px; opacity: .8; }
.ac-big { display: grid; justify-items: center; margin-bottom: 8px; }
.ac-big b { font: 800 48px/1 var(--font-display); }
.ac-big span { font: 600 10.5px var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.ac-parts { display: grid; gap: 4px; margin: 4px 0 6px; padding: 10px 12px; border-radius: 12px; background: var(--ink-1); border: 1px solid var(--line); }
.ac-parts div { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; color: var(--text-2); }
.ac-parts b { font-variant-numeric: tabular-nums; color: var(--text); }
.form-card { border-color: color-mix(in srgb, var(--good) 45%, transparent); background: linear-gradient(135deg, rgba(95, 197, 140, .1), transparent 60%), var(--ink-2); }
.form-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; color: #9bdcb2; }
.form-head b { flex: 1; font: 700 14px var(--font-display); color: var(--text); }
.form-hp { display: grid; grid-template-columns: 40px 1fr 40px; gap: 6px; align-items: center; }
.hp-step.sm { height: 38px; border-radius: 11px; }
.form-hpv { height: 38px; border-radius: 11px; border: 1px solid var(--line); background: var(--ink-1); color: var(--text-2); font: 500 13px var(--font-ui); }
.form-hpv b { font: 800 18px var(--font-display); color: var(--text); }
.form-card .hp-bar, .comp-card .hp-bar { margin: 8px 2px; }
.comp-cards { display: grid; gap: 10px; }
@media (min-width: 600px) { .comp-cards { grid-template-columns: 1fr 1fr; } }
.comp-card { padding: 10px; border-radius: 14px; border: 1px solid var(--line); background: var(--ink-1); display: grid; gap: 4px; }
.comp-card.active { border-color: color-mix(in srgb, var(--good) 55%, transparent); }
.cc-top { display: flex; align-items: center; gap: 6px; }
.row-btns.left { justify-content: flex-start; margin: 2px 0 6px; }
.add-row.center { display: flex; justify-content: center; margin: 0 0 12px; }
.row.counter.empty b { color: var(--bad); }
.macros { margin-bottom: 12px; }
.macros h4 { display: flex; align-items: center; gap: 6px; margin: 0 0 8px; font: 600 11px var(--font-ui); letter-spacing: .12em; text-transform: uppercase; color: var(--text-3); }
.macro-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.macro { display: inline-flex; align-items: stretch; border-radius: 12px; border: 1px solid var(--accent-line); background: var(--accent-soft); overflow: hidden; }
.macro > button:first-child { display: grid; gap: 1px; padding: 6px 10px; border: 0; background: none; color: var(--text); text-align: left; }
.macro b { font: 600 13px var(--font-ui); }
.macro small { font: 500 11px var(--font-mono); color: var(--accent-text); }
.macro-x { width: 30px; border: 0; border-left: 1px solid var(--accent-line); background: none; color: var(--text-3); display: grid; place-items: center; }
.sync-actions { display: grid; gap: 4px; }
.install-hint.warn { border-color: rgba(232, 179, 106, .45); background: rgba(232, 179, 106, .08); }
.install-hint .btn { flex: 0 0 auto; }

/* ---------- Thème clair ---------- */
:root[data-theme="light"] {
  color-scheme: light;
  --ink-0: #f4f2ee; --ink-1: #fbfaf8; --ink-2: #ffffff; --ink-3: #eeebe5; --ink-4: #e3dfd7; --ink-5: #c9c3b8;
  --line: #e2ddd3; --line-2: #d3cdc1;
  --text: #1c1b20; --text-2: #3d3b44; --text-3: #6c6874; --text-4: #9a95a0;
  --accent-text: color-mix(in srgb, var(--accent) 75%, black);
  --shadow-1: 0 4px 14px rgba(40, 30, 20, .1); --shadow-2: 0 12px 34px rgba(40, 30, 20, .14); --shadow-3: 0 24px 70px rgba(40, 30, 20, .2);
}
:root[data-theme="light"] body::before { opacity: 0; }
:root[data-theme="light"] .char-top { background: rgba(244, 242, 238, .9); }
:root[data-theme="light"] .tabbar { background: rgba(250, 248, 245, .95); }
:root[data-theme="light"] .roll-pop, :root[data-theme="light"] .toast { background: #ffffff; }
:root[data-theme="light"] .modal-layer { background: rgba(40, 34, 28, .35); }
:root[data-theme="light"] .card { background: var(--ink-2); }
:root[data-theme="light"] .hp-pill b { color: #1d6b43; }
:root[data-theme="light"] .hp-pill { color: #2f7a52; }
:root[data-theme="light"] .hp-pill.mid b, :root[data-theme="light"] .hp-pill.mid { color: #9a5b10; }
:root[data-theme="light"] .hp-pill.low b, :root[data-theme="light"] .hp-pill.low { color: #a3242f; }
:root[data-theme="light"] .rbtn.dmg { color: #a8561b; }
:root[data-theme="light"] .btn.danger-soft { color: #a3242f; }
:root[data-theme="light"] .btn.good-soft { color: #2f7a52; }
:root[data-theme="light"] .conc-card > div:first-child { color: #23766a; }
:root[data-theme="light"] .mini-tag.c { color: #23766a; }
:root[data-theme="light"] .mini-tag.r, :root[data-theme="light"] .chip-toggle.on { color: #8a5d00; }
:root[data-theme="light"] .rollmode button.active.adv { color: #2f7a52; }
:root[data-theme="light"] .rollmode button.active.dis { color: #a3242f; }
:root[data-theme="light"] .cond-chip { color: color-mix(in srgb, var(--c) 70%, black); }
:root[data-theme="light"] .crit-success .rp-total, :root[data-theme="light"] .rp-badge.good { color: #a06a00; }
:root[data-theme="light"] .page-top, :root[data-theme="light"] .comp-tools { background: var(--ink-0); }
/* L'assistant de création et la montée de niveau de Noctis restent en sombre. */
:root[data-theme="light"] .creator-layer { color-scheme: dark; color: #e7e9ec;
  --ink-0: #0b0c0e; --ink-1: #101215; --ink-2: #15171a; --ink-3: #1b1e22; --ink-4: #23262b; --ink-5: #2e3238;
  --line: #23262b; --line-2: #2f333a; --text: #e7e9ec; --text-2: #c2c7ce; --text-3: #8a9099; --text-4: #5b616a; }
:root[data-theme="light"] .form-head { color: #2f7a52; }

/* Table du MJ */
.table-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 8px; vertical-align: middle; background: var(--text-4); }
.table-dot.ok { background: var(--emerald-2, #5fc58c); box-shadow: 0 0 6px var(--emerald-2, #5fc58c); }
.table-dot.wait { background: #d6a64a; }
.table-dot.off { background: var(--crimson-2, #e0606a); }
.table-state { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; border: 1px solid var(--line-2); background: var(--ink-2); }
.table-state .table-dot { width: 12px; height: 12px; margin: 0; flex: none; }
.table-state div { display: grid; gap: 2px; }
.table-state small { color: var(--text-3); font-size: 12px; }
.table-state + .hint { margin-top: 10px; }
.credit a { color: var(--text-3); }
/* Synchro Noctis */
.sync-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-left: 8px; vertical-align: middle; background: var(--text-4); }
.sync-dot.ok { background: var(--emerald-2, #5fc58c); box-shadow: 0 0 6px var(--emerald-2, #5fc58c); }
.sync-dot.wait { background: #d6a64a; }
.sync-dot.off { background: var(--crimson-2, #e0606a); }
.sync-dot.auth { background: transparent; box-shadow: inset 0 0 0 1.5px var(--crimson-2, #e0606a); }
.row-main .sync-dot { margin: 0 8px 0 0; }
.table-state .sync-dot { width: 12px; height: 12px; margin: 0; flex: none; }
.choose-item[disabled] { opacity: .45; pointer-events: none; }
