:root {
  --bg: #08090d;
  --bg-elev: rgba(17, 21, 30, 0.88);
  --bg-card: rgba(21, 26, 37, 0.94);
  --border: rgba(232, 197, 123, 0.16);
  --border-strong: rgba(232, 197, 123, 0.45);
  --gold: #e8c57b;
  --gold-bright: #f7dfa4;
  --gold-dim: rgba(232, 197, 123, 0.14);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --weapon: #fb923c;
  --weapon-bg: rgba(249, 115, 22, 0.14);
  --vitality: #4ade80;
  --vitality-bg: rgba(34, 197, 94, 0.14);
  --spirit: #c084fc;
  --spirit-bg: rgba(192, 132, 252, 0.15);
  --danger: #fb7185;
  --soul: #2dd4bf;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter", "Segoe UI", system-ui, sans-serif;
  line-height: 1.48;
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(rgba(232, 197, 123, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(232, 197, 123, 0.03) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(circle at 50% 25%, black 35%, transparent 90%);
}

.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(115px);
  pointer-events: none;
  z-index: 0;
}
.bg-glow-gold { width: 520px; height: 520px; top: -180px; left: -120px; background: rgba(232, 197, 123, 0.12); }
.bg-glow-spirit { width: 560px; height: 560px; top: 10%; right: -180px; background: rgba(168, 85, 247, 0.1); }

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: rgba(8, 9, 13, 0.88);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--border);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.topbar-inner {
  max-width: 1440px;
  margin: 0 auto;
  padding: 13px 22px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.brand { display: flex; align-items: center; gap: 13px; }
.brand-sigil {
  width: 42px;
  height: 42px;
  border-radius: 10px;
  background: linear-gradient(145deg, #272013 0%, #12151e 100%);
  border: 1px solid var(--border-strong);
  display: grid;
  place-items: center;
  box-shadow: 0 0 22px rgba(232, 197, 123, 0.2), inset 0 0 12px rgba(232, 197, 123, 0.1);
}
.brand h1 {
  margin: 0;
  font-family: "Cinzel", Georgia, serif;
  font-size: 20px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--gold-bright);
  display: flex;
  align-items: center;
  gap: 9px;
}
.accent-tag {
  font-family: "Inter", sans-serif;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.12em;
  padding: 3px 7px;
  border-radius: 5px;
  background: var(--gold-dim);
  border: 1px solid var(--border-strong);
  color: var(--gold);
}
.brand .sub { font-size: 12px; color: var(--muted); margin-top: 1px; }

.nav-tabs { display: flex; flex-wrap: wrap; gap: 8px; }
.tab-btn {
  background: rgba(21, 26, 37, 0.8);
  color: var(--muted);
  border: 1px solid rgba(148, 163, 184, 0.18);
  padding: 9px 15px;
  border-radius: 9px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: all 0.18s ease;
}
.tab-dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: 0.5; }
.tab-count { font-size: 11px; padding: 1px 6px; border-radius: 999px; background: rgba(255, 255, 255, 0.07); }
.tab-btn:hover { color: var(--text); border-color: var(--border-strong); transform: translateY(-1px); }
.tab-btn.active {
  background: linear-gradient(135deg, rgba(232, 197, 123, 0.2) 0%, rgba(232, 197, 123, 0.06) 100%);
  color: var(--gold-bright);
  border-color: var(--gold);
  box-shadow: 0 0 20px rgba(232, 197, 123, 0.16);
}
.tab-btn.active .tab-dot { opacity: 1; box-shadow: 0 0 8px var(--gold); }

.container { max-width: 1440px; margin: 0 auto; padding: 22px; position: relative; z-index: 1; }
.panel { display: none; animation: fadeIn 0.2s ease; }
.panel.active { display: block; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: translateY(0); } }

/* Draft Box */
.draft-box {
  position: relative;
  background: linear-gradient(160deg, rgba(31, 27, 22, 0.88) 0%, rgba(16, 20, 30, 0.96) 60%);
  border: 1px solid var(--border-strong);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 20px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.45);
}

