:root {
  --bg: #101a2e;
  --surface: #182540;
  --line: #2a3a5c;
  --txt: #eaf0fb;
  --mut: #8fa3c4;
  --on: #58e0b4;
  --wait: #ffc857;
  --off: #8fa3c4;
  color-scheme: dark;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { height: 100%; margin: 0; }
body {
  background: radial-gradient(900px 500px at 50% -8%, #1d2f55 0, var(--bg) 65%);
  color: var(--txt);
  font: 16px/1.45 ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
}
main { min-height: 100%; display: grid; place-items: center; padding: 20px; }
section {
  width: min(380px, 100%);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 26px 24px 22px;
}
h1 { margin: 0; font-size: 20px; font-weight: 650; }
#login h1 { margin-bottom: 20px; }
header { display: flex; justify-content: space-between; align-items: center; gap: 12px; }

label { display: block; color: var(--mut); font-size: 14px; margin-bottom: 14px; }
input {
  width: 100%; margin-top: 6px; padding: 13px 14px;
  background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
  color: var(--txt); font: inherit;
}
input:focus-visible, button:focus-visible { outline: 2px solid var(--on); outline-offset: 2px; }
button { font: inherit; cursor: pointer; }
form button {
  width: 100%; padding: 13px; border: 0; border-radius: 12px;
  background: var(--on); color: #06231a; font-weight: 650;
}
.ghost {
  background: none; border: 1px solid var(--line); color: var(--mut);
  border-radius: 10px; padding: 6px 12px; font-size: 14px;
}

.state { text-align: center; padding: 30px 0 6px; --c: var(--off); }
.state[data-s="on"] { --c: var(--on); }
.state[data-s="wait"] { --c: var(--wait); }
#power {
  width: 176px; height: 176px; margin: 0 auto; border-radius: 50%;
  display: grid; place-items: center; color: var(--c);
  border: 3px solid var(--c);
  background: radial-gradient(circle at 50% 30%, color-mix(in srgb, var(--c) 20%, var(--surface)), var(--bg) 78%);
  box-shadow: 0 0 0 10px color-mix(in srgb, var(--c) 10%, transparent), 0 14px 40px #0007;
  transition: transform .15s, box-shadow .3s, color .3s, border-color .3s;
}
#power svg { width: 68px; height: 68px; }
#power:disabled { cursor: default; }
.state:not([data-s="on"]) #power:active { transform: scale(.96); }
.state[data-s="wait"] #power { animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse {
  50% { box-shadow: 0 0 0 20px color-mix(in srgb, var(--c) 16%, transparent), 0 14px 40px #0007; }
}
#label { font-size: 26px; font-weight: 650; margin: 24px 0 4px; color: var(--c); }
#sub { margin: 0; color: var(--mut); font-size: 15px; }
.err { color: #ff8a8a; font-size: 14px; min-height: 1.3em; margin: 14px 0 0; text-align: center; }
@media (prefers-reduced-motion: reduce) { #power { animation: none !important; transition: none; } }
