:root {
  --bg: #f4f5f7; --card: #ffffff; --fg: #1c1e21; --muted: #6b7280; --line: #e2e5ea;
  --ok: #1a9e55; --off: #9aa1ab; --pause: #c98a00; --stop: #d23c3c; --btn: #eceff3; --accent: #2563eb;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #101214; --card: #1a1d21; --fg: #e6e8eb; --muted: #9099a5; --line: #2b3037;
    --ok: #37c978; --off: #5c6470; --pause: #e0a82e; --stop: #f06262; --btn: #262b32; --accent: #6ea0ff;
  }
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body {
  margin: 0 auto; padding: 12px; max-width: 640px; background: var(--bg); color: var(--fg);
  font: 16px/1.5 system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
}
header { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
h1 { font-size: 20px; margin: 0; flex: 1; }
h2 { font-size: 16px; margin: 0 0 8px; }
.muted { color: var(--muted); font-size: 13px; }
.warn { color: var(--stop); font-size: 14px; margin: 6px 0 0; min-height: 1em; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; margin-bottom: 12px; }
.banner { background: var(--stop); color: #fff; border-radius: 10px; padding: 10px 14px; margin-bottom: 12px; }

button {
  font: inherit; color: var(--fg); background: var(--btn); border: 1px solid var(--line);
  border-radius: 10px; padding: 10px 12px; min-height: 44px; cursor: pointer;
}
button:disabled { opacity: .5; }
button.danger { color: var(--stop); border-color: var(--stop); }
button.plain { min-height: 0; padding: 4px 10px; font-size: 13px; }
input {
  font: inherit; width: 100%; padding: 10px; margin: 6px 0 10px; border-radius: 10px;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
}
#login button, button.primary { width: 100%; background: var(--accent); color: #fff; border-color: var(--accent); }
input[type=checkbox] { width: auto; margin: 0 6px 0 0; padding: 0; vertical-align: middle; }
label.check { display: block; margin: 0 0 12px; font-size: 14px; }
h3 { font-size: 15px; margin: 18px 0 4px; }
summary { cursor: pointer; font-weight: 600; }
details[open] > summary { margin-bottom: 8px; }
details.help { margin-top: 10px; }
details.help > summary { font-weight: 400; font-size: 13px; color: var(--muted); }
.copybox {
  display: block; margin: 6px 0 8px; padding: 8px 10px; background: var(--bg); border-radius: 8px;
  font: 13px/1.5 ui-monospace, Consolas, "Courier New", monospace;
  overflow-wrap: anywhere; word-break: break-all; user-select: all; -webkit-user-select: all;
}
.row { display: flex; flex-wrap: wrap; gap: 8px; }
#setupdone button.primary { margin-top: 14px; }
.offscreen { position: fixed; left: -9999px; top: 0; width: 1px; height: 1px; opacity: 0; }

.head { display: flex; align-items: center; gap: 8px; }
.dot { width: 12px; height: 12px; border-radius: 50%; background: var(--off); flex: none; }
.dot.on { background: var(--ok); }
.name { font-weight: 600; font-size: 17px; flex: 1; overflow-wrap: anywhere; }
.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 14px; color: #fff; background: var(--off); }
.badge.run { background: var(--ok); }
.badge.pause { background: var(--pause); }
.badge.stop { background: var(--stop); }
.meta { margin: 8px 0 0; }
.status { margin: 8px 0; padding: 8px 10px; background: var(--bg); border-radius: 8px; font-size: 14px; overflow-wrap: anywhere; }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; text-align: center; margin: 8px 0; }
.stats div { background: var(--bg); border-radius: 8px; padding: 6px 0; }
.stats b { display: block; font-size: 20px; }
.stats span { color: var(--muted); font-size: 13px; }
.btns { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 10px 0 6px; }
.btns .wide { grid-column: 1 / -1; }
.pending, .cmdmsg { font-size: 14px; margin: 6px 0 0; }
.pending { color: var(--pause); }
.shot { margin-top: 10px; }
.shot img { display: block; width: 100%; border-radius: 8px; border: 1px solid var(--line); cursor: zoom-in; }

.events { list-style: none; margin: 0; padding: 0; }
.events li { padding: 8px 0; border-top: 1px solid var(--line); font-size: 14px; overflow-wrap: anywhere; }
.events li:first-child { border-top: 0; }
.tag { display: inline-block; padding: 0 6px; border-radius: 6px; font-size: 12px; color: #fff; background: var(--off); margin-right: 6px; }
.tag.stop { background: var(--stop); }
.tag.recover { background: var(--ok); }

#viewer { position: fixed; inset: 0; background: rgba(0, 0, 0, .92); overflow: auto; cursor: zoom-out; z-index: 10; }
#viewer img { display: block; margin: auto; max-width: none; }
