:root {
  --gold: #d4af37;
  --gold-light: #f7ecc6;
  --ink: #20221f;
  --muted: #747870;
  --line: #e7e8e2;
  --paper: #fff;
  --canvas: #f8f9f5;
  --green: #31775a;
  --red: #c0392b;
  --radius: 24px;
  font-family: Manrope, system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; }
/* The HTML `hidden` attribute must always win over class-based display
   rules (e.g. `.checklist{display:flex}`) — author CSS otherwise beats the
   UA stylesheet's unqualified `[hidden]{display:none}` at equal specificity. */
[hidden] { display: none !important; }
html, body { height: 100%; }
body {
  margin: 0; font-size: 15px; line-height: 1.55; color: var(--ink);
  background: var(--canvas); min-height: 100vh;
  display: flex; align-items: center; justify-content: center;
  padding: 32px 16px; position: relative; overflow-x: hidden;
}
button, input { font: inherit; }
button { cursor: pointer; border: none; background: none; }
svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

/* ===== Animated background ===== */
.install-bg { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; }
.blob {
  position: absolute; border-radius: 50%; filter: blur(80px); opacity: .5;
  animation: float 16s ease-in-out infinite;
}
.blob-1 { width: 480px; height: 480px; background: var(--gold); top: -180px; left: -140px; }
.blob-2 { width: 420px; height: 420px; background: #a8e6cf; bottom: -160px; right: -120px; animation-delay: -8s; }
@keyframes float {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(40px, -30px) scale(1.08); }
}

.wrap { position: relative; z-index: 1; width: 100%; max-width: 640px; }
.wrap[hidden] { display: none !important; }

