:root {
  --bg: #0a0a0b;
  --surface: #111113;
  --surface-2: #17171a;
  --border: #26262b;
  --border-soft: #1d1d21;
  --text: #fafafa;
  --text-2: #a1a1aa;
  --text-3: #6b6b74;
  --accent: #3ecf8e;
  --accent-dim: rgba(62, 207, 142, 0.12);
  --amber: #d9a03f;
  --amber-dim: rgba(217, 160, 63, 0.12);
  --red: #e05252;
  --mono: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}
.wrap { max-width: 960px; margin: 0 auto; padding: 0 24px; }

/* ---------- 顶部 ---------- */
.topbar {
  border-bottom: 1px solid var(--border-soft);
  position: sticky; top: 0; z-index: 10;
  background: rgba(10, 10, 11, 0.82);
  backdrop-filter: blur(12px);
}
.topbar-inner {
  display: flex; align-items: center; justify-content: space-between;
  height: 56px;
}
.brand { font-family: var(--mono); font-size: 14px; font-weight: 600; letter-spacing: -0.02em; }
.brand .tld { color: var(--text-3); }
.topnav { display: flex; gap: 4px; font-size: 13px; }
.topnav a {
  color: var(--text-2); text-decoration: none; padding: 6px 12px;
  border-radius: 8px; transition: color .2s, background .2s;
  cursor: pointer; white-space: nowrap;
}
.topnav a:hover { color: var(--text); background: var(--surface-2); }
.topnav a.active { color: var(--accent); background: var(--accent-dim); }
@media (max-width: 640px) {
  .topnav { overflow-x: auto; -webkit-overflow-scrolling: touch; scrollbar-width: none; }
  .topnav::-webkit-scrollbar { display: none; }
  .topnav a { padding: 6px 8px; font-size: 12px; }
  .brand .tld { display: none; }
}

/* ---------- Hero ---------- */
.hero { padding: 88px 0 56px; }
.hero-kicker {
  font-family: var(--mono); font-size: 12px; color: var(--accent);
  letter-spacing: 0.12em; text-transform: uppercase;
  display: flex; align-items: center; gap: 10px;
  animation: rise .6s cubic-bezier(0.16, 1, 0.3, 1) both;
}
.dot {
  width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
  box-shadow: 0 0 0 0 var(--accent-dim);
  animation: breathe 2.6s ease-in-out infinite;
}
.hero h1 {
  font-size: 46px; font-weight: 700; letter-spacing: -0.035em; line-height: 1.05;
  margin: 18px 0 16px; max-width: 22ch;
  animation: rise .6s cubic-bezier(0.16, 1, 0.3, 1) .08s both;
}
.hero p {
  color: var(--text-2); max-width: 58ch; font-size: 16px;
  animation: rise .6s cubic-bezier(0.16, 1, 0.3, 1) .16s both;
}
.hero-meta {
  display: flex; gap: 24px; margin-top: 28px; flex-wrap: wrap;
  font-family: var(--mono); font-size: 12px; color: var(--text-3);
  animation: rise .6s cubic-bezier(0.16, 1, 0.3, 1) .24s both;
}
.hero-meta span b { color: var(--text-2); font-weight: 500; }
@media (max-width: 640px) { .hero { padding: 56px 0 40px; } .hero h1 { font-size: 34px; } }

