/* ============================================================================
 *  AIFI 终端 · 样式
 *  风格：tech-noir / cyberpunk（霓虹只做点缀，正文保持高对比）
 * ========================================================================== */

:root {
  --bg: #05070e;
  --bg-2: #080b15;
  --panel: #0b0f1a;
  --panel-2: #0e1320;
  --line: rgba(122, 145, 220, 0.14);
  --line-2: rgba(122, 145, 220, 0.26);
  --text: #e9edf7;
  --text-2: #8a94ad;
  --text-3: #5b6480;

  --cyan: #3de1ff;
  --cyan-dim: rgba(61, 225, 255, 0.14);
  --violet: #7a51ec;
  --violet-2: #a78bfa;
  --violet-dim: rgba(122, 81, 236, 0.16);

  --up: #ff5c5c;
  --down: #35d6a4;

  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "JetBrains Mono", "SFMono-Regular", Consolas, "Cascadia Code",
    "Liberation Mono", monospace;

  --r: 14px;
  --r-sm: 10px;
  --maxw: 1240px;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

/* 背景：两个极低透明度的光斑 + 细网格 */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(760px 460px at 12% -6%, rgba(122, 81, 236, 0.16), transparent 62%),
    radial-gradient(680px 420px at 92% 4%, rgba(61, 225, 255, 0.09), transparent 60%),
    radial-gradient(900px 600px at 50% 108%, rgba(122, 81, 236, 0.07), transparent 65%);
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image:
    linear-gradient(to right, rgba(122, 145, 220, 0.055) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(122, 145, 220, 0.055) 1px, transparent 1px);
  background-size: 56px 56px;
  mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 78%);
  -webkit-mask-image: radial-gradient(ellipse 90% 60% at 50% 0%, #000 20%, transparent 78%);
}

.wrap { position: relative; z-index: 1; }

/* 神经网络粒子背景 */
#bgCanvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.55;
}

/* ------------------------------------------------------------------ 动效 */

@keyframes rise {
  from { opacity: 0; transform: translateY(16px) scale(0.995); }
  to { opacity: 1; transform: none; }
}

.hero > .panel,
.cols-3 > .panel,
.admin {
  animation: rise 0.6s cubic-bezier(0.2, 0.75, 0.3, 1) both;
}
.hero > .panel:nth-child(2) { animation-delay: 0.07s; }
.cols-3 > .panel:nth-child(1) { animation-delay: 0.13s; }
.cols-3 > .panel:nth-child(2) { animation-delay: 0.19s; }
.cols-3 > .panel:nth-child(3) { animation-delay: 0.25s; }
.admin { animation-delay: 0.31s; }

/* 面板内的扫描光带 */
.scan {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  border-radius: inherit;
}
.scan::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 0;
  height: 46%;
  will-change: transform;
  background: linear-gradient(180deg, transparent, rgba(61, 225, 255, 0.038), transparent);
  animation: scanmove 7.5s ease-in-out infinite;
}
@keyframes scanmove {
  0% { transform: translateY(-120%); }
  55%, 100% { transform: translateY(330%); }
}

/* 倒计时环外圈自转 */
.ring-spin {
  transform-origin: 33px 33px;
  animation: spin 11s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* 角标呼吸 */
.panel::before { animation: cornerpulse 3.6s ease-in-out infinite; }
@keyframes cornerpulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.9; }
}

/* 连接状态呼吸点 */
.dot.on { animation: dotpulse 2.6s ease-in-out infinite; }
@keyframes dotpulse {
  0%, 100% { box-shadow: 0 0 8px var(--down); }
  50% { box-shadow: 0 0 14px var(--down); }
}

