:root {
  --bg: #f4f6f8;
  --surface: #ffffff;
  --text: #1a2332;
  --muted: #5b6b7c;
  --line: #e6ebf0;
  --brand: #0f766e;
  --brand-2: #0d9488;
  --brand-soft: #ecfdf8;
  --accent: #ea580c;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
  --radius: 14px;
  --max: 1180px;
  --font: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background:
    radial-gradient(1200px 500px at 10% -10%, #d8f3ef 0%, transparent 55%),
    radial-gradient(900px 420px at 100% 0%, #ffe8d6 0%, transparent 50%),
    var(--bg);
  line-height: 1.65;
}
a { color: inherit; text-decoration: none; }
a:hover { color: var(--brand); }
img { max-width: 100%; height: auto; display: block; }
.wrap { width: min(100% - 32px, var(--max)); margin-inline: auto; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: blur(12px);
  background: rgba(255,255,255,0.86);
  border-bottom: 1px solid rgba(230,235,240,0.9);
}
.header-inner {
  display: flex; align-items: center; gap: 20px;
  min-height: 64px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 800; font-size: 1.15rem; letter-spacing: -0.02em;
  white-space: nowrap;
}
.brand-mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #115e59);
  color: #fff; display: grid; place-items: center; font-size: 14px;
}
.nav-toggle {
  display: none; margin-left: auto; width: 42px; height: 42px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff;
  align-items: center; justify-content: center; flex-direction: column; gap: 5px; cursor: pointer;
}
.nav-toggle span {
  display: block; width: 18px; height: 2px; background: var(--text); border-radius: 2px;
}
.primary-nav { margin-left: auto; }
.primary-nav .menu {
  list-style: none; margin: 0; padding: 0;
  display: flex; align-items: center; gap: 4px; flex-wrap: wrap;
}
.primary-nav .menu > .menu-item { position: relative; }
.primary-nav .menu > .menu-item > a {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 8px 12px; border-radius: 999px; color: var(--muted); font-size: 0.92rem;
}
.primary-nav .menu > .menu-item > a:hover,
.primary-nav .current-menu-item > a,
.primary-nav .current-menu-ancestor > a {
  background: var(--brand-soft); color: var(--brand);
}
.primary-nav .menu-item-has-children > a::after {
  content: ""; width: 0; height: 0;
  border-left: 4px solid transparent; border-right: 4px solid transparent;
  border-top: 5px solid currentColor; opacity: .55;
}
.primary-nav .sub-menu {
  list-style: none; margin: 0; padding: 8px;
  position: absolute; left: 0; top: calc(100% + 6px);
  min-width: 200px; background: #fff; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow);
  opacity: 0; visibility: hidden; transform: translateY(6px);
  transition: .16s ease; z-index: 60;
}
.primary-nav .menu > .menu-item:hover > .sub-menu,
.primary-nav .menu > .menu-item:focus-within > .sub-menu,
.primary-nav .menu > .menu-item.open > .sub-menu {
  opacity: 1; visibility: visible; transform: none;
}
.primary-nav .sub-menu .menu-item { position: relative; }
.primary-nav .sub-menu a {
  display: block; padding: 9px 12px; border-radius: 10px;
  color: var(--text); font-size: 0.9rem; white-space: nowrap;
}
.primary-nav .sub-menu a:hover { background: var(--brand-soft); color: var(--brand); }
.primary-nav .sub-menu .sub-menu {
  top: -8px; left: calc(100% + 6px);
}
.header-search { display: none; }
@media (min-width: 900px) {
  .header-search { display: block; width: 220px; }
}
@media (max-width: 899px) {
  .nav-toggle { display: inline-flex; }
  .primary-nav {
    display: none; position: absolute; left: 0; right: 0; top: 64px;
    background: rgba(255,255,255,0.98); border-bottom: 1px solid var(--line);
    padding: 12px 16px 18px; box-shadow: var(--shadow);
  }
  .primary-nav.is-open { display: block; }
  .primary-nav .menu { flex-direction: column; align-items: stretch; }
  .primary-nav .menu > .menu-item > a { border-radius: 10px; }
  .primary-nav .sub-menu,
  .primary-nav .sub-menu .sub-menu {
    position: static; opacity: 1; visibility: visible; transform: none;
    display: none; box-shadow: none; border: 0; padding: 4px 0 4px 14px;
    min-width: 0; background: transparent;
  }
  .primary-nav .menu-item.open > .sub-menu { display: block; }
}

/* Hero */
.hero {
  padding: 48px 0 28px;
}
.hero-card {
  background: linear-gradient(145deg, #0f766e 0%, #134e4a 48%, #1e293b 100%);
  color: #fff; border-radius: 22px; padding: 36px 32px;
  box-shadow: var(--shadow);
  position: relative; overflow: hidden;
}
.hero-card::after {
  content: ""; position: absolute; inset: auto -40px -60px auto;
  width: 260px; height: 260px; border-radius: 50%;
  background: rgba(255,255,255,0.08);
}
.hero h1 {
  margin: 0 0 10px; font-size: clamp(1.6rem, 3vw, 2.2rem);
  letter-spacing: -0.03em; max-width: 18em;
}
.hero p { margin: 0 0 22px; color: rgba(255,255,255,0.82); max-width: 36em; }
.hero-search {
  display: flex; gap: 10px; max-width: 520px; position: relative; z-index: 1;
}
.hero-search input,
.search-field {
  flex: 1; border: 0; border-radius: 12px; padding: 14px 16px;
  font-size: 1rem; outline: none;
}
.hero-search button,
.btn {
  border: 0; border-radius: 12px; padding: 0 18px;
  background: var(--accent); color: #fff; font-weight: 700; cursor: pointer;
}
.btn-ghost {
  background: transparent; border: 1px solid var(--line); color: var(--text);
}

/* Category chips */
.cat-grid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px;
  margin: 22px 0 8px;
}
@media (min-width: 720px) {
  .cat-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 980px) {
  .cat-grid { grid-template-columns: repeat(6, 1fr); }
}
.cat-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 16px; padding: 16px 14px; box-shadow: var(--shadow);
  transition: transform .18s ease, border-color .18s ease;
}
.cat-card:hover { transform: translateY(-2px); border-color: #99f6e4; }
.cat-card strong { display: block; font-size: 0.95rem; margin-bottom: 4px; }
.cat-card span { color: var(--muted); font-size: 0.8rem; }

/* Sections */
.section { padding: 28px 0; }
.section-head {
  display: flex; align-items: end; justify-content: space-between;
  gap: 12px; margin-bottom: 16px;
}
.section-head h2 { margin: 0; font-size: 1.25rem; letter-spacing: -0.02em; }
.section-head p { margin: 4px 0 0; color: var(--muted); font-size: 0.9rem; }
.section-head a { color: var(--brand); font-size: 0.9rem; }

/* Post cards */
.post-grid {
  display: grid; grid-template-columns: 1fr; gap: 16px;
}
@media (min-width: 720px) {
  .post-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 1020px) {
  .post-grid { grid-template-columns: repeat(3, 1fr); }
}
.post-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  display: flex; flex-direction: column; min-height: 100%;
  transition: transform .18s ease;
}
.post-card:hover { transform: translateY(-3px); }
.post-thumb {
  aspect-ratio: 16/9; background: #e2e8f0; overflow: hidden;
}
.post-thumb img { width: 100%; height: 100%; object-fit: cover; }
.post-thumb.placeholder {
  display: grid; place-items: center;
  background: linear-gradient(135deg, #ccfbf1, #e2e8f0);
  color: var(--brand); font-weight: 800; font-size: 1.4rem;
}
.post-body { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.post-body h3 { margin: 0; font-size: 1.05rem; line-height: 1.4; letter-spacing: -0.01em; }
.post-body .excerpt { margin: 0; color: var(--muted); font-size: 0.9rem; flex: 1; }
.meta { display: flex; flex-wrap: wrap; gap: 10px; color: var(--muted); font-size: 0.8rem; }

/* Rank lists (codefather / ahhhhfs style) */
.rank-grid {
  display: grid; gap: 16px;
  grid-template-columns: 1fr;
}
@media (min-width: 900px) {
  .rank-grid { grid-template-columns: repeat(2, 1fr); }
}
.rank-panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
}
.rank-panel h3 {
  margin: 0 0 12px; font-size: 1.05rem;
  display: flex; justify-content: space-between; align-items: center;
}
.rank-panel h3 a { color: var(--brand); font-size: 0.85rem; font-weight: 600; }
.rank-list { list-style: none; margin: 0; padding: 0; }
.rank-list li {
  display: grid; grid-template-columns: 28px 1fr auto; gap: 10px;
  align-items: start; padding: 10px 0; border-top: 1px solid var(--line);
}
.rank-list li:first-child { border-top: 0; padding-top: 0; }
.rank-no {
  width: 24px; height: 24px; border-radius: 8px;
  display: grid; place-items: center; font-size: 0.75rem; font-weight: 800;
  background: #e2e8f0; color: #475569;
}
.rank-list li:nth-child(-n+3) .rank-no {
  background: var(--brand); color: #fff;
}
.rank-title { font-size: 0.92rem; line-height: 1.4; }
.rank-views { color: var(--muted); font-size: 0.78rem; white-space: nowrap; }

/* Content */
.content-layout {
  display: grid; gap: 22px; padding: 28px 0 48px;
}
@media (min-width: 980px) {
  .content-layout { grid-template-columns: minmax(0, 1fr) 300px; }
}
.article, .panel {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow);
}
.article { padding: 28px 24px; }
.article h1 { margin-top: 0; letter-spacing: -0.02em; }
.article .entry-content { font-size: 1.02rem; }
.article .entry-content h2, .article .entry-content h3 { margin-top: 1.6em; }
.article .entry-content a { color: var(--brand-2); text-decoration: underline; }
.article .entry-content pre,
.article .entry-content code {
  background: #0f172a; color: #e2e8f0; border-radius: 8px;
}
.article .entry-content pre { padding: 14px; overflow: auto; }
.article .entry-content code { padding: 2px 6px; }
.panel { padding: 16px; }
.panel h3 { margin: 0 0 12px; font-size: 1rem; }
.side-list { list-style: none; margin: 0; padding: 0; }
.side-list li { padding: 8px 0; border-top: 1px solid var(--line); }
.side-list li:first-child { border-top: 0; padding-top: 0; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--line);
  background: #0f172a; color: #cbd5e1; padding: 36px 0 28px; margin-top: 20px;
}
.site-footer a { color: #e2e8f0; }
.footer-grid {
  display: grid; gap: 18px;
  grid-template-columns: 1fr;
}
@media (min-width: 800px) {
  .footer-grid { grid-template-columns: 2fr 1fr 1fr; }
}
.site-footer h4 { margin: 0 0 10px; color: #fff; }
.muted { color: var(--muted); }
.footer-copy { margin-top: 22px; font-size: 0.85rem; color: #94a3b8; }

/* Forms */
.search-form { display: flex; gap: 8px; }
.search-form .search-submit {
  border: 0; border-radius: 10px; padding: 0 14px;
  background: var(--brand); color: #fff; cursor: pointer;
}

.page-title { padding: 28px 0 0; }
.page-title h1 { margin: 0; font-size: 1.6rem; }
.pagination {
  display: flex; gap: 8px; justify-content: center; padding: 24px 0 8px;
}
.pagination a, .pagination span {
  padding: 8px 12px; border-radius: 10px; background: var(--surface);
  border: 1px solid var(--line);
}
.pagination .current { background: var(--brand); color: #fff; border-color: var(--brand); }

.tags { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 24px; }
.tags a {
  background: var(--brand-soft); color: var(--brand);
  padding: 6px 10px; border-radius: 999px; font-size: 0.82rem;
}
