:root {
  --bg: #070b14;
  --bg2: #0d1424;
  --card: #111a2e;
  --line: #1e2a44;
  --text: #e6edf7;
  --muted: #8b9bb8;
  --accent: #38d6ff;
  --accent2: #1a8cff;
  --ok: #3ee59a;
  --warn: #ffb547;
  --bad: #ff5d73;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: radial-gradient(120% 80% at 50% 0%, #0f1d3a 0%, var(--bg) 60%) fixed, var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

.top {
  display: flex; align-items: center; justify-content: space-between;
  padding: max(14px, env(safe-area-inset-top)) 16px 14px;
}
.brand { font-weight: 700; letter-spacing: .32em; font-size: 14px; display: flex; align-items: center; gap: 10px; }
.brand .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 12px var(--accent); }

main { max-width: 480px; margin: 0 auto; padding: 0 16px 40px; }
.view.center { display: flex; flex-direction: column; align-items: center; text-align: center; padding-top: 6vh; }
.hidden { display: none !important; }

h1 { font-size: 24px; margin: 18px 0 4px; font-weight: 650; }
.muted { color: var(--muted); margin: 4px 0 18px; }
.small { font-size: 13px; }
code, .cmd { font-family: ui-monospace, "Cascadia Code", Consolas, monospace; font-size: 13px; }
.cmd {
  background: var(--bg2); border: 1px solid var(--line); border-radius: 10px;
  padding: 12px; white-space: pre-wrap; word-break: break-all; color: var(--accent);
}

button { font: inherit; cursor: pointer; border: 0; border-radius: 14px; }
button:disabled { opacity: .5; cursor: default; }
.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #04101f; font-weight: 650; padding: 14px 22px; width: 100%; max-width: 320px;
  box-shadow: 0 8px 30px -10px var(--accent);
}
.primary.big { padding: 18px 22px; font-size: 18px; }
.ghost { background: transparent; color: var(--muted); padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 14px; }
.link { background: none; color: var(--accent); padding: 12px; margin-top: 6px; }

form { display: flex; flex-direction: column; gap: 14px; align-items: stretch; }
form .primary { max-width: none; }
label { display: flex; flex-direction: column; gap: 6px; font-size: 14px; color: var(--muted); }
input {
  font: inherit; color: var(--text); background: var(--bg2); border: 1px solid var(--line);
  border-radius: 12px; padding: 13px 14px; outline: none; letter-spacing: .04em;
}
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px #38d6ff22; }

.msg { min-height: 1.5em; font-size: 14px; margin: 12px 0 0; text-align: center; }
.msg.error { color: var(--bad); }
.msg.ok { color: var(--ok); }

/* ---------- status ring ---------- */
.power { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 4vh 0 18px; }
.ring {
  --c: var(--muted);
  position: relative; width: 190px; height: 190px; border-radius: 50%;
  display: grid; place-items: center;
  background: radial-gradient(circle, #0b1222 55%, transparent 56%),
              conic-gradient(from 0deg, var(--c), transparent 30%, var(--c) 50%, transparent 80%, var(--c));
  box-shadow: 0 0 0 1px var(--line), 0 0 60px -20px var(--c);
  transition: box-shadow .4s;
}
.ring.small { width: 60px; height: 60px; }
.ring .core {
  position: absolute; width: 46%; height: 46%; border-radius: 50%;
  background: radial-gradient(circle, color-mix(in srgb, var(--c) 35%, transparent), transparent 70%);
}
.ring .pc { position: relative; width: 54px; height: 54px; fill: none; stroke: var(--c); stroke-width: 1.6; stroke-linecap: round; }
.ring.idle { --c: var(--accent); }
.ring.offline { --c: #5b6b88; }
.ring.waking { --c: var(--warn); animation: spin 2.2s linear infinite; }
.ring.waking .pc { animation: spin 2.2s linear infinite reverse; }
.ring.online { --c: var(--ok); animation: pulse 3s ease-in-out infinite; }
.ring.spin { --c: var(--accent); animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pulse { 50% { box-shadow: 0 0 0 1px var(--line), 0 0 90px -10px var(--c); } }
@media (prefers-reduced-motion: reduce) { .ring, .ring .pc { animation: none !important; } }

.steps { list-style: none; padding: 0; margin: 20px 0 0; width: 100%; max-width: 320px; text-align: left; }
.steps li { position: relative; padding: 8px 0 8px 32px; color: var(--muted); }
.steps li::before {
  content: ""; position: absolute; left: 4px; top: 12px; width: 14px; height: 14px; border-radius: 50%;
  border: 2px solid var(--line);
}
.steps li.active { color: var(--text); }
.steps li.active::before { border-color: var(--warn); border-top-color: transparent; animation: spin 1s linear infinite; }
.steps li.done { color: var(--text); }
.steps li.done::before { background: var(--ok); border-color: var(--ok); }

/* ---------- cards ---------- */
.card { background: var(--card); border: 1px solid var(--line); border-radius: 16px; margin-top: 14px; }
.card summary { padding: 14px 16px; cursor: pointer; font-weight: 600; list-style: none; display: flex; justify-content: space-between; }
.card summary::after { content: "›"; color: var(--muted); transition: transform .2s; }
.card[open] summary::after { transform: rotate(90deg); }
.card > p { padding: 0 16px 14px; margin: 0; }
.events, .devices { list-style: none; margin: 0; padding: 0 16px 8px; max-height: 360px; overflow-y: auto; }
.events li, .devices li { display: flex; flex-direction: column; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.events li span, .devices li span { color: var(--muted); font-size: 13px; }
.events li small { color: var(--muted); }
.events li.bad strong { color: var(--bad); }