/* 数值刷新闪烁 */
.flash { animation: flashval 0.85s ease-out; }
@keyframes flashval {
  0% { color: var(--cyan); text-shadow: 0 0 16px rgba(61, 225, 255, 0.6); }
  100% { text-shadow: 0 0 0 rgba(61, 225, 255, 0); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* ------------------------------------------------------------------ 顶栏 */

.topbar {
  position: sticky;
  top: 0;
  z-index: 40;
  border-bottom: 1px solid var(--line);
  background: rgba(5, 7, 14, 0.82);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
}

.topbar-in {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px;
  height: 62px;
  display: flex;
  align-items: center;
  gap: 20px;
}

.brand { display: flex; align-items: center; gap: 12px; }

.mark {
  position: relative;
  width: 30px;
  height: 30px;
  border: 1px solid var(--cyan);
  transform: rotate(45deg);
  display: grid;
  place-items: center;
  box-shadow: 0 0 14px rgba(61, 225, 255, 0.35), inset 0 0 10px rgba(61, 225, 255, 0.14);
  flex: none;
}
.mark i {
  width: 10px;
  height: 10px;
  background: var(--cyan);
  box-shadow: 0 0 10px var(--cyan);
  display: block;
  animation: corepulse 3s ease-in-out infinite;
}
@keyframes corepulse {
  0%, 100% { transform: scale(1); opacity: 0.85; }
  50% { transform: scale(1.28); opacity: 1; }
}
/* 外圈反向自转（抵消父级 45° 旋转） */
.mark-ring {
  position: absolute;
  inset: -7px;
  border: 1px dashed rgba(167, 139, 250, 0.55);
  border-radius: 50%;
  animation: spin 14s linear infinite reverse;
}

.brand-t { line-height: 1.15; }
.brand-t b {
  display: block;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
.brand-t span {
  display: block;
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.1em;
  font-family: var(--font-mono);
}

.spacer { flex: 1; }

.netpill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--text-2);
  background: rgba(255, 255, 255, 0.015);
  white-space: nowrap;
}
.dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-3);
  flex: none;
}
.dot.on { background: var(--down); box-shadow: 0 0 8px var(--down); }
.dot.warn { background: #f0b429; box-shadow: 0 0 8px #f0b429; }

/* ------------------------------------------------------------------ 按钮 */

.btn {
  appearance: none;
  border: 1px solid var(--line-2);
  background: rgba(255, 255, 255, 0.03);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 18px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, transform 0.08s, box-shadow 0.2s;
  white-space: nowrap;
  line-height: 1.2;
}
.btn:hover { background: rgba(255, 255, 255, 0.06); border-color: var(--line-2); }
.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.btn[disabled] { opacity: 0.42; cursor: not-allowed; }
.btn[disabled]:hover { background: rgba(255, 255, 255, 0.03); }

.btn-primary {
  position: relative;
  overflow: hidden;
  background: linear-gradient(100deg, var(--cyan) 0%, var(--violet-2) 100%);
  color: #06070d;
  border-color: transparent;
  font-weight: 600;
  box-shadow: 0 6px 26px -10px rgba(61, 225, 255, 0.7);
}
/* 悬停时的高光扫过 */
.btn-primary::after {
  content: "";
  position: absolute;
  top: 0;
  left: -60%;
  width: 45%;
  height: 100%;
  background: linear-gradient(100deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  transform: skewX(-18deg);
  transition: left 0.55s ease;
  pointer-events: none;
}
.btn-primary:hover::after { left: 125%; }
.btn-primary:hover {
  background: linear-gradient(100deg, #62e9ff 0%, #b9a2ff 100%);
  box-shadow: 0 8px 30px -8px rgba(61, 225, 255, 0.8);
}

.btn-ghost { background: transparent; }
.btn-sm { padding: 7px 13px; font-size: 12px; }
.btn-block { width: 100%; }

/* ------------------------------------------------------------------ 布局 */

.main {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 26px 24px 72px;
}

.hero {
  display: grid;
  grid-template-columns: 1.32fr 1fr;
  gap: 18px;
  margin-bottom: 18px;
}

.cols-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-bottom: 18px;
}

/* ------------------------------------------------------------------ 面板 */

.panel {
  position: relative;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.022), rgba(255, 255, 255, 0)) ,
    var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
}

/* 四角 HUD 标记 */
.panel::before,
.panel::after {
  content: "";
  position: absolute;
  width: 11px;
  height: 11px;
  pointer-events: none;
  opacity: 0.55;
}
.panel::before {
  top: 7px; left: 7px;
  border-left: 1px solid var(--cyan);
  border-top: 1px solid var(--cyan);
}
.panel::after {
  bottom: 7px; right: 7px;
  border-right: 1px solid var(--violet-2);
  border-bottom: 1px solid var(--violet-2);
}

.panel-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 20px 0;
}
.panel-hd h2 {
  margin: 0;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-2);
  font-family: var(--font-mono);
}
.panel-hd .spacer { flex: 1; }
.panel-bd { padding: 16px 20px 20px; }

.hd-line {
  height: 1px;
  background: linear-gradient(90deg, var(--line-2), transparent 72%);
  margin: 12px 20px 0;
}

/* ------------------------------------------------------------------ 价格区 */

.price-row {
  display: flex;
  align-items: flex-end;
  gap: 14px;
  flex-wrap: wrap;
}

