:root {
  --bg: #0f1720;
  --bg2: #17222e;
  --panel: #1b2a38;
  --panel2: #22303f;
  --border: #2e4054;
  --text: #e8eef5;
  --muted: #8fa3b8;
  --accent: #3b82f6;
  --accent2: #f59e0b;
  --ss: #f5c518;
  --s: #ef4444;
  --a: #fb923c;
  --b: #38bdf8;
  --c: #34d399;
  --f: #6b7280;
  --mythical: #c084fc;
  --legendary: #fbbf24;
  --epic: #a78bfa;
  --rare: #60a5fa;
  --uncommon: #4ade80;
  --common: #9ca3af;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, -apple-system, sans-serif;
  background: radial-gradient(1200px 600px at 20% -10%, #1c2c3d 0%, var(--bg) 55%) fixed;
  color: var(--text);
  min-height: 100vh;
}

.wrap { max-width: 1240px; margin: 0 auto; padding: 0 20px; }

/* Header */
.site-header {
  background: linear-gradient(135deg, #172a3d, #0e1a26);
  border-bottom: 1px solid var(--border);
  padding: 22px 0;
  position: sticky; top: 0; z-index: 40;
  box-shadow: 0 6px 24px rgba(0,0,0,.35);
}
.site-header .wrap { display: flex; align-items: center; justify-content: space-between; gap: 20px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 14px; }
.brand-mark {
  width: 52px; height: 52px; flex: 0 0 52px; border-radius: 12px;
  display: grid; place-items: center; font-weight: 800; font-size: 18px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #0b1220; letter-spacing: .5px;
}
.brand h1 { font-size: 21px; line-height: 1.2; }
.tagline { color: var(--muted); font-size: 13px; margin-top: 3px; }

.search-box { position: relative; min-width: 300px; }
.search-box input {
  width: 100%; padding: 11px 38px 11px 14px; border-radius: 10px;
  border: 1px solid var(--border); background: var(--panel); color: var(--text);
  font-size: 14px; outline: none;
}
.search-box input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(59,130,246,.2); }
.search-box button {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer;
  display: none; line-height: 1;
}

/* Stats */
.stats-bar { background: var(--bg2); border-bottom: 1px solid var(--border); }
.stats-bar .wrap { display: flex; gap: 8px; flex-wrap: wrap; padding: 14px 20px; }
.stat {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 8px 16px; border-radius: 10px; cursor: pointer; min-width: 90px;
  border: 1px solid var(--border); background: var(--panel); transition: .15s;
}
.stat:hover { border-color: var(--accent); transform: translateY(-2px); }
.stat.active { border-color: var(--accent); background: var(--panel2); box-shadow: 0 0 0 2px rgba(59,130,246,.25); }
.stat-num { font-size: 20px; font-weight: 800; }
.stat-label { font-size: 11px; color: var(--muted); }

/* Filter bar */
.filter-bar {
  margin: 20px 0 10px; padding: 16px; border-radius: 14px;
  background: var(--panel); border: 1px solid var(--border);
}
.filters { display: flex; gap: 12px; flex-wrap: wrap; align-items: flex-end; }
.filters label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--muted); }
.filters select {
  padding: 8px 10px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--text); font-size: 13px; outline: none; min-width: 120px;
}
.filters select:focus { border-color: var(--accent); }
.btn-reset {
  padding: 8px 16px; border-radius: 8px; border: 1px solid var(--border);
  background: var(--panel2); color: var(--text); cursor: pointer; font-size: 13px;
  margin-left: auto;
}
.btn-reset:hover { border-color: var(--accent); color: #fff; }
.result-info { margin-top: 12px; font-size: 13px; color: var(--muted); }

/* Legend */
.legend { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; margin: 8px 0 14px; font-size: 12px; color: var(--muted); }
.legend-title { color: var(--text); font-weight: 600; }
.lg-item { display: flex; align-items: center; gap: 5px; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.dot.ss { background: var(--ss); } .dot.s { background: var(--s); }
.dot.a { background: var(--a); } .dot.b { background: var(--b); }
.dot.c { background: var(--c); } .dot.f { background: var(--f); }

/* Champion list */
.champion-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 12px; }
.champ-card {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  background: var(--panel); border: 1px solid var(--border); border-radius: 12px;
  cursor: pointer; transition: .15s; position: relative; overflow: hidden;
}
.champ-avatar {
  flex: 0 0 56px; width: 56px; height: 73px; border-radius: 6px;
  object-fit: contain; background: var(--panel2); border: 1px solid var(--border);
}
.champ-avatar-fallback {
  flex: 0 0 56px; width: 56px; height: 73px; border-radius: 6px;
  display: grid; place-items: center; font-weight: 800; font-size: 20px;
  background: linear-gradient(135deg, var(--panel2), #2a3a4d);
  border: 1px solid var(--border); color: var(--muted); text-transform: uppercase;
}
.champ-card:hover { transform: translateY(-2px); border-color: var(--accent); box-shadow: 0 8px 20px rgba(0,0,0,.3); }
.rank-badge {
  flex: 0 0 42px; width: 42px; height: 42px; border-radius: 9px;
  display: grid; place-items: center; font-weight: 900; font-size: 16px; color: #0b1220;
}
.rank-ss { background: var(--rank-color,var(--ss)); } .rank-s { background: var(--rank-color,var(--s)); color: #fff; }
.rank-a { background: var(--rank-color,var(--a)); } .rank-b { background: var(--rank-color,var(--b)); color: #0b1220; }
.rank-c { background: var(--rank-color,var(--c)); color: #0b1220; } .rank-f { background: var(--rank-color,var(--f)); color: #fff; }
.rank-badge[class*="rank-"] { background: var(--rank-color,var(--accent)); }

.champ-main { flex: 1; min-width: 0; }
.champ-name { font-size: 15px; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.champ-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 5px; }
.chip {
  font-size: 10.5px; padding: 2px 7px; border-radius: 5px; font-weight: 600;
  background: var(--panel2); border: 1px solid var(--border); color: var(--muted);
  white-space: nowrap;
}
.chip.rarity-mythical { color: var(--mythical); border-color: rgba(192,132,252,.4); }
.chip.rarity-legendary { color: var(--legendary); border-color: rgba(251,191,36,.4); }
.chip.rarity-epic { color: var(--epic); border-color: rgba(167,139,250,.4); }
.chip.rarity-rare { color: var(--rare); border-color: rgba(96,165,250,.4); }
.chip.rarity-uncommon { color: var(--uncommon); border-color: rgba(74,222,128,.4); }
.chip.rarity-common { color: var(--common); border-color: rgba(156,163,175,.4); }
.chip.aff-force { color: #f87171; } .chip.aff-magic { color: #60a5fa; }
.chip.aff-spirit { color: #4ade80; } .chip.aff-void { color: #c084fc; }
.champ-abbr { font-family: ui-monospace, Consolas, monospace; font-size: 11px; color: var(--muted); }

.empty { text-align: center; padding: 60px 20px; color: var(--muted); font-size: 15px; }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 100; display: flex; align-items: stretch; justify-content: center; padding: 0; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(5,10,18,.8); backdrop-filter: blur(2px); }
.modal-card {
  position: relative; width: min(880px, 100%); max-height: 100vh; overflow-y: auto;
  background: var(--panel); border-left: 1px solid var(--border); border-right: 1px solid var(--border);
  padding: 30px 34px 48px; box-shadow: 0 20px 60px rgba(0,0,0,.5);
}
.modal-close {
  position: fixed; top: 14px; right: 18px; z-index: 10; background: var(--panel2); border: 1px solid var(--border);
  color: var(--text); font-size: 24px; cursor: pointer; line-height: 1; width: 40px; height: 40px; border-radius: 50%;
}
.modal-close:hover { color: #fff; border-color: var(--accent); }

.m-hero { width: 100%; height: auto; max-height: 340px; object-fit: contain; border-radius: 14px; border: 1px solid var(--border); background: var(--panel2); margin-bottom: 14px; display: block; }
.m-name { font-size: 24px; font-weight: 800; line-height: 1.2; }
.m-abbr { font-family: ui-monospace, Consolas, monospace; color: var(--muted); font-size: 14px; margin-top: 2px; }
.m-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 10px; }

.m-loading { text-align: center; color: var(--muted); padding: 40px 0; }

.m-section { margin-top: 22px; }
.m-section h3 {
  font-size: 15px; text-transform: uppercase; letter-spacing: 1px; color: var(--accent2);
  border-bottom: 1px solid var(--border); padding-bottom: 6px; margin-bottom: 12px;
}
.m-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 8px; }
.m-item { background: var(--panel2); border: 1px solid var(--border); border-radius: 10px; padding: 10px 12px; }
.m-item .k { font-size: 10.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
.m-item .v { font-size: 14px; font-weight: 700; margin-top: 3px; }

.rating-sections { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.rating-table { display: grid; gap: 6px; }
.rating-row { display: flex; align-items: center; gap: 8px; }
.rating-name { flex: 0 0 150px; font-size: 13px; color: var(--text); }
.rating-stars { color: var(--accent2); letter-spacing: 1px; font-size: 14px; }
.rating-empty { color: #3a4a5c; letter-spacing: 1px; font-size: 14px; }
@media (max-width: 640px) { .rating-sections { grid-template-columns: 1fr; } }

.skill-block { background: var(--panel2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.skill-head { display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.skill-name { font-size: 15px; font-weight: 700; }
.skill-cd { font-size: 11.5px; color: var(--accent2); font-weight: 600; }
.skill-desc { margin-top: 8px; font-size: 13.5px; color: #cdd8e4; line-height: 1.55; }
.skill-levels { margin-top: 8px; font-size: 12.5px; color: var(--muted); line-height: 1.7; }
.skill-mult { margin-top: 6px; font-size: 12.5px; color: #7fd18a; font-family: ui-monospace, Consolas, monospace; }

.chip-list { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-tag { font-size: 12px; padding: 3px 9px; border-radius: 6px; background: var(--panel2); border: 1px solid var(--border); color: #cdd8e4; }
.chip-tag.bold { font-weight: 700; color: var(--accent2); }

.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .two-col { grid-template-columns: 1fr; } }

.mastery-set { background: var(--panel2); border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px; margin-bottom: 10px; }
.mastery-title { font-weight: 700; font-size: 14px; margin-bottom: 8px; }
.mastery-img { width: 100%; border-radius: 10px; margin-bottom: 10px; border: 1px solid var(--border); }
.branch { margin-bottom: 10px; }
.branch-name { font-size: 12.5px; font-weight: 700; color: var(--accent); margin-bottom: 4px; }
.branch-list { font-size: 12.5px; color: #cdd8e4; line-height: 1.8; }

/* Ordered mastery recommendations; columns do not imply tree tiers. */
.mastery-branches { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(180px, 100%), 1fr)); gap: 16px; align-items: start; }
.mastery-branch { min-width: 0; padding: 12px; background: var(--bg2); border: 1px solid var(--border); border-radius: 10px; }
.mastery-branch > .branch-name { text-align: center; margin-bottom: 12px; }
.mastery-path { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 24px; }
.mastery-node { position: relative; padding: 10px 12px; border: 1px solid var(--accent); border-radius: 8px; background: var(--panel2); color: var(--text); font-size: 12.5px; line-height: 1.5; text-align: center; overflow-wrap: anywhere; }
.mastery-node + .mastery-node::before { content: "↓"; position: absolute; bottom: 100%; left: 50%; transform: translateX(-50%); height: 24px; line-height: 24px; color: var(--accent2); font-size: 18px; }
.mastery-original { margin-top: 14px; }
.mastery-original summary { cursor: pointer; color: var(--accent); font-size: 12.5px; padding: 6px 0; }
.mastery-original summary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.mastery-original .mastery-img { display: block; margin-top: 8px; }

.lore-text { font-size: 13.5px; color: #cdd8e4; line-height: 1.7; margin-bottom: 12px; }
.update-item { font-size: 13px; padding: 6px 0; border-bottom: 1px dashed var(--border); }
.update-item a { color: var(--accent); text-decoration: none; }

.m-link {
  display: inline-block; margin-top: 14px; padding: 11px 20px; border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), #2563eb); color: #fff;
  text-decoration: none; font-weight: 600; font-size: 14px;
}
.m-link:hover { filter: brightness(1.1); }

/* Ranking page sidebar */
.directory-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 24px; }
.directory-main { min-width: 0; }
.guide-sidebar { min-width: 0; padding: 16px; background: var(--panel); border: 1px solid var(--border); border-radius: 8px; }
.sidebar-heading { font-size: 16px; margin-bottom: 12px; }
.sidebar-section { border-top: 1px solid var(--border); padding: 12px 0; }
.sidebar-section h3 { font-size: 14px; color: var(--text); margin-bottom: 8px; }
.sidebar-section ul { list-style: none; display: grid; gap: 5px; }
.sidebar-section li { line-height: 1.35; }
.sidebar-section a { color: #a9c7e5; text-decoration: none; font-size: 12px; }
.sidebar-section a:hover { color: #fff; text-decoration: underline; }
.sidebar-description { font-size: 12px; color: var(--muted); line-height: 1.5; margin-bottom: 8px; }
.sidebar-error { color: var(--muted); font-size: 13px; }

/* Footer */
.site-footer { margin-top: 30px; padding: 20px 0; border-top: 1px solid var(--border); background: var(--bg2); }
.site-footer p { color: var(--muted); font-size: 13px; text-align: center; }

@media (max-width: 980px) {
  .directory-layout { grid-template-columns: minmax(0, 1fr) 260px; gap: 16px; }
}
@media (max-width: 760px) {
  .directory-layout { grid-template-columns: 1fr; }
  .guide-sidebar { margin-top: 18px; }
}
@media (max-width: 640px) {
  .brand h1 { font-size: 17px; }
  .search-box { min-width: 100%; }
  .champion-list { grid-template-columns: 1fr; }
}

/* Raid news strip */
.news-strip { margin:18px 0 24px; padding:15px 16px 13px; background:var(--panel); border:1px solid var(--border); border-radius:8px; }
.news-strip-heading { display:flex; align-items:center; justify-content:space-between; gap:12px; padding-bottom:11px; }
.news-strip-heading h2 { font-size:16px; }
.news-strip-hint,.news-updated { color:var(--muted); font-size:11px; }
.news-updated { margin-top:3px; }
.news-list { display:grid; grid-auto-columns:minmax(260px, 1fr); grid-auto-flow:column; gap:12px; overflow-x:auto; overscroll-behavior-inline:contain; padding:2px 1px 10px; scrollbar-width:thin; scrollbar-color:var(--border) transparent; }
.news-item { min-width:0; display:grid; grid-template-columns:108px minmax(0,1fr); gap:11px; align-items:center; padding:8px; text-align:left; color:var(--text); background:var(--bg2); border:1px solid var(--border); border-radius:6px; cursor:pointer; }
.news-item:hover { border-color:var(--accent); background:var(--panel2); }
.news-thumb { display:block; width:108px; aspect-ratio:16/9; overflow:hidden; background:var(--panel2); }
.news-thumb img { display:block; width:100%; height:100%; object-fit:cover; object-position:center; }
.news-copy { min-width:0; display:grid; gap:4px; }
.news-meta { color:var(--accent2); font-size:10px; }
.news-title { display:-webkit-box; overflow:hidden; -webkit-line-clamp:2; -webkit-box-orient:vertical; font-size:12px; font-weight:700; line-height:1.4; }
.news-excerpt { display:-webkit-box; overflow:hidden; -webkit-line-clamp:2; -webkit-box-orient:vertical; color:var(--muted); font-size:10px; line-height:1.4; }
.news-empty { padding:14px 0; color:var(--muted); font-size:12px; }
.news-dialog { width:min(860px,calc(100% - 28px)); max-height:min(88vh,900px); padding:28px 34px; overflow:auto; color:var(--text); background:var(--panel); border:1px solid var(--border); }
.news-dialog::backdrop { background:rgba(0,0,0,.78); }
.news-dialog-close { position:sticky; float:right; top:0; width:34px; height:34px; color:var(--text); background:var(--panel2); border:1px solid var(--border); font-size:22px; cursor:pointer; }
.news-article-meta { color:var(--accent2); font-size:12px; }
.news-dialog h2 { margin:8px 42px 16px 0; font-size:24px; line-height:1.3; }
.news-article-cover { display:block; width:100%; max-height:360px; aspect-ratio:16/9; object-fit:cover; background:var(--panel2); margin:12px 0 20px; }
.news-article-intro { font-size:15px; font-weight:600; line-height:1.7; }
.news-dialog article p { margin:10px 0; color:#cdd8e4; font-size:14px; line-height:1.75; }
.news-dialog article h3 { margin:22px 0 8px; color:var(--accent2); font-size:17px; }
.news-dialog article ul { padding-left:22px; color:#cdd8e4; line-height:1.7; }
.news-article-gallery { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:10px; margin:20px 0; }
.news-article-gallery img { display:block; width:100%; aspect-ratio:16/9; object-fit:cover; background:var(--panel2); }

/* Champion directory with the guide rail retained */
.directory-layout { display:grid; grid-template-columns:minmax(0,1fr) 300px; align-items:start; gap:24px; }
@media(max-width:980px){.directory-layout{grid-template-columns:minmax(0,1fr) 260px;gap:16px}}
@media(max-width:760px){.directory-layout{grid-template-columns:1fr}.guide-sidebar{margin-top:18px}}
@media(max-width:760px){.news-list{grid-auto-columns:minmax(240px,82vw)}.news-dialog{padding:20px 18px}}
@media(max-width:480px){.news-article-gallery{grid-template-columns:1fr}.news-dialog h2{font-size:20px}}
