:root {
  --bg-main: #090d1a;
  --bg-alt: #140f2e;
  --glass: rgba(255, 255, 255, 0.08);
  --glass-strong: rgba(255, 255, 255, 0.04);
  --border: rgba(255, 255, 255, 0.10);
  --text: #ecf1ff;
  --muted: #b7c2e0;
  --primary: #8d7bff;
  --primary-2: #5b89ff;
  --accent-gold: #f7d99c;
  --danger: #ff8e8e;
  --ok: #73e0b2;
  --radius: 18px;
  --shadow-1: 0 10px 30px rgba(7, 10, 22, 0.45);
  --shadow-2: 0 18px 55px rgba(9, 11, 28, 0.58);
}

* {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", "Vazirmatn", system-ui, -apple-system, "Segoe UI", sans-serif;
  background:
    radial-gradient(1200px 700px at 8% -15%, #2a1d5e 0%, rgba(42, 29, 94, 0) 62%),
    radial-gradient(1000px 800px at 95% 0%, #173f72 0%, rgba(23, 63, 114, 0) 58%),
    linear-gradient(135deg, var(--bg-main), var(--bg-alt));
  color: var(--text);
  line-height: 1.75;
}

.bg-orb {
  position: fixed;
  border-radius: 999px;
  filter: blur(48px);
  opacity: 0.42;
  z-index: 0;
  pointer-events: none;
}

.orb-a {
  width: 320px;
  height: 320px;
  background: #7c55ff;
  top: -80px;
  right: -110px;
  animation: driftA 8s ease-in-out infinite alternate;
}

.orb-b {
  width: 300px;
  height: 300px;
  background: #2f8dff;
  bottom: -110px;
  left: -90px;
  animation: driftB 10s ease-in-out infinite alternate;
}

.bg-noise {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.07;
  background-image: radial-gradient(circle, #fff 0.5px, transparent 0.5px);
  background-size: 3px 3px;
}

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 980px;
  margin: 0 auto;
  padding: 16px 14px 24px;
}

.app-header {
  margin: 4px 0 14px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  background: linear-gradient(145deg, var(--accent-gold), #ffe7be 45%, #cfac6f);
  box-shadow: 0 10px 20px rgba(22, 16, 7, 0.28);
}

.brand-copy {
  min-width: 0;
}

.brand-kicker {
  margin: 0 0 3px;
  font-size: 0.72rem;
  color: #d0d6ef;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.app-header h1 {
  margin: 0;
  font-family: "Playfair Display", "Vazirmatn", serif;
  font-size: 1.28rem;
  font-weight: 700;
  line-height: 1.35;
  letter-spacing: 0.15px;
}

.progress-wrap,
.card,
.status-box {
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  background: linear-gradient(150deg, rgba(20, 28, 70, 0.45), rgba(10, 14, 40, 0.3));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-1);
}

.progress-wrap {
  padding: 12px 12px 11px;
  margin-bottom: 12px;
}

.progress-label {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 7px;
}

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.13);
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #b597ff, #6ea5ff 62%, #8ad6ff);
  box-shadow: 0 0 16px rgba(126, 143, 255, 0.62);
  transition: width 450ms cubic-bezier(0.22, 1, 0.36, 1);
}

.card {
  padding: 16px;
  min-height: 300px;
  box-shadow: var(--shadow-2);
}

.step-card.fade-out {
  opacity: 0;
  transform: translateY(14px) scale(0.992);
  transition: opacity 200ms ease, transform 200ms ease;
}

.step-card.fade-in {
  opacity: 1;
  transform: translateY(0) scale(1);
  transition: opacity 380ms cubic-bezier(0.22, 1, 0.36, 1), transform 380ms cubic-bezier(0.22, 1, 0.36, 1);
}

