:root {
  --bg: #f4efe6;
  --surface: #fffaf2;
  --surface-2: #efe7da;
  --line: #ddd2c0;
  --text: #2a2219;
  --muted: #7a6c5b;
  --accent: #a8721a;
  --accent-ink: #fff;
  --accent-soft: #f3e2c0;
  --bad: #b3261e;
  --bad-soft: #fbe3df;
  --good: #2e7d4f;
  --c-dos2: #6d4fd6;
  --c-bg3: #b0302a;
  --c-5e14: #2c7a68;
  --c-5e24: #2f66ad;
  --radius: 12px;
  --shadow: 0 1px 2px rgb(60 40 10 / .06), 0 4px 16px rgb(60 40 10 / .06);
  --serif: 'Alegreya', Georgia, serif;
  --sans: 'Alegreya Sans', system-ui, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #15120f; --surface: #1f1a15; --surface-2: #29231c; --line: #3a3127; --text: #ece3d4; --muted: #a6978a;
    --accent: #d9a441; --accent-ink: #1a140c; --accent-soft: #3a2d17; --bad: #f28b82; --bad-soft: #3b1f1c; --good: #7cc79a;
    --c-dos2: #9d85ff; --c-bg3: #e0655c; --c-5e14: #5cbfa6; --c-5e24: #6ea3e8;
    --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 20px rgb(0 0 0 / .25);
  }
}
:root[data-theme="dark"] {
  --bg: #15120f; --surface: #1f1a15; --surface-2: #29231c; --line: #3a3127; --text: #ece3d4; --muted: #a6978a;
  --accent: #d9a441; --accent-ink: #1a140c; --accent-soft: #3a2d17; --bad: #f28b82; --bad-soft: #3b1f1c; --good: #7cc79a;
  --c-dos2: #9d85ff; --c-bg3: #e0655c; --c-5e14: #5cbfa6; --c-5e24: #6ea3e8;
  --shadow: 0 1px 2px rgb(0 0 0 / .3), 0 6px 20px rgb(0 0 0 / .25);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 17px/1.45 var(--sans); }
h1, h2, h3 { font-family: var(--serif); font-weight: 700; line-height: 1.15; margin: 0; }
a { color: var(--accent); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

.site-header { display: flex; align-items: center; justify-content: space-between; max-width: 1240px; margin: 0 auto; padding: 14px 16px; }
.logo { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font: 700 24px var(--serif); }
.logo svg { color: var(--accent); }
.theme-btn { background: none; border: 1px solid var(--line); border-radius: 50%; width: 36px; height: 36px; cursor: pointer; font-size: 18px; }
.site-footer { color: var(--muted); font-size: 14px; padding-top: 32px; padding-bottom: 32px; }

/* Кнопки и поля */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 7px 14px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; text-decoration: none; color: var(--text); white-space: nowrap; }
.btn:hover:not(:disabled) { border-color: var(--accent); }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 700; }
.btn.ghost { background: transparent; }
.btn.danger { color: var(--bad); }
input:not([type]), input[type="number"], input[type="text"], select, textarea {
  background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; min-width: 0; max-width: 100%;
}
textarea { width: 100%; resize: vertical; }
input.num { width: 64px; }
select { cursor: pointer; }
input[type="range"] { accent-color: var(--accent); }
input[type="checkbox"] { accent-color: var(--accent); width: 18px; height: 18px; flex: none; }

.row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.grow { flex: 1 1 auto; min-width: 0; }
.nowrap { white-space: nowrap; }
.muted { color: var(--muted); }
.fine { color: var(--muted); font-size: 13px; margin: 12px 0 0; }
.accent { color: var(--accent); }
.c { text-align: center; }
.strong { font-weight: 700; font-size: 1.1em; }

/* Главная */
.hero { padding: 28px 0 20px; }
.hero h1 { font-size: clamp(32px, 6vw, 52px); }
.hero p { max-width: 60ch; color: var(--muted); font-size: 19px; margin: 10px 0 0; }
.sys-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 14px; }
.sys-card { --c: var(--accent); text-align: left; display: flex; flex-direction: column; gap: 8px; padding: 18px; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--c); box-shadow: var(--shadow); cursor: pointer; transition: transform .15s; }
.sys-card:hover { transform: translateY(-2px); border-color: var(--c); }
.sys-card b { font: 700 21px var(--serif); }
.sys-card > span:not(.sys-badge) { color: var(--muted); font-size: 15px; }
.sys-card .cta { color: var(--c) !important; font-weight: 700; margin-top: auto; }
.sys-dos2 { --c: var(--c-dos2); } .sys-bg3 { --c: var(--c-bg3); } .sys-5e14 { --c: var(--c-5e14); } .sys-5e24 { --c: var(--c-5e24); }
.sys-badge { align-self: flex-start; display: inline-block; padding: 2px 8px; border-radius: 6px; background: var(--c, var(--accent)); color: #fff; font: 700 13px var(--sans); letter-spacing: .04em; }

.list-head { display: flex; align-items: center; justify-content: space-between; margin: 36px 0 12px; gap: 12px; }
.list-head h2 { font-size: 26px; display: flex; align-items: center; gap: 10px; }
.count { font: 500 14px var(--sans); background: var(--surface-2); border-radius: 99px; padding: 1px 9px; color: var(--muted); }
.build-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.build-row { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 10px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: var(--text); }
.build-row:hover { border-color: var(--accent); }
.build-row .grow { display: flex; flex-direction: column; }
.build-row small { color: var(--muted); }
.empty { color: var(--muted); padding: 28px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }

/* Редактор */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 8px 0 18px; }
.name-input { flex: 1 1 260px; font: 700 26px var(--serif) !important; background: transparent !important; border-color: transparent !important; padding: 4px 8px !important; }
.name-input:hover, .name-input:focus { border-color: var(--line) !important; }
.tools { display: flex; flex-wrap: wrap; gap: 6px; }