.deco-corner { position: absolute; width: 12px; height: 12px; border-color: var(--gold); border-style: solid; pointer-events: none; }
.deco-corner.tl { top: -1px; left: -1px; border-width: 2px 0 0 2px; border-top-left-radius: 6px; }
.deco-corner.tr { top: -1px; right: -1px; border-width: 2px 2px 0 0; border-top-right-radius: 6px; }
.deco-corner.bl { bottom: -1px; left: -1px; border-width: 0 0 2px 2px; border-bottom-left-radius: 6px; }
.deco-corner.br { bottom: -1px; right: -1px; border-width: 0 2px 2px 0; border-bottom-right-radius: 6px; }

.draft-header { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 12px; }
.draft-title {
  font-family: "Cinzel", Georgia, serif;
  font-size: 15px;
  font-weight: 700;
  color: var(--gold-bright);
  letter-spacing: 0.05em;
  display: flex;
  align-items: center;
  gap: 10px;
}
.draft-badge { font-family: "Inter", sans-serif; font-size: 12px; font-weight: 800; padding: 2px 9px; border-radius: 999px; background: var(--gold); color: #111; }
.draft-hint { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

.draft-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.action-btn {
  background: rgba(8, 9, 13, 0.75);
  color: var(--gold);
  border: 1px solid var(--border-strong);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: 0.15s;
}
.action-btn:hover, .action-btn.active { background: var(--gold); color: #111; }

.clear-btn {
  background: rgba(251, 113, 133, 0.12);
  color: var(--danger);
  border: 1px solid rgba(251, 113, 133, 0.4);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
}
.clear-btn:hover { background: rgba(251, 113, 133, 0.24); }

/* Quick Picker Strip */
.quick-picker {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding: 10px;
  margin-bottom: 12px;
  background: rgba(8, 9, 13, 0.65);
  border: 1px solid rgba(232, 197, 123, 0.18);
  border-radius: 10px;
}
.quick-picker.open { display: flex; }

.qp-item {
  width: 42px;
  height: 42px;
  border-radius: 8px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  background: #0d1017;
  padding: 2px;
  cursor: pointer;
  position: relative;
  transition: 0.14s;
}
.qp-item img { width: 100%; height: 100%; border-radius: 6px; object-fit: cover; display: block; }
.qp-item:hover { border-color: var(--gold); transform: scale(1.1); z-index: 2; }
.qp-item.picked { border-color: var(--gold); box-shadow: 0 0 12px rgba(232, 197, 123, 0.55); background: var(--gold); }

.draft-slots-bar {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.enemy-slot {
  height: 46px;
  border-radius: 9px;
  border: 1px dashed rgba(232, 197, 123, 0.28);
  background: rgba(8, 9, 13, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 11.5px;
  color: #64748b;
  font-weight: 600;
  padding: 0 8px;
  transition: 0.16s;
}
.enemy-slot.filled {
  border-style: solid;
  border-color: var(--gold);
  background: rgba(232, 197, 123, 0.12);
  color: var(--text);
  justify-content: flex-start;
  gap: 8px;
  cursor: pointer;
}
.enemy-slot.filled:hover { border-color: var(--danger); background: rgba(251, 113, 133, 0.12); }
.enemy-slot img { width: 30px; height: 30px; border-radius: 6px; object-fit: cover; }
.enemy-slot .es-name { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: 12.5px; font-weight: 700; flex: 1; }

/* Stage grouped draft summary */
.draft-summary-wrap { display: flex; flex-direction: column; gap: 12px; }
.stage-block {
  background: rgba(8, 9, 13, 0.5);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 10px;
  padding: 10px 12px;
}
.stage-title {
  font-size: 11.5px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  margin-bottom: 8px;
}
.stage-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(235px, 1fr));
  gap: 8px;
}

.rec-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 10px;
  padding: 8px 10px;
  cursor: pointer;
  transition: 0.15s;
}
.rec-item:hover { border-color: var(--gold); transform: translateY(-1px); }
.rec-item img { width: 38px; height: 38px; border-radius: 7px; flex-shrink: 0; }
.rec-meta { min-width: 0; }
.rec-name { font-size: 12.8px; font-weight: 700; color: var(--text); }
.rec-sub { font-size: 11.2px; color: var(--muted); }

/* Controls */
.controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
}
.search-wrap { flex: 1 1 260px; position: relative; display: flex; align-items: center; }
.search-ico { position: absolute; left: 11px; color: var(--gold); font-size: 16px; pointer-events: none; }
.search-input {
  width: 100%;
  background: rgba(8, 9, 13, 0.85);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  padding: 9px 12px 9px 32px;
  font-size: 13.5px;
  outline: none;
}
.search-input:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(232, 197, 123, 0.12); }
.sort-select {
  background: rgba(8, 9, 13, 0.85);
  color: var(--text);
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12.5px;
  font-weight: 600;
  outline: none;
}

