:root {
  --bg: #15120e; --panel: #201b15; --panel2: #2a231b; --line: #3d3326; --gold: #d8b45a; --gold2: #f3e3b5;
  --text: #e9dfc8; --muted: #a8997c; --red: #d9534f; --blue: #4ab0e0; --green: #5cb85c;
  font-family: "Segoe UI", system-ui, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); }
a { color: var(--gold); }
h1, h2, h3 { font-family: Georgia, "Times New Roman", serif; color: var(--gold2); font-weight: normal; }
button, .btn { background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; cursor: pointer; font-size: 13px; }
button:hover { border-color: var(--gold); }
button.primary { background: #6b5320; border-color: var(--gold); color: #fff; }
button.danger { border-color: #7a2b28; color: #f2b0ad; }
button.small { padding: 2px 6px; font-size: 12px; }
input, select, textarea { background: #120f0b; color: var(--text); border: 1px solid var(--line); border-radius: 5px; padding: 5px 7px; font: inherit; font-size: 13px; }
textarea { width: 100%; resize: vertical; }
label { display: block; font-size: 12px; color: var(--muted); margin: 6px 0; }
label input, label select, label textarea { display: block; width: 100%; margin-top: 3px; }
label.inline { display: flex; align-items: center; gap: 6px; }
label.inline input { width: auto; display: inline; margin: 0; }
.muted { color: var(--muted); font-size: 12px; }
.hidden { display: none !important; }
.badge { display: inline-block; font-size: 10px; padding: 1px 5px; border-radius: 8px; background: #3a2d1c; color: var(--gold2); margin-left: 4px; vertical-align: middle; }
.badge.dm { background: #5a1f1d; color: #ffc9c6; }

/* Connexion */
.login-page { display: flex; align-items: center; justify-content: center; background: radial-gradient(circle at 50% 30%, #3a2c18, #0c0a07 70%); }
.login-card { width: 340px; background: rgba(32,27,21,.95); border: 1px solid var(--gold); border-radius: 12px; padding: 28px; box-shadow: 0 10px 60px #000; text-align: center; }
.login-card h1 { margin: 0; font-size: 30px; }
.login-card h1 span { color: var(--gold); }
.login-card .subtitle { color: var(--muted); margin-top: 4px; font-style: italic; }
.login-card form { text-align: left; }
.login-card button { width: 100%; margin-top: 12px; padding: 10px; background: #6b5320; border-color: var(--gold); }
.who { text-align: center; color: var(--gold); margin: 10px 0; font-weight: bold; }
.err { color: var(--red); min-height: 1em; }
.switch { margin-top: 14px; font-size: 13px; }

/* Application */
#app { display: flex; flex-direction: column; height: 100vh; }
header.top { display: flex; align-items: center; gap: 14px; padding: 0 12px; height: 46px; background: linear-gradient(#2a2118, #1a150f); border-bottom: 1px solid var(--line); flex-shrink: 0; }
.brand { font-family: Georgia, serif; color: var(--gold2); font-size: 18px; white-space: nowrap; }
.brand span { color: var(--gold); }
nav.tabs { display: flex; gap: 2px; }
nav.tabs a { padding: 13px 12px; color: var(--muted); text-decoration: none; font-size: 14px; border-bottom: 2px solid transparent; }
nav.tabs a.active { color: var(--gold2); border-bottom-color: var(--gold); }
.spacer { flex: 1; }
.calendar { font-size: 12px; line-height: 1.25; text-align: right; cursor: default; padding: 2px 8px; border: 1px solid var(--line); border-radius: 6px; background: #17130e; }
.calendar b { color: var(--gold2); }
.calendar .cal-btns { display: inline-flex; gap: 2px; margin-left: 6px; vertical-align: middle; }
.me { font-size: 13px; display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
main { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; overflow: auto; }
.page { max-width: 1200px; margin: 0 auto; padding: 16px; }

/* Carte */
#view-map { display: flex; overflow: hidden; }
.toolbar { width: 54px; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: center; padding: 6px 0; gap: 3px; overflow-y: auto; flex-shrink: 0; }
.toolbar button.tool { width: 40px; height: 36px; font-size: 17px; padding: 0; display: flex; align-items: center; justify-content: center; }
.toolbar button.tool.active { background: #6b5320; border-color: var(--gold); }
.toolbar .sep { width: 36px; border-top: 1px solid var(--line); margin: 4px 0; }
.toolbar .swatch { width: 18px; height: 18px; border-radius: 4px; border: 2px solid transparent; cursor: pointer; }
.toolbar .swatch.active { border-color: #fff; }
.swatches { display: grid; grid-template-columns: 18px 18px; gap: 4px; }
.toolbar input[type=color] { width: 40px; height: 24px; padding: 0; border: none; background: none; }
.toolbar input[type=range] { width: 44px; }
.toolbar .lbl { font-size: 9px; color: var(--muted); text-align: center; }
.layer-btn { width: 44px; font-size: 10px !important; padding: 4px 0 !important; }
.layer-btn.active { background: #6b5320; border-color: var(--gold); }
.layer-btn.dmlayer.active { background: #5a1f1d; border-color: var(--red); }
.mapwrap { flex: 1; position: relative; min-width: 0; display: flex; flex-direction: column; }
.mapbar { display: flex; align-items: center; gap: 8px; padding: 5px 10px; background: #1b1611; border-bottom: 1px solid var(--line); min-height: 38px; flex-wrap: wrap; }
.crumbs { font-size: 14px; }
.crumbs a { text-decoration: none; color: var(--gold); cursor: pointer; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { color: var(--muted); margin: 0 6px; }
.crumbs .cur { color: var(--gold2); font-family: Georgia, serif; }
.scale { font-size: 11px; color: var(--muted); font-style: italic; }
.canvasbox { flex: 1; position: relative; overflow: hidden; background: #0b0907; }
#mapCanvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; }
.tooltip { position: absolute; pointer-events: none; background: rgba(20,16,11,.95); border: 1px solid var(--gold); border-radius: 6px; padding: 6px 9px; font-size: 12px; max-width: 280px; z-index: 5; }
.tooltip b { color: var(--gold2); }
.zoomctl { position: absolute; right: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 3px; z-index: 4; }
.zoomctl button { width: 32px; height: 30px; font-size: 16px; padding: 0; }
.statusbar { position: absolute; left: 10px; bottom: 10px; font-size: 11px; color: var(--muted); background: rgba(0,0,0,.5); padding: 3px 7px; border-radius: 4px; z-index: 4; }
.side { width: 290px; background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; padding: 10px; flex-shrink: 0; font-size: 13px; }
.side h3 { margin: 10px 0 6px; font-size: 15px; border-bottom: 1px solid var(--line); padding-bottom: 3px; }
.side ul { list-style: none; margin: 0; padding: 0; }
.side li { padding: 4px 6px; border-radius: 4px; cursor: pointer; display: flex; align-items: center; gap: 6px; }
.side li:hover { background: var(--panel2); }
.side li .grow { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.side li.sel { background: #3a2d1c; }
.editor { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; margin-top: 8px; }
.editor .row { display: flex; gap: 6px; }
.editor .row > * { flex: 1; }
.vis-list { display: flex; flex-wrap: wrap; gap: 6px; }
.vis-list label { margin: 0; }

/* Pages */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 14px; }
.card h2 { margin: 0 0 8px; font-size: 18px; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { text-align: left; padding: 5px 6px; border-bottom: 1px solid var(--line); }
th { color: var(--muted); font-weight: normal; font-size: 12px; }
td input { width: 80px; }
.log { max-height: 320px; overflow-y: auto; font-size: 12px; }
.log div { padding: 3px 0; border-bottom: 1px dotted var(--line); }
.log time { color: var(--muted); margin-right: 6px; }
.status-en_attente { color: var(--gold); } .status-acceptee { color: var(--green); } .status-refusee { color: var(--red); }
.notes-layout { display: grid; grid-template-columns: 260px 1fr; gap: 14px; height: calc(100vh - 80px); }
.notes-list { overflow-y: auto; }
.notes-list .item { padding: 7px; border-radius: 6px; cursor: pointer; border: 1px solid transparent; }
.notes-list .item:hover, .notes-list .item.sel { background: var(--panel2); border-color: var(--line); }
.note-edit { display: flex; flex-direction: column; gap: 8px; min-height: 0; }
.note-edit .panes { flex: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-height: 0; }
.note-edit textarea { height: 100%; font-family: ui-monospace, monospace; }
.md { background: #17130e; border: 1px solid var(--line); border-radius: 6px; padding: 10px; overflow-y: auto; }
.md h1, .md h2, .md h3 { margin: .4em 0; }
.md code { background: #000; padding: 1px 4px; border-radius: 3px; }
.toast { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); background: #3a2d1c; border: 1px solid var(--gold); padding: 8px 14px; border-radius: 8px; z-index: 100; font-size: 13px; }
.modal-bg { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; z-index: 50; }
.modal { background: var(--panel); border: 1px solid var(--gold); border-radius: 10px; padding: 16px; width: 380px; max-height: 90vh; overflow: auto; }

/* ===== Reconstruction : ajouts ===== */
.row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.row > label { flex: 1; min-width: 90px; }
.grow { flex: 1; }
.small { font-size: 12px; }
.modal.wide { width: min(760px, 96vw); }
.modal-foot { display: flex; gap: 6px; justify-content: flex-end; align-items: center; margin-top: 12px; }
.modal-foot .grow { flex: 1; }
.badge.ally { background: #1f4a24; color: #c9f5cd; }
.badge.link { background: #1f3a4a; color: #c6e8ff; }
.world select { padding: 2px 4px; }
.world { font-size: 13px; }
.show-banner { background: linear-gradient(#6b5320, #4a3a17); color: #fff; padding: 5px 12px; font-size: 13px; display: flex; gap: 8px; align-items: center; justify-content: center; border-bottom: 1px solid var(--gold); }
.show-card .show-img { max-width: 100%; max-height: 55vh; display: block; margin: 8px auto; border-radius: 6px; cursor: zoom-in; }
.player-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.login-card .player-btn { margin: 0; display: flex; gap: 8px; align-items: center; justify-content: center; background: var(--panel2); border-color: var(--line); }
.login-card .player-btn:hover { border-color: var(--gold); }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
canvas.placing { cursor: copy !important; }
.placing-hint { position: absolute; top: 8px; left: 50%; transform: translateX(-50%); background: #6b5320; border: 1px solid var(--gold); padding: 4px 10px; border-radius: 6px; font-size: 13px; z-index: 5; }
img.mini { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; vertical-align: middle; }
img.portrait { width: 48px; height: 48px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); }
.portrait.big { width: 84px; height: 84px; border-radius: 10px; object-fit: cover; border: 2px solid var(--gold); cursor: zoom-in; flex-shrink: 0; }
.portrait.ph { display: flex; align-items: center; justify-content: center; font-size: 32px; background: var(--panel2); cursor: default; }
.ph { display: flex; gap: 8px; align-items: center; margin-bottom: 6px; }
.pdesc { font-size: 13px; line-height: 1.4; } .pdesc p { margin: 4px 0; }
.pbtns { display: flex; gap: 5px; flex-wrap: wrap; margin: 6px 0; }
.editor h4, .modal h4 { margin: 10px 0 4px; color: var(--gold); font-size: 13px; }
.gallery { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.gthumb { position: relative; width: 82px; }
.gthumb img { width: 82px; height: 62px; object-fit: cover; border-radius: 5px; border: 1px solid var(--line); cursor: zoom-in; display: block; }
.gthumb.hid img { opacity: .45; border-style: dashed; border-color: #a33; }
.gthumb .gcap { font-size: 10px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gtools { display: flex; flex-wrap: wrap; gap: 1px; }
.gtools button { padding: 0 3px; font-size: 10px; }
.gadd { width: 82px; height: 62px; }
.bm-list, .contents, .inh, .log { list-style: none; padding: 0; margin: 4px 0; }
.bm-list li, .contents li, .inh li { display: flex; gap: 6px; align-items: center; padding: 3px 4px; border-radius: 4px; }
.bm-list li, .inh li { cursor: pointer; }
.bm-list li:hover, .inh li:hover, .contents li:hover { background: #3a2d1c; }
.contents a, .itemlink { cursor: pointer; }
.log li { font-size: 12px; padding: 2px 0; border-bottom: 1px dotted var(--line); }
.hpbox { margin: 6px 0; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.coins-in { display: flex; gap: 6px; } .coins-in label { flex: 1; margin: 0; } .coins-in input { width: 100%; }
.viewer { position: fixed; inset: 0; background: rgba(0,0,0,.92); z-index: 200; display: flex; align-items: center; justify-content: center; }
.viewer img { max-width: 94vw; max-height: 86vh; object-fit: contain; }
.viewer .vcap { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #fff; }
.viewer button { position: absolute; background: rgba(0,0,0,.5); font-size: 28px; border: none; color: #fff; }
.viewer .vprev { left: 10px; top: 50%; } .viewer .vnext { right: 10px; top: 50%; } .viewer .vclose { right: 10px; top: 10px; font-size: 20px; }
.ep-list, .pick-list { max-height: 46vh; overflow: auto; border: 1px solid var(--line); border-radius: 6px; padding: 4px; margin: 6px 0; }
.ep-item { padding: 5px 6px; border-radius: 5px; cursor: pointer; } .ep-item:hover, .ep-item.pre { background: #3a2d1c; }
.pick-list label.disabled { opacity: .55; }
.smart section { border-top: 1px solid var(--line); padding: 6px 0; }
fieldset.gridset { border: 1px solid var(--line); border-radius: 6px; margin: 8px 0; } fieldset.gridset legend { color: var(--gold); font-size: 12px; }
.side .editor .portrait { flex-shrink: 0; }
/* Pages */
.page-head { display: flex; align-items: center; gap: 10px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; align-items: center; }
.form-toggle { margin: 0; }
.bank-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px; }
.bank-grid .count { grid-column: 1 / -1; }
.bank-card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; cursor: pointer; display: flex; flex-direction: column; }
.bank-card:hover { border-color: var(--gold); }
.bank-card.hid { opacity: .7; border-style: dashed; }
.bank-card.k-pj { border-color: #2c5a72; }
.bank-card > img, .bank-card .noimg { width: 100%; height: 150px; object-fit: cover; object-position: top; background: var(--panel2); }
.bank-card .noimg { display: flex; align-items: center; justify-content: center; font-size: 46px; color: var(--muted); }
.bk-body { padding: 8px; } .bk-name { font-family: Georgia, serif; color: var(--gold2); font-size: 15px; }
.bk-btns { display: flex; gap: 4px; margin-top: 5px; flex-wrap: wrap; }
.grp-box { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; margin: 8px 0; }
.grp-box h3 { margin: 0; }
.groups-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; margin-top: 6px; }
.group-card { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 8px; }
.members, .engage-list { display: flex; flex-wrap: wrap; gap: 4px; margin: 4px 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: #3a2d1c; border-radius: 12px; padding: 2px 8px 2px 2px; font-size: 12px; cursor: pointer; color: var(--text); text-decoration: none; }
.chip img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }
tr.computed details summary { cursor: pointer; }
/* Fiche */
.sheet-modal { width: min(980px, 97vw); height: 92vh; display: flex; flex-direction: column; padding: 0; }
.sheet-head { display: flex; gap: 12px; padding: 12px 14px 6px; align-items: flex-start; }
.sheet-title { flex: 1; } .sheet-title h3 { margin: 0 0 4px; font-size: 22px; } .sheet-title h3 input { font-size: 18px; width: 100%; }
.sheet-title .badges .badge { margin: 0 3px 3px 0; }
.sheet-actions { display: flex; gap: 4px; }
.sheet-quick { display: flex; gap: 6px; padding: 4px 14px; flex-wrap: wrap; }
.sheet-quick .q { background: var(--panel2); border: 1px solid var(--line); border-radius: 6px; padding: 3px 8px; text-align: center; min-width: 70px; }
.sheet-quick .q span { display: block; font-size: 10px; color: var(--muted); } .sheet-quick .q input { width: 64px; }
.sheet-tabs { display: flex; gap: 2px; padding: 6px 14px 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.sheet-tabs button { border-radius: 6px 6px 0 0; border-bottom: none; }
.sheet-tabs button.active { background: #6b5320; border-color: var(--gold); color: #fff; }
.tabvis { padding: 4px 14px; font-size: 12px; color: var(--muted); background: #2a1f1f; }
.sheet-body { flex: 1; overflow: auto; padding: 8px 14px; }
.sheet-foot { display: flex; gap: 6px; justify-content: flex-end; padding: 8px 14px; border-top: 1px solid var(--line); }
.sec { margin-bottom: 10px; } .sec h4 { margin: 6px 0; color: var(--gold); border-bottom: 1px solid var(--line); }
.sec .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 4px 10px; }
.fld label { margin: 2px 0; } .fld.wide { grid-column: 1 / -1; } .fld .val { font-size: 13px; min-height: 18px; }
.fld input, .fld select, .fld textarea { width: 100%; }
.dmf { padding: 0 3px; font-size: 10px; opacity: .45; } .dmf.on { opacity: 1; background: #5a1f1d; border-radius: 4px; }
table.shlist { width: 100%; border-collapse: collapse; font-size: 13px; }
table.shlist th { text-align: left; color: var(--muted); font-weight: normal; font-size: 11px; border-bottom: 1px solid var(--line); }
table.shlist td { padding: 2px 4px; border-bottom: 1px dotted #33291e; vertical-align: top; }
table.shlist td input, table.shlist td select { width: 100%; min-width: 50px; }
table.shlist td.small input { max-width: 70px; }
table.shlist td.tools { white-space: nowrap; width: 1%; }
table.shlist tr.long td { color: var(--muted); font-size: 12px; }
.longval { margin: 2px 0; }
.dm-box { background: #2a1717; border: 1px solid #5a1f1d; border-radius: 8px; padding: 8px; margin-top: 10px; }
.item-modal { width: min(700px, 96vw); }
.md h1, .md h2, .md h3 { margin: 4px 0; }
@media (max-width: 800px) { .side { width: 220px; } .sheet-modal { height: 100vh; width: 100vw; } }
.login-card .player-btn.sel { border-color: var(--gold); background: #3a2d1c; }

/* ===== Panneau de dés (gauche) + journal des jets ===== */
.body-row { flex: 1; display: flex; min-height: 0; }
.body-row > main { flex: 1; min-width: 0; }
.dice-panel { width: 290px; flex-shrink: 0; background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; font-size: 13px; }
.dice-panel .dp-head { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--line); color: var(--gold2); }
.dice-panel .spacer, .dp-loghead .spacer, .ib-head .spacer { flex: 1; }
.dice-panel.collapsed { width: 38px; }
.dice-panel.collapsed .dp-inner, .dice-panel.collapsed .dp-head b { display: none; }
.dp-inner { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.dp-roller { padding: 8px; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid var(--line); }
.dp-dice { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.dp-dice .die { padding: 5px 0; font-size: 11px; font-weight: bold; }
.dp-row { display: flex; gap: 5px; }
.dp-row > input, .dp-row > select { flex: 1; min-width: 0; }
.dp-row label { flex: 1; margin: 0; }
.dp-row label input, .dp-row label select { width: 100%; box-sizing: border-box; }
.dp-target { font-size: 12px; min-height: 18px; }
.dp-loghead { display: flex; align-items: center; padding: 6px 8px; color: var(--gold2); border-bottom: 1px solid var(--line); }
.roll-log { flex: 1; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 6px; }
.rcard { background: var(--panel2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 8px; cursor: pointer; }
.rcard.secret { border-style: dashed; border-color: #7a4a8a; background: #2a2030; }
.rcard.nat20 { border-color: #3fbf5a; box-shadow: 0 0 6px rgba(63,191,90,.35); }
.rcard.nat1 { border-color: #d04040; box-shadow: 0 0 6px rgba(208,64,64,.35); }
.rc-head { display: flex; gap: 6px; align-items: flex-start; }
.rc-portrait { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; flex-shrink: 0; border: 1px solid var(--line); }
.rc-portrait.ph { display: flex; align-items: center; justify-content: center; background: #3a2d1c; color: var(--gold2); font-weight: bold; }
.rc-who { flex: 1; min-width: 0; line-height: 1.2; }
.rc-who b { color: var(--gold2); }
.rc-label { font-size: 12px; color: var(--text); }
.rc-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.rc-roll { display: flex; align-items: center; gap: 6px; margin-top: 5px; }
.rc-dice { display: inline-flex; flex-wrap: wrap; gap: 3px; align-items: center; flex: 1; }
.dface { display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px; padding: 0 3px; border-radius: 4px; background: #120f0b; border: 1px solid #5a4a33; font-size: 12px; font-weight: bold; }
.dface.d20 { border-radius: 50% / 40%; border-color: var(--gold); }
.dface.drop { opacity: .35; text-decoration: line-through; }
.dface.nat20 { background: #1f5a2a; border-color: #3fbf5a; color: #c8ffd2; }
.dface.nat1 { background: #5a1f1f; border-color: #d04040; color: #ffd0d0; }
.dconst, .dop { color: var(--muted); font-weight: bold; }
.rc-total { font-size: 22px; font-weight: bold; color: #fff; min-width: 34px; text-align: right; font-family: Georgia, serif; }
.rc-total.nat20 { color: #5fe07a; } .rc-total.nat1 { color: #ff6b6b; }
.deg { font-weight: bold; font-size: 12px; margin-top: 3px; }
.deg.crit-s { color: #5fe07a; } .deg.succ { color: #9fd38a; } .deg.fail { color: #e0a060; } .deg.crit-f { color: #ff6b6b; }
.rc-target { font-size: 12px; color: #ffb0b0; margin-top: 3px; }
.rc-dmg { margin-top: 4px; font-size: 12px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px; }
.rc-dmg.miss { opacity: .55; }
.rc-crit { width: 100%; color: #5fe07a; }
.rc-spell { margin-top: 3px; font-size: 12px; color: #c9b8ff; }
.rc-actions { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
.rc-actions button, .rc-spell button { padding: 2px 6px; font-size: 11px; }
.rc-applied { margin-top: 3px; }
.rc-more { display: none; margin-top: 4px; font-size: 11px; color: var(--muted); word-break: break-word; }
.rcard.open .rc-more, .rcard:hover .rc-more { display: block; }
.rc-saves { margin-top: 4px; display: flex; flex-direction: column; gap: 2px; }
.rc-save { display: flex; align-items: center; gap: 5px; font-size: 12px; }
.rc-save .grow { flex: 1; }
.sv-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 2px 10px; max-height: 300px; overflow-y: auto; margin: 6px 0; }
/* boutons de jet sur les fiches */
.rollbtn { padding: 1px 6px; font-size: 11px; margin-left: 4px; background: #2d2416; border-color: #6b5320; }
.rollbtn:hover { background: #6b5320; }
.sheet-rolls { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 4px 0 6px; }
.sheet-rolls .rollbtn { margin-left: 0; padding: 3px 8px; font-size: 12px; }
td.tools .rollbtn { margin: 1px; }
.tk-combat { margin: 6px 0; border-top: 1px solid var(--line); padding-top: 6px; }
.tk-rolls { display: flex; flex-wrap: wrap; gap: 3px; align-items: center; margin-top: 4px; }
.tk-atk { display: flex; align-items: center; gap: 3px; font-size: 12px; margin-top: 3px; }
.tk-atk .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-atk button { padding: 2px 5px; font-size: 11px; }
/* ===== Initiative ===== */
.init-box { position: absolute; top: 8px; left: 8px; width: 270px; max-height: calc(100% - 60px); overflow-y: auto; background: rgba(28,23,17,.94); border: 1px solid var(--gold); border-radius: 8px; padding: 6px; z-index: 5; font-size: 13px; box-shadow: 0 4px 20px #000; }
.ib-head { display: flex; align-items: center; gap: 6px; color: var(--gold2); margin-bottom: 4px; }
.ib-tools { display: flex; flex-wrap: wrap; gap: 3px; margin-bottom: 4px; }
.ib-tools button { padding: 3px 7px; font-size: 12px; }
.ib-list { list-style: none; margin: 0; padding: 0; }
.ib-list li { display: flex; align-items: center; gap: 5px; padding: 4px; border-radius: 5px; border: 1px solid transparent; cursor: pointer; }
.ib-list li:hover { background: var(--panel2); }
.ib-list li.cur { background: #1d3a4a; border-color: #7fd4ff; }
.ib-list li.hid { opacity: .6; }
.ib-list li.over { border-top: 2px solid var(--gold); }
.ib-list li.dragging { opacity: .4; }
.ib-init { min-width: 24px; text-align: center; font-weight: bold; color: #fff; background: #120f0b; border-radius: 4px; padding: 1px 3px; }
.ib-side { width: 6px; align-self: stretch; border-radius: 3px; }
.ib-name { flex: 1; min-width: 0; }
.ib-conds { display: flex; flex-wrap: wrap; gap: 2px; margin-top: 2px; }
.cond { font-size: 10px; background: #5a2a1a; color: #ffd9c0; border-radius: 6px; padding: 0 5px; }
.ib-hp { font-size: 11px; color: #ffb0b0; white-space: nowrap; }
button.tiny { padding: 0 4px; font-size: 10px; line-height: 16px; }
@media (max-width: 900px) { .dice-panel { width: 230px; } }
/* 🔒 Notes DM — champ réservé au MJ, visuellement distinct */
.dm-notes { background: repeating-linear-gradient(135deg, #2b1a26 0 10px, #2f1c2a 10px 20px); border: 1px dashed #b0587c; border-left: 4px solid #b0587c; border-radius: 8px; padding: 6px 8px; margin: 8px 0; }
.dm-notes label { display: flex; flex-wrap: wrap; align-items: baseline; gap: 2px 6px; color: #f0a8c4; font-weight: 600; font-size: 12px; margin: 0 0 4px; }
.dm-notes .dmn-hint { font-weight: 400; color: #b48aa0; font-size: 11px; }
.dm-notes .dmn-st { margin-left: auto; font-weight: 400; color: #9fd3a8; font-size: 11px; }
.dm-notes textarea { width: 100%; box-sizing: border-box; background: #1d1219; border: 1px solid #5a2f45; color: #f3e6ec; resize: vertical; min-height: 54px; font-size: 13px; }
.dm-notes .dmn-t { white-space: nowrap; }
/* 📍 Lieux des personnages (MJ) */
.place-pick .pp-row { padding: 5px 6px; border-radius: 5px; cursor: pointer; display: block; }
.place-pick .pp-row:hover { background: rgba(224,184,74,.12); }
.place-pick .pp-row.cur { background: rgba(224,184,74,.2); outline: 1px solid rgba(224,184,74,.5); }
.place-pick .pp-map { padding: 6px 6px 2px; font-weight: 700; color: var(--accent, #e0b84a); font-size: 12px; }
.place-pick .pp-none { font-style: italic; }
.sh-place { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 6px 0; padding: 6px 8px; border: 1px solid #4b5a3a; background: #1c2318; border-radius: 8px; }
.sh-place .lbl { font-weight: 600; color: #c9dba8; white-space: nowrap; }
.sh-place button.place-btn { flex: 1; min-width: 0; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bank-card .bk-sel { position: absolute; top: 6px; left: 6px; z-index: 2; width: 20px; height: 20px; accent-color: #e0b84a; }
.bank-card { position: relative; }
.bank-card.selected { outline: 2px solid #e0b84a; }
.bk-selbar { position: sticky; top: 0; z-index: 5; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; padding: 6px 8px; margin: 6px 0; background: #2a2414; border: 1px solid #6b5a25; border-radius: 8px; }
.pl-chars { list-style: none; padding: 0; margin: 4px 0; }
.pl-chars li { display: flex; align-items: center; gap: 6px; padding: 3px 4px; border-radius: 5px; }
.pl-chars li:hover { background: rgba(255,255,255,.04); }
.pl-chars li .nm { flex: 1; cursor: pointer; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 🎵 Musique d'ambiance */
.music-btn.playing { border-color: var(--gold); box-shadow: 0 0 0 1px var(--gold) inset; }
.music-panel { position: fixed; right: 12px; top: 54px; z-index: 60; width: 290px; background: var(--panel, #1d1a16); border: 1px solid var(--border, #4a3f2c); border-radius: 10px; padding: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.5); display: flex; flex-direction: column; gap: 8px; }
.music-panel .mp-head { display: flex; align-items: center; gap: 6px; }
.music-panel .mp-ctl { display: flex; gap: 6px; justify-content: center; }
.music-panel .mp-ctl button { min-width: 44px; font-size: 18px; }
.music-panel label { display: flex; align-items: center; gap: 6px; }
.music-panel input[type=range] { flex: 1; }
.sound-unlock { position: fixed; left: 50%; transform: translateX(-50%); bottom: 18px; z-index: 70; padding: 10px 18px; font-size: 16px; border-radius: 22px; box-shadow: 0 6px 18px rgba(0,0,0,.5); }
.music-box { margin-top: 8px; border-top: 1px solid var(--border, #4a3f2c); padding-top: 6px; }
.music-box summary { cursor: pointer; font-weight: 600; }
.music-box .mus-list { list-style: none; padding: 0; margin: 6px 0; }
.music-box .mus-list li { display: flex; align-items: center; gap: 4px; padding: 2px 0; }
.music-box .mus-list li .grow { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.music-box .mus-opts { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; margin: 6px 0; }
.music-box .mus-opts label { display: inline-flex; align-items: center; gap: 4px; }
.mx-act-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 8px 0; }
.mx-act-grid button { min-height: 44px; }

/* ⚔ Jetons intelligents (v2) & gestionnaire de battlemaps */
.st2 { display: grid; grid-template-columns: 1.3fr 1fr; gap: 12px; min-height: 360px; }
.st2-src, .st2-sel { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.st2-tabs { display: flex; gap: 4px; flex-wrap: wrap; }
.st2-tabs button.active { background: #6b5320; border-color: var(--gold); }
.st2-body { flex: 1; overflow: auto; max-height: 52vh; border: 1px solid #3a2d1c; border-radius: 6px; padding: 6px; }
.st2-body label.inline, .st2-sel label.inline { display: flex; align-items: center; gap: 6px; }
.st2-grp { border-bottom: 1px solid #3a2d1c; padding: 4px 0; }
.st2-mem { font-size: 12px; }
.st2-sel .contents { max-height: 30vh; overflow: auto; }
.bm-mgr { max-height: 64vh; overflow: auto; display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.bm-place { font-weight: 600; color: var(--gold); margin: 4px 0; }
.bm-row { display: flex; gap: 10px; align-items: flex-start; padding: 6px; border: 1px solid #3a2d1c; border-radius: 8px; margin-bottom: 6px; }
.bm-row.hl { border-color: var(--gold); background: #2b2216; }
.bm-thumb { width: 96px; height: 68px; object-fit: cover; border-radius: 6px; flex-shrink: 0; background: #2a2218; }
.bm-thumb.ph { display: flex; align-items: center; justify-content: center; font-size: 26px; }
.bm-info { flex: 1; min-width: 0; }
.bm-acts { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
@media (max-width: 700px) { .st2 { grid-template-columns: 1fr; } }
.st2-sel .contents li { gap: 4px; }
.st2-sel .contents li input.grow { flex: 1; min-width: 0; width: 100%; }
.st2-sel .contents li select { width: 86px; flex-shrink: 0; }
.st2-sel .contents li input[type=number] { flex-shrink: 0; }

/* 🪙 Gestion des jetons : sélection multiple, tailles, verrou */
html:not(.is-mobile) .mobile-only { display: none !important; }
.multi-bar { position: absolute; left: 50%; transform: translateX(-50%); top: 8px; z-index: 7; display: flex; gap: 6px; align-items: center; background: rgba(20,16,11,.92); border: 1px solid var(--gold); border-radius: 10px; padding: 5px 10px; }
.size-ctl { margin: 6px 0; padding: 6px 0; border-top: 1px solid #3a2d1c; }
.size-ctl .row { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.size-ctl input[type=range] { flex: 1; min-width: 120px; }
.size-ctl .pf2 button.primary { border-color: var(--gold); }

/* ===== 🌍 Mondes : bouton Terre ⇄ Dominion, transition « Œil d'Oronhià:ke », double calendrier ===== */
.world { display: inline-flex; align-items: center; gap: 4px; }
.world-switch { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px; border: 1px solid #8a6d3b; background: linear-gradient(90deg, #1d2a1c, #2a1f3a); color: #f3e3bd; font-weight: 600; cursor: pointer; box-shadow: 0 0 0 1px rgba(224,184,74,.15), 0 0 12px rgba(160,120,255,.18); }
.world-switch:hover:not([disabled]) { box-shadow: 0 0 0 1px rgba(224,184,74,.45), 0 0 18px rgba(160,120,255,.45); }
.world-switch.solo, .world-switch[disabled] { cursor: default; background: #17130e; box-shadow: none; }
.world-switch .ws-side { opacity: .55; }
.world-switch .ws-side.on { opacity: 1; color: var(--gold2, #ffd34d); text-shadow: 0 0 6px rgba(255,211,77,.5); }
.world-switch .ws-arrow { opacity: .8; }
#worldFx { position: fixed; inset: 0; z-index: 9999; pointer-events: none; opacity: 0; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 50%, rgba(255,246,214,.95) 0, rgba(190,150,255,.55) 18%, rgba(20,12,30,.92) 55%, #07050b 100%); }
#worldFx .eye { width: 34vmin; height: 16vmin; border-radius: 50%; border: 2px solid rgba(255,230,160,.9); box-shadow: 0 0 40px rgba(255,220,140,.9), inset 0 0 30px rgba(160,120,255,.8);
  background: radial-gradient(circle, #fff7d6 0 12%, #9b7bff 13% 26%, transparent 27%); transform: scale(.2); }
#worldFx.on { animation: mxWorldFade 1.1s ease forwards; }
#worldFx.on .eye { animation: mxWorldEye 1.1s ease forwards; }
#worldFx.reduce.on, #worldFx.reduce.on .eye { animation: none; }
#worldFx.reduce.on { opacity: .85; transition: opacity .1s; background: #07050b; }
#worldFx.reduce .eye { display: none; }
@keyframes mxWorldFade { 0% { opacity: 0; } 35% { opacity: 1; } 60% { opacity: 1; } 100% { opacity: 0; } }
@keyframes mxWorldEye { 0% { transform: scale(.2) rotate(0); opacity: 0; } 40% { transform: scale(1.1); opacity: 1; } 60% { transform: scale(1.6); opacity: 1; } 100% { transform: scale(6); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { #worldFx.on, #worldFx.on .eye { animation: none !important; } }
.calendar .cal-row.here b { text-shadow: 0 0 6px rgba(255,211,77,.45); }
.calendar .cal-note { font-size: 10.5px; }
.time-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin: 8px 0; }
.time-grid .tg-col { border: 1px solid var(--line); border-radius: 8px; padding: 8px; background: #17130e; }
.time-grid .big { font-size: 18px; color: var(--gold2, #ffd34d); margin: 4px 0 6px; }
.time-log { max-height: 220px; overflow: auto; font-size: 12px; }
.time-log .tl-row { padding: 3px 0; border-bottom: 1px dashed var(--line); }
.world-list .row { padding: 4px 0; gap: 8px; }
.badge.travel { background: linear-gradient(90deg, #1d3a2a, #3a2a5a); border-color: #8a6d3b; }
@media (max-width: 700px) { .time-grid { grid-template-columns: 1fr; } }
/* Calendrier double compact dans la barre du haut (46 px) */
.calendar { display: flex; align-items: center; gap: 8px; }
.calendar .cal-rows { display: flex; flex-direction: column; gap: 1px; }
.calendar .cal-row { white-space: nowrap; font-size: 11.5px; line-height: 17px; }
.calendar .cal-btns button.small, .calendar .cal-side button.small { padding: 0 5px; line-height: 14px; min-height: 0; font-size: 11px; }
.calendar .cal-row:not(.here) { opacity: .72; }
.calendar .cal-side { display: flex; align-items: center; gap: 6px; border-left: 1px solid var(--line); padding-left: 8px; }
.calendar .cal-side .cal-note { font-size: 10px; line-height: 12px; text-align: left; white-space: nowrap; }
/* 👁 Visible / 🚫 Caché (MJ) */
.badge.vis { background: #1f4a2b; color: #c8f2d2; }
.vis-toggle { display: inline-flex; border: 1px solid #6b5a25; border-radius: 6px; overflow: hidden; margin-right: 4px; }
.vis-toggle button { border: 0; border-radius: 0; margin: 0; padding: 3px 8px; background: transparent; opacity: .65; white-space: nowrap; }
.vis-toggle button + button { border-left: 1px solid #6b5a25; }
.vis-toggle button.on[data-visset="all"] { background: #1f4a2b; color: #c8f2d2; opacity: 1; font-weight: 600; }
.vis-toggle button.on[data-visset="players"] { background: #4a3d12; color: #ffe7a3; opacity: 1; font-weight: 600; }
.vis-toggle button[data-visset="players"] { max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
.vis-toggle button.on[data-visset="hidden"] { background: #5a1f1d; color: #ffc9c6; opacity: 1; font-weight: 600; }
.bk-selbar .vis-bulk:disabled { opacity: .45; }
.badge.part { background: #4a3d12; color: #ffe7a3; }
.vis-pick { display: flex; flex-direction: column; gap: 6px; margin: 6px 0 10px; }
.vis-pick label { font-size: 15px; }
/* 🏷 Étiquettes du personnage (MJ, mode édition) */
.sh-labels { border: 1px solid #6b5a25; border-radius: 8px; padding: 6px 10px 8px; margin: 0 0 10px; background: rgba(224, 184, 74, .06); }
.sh-labels h4 { margin: 2px 0 6px; }
.sh-labels .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 4px 10px; }
.sh-labels select:disabled { opacity: .6; }
