:root {
  --bg: #0e1116;
  --bg-2: #161a21;
  --bg-3: #1f242d;
  --border: rgba(255, 255, 255, .07);
  --text: #e9ecf1;
  --muted: #8c95a6;
  --accent: #7c8cff;
  --accent-2: #a5b0ff;
  --hover: #262c37;
  --r-common: #9aa3ad;
  --r-uncommon: #4ec96a;
  --r-rare: #4f8dff;
  --r-epic: #b05cff;
  --r-exotic: #ff9f2e;
  --r-mythical: #ff4d5e;
  --r-founder: #22d3c5;
  --radius: 14px;
  --chip-active-text: #fff;
  --sb-w: 224px;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f5f6fa;
  --bg-2: #ffffff;
  --bg-3: #eef0f5;
  --border: rgba(20, 24, 40, .08);
  --text: #171b26;
  --muted: #646d80;
  --accent: #4f5ee8;
  --accent-2: #3e4bd0;
  --hover: #e5e8f0;
  --r-common: #6b7480;
  --r-uncommon: #2f9e4a;
  --r-rare: #2f6fe0;
  --r-epic: #8a3fe0;
  --r-exotic: #e07a0c;
  --r-mythical: #e03445;
  --r-founder: #0f9c92;
  --chip-active-text: #fff;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
  display: flex; flex-direction: column;
  padding-left: var(--sb-w);
}
body.sb-collapsed { --sb-w: 60px; }
a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, select, input { font: inherit; color: inherit; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 16px;
  padding: 10px 20px;
  background: var(--bg-2);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 16px; color: var(--text); display: flex; gap: 8px; align-items: center; white-space: nowrap; min-width: 0; overflow: hidden; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 32px; height: 32px; border-radius: 50%; flex: none; display: block; }
.topbar .brand-logo, .topbar .brand-title { display: none; }
.brand-page { overflow: hidden; text-overflow: ellipsis; }
.topbar .brand-page { transition: opacity .15s, visibility .15s; }
body.title-in-view .topbar .brand-page { opacity: 0; visibility: hidden; }   /* заголовок страницы на экране — в шапке не повторяем (core.js, watchPageTitle) */
.topbar-right { margin-left: auto; display: flex; gap: 6px; flex: none; }
.menu-btn { display: none; }

/* ---------- боковое меню ---------- */
.sidebar { position: fixed; left: 0; top: 0; bottom: 0; width: var(--sb-w); z-index: 30; display: flex; flex-direction: column;
  background: var(--bg-2); border-right: 1px solid var(--border); overflow: hidden auto; scrollbar-width: thin; }
