:root {
  color-scheme: light;
  --bg: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --grid: #e1e0d9;
  --axis: #c3c2b7;
  --border: rgba(11, 11, 11, .10);
  --wash: rgba(11, 11, 11, .05);
  --good: #0ca30c;
  --good-wash: rgba(12, 163, 12, .08);
  --warn: #fab219;
  --crit: #d03b3b;
  --crit-wash: rgba(208, 59, 59, .08);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --grid: #2c2c2a;
    --axis: #383835;
    --border: rgba(255, 255, 255, .10);
    --wash: rgba(255, 255, 255, .06);
    --good-wash: rgba(12, 163, 12, .14);
    --crit-wash: rgba(208, 59, 59, .16);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --surface: #1a1a19;
  --ink: #ffffff;
  --ink-2: #c3c2b7;
  --muted: #898781;
  --grid: #2c2c2a;
  --axis: #383835;
  --border: rgba(255, 255, 255, .10);
  --wash: rgba(255, 255, 255, .06);
  --good-wash: rgba(12, 163, 12, .14);
  --crit-wash: rgba(208, 59, 59, .16);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 14px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
h1, h2 { margin: 0; letter-spacing: -.01em; }
h1 { font-size: 18px; font-weight: 600; }
h2 { font-size: 14px; font-weight: 600; }
p { margin: 0; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
code { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

/* Statuspunkt – immer zusammen mit einem Text */
.dot { display: inline-block; flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--axis); }
.dot.good { background: var(--good); }
.dot.warn { background: var(--warn); }
.dot.crit { background: var(--crit); }

/* Buttons & Eingaben */
.btn, .btn-ghost, .btn-danger { font: inherit; font-size: 13px; cursor: pointer; border-radius: 10px; padding: 7px 14px; }
.btn { background: var(--ink); color: var(--bg); border: 1px solid var(--ink); font-weight: 500; }
.btn:hover { opacity: .88; }
.btn-ghost { background: transparent; color: var(--ink-2); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--wash); color: var(--ink); }
.btn-ghost.small { font-size: 12px; padding: 5px 10px; }
.btn-danger { width: 100%; padding: 12px 14px; font-size: 14px; font-weight: 500; background: var(--surface); color: var(--crit); border: 1px solid var(--border); }
.btn-danger:hover:not(:disabled) { background: var(--crit-wash); border-color: var(--crit); }
.btn-danger:disabled { color: var(--muted); cursor: not-allowed; }
input[type=password] {
  font: inherit; color: var(--ink); background: var(--bg);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-width: 0;
}
input:focus-visible, button:focus-visible { outline: 2px solid var(--ink-2); outline-offset: 2px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: 12px; padding: 16px; margin-top: 12px; }
.card > h2 { margin-bottom: 12px; }

/* ---------- Ein-Bildschirm-Ansicht ---------- */
.screen {
  max-width: 560px; margin: 0 auto; min-height: 100vh; min-height: 100dvh;
  padding: max(16px, env(safe-area-inset-top)) 16px max(16px, env(safe-area-inset-bottom));
  display: flex; flex-direction: column; gap: 20px;
}
.top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.top h1 { font-size: 20px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hero { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 6px; min-height: 0; }
.big {
  width: clamp(112px, 34vw, 148px); aspect-ratio: 1; border-radius: 50%; margin-bottom: 8px;
  display: grid; place-items: center; border: 3px solid var(--axis); color: var(--axis); background: var(--surface);
  transition: color .3s, border-color .3s, background .3s;
}
.big svg { width: 50%; height: 50%; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.big.good { border-color: var(--good); color: var(--good); background: var(--good-wash); }
.big.crit { border-color: var(--crit); color: var(--crit); background: var(--crit-wash); }
.hero-label { font-size: 22px; font-weight: 600; letter-spacing: -.01em; }

/* Verbindungsweg: Internet → Haus → FRITZ!Box → Netzwerk */
.where { background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 16px 8px 14px; }
.path { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); }
.node { position: relative; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 2px; min-width: 0; }
.node .ico {
  position: relative; z-index: 1; width: 44px; height: 44px; margin-bottom: 6px; border-radius: 50%;
  display: grid; place-items: center; background: var(--surface); border: 2px solid var(--axis); color: var(--ink);
}
.node .ico svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.node + .node::before {
  content: ""; position: absolute; top: 21px; left: calc(-50% + 26px); width: calc(100% - 52px); height: 2px;
  border-radius: 1px; background: var(--axis);
}
.node.good .ico { border-color: var(--good); }
.node.warn .ico { border-color: var(--warn); }
.node.crit .ico { border-color: var(--crit); }
.node.good::before { background: var(--good); }
.node.warn::before { background: var(--warn); }
.node.crit::before { background: var(--crit); }
.n-title { font-size: 12px; font-weight: 600; white-space: nowrap; }
.n-state { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; color: var(--ink-2); white-space: nowrap; }
.n-state .dot { width: 6px; height: 6px; }
.diag { margin: 14px 8px 0; padding-top: 12px; border-top: 1px solid var(--grid); text-align: center; font-size: 13px; color: var(--ink-2); }
.diag:empty { display: none; }

.actions { display: flex; flex-direction: column; gap: 6px; text-align: center; }

/* Login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(360px, 100%); display: flex; flex-direction: column; gap: 10px; padding: 24px; margin: 0; }
.login-card label { font-size: 12px; color: var(--ink-2); margin-top: 6px; }
.login-card .btn { margin-top: 6px; padding: 9px 14px; }
.form-error { color: var(--crit); font-size: 13px; }

/* Einrichtung (check.php) */
.wrap { max-width: 760px; margin: 0 auto; padding: 24px 16px 40px; }
.wrap .top { margin-bottom: 8px; }
table { width: 100%; border-collapse: collapse; }
td { padding: 8px; border-bottom: 1px solid var(--grid); vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
.checks td { font-size: 13px; }
.checks .state { white-space: nowrap; width: 1%; }
.checks .state .dot { margin-right: 8px; }
.checks .detail { overflow-wrap: anywhere; }
.hash-form label { display: block; font-size: 12px; color: var(--ink-2); margin-bottom: 6px; }
.hash-form .row { display: flex; gap: 8px; }
.hash-form input { flex: 1; }
.code { background: var(--bg); border: 1px solid var(--border); border-radius: 8px; padding: 10px; overflow-x: auto; font-size: 12px; margin: 8px 0 0; }

@media (max-height: 640px) {
  .screen { gap: 14px; }
  .big { width: 104px; }
  .hero-label { font-size: 19px; }
}
