/* ── Герой ──────────────────────────────────────────────────────────────── */
.hero-head { margin-bottom: 8px; }
.hero-name { font-family: var(--font-title); font-size: 17px; color: var(--gold); letter-spacing: 2px; }
.hero-class { font-size: 11px; color: var(--text-dim); margin-top: 2px; }

.stats-grid { display: flex; flex-direction: column; gap: 3px; }
.stat {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 6px;
  background: rgba(255, 255, 255, 0.015);
  border-left: 2px solid transparent;
  font-size: 12px;
}
.stat.main { border-left-color: var(--gold); background: rgba(201, 161, 63, 0.06); }
.stat-name { color: var(--text-dim); }
.stat-value { font-family: var(--font-mono); color: #e6dbc8; }
.stat-tag {
  font-size: 9px; letter-spacing: 1px; text-transform: uppercase;
  color: var(--gold-dim); border: 1px solid var(--gold-dim); padding: 0 4px; border-radius: 2px;
}

/* ── Зона и карта уровней ───────────────────────────────────────────────── */
.zone-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.zone-name { font-family: var(--font-title); font-size: 16px; letter-spacing: 1px; }
.zone-level { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }
.zone-controls { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

.level-map {
  margin-top: 12px;
  max-height: 260px;
  overflow-y: auto;
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
}
.map-zone { margin-bottom: 10px; }
.map-zone-name { font-size: 10px; letter-spacing: 2px; text-transform: uppercase; margin-bottom: 4px; }
.map-cells { display: grid; grid-template-columns: repeat(10, 24px); gap: 3px; }
.map-cell {
  width: 24px;
  height: 24px;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 10px;
  background: #12101a;
  color: var(--text-dim);
  border: 1px solid var(--line-soft);
  border-radius: 2px;
  cursor: pointer;
  padding: 0;
}
.map-cell:hover { border-color: var(--gold-dim); color: var(--gold); }
.map-cell.locked { opacity: 0.28; cursor: not-allowed; }
.map-cell.current { border-color: var(--gold); color: var(--gold); box-shadow: 0 0 8px rgba(201, 161, 63, 0.4); }
.map-cell.boss { color: var(--blood-bright); border-color: #3a1614; }
.map-cell.boss.done { color: var(--green); border-color: #1e3a1e; }
.map-footer { font-size: 10px; color: var(--text-faint); text-align: center; padding-top: 4px; }

/* ── Способности ────────────────────────────────────────────────────────── */
.skillbar { display: flex; flex-direction: column; gap: 8px; }
.skill-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.skill {
  position: relative;
  width: 52px; height: 52px;
  padding: 0;
  background: linear-gradient(180deg, #1b1622, #0e0b12);
  border: 1px solid var(--line);
  border-radius: 3px;
  cursor: pointer;
  overflow: hidden;
}
.skill.ready { border-color: var(--gold-dim); box-shadow: 0 0 12px rgba(201, 161, 63, 0.18); }
.skill:hover { border-color: var(--gold); }
.skill.active { border-color: #8ab6ff; box-shadow: 0 0 14px rgba(138, 182, 255, 0.55); }
.skill.urgent { animation: urgentPulse 0.7s ease-in-out infinite; }
@keyframes urgentPulse {
  0%, 100% { border-color: var(--gold-dim); box-shadow: 0 0 6px rgba(255, 90, 60, 0.2); }
  50% { border-color: #ff6a4a; box-shadow: 0 0 18px rgba(255, 90, 60, 0.8); }
}
.skill-icon {
  position: absolute; left: 50%; top: 46%;
  transform: translate(-50%, -50%);
  image-rendering: pixelated;
}
.skill-cd {
  position: absolute; left: 0; bottom: 0; width: 100%;
  background: rgba(6, 4, 10, 0.72);
  transition: height 0.08s linear;
  pointer-events: none;
}
.skill-cd-text {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-mono); font-size: 14px; color: #e6dbc8;
  text-shadow: 0 1px 3px #000;
  pointer-events: none;
}
.skill-key {
  position: absolute; right: 3px; bottom: 2px;
  font-family: var(--font-mono); font-size: 9px; color: var(--text-faint);
}
.skill-hint { font-size: 11px; color: var(--text-faint); flex: 1 1 160px; }

/* ── Кукла персонажа ────────────────────────────────────────────────────── */
.paperdoll {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(5, 1fr);
  gap: 6px;
  max-width: 250px;
  margin: 0 auto;
}
.slot {
  position: relative;
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 50% 30%, #191320, #0d0b12);
  border: 1px solid var(--line);
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.slot:not(.empty) {
  border-color: var(--rarity);
  box-shadow: inset 0 0 14px var(--rarity-glow);
}
.slot:hover { border-color: var(--gold); }
.slot .icon { image-rendering: pixelated; }
.slot-label {
  font-size: 9px;
  letter-spacing: 1px;
  color: var(--text-faint);
  text-transform: uppercase;
  text-align: center;
  padding: 0 2px;
}

/* ── Сумка ──────────────────────────────────────────────────────────────── */
.inv-toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.inv-count { margin-left: auto; font-family: var(--font-mono); font-size: 11px; color: var(--text-faint); }
.inv-filters { display: flex; gap: 4px; flex-wrap: wrap; margin-bottom: 8px; }

.inv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 5px;
  max-height: 320px;
  overflow-y: auto;
  padding-right: 4px;
}
/*
 * Ячейка сумки красится в качество целиком: рамка, подложка и полоса снизу.
 * Раньше рарность было видно только по цвету самой иконки — в куче из сорока
 * предметов это не читалось.
 */
.inv-cell {
  position: relative;
  aspect-ratio: 1;
  display: flex; align-items: center; justify-content: center;
  background:
    radial-gradient(circle at 50% 118%, var(--rarity-glow), transparent 72%),
    radial-gradient(circle at 50% 30%, #191320, #0d0b12);
  border: 2px solid var(--rarity);
  box-shadow: inset 0 0 14px var(--rarity-glow);
  border-radius: 2px;
  cursor: pointer;
}
/* Полоса качества снизу — рарность ловится боковым зрением. */
.inv-cell::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: 0;
  height: 3px;
  background: var(--rarity);
}
.inv-cell:hover { filter: brightness(1.25); }
.inv-cell .icon { image-rendering: pixelated; position: relative; z-index: 1; }
.inv-badge {
  position: absolute; z-index: 2; right: 3px; bottom: 4px;
  display: flex; gap: 2px; align-items: baseline;
  font-family: var(--font-mono); font-size: 10px;
  color: #efe5d2; text-shadow: 0 1px 2px #000;
}
.inv-badge-worn { color: var(--gold); font-size: 9px; }
.inv-merge-mark {
  position: absolute; z-index: 2; left: 2px; top: 0;
  font-size: 11px; color: var(--gold);
  text-shadow: 0 0 6px rgba(201, 161, 63, 0.8);
}
.inv-cell.mergeable { animation: mergeGlow 2.2s ease-in-out infinite; }
@keyframes mergeGlow {
  0%, 100% { box-shadow: inset 0 0 14px var(--rarity-glow); }
  50% { box-shadow: inset 0 0 14px var(--rarity-glow), 0 0 10px rgba(201, 161, 63, 0.5); }
}
.inv-empty { grid-column: 1 / -1; color: var(--text-faint); font-size: 11px; padding: 14px 0; text-align: center; }

/* ── Хроника ────────────────────────────────────────────────────────────── */
.panel-log .log-list {
  max-height: 150px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.log-line {
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 2px 4px;
  border-left: 2px solid rgba(255, 255, 255, 0.06);
  animation: logIn 0.25s ease-out;
}
@keyframes logIn { from { opacity: 0; transform: translateX(-6px); } to { opacity: 1; transform: none; } }

/* ── Тултип предмета ────────────────────────────────────────────────────── */
.tooltip {
  position: fixed;
  z-index: 700;
  width: 260px;
  background: rgba(12, 10, 16, 0.98);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 10px 12px;
  pointer-events: none;
  font-size: 12px;
}
.tt-head { display: flex; gap: 10px; align-items: center; margin-bottom: 6px; }
.tt-icon { image-rendering: pixelated; }
.tt-name { font-family: var(--font-title); font-size: 14px; letter-spacing: 1px; }
.tt-sub { font-size: 10.5px; color: var(--text-faint); margin-top: 2px; }
.tt-type { font-size: 11px; color: var(--text-dim); margin-bottom: 4px; }
.tt-stat { display: flex; gap: 6px; align-items: baseline; font-family: var(--font-mono); font-size: 11.5px; }
.tt-label { color: var(--text-dim); flex: 1; }
.tt-value { color: #e6dbc8; }
.tt-delta.better { color: var(--green); }
.tt-delta.worse { color: var(--blood-bright); }
.tt-divider { height: 1px; background: var(--line-soft); margin: 7px 0; }
.tt-affix { font-family: var(--font-mono); font-size: 11.5px; padding: 1px 0; }
.tt-compare { font-size: 11px; }
.tt-compare.better { color: var(--green); }
.tt-compare.worse { color: var(--blood-bright); }
.tt-equipped { font-size: 10.5px; color: var(--text-faint); margin-top: 2px; }
.tt-merge { font-family: var(--font-mono); font-size: 11px; color: var(--text-dim); }
.tt-merge.ready { color: var(--gold); }
.tt-hint { margin-top: 8px; font-size: 10px; color: var(--text-faint); border-top: 1px solid var(--line-soft); padding-top: 6px; }

/* ── Скроллбары ─────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: #0b0910; }
::-webkit-scrollbar-thumb { background: #241d2c; border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: #362b42; }

/* ── Меню баланса (отладочное) ───────────────────────────────────────────── */
.balance-panel {
  position: fixed;
  right: 0;
  /* Ниже шапки — иначе панель перекрывает собственную кнопку и «Удалить сейвы». */
  top: 58px;
  bottom: 0;
  width: 400px;
  max-width: 92vw;
  z-index: 620;
  background: linear-gradient(180deg, #16121d, #0d0b12);
  border-left: 1px solid var(--line);
  box-shadow: -14px 0 40px rgba(0, 0, 0, 0.7);
  padding: 14px 16px 20px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.balance-head {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
  position: sticky;
  top: -14px;
  background: linear-gradient(180deg, #16121d 70%, transparent);
  padding-top: 6px;
  z-index: 2;
}
.balance-head .panel-title { margin: 0; border: 0; padding: 0; flex: 1 1 auto; }
.balance-counter { font-family: var(--font-mono); font-size: 10px; color: var(--text-faint); }
.balance-counter.active { color: var(--gold); }
.balance-note { font-size: 10.5px; color: var(--text-faint); line-height: 1.5; margin: 0 0 6px; }

.balance-group { border: 1px solid var(--line-soft); border-radius: 3px; background: rgba(255, 255, 255, 0.012); }
.balance-group > summary {
  cursor: pointer;
  padding: 7px 10px;
  font-size: 11px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--gold-dim);
  list-style: none;
}
.balance-group > summary::marker { content: ''; }
.balance-group > summary::before { content: '▸ '; color: var(--text-faint); }
.balance-group[open] > summary::before { content: '▾ '; }
.balance-fields { padding: 4px 10px 10px; display: flex; flex-direction: column; gap: 9px; }

.balance-row { border-left: 2px solid transparent; padding-left: 6px; }
.balance-row.changed { border-left-color: var(--gold); }
.balance-label { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.balance-name { font-size: 11.5px; color: var(--text); }
.balance-default { font-family: var(--font-mono); font-size: 9.5px; color: var(--text-faint); white-space: nowrap; }
.balance-controls { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.balance-range { flex: 1; accent-color: var(--gold-dim); height: 14px; }
.balance-number {
  width: 78px;
  background: #0b0910;
  border: 1px solid var(--line);
  color: #e6dbc8;
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 3px 4px;
  border-radius: 2px;
}
.balance-hint { display: block; font-size: 10px; color: var(--text-faint); margin-top: 2px; line-height: 1.4; }
.chip.balance-toggle.active { border-color: var(--gold); color: var(--gold); }

/* ── Подсказка по характеристике ─────────────────────────────────────────── */
.stat { cursor: help; }
.stat:hover { background: rgba(201, 161, 63, 0.08); }
.stat-tip {
  position: fixed;
  z-index: 720;
  width: 250px;
  background: rgba(12, 10, 16, 0.98);
  border: 1px solid var(--line);
  border-left: 2px solid var(--gold-dim);
  box-shadow: var(--shadow);
  padding: 9px 11px;
  pointer-events: none;
  font-size: 11.5px;
  line-height: 1.55;
  color: var(--text-dim);
}
.stat-tip b { color: var(--gold); display: block; margin-bottom: 3px; font-weight: normal; letter-spacing: 1px; }
.stat-tip .stat-tip-formula {
  display: block;
  margin-top: 5px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-faint);
  border-top: 1px solid var(--line-soft);
  padding-top: 5px;
}

/* ── Кузница ─────────────────────────────────────────────────────────────── */
.chip.forge-toggle.active { border-color: #8a4dff; color: #b98cff; }

.inv-cell.is-set { border-style: double; border-width: 3px; }
.inv-set-mark {
  position: absolute; z-index: 2; left: 2px; top: 1px;
  font-family: var(--font-mono); font-size: 9px;
  color: #c6a4ff;
  text-shadow: 0 0 6px rgba(138, 77, 255, 0.9), 0 1px 2px #000;
}

.forge-panel {
  position: fixed;
  inset: 58px 0 0;
  z-index: 640;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px 18px 20px;
  background: linear-gradient(180deg, rgba(9, 7, 13, 0.97), rgba(6, 5, 9, 0.99));
  backdrop-filter: blur(2px);
  overflow-y: auto;
}
.forge-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
  max-width: 1100px; width: 100%; margin: 0 auto;
}
.forge-head .panel-title { margin: 0; border: 0; padding: 0; color: #b98cff; }

.forge-body {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  max-width: 1100px; width: 100%; margin: 0 auto;
  align-items: start;
}
@media (max-width: 820px) {
  .forge-body { grid-template-columns: 1fr; }
}

.forge-col {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 12px 14px 14px;
  display: flex; flex-direction: column; gap: 10px;
}

.forge-picker { display: flex; gap: 5px; flex-wrap: wrap; }
.forge-pick {
  background: #0f0c14;
  border: 1px solid var(--line);
  border-radius: 2px;
  padding: 3px;
  cursor: pointer;
  line-height: 0;
}
.forge-pick.active { border-color: #8a4dff; box-shadow: 0 0 10px rgba(138, 77, 255, 0.45); }
.forge-pick canvas { image-rendering: pixelated; }

.forge-target {
  display: flex; align-items: center; gap: 12px;
  padding: 10px;
  border: 2px solid var(--rarity);
  border-radius: 2px;
  background:
    radial-gradient(circle at 50% 120%, var(--rarity-glow), transparent 75%),
    #100d16;
}
.forge-target canvas { image-rendering: pixelated; }
.forge-target-name { font-family: var(--font-title); font-size: 15px; letter-spacing: 1px; }
.forge-target-sub { font-size: 10.5px; color: var(--text-faint); margin-top: 3px; line-height: 1.5; }

.forge-level-row { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 4px; }
.forge-level-row b { color: #c6a4ff; font-weight: normal; letter-spacing: 1px; }
.forge-level-max { font-size: 10px; color: var(--text-faint); }
.bar-fill.forge-fill { background: linear-gradient(180deg, #8a4dff, #3d1a7a); }
.forge-hint { font-size: 10.5px; color: var(--text-faint); line-height: 1.5; margin-top: 5px; }

.forge-affixes { display: flex; flex-direction: column; gap: 3px; }
.forge-affix {
  display: flex; align-items: baseline; justify-content: space-between; gap: 8px;
  font-size: 11.5px;
  padding: 2px 4px;
  border-left: 2px solid transparent;
}
.forge-affix.by-class { border-left-color: #8a4dff; background: rgba(138, 77, 255, 0.07); }
.forge-affix-tag { font-size: 9px; color: #8a6ac0; letter-spacing: 1px; text-transform: uppercase; }

.forge-tools { display: flex; gap: 5px; flex-wrap: wrap; }
.forge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(46px, 1fr));
  gap: 5px;
  max-height: 46vh;
  overflow-y: auto;
  padding-right: 4px;
}
.forge-cell { position: relative; }
.forge-cell.picked {
  outline: 2px solid #c9a13f;
  outline-offset: -2px;
  filter: brightness(1.3);
}
.forge-cell.is-set { border-style: double; border-width: 3px; }
.forge-xp {
  position: absolute; z-index: 2; right: 2px; bottom: 4px;
  font-family: var(--font-mono); font-size: 8.5px;
  color: #c6a4ff; text-shadow: 0 1px 2px #000;
}
.forge-mark {
  position: absolute; z-index: 2; left: 2px; top: 0;
  font-size: 11px; color: var(--gold);
  text-shadow: 0 0 6px rgba(201, 161, 63, 0.8);
}

.forge-summary {
  border-top: 1px solid var(--line-soft);
  padding-top: 10px;
  display: flex; flex-direction: column; gap: 6px;
}
.forge-summary-row { display: flex; align-items: baseline; justify-content: space-between; font-size: 12px; }
.forge-gain { color: #c6a4ff; font-family: var(--font-mono); }
.forge-go { align-self: flex-start; }
.forge-empty { max-width: 560px; margin: 30px auto; text-align: center; color: var(--text-dim); line-height: 1.7; }

/* ── Комплектное в подсказке ─────────────────────────────────────────────── */
.tt-set {
  display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  margin: 6px 0 2px;
  padding: 4px 6px;
  border: 1px solid #3d1a7a;
  background: rgba(138, 77, 255, 0.1);
  font-size: 11px;
  color: #c6a4ff;
}
.tt-set-xp { font-family: var(--font-mono); font-size: 10px; color: #8a6ac0; }
.tt-affix.by-class { display: flex; align-items: baseline; gap: 5px; }
.tt-affix-tag { font-size: 9px; color: #8a6ac0; letter-spacing: 0.5px; }

/* ── Сравнение по Shift ──────────────────────────────────────────────────── */
.tooltip-compare { opacity: 0.97; }
.tt-compare-head {
  font-size: 9px;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--text-faint);
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 5px;
  margin-bottom: 7px;
}
.tt-hint-shift { color: var(--text-faint); }
.tt-hint-shift.on { color: var(--gold-dim); }

/* Метка «по классу» не должна ломать строку характеристики. */
.tt-affix.by-class > span:first-child,
.forge-affix > span:first-child { flex: 1; min-width: 0; }
.tt-affix-tag, .forge-affix-tag { white-space: nowrap; flex: 0 0 auto; }
