* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Apple SD Gothic Neo", "Segoe UI", Roboto, sans-serif;
  background:
    radial-gradient(80% 50% at 50% -10%, color-mix(in srgb, var(--teal) 22%, transparent), transparent 70%),
    var(--bg);
  color: var(--text);
  min-height: 100vh;
  display: flex; flex-direction: column; align-items: center;
  padding: max(36px, env(safe-area-inset-top)) 18px 40px;
  -webkit-font-smoothing: antialiased;
}
b { color: var(--text); font-weight: 650; }

.hero { text-align: center; }
.logo { width: 76px; height: 76px; border-radius: 18px; box-shadow: 0 10px 30px rgba(0,0,0,.35); }
h1 { font-size: 26px; font-weight: 750; margin-top: 12px; letter-spacing: -.01em; }
.tagline { color: var(--muted); font-size: 15px; margin-top: 6px; line-height: 1.5; }
h2 { font-size: 19px; font-weight: 700; text-align: center; margin-bottom: 8px; }

/* three-step tracker */
.track { list-style: none; display: flex; gap: 8px; margin: 26px 0 18px; width: 100%; max-width: 360px; }
.track li {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 12px; color: var(--muted); position: relative;
}
.track li + li::before {
  content: ""; position: absolute; top: 13px; right: 50%; width: 100%; height: 2px;
  background: var(--line); z-index: -1;
}
.track .dot {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center;
  font-weight: 700; font-size: 13px; background: var(--panel); border: 2px solid var(--line);
  transition: all .4s ease;
}
.track li.on { color: var(--text); }
.track li.on .dot { border-color: var(--teal); color: var(--teal); box-shadow: 0 0 0 6px color-mix(in srgb, var(--teal) 18%, transparent); }
.track li.done .dot { background: var(--teal); border-color: var(--teal); color: var(--bg); }
.track li.done + li::before, .track li.on::before { background: var(--teal); }

main { width: 100%; max-width: 380px; }
.panel {
  display: none; background: var(--panel); border: 1px solid var(--line); border-radius: 20px;
  padding: 24px 20px; text-align: center; animation: rise .45s cubic-bezier(.2,.8,.2,1);
}
body[data-stage="enroll"] [data-for="enroll"],
body[data-stage="profile"] [data-for="profile"],
body[data-stage="sign"] [data-for="sign"],
body[data-stage="ready"] [data-for="ready"],
body[data-stage="installing"] [data-for="installing"],
body[data-stage="devmode"] [data-for="devmode"],
body[data-stage="error"] [data-for="error"],
body[data-stage="desktop"] [data-for="desktop"] { display: block; }
@keyframes rise { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: none; } }

.lead, .note { color: var(--muted); font-size: 14.5px; line-height: 1.6; }
.note { margin-top: 10px; }
.wait-note:empty { display: none; }
.wait-note { color: var(--teal); }
.btn {
  display: block; width: 100%; padding: 16px; margin-top: 18px;
  background: var(--teal); color: #06161a; font-size: 17px; font-weight: 700;
  border-radius: 14px; text-decoration: none; text-align: center;
  transition: transform .15s ease, filter .15s ease;
}
.btn:active { transform: scale(.97); filter: brightness(.92); }
.btn.pulse { animation: pulse 1.8s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--teal) 55%, transparent); }
  50% { box-shadow: 0 0 0 14px transparent; }
}
.link { display: inline-block; margin-top: 16px; color: var(--teal); font-size: 14px; text-decoration: none; }
.status.err { color: var(--down); font-size: 15px; line-height: 1.5; }

