/* ============================================================
   Site Shell — 共享样式
   设计系统：近黑画布 / 1px 细描边分层 / 蓝色主色 / 等宽字体承载路径
   ============================================================ */

:root {
  --bg: #08090a;
  --bg-bar: #0a0c0e;
  --card: #0d0f11;
  --card-2: #0b0d0f;
  --line: #1f2429;
  --line-2: #232a31;
  --line-3: #2a333b;
  --fg: #edf1f5;
  --fg-2: #b9c2cb;
  --fg-3: #8b949e;
  --fg-4: #5c666f;
  --fg-5: #4a555f;
  --accent: #0070f3;
  --accent-2: #4fa3ff;
  --ok: #3ccf4e;
  --warn: #f5a623;
  --err: #ee0000;
  --r: 8px;
  --r-sm: 6px;
  --sans: Inter, "Noto Sans SC", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

a { color: var(--accent-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
::selection { background: rgba(0, 112, 243, 0.35); }

/* ---------- 顶栏 ---------- */
.header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 64px;
  padding: 0 20px;
  background: var(--bg-bar);
  border-bottom: 1px solid var(--line);
}

.brand { display: flex; align-items: center; gap: 9px; }

.brand-mark {
  width: 26px;
  height: 26px;
  flex: 0 0 26px;
  border-radius: 7px;
  background: #101820;
  border: 1px solid #243040;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2px;
  padding: 5px;
}
.brand-mark i { border-radius: 1.4px; background: #3a4750; display: block; }
.brand-mark i:nth-child(1) { background: var(--accent); }
.brand-mark i:nth-child(4) { background: #2fe6c8; }

.brand-name { font-weight: 600; font-size: 15px; letter-spacing: 0.01em; }
.brand-host { font-family: var(--mono); font-size: 11px; color: var(--fg-5); }
.crumb-sep { font-family: var(--mono); color: #3a444d; font-size: 13px; }
.crumb-cur { font-size: 13px; color: var(--fg-3); }

.header-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- 按钮 ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line-3);
  background: transparent;
  color: var(--fg-2);
  font-size: 13px;
  transition: background 0.18s, border-color 0.18s, color 0.18s;
  white-space: nowrap;
}
.btn:hover { background: #12161a; border-color: #333d47; color: var(--fg); }
.btn:active { transform: translateY(0.5px); }
.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
  font-weight: 500;
}
.btn-primary:hover { background: #1a80f8; border-color: #1a80f8; color: #fff; }
.btn-ghost { border-color: transparent; color: var(--fg-3); }
.btn-ghost:hover { background: #12161a; border-color: var(--line-2); }
.btn-sm { height: 28px; font-size: 12px; padding: 0 10px; }
.btn-danger { color: #ff8a8a; border-color: #40262a; }
.btn-danger:hover { background: #24191b; border-color: #5a2f34; color: #ff9d9d; }
.btn-icon { width: 32px; padding: 0; }
.btn[disabled] { opacity: 0.45; cursor: not-allowed; }

/* 设备切换 */
.seg {
  display: inline-flex;
  gap: 2px;
  padding: 3px;
  background: #0f1215;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  height: 32px;
}
.seg button {
  border: 0;
  background: transparent;
  color: var(--fg-3);
  font-size: 12px;
  padding: 0 9px;
  border-radius: 4px;
  transition: background 0.16s, color 0.16s;
}
.seg button[aria-pressed="true"] { background: #22282e; color: var(--fg); }

/* ---------- 页面骨架 ---------- */
.page { padding: 32px 20px 56px; max-width: 1440px; margin: 0 auto; }
.page-narrow { max-width: 1180px; }

.hero {
  position: relative;
  padding: 40px 0 32px;
  background:
    radial-gradient(120% 140% at 50% -20%, rgba(0, 112, 243, 0.16) 0%, rgba(8, 9, 10, 0) 62%);
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 9px;
  margin-bottom: 18px;
  border: 1px solid #243040;
  border-radius: var(--r-sm);
  background: #101820;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-3);
}
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ok); flex: 0 0 6px; }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-idle { background: #4a555f; }
.dot-live { background: #2fe6c8; box-shadow: 0 0 0 3px rgba(47, 230, 200, 0.14); }

h1.hero-title {
  margin: 0 0 12px;
  font-size: 34px;
  line-height: 1.24;
  font-weight: 650;
  letter-spacing: -0.01em;
}
.hero-sub { margin: 0 0 22px; max-width: 720px; color: var(--fg-3); font-size: 14px; line-height: 1.7; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.hero-actions .btn { height: 38px; padding: 0 16px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 8px 0 14px;
}
.section-title { display: flex; align-items: baseline; gap: 8px; font-size: 16px; font-weight: 600; }
.section-count { font-family: var(--mono); font-size: 12px; color: var(--fg-4); font-weight: 400; }
.section-note { font-family: var(--mono); font-size: 11px; color: var(--fg-5); }

/* ---------- 站点卡网格 ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(288px, 1fr));
  gap: 16px;
}

.scard {
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  transition: border-color 0.18s, transform 0.18s;
}
.scard:hover { border-color: #333d47; }
.scard-thumb {
  position: relative;
  height: 168px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: flex-end;
  padding: 12px;
}
.scard-thumb::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.05) 1px, transparent 0) 0 0 / 18px 18px;
  pointer-events: none;
}
.scard-thumb span {
  position: relative;
  font-family: var(--mono);
  font-size: 11px;
  color: var(--fg-3);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 4px;
  padding: 2px 6px;
  backdrop-filter: blur(3px);
}
.scard-body { padding: 14px; display: flex; flex-direction: column; gap: 9px; }
.scard-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.scard-name { font-size: 14px; font-weight: 500; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.scard-top .chip { flex: 0 0 auto; }
.scard-meta { display: flex; align-items: center; gap: 7px; }
.scard-slug { font-family: var(--mono); font-size: 11px; color: var(--fg-4); }
.scard-desc {
  font-size: 12px;
  color: var(--fg-3);
  line-height: 1.6;
  min-height: 19px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.scard-open {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  border-radius: 5px;
  border: 1px solid var(--line-2);
  background: #161b20;
  color: var(--fg-2);
  font-size: 12px;
  transition: background 0.16s, border-color 0.16s, color 0.16s;
}
.scard-open:hover { background: #1b2229; border-color: #333d47; color: var(--fg); }

/* 空态 */
.empty {
  border: 1px dashed var(--line-3);
  border-radius: var(--r);
  padding: 48px 20px;
  text-align: center;
  color: var(--fg-4);
}
.empty strong { display: block; color: var(--fg-2); font-size: 14px; font-weight: 500; margin-bottom: 6px; }

/* ---------- 引导条 ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 28px; }
.step {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card-2);
  display: flex;
  flex-direction: column;
  gap: 7px;
}
.step-no { font-family: var(--mono); font-size: 11px; color: var(--accent-2); }
.step-t { font-size: 13px; font-weight: 500; color: var(--fg); }
.step-d { font-size: 11px; line-height: 1.65; color: var(--fg-4); }

/* ---------- 预览页 ---------- */
.preview-wrap {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 64px);
  padding: 16px 20px 12px;
  gap: 12px;
}
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.preview-title { display: flex; align-items: center; gap: 10px; }
.preview-title h2 { margin: 0; font-size: 18px; font-weight: 600; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 7px;
  border-radius: 4px;
  font-size: 11px;
  background: rgba(60, 207, 78, 0.12);
  color: var(--ok);
}
.chip-warn { background: rgba(245, 166, 35, 0.12); color: var(--warn); }
.chip-idle { background: #161b20; color: var(--fg-3); }
.chip-bad { background: rgba(238, 0, 0, 0.12); color: #ff8a8a; }
.preview-dim { font-family: var(--mono); font-size: 12px; color: var(--fg-4); }

.frame-shell {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card);
  overflow: hidden;
}
.chrome {
  display: flex;
  align-items: center;
  gap: 10px;
  height: 44px;
  padding: 0 9px;
  background: #0f1215;
  border-bottom: 1px solid var(--line);
  flex: 0 0 44px;
}
.lights { display: flex; gap: 6px; }
.lights i { width: 8px; height: 8px; border-radius: 50%; display: block; opacity: 0.9; }
.lights i:nth-child(1) { background: #f35e59; }
.lights i:nth-child(2) { background: #f5a623; }
.lights i:nth-child(3) { background: #3ccf4e; }
.addr {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 8px;
  border-radius: 5px;
  background: var(--bg);
  border: 1px solid #1a1f25;
}
.addr svg { flex: 0 0 11px; }
.addr input {
  flex: 1;
  min-width: 0;
  background: transparent;
  border: 0;
  outline: none;
  color: var(--fg-3);
  font-family: var(--mono);
  font-size: 11px;
}
.addr input::placeholder { color: var(--fg-5); }
.mode {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--accent-2);
  background: #131a22;
  border-radius: 3px;
  padding: 3px 5px;
}
.viewport {
  flex: 1;
  min-height: 0;
  display: flex;
  justify-content: center;
  background:
    radial-gradient(circle at 1px 1px, rgba(255, 255, 255, 0.045) 1px, transparent 0) 0 0 / 22px 22px,
    #0a0c0e;
  overflow: auto;
  padding: 12px;
}
.viewport iframe {
  width: 100%;
  height: 100%;
  min-height: 320px;
  border: 0;
  border-radius: 6px;
  background: #fff;
  transition: width 0.24s ease, max-width 0.24s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.5);
}
body[data-device="mobile"] .viewport iframe { width: 390px; max-width: 390px; }
.viewport-note {
  margin: 0;
  padding: 10px 2px 0;
  font-size: 11px;
  color: var(--fg-5);
  font-family: var(--mono);
}

/* ---------- 表单 / 上传页 ---------- */
.split { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 40px; align-items: start; }
@media (max-width: 1080px) { .split { grid-template-columns: 1fr; gap: 20px; } }

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 200px;
  padding: 24px;
  border: 1px solid var(--line-3);
  border-radius: var(--r);
  background: var(--card-2);
  text-align: center;
  transition: border-color 0.18s, background 0.18s;
  cursor: pointer;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--accent); background: #0c131b; }
.dropzone strong { font-size: 14px; font-weight: 500; }
.dropzone small { font-family: var(--mono); font-size: 11px; color: var(--fg-4); }

.formcard {
  margin-top: 20px;
  padding: 20px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--card-2);
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .row2 { grid-template-columns: 1fr; } }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 11px; color: var(--fg-3); }
.field .hint { font-size: 11px; color: var(--fg-5); }

.input {
  height: 36px;
  padding: 0 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--fg);
  font-size: 13px;
  font-family: var(--sans);
  outline: none;
  width: 100%;
  transition: border-color 0.16s;
}
.input:focus { border-color: var(--accent); }
.input.mono { font-family: var(--mono); font-size: 12px; }
textarea.input { height: 84px; padding: 9px 10px; line-height: 1.6; resize: vertical; }

.input-group { display: flex; align-items: center; height: 36px; border-radius: var(--r-sm); border: 1px solid var(--line); background: var(--bg); overflow: hidden; }
.input-group:focus-within { border-color: var(--accent); }
.input-group .prefix { padding-left: 10px; font-family: var(--mono); font-size: 12px; color: var(--fg-5); }
.input-group input { flex: 1; min-width: 0; height: 100%; border: 0; background: transparent; color: var(--accent-2); font-family: var(--mono); font-size: 12px; padding: 0 10px 0 2px; outline: none; }

.swatches { display: flex; align-items: center; gap: 8px; }
.swatch { width: 18px; height: 18px; border-radius: 50%; border: 2px solid transparent; padding: 0; }
.swatch[aria-pressed="true"] { border-color: #fff; }

.actions { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 18px; }
.actions-note { font-family: var(--mono); font-size: 11px; color: var(--fg-5); }
.actions-btns { display: flex; gap: 8px; }

/* ---------- 侧栏卡片 ---------- */
.side { display: flex; flex-direction: column; gap: 14px; }
.panel { padding: 16px; border: 1px solid var(--line); border-radius: var(--r); background: var(--card-2); display: flex; flex-direction: column; gap: 10px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.panel-title { font-size: 12px; font-weight: 500; color: #c9d1d9; }
.panel-count { font-family: var(--mono); font-size: 11px; color: var(--fg-4); }
.panel-note { font-size: 11px; line-height: 1.7; color: var(--fg-4); }
.file-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 9px; border-radius: 5px; background: var(--bg); font-family: var(--mono); font-size: 11px; }
.check { display: flex; align-items: center; gap: 8px; font-size: 11px; color: var(--fg-2); }
.check svg { flex: 0 0 13px; }

.prog { height: 3px; border-radius: 2px; background: #1f2429; overflow: hidden; }
.prog i { display: block; height: 100%; background: var(--accent); border-radius: 2px; transition: width 0.3s; }

/* 管理列表 */
.rows { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.row-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 11px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--card);
}
.row-main { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.row-name { font-size: 13px; color: var(--fg); display: flex; align-items: center; gap: 7px; }
.row-sub { font-family: var(--mono); font-size: 11px; color: var(--fg-4); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row-actions { display: flex; gap: 6px; }

/* toast */
.toast {  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translate(-50%, 20px);
  padding: 10px 16px;
  border-radius: 8px;
  border: 1px solid var(--line-3);
  background: #12161a;
  color: var(--fg);
  font-size: 13px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
  z-index: 60;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

/* ---------- 移动端 ---------- */
@media (max-width: 720px) {
  .header { height: 56px; padding: 0 14px; }
  .brand-host, .crumb-cur, .crumb-sep { display: none; }
  .page { padding: 20px 14px 40px; }
  .hero { padding: 14px 0 22px; }
  h1.hero-title { font-size: 24px; }
  .hero-sub { font-size: 13px; }
  .grid { grid-template-columns: 1fr; gap: 12px; }
  .scard-thumb { height: 132px; }
  .steps { grid-template-columns: 1fr; }
  .preview-wrap { height: calc(100vh - 56px); padding: 10px 10px 8px; gap: 8px; }
  .preview-head { flex-wrap: wrap; }
  .preview-title h2 { font-size: 15px; }
  .lights { display: none; }
  .split { gap: 16px; }
  .formcard { padding: 14px; }
  .actions { flex-direction: column-reverse; align-items: stretch; }
  .actions-btns { justify-content: stretch; }
  .actions-btns .btn { flex: 1; }
  body[data-device="mobile"] .viewport iframe { width: 100%; max-width: 100%; }
}

/* 窄屏兜底：隐藏次要入口，避免头部挤压 */
@media (max-width: 440px) {
  .header-actions .btn-ghost { display: none; }
  .section-note { display: none; }
  .hero-actions .btn { flex: 1; }
}

/* ---------- file:// 打开时的提示 ---------- */
.file-warn {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin: 0 0 18px;
  padding: 14px 16px;
  border: 1px solid #4a3a18;
  border-radius: 8px;
  background: #1d1710;
  color: #f0c680;
  font-size: 12.5px;
  line-height: 1.75;
}
.file-warn[hidden] { display: none; }
.file-warn b { color: #ffd79a; font-weight: 600; }
.file-warn code {
  font-family: var(--mono);
  background: #2a2116;
  padding: 1px 5px;
  border-radius: 3px;
}
.file-warn .x {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #8a7551;
  font-size: 16px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}
.file-warn .x:hover { color: #f0c680; }
.viewport-blocked {
  margin: auto;
  max-width: 520px;
  padding: 24px;
  border: 1px solid #4a3a18;
  border-radius: 10px;
  background: #16120c;
  color: #f0c680;
  font-size: 13px;
  line-height: 1.8;
}
.viewport-blocked b { display: block; color: #ffd79a; font-size: 14px; margin-bottom: 8px; }
.viewport-blocked code {
  font-family: var(--mono);
  background: #2a2116;
  padding: 1px 5px;
  border-radius: 3px;
}

