/* Ranklist · Apple-style design system */
:root {
  --bg: #ffffff;
  --bg-alt: #f5f5f7;
  --text: #1d1d1f;
  --text-2: #6e6e73;
  --blue: #0071e3;
  --blue-hover: #0077ed;
  --radius: 18px;
  --shadow: 0 4px 24px rgba(0, 0, 0, .06);
  --shadow-hover: 0 12px 40px rgba(0, 0, 0, .12);
  --nav-h: 48px;
}
* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Helvetica Neue", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -.01em;
}
a { color: var(--blue); text-decoration: none; }
img { display: block; max-width: 100%; }
button { font: inherit; border: 0; background: none; cursor: pointer; }

/* ---------- 导航 ---------- */
#siteNav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  height: var(--nav-h);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 max(24px, env(safe-area-inset-left));
  background: rgba(255, 255, 255, .72);
  backdrop-filter: saturate(180%) blur(20px);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom: 1px solid transparent;
  transition: background .3s, border-color .3s;
}
#siteNav.scrolled { border-bottom-color: rgba(0, 0, 0, .08); background: rgba(255, 255, 255, .85); }
.nav-logo { font-size: 21px; font-weight: 700; color: var(--text); letter-spacing: -.02em; display: flex; align-items: center; gap: 8px; }
.nav-logo .logo-mark { height: 24px; width: auto; display: block; }
.nav-actions { display: flex; align-items: center; gap: 10px; }
.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text); background: rgba(0, 0, 0, .05);
  transition: background .2s, transform .2s;
}
.icon-btn:hover { background: rgba(0, 0, 0, .09); }
.icon-btn:active { transform: scale(.93); }
.icon-btn svg { width: 17px; height: 17px; }

/* 语言选择器 */
.lang-switch { position: relative; }
#langBtn.open { background: rgba(0, 0, 0, .09); }
#langMenu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 110;
  width: 190px; max-height: 380px; overflow-y: auto;
  background: rgba(255, 255, 255, .92);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  border-radius: 14px; box-shadow: var(--shadow-hover);
  padding: 6px; opacity: 0; transform: translateY(-6px) scale(.98);
  pointer-events: none; transition: opacity .22s, transform .22s;
}
#langMenu.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.lang-item { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border-radius: 8px; font-size: 13px; color: var(--text); text-align: left; transition: background .15s; }
.lang-item:hover { background: rgba(0, 0, 0, .05); }
.lang-item .flag { font-size: 15px; }

