/* The app's look (docs/DESIGN.md) on a web page.
   On a phone it is the app's own sign-in: a white page, the question 30/36
   Bold, reading text 17 and second lines 16 in the grey (#646A77), grey boxes
   without an outline (corners 28), fields with a floating label (corners 20),
   the onboarding's black main button (58 tall, corners 24, 17 SemiBold) and
   the grey second one. On a computer (`html.desktop`, set by consent.js) it is
   the desktop app's sign-in: the same steps in a white card on the icon's own
   colours, with the code to scan first. */
:root {
  --page: #FFFFFF;
  --surface: #FFFFFF;
  --muted: #F6F4F9;
  --pressed: #ECE9F2;
  --ink: #0D0D0D;
  --text-secondary: #646A77;
  --hairline: #E9EDF2;
  --danger: #E24B4A;
  --danger-text: #B93E3D;
  --ease: cubic-bezier(0.4, 0, 0.2, 1);
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  min-height: 100dvh;
  background: var(--page);
  color: var(--ink);
  font: 17px/24px "Google Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
/* The desktop app's ground: the icon's yellow, lime and mint, softened. */
html.desktop body { background: linear-gradient(135deg, #FBFCE3 0%, #E6F8D2 50%, #D3F1EC 100%) fixed; }

.page {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 32px 20px calc(32px + env(safe-area-inset-bottom));
}
.card {
  width: 100%;
  max-width: 440px;
  background: var(--surface);
}
html.desktop .card {
  max-width: 460px;
  padding: 40px 44px 36px;
  border-radius: 28px;
  box-shadow: 0 1px 2px rgba(20, 40, 20, 0.05), 0 20px 60px rgba(30, 60, 30, 0.12);
}

/* ── The top of each step: the icon, the question, its line ─────────────── */
.top { display: flex; flex-direction: column; align-items: center; text-align: center; margin-bottom: 28px; }
.icon { display: block; width: 64px; height: 64px; border-radius: 15px; margin-bottom: 20px; }
h1 { margin: 0; font-size: 30px; line-height: 36px; font-weight: 700; letter-spacing: -0.6px; overflow-wrap: anywhere; }
.lead { margin: 8px 0 0; color: var(--text-secondary); }
.lead b { color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
.lead.alone { margin: 0 0 20px; text-align: center; }
.wait p { margin: 0; }

/* A step opened from another: the back arrow, at the page's top left on a
   phone (as the app's bar), in the card's own top row on a computer. */
.bar { position: fixed; top: calc(8px + env(safe-area-inset-top)); left: 10px; z-index: 2; display: flex; }
html.desktop .bar { position: static; height: 44px; margin: -8px 0 12px -10px; }
.round {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink);
  cursor: pointer;
  transition: background-color 120ms var(--ease);
}
.round:hover { background: var(--muted); }

/* ── Buttons ────────────────────────────────────────────────────────────── */
.stack { display: grid; gap: 10px; }
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 58px;
  padding: 0 20px;
  border: 0;
  border-radius: 24px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 120ms var(--ease), transform 120ms var(--ease), opacity 120ms var(--ease);
}
.btn:active { transform: scale(0.985); }
.btn.black { background: #000; color: #FFF; }
.btn.black:hover { background: #26262A; }
.btn.grey { background: var(--muted); color: var(--ink); }
.btn.grey:hover { background: var(--pressed); }
.btn img, .btn svg { flex: none; width: 20px; height: 20px; }
button:disabled { opacity: 0.5; cursor: default; }
button:disabled:active { transform: none; }
/* A quiet way out: the words alone, the pill press under them. */
.quiet {
  height: 44px;
  padding: 0 16px;
  border: 0;
  border-radius: 999px;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 120ms var(--ease);
}
.quiet:hover { background: var(--muted); }
.quiet:disabled { color: var(--text-secondary); opacity: 1; }
.foot { display: flex; justify-content: center; margin-top: 12px; }

.or { display: flex; align-items: center; gap: 12px; margin: 20px 0; font-size: 16px; color: var(--text-secondary); }
.or::before, .or::after { content: ""; flex: 1; height: 1px; background: var(--hairline); }

/* ── Fields: the label sits in the box and rises as she types ───────────── */
.field {
  position: relative;
  display: block;
  height: 64px;
  border-radius: 20px;
  background: var(--muted);
  box-shadow: inset 0 0 0 1.5px transparent;
  transition: box-shadow 120ms var(--ease), background-color 120ms var(--ease);
}
.field:focus-within { background: var(--surface); box-shadow: inset 0 0 0 1.5px var(--ink); }
.field.invalid { box-shadow: inset 0 0 0 1.5px var(--danger); }
.field input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 26px 18px 8px;
  border: 0;
  border-radius: 20px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  outline: none;
}
.field .float {
  position: absolute;
  left: 18px;
  top: 20px;
  color: var(--text-secondary);
  pointer-events: none;
  transform-origin: left top;
  transition: transform 200ms var(--ease);
}
.field:focus-within .float, .field.filled .float { transform: translateY(-10px) scale(0.76); }
.field.code input { letter-spacing: 4px; }
.after { margin-top: 16px; }
.error { margin: 10px 4px 0; font-size: 16px; line-height: 22px; color: var(--danger-text); }
.error:empty { display: none; }
.note { margin: 12px 4px 0; font-size: 16px; line-height: 22px; color: var(--text-secondary); }
.note:empty { display: none; }

/* ── The code to scan (computer only) ───────────────────────────────────── */
.scan { display: flex; align-items: center; gap: 18px; padding: 8px; border-radius: 28px; background: var(--muted); }
.qr {
  position: relative;
  flex: none;
  display: grid;
  place-items: center;
  width: 136px;
  height: 136px;
  border-radius: 20px;
  background: #FFF;
  overflow: hidden;
}
.qr svg { width: 120px; height: 120px; }
.qr .cover { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(255, 255, 255, 0.9); }
.qr .cover.bare { background: #FFF; }
.scan .words { flex: 1; min-width: 0; padding-right: 8px; }
.scan .words strong { display: block; font-weight: 600; }
.scan .words span { display: block; margin-top: 4px; font-size: 16px; line-height: 22px; color: var(--text-secondary); }
.again {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 36px;
  padding: 0 14px;
  border: 0;
  border-radius: 999px;
  background: var(--muted);
  color: var(--ink);
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
}
.again:hover { background: var(--pressed); }
.again svg { width: 16px; height: 16px; }
.spin {
  width: 22px;
  height: 22px;
  border: 2.5px solid #D9DCE3;
  border-top-color: var(--ink);
  border-radius: 50%;
  animation: spin 800ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.wait { display: flex; flex-direction: column; align-items: center; gap: 14px; padding: 40px 0; color: var(--text-secondary); text-align: center; }

/* ── Allowing an app ────────────────────────────────────────────────────── */
.label { margin: 0 4px 10px; font-weight: 600; color: var(--text-secondary); }
.box { padding: 6px 0; border-radius: 28px; background: var(--muted); }
.box + .label { margin-top: 20px; }
.item { display: flex; gap: 14px; padding: 12px 18px; }
.item svg { flex: none; width: 24px; height: 24px; }
.item p { margin: 0; }
.fact { padding: 10px 18px; }
.fact span { display: block; font-size: 16px; line-height: 22px; color: var(--text-secondary); }
.fact strong { display: block; font-weight: 600; overflow-wrap: anywhere; }
.actions { display: grid; gap: 10px; margin-top: 24px; }
/* On a phone a long step keeps its buttons at the bottom of the screen. */
html:not(.desktop) .actions.sticky {
  position: sticky;
  bottom: 0;
  margin: 12px -20px 0;
  padding: 12px 20px calc(12px + env(safe-area-inset-bottom));
  background: var(--page);
}

/* The home page (/). */
.mark { display: block; margin: 0 auto 20px; border-radius: 15px; }
.card > p { margin: 8px 0 0; }
.secondary { color: var(--text-secondary); }

input:focus-visible, button:focus-visible, a:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }
.field input:focus-visible { outline: none; }

@media (max-width: 360px) {
  h1 { font-size: 26px; line-height: 32px; }
  html.desktop .card { padding: 32px 24px 28px; }
}
@media (max-width: 520px) {
  html.desktop .card { padding: 32px 24px 28px; }
  .scan { flex-direction: column; align-items: stretch; text-align: center; }
  .qr { margin: 0 auto; }
  .scan .words { padding: 0 8px 8px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 1ms !important; }
}

/* The code she is asked to turn on (/code): shown as written, never run. */
.code {
  margin: 4px 0 0;
  padding: 14px 16px;
  max-height: 260px;
  overflow: auto;
  border-radius: 20px;
  background: var(--muted);
  font: 13px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
a.btn { text-decoration: none; }
