/* ============================================================
   “城”全你 · 访客簿
   宣纸账本 · 朱砂批注 · 靛青副线
   ============================================================ */

.stats-wrap {
  padding-top: 26px;
  padding-bottom: 40px;
}

/* ── Hero 印章与实时行 ─────────────────────────────── */
.stats-hero h1 {
  display: flex;
  align-items: center;
  gap: 14px;
}
.seal {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border: 2px solid var(--red);
  border-radius: 3px;
  color: var(--red);
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  line-height: 1;
  transform: rotate(-4deg);
  background: rgba(192, 57, 43, 0.05);
  box-shadow: inset 0 0 0 1px rgba(192, 57, 43, 0.25);
  flex-shrink: 0;
}
.live-row {
  margin-top: 20px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 9px;
  font-family: var(--mono);
  font-size: 11.5px;
  letter-spacing: 0.04em;
  color: var(--ink-3);
}
.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 rgba(63, 107, 74, 0.5);
  animation: cqPulse 2.4s ease-out infinite;
  flex-shrink: 0;
}
.live-dot.warn {
  background: var(--gold);
  animation: none;
}
.live-sep {
  color: var(--line);
}
@keyframes cqPulse {
  0% { box-shadow: 0 0 0 0 rgba(63, 107, 74, 0.45); }
  70% { box-shadow: 0 0 0 7px rgba(63, 107, 74, 0); }
  100% { box-shadow: 0 0 0 0 rgba(63, 107, 74, 0); }
}

/* ── 常驻控制区 ────────────────────────────────────── */
.stats-controls {
  position: sticky;
  top: 62px;
  z-index: 90;
  background: rgba(251, 250, 247, 0.95);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(26, 26, 24, 0.02);
}
.stats-controls-in {
  max-width: var(--max);
  margin: 0 auto;
  padding: 11px 24px;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 20px;
}
.ctl {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ctl-label {
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-4);
  white-space: nowrap;
}
.ctl-actions {
  margin-left: auto;
  gap: 8px;
}
.seg {
  display: inline-flex;
  border: 1px solid var(--line);
  border-radius: 3px;
  overflow: hidden;
  background: var(--paper);
}
.seg button {
  appearance: none;
  border: 0;
  background: transparent;
  font-family: var(--sans);
  font-size: 12.5px;
  color: var(--ink-2);
  padding: 5px 11px;
  cursor: pointer;
  border-right: 1px solid var(--line-soft);
  transition: background 0.15s ease, color 0.15s ease;
  white-space: nowrap;
}
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--paper-2); color: var(--ink); }
.seg button.on {
  background: var(--red);
  color: #fff;
  font-weight: 600;
}
.seg button:focus-visible {
  outline: 2px solid var(--navy);
  outline-offset: -2px;
}

.switch {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  background: var(--paper);
  border-radius: 20px;
  padding: 5px 13px 5px 5px;
  min-height: 30px;
  cursor: pointer;
  font-family: var(--sans);
  font-size: 12px;
  color: var(--ink-3);
  transition: all 0.18s ease;
}
.switch-knob {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--paper-3);
  border: 1px solid var(--line);
  transition: all 0.18s ease;
  flex-shrink: 0;
}
.switch:hover { border-color: var(--ink-4); }
.switch.on {
  border-color: var(--green);
  color: var(--green);
  background: var(--green-soft);
}
.switch.on .switch-knob {
  background: var(--green);
  border-color: var(--green);
  transform: translateX(2px);
}
.switch-red.on {
  border-color: var(--red);
  color: var(--red);
  background: var(--red-soft);
}
.switch-red.on .switch-knob {
  background: var(--red);
  border-color: var(--red);
}
.switch:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }

.btn {
  appearance: none;
  font-family: var(--sans);
  font-size: 12.5px;
  padding: 6px 14px;
  border-radius: 3px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--ink-2);
  cursor: pointer;
  transition: all 0.16s ease;
  white-space: nowrap;
}
.btn:hover { border-color: var(--ink-4); color: var(--ink); background: var(--paper-2); }
.btn:disabled { opacity: 0.55; cursor: progress; }
.btn:focus-visible { outline: 2px solid var(--navy); outline-offset: 2px; }
.btn-primary {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  font-weight: 600;
}
.btn-primary:hover { background: #A82F22; border-color: #A82F22; color: #fff; }
.btn.done { background: var(--green-soft); border-color: var(--green); color: var(--green); }

/* ── KPI 账本条 ────────────────────────────────────── */
.kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(
      0deg, transparent, transparent 27px,
      rgba(26, 26, 24, 0.018) 27px, rgba(26, 26, 24, 0.018) 28px
    ),
    var(--paper-2);
  overflow: hidden;
  margin-bottom: 20px;
}
.kpi {
  padding: 16px 18px 15px;
  border-right: 1px solid var(--line);
  position: relative;
  min-width: 0;
}
.kpi:last-child { border-right: 0; }
.kpi::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 2px;
  background: var(--kpi-accent, var(--red));
  opacity: 0.75;
}
.kpi-l {
  font-size: 11.5px;
  letter-spacing: 0.1em;
  color: var(--ink-3);
  margin-bottom: 7px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpi-v {
  font-family: var(--serif);
  font-size: clamp(23px, 2.5vw, 32px);
  font-weight: 700;
  line-height: 1.1;
  color: var(--ink);
  letter-spacing: 0.01em;
  font-variant-numeric: tabular-nums;
}
.kpi-s {
  margin-top: 6px;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  color: var(--ink-4);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── 面板 ─────────────────────────────────────────── */
.panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--paper);
  margin-bottom: 18px;
  box-shadow: var(--shadow-sm);
  animation: cqRise 0.55s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
@keyframes cqRise {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: none; }
}
.panel-chart { animation-delay: 0.06s; }
.stats-col .panel:nth-child(1) { animation-delay: 0.14s; }
.stats-col .panel:nth-child(2) { animation-delay: 0.22s; }
.stats-col .panel:nth-child(3) { animation-delay: 0.3s; }
.stats-grid > .stats-col:nth-child(2) .panel:nth-child(1) { animation-delay: 0.18s; }
.stats-grid > .stats-col:nth-child(2) .panel:nth-child(2) { animation-delay: 0.26s; }
.panel-note { animation-delay: 0.32s; }
.kpis { animation: cqRise 0.5s cubic-bezier(0.22, 0.61, 0.36, 1) both; }
.panel-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 20px 13px;
  border-bottom: 1px solid var(--line-soft);
}
.panel-head h2 {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  margin: 0;
  color: var(--ink);
  letter-spacing: 0.02em;
}
.panel-sub {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  color: var(--ink-4);
  margin-top: 3px;
  text-transform: uppercase;
}
.panel-meta {
  text-align: right;
  flex-shrink: 0;
  min-height: 20px;
}
.meta-num {
  font-family: var(--serif);
  font-size: 19px;
  font-weight: 700;
  color: var(--red);
  font-variant-numeric: tabular-nums;
}
.meta-lbl {
  display: block;
  font-size: 10.5px;
  color: var(--ink-4);
  letter-spacing: 0.06em;
}
.panel-body { padding: 18px 20px 20px; }
.panel-foot {
  margin: 14px 0 0;
  font-size: 12.5px;
  color: var(--ink-3);
  border-top: 1px dashed var(--line);
  padding-top: 11px;
}
.panel-foot strong { color: var(--red); font-weight: 600; }

.stats-grid {
  display: grid;
  grid-template-columns: 1.05fr 1fr;
  gap: 18px;
  align-items: start;
}
.stats-grid .panel { margin-bottom: 0; }
.stats-col {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

/* ── 趋势图 ───────────────────────────────────────── */
.chart-box {
  position: relative;
  padding: 10px 14px 14px;
}
.trend { display: block; width: 100%; overflow: visible; }
.trend .ax {
  font-family: var(--mono);
  font-size: 10.5px;
  fill: var(--ink-4);
  letter-spacing: 0.02em;
}
.legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  padding: 10px 6px 0;
  border-top: 1px dashed var(--line);
  margin-top: 8px;
}
.lg {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-2);
}
.lg i {
  width: 14px;
  height: 3px;
  border-radius: 2px;
  display: inline-block;
}
.lg-note {
  margin-left: auto;
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-4);
  letter-spacing: 0.04em;
}
.tip {
  position: absolute;
  z-index: 5;
  min-width: 132px;
  background: var(--paper);
  border: 1px solid var(--line);
  border-left: 2px solid var(--red);
  border-radius: 3px;
  box-shadow: var(--shadow-lg);
  padding: 8px 11px;
  pointer-events: none;
}
.tip-d {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--ink-3);
  letter-spacing: 0.04em;
  margin-bottom: 5px;
}
.tip-r {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.9;
}
.tip-r i {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  flex-shrink: 0;
}
.tip-r b {
  margin-left: auto;
  font-family: var(--serif);
  font-size: 14px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}