.price-now {
  font-family: var(--font-mono);
  font-size: 46px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  background: linear-gradient(96deg, #ffffff 12%, var(--cyan) 46%, #c7b6ff 72%, #ffffff 92%);
  background-size: 240% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 7s ease-in-out infinite;
}
@keyframes shimmer {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.price-unit {
  font-size: 13px;
  color: var(--text-2);
  padding-bottom: 7px;
  font-family: var(--font-mono);
}

.chg {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  margin-bottom: 8px;
}
.chg.up { color: var(--up); background: rgba(255, 92, 92, 0.1); border: 1px solid rgba(255, 92, 92, 0.28); }
.chg.down { color: var(--down); background: rgba(53, 214, 164, 0.1); border: 1px solid rgba(53, 214, 164, 0.28); }
.chg.flat { color: var(--text-2); background: rgba(255, 255, 255, 0.04); border: 1px solid var(--line); }

.price-sub {
  margin-top: 10px;
  color: var(--text-3);
  font-size: 12px;
  font-family: var(--font-mono);
}

/* 周期环 */
.cycle {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}
.ring { position: relative; width: 66px; height: 66px; flex: none; }
.ring svg { transform: rotate(-90deg); display: block; }
.ring-val {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--cyan);
  letter-spacing: -0.02em;
}
.cycle-txt strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.02em;
}
.cycle-txt span { font-size: 12px; color: var(--text-3); }

/* 进度条 */
.bar {
  height: 4px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.07);
  overflow: hidden;
  margin: 8px 0 6px;
}
.bar i {
  display: block;
  height: 100%;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--violet), var(--cyan));
  box-shadow: 0 0 12px rgba(61, 225, 255, 0.5);
  transition: width 0.5s ease;
}
.bar-meta {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

/* ------------------------------------------------------------------ 统计 */

.stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1px;
  background: var(--line);
  border-top: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  margin: 18px -20px 0;
}
.stat {
  background: var(--panel);
  padding: 14px 20px;
}
.stat-k {
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.stat-v {
  font-family: var(--font-mono);
  font-size: 19px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
  margin-top: 3px;
}
.stat-v small { font-size: 11px; color: var(--text-3); font-weight: 400; margin-left: 4px; }

/* ------------------------------------------------------------------ 表单 */

.field {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
  transition: border-color 0.15s, background 0.15s;
}
.field:focus-within {
  border-color: rgba(61, 225, 255, 0.5);
  background: rgba(61, 225, 255, 0.04);
  box-shadow: 0 0 0 3px rgba(61, 225, 255, 0.07);
}
.field input {
  flex: 1;
  min-width: 0;
  background: none;
  border: 0;
  outline: 0;
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 17px;
  font-variant-numeric: tabular-nums;
  padding: 2px 0;
}
.field input::placeholder { color: #3f4760; }
.field .suffix {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-2);
  white-space: nowrap;
}
.field .max {
  background: rgba(61, 225, 255, 0.1);
  border: 1px solid rgba(61, 225, 255, 0.26);
  color: var(--cyan);
  font-size: 10px;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
}
.field .max:hover { background: rgba(61, 225, 255, 0.18); }

.field-label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 12px;
  color: var(--text-2);
  margin: 14px 0 7px;
}
.field-label:first-child { margin-top: 0; }
.field-label em {
  font-style: normal;
  color: var(--text-3);
  font-family: var(--font-mono);
  font-size: 11px;
}

.quote {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: rgba(122, 81, 236, 0.07);
  border: 1px solid rgba(122, 81, 236, 0.22);
  border-radius: var(--r-sm);
  padding: 11px 13px;
  margin-top: 14px;
}
.quote .q-k { font-size: 12px; color: var(--text-2); }
.quote .q-v {
  font-family: var(--font-mono);
  font-size: 16px;
  font-weight: 500;
  color: var(--violet-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.01em;
}

.hint {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 10px;
  line-height: 1.55;
}

/* ------------------------------------------------------------------ 列表 */

.kv {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px dashed rgba(122, 145, 220, 0.09);
  font-size: 13px;
}
.kv:last-child { border-bottom: 0; }
.kv .k { color: var(--text-2); font-size: 12px; }
.kv .v {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 13px;
  letter-spacing: -0.01em;
}
.kv .v.good { color: var(--down); }
.kv .v.acc { color: var(--cyan); }

/* 操作按钮组 */
.actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  margin-top: 16px;
}
.actions .full { grid-column: 1 / -1; }

