:root {
  color-scheme: light;
  --bg: #f4f6f8;
  --panel: #ffffff;
  --panel-soft: #f9fbfc;
  --ink: #17202a;
  --muted: #5c6875;
  --line: #dbe2ea;
  --accent: #be2f34;
  --accent-dark: #8e2026;
  --gold: #c6933d;
  --teal: #1c7c78;
  --link: #1260a3;
  --shadow: 0 8px 22px rgba(18, 32, 46, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.65;
}

a {
  color: var(--link);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

img {
  display: block;
  max-width: 100%;
}

.site-header {
  background: #17202a;
  color: #fff;
  border-bottom: 4px solid var(--accent);
}

.topbar {
  max-width: 1180px;
  margin: 0 auto;
  padding: 12px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 800;
  letter-spacing: 0;
}

.brand:hover {
  text-decoration: none;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  background: var(--accent);
  color: #fff;
  font-size: 17px;
  border-radius: 4px;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.search-box {
  position: relative;
}

.search-box input {
  width: min(36vw, 340px);
  min-width: 200px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  padding: 9px 12px;
  border-radius: 4px;
  outline: none;
}

.search-box input::placeholder {
  color: rgba(255, 255, 255, 0.72);
}

.search-box input:focus {
  border-color: var(--gold);
  background: rgba(255, 255, 255, 0.14);
}

.nav-wrap {
  background: #22303c;
}

.nav {
  max-width: 1180px;
  margin: 0 auto;
  padding: 0 18px;
  display: flex;
  gap: 4px;
  overflow-x: auto;
}

.nav a {
  flex: 0 0 auto;
  color: #eaf0f5;
  padding: 10px 12px;
  font-size: 14px;
  border-bottom: 3px solid transparent;
}

.nav a:hover,
.nav a[aria-current="page"] {
  color: #fff;
  border-bottom-color: var(--gold);
  text-decoration: none;
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 18px;
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 18px;
  align-items: stretch;
}

.hero-main {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.hero-copy {
  padding: 20px 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-weight: 700;
  font-size: 13px;
}

h1,
h2,
h3,
h4 {
  line-height: 1.28;
  margin: 0;
}

h1 {
  font-size: clamp(26px, 3.6vw, 38px);
}

h2 {
  font-size: 21px;
}

h3 {
  font-size: 18px;
}

h4 {
  font-size: 15px;
}

.lead {
  margin: 10px 0 0;
  color: #36434f;
  font-size: 16px;
}

.quick-panel {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 16px;
}

.quick-panel h2 {
  margin-bottom: 12px;
}

.update-list,
.link-list,
.toc-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.update-list li {
  display: grid;
  grid-template-columns: 92px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-top: 1px solid var(--line);
}

.update-list li:first-child {
  border-top: 0;
}

.date {
  color: var(--muted);
  font-size: 13px;
}

.section {
  margin-top: 18px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 14px 16px;
  background: #f9fbfc;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.section-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.grid {
  display: grid;
  gap: 12px;
}

.grid.cols-3 {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 16px;
}

.grid.cols-2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 16px;
}

.guide-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  min-height: 88px;
  padding: 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  align-items: start;
}

.guide-card:hover {
  border-color: var(--link);
  box-shadow: 0 4px 12px rgba(18, 96, 163, 0.08);
  text-decoration: none;
}

.info-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  background: #f9fbfc;
  color: var(--ink);
  align-items: start;
}

.info-card.no-thumb {
  grid-template-columns: minmax(0, 1fr);
}

.info-card strong {
  display: block;
  color: var(--ink);
  line-height: 1.35;
}

.info-card .desc {
  display: block;
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.thumb {
  width: 112px;
  height: 63px;
  background: #1a242e;
  object-fit: cover;
  border-radius: 3px;
}

.guide-card strong {
  display: block;
  color: var(--ink);
  line-height: 1.35;
}

.guide-card span.desc,
.guide-card > span > span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 3px 10px;
  background: #eef3f7;
  border: 1px solid #d4dfe8;
  color: #2f3e4b;
  font-size: 12px;
  font-weight: 600;
  border-radius: 4px;
}

a.tag:hover {
  background: #e1ebf3;
  border-color: var(--link);
  color: var(--link);
  text-decoration: none;
}

.rank-list {
  counter-reset: rank;
  list-style: none;
  padding: 16px;
  margin: 0;
  display: grid;
  gap: 10px;
}

.rank-list li {
  counter-increment: rank;
}

.rank-list a {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px;
  background: #fff;
  border: 1px solid var(--line);
  color: var(--ink);
}

.rank-list a:hover {
  border-color: var(--link);
  text-decoration: none;
}

.rank-list a::before {
  content: counter(rank);
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  background: var(--accent);
  color: #fff;
  font-weight: 800;
  border-radius: 3px;
}

.pill {
  display: inline-block;
  color: #fff;
  background: var(--teal);
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 700;
  border-radius: 3px;
  white-space: nowrap;
}

.pill.tier-s {
  background: #be2f34;
}

.pill.tier-a {
  background: #b77715;
}

.pill.tier-b {
  background: #1c7c78;
}

.pill.tier-c {
  background: #5b6773;
}

.pill.unlock-free {
  background: #1f7a4c;
}

.pill.unlock-cogs {
  background: #1260a3;
}

.pill.unlock-locked {
  background: #66717d;
}

.source-link {
  display: inline-block;
  margin-left: 4px;
  padding: 1px 6px;
  font-size: 12px;
  font-weight: 600;
  color: #9e2a1f;
  background: #fff1ef;
  border: 1px solid #f2c7c2;
  border-radius: 3px;
  white-space: nowrap;
}

.source-link:hover {
  background: #ffe3df;
  text-decoration: none;
}

.article-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 270px;
  gap: 18px;
  align-items: start;
}

