:root {
  --bg: #f5f7fb;
  --surface: rgba(255, 255, 255, 0.86);
  --surface-solid: #ffffff;
  --surface-2: #eef2f7;
  --text: #111827;
  --muted: #667085;
  --line: rgba(17, 24, 39, 0.09);
  --accent: #10a37f;
  --accent-dark: #087f64;
  --accent-soft: rgba(16, 163, 127, 0.11);
  --orange: #ff7a45;
  --shadow: 0 22px 60px rgba(31, 41, 55, 0.08);
  --radius: 22px;
}

[data-theme="dark"] {
  --bg: #0b1017;
  --surface: rgba(20, 27, 37, 0.88);
  --surface-solid: #141b25;
  --surface-2: #1b2430;
  --text: #f4f7fb;
  --muted: #98a2b3;
  --line: rgba(255, 255, 255, 0.09);
  --accent: #27c79b;
  --accent-dark: #15aa84;
  --accent-soft: rgba(39, 199, 155, 0.13);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  line-height: 1.5;
  min-height: 100vh;
  transition: background .25s ease, color .25s ease;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.ambient {
  position: fixed;
  width: 440px;
  height: 440px;
  border-radius: 50%;
  filter: blur(100px);
  pointer-events: none;
  opacity: .16;
  z-index: -1;
}
.ambient-a { background: #20c997; top: -180px; right: 8%; }
.ambient-b { background: #7c5cff; bottom: 8%; left: -220px; opacity: .1; }

.topbar {
  height: 72px;
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 11px;
  color: var(--text);
  text-decoration: none;
  font-weight: 760;
  letter-spacing: -.02em;
}
.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  color: white;
  background: linear-gradient(145deg, var(--accent), #4ad5b4);
  box-shadow: 0 8px 20px rgba(16, 163, 127, .24);
}
.top-actions { display: flex; align-items: center; gap: 12px; }
.live-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  background: var(--surface);
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 999px;
  backdrop-filter: blur(12px);
}
.live-badge i {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f59e0b;
  box-shadow: 0 0 0 4px rgba(245, 158, 11, .12);
}
.live-badge.live i { background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
}

.page-shell { max-width: 1240px; margin: 0 auto; padding: 0 24px 80px; }
.hero { padding: 70px 0 52px; max-width: 900px; }
.eyebrow, .section-kicker {
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .14em;
  margin: 0 0 14px;
}
.hero h1 {
  margin: 0;
  font-size: clamp(44px, 6.4vw, 78px);
  line-height: 1.03;
  letter-spacing: -.055em;
  font-weight: 850;
}
.hero h1 span {
  background: linear-gradient(90deg, var(--accent-dark), #24b58e 48%, #5b8def);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.hero-copy {
  max-width: 720px;
  color: var(--muted);
  font-size: 17px;
  margin: 26px 0 0;
  line-height: 1.8;
}
.hero-actions { display: flex; gap: 12px; flex-wrap: wrap; margin-top: 30px; }
.primary-btn, .secondary-btn {
  min-height: 44px;
  padding: 0 18px;
  border-radius: 12px;
  border: 1px solid transparent;
  font-weight: 700;
  transition: transform .18s ease, box-shadow .18s ease, opacity .18s ease;
}
.primary-btn { background: var(--text); color: var(--bg); box-shadow: 0 10px 24px rgba(17, 24, 39, .13); }
.secondary-btn { background: var(--surface); color: var(--text); border-color: var(--line); }
.primary-btn:hover, .secondary-btn:hover { transform: translateY(-1px); }
.primary-btn:disabled, .secondary-btn:disabled { cursor: wait; opacity: .55; transform: none; }
.hero-meta { margin-top: 18px; color: var(--muted); font-size: 12px; display: flex; gap: 18px; flex-wrap: wrap; }

.baseline-panel, .table-panel, .method-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}
.baseline-panel { padding: 26px; margin-bottom: 72px; }
.section-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin-bottom: 26px; }
.section-heading.compact { align-items: center; margin-bottom: 18px; }
.section-heading h2, .method-panel h2 { margin: 0; font-size: 30px; letter-spacing: -.035em; }
.section-kicker { margin-bottom: 6px; }
.hint { color: var(--muted); font-size: 12px; }
.baseline-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.baseline-card {
  background: var(--surface-2);
  border: 1px solid transparent;
  padding: 18px;
  border-radius: 16px;
  min-height: 112px;
  position: relative;
  overflow: hidden;
}
.baseline-card::after {
  content: "";
  position: absolute;
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-soft);
  right: -28px;
  bottom: -28px;
}
.baseline-card span { color: var(--muted); font-size: 12px; }
.baseline-card strong { display: block; font-size: 27px; margin-top: 8px; letter-spacing: -.035em; }
.baseline-card small { color: var(--muted); }