.editor { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 20px; align-items: start; }
.editor-col { display: grid; gap: 16px; min-width: 0; }
.summary-col { position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow: auto; }
@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; }
  .summary-col { position: static; max-height: none; order: -1; }
}

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: grid; gap: 12px; min-width: 0; }
.card h2 { font-size: 22px; }
.card h3 { font-size: 17px; margin-top: 6px; color: var(--muted); }
.field { display: grid; gap: 4px; min-width: 0; }
.field-label { font-size: 14px; color: var(--muted); font-weight: 500; }
.field-hint { font-size: 13px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.pill { display: inline-block; padding: 4px 10px; border-radius: 6px; background: var(--accent-soft); font-weight: 700; font-size: 14px; }
.asi-slots { display: flex; flex-wrap: wrap; gap: 8px; }
.asi-slot { display: flex; align-items: center; gap: 6px; padding: 4px 6px 4px 10px; background: var(--surface-2); border-radius: 8px; }
.feat-pick { display: grid; gap: 4px; }
.feat-pick select.grow { flex: 1 1 200px; }

.tabs { display: flex; flex-wrap: wrap; gap: 4px; background: var(--surface-2); padding: 4px; border-radius: 10px; justify-self: start; max-width: 100%; }
.tabs button { border: 0; background: transparent; padding: 6px 12px; border-radius: 7px; cursor: pointer; }
.tabs button.on { background: var(--surface); box-shadow: var(--shadow); font-weight: 700; }
.budget { margin: 0; font-weight: 700; }
.budget.bad, .bad { color: var(--bad); }
.budget-tag { justify-self: start; font-size: 14px; font-weight: 700; padding: 2px 10px; border-radius: 99px; background: var(--accent-soft); }
.budget-tag.bad { background: var(--bad-soft); color: var(--bad); }
.budget-tag.done { background: var(--surface-2); color: var(--muted); }

.table-wrap { overflow-x: auto; }
table.abil { width: 100%; border-collapse: collapse; }
table.abil th, table.abil td { padding: 6px 8px; border-bottom: 1px solid var(--line); text-align: left; }
table.abil thead th { font-size: 13px; color: var(--muted); font-weight: 500; }
table.abil .c { text-align: center; }
.ab-short { font-weight: 700; letter-spacing: .04em; }
.ab-full { display: block; font-size: 13px; color: var(--muted); font-weight: 400; }
.mod { display: inline-block; min-width: 36px; padding: 1px 6px; border-radius: 6px; background: var(--surface-2); font-weight: 700; text-align: center; }

.stepper { display: inline-flex; align-items: center; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface-2); flex: none; }
.stepper button { width: 32px; height: 32px; border: 0; background: transparent; cursor: pointer; font-size: 18px; }
.stepper button:hover:not(:disabled) { background: var(--accent-soft); }
.stepper button:disabled { opacity: .3; cursor: default; }
.stepper output { min-width: 32px; text-align: center; font-weight: 700; }

/* Уровни */
.levels { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.lvl { display: flex; gap: 12px; padding: 10px; border-radius: 10px; background: var(--surface-2); }
.lvl.has-feat { box-shadow: inset 3px 0 0 var(--accent); }
.lvl-num { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--line); font: 700 16px var(--serif); }
.lvl-body { flex: 1; display: grid; gap: 6px; min-width: 0; }
.cls-sel { flex: 0 1 220px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chip { font-size: 13px; padding: 1px 8px; border-radius: 99px; background: var(--surface); border: 1px solid var(--line); }
.chip.sub { border-color: var(--accent); color: var(--accent); }
.slot-label { font-size: 13px; font-weight: 700; color: var(--accent); }
.add-level { padding-top: 6px; }

.skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 6px; }
.skill { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; text-align: left; }
.skill .dot { width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--muted); flex: none; }
.skill.s1 .dot { background: var(--accent); border-color: var(--accent); }
.skill.s2 .dot { background: var(--accent); border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.skill.s1, .skill.s2 { border-color: var(--accent); }

/* DOS2 */
.alloc { display: grid; gap: 2px; }
.alloc-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.alloc-row:last-child { border-bottom: 0; }
.alloc-row .grow { display: grid; }
.alloc-row .en { font-size: 13px; color: var(--muted); }
.alloc-row small { font-size: 13px; color: var(--muted); }
.alloc-row small.accent { color: var(--accent); }
.lvl-out { min-width: 28px; font: 700 20px var(--serif); text-align: right; }
.talents { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; }
.talent { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.talent.on { border-color: var(--accent); }
.talent span { display: grid; }
.talent small { color: var(--muted); font-size: 13px; }
.school { border: 1px solid var(--line); border-radius: 10px; padding: 0 12px; }
.school summary { cursor: pointer; padding: 10px 0; font-weight: 700; }
.skill-list { display: grid; gap: 4px; padding-bottom: 10px; }
.dskill { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border-radius: 6px; cursor: pointer; flex-wrap: wrap; }
.dskill.on { background: var(--accent-soft); }
.dskill.locked > .grow { opacity: .6; }
.dskill .muted { font-size: 13px; }
.src { color: var(--accent); }
.x { border: 0; background: none; color: var(--bad); cursor: pointer; font-size: 18px; line-height: 1; }
.add-skill { border-top: 1px solid var(--line); padding-top: 12px; }

/* Сводка */
.summary { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); display: grid; gap: 14px; }
.sum-head { display: grid; gap: 4px; }
.sum-head h2 { font-size: 24px; word-break: break-word; }
.sum-head p { margin: 0; }
.stats3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.stat { background: var(--surface-2); border-radius: 8px; padding: 8px 6px; text-align: center; display: grid; }
.stat b { font: 700 22px var(--serif); }
.stat span { font-size: 12px; color: var(--muted); line-height: 1.2; }
.abil-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.abil-box { border: 1px solid var(--line); border-radius: 10px; padding: 8px 4px; text-align: center; display: grid; gap: 2px; justify-items: center; }
.abil-box b { font: 700 24px var(--serif); }
.abil-box.save { border-color: var(--accent); }
.save-line { font-size: 12px; color: var(--muted); }
.abil-box.save .save-line { color: var(--accent); font-weight: 700; }
.block { display: grid; gap: 6px; }
.block h3 { font-size: 16px; }
.block p { margin: 0; }
.slots { display: flex; flex-wrap: wrap; gap: 4px; }
.slot { display: grid; text-align: center; min-width: 34px; padding: 4px; border-radius: 6px; background: var(--surface-2); }
.slot span { font-size: 11px; color: var(--muted); }
.kv { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 700; text-align: right; }
.warn { background: var(--bad-soft); border-radius: 10px; padding: 10px 12px; }
.warn h3 { color: var(--bad); }
.warn ul { margin: 0; padding-left: 18px; font-size: 15px; }
.ok { color: var(--good); font-weight: 700; margin: 0; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--text); color: var(--bg); padding: 10px 18px; border-radius: 99px; box-shadow: var(--shadow); transition: opacity .4s; z-index: 10; }
.toast.out { opacity: 0; }

