:root {
  --ink: #070807;
  --paper: #f5f2ea;
  --muted: var(--sv-color-text-muted);
  --line: #292b27;
  --panel: var(--sv-color-surface);
  --acid: var(--sv-color-brand);
  --cyan: #53d9e8;
  --danger: #ff735c;
}

* { box-sizing: border-box; }
html { background: var(--ink); color: var(--paper); font-family: var(--sv-font-sans); }
body { margin: 0; min-height: 100vh; background: var(--ink); }
button, input { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: wait; opacity: .5; }

.topbar { height: 72px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; padding: 0 clamp(24px, 5vw, 76px); }
.brand { color: var(--paper); text-decoration: none; display: flex; align-items: center; gap: 12px; font-size: 12px; font-weight: 800; letter-spacing: .18em; }
.brand-mark { width: 18px; height: 18px; border: 2px solid var(--acid); position: relative; transform: rotate(45deg); }
.brand-mark::after { content: ""; position: absolute; inset: 4px; background: var(--acid); }
.local-state { color: var(--muted); text-transform: uppercase; font: 600 10px/1 var(--sv-font-mono); letter-spacing: .13em; display: flex; gap: 9px; align-items: center; }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 0 4px rgba(83,217,232,.09); }

main { width: min(1180px, calc(100% - 48px)); margin: 0 auto; padding: 80px 0 100px; }
.hero { max-width: 850px; margin-bottom: 80px; }
.eyebrow { margin: 0 0 18px; color: var(--acid); font: 700 10px/1 var(--sv-font-mono); letter-spacing: .2em; }
h1 { margin: 0; font-size: clamp(48px, 7.2vw, 98px); line-height: .94; letter-spacing: -.055em; font-weight: 740; }
h1 em { color: var(--acid); font-style: normal; }
.lede { color: var(--muted); max-width: 600px; font-size: 17px; line-height: 1.8; margin: 32px 0 0; }
h2 { margin: 0; font-size: clamp(28px, 3.3vw, 46px); letter-spacing: -.035em; }