.dashboard-section { margin-top: 10px; position: relative; }
.dashboard-section > .section-heading {
  position: sticky;
  top: 0;
  z-index: 30;
  margin: 0 -2px 22px;
  padding: 12px 2px;
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  backdrop-filter: blur(18px);
}
.dashboard-section > .section-heading::after {
  content: "";
  position: absolute;
  left: 2px;
  right: 2px;
  bottom: 0;
  height: 1px;
  background: var(--line);
  opacity: .85;
}
.plan-tabs { display: flex; padding: 5px; border: 1px solid var(--line); border-radius: 14px; background: var(--surface); gap: 4px; }
.plan-tab { border: 0; background: transparent; color: var(--muted); border-radius: 10px; padding: 9px 14px; font-size: 13px; font-weight: 700; }
.plan-tab.active { background: var(--text); color: var(--bg); }
.stats-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  min-height: 138px;
  box-shadow: 0 12px 34px rgba(31, 41, 55, .045);
}
.stat-card.featured { background: linear-gradient(145deg, #0f9e7a, #12b98c); color: white; border-color: transparent; }
.stat-label { font-size: 12px; opacity: .72; }
.stat-card strong { display: block; font-size: 31px; line-height: 1.15; letter-spacing: -.04em; margin: 16px 0 8px; }
.stat-card small { color: var(--muted); font-size: 12px; }
.stat-card.featured small { color: rgba(255,255,255,.75); }

.deal-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 22px; }
.deal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 19px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}
.deal-rank { color: var(--accent-dark); font-size: 12px; font-weight: 800; letter-spacing: .08em; }
.deal-region { display: flex; align-items: center; gap: 10px; margin-top: 7px; font-weight: 750; }
.deal-flag { font-size: 24px; }
.deal-price { text-align: right; }
.deal-price strong { display: block; font-size: 22px; }
.deal-price small { color: var(--muted); }

