/*
 * The phone shell's own screens and its sheets (pairing, the desk list,
 * the approval sheet, Face ID set-up, About), on the desk's tokens and
 * fonts (docs/design.md): brass means you, verdigris live, sentence case,
 * quiet chrome. Narrow first: a phone at 390 px, safe areas respected.
 */
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/fonts/atkinson-next-latin.woff2") format("woff2"); }
@font-face { font-family: "Atkinson Hyperlegible Next"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/fonts/atkinson-next-latin-ext.woff2") format("woff2"); unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1E00-1E9F, U+2C60-2C7F, U+A720-A7FF; }
@font-face { font-family: "Atkinson Hyperlegible Mono"; font-style: normal; font-weight: 200 800; font-display: swap; src: url("/fonts/atkinson-mono-latin.woff2") format("woff2"); }

:root {
  --graphite: #1b1f1f;
  --slate: #252a29;
  --slate-2: #2e3433;
  --rule: #343b3a;
  --rule-soft: #2a302f;
  --chalk: #e4e8e6;
  --pewter: #9aa5a2;
  --brass: #d6ae5c;
  --verdigris: #6cc2ae;
  --red: #f2767a;
  --on-chalk: #1b1f1f;
  --brass-wash: color-mix(in srgb, var(--brass) 12%, transparent);
  --verdigris-wash: color-mix(in srgb, var(--verdigris) 14%, transparent);
  --red-wash: color-mix(in srgb, var(--red) 13%, transparent);
  --scrim: rgb(8 10 10 / 0.6);
  --font-sans: "Atkinson Hyperlegible Next", -apple-system, system-ui, sans-serif;
  --font-mono: "Atkinson Hyperlegible Mono", ui-monospace, Menlo, monospace;
  --r-2: 8px;
  --r-3: 12px;
  color-scheme: dark;
}
@media (prefers-color-scheme: light) {
  :root {
    --graphite: #f4f6f5;
    --slate: #ffffff;
    --slate-2: #e8edeb;
    --rule: #d3dbd8;
    --rule-soft: #e1e7e5;
    --chalk: #1a1f1e;
    --pewter: #596561;
    --brass: #87620f;
    --verdigris: #1e7564;
    --red: #c2333b;
    --on-chalk: #ffffff;
    --brass-wash: color-mix(in srgb, #d6ae5c 22%, transparent);
    --verdigris-wash: color-mix(in srgb, #6cc2ae 22%, transparent);
    --red-wash: color-mix(in srgb, #f2767a 16%, transparent);
    --scrim: rgb(20 30 28 / 0.32);
    color-scheme: light;
  }
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--graphite);
  color: var(--chalk);
  font-family: var(--font-sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-text-size-adjust: 100%;
  overscroll-behavior: none;
}
button { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--verdigris); outline-offset: 2px; }
#app { min-height: 100%; }

.screen {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 100dvh;
  padding: calc(env(safe-area-inset-top) + 28px) calc(env(safe-area-inset-right) + 22px) calc(env(safe-area-inset-bottom) + 24px) calc(env(safe-area-inset-left) + 22px);
}
.brand { display: inline-flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--chalk); margin-bottom: 18px; }
.brand svg { color: var(--verdigris); }
h1 { margin: 0; font-size: 24px; line-height: 1.25; font-weight: 600; text-wrap: balance; }
h2 { margin: 0; font-size: 19px; line-height: 1.3; font-weight: 600; text-wrap: balance; }
.lead { margin: 0; color: var(--pewter); max-width: 34em; }
.note { margin: 0; font-size: 13px; color: var(--pewter); }
.steps { margin: 6px 0 0; padding-left: 1.3em; display: flex; flex-direction: column; gap: 10px; }
.steps li::marker { color: var(--pewter); }
.actions { margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 18px; }
.row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--r-2);
  border: 1px solid var(--rule);
  background: var(--slate);
  color: var(--chalk);
  font-weight: 500;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.btn:active:not(:disabled) { background: var(--slate-2); }
.btn:disabled { opacity: 0.5; }
.btn-primary { background: var(--chalk); border-color: var(--chalk); color: var(--on-chalk); font-weight: 600; }
.btn-wide { width: 100%; }
.btn-deny { color: var(--red); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--pewter); }