/* ── 热门页面排行 ─────────────────────────────────── */
.rank {
  list-style: none;
  margin: 0;
  padding: 0 8px 0 0;
  max-height: 452px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.rank::-webkit-scrollbar { width: 8px; }
.rank::-webkit-scrollbar-track {
  background: var(--paper-2);
  border-radius: 4px;
}
.rank::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 4px;
  border: 2px solid var(--paper-2);
}
.rank::-webkit-scrollbar-thumb:hover { background: var(--red); }
.rank { scrollbar-width: thin; scrollbar-color: var(--line) var(--paper-2); }
.rank-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 9px 6px;
  border-bottom: 1px dashed var(--line-soft);
  border-radius: 3px;
  transition: background 0.15s ease;
}
.rank-row:hover { background: rgba(192, 57, 43, 0.04); }
.rank-row:last-child { border-bottom: 0; }
.rank-n {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-4);
  width: 22px;
  text-align: center;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.rank-n.top { color: var(--red); }
.rank-main { flex: 1; min-width: 0; }
.rank-name {
  font-size: 13.5px;
  color: var(--ink);
  border-bottom: 1px solid transparent;
  font-weight: 500;
}
.rank-name:hover { color: var(--red); border-bottom-color: var(--red); }
.rank-path {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-4);
  letter-spacing: 0.02em;
  margin: 1px 0 5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rank-bar {
  display: block;
  height: 4px;
  background: var(--paper-3);
  border-radius: 2px;
  overflow: hidden;
}
.rank-bar i {
  display: block;
  height: 100%;
  border-radius: 2px;
  transition: width 0.5s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.rank-v {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 700;
  color: var(--ink);
  text-align: right;
  flex-shrink: 0;
  min-width: 62px;
  font-variant-numeric: tabular-nums;
}
.rank-v small {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  color: var(--ink-4);
}

/* ── 来源渠道 ─────────────────────────────────────── */
.stack {
  display: flex;
  height: 12px;
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--line);
  background: var(--paper-3);
  margin-bottom: 16px;
}
.stack-seg {
  display: block;
  height: 100%;
  transition: width 0.5s ease;
}
.ch-list { display: flex; flex-direction: column; gap: 2px; }
.ch-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
  border-bottom: 1px dashed var(--line-soft);
}
.ch-row:last-child { border-bottom: 0; }
.ch-dot {
  width: 9px;
  height: 9px;
  border-radius: 2px;
  flex-shrink: 0;
}
.ch-name {
  font-size: 13px;
  color: var(--ink);
  width: 116px;
  flex-shrink: 0;
}
.ch-name small {
  display: block;
  font-size: 10.5px;
  color: var(--ink-4);
  line-height: 1.5;
}
.ch-bar {
  flex: 1;
  height: 4px;
  background: var(--paper-3);
  border-radius: 2px;
  overflow: hidden;
  min-width: 30px;
}
.ch-bar i { display: block; height: 100%; transition: width 0.5s ease; }
.ch-v {
  font-family: var(--serif);
  font-size: 15px;
  font-weight: 700;
  text-align: right;
  min-width: 58px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.ch-v small {
  display: block;
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  color: var(--ink-4);
}

/* ── 时段分布 ─────────────────────────────────────── */
.bands {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  align-items: end;
  height: 168px;
}
.band {
  display: flex;
  flex-direction: column;
  align-items: center;
  height: 100%;
  min-width: 0;
}
.band-v {
  font-family: var(--mono);
  font-size: 10.5px;
  color: var(--ink-3);
  height: 16px;
  font-variant-numeric: tabular-nums;
}
.band-col {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  background: linear-gradient(180deg, transparent, rgba(26, 26, 24, 0.025));
  border-bottom: 1px solid var(--line);
}
.band-col i {
  display: block;
  width: 100%;
  background: linear-gradient(180deg, #2E6DA4, #173F63);
  border-radius: 2px 2px 0 0;
  transition: height 0.55s cubic-bezier(0.22, 0.61, 0.36, 1);
}
.band.peak .band-col i { background: linear-gradient(180deg, #D4574A, #A82F22); }
.band.peak .band-v { color: var(--red); font-weight: 600; }
.band-l {
  font-family: var(--mono);
  font-size: 9.5px;
  color: var(--ink-4);
  margin-top: 6px;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

/* ── 设备与浏览器 ─────────────────────────────────── */
.env-block { margin-bottom: 18px; }
.env-block:last-of-type { margin-bottom: 12px; }
.env-block h3 {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
  margin: 0 0 9px;
  color: var(--ink);
  display: flex;
  align-items: baseline;
  gap: 9px;
}
.env-block h3 small {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 400;
  color: var(--ink-4);
  letter-spacing: 0.04em;
}
.env-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
}
.env-n {
  font-size: 12.5px;
  color: var(--ink-2);
  width: 82px;
  flex-shrink: 0;
}
.env-bar {
  flex: 1;
  height: 4px;
  background: var(--paper-3);
  border-radius: 2px;
  overflow: hidden;
}
.env-bar i { display: block; height: 100%; transition: width 0.5s ease; }
.env-v {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
  min-width: 56px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.env-v small {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 400;
  color: var(--ink-4);
}
.env-self {
  border-top: 1px dashed var(--line);
  padding-top: 12px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  flex-wrap: wrap;
}
.env-self-t {
  font-size: 11px;
  letter-spacing: 0.1em;
  color: var(--ink-4);
}
.env-self-v {
  font-family: var(--mono);
  font-size: 11.5px;
  color: var(--navy);
  background: var(--navy-soft);
  border: 1px solid rgba(31, 78, 121, 0.18);
  border-radius: 3px;
  padding: 2px 9px;
}

/* ── 说明与隐私 ───────────────────────────────────── */
.panel-note { background: var(--paper-2); }
.note-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 18px 28px;
}
.note-item h3 {
  font-family: var(--serif);
  font-size: 14.5px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--red);
}
.note-item p {
  margin: 0;
  font-size: 13px;
  line-height: 1.85;
  color: var(--ink-2);
}
.note-item strong { color: var(--ink); font-weight: 600; }
.notice-privacy { margin-top: 18px; }

/* ── 错误横幅 ─────────────────────────────────────── */
.banner {
  display: flex;
  align-items: center;
  gap: 13px;
  border: 1px solid rgba(192, 57, 43, 0.35);
  border-left: 3px solid var(--red);
  background: var(--red-soft);
  border-radius: var(--radius);
  padding: 12px 16px;
  margin-bottom: 18px;
}
.banner-ic {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--red);
  color: #fff;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.banner-tx { flex: 1; min-width: 0; }
.banner-tx strong {
  display: block;
  font-size: 13.5px;
  color: var(--red);
  margin-bottom: 2px;
}
.banner-tx span {
  font-size: 12.5px;
  color: var(--ink-2);
  line-height: 1.7;
}

/* ── 骨架与空态 ───────────────────────────────────── */
.sk {
  display: block;
  background: linear-gradient(90deg, var(--paper-3) 25%, var(--line-soft) 37%, var(--paper-3) 63%);
  background-size: 400% 100%;
  animation: cqShimmer 1.5s ease-in-out infinite;
  border-radius: 3px;
}
@keyframes cqShimmer {
  0% { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
.sk-num { height: 30px; width: 72px; }
.sk-line { height: 16px; width: 88px; }
.sk-chart { height: 280px; width: 100%; }
.sk-chart-sm { height: 168px; width: 100%; }
.sk-rows { display: flex; flex-direction: column; gap: 13px; }
.sk-row { height: 15px; }
.chart-sk { padding: 6px 0; }
.empty,
.empty-sm {
  font-size: 13px;
  color: var(--ink-4);
  text-align: center;
  padding: 26px 10px;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--paper-2);
}
.empty-sm { padding: 14px 10px; font-size: 12px; }

/* ── 滚动条（沿用本站纸本色） ─────────────────────── */
.stats-wrap ::-webkit-scrollbar,
.chart-box ::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}
.stats-wrap ::-webkit-scrollbar-track,
.chart-box ::-webkit-scrollbar-track {
  background: var(--paper-2);
  border-radius: 5px;
}
.stats-wrap ::-webkit-scrollbar-thumb,
.chart-box ::-webkit-scrollbar-thumb {
  background: var(--line);
  border-radius: 5px;
  border: 2px solid var(--paper-2);
}
.stats-wrap ::-webkit-scrollbar-thumb:hover,
.chart-box ::-webkit-scrollbar-thumb:hover {
  background: var(--ink-4);
}
.stats-wrap * {
  scrollbar-width: thin;
  scrollbar-color: var(--line) var(--paper-2);
}

/* ── 响应式 ───────────────────────────────────────── */
@media (max-width: 1080px) {
  .kpis { grid-template-columns: repeat(3, 1fr); }
  .kpi:nth-child(3n) { border-right: 0; }
  .kpi:nth-child(-n + 3) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 900px) {
  .stats-grid { grid-template-columns: 1fr; gap: 18px; }
  .stats-controls-in { padding: 10px 18px; gap: 9px 14px; }
  .ctl-actions { margin-left: 0; }
  .note-grid { grid-template-columns: 1fr; gap: 15px; }
}
@media (max-width: 720px) {
  .stats-controls { top: 56px; }
}
@media (max-width: 620px) {
  .stats-wrap { padding-top: 18px; }
  .kpis { grid-template-columns: repeat(2, 1fr); }
  .kpi { padding: 13px 14px; }
  .kpi:nth-child(3n) { border-right: 1px solid var(--line); }
  .kpi:nth-child(2n) { border-right: 0; }
  .kpi:nth-child(-n + 4) { border-bottom: 1px solid var(--line); }
  .kpi-v { font-size: 24px; }
  .panel-head { padding: 13px 15px 11px; }
  .panel-body { padding: 15px; }
  .chart-box { padding: 8px 8px 12px; }
  .bands { gap: 4px; height: 142px; }
  .band-l { font-size: 8.5px; }
  .ch-name { width: 92px; font-size: 12.5px; }
  .ch-name small { display: none; }
  .env-n { width: 68px; font-size: 12px; }
  .rank-path { display: none; }
  .lg-note { display: none; }
  .stats-hero h1 { gap: 10px; }
  .seal { width: 28px; height: 28px; font-size: 16px; }
  .banner { flex-wrap: wrap; }
  .banner .btn { width: 100%; }
}
@media (max-width: 400px) {
  .ctl-label { display: none; }
  .seg button { padding: 5px 8px; font-size: 12px; }
}

@media (prefers-reduced-motion: reduce) {
  .live-dot { animation: none; }
  .sk { animation: none; }
  .rank-bar i, .ch-bar i, .env-bar i, .band-col i, .stack-seg { transition: none; }
}

@media print {
  .stats-controls, .totop, .banner .btn { display: none !important; }
  .panel { break-inside: avoid; box-shadow: none; }
}
/* ── 登录门（未登录时唯一可见内容） ─────────────────── */
.gate-wrap { padding: 40px 24px 60px; }
.gate {
  max-width: 560px;
  margin: 0 auto;
  border: 1px solid var(--line);
  border-top: 3px solid var(--red);
  border-radius: var(--radius);
  background:
    repeating-linear-gradient(0deg, transparent, transparent 27px,
      rgba(26, 26, 24, 0.018) 27px, rgba(26, 26, 24, 0.018) 28px),
    var(--paper);
  box-shadow: var(--shadow);
  padding: 34px 34px 30px;
  position: relative;
  animation: cqRise 0.5s cubic-bezier(0.22, 0.61, 0.36, 1) both;
}
.gate-mark {
  position: absolute;
  top: 22px;
  right: 26px;
  width: 38px;
  height: 38px;
  border: 2px solid var(--red);
  border-radius: 3px;
  color: var(--red);
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  transform: rotate(5deg);
  background: rgba(192, 57, 43, 0.05);
  opacity: 0.85;
}
.gate h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 10px;
  color: var(--ink);
  padding-right: 52px;
}
.gate-lede {
  font-size: 13.5px;
  line-height: 1.85;
  color: var(--ink-2);
  margin: 0 0 22px;
}
.gate-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--ink-4);
  margin: 0 0 6px;
}
.gate-row { display: flex; gap: 10px; }
.gate-input {
  flex: 1;
  min-width: 0;
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 3px;
  padding: 9px 13px;
  transition: border-color 0.16s ease, background 0.16s ease;
}
.gate-input:focus {
  outline: none;
  border-color: var(--red);
  background: var(--paper);
  box-shadow: 0 0 0 3px rgba(192, 57, 43, 0.1);
}
.gate-btn { padding: 9px 20px; flex-shrink: 0; }
.gate-msg {
  min-height: 22px;
  margin-top: 10px;
  font-size: 12.5px;
  line-height: 1.7;
  color: var(--ink-3);
}
.gate-msg.err { color: var(--red); }
.gate-msg.ok { color: var(--green); }
.gate-err {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  border: 1px solid rgba(192, 57, 43, 0.35);
  border-left: 3px solid var(--red);
  background: var(--red-soft);
  border-radius: var(--radius);
  padding: 11px 14px;
  font-size: 12.5px;
  color: var(--ink-2);
  margin-bottom: 18px;
}
.gate-tip {
  margin: 18px 0 0;
  padding-top: 14px;
  border-top: 1px dashed var(--line);
  font-size: 11.5px;
  line-height: 1.8;
  color: var(--ink-4);
}
.gate-notice { margin: 18px 0 0; }
.gate-alt { margin-top: 10px; }
.gate-form .gate-input { width: 100%; margin-bottom: 14px; }
.gate-form .gate-row .gate-input { width: auto; margin-bottom: 0; }

