:root {
  color-scheme: light dark;
  --paper: light-dark(#faf8f3, #262521);
  --surface: light-dark(#fffdf8, #2e2d27);
  --ink: light-dark(#2e2b24, #f5eee2);
  --dim: light-dark(#675f53, #bdb3a4);
  --line: light-dark(#e4ded2, #48443b);
  --rust: light-dark(#98442a, #f0a183);
  --active: light-dark(#f3e7db, #463327);
  --green: light-dark(#3e684f, #a6cfad);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 15px/1.6 "Instrument Sans", system-ui, sans-serif;
}

.page {
  min-height: 100svh;
  display: grid;
  place-items: center;
  padding: 24px 16px;
}

.card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 24px;
  display: grid;
  gap: 14px;
}

.card :where(h1, h2, p, ul) { margin: 0; }
.card ul { padding: 0; list-style: none; }

.brand {
  font: 600 18px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.04em;
}

.dim { color: var(--dim); font-size: 13px; }

.state {
  justify-self: start;
  border-radius: 99px;
  background: var(--active);
  color: var(--rust);
  padding: 2px 10px;
  font-size: 12px;
}
.state[data-tone="done"] { background: transparent; border: 1px solid var(--line); color: var(--green); }

.email { font-size: 14px; word-break: break-all; }

.pairing {
  font: 500 32px/1.2 ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.3em;
}

button, .button {
  font: inherit;
  color: inherit;
  display: block;
  width: 100%;
  text-align: center;
  text-decoration: none;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 9px 12px;
  cursor: pointer;
}
button:disabled { opacity: 0.6; cursor: default; }
.primary { background: var(--rust); color: var(--paper); border-color: transparent; font-weight: 600; }
button:focus-visible, input:focus-visible, a:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }

input {
  font: inherit;
  color: inherit;
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 42px;
  padding: 9px 12px;
}
input::placeholder { color: var(--dim); }
label { font-size: 13px; display: grid; gap: 6px; }

.link {
  color: var(--rust);
  text-decoration: underline;
  text-underline-offset: 3px;
  font-size: 14px;
  justify-self: center;
}

.error { color: var(--rust); font-size: 13px; }
.ok { color: var(--green); font-size: 13px; }

.keys li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 0;
  font-size: 14px;
}
.keys li + li { border-top: 1px solid var(--line); }
.keys .meta { min-width: 0; }
.keys .meta span { display: block; word-break: break-all; }
.keys .meta .dim { font-size: 12px; }
.keys button { width: auto; min-height: 32px; padding: 4px 10px; font-size: 13px; }

.spin {
  width: 14px; height: 14px;
  border: 2px solid var(--line);
  border-top-color: var(--rust);
  border-radius: 50%;
  display: inline-block;
  vertical-align: -2px;
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spin { animation: none; } }
