body {
  background: #f0f4ff;
  color: #111827;
  font-family: system-ui, -apple-system, sans-serif;
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}
.page { max-width: 480px; margin: 0 auto; padding: 1.25rem 1rem 3rem; }

.brand { font-size: 1.1rem; font-weight: 800; color: #111827; letter-spacing: -.3px; }
.brand span { color: #4f46e5; }

.section {
  background: #fff; border: 1px solid #e0e7ff;
  border-radius: 14px; padding: 1.25rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 8px rgba(79,70,229,.06);
}
.section-title {
  font-size: .78rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: #6366f1; margin-bottom: .9rem;
}
.form-label {
  font-size: .85rem; font-weight: 600; color: #374151; margin-bottom: .3rem;
}
.form-control {
  background: #f9fafb; border: 1.5px solid #d1d5db;
  color: #111827; border-radius: 9px; font-size: 1rem;
}
.form-control::placeholder { color: #9ca3af; }
.form-control:focus {
  background: #fff; border-color: #6366f1;
  box-shadow: 0 0 0 3px rgba(99,102,241,.18); color: #111827;
}
.form-control[readonly] {
  background: #eff6ff !important; border-color: #93c5fd !important;
  color: #1d4ed8 !important; cursor: default;
}
textarea.form-control { resize: none; }

.pin-wrap { position: relative; }
.pin-wrap input { letter-spacing: .2em; font-size: 1.1rem; padding-right: 3rem; }
.pin-toggle {
  position: absolute; right: .75rem; top: 50%; transform: translateY(-50%);
  background: none; border: none; color: #6b7280; cursor: pointer;
  font-size: .85rem; padding: 0;
}
.pin-toggle:hover { color: #374151; }
.pin-strength { font-size: .75rem; margin-top: .35rem; min-height: 1.1rem; }

.origin-note {
  font-size: .82rem; color: #4b5563; line-height: 1.5;
  background: #eef2ff; border-radius: 8px; padding: .65rem .85rem;
  margin-bottom: .9rem; border-left: 3px solid #6366f1;
}
.did-display {
  font-size: .7rem; font-family: monospace; color: #4f46e5;
  word-break: break-all; background: #eef2ff;
  padding: .4rem .6rem; border-radius: 6px; margin-top: .5rem;
  display: none;
}

/* Existing identity banner */
#existing-identity {
  background: #f0fdf4; border: 1.5px solid #86efac;
  border-radius: 10px; padding: .9rem; margin-bottom: 1rem;
  display: none;
}
#existing-identity .label { font-size: .75rem; font-weight: 700;
                            color: #166534; margin-bottom: .25rem; }
#existing-identity .did   { font-size: .68rem; font-family: monospace;
                            color: #15803d; word-break: break-all; }
.btn-clear-id {
  margin-top: .5rem; background: none; border: 1px solid #dc2626;
  border-radius: 7px; color: #dc2626; font-size: .72rem; font-weight: 600;
  padding: .25rem .65rem; cursor: pointer;
}
.btn-clear-id:hover { background: #fef2f2; }

.btn-launch {
  background: #4f46e5; border: none; border-radius: 11px;
  color: #fff; font-weight: 700; font-size: 1rem;
  padding: .85rem; width: 100%; cursor: pointer;
  transition: background .15s;
}
.btn-launch:hover:not(:disabled) { background: #4338ca; }
.btn-launch:disabled { opacity: .55; cursor: not-allowed; }

/* Clear identity link (always visible for testing) */
#clear-link {
  display: block; text-align: center; margin-top: .75rem;
  font-size: .72rem; color: #9ca3af; cursor: pointer;
  text-decoration: underline;
}
#clear-link:hover { color: #dc2626; }

/* Error box */
#error-box {
  display: none; background: #fef2f2; border: 1px solid #fca5a5;
  border-radius: 10px; padding: .75rem 1rem; margin-top: .75rem;
  font-size: .85rem; color: #991b1b;
}

/* ── Launch status popup ── */
#launch-popup {
  display: none; position: fixed; inset: 0;
  background: rgba(15,17,30,.55); z-index: 9999;
  align-items: center; justify-content: center;
}
#launch-popup.open { display: flex; }
#popup-box {
  background: #fff; border-radius: 18px; padding: 1.5rem 1.75rem;
  max-width: 340px; width: 90%;
  box-shadow: 0 24px 64px rgba(0,0,0,.28);
}
#popup-title {
  font-size: .95rem; font-weight: 700; color: #374151; margin-bottom: 1.1rem;
}
.step-row {
  display: flex; align-items: center; gap: .55rem;
  font-size: .84rem; color: #9ca3af; padding: .28rem 0;
}
.step-icon { width: 18px; text-align: center; font-size: .85rem; flex-shrink: 0; }
.step-row.done   { color: #16a34a; }
.step-row.active { color: #4f46e5; font-weight: 600; }
.step-row.error  { color: #dc2626; }
#popup-error {
  display: none; background: #fef2f2; border: 1px solid #fca5a5;
  border-radius: 9px; padding: .6rem .85rem; margin-top: .9rem;
  font-size: .82rem; color: #991b1b;
}
#popup-dismiss {
  display: none; margin-top: .85rem; width: 100%;
  background: #f3f4f6; border: none; border-radius: 9px;
  padding: .6rem; font-size: .85rem; font-weight: 600;
  color: #374151; cursor: pointer;
}
#popup-dismiss:hover { background: #e5e7eb; }

/* Success screen */
#success {
  display: none; text-align: center;
  background: #fff; border-radius: 14px;
  padding: 2rem 1.5rem; margin-top: 1.5rem;
  border: 1px solid #bbf7d0;
  box-shadow: 0 4px 20px rgba(22,163,74,.1);
}
.success-icon { font-size: 3rem; margin-bottom: .75rem; }
.success-title { font-size: 1.2rem; font-weight: 700; color: #15803d; }
.success-sub { font-size: .85rem; color: #4b5563; margin-top: .4rem; line-height: 1.5; }