/* 推荐链接 */
.reflink {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.reflink input {
  flex: 1;
  min-width: 0;
  background: rgba(255, 255, 255, 0.028);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  color: var(--text-2);
  font-family: var(--font-mono);
  font-size: 11px;
  padding: 9px 11px;
  outline: 0;
}
.reflink input:focus { border-color: rgba(61, 225, 255, 0.45); }

/* 持仓分布 */
.cols-3 > .panel { display: flex; flex-direction: column; }
.cols-3 > .panel > .panel-bd { flex: 1; }
.pb-fill { display: flex; flex-direction: column; }
.pb-fill .split { margin-top: auto; }
.split { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line); }
.split-hd {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 11px;
  color: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-family: var(--font-mono);
  margin-bottom: 9px;
}
.split-bar {
  display: flex;
  height: 6px;
  border-radius: 99px;
  overflow: hidden;
  background: rgba(255, 255, 255, 0.06);
  gap: 2px;
}
.split-bar i {
  display: block;
  height: 100%;
  transition: width 0.5s ease;
}
.split-bar .sw { background: linear-gradient(90deg, var(--violet), var(--violet-2)); }
.split-bar .ss { background: linear-gradient(90deg, var(--cyan), #8ff0ff); }
.split-lg {
  display: flex;
  gap: 16px;
  margin-top: 9px;
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.split-lg b { color: var(--text-2); font-weight: 500; }
.split-lg span { display: inline-flex; align-items: center; gap: 5px; }
.split-lg span::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 2px;
  background: currentColor;
}
.split-lg .lw::before { color: var(--violet-2); background: var(--violet-2); }
.split-lg .ls::before { color: var(--cyan); background: var(--cyan); }

/* ------------------------------------------------------------------ 横幅 */

.banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  border-radius: var(--r-sm);
  font-size: 12px;
  border: 1px solid rgba(240, 180, 41, 0.28);
  background: rgba(240, 180, 41, 0.07);
  color: #f0c24a;
  margin-bottom: 16px;
  font-family: var(--font-mono);
}
.banner b { font-weight: 500; color: #ffd77a; }
.banner .x {
  margin-left: auto;
  cursor: pointer;
  color: #9a7c2a;
  background: none;
  border: 0;
  font-size: 15px;
  line-height: 1;
  padding: 2px 4px;
}
.banner .x:hover { color: #ffd77a; }

/* ------------------------------------------------------------------ 管理 */

.admin { margin-top: 18px; }
.admin-hd {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 14px 20px;
  user-select: none;
}
.admin-hd:hover { background: rgba(255, 255, 255, 0.02); }
.admin-hd h2 {
  margin: 0;
  font-size: 12px;
  font-family: var(--font-mono);
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--text-2);
  font-weight: 500;
}
.chev { color: var(--text-3); transition: transform 0.2s; font-size: 11px; }
.admin.open .chev { transform: rotate(90deg); }
.admin-body { display: none; padding: 0 20px 20px; }
.admin.open .admin-body { display: block; }
.admin-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}

/* ------------------------------------------------------------------ 提示 */

.toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 380px;
}
.toast {
  background: #0d1220;
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--cyan);
  border-radius: 8px;
  padding: 11px 14px;
  font-size: 12px;
  color: var(--text);
  box-shadow: 0 14px 40px -14px rgba(0, 0, 0, 0.9);
  animation: slidein 0.22s ease;
  font-family: var(--font-mono);
  word-break: break-all;
}
.toast.err { border-left-color: var(--up); }
.toast.ok { border-left-color: var(--down); }
@keyframes slidein {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: none; }
}

/* ------------------------------------------------------------------ 页脚 */

.foot {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 0 24px 40px;
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  letter-spacing: 0.04em;
}

.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ------------------------------------------------------------------ 响应式 */

@media (max-width: 1080px) {
  .hero { grid-template-columns: 1fr; }
  .cols-3 { grid-template-columns: 1fr 1fr; }
  .cols-3 > :last-child { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .main { padding: 18px 16px 56px; }
  .topbar-in { padding: 0 16px; height: 58px; }
  .cols-3 { grid-template-columns: 1fr; }
  .cols-3 > :last-child { grid-column: auto; }
  .price-now { font-size: 38px; }
  .brand-t span { display: none; }
  .netpill { display: none; }
  .toasts { left: 16px; right: 16px; max-width: none; }
  .stat-grid { margin: 16px -20px 0; }
}

/* ============================================================================
 *  多页面外壳：导航 / 页面头 / 双栏 / 分段统计
 * ========================================================================== */

a.brand { text-decoration: none; color: inherit; }

.nav {
  display: flex;
  gap: 3px;
  margin-left: 24px;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.02);
  flex: none;
}
.nav-i {
  padding: 6px 16px;
  border-radius: 999px;
  font-size: 13px;
  color: var(--text-2);
  text-decoration: none;
  transition: color 0.16s, background 0.16s;
  white-space: nowrap;
}
.nav-i:hover { color: var(--text); background: rgba(255, 255, 255, 0.04); }
.nav-i:focus-visible { outline: 2px solid var(--cyan); outline-offset: 2px; }
.nav-i.is-on {
  color: #06070d;
  font-weight: 600;
  background: linear-gradient(100deg, var(--cyan), var(--violet-2));
  box-shadow: 0 4px 18px -8px rgba(61, 225, 255, 0.8);
}

