/* 网页变化守望台 · 样式
   维护提醒：改了样式或脚本，页面引用会自动带上内容版本号（见 assets.go），
   不要把它改成长期缓存，也不要手动把 ?v= 去掉。 */

:root {
  --bg: #f6f4ef;
  --bg-soft: #fbf9f4;
  --card: #fffdfa;
  --ink: #1b1f24;
  --ink-2: #3b4147;
  --muted: #6b7178;
  --faint: #90958f;
  --line: #e7e2d7;
  --line-strong: #d9d2c4;
  --accent: #d9512c;
  --accent-deep: #b93f1d;
  --accent-soft: #fde8df;
  --good: #1e8e63;
  --good-soft: #e4f2ea;
  --warn: #b7791f;
  --warn-soft: #fbf0da;
  --bad: #c23b30;
  --bad-soft: #fbe4e0;
  --radius: 18px;
  --shadow-sm: 0 1px 2px rgba(40, 32, 22, .05);
  --shadow-md: 0 14px 38px -18px rgba(40, 32, 22, .28);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.6;
  background:
    radial-gradient(900px 520px at 88% -12%, #f3e6d6 0%, transparent 62%),
    radial-gradient(720px 460px at -12% 2%, #e8f0e7 0%, transparent 58%),
    var(--bg);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--accent-deep); }

button { font-family: inherit; }

[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.ic {
  width: 1.15em;
  height: 1.15em;
  flex: none;
  stroke: currentColor;
  fill: none;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: -.18em;
}

/* ---------- 顶栏 ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  border-bottom: 1px solid rgba(217, 210, 196, .6);
  background: rgba(246, 244, 239, .82);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.topbar-inner {
  max-width: 1040px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--ink);
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: #f7e0d2;
  background: linear-gradient(150deg, #2b3037, #14181c 70%);
  box-shadow: 0 4px 12px -4px rgba(20, 24, 28, .5);
  flex: none;
}

.brand-mark .ic { width: 20px; height: 20px; }

.brand-name {
  font-weight: 750;
  font-size: 15.5px;
  letter-spacing: .01em;
  white-space: nowrap;
}

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

/* ---------- 按钮 ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 650;
  line-height: 1;
  color: var(--ink);
  background: transparent;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background .16s ease, border-color .16s ease, color .16s ease, transform .12s ease, box-shadow .16s ease;
}

.btn:active { transform: translateY(1px); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }

.btn.primary { background: var(--ink); color: #fff; box-shadow: 0 8px 20px -12px rgba(20, 24, 28, .7); }
.btn.primary:hover { background: #000; }
.btn.dark { background: var(--ink); color: #fff; }
.btn.dark:hover { background: #000; }
.btn.ghost { background: var(--card); border-color: var(--line-strong); color: var(--ink-2); }
.btn.ghost:hover { background: #fff; border-color: #c9c1b1; color: var(--ink); }
.btn.plain { background: transparent; color: var(--muted); }
.btn.plain:hover { color: var(--ink); background: #efece4; }
.btn.danger { background: var(--bad); color: #fff; }
.btn.danger:hover { background: #a92f25; }
.btn.danger-ghost { background: transparent; border-color: rgba(194, 59, 48, .32); color: var(--bad); }
.btn.danger-ghost:hover { background: var(--bad-soft); border-color: rgba(194, 59, 48, .5); }
.btn.sm { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn.lg { padding: 14px 22px; font-size: 15px; border-radius: 14px; }
.btn.wide { width: 100%; padding: 14px 18px; font-size: 15px; }
.btn .ic { width: 1.1em; height: 1.1em; }

.link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 0;
  padding: 4px 2px;
  color: var(--accent-deep);
  font-size: 13px;
  font-weight: 650;
  cursor: pointer;
  text-decoration: none;
}
.link:hover { text-decoration: underline; text-underline-offset: 3px; }
.link .ic { width: 1em; height: 1em; }

.danger-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 26px auto 4px;
  padding: 9px 12px;
  border: 0;
  border-radius: 10px;
  background: none;
  color: var(--bad);
  font-size: 13px;
  cursor: pointer;
}
.danger-link:hover { background: var(--bad-soft); }

/* ---------- 布局 ---------- */

.wrap { max-width: 1040px; margin: 0 auto; padding: 0 20px 64px; }
.wrap.narrow { max-width: 780px; }

.page-head { padding: 36px 0 18px; }
.page-head h1 {
  font-size: clamp(26px, 3.6vw, 34px);
  line-height: 1.2;
  letter-spacing: -.02em;
  margin: 6px 0 10px;
}
.page-head .lede { max-width: 620px; }

.eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  font-size: 12.5px;
  font-weight: 650;
  letter-spacing: .08em;
  color: var(--muted);
}

.lede { margin: 0; color: var(--muted); font-size: 14.5px; line-height: 1.75; }

.pulse-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--good);
  box-shadow: 0 0 0 0 rgba(30, 142, 99, .38);
  animation: pulseDot 2.2s ease-out infinite;
  flex: none;
}

