/* SpaciousID pages: one calm column, big targets, readable text, light and dark. Tokens use the Feature
   Library's shared names (--text, --accent, --radius …), so a library component dropped in follows them. */

:root {
  color-scheme: light dark;
  --bg: #f6f5f1;
  --surface: #ffffff;
  --text: #1b1c1f;
  --muted: #55585f;
  --line: #d9d7d0;
  --accent: #2f5bd3;
  --accent-text: #ffffff;
  --danger: #b42318;
  --danger-text: #ffffff;
  --ok: #1d7a46;
  --focus: #2f5bd3;
  --radius: 14px;
  --gap: 1rem;
  --font: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --mono: ui-monospace, 'SF Mono', Consolas, monospace;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg: #131417;
    --surface: #1d1f23;
    --text: #eceae4;
    --muted: #a5a8ae;
    --line: #34373d;
    --accent: #8aa8ff;
    --accent-text: #0d1220;
    --danger: #ff8a7a;
    --danger-text: #240805;
    --ok: #6fd39c;
    --focus: #8aa8ff;
  }
}
:root[data-theme='dark'] {
  --bg: #131417;
  --surface: #1d1f23;
  --text: #eceae4;
  --muted: #a5a8ae;
  --line: #34373d;
  --accent: #8aa8ff;
  --accent-text: #0d1220;
  --danger: #ff8a7a;
  --danger-text: #240805;
  --ok: #6fd39c;
  --focus: #8aa8ff;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 1.0625rem/1.5 var(--font);
  display: grid;
  place-items: start center;
  padding: clamp(1rem, 6vh, 4rem) 16px 3rem;
}
main { width: 100%; max-width: 27rem; }
.brand { display: flex; align-items: center; gap: 0.5rem; color: var(--muted); font-size: 0.9375rem; margin: 0 0 1.25rem; }
.brand svg { width: 1.5rem; height: 1.5rem; }
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: clamp(1.25rem, 5vw, 2rem);
}
h1 { font-size: 1.5rem; line-height: 1.25; margin: 0 0 0.5rem; text-wrap: balance; }
h2 { font-size: 1.125rem; margin: 1.75rem 0 0.5rem; }
p { margin: 0 0 1rem; }
.lead { color: var(--muted); }
.small { font-size: 0.9375rem; color: var(--muted); }
section[hidden] { display: none; }
.stack { display: grid; gap: 0.75rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: center; }

button, .button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 3rem;
  padding: 0.625rem 1.125rem;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  width: 100%;
}
button.primary, .button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-text); }
button.danger { background: var(--danger); border-color: var(--danger); color: var(--danger-text); }
button.link { background: none; border: none; min-height: 2.75rem; padding: 0.25rem 0; width: auto; color: var(--accent); text-decoration: underline; font-weight: 500; }
button:disabled { opacity: 0.55; cursor: progress; }
button svg { width: 1.25rem; height: 1.25rem; flex: none; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

label { display: block; font-weight: 600; margin: 0 0 0.375rem; }
input[type='text'], input[type='email'], input:not([type]) {
  width: 100%;
  min-height: 3rem;
  padding: 0.625rem 0.875rem;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--bg);
  color: var(--text);
  font: inherit;
}
input.code { font-family: var(--mono); font-size: 1.375rem; letter-spacing: 0.12em; text-transform: uppercase; text-align: center; }

.choice { display: grid; gap: 0.75rem; grid-template-columns: 1fr 1fr; }
@media (max-width: 22rem) { .choice { grid-template-columns: 1fr; } }
.choice button { min-height: 4rem; border-radius: var(--radius); }

.names { display: grid; gap: 0.5rem; }
.names button { justify-content: flex-start; border-radius: 10px; font-family: var(--mono); font-weight: 500; }
.names button[aria-pressed='true'] { border-color: var(--accent); box-shadow: inset 0 0 0 2px var(--accent); }

.note { border-left: 3px solid var(--line); padding: 0.25rem 0 0.25rem 0.75rem; color: var(--muted); font-size: 0.9375rem; }
.error { color: var(--danger); font-weight: 600; min-height: 1.5em; margin: 0.5rem 0 0; }
.error:empty { min-height: 0; margin: 0; }
.divider { display: flex; align-items: center; gap: 0.75rem; color: var(--muted); font-size: 0.875rem; margin: 1.25rem 0; }
.divider::before, .divider::after { content: ''; flex: 1; border-top: 1px solid var(--line); }

.code-show { font-family: var(--mono); font-size: clamp(1.5rem, 8vw, 2.125rem); letter-spacing: 0.08em; text-align: center; margin: 0.5rem 0; overflow-wrap: anywhere; }
.qr { display: grid; place-items: center; margin: 0.75rem 0; }
.qr svg { width: min(12rem, 70vw); height: auto; background: #fff; border-radius: 8px; }

ul.plain { list-style: none; margin: 0 0 1rem; padding: 0; display: grid; gap: 0.5rem; }
ul.plain li { display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; padding: 0.625rem 0.75rem; border: 1px solid var(--line); border-radius: 10px; overflow-wrap: anywhere; }
ul.plain li button { width: auto; min-height: 2.75rem; }

.hold { position: relative; overflow: hidden; background: var(--danger); border-color: var(--danger); color: var(--danger-text); }
.hold::before { content: ''; position: absolute; inset: 0; background: rgb(0 0 0 / 0.28); transform-origin: left; transform: scaleX(var(--htc-hold, 0)); }
.hold > span { position: relative; }
.hold[data-hold='done']::before { transform: scaleX(1); }

dialog { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--text); padding: 1.5rem; max-width: min(24rem, calc(100vw - 32px)); }
dialog::backdrop { background: rgb(0 0 0 / 0.45); }

footer { margin-top: 1.25rem; text-align: center; font-size: 0.875rem; color: var(--muted); }
footer a { color: inherit; }
a { color: var(--accent); }

.prose h2 { margin-top: 2rem; }
.prose ul { padding-left: 1.25rem; }
.prose li { margin: 0.25rem 0; }
table { border-collapse: collapse; width: 100%; font-size: 0.9375rem; }
th, td { text-align: left; padding: 0.5rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.scroll { overflow-x: auto; }

@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
@media (forced-colors: active) { button.primary, .hold { border: 2px solid ButtonText; } }
