/* ============================================================
   Kriha — survey styles
   Brand: Kriha indigo #523AD7 · Type: Plus Jakarta Sans
   ============================================================ */

:root {
  --bg: #f7f7fb;
  --bg-tint: #f1eefc;
  --card: #ffffff;
  --text: #17133a;
  --muted: #6b6785;
  --brand: #523ad7;
  --brand-dark: #3f2bb0;
  --brand-2: #7c5cf0;
  --brand-soft: #efebfc;
  --brand-ring: rgba(82, 58, 215, .18);
  --ok: #16a34a;
  --danger: #dc2626;
  --border: #e7e5f0;
  --radius: 16px;
  --radius-sm: 12px;
  --shadow-sm: 0 1px 2px rgba(23, 19, 58, .05), 0 1px 3px rgba(23, 19, 58, .04);
  --shadow: 0 4px 14px rgba(23, 19, 58, .06), 0 12px 32px rgba(82, 58, 215, .05);
  --shadow-brand: 0 8px 22px rgba(82, 58, 215, .32);
  --font: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.logo-img { display: block; height: 30px; width: auto; }

/* ---------- Landing ---------- */
.landing {
  position: relative;
  max-width: 500px;
  margin: 0 auto;
  padding: 0 20px 32px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  overflow: hidden;
}

/* soft brand glow behind the hero */
.landing::before {
  content: "";
  position: absolute;
  top: -180px;
  left: 50%;
  transform: translateX(-50%);
  width: 520px;
  height: 420px;
  background: radial-gradient(ellipse at center, rgba(124, 92, 240, .22), rgba(124, 92, 240, 0) 68%);
  pointer-events: none;
  z-index: 0;
}

.landing > * { position: relative; z-index: 1; }

.landing-top { padding: 26px 0 0; }
.landing-top .logo-img { height: 34px; margin: 0 auto; }

.landing-hero { text-align: center; margin: 44px 0 34px; }

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--brand-dark);
  background: var(--brand-soft);
  border: 1px solid #e0d9fa;
  padding: 6px 13px;
  border-radius: 99px;
  margin-bottom: 20px;
}
.hero-badge::before {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-ring);
}

.landing-hero h1 {
  font-size: 27px;
  font-weight: 800;
  letter-spacing: -.6px;
  line-height: 1.22;
}

.landing-hero p {
  color: var(--muted);
  margin-top: 12px;
  font-size: 16px;
  font-weight: 500;
}

.role-cards { display: flex; flex-direction: column; gap: 14px; }

.role-card {
  display: flex;
  align-items: center;
  gap: 15px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px;
  text-decoration: none;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: transform .16s ease, box-shadow .16s ease, border-color .16s ease;
}
.role-card:hover { transform: translateY(-2px); box-shadow: var(--shadow); border-color: #d9d2f6; }
.role-card:active { transform: translateY(0) scale(.99); }

.role-emoji {
  font-size: 27px;
  width: 54px; height: 54px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft);
  border-radius: 14px;
  flex-shrink: 0;
}

.role-card h2 { font-size: 16.5px; font-weight: 700; letter-spacing: -.2px; }
.role-card p { font-size: 13.5px; color: var(--muted); margin-top: 2px; font-weight: 500; }

.role-arrow {
  margin-left: auto;
  flex-shrink: 0;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: var(--bg-tint);
  color: var(--brand);
  font-size: 17px;
  font-weight: 700;
  transition: background .16s, color .16s, transform .16s;
}
.role-card:hover .role-arrow { background: var(--brand); color: #fff; transform: translateX(2px); }

.trust-row {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 18px;
  margin-top: 28px;
}
.trust-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 500;
}
.trust-item svg { width: 15px; height: 15px; color: var(--brand); flex-shrink: 0; }

.landing-foot {
  margin-top: auto;
  padding-top: 34px;
  text-align: center;
  font-size: 12px;
  color: #9491a8;
  line-height: 1.6;
}

/* ---------- Survey shell ---------- */
.survey-wrap {
  max-width: 500px;
  margin: 0 auto;
  padding: 0 20px 36px;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

.topbar {
  position: sticky;
  top: 0;
  background: rgba(247, 247, 251, .88);
  backdrop-filter: saturate(180%) blur(10px);
  -webkit-backdrop-filter: saturate(180%) blur(10px);
  padding: 15px 0 12px;
  z-index: 5;
}

.topbar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 11px;
}
.topbar .logo-img { height: 26px; }

.step-count {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  background: var(--card);
  border: 1px solid var(--border);
  padding: 4px 11px;
  border-radius: 99px;
}

.progress-track {
  height: 7px;
  background: #e7e3f5;
  border-radius: 99px;
  overflow: hidden;
}
.progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--brand), var(--brand-2));
  border-radius: 99px;
  transition: width .4s cubic-bezier(.4, 0, .2, 1);
}

#app { flex: 1; display: flex; flex-direction: column; padding-top: 20px; }

.step { animation: slideIn .3s cubic-bezier(.22, 1, .36, 1); }
@keyframes slideIn {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

.section-tag {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--brand);
  background: var(--brand-soft);
  padding: 5px 11px;
  border-radius: 99px;
  margin-bottom: 14px;
}

.q-title { font-size: 22px; font-weight: 800; letter-spacing: -.4px; line-height: 1.3; }
.q-hint { color: var(--muted); font-size: 14px; margin-top: 7px; font-weight: 500; }

