:root {
  color-scheme: dark;
  font-family: system-ui, sans-serif;
  background: #101216;
  color: #edf0f7;
  --muted: #a8b1c0;
  --line: #303743;
  --surface: #191e26;
  --accent: #a9a3ff;
}

* { box-sizing: border-box; }
body { margin: 0; }
main { width: min(100% - 2rem, 40rem); margin: clamp(1.25rem, 6vh, 4rem) auto; }
.brand { display: flex; align-items: center; gap: .65rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
h1, h2, p { margin: 0; }
h1 { font-size: 1.35rem; letter-spacing: -.025em; }
.mark {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: .65rem;
  color: #17152b;
  background: var(--accent);
  font-size: 1.5rem;
}
.mode { margin-left: auto; font-size: .82rem; color: var(--muted); }
.card, dialog {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 1rem;
  padding: clamp(1rem, 5vw, 1.8rem);
}
.card + .card { margin-top: .9rem; }
.connection { display: flex; align-items: center; gap: .55rem; font-size: .88rem; color: var(--muted); }
.connection span { width: .55rem; height: .55rem; border-radius: 50%; background: #f5be79; }
.connection[data-state="online"] span { background: #79e0b1; }
.device h2 { margin-top: .65rem; font-size: clamp(1.55rem, 6vw, 2.15rem); overflow-wrap: anywhere; }
dl { display: grid; grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: .75rem; margin: 1.2rem 0 .8rem; }
dl div { background: #13171d; border-radius: .65rem; padding: .75rem; }
dt, .hint { color: var(--muted); font-size: .88rem; }
dd { margin: .25rem 0 0; font-variant-numeric: tabular-nums; }
.controls h2, dialog h2 { font-size: 1.1rem; }
.controls .hint, dialog p { margin-top: .3rem; }
.buttons { display: flex; flex-wrap: wrap; gap: .55rem; margin-top: 1rem; }
button {
  min-height: 2.75rem;
  flex: 1 1 auto;
  border: 1px solid #485365;
  border-radius: .6rem;
  background: #252e3a;
  color: inherit;
  padding: .4rem .75rem;
  font: inherit;
  cursor: pointer;
}
button:hover:enabled { background: #354255; }
button:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
button:disabled { opacity: .55; cursor: default; }
button[data-action="shutdown"] { color: #ffb3ba; }
#result { margin-top: .75rem; color: var(--muted); font-size: .9rem; }
#result:empty { display: none; }
dialog { width: min(100% - 2rem, 25rem); color: inherit; }
dialog::backdrop { background: #080a0cbd; }
#send { color: #17152b; background: var(--accent); }
#send:hover:enabled { background: #c6c1ff; }

input {
  display: block;
  width: 100%;
  margin-top: .4rem;
  padding: .55rem;
  border: 1px solid var(--line);
  border-radius: .4rem;
  font: inherit;
}
#credential-box, #pairing-status { margin-top: .75rem; }
.device-row { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; margin-top: .5rem; }
.device-row code { overflow-wrap: anywhere; }
.device-row button { flex: 0 0 auto; }
[hidden] { display: none !important; }
#login label { display: block; margin-top: .65rem; }
#login-error { margin-top: .65rem; color: #ffb3ba; }
#logout { flex: 0 0 auto; }
#shutdown { color: #ffb3ba; }
