:root {
  --bg: #f6f5f3;
  --card: #ffffff;
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: #e2e0dc;
  --accent: #2f6f4f;
  --warn: #b3261e;
  --ok: #2f6f4f;
  --off: #b9b6b0;
  --radius: 12px;
  font-family: -apple-system, BlinkMacSystemFont, "Hiragino Sans", "Noto Sans JP", "Segoe UI", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141414;
    --card: #1f1f1f;
    --ink: #eeeeee;
    --muted: #9a9a9a;
    --line: #333333;
    --accent: #6fbf8f;
    --warn: #ff7a70;
    --ok: #6fbf8f;
    --off: #555555;
  }
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 15px; }
header {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line); background: var(--card);
  position: sticky; top: 0; z-index: 2;
}
.brand { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--off); display: inline-block; }
.dot.on { background: var(--ok); }
.conn { display: flex; align-items: center; gap: 8px; }
nav { display: flex; gap: 4px; padding: 8px 16px; overflow-x: auto; }
nav button { border: none; background: none; padding: 8px 14px; border-radius: 999px; color: var(--muted); font-size: 15px; }
nav button.active { background: var(--card); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
main { padding: 8px 16px 48px; max-width: 1100px; margin: 0 auto; }
.tab { display: none; }
.tab.active { display: block; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 12px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; min-width: 0; }
.card.wide { grid-column: 1 / -1; }
.card h3 { margin: 0 0 10px; font-size: 13px; color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.state { font-size: 32px; font-weight: 700; font-variant-numeric: tabular-nums; }
.state small { font-size: 16px; color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; margin: 8px 0; flex-wrap: wrap; }
.row.wrap { flex-wrap: wrap; }
.row label { min-width: 88px; color: var(--muted); font-size: 13px; }
input, select, textarea {
  font: inherit; color: inherit; background: var(--bg); border: 1px solid var(--line);
  border-radius: 8px; padding: 7px 9px; min-width: 0;
}
input[type=number] { width: 84px; }
.row input:not([type]), .row input[type=password], .row select { flex: 1 1 160px; }
textarea { width: 100%; font-family: ui-monospace, Menlo, monospace; font-size: 12px; }
button {
  font: inherit; padding: 7px 13px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--card); color: var(--ink); cursor: pointer;
}
button.primary { background: var(--accent); color: #fff; border-color: transparent; }
button.warn { color: var(--warn); border-color: var(--warn); }
button:disabled { opacity: .5; cursor: default; }
.chk { display: flex; align-items: center; gap: 6px; margin: 6px 0; font-size: 14px; flex-wrap: wrap; }
.chk input.short, input.short { width: 64px; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { border: none; border-radius: 0; min-width: 64px; }
.seg button.on { background: var(--accent); color: #fff; }
a { color: var(--accent); }
.flags { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.flags li::before { content: "●"; margin-right: 8px; color: var(--off); }
.flags li.on::before { color: var(--ok); }
.flags li.bad::before { color: var(--warn); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 12px; font-size: 13px; margin-bottom: 8px; }
.notice { background: var(--card); border: 1px solid var(--warn); color: var(--warn); padding: 10px 12px; border-radius: 8px; }
.notice.ok { border-color: var(--ok); color: var(--ok); }
pre#log { background: var(--card); border: 1px solid var(--line); border-radius: 8px; padding: 10px; max-height: 420px; overflow: auto; font-size: 12px; white-space: pre-wrap; }
canvas { max-width: 100%; background: var(--card); border: 1px solid var(--line); border-radius: 8px; }
canvas#thumb { width: 320px; height: 240px; image-rendering: pixelated; }
@media (max-width: 520px) {
  .state { font-size: 26px; }
  header { flex-wrap: wrap; }
}