/* ---------- 首页介绍 ---------- */

.intro {
  display: grid;
  grid-template-columns: 1.02fr .98fr;
  gap: 36px;
  align-items: center;
  padding: 50px 0 30px;
}

.intro-copy h1 {
  font-size: clamp(30px, 4.6vw, 47px);
  line-height: 1.16;
  letter-spacing: -.025em;
  margin: 12px 0 16px;
  font-weight: 800;
}

.intro-copy h1 em {
  font-style: normal;
  color: var(--accent);
  background: linear-gradient(transparent 66%, #f8dccd 66%);
  padding: 0 2px;
}

.intro-copy .lede { max-width: 460px; font-size: 15px; }

.intro-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  list-style: none;
  padding: 0;
  margin: 30px 0 0;
}

.steps li { display: flex; align-items: flex-start; gap: 9px; }

.step-num {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--accent);
  display: grid;
  place-items: center;
  font-size: 12px;
  font-weight: 750;
  flex: none;
  margin-top: 1px;
}

.steps b { display: block; font-size: 13px; color: var(--ink); }
.steps em { display: block; font-style: normal; font-size: 12px; color: var(--faint); margin-top: 2px; }

.intro-art { display: flex; justify-content: center; }
.intro-art svg { width: 100%; max-width: 440px; height: auto; }

/* ---------- 提示条 ---------- */

.notice {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 16px 0;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow-sm);
  font-size: 13.5px;
  color: var(--ink-2);
}

.notice.amber { background: #fffaf0; border-color: #f0dfbd; }

.notice-icon {
  width: 32px;
  height: 32px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: none;
  color: var(--accent);
  background: var(--accent-soft);
}
.notice.amber .notice-icon { color: var(--warn); background: var(--warn-soft); }
.notice-icon .ic { width: 18px; height: 18px; }

.notice-text { flex: 1; line-height: 1.55; min-width: 0; }
.notice-text b { color: var(--ink); }

.notice-close {
  width: 30px;
  height: 30px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--faint);
  display: grid;
  place-items: center;
  cursor: pointer;
  flex: none;
}
.notice-close:hover { background: rgba(0, 0, 0, .06); color: var(--ink); }
.notice-close .ic { width: 16px; height: 16px; }

.offline {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--bad-soft);
  color: var(--bad);
  font-size: 13px;
}

/* ---------- 概览数字 ---------- */

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin: 10px 0 34px;
}

.stat {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 15px 17px 13px;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 5px;
  min-width: 0;
}

.stat-label { font-size: 12.5px; color: var(--muted); }
.stat-main { display: flex; align-items: baseline; gap: 6px; }
.stat-value {
  font-family: var(--mono);
  font-size: 27px;
  font-weight: 750;
  letter-spacing: -.03em;
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
}
.stat-value.good { color: var(--good); }
.stat-value.bad { color: var(--bad); }
.stat-value.warn { color: var(--warn); }
.stat-unit { font-size: 11.5px; color: var(--faint); }

/* ---------- 区块标题 ---------- */

.section { margin-top: 34px; }

.section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 13px;
}

.section-head h2 { font-size: 17.5px; margin: 0; letter-spacing: -.01em; }