/* ===== Wizard Card ===== */
.wizard-card {
  background: var(--paper); border-radius: var(--radius);
  padding: 44px 48px 40px; box-shadow: 0 40px 120px #20221f1a;
  animation: card-in .5s cubic-bezier(.22,1,.36,1);
}
@keyframes card-in {
  from { opacity: 0; transform: translateY(24px) scale(.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.wizard-logo {
  font-size: 24px; font-weight: 800; letter-spacing: -.02em;
  margin-bottom: 28px; text-align: center;
}
.logo-dot { color: var(--gold); }

/* ===== Stepper ===== */
.stepper { display: flex; align-items: center; margin-bottom: 36px; }
.step-line { flex: 1; height: 2px; background: var(--line); margin: 0 4px; transition: background .4s; }
.step-line.done { background: var(--green); }

.step-dot {
  display: flex; flex-direction: column; align-items: center; gap: 6px; flex-shrink: 0;
}
.step-dot span {
  width: 30px; height: 30px; border-radius: 50%;
  background: var(--canvas); border: 2px solid var(--line);
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 800; color: var(--muted);
  transition: all .3s cubic-bezier(.22,1,.36,1);
}
.step-dot label { font-size: 10px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; display: none; }
.step-dot.active span { background: var(--gold); border-color: var(--gold); color: var(--ink); transform: scale(1.15); }
.step-dot.done span { background: var(--green); border-color: var(--green); color: #fff; }
.step-dot.done span::after { content: '✓'; }

@media (min-width: 560px) {
  .step-dot label { display: block; }
}

/* ===== Steps ===== */
.step-viewport { position: relative; min-height: 320px; }
.step { display: none; animation: step-in .4s cubic-bezier(.22,1,.36,1); }
.step.active { display: block; }
@keyframes step-in {
  from { opacity: 0; transform: translateX(16px); }
  to { opacity: 1; transform: translateX(0); }
}

.eyebrow {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted); margin-bottom: 10px;
}
.step h1 { font-size: 28px; font-weight: 800; letter-spacing: -.01em; margin-bottom: 10px; }
.lead { color: var(--muted); font-size: 15px; margin-bottom: 24px; max-width: 46ch; }

.feature-list { list-style: none; padding: 0; margin: 0 0 32px; display: flex; flex-direction: column; gap: 12px; }
.feature-list li {
  display: flex; align-items: center; gap: 12px; font-size: 14px; font-weight: 600;
  background: var(--canvas); padding: 12px 16px; border-radius: 14px;
}
.feature-list svg { color: var(--green); flex-shrink: 0; }

/* ===== Checklist (DB step) ===== */
.checklist { display: flex; flex-direction: column; gap: 10px; margin-bottom: 32px; }
.check-item {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; border-radius: 14px; background: var(--canvas);
  font-size: 14px; font-weight: 600; color: var(--muted);
  opacity: .4; transition: opacity .3s;
}
.check-item.pending { opacity: 1; }
.check-item.done { opacity: 1; color: var(--ink); }
.check-icon {
  width: 20px; height: 20px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--line); position: relative; transition: all .3s;
}
.check-item.pending .check-icon {
  border-color: var(--gold); border-top-color: transparent;
  animation: spin .7s linear infinite;
}
.check-item.done .check-icon { background: var(--green); border-color: var(--green); }
.check-item.done .check-icon::after {
  content: ''; position: absolute; left: 5px; top: 2px;
  width: 5px; height: 9px; border: solid #fff; border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Forms ===== */
form { margin-bottom: 24px; }
.field-group { margin-bottom: 18px; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-group label { display: block; font-size: 13px; font-weight: 700; margin-bottom: 6px; }
.field-group input {
  width: 100%; padding: 13px 16px; border: 1.5px solid var(--line);
  border-radius: 12px; font-size: 15px; outline: none; color: var(--ink);
  transition: border-color .2s, box-shadow .2s;
}
.field-group input:focus { border-color: var(--gold); box-shadow: 0 0 0 4px #d4af3730; }

.strength-bar { height: 4px; border-radius: 4px; background: var(--line); margin-top: 8px; overflow: hidden; }
.strength-bar span {
  display: block; height: 100%; width: 0%; border-radius: 4px;
  background: var(--red); transition: width .3s, background .3s;
}

.field-error {
  background: #fde8e8; color: var(--red); padding: 12px 16px;
  border-radius: 12px; font-size: 13px; font-weight: 600; margin-top: 4px;
}
.field-error[hidden] { display: none !important; }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  background: var(--canvas); padding: 16px 18px; border-radius: 14px; cursor: pointer;
}
.toggle-row strong { display: block; font-size: 14px; font-weight: 700; }
.toggle-row small { display: block; color: var(--muted); font-size: 12px; margin-top: 3px; max-width: 40ch; }

.toggle { position: relative; display: inline-block; width: 46px; height: 26px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; cursor: pointer; background: var(--line); border-radius: 26px; transition: .3s; }
.toggle-slider::before {
  content: ''; position: absolute; height: 20px; width: 20px; left: 3px; bottom: 3px;
  background: #fff; border-radius: 50%; transition: .3s; box-shadow: 0 2px 4px #0002;
}
.toggle input:checked + .toggle-slider { background: var(--green); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }

/* ===== Buttons ===== */
.step-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 8px; }
.step-actions.center { justify-content: center; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--ink); color: #fff; text-decoration: none;
  font-weight: 700; font-size: 15px; padding: 14px 26px;
  border-radius: 100px; transition: transform .15s, opacity .2s;
}
.btn-primary:hover { opacity: .88; transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn-primary svg { width: 16px; height: 16px; }

.btn-ghost {
  display: inline-flex; align-items: center; gap: 8px;
  background: none; color: var(--muted); text-decoration: none;
  font-weight: 700; font-size: 14px; padding: 14px 18px;
}
.btn-ghost:hover { color: var(--ink); }

.btn-secondary {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--canvas); color: var(--ink); border: 1.5px solid var(--line);
  font-weight: 700; font-size: 14px; padding: 12px 22px;
  border-radius: 100px; transition: border-color .2s, transform .15s;
}
.btn-secondary:hover { border-color: var(--gold); transform: translateY(-1px); }
.btn-secondary:disabled { opacity: .5; cursor: not-allowed; transform: none; }

.field-success {
  background: #e8f5ee; color: var(--green); padding: 12px 16px;
  border-radius: 12px; font-size: 13px; font-weight: 600; margin-top: 4px;
}
.field-success[hidden] { display: none !important; }

/* ===== Center card (already installed) ===== */
.center-card { text-align: center; padding: 56px 48px; }
.center-card h1 { font-size: 24px; font-weight: 800; margin: 20px 0 10px; }
.center-card p { color: var(--muted); margin-bottom: 28px; }
.center-card .btn-primary { margin-right: 10px; }

/* ===== Check badges ===== */
.check-badge {
  width: 64px; height: 64px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; margin: 0 auto;
}
.check-badge.success { background: #e8f5ee; color: var(--green); }
.check-badge.error { background: #fde8e8; color: var(--red); }
.check-badge svg { width: 30px; height: 30px; }
.check-badge.big { width: 84px; height: 84px; animation: pop-in .5s cubic-bezier(.22,1,.36,1); }
.check-badge.big svg { width: 40px; height: 40px; }
@keyframes pop-in {
  0% { transform: scale(0); opacity: 0; }
  60% { transform: scale(1.15); opacity: 1; }
  100% { transform: scale(1); }
}

/* ===== Finish screen ===== */
.finish-screen { text-align: center; padding: 24px 0; }
.finish-screen[hidden] { display: none !important; }
.finish-screen h1 { font-size: 24px; font-weight: 800; margin: 20px 0 10px; }
.finish-screen .lead { margin-left: auto; margin-right: auto; }

.spinner {
  width: 52px; height: 52px; border-radius: 50%;
  border: 4px solid var(--gold-light); border-top-color: var(--gold);
  margin: 0 auto; animation: spin .8s linear infinite;
}

/* ===== Responsive ===== */
@media (max-width: 560px) {
  .wizard-card { padding: 32px 22px 28px; }
  .field-row { grid-template-columns: 1fr; }
  .step h1 { font-size: 24px; }
  .step-actions { flex-wrap: wrap; }
}