.notice { display: flex; flex-direction: column; gap: 8px; padding: 12px 14px; border-radius: var(--r-3); background: var(--slate); border: 1px solid var(--rule-soft); }
.notice p { margin: 0; font-size: 14px; color: var(--pewter); }
.notice-warn { border-left: 3px solid var(--brass); }
.notice-warn strong { color: var(--brass); font-weight: 600; }
.notice-error { color: var(--red); background: var(--red-wash); border-color: transparent; }

/* The scanner: the back camera with a square to aim at. */
.camera { position: relative; width: 100%; aspect-ratio: 3 / 4; max-height: 56dvh; overflow: hidden; border-radius: var(--r-3); background: #000; }
.camera-video { width: 100%; height: 100%; object-fit: cover; display: block; }
.camera-frame { position: absolute; inset: 18% 14%; border: 2px solid var(--verdigris); border-radius: 14px; box-shadow: 0 0 0 100vmax rgb(0 0 0 / 0.35); }

/* Waiting for the desk: the check code both screens show. Brass: the person compares it. */
.check-code { margin: 18px 0 6px; font-family: var(--font-mono); font-size: 44px; font-weight: 600; letter-spacing: 0.22em; color: var(--brass); text-align: center; }

/* The desk's UI, full screen in its sandboxed frame. */
.ui-holder { position: fixed; inset: 0; background: var(--graphite); }
.ui-frame { display: block; width: 100%; height: 100%; border: 0; background: var(--graphite); }

/* Sheets: the shell's own, over the frame (approvals, Face ID set-up, the menu). */
.sheet-backdrop { position: fixed; inset: 0; z-index: 10; display: flex; align-items: flex-end; background: var(--scrim); }
.sheet {
  width: 100%;
  max-height: 88dvh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 20px calc(env(safe-area-inset-right) + 20px) calc(env(safe-area-inset-bottom) + 18px) calc(env(safe-area-inset-left) + 20px);
  background: var(--slate);
  border-radius: 16px 16px 0 0;
  border-top: 3px solid var(--brass);
  box-shadow: 0 -12px 32px rgb(0 0 0 / 0.35);
}
.sheet-desk { margin: 0; font-size: 13px; color: var(--pewter); }
.sheet-desk.ok { color: var(--verdigris); }
.sheet-line { display: flex; flex-direction: column; gap: 4px; }
.sheet-label { font-size: 13px; color: var(--pewter); }
.sheet-value { margin: 0; overflow-wrap: anywhere; }
.sheet-mono {
  margin: 0;
  padding: 10px 12px;
  max-height: 34dvh;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: 13.5px;
  line-height: 1.45;
  white-space: pre;
  background: var(--graphite);
  border: 1px solid var(--rule-soft);
  border-radius: var(--r-2);
  -webkit-overflow-scrolling: touch;
}
.sheet-chat { margin: 0; font-size: 14px; color: var(--pewter); }
.sheet-status { margin: 0; min-height: 1.4em; font-size: 14px; color: var(--pewter); }
.sheet-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.about { margin: 4px 0 0; font-size: 12px; color: var(--pewter); text-align: center; }

.desk-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.desk-row { display: flex; flex-direction: column; align-items: flex-start; width: 100%; min-height: 52px; padding: 8px 12px; text-align: left; background: transparent; border: 1px solid transparent; border-radius: var(--r-2); cursor: pointer; }
.desk-row.on { background: var(--graphite); border-color: var(--rule-soft); }
.desk-name { font-weight: 600; }
.desk-sub { font-size: 13px; color: var(--pewter); }

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