.count {
  display: inline-block;
  margin-left: 5px;
  padding: 1px 8px;
  border-radius: 999px;
  background: #eee9df;
  color: var(--muted);
  font-size: 12px;
  font-weight: 650;
  vertical-align: 2px;
}

/* ---------- 监控卡片 ---------- */

.grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }

.monitor {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 17px 18px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  transition: box-shadow .2s ease, border-color .2s ease, transform .2s ease;
  min-width: 0;
}
.monitor:hover { border-color: var(--line-strong); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.monitor.is-paused { background: #fbf9f4; }
.monitor.is-paused .m-value { color: var(--faint); }
.monitor.is-error { border-color: #eec6bf; background: linear-gradient(180deg, #fffdfa, #fff8f5); }

.m-top { display: flex; align-items: center; gap: 8px; min-width: 0; }
.m-top h3 {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 15.5px;
  font-weight: 700;
  letter-spacing: -.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--faint);
  box-shadow: 0 0 0 3px rgba(144, 149, 143, .14);
  flex: none;
}
.status-dot.st-ok { background: var(--good); box-shadow: 0 0 0 3px rgba(30, 142, 99, .16); }
.status-dot.st-error { background: var(--bad); box-shadow: 0 0 0 3px rgba(194, 59, 48, .16); animation: blink 1.8s ease-in-out infinite; }
.status-dot.st-pending { background: var(--warn); box-shadow: 0 0 0 3px rgba(183, 121, 31, .16); }

.pill {
  flex: none;
  padding: 3px 8px;
  border-radius: 999px;
  background: #f0ece3;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  white-space: nowrap;
}
.pill.paused { background: #eeeae1; color: var(--faint); }

.m-value {
  margin: 15px 0 4px;
  font-family: var(--mono);
  font-size: 27px;
  font-weight: 750;
  letter-spacing: -.03em;
  line-height: 1.25;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  word-break: break-word;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.m-value.is-text { font-family: var(--font); font-size: 17px; font-weight: 600; letter-spacing: 0; line-height: 1.5; }
.m-value.is-empty { color: var(--faint); font-size: 16px; font-weight: 500; font-family: var(--font); }

.m-raw {
  margin: 0 0 6px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.m-err {
  margin: 6px 0 2px;
  padding: 8px 10px;
  border-radius: 10px;
  background: var(--bad-soft);
  color: var(--bad);
  font-size: 12px;
  line-height: 1.55;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.m-err-action {
  margin: 4px 0 6px;
  font-size: 12px;
}
.m-err-action a {
  color: var(--accent-deep);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(185, 63, 29, .35);
  padding-bottom: 1px;
}

.m-browser {
  margin: 0 0 6px;
  color: var(--faint);
  font-size: 12px;
  line-height: 1.5;
}
.m-browser::before {
  content: "浏览器代看";
  display: inline-block;
  margin-right: 6px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--ink-soft, #ece8e0);
  color: var(--muted);
  font-size: 11px;
}

.m-meta { display: flex; align-items: center; gap: 6px; color: var(--faint); font-size: 12px; flex-wrap: wrap; }
.m-meta .sep { opacity: .55; }
.m-url {
  margin-top: 8px;
  display: flex;
  align-items: center;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  text-decoration: none;
  min-width: 0;
}
.m-url:hover { color: var(--accent-deep); text-decoration: underline; }
.m-url .ic { width: 13px; height: 13px; flex: none; opacity: .7; }
.m-url span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.m-actions {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-top: 13px;
  padding-top: 10px;
  border-top: 1px dashed var(--line);
  flex-wrap: wrap;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 9px;
  border: 0;
  border-radius: 9px;
  background: transparent;
  color: var(--muted);
  font-size: 12.5px;
  cursor: pointer;
}
.icon-btn:hover { background: #f2eee6; color: var(--ink); }
.icon-btn.danger:hover { background: var(--bad-soft); color: var(--bad); }
.icon-btn:disabled { opacity: .55; cursor: progress; }
.icon-btn .ic { width: 14px; height: 14px; }

.spinning { animation: spin 1s linear infinite; }

/* ---------- 动态 ---------- */

.events {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}

.event {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: start;
  padding: 14px 17px;
  border-bottom: 1px solid #f1ede4;
}
.event:last-child { border-bottom: 0; }

.ev-icon {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent);
  flex: none;
}
.event.info .ev-icon { background: #f0ede6; color: var(--muted); }
.ev-icon .ic { width: 17px; height: 17px; }

.ev-main { min-width: 0; }
.ev-title { font-size: 13.5px; color: var(--ink); line-height: 1.5; }
.ev-title b { font-weight: 700; }
.ev-values {
  margin-top: 3px;
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-2);
  word-break: break-word;
  line-height: 1.5;
}
.ev-values .old { color: var(--faint); text-decoration: line-through; text-decoration-thickness: 1px; }
.ev-values .new { color: var(--accent); font-weight: 700; }
.ev-detail { margin-top: 3px; font-size: 12px; color: var(--muted); line-height: 1.55; word-break: break-word; }

.ev-right { text-align: right; white-space: nowrap; }
.ev-time { font-size: 11.5px; color: var(--faint); }
.ev-push { margin-top: 4px; font-size: 11px; color: var(--good); }
.ev-push.failed { color: var(--bad); }
.ev-push.muted { color: var(--faint); }

.empty-line {
  margin: 16px 0 0;
  padding: 20px;
  border: 1px dashed var(--line-strong);
  border-radius: 14px;
  color: var(--faint);
  font-size: 13px;
  text-align: center;
}

/* ---------- 表单 ---------- */

.form { display: flex; flex-direction: column; gap: 14px; }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 22px;
  box-shadow: var(--shadow-sm);
}

.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 17px; }
.card-head h2 { font-size: 16px; margin: 0; letter-spacing: -.01em; }

.step-tag {
  width: 26px;
  height: 26px;
  border-radius: 9px;
  display: grid;
  place-items: center;
  flex: none;
  background: var(--ink);
  color: #fff;
  font-size: 12px;
  font-weight: 750;
}

.field { display: flex; flex-direction: column; gap: 7px; margin: 16px 0; }
.field:first-of-type { margin-top: 0; }
.field:last-child { margin-bottom: 0; }

.label { font-size: 13px; font-weight: 650; color: var(--ink-2); }
.help { font-size: 12px; color: var(--faint); line-height: 1.65; }

/* 手机接收端：配对码、地址和已连接的手机 */
.receiver-pair {
  display: grid;
  grid-template-columns: minmax(0, .9fr) minmax(0, 1.3fr);
  gap: 12px;
  margin: 16px 0;
}

.receiver-code-box,
.receiver-link-box {
  min-width: 0;
  padding: 13px 15px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--bg-soft);
}

.receiver-label { display: block; margin-bottom: 4px; font-size: 12px; color: var(--faint); }

.receiver-code {
  display: block;
  font-family: var(--mono);
  font-size: 27px;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--ink);
  white-space: nowrap;
}

.receiver-link-box code {
  display: block;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.65;
  color: var(--ink-2);
  word-break: break-all;
}

.receiver-devices { margin: 4px 0 14px; }

.receiver-device {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 13px;
  color: var(--ink-2);
}

.receiver-device:last-child { border-bottom: 0; }
.receiver-device .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.receiver-device.online .dot { background: var(--good); box-shadow: 0 0 0 3px var(--good-soft); }
.receiver-device .rd-name { font-weight: 650; }
.receiver-device .rd-meta { margin-left: auto; color: var(--faint); font-size: 11.5px; white-space: nowrap; }
.receiver-empty { margin: 4px 0 10px; font-size: 12.5px; color: var(--faint); }

input[type="text"],
input[type="url"],
input[type="number"],
input[type="time"],
select {
  width: 100%;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  padding: 11px 13px;
  font: inherit;
  font-size: 14px;
  color: var(--ink);
  transition: border-color .15s ease, box-shadow .15s ease;
  -webkit-appearance: none;
  appearance: none;
}

input::placeholder { color: #b3ada1; }

input[type="text"]:focus,
input[type="url"]:focus,
input[type="number"]:focus,
input[type="time"]:focus,
select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(217, 81, 44, .13);
}

select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5 6 6.5 11 1.5' fill='none' stroke='%236b7178' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 13px center;
  padding-right: 36px;
}

.input-row { display: flex; gap: 8px; align-items: stretch; }
.input-row input { flex: 1; min-width: 0; }
.input-row .btn { flex: none; }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { position: relative; display: inline-flex; }
.chip input { position: absolute; opacity: 0; pointer-events: none; }
.chip span {
  display: inline-flex;
  align-items: center;
  padding: 9px 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, color .15s ease;
}
.chip span:hover { border-color: #c9c1b1; }
.chip input:checked + span { background: var(--ink); border-color: var(--ink); color: #fff; }
.chip input:focus-visible + span { box-shadow: 0 0 0 3px rgba(217, 81, 44, .22); }

.inline-field { display: flex; align-items: center; flex-wrap: wrap; gap: 10px 12px; margin: 16px 0; }
.inline-field .label { flex: none; }
.inline-field input { max-width: 190px; }
.inline-field .help { flex-basis: 100%; margin: 0; }

.time-row { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 10px; margin: 12px 0 4px; }
.time-row .label { flex: none; color: var(--faint); }
.time-row input { max-width: 150px; }

.switch-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 14px;
  padding: 14px 0 2px;
  border-top: 1px solid #f1ede4;
  cursor: pointer;
}
.switch-copy { min-width: 0; }
.switch-copy b { display: block; font-size: 14px; }
.switch-copy em { display: block; font-style: normal; font-size: 12px; color: var(--faint); margin-top: 3px; line-height: 1.55; }

.switch { position: relative; width: 46px; height: 27px; flex: none; }
.switch input { position: absolute; inset: 0; margin: 0; opacity: 0; cursor: pointer; z-index: 2; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: #d8d3c8; transition: background .18s ease; }
.switch i::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 21px;
  height: 21px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .22);
  transition: transform .18s ease;
}
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(19px); }
.switch input:focus-visible + i { box-shadow: 0 0 0 3px rgba(217, 81, 44, .22); }