.page-hd { margin: 2px 0 20px; }
.page-hd h1 {
  margin: 0;
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.01em;
  line-height: 1.25;
}
.page-hd p {
  margin: 7px 0 0;
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.7;
}
.page-hd h1::after {
  content: "";
  display: block;
  width: 42px;
  height: 2px;
  margin-top: 10px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--cyan), var(--violet));
  box-shadow: 0 0 10px rgba(61, 225, 255, 0.55);
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.stat-grid-3,
.stat-grid-4 {
  display: grid;
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: 10px;
  overflow: hidden;
}
.stat-grid-3 { grid-template-columns: repeat(3, 1fr); }
.stat-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat-grid-3 .stat,
.stat-grid-4 .stat { background: var(--panel-2); padding: 15px 18px; }
.stat-v.big { font-size: 29px; letter-spacing: -0.02em; }
.stat-v small { font-size: 11.5px; color: var(--text-2); }
.stat-v.big small { font-size: 13px; }

/* 让面板底部说明贴底，填掉等高网格留下的空隙 */
.pb-fill > .hint:last-child,
.pb-fill > .notice:last-child { margin-top: auto; }

.link-more {
  font-size: 12px;
  color: var(--text-2);
  text-decoration: none;
  font-family: var(--font-mono);
  transition: color 0.16s;
}
.link-more:hover { color: var(--cyan); }

/* 推荐页 */
.ref-card .panel-bd { padding: 22px 24px 24px; }
.ref-card-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.ref-hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.ref-card .reflink input { padding: 12px 14px; font-size: 12px; }
.ref-card .reflink .btn { padding: 11px 22px; }
.ref-note {
  margin-top: 12px;
  font-size: 11.5px;
  color: var(--text-3);
  line-height: 1.7;
}
.ref-note code,
.notice code {
  font-family: var(--font-mono);
  background: rgba(255, 255, 255, 0.055);
  padding: 1px 5px;
  border-radius: 4px;
  color: var(--text-2);
}

.rules { margin: 0; padding: 0; list-style: none; display: grid; gap: 9px; }
.rules li {
  position: relative;
  padding-left: 18px;
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.7;
}
.rules li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 8px;
  width: 5px;
  height: 5px;
  background: var(--cyan);
  border-radius: 1px;
  transform: rotate(45deg);
  box-shadow: 0 0 6px rgba(61, 225, 255, 0.6);
}
.rules b { color: var(--text); font-weight: 500; }

.notice {
  margin-top: 15px;
  padding: 11px 13px;
  border-radius: 8px;
  border: 1px dashed rgba(240, 180, 41, 0.28);
  background: rgba(240, 180, 41, 0.05);
  font-size: 11.5px;
  color: #c2a252;
  line-height: 1.7;
}
.notice strong {
  display: block;
  color: #f0c24a;
  font-weight: 500;
  margin-bottom: 3px;
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-family: var(--font-mono);
}
.notice code { color: #e0c47a; }

@media (max-width: 1060px) {
  .nav { margin-left: 12px; }
  .nav-i { padding: 6px 13px; }
}

@media (max-width: 900px) {
  .grid-2 { grid-template-columns: 1fr; }
  .stat-grid-3 { grid-template-columns: 1fr 1fr; }
  .stat-grid-3 > .stat:last-child { grid-column: 1 / -1; }
  .stat-grid-4 { grid-template-columns: 1fr 1fr; }
  .page-hd h1 { font-size: 22px; }
  .stat-v.big { font-size: 25px; }
}

@media (max-width: 760px) {
  .topbar-in {
    height: auto;
    flex-wrap: wrap;
    padding: 10px 16px 12px;
    row-gap: 10px;
  }
  .nav {
    order: 5;
    flex: 1 0 100%;
    margin: 0;
    justify-content: stretch;
  }
  .nav-i { flex: 1; text-align: center; padding: 7px 0; }
}