.chip-group { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  background: rgba(8, 9, 13, 0.7);
  color: var(--muted);
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 7px;
  padding: 6px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s;
}
.chip:hover { color: var(--text); border-color: #64748b; }
.chip.active { background: var(--gold-dim); color: var(--gold-bright); border-color: var(--gold); }
.chip.slot-weapon.active { background: var(--weapon-bg); color: var(--weapon); border-color: var(--weapon); }
.chip.slot-vitality.active { background: var(--vitality-bg); color: var(--vitality); border-color: var(--vitality); }
.chip.slot-spirit.active { background: var(--spirit-bg); color: var(--spirit); border-color: var(--spirit); }

/* Heroes Grid */
.heroes-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(420px, 1fr)); gap: 15px; }
.hero-card {
  background: var(--bg-card);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 14px;
  padding: 15px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}
.hero-card:hover { transform: translateY(-2px); border-color: var(--border-strong); box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45); }
.hero-card.picked {
  border-color: var(--gold);
  background: linear-gradient(180deg, rgba(232, 197, 123, 0.08) 0%, var(--bg-card) 45%);
  box-shadow: 0 0 0 1px var(--gold), 0 10px 28px rgba(232, 197, 123, 0.15);
}

.hero-head { display: flex; align-items: center; gap: 12px; }
.hero-avatar {
  width: 56px; height: 56px; border-radius: 11px; background: #0d1017;
  border: 1px solid var(--border-strong); object-fit: cover; flex-shrink: 0;
}
.hero-title-wrap { flex: 1; min-width: 0; }
.hero-name { font-family: "Cinzel", Georgia, serif; font-size: 18px; font-weight: 700; color: var(--gold-bright); margin: 0; }
.hero-threat {
  display: inline-block;
  font-size: 11.8px;
  font-weight: 600;
  color: #fda4af;
  background: rgba(244, 63, 94, 0.1);
  border: 1px solid rgba(244, 63, 94, 0.25);
  border-radius: 6px;
  padding: 2px 7px;
  margin-top: 4px;
}