.picked {
  border: 1.5px dashed var(--line-strong);
  border-radius: 14px;
  background: #fcfaf5;
  padding: 15px 16px;
}

.picked-empty { display: flex; gap: 9px; align-items: flex-start; color: var(--muted); font-size: 13px; line-height: 1.65; }
.picked-empty .ic { color: var(--accent); flex: none; margin-top: 3px; }
.picked-empty b { color: var(--ink); }

/* 登录提示：告诉用户需要登录的网页怎么用，以及密码不会被保存。 */
.login-note {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 12px 14px;
  border: 1px solid #dfe8e1;
  border-radius: 14px;
  background: #f2f6f3;
}
.login-note-icon {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  border-radius: 9px;
  background: var(--good-soft);
  color: var(--good);
}
.login-note-copy b { display: block; font-size: 13.5px; color: var(--ink); }
.login-note-copy span { display: block; margin-top: 3px; color: var(--muted); font-size: 12.5px; line-height: 1.7; }

.login-state {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--good-soft);
  color: var(--good);
  font-size: 12.5px;
}
.login-state-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; flex: none; }
.login-state .link { margin-left: auto; color: var(--good); }

.picked-body { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 9px; }
.picked-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--good-soft);
  color: var(--good);
  font-size: 11.5px;
  font-weight: 700;
  flex: none;
  margin-top: 1px;
}
.picked-tag .ic { width: 12px; height: 12px; }
.picked-text {
  flex: 1;
  min-width: 180px;
  margin: 0;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  color: var(--ink);
  font-size: 13.5px;
  line-height: 1.55;
  word-break: break-word;
}
.picked-text.is-selector { font-family: var(--mono); font-size: 12px; color: var(--muted); }

