/* Lidless relay screens: only what style.css lacks. Same variables, same
   classes (.pair, .pair-card, .field, .error, button.primary, button.quiet).
   Sizes follow the space there is; nothing assumes a particular screen. */

/* style.css gives fields their look by type="text"; the address field is
   type="email". 16px keeps iOS from zooming the page on focus. */
.relay-screen input[type="email"] {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--field);
  font-size: 16px;
  line-height: 1.4;
}
.relay-screen input[type="email"]:focus-visible { outline-offset: 0; }

/* Focus is moved to the heading on each screen change so that a screen
   reader starts there; it is not a control and needs no ring. */
.relay-screen h1:focus { outline: none; }
.relay-screen h1 { overflow-wrap: break-word; }

/* An e-mail address has no spaces to break at. */
.relay-address { overflow-wrap: anywhere; }

#relay-otp, #relay-reauth-otp {
  min-height: 56px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 26px;
  letter-spacing: 0.18em;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* The six digits both screens show, in two groups of three. */
.relay-sas {
  display: flex;
  justify-content: center;
  gap: 0.4em;
  padding: 14px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: clamp(34px, 13vw, 56px);
  font-weight: 600;
  line-height: 1.1;
  letter-spacing: 0.06em;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.relay-note { color: var(--muted); font-size: 14px; }
.relay-note.boxed {
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
}

/* The waiting line: a dot that says "still going" without depending on
   colour or on motion alone; the words carry the meaning. */
.relay-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 24px;
  font-size: 15px;
  font-weight: 600;
  text-align: center;
}
.relay-status::before {
  content: "";
  flex: none;
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
}
.relay-status[data-state="waiting"]::before { animation: relay-pulse 1.4s ease-in-out infinite; }
.relay-status[data-state="done"] { color: var(--good); }
.relay-status[data-state="done"]::before { background: var(--good); }
@keyframes relay-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.35; transform: scale(0.7); }
}
@media (prefers-reduced-motion: reduce) {
  .relay-status[data-state="waiting"]::before { animation: none; }
}

/* Secondary actions as text buttons under the main one. They keep the
   44px touch height of every button and wrap when the card is narrow. */
.relay-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 2px 8px;
  margin: -8px -8px 0;
}
.relay-links.single { justify-content: center; }
.relay-links button { padding: 0 8px; font-weight: 600; font-size: 14.5px; }
.relay-links button:disabled { color: var(--muted); opacity: 1; font-weight: 500; }

.relay-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0 12px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13.5px;
}
.relay-foot .relay-address { flex: 1 1 12em; min-width: 0; }
.relay-foot button { flex: none; padding: 0 8px; font-size: 14.5px; }
.relay-foot-actions { display: flex; flex: none; flex-wrap: wrap; gap: 0 4px; margin-right: -8px; }

/* Read by screen readers, not shown. */
.relay-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

.relay-mac { font-size: 15px; overflow-wrap: anywhere; }
.relay-h2 { margin: 4px 0 -6px; font-size: 16px; font-weight: 600; }

/* "Choose your Mac": one row per Mac, the whole row is the target. */
.relay-choices { margin: 0; padding: 0; border: 0; min-width: 0; }
.relay-choice-list { display: flex; flex-direction: column; gap: 8px; }
.relay-choice {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 56px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
}
.relay-choice:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: var(--accent-soft); }
.relay-choice input { flex: none; width: 20px; height: 20px; margin: 0; accent-color: var(--accent); }
.relay-choice-text, .relay-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.relay-host-name { font-weight: 600; overflow-wrap: anywhere; }
.relay-host-seen { color: var(--muted); font-size: 13.5px; }

/* The account's Macs. */
.relay-rows { margin: 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.relay-rows:empty { display: none; }
.relay-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 4px 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}
.relay-row-text { flex: 1 1 10em; }
.relay-row > button { flex: none; margin-right: -8px; padding: 0 8px; font-size: 14.5px; }

/* An "are you sure" in place, not a dialog. */
.relay-confirm {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1 1 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  font-size: 14.5px;
}
.relay-confirm-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.relay-confirm-buttons button { flex: 1 1 8em; }

.relay-pair-buttons { display: flex; flex-wrap: wrap; gap: 8px; }
.relay-pair-buttons button { flex: 1 1 12em; }

/* The one button that destroys something. */
button.primary.relay-destroy { background: var(--bad); border-color: var(--bad); color: var(--accent-ink); }
@media (prefers-color-scheme: light) {
  button.primary.relay-destroy { color: #ffffff; }
}

/* A short window (a phone on its side, or with the keyboard up): tighter,
   so the field and its button stay together above the keyboard. */
@media (max-height: 460px) {
  .relay-screen .pair-card { gap: 12px; }
  .relay-screen .brand-mark { width: 32px; height: 32px; }
  .relay-screen.pair { padding-top: calc(env(safe-area-inset-top) + 12px); padding-bottom: calc(env(safe-area-inset-bottom) + 12px); }
  .relay-sas { padding: 8px; font-size: clamp(30px, 9vw, 44px); }
}