.pick-btn {
  background: rgba(8, 9, 13, 0.8);
  color: var(--muted);
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 8px;
  padding: 6px 11px;
  font-size: 11.5px;
  font-weight: 700;
  cursor: pointer;
  flex-shrink: 0;
}
.pick-btn:hover { color: var(--gold); border-color: var(--gold); }
.hero-card.picked .pick-btn { background: var(--gold); color: #111; border-color: var(--gold); }

.counter-slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.slot-card {
  position: relative;
  background: rgba(11, 14, 21, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 9px;
  padding: 8px 6px;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 5px;
  cursor: pointer;
  transition: 0.15s;
}
.slot-card:hover { background: rgba(29, 36, 51, 0.95); border-color: var(--gold); transform: translateY(-1px); }
.slot-card.shared-hit { box-shadow: inset 0 0 0 1px var(--gold); background: rgba(232, 197, 123, 0.08); }
.slot-card.slot-Оружие { border-top: 2px solid var(--weapon); }
.slot-card.slot-Живучесть { border-top: 2px solid var(--vitality); }
.slot-card.slot-Спирит { border-top: 2px solid var(--spirit); }
.slot-card img { width: 38px; height: 38px; border-radius: 6px; }
.slot-card .s-name { font-size: 11.5px; font-weight: 700; color: var(--text); line-height: 1.22; }
.slot-card .s-cost { font-size: 11px; font-weight: 700; color: var(--soul); }
.shared-star {
  position: absolute;
  top: 4px;
  right: 5px;
  font-size: 10px;
  color: var(--gold);
}

.hero-strat {
  font-size: 12.8px;
  color: #cbd5e1;
  background: rgba(8, 9, 13, 0.6);
  border-radius: 8px;
  padding: 9px 11px;
  border-left: 2px solid var(--gold);
}

/* Items Grid */
.items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(365px, 1fr)); gap: 13px; }
.item-card {
  background: var(--bg-card);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 13px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  cursor: pointer;
  transition: 0.16s;
}
.item-card:hover { border-color: var(--border-strong); transform: translateY(-2px); }
.item-card.item-Оружие { border-left: 3px solid var(--weapon); }
.item-card.item-Живучесть { border-left: 3px solid var(--vitality); }
.item-card.item-Спирит { border-left: 3px solid var(--spirit); }
.item-head { display: flex; align-items: center; gap: 11px; }
.item-head img { width: 48px; height: 48px; border-radius: 9px; background: #0d1017; flex-shrink: 0; }
.item-names { flex: 1; min-width: 0; }
.item-ru { font-size: 15px; font-weight: 800; color: var(--text); }
.item-en { font-size: 12px; color: var(--muted); }
.badge-row { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.badge { font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 6px; }
.badge-Оружие { background: var(--weapon-bg); color: var(--weapon); }
.badge-Живучесть { background: var(--vitality-bg); color: var(--vitality); }
.badge-Спирит { background: var(--spirit-bg); color: var(--spirit); }
.badge-cost { background: rgba(45, 212, 191, 0.14); color: var(--soul); }
.item-nums { font-size: 12.5px; font-weight: 700; color: var(--gold); }
.item-desc { font-size: 12.8px; color: #cbd5e1; }

/* Fixes */
.fixes-list { display: flex; flex-direction: column; gap: 10px; }
.fix-row {
  background: var(--bg-card);
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  padding: 13px 15px;
  display: grid;
  grid-template-columns: 160px 1fr 1fr 1fr;
  gap: 13px;
  align-items: start;
}
.fix-target { font-weight: 800; color: var(--gold-bright); font-size: 13.5px; }
.fix-sheet { font-size: 11px; color: var(--muted); margin-top: 3px; }
.fix-col-label { font-size: 10.5px; text-transform: uppercase; font-weight: 700; letter-spacing: 0.05em; margin-bottom: 3px; }
.fix-before { font-size: 12.5px; color: #fca5a5; }
.fix-after { font-size: 12.5px; color: #86efac; }
.fix-why { font-size: 12.5px; color: #cbd5e1; }
.count-pill { font-size: 12.5px; color: var(--muted); margin-left: auto; }

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(4, 5, 8, 0.8);
  backdrop-filter: blur(7px);
  display: none;
  place-items: center;
  padding: 20px;
}
.modal-backdrop.open { display: grid; }
.modal-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  background: #131823;
  border: 1px solid var(--gold);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.75);
}
.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: var(--text);
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}
.modal-heroes { margin-top: 14px; padding-top: 12px; border-top: 1px solid rgba(148, 163, 184, 0.16); }
.modal-heroes-title { font-size: 11.5px; font-weight: 700; text-transform: uppercase; color: var(--gold); margin-bottom: 8px; }
.modal-hero-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.mh-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(8, 9, 13, 0.8); border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 999px; padding: 3px 9px 3px 4px; font-size: 11.5px; font-weight: 600;
}
.mh-chip img { width: 20px; height: 20px; border-radius: 50%; object-fit: cover; }

.scroll-top {
  position: fixed; right: 22px; bottom: 22px; z-index: 60;
  width: 42px; height: 42px; border-radius: 10px;
  background: var(--bg-card); color: var(--gold); border: 1px solid var(--border-strong);
  font-size: 18px; font-weight: 800; cursor: pointer; display: none;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.5);
}
.scroll-top.show { display: grid; place-items: center; }

@media (max-width: 960px) {
  .draft-slots-bar { grid-template-columns: repeat(3, 1fr); }
  .heroes-grid { grid-template-columns: 1fr; }
  .items-grid { grid-template-columns: 1fr; }
  .fix-row { grid-template-columns: 1fr; }
}