.sb-brand { display: flex; align-items: center; gap: 10px; padding: 14px 14px 8px; color: var(--text); font-weight: 800; font-size: 16px; letter-spacing: -.01em; white-space: nowrap; }
.sb-brand:hover { text-decoration: none; }
.sb-brand .brand-logo { width: 32px; height: 32px; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 10px 10px; }
.nav-group { display: flex; align-items: center; gap: 8px; margin: 16px 10px 6px; font-size: 10.5px; font-weight: 800; letter-spacing: .14em; text-transform: uppercase; color: var(--accent); white-space: nowrap; }
.nav-group:first-child { margin-top: 6px; }
.nav-group::after { content: ''; flex: 1; height: 1px; background: color-mix(in srgb, var(--accent) 35%, var(--border)); }
.nav a { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: 10px; color: var(--muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
.nav a .nav-ico { width: 22px; flex: none; text-align: center; font-size: 16px; line-height: 1; }
.nav a:hover { text-decoration: none; color: var(--text); background: var(--bg-3); }
.nav a.active { color: var(--accent); background: color-mix(in srgb, var(--accent) 18%, transparent); }
.sb-toggle { margin: auto 10px 12px; display: flex; align-items: center; gap: 10px; padding: 7px 10px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font: inherit; font-size: 12px; cursor: pointer; white-space: nowrap; }
.sb-toggle:hover { background: var(--bg-3); color: var(--text); }
.sb-toggle-ico { width: 22px; text-align: center; font-size: 16px; line-height: 1; }
.sb-overlay { display: none; position: fixed; inset: 0; background: rgba(0, 0, 0, .5); z-index: 29; }
body.sb-collapsed .sb-title, body.sb-collapsed .nav-group, body.sb-collapsed .nav a .nav-lbl, body.sb-collapsed .sb-toggle-lbl { display: none; }
body.sb-collapsed .sb-brand { padding: 14px 0 8px; justify-content: center; }
body.sb-collapsed .nav { padding: 4px 8px 10px; }
body.sb-collapsed .nav a { justify-content: center; padding: 8px 0; }
body.sb-collapsed .sb-toggle { margin: auto 8px 12px; justify-content: center; padding: 8px 0; }
body.sb-collapsed .sb-toggle-ico { transform: scaleX(-1); }

.container { flex: 1; width: 100%; max-width: 1400px; margin: 0 auto; padding: 20px; }
.footer { padding: 14px 20px; color: var(--muted); font-size: 12px; border-top: 1px solid var(--border); text-align: center; }
.footer-note { max-width: 900px; margin: 4px auto 0; font-size: 11px; opacity: .8; }
.loading { color: var(--muted); padding: 40px; text-align: center; }

.btn {
  background: var(--bg-3); border: 1px solid var(--border); color: var(--text);
  padding: 7px 12px; border-radius: 8px; cursor: pointer;
}
.btn:hover { border-color: var(--muted); }
.btn.active { background: var(--accent); color: #1a1200; border-color: var(--accent); font-weight: 600; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 4px 9px; font-size: 12px; }

/* filters */
.filters {
  display: flex; flex-wrap: wrap; gap: 10px; align-items: center;
  padding: 12px; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius);
  margin-bottom: 16px;
}
.filters input[type=search], .filters select {
  background: var(--bg-3); border: 1px solid var(--border); border-radius: 8px; padding: 7px 10px; color: var(--text);
}
.filters input[type=search] { min-width: 220px; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip {
  border: 1px solid var(--border); background: var(--bg-3); color: var(--muted);
  padding: 4px 10px; border-radius: 999px; cursor: pointer; font-size: 12px; font-weight: 600;
}
.chip:hover { color: var(--text); }
.chip.active { color: var(--chip-active-text); border-color: var(--c, var(--accent)); background: color-mix(in srgb, var(--c, var(--accent)) 25%, var(--bg-3)); }
.filters .spacer { flex: 1; }
.filters-end { display: flex; gap: 8px; align-items: center; }
/* панель фильтров списка (предметы, сеты — W.filtersBarHtml): стоит над списком, который прокручивается внутри (#app.fill);
   на мобильном сворачивается в строку «поиск + Фильтры» */
.filters-bar { position: relative; z-index: 10; }
.filters-toggle { display: none; }
.filters-more { display: contents; }
.filters-n { background: var(--accent); color: #1a1200; border-radius: 999px; padding: 0 6px; font-size: 11px; font-weight: 700; line-height: 16px; }
.count { color: var(--muted); font-size: 13px; }

/* rarity colors */
.rar-common { --c: var(--r-common); }
.rar-uncommon { --c: var(--r-uncommon); }
.rar-rare { --c: var(--r-rare); }
.rar-epic { --c: var(--r-epic); }
.rar-exotic { --c: var(--r-exotic); }
.rar-mythical { --c: var(--r-mythical); }
.rar-founder { --c: var(--r-founder); }
.rarity-text { color: var(--c); font-weight: 600; text-transform: capitalize; }

/* grid */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.card {
  display: flex; gap: 12px; padding: 12px;
  background: var(--bg-2); border: 1px solid var(--border); border-left: 3px solid var(--c, var(--border));
  border-radius: var(--radius); color: var(--text); cursor: pointer;
  transition: transform .08s, border-color .08s;
}
.card:hover { text-decoration: none; transform: translateY(-2px); border-color: var(--c); }
.thumb {
  width: 64px; height: 64px; flex: none; border-radius: 8px;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--c, #555) 35%, transparent), var(--bg-3) 75%);
  display: flex; align-items: center; justify-content: center; font-size: 30px;
  border: 1px solid color-mix(in srgb, var(--c, var(--border)) 50%, var(--border));
}
.thumb img, .thumb .thumb-img { width: 56px; height: 56px; object-fit: contain; image-rendering: auto; }
.thumb.lg { width: 140px; height: 140px; font-size: 64px; }
.thumb.lg img, .thumb.lg .thumb-img { width: 120px; height: 120px; }
.thumb-col { display: flex; flex-direction: column; align-items: center; gap: 3px; flex: none; }
.thumb-id { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.card-body { min-width: 0; flex: 1; }
.card-title { font-weight: 700; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sub { color: var(--muted); font-size: 12px; margin-bottom: 4px; }
.card-power { color: var(--accent); font-weight: 700; font-size: 12px; }
.stat-list { list-style: none; margin: 4px 0 0; padding: 0; font-size: 12px; color: var(--muted); }
.stat-list li { display: flex; justify-content: space-between; gap: 8px; }
.stat-list li b { color: var(--text); font-weight: 600; }

/* table */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-2); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--border); white-space: nowrap; }
th { background: var(--bg-3); color: var(--muted); font-weight: 600; position: sticky; top: 0; user-select: none; }
th[data-sort] { cursor: pointer; }
th.sorted { color: var(--accent); }
/* список с панелью фильтров (#app.fill): страница не прокручивается — плитка или таблица занимает остаток экрана
   и прокручивается внутри; шапка таблицы (и первая колонка на мобильном) липнут средствами CSS */
.container.fill { display: flex; flex-direction: column; flex: none; height: calc(100vh - var(--topbar-h, 0px)); height: calc(100dvh - var(--topbar-h, 0px)); }
.container.fill > * { flex: none; }
.container.fill .table-wrap.table-sticky, .container.fill .grid { flex: 0 1 auto; min-height: 140px; overflow: auto; }
.container.fill .table-wrap.table-sticky { isolation: isolate; }
/* таблица предметов: колонка «иконка + название» закреплена слева на любой ширине */
#itemsTable td.name .mini { float: left; margin: -4px 8px -4px 0; }
#itemsTable td.name .nm { display: block; overflow: hidden; }
html #itemsTable th:first-child, html #itemsTable td:first-child { position: sticky; left: 0; z-index: 1; background: var(--bg-2); box-shadow: 1px 0 0 var(--border); }
html #itemsTable th:first-child { z-index: 3; }
.container.fill .grid { padding: 3px 3px 6px; margin: -3px -3px 0; }   /* запас под сдвиг карточки при наведении и под скроллбар */
th.num, td.num { text-align: right; }
tbody tr:hover { background: var(--bg-3); }
tbody tr:last-child td { border-bottom: none; }
td.name a { color: var(--text); font-weight: 600; }
.mini { width: 32px; height: 32px; vertical-align: middle; object-fit: contain; }
.dim { color: var(--muted); }

/* detail */
.detail-head { display: flex; gap: 20px; align-items: flex-start; margin-bottom: 20px; flex-wrap: wrap; }
.detail-head h1 { margin: 0 0 6px; font-size: 24px; }
.meta { display: flex; gap: 14px; flex-wrap: wrap; color: var(--muted); font-size: 13px; }
.meta b { color: var(--text); }
.badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
/* Иконка стата перед названием (Wiki.statIcon): размер от шрифта контекста */
/* Иконки из игры (Wiki.gameIcon): картинка или одноцветная маска цветом текста; размер от шрифта */
.gi { display: inline-block; width: 1.25em; height: 1.25em; object-fit: contain; vertical-align: -0.28em; flex: none; }
.gi-m { background: currentColor; -webkit-mask: var(--gi) center / contain no-repeat; mask: var(--gi) center / contain no-repeat; }
.gi-stars { background: #f5b400; }
.nav a .nav-ico .gi { width: 20px; height: 20px; vertical-align: middle; }
.stat-ic { width: 1.3em; height: 1.3em; object-fit: contain; vertical-align: -0.3em; margin-right: 0.25em; flex: none; }
:root[data-theme="light"] .stat-ic-power { filter: invert(1); }
.badge { font-size: 11px; padding: 2px 8px; border-radius: 999px; background: var(--bg-3); border: 1px solid var(--border); color: var(--muted); }
.badge.warn { color: var(--r-mythical); border-color: color-mix(in srgb, var(--r-mythical) 50%, var(--border)); }
.badge.ability { color: var(--accent-2); border-color: color-mix(in srgb, var(--accent) 50%, var(--border)); }
.cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.cols > * { min-width: 0; }
@media (max-width: 900px) { .cols { grid-template-columns: 1fr; } }
.panel { min-width: 0; background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.panel h2 { margin: 0 0 10px; font-size: 15px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.stats-big { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 6px 14px; }
.stats-big li { display: flex; justify-content: space-between; padding: 6px 8px; background: var(--bg-3); border-radius: 6px; }
.stats-big li b { color: var(--accent-2); }
.back { display: inline-block; margin-bottom: 12px; color: var(--muted); }
.level-table td.cost { color: var(--r-epic); }
.item-row { display: flex; align-items: center; gap: 10px; padding: 6px 0; border-bottom: 1px solid var(--border); }
.item-row:last-child { border-bottom: none; }
.item-row .mini { width: 36px; height: 36px; }
.item-row.current { background: color-mix(in srgb, var(--accent) 10%, transparent); border-radius: 6px; padding-left: 6px; }
.item-row .r-name { font-weight: 600; color: var(--text); }
.item-row .r-sub { font-size: 12px; color: var(--muted); }

/* sets list */
.set-card { background: var(--bg-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.set-card h3 { margin: 0; font-size: 15px; }
.set-card h3 a { color: var(--text); }
.set-thumbs { display: flex; gap: 4px; flex-wrap: wrap; }
.set-thumbs .thumb { width: 44px; height: 44px; font-size: 20px; }
.set-thumbs .thumb img, .set-thumbs .thumb .thumb-img { width: 38px; height: 38px; }
.bonus-list { list-style: none; margin: 0; padding: 0; font-size: 12px; color: var(--muted); }
.bonus-list li { display: flex; gap: 8px; }
.bonus-list .n { color: var(--accent); font-weight: 700; min-width: 34px; }
.bonus-list b { color: var(--text); font-weight: 600; }
.empty { color: var(--muted); padding: 30px; text-align: center; }
kbd { background: var(--bg-3); border: 1px solid var(--border); border-radius: 4px; padding: 0 5px; font-size: 11px; }

/* shared extras */
.reward { display: inline-block; padding: 2px 8px; margin: 2px 2px 2px 0; border-radius: 6px; background: var(--bg-3); border: 1px solid var(--border); font-size: 12px; white-space: nowrap; }
.reward .rarity-text { text-transform: none; }
.page-title { margin: 0 0 14px; font-size: 22px; }
.page-title small { color: var(--muted); font-weight: 400; font-size: 14px; margin-left: 8px; }
.note { color: var(--muted); font-size: 12px; margin-top: 8px; }
.thumb.set-pending { opacity: .55; }
.page-disclaimer { color: var(--muted); font-size: 13px; margin: -6px 0 14px; max-width: 900px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
h3.sub { margin: 14px 0 8px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }

/* ---------- mobile ---------- */
html { -webkit-text-size-adjust: 100%; }
@media (max-width: 900px) {
  /* боковое меню становится выдвижной панелью */
  body, body.sb-collapsed { --sb-w: 0px; padding-left: 0; }
  .sidebar { width: 260px; transform: translateX(-100%); transition: transform .18s; box-shadow: none; }
  body.nav-open .sidebar { transform: none; box-shadow: 0 0 40px rgba(0, 0, 0, .4); }
  body.nav-open .sb-overlay { display: block; }
  body.nav-open { position: fixed; left: 0; right: 0; overflow: hidden; }   /* top задаёт core.js: -scrollY, чтобы страница не прыгала */
  .sidebar { overscroll-behavior: contain; }
  .sb-overlay { touch-action: none; }
  body.sb-collapsed .sb-title, body.sb-collapsed .nav a .nav-lbl { display: initial; }
  body.sb-collapsed .nav-group { display: flex; }
  body.sb-collapsed .nav a { justify-content: flex-start; padding: 9px 10px; }
  body.sb-collapsed .sb-brand { padding: 14px 14px 8px; justify-content: flex-start; }
  .sb-toggle { display: none; }
  .nav a { padding: 9px 10px; font-size: 14px; }
  .topbar { gap: 8px; padding: 8px 12px; }
  .topbar .brand-logo { display: block; }
  .menu-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 34px; padding: 0; font-size: 18px; line-height: 1; flex: none; }
}
@media (max-width: 700px) {
  .container { padding: 12px 10px; }
  input, select, textarea { font-size: 16px; }   /* iOS увеличивает страницу при фокусе на поле мельче 16 px */
  .chip, .btn-sm { min-height: 36px; display: inline-flex; align-items: center; justify-content: center; }
  .footer { padding: 12px 10px; }
  .page-title { font-size: 20px; margin-bottom: 10px; }
  .page-title small { display: block; margin: 2px 0 0; font-size: 13px; }
  .detail-head { gap: 14px; margin-bottom: 14px; }
  .detail-head h1 { font-size: 20px; }
  .thumb.lg { width: 110px; height: 110px; font-size: 52px; }
  .thumb.lg img, .thumb.lg .thumb-img { width: 92px; height: 92px; }
  .panel { padding: 12px 10px; }
  .cols { gap: 12px; }
  /* фильтры: поиск во всю ширину, выпадающие списки по два в ряд, чипсы одной прокручиваемой строкой */
  .filters { padding: 10px; gap: 8px; margin-bottom: 12px; }
  .filters input[type=search] { min-width: 0; flex: 1 1 100%; width: 100%; font-size: 16px; }
  .filters select { flex: 1 1 calc(50% - 4px); min-width: 0; max-width: 100%; font-size: 16px; padding: 8px 10px; }
  .filters .chips { flex: 1 1 100%; width: 100%; flex-wrap: nowrap; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
  .filters .chips::-webkit-scrollbar { display: none; }
  .filters .chip { flex: none; }
  .chip { padding: 6px 12px; font-size: 13px; }
  .filters .spacer { display: none; }
  .filters .count { margin-left: auto; }
  .filters-end { margin-left: auto; }
  .filters-end .count { margin-left: 0; }
  /* липкая панель: в строке только поиск и кнопка «Фильтры», остальное — выпадающий блок поверх содержимого */
  .filters.filters-bar { padding: 8px; gap: 8px; }
  .filters.filters-bar input[type=search] { flex: 1 1 0; width: auto; min-width: 0; }
  .filters-toggle { display: inline-flex; align-items: center; gap: 6px; flex: none; white-space: nowrap; }
  .filters-toggle .chev { font-size: 10px; opacity: .7; transition: transform .15s; }
  .filters-bar.open .filters-toggle .chev { transform: rotate(180deg); }
  .filters-bar .filters-more { display: none; position: absolute; left: -1px; right: -1px; top: 100%; z-index: 1;
    flex-wrap: wrap; gap: 8px; align-items: center; padding: 10px 8px; background: var(--bg-2); border: 1px solid var(--border); border-top: 0;
    border-radius: 0 0 var(--radius) var(--radius); box-shadow: 0 14px 28px -10px rgba(0, 0, 0, .5);
    max-height: calc(100vh - var(--topbar-h, 0px) - 80px); max-height: calc(100dvh - var(--topbar-h, 0px) - 80px); overflow: auto; }
  .filters-bar.open .filters-more { display: flex; }
  .filters-bar.open { border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
  .btn { padding: 8px 12px; }
  .btn-sm { padding: 6px 10px; font-size: 13px; }
  .tabs .btn, .tabs .chip { padding: 7px 12px; }
  /* таблицы: компактнее, первая колонка закреплена при горизонтальной прокрутке */
  th, td { padding: 6px 8px; font-size: 12px; }
  .table-wrap { -webkit-overflow-scrolling: touch; }
  .table-wrap table th:first-child, .table-wrap table td:first-child { position: sticky; left: 0; z-index: 1; background: var(--bg-2); box-shadow: 1px 0 0 var(--border); }
  .table-wrap table th:first-child { background: var(--bg-2); z-index: 3; }
  .table-wrap table th:first-child, .table-wrap table td:first-child { white-space: normal; max-width: 46vw; }
  .table-wrap table td.num:first-child, .table-wrap table th.num:first-child { white-space: nowrap; }
  .table-wrap table th { z-index: 2; }
  .table-wrap table th[colspan] { position: static; }
  .mini { width: 28px; height: 28px; }
  .reward { white-space: normal; }
  body .kv, body .leagues-season, body .bosses-kv, body .clans-kv, body .quests-kv, body .abilities-resist dl { grid-template-columns: minmax(0, max-content) minmax(50%, 1fr); gap: 6px 10px; }
  .kv dt, .quests-kv dt { white-space: normal; }
  .kv dd, .bosses-kv dd { overflow-wrap: anywhere; }
  .stats-big { grid-template-columns: 1fr; }
  .stats-big li { flex-wrap: wrap; }
  .card-title { font-size: 13px; }
  .note, .footer-note { overflow-wrap: anywhere; }
}
@media (max-width: 480px) {
  /* плитка предметов: две колонки, карточка вертикальная */
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .card { flex-direction: column; gap: 6px; padding: 10px 8px 8px; }
  .card .thumb-col { align-self: center; }
  .card-body { width: 100%; }
  .card-sub { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .stat-list li { gap: 6px; }
  .stat-list li span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .set-thumbs .thumb { width: 40px; height: 40px; font-size: 18px; }
  .set-thumbs .thumb img, .set-thumbs .thumb .thumb-img { width: 34px; height: 34px; }
}

/* ---------- flat components: с префиксом html, чтобы перебивать стили страниц (они вставляются после styles.css) ---------- */
html body { font-size: 14.5px; letter-spacing: .005em; }
html .topbar { border-bottom: none; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); padding: 10px 20px; min-height: 57px; }
html .brand { font-weight: 800; letter-spacing: -.01em; }
.btn, .chip, .filters input[type=search], .filters select,
html .forge-calc input, html .bosses-levels input { border-color: transparent; }
html .btn { border-radius: 10px; }
html .btn:hover, html .chip:hover { background: var(--hover); border-color: transparent; }
html .btn.active { background: var(--accent); color: #fff; }
html:not([data-theme="light"]) .btn.active { color: #0e1116; }   /* белый на светлом акценте тёмной темы — 3:1, тёмный — 6.5:1 */
html .btn-ghost { background: var(--bg-3); }
/* активный чип: подкрашенный фон и рамка цвета редкости, текст обычный — белый на зелёном/оранжевом/жёлтом не читался (2:1) */
html .chip.active { background: color-mix(in srgb, var(--c, var(--accent)) 28%, var(--bg-3)); color: var(--text); border-color: var(--c, var(--accent)); }
.filters, .panel, .set-card, .table-wrap,
html .abilities-card, html .shop-card, html .bosses-diffcard { border-color: transparent; }
html .card { border: none; border-left: none; background: var(--bg-2); box-shadow: inset 0 0 0 1px var(--border); }
html .card:hover { transform: none; background: var(--hover); box-shadow: inset 0 0 0 2px var(--c, var(--accent)); }
html .card-power { color: var(--accent-2); }
html .thumb { border: none; background: color-mix(in srgb, var(--c, var(--muted)) 16%, var(--bg-3)); border-radius: 12px; }
html .set-thumbs .thumb, html .abilities-item .thumb { border-radius: 10px; }
html .panel h2, html h3.sub, html .forge-rarity h3, html .abilities-sub, html .bosses-sub {
  text-transform: none; letter-spacing: -.01em; font-size: 16px; font-weight: 700; color: var(--text); }
html .panel h2 { margin-bottom: 12px; }
html h3.sub { font-size: 14px; color: var(--muted); }
html .page-title, html .detail-head h1 { font-weight: 800; letter-spacing: -.02em; }
html th { background: var(--bg-2); text-transform: uppercase; font-size: 11px; letter-spacing: .05em; border-bottom: 1px solid var(--border); }
html .table-wrap th:first-child, html .table-wrap td:first-child, html .bosses-table th:first-child { box-shadow: none; background: var(--bg-2); }
html .table-wrap { background: var(--bg-2); }
html .table-wrap table { background: transparent; }
html tbody tr:hover { background: color-mix(in srgb, var(--accent) 7%, transparent); }
/* закреплённая первая колонка непрозрачна — при наведении красим её тем же цветом, что и строку */
html tbody tr:hover > :is(td, th):first-child, html #itemsTable tbody tr:hover > td:first-child { background: color-mix(in srgb, var(--accent) 7%, var(--bg-2)); }
.stats-big li, .skills-meta div, .abilities-stat, .bosses-price,
html .chests-card, html .forge-pitem { border-radius: 10px; border-color: transparent; }
html .chests-card, html .forge-pitem, html .abilities-card, html .abilities-card.abilities-boss, html .abilities-resist, html .bosses-ability, html .bosses-table td.bosses-name { border-left: none; }
html .bosses-rule, html .bosses-diffcard { border-top: none; }
html .bosses-table tr.bosses-hl td.bosses-name { color: var(--muted); }
.badge, .reward, .gems-other, .shop-item, .leagues-item,
html .shop-price, html .quests-count, html .shop-count, html .bosses-diff { border-color: transparent; }
html .badge.warn { background: color-mix(in srgb, var(--r-mythical) 14%, var(--bg-3)); }
html .badge.ability { background: color-mix(in srgb, var(--accent) 14%, var(--bg-3)); }
html .item-row.current { background: color-mix(in srgb, var(--accent) 12%, transparent); }
html .footer { border-top: none; }
html .btn.active .dim { color: rgba(255, 255, 255, .78); }
html:not([data-theme="light"]) .btn.active .dim { color: rgba(14, 17, 22, .7); }
html .chip.active .dim, html .chip.active small { color: var(--muted); }
.skills-graph-wrap, .abilities-effects code, .bosses-kv code, .clans-page code,
html .quests-formula code, html .bosses-growth code, html kbd { border-color: transparent; }
html .leagues-client-head .ld { border-color: transparent; }
@media (max-width: 820px) {
  html .nav { border-top: none; }
  html .nav a { border-radius: 10px; }
  html .nav a.active { box-shadow: none; background: color-mix(in srgb, var(--accent) 22%, var(--bg-3)); }
}

/* фокус с клавиатуры */
a:focus-visible, button:focus-visible, summary:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; }
/* меньше движения по просьбе системы */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; scroll-behavior: auto !important; }
}
