@import url('https://fonts.googleapis.com/css2?family=Cinzel:wght@400;600;700&family=Crimson+Pro:ital,wght@0,300;0,400;0,600;1,300;1,400&display=swap');

/* ─── ГЛОБАЛЬНОЕ ПРАВИЛО ВИДИМОСТИ ─── */
.is-hidden { display: none !important; }

/* ─── ТОКЕНЫ ──────────────────────────────────────────────── */
:root {
  --ink:         #e8dfc8;
  --muted:       #8a7d5a;
  --paper:       #0d0b08;
  --card:        #141009;
  --border:      rgba(180,140,60,0.18);
  --accent:      #c9a84c;
  --accent-soft: rgba(180,140,60,0.12);
  --shadow-sm:   0 2px 12px rgba(0,0,0,0.4);
  --shadow-md:   0 10px 32px rgba(0,0,0,0.6);
  --gold:        #c9a84c;
  --gold-hi:     #e8cc7a;
  --gold-dim:    #7a6428;
  --bg2:         #1c1710;
  --border-hi:   rgba(180,140,60,0.45);
  --radius:      10px;
  --radius-lg:   16px;
}

/* ─── BASE ────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  font-family: 'Crimson Pro', Georgia, serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
  background-image: radial-gradient(ellipse 80% 50% at 50% -5%, rgba(100,70,20,0.2) 0%, transparent 70%);
}

body::after {
  content: '';
  position: fixed; inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.035'/%3E%3C/svg%3E");
  pointer-events: none;
  z-index: 999;
}

/* ─── LAYOUT ──────────────────────────────────────────────── */
.page {
  max-width: 1200px;
  margin: 0 auto;
  padding: 24px 24px 72px;
}

.screen[hidden] { display: none; }

/* ─── HERO / BRAND ────────────────────────────────────────── */
.hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px 24px;
  border-radius: var(--radius-lg);
  background: linear-gradient(120deg, rgba(180,140,60,0.08) 0%, transparent 70%);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
}

.hero-plain { background: rgba(255,255,255,0.02); }

.brand { display: flex; align-items: center; gap: 16px; }

.logo {
  width: 56px; height: 56px;
  border-radius: 14px;
  background: rgba(180,140,60,0.12);
  border: 1px solid var(--border-hi);
  display: grid;
  place-items: center;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 13px;
  letter-spacing: 0.05em;
  color: var(--gold);
}

.brand-text .title {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--gold-hi);
  letter-spacing: 0.04em;
}

.brand-text .subtitle {
  color: var(--muted);
  font-style: italic;
  font-size: 14px;
}

/* ─── HOME SCREEN ─────────────────────────────────────────── */

/* Весь экран — flex колонка, группа по центру */
#home-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 0 24px;
}

/* Скрываем когда hidden */
#home-screen[hidden] {
  display: none;
}

/* Герой и карточки одной ширины */
.home-hero {
  width: 100%;
  max-width: 720px;
  margin-bottom: 16px;
}

/* Сетка карточек */
.home-actions {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  width: 100%;
  max-width: 920px;
  margin-top: 0;
}

/* Карточка — кликабельный тайл */
.home-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px 24px 56px;
  box-shadow: var(--shadow-sm);
  display: grid;
  gap: 8px;
  cursor: pointer;
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
  background: var(--card);
}

.home-card::before {
  content: '';
  position: absolute; inset: 0;
  background: radial-gradient(circle at 50% 0%, rgba(180,140,60,0.07) 0%, transparent 70%);
  opacity: 0;
  transition: opacity 0.2s;
}

/* Стрелка вместо кнопки */
.home-card::after {
  content: '→';
  position: absolute;
  bottom: 20px; right: 22px;
  font-size: 20px;
  color: var(--gold-dim);
  transition: color 0.2s, transform 0.2s;
}

.home-card:hover {
  border-color: var(--border-hi);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}
.home-card:hover::before { opacity: 1; }
.home-card:hover::after {
  color: var(--gold);
  transform: translateX(4px);
}

.home-card-title {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 16px;
  color: var(--gold-hi);
  letter-spacing: 0.03em;
}

.home-card-text {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
}

/* Кнопки внутри карточек — скрыты визуально, логика сохранена */
.home-card .primary,
.home-card .ghost {
  position: absolute;
  width: 1px; height: 1px;
  opacity: 0;
  pointer-events: none;
  overflow: hidden;
}

/* ─── КНОПКИ ──────────────────────────────────────────────── */
button {
  border: none;
  border-radius: var(--radius);
  padding: 10px 18px;
  font-family: 'Cinzel', serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: all 0.2s;
}

button:disabled { opacity: 0.4; cursor: not-allowed; }

.primary {
  background: var(--gold);
  color: #0d0b08;
  box-shadow: 0 2px 16px rgba(180,140,60,0.3);
}
.primary:hover:not(:disabled) {
  background: var(--gold-hi);
  box-shadow: 0 2px 24px rgba(180,140,60,0.45);
  transform: translateY(-1px);
}
.primary:active { transform: translateY(0); }

.ghost {
  background: transparent;
  color: var(--ink);
  border: 1px solid var(--border);
}
.ghost:hover:not(:disabled) {
  border-color: var(--border-hi);
  color: var(--gold-hi);
}

.back-button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 8px 16px;
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
}
.back-button:hover { border-color: var(--border-hi); color: var(--ink); }

/* ─── БИБЛИОТЕКА ──────────────────────────────────────────── */
.library-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 20px;
}

.library-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: grid;
  gap: 8px;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.library-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
  border-color: var(--border-hi);
}

.library-card-delete {
  position: absolute; top: 10px; right: 10px;
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: rgba(168,48,48,0.15);
  display: flex; align-items: center; justify-content: center;
  color: #c06060;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.library-card-delete-icon {
  width: 16px; height: 16px;
  stroke: currentColor; stroke-width: 1.7; fill: none;
}
.library-card:hover .library-card-delete,
.library-card:focus-within .library-card-delete {
  opacity: 1; pointer-events: auto;
}

.library-card-title {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 15px;
  color: var(--gold-hi);
}
.library-card-line { color: var(--muted); font-size: 13px; }

.library-empty {
  margin-top: 24px;
  background: rgba(255,255,255,0.02);
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  padding: 32px 24px;
  text-align: center;
  display: grid;
  gap: 8px;
  color: var(--muted);
}

/* ─── ЛИСТ ПЕРСОНАЖА ──────────────────────────────────────── */
.sheet-topbar {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.sheet-topbar .back-button { flex-shrink: 0; }
.sheet-topbar .header-summary { flex: 1; }
.sheet-topbar .header-actions { flex-shrink: 0; }

.sheet-zone { display: grid; gap: 16px; }
.sheet-zone + .sheet-zone { margin-top: 28px; }

.sheet-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

.block-title {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
  font-size: 10px;
  letter-spacing: 0.18em;
  color: var(--gold-dim);
}

.header-block {
  display: grid;
  grid-template-columns: 1.4fr 1fr;
  gap: 16px;
}
.header-left { display: grid; gap: 16px; }

/* ─── ПОЛЯ ────────────────────────────────────────────────── */
.field-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
  font-size: 13px;
  color: var(--muted);
}

.field-label {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

.field-value,
select,
input {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  background: var(--bg2);
  font-family: 'Crimson Pro', serif;
  font-size: 15px;
  color: var(--ink);
  min-height: 36px;
  transition: border-color 0.2s, box-shadow 0.2s;
}

select, input { width: 100%; appearance: none; }

select:focus, input:focus {
  outline: none;
  border-color: var(--gold-dim);
  box-shadow: 0 0 0 2px rgba(180,140,60,0.12);
}

input::placeholder { color: rgba(138,125,90,0.5); font-style: italic; }

.editable[contenteditable="true"] { cursor: text; }
.editable[contenteditable="true"]:not(.readonly):hover {
  border-bottom: 1px solid rgba(180,140,60,0.4);
}
.editable[contenteditable="true"]:focus {
  outline: none;
  box-shadow: 0 0 0 2px rgba(180,140,60,0.2);
}
.editable.readonly {
  pointer-events: none;
  background: rgba(255,255,255,0.03);
  color: var(--muted);
}

.header-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
}
.header-summary span {
  padding: 4px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid var(--border-hi);
  font-size: 12px;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.05em;
  color: var(--gold);
}

.header-actions { display: grid; gap: 8px; }
.header-buttons { display: flex; gap: 10px; flex-wrap: wrap; }
.save-hint { font-size: 12px; color: var(--muted); font-style: italic; }

/* ─── СТАТЫ ───────────────────────────────────────────────── */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.stat-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--bg2);
  display: grid;
  gap: 6px;
  transition: border-color 0.2s;
}
.stat-box:focus-within { border-color: var(--gold-dim); }

.stat-wide { grid-column: span 2; }

.stat-title {
  font-family: 'Cinzel', serif;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--gold-dim);
}

.stat-value {
  font-family: 'Cinzel', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--gold-hi);
}

.stat-row {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
}

.bar {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 999px;
  overflow: hidden;
}
.bar .fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dim), var(--gold));
  border-radius: 999px;
  transition: width 0.4s ease;
}

.death-saves { display: grid; gap: 8px; font-size: 12px; }
.death-row { display: flex; gap: 6px; }

/* ─── БЫСТРЫЕ ПАРАМЕТРЫ ───────────────────────────────────── */
.quick-params {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 10px;
}

.quick-item {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px;
  background: var(--bg2);
  display: grid;
  gap: 6px;
}

.quick-label {
  font-family: 'Cinzel', serif;
  font-size: 9px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  color: var(--gold-dim);
}

.quick-value {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

/* ─── ХАРАКТЕРИСТИКИ ──────────────────────────────────────── */
.ability-stack { display: grid; gap: 10px; }

.ability {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  transition: border-color 0.2s;
}
.ability:hover { border-color: var(--border-hi); }

.ability-name {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 13px;
  color: var(--gold-hi);
  letter-spacing: 0.03em;
}

.ability-score {
  min-width: 50px;
  text-align: center;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 18px;
  color: var(--ink);
}

.ability-mod {
  min-width: 50px;
  text-align: right;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--gold);
}

.ability-details {
  grid-column: 1 / -1;
  display: grid;
  gap: 6px;
  padding-top: 10px;
  border-top: 1px solid rgba(180,140,60,0.1);
}

.ability-skill-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  gap: 8px;
}
.ability-skill-name { display: flex; align-items: center; gap: 8px; }
.ability-skill-bonus { font-weight: 700; color: var(--ink); }

/* ─── ТАБЛИЦЫ ─────────────────────────────────────────────── */
.extras-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}

.table { display: grid; gap: 8px; }

.table-header {
  display: grid;
  gap: 8px;
  font-family: 'Cinzel', serif;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--gold-dim);
  padding: 0 4px;
}

.table-row {
  display: grid;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--bg2);
  font-size: 14px;
  transition: border-color 0.15s;
}
.table-row:hover { border-color: var(--border-hi); }

.weapons-block .table-header,
.weapons-block .table-row { grid-template-columns: 1.2fr 1fr 1fr 1.2fr; }

.weapon-entry { display: flex; flex-direction: column; gap: 4px; }
.weapon-config { display: flex; gap: 6px; padding: 0 4px; }

.spell-list .table-header,
.spell-list .table-row { grid-template-columns: 0.6fr 1.4fr 1.1fr 1fr 1.1fr 1.2fr; }

.class-features-block .field-value,
.traits-block .field-value,
.feats-block .field-value,
.narrative-block .field-value,
.equipment-block .field-value { min-height: 110px; }

/* ─── МАГИЯ ───────────────────────────────────────────────── */
.magic-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 12px;
}

.magic-stats,
.magic-slots,
.magic-appearance { display: grid; gap: 10px; }

.slots-grid { display: grid; gap: 6px; }

.slot-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  background: var(--bg2);
  font-size: 13px;
}

.attunement-slots { display: grid; gap: 8px; }
.attunement-slots label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--bg2);
  cursor: pointer;
  transition: border-color 0.2s;
}
.attunement-slots label:hover { border-color: var(--border-hi); }

/* ─── МОНЕТЫ ──────────────────────────────────────────────── */
.coins-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(90px, 1fr));
  gap: 10px;
}

.coin {
  display: grid;
  gap: 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px;
  background: var(--bg2);
  text-align: center;
  font-size: 11px;
  text-transform: uppercase;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.08em;
  color: var(--gold-dim);
}
.coin .editable { font-weight: 700; font-size: 16px; color: var(--gold-hi); }

input[type="checkbox"] { accent-color: var(--gold); width: 14px; height: 14px; }

/* ─── ОВЕРЛЕИ ─────────────────────────────────────────────── */
.confirm-overlay {
  position: fixed; inset: 0;
  background: rgba(5,4,2,0.75);
  display: grid;
  place-items: center;
  z-index: 1000;
  backdrop-filter: blur(4px);
}

.confirm-overlay[hidden] { display: none; }

.confirm-dialog {
  width: min(580px, 90vw);
  background: var(--card);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-hi);
  box-shadow: var(--shadow-md), 0 0 60px rgba(180,140,60,0.06);
}

