:root {
  --bg: #f8f9fb;
  --surface: #ffffff;
  --surface-2: #f0f1f5;
  --text: #14151a;
  --text-muted: #6b6f7a;
  --border: rgba(20, 21, 26, 0.1);
  --accent: #3457d5;
  --accent-dark: #2540a8;
  --accent-soft: rgba(52, 87, 213, 0.1);
  --good: #1a9c5c;
  --radius: 14px;
  --shadow: 0 8px 30px rgba(20, 21, 26, 0.08);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0e0f13;
    --surface: #16171d;
    --surface-2: #1e2028;
    --text: #f2f3f6;
    --text-muted: #9a9daa;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #5b7cf5;
    --accent-dark: #3457d5;
    --accent-soft: rgba(91, 124, 245, 0.15);
    --shadow: 0 8px 30px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Vazirmatn", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.8;
}

.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 0 20px;
}

.hidden { display: none !important; }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--surface) 88%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
}
.header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
}
.brand {
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.5px;
  color: var(--accent);
}
.auth-nav { display: flex; gap: 8px; align-items: center; }
.user-email { font-size: 13px; color: var(--text-muted); margin-inline-end: 6px; }

/* Buttons */
.btn {
  font-family: inherit;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 9px 18px;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.12s ease, box-shadow 0.12s ease, background 0.12s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 4px 14px rgba(0,0,0,0.08); }
.btn:active { transform: translateY(0); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-dark); }
.btn-ghost { background: transparent; }
.btn-lg { padding: 14px 30px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Hero */
.hero {
  padding: 90px 0 70px;
  text-align: center;
  background:
    radial-gradient(ellipse 60% 50% at 50% 0%, var(--accent-soft), transparent);
}
.hero h1 {
  font-size: clamp(28px, 4.2vw, 44px);
  font-weight: 800;
  max-width: 780px;
  margin: 0 auto 18px;
  line-height: 1.5;
}
.hero h1 span { color: var(--accent); }
.hero-sub {
  color: var(--text-muted);
  font-size: 17px;
  max-width: 560px;
  margin: 0 auto 32px;
}

.hero-badges { display: flex; gap: 12px; justify-content: center; margin: 26px 0 22px; flex-wrap: wrap; }
.tool-badge { height: 40px; width: auto; }

.hero-guide-links { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; max-width: 640px; margin: 0 auto; }
.guide-link {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 9px 18px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  box-shadow: var(--shadow);
  transition: transform 0.12s ease, border-color 0.12s ease;
}
.guide-link:hover { transform: translateY(-1px); border-color: var(--accent); color: var(--accent); }
.guide-link-icon { font-size: 15px; }
.guide-link-arrow { color: var(--accent); }

/* Wizard */
.wizard-section { padding: 20px 0 100px; }

.level-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}
@media (max-width: 860px) { .level-grid { grid-template-columns: 1fr; } }

.level-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px 22px;
  cursor: pointer;
  text-align: right;
  box-shadow: var(--shadow);
  transition: transform 0.15s ease, border-color 0.15s ease;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.level-card:hover { transform: translateY(-4px); border-color: var(--accent); }
.level-badge {
  align-self: flex-start;
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 4px 10px;
  border-radius: 999px;
}
.level-card h3 { margin: 0; font-size: 17px; }
.level-card p { margin: 0; color: var(--text-muted); font-size: 13.5px; }
.level-cta { margin-top: auto; font-weight: 700; color: var(--accent); font-size: 13.5px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 26px 26px;
  box-shadow: var(--shadow);
}

.wizard-progress { display: flex; gap: 6px; margin-bottom: 20px; }
.progress-dot { height: 4px; flex: 1; border-radius: 999px; background: var(--surface-2); }
.progress-dot.active, .progress-dot.done { background: var(--accent); }
.progress-dot.done { opacity: 0.5; }

.step-title { font-size: 19px; font-weight: 700; margin: 0 0 14px; }
.step-body { margin: 0 0 20px; padding-inline-start: 20px; color: var(--text-muted); font-size: 14.5px; display: flex; flex-direction: column; gap: 8px; }

.choice-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 10px; margin-bottom: 18px; }
.choice-card {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 10px;
  padding: 14px 16px;
  text-align: right;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.choice-card strong { font-size: 14px; }
.choice-card span { font-size: 12.5px; color: var(--text-muted); }
.choice-card.selected { border-color: var(--accent); background: var(--accent-soft); }

.pill-row { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.pill {
  border: 1px solid var(--border);
  background: var(--surface-2);
  border-radius: 999px;
  padding: 8px 18px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.pill.selected { border-color: var(--accent); background: var(--accent); color: #fff; }

.summary-box {
  background: var(--surface-2);
  border-radius: 10px;
  padding: 14px 16px;
  font-size: 13.5px;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 18px;
}

.wizard-nav-row { display: flex; justify-content: space-between; align-items: center; margin-top: 6px; }
.wizard-nav-right { display: flex; gap: 8px; }

.result-summary { display: flex; flex-direction: column; gap: 10px; }
.result-summary h3 { margin: 0; font-size: 18px; }
.status-line { font-size: 13.5px; color: var(--good); }
.status-line.warn { color: #b8860b; }

#report-preview-meta { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
#report-preview-meta h3 { margin: 0; font-size: 18px; }
.report-preview-frame {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--border, #e2e2e2);
  border-radius: 8px;
  background: #fff;
}
.result-actions { display: flex; gap: 10px; margin-top: 16px; justify-content: flex-start; }

.build-progress { display: flex; flex-direction: column; gap: 8px; margin: 14px 0; }
.progress-track { height: 10px; border-radius: 999px; background: var(--accent-soft); overflow: hidden; }
.progress-fill { height: 100%; width: 0%; background: var(--accent); border-radius: 999px; transition: width 0.2s ease; }
.progress-label { font-size: 13px; color: var(--text-muted); }

.range-row { display: flex; align-items: center; gap: 12px; margin: 0 0 14px; }
.range-row label { font-size: 13.5px; color: var(--text-muted); white-space: nowrap; }
.range-row input[type="range"] { flex: 1; accent-color: var(--accent); }
.range-value { font-weight: 700; color: var(--accent); min-width: 64px; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 22px 0;
  text-align: center;
  color: var(--text-muted);
  font-size: 12.5px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 14, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 50;
  padding: 16px;
}
.modal {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 28px 26px;
  width: 100%;
  max-width: 380px;
  box-shadow: var(--shadow);
}
.modal-close {
  position: absolute;
  top: 14px;
  left: 14px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
}
.modal-tabs { display: flex; gap: 6px; margin-bottom: 20px; border-bottom: 1px solid var(--border); }
.modal-tab {
  flex: 1;
  border: none;
  background: transparent;
  padding: 10px;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
}
.modal-tab.active { color: var(--accent); border-color: var(--accent); }

.auth-form { display: flex; flex-direction: column; gap: 14px; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text-muted); }
.auth-form input {
  font-family: inherit;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
}
.form-error { color: #d94848; font-size: 13px; min-height: 16px; }
