:root {
  --paper: #F3F5F2;
  --surface: #FFFFFF;
  --ink: #1D2B3A;
  --ink-soft: #55616E;
  --line: #D5DBD3;
  --go: #1F7A5C;
  --stop: #B23A2E;
  --stop-tint: #F8E3DF;
  --notice: #F6E9C2;
  --key: #FFFFFF;
  --key-edge: #B9C2BA;
  --focus: #2F6FDE;
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #12191F;
    --surface: #1B242C;
    --ink: #E7ECEA;
    --ink-soft: #9AA6AE;
    --line: #2C3943;
    --go: #3DAE86;
    --stop: #E2695B;
    --stop-tint: #3A2220;
    --notice: #3A3320;
    --key: #24303A;
    --key-edge: #0D1317;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-text-size-adjust: 100%;
}
main {
  max-width: 30rem;
  margin: 0 auto;
  padding: calc(env(safe-area-inset-top, 0px) + 1.25rem) 1.25rem calc(env(safe-area-inset-bottom, 0px) + 2rem);
}
h1, h2 { margin: 0; line-height: 1.2; }
h2 { font-size: 1.05rem; font-weight: 650; }
p { margin: .5rem 0 0; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.loading, .quiet { color: var(--ink-soft); font-size: .92rem; }
.quiet { text-align: center; margin-top: 1.5rem; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; }

/* header */
.top { display: flex; align-items: center; gap: .6rem; margin-bottom: 1.25rem; }
.top h1 { font-size: 1.3rem; font-weight: 700; letter-spacing: -.01em; }
.mark { width: 2rem; height: 2rem; }
.mark path { fill: var(--ink); }
.mark .tick { fill: none; stroke: var(--paper); stroke-width: 4; stroke-linecap: round; stroke-linejoin: round; }

/* panels */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; padding: 1.1rem; margin-top: 1rem; }
.note { background: var(--notice); border-radius: 14px; padding: 1rem 1.1rem; margin-top: 1rem; }
.note.warn { background: var(--stop-tint); }
.note p { font-size: .95rem; }
.note .btn { margin-top: .8rem; }
.empty { color: var(--ink-soft); font-size: .95rem; }
.accts { list-style: none; margin: .5rem 0 0; padding: 0; }
.accts li { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .7rem 0; border-top: 1px solid var(--line); }
.accts li:first-child { border-top: 0; }
.who { display: flex; flex-direction: column; min-width: 0; }
.who span { color: var(--ink-soft); font-size: .9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.who em { color: var(--stop); font-size: .85rem; font-style: normal; }
.addf { display: flex; gap: .5rem; margin-top: .75rem; }
.addf input {
  flex: 1; min-width: 0; font: 600 1.15rem/1 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .08em;
  text-transform: uppercase; padding: .75rem .8rem; border-radius: 10px; border: 1px solid var(--line);
  background: var(--paper); color: var(--ink);
}
.bigcode { font: 700 2rem/1.2 ui-monospace, "SF Mono", Menlo, Consolas, monospace; letter-spacing: .1em; text-align: center; margin: 1rem 0; }
.err { color: var(--stop); font-size: .95rem; }

/* buttons */
.btn {
  appearance: none; border: 0; border-radius: 10px; padding: .8rem 1.1rem; font: inherit; font-weight: 650;
  cursor: pointer; color: var(--ink); background: transparent;
}
.btn.solid { background: var(--ink); color: var(--paper); }
.btn.text { padding: .5rem .25rem; color: var(--ink-soft); }
.btn.text.danger { color: var(--stop); }
.btn.wide { display: block; width: 100%; margin-top: .6rem; }
.btn:disabled { opacity: .5; }

/* the sign-in request */
.req { text-align: center; padding-top: .5rem; }
.req-intro { color: var(--ink-soft); font-size: .95rem; margin: 0; }
.req-site { font-size: clamp(1.9rem, 8vw, 2.4rem); font-weight: 750; letter-spacing: -.02em; margin-top: .2rem; overflow-wrap: anywhere; }
.req-domain { font-weight: 600; color: var(--ink-soft); margin-top: .15rem; }
.req-meta { margin: 1.1rem 0 0; padding: .4rem 1rem; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; text-align: left; }
.req-meta div { display: flex; justify-content: space-between; gap: 1rem; padding: .45rem 0; border-top: 1px solid var(--line); font-size: .93rem; }
.req-meta div:first-child { border-top: 0; }
.req-meta dt { color: var(--ink-soft); }
.req-meta dd { margin: 0; text-align: right; overflow-wrap: anywhere; font-weight: 550; }
.req-ask { font-size: 1.05rem; font-weight: 650; margin-top: 1.6rem; }

/* The memorable part: three physical-feeling keys */
.choices { display: grid; grid-template-columns: repeat(3, 1fr); gap: .8rem; margin-top: 1rem; }
.num {
  appearance: none; font: 800 clamp(2.4rem, 13vw, 3.2rem)/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-variant-numeric: tabular-nums; color: var(--ink); background: var(--key);
  border: 1px solid var(--line); border-bottom: 6px solid var(--key-edge); border-radius: 16px;
  padding: 1.3rem 0 1.1rem; cursor: pointer; transition: transform .06s, border-bottom-width .06s;
}
.num:active { transform: translateY(4px); border-bottom-width: 2px; }
.num:disabled { opacity: .55; }
.btn.deny { background: var(--stop-tint); color: var(--stop); margin-top: 1.4rem; }
.timer { color: var(--ink-soft); font-size: .9rem; font-variant-numeric: tabular-nums; margin-top: .9rem; }

/* result */
.result { text-align: center; padding-top: 3rem; }
.result-mark {
  width: 5rem; height: 5rem; margin: 0 auto 1.2rem; border-radius: 50%; display: grid; place-items: center;
  font: 800 2.6rem/1 system-ui, sans-serif; background: var(--line); color: var(--ink);
}
.result.ok .result-mark { background: var(--go); color: #fff; }
.result.bad .result-mark { background: var(--stop); color: #fff; }
.result h1 { font-size: 1.6rem; }
.result p { color: var(--ink-soft); max-width: 24rem; margin: .6rem auto 1.5rem; }

.toast {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + 1.2rem); transform: translateX(-50%);
  background: var(--ink); color: var(--paper); padding: .6rem 1rem; border-radius: 999px; font-size: .95rem; font-weight: 600; white-space: nowrap;
}
@media (prefers-reduced-motion: reduce) { .num { transition: none; } }

/* lock screen */
.lockscreen { text-align: center; padding-top: 3.5rem; }
.lockscreen h1 { font-size: 1.55rem; margin-top: 1.2rem; }
.lockscreen p { color: var(--ink-soft); max-width: 24rem; margin: .6rem auto 0; }
.lockscreen .btn.wide:first-of-type { margin-top: 1.6rem; }
.mark.big { width: 4.5rem; height: 4.5rem; }
.top .push { margin-left: auto; }

/* install */
.note.install { background: var(--surface); border: 2px solid var(--ink); }
.guide {
  border: 0; border-radius: 18px; padding: 1.4rem; width: min(26rem, calc(100vw - 2rem));
  background: var(--surface); color: var(--ink);
}
.guide::backdrop { background: rgba(10, 16, 22, .55); }
.guide h2 { font-size: 1.25rem; }
.guide p { color: var(--ink-soft); font-size: .95rem; }
.steps { margin: 1rem 0 .5rem; padding: 0; list-style: none; counter-reset: s; }
.steps li { counter-increment: s; position: relative; padding: .55rem 0 .55rem 2.6rem; border-top: 1px solid var(--line); }
.steps li:first-child { border-top: 0; }
.steps li::before {
  content: counter(s); position: absolute; left: 0; top: .5rem; width: 1.8rem; height: 1.8rem; border-radius: 50%;
  display: grid; place-items: center; background: var(--ink); color: var(--paper); font-weight: 700; font-size: .9rem;
}
.ico { width: 1.25em; height: 1.25em; vertical-align: -.25em; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico circle { fill: currentColor; stroke: none; }
.share-hint {
  position: fixed; left: 50%; bottom: calc(env(safe-area-inset-bottom, 0px) + .4rem); transform: translateX(-50%);
  z-index: 10; background: var(--ink); color: var(--paper); font-weight: 700; font-size: .9rem;
  padding: .45rem .9rem; border-radius: 999px; display: flex; gap: .4rem; align-items: center;
  animation: nudge 1.1s ease-in-out infinite;
}
.share-hint[hidden] { display: none; }
@keyframes nudge { 50% { transform: translate(-50%, 6px); } }
@media (prefers-reduced-motion: reduce) { .share-hint { animation: none; } }

/* QR scanning */
.hint { color: var(--ink-soft); font-size: .93rem; }
.scanbtn { display: flex; align-items: center; justify-content: center; gap: .5rem; margin-top: .9rem; }
.scanbtn .ico { width: 1.4em; height: 1.4em; }
.or { text-align: center; color: var(--ink-soft); font-size: .88rem; margin: .9rem 0 0; }
.scanner { text-align: center; }
.scanner h1 { font-size: 1.4rem; }
.scanner > p { color: var(--ink-soft); }
.viewfinder { position: relative; margin: 1.1rem auto 0; width: 100%; max-width: 22rem; aspect-ratio: 1; border-radius: 18px; overflow: hidden; background: #000; }
.viewfinder video { width: 100%; height: 100%; object-fit: cover; display: block; }
.frame {
  position: absolute; inset: 16%; border-radius: 14px;
  box-shadow: 0 0 0 999px rgba(0, 0, 0, .35); outline: 3px solid #fff; outline-offset: 0;
}
.scanmsg { min-height: 1.5em; margin-top: .9rem; color: var(--stop); font-weight: 600; }

/* home tabs */
#app:has(.tabbar) { padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 6rem); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 5;
  display: grid; grid-template-columns: 1fr 1fr;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: .35rem max(.75rem, env(safe-area-inset-left, 0px)) calc(env(safe-area-inset-bottom, 0px) + .35rem);
}
.tabbar button {
  appearance: none; border: 0; background: none; color: var(--ink-soft); font: inherit; font-size: .78rem; font-weight: 650;
  display: flex; flex-direction: column; align-items: center; gap: .15rem; padding: .35rem 0; cursor: pointer; position: relative;
}
.tabbar button[aria-selected="true"] { color: var(--ink); }
.tabico { width: 1.6rem; height: 1.6rem; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.tabbar button[aria-selected="true"] .tabico { stroke-width: 2.1; }
.badge {
  position: absolute; top: .1rem; left: calc(50% + .55rem); min-width: 1.15rem; height: 1.15rem; padding: 0 .3rem;
  border-radius: 999px; background: var(--ink); color: var(--paper); font-size: .7rem; line-height: 1.15rem; text-align: center;
}
.idle { text-align: center; padding: 2.2rem 1rem 1.4rem; }
.idle h2 { font-size: 1.15rem; margin-top: .9rem; }
.idle p { color: var(--ink-soft); font-size: .95rem; max-width: 20rem; margin: .4rem auto 0; }
.idle-mark path { fill: var(--line); }
.idle-mark .tick { stroke: var(--ink-soft); }
.summary {
  appearance: none; width: 100%; margin-top: 1rem; display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  text-align: left; font: inherit; color: var(--ink); background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 1rem 1.1rem; cursor: pointer;
}
.summary .sub { display: block; color: var(--ink-soft); font-size: .88rem; font-weight: 400; }
.summary .chev { font-size: 1.6rem; color: var(--ink-soft); line-height: 1; }