.confirm-header { padding: 20px 24px 0; }
.confirm-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 17px;
  color: var(--gold-hi);
}
.confirm-body { padding: 12px 24px; color: var(--muted); font-size: 15px; }
.confirm-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 0 24px 20px;
}

/* ─── МАСТЕР ──────────────────────────────────────────────── */

/* ── Оверлей ── */
.wizard-overlay {
  position: fixed; inset: 0;
  background: linear-gradient(160deg, #1a1308 0%, #0f0c07 100%);
  display: flex;
  flex-direction: column;
  z-index: 950;
}
.wizard-overlay[hidden] { display: none; }

/* ── Контейнер мастера ── */
.wizard {
  display: flex;
  flex-direction: column;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════════
   ШАПКА
══════════════════════════════════════════════════════════ */
.wizard-modal-header {
  padding: 24px 32px 20px;
  border-bottom: 1px solid rgba(180,140,60,0.15);
  background: linear-gradient(180deg, rgba(180,140,60,0.07) 0%, transparent 100%);
  flex-shrink: 0;
}

.wizard-header-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 20px;
}

.wizard-header { flex: 1; }

.wizard-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 22px;
  color: #e8cc7a;
  letter-spacing: 0.05em;
  line-height: 1.2;
}
.wizard-subtitle {
  color: #6a5e3a;
  margin-top: 4px;
  font-style: italic;
  font-size: 13px;
}
.wizard-progress {
  display: none;
  align-items: center;
  gap: 6px;
  color: #7a6428;
  font-size: 11px;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.12em;
  margin-top: 6px;
  text-transform: uppercase;
}
.wizard-progress::before {
  content: '';
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--gold);
  opacity: 0.7;
}

/* ══════════════════════════════════════════════════════════
   ШАГИ — горизонтальный трекер
══════════════════════════════════════════════════════════ */
.wizard-steps {
  display: flex;
  align-items: flex-start;
  position: relative;
  gap: 0;
  padding: 0 16px;
}

.wizard-step {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  background: transparent;
  border: none;
  padding: 4px 0;
  cursor: pointer;
  transition: opacity 0.2s;
}
.wizard-step:not(.done):not(.active) { cursor: default; opacity: 0.5; }
.wizard-step.done:hover { opacity: 0.8; }

/* Соединительная линия */
.wizard-step:not(:first-child)::before {
  content: '';
  position: absolute;
  top: 18px;
  right: 50%;
  left: -50%;
  height: 2px;
  background: rgba(180,140,60,0.15);
  z-index: 0;
  transition: background 0.4s;
}
.wizard-step.done::before,
.wizard-step.active::before {
  background: linear-gradient(90deg, rgba(180,140,60,0.5), rgba(201,168,76,0.8));
}

/* Кружок шага */
.wizard-step-circle {
  position: relative;
  z-index: 1;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 2px solid rgba(180,140,60,0.2);
  background: #1a1308;
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 700;
  color: #4a3e20;
  display: grid;
  place-items: center;
  transition: all 0.3s;
  box-shadow: 0 2px 8px rgba(0,0,0,0.4);
}

.wizard-step.active .wizard-step-circle {
  background: linear-gradient(145deg, #d4a84c, #b08030);
  color: #0d0a05;
  border-color: #e8cc7a;
  box-shadow:
    0 0 0 4px rgba(180,140,60,0.18),
    0 0 20px rgba(180,140,60,0.5),
    0 2px 8px rgba(0,0,0,0.5);
  transform: scale(1.1);
}
.wizard-step.done .wizard-step-circle {
  background: rgba(180,140,60,0.15);
  border-color: rgba(180,140,60,0.5);
  color: #c9a84c;
}
.wizard-step.done .wizard-step-circle::after {
  content: '✓';
  position: absolute;
  font-size: 14px;
  color: var(--gold);
}
.wizard-step.done .wizard-step-circle > * { display: none; }

/* Метка шага */
.wizard-step-label {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #4a3e20;
  white-space: nowrap;
  transition: color 0.2s;
  display: block;
}
.wizard-step.active .wizard-step-label {
  color: #e8cc7a;
  font-weight: 600;
}
.wizard-step.done .wizard-step-label { color: #8a7030; }

/* ══════════════════════════════════════════════════════════
   БЕЙДЖИ
══════════════════════════════════════════════════════════ */
.wizard-badges {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 16px;
}
.wizard-badge {
  font-size: 10px;
  padding: 4px 12px;
  border-radius: 999px;
  background: rgba(180,140,60,0.1);
  border: 1px solid rgba(180,140,60,0.3);
  font-family: 'Cinzel', serif;
  letter-spacing: 0.07em;
  color: #c9a84c;
  transition: all 0.2s;
}

/* ══════════════════════════════════════════════════════════
   ТЕЛО
══════════════════════════════════════════════════════════ */
.wizard-modal-body {
  padding: 24px 32px;
  overflow-y: auto;
  overflow-x: hidden;
  flex: 1;
  scrollbar-width: thin;
  scrollbar-color: rgba(180,140,60,0.2) transparent;
}

/* ══════════════════════════════════════════════════════════
   ПОДВАЛ
══════════════════════════════════════════════════════════ */
.wizard-modal-footer {
  border-top: 1px solid rgba(180,140,60,0.12);
  padding: 16px 32px;
  display: flex;
  gap: 10px;
  justify-content: flex-end;
  align-items: center;
  flex-shrink: 0;
  background: rgba(0,0,0,0.3);
}

/* ══════════════════════════════════════════════════════════
   СТРАНИЦЫ / АНИМАЦИЯ
══════════════════════════════════════════════════════════ */
.wizard-page { display: none; }
.wizard-page.active {
  display: grid;
  gap: 20px;
  animation: wiz-fade 0.3s ease;
}

/* wiz-fade определён ниже, в блоке wizard v2 */

/* ── Двухколоночная сетка для шага 1 ── */
.wizard-page[data-step="1"].active {
  grid-template-columns: 1fr 1fr;
  align-items: start;
}
.wizard-page[data-step="1"] .wizard-section:nth-child(1) { grid-column: 1; grid-row: 1; }
.wizard-page[data-step="1"] .wizard-section:nth-child(2) { grid-column: 2; grid-row: 1; }
.wizard-page[data-step="1"] .wizard-section:nth-child(3) { grid-column: 1; grid-row: 2; }
.wizard-page[data-step="1"] .wizard-section:nth-child(4) { grid-column: 2; grid-row: 2; }

/* ══════════════════════════════════════════════════════════
   СЕКЦИИ — карточки с рамкой
══════════════════════════════════════════════════════════ */
.wizard-section {
  display: grid;
  gap: 10px;
  background: rgba(0,0,0,0.25);
  border: 1px solid rgba(180,140,60,0.12);
  border-radius: 14px;
  padding: 14px 16px;
  position: relative;
}
.wizard-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(180,140,60,0.3), transparent);
}

.wizard-section-title {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: #c9a84c;
  padding-bottom: 10px;
  border-bottom: 1px solid rgba(180,140,60,0.15);
  display: flex;
  align-items: center;
  gap: 8px;
}
.wizard-section-title::before {
  content: '';
  width: 3px; height: 12px;
  background: var(--gold);
  border-radius: 2px;
  opacity: 0.7;
}