/* ── 修改口令弹窗 ───────────────────────────────────── */
.modal { position: fixed; inset: 0; z-index: 300; }
.modal-mask {
  position: absolute;
  inset: 0;
  background: rgba(26, 26, 24, 0.42);
  backdrop-filter: blur(2px);
  animation: cqFade 0.2s ease both;
}
@keyframes cqFade { from { opacity: 0; } to { opacity: 1; } }
.modal-card {
  position: relative;
  max-width: 420px;
  margin: 8vh auto 0;
  background: var(--paper);
  border: 1px solid var(--line);
  border-top: 3px solid var(--red);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 26px 28px 24px;
  animation: cqRise 0.28s cubic-bezier(0.22, 0.61, 0.36, 1) both;
  max-height: 84vh;
  overflow-y: auto;
}
.modal-card h3 {
  font-family: var(--serif);
  font-size: 18px;
  font-weight: 700;
  margin: 0 0 8px;
  color: var(--ink);
}
.modal-lede {
  font-size: 12.5px;
  color: var(--ink-3);
  line-height: 1.75;
  margin: 0 0 18px;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 6px;
}
.btn-quiet { color: var(--ink-3); }
.btn-quiet:hover { color: var(--red); border-color: var(--red); background: var(--red-soft); }

/* ── 地域分布 ───────────────────────────────────────── */
.geo-list { display: flex; flex-direction: column; gap: 1px; }
.geo-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px 0;
}
.geo-n {
  font-size: 12.5px;
  color: var(--ink-2);
  width: 74px;
  flex-shrink: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.geo-n.top { color: var(--red); font-weight: 600; }
.geo-bar {
  flex: 1;
  height: 4px;
  background: var(--paper-3);
  border-radius: 2px;
  overflow: hidden;
  min-width: 24px;
}
.geo-bar i {
  display: block;
  height: 100%;
  background: linear-gradient(90deg, #2E7D8A, #1F4E79);
  transition: width 0.5s ease;
}
.geo-v {
  font-family: var(--serif);
  font-size: 14px;
  font-weight: 700;
  min-width: 56px;
  text-align: right;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.geo-v small {
  display: block;
  font-family: var(--mono);
  font-size: 9.5px;
  font-weight: 400;
  color: var(--ink-4);
}

/* ── 管理员专属元素 ─────────────────────────────────── */
/* display:flex/grid 会覆盖 UA 的 [hidden]{display:none}，这里统一兜底 */
.stats-hero [hidden],
#cqGate[hidden],
#cqDash[hidden],
.modal[hidden],
[data-cq-admin][hidden] { display: none !important; }
.fcount-lock {
  font-size: 10.5px;
  color: var(--green);
  background: var(--green-soft);
  border: 1px solid rgba(63, 107, 74, 0.22);
  border-radius: 2px;
  padding: 1px 7px;
  letter-spacing: 0.04em;
}

@media (max-width: 620px) {
  .gate { padding: 26px 20px 24px; }
  .gate h2 { font-size: 19px; padding-right: 44px; }
  .gate-mark { width: 32px; height: 32px; font-size: 17px; top: 18px; right: 18px; }
  .gate-row { flex-direction: column; }
  .gate-btn { width: 100%; }
  .modal-card { margin: 4vh 14px 0; padding: 22px 20px 20px; }
  .geo-n { width: 62px; font-size: 12px; }
}
