/* Styles for modals, compendium, party, character sheets & creator, music, map library */
.tabs .tab { font-size: 13px; padding-left: 2px; padding-right: 2px; }

.modal-backdrop {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(5, 6, 9, .62); backdrop-filter: blur(3px);
  display: grid; grid-template-columns: minmax(0, 1fr); place-items: center; padding: 16px;
  animation: pop .15s ease-out;
}
.modal {
  width: min(560px, 100%); max-width: 100%; max-height: calc(100vh - 32px); min-height: 0;
  display: flex; flex-direction: column;
  background: var(--panel); border: 1px solid var(--line-2); border-radius: 16px; box-shadow: var(--shadow);
}
.modal.wide { width: min(980px, 100%); }
.modal-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px 12px; border-bottom: 1px solid var(--line); }
.modal-title { flex: 1; font-size: 18px; font-weight: 800; min-width: 0; }
.modal-head .close { font-size: 22px; }
.modal-body { padding: 14px 16px 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.modal-body h3 { margin: 6px 0 0; font-size: 16px; }
.modal-body h4 { margin: 8px 0 0; font-size: 13.5px; color: var(--accent-2); }
.modal-body p { margin: 0; }
.prose p { margin: 0 0 8px; }
.prose p.bullet { padding-left: 14px; position: relative; }
.prose p.bullet::before { content: "•"; position: absolute; left: 2px; color: var(--muted); }

.roll-chip {
  display: inline-flex; align-items: center; gap: 3px;
  padding: 1px 7px; margin: 0 1px;
  border-radius: 6px; border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent); color: var(--accent-2);
  font-weight: 700; font-size: .92em; cursor: pointer; white-space: nowrap;
}
.roll-chip:hover { background: color-mix(in srgb, var(--accent) 25%, transparent); }
.roll-chip.dmg { border-color: rgba(239, 68, 68, .45); background: rgba(239, 68, 68, .1); color: #fca5a5; }
.roll-chip.dmg:hover { background: rgba(239, 68, 68, .22); }

/* ---------------- compendium */
#bookPanel, #partyPanel { overflow: hidden; }
.comp-head { padding: 10px 12px; display: flex; flex-direction: column; gap: 8px; border-bottom: 1px solid var(--line); flex: none; }
.comp-tabs { width: 100%; }
.comp-tabs button { flex: 1; }
.comp-search { width: 100%; }
.comp-filters { display: flex; gap: 6px; }
.comp-filters:empty { display: none; }
.comp-filters select { flex: 1; padding: 5px 7px; }
.comp-list { flex: 1; overflow-y: auto; padding: 6px; display: flex; flex-direction: column; gap: 2px; }
.comp-loading { padding: 20px; text-align: center; }
.comp-row { display: flex; align-items: center; gap: 10px; padding: 7px 8px; border-radius: 8px; cursor: pointer; }
.comp-row:hover { background: var(--bg-2); }
.comp-dot { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.comp-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.comp-main b { font-weight: 600; }
.comp-main .small { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cr-pill { font-size: 11px; font-weight: 700; color: var(--muted); background: var(--bg-2); border: 1px solid var(--line); border-radius: 99px; padding: 2px 7px; white-space: nowrap; }
.icon-btn.add { border-color: var(--line-2); color: var(--accent-2); font-size: 18px; font-weight: 700; }
.icon-btn.add:hover { background: var(--accent); color: var(--accent-ink); }
.comp-more { margin: 6px auto; }
.comp-foot { padding: 6px 12px 10px; border-top: 1px solid var(--line); flex: none; font-size: 11px; }

/* ---------------- stat block */
.statblock { display: flex; flex-direction: column; gap: 4px; }
.sb-sub { font-style: italic; color: var(--muted); }
.sb-rule { height: 2px; background: linear-gradient(90deg, #b45309, transparent); margin: 4px 0; }
.sb-line { font-size: 13.5px; }
.sb-line b, .sb-action > b { color: #fdba74; }
.sb-abils { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.sb-abil { display: flex; flex-direction: column; align-items: center; padding: 5px 0; border-radius: 8px; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; font-size: 12.5px; }
.sb-abil:hover { border-color: var(--accent); }
.sb-abil b { font-size: 11px; color: var(--muted); }
.sb-action { font-size: 13.5px; margin: 3px 0; }
.statblock h4 { border-bottom: 1px solid #b45309; padding-bottom: 2px; }
.sb-add { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line-2); position: sticky; bottom: -16px; }
.spell-card { display: flex; flex-direction: column; gap: 8px; }
.spell-meta { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; font-size: 13px; }
.spell-meta b { color: var(--muted); font-weight: 600; }
details.feat { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; }
details.feat > summary { padding: 7px 10px; cursor: pointer; font-weight: 600; list-style: none; }
details.feat > summary::-webkit-details-marker { display: none; }
details.feat > summary::before { content: "▸ "; color: var(--muted); }
details.feat[open] > summary::before { content: "▾ "; }
.feat-body { padding: 0 12px 8px; font-size: 13.5px; }

/* ---------------- party */
.party-head { padding: 12px; display: flex; flex-direction: column; gap: 6px; border-bottom: 1px solid var(--line); flex: none; }
.party-list { flex: 1; overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 6px; }
.party-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 4px 2px; }
.pc-card { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); cursor: pointer; }
.pc-card:hover { border-color: var(--line-2); }
.pc-portrait { width: 42px; height: 42px; border-radius: 50%; flex: none; display: grid; place-items: center; overflow: hidden; font-weight: 800; color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.5); box-shadow: 0 0 0 2px rgba(0,0,0,.35); }
.pc-portrait.big { width: 56px; height: 56px; font-size: 20px; }
.pc-portrait img { width: 100%; height: 100%; object-fit: cover; }
.pc-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.pc-name { font-weight: 700; display: flex; align-items: center; gap: 6px; }
.pc-owner { font-size: 10.5px; font-weight: 600; color: var(--muted); background: var(--panel); border-radius: 99px; padding: 1px 6px; }
.pc-owner.online::before { content: "● "; color: var(--ok); }
.pc-hp { display: flex; align-items: center; gap: 8px; }
.pc-hp-bar { flex: 1; height: 6px; background: var(--panel-2); border-radius: 6px; overflow: hidden; }
.pc-hp-bar > div { height: 100%; border-radius: 6px; }

/* ---------------- character sheet */
.sheet-title { display: flex; align-items: center; gap: 12px; }
.sheet-name { font-size: 20px; font-weight: 800; }
.sheet-modal .modal-title .muted { font-weight: 500; font-size: 12.5px; }
.sheet-top { display: flex; gap: 8px; flex-wrap: wrap; align-items: stretch; }
.sheet-stat { display: flex; flex-direction: column; align-items: center; justify-content: center; min-width: 78px; padding: 8px 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.sheet-stat.click { cursor: pointer; }
.sheet-stat.click:hover { border-color: var(--accent); }
.sheet-stat .v { font-size: 20px; font-weight: 800; }
.sheet-stat .l { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 700; text-align: center; }
.sheet-hp { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 6px; padding: 8px 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.hp-nums { display: flex; align-items: end; gap: 6px; }
.hp-nums label { display: flex; flex-direction: column; gap: 2px; font-size: 10.5px; color: var(--muted); font-weight: 700; text-transform: uppercase; }
.hp-nums input { width: 64px; }
.death { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; }
.pips { display: inline-flex; gap: 3px; }
.pip { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--line-2); background: transparent; cursor: pointer; padding: 0; }
.pip.good.on { background: var(--ok); border-color: var(--ok); }
.pip.bad.on { background: var(--danger); border-color: var(--danger); }
.sheet-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.sheet-cols { display: grid; grid-template-columns: 300px 1fr; gap: 14px; align-items: start; }
.sheet-abils { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.abil-box { display: flex; flex-direction: column; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); overflow: hidden; }
.abil-main { display: flex; flex-direction: column; align-items: center; padding: 6px 0 4px; border: 0; background: transparent; cursor: pointer; }
.abil-main:hover, .abil-save:hover { background: var(--panel-2); }
.abil-name { font-size: 10.5px; font-weight: 800; color: var(--muted); letter-spacing: .06em; }
.abil-mod { font-size: 22px; font-weight: 800; line-height: 1.1; }
.abil-score { font-size: 11.5px; color: var(--muted); }
.abil-save { border: 0; border-top: 1px solid var(--line); background: transparent; padding: 4px; font-size: 11.5px; cursor: pointer; color: var(--muted); display: flex; align-items: center; justify-content: center; gap: 4px; }
.abil-save .dot { width: 7px; height: 7px; border-radius: 50%; border: 1.5px solid var(--muted); }
.abil-save.prof { color: var(--text); }
.abil-save.prof .dot { background: var(--accent); border-color: var(--accent); }
.sheet-skills { margin-top: 10px; display: flex; flex-direction: column; }
.sheet-skills h4 { margin-bottom: 4px; }
.skill-row { display: flex; align-items: center; gap: 6px; padding: 1px 0; }
.dot-btn { width: 13px; height: 13px; border-radius: 50%; border: 1.5px solid var(--muted); background: transparent; padding: 0; cursor: pointer; flex: none; }
.dot-btn.prof { background: var(--accent); border-color: var(--accent); }
.dot-btn.exp { background: var(--accent); border-color: #fff; box-shadow: 0 0 0 2px var(--accent); }
.skill-name { flex: 1; text-align: left; border: 0; background: transparent; cursor: pointer; padding: 3px 4px; border-radius: 5px; font-size: 13px; }
.skill-name:hover { background: var(--panel-2); }
.skill-mod { font-weight: 700; font-variant-numeric: tabular-nums; width: 32px; text-align: right; }
.sheet-section { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.sheet-section.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.sheet-section.two textarea { width: 100%; margin-top: 4px; }
.attack-list { display: flex; flex-direction: column; gap: 4px; }
.attack-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 5px 8px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); }
.attack-name { flex: 1; font-weight: 600; min-width: 120px; }
.caster-row { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; font-size: 13px; }
.slots { display: flex; gap: 10px; flex-wrap: wrap; }
.slot-level { display: flex; align-items: center; gap: 3px; }
.slot { width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--accent); background: var(--accent); cursor: pointer; padding: 0; }
.slot.used { background: transparent; border-color: var(--line-2); }
.spell-chips, .chip-row { display: flex; flex-wrap: wrap; gap: 5px; }
.spell-chip, .chip { font-size: 12.5px; padding: 4px 10px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; }
.spell-chip:hover, .chip:hover:not(:disabled) { border-color: var(--accent); }
.spell-chip .tag { font-size: 10px; margin-left: 5px; color: var(--accent-2); font-weight: 800; }
.chip.on { background: color-mix(in srgb, var(--accent) 16%, transparent); border-color: var(--accent); color: var(--accent-2); }
.chip:disabled { opacity: .35; cursor: default; }

/* ---------------- creator */
.creator .modal-body { padding-top: 0; }
.steps { display: flex; gap: 4px; overflow-x: auto; position: sticky; top: 0; background: var(--panel); padding: 12px 0 10px; z-index: 2; border-bottom: 1px solid var(--line); }
.step { display: flex; align-items: center; gap: 6px; padding: 6px 10px; border-radius: 99px; border: 1px solid transparent; background: transparent; cursor: pointer; color: var(--muted); font-weight: 600; white-space: nowrap; font-size: 13px; }
.step .n { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); font-size: 11px; }
.step.done { color: var(--text); }
.step.done .n { background: rgba(34, 197, 94, .25); color: #4ade80; }
.step.on { color: var(--text); border-color: var(--accent); }
.step.on .n { background: var(--accent); color: var(--accent-ink); }
.step-body { display: flex; flex-direction: column; gap: 10px; min-height: 300px; }
.step-nav { display: flex; gap: 8px; position: sticky; bottom: -16px; background: var(--panel); padding: 10px 0 4px; border-top: 1px solid var(--line); }
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 6px; }
.pick-card { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; }
.pick-card:hover { border-color: #465068; }
.pick-card.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); box-shadow: 0 0 0 1px var(--accent); }
.detail { display: flex; flex-direction: column; gap: 6px; }
.basics { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.portrait-pick { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.portrait-pick .pc-portrait.big { width: 96px; height: 96px; font-size: 32px; }
.basics-fields { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: 12px; }
.row2 { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-start; }
.row2 > .field { flex: 1; min-width: 160px; }
.abil-assign { display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; }
.abil-pick { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 6px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.abil-pick .abil-name { font-size: 12px; }
.abil-pick select, .abil-pick input { width: 70px; text-align: center; }
.abil-final { font-size: 24px; font-weight: 800; display: flex; flex-direction: column; align-items: center; line-height: 1; }
.abil-final span { font-size: 12px; color: var(--accent-2); margin-top: 3px; }
.pb { display: flex; align-items: center; gap: 4px; }
.pb b { width: 24px; text-align: center; }
.review-abils { display: flex; gap: 6px; flex-wrap: wrap; }
.problems { padding: 10px 12px; border-radius: 10px; background: #3b1518; border: 1px solid #7f1d1d; color: #fecaca; font-size: 13px; }

/* ---------------- music */
.music-ctl { display: flex; align-items: center; gap: 6px; }
.music-ctl input[type=range] { width: 70px; }
.music-name { font-size: 12px; color: var(--muted); max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.playlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; }
.playlist li { display: flex; align-items: center; gap: 4px; padding: 3px 4px; border-radius: 7px; }
.playlist li.current { background: color-mix(in srgb, var(--accent) 12%, transparent); }
.playlist .play { color: var(--accent-2); }
.track-name { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.music-controls { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.music-controls select { padding: 4px 6px; font-size: 12px; }
.music-controls input[type=range] { width: 70px; }
.lib-tracks { display: flex; flex-direction: column; gap: 3px; }
.lib-track { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 4px 8px; background: var(--bg-2); border-radius: 7px; }

/* ---------------- map library */
.library .modal-body { min-height: 60vh; }
.lib-bar { display: flex; gap: 6px; flex-wrap: wrap; }
.lib-bar input { flex: 1; min-width: 160px; }
.lib-wrap { display: grid; grid-template-columns: 220px 1fr; gap: 12px; min-height: 0; }
.lib-folders { display: flex; flex-direction: column; gap: 2px; }
.lib-folders button { display: flex; justify-content: space-between; gap: 8px; text-align: left; padding: 7px 10px; border-radius: 8px; border: 0; background: transparent; cursor: pointer; font-weight: 600; font-size: 13px; }
.lib-folders button span { color: var(--muted); font-weight: 500; }
.lib-folders button:hover { background: var(--bg-2); }
.lib-folders button.on { background: var(--panel-2); color: var(--accent-2); }
.lib-main { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.lib-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; }
.lib-item { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.lib-thumb { aspect-ratio: 4/3; border-radius: 7px; overflow: hidden; background: var(--panel-2); display: grid; place-items: center; }
.lib-thumb img { width: 100%; height: 100%; object-fit: cover; }
.uvtt-badge { display: flex; flex-direction: column; align-items: center; font-weight: 800; color: var(--accent-2); }
.uvtt-badge small { color: var(--muted); font-weight: 500; }
.lib-name { font-weight: 600; font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lib-actions { display: flex; gap: 4px; }
.lib-actions .btn { flex: 1; }
.lib-empty { padding: 20px; display: flex; flex-direction: column; gap: 10px; }
.lib-empty pre { background: var(--bg-2); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font-size: 12.5px; overflow-x: auto; }

@media (max-width: 800px) {
  .sheet-cols { grid-template-columns: 1fr; }
  .abil-assign { grid-template-columns: repeat(3, 1fr); }
  .lib-wrap { grid-template-columns: 1fr; }
  .lib-folders { flex-direction: row; overflow-x: auto; }
  .sheet-section.two { grid-template-columns: 1fr; }
  .music-name { display: none; }
  .modal-backdrop { padding: 8px; }
  .sheet-hp { min-width: 0; flex-basis: 100%; }
  .sheet-stat { min-width: 64px; flex: 1; }
}
.hp-nums { flex-wrap: wrap; }
.sheet-modal .modal-body, .creator .modal-body { overflow-x: hidden; }

/* ---------------- rules browser additions */
.comp-tab-select { width: 100%; font-weight: 700; }
.comp-filters { flex-wrap: wrap; }
.comp-filters select { min-width: 0; flex: 1 1 45%; }
.comp-count { padding: 2px 6px 4px; }
.edition-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 8px; border-radius: 8px; background: var(--panel); border: 1px solid var(--line); }
.edition-row .check { flex: 1; min-width: 140px; }

/* ---------------- creator additions */
.pick-search { width: 100%; max-width: 360px; }
.asi-ctl { display: flex; align-items: center; gap: 2px; }
.asi-ctl .icon-btn { width: 22px; height: 22px; font-size: 13px; border-color: var(--line); }
.asi { font-size: 12px; font-weight: 700; color: var(--muted); min-width: 26px; text-align: center; }
.asi.on { color: var(--accent-2); }
.asi-help { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.chip.over { opacity: .55; }

/* ---------------- attacks */
.atk-go { padding: 3px 8px; }
.atk-options { display: flex; flex-direction: column; gap: 4px; }
.atk-option { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; text-align: left; padding: 9px 10px; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; }
.atk-option:hover { border-color: var(--danger); background: rgba(239, 68, 68, .08); }
.atk-option b { flex: 1; min-width: 120px; }
.atk-option .tag { font-size: 10px; margin-left: 6px; color: #c4b5fd; text-transform: uppercase; }
.atk-custom { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
.attack-card {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: min(460px, calc(100% - 140px));
  display: flex; flex-direction: column; gap: 6px;
  z-index: 7;
}
.atk-row {
  display: flex; flex-direction: column; gap: 6px;
  padding: 10px 12px; border-radius: 12px;
  background: rgba(26, 30, 40, .97); border: 1px solid #7f1d1d; box-shadow: var(--shadow);
  animation: pop .2s ease-out;
}
.atk-row.hit { border-color: #15803d; }
.atk-row.targeting { border-color: var(--accent); flex-direction: row; align-items: center; flex-wrap: wrap; }
.atk-row.targeting .atk-title { flex: 1; }
.atk-title { font-size: 14px; }
.atk-sub { font-size: 13px; display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.atk-sub .warn { color: var(--accent-2); }
.atk-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.atk-actions .btn:not(.small) { flex: 1; }
.atk-hit { font-weight: 800; color: #4ade80; }
.atk-riders { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
body.targeting #board { cursor: crosshair; }
.msg.atk-msg .outcome { margin-top: 6px; font-weight: 700; font-size: 13px; }
.msg.atk-hit, .msg.atk-crit { border-color: rgba(34, 197, 94, .45); }
.msg.atk-hit .outcome, .msg.atk-crit .outcome { color: #4ade80; }
.msg.atk-miss { border-color: rgba(148, 163, 184, .35); }
.msg.atk-miss .outcome { color: var(--muted); }
.msg.atk-damage { border-color: rgba(239, 68, 68, .5); background: linear-gradient(180deg, rgba(239, 68, 68, .08), transparent); }
.msg.atk-damage .outcome { color: #fca5a5; }

/* ---------------- map generator */
.mapgen-wrap { display: grid; grid-template-columns: 280px 1fr; gap: 14px; align-items: start; }
.mapgen-side { display: flex; flex-direction: column; gap: 12px; }
.mapgen-side .field .seg { width: 100%; }
.mapgen-side .field .seg button { flex: 1; }
.mapgen-side .field .check { margin-top: 2px; }
.mapgen-styles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 4px; margin: 3px 0 6px; }
.mapgen-styles button { border: 1px solid var(--line-2); background: transparent; color: var(--muted); border-radius: 7px; padding: 5px 2px; font-size: 12px; font-weight: 600; cursor: pointer; }
.mapgen-styles button:hover { color: var(--text); }
.mapgen-styles button.on { background: var(--panel-2); color: var(--text); border-color: var(--accent); }
.mapgen-hint { margin-top: 4px; }
.ctx-note { padding: 4px 10px 2px; font-size: 11px; color: var(--muted); max-width: 240px; }
.mapgen-actions { display: flex; flex-direction: column; gap: 6px; }
.mapgen-preview { border-radius: 10px; overflow: hidden; border: 1px solid var(--line-2); background: #000; display: grid; place-items: center; }
.mapgen-canvas { width: 100%; height: auto; display: block; }
@media (max-width: 800px) {
  .mapgen-wrap { grid-template-columns: 1fr; }
  .attack-card { width: calc(100% - 70px); left: 60px; transform: none; }
}

/* ================================================================ fixed modal header/footer (creator Back/Next) */
.modal-top { flex: none; padding: 0 16px; border-bottom: 1px solid var(--line); }
.modal-top .steps { position: static; border-bottom: 0; padding: 10px 0; }
.modal-foot {
  flex: none; display: flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-top: 1px solid var(--line);
  background: var(--panel); border-radius: 0 0 16px 16px;
}
.modal-foot .foot-summary { flex: 1; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.creator .modal-body { padding-top: 14px; }

/* ================================================================ paging */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding: 4px 0; }
.pager .muted { flex: 1; text-align: center; }
.comp-list .pager { padding: 4px 6px; }
.selected-note { font-size: 13px; padding: 6px 10px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.locked-note { font-size: 13px; padding: 8px 10px; border-radius: 8px; background: rgba(148, 163, 184, .1); border: 1px dashed var(--line-2); color: var(--muted); }
.pick-card.locked { opacity: .45; cursor: not-allowed; }

/* ================================================================ level-ups */
.level-block { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.level-head { display: flex; align-items: center; gap: 8px; }
.level-head .lvl { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--panel-2); font-weight: 800; font-size: 12px; }
.choice-row { display: flex; flex-direction: column; gap: 6px; padding: 8px; border-radius: 8px; border: 1px solid var(--line); background: var(--panel); }
.choice-row.needs { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.choice-row .field select { max-width: 420px; }
.choice-row .seg { align-self: flex-start; }

/* ================================================================ right-click menu */
.ctx-menu {
  position: fixed; z-index: 60; min-width: 220px; max-width: 300px;
  background: rgba(26, 30, 40, .98); border: 1px solid var(--line-2); border-radius: 10px;
  box-shadow: var(--shadow); padding: 5px; display: flex; flex-direction: column;
  animation: pop .12s ease-out;
}
.ctx-title { font-weight: 800; font-size: 12.5px; padding: 6px 8px 4px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ctx-item { display: flex; align-items: center; gap: 8px; text-align: left; padding: 7px 8px; border: 0; background: transparent; border-radius: 7px; cursor: pointer; font-size: 13.5px; }
.ctx-item:hover:not(:disabled) { background: var(--panel-2); }
.ctx-item:disabled { opacity: .4; cursor: not-allowed; }
.ctx-item.danger { color: #fca5a5; }
.ctx-ico { width: 20px; text-align: center; }
.ctx-sep { height: 1px; background: var(--line); margin: 4px 2px; }

/* ================================================================ casting */
.cast-card { top: 12px; }
.atk-row.cast { border-color: #7c3aed; }
.cast-targets { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.msg.cast { border-color: rgba(124, 58, 237, .5); background: linear-gradient(180deg, rgba(124, 58, 237, .08), transparent); }
.msg.cast .outcome { margin-top: 6px; font-weight: 700; font-size: 13px; color: #c4b5fd; }
.cast-rows { display: flex; flex-direction: column; gap: 2px; margin-top: 6px; font-size: 12.5px; }
.cast-row { padding: 3px 6px; border-radius: 5px; background: var(--panel); }
.cast-row.bad { border-left: 3px solid #ef4444; }
.cast-row.good { border-left: 3px solid #22c55e; }
.spell-rows { display: flex; flex-direction: column; gap: 3px; }
.spell-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; padding: 3px 0; }
.tag-pill { font-size: 10.5px; font-weight: 700; padding: 1px 6px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--muted); }
.linkish { background: none; border: 0; padding: 0; color: var(--text); font-weight: 600; cursor: pointer; text-align: left; }
.linkish:hover { color: var(--accent-2); text-decoration: underline; }

/* ================================================================ inventory, coins, shop */
.inv-head { display: flex; align-items: center; gap: 8px; }
.inv-head h4 { margin: 0; }
.purse { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; padding: 8px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.coin { display: flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; }
.coin input { width: 74px; }
.coin-dot { width: 14px; height: 14px; border-radius: 50%; box-shadow: inset 0 -2px 0 rgba(0,0,0,.3); }
.coin-pp .coin-dot { background: #e5e7eb; }
.coin-gp .coin-dot { background: #facc15; }
.coin-sp .coin-dot { background: #94a3b8; }
.coin-cp .coin-dot { background: #c2703d; }
.purse-total { flex: 1; text-align: right; }
.purse-change { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; width: 100%; }
.inv-list { display: flex; flex-direction: column; gap: 3px; }
.inv-row { display: grid; grid-template-columns: 44px minmax(120px, 1fr) auto auto 64px auto auto; gap: 8px; align-items: center; padding: 4px 8px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); font-size: 13px; }
.inv-row.equipped { border-color: rgba(34, 197, 94, .45); }
.inv-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qty { display: flex; align-items: center; gap: 2px; }
.qty .icon-btn { width: 22px; height: 22px; }
.price { text-align: right; font-variant-numeric: tabular-nums; }
.shop-head { display: flex; flex-direction: column; gap: 8px; }
.purse-mini { font-size: 13px; }
.shop-list { display: flex; flex-direction: column; gap: 3px; }
.shop-row { display: grid; grid-template-columns: minmax(140px, 1.4fr) minmax(100px, 1fr) 90px auto auto; gap: 8px; align-items: center; padding: 5px 8px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); font-size: 13px; }
.shop-actions { display: flex; flex-direction: column; gap: 8px; padding: 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent); }
.price-row { display: flex; gap: 18px; flex-wrap: wrap; }
@media (max-width: 800px) {
  .inv-row { grid-template-columns: 40px 1fr auto auto; }
  .inv-row > .muted.small:not(.price) { display: none; }
  .shop-row { grid-template-columns: 1fr auto auto; }
  .shop-row > .muted.small { display: none; }
}

/* ================================================================ campaigns, roster, whispers */
body.is-dm .player-only { display: none !important; }
.join-campaign { font-size: 13.5px; padding: 8px 10px; border-radius: 9px; background: var(--bg-2); border: 1px solid var(--line); }
.campaign-list { display: flex; flex-direction: column; gap: 6px; }
.campaign-row, .roster-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.campaign-row.current { border-color: var(--accent); }
.roster-row.busy { opacity: .6; }
.new-campaign { display: flex; flex-direction: column; gap: 6px; }
.roster-actions { margin-top: 6px; }
.campaign-card .row-field input { width: 100%; }
.chat-form .whisper { flex: none; padding: 8px 10px; font-size: 12.5px; }
.chat-form .whisper.on { background: #4c1d95; border-color: #7c3aed; color: #ede9fe; }
body.whispering #chatInput { border-color: #7c3aed; box-shadow: 0 0 0 3px rgba(124, 58, 237, .25); }
.msg.text.private { border-style: dashed; border-color: rgba(168, 85, 247, .45); }

/* ================================================================ damage prompts */
.dmg-cards { position: absolute; right: 12px; top: 12px; display: flex; flex-direction: column; gap: 8px; z-index: 8; width: min(340px, calc(100% - 80px)); }
.dmg-card { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border-radius: 12px; background: rgba(26, 30, 40, .98); border: 1px solid #b91c1c; box-shadow: var(--shadow); animation: pop .2s ease-out; }
.dmg-amount { font-size: 13px; color: #fca5a5; }
.dmg-amount .big { font-size: 26px; font-weight: 800; margin-right: 4px; color: #fecaca; }
.atk-option.out { opacity: .55; }
.atk-option:disabled { cursor: not-allowed; }
.warn { color: var(--accent-2) !important; }

/* ================================================================ creator: families, starting gear */
.family-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.family-head b { font-size: 15px; }
.pick-card { position: relative; }
.family-count { position: absolute; top: 8px; right: 10px; font-size: 11px; font-weight: 800; color: var(--accent-2); background: color-mix(in srgb, var(--accent) 14%, transparent); border-radius: 99px; padding: 1px 7px; }
.start-block { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.start-block h4 { margin: 0; }
.start-row { display: flex; flex-direction: column; gap: 4px; }
.start-alts { display: flex; flex-direction: column; gap: 3px; }
.start-alt { display: flex; align-items: flex-start; gap: 8px; padding: 6px 8px; border-radius: 8px; border: 1px solid var(--line); cursor: pointer; font-size: 13px; }
.start-alt.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.start-alt input { margin-top: 2px; }
.start-fixed { font-size: 13px; padding: 2px 4px; }
.any-pick { margin-left: 28px; }
.start-summary { font-size: 13px; padding: 8px 10px; border-radius: 9px; background: rgba(34, 197, 94, .08); border: 1px solid rgba(34, 197, 94, .3); }
.spell-limits { font-size: 13px; font-weight: 600; }
.ok-note { padding: 8px 12px; border-radius: 10px; background: rgba(34, 197, 94, .1); border: 1px solid rgba(34, 197, 94, .35); color: #86efac; font-weight: 600; font-size: 13px; }

/* ================================================================ PDF import preview */
.imp-report { display: flex; flex-direction: column; gap: 4px; }
.imp-line { display: flex; gap: 6px; align-items: baseline; padding: 6px 10px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); font-size: 13px; }
.imp-line.miss { border-color: color-mix(in srgb, var(--accent-2) 45%, transparent); }
.imp-ok { width: 16px; flex: none; color: #4ade80; font-weight: 800; }
.imp-line.miss .imp-ok { color: var(--accent-2); }

/* ---- multiclassing (creator) */
.mc-section { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; padding: 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--bg-2); }
.mc-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.mc-head h4 { margin: 0; }
.mc-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 6px 8px; border-radius: 8px; background: var(--panel-2); }
.mc-row.first { background: transparent; border: 1px dashed var(--line-2); }
.mc-row .qty { display: flex; align-items: center; gap: 4px; }
.mc-level { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 56px; text-align: center; }
.mc-row .spacer { flex: 1; }
.mc-level-head { margin: 16px 0 4px; padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.spell-section { display: flex; flex-direction: column; gap: 6px; margin-top: 8px; }

/* ---- prepared spells */
.prep-group { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; margin-bottom: 10px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); }
.prep-head { display: flex; align-items: baseline; gap: 6px; flex-wrap: wrap; }
.prep-head .spacer { flex: 1; }
.ok-text { color: #86efac; }
.chip.locked { cursor: default; opacity: .8; }
.spell-row.unprepared .linkish { opacity: .55; }
.tag-pill.ok { color: #86efac; border-color: rgba(34, 197, 94, .35); }
.chip .star { display: inline-block; width: 1.1em; margin-right: 3px; text-align: center; }

/* ================================================================ side panels (left / right) */
.sidebar.side-left { border-left: 0; border-right: 1px solid var(--line); }
.sidebar.closed { display: none; }
.sidebar .panels { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.tabs .tab-move { flex: 0 0 26px; padding-left: 0; padding-right: 0; color: var(--muted); }
.topbar .icon-btn.on { color: var(--accent-2); }
.layout-rows { display: flex; flex-direction: column; gap: 6px; }
.layout-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 6px 10px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); }
body.no-player-draw #toolbar [data-tool="draw"] { display: none; }
@media (max-width: 800px) {
  .sidebar.side-left { position: fixed; left: 0; right: auto; top: 52px; bottom: 0; width: min(380px, 100%); z-index: 21; box-shadow: var(--shadow); }
}

/* docked character sheet */
#sheetPanel { overflow: hidden; }
.dock-sheet { display: flex; flex-direction: column; min-height: 0; flex: 1; }
.dock-pick { margin: 8px 10px 0; }
.dock-title { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.dock-title .pc-portrait.big { width: 40px; height: 40px; font-size: 14px; }
.dock-title .sheet-name { font-size: 16px; }
.dock-body { flex: 1; overflow-y: auto; padding: 10px; display: flex; flex-direction: column; gap: 10px; }
.dock-body .sheet-cols { grid-template-columns: 1fr; }
.dock-body .turn-grid { grid-template-columns: 1fr; }
.dock-body .sheet-stat { min-width: 64px; padding: 6px 8px; }
.dock-body .sheet-stat .v { font-size: 17px; }
.dock-body .inv-row { grid-template-columns: 40px minmax(90px, 1fr) auto auto; }
.dock-body .inv-row > .muted.small:not(.inv-desc), .dock-body .inv-row .price { display: none; }

/* ================================================================ roll prompt + your roll on the map */
.roll-choice { position: fixed; z-index: 70; background: var(--panel); border: 1px solid var(--line-2); border-radius: 12px; box-shadow: var(--shadow); padding: 10px; display: flex; flex-direction: column; gap: 8px; min-width: 220px; animation: pop .12s ease-out; }
.roll-choice .rc-title { font-weight: 700; }
.roll-choice .rc-btns { display: flex; flex-direction: column; gap: 6px; }
.roll-pops { position: absolute; left: 50%; bottom: 18px; transform: translateX(-50%); display: flex; flex-direction: column; gap: 8px; align-items: center; z-index: 9; pointer-events: none; }
.roll-pop { pointer-events: auto; cursor: pointer; min-width: 240px; max-width: min(520px, 90vw); background: rgba(20, 23, 31, .96); border: 1px solid var(--line-2); border-radius: 14px; box-shadow: var(--shadow); padding: 10px 14px; animation: pop .18s ease-out; transition: opacity .5s, transform .5s; }
.roll-pop.out { opacity: 0; transform: translateY(10px); }
.roll-pop .rp-label { font-weight: 700; font-size: 13px; display: flex; gap: 6px; align-items: center; }
.roll-pop .rp-main { display: flex; align-items: center; gap: 12px; margin-top: 4px; }
.roll-pop .rp-total { font-size: 34px; font-weight: 900; color: var(--accent-2); min-width: 44px; text-align: center; }
.roll-pop .rp-dice { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.roll-pop .die { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 4px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line-2); font-weight: 800; font-size: 12.5px; }
.roll-pop .die.max { border-color: #22c55e; color: #86efac; }
.roll-pop .die.min { border-color: #ef4444; color: #fca5a5; }
.roll-pop .die.dropped { opacity: .4; text-decoration: line-through; }
.roll-pop .mod { color: var(--muted); font-weight: 700; }
.roll-pop .rp-note { margin-top: 4px; font-size: 13px; }
.roll-pop.crit-success { border-color: #22c55e; }
.roll-pop.crit-fail { border-color: #ef4444; }
.roll-pop.atk-hit, .roll-pop.atk-crit { border-color: rgba(34, 197, 94, .6); }
.roll-pop.atk-miss { border-color: rgba(239, 68, 68, .6); }

/* dice pool */
.die-btn { position: relative; }
.die-count { position: absolute; top: -6px; right: -4px; background: var(--accent); color: var(--accent-ink); font-size: 10.5px; font-weight: 800; padding: 0 4px; border-radius: 99px; }
.dice-pool { display: flex; align-items: center; gap: 8px; margin-top: 6px; padding: 5px 8px; border-radius: 8px; background: color-mix(in srgb, var(--accent) 10%, transparent); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.dice-pool .pool-expr { flex: 1; font-weight: 800; color: var(--accent-2); }

/* selected tokens */
.sel-bar { position: absolute; left: 50%; top: 12px; transform: translateX(-50%); z-index: 8; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; max-width: calc(100% - 140px); padding: 6px 10px; border-radius: 12px; background: rgba(20, 23, 31, .95); border: 1px solid var(--blue); box-shadow: var(--shadow); }

/* initiative: player characters in their color; friendly fire */
.init-row.pc { border-left: 4px solid var(--pc); }
.init-row.pc .init-name { color: var(--pc); font-weight: 700; }
.init-row.pc .init-dot { box-shadow: 0 0 0 2px var(--pc); }
.ff-btn { margin-left: auto; margin-right: 8px; }
.ff-btn.on { border-color: rgba(239, 68, 68, .5); color: #fca5a5; }
.ff-btn:not(.on) { border-color: rgba(34, 197, 94, .5); color: #86efac; }

/* item requests in chat */
.msg.request { border: 1px solid color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 7%, transparent); border-radius: 10px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; }
.msg.request.approved, .msg.request.bought { border-color: rgba(34, 197, 94, .45); background: rgba(34, 197, 94, .07); }
.msg.request.denied { border-color: rgba(239, 68, 68, .4); background: rgba(239, 68, 68, .06); opacity: .8; }

/* ================================================================ character sheet: tabs, turn, resources */
.sheet-tabs { display: flex; flex-wrap: wrap; width: 100%; flex: none; }
.dock-body > *, .sheet-modal .modal-body > * { flex-shrink: 0; }
.sheet-tabs button { flex: 1; padding: 7px 8px; font-size: 12.5px; white-space: nowrap; }
.sheet-tab-body { display: flex; flex-direction: column; gap: 10px; }
.sheet-stat.insp .v { color: var(--muted); }
.sheet-stat.insp.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); }
.sheet-stat.insp.on .v { color: var(--accent-2); }
.insp-star { color: var(--accent-2); }
.btn.rest { border-color: rgba(96, 165, 250, .45); }
.turn-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 10px; align-items: start; }
.turn-col { display: flex; flex-direction: column; gap: 6px; padding: 10px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); }
.turn-col h4 { margin: 0 0 2px; }
.turn-action { border-top: 3px solid #ef4444; }
.turn-bonus { border-top: 3px solid var(--accent); }
.turn-reaction { border-top: 3px solid #60a5fa; }
.turn-free { border-top: 3px solid #a78bfa; }
.turn-sub { font-size: 10.5px; font-weight: 800; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin-top: 4px; }
.turn-item { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 13px; }
.turn-col .attack-row { grid-template-columns: auto 1fr; font-size: 12.5px; }
.turn-feat { border: 1px solid var(--line); border-radius: 8px; background: var(--panel); }
.turn-feat summary { padding: 5px 8px; cursor: pointer; font-size: 13px; font-weight: 600; }
.res-widget { display: flex; flex-direction: column; gap: 4px; padding: 7px 9px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line-2); }
.feat-body .res-widget { margin: 4px 0 8px; }
.res-widget.out { opacity: .65; }
.res-head { display: flex; align-items: baseline; gap: 8px; justify-content: space-between; }
.res-reset { font-size: 10.5px; color: var(--muted); white-space: nowrap; }
.res-body { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.res-pips { display: inline-flex; gap: 4px; flex-wrap: wrap; }
.res-pip { width: 17px; height: 17px; border-radius: 4px; border: 2px solid var(--accent); background: color-mix(in srgb, var(--accent) 35%, transparent); cursor: pointer; padding: 0; }
.res-pip.used { background: transparent; border-color: var(--line-2); }
.res-pip:disabled { cursor: default; }
.res-count { display: inline-flex; align-items: center; gap: 4px; font-size: 15px; }
.chip-x { margin-left: 4px; border: 0; background: transparent; color: var(--muted); cursor: pointer; font-weight: 800; }
.chip-x:hover { color: var(--danger); }
.sheet-section.profs .chip-row { gap: 4px; }
.inv-row { grid-template-columns: 44px minmax(120px, 1fr) auto auto 64px auto auto auto; }
.inv-main { display: flex; flex-direction: column; min-width: 0; }
.inv-desc { white-space: pre-wrap; }
.rest-list { margin: 0; padding-left: 18px; }
.skill-row .skill-mod.roll-chip { justify-self: end; }

/* level-ups: the 1–20 road with ASI levels marked */
.level-road { display: grid; grid-template-columns: repeat(20, 1fr); gap: 3px; margin: 4px 0; }
.road-step { display: flex; flex-direction: column; align-items: center; padding: 3px 0; border-radius: 6px; background: var(--bg-2); border: 1px solid var(--line); font-size: 11px; font-weight: 700; color: var(--muted); }
.road-step i { font-style: normal; font-size: 8.5px; letter-spacing: .02em; }
.road-step.reached { color: var(--text); background: var(--panel-2); }
.road-step.asi { border-color: color-mix(in srgb, var(--accent) 70%, transparent); color: var(--accent-2); }
.road-step.sub { border-color: rgba(96, 165, 250, .7); }
.level-block.asi-level { border-color: color-mix(in srgb, var(--accent) 55%, transparent); }
.asi-badge { font-size: 11px; font-weight: 800; color: var(--accent-ink); background: var(--accent); padding: 1px 8px; border-radius: 99px; }

/* party grouped by player */
.party-group { display: flex; flex-direction: column; gap: 6px; }
.party-extra { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 0 4px; }
.online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); margin-right: 6px; vertical-align: middle; }
.online-dot.on { background: var(--ok); }

/* ================================================================ homebrew workshop */
.homebrew .hb-kinds .step { white-space: nowrap; }
.hb-layout { display: grid; grid-template-columns: 210px 1fr; gap: 14px; align-items: start; }
.hb-list { display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; }
.hb-item { display: flex; align-items: center; justify-content: space-between; gap: 6px; padding: 4px 8px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); }
.hb-item.on { border-color: var(--accent); }
.hb-form { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.hb-form h3 { margin: 0; }
.hb-form .row2 { display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-end; }
.hb-form .row2 > .row-field { flex: 1; min-width: 140px; }
.hb-abils { display: flex; flex-wrap: wrap; gap: 8px 14px; }
.hb-abils .num { width: 64px; }
.hb-rows { display: flex; flex-direction: column; gap: 6px; }
.hb-row { display: grid; grid-template-columns: 180px 1fr auto; gap: 6px; align-items: start; }
.hb-row:has(> input.num) { grid-template-columns: 64px 180px 1fr auto; }
.hb-row textarea { width: 100%; }
@media (max-width: 720px) { .hb-layout { grid-template-columns: 1fr; } .level-road { grid-template-columns: repeat(10, 1fr); } }

/* ================================================================ resizable side panels */
.sidebar { max-width: 100vw; }
@media (min-width: 801px) { .sidebar { position: relative; } }
.side-resize { position: absolute; top: 0; bottom: 0; width: 8px; z-index: 6; cursor: col-resize; touch-action: none; }
.side-resize.left { right: -4px; }
.side-resize.right { left: -4px; }
.side-resize::after { content: ""; position: absolute; top: 50%; left: 3px; width: 2px; height: 36px; margin-top: -18px; border-radius: 2px; background: var(--line-2); opacity: 0; transition: opacity .15s; }
.side-resize:hover::after, body.resizing .side-resize::after { opacity: 1; background: var(--accent); }
body.resizing { cursor: col-resize; user-select: none; }
body.resizing #board, body.resizing iframe { pointer-events: none; }
body.panels-full .board-wrap > :not(canvas) { display: none; }

/* ================================================================ lasting spells */
.effect-list { padding: 0 10px 8px; display: flex; flex-direction: column; gap: 6px; }
.effect-list:empty { display: none; }
.effect-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 8px; background: var(--bg-2); border: 1px solid var(--line); }
.effect-main { flex: 1; min-width: 0; font-size: 13px; }
.effect-main .tag-pill { margin-left: 6px; }
.effect-btns { display: flex; gap: 4px; align-items: center; }

/* per-player main color picker */
.accent-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.accent-row .swatch.on { outline: 2px solid var(--text); outline-offset: 2px; }
.accent-custom { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; color: var(--muted); }
.accent-custom input { width: 32px; height: 26px; padding: 0; border: 0; background: none; }
.shop .row2 select { min-width: 0; }

/* invite card: help when a phone can't connect */
.invite-help { margin-top: 6px; font-size: 12.5px; }
.invite-help summary { cursor: pointer; color: var(--accent-2); font-weight: 600; }
.invite-help ol { margin: 6px 0; padding-left: 18px; display: flex; flex-direction: column; gap: 5px; color: var(--muted); }
.invite-help code { font-size: 11.5px; }
.invite-url { flex-wrap: wrap; }
.invite-url code { white-space: normal; overflow-wrap: anywhere; text-overflow: clip; flex: 1 1 140px; }

/* ================================================================ "Who's playing?" accounts + lobby */
.avatar { overflow: hidden; }
.avatar .avatar-img { width: 100%; height: 100%; object-fit: cover; }
.acct-card { width: min(720px, 100%); background: var(--panel); border: 1px solid var(--line); border-radius: 16px; padding: 26px 28px; box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 14px; }
.acct-brand { display: flex; align-items: center; gap: 14px; }
.acct-logo { font-size: 42px; line-height: 1; }
.acct-logo.small { font-size: 22px; }
.acct-title { font-size: 30px; font-weight: 800; color: var(--accent-2); letter-spacing: -.01em; }
.acct-campaign { padding: 8px 12px; border-radius: 10px; background: var(--bg-2); border: 1px solid var(--line); font-size: 13.5px; }
.acct-h { font-size: 17px; font-weight: 800; color: var(--accent-2); }
.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.acct-tile { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); color: var(--text); text-align: left; cursor: pointer; font: inherit; }
.acct-tile:hover { border-color: var(--accent); background: var(--panel-2); }
.acct-tile.last { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.acct-info { display: flex; flex-direction: column; min-width: 0; }
.acct-info b { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.acct-avatar { flex: none; border-radius: 50%; display: grid; place-items: center; overflow: hidden; color: #fff; font-weight: 800; box-shadow: 0 0 0 2px rgba(0, 0, 0, .25); }
.acct-avatar img { width: 100%; height: 100%; object-fit: cover; }
.acct-new { display: flex; gap: 8px; flex-wrap: wrap; }
.acct-new input { flex: 1 1 200px; padding: 10px 12px; font-size: 15px; }
.acct-row { display: flex; align-items: center; gap: 10px; }
.acct-row input { flex: 1; }
.acct-colors { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.acct-colors .swatch { width: 22px; height: 22px; }
.acct-dm summary { cursor: pointer; font-weight: 700; color: var(--muted); }
.acct-dm[open] summary { margin-bottom: 8px; color: var(--text); }
.acct-status .dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; background: var(--ok); vertical-align: middle; }

.lobby { position: fixed; inset: 0; z-index: 35; background: var(--bg); display: flex; flex-direction: column; overflow: auto; }
.lb-top { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--panel-2); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 2; flex-wrap: wrap; }
.lb-brand { font-size: 17px; }
.lb-me { display: inline-flex; align-items: center; gap: 8px; border: 0; background: transparent; color: var(--text); cursor: pointer; font: inherit; padding: 2px 6px; border-radius: 99px; }
.lb-me:hover { background: var(--panel); }
.lb-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px; flex: 1; align-items: start; }
.lb-panel { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 10px; min-height: 60vh; }
.lb-head { display: flex; align-items: center; gap: 10px; justify-content: space-between; flex-wrap: wrap; }
.lb-head h2 { margin: 0; font-size: 22px; color: var(--accent-2); }
.lb-list { display: flex; flex-direction: column; gap: 8px; }
.lb-char, .lb-camp { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--bg-2); cursor: pointer; }
.lb-camp { cursor: default; }
.lb-char:hover { border-color: var(--line-2); }
.lb-char.on, .lb-camp.on { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent) inset; }
.lb-char-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.lb-char-btns { display: flex; flex-direction: column; gap: 4px; }
.lb-pill { align-self: flex-start; font-size: 11px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line-2); color: var(--muted); }
.lb-pill.here { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent) 50%, transparent); }
.lb-pill.none { font-style: italic; }
.lb-camp-ico { font-size: 26px; width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%; background: var(--panel-2); flex: none; }
.lb-campaigns { display: flex; flex-direction: column; gap: 10px; }
.lb-focus { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 10%, var(--bg-2)); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent); }
.lb-focus:has(> .muted:only-child) { background: transparent; border-color: transparent; padding: 0 2px; }
.lb-empty { color: var(--muted); padding: 20px 4px; }
@media (max-width: 820px) { .lb-cols { grid-template-columns: 1fr; } .lb-panel { min-height: 0; } .acct-card { padding: 18px; } }

/* DM: player accounts list */
.accounts-card summary { cursor: pointer; }
.acct-admin { display: flex; flex-direction: column; gap: 4px; margin: 6px 0; max-height: 260px; overflow: auto; }
.acct-admin-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 8px; background: var(--bg-2); }

/* ---------- monster & species art (pictures from the art folder) */
.comp-thumb { width: 30px; height: 30px; border-radius: 8px; object-fit: cover; flex: none; border: 2px solid var(--line-2); background: var(--panel-2); }
.art-figure { display: block; max-width: 100%; border-radius: 12px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: zoom-in; }
.sb-art { align-self: center; width: auto; max-width: 100%; max-height: 300px; object-fit: contain; margin: 0 0 8px; }
.race-art { width: min(100%, 560px); aspect-ratio: 16 / 9; object-fit: cover; object-position: center 30%; margin-bottom: 10px; }
.art-modal .modal-body { display: flex; justify-content: center; }
.art-big { max-width: 100%; max-height: 78vh; border-radius: 12px; object-fit: contain; }
.pick-grid.with-art { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.pick-card.has-art { padding-top: 0; overflow: hidden; }
.pick-art { width: calc(100% + 24px); margin: 0 -12px 6px; aspect-ratio: 16 / 9; object-fit: cover; object-position: center 30%; background: var(--panel-2); border-bottom: 1px solid var(--line); }
.pick-card.has-art .family-count { z-index: 1; }
.art-picker input[type=search] { width: 100%; margin-bottom: 10px; }
.art-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; max-height: 62vh; overflow: auto; }
.art-tile { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 6px; border-radius: 10px; border: 1px solid var(--line-2); background: var(--bg-2); cursor: pointer; color: var(--text); }
.art-tile:hover { border-color: var(--accent); }
.art-tile img { width: 80px; height: 80px; border-radius: 50%; object-fit: cover; background: var(--panel-2); }
.art-tile span { font-size: 11px; line-height: 1.2; text-align: center; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ---------- inventory sub-tabs & pets */
.inv-tabs { display: flex; gap: 4px; margin-bottom: 8px; }
.inv-tab { padding: 5px 12px; border-radius: 99px; border: 1px solid var(--line-2); background: var(--bg-2); color: var(--muted); font-weight: 600; cursor: pointer; }
.inv-tab.on { background: color-mix(in srgb, var(--accent) 18%, transparent); border-color: var(--accent); color: var(--text); }
.pet-list { display: flex; flex-direction: column; gap: 6px; }
.pet-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 12px; background: var(--bg-2); border: 1px solid var(--line); flex-wrap: wrap; }
.pet-row.down { opacity: .6; }
.pet-pic { width: 52px; height: 52px; border-radius: 50%; object-fit: cover; flex: none; border: 2px solid var(--line-2); cursor: pointer; background: var(--panel-2); }
.pet-pic.none { display: grid; place-items: center; font-size: 22px; color: #fff; }
.pet-main { display: flex; flex-direction: column; gap: 1px; min-width: 140px; flex: 1; }
.pet-name { font-weight: 700; font-size: 15px; text-align: left; }
.pet-stats b { color: var(--muted); font-weight: 600; }
.pet-actions { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.pet-empty { padding: 16px; text-align: center; border: 1px dashed var(--line-2); border-radius: 12px; }
.pet-edit { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; }
.pet-edit input { width: 180px; }
.give-pet-list { max-height: 58vh; overflow: auto; margin-top: 8px; }
.give-pet-list .comp-row { cursor: default; }
@media (max-width: 600px) {
  .sb-art { max-height: 220px; }
  .pet-actions { width: 100%; }
}
.pick-art.none { display: grid; place-items: center; font-size: 34px; font-weight: 800; color: var(--line-2); background: linear-gradient(135deg, var(--panel-2), var(--bg-2)); }
.pick-card.has-art { justify-content: flex-start; }
.tag-pill.ts { color: #a5b4fc; border-color: rgba(129, 140, 248, .45); }
.tag-pill.warn { color: #fcd34d; border-color: rgba(245, 158, 11, .45); }
.ts-warn { margin: 6px 0; padding: 8px 10px; border-radius: 8px; background: color-mix(in srgb, var(--danger) 14%, transparent); border: 1px solid color-mix(in srgb, var(--danger) 45%, transparent); font-size: 12.5px; }

/* walls & vision */
.vision-card summary { cursor: pointer; }
.vision-card .check { display: flex; gap: 6px; align-items: center; margin: 4px 0; }
.vision-card .row2 { flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.detect-preview { display: block; max-width: 100%; margin: 8px auto; border-radius: 8px; border: 1px solid var(--line-2); }
.trap-presets { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; margin-bottom: 10px; }
.trap-switches { display: grid; grid-template-columns: 1fr 1fr; gap: 4px 12px; margin: 8px 0; }
.trap-modal .row2 { gap: 8px; align-items: flex-end; }
.trap-modal .field { flex: 1; }
.insp-row .seg button { padding: 3px 8px; }
.warn-text { color: #fcd34d; max-width: 420px; white-space: normal; }