.options { display: flex; flex-direction: column; gap: 10px; margin-top: 22px; }

.opt {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  text-align: left;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  background: var(--card);
  color: var(--text);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 15px 16px;
  min-height: 56px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color .14s, background .14s, transform .08s, box-shadow .14s;
  -webkit-tap-highlight-color: transparent;
}
.opt:hover { border-color: #cdc4f2; }
.opt:active { transform: scale(.985); }

.opt .check {
  width: 23px; height: 23px;
  border: 2px solid #d3cdea;
  border-radius: 50%;
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px;
  color: #fff;
  transition: all .14s;
}
.opt.multi .check { border-radius: 7px; }
.opt .check svg { width: 13px; height: 13px; opacity: 0; transform: scale(.5); transition: all .14s; }

.opt.selected {
  border-color: var(--brand);
  background: var(--brand-soft);
  box-shadow: 0 0 0 3px var(--brand-ring);
}
.opt.selected .check { background: var(--brand); border-color: var(--brand); }
.opt.selected .check svg { opacity: 1; transform: scale(1); }

/* scale */
.scale-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 9px;
  margin-top: 22px;
}
.scale-grid.ten { grid-template-columns: repeat(5, 1fr); }

.scale-btn {
  font: inherit;
  font-size: 17px;
  font-weight: 700;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 54px;
  cursor: pointer;
  color: var(--text);
  box-shadow: var(--shadow-sm);
  transition: all .14s;
  -webkit-tap-highlight-color: transparent;
}
.scale-btn:hover { border-color: #cdc4f2; }
.scale-btn:active { transform: scale(.94); }
.scale-btn.selected {
  background: linear-gradient(160deg, var(--brand-2), var(--brand));
  border-color: var(--brand);
  color: #fff;
  box-shadow: var(--shadow-brand);
}

.scale-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 12px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

/* text input */
.text-wrap { margin-top: 22px; }
.text-input {
  width: 100%;
  font: inherit;
  font-size: 16px;
  padding: 15px 16px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--card);
  color: var(--text);
  outline: none;
  box-shadow: var(--shadow-sm);
  transition: border-color .14s, box-shadow .14s;
}
.text-input::placeholder { color: #a7a3bd; }
.text-input:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
textarea.text-input { min-height: 120px; resize: vertical; }

/* centered steps (consent / intro / thanks) */
.center-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  text-align: center;
  padding-bottom: 6vh;
}
.center-step .big-emoji {
  font-size: 40px;
  width: 84px; height: 84px;
  margin: 0 auto 20px;
  display: flex; align-items: center; justify-content: center;
  background: var(--brand-soft);
  border-radius: 24px;
  box-shadow: inset 0 0 0 1px #e2daf9;
}
.center-step h2 { font-size: 25px; font-weight: 800; letter-spacing: -.5px; line-height: 1.25; }
.center-step > p { color: var(--muted); margin-top: 13px; font-size: 15.5px; font-weight: 500; }

.consent-box {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  text-align: left;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 17px;
  margin-top: 26px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
  transition: border-color .14s, box-shadow .14s;
}
.consent-box:hover { border-color: #cdc4f2; }
.consent-box.checked { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-ring); }
.consent-box input {
  width: 21px; height: 21px;
  margin-top: 1px;
  accent-color: var(--brand);
  flex-shrink: 0;
  cursor: pointer;
}

.consent-meta {
  display: flex; flex-wrap: wrap; gap: 8px 14px;
  justify-content: center;
  margin-top: 20px;
}
.consent-meta span {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12.5px; color: var(--muted); font-weight: 500;
}
.consent-meta svg { width: 14px; height: 14px; color: var(--brand); }

/* nav buttons */
.nav-row { display: flex; gap: 10px; margin-top: 28px; }

.btn {
  font: inherit;
  font-size: 16px;
  font-weight: 700;
  border: none;
  border-radius: var(--radius-sm);
  padding: 16px 22px;
  min-height: 56px;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  transition: all .14s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}
.btn:active { transform: scale(.98); }

.btn-primary {
  background: linear-gradient(160deg, var(--brand-2), var(--brand));
  color: #fff;
  flex: 1;
  box-shadow: var(--shadow-brand);
}
.btn-primary:hover { filter: brightness(1.05); box-shadow: 0 10px 26px rgba(82, 58, 215, .4); }
.btn-primary:disabled {
  background: #d7d2ea;
  color: #fff;
  box-shadow: none;
  cursor: not-allowed;
  transform: none;
  filter: none;
}

.btn-ghost {
  background: var(--card);
  color: var(--muted);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { color: var(--text); border-color: #cdc4f2; }

.back-link {
  background: none;
  border: none;
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  padding: 6px 0;
  margin-bottom: 10px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.back-link:hover { color: var(--brand); }

.max-hint { animation: shake .32s ease; color: var(--danger) !important; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.error-box {
  background: #fef2f2;
  border: 1.5px solid #fecaca;
  color: #b91c1c;
  border-radius: var(--radius);
  padding: 15px 16px;
  font-size: 14px;
  font-weight: 500;
  margin-top: 20px;
}

.spinner {
  width: 36px; height: 36px;
  border: 3px solid #e2daf9;
  border-top-color: var(--brand);
  border-radius: 50%;
  margin: 0 auto;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 560px) {
  .q-title { font-size: 24px; }
  .landing-hero h1 { font-size: 30px; }
}
