:root {
  color-scheme: dark;
  --background: #0f0f23;
  --surface: #18182f;
  --surface-raised: #222241;
  --text: #f8fafc;
  --muted: #b9bdd0;
  --primary: #a78bfa;
  --primary-strong: #7c3aed;
  --action: #f43f5e;
  --action-hover: #fb7185;
  --border: #393963;
  --success: #34d399;
  --danger: #fb7185;
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Display", "PingFang SC", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  background:
    radial-gradient(circle at 10% 0%, rgb(124 58 237 / 24%), transparent 38%),
    radial-gradient(circle at 95% 85%, rgb(244 63 94 / 16%), transparent 34%),
    var(--background);
  color: var(--text);
}

button,
input { font: inherit; }

button,
a { -webkit-tap-highlight-color: transparent; }

.shell {
  width: 100%;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: max(20px, env(safe-area-inset-top)) 16px max(24px, env(safe-area-inset-bottom));
}

.install-card {
  width: 100%;
  max-width: 480px;
  padding: 28px 22px 24px;
  border: 1px solid var(--border);
  border-radius: 28px;
  background: rgb(24 24 47 / 94%);
  box-shadow: 0 28px 80px rgb(0 0 0 / 35%);
}

.brand-mark {
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  margin-bottom: 18px;
  border-radius: 20px;
  color: var(--primary);
  background: linear-gradient(145deg, rgb(124 58 237 / 22%), rgb(244 63 94 / 18%));
  border: 1px solid rgb(167 139 250 / 34%);
}

.brand-mark svg { width: 42px; height: 42px; }

.eyebrow {
  margin: 0 0 8px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: .16em;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  font-size: clamp(30px, 9vw, 42px);
  line-height: 1.08;
  letter-spacing: -.04em;
}

.intro {
  margin: 16px 0 22px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.65;
}

.notice {
  margin: 0 0 18px;
  padding: 12px 14px;
  border: 1px solid rgb(244 63 94 / 42%);
  border-radius: 14px;
  color: #fecdd3;
  background: rgb(244 63 94 / 10%);
  line-height: 1.5;
}

.steps {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin: 0 0 24px;
  padding: 0;
  list-style: none;
}

.steps li {
  min-width: 0;
  color: #7f849e;
  font-size: 11px;
  text-align: center;
}

.steps span {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  margin: 0 auto 7px;
  border: 1px solid var(--border);
  border-radius: 50%;
  background: var(--surface);
  font-weight: 800;
}

.steps strong {
  display: block;
  overflow-wrap: anywhere;
  font-weight: 650;
}

.steps li.active,
.steps li.complete { color: var(--text); }

.steps li.active span {
  border-color: var(--primary);
  color: #fff;
  background: var(--primary-strong);
  box-shadow: 0 0 0 5px rgb(124 58 237 / 16%);
}

.steps li.complete span {
  border-color: var(--success);
  color: #052e24;
  background: var(--success);
}

.consent-panel,
.status-panel {
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 18px;
  background: var(--surface-raised);
}

.consent-panel h2,
.status-panel h2 {
  margin: 0 0 9px;
  font-size: 18px;
}

.consent-panel p,
.status-panel p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.consent-row {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  margin-top: 16px;
  cursor: pointer;
  line-height: 1.5;
}

.consent-row input {
  width: 22px;
  height: 22px;
  flex: 0 0 auto;
  margin: 0;
  accent-color: var(--action);
}

.consent-row a {
  color: var(--primary);
  font-weight: 700;
  text-underline-offset: 3px;
}

.status-panel { text-align: center; }

.status-orb {
  width: 46px;
  height: 46px;
  margin: 0 auto 14px;
  border: 4px solid rgb(167 139 250 / 20%);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin .9s ease-in-out infinite;
}

.status-panel.ready .status-orb,
.status-panel.failed .status-orb {
  animation: none;
  border-color: currentColor;
  background: currentColor;
  box-shadow: inset 0 0 0 12px var(--surface-raised);
}

.status-panel.ready { color: var(--success); }
.status-panel.failed { color: var(--danger); }

.settings-guide {
  display: grid;
  gap: 6px;
  margin-top: 16px;
  padding: 13px;
  border-radius: 13px;
  color: var(--text);
  background: rgb(15 15 35 / 58%);
  font-size: 13px;
  line-height: 1.5;
  text-align: left;
}

.settings-guide span { color: var(--muted); }

.primary-action,
.secondary-action {
  width: 100%;
  min-height: 52px;
  margin-top: 18px;
  padding: 13px 18px;
  border: 0;
  border-radius: 16px;
  cursor: pointer;
  font-weight: 800;
  transition: background-color 180ms ease, border-color 180ms ease, opacity 180ms ease;
}

.stack-card { margin-top: 12px; }

.action-link {
  display: grid;
  place-items: center;
  text-decoration: none;
}

.primary-action {
  color: white;
  background: var(--action);
  box-shadow: 0 14px 36px rgb(244 63 94 / 24%);
}

.primary-action:hover { background: var(--action-hover); }
.primary-action:disabled { cursor: not-allowed; opacity: .42; box-shadow: none; }

.secondary-action {
  margin-top: 10px;
  color: var(--text);
  border: 1px solid var(--border);
  background: transparent;
}

button:focus-visible,
a:focus-visible,
input:focus-visible {
  outline: 3px solid var(--primary);
  outline-offset: 3px;
}

.footnote {
  margin: 18px 4px 0;
  color: #9297ae;
  font-size: 12px;
  line-height: 1.55;
  text-align: center;
}

.release-version {
  width: fit-content;
  margin: 12px auto 0;
  padding: 4px 9px;
  border: 1px solid rgb(167 139 250 / 26%);
  border-radius: 999px;
  color: var(--muted);
  background: rgb(15 15 35 / 46%);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
  line-height: 1.4;
  text-align: center;
}

[hidden] { display: none !important; }

@keyframes spin { to { transform: rotate(360deg); } }

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --background: #f6f5ff;
    --surface: #fff;
    --surface-raised: #f5f3ff;
    --text: #17152c;
    --muted: #55536b;
    --border: #ddd8f4;
  }

  body {
    background:
      radial-gradient(circle at 10% 0%, rgb(124 58 237 / 12%), transparent 38%),
      radial-gradient(circle at 95% 85%, rgb(244 63 94 / 8%), transparent 34%),
      var(--background);
  }

  .install-card { background: rgb(255 255 255 / 96%); box-shadow: 0 24px 72px rgb(48 35 89 / 13%); }
  .settings-guide { background: rgb(255 255 255 / 74%); }
  .release-version { background: rgb(245 243 255 / 88%); }
}

@media (min-width: 768px) {
  .install-card { padding: 38px 38px 30px; }
  .shell { padding: 40px 24px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}