.advanced { margin-top: 16px; padding-top: 11px; border-top: 1px solid #f1ede4; }
.advanced summary { cursor: pointer; font-size: 12.5px; color: var(--muted); list-style: none; }
.advanced summary::-webkit-details-marker { display: none; }
.advanced summary::before { content: "＋"; color: var(--faint); margin-right: 6px; }
.advanced[open] summary::before { content: "－"; }
.advanced-body { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }

.form-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.form-actions.inline-actions { margin-top: 20px; }

.form-error {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 0 0 14px;
  padding: 11px 14px;
  border: 1px solid #efc7c0;
  border-radius: 12px;
  background: #fff9f7;
  color: var(--bad);
  font-size: 13px;
  line-height: 1.55;
}
.form-error .ic { margin-top: 2px; flex: none; }

.test-box {
  margin-top: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow-sm);
}
.test-box.ok { border-color: #bfe0ce; background: #fbfefc; }
.test-box.bad { border-color: #efc7c0; background: #fff9f7; }
.test-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; font-size: 13px; font-weight: 700; }
.test-value { margin: 2px 0 8px; font-family: var(--mono); font-size: 27px; font-weight: 750; letter-spacing: -.03em; word-break: break-word; }
.test-raw { padding: 8px 10px; border-radius: 9px; background: #f5f2ea; color: var(--muted); font-size: 12.5px; line-height: 1.6; word-break: break-word; }
.test-meta { margin-top: 8px; color: var(--faint); font-size: 12px; line-height: 1.65; word-break: break-word; }
.test-error { color: var(--bad); font-size: 13.5px; line-height: 1.65; }
.test-error b { display: block; margin-bottom: 3px; }
.test-link {
  display: inline-block;
  margin-top: 9px;
  color: var(--accent-deep);
  font-size: 12.5px;
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid rgba(185, 63, 29, .35);
}

/* ---------- 设置页 ---------- */

.channel-list { display: flex; flex-direction: column; gap: 10px; }
.channel { position: relative; display: block; cursor: pointer; }
.channel input { position: absolute; opacity: 0; pointer-events: none; }
.channel-body {
  display: block;
  padding: 14px 16px;
  border: 1px solid var(--line-strong);
  border-radius: 13px;
  background: #fff;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
}
.channel-body:hover { border-color: #c9c1b1; }
.channel input:checked + .channel-body {
  border-color: var(--accent);
  background: #fff8f3;
  box-shadow: 0 0 0 3px rgba(217, 81, 44, .1);
}
.channel input:focus-visible + .channel-body { box-shadow: 0 0 0 3px rgba(217, 81, 44, .22); }
.channel-top { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink); }
.channel-body em { display: block; font-style: normal; font-size: 12.5px; color: var(--muted); margin-top: 4px; line-height: 1.6; }
.rec { padding: 2px 7px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); font-size: 10.5px; font-weight: 750; }

#targetWrap { margin-top: 18px; }

.saved-hint {
  display: flex;
  align-items: flex-start;
  gap: 6px;
  margin: 2px 0 10px;
  padding: 9px 11px;
  border-radius: 10px;
  background: var(--good-soft);
  color: var(--good);
  font-size: 12.5px;
  line-height: 1.55;
}
.saved-hint .ic { margin-top: 2px; flex: none; }

.howto { border-bottom: 1px solid #f1ede4; padding: 9px 0; }
.howto:last-of-type { border-bottom: 0; }
.howto summary { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13.5px; font-weight: 650; list-style: none; padding: 5px 0; }
.howto summary::-webkit-details-marker { display: none; }
.howto summary::before { content: "›"; color: var(--faint); transition: transform .15s ease; }
.howto[open] summary::before { transform: rotate(90deg); }
.howto ol { margin: 4px 0 6px; padding-left: 22px; color: var(--muted); font-size: 13px; line-height: 1.85; }

/* ---------- 选元素浮层 ---------- */

.picker {
  position: fixed;
  inset: 0;
  z-index: 110;
  display: flex;
  flex-direction: column;
  padding: 16px;
  background: rgba(18, 16, 14, .72);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.picker-shell {
  flex: 1;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1180px;
  min-height: 0;
  margin: 0 auto;
  border-radius: 16px;
  background: var(--card);
  overflow: hidden;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .55);
}

.picker-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-soft);
}
.picker-info { min-width: 0; }
.picker-info b { display: block; font-size: 13.5px; }
.picker-info span { display: block; margin-top: 1px; color: var(--muted); font-size: 12px; }
.picker-info .picker-tip { margin-top: 3px; color: var(--accent-deep); font-size: 11.5px; }
.picker-frame-wrap { flex: 1; min-height: 0; background: #fff; }
.picker-frame-wrap iframe { display: block; width: 100%; height: 100%; border: 0; }

/* ---------- 报警弹窗 ---------- */

.alarm {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(26, 22, 18, .58);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  animation: fadeIn .18s ease both;
}

.alarm-card {
  width: min(430px, 100%);
  padding: 28px 26px 22px;
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 34px 90px -22px rgba(0, 0, 0, .55);
  text-align: center;
  animation: pop .3s cubic-bezier(.2, .9, .3, 1.25) both;
}

.alarm-visual { position: relative; width: 104px; height: 104px; margin: 0 auto 10px; display: grid; place-items: center; }
.alarm-bell {
  position: relative;
  z-index: 2;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #ec7348, var(--accent));
  color: #fff;
  box-shadow: 0 12px 26px -8px rgba(217, 81, 44, .75);
  animation: bellShake 1.6s ease-in-out infinite;
}
.alarm-bell .ic { width: 30px; height: 30px; stroke-width: 1.9; }
.ring { position: absolute; inset: 4px; border-radius: 50%; border: 2px solid rgba(217, 81, 44, .3); animation: ripple 2.4s ease-out infinite; }
.r2 { animation-delay: .8s; }
.r3 { animation-delay: 1.6s; }

.alarm-kicker { margin: 0; color: var(--accent); font-size: 12.5px; font-weight: 750; letter-spacing: .14em; }
.alarm-card h2 { margin: 5px 0 14px; font-size: 20px; letter-spacing: -.01em; word-break: break-word; }

.alarm-change {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 9px;
  margin: 0 0 12px;
  font-family: var(--mono);
  font-size: 23px;
  font-weight: 750;
  line-height: 1.35;
  word-break: break-word;
}
.alarm-change .old { color: var(--faint); text-decoration: line-through; text-decoration-thickness: 1px; }
.alarm-change .new { color: var(--accent); }
.alarm-change .arrow { color: var(--faint); font-family: var(--font); font-weight: 400; }
.alarm-change:empty { display: none; }

.alarm-meta { margin: 0 0 16px; color: var(--muted); font-size: 12.5px; word-break: break-word; }
.alarm-more { margin: 12px 0 0; color: var(--faint); font-size: 12px; }

/* 手机浏览器要先点一下页面才能出声，这里给一个明确的按钮。 */
.alarm-sound {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin: 0 0 12px;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid #f2d3c4;
  background: #fdf2ec;
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.5;
  text-align: left;
}
.alarm-sound span { flex: 1; min-width: 0; }
.alarm-sound .btn { flex: none; }
.alarm-hint { margin: 10px 0 0; color: var(--faint); font-size: 12px; }

/* ---------- 提示 ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 26px;
  transform: translateX(-50%);
  z-index: 130;
  max-width: calc(100vw - 32px);
  padding: 11px 17px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-size: 13.5px;
  line-height: 1.5;
  text-align: center;
  box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .5);
  animation: rise .2s ease both;
}
.toast.error { background: var(--bad); }
.toast.good { background: #176b4c; }

/* ---------- 确认对话框 ---------- */

.confirm { position: fixed; inset: 0; z-index: 120; display: grid; place-items: center; padding: 20px; background: rgba(26, 22, 18, .5); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); }
.confirm-card { width: min(380px, 100%); padding: 22px; border-radius: 18px; background: var(--card); box-shadow: 0 30px 70px -20px rgba(0, 0, 0, .5); }
.confirm-card h3 { margin: 0 0 8px; font-size: 17px; }
.confirm-card p { margin: 0 0 18px; color: var(--muted); font-size: 13.5px; line-height: 1.65; word-break: break-word; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 9px; }

