@import url("https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap");

:root {
  --accent: #5b5ce2;
  --accent-dark: #4849c7;
  --accent-soft: color-mix(in srgb, var(--accent) 10%, white);
  --ink: #161823;
  --muted: #6c7080;
  --line: #e7e8ef;
  --surface: #ffffff;
  --canvas: #f7f8fc;
  --warning: #a8610c;
  --warning-bg: #fff7e8;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  font-family: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--canvas);
  -webkit-text-size-adjust: 100%;
}

body {
  min-width: 320px;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 34rem),
    var(--canvas);
  -webkit-font-smoothing: antialiased;
}

button {
  font: inherit;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--accent) 28%, transparent);
  outline-offset: 2px;
}

.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  padding-bottom: calc(112px + var(--safe-bottom));
}

.topbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: 76px minmax(120px, 240px) 76px;
  align-items: center;
  justify-content: center;
  min-height: calc(76px + var(--safe-top));
  padding: calc(12px + var(--safe-top)) 16px 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--line) 75%, transparent);
  background: color-mix(in srgb, var(--canvas) 88%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.nav-button {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  justify-self: start;
  min-width: 44px;
  min-height: 44px;
  padding: 0;
  border: 0;
  color: var(--ink);
  background: transparent;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.nav-button svg {
  width: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-button--close {
  justify-self: end;
  color: var(--muted);
}

.nav-button--hidden {
  visibility: hidden;
  pointer-events: none;
}

.progress-wrap {
  text-align: center;
}

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

.progress-track {
  height: 5px;
  overflow: hidden;
  border-radius: 999px;
  background: #e2e3eb;
}

.progress-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: var(--accent);
  transition: width 400ms cubic-bezier(0.22, 1, 0.36, 1);
}

#stepRoot:focus {
  outline: none;
}

.step {
  width: min(100%, 640px);
  margin: 0 auto;
  padding: 28px 20px 16px;
  animation: step-in 420ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes step-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.step-visual {
  position: relative;
  display: grid;
  place-items: center;
  width: 148px;
  height: 148px;
  margin: 0 auto 30px;
  overflow: hidden;
  border: 1px solid color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 44px;
  background:
    linear-gradient(145deg, color-mix(in srgb, var(--accent) 6%, white), white);
  box-shadow: 0 20px 50px color-mix(in srgb, var(--accent) 12%, transparent);
}

.visual-card {
  position: relative;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: var(--accent);
}

.visual-card svg {
  width: 48px;
  height: 48px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.visual-card span {
  max-width: 112px;
  color: var(--ink);
  font-size: 11px;
  font-weight: 800;
  text-align: center;
}

.visual-orbit {
  position: absolute;
  border: 1px solid color-mix(in srgb, var(--accent) 12%, transparent);
  border-radius: 50%;
}

.visual-orbit--one {
  width: 190px;
  height: 82px;
  transform: rotate(28deg);
}

.visual-orbit--two {
  width: 82px;
  height: 190px;
  transform: rotate(28deg);
}

.step-visual--done {
  background: linear-gradient(145deg, #edfff7, #fff);
  box-shadow: 0 20px 50px rgb(37 178 115 / 12%);
}

.step-visual--done .visual-card {
  color: #1aa56b;
}

.step-copy {
  margin-bottom: 26px;
  text-align: center;
}

h1 {
  margin: 0;
  font-size: clamp(28px, 8vw, 40px);
  font-weight: 800;
  letter-spacing: -0.045em;
  line-height: 1.12;
}

.lead {
  margin: 14px auto 0;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.6;
}

.step-body {
  display: grid;
  gap: 16px;
}

.instruction-list {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.instruction-list li {
  display: grid;
  grid-template-columns: 36px 1fr;
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 14px 10px 10px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.45;
  box-shadow: 0 4px 18px rgb(27 29 43 / 3%);
}

.number {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 13px;
  font-weight: 800;
}

.notice {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  padding: 16px;
  border: 1px solid #f5dfb7;
  border-radius: 18px;
  color: #6f4a18;
  background: var(--warning-bg);
}

.notice svg {
  width: 22px;
  fill: none;
  stroke: #d58a21;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.notice p,
.tip-card p,
.success-note p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
}

.credentials {
  display: grid;
  gap: 10px;
}

.account-list {
  display: grid;
  gap: 12px;
}

.account-card {
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 22px;
  align-items: center;
  gap: 14px;
  width: 100%;
  min-height: 92px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 20px;
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 5px 22px rgb(27 29 43 / 4%);
  text-align: left;
  cursor: pointer;
  transition: border-color 160ms ease, transform 160ms ease, box-shadow 160ms ease;
}

.account-card:active {
  transform: scale(0.985);
}

.account-card:hover {
  border-color: color-mix(in srgb, var(--accent) 38%, var(--line));
  box-shadow: 0 8px 28px color-mix(in srgb, var(--accent) 8%, transparent);
}

.account-card > svg {
  width: 22px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
}

.account-avatar {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 16px;
  color: white;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
  font-size: 15px;
  font-weight: 800;
}

.account-info {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.account-info strong {
  font-size: 14px;
}

.account-info small {
  overflow: hidden;
  color: var(--muted);
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-info > span {
  margin-top: 3px;
  color: var(--accent);
  font-size: 10px;
  font-weight: 800;
}

.package-picker {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.package-picker > p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.package-option {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 46px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 13px;
  color: var(--ink);
  background: var(--canvas);
  font-size: 13px;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.package-option--selected {
  border-color: color-mix(in srgb, var(--accent) 48%, transparent);
  background: var(--accent-soft);
}

.package-radio {
  width: 17px;
  height: 17px;
  border: 2px solid #c9cbd5;
  border-radius: 50%;
}

.package-option--selected .package-radio {
  border: 5px solid var(--accent);
}

.credential-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 14px 14px 16px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
  box-shadow: 0 4px 18px rgb(27 29 43 / 3%);
}

.credential-content {
  display: grid;
  min-width: 0;
  margin-right: auto;
}

.credential-label {
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
}

.credential-value {
  overflow: hidden;
  font-size: 14px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
  user-select: all;
}

.credential-value--password {
  letter-spacing: 0.02em;
}

.copy-button {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 6px;
  min-height: 42px;
  padding: 0 11px;
  border: 0;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  font-size: 11px;
  font-weight: 800;
  cursor: pointer;
}

.copy-button svg {
  width: 17px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.tip-card,
.success-note {
  display: grid;
  grid-template-columns: 40px 1fr;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.tip-icon,
.success-note > span {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  color: white;
  background: var(--accent);
  font-size: 15px;
  font-weight: 800;
}

.success-note > span {
  color: #178958;
  background: #e8fbf2;
}

.success-note svg {
  width: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.text-link {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 4px;
  border: 0;
  color: var(--accent);
  background: transparent;
  font-size: 13px;
  font-weight: 800;
  text-align: left;
  cursor: pointer;
}

.text-link svg {
  width: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

.text-link--center {
  justify-content: center;
}

.install-status {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--surface);
}

.app-placeholder {
  display: grid;
  place-items: center;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  color: white;
  background: linear-gradient(145deg, var(--accent), var(--accent-dark));
}

.app-placeholder svg {
  width: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.install-status > div {
  display: grid;
  gap: 3px;
}

.install-status strong {
  font-size: 14px;
}

.install-status div span {
  color: var(--muted);
  font-size: 11px;
}

.status-pulse {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--accent) 35%, transparent);
  animation: pulse 1.8s infinite;
}

@keyframes pulse {
  70% {
    box-shadow: 0 0 0 8px transparent;
  }
  100% {
    box-shadow: 0 0 0 0 transparent;
  }
}

.action-bar {
  position: fixed;
  z-index: 15;
  right: 0;
  bottom: 0;
  left: 0;
  padding: 12px 16px calc(12px + var(--safe-bottom));
  border-top: 1px solid color-mix(in srgb, var(--line) 80%, transparent);
  background: color-mix(in srgb, var(--canvas) 90%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
}

.action-bar--hidden {
  display: none;
}

.action-inner {
  display: flex;
  gap: 10px;
  width: min(100%, 600px);
  margin: 0 auto;
}

.button {
  display: inline-flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  gap: 9px;
  min-height: 56px;
  padding: 0 18px;
  border: 0;
  border-radius: 17px;
  font-size: 14px;
  font-weight: 800;
  cursor: pointer;
  transition: transform 150ms ease, background 150ms ease;
}

.button:active {
  transform: scale(0.98);
}

.button svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.button--primary {
  color: white;
  background: var(--accent);
  box-shadow: 0 10px 28px color-mix(in srgb, var(--accent) 28%, transparent);
}

.button--primary:hover {
  background: color-mix(in srgb, var(--accent) 88%, black);
}

.button--secondary {
  border: 1px solid var(--line);
  color: var(--ink);
  background: white;
}

.button--danger {
  color: #b42318;
  background: #fff0ee;
}

.toast {
  position: fixed;
  z-index: 50;
  top: calc(86px + var(--safe-top));
  left: 50%;
  padding: 11px 16px;
  border-radius: 999px;
  color: white;
  background: #22242e;
  box-shadow: 0 8px 28px rgb(0 0 0 / 18%);
  font-size: 12px;
  font-weight: 800;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -8px);
  transition: 200ms ease;
}

.toast--visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

.close-dialog {
  width: min(calc(100% - 32px), 390px);
  padding: 26px;
  border: 0;
  border-radius: 26px;
  color: var(--ink);
  background: white;
  box-shadow: 0 24px 70px rgb(18 20 29 / 24%);
  text-align: center;
}

.close-dialog::backdrop {
  background: rgb(22 24 35 / 48%);
  -webkit-backdrop-filter: blur(4px);
  backdrop-filter: blur(4px);
}

.dialog-icon {
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin: 0 auto 18px;
  border-radius: 16px;
  color: #c37819;
  background: #fff5e3;
}

.dialog-icon svg {
  width: 25px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
}

.close-dialog h2 {
  margin: 0;
  font-size: 22px;
  letter-spacing: -0.03em;
}

.close-dialog p {
  margin: 10px 0 22px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.dialog-actions {
  display: flex;
  gap: 10px;
}

@media (max-width: 390px) {
  .topbar {
    grid-template-columns: 60px minmax(118px, 1fr) 60px;
    padding-inline: 12px;
  }

  .nav-button span {
    font-size: 11px;
  }

  .copy-button span {
    display: none;
  }

  .action-inner:has(.button--secondary) {
    flex-direction: column-reverse;
  }

  .app-shell:has(.action-inner .button--secondary) {
    padding-bottom: calc(180px + var(--safe-bottom));
  }
}

@media (min-width: 700px) {
  .app-shell {
    padding-bottom: 122px;
  }

  .topbar {
    grid-template-columns: 110px 300px 110px;
    padding-inline: 32px;
  }

  .step {
    padding-top: 42px;
  }

  .step-visual {
    width: 172px;
    height: 172px;
    border-radius: 52px;
  }

  .lead {
    font-size: 16px;
  }

  .instruction-list li {
    min-height: 64px;
    padding-right: 18px;
    font-size: 15px;
  }
}

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