.article {
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.article-header {
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.article-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.article-body {
  padding: 18px;
}

.article-body h2 {
  margin-top: 28px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--accent);
}

.article-body h2:first-child {
  margin-top: 0;
}

.article-body h3 {
  margin-top: 18px;
}

.article-body p,
.article-body ul,
.article-body ol {
  margin: 10px 0;
}

.article-body li {
  margin: 5px 0;
}

.side-card {
  position: sticky;
  top: 14px;
  background: var(--panel);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  padding: 14px;
  max-height: calc(100vh - 28px);
  overflow-y: auto;
}

.side-card h2 {
  font-size: 17px;
  margin-bottom: 10px;
}

.toc-list a,
.link-list a {
  display: block;
  padding: 6px 0;
  border-top: 1px solid var(--line);
  font-size: 14px;
}

.toc-list li:first-child a,
.link-list li:first-child a {
  border-top: 0;
}

.info-box,
.warning-box {
  margin: 16px 0;
  padding: 12px 14px;
  border-left: 4px solid var(--teal);
  background: #eff9f8;
  font-size: 14px;
}

.warning-box {
  border-left-color: var(--gold);
  background: #fff7e8;
}

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 12px 0 8px;
  padding: 10px 12px;
  background: #f9fbfc;
  border: 1px solid var(--line);
}

.table-toolbar-left {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.table-toolbar-right {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.table-search {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 13px;
  min-width: 190px;
}

.table-search:focus {
  outline: none;
  border-color: var(--link);
}

.table-wrap {
  overflow-x: auto;
  margin: 8px 0 16px;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  min-width: 560px;
  font-size: 14px;
}

th,
td {
  border: 1px solid var(--line);
  padding: 8px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #eef3f7;
  font-weight: 700;
}

th[data-sort-col] {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

th[data-sort-col]:hover {
  background: #e2eaf1;
}

.sort-indicator {
  display: inline-block;
  margin-left: 4px;
  font-size: 11px;
  color: var(--muted);
}

th[data-sort-dir="asc"] .sort-indicator,
th[data-sort-dir="desc"] .sort-indicator {
  color: var(--accent);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}

.filter-btn {
  appearance: none;
  border: 1px solid var(--line);
  background: #f9fbfc;
  color: var(--ink);
  padding: 5px 10px;
  font-size: 13px;
  border-radius: 4px;
  cursor: pointer;
}

.filter-btn:hover {
  border-color: #b5c3d1;
}

.filter-btn.is-active {
  background: #17202a;
  color: #fff;
  border-color: #17202a;
}

.hero-entry {
  border: 1px solid var(--line);
  background: #fff;
  margin: 16px 0;
  scroll-margin-top: 16px;
}

.hero-entry-head {
  display: grid;
  grid-template-columns: 128px minmax(0, 1fr);
  gap: 14px;
  padding: 14px;
  background: #f9fbfc;
  border-bottom: 1px solid var(--line);
  align-items: center;
}

.hero-portrait {
  width: 128px;
  height: 72px;
  object-fit: cover;
  border-radius: 3px;
  background: #1a242e;
}

.hero-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.hero-sub {
  margin-top: 5px;
  font-size: 13px;
  color: var(--muted);
}

.hero-entry-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  padding: 14px;
}

.hero-block {
  border: 1px solid #e7edf2;
  background: #fcfdfe;
  padding: 10px 12px;
}

.hero-block.full {
  grid-column: 1 / -1;
}

.hero-block h4 {
  color: var(--accent-dark);
  margin-bottom: 6px;
}

.hero-block ul {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
}

.hero-block p {
  margin: 4px 0 0;
  font-size: 14px;
}

.footer {
  margin-top: 26px;
  padding: 24px 18px 34px;
  background: #17202a;
  color: #d7e1ea;
  font-size: 13px;
}

.footer-inner {
  max-width: 1180px;
  margin: 0 auto;
}

.footer a {
  color: #fff;
}

.empty-search {
  display: none;
  padding: 16px;
  color: var(--muted);
}

.is-hidden {
  display: none !important;
}

@media (max-width: 900px) {
  .hero,
  .article-layout {
    grid-template-columns: 1fr;
  }

  .grid.cols-3,
  .grid.cols-2,
  .hero-entry-grid {
    grid-template-columns: 1fr;
  }

  .side-card {
    position: static;
    max-height: none;
  }
}

@media (max-width: 640px) {
  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .search-box input {
    width: 100%;
  }

  .container {
    padding: 12px;
  }

  .guide-card,
  .info-card {
    grid-template-columns: 88px minmax(0, 1fr);
  }

  .info-card.no-thumb {
    grid-template-columns: minmax(0, 1fr);
  }

  .thumb {
    width: 88px;
    height: 50px;
  }

  .hero-entry-head {
    grid-template-columns: 96px minmax(0, 1fr);
  }

  .hero-portrait {
    width: 96px;
    height: 54px;
  }

  .update-list li {
    grid-template-columns: 84px 1fr;
  }

  .rank-list a {
    grid-template-columns: 32px minmax(0, 1fr);
  }

  .rank-list .pill {
    grid-column: 2;
    width: max-content;
  }
}