/* ---------- 区块（Tab 面板） ---------- */
section { padding: 40px 0 8px; }
section.tab-panel { display: none; }
section.tab-panel.active { display: block; animation: rise .4s cubic-bezier(0.16, 1, 0.3, 1) both; }
.sec-head { display: flex; align-items: baseline; gap: 14px; margin-bottom: 8px; }
.sec-num { font-family: var(--mono); font-size: 13px; color: var(--text-3); }
.sec-head h2 { font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.sec-desc { color: var(--text-2); font-size: 14px; max-width: 62ch; margin-bottom: 24px; }

/* ---------- 接口行 ---------- */
.ep-list { border-top: 1px solid var(--border); }
.ep {
  border-bottom: 1px solid var(--border);
  padding: 18px 0;
  display: grid;
  grid-template-columns: 64px 1fr auto;
  gap: 16px; align-items: start;
  animation: rise .5s cubic-bezier(0.16, 1, 0.3, 1) both;
  animation-delay: calc(var(--i, 0) * 60ms);
}
.method {
  font-family: var(--mono); font-size: 11px; font-weight: 600; letter-spacing: 0.06em;
  text-align: center; padding: 3px 0; border-radius: 6px; margin-top: 3px;
}
.method.get { color: var(--accent); background: var(--accent-dim); }
.method.post { color: var(--amber); background: var(--amber-dim); }
.ep-path { font-family: var(--mono); font-size: 13.5px; color: var(--text); word-break: break-all; }
.ep-path .q { color: var(--text-3); }
.ep-desc { font-size: 13.5px; color: var(--text-2); margin-top: 4px; max-width: 60ch; }
.ep pre {
  margin-top: 10px; font-family: var(--mono); font-size: 12px; line-height: 1.6;
  color: var(--text-2); background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 10px; padding: 12px 14px; overflow-x: auto;
}
.ep pre .c { color: var(--text-3); }
.ep pre .a { color: var(--accent); }
.ep pre .m { color: var(--amber); }

/* ---------- 按钮 ---------- */
.btn {
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  color: var(--text-2); background: var(--surface-2);
  border: 1px solid var(--border); border-radius: 8px;
  padding: 6px 14px; cursor: pointer; white-space: nowrap;
  transition: color .2s, border-color .2s, transform .1s;
}
.btn:hover { color: var(--text); border-color: #3a3a41; }
.btn:active { transform: scale(0.96); }
.btn.primary { color: #0a0a0b; background: var(--accent); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: #4bd99b; color: #0a0a0b; }
.btn.running { pointer-events: none; color: var(--accent); border-color: var(--accent); }

/* ---------- 演示结果面板 ---------- */
.result {
  grid-column: 1 / -1;
  margin-top: 14px;
  display: none;
}
.result.show { display: block; animation: rise .35s cubic-bezier(0.16, 1, 0.3, 1) both; }
.result-bar {
  display: flex; align-items: center; gap: 10px; margin-bottom: 8px;
  font-family: var(--mono); font-size: 11px; color: var(--text-3);
}
.status-code { padding: 2px 8px; border-radius: 5px; font-weight: 600; }
.status-code.ok { color: var(--accent); background: var(--accent-dim); }
.status-code.err { color: var(--red); background: rgba(224, 82, 82, 0.12); }
.result pre {
  font-family: var(--mono); font-size: 12.5px; line-height: 1.65;
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 10px; padding: 14px 16px; overflow-x: auto;
  color: var(--text-2); max-height: 340px; overflow-y: auto;
}
.result pre.ok { color: var(--text-2); }
.result pre.err { color: var(--red); }
.shimmer {
  background: linear-gradient(90deg, var(--surface) 0%, var(--surface-2) 50%, var(--surface) 100%);
  background-size: 200% 100%;
  animation: shimmer 1.1s linear infinite;
  border-radius: 10px; height: 84px; border: 1px solid var(--border-soft);
}

/* ---------- SSE ---------- */
.sse-panel {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 14px; padding: 20px;
}
.sse-controls { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.sse-state { font-family: var(--mono); font-size: 12px; color: var(--text-3); display: flex; align-items: center; gap: 8px; }
.sse-out {
  font-family: var(--mono); font-size: 12px; line-height: 1.7;
  background: var(--bg); border: 1px solid var(--border-soft); border-radius: 10px;
  padding: 14px 16px; margin-top: 14px; height: 220px; overflow-y: auto;
  color: var(--text-2); white-space: pre-wrap; word-break: break-all;
}
.sse-out .ts { color: var(--text-3); }

/* ---------- 代理映射表 ---------- */
.map-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.map-table th {
  text-align: left; font-family: var(--mono); font-size: 11px; font-weight: 500;
  color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em;
  padding: 10px 14px; border-bottom: 1px solid var(--border);
}
.map-table td {
  padding: 12px 14px; border-bottom: 1px solid var(--border-soft);
  font-family: var(--mono); font-size: 12.5px; color: var(--text-2);
}
.map-table td:first-child { color: var(--accent); font-weight: 500; }
.map-table tr:last-child td { border-bottom: none; }
.map-box {
  border: 1px solid var(--border-soft); border-radius: 14px; overflow: hidden;
  background: var(--surface);
}

/* ---------- mifi 面板 ---------- */
.mifi-panel {
  background: var(--surface); border: 1px solid var(--border-soft);
  border-radius: 14px; padding: 22px; margin-top: 4px;
}
.field { margin-bottom: 14px; }
.field label {
  display: block; font-size: 12px; font-weight: 550; color: var(--text-2);
  margin-bottom: 6px; letter-spacing: 0.02em;
}
.field .hint { font-size: 12px; color: var(--text-3); margin-top: 5px; }
.field .hint code { font-family: var(--mono); color: var(--text-2); }
.field.error .hint { color: var(--red); }
.input {
  width: 100%; font-family: var(--mono); font-size: 13px;
  color: var(--text); background: var(--bg);
  border: 1px solid var(--border); border-radius: 9px;
  padding: 9px 12px; outline: none;
  transition: border-color .2s;
}
.input:focus { border-color: var(--accent); }
.field.error .input { border-color: var(--red); }
.dev-list { margin-top: 16px; }
.dev-empty { text-align: center; padding: 28px 0; color: var(--text-3); font-size: 13px; }
.dev-empty .mono { font-family: var(--mono); font-size: 12px; }
.dev-wrap { border-bottom: 1px solid var(--border-soft); }
.dev-wrap:last-child { border-bottom: none; }
.dev {
  display: grid; grid-template-columns: auto 1fr auto; gap: 14px; align-items: center;
  padding: 14px 8px; cursor: pointer; border-radius: 10px;
  transition: background .15s;
}
.dev:hover { background: var(--surface-2); }
.dev-wrap.open .dev { background: var(--surface-2); }
.dev-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--text-3); }
.dev.online .dev-dot { background: var(--accent); animation: breathe 2.4s ease-in-out infinite; }
.dev-name { font-size: 14px; font-weight: 550; }
.dev-sn { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.dev-stats { display: flex; gap: 18px; font-family: var(--mono); font-size: 12px; color: var(--text-2); flex-wrap: wrap; }
.dev-stats .k { color: var(--text-3); font-size: 10.5px; display: block; letter-spacing: 0.05em; }
.dev-stats .net-bad { color: var(--red); font-weight: 600; }
.dev-badge {
  font-family: var(--mono); font-size: 10.5px; padding: 3px 9px; border-radius: 6px;
}
.dev-badge.on { color: var(--accent); background: var(--accent-dim); }
.dev-badge.off { color: var(--text-3); background: var(--surface-2); }

/* ---------- 设备详情面板 ---------- */
.dev-detail { display: none; padding: 2px 8px 18px; }
.dev-wrap.open .dev-detail { display: block; animation: rise .3s cubic-bezier(0.16, 1, 0.3, 1) both; }
.dd-inner { border-left: 2px solid var(--border); padding-left: 16px; display: grid; gap: 14px; }
.dd-group .dd-title {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; color: var(--text-3);
  text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 8px;
}
.dd-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 20px; }
.dd-item .k {
  display: block; font-size: 10.5px; color: var(--text-3); letter-spacing: 0.04em;
  font-family: var(--mono); margin-bottom: 2px;
}
.dd-item .v { font-family: var(--mono); font-size: 12.5px; color: var(--text); word-break: break-all; }
.dd-none { color: var(--text-3); font-size: 12.5px; font-style: normal; }
.dd-error { color: var(--red); font-family: var(--mono); font-size: 12px; padding: 10px 0; }
.dd-raw { border: 1px solid var(--border-soft); border-radius: 10px; background: var(--bg); }
.dd-raw summary {
  cursor: pointer; font-family: var(--mono); font-size: 11.5px; color: var(--text-3);
  padding: 10px 14px; user-select: none; transition: color .2s;
}
.dd-raw summary:hover { color: var(--text-2); }
.dd-raw pre {
  margin: 0 14px 14px; font-family: var(--mono); font-size: 11.5px; line-height: 1.6;
  color: var(--text-2); overflow-x: auto; max-height: 320px; overflow-y: auto;
}

/* ---------- 字段表 ---------- */
.fields-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.fields-table th {
  text-align: left; font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em;
  padding: 8px 12px; border-bottom: 1px solid var(--border);
}
.fields-table td { padding: 8px 12px; border-bottom: 1px solid var(--border-soft); color: var(--text-2); }
.fields-table td:first-child { font-family: var(--mono); color: var(--text); white-space: nowrap; }
.fields-table td:nth-child(2) { font-family: var(--mono); color: var(--text-3); white-space: nowrap; }
.fields-table tr:last-child td { border-bottom: none; }

footer {
  margin-top: 72px; padding: 28px 0 40px; border-top: 1px solid var(--border-soft);
  font-family: var(--mono); font-size: 12px; color: var(--text-3);
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 8px;
}

@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
@keyframes breathe { 0%, 100% { opacity: 1; } 50% { opacity: 0.35; } }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}