/* ---------- Hero v5 · 浅色一体式：莫比乌斯环 ---------- */
.hero {
  position: relative; overflow: hidden;
  min-height: min(48vh, 440px);
  display: flex; align-items: center; justify-content: center;
  padding: calc(var(--nav-h) + 26px) 24px 42px;
  background: radial-gradient(58% 54% at 50% 44%, #f1f2f6 0%, #ffffff 74%);
  color: var(--text);
}
#heroCanvas { position: absolute; inset: 0; width: 100%; height: 100%; z-index: 1; }
.hero-inner { position: relative; z-index: 3; max-width: 980px; text-align: center; }
.hero h1 {
  font-size: clamp(40px, 7vw, 80px);
  font-weight: 700; letter-spacing: -.025em; line-height: 1.05;
  color: #1d1d1f;
  animation: rise .8s ease both;
}
.hero-sub {
  font-size: clamp(15px, 2vw, 19px); color: var(--text-2);
  margin-top: 14px; font-weight: 500;
  animation: rise .8s .2s ease both;
}
.hero-cta {
  display: flex; align-items: center; justify-content: center;
  gap: 28px; margin-top: 32px; flex-wrap: wrap;
  animation: rise .8s .32s ease both;
}
.btn-primary {
  display: inline-flex; align-items: center;
  background: #0071e3; color: #fff;
  font-size: 15px; font-weight: 550; letter-spacing: .01em;
  padding: 12px 28px; border-radius: 980px;
  box-shadow: 0 4px 16px rgba(0, 113, 227, .22);
  transition: background .25s, transform .25s cubic-bezier(.2, .7, .3, 1), box-shadow .25s;
}
.btn-primary:hover { background: #0077ed; transform: translateY(-1px); box-shadow: 0 8px 24px rgba(0, 113, 227, .3); }
.btn-primary:active { transform: translateY(0); }
.link-secondary {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 15px; font-weight: 550; color: var(--blue);
}
.link-secondary .arr { transition: transform .25s cubic-bezier(.2, .7, .3, 1); }
.link-secondary:hover .arr { transform: translateX(4px); }
.cat-section { scroll-margin-top: 64px; }

@keyframes rise { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }

/* ---------- 分类区 ---------- */
main { max-width: 1440px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 32px); }
.cat-section { padding: 56px 0 8px; }
.cat-head { display: flex; align-items: center; gap: 16px; margin-bottom: 24px; }
.cat-icon { font-size: 34px; }
.cat-head h2 { font-size: clamp(24px, 3.4vw, 32px); font-weight: 700; letter-spacing: -.02em; }
.cat-head p { font-size: 14px; color: var(--text-2); margin-top: 2px; }

/* 卡片网格（统一高度） */
.masonry { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; }
.masonry .rcard { min-width: 0; }

/* 卡片 */
.rcard {
  display: flex; flex-direction: column;
  border-radius: var(--radius); overflow: hidden;
  background: var(--bg-alt);
  box-shadow: var(--shadow);
  transition: transform .35s cubic-bezier(.2, .7, .3, 1), box-shadow .35s;
}
.rcard:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); }
.rcard-media { position: relative; height: 132px; overflow: hidden; }
.rcard-media .card-bg { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform .6s cubic-bezier(.2, .7, .3, 1); }
.rcard:hover .card-bg { transform: scale(1.06); }
.card-gradient { position: absolute; inset: 0; width: 100%; height: 100%; opacity: .92; transition: opacity .35s; }
.rcard:hover .card-gradient { opacity: 1; }
.g0 { background: linear-gradient(135deg, #0a84ff, #64d2ff); }
.g1 { background: linear-gradient(135deg, #5e5ce6, #bf5af2); }
.g2 { background: linear-gradient(135deg, #ff375f, #ff9f0a); }
.g3 { background: linear-gradient(135deg, #30d158, #64d2ff); }
.g4 { background: linear-gradient(135deg, #ff9f0a, #ffd60a); }
.g5 { background: linear-gradient(135deg, #bf5af2, #0a84ff); }
.g6 { background: linear-gradient(135deg, #64d2ff, #30d158); }
.g7 { background: linear-gradient(135deg, #ff6482, #bf5af2); }
.rcard-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.rcard-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.rcard-top h3 {
  font-size: 16px; font-weight: 600; line-height: 1.3; letter-spacing: -.01em;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.6em;
}
.rcard-top .count { font-size: 12px; font-weight: 700; color: #fff; background: var(--text); border-radius: 980px; padding: 2px 9px; white-space: nowrap; }
.rcard-desc { display: none; }
.card-link { font-size: 13px; font-weight: 600; margin-top: auto; }
.card-link.live { color: var(--blue); transition: color .2s; }
.card-link.live:hover { color: var(--blue-hover); }
.card-link.soon { color: var(--text-2); font-weight: 500; }

/* 已上线卡片 */
.rcard.live-card { background: #fff; }

/* ---------- 排名详情页 ---------- */
.ranking-hero {
  position: relative; min-height: 420px;
  display: flex; align-items: flex-end;
  padding: calc(var(--nav-h) + 80px) 32px 56px;
  color: #fff; overflow: hidden;
}
.ranking-hero .cover {
  position: absolute; inset: 0;
  background: url("../../images/covers/programming-languages.jpg") center 38% / cover no-repeat;
  animation: heroZoom 12s ease-out both;
}
@keyframes heroZoom { from { transform: scale(1.12); } to { transform: scale(1); } }
.ranking-hero .veil {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(10, 10, 14, .18) 0%, rgba(10, 10, 14, .42) 55%, rgba(10, 10, 14, .82) 100%);
}
.ranking-hero .inner { position: relative; max-width: 1440px; margin: 0 auto; width: 100%; animation: rise .9s ease both; }
.ranking-hero .badge {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 12px; font-weight: 600; letter-spacing: .02em;
  background: rgba(255, 255, 255, .16); border: 1px solid rgba(255, 255, 255, .28);
  padding: 6px 14px; border-radius: 980px; margin-bottom: 18px;
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
}
.ranking-hero .dot { width: 7px; height: 7px; border-radius: 50%; background: #30d158; box-shadow: 0 0 10px #30d158; }
.ranking-hero h1 { font-size: clamp(34px, 5.6vw, 62px); font-weight: 700; letter-spacing: -.02em; line-height: 1.08; text-shadow: 0 2px 24px rgba(0,0,0,.3); }
.ranking-hero .sub { font-size: clamp(15px, 2vw, 19px); opacity: .92; margin-top: 12px; max-width: 720px; }

.container { max-width: 1080px; margin: 0 auto; padding: 0 clamp(16px, 3vw, 32px); }

/* 排序标准 */
.criteria-card {
  background: var(--bg-alt); border-radius: var(--radius);
  padding: 28px 30px; margin-top: 36px;
  box-shadow: var(--shadow);
}
.criteria-card h2 { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.criteria-card p { font-size: 15px; color: var(--text-2); }
.criteria-card p b { color: var(--text); }

/* 领奖台 Top3 */
.podium-wrap { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 48px 0 12px; }
.podium-wrap .rows { grid-column: 1 / -1; margin: 0; }
.podium {
  border-radius: var(--radius); padding: 30px 26px;
  background: var(--bg-alt); box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 12px; align-items: flex-start;
  transition: transform .35s cubic-bezier(.2, .7, .3, 1), box-shadow .35s;
}
.podium:hover { transform: translateY(-6px); box-shadow: var(--shadow-hover); }
.podium.gold   { border-top: 4px solid #ffd60a; }
.podium.silver { border-top: 4px solid #a5a5ab; }
.podium.bronze { border-top: 4px solid #d29d66; }
.podium-rank { font-size: 13px; font-weight: 700; color: var(--text-2); letter-spacing: .06em; }
.podium .podium-avatar, .row-item .row-avatar {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 22px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, var(--c, #0a84ff), var(--c2, #5e5ce6));
  box-shadow: 0 6px 16px color-mix(in srgb, var(--c, #0a84ff) 35%, transparent);
}
.podium h3 { font-size: 22px; font-weight: 700; letter-spacing: -.02em; }
.podium .en { font-size: 13px; color: var(--text-2); }
.podium .desc { font-size: 14px; color: var(--text-2); line-height: 1.55; }

/* 分数条 */
.score-wrap, .row-score { display: flex; align-items: center; gap: 12px; width: 100%; }
.row-score { width: 190px; flex: none; }
.score-bar {
  flex: 1; height: 6px; border-radius: 980px;
  background: rgba(0, 0, 0, .07); overflow: hidden;
}
.score-bar span {
  display: block; height: 100%; border-radius: inherit;
  background: linear-gradient(90deg, var(--c, #0a84ff), #5e5ce6);
  width: 0; transition: width 1.1s cubic-bezier(.2, .7, .3, 1);
}
.visible .score-bar span { width: var(--w, 0%); }
.score-num, .row-score span:last-child { font-size: 13px; font-weight: 700; font-variant-numeric: tabular-nums; }

.visit, .row-link {
  font-size: 13px; font-weight: 600; color: var(--blue);
  transition: color .2s;
}
.visit:hover, .row-link:hover { color: var(--blue-hover); text-decoration: underline; }

/* 4-30 行条目 */
.rows { display: flex; flex-direction: column; gap: 12px; margin: 12px 0 48px; }
.row-item {
  display: flex; align-items: center; gap: 18px;
  background: var(--bg-alt); border-radius: 16px;
  padding: 18px 22px; box-shadow: var(--shadow);
  transition: transform .3s cubic-bezier(.2, .7, .3, 1), box-shadow .3s, background .3s;
}
.row-item:hover { transform: translateY(-3px); box-shadow: var(--shadow-hover); background: #fff; }
.row-rank { width: 34px; font-size: 17px; font-weight: 700; color: var(--text-2); font-variant-numeric: tabular-nums; flex: none; }
.row-avatar { width: 44px; height: 44px; border-radius: 12px; font-size: 18px; flex: none; }
.row-main { flex: 1; min-width: 0; }
.row-name { font-size: 16px; font-weight: 650; display: flex; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.row-en { font-size: 12px; font-weight: 500; color: var(--text-2); }
.row-desc { font-size: 13.5px; color: var(--text-2); margin-top: 5px; line-height: 1.5; }
.row-link { flex: none; white-space: nowrap; }

/* 参考来源 */
.sources-title { font-size: clamp(24px, 3.4vw, 32px); font-weight: 700; letter-spacing: -.02em; margin: 56px 0 6px; }
.sources-note { font-size: 14px; color: var(--text-2); margin-bottom: 24px; }
.source-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; padding-bottom: 64px; }
.source-card {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--bg-alt); border-radius: 16px; padding: 20px 22px;
  box-shadow: var(--shadow); color: var(--text);
  transition: transform .3s cubic-bezier(.2, .7, .3, 1), box-shadow .3s;
}
.source-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-hover); }
.s-name { font-size: 14px; font-weight: 650; }
.s-weight { align-self: flex-start; font-size: 11px; font-weight: 700; color: var(--blue); background: rgba(0, 113, 227, .1); border-radius: 980px; padding: 2px 10px; }
.s-url { font-size: 12px; color: var(--text-2); word-break: break-all; }

/* 更新时间徽章 */
.updated-pill {
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 550; color: var(--text-2);
  background: var(--bg-alt); border-radius: 980px; padding: 8px 18px;
  margin: 40px 0 0; box-shadow: var(--shadow);
}

/* ---------- 搜索面板 ---------- */
.search-pop {
  position: fixed; inset: 0; z-index: 200;
  display: flex; justify-content: center; align-items: flex-start;
  padding-top: 16vh;
  background: rgba(250, 250, 252, .62);
  backdrop-filter: saturate(180%) blur(24px);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  opacity: 0; pointer-events: none;
  transition: opacity .25s ease;
}
.search-pop.open { opacity: 1; pointer-events: auto; }
.search-panel { width: min(580px, 92vw); }
.search-box {
  display: flex; align-items: center; gap: 12px;
  background: #fff; border-radius: 16px; padding: 15px 18px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .18);
}
.search-box svg { width: 19px; height: 19px; color: var(--text-2); flex: none; }
.search-box input {
  flex: 1; border: 0; outline: 0; background: transparent;
  font-size: 17px; font-family: inherit; color: var(--text);
}
.search-box kbd {
  font: 600 10px/1 -apple-system, sans-serif; color: var(--text-2);
  background: rgba(0, 0, 0, .06); border-radius: 6px; padding: 5px 7px;
}
.search-results {
  margin-top: 10px; background: #fff; border-radius: 16px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, .16);
  overflow: hidden auto; max-height: 52vh;
}
.search-results:empty { display: none; }
.sr-item {
  display: flex; align-items: center; gap: 12px;
  padding: 13px 18px; cursor: pointer;
  transition: background .15s;
}
.sr-item + .sr-item { border-top: 1px solid rgba(0, 0, 0, .05); }
.sr-item:hover { background: #f5f5f7; }
.sr-name { font-size: 14px; font-weight: 550; flex: 1; }
.sr-cat { font-size: 11px; font-weight: 600; color: var(--text-2); background: rgba(0, 0, 0, .05); border-radius: 980px; padding: 3px 10px; white-space: nowrap; }
.sr-badge { font-size: 11px; font-weight: 700; color: #fff; background: #0a84ff; border-radius: 980px; padding: 3px 10px; white-space: nowrap; }
.sr-empty { padding: 22px; text-align: center; font-size: 14px; color: var(--text-2); }
.rcard.flash { box-shadow: 0 0 0 3px rgba(10, 132, 255, .5), var(--shadow-hover); }

/* ---------- 页脚 ---------- */
footer {
  border-top: 1px solid rgba(0, 0, 0, .08);
  padding: 36px 24px 48px; text-align: center;
  color: var(--text-2); font-size: 13px;
  background: var(--bg-alt);
}
footer .foot-links { display: flex; justify-content: center; gap: 24px; margin-bottom: 14px; flex-wrap: wrap; }
footer a { color: var(--text-2); transition: color .2s; }
footer a:hover { color: var(--text); }

/* ---------- 滚动显现 ---------- */
[data-reveal] { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s cubic-bezier(.2, .7, .3, 1); }
[data-reveal].visible { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  [data-reveal] { opacity: 1; transform: none; transition: none; }
  .ranking-hero .cover { animation: none; }
}

/* ---------- 响应式 ---------- */
@media (max-width: 1240px) { .masonry { grid-template-columns: repeat(3, 1fr); } }
@media (max-width: 1024px) {
  .podium-wrap { grid-template-columns: 1fr; }
  .row-item { flex-wrap: wrap; }
  .row-score { width: 100%; order: 4; }
}
@media (max-width: 900px) { .masonry { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 1024px) {
  .hero-cards { grid-template-columns: 1fr 1fr; }
  .hcard-live { grid-column: 1 / -1; }
}
@media (max-width: 768px) {
  body { font-size: 16px; }
  .search-pop { padding-top: 10vh; }
  .hero { min-height: min(50vh, 420px); padding-top: calc(var(--nav-h) + 22px); padding-bottom: 32px; }
  .masonry { gap: 14px; }
  .rcard-media { height: 104px !important; }
  .row-item { padding: 16px; gap: 12px; }
  .row-rank { width: 26px; font-size: 15px; }
}
@media (max-width: 480px) {
  .masonry { gap: 12px; }
  .masonry .rcard { margin-bottom: 0; }
  .rcard-media { height: 96px !important; }
  .rcard-body { padding: 11px 13px 13px; gap: 7px; }
  .rcard-top h3 { font-size: 13.5px; }
  .rcard-top .count { font-size: 10px; padding: 2px 7px; }
  .card-link { font-size: 12px; }
  .ranking-hero { padding-left: 20px; padding-right: 20px; min-height: 360px; }
}
