:root {
  --paper: #f4efe6;
  --paper-deep: #ebe3d4;
  --card: #fffdf8;
  --ink: #1c1915;
  --ink-soft: #5c5348;
  --line: #e4d8c4;
  --teal: #0d6b66;
  --teal-deep: #0a524e;
  --teal-soft: #dceeee;
  --gold: #c4922a;
  --gold-soft: #f6e8c6;
  --clay: #b85c38;
  --plum: #5b4570;
  --plum-soft: #ece6f2;
  --ok: #2f7a55;
  --ok-soft: #dff3e8;
  --danger: #b42318;
  --danger-soft: #fde8e6;
  --shadow: 0 16px 40px rgba(55, 38, 16, 0.08);
  --radius: 22px;
  --tap: 48px;
  --header-h: 76px;
  --nav-h: 88px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Vazirmatn", "Tahoma", sans-serif;
  background:
    radial-gradient(1200px 500px at 100% -10%, rgba(13, 107, 102, 0.12), transparent 50%),
    radial-gradient(900px 420px at -10% 110%, rgba(196, 146, 42, 0.12), transparent 46%),
    var(--paper);
  color: var(--ink);
  line-height: 1.8;
}

button,
input {
  font-family: inherit;
}

button {
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}

.app {
  width: min(760px, calc(100% - 24px));
  margin: 0 auto;
  padding: 16px 0 calc(var(--nav-h) + 28px);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--header-h);
  padding: 12px 0 10px;
  background: linear-gradient(180deg, rgba(244, 239, 230, 0.96) 70%, rgba(244, 239, 230, 0));
  backdrop-filter: blur(10px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mark {
  width: 40px;
  height: 40px;
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: linear-gradient(160deg, var(--teal), #17857f);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 8px 18px rgba(13, 107, 102, 0.24);
}

.brand-copy {
  min-width: 0;
}

.brand-copy strong,
.section-kicker,
.card-index,
.scale-label,
.toast,
.opt,
.choice,
.btn,
.field-label {
  display: block;
}

.brand-copy strong {
  font-size: 0.95rem;
  line-height: 1.3;
}

.brand-copy span,
.muted,
.helper,
.progress-meta {
  color: var(--ink-soft);
}

.brand-copy span {
  font-size: 0.78rem;
}

.progress-wrap {
  flex: 1;
  max-width: 280px;
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 6px;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7dece;
}

.progress-bar {
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--teal), #2ea39c);
  transition: width 0.35s ease;
}

.screen {
  animation: rise 0.38s ease;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.hero,
.panel,
.card,
.thanks-card,
.admin-card {
  background: var(--card);
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.hero {
  padding: 28px 22px 24px;
  position: relative;
}

.hero::after {
  content: "";
  position: absolute;
  inset: auto -40px -60px auto;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(13, 107, 102, 0.16), transparent 68%);
}

.eyebrow,
.section-kicker {
  color: var(--teal-deep);
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.hero h1,
.section-head h2,
.thanks-card h2 {
  margin: 8px 0 12px;
  font-size: clamp(1.55rem, 5vw, 2.15rem);
  line-height: 1.35;
}

.lead {
  margin: 0 0 18px;
  color: var(--ink-soft);
  font-size: 0.98rem;
}

.pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 18px 0 22px;
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--teal-soft);
  color: var(--teal-deep);
  font-size: 0.82rem;
  font-weight: 600;
}

.hero .btn-primary {
  margin: 4px 0 20px;
}

.steps {
  display: grid;
  gap: 8px;
  margin: 0 0 12px;
  padding: 0;
  list-style: none;
}

.steps li {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px 12px 12px 10px;
  border-radius: 16px;
  background: #faf6ee;
}

.step-num {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: #fff;
  color: var(--teal);
  font-weight: 700;
  box-shadow: inset 0 0 0 1px var(--line);
}

.thanks {
  margin: 0;
  font-weight: 700;
  color: var(--teal-deep);
}

.section-head {
  margin: 8px 0 16px;
}

.section-head p {
  margin: 0;
  color: var(--ink-soft);
}

.stack {
  display: grid;
  gap: 14px;
}

.card {
  padding: 16px 16px 14px;
  scroll-margin-top: calc(var(--header-h) + 12px);
  scroll-margin-bottom: calc(var(--nav-h) + 12px);
  transition: box-shadow 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

.card.is-error {
  border-color: #f0b4ad;
  box-shadow: 0 0 0 4px var(--danger-soft);
}

.card.is-done {
  box-shadow: 0 0 0 1px rgba(13, 107, 102, 0.12), var(--shadow);
}

.card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.card-index {
  min-width: 42px;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--gold-soft);
  color: #7a5a10;
  font-size: 0.78rem;
  font-weight: 700;
  text-align: center;
}

.card-text {
  margin: 0;
  font-size: 1.02rem;
  font-weight: 600;
}

.scale {
  display: grid;
  gap: 10px;
}

.scale-current {
  min-height: 28px;
  color: var(--teal-deep);
  font-size: 0.95rem;
  font-weight: 800;
  text-align: center;
}

.scale-current.is-empty {
  color: var(--ink-soft);
  font-weight: 600;
}

.slider {
  --stops: 5;
  position: relative;
  height: 48px;
  display: flex;
  align-items: center;
  touch-action: none;
  user-select: none;
}

.slider-rail {
  position: absolute;
  inset-inline: calc(100% / var(--stops) / 2);
  height: 8px;
  border-radius: 999px;
  background: #e7dece;
}

.slider-fill {
  position: absolute;
  inset-block: 0;
  inset-inline-start: 0;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(to left, var(--teal), #2ea39c);
  transition: width 0.16s ease;
}

.slider-stops {
  position: relative;
  z-index: 1;
  display: grid;
  width: 100%;
  grid-template-columns: repeat(var(--stops), minmax(0, 1fr));
}

.slider-stop {
  width: 22px;
  height: 22px;
  margin: 0 auto;
  padding: 0;
  border: 2px solid #d4c7b0;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 10px transparent;
  transition: 0.16s ease;
}

.slider-stop.is-on {
  width: 28px;
  height: 28px;
  border-color: var(--teal);
  background: var(--teal);
  box-shadow: 0 0 0 6px rgba(13, 107, 102, 0.16);
}

.scale-ends {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink-soft);
  font-size: 0.75rem;
  line-height: 1.4;
}

.scale-ends span {
  max-width: 46%;
}

.scale-ends span:last-child {
  text-align: left;
}

.opt,
.tf-btn {
  width: 100%;
  height: 52px;
  display: grid;
  place-items: center;
  padding: 0 4px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  color: var(--ink);
  font-size: 1rem;
  font-weight: 700;
  text-align: center;
  transition: 0.18s ease;
}

.opt:hover,
.choice:hover {
  border-color: #c9b89a;
  transform: translateY(-1px);
}

.opt.is-on,
.choice.is-on {
  background: var(--teal);
  border-color: var(--teal);
  color: #fff;
  box-shadow: 0 8px 16px rgba(13, 107, 102, 0.22);
}

.tf-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.field {
  padding: 16px;
}

.field-label {
  margin-bottom: 10px;
  font-weight: 700;
}

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.choice {
  min-height: 44px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  font-weight: 600;
}

.age-input {
  width: 100%;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  font-size: 16px;
}

.age-input:focus,
.opt:focus-visible,
.choice:focus-visible,
.slider-stop:focus-visible,
.btn:focus-visible,
.link-btn:focus-visible {
  outline: 3px solid rgba(13, 107, 102, 0.28);
  outline-offset: 2px;
}

.bottom-nav {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  display: flex;
  justify-content: center;
  padding: 12px 12px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, transparent, rgba(244, 239, 230, 0.94) 28%);
}

