:root {
  --bg: #08090b;
  --bg-soft: #121418;
  --card: rgba(255, 255, 255, .045);
  --line: rgba(255, 255, 255, .09);
  --text: #f2f4f7;
  --muted: #8b9099;
  --accent: #3d7bfd;
  --ok: #35c46a;
  --off: #6a7078;
  --warn: #f0a02a;
  --radius: 18px;
  --shadow: 0 18px 50px rgba(0, 0, 0, .45);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 50% -10%, rgba(61, 123, 253, .18), transparent 70%),
    var(--bg);
  color: var(--text);
  font: 15px/1.55 -apple-system, BlinkMacSystemFont, "HarmonyOS Sans", "PingFang SC", "Noto Sans SC", "Microsoft YaHei", sans-serif;
  padding: env(safe-area-inset-top) 0 calc(24px + env(safe-area-inset-bottom));
}

.shell { max-width: 520px; margin: 0 auto; padding: 18px 16px 0; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  margin: 4px 2px 18px;
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; letter-spacing: .3px; font-size: 15px; color: #cfd4dc; }
.brand .ico { color: var(--accent); }

.ico { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }

.icon-btn {
  width: 38px; height: 38px; display: grid; place-items: center;
  border: 1px solid var(--line); border-radius: 12px;
  background: var(--card); color: var(--text); cursor: pointer;
  transition: transform .18s ease, background .18s ease;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn.spin .ico { animation: spin .9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 18px;
  margin-bottom: 14px;
  backdrop-filter: blur(14px) saturate(140%);
  box-shadow: var(--shadow);
}

h2 { font-size: 17px; margin: 0 0 8px; font-weight: 600; letter-spacing: .2px; }
.muted { color: var(--muted); margin: 0; }
.small { font-size: 12.5px; }
.center { text-align: center; }
.err { color: #ff6b6b; font-size: 13px; margin: 10px 0 0; }

input {
  width: 100%; margin: 14px 0 12px; padding: 13px 14px;
  border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .06); color: var(--text);
  font-size: 15px; outline: none;
}
input:focus { border-color: rgba(61, 123, 253, .7); box-shadow: 0 0 0 3px rgba(61, 123, 253, .16); }

.primary {
  width: 100%; padding: 13px 16px; border: 0; border-radius: 12px;
  background: linear-gradient(180deg, #4a86ff, #2f6bf0); color: #fff;
  font-size: 15px; font-weight: 600; cursor: pointer;
}
.primary:active { filter: brightness(.94); }

.ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line);
  background: rgba(255, 255, 255, .04); color: #cfd4dc;
  font-size: 14px; text-decoration: none; cursor: pointer;
}
.ghost:active { background: rgba(255, 255, 255, .08); }
.ghost.block { display: flex; width: 100%; margin-top: 14px; }
.ghost.danger { color: #ff8f8f; }

.qr-wrap {
  position: relative; margin: 16px auto 12px; width: 232px; height: 232px;
  display: grid; place-items: center;
  border-radius: 16px; background: #fff; padding: 12px;
}
.qr-wrap img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; display: none; }
.qr-blank { position: absolute; inset: 0; display: grid; place-items: center; color: #6b7280; font-size: 13px; }

.device-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.device h2 { margin: 0 0 10px; font-size: 20px; }
.pill {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: #a9b0ba; padding: 4px 10px;
  border: 1px solid var(--line); border-radius: 999px; background: rgba(255, 255, 255, .05);
}
.pill .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--off); }
.pill.online { color: #b8f3cf; border-color: rgba(53, 196, 106, .35); background: rgba(53, 196, 106, .12); }
.pill.online .dot { background: var(--ok); box-shadow: 0 0 0 4px rgba(53, 196, 106, .16); }

.battery { display: flex; align-items: baseline; gap: 2px; color: #dfe4ea; }
.battery span:first-child { font-size: 26px; font-weight: 650; letter-spacing: -.5px; }
.battery .unit { font-size: 13px; color: var(--muted); }

.bar { height: 6px; border-radius: 999px; background: rgba(255, 255, 255, .07); margin: 14px 0 16px; overflow: hidden; }
.bar span { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #35c46a, #7fe3a5); transition: width .5s ease; }
.bar span.low { background: linear-gradient(90deg, #f0a02a, #ffce7a); }
.bar span.critical { background: linear-gradient(90deg, #e5544b, #ff8f88); }

.addr { margin: 0; font-size: 16px; line-height: 1.5; color: #eef1f5; }

.meta { padding: 6px 18px; }
.meta ul { list-style: none; margin: 0; padding: 0; }
.meta li {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 0; border-bottom: 1px solid var(--line);
}
.meta li:last-child { border-bottom: 0; }
.meta li span { color: var(--muted); font-size: 13.5px; }
.meta li b { font-weight: 550; font-size: 14px; color: #e6eaef; text-align: right; }

.row { display: flex; gap: 10px; margin-top: 4px; }
.row .ghost { flex: 1; }

.toast {
  position: fixed; left: 50%; bottom: calc(26px + env(safe-area-inset-bottom));
  transform: translateX(-50%); max-width: 86vw;
  padding: 10px 16px; border-radius: 999px;
  background: rgba(20, 22, 26, .92); border: 1px solid var(--line);
  color: #e8ecf1; font-size: 13px; box-shadow: var(--shadow);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f4f5f7; --bg-soft: #fff; --card: rgba(255, 255, 255, .92);
    --line: rgba(15, 20, 30, .09); --text: #16181c; --muted: #6c727c;
    --shadow: 0 10px 30px rgba(15, 20, 30, .08);
  }
  body { background: radial-gradient(900px 400px at 50% -5%, #e9f0ff, transparent 70%), var(--bg); }
  .brand { color: #5b616b; }
  .battery span:first-child, .addr, .meta li b { color: #16181c; }
  .ghost { background: rgba(15, 20, 30, .03); color: #4a5058; }
  .pill { background: rgba(15, 20, 30, .04); }
}

/* 表单与文字按钮 */
.field { display: block; margin-top: 14px; }
.field span { display: block; font-size: 12.5px; color: var(--muted); margin-bottom: 7px; }
.field input {
  width: 100%; padding: 13px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: rgba(255, 255, 255, .06);
  color: var(--text); font-size: 15px; outline: none;
}
.field input:focus { border-color: rgba(61, 123, 253, .7); box-shadow: 0 0 0 3px rgba(61, 123, 253, .16); }
#btnPwLogin, #btnSms { margin-top: 18px; }
#pwPane input:first-of-type { margin-top: 0; }
.link {
  display: block; width: 100%; margin-top: 14px; padding: 6px 0;
  border: 0; background: none; color: #7aa4ff; font-size: 13.5px; cursor: pointer;
}
.link:active { opacity: .7; }