/* ---------- 页脚 ---------- */

.foot {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  max-width: 1040px;
  margin: 0 auto;
  padding: 22px 20px 42px;
  color: var(--faint);
  font-size: 12px;
  text-align: center;
}
.foot .dot { opacity: .6; }
.foot-link { color: var(--accent-deep); text-decoration: none; border-bottom: 1px solid rgba(185, 63, 29, .28); }
.foot-link:hover { border-bottom-color: var(--accent-deep); }

/* ---------- 动画 ---------- */

@keyframes pulseDot {
  0% { box-shadow: 0 0 0 0 rgba(30, 142, 99, .4); }
  70% { box-shadow: 0 0 0 7px rgba(30, 142, 99, 0); }
  100% { box-shadow: 0 0 0 0 rgba(30, 142, 99, 0); }
}
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: .35; } }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes pop { from { opacity: 0; transform: scale(.94) translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 8px); } to { opacity: 1; transform: translate(-50%, 0); } }
@keyframes ripple {
  0% { transform: scale(.62); opacity: .75; }
  80%, 100% { transform: scale(1.45); opacity: 0; }
}
@keyframes bellShake {
  0%, 55%, 100% { transform: rotate(0); }
  60% { transform: rotate(-9deg); }
  67% { transform: rotate(8deg); }
  74% { transform: rotate(-6deg); }
  81% { transform: rotate(4deg); }
  88% { transform: rotate(0); }
}