.section-badge {
  display: inline-block;
  border-radius: 999px;
  padding: 5px 11px;
  margin-bottom: 10px;
  background: linear-gradient(145deg, rgba(252, 229, 177, 0.35), rgba(255, 255, 255, 0.08));
  color: #ffe2a7;
  font-size: 0.77rem;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.step-title {
  margin: 0 0 10px;
  font-family: "Vazirmatn", "Inter", sans-serif;
  font-weight: 700;
  font-size: 1.06rem;
  line-height: 1.95;
}

.step-description {
  margin: 0 0 12px;
  color: var(--muted);
  font-size: 0.9rem;
}

.notice {
  margin-bottom: 10px;
  border-radius: 13px;
  padding: 11px;
  background: linear-gradient(150deg, rgba(141, 123, 255, 0.12), rgba(255, 255, 255, 0.03));
  border: 1px solid rgba(209, 196, 255, 0.18);
  color: #e8ebff;
  font-size: 0.9rem;
}

.input,
.textarea,
.select {
  width: 100%;
  border: 1px solid rgba(227, 234, 255, 0.26);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  border-radius: 13px;
  padding: 12px 13px;
  font-size: 0.95rem;
  font-family: "Vazirmatn", "Inter", sans-serif;
  transition: border-color 180ms ease, box-shadow 240ms ease, transform 200ms ease, background-color 220ms ease;
}

.input::placeholder,
.textarea::placeholder {
  color: #c8d0ea;
}

.select option {
  color: #111827;
}

.textarea {
  min-height: 118px;
  resize: vertical;
}

.input:focus,
.textarea:focus,
.select:focus {
  outline: none;
  border-color: rgba(181, 169, 255, 0.85);
  background: rgba(255, 255, 255, 0.1);
  box-shadow: 0 0 0 4px rgba(147, 125, 255, 0.2), 0 10px 20px rgba(73, 49, 132, 0.24);
  transform: translateY(-1px);
}

.choice-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
}

.choice-item {
  border: 1px solid rgba(150, 165, 220, 0.15);
  background: rgba(20, 28, 70, 0.4);
  border-radius: 13px;
  padding: 10px 11px;
  display: flex;
  align-items: center;
  gap: 9px;
  cursor: pointer;
  transition: transform 170ms ease, border-color 220ms ease, box-shadow 240ms ease, background-color 220ms ease;
}

.choice-item input[type="radio"] {
  margin: 0;
  accent-color: #9e87ff;
}

.choice-item:hover {
  transform: translateY(-2px);
  border-color: rgba(193, 206, 255, 0.58);
  background: rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 22px rgba(20, 28, 63, 0.35);
}

.choice-item:has(input:checked) {
  border-color: rgba(190, 178, 255, 0.9);
  background: linear-gradient(145deg, rgba(160, 142, 255, 0.3), rgba(85, 130, 245, 0.18));
  box-shadow: 0 10px 25px rgba(56, 74, 152, 0.38);
}

.matrix-wrap {
  display: grid;
  gap: 10px;
}

.matrix-row {
  border-radius: 13px;
  border: 1px solid rgba(231, 236, 255, 0.2);
  background: rgba(255, 255, 255, 0.045);
  padding: 11px;
  transition: border-color 200ms ease, box-shadow 220ms ease, transform 180ms ease;
}

.matrix-row:hover {
  transform: translateY(-1px);
  border-color: rgba(206, 217, 255, 0.5);
  box-shadow: 0 8px 20px rgba(24, 30, 66, 0.34);
}

.matrix-label {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: #ebefff;
}

.dual-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.dual-col label {
  display: block;
  margin-bottom: 4px;
  color: #c6cde7;
  font-size: 0.8rem;
}

.jalali-date-wrap {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
}

.jalali-date-col label {
  display: block;
  margin-bottom: 4px;
  color: #c6cde7;
  font-size: 0.8rem;
}

.checkbox-line {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-top: 12px;
}

.checkbox-line input[type="checkbox"] {
  margin-top: 4px;
  accent-color: #a591ff;
}

.nav-actions {
  position: sticky;
  bottom: 0;
  margin-top: 12px;
  padding: 12px 0 2px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 9px;
  background: linear-gradient(180deg, rgba(10, 13, 28, 0), rgba(10, 13, 28, 0.88) 32%, rgba(10, 13, 28, 0.98));
  backdrop-filter: blur(2px);
}