/* ══════════════════════════════════════════════════════════
   ПОЛЯ
══════════════════════════════════════════════════════════ */
.wizard-field {
  display: grid;
  gap: 7px;
  font-size: 14px;
  color: var(--muted);
}
.wizard-field-dropdown-wrap {
  position: relative;
}
.wizard-field > span:first-child {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7a6a40;
  font-weight: 600;
}
.wizard-field input,
.wizard-field select {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(180,140,60,0.2);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: 'Crimson Pro', serif;
  font-size: 15px;
  color: #e8dfc8;
  transition: border-color 0.2s, box-shadow 0.2s, background 0.2s;
  min-height: 44px;
}
.wizard-field input:focus,
.wizard-field select:focus {
  outline: none;
  border-color: rgba(180,140,60,0.6);
  background: rgba(180,140,60,0.06);
  box-shadow: 0 0 0 3px rgba(180,140,60,0.1);
}
.wizard-field input::placeholder { color: #4a3e20; }

/* ── Мультиклассирование в мастере ── */
.wizard-mc-row {
  display: grid;
  grid-template-columns: 1fr 60px 28px;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}
.wizard-mc-row select {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(180,140,60,0.2);
  border-radius: 8px;
  padding: 6px 10px;
  font-family: 'Crimson Pro', serif;
  font-size: 14px;
  color: #e8dfc8;
  min-height: 36px;
}
.wizard-mc-row input[type="number"] {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(180,140,60,0.2);
  border-radius: 8px;
  padding: 6px 8px;
  font-family: 'Crimson Pro', serif;
  font-size: 14px;
  color: #e8dfc8;
  text-align: center;
  min-height: 36px;
  width: 100%;
}
.wizard-mc-remove {
  background: none;
  border: none;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px;
  border-radius: 4px;
  transition: color 0.15s;
}
.wizard-mc-remove:hover { color: #f08080; }
.wizard-mc-footer {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
}
.wizard-mc-total {
  font-size: 12px;
  color: var(--muted);
  font-family: 'Cinzel', serif;
}
.wizard-mc-total b { color: var(--gold-hi); }
.wizard-mc-total.over b { color: #f08080; }
.wizard-field select {
  -webkit-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%23c9a84c' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
.wizard-field select option {
  background: #1a1308;
  color: #e8dfc8;
}
.wizard-field textarea {
  width: 100%;
  border: 1px solid rgba(180,140,60,0.2);
  border-radius: 10px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.04);
  font-family: 'Crimson Pro', serif;
  font-size: 15px;
  color: var(--ink);
  resize: vertical;
  transition: border-color 0.2s;
  min-height: 80px;
}
.wizard-field textarea:focus {
  outline: none;
  border-color: rgba(180,140,60,0.6);
  box-shadow: 0 0 0 3px rgba(180,140,60,0.1);
}

/* ══════════════════════════════════════════════════════════
   УРОВЕНЬ — стилизованный счётчик
══════════════════════════════════════════════════════════ */
.wizard-level {
  display: flex;
  align-items: center;
  gap: 0;
  background: rgba(0,0,0,0.3);
  border: 1px solid rgba(180,140,60,0.25);
  border-radius: 12px;
  overflow: hidden;
  height: 48px;
  position: relative;
}
.wizard-level button {
  width: 48px;
  height: 48px;
  border-radius: 0;
  border: none;
  background: rgba(180,140,60,0.1);
  font-size: 22px;
  padding: 0;
  color: #c9a84c;
  flex-shrink: 0;
  transition: background 0.2s, color 0.2s;
  display: grid;
  place-items: center;
  line-height: 1;
}
.wizard-level button:hover:not(:disabled) {
  background: rgba(180,140,60,0.22);
  color: #e8cc7a;
  transform: none;
}
.wizard-level input[type="number"] {
  flex: 1;
  text-align: center;
  border: none;
  border-left: 1px solid rgba(180,140,60,0.15);
  border-right: 1px solid rgba(180,140,60,0.15);
  border-radius: 0;
  background: transparent;
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 700;
  color: #e8cc7a;
  min-height: unset;
  height: 48px;
  padding: 0;
  width: auto;
  min-width: 0;
}
.wizard-level input[type="number"]:focus {
  outline: none;
  box-shadow: none;
  border-color: rgba(180,140,60,0.15);
}
.wizard-level input[type="number"]::-webkit-inner-spin-button,
.wizard-level input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }

.wizard-level-fixed {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 15px;
  color: #8a7030;
  display: flex;
  align-items: baseline;
  gap: 10px;
}
.wizard-level-hint {
  font-family: 'Crimson Pro', Georgia, serif;
  font-weight: 400;
  font-size: 13px;
  color: var(--muted);
}
.wizard-level-display {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 12px;
  color: #8a7030;
  padding: 0 16px;
  flex-shrink: 0;
  border-left: 1px solid rgba(180,140,60,0.15);
  display: flex;
  align-items: center;
  letter-spacing: 0.06em;
}

/* ══════════════════════════════════════════════════════════
   ПОИСКОВЫЕ ДРОПДАУНЫ
══════════════════════════════════════════════════════════ */
.wizard [hidden],
.wizard-overlay[hidden] {
  display: none !important;
}
.wizard-dropdown {
  display: grid;
  gap: 4px;
  max-height: 200px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(180,140,60,0.2) transparent;
  border-radius: 10px;
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 100;
  background: #1a150d;
  border: 1px solid rgba(180,140,60,0.25);
  padding: 6px;
}
.wizard-option {
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(180,140,60,0.15);
  background: rgba(255,255,255,0.03);
  cursor: pointer;
  font-size: 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: all 0.15s;
  color: #c8b880;
}
.wizard-option:hover {
  border-color: rgba(180,140,60,0.45);
  background: rgba(180,140,60,0.1);
  color: #e8cc7a;
  padding-left: 18px;
}
.wizard-option-badge {
  margin-left: auto;
  font-size: 10px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(180,140,60,0.1);
  border: 1px solid rgba(180,140,60,0.25);
  font-family: 'Cinzel', serif;
  letter-spacing: 0.04em;
  color: #7a6428;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ══════════════════════════════════════════════════════════
   ВЫБРАННЫЙ ЭЛЕМЕНТ
══════════════════════════════════════════════════════════ */
.wizard-choice {
  display: grid;
  gap: 6px;
}
.wizard-choice-summary {
  font-size: 13px;
  color: #c8b880;
  line-height: 1.6;
}
.wizard-choice-summary b {
  color: #8a7a50;
  font-weight: 600;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.wizard-choice-details {
  font-size: 12px;
  color: #7a6a40;
  line-height: 1.6;
}
.wizard-choice-details b {
  color: #8a7a50;
  font-weight: 600;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.wizard-choice-details:empty {
  display: none;
}

/* ══════════════════════════════════════════════════════════
   ПОДВИДЫ
══════════════════════════════════════════════════════════ */
.wizard-subrace-item {
  display: grid;
  gap: 5px;
  border: 1px solid rgba(180,140,60,0.15);
  border-radius: 10px;
  padding: 12px 14px;
  background: rgba(0,0,0,0.25);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.2s;
}
.wizard-subrace-item input[type="radio"] { display: none; }
.wizard-subrace-item:hover {
  border-color: rgba(180,140,60,0.4);
  background: rgba(180,140,60,0.08);
}
.wizard-subrace-item.selected {
  border-color: rgba(180,140,60,0.65);
  background: rgba(180,140,60,0.15);
  box-shadow: 0 0 0 1px rgba(180,140,60,0.2);
}
.wizard-subrace-name {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  color: #c8a84c;
  font-size: 13px;
  transition: color 0.2s;
}
.wizard-subrace-item.selected .wizard-subrace-name { color: #e8cc7a; }
.wizard-subrace-desc { color: #6a5e3a; font-size: 12px; }

/* ══════════════════════════════════════════════════════════
   МЕТОДЫ ХАРАКТЕРИСТИК
══════════════════════════════════════════════════════════ */
.wizard-methods {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.wizard-method {
  border: 1px solid rgba(180,140,60,0.2);
  background: rgba(0,0,0,0.3);
  color: #7a6a40;
  font-size: 12px;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.06em;
  padding: 9px 16px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}
.wizard-method:hover {
  border-color: rgba(180,140,60,0.4);
  color: #c9a84c;
  background: rgba(180,140,60,0.08);
  transform: none;
}
.wizard-method.active {
  background: rgba(180,140,60,0.18);
  border-color: rgba(180,140,60,0.6);
  color: #e8cc7a;
  box-shadow: 0 0 12px rgba(180,140,60,0.15);
}

/* ══════════════════════════════════════════════════════════
   ХАРАКТЕРИСТИКИ: СЕТКА
══════════════════════════════════════════════════════════ */
.wizard-page[data-step="2"] .wizard-section { gap: 12px; }

.wizard-ability-name {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #7a6a40;
}

/* ══════════════════════════════════════════════════════════
   ПОДСКАЗКИ
══════════════════════════════════════════════════════════ */
.wizard-hint {
  color: #6a5e3a;
  font-size: 12px;
  font-style: italic;
  padding: 10px 14px;
  border-left: 3px solid rgba(180,140,60,0.3);
  background: rgba(180,140,60,0.04);
  border-radius: 0 8px 8px 0;
}
.wizard-skill-choice-label {
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 4px;
}
.wizard-skill-choice-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  padding: 3px 0;
  cursor: pointer;
}
.wizard-skill-choice-item input[type="checkbox"] {
  accent-color: var(--gold);
  cursor: pointer;
}
.wizard-skill-choice-item input:disabled { opacity: 0.4; cursor: default; }
.wizard-point-info {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: #7a6a40;
  padding: 8px 14px;
  background: rgba(180,140,60,0.06);
  border-radius: 8px;
  border: 1px solid rgba(180,140,60,0.2);
}
.wizard-point-info span {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 700;
  color: #e8cc7a;
}

/* ══════════════════════════════════════════════════════════
   КОСТИ
══════════════════════════════════════════════════════════ */
.wizard-roll-results {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 0;
}
.wizard-roll-chip {
  padding: 8px 18px;
  border-radius: 999px;
  border: 1px solid rgba(180,140,60,0.4);
  background: rgba(180,140,60,0.1);
  font-family: 'Cinzel', serif;
  font-weight: 700;
  color: #c9a84c;
  font-size: 14px;
  cursor: pointer;
  transition: all 0.2s;
}
.wizard-roll-chip:hover { background: rgba(180,140,60,0.22); color: #e8cc7a; }
.wizard-roll-chip.used { opacity: 0.3; text-decoration: line-through; pointer-events: none; }

/* ══════════════════════════════════════════════════════════
   НАВЫКИ И ЗАКЛИНАНИЯ
══════════════════════════════════════════════════════════ */
.wizard-skill-item,
.wizard-spell-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border: 1px solid rgba(180,140,60,0.15);
  border-radius: 10px;
  background: rgba(0,0,0,0.2);
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.wizard-skill-item:hover,
.wizard-spell-item:hover {
  border-color: rgba(180,140,60,0.35);
  background: rgba(180,140,60,0.07);
}
.wizard-skill-item.selected,
.wizard-spell-item.selected {
  border-color: rgba(180,140,60,0.65);
  background: rgba(180,140,60,0.15);
  color: #e8cc7a;
  box-shadow: 0 0 0 1px rgba(180,140,60,0.2);
}
.wizard-skill-item input[type="checkbox"],
.wizard-spell-item input[type="checkbox"] {
  width: 16px; height: 16px;
  flex-shrink: 0;
  accent-color: var(--gold);
}
.wizard-skill-meta,
.wizard-spell-meta {
  margin-left: auto;
  font-size: 11px;
  color: #5a4e28;
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════════
   ИТОГ
══════════════════════════════════════════════════════════ */
.wizard-summary {
  border: 1px solid rgba(180,140,60,0.3);
  border-radius: 14px;
  padding: 22px 24px;
  background: linear-gradient(135deg, rgba(180,140,60,0.07) 0%, rgba(0,0,0,0.3) 100%);
  white-space: pre-line;
  font-size: 14px;
  line-height: 2;
  color: #c8b880;
}

/* ══════════════════════════════════════════════════════════
   ОШИБКА В ФУТЕРЕ
══════════════════════════════════════════════════════════ */
.wizard-error {
  color: #d07070;
  margin-right: auto;
  font-size: 12px;
  font-style: italic;
  background: rgba(200,80,80,0.1);
  padding: 5px 14px;
  border-radius: 999px;
  border: 1px solid rgba(200,80,80,0.25);
}

/* ══════════════════════════════════════════════════════════
   РАЗДЕЛИТЕЛЬ
══════════════════════════════════════════════════════════ */
.wizard-section + .wizard-section {
  padding-top: 0;
}

/* ══════════════════════════════════════════════════════════
   АДАПТИВ
══════════════════════════════════════════════════════════ */
@media (max-width: 740px) {
  .wizard-page[data-step="1"].active {
    grid-template-columns: 1fr;
  }
  .wizard-page[data-step="1"] .wizard-section:nth-child(n) {
    grid-column: 1;
    grid-row: auto;
  }
  .wizard-abilities-grid {
    grid-template-columns: 1fr;
  }
  .wizard-step-label { display: none; }
  .wizard { max-height: 95vh; }
  .wizard-modal-body { padding: 16px 20px; }
  .wizard-modal-header { padding: 16px 20px; }
  .wizard-modal-footer { padding: 14px 20px; }
}
/* ─── АНИМАЦИЯ ────────────────────────────────────────────── */
.reveal {
  opacity: 0;
  transform: translateY(10px);
  animation: rise 0.5s ease forwards;
}

@keyframes rise {
  to { opacity: 1; transform: translateY(0); }
}

/* ─── СКРОЛЛБАР ───────────────────────────────────────────── */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

/* ─── АДАПТИВ ─────────────────────────────────────────────── */
@media (max-width: 980px) {
  .header-block { grid-template-columns: 1fr; }
  .stat-wide { grid-column: span 1; }
  .magic-grid { grid-template-columns: 1fr; }
}

/* ─── ЧИП-КНОПКИ ──────────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px;
  font-family: 'Cinzel', serif;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  border: 1px solid var(--border);
  background: var(--bg2);
  color: var(--muted);
  cursor: pointer;
  transition: all 0.2s;
  min-height: 24px;
}
.chip:hover {
  border-color: var(--border-hi);
  color: var(--gold-hi);
}
/* Активное состояние: on или не-none/не-off */
.chip[data-state="on"],
.chip[data-state="str"],
.chip[data-state="dex"],
.chip[data-state="spell"],
.chip[data-state="light"],
.chip[data-state="medium"],
.chip[data-state="heavy"] {
  background: rgba(180,140,60,0.15);
  border-color: var(--border-hi);
  color: var(--gold-hi);
}

@media (max-width: 720px) {
  .page { padding: 16px 16px 64px; }
  .home-actions { grid-template-columns: 1fr; }
  .weapons-block .table-header,
  .weapons-block .table-row,
  .spell-list .table-header,
  .spell-list .table-row { grid-template-columns: 1fr; }
  .table-header { display: none; }
}

/* ─── ШАГ 2: ХАРАКТЕРИСТИКИ ─────────────────────────────── */
.wizard-abilities-header {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  gap: 8px;
  padding: 0 14px;
  font-family: 'Cinzel', serif;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #5a4e28;
  margin-bottom: 4px;
}

.wizard-abilities-grid {
  display: grid;
  gap: 6px;
}

.wizard-ability-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto auto;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border: 1px solid rgba(180,140,60,0.15);
  border-radius: 10px;
  background: rgba(0,0,0,0.25);
  transition: border-color 0.2s, background 0.2s;
}
.wizard-ability-row:focus-within {
  border-color: rgba(180,140,60,0.45);
  background: rgba(180,140,60,0.06);
}

.wizard-ability-row input[type="number"] {
  width: 60px;
  text-align: center;
  font-family: 'Cinzel', serif;
  font-size: 15px;
  font-weight: 700;
  color: #e8cc7a;
  border-color: rgba(180,140,60,0.2);
  background: rgba(180,140,60,0.06);
  padding: 6px 4px;
  min-height: unset;
  height: 36px;
  border-radius: 8px;
}

.wizard-ability-chip {
  font-size: 11px;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  min-width: 36px;
  text-align: center;
  padding: 4px 6px;
  border-radius: 6px;
  border: 1px solid rgba(180,140,60,0.15);
  background: rgba(0,0,0,0.2);
  color: #8a7a50;
}

/* ── Standard Array picker ── */
.wizard-sa-hint {
  font-size: 11px;
  color: var(--muted);
  margin-bottom: 10px;
  font-style: italic;
}
.wizard-sa-chips {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.wizard-sa-chip {
  font-family: 'Cinzel', serif;
  font-size: 15px;
  font-weight: 700;
  min-width: 44px;
  padding: 6px 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.wizard-sa-chip.used {
  opacity: 0.35;
  cursor: default;
  pointer-events: none;
}
/* Активный слот — ждёт назначения */
.wizard-ability-row.sa-active {
  border-color: var(--gold);
  background: rgba(180,140,60,0.12);
  cursor: pointer;
  box-shadow: 0 0 0 2px rgba(180,140,60,0.25);
}
/* Слот с назначенным значением */
.wizard-ability-row.sa-assigned {
  border-color: rgba(180,140,60,0.4);
  background: rgba(180,140,60,0.06);
}
/* В режиме SA — скрываем input, строки кликабельны */
.wizard-abilities-grid.sa-mode .wizard-ability-row[data-ability] {
  cursor: pointer;
}
.wizard-abilities-grid.sa-mode input[type="number"] {
  display: none;
}

.wizard-bonus-toggle {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  background: rgba(180,140,60,0.04);
  border: 1px solid rgba(180,140,60,0.18);
  border-radius: 10px;
  cursor: pointer;
  color: #7a6a40;
  font-size: 13px;
  transition: all 0.2s;
  user-select: none;
}
.wizard-bonus-toggle:hover { border-color: rgba(180,140,60,0.35); color: #c9a84c; }
.wizard-bonus-toggle input[type="checkbox"] {
  accent-color: var(--gold);
  width: 16px; height: 16px;
  flex-shrink: 0;
}

/* ─── ШАГ 3: НАВЫКИ ──────────────────────────────────────── */
.skill-indicator {
  font-size: 12px;
  color: #5a4e28;
  min-width: 20px;
  text-align: center;
  flex-shrink: 0;
  transition: color 0.2s;
}
.wizard-skill-item.selected .skill-indicator { color: var(--gold); }
.wizard-skill-item.expert .skill-indicator { color: #e8cc7a; }

.skill-name {
  flex: 1;
  font-size: 14px;
  color: #c8b880;
  transition: color 0.2s;
}
.wizard-skill-item.selected .skill-name { color: #e8dfc8; }
.wizard-skill-item.expert .skill-name { color: #e8cc7a; }

.skill-source-badge {
  font-family: 'Cinzel', serif;
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(180,140,60,0.12);
  border: 1px solid rgba(180,140,60,0.3);
  color: #8a7030;
  flex-shrink: 0;
}
.skill-source-race {
  background: rgba(100,160,100,0.12);
  border-color: rgba(100,160,100,0.3);
  color: #60a060;
}
.skill-source-expert {
  background: rgba(220,180,60,0.18);
  border-color: rgba(220,180,60,0.5);
  color: #e8cc7a;
}

.wizard-skill-item.expert {
  border-color: rgba(220,180,60,0.55);
  background: rgba(220,180,60,0.1);
  box-shadow: 0 0 0 1px rgba(220,180,60,0.15);
}}

/* ─── КНОПКИ УРОВНЯ ────────────────────────────────────────── */
.level-field {
  display: flex;
  align-items: center;
  gap: 4px;
}
.level-btn {
  padding: 2px 7px;
  font-size: 11px;
  min-width: 28px;
  height: 28px;
}
.level-up-btn {
  padding: 4px 10px;
  font-size: 16px;
  cursor: pointer;
  background: rgba(180,140,60,0.1);
  border: 1px solid rgba(180,140,60,0.3);
  border-radius: 6px;
  color: var(--gold);
  transition: all 0.15s;
}
.level-up-btn:hover {
  background: rgba(180,140,60,0.2);
  border-color: var(--gold);
}
#level-display {
  font-size: 18px;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  color: var(--text);
  min-width: 28px;
  text-align: center;
}

/* ─── МАСТЕР ПОВЫШЕНИЯ УРОВНЯ ──────────────────────────────── */
.levelup-overlay {
  position: fixed; inset: 0;
  background: rgba(5,4,2,0.82);
  display: grid;
  place-items: center;
  z-index: 10;
  backdrop-filter: blur(6px);
  padding: 16px;
}
.levelup-overlay[hidden] { display: none; }

.levelup-dialog {
  display: flex;
  flex-direction: column;
  width: min(520px, 96vw);
  max-height: 88vh;
  background: linear-gradient(160deg, #1a1308 0%, #0f0c07 100%);
  border-radius: 18px;
  border: 1px solid rgba(180,140,60,0.35);
  box-shadow: 0 0 0 1px rgba(0,0,0,0.8), 0 24px 60px rgba(0,0,0,0.8), inset 0 1px 0 rgba(180,140,60,0.12);
  overflow: hidden;
}

.lu-header {
  padding: 20px 24px 14px;
  border-bottom: 1px solid var(--border);
}
.lu-title {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-hi);
}

.lu-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.lu-section { display: flex; flex-direction: column; gap: 8px; }
.lu-section[hidden] { display: none; }

.lu-section-title {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--gold-hi);
  letter-spacing: 0.04em;
  display: flex;
  align-items: center;
  gap: 8px;
}
/* ASI options — три карточки */
.lu-asi-options {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
  margin-top: 8px;
}
.lu-asi-option {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s, opacity 0.2s;
}
.lu-asi-option:hover { border-color: rgba(180,140,60,0.4); }
.lu-asi-option--active {
  border-color: var(--gold-hi);
  background: rgba(180,140,60,0.08);
  box-shadow: 0 0 0 2px rgba(180,140,60,0.2);
}
.lu-asi-option--greyed {
  opacity: 0.35;
  pointer-events: none;
}
.lu-asi-option--feat {
  grid-column: span 3;
}
.lu-asi-opt-title {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-hi);
}
.lu-asi-select {
  width: 100%;
  background: var(--bg2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
  cursor: pointer;
}

.lu-hint { font-size: 12px; color: var(--muted); }

.lu-hp-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 4px; }

.lu-hp-result {
  font-size: 22px;
  font-weight: 700;
  color: var(--gold-hi);
  min-height: 32px;
}

.lu-features-list {
  margin: 0; padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.lu-features-list li {
  font-size: 13px;
  color: var(--text);
  padding: 4px 10px;
  background: rgba(180,140,60,0.06);
  border-radius: 6px;
  border-left: 2px solid rgba(180,140,60,0.3);
}
.lu-features-empty { font-size: 13px; color: var(--muted); font-style: italic; }


.lu-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 24px 20px;
  border-top: 1px solid var(--border);
}
.lu-footer #lu-back { margin-right: auto; }

/* Степпер мастера повышения */
.lu-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 10px;
}
.lu-step {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 3px 8px;
  border-radius: 20px;
  border: 1px solid transparent;
  transition: all 0.2s;
}
.lu-step--active {
  color: var(--gold-hi);
  border-color: rgba(180,140,60,0.5);
  background: rgba(180,140,60,0.1);
}
.lu-step--done {
  color: #8a7030;
}
.lu-step-sep {
  font-size: 10px;
  color: var(--muted);
  opacity: 0.5;
}

/* Страницы */
.lu-page { display: flex; flex-direction: column; gap: 20px; }
.lu-page[hidden] { display: none; }

/* Карточки итога */
.lu-summary-cards {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.lu-summary-card {
  display: flex;
  align-items: center;
  gap: 12px;
  border-radius: var(--radius);
  padding: 12px 16px;
  border: 1px solid;
  animation: lu-card-in 200ms ease both;
  animation-delay: calc(var(--i, 0) * 50ms);
}
@keyframes lu-card-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.lu-summary-card__dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.lu-summary-card__label {
  font-family: 'Cinzel', serif;
  font-size: 14px;
  font-weight: 600;
}
.lu-summary-card__sub {
  font-size: 12px;
  margin-top: 2px;
  opacity: 0.6;
}

/* Темы */
.lu-summary-card--green {
  background: rgba(40, 80, 40, 0.2);
  border-color: rgba(80, 140, 60, 0.3);
  color: #8ed470;
}
.lu-summary-card--green .lu-summary-card__dot {
  background: rgba(80, 140, 60, 0.5);
}
.lu-summary-card--blue {
  background: rgba(40, 60, 100, 0.2);
  border-color: rgba(60, 90, 160, 0.3);
  color: #8098e8;
}
.lu-summary-card--blue .lu-summary-card__dot {
  background: rgba(60, 90, 160, 0.5);
}
.lu-summary-card--gold {
  background: rgba(80, 50, 20, 0.2);
  border-color: rgba(150, 100, 30, 0.3);
  color: var(--gold);
}
.lu-summary-card--gold .lu-summary-card__dot {
  background: rgba(150, 100, 30, 0.5);
}

.lu-subclass-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
  max-height: 260px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 100%;
}
.lu-subclass-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  transition: border-color 0.15s;
  min-width: 0;
}
.lu-subclass-item label { flex: 1; min-width: 0; }
.lu-subclass-item:hover { border-color: var(--gold-hi); }
.lu-subclass-item.selected {
  border-color: var(--gold-hi);
  background: rgba(196,160,74,0.08);
}
.lu-subclass-item input[type="radio"] { accent-color: var(--gold-hi); flex-shrink: 0; margin-top: 3px; }
.lu-subclass-item label { cursor: pointer; }
.lu-subclass-item .lu-sub-name { font-size: 14px; color: var(--ink); font-weight: 600; display: block; }
.lu-subclass-item .lu-sub-desc { font-size: 12px; color: var(--muted); margin-top: 2px; display: block; line-height: 1.4; }

/* Строка "+ Добавить новый класс" в level-up */
.lu-mc-new-class-row { border-style: dashed; }
.lu-mc-new-class-row.selected { border-color: var(--gold-hi); background: var(--surface); }
.lu-mc-new-class-sel { width: 100%; background: transparent; border: none; font-size: 14px; color: var(--ink); cursor: pointer; padding: 0; }

.lu-spell-search {
  width: 100%;
  box-sizing: border-box;
  margin: 8px 0 6px;
  padding: 5px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--ink);
  font-size: 13px;
}
.lu-spell-search::placeholder { color: var(--muted); }

.lu-spell-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
}
.lu-spell-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 4px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  cursor: pointer;
}
.lu-spell-item:hover { background: rgba(255,255,255,0.04); border-radius: 4px; }
.lu-spell-item input[type="checkbox"] { accent-color: var(--gold-hi); flex-shrink: 0; }
.lu-spell-item label { font-size: 13px; color: var(--text); cursor: pointer; flex: 1; }
.lu-spell-item .lu-spell-lvl {
  font-size: 11px;
  color: var(--muted);
  min-width: 40px;
  text-align: right;
}
.lu-spell-item.selected label { color: var(--gold-hi); }
.lu-spell-empty { font-size: 13px; color: var(--muted); padding: 8px 4px; }

/* ─── СОСТОЯНИЯ ─────────────────────────────────────────── */
.conditions-block { }

.languages-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
  position: relative;
}

.lang-chip {
  font-size: 11px;
  padding: 2px 8px;
  border-color: #5b7fa6;
  color: #a8c4e0;
}

.lang-chip:hover { border-color: #7bafd4; background: rgba(91,127,166,0.15); }

.chip-bg-lang {
  font-size: 11px;
  padding: 2px 8px;
  border-color: #7a6fa6;
  color: #b8aee0;
  cursor: default;
}
.chip-bg-lang--choice {
  opacity: 0.7;
  border-style: dashed;
  cursor: pointer;
}
.chip-bg-lang--choice:hover {
  opacity: 1;
  border-color: var(--gold);
  background: rgba(180,140,60,0.1);
}

/* Language picker dropdown */
.lang-picker {
  position: absolute;
  z-index: 100;
  background: var(--card);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-height: 240px;
  overflow-y: auto;
  min-width: 160px;
  padding: 4px 0;
}
.lang-picker-header {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 6px 10px 2px;
}
.lang-picker-option {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  border-radius: 0;
  padding: 5px 12px;
  font-family: 'Crimson Pro', serif;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.1s;
}
.lang-picker-option:hover {
  background: rgba(180,140,60,0.12);
  color: var(--gold-hi);
}

.conditions-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}

.condition-chip {
  font-size: 10px;
  padding: 2px 8px;
  min-height: 22px;
}

.condition-chip[data-state="on"] {
  background: rgba(200, 60, 60, 0.2);
  border-color: #c84040;
  color: #f08080;
}

/* ── Hint tooltip (ability / skill hover) ── */
.hint-tooltip {
  position: fixed;
  z-index: 9998;
  width: 240px;
  max-width: 88vw;
  background: #1a1a2e;
  border: 1px solid rgba(180,140,60,0.35);
  border-radius: 8px;
  box-shadow: 0 4px 18px rgba(0,0,0,0.65);
  padding: 10px 13px;
  pointer-events: none;
}
.hint-tooltip[hidden] { display: none; }
.hint-tooltip__title {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  font-weight: 700;
  color: var(--gold-hi);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 6px;
}
.hint-tooltip__body {
  font-size: 12px;
  line-height: 1.55;
  color: #bbb;
  white-space: pre-wrap;
}

.condition-tooltip {
  position: fixed;
  z-index: 9999;
  width: 280px;
  max-width: 90vw;
  background: #1e1e2e;
  border: 1px solid #444466;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.6);
  padding: 0;
  overflow: hidden;
}

.condition-tooltip__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: #2a2a40;
  border-bottom: 1px solid #444466;
  font-size: 13px;
  font-weight: 600;
  color: #c0b0ff;
}

.condition-tooltip__close {
  background: none;
  border: none;
  color: #888;
  cursor: pointer;
  font-size: 12px;
  padding: 0 2px;
  line-height: 1;
}

.condition-tooltip__close:hover { color: #fff; }

.condition-tooltip__body {
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: #ccc;
  max-height: 260px;
  overflow-y: auto;
  white-space: pre-wrap;
}

/* ── Magic items block ──────────────────────────────────────────────────────── */
.magic-items-search-wrap {
  position: relative;
  margin-bottom: 8px;
}

.magic-items-search {
  width: 100%;
  box-sizing: border-box;
  padding: 6px 10px;
  background: #1a1a2e;
  border: 1px solid #444;
  border-radius: 6px;
  color: #e0e0e0;
  font-size: 13px;
  outline: none;
}

.magic-items-search:focus { border-color: #7b68ee; }

.magic-items-dropdown {
  position: absolute;
  top: calc(100% + 2px);
  left: 0;
  right: 0;
  background: #1e1e32;
  border: 1px solid #555;
  border-radius: 6px;
  z-index: 500;
  max-height: 220px;
  overflow-y: auto;
}

.mi-option {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 6px 10px;
  cursor: pointer;
  gap: 8px;
}

.mi-option:hover { background: #2a2a48; }

.mi-opt-name { font-size: 13px; color: #e0e0e0; flex: 1; }

.mi-opt-meta { font-size: 11px; color: #888; white-space: nowrap; }

.magic-items-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.magic-item-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 8px;
  border-radius: 6px;
  background: #1e1e32;
  border-left: 3px solid #555;
  cursor: pointer;
  transition: background 0.15s;
}

.magic-item-chip:hover { background: #252545; }

.magic-item-chip.rarity-common    { border-color: #888; }
.magic-item-chip.rarity-uncommon  { border-color: #4caf50; }
.magic-item-chip.rarity-rare      { border-color: #2196f3; }
.magic-item-chip.rarity-very_rare { border-color: #9c27b0; }
.magic-item-chip.rarity-legendary { border-color: #ff9800; }
.magic-item-chip.rarity-artifact  { border-color: #f44336; }

.mi-name { flex: 1; font-size: 13px; color: #e0e0e0; }

.mi-type { font-size: 11px; color: #888; }

.mi-attune { font-size: 12px; color: #9c7fd4; title: "Требуется настройка"; }

.mi-remove {
  background: none;
  border: none;
  color: #666;
  cursor: pointer;
  font-size: 12px;
  padding: 2px 4px;
  line-height: 1;
  border-radius: 3px;
}

.mi-remove:hover { color: #e57373; background: rgba(229,115,115,0.1); }

.magic-item-tooltip__meta {
  padding: 4px 12px 0;
  font-size: 11px;
  color: #aaa;
  font-style: italic;
}

.exhaustion-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 4px;
  font-size: 13px;
}

.exhaustion-label {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

.exhaustion-level {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-hi);
  min-width: 20px;
  text-align: center;
}

.exhaustion-effect {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* ─── ОТДЫХ ─────────────────────────────────────────────── */
.rest-buttons {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ─── МОДАЛ КОРОТКОГО ОТДЫХА ─────────────────────────────── */
.short-rest-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.short-rest-overlay[hidden] { display: none; }

.short-rest-dialog {
  background: var(--bg2);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius);
  padding: 24px;
  min-width: 300px;
  max-width: 420px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.short-rest-title {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--gold-hi);
}

.short-rest-info {
  font-size: 13px;
  color: var(--muted);
}

.short-rest-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.short-rest-log {
  min-height: 40px;
  max-height: 120px;
  overflow-y: auto;
  font-size: 13px;
  color: var(--text);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.short-rest-entry {
  padding: 3px 0;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.short-rest-hd-select {
  width: 100%;
  padding: 4px 8px;
  border-radius: 6px;
  border: 1px solid var(--gold-dim);
  background: var(--surface);
  color: var(--text);
  font-size: 12px;
  cursor: pointer;
}

.short-rest-footer {
  display: flex;
  justify-content: flex-end;
}

/* Background details & ability */
.block-subtitle {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin: 6px 0 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.background-details-list {
  margin: 6px 0 0;
  padding-left: 16px;
  font-size: 13px;
  color: var(--text-muted);
}

.background-details-list li {
  margin-bottom: 3px;
}

/* Feature list block (class/race sections from JSON) */
.feature-list-block {
  padding: 0;
}

.feature-group {
  margin-bottom: 10px;
}

.feature-group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent);
  margin-bottom: 4px;
}

/* Weapon search */
.weapon-search-wrap {
  margin-top: 6px;
  position: relative;
}

.weapon-search-input {
  width: 100%;
  box-sizing: border-box;
  padding: 5px 8px;
  background: var(--block-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
}

.weapon-search-input:focus {
  outline: none;
  border-color: var(--accent);
}

.weapon-search-list {
  max-height: 220px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 4px 4px;
  background: var(--block-bg);
}

.weapon-opt {
  padding: 5px 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  font-size: 13px;
}

.weapon-opt:hover { background: rgba(255,255,255,0.06); }

.weapon-opt-name { color: var(--text); }

.weapon-opt-meta {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Prepared spells block */
.prepared-spells-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.prepared-limit-display {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: auto;
  margin-right: 6px;
}
.prepared-limit-display.over-limit {
  color: #e05050;
  font-weight: 600;
}

.spell-add-wrap {
  margin-bottom: 8px;
}

.spell-add-input {
  width: 100%;
  box-sizing: border-box;
  padding: 5px 8px;
  background: var(--block-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  color: var(--text);
  font-size: 13px;
}

.spell-add-input:focus { outline: none; border-color: var(--accent); }

.spell-add-list {
  max-height: 200px;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 4px 4px;
  background: var(--block-bg);
}

.spell-add-opt {
  padding: 5px 8px;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
}

.spell-add-opt:hover { background: rgba(255,255,255,0.06); }
.spell-add-name { color: var(--text); }
.spell-add-meta { font-size: 11px; color: var(--text-muted); }

.ps-level { margin-bottom: 10px; }

.ps-level-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
  padding-bottom: 3px;
  border-bottom: 1px solid var(--border);
}

.ps-level-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
}

.ps-slots { display: flex; gap: 3px; }

.ps-slot-circle {
  font-size: 13px;
  color: var(--text-muted);
  cursor: default;
}

.ps-slot-circle.used { color: var(--accent); }

.ps-row {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 0;
  font-size: 13px;
}

.ps-row:hover { background: rgba(255,255,255,0.03); }

.ps-prepared-check { cursor: pointer; accent-color: var(--accent); }

.ps-dot { color: var(--text-muted); font-size: 12px; }

.ps-name { flex: 1; color: var(--text); }

.ps-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  padding: 0 2px;
  font-size: 11px;
  opacity: 0.5;
}

.ps-remove:hover { opacity: 1; color: #e06c75; }

/* Подклассовые заклинания (Oath Spells, Domain Spells) — всегда подготовлены */
.ps-row--subclass { opacity: 0.85; }
.ps-dot--granted { color: #c8a028; font-size: 11px; }

.prepared-spells-empty {
  font-size: 12px;
  color: var(--text-muted);
  font-style: italic;
  padding: 4px 0;
}

/* ═══════════════════════════════════════════════════════════════
   НОВЫЙ ЛИСТ — 3-КОЛОНКОВЫЙ МАКЕТ
═══════════════════════════════════════════════════════════════ */

/* ── Шапка персонажа ── */
.char-header {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: flex-end;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: rgba(180,140,60,0.04);
  margin-bottom: 8px;
}
.char-header-name {
  flex: 1 1 160px;
  display: grid;
  gap: 4px;
}
.char-header-name .field-value {
  font-family: 'Cinzel', serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--gold-hi);
  padding: 5px 10px;
}
.char-header .field {
  flex: 0 1 130px;
}
.char-header select,
.char-header input[type="number"] {
  font-size: 13px;
  padding: 4px 8px;
  min-height: 30px;
}
.char-header .field-value {
  font-size: 13px;
  padding: 4px 8px;
  min-height: 30px;
}

#class-mc-label {
  display: block;
  width: 100%;
  font-size: 13px;
  padding: 4px 8px;
  min-height: 30px;
}

/* ── 3 колонки листа ── */
.sheet-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 8px;
  align-items: start;
  margin-bottom: 8px;
}

.sheet-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

/* ── Универсальная секция с рамкой ── */
.sheet-section {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 9px;
  background: var(--bg2);
}

.section-title {
  font-family: 'Cinzel', serif;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--gold-dim);
  text-align: center;
  margin-bottom: 5px;
}
.section-title-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  margin-bottom: 5px;
}
.section-title-row .section-title {
  margin-bottom: 0;
}

/* ── Характеристики (компактные карточки 2×3) ── */
.abilities-block {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 5px;
}

.sheet-col--left .ability {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 6px 4px 5px;
  gap: 2px;
  background: var(--bg2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  transition: border-color 0.2s;
}
.sheet-col--left .ability:hover { border-color: var(--border-hi); }

.sheet-col--left .ability-score {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  min-width: unset;
  line-height: 1;
  text-align: center;
}
.sheet-col--left .ability-mod {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 700;
  color: var(--gold);
  background: rgba(180,140,60,0.08);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0 8px;
  min-width: unset;
  text-align: center;
  cursor: pointer;
}
.sheet-col--left .ability-mod:active { opacity: 0.6; }
.sheet-col--left .ability-name {
  font-family: 'Cinzel', serif;
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}

/* ── Вдохновение + БМ ── */
.insp-prof-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.insp-prof-box {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 6px 4px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  gap: 3px;
}
.insp-prof-value {
  font-family: 'Cinzel', serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--gold-hi);
  line-height: 1;
  min-height: 22px;
  text-align: center;
}
#toggle-inspiration {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: color 0.15s, transform 0.1s;
}
#toggle-inspiration[data-state="off"] {
  color: var(--muted);
}
#toggle-inspiration[data-state="on"] {
  color: var(--gold-hi);
  transform: scale(1.15);
  text-shadow: 0 0 8px var(--gold-hi);
}
.insp-prof-label {
  font-family: 'Cinzel', serif;
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
  text-align: center;
}

/* ── Список спасбросков / навыков ── */
.skill-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.skill-row {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 1px 0;
  font-size: 11px;
  color: var(--muted);
  line-height: 1.3;
}
.skill-row--prof { color: var(--ink); }
.skill-row--jat { color: var(--muted); }
.jat-mark { font-size: 8px; color: var(--muted); margin-left: 1px; vertical-align: super; }
.skill-dot {
  flex-shrink: 0;
  width: 12px;
  text-align: center;
  font-size: 9px;
  color: var(--muted);
}
.skill-row--prof .skill-dot { color: var(--gold); }
.skill-row--expert { color: var(--ink); }
.skill-row--expert .skill-dot { color: var(--gold-hi); font-size: 8px; }
.skill-name { flex: 1; }
.skill-ability {
  font-family: 'Cinzel', serif;
  font-size: 8px;
  color: var(--gold-dim);
  letter-spacing: 0.04em;
  flex-shrink: 0;
}
.skill-adv {
  font-size: 9px;
  color: var(--gold);
  flex-shrink: 0;
  cursor: default;
  line-height: 1;
}
.skill-bonus {
  font-weight: 700;
  font-size: 11px;
  min-width: 24px;
  text-align: right;
  color: var(--ink);
  flex-shrink: 0;
  cursor: pointer;
}
.skill-bonus:active { opacity: 0.6; }

/* ── Пассивное восприятие ── */
.passive-perc-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
}
.passive-perc-value {
  font-family: 'Cinzel', serif;
  font-size: 17px;
  font-weight: 700;
  color: var(--gold-hi);
  min-width: 28px;
  text-align: center;
  line-height: 1;
}
.passive-perc-label {
  font-family: 'Cinzel', serif;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

/* ── Владения ── */
.prof-grid {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 3px 8px;
  align-items: start;
  font-size: 12px;
}
.prof-label {
  font-family: 'Cinzel', serif;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold-dim);
  padding-top: 3px;
  white-space: nowrap;
}
.prof-grid .field-value {
  font-size: 12px;
  padding: 2px 6px;
  min-height: unset;
}

/* ── Боевой ряд (КД / Инициатива / Скорость / Щит) ── */
.combat-row {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex-wrap: wrap;
}
.combat-box {
  flex: 1 1 50px;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 7px 4px 5px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg2);
  gap: 2px;
  text-align: center;
}
.combat-value {
  font-family: 'Cinzel', serif;
  font-size: 20px;
  font-weight: 700;
  color: var(--gold-hi);
  line-height: 1;
}
.combat-label {
  font-family: 'Cinzel', serif;
  font-size: 7px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--muted);
}
.combat-box--shield {
  justify-content: center;
  flex: 0 1 auto;
  padding: 6px 8px;
}
.armor-type-row {
  display: flex;
  gap: 3px;
  align-items: center;
  justify-content: center;
}
.armor-warning {
  font-size: 9px;
  color: #c77b2a;
  text-align: center;
  padding: 2px 4px;
  line-height: 1.2;
}
.armor-base-row {
  display: flex;
  gap: 4px;
  align-items: center;
  font-size: 10px;
  color: var(--muted);
  margin-top: 2px;
}
.armor-base-row .editable {
  width: 36px;
  font-size: 12px;
  padding: 2px 4px;
  min-height: unset;
  text-align: center;
}

/* ── HP ── */
.hp-block {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.hp-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.hp-row--max .hp-value { color: var(--muted); font-size: 16px; }
.hp-label { color: var(--muted); font-size: 11px; }
.hp-value {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  font-weight: 700;
  color: var(--gold-hi);
}


/* ── Ресурсы (кости хитов + спасброски смерти) ── */
.resources-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.resources-box {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 9px;
  background: var(--bg2);
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.res-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--muted);
}
.res-label { font-size: 10px; }
.hd-recover-row { margin-top: 2px; border-top: 1px solid var(--border); padding-top: 3px; }
.hd-recover-label { color: var(--muted); font-size: 11px; }
.hd-recover-toggle {
  padding: 1px 6px;
  border-radius: 8px;
  border: 1px solid var(--gold-dim);
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  cursor: pointer;
  transition: all 0.15s;
}
.hd-recover-toggle:hover { border-color: var(--gold-hi); color: var(--text); }
.hd-recover-toggle[data-state="all"] { border-color: #6090d8; color: #8ab0f0; }
.death-col {
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 10px;
  color: var(--muted);
}

/* ── Кнопки отдыха ── */
.rest-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.rest-row .chip {
  flex: 1;
  text-align: center;
  font-size: 11px;
}
#btn-short-rest {
  border-color: rgba(200,160,40,0.5);
  color: #c8a028;
}
#btn-short-rest:hover {
  background: rgba(200,160,40,0.15);
  border-color: #c8a028;
  color: #e8be48;
}
#btn-long-rest {
  border-color: rgba(80,110,200,0.5);
  color: #8090d8;
}
#btn-long-rest:hover {
  background: rgba(80,110,200,0.15);
  border-color: #8090d8;
  color: #a0b0f0;
}

/* ── Шапка таблицы атак ── */
.attacks-header {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 6px;
  font-family: 'Cinzel', serif;
  font-size: 8px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold-dim);
  padding: 0 4px 4px;
  border-bottom: 1px solid var(--border);
}
.weapon-main-row {
  display: grid;
  grid-template-columns: 1fr 70px 80px;
  gap: 5px;
  align-items: center;
}
.weapon-main-row .editable {
  font-size: 12px;
  padding: 3px 6px;
  min-height: unset;
}

/* ── Нарративные поля (правая колонка) ── */
.narrative-field,
.features-field {
  font-size: 13px;
  line-height: 1.5;
  max-height: 3em;
  overflow: hidden;
  cursor: pointer;
  transition: max-height 0.25s ease;
  position: relative;
}
.narrative-field.expanded,
.features-field.expanded {
  max-height: none;
  cursor: text;
}
.features-field {
  font-size: 12px;
}
/* Визуальная подсказка что поле обрезано */
.narrative-field:not(.expanded)::after,
.features-field:not(.expanded)::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 16px;
  background: linear-gradient(transparent, var(--card, #141009));
  pointer-events: none;
}
@media print {
  .narrative-field, .features-field { max-height: none !important; }
  .narrative-field::after, .features-field::after { display: none; }
}
.features-section .section-title { margin-top: 8px; }
.features-section .section-title:first-child { margin-top: 0; }
.features-sublabel {
  font-size: 9px;
  font-family: 'Cinzel', serif;
  color: var(--muted);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 2px;
}

/* ── Магическая секция ── */
.sheet-magic {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 8px 12px;
  background: var(--bg2);
  margin-bottom: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.sheet-magic-top {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.magic-params-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 12px;
  align-items: end;
}
.magic-params-row .field {
  flex: 1 1 120px;
}
.spell-slots-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.slots-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.slot-row {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 3px 7px;
  background: rgba(0,0,0,0.15);
}
.slot-lvl {
  font-family: 'Cinzel', serif;
  font-size: 9px;
  color: var(--gold-dim);
  min-width: 9px;
}
.slot-used {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-hi);
  padding: 0 2px;
  min-height: unset;
  border: none;
  background: transparent;
  min-width: 18px;
  text-align: center;
}
.slot-sep {
  font-size: 11px;
  color: var(--muted);
  padding: 0 1px;
}
.slot-max {
  font-size: 11px;
  color: var(--muted);
  min-width: 14px;
  text-align: center;
}

/* ── Ресурсы класса ── */
.class-resources-list {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.resource-row {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
}
.resource-name {
  flex: 1;
  color: var(--ink);
  font-size: 11px;
}
.resource-row--info {
  opacity: 0.7;
  font-style: italic;
}
.resource-row--info .resource-name {
  color: var(--muted);
}
.resource-used {
  font-size: 13px;
  font-weight: 700;
  color: var(--gold-hi);
  padding: 0 2px;
  min-height: unset;
  border: none;
  background: transparent;
  min-width: 20px;
  text-align: center;
  border-bottom: 1px solid var(--border);
}
.resource-sep { font-size: 11px; color: var(--muted); }
.resource-max { font-size: 11px; color: var(--muted); min-width: 18px; }
.resource-unlimited { font-size: 14px; color: var(--gold-hi); padding: 0 4px; }
.resource-restore { font-size: 10px; color: var(--muted); margin-left: auto; white-space: nowrap; }

/* ── Pact Magic (варлок при мультиклассировании) ── */
#pact-slots-section {
  margin-top: 8px;
  padding: 6px 8px;
  border: 1px dashed var(--gold-dim);
  border-radius: 6px;
  background: rgba(120, 60, 160, 0.08);
}
#pact-slots-section .field-label {
  margin-bottom: 4px;
  color: var(--gold-hi);
  font-size: 11px;
}
.pact-rest-hint {
  font-size: 10px;
  color: var(--muted);
  margin-left: 4px;
}

/* ── Концентрация ── */
.concentration-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}
.concentration-btn {
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid var(--gold-dim);
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.concentration-btn:hover {
  border-color: var(--gold-hi);
  color: var(--text);
}
.concentration-btn[data-state="on"] {
  border-color: #6090d8;
  background: rgba(80, 120, 200, 0.15);
  color: #8ab0f0;
  font-weight: 600;
}
.concentration-detail {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  min-width: 0;
}
#concentration-spell {
  flex: 1;
  min-width: 80px;
  padding: 2px 4px;
  border-bottom: 1px solid rgba(80, 120, 200, 0.4);
  color: #8ab0f0;
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.concentration-dc {
  font-size: 10px;
  color: var(--muted);
  white-space: nowrap;
}
.concentration-clear-btn {
  padding: 1px 5px;
  border-radius: 50%;
  border: 1px solid rgba(200, 80, 80, 0.4);
  background: transparent;
  color: rgba(200, 100, 100, 0.8);
  font-size: 11px;
  cursor: pointer;
  line-height: 1.4;
  transition: all 0.15s;
}
.concentration-clear-btn:hover {
  background: rgba(200, 80, 80, 0.15);
  border-color: rgba(200, 80, 80, 0.8);
  color: #e08080;
}

/* ── Дополнительные колонки ── */
.sheet-extra-columns {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 8px;
  margin-bottom: 8px;
}
.sheet-extra-col {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.sheet-extra-col .field-value { font-size: 13px; }

/* ── Языки (секция в левой колонке) ── */
.languages-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }

/* ── Подзаголовок предыстории ── */
.block-subtitle {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--gold-dim);
  margin: 6px 0 3px;
}
.background-details-list {
  margin: 4px 0 0;
  padding-left: 16px;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.5;
}
.background-details-list li { margin-bottom: 2px; }

/* ── Адаптация существующих элементов в новых секциях ── */
.sheet-section .field-value {
  font-size: 13px;
  padding: 4px 8px;
  min-height: 30px;
}
.sheet-section select {
  font-size: 13px;
  padding: 4px 8px;
  min-height: 30px;
}
.sheet-col--center .sheet-section .bar { margin-top: 4px; }

/* ── Инструкция для монет ── */
.sheet-col--center .coins-grid {
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
}
.sheet-col--center .coin {
  padding: 4px;
  gap: 2px;
}
.sheet-col--center .coin span {
  font-size: 9px;
}
.sheet-col--center .coin .editable {
  font-size: 14px;
}

/* ── Секция подготовленных заклинаний ── */
.prepared-spells-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}

/* ── Адаптация кнопок уровня в шапке ── */
.char-header .level-field input {
  width: 50px;
  text-align: center;
  font-size: 14px;
  font-family: 'Cinzel', serif;
  font-weight: 700;
  color: var(--gold-hi);
}

/* ── Toast уведомление ── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  background: #2a2a3e;
  border: 1px solid rgba(180,140,60,0.4);
  color: var(--gold-hi);
  font-family: 'Cinzel', serif;
  font-size: 12px;
  letter-spacing: 0.05em;
  padding: 8px 20px;
  border-radius: 999px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.5);
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s;
  pointer-events: none;
  z-index: 99999;
}
.toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ═══════════════════════════════════════════════════════
   АДАПТИВНАЯ ВЁРСТКА — планшеты и телефоны
   ═══════════════════════════════════════════════════════ */

/* -- Планшет (до 1024px) -- */
@media (max-width: 1024px) {
  .sheet-columns {
    grid-template-columns: 180px minmax(0, 1fr) 200px;
  }
  .sheet-extra-columns {
    grid-template-columns: 1fr 1fr;
  }
  .wizard-body-layout {
    grid-template-columns: 200px 1fr;
  }
}

/* -- Маленький планшет / большой телефон (до 768px) -- */
@media (max-width: 768px) {
  .sheet-columns {
    grid-template-columns: 1fr;
  }
  .sheet-extra-columns {
    grid-template-columns: 1fr;
  }
  .char-header {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
  }
  .char-header-name {
    grid-column: 1 / -1;
  }
  .char-header .field {
    flex: none;
    width: 100%;
  }
  .magic-params-row {
    flex-wrap: wrap;
    gap: 8px;
  }
  .magic-params-row .field {
    flex: 1 1 45%;
    min-width: 120px;
  }
  .slots-grid {
    flex-wrap: wrap;
  }
  .wizard-body-layout {
    grid-template-columns: 1fr;
  }
  .wizard-summary-panel {
    display: none;
  }
  .sheet-topbar {
    flex-wrap: wrap;
    gap: 6px;
  }
  .sheet-topbar .topbar-actions {
    width: 100%;
    justify-content: flex-end;
  }
  /* Левая колонка — характеристики в ряд */
  .sheet-col--left .abilities-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
  }
  /* Спасброски и навыки — компактнее */
  .saves-list, .skills-list {
    font-size: 11px;
  }
}

/* -- Телефон (до 480px) -- */
@media (max-width: 480px) {
  body { font-size: 14px; }
  .char-header {
    grid-template-columns: 1fr;
  }
  .sheet-topbar .header-summary { display: none; }
  .sheet-topbar .header-actions { width: 100%; }
  .header-buttons { width: 100%; display: flex; gap: 4px; }
  .header-buttons .ghost,
  .header-buttons .primary { flex: 1; }
  .page { padding: 8px 8px 48px; }
  .home-hero .brand { flex-direction: column; text-align: center; }
  .home-card { padding: 16px; }
  .sheet-columns { gap: 4px; }
  .sheet-section { padding: 6px; }
  .weapon-main-row {
    grid-template-columns: 1fr;
    gap: 2px;
  }
  .attacks-header { display: none; }
  .coins-grid {
    grid-template-columns: repeat(3, 1fr);
  }
  .sheet-col--left .abilities-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  /* Мастер — минимальные отступы */
  .wizard-modal-body { padding: 10px 12px; }
  .wizard-modal-header { padding: 10px 12px; }
  .wizard-modal-footer { padding: 10px 12px; }
  .wizard-step-circle { width: 28px; height: 28px; font-size: 11px; }
  .wizard-step-label { display: none; }
  .class-card-grid,
  .race-card-grid,
  .bg-card-grid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  }
  .ability-grid {
    gap: 4px;
  }
  .skills-grid {
    grid-template-columns: 1fr;
  }
}

/* ═══════════════════════════════════════════════════════
   @media print — экспорт в PDF
   ═══════════════════════════════════════════════════════ */
@media print {
  @page {
    size: A4;
    margin: 8mm 10mm;
  }

  /* Скрываем всё кроме листа персонажа */
  #home-screen,
  #library-screen,
  #dice-screen { display: none !important; }

  /* Скрываем overlays и tooltips */
  .confirm-overlay,
  .wizard-overlay,
  .levelup-overlay,
  .short-rest-overlay,
  .hint-tooltip,
  .condition-tooltip { display: none !important; }

  /* Скрываем интерактивные кнопки шапки */
  #btn-back-from-sheet,
  #btn-reset,
  #btn-export-pdf,
  #btn-save,
  .level-btn, .level-up-btn { display: none !important; }

  /* Скрываем кнопки отдыха и усталости */
  .rest-row,
  #exhaustion-minus,
  #exhaustion-plus { display: none !important; }

  /* Скрываем поисковые строки */
  .weapon-search-wrap,
  #armor-base-row { display: none !important; }

  /* Скрываем кнопки поиска и добавления */
  .armor-search-btn,
  .weapon-search-btn,
  .equip-search-btn,
  #add-spell-btn { display: none !important; }

  /* Скрываем кнопки выбора типа брони и щита */
  .armor-toggle,
  #toggle-shield { display: none !important; }

  /* Убираем интерактивные рамки у редактируемых полей */
  [contenteditable="true"] {
    outline: none !important;
    border: none !important;
    -webkit-user-modify: read-only !important;
  }

  /* Разрешить перенос между секциями, но не внутри */
  .sheet-section { page-break-inside: avoid; }

  /* Убираем скролл */
  body, .page, .screen { overflow: visible !important; height: auto !important; }

  /* Белый фон, чёрный текст для печати */
  body {
    background: #fff !important;
    background-image: none !important;
    color: #000 !important;
  }
  body::after { display: none !important; }
  * {
    color: #000 !important;
    border-color: #ccc !important;
  }
  .sheet-topbar,
  .char-header,
  .sheet-section,
  .sheet-col,
  .sheet-magic,
  .sheet-extra-col {
    background: #fff !important;
    border-color: #ccc !important;
  }
  .section-title { color: #333 !important; }
  .field-label { color: #666 !important; }
  .ability { background: #f8f8f8 !important; border-color: #ccc !important; }
  .save-hint, .storage-info, .header-summary { display: none !important; }

  /* Показать лист даже если hidden */
  #sheet-screen { display: block !important; }
  #sheet-screen[hidden] { display: block !important; }

  /* Лист на всю ширину */
  .page { max-width: none !important; padding: 0 !important; }
}

/* ══════════════════════════════════════════════════════════
   НОВЫЙ МАСТЕР v2
══════════════════════════════════════════════════════════ */

/* -- Двухколоночный layout -- */
.wizard-body-layout {
  display: grid;
  grid-template-columns: minmax(0, 260px) 1fr;
  flex: 1;
  overflow: hidden;
}
@media (max-width: 640px) {
  .wizard-body-layout {
    grid-template-columns: 1fr;
  }
  .wizard-summary-panel { display: none; }
}

/* -- Левая панель (резюме) -- */
.wizard-summary-panel {
  padding: 20px;
  border-right: 1px solid rgba(180,140,60,0.12);
  overflow-y: auto;
  background: rgba(0,0,0,0.2);
}
.wizard-summary-field {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px solid rgba(180,140,60,0.06);
  font-size: 13px;
}
.wizard-summary-label {
  color: #7a6a40;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.wizard-summary-value {
  color: #c8b880;
  text-align: right;
}
.wizard-summary-abilities {
  font-size: 11px;
  color: #8a7a50;
  padding: 8px 0;
  letter-spacing: 0.05em;
}

/* -- Контейнер шагов -- */
.wizard-step-content {
  padding: 24px 32px;
  animation: wiz-fade 0.25s ease;
}
@keyframes wiz-fade {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* -- Общие стили полей -- */
.wizard-field-label {
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: #7a6a40;
  font-weight: 600;
}
.wizard-input {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(180,140,60,0.2);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: 'Crimson Pro', serif;
  font-size: 15px;
  color: #e8dfc8;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.wizard-input:focus {
  outline: none;
  border-color: rgba(180,140,60,0.6);
  background: rgba(180,140,60,0.06);
  box-shadow: 0 0 0 3px rgba(180,140,60,0.1);
}
.wizard-input::placeholder { color: #4a3e20; }

/* -- Мировоззрение — auto-fit, минимум 100px на ячейку -- */
.alignment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 6px;
}
.alignment-cell {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 6px;
  border-radius: 8px;
  border: 1px solid rgba(180,140,60,0.12);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: all 0.15s;
}
.alignment-cell:hover {
  border-color: rgba(180,140,60,0.35);
  background: rgba(180,140,60,0.06);
}
.alignment-cell.selected {
  border-color: var(--gold);
  background: rgba(180,140,60,0.12);
  box-shadow: 0 0 0 2px rgba(180,140,60,0.15);
}
.alignment-code {
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 700;
  color: #c9a84c;
}
.alignment-cell.selected .alignment-code { color: #e8cc7a; }
.alignment-label {
  font-size: 10px;
  color: #6a5e3a;
  text-align: center;
}
.alignment-cell.selected .alignment-label { color: #a08a50; }

/* -- Карточки классов/рас/предысторий -- */
.class-card-grid,
.race-card-grid,
.bg-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(140px, 100%), 1fr));
  gap: 8px;
}
.race-grid-divider {
  grid-column: 1 / -1;
  font-size: 11px;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 8px 0 2px;
  border-top: 1px solid var(--border);
  margin-top: 4px;
}
.class-card,
.race-card,
.bg-card {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid rgba(180,140,60,0.12);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
  overflow: hidden;
  min-width: 0;
}
.class-card:hover,
.race-card:hover,
.bg-card:hover {
  border-color: rgba(180,140,60,0.4);
  background: rgba(180,140,60,0.06);
}
.class-card.selected,
.race-card.selected,
.bg-card.selected {
  border-color: var(--gold);
  background: rgba(180,140,60,0.1);
  box-shadow: 0 0 0 2px rgba(180,140,60,0.15);
}
.class-card-name,
.race-card-name,
.bg-card-name {
  font-size: 14px;
  color: #c8b880;
  font-weight: 600;
  word-break: break-word;
}
.class-card.selected .class-card-name,
.race-card.selected .race-card-name,
.bg-card.selected .bg-card-name {
  color: #e8cc7a;
}
.class-card-hit-die,
.race-card-asi,
.bg-card-skills {
  font-size: 10px;
  color: #8a7a50;
  margin-top: 2px;
}
.class-card-source,
.race-card-source,
.bg-card-source {
  font-size: 10px;
  color: #5a5030;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.08em;
}

/* -- Панель деталей -- */
.class-detail-panel,
.race-detail-panel,
.bg-detail-panel {
  margin-top: 16px;
  padding: 16px;
  border-radius: 10px;
  border: 1px solid rgba(180,140,60,0.25);
  background: rgba(15,12,7,0.6);
  border-top: 2px solid rgba(180,140,60,0.3);
}
.class-detail-name,
.race-detail-name,
.bg-detail-name {
  font-family: 'Cinzel', serif;
  font-size: 16px;
  font-weight: 700;
  color: #e8cc7a;
  margin-bottom: 10px;
}
.class-detail-row,
.race-detail-row,
.bg-detail-row {
  font-size: 13px;
  color: #c8b880;
  padding: 4px 0;
  line-height: 1.5;
}
.class-detail-row b,
.race-detail-row b,
.bg-detail-row b {
  color: #7a6a40;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-right: 6px;
}

/* -- Подрасы -- */
.subrace-section {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid rgba(180,140,60,0.15);
}
.subrace-title {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  color: #7a6a40;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 8px;
}
.subrace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(130px, 100%), 1fr));
  gap: 6px;
  margin-bottom: 8px;
}
.subrace-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(180,140,60,0.12);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.subrace-card:hover {
  border-color: rgba(180,140,60,0.4);
  background: rgba(180,140,60,0.06);
}
.subrace-card.selected {
  border-color: var(--gold);
  background: rgba(180,140,60,0.1);
  box-shadow: 0 0 0 2px rgba(180,140,60,0.15);
}
.subrace-card-name {
  font-size: 13px;
  color: #c8b880;
  font-weight: 600;
}
.subrace-card.selected .subrace-card-name {
  color: #e8cc7a;
}
.subrace-card-asi {
  font-size: 10px;
  color: #8a7a50;
}
.subrace-detail {
  font-size: 13px;
  color: #c8b880;
}

/* -- Тулбар поиска + фильтр -- */
.step-race-toolbar,
.step-bg-toolbar {
  display: flex;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 16px;
}
.source-toggle {
  display: flex;
  align-items: center;
  gap: 0;
  font-size: 12px;
  color: #6a5a30;
  cursor: pointer;
  white-space: nowrap;
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid rgba(180,140,60,0.25);
  background: rgba(255,255,255,0.03);
  transition: all 0.2s;
  user-select: none;
}
.source-toggle:hover {
  border-color: rgba(180,140,60,0.5);
  background: rgba(180,140,60,0.08);
}
.source-toggle:has(input:checked) {
  border-color: var(--gold);
  background: rgba(180,140,60,0.18);
  color: #e8cc7a;
  box-shadow: 0 0 6px rgba(180,140,60,0.25);
}
.source-toggle input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.source-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 8px;
}
.source-chip {
  font-size: 10px;
  padding: 3px 8px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  opacity: 0.5;
  transition: all 0.15s;
}
.source-chip.active {
  opacity: 1;
  border-color: var(--gold);
  background: rgba(180,140,60,0.15);
  color: var(--gold);
}
.source-chip:hover { opacity: 0.8; }

/* -- Характеристики -- */
.ability-methods {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.ability-method-btn {
  padding: 8px 14px;
  border-radius: 8px;
  border: 1px solid rgba(180,140,60,0.2);
  background: rgba(255,255,255,0.02);
  color: #8a7a50;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}
.ability-method-btn:hover { border-color: rgba(180,140,60,0.4); }
.ability-method-btn.selected {
  border-color: var(--gold);
  background: rgba(180,140,60,0.1);
  color: #e8cc7a;
}
.ability-grid {
  display: grid;
  gap: 8px;
  margin-top: 16px;
}
.ability-row--header {
  display: flex;
  justify-content: flex-end;
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  gap: 12px;
  padding-bottom: 2px;
  border-bottom: 1px solid var(--border);
}
.ability-row--header .ability-name { flex: 1; }
.ability-header-cell {
  text-align: center;
  min-width: 40px;
}
.ability-row {
  display: grid;
  grid-template-columns: 120px 1fr auto auto 50px;
  align-items: center;
  gap: 8px;
}
.ability-race-bonus {
  font-size: 12px;
  color: #80c080;
  font-family: 'Cinzel', serif;
  min-width: 24px;
  text-align: center;
}
.ability-total {
  font-size: 14px;
  font-weight: 700;
  color: #e8cc7a;
  font-family: 'Cinzel', serif;
  min-width: 24px;
  text-align: center;
}
.ability-race-info {
  font-size: 13px;
  color: #80c080;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(100,180,100,0.06);
  border: 1px solid rgba(100,180,100,0.15);
  margin-bottom: 8px;
}
.ability-name {
  font-size: 14px;
  color: #c8b880;
}
.ability-value {
  text-align: center;
  font-size: 18px;
  font-weight: 700;
  color: #e8cc7a;
  font-family: 'Cinzel', serif;
}
.ability-mod {
  text-align: center;
  font-size: 13px;
  color: #8a7a50;
}
.ability-minus,
.ability-plus {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1px solid rgba(180,140,60,0.2);
  background: rgba(255,255,255,0.03);
  color: #c9a84c;
  font-size: 16px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.15s;
}
.ability-minus:hover:not(:disabled),
.ability-plus:hover:not(:disabled) {
  border-color: rgba(180,140,60,0.5);
  background: rgba(180,140,60,0.1);
}
.ability-minus:disabled,
.ability-plus:disabled {
  opacity: 0.25;
  cursor: not-allowed;
}

/* -- Point buy info -- */
.ability-pb-info {
  font-size: 14px;
  color: #8a7a50;
  margin-bottom: 8px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(180,140,60,0.06);
  border: 1px solid rgba(180,140,60,0.1);
}
.ability-pb-info b { color: #e8cc7a; font-family: 'Cinzel', serif; font-size: 16px; }

/* -- Point buy row with +/- buttons -- */
.ability-row .ability-minus,
.ability-row .ability-plus { flex-shrink: 0; }
.ability-row:has(.ability-minus) {
  grid-template-columns: 120px 32px 50px 32px auto auto 50px;
}

/* (ability-select удалён — заменён на click-to-assign slots) */

/* -- Roll area -- */
.ability-roll-area {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.ability-auto-area {
  margin-bottom: 12px;
}
.roll-chip {
  display: inline-block;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  border: 1px solid rgba(180,140,60,0.3);
  background: rgba(180,140,60,0.08);
  color: #e8cc7a;
  font-family: 'Cinzel', serif;
  font-size: 15px;
  font-weight: 700;
  text-align: center;
  line-height: 36px;
}
.roll-chip.used {
  opacity: 0.3;
  text-decoration: line-through;
}

/* -- Standard array / Roll pool -- */
.ability-sa-pool {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}
.sa-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 2px solid rgba(180,140,60,0.3);
  background: rgba(180,140,60,0.08);
  color: #e8cc7a;
  font-family: 'Cinzel', serif;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.sa-chip:hover:not(.used) {
  border-color: var(--gold);
  background: rgba(180,140,60,0.15);
  transform: scale(1.05);
}
.sa-chip.selected {
  border-color: var(--gold);
  background: rgba(180,140,60,0.25);
  box-shadow: 0 0 12px rgba(180,140,60,0.4);
  transform: scale(1.1);
}
.sa-chip.used {
  opacity: 0.25;
  cursor: default;
  transform: none;
}

/* -- Ability slot (click-to-assign) -- */
.ability-slot {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  border: 2px dashed rgba(180,140,60,0.2);
  color: #5a5030;
  font-family: 'Cinzel', serif;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s;
  user-select: none;
}
.ability-slot.filled {
  border-style: solid;
  border-color: rgba(180,140,60,0.4);
  background: rgba(180,140,60,0.1);
  color: #e8cc7a;
}
.ability-slot.target {
  border-color: var(--gold);
  background: rgba(180,140,60,0.08);
  animation: slot-pulse 1s ease infinite alternate;
}
@keyframes slot-pulse {
  from { box-shadow: 0 0 0 0 rgba(180,140,60,0.2); }
  to   { box-shadow: 0 0 8px 2px rgba(180,140,60,0.3); }
}

/* -- Синергия предысторий -- */
.bg-card-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}
.synergy-badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.04em;
}
.synergy-good {
  background: rgba(80,160,80,0.15);
  color: #80c080;
}
.synergy-warn {
  background: rgba(200,160,60,0.15);
  color: #c0a050;
}
.bg-skill-dupe {
  color: #d09060;
  text-decoration: underline wavy rgba(200,140,60,0.4);
}

/* -- bg description -- */
.bg-detail-desc {
  max-height: 120px;
  overflow-y: auto;
  line-height: 1.6;
}
.bg-list-detail {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

/* -- Заглушка -- */
.step-placeholder {
  color: #5a5030;
  font-style: italic;
  padding: 40px 0;
  text-align: center;
}

/* -- Навыки -- */
.skills-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.skills-counter {
  font-size: 12px;
  color: #8a7a50;
  font-family: 'Cinzel', serif;
}
.skills-bg-note {
  font-size: 12px;
  color: #7a6a40;
  margin-bottom: 12px;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(180,140,60,0.06);
  border: 1px solid rgba(180,140,60,0.1);
}
.skills-bg-note b { color: #8a7a50; }
.skills-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 6px;
}
.skill-item {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 8px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(180,140,60,0.1);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.skill-item:hover:not([disabled]) {
  border-color: rgba(180,140,60,0.3);
  background: rgba(180,140,60,0.05);
}
.skill-item.skill-selected {
  border-color: var(--gold);
  background: rgba(180,140,60,0.1);
}
.skill-item.skill-locked {
  border-color: rgba(180,140,60,0.2);
  background: rgba(180,140,60,0.05);
  cursor: default;
  opacity: 0.8;
}
.skill-item.skill-unavailable {
  opacity: 0.35;
  cursor: not-allowed;
}
.skill-name { font-size: 13px; color: #c8b880; flex: 1; }
.skill-item.skill-selected .skill-name { color: #e8cc7a; }
.skill-ability { font-size: 10px; color: #5a5030; font-family: 'Cinzel', serif; }
.skill-badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  font-family: 'Cinzel', serif;
  letter-spacing: 0.05em;
}
.skill-badge--bg { background: rgba(100,140,180,0.15); color: #8ab0d0; }
.skill-badge--race { background: rgba(100,180,100,0.15); color: #80c080; }
.skill-badge--class { background: rgba(180,140,60,0.15); color: #c9a84c; }
.skill-badge--dupe { background: rgba(200,80,60,0.15); color: #d09080; }

/* -- Заклинания -- */
.spells-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.spells-note {
  font-size: 11px;
  color: #6a5e3a;
  font-style: italic;
}
.spells-section {
  margin-bottom: 20px;
}
.spells-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  font-size: 13px;
  color: #8a7a50;
  font-family: 'Cinzel', serif;
}
.spells-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 6px;
}
.spell-card {
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid rgba(180,140,60,0.1);
  background: rgba(255,255,255,0.02);
  cursor: pointer;
  transition: all 0.15s;
  text-align: left;
}
.spell-card:hover {
  border-color: rgba(180,140,60,0.3);
}
.spell-card.selected {
  border-color: var(--gold);
  background: rgba(180,140,60,0.1);
}
.spell-card-name {
  font-size: 13px;
  color: #c8b880;
}
.spell-card.selected .spell-card-name { color: #e8cc7a; }
.spell-card-meta {
  font-size: 10px;
  color: #5a5030;
}

/* -- Summary итог -- */
.step-summary-title {
  font-family: 'Cinzel', serif;
  font-size: 18px;
  color: #e8cc7a;
  margin-bottom: 16px;
}
.step-summary-fields {
  display: grid;
  gap: 8px;
}
.summary-row {
  font-size: 14px;
  color: #c8b880;
  padding: 6px 0;
  border-bottom: 1px solid rgba(180,140,60,0.06);
}
.summary-row b {
  color: #7a6a40;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-right: 8px;
}

/* -- Проблемы на итоговом шаге -- */
.summary-issues {
  margin-bottom: 16px;
  padding: 12px 16px;
  border-radius: 8px;
  background: rgba(200,80,60,0.08);
  border: 1px solid rgba(200,80,60,0.2);
}
.summary-issue {
  font-size: 13px;
  color: #d09080;
  padding: 3px 0;
}
.summary-issue::before {
  content: "!";
  display: inline-block;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: rgba(200,80,60,0.15);
  color: #d09080;
  text-align: center;
  line-height: 18px;
  font-size: 11px;
  font-weight: 700;
  margin-right: 8px;
}
.summary-abs small { color: #8a7a50; font-size: 12px; }
.summary-calculated {
  display: flex;
  gap: 16px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(180,140,60,0.15);
}
.summary-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  min-width: 60px;
  padding: 10px 14px;
  border-radius: 10px;
  border: 1px solid rgba(180,140,60,0.2);
  background: rgba(180,140,60,0.05);
}
.summary-stat-value {
  font-family: 'Cinzel', serif;
  font-size: 22px;
  font-weight: 700;
  color: #e8cc7a;
}
.summary-stat-label {
  font-size: 10px;
  color: #7a6a40;
  font-family: 'Cinzel', serif;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.summary-saves {
  margin-top: 12px;
}

/* ═══════════════════════════════════════════════════════════════
   DICE ROLLER
   ═══════════════════════════════════════════════════════════════ */

/* ─── FAB (floating action button) ───────────────────────────── */
.dice-fab {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 900;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, #1c1710 0%, #2a2010 100%);
  border: 1.5px solid var(--border-hi);
  color: var(--gold);
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.5), 0 0 0 0 rgba(201,168,76,0);
  transition: transform 0.2s, box-shadow 0.2s, border-color 0.2s;
}
.dice-fab:hover {
  transform: scale(1.08);
  border-color: var(--gold);
  box-shadow: 0 4px 20px rgba(0,0,0,0.5), 0 0 12px rgba(201,168,76,0.2);
}
.dice-fab--active {
  border-color: var(--gold);
  background: linear-gradient(135deg, #2a2010 0%, #3a3020 100%);
}
.dice-fab--roll {
  animation: dice-bounce 0.5s ease;
}
@keyframes dice-bounce {
  0%   { transform: scale(1); }
  30%  { transform: scale(1.2) rotate(15deg); }
  60%  { transform: scale(0.95) rotate(-5deg); }
  100% { transform: scale(1) rotate(0); }
}
.dice-fab-icon {
  display: block;
}

/* ─── FLOATING PANEL ─────────────────────────────────────────── */
.dice-floating-panel {
  position: fixed;
  bottom: 92px;
  right: 24px;
  z-index: 899;
  width: 280px;
  background: var(--card);
  border: 1px solid var(--border-hi);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  opacity: 0;
  transform: translateY(16px) scale(0.95);
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.dice-floating-panel.dice-panel--open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ─── DICE CONFIGURATOR ──────────────────────────────────────── */
.dice-cfg {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dice-cfg--compact .dice-cfg-row {
  padding: 3px 0;
}
.dice-cfg--full {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 16px;
}
.dice-cfg-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.dice-cfg-row--full {
  flex-direction: column;
  gap: 4px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 8px;
  transition: border-color 0.15s;
}
.dice-cfg-row--full:has(.dice-cfg-count:not(:empty)) {
  /* highlight when count > 0 handled by JS class */
}
.dice-cfg-label {
  font-family: 'Cinzel', serif;
  font-weight: 600;
  font-size: 13px;
  color: var(--gold);
  min-width: 36px;
  text-align: center;
}
.dice-cfg-row--full .dice-cfg-label {
  font-size: 16px;
  min-width: auto;
}
.dice-cfg-count,
.dice-cfg-mod-value {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  min-width: 24px;
  text-align: center;
}
.dice-cfg-row--full .dice-cfg-count,
.dice-cfg-row--full .dice-cfg-mod-value {
  font-size: 20px;
  min-width: 32px;
}
.dice-cfg-minus,
.dice-cfg-plus {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(180,140,60,0.06);
  color: var(--gold);
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
  transition: background 0.12s, border-color 0.12s, transform 0.1s;
}
.dice-cfg-row--full .dice-cfg-minus,
.dice-cfg-row--full .dice-cfg-plus {
  width: 34px;
  height: 34px;
  font-size: 18px;
}
.dice-cfg-minus:hover,
.dice-cfg-plus:hover {
  background: rgba(180,140,60,0.18);
  border-color: var(--border-hi);
}
.dice-cfg-minus:active,
.dice-cfg-plus:active {
  transform: scale(0.9);
}
/* Кнопка режима: сумма (Σ) / раздельно (•••) */
.dice-cfg-mode {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: rgba(180,140,60,0.06);
  color: var(--gold);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  display: grid;
  place-items: center;
  padding: 0;
  line-height: 1;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
  margin-left: auto;
}
.dice-cfg-mode[hidden] { display: none; }
.dice-cfg-row--full .dice-cfg-mode {
  width: 32px;
  height: 32px;
  font-size: 14px;
  margin-left: 0;
  margin-top: 2px;
}
.dice-cfg-mode:hover {
  background: rgba(180,140,60,0.18);
  border-color: var(--border-hi);
}
.dice-cfg-mode--each {
  background: rgba(180,140,60,0.15);
  border-color: var(--gold);
  color: var(--gold-hi);
}

.dice-cfg-row--mod {
  border-top: 1px solid var(--border);
  padding-top: 6px;
  margin-top: 2px;
}
.dice-cfg-row--full.dice-cfg-row--mod {
  border-top: none;
  padding-top: 10px;
  margin-top: 0;
}

/* ─── CONFIGURATOR ACTIONS ───────────────────────────────────── */
.dice-cfg-actions {
  display: flex;
  gap: 6px;
}
.dice-cfg-actions--full {
  justify-content: center;
  gap: 10px;
  margin-bottom: 24px;
}
.dice-cfg-roll {
  flex: 1;
  font-family: 'Cinzel', serif;
  font-size: 13px;
  font-weight: 600;
  color: var(--paper);
  background: linear-gradient(135deg, var(--gold) 0%, var(--gold-dim) 100%);
  border: none;
  border-radius: var(--radius);
  padding: 8px 14px;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}
.dice-cfg-roll:disabled {
  opacity: 0.4;
  cursor: default;
}
.dice-cfg-roll:not(:disabled):hover {
  opacity: 0.9;
  transform: translateY(-1px);
}
.dice-cfg-roll:not(:disabled):active {
  transform: scale(0.97);
}
.dice-cfg-roll--full {
  flex: none;
  font-size: 16px;
  padding: 12px 32px;
  border-radius: var(--radius-lg);
}
.dice-cfg-reset {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.dice-cfg-reset:hover {
  color: var(--gold);
  border-color: var(--border-hi);
}

/* ─── DICE LOG ───────────────────────────────────────────────── */
.dice-log {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.dice-log--floating {
  max-height: 160px;
  overflow-y: auto;
}
.dice-log--full {
  max-height: 60vh;
  overflow-y: auto;
  padding: 0 4px;
}
.dice-log-empty {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 12px 0;
  font-style: italic;
}

.dice-log-row {
  display: grid;
  grid-template-columns: auto auto 1fr auto;
  gap: 6px;
  align-items: baseline;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 13px;
  background: rgba(255,255,255,0.02);
  border: 1px solid transparent;
  transition: opacity 0.2s;
}
.dice-log-row--latest {
  background: rgba(180,140,60,0.06);
  border-color: var(--border);
}

/* Crit / Fail */
.dice-log-row--crit {
  background: rgba(201,168,76,0.12);
  border-color: var(--gold);
}
.dice-log-row--crit .dice-log-total {
  color: var(--gold-hi);
  text-shadow: 0 0 8px rgba(201,168,76,0.4);
}
.dice-log-row--fail {
  background: rgba(180,40,40,0.1);
  border-color: rgba(180,40,40,0.3);
}
.dice-log-row--fail .dice-log-total {
  color: #e05555;
}

.dice-log-label {
  display: block;
  color: var(--accent);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 1px;
  opacity: 0.85;
}
.dice-log-formula {
  color: var(--muted);
  font-family: 'Cinzel', serif;
  font-size: 11px;
  letter-spacing: 0.02em;
}
.dice-log-eq {
  color: var(--muted);
  opacity: 0.5;
}
.dice-log-total {
  font-family: 'Cinzel', serif;
  font-weight: 700;
  font-size: 16px;
  color: var(--gold);
}
.dice-log-details {
  color: var(--muted);
  font-size: 11px;
  text-align: right;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Individual roll values */
.dice-val--crit { color: var(--gold-hi); font-weight: 700; }
.dice-val--fail { color: #e05555; font-weight: 700; }
.dice-val--max  { color: var(--gold); }

.dice-detail-group { margin-right: 4px; }
.dice-detail-mod { color: var(--muted); opacity: 0.7; }

/* Grouped rolls (sum + each в одном броске) */
.dice-log-group {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  background: rgba(255,255,255,0.01);
}
.dice-log-group--latest {
  border-color: var(--border-hi);
  background: rgba(180,140,60,0.04);
}
.dice-log-group-header {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  color: var(--muted);
  padding: 4px 8px 2px;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--border);
}
.dice-log-row--grouped {
  border: none;
  border-radius: 0;
  background: transparent;
}
.dice-log-row--grouped + .dice-log-row--grouped {
  border-top: 1px solid rgba(180,140,60,0.06);
}

/* ─── FULL SCREEN MODULE ─────────────────────────────────────── */
.dice-full-body {
  margin-top: 24px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}
.dice-log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.dice-log-title {
  font-family: 'Cinzel', serif;
  font-size: 12px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.dice-clear-btn {
  font-family: 'Cinzel', serif;
  font-size: 11px;
  color: var(--muted);
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 4px 10px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.dice-clear-btn:hover {
  color: var(--gold);
  border-color: var(--border-hi);
}

/* ─── PRINT: hide dice FAB ───────────────────────────────────── */
@media print {
  .dice-fab,
  .dice-floating-panel { display: none !important; }
}

/* ─── RESPONSIVE ─────────────────────────────────────────────── */
@media (max-width: 720px) {
  .dice-fab {
    bottom: 16px;
    right: 16px;
    width: 48px;
    height: 48px;
  }
  .dice-floating-panel {
    bottom: 76px;
    right: 16px;
    width: 260px;
  }
  .dice-cfg--full {
    grid-template-columns: repeat(2, 1fr);
  }
}