/* Settings look-alike that shows where to tap */
.phone-mock {
  margin: 16px auto 18px; max-width: 260px; text-align: left;
  background: color-mix(in srgb, var(--bg) 70%, #000); border: 1px solid var(--line);
  border-radius: 22px; padding: 14px 12px 12px;
}
.pm-title { font-size: 20px; font-weight: 750; margin: 2px 4px 10px; }
.pm-row {
  display: flex; align-items: center; gap: 10px; padding: 10px; margin-top: 6px;
  background: var(--panel); border-radius: 12px; font-size: 14px; position: relative;
}
.pm-avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--line); flex: none; }
.pm-ico { width: 22px; height: 22px; border-radius: 6px; flex: none; }
.pm-ico.c1 { background: #ff9f0a; } .pm-ico.c2 { background: #0a84ff; }
.pm-gear { width: 22px; height: 22px; border-radius: 6px; flex: none; background: #8e8e93; }
.pm-line { height: 9px; border-radius: 5px; background: var(--line); }
.w40 { width: 40%; } .w50 { width: 50%; } .w60 { width: 60%; }
.pm-chev { margin-left: auto; color: var(--muted); }
.pm-hit { outline: 2px solid var(--teal); animation: glow 1.6s ease-in-out infinite; font-weight: 600; }
@keyframes glow { 50% { outline-color: transparent; background: color-mix(in srgb, var(--teal) 16%, var(--panel)); } }
.tap {
  position: absolute; right: 26px; top: 50%; width: 26px; height: 26px; margin-top: -13px;
  border-radius: 50%; background: rgba(255,255,255,.55); animation: tap 1.6s ease-out infinite;
}
@keyframes tap {
  0% { transform: scale(.4); opacity: 0; } 25% { transform: scale(1); opacity: .9; }
  60% { transform: scale(1.8); opacity: 0; } 100% { opacity: 0; }
}
.howto { text-align: left; margin: 0 auto; max-width: 290px; padding-left: 20px; color: var(--muted); font-size: 14.5px; line-height: 1.9; }
.waiting { margin-top: 14px; }
.spinner {
  display: inline-block; width: 22px; height: 22px; border-radius: 50%;
  border: 3px solid var(--line); border-top-color: var(--teal); animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* signing progress */
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; margin: 18px 0 16px; }
.bar-fill {
  height: 100%; width: 3%; border-radius: 4px; transition: width .8s ease;
  background: linear-gradient(90deg, var(--teal), color-mix(in srgb, var(--teal) 55%, #fff), var(--teal));
  background-size: 200% 100%; animation: shimmer 1.6s linear infinite;
}
@keyframes shimmer { to { background-position: -200% 0; } }
.checks { list-style: none; text-align: left; }
.checks li { display: flex; align-items: center; gap: 12px; padding: 9px 2px; font-size: 15px; color: var(--muted); }
.checks .mark { width: 22px; height: 22px; flex: none; border-radius: 50%; border: 2px solid var(--line); display: grid; place-items: center; }
.checks li.active { color: var(--text); }
.checks li.active .mark { border-color: var(--line); border-top-color: var(--teal); animation: spin .9s linear infinite; }
.checks li.done { color: var(--text); }
.checks li.done .mark { background: var(--teal); border-color: var(--teal); animation: pop .35s ease; }
.checks li.done .mark::after { content: ""; width: 6px; height: 10px; border: solid #06161a; border-width: 0 2.5px 2.5px 0; transform: translateY(-1px) rotate(45deg); }
@keyframes pop { 0% { transform: scale(.5); } 70% { transform: scale(1.15); } 100% { transform: none; } }

/* ready */
.ready-icon img { width: 84px; height: 84px; border-radius: 20px; animation: float 3s ease-in-out infinite; }
.ready-icon { margin-bottom: 12px; }
@keyframes float { 50% { transform: translateY(-6px); } }

/* installing: the icon fills like the Home Screen one does */
.ring-wrap { position: relative; width: 132px; height: 132px; margin: 4px auto 14px; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 7; }
.ring-fg { fill: none; stroke: var(--teal); stroke-width: 7; stroke-linecap: round; stroke-dasharray: 339.3; stroke-dashoffset: 339.3; transition: stroke-dashoffset .9s linear; }
.ring-icon { position: absolute; inset: 22px; width: 88px; height: 88px; border-radius: 20px; filter: grayscale(1) brightness(.6); transition: filter 1s ease; }
.ring-wrap.full .ring-icon { filter: none; }

.site-link { display: block; margin-top: 20px; padding: 12px; background: color-mix(in srgb, var(--teal) 12%, transparent); border-radius: 10px; font-weight: 600; }
.qr { width: 200px; height: 200px; background: #fff; padding: 10px; border-radius: 14px; margin: 14px auto 4px; display: block; }

.inapp-hint { display: none; margin-top: 18px; font-size: 13px; color: var(--muted); text-align: center; }
.inapp-hint a { color: var(--teal); text-decoration: none; }
body.maybe-inapp .inapp-hint { display: block; }

.langs { margin-top: 26px; display: flex; gap: 14px; }
.langs a { color: var(--muted); font-size: 13px; text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 2px; }

/* in-app browser sheet */
.sheet { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; z-index: 10; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.sheet[hidden] { display: none; }
.sheet-card {
  width: 100%; max-width: 440px; background: var(--panel); border-radius: 24px 24px 0 0;
  padding: 26px 22px calc(26px + env(safe-area-inset-bottom)); text-align: center;
  animation: up .4s cubic-bezier(.2,.8,.2,1);
}
.sheet-card p { color: var(--muted); font-size: 14.5px; line-height: 1.6; margin-top: 6px; }
@keyframes up { from { transform: translateY(100%); } to { transform: none; } }
.safari-ico {
  width: 64px; height: 64px; margin: 0 auto 12px; border-radius: 50%;
  background: conic-gradient(from 45deg, #1e90ff, #36c5f0, #1e90ff);
  position: relative; animation: float 3s ease-in-out infinite;
}
.safari-ico::after {
  content: ""; position: absolute; left: 50%; top: 12px; width: 8px; height: 40px; margin-left: -4px;
  background: linear-gradient(#ff3b30 50%, #fff 50%); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%);
  transform: rotate(45deg);
}

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