.btn {
  border: 1px solid transparent;
  border-radius: 13px;
  padding: 12px;
  font-family: "Vazirmatn", "Inter", sans-serif;
  font-size: 0.94rem;
  font-weight: 600;
  cursor: pointer;
  transition: transform 170ms ease, box-shadow 240ms ease, filter 180ms ease, background-color 180ms ease;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn:active:not(:disabled) {
  transform: translateY(1px);
}

.btn-primary {
  color: #f9fbff;
  background: linear-gradient(140deg, var(--primary), var(--primary-2));
  box-shadow: 0 14px 24px rgba(86, 106, 207, 0.42), 0 0 18px rgba(118, 135, 255, 0.3);
}

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  filter: brightness(1.06);
  box-shadow: 0 18px 28px rgba(86, 106, 207, 0.5), 0 0 24px rgba(136, 152, 255, 0.38);
}

.btn-secondary {
  color: #e7edff;
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  border-color: rgba(242, 245, 255, 0.16);
}

.btn-secondary:hover:not(:disabled) {
  transform: translateY(-1px);
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
}

.status-box {
  margin-top: 12px;
  padding: 11px;
  color: #ffe9ea;
  border-color: rgba(255, 160, 160, 0.4);
  background: linear-gradient(140deg, rgba(183, 36, 24, 0.33), rgba(255, 255, 255, 0.06));
  font-size: 0.9rem;
  animation: popIn 240ms ease;
}

.status-box.ok {
  color: #d9ffec;
  border-color: rgba(122, 232, 174, 0.48);
  background: linear-gradient(145deg, rgba(3, 122, 72, 0.37), rgba(255, 255, 255, 0.07));
}

.results-section {
  margin-top: 14px;
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 420ms ease, transform 420ms ease;
}

.results-section.show {
  opacity: 1;
  transform: translateY(0);
}

.results-root {
  display: grid;
  gap: 12px;
  animation: popIn 320ms ease;
}

.after-submit-card {
  text-align: center;
  display: grid;
  gap: 10px;
}

.after-submit-card h3 {
  margin: 0;
  font-family: "Vazirmatn", "Inter", sans-serif;
  font-size: 1.15rem;
}

.after-submit-card p {
  margin: 0;
  color: var(--muted);
}

.result-open-btn {
  width: 100%;
  min-height: 52px;
  font-size: 1rem;
}

.results-header,
.results-risk,
.results-summary,
.results-recommendations,
.results-note,
.chart-card,
.result-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: linear-gradient(150deg, rgba(20, 28, 70, 0.45), rgba(10, 14, 40, 0.3));
  box-shadow: var(--shadow-1);
  padding: 14px;
}

.results-header h2 {
  margin: 0 0 4px;
  font-family: "Vazirmatn", "Inter", sans-serif;
  font-size: 1.35rem;
}

.results-header p {
  margin: 0;
  color: var(--muted);
}

.results-actions {
  margin-top: 12px;
  display: grid;
  gap: 8px;
}

.results-risk {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.results-risk p {
  margin: 0;
}

.risk-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 7px 12px;
  font-weight: 700;
  font-size: 0.9rem;
  border: 1px solid rgba(255, 255, 255, 0.22);
  background: rgba(255, 255, 255, 0.07);
}

.risk-good {
  border-color: rgba(86, 210, 159, 0.42);
  background: linear-gradient(150deg, rgba(36, 131, 89, 0.35), rgba(10, 14, 40, 0.3));
}

.risk-watch {
  border-color: rgba(245, 207, 84, 0.4);
  background: linear-gradient(150deg, rgba(150, 118, 29, 0.35), rgba(10, 14, 40, 0.3));
}

.risk-action {
  border-color: rgba(255, 165, 92, 0.45);
  background: linear-gradient(150deg, rgba(160, 89, 35, 0.35), rgba(10, 14, 40, 0.3));
}

.risk-urgent {
  border-color: rgba(255, 121, 121, 0.52);
  background: linear-gradient(150deg, rgba(145, 38, 38, 0.4), rgba(10, 14, 40, 0.3));
}

.results-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 10px;
}

.result-card h3,
.results-summary h3,
.results-recommendations h3,
.chart-card h3 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.result-score-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.result-score-row p {
  margin: 0;
}