.message { position: sticky; z-index: 4; top: 16px; margin: -45px 0 28px auto; width: min(540px, 100%); padding: 13px 16px; border: 1px solid var(--line); background: var(--paper); color: var(--ink); font-size: 13px; }
.message.error { color: #2b0904; background: #ffb4a8; border-color: var(--danger); }

.pairing-shell, .devices-section { display: grid; grid-template-columns: 54px minmax(260px, .8fr) minmax(360px, 1.2fr); border-top: 1px solid var(--line); padding: 34px 0 72px; gap: clamp(24px, 4vw, 66px); }
.section-index { color: var(--muted); font: 500 11px/1 var(--sv-font-mono); }
.pairing-copy > p:not(.eyebrow) { color: var(--muted); line-height: 1.7; font-size: 14px; max-width: 390px; }
.steps { list-style: none; padding: 0; margin: 40px 0 0; border-top: 1px solid var(--line); }
.steps li { padding: 15px 0; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 13px; display: flex; gap: 14px; }
.steps span { color: var(--paper); font: 600 10px/1.7 var(--sv-font-mono); }

.pairing-panel { min-height: 520px; background: var(--panel); border: 1px solid var(--line); padding: clamp(26px, 4vw, 52px); display: flex; align-items: center; justify-content: center; position: relative; overflow: hidden; }
.pairing-panel::before { content: "PAIR / LOCAL / TRUST"; position: absolute; top: 16px; right: 18px; color: #343630; font: 700 9px/1 var(--sv-font-mono); letter-spacing: .13em; }
.state-block { width: min(100%, 430px); }
.scan-placeholder { width: 214px; height: 214px; margin: 0 auto 42px; position: relative; }
.scan-placeholder span { position: absolute; width: 54px; height: 54px; border-color: var(--paper); border-style: solid; }
.scan-placeholder span:nth-child(1) { left: 0; top: 0; border-width: 2px 0 0 2px; }
.scan-placeholder span:nth-child(2) { right: 0; top: 0; border-width: 2px 2px 0 0; }
.scan-placeholder span:nth-child(3) { left: 0; bottom: 0; border-width: 0 0 2px 2px; }
.scan-placeholder span:nth-child(4) { right: 0; bottom: 0; border-width: 0 2px 2px 0; }
.scan-placeholder b { position: absolute; inset: 0; display: grid; place-items: center; color: var(--acid); font: 200 48px/1 sans-serif; }
.primary-button, .secondary-button { min-height: 52px; border: 1px solid var(--acid); padding: 0 22px; font-size: 13px; font-weight: 750; }
.primary-button { width: 100%; background: var(--acid); color: var(--ink); }
.primary-button:hover { background: var(--paper); border-color: var(--paper); }
.secondary-button { background: transparent; color: var(--paper); border-color: #464942; }
.secondary-button:hover { border-color: var(--paper); }
.microcopy { color: var(--muted); text-align: center; font-size: 11px; margin: 14px 0 0; }

.qr-wrap { width: min(100%, 360px); aspect-ratio: 1; margin: 0 auto; background: var(--ink); padding: 15px; border: 1px solid var(--line); }
.qr-wrap img { width: 100%; height: 100%; display: block; }
.pair-meta { display: flex; justify-content: space-between; align-items: center; margin-top: 16px; color: var(--muted); font: 600 11px/1 var(--sv-font-mono); }
.text-button { color: var(--paper); border: 0; border-bottom: 1px solid #464942; background: none; padding: 4px 0; font-size: 11px; }
.waiting { text-align: center; color: var(--muted); font-size: 12px; margin: 28px 0 0; }
.waiting span { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); margin-right: 8px; animation: beacon 1.4s ease-in-out infinite; }
@keyframes beacon { 50% { box-shadow: 0 0 0 8px rgba(83,217,232,0); opacity: .55; } }

.device-heading { display: flex; align-items: center; gap: 16px; margin-bottom: 28px; }
.device-heading small, .device-heading strong { display: block; }
.device-heading small { color: var(--muted); font: 600 10px/1 var(--sv-font-mono); text-transform: uppercase; letter-spacing: .12em; margin-bottom: 7px; }
.device-heading strong { font-size: 21px; }
.phone-glyph { width: 33px; height: 54px; border: 2px solid var(--paper); border-radius: 7px; position: relative; }
.phone-glyph::after { content: ""; position: absolute; bottom: 4px; left: 12px; width: 5px; height: 5px; border-radius: 50%; background: var(--acid); }
.facts { margin: 0 0 26px; border-top: 1px solid var(--line); }
.facts div { display: flex; justify-content: space-between; gap: 18px; border-bottom: 1px solid var(--line); padding: 12px 0; }
.facts dt { color: var(--muted); font-size: 11px; }
.facts dd { margin: 0; font: 600 11px/1.4 var(--sv-font-mono); text-align: right; overflow-wrap: anywhere; }
.verify-block { padding: 18px; background: var(--ink); margin-bottom: 26px; }
.verify-block small { display: block; color: var(--muted); font-size: 11px; margin-bottom: 12px; }
.confirmation-code { color: var(--acid); font: 750 clamp(30px, 5vw, 46px)/1 var(--sv-font-mono); letter-spacing: .18em; }
fieldset { border: 0; padding: 0; margin: 0; }
legend { color: var(--muted); font: 600 10px/1 var(--sv-font-mono); letter-spacing: .1em; text-transform: uppercase; margin-bottom: 8px; }
fieldset label { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; min-height: 42px; border-bottom: 1px solid var(--line); font-size: 12px; }
fieldset input { accent-color: var(--acid); }
fieldset code { color: var(--muted); font-size: 9px; }
.actions { display: grid; grid-template-columns: 1fr 2fr; gap: 10px; margin-top: 28px; }

.approved { text-align: center; }
.approved-mark { width: 72px; height: 72px; margin: 0 auto 28px; display: grid; place-items: center; border: 1px solid var(--acid); color: var(--acid); font-size: 28px; }
.approved h3 { font-size: 30px; margin: 0 0 14px; }
.approved > p:not(.eyebrow) { color: var(--muted); line-height: 1.7; }
.approved .secondary-button { margin-top: 22px; }

.devices-section { grid-template-columns: 54px minmax(240px, .55fr) minmax(360px, 1.45fr); }
.device-list { border-top: 1px solid var(--line); }
.device-row { display: grid; grid-template-columns: 1fr auto; gap: 20px; padding: 20px 0; border-bottom: 1px solid var(--line); }
.device-row h3 { margin: 0 0 7px; font-size: 16px; }
.device-row p { margin: 0; color: var(--muted); font: 500 10px/1.7 var(--sv-font-mono); }
.device-row button { align-self: center; border: 0; background: none; color: var(--danger); font-size: 11px; padding: 10px; }
.device-row.revoked { opacity: .48; }
.empty { color: var(--muted); font-size: 13px; margin: 24px 0; }
.boundary-note { border: 1px solid var(--line); padding: 23px; display: grid; grid-template-columns: 180px 1fr; gap: 24px; color: var(--muted); }
.boundary-note span { color: var(--acid); font: 700 9px/1.5 var(--sv-font-mono); letter-spacing: .14em; }
.boundary-note p { margin: 0; font-size: 12px; line-height: 1.8; }

[hidden] { display: none !important; }
@media (max-width: 800px) {
  main { width: min(100% - 30px, 620px); padding-top: 54px; }
  .topbar { padding: 0 18px; }
  .pairing-shell, .devices-section { grid-template-columns: 1fr; gap: 28px; }
  .section-index { display: none; }
  .pairing-panel { min-height: 500px; }
  .hero { margin-bottom: 54px; }
  .boundary-note { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .waiting span { animation: none; }
}