.nav-inner {
  width: min(760px, 100%);
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 10px;
}

.btn {
  min-height: 52px;
  padding: 0 16px;
  border: 0;
  border-radius: 16px;
  font-size: 1rem;
  font-weight: 700;
  scroll-margin-top: 96px;
}

.btn-ghost {
  background: #fff;
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

.btn-primary {
  background: linear-gradient(180deg, #14827c, var(--teal-deep));
  color: #fff;
  box-shadow: 0 10px 20px rgba(13, 107, 102, 0.22);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.full {
  grid-column: 1 / -1;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--nav-h) + 8px);
  z-index: 40;
  transform: translate(-50%, 12px);
  width: min(520px, calc(100% - 24px));
  padding: 12px 14px;
  border-radius: 14px;
  background: #3b2f22;
  color: #fff;
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: 0.25s ease;
}

.toast.is-on {
  opacity: 1;
  transform: translate(-50%, 0);
}

.thanks-card,
.admin-card {
  padding: 28px 22px;
  text-align: center;
}

.code-box {
  margin: 18px 0;
  padding: 14px;
  border-radius: 16px;
  background: var(--teal-soft);
  font-weight: 800;
  letter-spacing: 0.08em;
}

.note {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--gold-soft);
  color: #6b4e0d;
  font-size: 0.9rem;
}

.admin-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 16px 0;
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

th,
td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  white-space: nowrap;
}

th {
  background: #faf6ee;
}

.empty {
  padding: 28px 12px;
  color: var(--ink-soft);
}

.link-btn {
  border: 0;
  background: none;
  color: var(--teal-deep);
  font-weight: 700;
  text-decoration: underline;
}

.footer-link {
  display: block;
  margin-top: 18px;
  text-align: center;
}

.save-dot {
  font-size: 0.75rem;
  color: var(--ok);
}

@media (min-width: 720px) {
  .app {
    width: min(820px, calc(100% - 40px));
    padding-top: 20px;
  }

  .hero,
  .thanks-card,
  .admin-card,
  .field,
  .card {
    padding: 22px;
  }

  .opt {
    height: 56px;
    font-size: 1.1rem;
  }

  .choices {
    gap: 10px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }
}
