:root {
  --bg: #f1f5f9; --card: #ffffff; --text: #0f172a; --muted: #64748b; --line: #e2e8f0;
  --accent: #2563eb; --ok: #16a34a; --warn: #d97706; --bad: #dc2626; --off: #94a3b8;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root { --bg: #0b1220; --card: #131c2e; --text: #e2e8f0; --muted: #94a3b8; --line: #23304a; --accent: #3b82f6; --off: #475569; }
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif; }
main { max-width: 640px; margin: 0 auto; padding: 16px 16px calc(24px + env(safe-area-inset-bottom)); }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0 0 6px; line-height: 1.2; }
h1 { font-size: 24px; } h2 { font-size: 21px; } h3 { font-size: 16px; }
.muted { color: var(--muted); } .small { font-size: 13px; } .center { text-align: center; }
.err { color: var(--bad); margin: 8px 0 0; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; padding: 18px; margin-bottom: 14px; }
.narrow { max-width: 380px; margin: 12vh auto 0; text-align: center; }
.logo { width: 64px; height: 64px; border-radius: 16px; margin-bottom: 8px; }
.logo.sm { width: 28px; height: 28px; border-radius: 8px; margin: 0; }
.top { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 14px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; }
.row { display: flex; gap: 8px; align-items: center; }
.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
form { display: grid; gap: 10px; margin-top: 10px; }
form.row { display: flex; flex-wrap: wrap; } form.row input { flex: 1 1 200px; }
input { font: inherit; color: inherit; background: transparent; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-width: 0; }
input:focus { outline: 2px solid var(--accent); outline-offset: -1px; }
button, a.ghost { font: inherit; cursor: pointer; border-radius: 10px; padding: 9px 14px; border: 1px solid transparent; text-decoration: none; display: inline-flex; align-items: center; justify-content: center; }
.primary { background: var(--accent); color: #fff; font-weight: 600; }
.ghost { background: transparent; color: var(--accent); border-color: var(--line); }
.ghost.sm { padding: 5px 10px; font-size: 13px; }
.danger { color: var(--bad); }
button:disabled { opacity: .55; cursor: default; }

.hero { text-align: center; padding: 28px 18px 22px; }
.power { width: 132px; height: 132px; border-radius: 50%; margin: 0 auto 16px; color: #fff; background: var(--off); border: 0;
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--off) 18%, transparent); transition: background .25s, box-shadow .25s, transform .1s; }
.power:active { transform: scale(.97); }
.power[data-s="on"] { background: var(--ok); box-shadow: 0 0 0 10px color-mix(in srgb, var(--ok) 22%, transparent); }
.power[data-s="busy"] { background: var(--warn); animation: pulse 1.2s infinite; }
.power[data-s="na"] { background: var(--line); color: var(--muted); box-shadow: none; cursor: default; }
@keyframes pulse { 50% { box-shadow: 0 0 0 18px color-mix(in srgb, var(--warn) 10%, transparent); } }
.hint { margin-top: 14px; padding: 12px; border-radius: 12px; background: color-mix(in srgb, var(--accent) 9%, transparent); text-align: left; font-size: 14px; }
.hint a { color: var(--accent); }

.devices { list-style: none; margin: 10px 0; padding: 0; }
.devices li { display: flex; align-items: center; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); }
.devices li:first-child { border-top: 0; }
.devices .label { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--off); flex: none; }
.dot.on { background: var(--ok); }
.devices li.mine .label::after { content: " · dieses Gerät"; color: var(--ok); font-weight: 400; font-size: 13px; }
@media (max-width: 420px) { .devices .dl { display: none; } }