/* ---------- 响应式 ---------- */

@media (max-width: 900px) {
  .intro { grid-template-columns: 1fr; gap: 20px; padding-top: 36px; }
  .intro-art { display: none; }
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 560px) {
  body { font-size: 14.5px; }
  .topbar-inner { padding: 10px 14px; }
  .brand-name { font-size: 14.5px; }
  .brand-mark { width: 31px; height: 31px; border-radius: 10px; }
  .hide-sm { display: none; }
  .wrap { padding: 0 14px 54px; }
  .page-head { padding: 26px 0 14px; }
  .intro { padding: 28px 0 18px; }
  .intro-copy h1 { font-size: 31px; }
  .intro-actions .btn { flex: 1 1 auto; }
  .steps { gap: 10px 16px; margin-top: 22px; }
  .steps li { flex: 1 1 46%; }
  .stats { gap: 9px; margin-bottom: 26px; }
  .stat { padding: 12px 13px; border-radius: 14px; }
  .stat-value { font-size: 23px; }
  .stat-unit { font-size: 11px; }
  .section { margin-top: 26px; }
  .monitor { padding: 15px 15px 10px; }
  .m-value { font-size: 24px; }
  .card { padding: 17px; border-radius: 16px; }
  .notice { flex-wrap: wrap; padding: 11px 12px; }
  .notice .btn { width: auto; }
  .notice-text { flex-basis: calc(100% - 46px); }
  .notice .notice-close { position: absolute; right: 8px; top: 8px; }
  .notice { position: relative; }
  .input-row { flex-direction: column; }
  .input-row .btn { width: 100%; padding: 12px 14px; }
  .form-actions { flex-direction: column; align-items: stretch; }
  .form-actions .btn { width: 100%; }
  .receiver-pair { grid-template-columns: 1fr; }
  .receiver-code { font-size: 25px; }
  .event { grid-template-columns: 30px minmax(0, 1fr); gap: 10px; padding: 13px 14px; }
  .event .ev-right { grid-column: 2; text-align: left; display: flex; gap: 10px; align-items: center; margin-top: -2px; }
  .ev-push { margin-top: 0; }
  .alarm-card { padding: 24px 18px 18px; border-radius: 20px; }
  .alarm-change { font-size: 20px; }
  .picker { padding: 0; }
  .picker-shell { border-radius: 0; }
  .picker-bar { padding: 9px 12px; }
  .picker-info b { font-size: 13px; }
  .picker-info span { font-size: 11.5px; }
  .foot { padding-bottom: 34px; }
}

@media (max-width: 380px) {
  .brand-name { display: none; }
  .intro-copy h1 { font-size: 28px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .001ms !important;
  }
}