.score-progress {
  margin: 10px 0 8px;
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.14);
  overflow: hidden;
}

.score-progress-fill {
  width: 0;
  height: 100%;
  border-radius: 999px;
  transition: width 850ms cubic-bezier(0.22, 1, 0.36, 1);
}

.score-green .score-progress-fill {
  background: linear-gradient(90deg, #3ccf9a, #83f2c9);
}

.score-blue .score-progress-fill {
  background: linear-gradient(90deg, #4f7dff, #8fb6ff);
}

.score-orange .score-progress-fill {
  background: linear-gradient(90deg, #ff9f43, #ffd28d);
}

.score-red .score-progress-fill {
  background: linear-gradient(90deg, #ff6b6b, #ffa4a4);
}

.result-band,
.result-desc {
  margin: 0;
  color: #dde6ff;
}

.result-desc {
  color: #c8d3f4;
}

.results-charts {
  display: grid;
  gap: 10px;
}

.chart-wrap {
  position: relative;
  width: 100%;
  min-height: 260px;
}

.chart-fallback {
  margin: 0;
  border-radius: 12px;
  border: 1px dashed rgba(255, 255, 255, 0.28);
  background: rgba(255, 255, 255, 0.05);
  color: #dae3ff;
  padding: 12px;
  font-size: 0.9rem;
}

.results-summary p,
.results-note p {
  margin: 0;
  color: #d9e2ff;
}

.results-recommendations ul {
  margin: 0;
  padding-inline-start: 18px;
  display: grid;
  gap: 6px;
}

.results-recommendations li {
  color: #e6ecff;
}

.results-note {
  border-color: rgba(255, 232, 166, 0.32);
  background: linear-gradient(145deg, rgba(170, 130, 41, 0.22), rgba(10, 14, 40, 0.3));
}

.confetti-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 99;
}

.confetti-piece {
  position: absolute;
  top: -18px;
  width: 10px;
  height: 16px;
  border-radius: 4px;
  opacity: 0;
  animation: confetti-fall 2500ms cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.success-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 20% 20%, rgba(142, 118, 255, 0.25), rgba(11, 14, 28, 0.92));
  opacity: 0;
  pointer-events: none;
  transition: opacity 320ms ease;
}

.success-overlay.show {
  opacity: 1;
  pointer-events: auto;
}

.success-modal {
  width: min(92vw, 500px);
  border-radius: 20px;
  border: 1px solid rgba(228, 235, 255, 0.24);
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.5);
  padding: 24px 18px 18px;
  text-align: center;
  transform: translateY(16px) scale(0.92);
  transition: transform 400ms cubic-bezier(0.22, 1, 0.36, 1);
}

.success-overlay.show .success-modal {
  transform: translateY(0) scale(1);
}

.success-modal h3 {
  margin: 0 0 8px;
  font-family: "Playfair Display", "Vazirmatn", serif;
  font-size: 1.45rem;
  color: #fff3cf;
}

.success-modal p {
  margin: 0 0 14px;
  color: #e2e8ff;
  font-size: 0.96rem;
}

.response-code-box {
  margin: 0 auto 16px;
  width: fit-content;
  border-radius: 14px;
  border: 1px solid rgba(255, 236, 182, 0.4);
  background: linear-gradient(145deg, rgba(255, 232, 176, 0.18), rgba(255, 255, 255, 0.08));
  padding: 8px 14px;
  color: #fff8e8;
  display: flex;
  align-items: center;
  gap: 8px;
}

.response-code-box strong {
  font-family: "Inter", monospace;
  letter-spacing: 0.8px;
  font-size: 1rem;
}

.check-wrap {
  width: 88px;
  height: 88px;
  margin: 0 auto 14px;
}

.check-svg {
  width: 100%;
  height: 100%;
}

.check-circle {
  fill: rgba(115, 224, 178, 0.22);
  stroke: #9cffd5;
  stroke-width: 3;
  stroke-dasharray: 188;
  stroke-dashoffset: 188;
  animation: drawCircle 620ms ease forwards;
}

.check-path {
  fill: none;
  stroke: #d9ffe9;
  stroke-width: 5;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 46;
  stroke-dashoffset: 46;
  animation: drawCheck 430ms 520ms ease forwards;
}

.success-close-btn {
  min-width: 130px;
}

.success-particles {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 7px;
  height: 16px;
  border-radius: 10px;
  opacity: 0;
  animation: confetti 1400ms ease-out forwards;
}

.particle:nth-child(odd) {
  background: #f4cf8e;
}

.particle:nth-child(even) {
  background: #8db4ff;
}

.p-1 { left: 8%; top: -8%; animation-delay: 0ms; }
.p-2 { left: 14%; top: -10%; animation-delay: 70ms; }
.p-3 { left: 20%; top: -11%; animation-delay: 140ms; }
.p-4 { left: 25%; top: -8%; animation-delay: 210ms; }
.p-5 { left: 31%; top: -12%; animation-delay: 280ms; }
.p-6 { left: 37%; top: -9%; animation-delay: 350ms; }
.p-7 { left: 43%; top: -11%; animation-delay: 420ms; }
.p-8 { left: 49%; top: -7%; animation-delay: 490ms; }
.p-9 { left: 55%; top: -12%; animation-delay: 560ms; }
.p-10 { left: 60%; top: -9%; animation-delay: 630ms; }
.p-11 { left: 66%; top: -8%; animation-delay: 700ms; }
.p-12 { left: 72%; top: -12%; animation-delay: 770ms; }
.p-13 { left: 78%; top: -9%; animation-delay: 840ms; }
.p-14 { left: 84%; top: -12%; animation-delay: 910ms; }
.p-15 { left: 90%; top: -10%; animation-delay: 980ms; }
.p-16 { left: 6%; top: -15%; animation-delay: 40ms; }
.p-17 { left: 18%; top: -16%; animation-delay: 110ms; }
.p-18 { left: 29%; top: -14%; animation-delay: 180ms; }
.p-19 { left: 41%; top: -15%; animation-delay: 250ms; }
.p-20 { left: 52%; top: -17%; animation-delay: 320ms; }
.p-21 { left: 63%; top: -15%; animation-delay: 390ms; }
.p-22 { left: 74%; top: -16%; animation-delay: 460ms; }
.p-23 { left: 86%; top: -14%; animation-delay: 530ms; }
.p-24 { left: 11%; top: -20%; animation-delay: 600ms; }
.p-25 { left: 33%; top: -19%; animation-delay: 670ms; }
.p-26 { left: 46%; top: -21%; animation-delay: 740ms; }
.p-27 { left: 69%; top: -19%; animation-delay: 810ms; }
.p-28 { left: 82%; top: -20%; animation-delay: 880ms; }

@keyframes drawCircle {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes drawCheck {
  to {
    stroke-dashoffset: 0;
  }
}

@keyframes confetti {
  0% {
    opacity: 0;
    transform: translateY(0) rotate(0deg) scale(0.8);
  }
  18% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(115vh) rotate(560deg) scale(1);
  }
}

@keyframes popIn {
  from {
    opacity: 0;
    transform: translateY(7px) scale(0.99);
  }

  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes driftA {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(-20px, 18px) scale(1.08); }
}

@keyframes driftB {
  from { transform: translate(0, 0) scale(1); }
  to { transform: translate(16px, -14px) scale(1.06); }
}

@keyframes confetti-fall {
  0% {
    opacity: 0;
    transform: translateY(0) rotate(0deg);
  }
  12% {
    opacity: 1;
  }
  100% {
    opacity: 0;
    transform: translateY(108vh) rotate(560deg);
  }
}

@media (min-width: 768px) {
  .app-shell {
    padding: 24px 20px 30px;
  }

  .brand-mark {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .brand-kicker {
    font-size: 0.74rem;
  }

  .app-header h1 {
    font-size: 1.45rem;
  }

  .progress-wrap,
  .card {
    padding: 16px;
  }

  .choice-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .dual-grid {
    grid-template-columns: 1fr 1fr;
  }

  .jalali-date-wrap {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .results-actions {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .results-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .results-charts {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .chart-wrap {
    min-height: 300px;
  }

  .result-open-btn {
    width: auto;
    min-width: 280px;
    justify-self: center;
  }
}