@media (max-width: 560px) {
  body { font-size: 16px; }
  .toolbar .tools { width: 100%; }
  .lvl { gap: 8px; padding: 8px; }
  .lvl-num { width: 28px; height: 28px; font-size: 14px; }
  .ab-full { display: none; }
}

@media print {
  .site-header, .site-footer, .toolbar .tools, .toolbar .btn, .add-level, .add-skill, .theme-btn { display: none !important; }
  body { background: #fff; color: #000; }
  .editor { grid-template-columns: 1fr; }
  .summary-col { position: static; max-height: none; order: -1; }
  .card, .summary { box-shadow: none; break-inside: avoid; }
}

/* ===================== Раскладки под игры ===================== */
.editor.no-side { grid-template-columns: minmax(0, 1fr); }
.editor-col > * { min-width: 0; }

/* Общая «игровая» тёмная палитра: в играх интерфейс всегда тёмный */
.skin-bg3, .skin-dos2 {
  --surface-2: #2a231b; --line: #4a3d2c; --text: #eadfca; --muted: #a39274;
  --accent-ink: #1a140c; --bad: #f28b82; --bad-soft: #3b1f1c; --good: #8fd1a5;
  color: var(--text); background: var(--bg); border-radius: 14px; padding: 14px;
  --shadow: 0 2px 12px rgb(0 0 0 / .35);
}
.skin-bg3 { --bg: #0e0c0a; --surface: #1a1612; --accent: #c9a55c; --accent-soft: #3a2f1c; border: 1px solid #3a2f22; }
.skin-dos2 { --bg: #120f0c; --surface: #1d1813; --accent: #e3a54a; --accent-soft: #3d2c17; border: 1px solid #3b2e20; }
.skin-bg3 h2, .skin-bg3 h3, .skin-dos2 h2, .skin-dos2 h3 { color: var(--accent); }
.skin-bg3 .summary-col, .skin-dos2 .summary-col { top: 12px; }

/* ----- BG3: создание персонажа ----- */
.cc { display: grid; gap: 14px; }
.cc-tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 1px solid var(--line); scrollbar-width: thin; }
.cc-tabs button { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 14px; border: 0; background: none; cursor: pointer; color: var(--muted); border-bottom: 2px solid transparent; font: 700 16px var(--serif); }
.cc-tabs button.on { color: var(--accent); border-bottom-color: var(--accent); }
.cc-num { width: 22px; height: 22px; display: grid; place-items: center; border: 1px solid currentColor; border-radius: 50%; font: 700 12px/1 var(--sans); }
.cc-pane { display: grid; gap: 12px; min-width: 0; }
.cc-split { display: grid; grid-template-columns: 230px minmax(0, 1fr); gap: 16px; align-items: start; }
.cc-list { display: grid; gap: 4px; max-height: 560px; overflow: auto; padding-right: 4px; }
.cc-item { display: grid; text-align: left; padding: 9px 12px; border-radius: 8px; border: 1px solid transparent; background: var(--surface); cursor: pointer; }
.cc-item b { font: 700 17px var(--serif); }
.cc-item small { color: var(--muted); }
.cc-item:hover { border-color: var(--line); }
.cc-item.on { border-color: var(--accent); background: linear-gradient(90deg, var(--accent-soft), var(--surface)); }
.cc-detail { display: grid; gap: 10px; padding: 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.cc-detail h2 { font-size: 28px; }
.cc-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.cc-chip { padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.cc-chip.on { border-color: var(--accent); color: var(--accent); font-weight: 700; }
.cc-note { margin: 0; padding: 8px 12px; border-left: 3px solid var(--accent); background: var(--surface-2); border-radius: 0 8px 8px 0; color: var(--muted); font-size: 15px; }
.cc-kv { grid-template-columns: auto 1fr; }
.cc-kv dd { text-align: left; }
.cc-skills { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 4px; }
.cc-skill { display: flex; align-items: center; gap: 8px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; text-align: left; }
.cc-skill small { color: var(--muted); }
.cc-skill .dot { width: 12px; height: 12px; transform: rotate(45deg); border: 2px solid var(--muted); flex: none; }
.cc-skill.s1 .dot, .cc-skill.s2 .dot { background: var(--accent); border-color: var(--accent); }
.cc-skill.s2 .dot { box-shadow: 0 0 0 3px var(--accent-soft); }
.cc-skill.s1, .cc-skill.s2 { border-color: var(--accent); }
.cc-points { display: flex; justify-content: space-between; align-items: baseline; padding: 10px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.cc-points b { font: 700 26px var(--serif); color: var(--accent); }
.cc-points.bad b { color: var(--bad); }
.cc-abil th[scope="row"] { font: 700 17px var(--serif); }
.cc-radio { width: 20px; height: 20px; accent-color: var(--accent); cursor: pointer; }
.cc-foot { display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding-top: 12px; }

/* ----- BG3: лист персонажа ----- */
.bg3-sheet { display: grid; gap: 10px; padding: 16px; border-radius: 12px; background: linear-gradient(180deg, #211b15, var(--surface)); border: 1px solid #5a4a33; box-shadow: inset 0 0 0 3px var(--surface), inset 0 0 0 4px #3e3324; }
.bg3-head { text-align: center; display: grid; gap: 2px; }
.bg3-head h2 { font-size: 26px; word-break: break-word; }
.bg3-head p { margin: 0; }
.gold { color: var(--accent); font-weight: 700; }
.bg3-vitals { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; align-items: center; }
.bg3-ac { justify-self: center; width: 62px; height: 70px; display: grid; place-content: center; text-align: center; background: var(--accent); color: var(--accent-ink); clip-path: polygon(50% 0, 100% 14%, 100% 55%, 50% 100%, 0 55%, 0 14%); }
.bg3-ac b { font: 700 24px var(--serif); line-height: 1; }
.bg3-ac span { font-size: 11px; font-weight: 700; }
.bg3-vital { display: grid; text-align: center; }
.bg3-vital b { font: 700 20px var(--serif); }
.bg3-vital span { font-size: 11px; color: var(--muted); }
.bg3-abils { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; }
.bg3-abil { display: grid; justify-items: center; padding: 6px 2px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-2); }
.bg3-abil span { font-size: 11px; font-weight: 700; color: var(--muted); }
.bg3-abil b { font: 700 22px var(--serif); line-height: 1.1; }
.bg3-abil small { color: var(--accent); font-weight: 700; }
.bg3-row { display: flex; justify-content: space-between; border-bottom: 1px dotted var(--line); padding: 2px 0; }
.bg3-h { font-size: 15px !important; text-transform: uppercase; letter-spacing: .08em; text-align: center; border-top: 1px solid var(--line); padding-top: 8px; margin-top: 4px; }
.bg3-saves { display: grid; grid-template-columns: repeat(6, 1fr); gap: 4px; text-align: center; }
.bg3-save { display: grid; font-size: 12px; color: var(--muted); padding: 4px 0; border-radius: 6px; }
.bg3-save b { color: var(--text); font-size: 16px; }
.bg3-save.prof { background: var(--accent-soft); }
.bg3-save.prof b { color: var(--accent); }
.bg3-skills { display: grid; gap: 8px; }
.bg3-skill-group { display: grid; gap: 1px; }
.bg3-skill-ab { font-size: 12px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.bg3-skill { display: flex; justify-content: space-between; font-size: 15px; padding: 1px 6px; border-radius: 4px; }
.bg3-skill.prof { background: var(--accent-soft); }
.bg3-skill.prof b { color: var(--accent); }

/* ----- DOS2: окно персонажа ----- */
.d2-sheet { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 14px; align-items: start; }
.d2-rail { display: grid; gap: 4px; position: sticky; top: 12px; }
.d2-rail button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 8px; border: 1px solid transparent; background: var(--surface); cursor: pointer; text-align: left; font: 700 15px var(--serif); color: var(--muted); }
.d2-rail button.on { color: var(--accent); border-color: var(--accent); background: linear-gradient(90deg, var(--accent-soft), var(--surface)); }
.d2-ico { width: 28px; height: 28px; display: grid; place-items: center; border-radius: 50%; border: 1px solid currentColor; font-size: 15px; flex: none; }
.d2-rail-label { flex: 1; }
.d2-badge { min-width: 22px; padding: 0 6px; border-radius: 99px; background: var(--accent); color: var(--accent-ink); font: 700 12px/20px var(--sans); text-align: center; }
.d2-pane { display: grid; gap: 12px; padding: 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); min-width: 0; }
.d2-points { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 14px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); }
.d2-points b { font: 700 24px var(--serif); color: var(--accent); }
.d2-points.bad b { color: var(--bad); }
.d2-group h3 { font-size: 14px !important; text-transform: uppercase; letter-spacing: .1em; padding: 6px 0; border-bottom: 1px solid var(--accent-soft); }
.d2-list, .d2-group { display: grid; }
.d2-row { display: flex; align-items: center; gap: 12px; padding: 7px 4px; border-bottom: 1px solid var(--line); }
.d2-row:last-child { border-bottom: 0; }
.d2-row .grow { display: grid; }
.d2-name { font: 700 17px var(--serif); }
.d2-en { font-size: 12px; color: var(--muted); }
.d2-row small { font-size: 13px; color: var(--muted); }
.d2-row small.accent { color: var(--accent); }
.d2-talents { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 6px; }
.d2-talent { display: flex; gap: 8px; align-items: flex-start; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.d2-talent.on { border-color: var(--accent); }
.d2-talent span { display: grid; }
.d2-talent small { color: var(--muted); font-size: 13px; }
.d2-schools { display: flex; flex-wrap: wrap; gap: 4px; border-bottom: 1px solid var(--line); padding-bottom: 6px; }
.d2-schools button { flex: none; display: flex; align-items: center; gap: 4px; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--line); border-bottom-width: 2px; background: var(--surface-2); cursor: pointer; color: var(--muted); font-weight: 700; }
.d2-schools button.on { color: var(--accent); border-bottom-color: var(--accent); }
.d2-book { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.d2-skill { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; }
.d2-skill .grow { display: grid; }
.d2-skill small { color: var(--muted); font-size: 12px; }
.d2-skill.on { border-color: var(--accent); background: var(--accent-soft); }
.d2-stats { display: grid; gap: 12px; padding: 16px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); }
.d2-stats-head { text-align: center; }
.d2-stats-head h2 { font-size: 24px; word-break: break-word; }
.d2-stats-head p { margin: 2px 0 0; }
.d2-attr-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.d2-attr { display: grid; text-align: center; padding: 6px 2px; border-radius: 8px; background: var(--surface-2); }
.d2-attr span { font-size: 12px; color: var(--muted); }
.d2-attr b { font: 700 22px var(--serif); color: var(--accent); }
.d2-block { display: grid; gap: 4px; }
.d2-block h3 { font-size: 13px !important; text-transform: uppercase; letter-spacing: .1em; }
.d2-block p { margin: 0; }

/* ----- 5e / 5.5e: бумажный лист ----- */
.skin-sheet { --ink: color-mix(in srgb, var(--text) 70%, transparent); --ink-soft: color-mix(in srgb, var(--text) 25%, transparent); }
.ps-wrap { display: grid; gap: 12px; }
.ps-tabs { display: flex; gap: 2px; overflow-x: auto; border-bottom: 2px solid var(--ink); }
.ps-tabs button { flex: none; padding: 8px 16px; border: 1px solid transparent; border-bottom: 0; border-radius: 8px 8px 0 0; background: none; cursor: pointer; font: 700 16px var(--serif); color: var(--muted); }
.ps-tabs button.on { background: var(--surface); border-color: var(--ink); color: var(--text); margin-bottom: -2px; border-bottom: 2px solid var(--surface); }
.ps-status { margin: 0; font-size: 15px; }
.ps-status.ok { color: var(--good); font-weight: 700; }
.ps-status.bad { color: var(--bad); background: var(--bad-soft); border-radius: 8px; padding: 6px 12px; }
.ps-status summary { cursor: pointer; font-weight: 700; }
.ps-status ul { margin: 6px 0 0; padding-left: 18px; }
.ps { display: grid; gap: 12px; padding: 16px; background: var(--surface); border: 1px solid var(--ink-soft); border-radius: 6px; box-shadow: var(--shadow); }
.ps textarea, .ps input:not([type]), .ps input[type="text"] { background: transparent; border: 0; border-bottom: 1px solid var(--ink-soft); border-radius: 0; padding: 4px 2px; width: 100%; }
.ps textarea { border: 1px dashed var(--ink-soft); border-radius: 4px; padding: 6px; font-size: 15px; }
.ps-label { font: 700 10px/1.2 var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); text-align: center; padding-top: 2px; }
.ps-big { font: 700 26px/1 var(--serif); }
.ps-box { border: 1.5px solid var(--ink); border-radius: 8px; padding: 6px 4px 4px; display: grid; align-content: space-between; text-align: center; min-width: 0; }
.ps-box-body { display: flex; align-items: baseline; justify-content: center; gap: 2px; min-height: 30px; flex-wrap: wrap; }
.ps-panel { border: 1.5px solid var(--ink); border-radius: 8px; padding: 8px 10px; display: grid; gap: 4px; align-content: start; min-width: 0; }
.ps-panel-title { font: 700 11px var(--sans); text-transform: uppercase; letter-spacing: .1em; text-align: center; color: var(--muted); border-bottom: 1px solid var(--ink-soft); padding-bottom: 3px; margin-bottom: 2px; }
.ps-col { display: grid; gap: 10px; align-content: start; min-width: 0; }
.ps-line { display: flex; align-items: center; gap: 6px; font-size: 14px; line-height: 1.6; }
.ps-line small { color: var(--muted); }
.ps-val { min-width: 30px; text-align: center; border-bottom: 1px solid var(--ink); font-size: 14px; }
.ps-bubble { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--ink); background: transparent; padding: 0; flex: none; cursor: pointer; }
.ps-bubble.static { cursor: default; display: inline-block; }
.ps-bubble.s1 { background: var(--text); }
.ps-bubble.s2 { background: var(--text); box-shadow: 0 0 0 2px var(--surface), 0 0 0 3.5px var(--text); }
.ps-pill { display: flex; align-items: center; gap: 10px; border: 1.5px solid var(--ink); border-radius: 99px; padding: 4px 12px 4px 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; font-weight: 700; }
.ps-pill b { min-width: 36px; height: 30px; display: grid; place-items: center; border: 1.5px solid var(--ink); border-radius: 50%; font: 700 17px var(--serif); text-transform: none; }
.ps-pill input { width: 28px; height: 28px; margin: 0 4px; }
.ps-calc { margin: 0; font-size: 14px; font-weight: 700; }
.ps-sub { margin: 6px 0 0; font: 700 11px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ps-list { margin: 0; padding-left: 18px; font-size: 14px; }
.ps-list li { break-inside: avoid; }
.ps-2col .ps-list { columns: 2 200px; column-gap: 20px; }
.ps-duo { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.ps-trio { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ps-trio.four { grid-template-columns: repeat(4, 1fr); }
.ps-death { display: grid; gap: 2px; font-size: 12px; justify-items: end; }
.ps-death > div { display: flex; gap: 8px; align-items: center; }
.ps-dots { display: inline-flex; gap: 4px; }

/* 2014 */
.ps-head { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: 14px; align-items: end; }
.ps-namebox { border: 1.5px solid var(--ink); border-radius: 8px; padding: 8px 10px 4px; }
.ps-name { font: 700 22px var(--serif) !important; border-bottom: 1px solid var(--ink-soft) !important; }
.ps-meta { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px 12px; border: 1.5px solid var(--ink); border-radius: 8px; padding: 8px 12px; }
.ps-meta-cell { min-width: 0; }
.ps-meta-val { border-bottom: 1px solid var(--ink-soft); min-height: 28px; display: flex; align-items: end; font-size: 15px; overflow-wrap: anywhere; }
.ps-meta-cell .ps-label { text-align: left; }
.ps-meta-val input { border: 0 !important; padding: 2px 0 !important; }
.ps-cols { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr) minmax(0, 1fr); gap: 14px; }
.ps-abil-wrap { display: grid; grid-template-columns: 88px minmax(0, 1fr); gap: 10px; }
.ps-abils { display: grid; gap: 8px; align-content: start; background: var(--surface-2); border-radius: 10px; padding: 6px; }
.ps-ab { border: 1.5px solid var(--ink); border-radius: 10px; background: var(--surface); padding: 4px 2px 0; display: grid; justify-items: center; }
.ps-ab .ps-label { padding: 0; font-size: 9px; }
.ps-ab .ps-big { margin: 4px 0; }
.ps-oval { margin-bottom: -10px; min-width: 40px; padding: 1px 6px; border: 1.5px solid var(--ink); border-radius: 99px; background: var(--surface); text-align: center; font-weight: 700; }
.ps-ab { margin-bottom: 10px; }
.ps-hp { border: 1.5px solid var(--ink); border-radius: 8px; padding: 6px 10px 4px; }
.ps-hp-max { font-size: 13px; color: var(--muted); border-bottom: 1px solid var(--ink-soft); padding-bottom: 2px; }
.ps-hp-max b { color: var(--text); font-size: 16px; }
.ps-hp-cur input { font: 700 22px var(--serif) !important; text-align: center; border: 0 !important; }
.ps-persona { display: grid; gap: 6px; padding: 8px; border-radius: 10px; background: var(--surface-2); }

/* 2024 */
.ps24-head { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr); gap: 14px; }
.ps24-ident { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px 12px; border: 1.5px solid var(--ink); border-radius: 10px; padding: 10px 12px; align-content: start; }
.ps24-field { min-width: 0; }
.ps24-field.wide { grid-column: 1 / -1; }
.ps24-field .ps-label { text-align: left; }
.ps24-lvl { grid-column: 1 / -1; display: grid; grid-template-columns: auto 1fr; gap: 16px; align-items: end; }
.ps24-lvl > div { display: grid; justify-items: start; }
.ps24-vitals { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; }
.ps24-shield { grid-row: span 2; width: 86px; display: grid; place-content: center; text-align: center; padding: 10px 6px 18px; border: 1.5px solid var(--ink); clip-path: polygon(50% 0, 100% 10%, 100% 60%, 50% 100%, 0 60%, 0 10%); background: var(--surface-2); }
.ps24-shield .ps-big { font-size: 30px; }
.ps24-hp { border: 1.5px solid var(--ink); border-radius: 8px; padding: 6px 8px; min-width: 0; }
.ps24-hp-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; text-align: center; }
.ps24-hp-grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.ps24-hp-grid > div { display: grid; justify-items: center; }
.ps24-hp-grid small { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.ps24-hp-grid input { text-align: center; font: 700 18px var(--serif) !important; }
.ps24-hp-grid b { font: 700 18px var(--serif); min-height: 30px; display: grid; align-items: center; }
.ps24-vitals .ps24-hp:last-child { grid-column: 1 / -1; }
.ps24-strip { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; }
.ps24-body { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 14px; }
.ps24-abils { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; align-content: start; }
.ps24-training { grid-column: 1 / -1; }
.ps24-ab { border: 1.5px solid var(--ink); border-radius: 10px; padding: 8px 10px; display: grid; gap: 1px; }
.ps24-ab-head { display: flex; justify-content: space-between; align-items: center; gap: 6px; border-bottom: 1px solid var(--ink-soft); padding-bottom: 6px; margin-bottom: 4px; }
.ps24-ab-name { font: 700 16px var(--serif); text-transform: uppercase; letter-spacing: .04em; }
.ps24-ab-nums { display: flex; gap: 8px; }
.ps24-ab-nums > div { display: grid; justify-items: center; min-width: 52px; border: 1.5px solid var(--ink); border-radius: 8px; padding: 2px 4px; }
.ps24-ab-nums small { font-size: 8px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.ps24-ab-nums b { font: 700 18px/1.4 var(--serif); }
.ps-armor { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; font-size: 14px; }
.ps-slots24 { display: grid; grid-template-columns: repeat(9, minmax(0, 1fr)); gap: 6px; }
.ps-slot24 { display: grid; text-align: center; border: 1.5px solid var(--ink); border-radius: 8px; padding: 4px; }
.ps-slot24 small { font-size: 11px; color: var(--muted); }
.ps-slot24 b { font: 700 20px var(--serif); }
.ps-slot24.empty { opacity: .45; }
.ps-spell-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.ps-spell-lvl { border: 1.5px solid var(--ink); border-radius: 8px; padding: 8px; display: grid; gap: 6px; }
.ps-spell-head { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 700; }
.ps-spell-num { width: 32px; height: 32px; display: grid; place-items: center; border: 1.5px solid var(--ink); border-radius: 50%; font: 700 18px var(--serif); }
.build-grid { display: grid; gap: 16px; }

@media (max-width: 1000px) {
  .ps-cols { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .ps-cols > .ps-col:first-child { grid-column: 1 / -1; }
  .ps24-head, .ps24-body { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 900px) {
  .d2-sheet { grid-template-columns: minmax(0, 1fr); }
  .d2-rail { position: static; display: flex; overflow-x: auto; scrollbar-width: thin; }
  .d2-rail button { flex: none; }
  .cc-split { grid-template-columns: minmax(0, 1fr); }
  .cc-list { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); max-height: none; }
}
@media (max-width: 640px) {
  .skin-bg3, .skin-dos2 { padding: 10px; margin: 0 -6px; }
  .ps { padding: 10px; }
  .ps-head, .ps-cols, .ps-duo { grid-template-columns: minmax(0, 1fr); }
  .ps-cols > .ps-col:first-child { grid-column: auto; }
  .ps-meta { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ps24-abils, .ps24-ident { grid-template-columns: minmax(0, 1fr); }
  .ps24-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .ps-trio.four { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ps-slots24 { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .bg3-abils, .bg3-saves { grid-template-columns: repeat(3, 1fr); }
  .d2-rail-label { display: none; }
  .d2-rail button.on .d2-rail-label { display: inline; }
}
@media print {
  .ps-tabs, .cc-tabs, .cc-foot, .d2-rail, .ps-status { display: none !important; }
  .skin-bg3, .skin-dos2 { background: #fff; color: #000; border: 0; }
}

/* Иконки навыков и талантов DOS2 */
.d2-icon { width: 40px; height: 40px; flex: none; border-radius: 6px; border: 1px solid var(--line); background: #0b0907; object-fit: cover; }
.d2-icon.stub { display: grid; place-items: center; font: 700 18px var(--serif); color: var(--accent); }
.d2-skill small.unmet { color: var(--bad); }
.d2-tier { text-transform: uppercase; letter-spacing: .06em; font-size: 10px !important; }
.d2-req { color: var(--accent) !important; }
.d2-talent { align-items: center; }

/* DOS2: экипировка */
.btn.small { padding: 4px 10px; font-size: 14px; }
.d2-doll { display: grid; gap: 6px; }
.d2-slot { display: grid; gap: 6px; padding: 8px 10px; border-radius: 10px; border: 1px dashed var(--line); background: var(--surface-2); min-width: 0; }
.d2-slot.filled { border-style: solid; border-color: var(--accent-soft); }
.d2-slot-head { display: grid; grid-template-columns: 130px minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.d2-slot-name { font: 700 12px var(--sans); text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.d2-slot-head input { width: 100%; }
.d2-bonuses { display: grid; gap: 4px; padding-left: 138px; }
.d2-bonus { display: grid; grid-template-columns: minmax(0, 1fr) 72px auto; gap: 6px; align-items: center; }
.d2-bonus select { width: 100%; min-width: 0; }
.d2-bonus .num { width: 100%; }
.d2-slot-foot { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px; align-items: center; padding-left: 138px; }
.d2-slot-foot select, .d2-slot-foot input { width: 100%; min-width: 0; }
.d2-del { width: 32px; height: 32px; flex: none; display: grid; place-items: center; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); color: var(--bad); font-size: 18px; line-height: 1; cursor: pointer; }
.d2-del:hover { border-color: var(--bad); background: var(--bad-soft); }
.d2-gear-total { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; padding: 8px 10px; border-radius: 8px; background: var(--surface-2); }
@media (max-width: 1100px) {
  .d2-slot-head { grid-template-columns: minmax(0, 1fr) auto; }
  .d2-slot-name { grid-column: 1 / -1; }
  .d2-bonuses, .d2-slot-foot { padding-left: 0; }
}
@media (max-width: 480px) {
  .d2-slot-foot { grid-template-columns: minmax(0, 1fr); }
  .d2-slot-foot .btn { justify-self: start; }
}

/* DOS2: сводка как в игре */
.d2-bars { display: grid; gap: 4px; }
.d2-bar { display: flex; justify-content: space-between; align-items: center; padding: 5px 10px; border-radius: 4px; font-size: 14px; color: #fff; }
.d2-bar b { font: 700 16px var(--serif); }
.d2-bar.vit { background: linear-gradient(90deg, #7a1d1d, #4a1212); }
.d2-bar.parm { background: linear-gradient(90deg, #6b5a3a, #3f3522); }
.d2-bar.marm { background: linear-gradient(90deg, #2c5470, #1b3446); }
.d2-ap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; text-align: center; }
.d2-ap > div { display: grid; padding: 6px 2px; border-radius: 8px; background: var(--surface-2); }
.d2-ap b { font: 700 22px var(--serif); color: var(--accent); }
.d2-ap span { font-size: 11px; color: var(--muted); }
.d2-sect { display: grid; gap: 2px; }
.d2-sect h3 { font-size: 13px !important; text-transform: uppercase; letter-spacing: .1em; padding-bottom: 4px; margin-bottom: 2px; border-bottom: 1px solid var(--accent-soft); }
.d2-sect p { margin: 0; }
.d2-stat-row { display: flex; justify-content: space-between; gap: 8px; padding: 2px 0; font-size: 15px; }
.d2-stat-row span { color: var(--muted); }
.d2-attr small.gear { font-size: 11px; color: var(--good); }
.d2-res { display: grid; grid-template-columns: repeat(5, 1fr); gap: 4px; text-align: center; }
.d2-res-cell { display: grid; padding: 5px 2px; border-radius: 6px; background: var(--surface-2); border-top: 2px solid var(--rc); }
.d2-res-cell span { font-size: 11px; color: var(--muted); }
.d2-res-cell b { font-size: 15px; }
.res-fire { --rc: #e2593b; } .res-water { --rc: #4b9be0; } .res-earth { --rc: #b08a4a; } .res-air { --rc: #a98be8; } .res-poison { --rc: #6fbf4a; }
.d2-cond { margin: 0; padding-left: 16px; font-size: 13px; color: var(--muted); }

/* BG3: иконки */
.bg3-ic { flex: none; border-radius: 6px; object-fit: contain; }
.bg3-ic.stub { display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--line); color: var(--accent); font: 700 14px var(--serif); }
.cc-item { display: flex; align-items: center; gap: 10px; }
.cc-item-text { display: grid; min-width: 0; }
.cc-chip { display: inline-flex; align-items: center; gap: 6px; }
.cc-detail-head { display: flex; align-items: center; gap: 14px; }
.cc-detail-head p { margin: 0; }
.cc-skill .bg3-ic { margin-left: -2px; }
.bg3-badges { display: flex; justify-content: center; flex-wrap: wrap; gap: 8px; margin: 6px 0 2px; }
.bg3-badge { position: relative; display: inline-grid; }
.bg3-badge b { position: absolute; right: -6px; bottom: -4px; min-width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; background: var(--accent); color: var(--accent-ink); font: 700 12px var(--sans); }
.bg3-skill { align-items: center; gap: 6px; }
.feat-with-icon { flex-wrap: nowrap; align-items: flex-start; }
.feat-with-icon > .feat-pick { flex: 1; min-width: 0; }

/* BG3: подробные выборы и повышение уровня */
.lu-features { display: grid; gap: 6px; }
.lu-feature { padding: 8px 12px; border-radius: 8px; background: var(--surface-2); border-left: 3px solid var(--accent); }
.lu-feature-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: baseline; }
.lu-feature-head small { color: var(--muted); font-size: 12px; }
.lu-feature p { margin: 2px 0 0; font-size: 15px; color: var(--muted); }
.lu-choice { display: grid; gap: 8px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.lu-choice.note { padding: 6px 12px; color: var(--muted); border-style: dashed; }
.lu-choice-head { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.lu-count { font-size: 13px; font-weight: 700; padding: 1px 8px; border-radius: 99px; background: var(--bad-soft); color: var(--bad); }
.lu-count.done { background: var(--accent-soft); color: var(--accent); }
.lu-spell-note { margin: 0; font-size: 15px; }
.lu-choice input:not([type]) { width: 100%; }
.lu-asi { gap: 6px; }
.opt-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 6px; }
.opt-grid.wide { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
.opt-card { display: grid; gap: 4px; align-content: start; text-align: left; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--line); background: var(--surface-2); cursor: pointer; min-width: 0; }
.opt-card:hover:not(:disabled) { border-color: var(--accent); }
.opt-card:disabled { opacity: .45; cursor: default; }
.opt-card.on { border-color: var(--accent); background: linear-gradient(160deg, var(--accent-soft), var(--surface-2) 70%); box-shadow: inset 0 0 0 1px var(--accent); }
.opt-card b { font: 700 16px var(--serif); }
.opt-card .en { font-size: 12px; color: var(--muted); }
.opt-card > span { font-size: 14px; color: var(--muted); }
.opt-card .row { flex-wrap: nowrap; }
.opt-card.cls .grow { display: grid; }

.lu-up { font-size: 17px; padding: 10px 18px; }
.lu-wizard { display: grid; gap: 12px; padding: 14px; border-radius: 12px; border: 1px solid var(--accent); background: var(--surface); }
.lu-wizard-head { display: flex; justify-content: space-between; align-items: center; font: 700 18px var(--serif); color: var(--accent); }
.lu-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.lu-steps button { display: flex; align-items: center; gap: 6px; padding: 6px 12px; border-radius: 99px; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); cursor: pointer; font-weight: 700; }
.lu-steps button span { width: 20px; height: 20px; display: grid; place-items: center; border-radius: 50%; border: 1px solid currentColor; font-size: 12px; }
.lu-steps li.on button { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); }
.lu-steps li.done button { color: var(--accent); border-color: var(--accent); }
.lu-steps button:disabled { opacity: .5; cursor: default; }
.lu-body { display: grid; gap: 10px; }
.lu-hp { font-weight: 700; color: var(--good); }
.lu-summary { grid-template-columns: auto 1fr; }
.lu-summary dd { text-align: left; font-weight: 500; }
.lu-history { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.lu-row { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.lu-row.open { border-color: var(--accent-soft); }
.lu-row-head { width: 100%; display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 0; background: none; cursor: pointer; text-align: left; }
.lu-row-head .grow { display: grid; min-width: 0; }
.lu-row-head small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lu-warn { width: 22px; height: 22px; display: grid; place-items: center; border-radius: 50%; background: var(--bad); color: #fff; font-weight: 700; font-size: 13px; }
.lu-caret { color: var(--muted); }
.lu-details { display: grid; gap: 8px; padding: 0 12px 12px; }
.lu-details h4 { margin: 4px 0 0; font: 700 15px var(--serif); color: var(--accent); }

/* BG3: заклинания */
.spell-panel { display: grid; gap: 10px; }
.spell-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.spell-tools input[type="search"] { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; min-width: 0; flex: 0 1 220px; }
.spell-sec { display: grid; gap: 6px; }
.opt-grid.spells { grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
.opt-card.spell { gap: 2px; }
.spell-head { display: flex; align-items: center; gap: 8px; }
.spell-lvl { width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--accent); color: var(--accent); font: 700 12px var(--sans); }
.spell-meta { color: var(--accent); font-size: 12px; }
.spell-stats { color: var(--text); font-size: 12px; font-weight: 700; }
.spell-class { display: grid; gap: 10px; padding-bottom: 14px; border-bottom: 1px solid var(--line); }
.bg3-spells { margin: 0; font-size: 14px; }
.spell-ic { border-radius: 50%; }
.spell-head .spell-lvl { font-size: 14px; }
.bg3-spells { display: grid; grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)); gap: 6px; }
.bg3-spell { display: grid; justify-items: center; gap: 2px; text-align: center; }
.bg3-spell small { font-size: 11px; line-height: 1.15; color: var(--muted); }
.cc-skill.readonly { cursor: default; }
.skill-manual { border: 1px solid var(--bad); background: var(--bad-soft); color: var(--bad); border-radius: 99px; padding: 0 8px; font-size: 12px; cursor: pointer; }
.spell-off { color: var(--bad); font-size: 11px; }

/* Выданные заклинания */
.spell-granted { display: flex; flex-wrap: wrap; gap: 6px; }
.spell-chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 3px; border-radius: 99px; background: var(--surface-2); border: 1px solid var(--accent-soft); font-size: 14px; }
.spell-chip small { color: var(--muted); font-size: 11px; }

/* Вкладки создания BG3 переносятся, чтобы все были видны */
.cc-tabs { flex-wrap: wrap; overflow: visible; row-gap: 0; }
.cc-tabs button { padding: 8px 10px; font-size: 15px; }
@media (max-width: 560px) { .cc-tabs button { padding: 6px 8px; font-size: 14px; gap: 6px; } }

/* 5e: автоматические атаки и владения */
.ps-attacks { width: 100%; border-collapse: collapse; font-size: 13px; }
.ps-attacks th { text-align: left; font: 700 10px var(--sans); text-transform: uppercase; letter-spacing: .06em; color: var(--muted); border-bottom: 1px solid var(--ink-soft); padding: 2px 4px; }
.ps-attacks td { padding: 3px 4px; border-bottom: 1px dashed var(--ink-soft); vertical-align: top; }
.ps-attacks td:nth-child(2) { font-weight: 700; white-space: nowrap; }
.ps-attacks td:nth-child(3) { white-space: nowrap; }
.ps-attacks tr.noprof td:nth-child(2) { color: var(--bad); }
.ps-mastery { color: var(--accent); font-weight: 700; cursor: help; }
.ps-prof { margin: 0 0 2px; font-size: 13px; }
.ps-prof small { color: var(--muted); text-transform: uppercase; font-size: 10px; letter-spacing: .05em; }
.ps-spell-list { margin: 0; padding: 0; list-style: none; font-size: 14px; display: grid; gap: 2px; }
.ps-spell-list li { display: flex; align-items: center; gap: 6px; }
.ps-spell-list small { color: var(--accent); font-weight: 700; }
.ps-spelltable td:last-child { white-space: normal; font-size: 12px; }
.spell-pickers h3 small { font: 400 14px var(--sans); }
.ps-feats li { margin-bottom: 3px; }
.ps-feats small { color: var(--muted); }
.ps-desc { display: block; font-size: 12px; color: var(--muted); line-height: 1.35; }
.block.todo { background: var(--accent-soft); border-radius: 10px; padding: 10px 12px; }
.block.todo h3 { color: var(--accent); }
.block.todo ul { margin: 0; padding-left: 18px; font-size: 15px; }
.ps-statuses { display: grid; gap: 6px; }
.ps-status.todo { color: var(--accent); background: var(--accent-soft); border-radius: 8px; padding: 6px 12px; }
.ps-status.todo summary { cursor: pointer; font-weight: 700; }
.ps-status.todo ul { margin: 6px 0 0; padding-left: 18px; color: var(--text); }
.ps-moves { display: block; width: 100%; font-size: 10px; color: var(--muted); }
