/* HKUScope - shared design system. Zero external dependencies. */
:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-2: #f0f3f8;
  --border: #e1e7f0;
  --border-strong: #cbd5e3;
  --text: #17212f;
  --text-muted: #5b6b80;
  --text-faint: #8a98a9;
  --brand: #1d4ed8;
  --brand-dark: #173a7a;
  --brand-soft: #e8effd;
  --up: #d92b2b;
  --down: #0e9f6e;
  --up-soft: #fdecec;
  --down-soft: #e6f7f0;
  --demo: #a35a06;
  --demo-soft: #fff4e0;
  --demo-border: #f0d299;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(16, 32, 56, .04), 0 8px 24px rgba(16, 32, 56, .06);
  --shadow-sm: 0 1px 3px rgba(16, 32, 56, .06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
}

/* International convention: green up / red down (toggle in header). */
body[data-scheme="intl"] {
  --up: #0e9f6e;
  --down: #d92b2b;
  --up-soft: #e6f7f0;
  --down-soft: #fdecec;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { line-height: 1.3; margin: 0 0 .6em; font-weight: 700; letter-spacing: -.01em; }
h1 { font-size: 32px; }
h2 { font-size: 22px; }
h3 { font-size: 17px; }
p { margin: 0 0 1em; }
ul, ol { padding-left: 1.2em; }
hr { border: 0; border-top: 1px solid var(--border); margin: 28px 0; }

.container { width: min(1180px, calc(100% - 40px)); margin: 0 auto; }
.section { margin: 40px 0; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-head h2 { margin: 0; font-size: 21px; }
.section-head .sub { color: var(--text-muted); font-size: 13px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-main { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
.row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.between { justify-content: space-between; }
.spacer { flex: 1; }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.mono { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }
.mt-0 { margin-top: 0; }
.mb-0 { margin-bottom: 0; }
.mt-24 { margin-top: 24px; }

/* ---------- header ---------- */
.demo-banner {
  background: var(--demo-soft);
  border-bottom: 1px solid var(--demo-border);
  color: var(--demo);
  font-size: 12.5px;
  text-align: center;
  padding: 7px 16px;
  letter-spacing: .01em;
}
.demo-banner strong { font-weight: 700; }
.site-header {
  position: sticky; top: 0; z-index: 40;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
}
.header-inner { display: flex; align-items: center; gap: 22px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 800; font-size: 17px; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 30px; height: 30px; border-radius: 9px;
  background: linear-gradient(135deg, var(--brand), #4f7fe8);
  color: #fff; display: grid; place-items: center; font-size: 13px; font-weight: 800;
  letter-spacing: -.04em;
}
.brand-sub { font-size: 11px; color: var(--text-faint); font-weight: 500; margin-left: 2px; }
.header-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
/* Two-row sticky shell: brand + utilities, then the channel navigation. */
html { scroll-padding-top: 116px; }
.search-box { position: relative; }
.search-box input {
  width: 176px; height: 34px; padding: 0 12px 0 32px;
  border: 1px solid var(--border); border-radius: 999px;
  background: var(--surface-2); color: var(--text); font-size: 13px; font-family: var(--font);
  outline: none;
}
.search-box input:focus { border-color: var(--brand); background: #fff; }
.search-box .search-icon { position: absolute; left: 11px; top: 8px; color: var(--text-faint); font-size: 13px; pointer-events: none; }
.scheme-btn {
  border: 1px solid var(--border); background: #fff; color: var(--text-muted);
  height: 34px; padding: 0 11px; border-radius: 999px; cursor: pointer;
  font-size: 12px; font-family: var(--font); white-space: nowrap;
}
.scheme-btn:hover { border-color: var(--brand); color: var(--brand); }

/* ---------- shared components ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow-sm);
}
.card.tight { padding: 16px; }
.card.flat { box-shadow: none; }
.card-hover:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.badge {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px;
  border: 1px solid var(--border); color: var(--text-muted); background: var(--surface-2);
  white-space: nowrap; line-height: 1.6;
}
.badge-hk { color: #a03a12; background: #fff0e6; border-color: #f6d9c4; }
.badge-us { color: #1c4a9c; background: #e9f0ff; border-color: #cadcff; }
.badge-demo { color: var(--demo); background: var(--demo-soft); border-color: var(--demo-border); }
.badge-open { color: #0b7a54; background: #e6f7f0; border-color: #bfe9d8; }
.badge-closed { color: var(--text-muted); background: var(--surface-2); }
.tag {
  display: inline-block; font-size: 12px; color: var(--text-muted);
  background: var(--surface-2); border-radius: 6px; padding: 2px 8px; margin: 0 6px 6px 0;
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  border: 1px solid var(--border); background: #fff; color: var(--text);
  padding: 9px 16px; border-radius: 10px; cursor: pointer;
  font-size: 14px; font-weight: 600; font-family: var(--font); text-decoration: none;
}
.btn:hover { text-decoration: none; border-color: var(--brand); color: var(--brand); }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12.5px; border-radius: 8px; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--brand); }
.notice {
  background: var(--brand-soft); border: 1px solid #d2e0fb; color: var(--brand-dark);
  border-radius: var(--radius-sm); padding: 12px 16px; font-size: 13.5px;
}
.notice.demo { background: var(--demo-soft); border-color: var(--demo-border); color: var(--demo); }
.callout {
  border-left: 3px solid var(--brand); background: var(--surface-2);
  padding: 12px 16px; border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
  color: var(--text-muted); font-size: 14px;
}
.divider { height: 1px; background: var(--border); margin: 16px 0; }
.empty { text-align: center; color: var(--text-faint); padding: 40px 16px; font-size: 14px; }

/* ---------- hero ---------- */
.hero {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr);
  gap: 28px; align-items: center; padding: 44px 0 30px;
}
.hero-title { font-size: 38px; letter-spacing: -.025em; margin-bottom: 14px; }
.hero-title .accent { color: var(--brand); }
.hero-lead { color: var(--text-muted); font-size: 16px; max-width: 620px; margin-bottom: 22px; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-stats { display: flex; gap: 26px; margin-top: 26px; flex-wrap: wrap; }
.hero-stats .stat-value { font-size: 20px; font-weight: 800; }
.hero-stats .stat-label { font-size: 12px; color: var(--text-faint); }
.hero-side { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow-sm); }

/* ---------- KPI / market ---------- */
.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 16px 18px; box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.kpi-label { font-size: 12.5px; color: var(--text-muted); display: flex; align-items: center; gap: 7px; }
.kpi-value { font-size: 25px; font-weight: 800; font-family: var(--mono); letter-spacing: -.02em; margin: 8px 0 2px; }
.kpi-change { font-size: 13px; font-weight: 700; font-family: var(--mono); }
.kpi-foot { display: flex; align-items: center; justify-content: space-between; margin-top: 8px; }
.up { color: var(--up); }
.down { color: var(--down); }
.flat { color: var(--text-muted); }
.pill-up { background: var(--up-soft); color: var(--up); }
.pill-down { background: var(--down-soft); color: var(--down); }
.spark { width: 92px; height: 30px; display: block; color: var(--text-faint); }
.spark.up { color: var(--up); }
.spark.down { color: var(--down); }

.status-line { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; font-size: 13px; color: var(--text-muted); }
.heat-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.heat-cell { border-radius: 9px; padding: 12px; font-size: 13px; border: 1px solid var(--border); background: var(--surface); }
.heat-cell .heat-name { font-weight: 700; margin-bottom: 4px; }
.heat-cell .heat-val { font-family: var(--mono); font-weight: 700; font-size: 15px; }
.heat-cell.strong-up { background: var(--up-soft); }
.heat-cell.strong-down { background: var(--down-soft); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
table.data-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
table.data-table th {
  text-align: left; padding: 11px 14px; background: var(--surface-2);
  color: var(--text-muted); font-weight: 700; font-size: 12.5px; white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
table.data-table td { padding: 11px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.data-table tr:last-child td { border-bottom: 0; }
table.data-table tbody tr:hover { background: #f9fbfe; }
table.data-table th.num, table.data-table td.num { text-align: right; }
table.data-table .code { font-family: var(--mono); color: var(--text-muted); font-size: 12.5px; }
table.data-table .name { font-weight: 600; color: var(--text); }
.source-note { font-size: 12px; color: var(--text-faint); margin-top: 8px; line-height: 1.6; }

/* ---------- articles ---------- */
.article-list { display: grid; gap: 12px; }
.article-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 18px 20px; display: flex; gap: 18px; align-items: flex-start;
}
.article-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-sm); }
.article-item .article-title { font-size: 16px; font-weight: 700; color: var(--text); margin: 6px 0 6px; }
.article-item .article-title a { color: var(--text); }
.article-item .article-title a:hover { color: var(--brand); }
.article-item p { color: var(--text-muted); font-size: 13.5px; margin: 0 0 8px; }
.article-meta { font-size: 12px; color: var(--text-faint); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.article-index { font-family: var(--mono); font-size: 20px; font-weight: 700; color: var(--border-strong); min-width: 34px; padding-top: 2px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
.tab {
  border: 1px solid var(--border); background: var(--surface); color: var(--text-muted);
  padding: 7px 14px; border-radius: 999px; cursor: pointer; font-size: 13px; font-family: var(--font);
}
.tab:hover { border-color: var(--brand); color: var(--brand); }
.tab.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }

/* ---------- tools / forms ---------- */
.tool-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.tool-card { display: block; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; color: var(--text); }
.tool-card:hover { text-decoration: none; border-color: var(--brand); box-shadow: var(--shadow-sm); }
.tool-icon {
  width: 36px; height: 36px; border-radius: 10px; background: var(--brand-soft); color: var(--brand);
  display: grid; place-items: center; font-weight: 800; font-size: 15px; margin-bottom: 12px;
}
.tool-card h3 { margin-bottom: 6px; font-size: 16px; }
.tool-card p { font-size: 13px; color: var(--text-muted); margin: 0; }
.filters { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.field label { display: block; font-size: 12px; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; }
.field input, .field select, .field textarea {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font-size: 13.5px; font-family: var(--font); outline: none;
}
.field input:focus, .field select:focus { border-color: var(--brand); }
.field.full { grid-column: 1 / -1; }

/* ---------- calendar ---------- */
.calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 6px; }
.cal-head { text-align: center; font-size: 12px; color: var(--text-faint); font-weight: 700; padding: 6px 0; }
.cal-cell {
  min-height: 92px; border: 1px solid var(--border); border-radius: 9px;
  background: var(--surface); padding: 8px; font-size: 12px;
}
.cal-cell.other { background: var(--surface-2); color: var(--text-faint); }
.cal-cell.today { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.cal-day { font-family: var(--mono); font-weight: 700; color: var(--text-muted); margin-bottom: 4px; }
.cal-event {
  display: block; background: var(--brand-soft); color: var(--brand-dark);
  border-radius: 5px; padding: 2px 5px; margin-bottom: 3px; font-size: 11px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cal-event.us { background: #eaf0ff; color: #1c4a9c; }
.cal-event.more { background: var(--surface-2); color: var(--text-muted); font-family: var(--mono); font-weight: 700; }

/* ---------- article detail ---------- */
.article-header { padding: 28px 0 14px; border-bottom: 1px solid var(--border); }
.article-header h1 { font-size: 30px; max-width: 820px; }
.article-body { max-width: 780px; margin: 0 auto; padding: 26px 0 40px; font-size: 15.5px; }
.article-body h2 { margin-top: 30px; font-size: 20px; }
.article-body h3 { margin-top: 22px; font-size: 16.5px; }
.article-body p { color: #2b3949; }
.toc { background: var(--surface-2); border-radius: var(--radius-sm); padding: 14px 18px; font-size: 13.5px; }
.toc a { display: block; padding: 2px 0; }
.disclaimer {
  margin-top: 32px; padding: 16px 18px; border: 1px solid var(--demo-border);
  background: var(--demo-soft); color: #6f4408; border-radius: var(--radius-sm); font-size: 13px;
}
.skeleton-line { height: 12px; border-radius: 6px; background: var(--surface-2); margin: 10px 0; }
.skeleton-line.w80 { width: 80%; }
.skeleton-line.w60 { width: 60%; }

/* ---------- planning doc ---------- */
.doc-hero { padding: 40px 0 22px; }
.doc-hero h1 { font-size: 34px; }
.doc-toc { display: flex; gap: 8px; flex-wrap: wrap; margin: 18px 0 0; }
.doc-toc a { font-size: 12.5px; background: var(--surface); border: 1px solid var(--border); padding: 5px 11px; border-radius: 999px; color: var(--text-muted); }
.doc-section { scroll-margin-top: 80px; margin: 34px 0; }
.doc-section > h2 { font-size: 22px; padding-bottom: 10px; border-bottom: 2px solid var(--brand); display: inline-block; }
.tree { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; font-size: 13.5px; }
.tree ul { list-style: none; padding-left: 22px; margin: 0; }
.tree > ul { padding-left: 0; }
.tree li { position: relative; padding: 5px 0 5px 16px; border-left: 1px solid var(--border); }
.tree > ul > li { border-left: 0; padding-left: 0; font-weight: 700; }
.tree > ul > li > ul { margin-top: 4px; }
.tree li::before { content: ""; position: absolute; left: 0; top: 17px; width: 11px; height: 1px; background: var(--border); }
.tree > ul > li::before { display: none; }
.tree .url { font-family: var(--mono); font-size: 12px; color: var(--text-faint); font-weight: 400; margin-left: 8px; }
.phase-list { display: grid; gap: 12px; }
.phase { display: grid; grid-template-columns: 120px 1fr; gap: 16px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; }
.phase-name { font-weight: 800; color: var(--brand); font-size: 14px; }
.phase p { margin: 0; font-size: 13.5px; color: var(--text-muted); }
.kv-list { display: grid; gap: 0; }
.kv-row { display: grid; grid-template-columns: 180px 1fr; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.kv-row:last-child { border-bottom: 0; }
.kv-row .k { font-weight: 700; color: var(--text); }
.kv-row .v { color: var(--text-muted); }

/* ---------- footer ---------- */
.site-footer { margin-top: 60px; border-top: 1px solid var(--border); background: var(--surface); }
.footer-grid { display: grid; grid-template-columns: 1.4fr repeat(3, 1fr); gap: 28px; padding: 34px 0 22px; }
.footer-grid h4 { font-size: 13px; margin-bottom: 12px; }
.footer-grid a { display: block; font-size: 13px; color: var(--text-muted); padding: 3px 0; }
.footer-grid a:hover { color: var(--brand); }
.footer-bottom { border-top: 1px solid var(--border); padding: 16px 0 26px; font-size: 12px; color: var(--text-faint); line-height: 1.8; }

/* ---------- responsive ---------- */
@media (max-width: 1080px) {
  .channel-nav a { padding: 7px 8px; font-size: 12.5px; }
  .search-box input { width: 140px; }
  .kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 820px) {
  .container { width: min(100% - 28px, 1180px); }
  .header-inner { height: auto; flex-wrap: wrap; padding: 10px 0; gap: 10px; }
  .header-actions { margin-left: auto; }
  .hero { grid-template-columns: 1fr; padding: 28px 0 20px; }
  .hero-title { font-size: 30px; }
  .grid-main, .grid-2, .grid-3, .grid-4, .tool-grid { grid-template-columns: 1fr; }
  .heat-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .footer-grid { grid-template-columns: repeat(2, 1fr); }
  .phase, .kv-row { grid-template-columns: 1fr; gap: 4px; }
  .calendar-grid { gap: 3px; }
  .cal-cell { min-height: 66px; padding: 5px; }
}
@media (max-width: 520px) {
  .kpi-grid, .heat-grid { grid-template-columns: 1fr; }
  .filters { grid-template-columns: 1fr; }
  .search-box input { width: 108px; }
  .brand-sub { display: none; }
  .hero-title { font-size: 26px; }
  .article-item { flex-direction: column; gap: 6px; }
  .article-index { display: none; }
  .footer-grid { grid-template-columns: 1fr; }
}

/* ---------- ad slots ---------- */
.ad-mount-top, .ad-mount-inline, .ad-mount-footer {
  width: min(1180px, calc(100% - 40px)); margin: 14px auto;
}
.ad-slot-banner { position: relative; }
.ad-label {
  position: absolute; top: -8px; left: 10px; z-index: 3;
  font-size: 10px; letter-spacing: .06em; line-height: 1.6;
  background: rgba(255, 255, 255, .95); color: var(--text-muted);
  border: 1px solid var(--border); padding: 0 6px; border-radius: 4px;
}
.ad-banner {
  display: flex; align-items: center; justify-content: center; gap: 20px;
  padding: 14px 26px; border-radius: 12px; text-decoration: none;
  box-shadow: var(--shadow-sm); position: relative; overflow: hidden;
}
.ad-banner:hover { text-decoration: none; filter: brightness(1.07); }
.ad-image { max-height: 60px; max-width: 170px; border-radius: 8px; object-fit: contain; background: rgba(255,255,255,.14); }
/* 整图通栏广告（ads layout:full）：图片即完整创意，去掉内边距与文字区 */
.ad-banner.ad-banner-full { padding: 0; display: block; box-shadow: var(--shadow-sm); aspect-ratio: 1180 / 73; }
.ad-banner-full .ad-banner-media { display: block; height: 100%; line-height: 0; }
.ad-banner-img { display: block; width: 100%; height: 100%; object-fit: cover; object-position: center; border-radius: 12px; }
@media (max-width: 700px) {
  /* 窄屏：广告位按 8:1 保高，图片完整等比显示（不裁剪），上下用素材同色补齐 */
  .ad-banner.ad-banner-full { aspect-ratio: 8 / 1; }
  .ad-banner-img { object-fit: contain; background: #01106A; }
}
/* 整图通栏时「广告」标签落在图内，避免被裁切 */
.ad-slot-full .ad-label {
  top: 8px; left: 10px; background: rgba(0, 0, 0, .45); color: #fff;
  border-color: rgba(255, 255, 255, .38); backdrop-filter: blur(2px);
}
/* 深色卡片（品牌图位）标签同样内收，避免压在卡片边缘 */
.ad-slot-rect .ad-label {
  top: 8px; left: 10px; background: rgba(0, 0, 0, .45); color: #fff;
  border-color: rgba(255, 255, 255, .34); backdrop-filter: blur(2px);
}
.ad-copy { text-align: left; min-width: 0; }
.ad-title { font-weight: 800; font-size: 17px; line-height: 1.4; }
.ad-text { font-size: 13px; opacity: .9; }
.ad-cta {
  border: 1px solid currentColor; border-radius: 999px; padding: 5px 15px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap;
}
.ad-close {
  position: absolute; top: 6px; right: 8px; z-index: 3;
  width: 22px; height: 22px; line-height: 20px; text-align: center;
  border: 1px solid rgba(255, 255, 255, .5); background: rgba(0, 0, 0, .18);
  color: #fff; border-radius: 50%; cursor: pointer; font-size: 15px; padding: 0;
}
.ad-close:hover { background: rgba(0, 0, 0, .4); }

/* --- right-sidebar rectangle ad (the "right column ad" pattern) --- */
.ad-slot-rect { position: relative; }
.ad-rect {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center;
  gap: 10px; padding: 20px; text-decoration: none; border-radius: var(--radius);
  box-sizing: border-box; width: 100%; box-shadow: var(--shadow-sm); overflow: hidden;
  border: 1px solid rgba(255, 255, 255, .18);
  transition: filter .15s ease, transform .15s ease;
}
.ad-rect:hover { text-decoration: none; filter: brightness(1.06); transform: translateY(-1px); }
.ad-rect .ad-image { width: 100%; max-width: none; max-height: 120px; border-radius: var(--radius-sm); object-fit: cover; }
.ad-rect .ad-title { font-size: 17px; font-weight: 800; line-height: 1.3; }
.ad-rect .ad-text { font-size: 13px; line-height: 1.6; opacity: .92; }
.ad-rect .ad-cta {
  margin-top: 6px; padding: 8px 16px; border-radius: 999px; font-size: 13px; font-weight: 700;
  background: rgba(255, 255, 255, .22); border: 1px solid rgba(255, 255, 255, .6);
}
/* In-flow host: the ad fills the column it sits in. */
#ad-sidebar { display: block; margin-bottom: 14px; }
#ad-sidebar .ad-slot-rect { width: 100%; }

/* Two-column page layout with an in-flow right rail for the rectangle ad.
   The ad is embedded in the page grid — never floating or overlaid. */
.main-2col { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); align-items: start; }
.main-2col > :first-child { grid-column: 1 / -1; }
.aside-col {
  grid-column: 2; grid-row: 2 / -1; align-self: start;
  position: sticky; top: 120px; display: block;
}
@media (max-width: 1024px) {
  .main-2col { grid-template-columns: 1fr; }
  .main-2col > :first-child { grid-column: auto; }
  #ad-sidebar.aside-col { display: none; }
}

/* Couplets sit just OUTSIDE the 1180px content column with a fixed 28px
   breathing gap, so they never overlap editorial text while scrolling.
   Width is capped at 80px (overriding the data default) and they only show
   on viewports >=1420px — the minimum width that fits an 80px couplet plus
   its gap on both sides of the 1180px column. Below that, hide rather than
   cover body text. */
.ad-couplet { position: fixed; top: 26%; z-index: 35; display: none; }
@media (min-width: 1420px) { .ad-couplet { display: block; } }
.ad-couplet.side-left { left: max(8px, calc((100vw - 1180px) / 2 - 108px)); }
.ad-couplet.side-right { right: max(8px, calc((100vw - 1180px) / 2 - 108px)); }
.ad-couplet .ad-label { top: -8px; left: 50%; transform: translateX(-50%); }
.ad-couplet-link {
  width: 80px !important; /* override inline width from data; keep clear of body text */
  display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 8px;
  border-radius: 10px; text-decoration: none; box-shadow: var(--shadow);
  padding: 14px 6px; overflow: hidden;
}
.ad-couplet-link:hover { text-decoration: none; filter: brightness(1.07); }
/* 对联位直接投放竖版图片（2026-11-16） */
.ad-couplet-link.ad-couplet-hasimg { padding: 0; display: block; }
.ad-couplet-img { width: 100%; height: 100%; object-fit: cover; border-radius: 10px; display: block; }
/* 对联位改图片投放后，标签与关闭按钮收进图内 */
.ad-couplet .ad-label { top: 6px; left: 6px; transform: none; font-size: 9px; padding: 0 5px; line-height: 1.5; background: rgba(0, 0, 0, .5); color: #fff; border-color: rgba(255, 255, 255, .35); }
.ad-couplet .ad-close-couplet { width: 18px; height: 18px; line-height: 16px; font-size: 13px; }
.ad-couplet .ad-close-couplet { top: 6px; right: 6px; background: rgba(0, 0, 0, .45); border-color: rgba(255, 255, 255, .5); }
.ad-couplet-title, .ad-couplet-text { writing-mode: vertical-rl; }
.ad-couplet-title { font-size: 19px; font-weight: 800; letter-spacing: .16em; }
.ad-couplet-text { font-size: 13px; letter-spacing: .1em; opacity: .92; }
.ad-close-couplet { top: -8px; right: -8px; background: var(--text-muted); }
@media (max-width: 820px) {
  .ad-mount-top, .ad-mount-inline, .ad-mount-footer { width: calc(100% - 28px); }
  .ad-banner { gap: 12px; padding: 12px 16px; flex-wrap: wrap; }
  .ad-title { font-size: 15px; }
  .ad-cta { display: none; }
}

/* ---------- admin console ---------- */
.admin-top { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; padding: 26px 0 10px; }
.admin-top h1 { font-size: 26px; margin: 0; }
.admin-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin: 18px 0 22px; }
.admin-tab {
  border: 0; background: transparent; color: var(--text-muted); cursor: pointer;
  padding: 10px 16px; font-size: 14px; font-weight: 600; font-family: var(--font);
  border-bottom: 2px solid transparent;
}
.admin-tab:hover { color: var(--brand); }
.admin-tab.active { color: var(--brand); border-bottom-color: var(--brand); }
.admin-pane { display: none; }
.admin-pane.active { display: block; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.pane-head h2 { margin: 0; font-size: 19px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.form-field label { display: block; font-size: 12px; color: var(--text-muted); font-weight: 600; margin-bottom: 5px; }
.form-field input, .form-field select, .form-field textarea {
  width: 100%; padding: 8px 10px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface); color: var(--text);
  font-size: 13.5px; font-family: var(--font); outline: none;
}
.form-field textarea { min-height: 84px; resize: vertical; line-height: 1.6; }
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { border-color: var(--brand); }
.form-field.full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 14px; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.admin-table th { text-align: left; padding: 10px; background: var(--surface-2); color: var(--text-muted); font-size: 12px; border-bottom: 1px solid var(--border); }
.admin-table td { padding: 10px; border-bottom: 1px solid var(--border); }
.admin-table tr:last-child td { border-bottom: 0; }
.ad-card { border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; background: var(--surface); margin-bottom: 12px; }
.ad-card.disabled { opacity: .62; }
.ad-card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.switch { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-muted); cursor: pointer; }
.switch input { accent-color: var(--brand); width: 15px; height: 15px; }
.stat-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: 999px; padding: 3px 10px; color: var(--text-muted); }
.code-block {
  font-family: var(--mono); font-size: 12px; line-height: 1.7; background: var(--surface-2);
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px;
  white-space: pre-wrap; word-break: break-all; max-height: 240px; overflow: auto;
}
.toast {
  position: fixed; right: 22px; bottom: 22px; z-index: 90;
  background: var(--text); color: #fff; padding: 11px 18px; border-radius: 10px;
  font-size: 13px; box-shadow: var(--shadow); opacity: 0; transform: translateY(8px);
  transition: opacity .2s, transform .2s; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.ad-preview-stage { position: relative; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); padding: 46px 60px 20px; min-height: 330px; }
.ad-preview-frame { background: var(--surface); border: 1px solid var(--border); border-radius: 10px; padding: 12px; }
.ad-preview-bar { height: 18px; border-radius: 5px; background: var(--surface-2); margin-bottom: 10px; }
.ad-preview-lines { height: 8px; border-radius: 4px; background: var(--surface-2); margin: 7px 0; }
.ad-preview-couplet {
  position: absolute; top: 92px; width: 54px; height: 160px; border-radius: 7px;
  display: flex; align-items: center; justify-content: center; gap: 6px;
  font-size: 11px; font-weight: 700; box-shadow: var(--shadow-sm); overflow: hidden;
}
.ad-preview-couplet span { writing-mode: vertical-rl; letter-spacing: .1em; }
.ad-preview-couplet.left { left: 6px; }
.ad-preview-couplet.right { right: 6px; }
@media (max-width: 820px) {
  .form-grid { grid-template-columns: 1fr; }
  .ad-preview-stage { padding: 40px 14px 16px; }
}
/* Compact rendering inside the admin preview stage (reuses real ad markup). */
.ad-preview-stage .ad-banner { min-height: 42px !important; padding: 7px 12px; gap: 9px; border-radius: 8px; }
.ad-preview-stage .ad-title { font-size: 12px; }
.ad-preview-stage .ad-text { font-size: 10px; }
.ad-preview-stage .ad-cta { font-size: 10px; padding: 2px 9px; }
.ad-preview-stage .ad-image { max-height: 28px; max-width: 60px; }
.ad-preview-stage .ad-close { display: none; }
.ad-preview-stage .ad-label { font-size: 9px; top: -7px; }
.ad-preview-stage .ad-slot-banner { margin: 8px 0; }

/* --- independent subdomain identity & deployment --- */
.badge-domain { font-family: var(--mono); letter-spacing: .02em; border-color: var(--brand); color: var(--brand); }
.permalink-box {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 14px; padding: 10px 12px; border: 1px dashed var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2);
}
.permalink-box code { font-family: var(--mono); font-size: 12px; word-break: break-all; flex: 1; min-width: 180px; }
.check-item {
  display: flex; align-items: flex-start; gap: 9px; padding: 8px 0;
  border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text); cursor: pointer;
}
.check-item:last-child { border-bottom: 0; }
.check-item input { accent-color: var(--brand); margin-top: 3px; flex: none; }
.site-footer .footer-bottom a { color: inherit; text-decoration: underline; text-underline-offset: 2px; }
.deploy-step { border-left: 3px solid var(--brand); padding-left: 16px; margin: 18px 0; }
.deploy-step h3 { margin: 0 0 8px; font-size: 16px; }
.deploy-hero {
  background: linear-gradient(120deg, var(--brand), #1e3a5f); color: #fff;
  border-radius: var(--radius); padding: 26px 28px; margin-bottom: 22px;
}
.deploy-hero h1 { color: #fff; margin: 0 0 10px; font-size: 28px; }
.deploy-hero p { color: #e2e8f0; margin: 0; max-width: 760px; }
.deploy-hero code { color: #fde68a; }
@media (max-width: 820px) {
  .deploy-hero { padding: 20px 18px; }
  .deploy-hero h1 { font-size: 22px; }
}


/* live-data-disclosure */
.data-disclosure {
  background: var(--brand-soft);
  border-bottom: 1px solid var(--border);
  color: var(--brand-dark);
  font-size: 12.5px; text-align: center;
  padding: 7px 16px; letter-spacing: .01em;
}
.data-disclosure strong { font-weight: 700; }
.badge-source { color: var(--brand-dark); background: var(--brand-soft); border-color: #c7d8fb; }
.data-source {
  font-size: 12px; color: var(--text-muted); line-height: 1.7;
  margin-top: 10px; padding: 10px 12px;
  border: 1px solid var(--border); border-left: 3px solid var(--brand);
  border-radius: var(--radius-sm); background: var(--surface);
}
.data-source strong { color: var(--text); }
.data-source .tiny { color: var(--text-faint); }
.data-alert { color: #a35a06; font-weight: 600; }
.data-alert-box {
  margin: 10px 0; padding: 10px 12px; font-size: 13px;
  background: var(--demo-soft); border: 1px solid var(--demo-border);
  border-radius: var(--radius-sm); color: var(--demo);
}
input:disabled, select:disabled { opacity: .55; cursor: not-allowed; }

/* --- editorial portal: channel navigation / news feed / rankings / sources --- */
/* The channel row is the site's ONLY navigation bar and lives inside the
   sticky shell rendered by site.js, so it appears on every page. */
.channel-bar { background: var(--surface); border-top: 1px solid var(--border); }
.channel-inner {
  display: flex; align-items: center; gap: 4px;
  overflow-x: auto; padding: 0 4px; min-height: 44px;
  scrollbar-width: thin;
}
.channel-label {
  flex: none; font-size: 11px; font-weight: 700; letter-spacing: .12em;
  color: var(--text-faint); margin-right: 8px; text-transform: uppercase;
}
.channel-nav { display: flex; align-items: center; gap: 4px; flex: 1; min-width: 0; }
.channel-nav a {
  flex: none; padding: 7px 12px; border-radius: 7px;
  font-size: 13px; font-weight: 600; color: var(--text-muted);
  text-decoration: none; white-space: nowrap;
}
.channel-nav a:hover { background: var(--brand-soft); color: var(--brand-dark); text-decoration: none; }
.channel-nav a.active { color: var(--brand); background: var(--brand-soft); }
.channel-bar .channel-rss {
  flex: none; margin-left: auto; padding: 7px 10px;
  color: var(--brand); font-size: 12px; font-weight: 600; text-decoration: none;
}
.channel-bar .channel-rss:hover { text-decoration: underline; }

.hero-portal .lead-wrap { min-width: 0; }
.lead-link { color: inherit; text-decoration: none; }
.lead-link:hover { color: var(--brand); }
.hero-side.news-side { overflow: hidden; }

.news-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 9px 0; border-bottom: 1px solid var(--border);
  color: var(--text); text-decoration: none;
}
.news-item:last-child { border-bottom: 0; }
.news-item:hover .news-title { color: var(--brand); }
.news-index {
  flex: none; width: 22px; font-family: var(--mono); font-size: 11px;
  color: var(--text-faint); padding-top: 3px;
}
.news-body { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.news-title { font-size: 13.5px; font-weight: 600; line-height: 1.5; }
.news-meta { font-size: 11px; color: var(--text-faint); }

.tabs { overflow-x: auto; scrollbar-width: thin; }

.brief-grid { display: grid; grid-template-columns: 1fr 1fr 1.15fr; gap: 14px; }
.brief-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 8px; margin-bottom: 10px;
}
.brief-head h3 { margin: 0; font-size: 15px; }
.rank-row {
  display: grid; grid-template-columns: 84px 1fr auto auto;
  align-items: center; gap: 8px;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.rank-row:last-child { border-bottom: 0; }
.rank-code { color: var(--text-faint); }
.rank-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-row .num { font-weight: 700; }

.source-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.source-card {
  display: flex; flex-direction: column; gap: 8px;
  padding: 14px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); color: var(--text); text-decoration: none;
  box-shadow: var(--shadow-sm); transition: border-color .15s, transform .15s;
}
.source-card:hover { border-color: var(--brand); transform: translateY(-2px); }
.source-card strong { font-size: 13px; }
.source-arrow { margin-left: auto; color: var(--text-faint); font-size: 12px; }
.source-links a { display: block; padding: 4px 0; font-size: 13px; }
.article-crumbs {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  margin: 18px 0 10px; font-size: 12.5px; color: var(--text-faint);
}
.article-crumbs a { color: var(--text-muted); }

.pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-top: 16px;
}
.page-buttons { display: flex; gap: 6px; flex-wrap: wrap; }
.page-btn {
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 8px;
  background: var(--surface); color: var(--text);
  font-family: var(--font); font-size: 13px; cursor: pointer;
}
.page-btn:hover:not(:disabled) { border-color: var(--brand); color: var(--brand); }
.page-btn.active { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 700; }
.page-btn:disabled { opacity: .45; cursor: not-allowed; }

@media (max-width: 1040px) {
  .brief-grid { grid-template-columns: 1fr 1fr; }
  .source-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .brief-grid { grid-template-columns: 1fr; }
  .source-grid { grid-template-columns: 1fr; }
  .rank-row { grid-template-columns: 76px 1fr auto; }
  .rank-row .nowrap { display: none; }
  .channel-label { display: none; }
}