.table-panel { overflow: clip; }
.filters {
  position: sticky;
  top: 78px;
  z-index: 20;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  display: grid;
  grid-template-columns: minmax(240px, 1fr) repeat(3, minmax(150px, auto));
  gap: 10px;
  background: color-mix(in srgb, var(--surface-solid) 84%, transparent);
  backdrop-filter: blur(16px);
}
.search-box { display: flex; align-items: center; gap: 9px; padding: 0 13px; border-radius: 12px; background: var(--surface-2); border: 1px solid transparent; }
.search-box:focus-within { border-color: var(--accent); }
.search-box input { width: 100%; border: 0; outline: none; background: transparent; color: var(--text); min-height: 42px; }
select { min-height: 42px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface-2); color: var(--text); padding: 0 34px 0 12px; outline: none; }
.table-wrap { overflow-x: auto; min-height: 260px; }
table { width: 100%; border-collapse: collapse; min-width: 1050px; }
th { color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .06em; font-weight: 750; padding: 14px 18px; text-align: left; background: color-mix(in srgb, var(--surface-2) 70%, transparent); }
td { border-top: 1px solid var(--line); padding: 16px 18px; font-size: 13px; vertical-align: middle; }
tbody tr { transition: background .15s ease; }
tbody tr:hover { background: var(--accent-soft); }
.rank { font-variant-numeric: tabular-nums; color: var(--muted); }
.region-cell { display: flex; align-items: center; gap: 11px; min-width: 190px; }
.flag { font-size: 24px; width: 30px; text-align: center; }
.region-name strong { display: block; font-size: 13px; }
.region-name small { color: var(--muted); }
.local-price { font-weight: 740; font-variant-numeric: tabular-nums; }
.cny-price { font-size: 15px; font-weight: 820; color: var(--accent-dark); font-variant-numeric: tabular-nums; }
.delta { font-size: 12px; font-weight: 700; }
.delta.cheap { color: #0c9b73; }
.delta.expensive { color: #e05252; }
.delta.same { color: var(--muted); }
.status-tag { display: inline-flex; align-items: center; border-radius: 999px; padding: 5px 8px; font-size: 11px; font-weight: 700; white-space: nowrap; }
.status-ok { background: rgba(16, 163, 127, .11); color: var(--accent-dark); }
.status-missing { background: rgba(245, 158, 11, .12); color: #b36c00; }
.status-error { background: rgba(224, 82, 82, .11); color: #c73f3f; }
.source-link { color: var(--text); text-decoration: none; border-bottom: 1px dashed var(--muted); }
.date-cell { color: var(--muted); white-space: nowrap; }
.empty-state { text-align: center; color: var(--muted); padding: 72px 20px; }
.table-footer { display: flex; justify-content: space-between; gap: 20px; color: var(--muted); padding: 14px 18px; border-top: 1px solid var(--line); font-size: 11px; }

.method-panel { margin-top: 70px; padding: 30px; }
.method-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; margin-top: 22px; }
.method-grid article { background: var(--surface-2); border-radius: 16px; padding: 20px; }
.method-grid article > span { color: var(--accent-dark); font-size: 11px; font-weight: 800; }
.method-grid h3 { margin: 12px 0 7px; font-size: 16px; }
.method-grid p { margin: 0; color: var(--muted); font-size: 13px; line-height: 1.7; }
.notice { margin-top: 16px; border-left: 3px solid var(--orange); padding: 12px 15px; background: rgba(255, 122, 69, .07); border-radius: 0 12px 12px 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.notice strong { color: var(--text); }
footer { max-width: 1240px; margin: 0 auto; padding: 28px 24px 44px; color: var(--muted); border-top: 1px solid var(--line); display: flex; justify-content: space-between; gap: 20px; font-size: 11px; }
.toast { position: fixed; right: 24px; bottom: 24px; background: var(--text); color: var(--bg); border-radius: 12px; padding: 12px 16px; box-shadow: var(--shadow); font-size: 13px; transform: translateY(20px); opacity: 0; pointer-events: none; transition: all .2s ease; z-index: 50; }
.toast.show { transform: translateY(0); opacity: 1; }

@media (max-width: 980px) {
  .baseline-grid { grid-template-columns: repeat(3, 1fr); }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .filters { grid-template-columns: 1fr 1fr; }
  .search-box { grid-column: span 2; }
}
@media (max-width: 720px) {
  .topbar { height: 62px; padding: 0 16px; }
  .brand span:last-child { display: none; }
  .live-badge { max-width: 180px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
  .page-shell { padding: 0 14px 52px; }
  .hero { padding: 48px 0 40px; }
  .hero h1 { font-size: 44px; }
  .hero-copy { font-size: 15px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .section-heading.compact { align-items: flex-start; }
  .baseline-grid, .deal-grid, .method-grid { grid-template-columns: 1fr; }
  .baseline-panel { padding: 20px; margin-bottom: 52px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .stat-card { padding: 17px; min-height: 125px; }
  .stat-card strong { font-size: 25px; }
  .plan-tabs { width: 100%; overflow-x: auto; }
  .plan-tab { flex: 1; white-space: nowrap; }
  .filters { grid-template-columns: 1fr; }
  .search-box { grid-column: auto; }
  .table-footer, footer { flex-direction: column; }
  .method-panel { padding: 22px; margin-top: 50px; }
}
@media (max-width: 460px) {
  .stats-grid { grid-template-columns: 1fr; }
  .hero-actions button { width: 100%; }
  .baseline-grid { grid-template-columns: 1fr 1fr; }
  .baseline-card:last-child { grid-column: span 2; }
}
