:root {
  --c-primary: #003c71;
  --c-primary-700: #002a55;
  --c-primary-50: #e9eff6;
  --c-accent: #c5a572;
  --c-accent-700: #a78951;
  --c-bg: #f3f5f8;
  --c-surface: #ffffff;
  --c-surface-2: #f9fafc;
  --c-border: #e3e8ef;
  --c-text: #14213d;
  --c-text-2: #4a5468;
  --c-text-3: #8893a4;
  --c-success: #1f9d55;
  --c-danger: #c0392b;
  --shadow-sm: 0 1px 2px rgba(20, 33, 61, 0.06);
  --shadow-md: 0 4px 16px rgba(20, 33, 61, 0.08);
  --shadow-lg: 0 12px 32px rgba(20, 33, 61, 0.12);
  --radius: 14px;
  --radius-lg: 22px;
  --tap: 48px;
  --ease: cubic-bezier(.4, 0, .2, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --dur-1: 180ms;
  --dur-2: 320ms;
  --dur-3: 520ms;
  --header-h: calc(56px + env(safe-area-inset-top));
}
[data-theme="dark"] {
  --c-primary: #3b82f6;
  --c-primary-700: #2563eb;
  --c-primary-50: #1e2a45;
  --c-accent: #d4b67f;
  --c-accent-700: #b89a64;
  --c-bg: #0b1320;
  --c-surface: #131c2c;
  --c-surface-2: #1a2436;
  --c-border: #25324a;
  --c-text: #e8eef7;
  --c-text-2: #aab6c8;
  --c-text-3: #6b7689;
  --c-success: #4ade80;
  --c-danger: #f87171;
  --shadow-sm: 0 1px 2px rgba(0,0,0,.35);
  --shadow-md: 0 4px 16px rgba(0,0,0,.45);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.55);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--c-bg);
  color: var(--c-text);
  min-height: 100vh;
  min-height: 100dvh;
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  transition: background var(--dur-2) var(--ease), color var(--dur-2) var(--ease);
  padding-top: var(--header-h);
  padding-bottom: env(safe-area-inset-bottom);
  overflow-x: hidden;
}
body.quest-mode { overflow: hidden; padding-bottom: 0; }

/* ===== Top bar ===== */
.top {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: var(--header-h);
  padding: env(safe-area-inset-top) 16px 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  z-index: 50;
  backdrop-filter: blur(12px);
  transition: background var(--dur-2) var(--ease), border-color var(--dur-2) var(--ease);
}
.brand { display: flex; align-items: center; gap: 10px; min-width: 0; }
.brand-mark {
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  flex: none;
  overflow: hidden;
}
.brand-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.brand-text { display: flex; flex-direction: column; min-width: 0; }
.brand-name { font-size: 13px; font-weight: 700; color: var(--c-text); line-height: 1.1; letter-spacing: .2px; }
.brand-sub { font-size: 11px; color: var(--c-text-3); line-height: 1.1; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.top-controls { display: flex; align-items: center; gap: 8px; }
.lang-switch {
  display: inline-flex;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: 10px;
  padding: 2px;
  gap: 2px;
  transition: opacity var(--dur-2) var(--ease);
}
.lang-switch[data-locked="true"] { opacity: .45; pointer-events: none; }
.lang-switch button {
  border: 0;
  background: transparent;
  color: var(--c-text-2);
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  border-radius: 8px;
  cursor: pointer;
  transition: all var(--dur-1) var(--ease);
  letter-spacing: .3px;
  font-family: inherit;
}
.lang-switch button.active { background: var(--c-primary); color: #fff; box-shadow: var(--shadow-sm); }

.icon-btn {
  width: 38px; height: 38px;
  border-radius: 10px;
  border: 1px solid var(--c-border);
  background: var(--c-surface-2);
  color: var(--c-text-2);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--dur-1) var(--ease);
  position: relative;
}
.icon-btn:active { transform: scale(.94); }
.icon-btn svg { width: 18px; height: 18px; position: absolute; transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease); }
.ico-sun { opacity: 1; transform: rotate(0); }
.ico-moon { opacity: 0; transform: rotate(-90deg); }
[data-theme="dark"] .ico-sun { opacity: 0; transform: rotate(90deg); }
[data-theme="dark"] .ico-moon { opacity: 1; transform: rotate(0); }

/* ===== Root (non-quest stages) ===== */
.root { max-width: 640px; margin: 0 auto; padding: 16px; min-height: calc(100dvh - var(--header-h)); }
body.quest-mode .root { display: none; }

.loader { display: grid; place-items: center; padding: 60px 0; }
.spinner {
  width: 36px; height: 36px;
  border: 3px solid var(--c-border);
  border-top-color: var(--c-primary);
  border-radius: 50%;
  animation: spin .9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ===== Stage anim ===== */
.stage { animation: stage-in var(--dur-3) var(--ease-out); }
@keyframes stage-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Hero / card ===== */
.hero-card,
.card {
  background: var(--c-surface);
  border-radius: var(--radius-lg);
  padding: 28px 22px 26px;
  text-align: center;
  border: 1px solid var(--c-border);
  box-shadow: var(--shadow-md);
  margin-top: 8px;
}
.card { text-align: left; padding: 22px 20px; border-radius: var(--radius); }
.hero-icon {
  width: 72px; height: 72px;
  margin: 0 auto 18px;
  color: var(--c-primary);
  background: var(--c-primary-50);
  border-radius: 50%;
  display: grid; place-items: center;
  animation: float 4s ease-in-out infinite;
}
.hero-icon.small { width: 52px; height: 52px; margin: 0 auto 12px; }
.hero-icon.small svg { width: 30px; height: 30px; }
.hero-icon svg { width: 40px; height: 40px; }
.hero-icon.success { color: var(--c-success); background: rgba(31,157,85,.12); }
.hero-icon.dup-icon { color: var(--c-primary); background: var(--c-primary-50); }

.stage-duplicate { padding: 16px; }
.dup-card { padding: 28px 22px 24px; }
.dup-lines { margin: 4px 0 20px; text-align: left; display: grid; gap: 8px; }
.dup-line {
  margin: 0;
  padding: 12px 14px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  font-size: 13.5px;
  color: var(--c-text);
  line-height: 1.45;
  font-weight: 500;
}
.dup-meta {
  display: grid;
  gap: 8px;
  background: var(--c-primary-50);
  border: 1px solid var(--c-border);
  border-radius: 12px;
  padding: 14px 16px;
  margin: 0 0 20px;
}
.dup-meta-row {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--c-text);
}
.dup-meta-ico {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--c-primary);
}
.dup-meta-ico svg { width: 18px; height: 18px; display: block; }
.dup-meta-label {
  font-size: 11.5px;
  color: var(--c-text-3);
  font-weight: 600;
  letter-spacing: .2px;
  text-transform: none;
}
.dup-meta-val {
  font-size: 14px;
  font-weight: 700;
  color: var(--c-text);
  font-variant-numeric: tabular-nums;
  letter-spacing: .3px;
}
.btn.multilang {
  flex-wrap: nowrap;
  gap: 6px;
  font-size: 14px;
  letter-spacing: .1px;
}
.btn.multilang .sep { opacity: .55; font-weight: 400; }
@keyframes float { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }

.welcome-title { font-size: 22px; font-weight: 700; margin: 0 0 10px; color: var(--c-text); letter-spacing: -.3px; }
.welcome-sub { font-size: 14px; color: var(--c-text-2); margin: 0 0 14px; }
.privacy { font-size: 12px; color: var(--c-text-3); margin: 0 0 20px; line-height: 1.5; padding: 0 8px; }

/* ===== Buttons ===== */
.btn {
  border: 0;
  border-radius: 12px;
  padding: 0 18px;
  height: var(--tap);
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur-1) var(--ease);
  font-family: inherit;
  letter-spacing: .1px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
.btn.primary { background: var(--c-primary); color: #fff; box-shadow: var(--shadow-sm); }
.btn.primary:hover { background: var(--c-primary-700); }
.btn.primary:active { transform: scale(.98); }
.btn.primary:disabled:not(.chosen) { background: var(--c-border); color: var(--c-text-3); cursor: not-allowed; box-shadow: none; }
.btn.ghost { background: transparent; color: var(--c-text-2); border: 1px solid var(--c-border); }
.btn.ghost:active { transform: scale(.98); background: var(--c-surface-2); }
.btn.ghost:disabled:not(.chosen) { color: var(--c-text-3); cursor: not-allowed; }
.btn.chosen {
  border-width: 2px;
  border-style: solid;
  border-color: var(--c-primary);
  cursor: default;
}
.btn.ghost.chosen {
  background: var(--c-primary-50);
  color: var(--c-primary);
}
.btn.primary.chosen {
  background: var(--c-primary);
  color: #fff;
  box-shadow: 0 0 0 2px var(--c-primary-50), var(--shadow-md);
  border-color: var(--c-primary);
}
.btn.big { width: 100%; height: 54px; font-size: 16px; border-radius: 14px; margin-top: 4px; }
.btn.half { flex: 1; }

.row-actions { display: flex; gap: 10px; margin-top: 16px; }

/* ===== Biz cards ===== */
.q-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--c-text);
  margin: 8px 4px 14px;
  line-height: 1.35;
  letter-spacing: -.2px;
}
/* "Several answers may be ticked" -- one short line under the title. */
.q-hint {
  font-size: 12px;
  color: var(--c-text-3);
  margin: 0 4px;
  font-style: italic;
}

/* A question's own explanation, which can run to several lines: same size as
   the question, set off by a dashed rule, and inside the scroll area so it
   does not eat the fixed header. */
.q-note {
  font-size: 16px;
  color: var(--c-text-3);
  margin: 0 4px 16px;
  padding-bottom: 14px;
  border-bottom: 1px dashed var(--c-border);
  font-style: italic;
  line-height: 1.45;
}
.choice-grid { display: grid; gap: 10px; }
.choice-grid.two { grid-template-columns: 1fr 1fr; }
.choice-card {
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  padding: 22px 14px;
  text-align: center;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  transition: all var(--dur-1) var(--ease);
  font-family: inherit;
}
.choice-card:active { transform: scale(.97); }
.choice-card:hover, .choice-card.selected { border-color: var(--c-primary); background: var(--c-primary-50); color: var(--c-primary); }
.choice-ico { width: 36px; height: 36px; color: var(--c-primary); }
.choice-ico svg { width: 100%; height: 100%; }
.choice-label { font-size: 14px; font-weight: 600; color: var(--c-text); }
.choice-card.selected .choice-label { color: var(--c-primary); }

/* ===== QUEST SHELL ===== */
.quest-shell {
  position: fixed;
  top: var(--header-h);
  left: 0; right: 0; bottom: 0;
  display: flex;
  flex-direction: column;
  background: var(--c-bg);
  z-index: 10;
}
.quest-toolbar {
  flex: none;
  padding: 12px 16px 14px;
  background: var(--c-surface);
  border-bottom: 1px solid var(--c-border);
  max-height: 45vh;
  overflow-y: auto;
}
.quest-toolbar::-webkit-scrollbar { width: 4px; }
.quest-toolbar::-webkit-scrollbar-thumb { background: var(--c-border); border-radius: 999px; }
.quest-toolbar .progress-wrap { margin-bottom: 10px; }
.q-title-fixed {
  font-size: 16px;
  margin: 0 0 4px;
  line-height: 1.4;
}
.quest-toolbar .q-hint { margin-top: 4px; }

.quest-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  /* Reserve room for the vertical scrollbar so the content width doesn't
     hop when the scroll thumb appears / disappears mid-interaction. */
  scrollbar-gutter: stable;
  padding: 16px 12px 22px;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
}
.quest-inner {
  max-width: 640px;
  margin: 0 auto;
  padding: 0 4px;
  animation: stage-in var(--dur-3) var(--ease-out);
}
.quest-foot {
  flex: none;
  display: flex;
  gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: var(--c-surface);
  border-top: 1px solid var(--c-border);
}
.quest-foot .btn {
  flex-grow: 1;
  flex-shrink: 1;
  flex-basis: 0;
  min-width: 0;
  overflow: hidden;
  white-space: nowrap;
  transition: flex-grow var(--dur-2) var(--ease),
              flex-basis var(--dur-2) var(--ease),
              opacity var(--dur-2) var(--ease),
              padding var(--dur-2) var(--ease),
              margin var(--dur-2) var(--ease),
              background var(--dur-1) var(--ease),
              color var(--dur-1) var(--ease),
              border-color var(--dur-1) var(--ease),
              box-shadow var(--dur-1) var(--ease);
}
.quest-foot .btn.collapsed {
  flex-grow: 0;
  flex-basis: 0;
  opacity: 0;
  padding-left: 0;
  padding-right: 0;
  pointer-events: none;
}
.quest-foot #qBack.collapsed { margin-right: -10px; }
.quest-foot #qNext.collapsed { margin-left: -10px; }

/* Progress */
.progress-wrap { display: flex; align-items: center; width: 100%; max-width: 640px; margin: 0 auto; }
.progress-bar { flex: 1; height: 4px; background: var(--c-border); border-radius: 999px; overflow: hidden; }
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--c-primary), var(--c-accent));
  border-radius: 999px;
  width: 0;
  transition: width var(--dur-3) var(--ease-out);
}

/* Custom scrollbar */
.quest-scroll::-webkit-scrollbar,
textarea::-webkit-scrollbar { width: 6px; }
.quest-scroll::-webkit-scrollbar-track,
textarea::-webkit-scrollbar-track { background: transparent; }
.quest-scroll::-webkit-scrollbar-thumb,
textarea::-webkit-scrollbar-thumb {
  background: var(--c-border);
  border-radius: 999px;
  transition: background var(--dur-1) var(--ease);
}
.quest-scroll::-webkit-scrollbar-thumb:hover,
textarea::-webkit-scrollbar-thumb:hover { background: var(--c-text-3); }
.quest-scroll { scrollbar-width: thin; scrollbar-color: var(--c-border) transparent; }

/* ===== Question body ===== */
.q-body { display: grid; gap: 8px; }

.opt {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  transition: all var(--dur-1) var(--ease);
  text-align: left;
  font-family: inherit;
  color: var(--c-text);
  font-size: 14px;
  line-height: 1.4;
  min-height: var(--tap);
  width: 100%;
}
.opt:active { transform: scale(.99); }
.opt:hover { border-color: var(--c-primary); }
.opt .mark {
  position: relative;
  width: 22px; height: 22px;
  border: 2px solid var(--c-border);
  flex: none;
  transition: all var(--dur-1) var(--ease);
  display: block;
}
.opt.radio .mark { border-radius: 50%; }
.opt.check .mark { border-radius: 6px; }
.opt.check .mark svg {
  position: absolute;
  top: 50%; left: 50%;
  width: 14px; height: 14px;
  color: #fff;
  opacity: 0;
  transform: translate(-50%, -50%) scale(.5);
  transition: opacity var(--dur-1) var(--ease), transform var(--dur-1) var(--ease);
}
.opt.selected { border-color: var(--c-primary); background: var(--c-primary-50); }
.opt.selected .mark { background: var(--c-primary); border-color: var(--c-primary); }
.opt.selected.radio .mark::after {
  content: '';
  position: absolute;
  top: 50%; left: 50%;
  width: 8px; height: 8px;
  background: #fff;
  border-radius: 50%;
  transform: translate(-50%, -50%);
}
.opt.selected.check .mark svg { opacity: 1; transform: translate(-50%, -50%) scale(1); }
.opt-text { flex: 1; min-width: 0; }

.q-body.cols-2 { grid-template-columns: 1fr 1fr; }
.q-body.cols-2 .opt { padding: 12px 12px; font-size: 13px; }

/* ===== Percent dropdown ===== */
.percent-wrap { display: grid; gap: 8px; }
.pdrop { display: flex; flex-direction: column; }
.pdrop-head {
  position: relative;
  width: 100%;
}
.pdrop-head .opt-text {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.pdrop-value {
  color: var(--c-primary);
  font-weight: 700;
  font-size: 13px;
}
.pdrop-caret {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  color: var(--c-text-3);
  transition: transform var(--dur-2) var(--ease), color var(--dur-1) var(--ease);
}
.pdrop-caret svg { width: 16px; height: 16px; }
.pdrop.open .pdrop-caret { transform: rotate(180deg); color: var(--c-primary); }
.pdrop.open .pdrop-head { border-color: var(--c-primary); background: var(--c-primary-50); }
.pdrop.open .pdrop-head .mark { border-color: var(--c-primary); }

.pdrop-panel {
  max-height: 0;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 0;
  padding: 0 4px;
  transition: max-height var(--dur-2) var(--ease), margin-top var(--dur-2) var(--ease), padding var(--dur-2) var(--ease);
}
.pdrop.open .pdrop-panel {
  max-height: 180px;
  margin-top: 6px;
  padding: 8px 4px 4px;
  animation: pdrop-fade 320ms var(--ease-out);
}
@keyframes pdrop-fade {
  from { opacity: 0; }
  to { opacity: 1; }
}
.pdrop-val {
  flex: 1;
  min-width: 0;
  height: 38px;
  border-radius: 10px;
  border: 1.5px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur-1) var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.pdrop-val:hover { border-color: var(--c-primary); color: var(--c-primary); }
.pdrop-val:active { transform: scale(.96); }
.pdrop-val.val-selected {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
  box-shadow: var(--shadow-sm);
}

/* ===== Group accordion (sentiment yaxshilandi/o'zgarmadi/... block) ===== */
.q-body.group-wrap { display: grid; gap: 8px; }

.grp-row { display: flex; flex-direction: column; }
.grp-head {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  color: var(--c-text);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: all var(--dur-1) var(--ease);
}
.grp-head:active { transform: scale(.99); }
.grp-head:hover { border-color: var(--c-primary); }
.grp-idx {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--c-primary-50);
  color: var(--c-primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px;
  font-weight: 700;
}
.grp-label {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px;
  line-height: 1.35;
}
.grp-text { }
.grp-value {
  color: var(--c-primary);
  font-weight: 700;
  font-size: 13px;
}
.grp-head .pdrop-caret {
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px; height: 22px;
  color: var(--c-text-3);
  transition: transform var(--dur-2) var(--ease), color var(--dur-1) var(--ease);
}
.grp-head .pdrop-caret svg { width: 16px; height: 16px; }
.grp-row.open .grp-head .pdrop-caret { transform: rotate(180deg); color: var(--c-primary); }
.grp-row.open .grp-head {
  border-color: var(--c-primary);
  background: var(--c-primary-50);
}
.grp-head.answered .grp-idx {
  background: var(--c-primary);
  color: #fff;
}

.grp-panel {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  max-height: 0;
  overflow: hidden;
  padding: 0 4px;
  transition: max-height var(--dur-2) var(--ease), margin-top var(--dur-2) var(--ease), padding var(--dur-2) var(--ease);
}
.grp-row.open .grp-panel {
  max-height: 220px;
  margin-top: 6px;
  padding: 6px 4px 4px;
  animation: pdrop-fade 320ms var(--ease-out);
}
.grp-chip {
  flex: 1;
  min-width: 0;
  height: 40px;
  border-radius: 10px;
  border: 1.5px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text);
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all var(--dur-1) var(--ease);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px;
  text-align: center;
  line-height: 1.15;
}
.grp-chip:hover { border-color: var(--c-primary); color: var(--c-primary); }
.grp-chip:active { transform: scale(.96); }
.grp-chip.val-selected {
  background: var(--c-primary);
  color: #fff;
  border-color: var(--c-primary);
  box-shadow: var(--shadow-sm);
}

/* ===== Post-survey cascading panels ===== */
.stage-post { padding-bottom: 32px; }
.post-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-width: 640px;
  margin: 0 auto;
}
.post-panel {
  margin-top: 0;
  animation: panel-in 520ms var(--ease-out);
  transition: opacity var(--dur-2) var(--ease), transform var(--dur-2) var(--ease);
}
@keyframes panel-in {
  from { opacity: 0; transform: translateY(20px) scale(.97); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.post-panel.dim {
  opacity: .55;
}
.post-panel.dim .btn:not(.chosen),
.post-panel.dim textarea,
.post-panel.dim input,
.post-panel.dim .pdrop-head,
.post-panel.dim .opt {
  pointer-events: none;
}
.post-panel.pinned {
  opacity: 1 !important;
}
.post-panel.pinned * { pointer-events: auto !important; }
.post-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--c-text);
  letter-spacing: -.1px;
}
.post-sub {
  font-size: 13.5px;
  color: var(--c-text-2);
  margin: 0 0 14px;
  line-height: 1.5;
}
.done-panel { text-align: center; }
.done-panel .post-title { margin-bottom: 4px; }
.done-panel .post-sub { margin-bottom: 0; }

/* ===== Final-thanks body ===== */
.final-body {
  text-align: left;
  margin: 0;
  padding: 14px 16px;
  background: var(--c-surface-2);
  border: 1px solid var(--c-border);
  border-radius: var(--radius);
  color: var(--c-text-2);
  font-size: 13.5px;
  line-height: 1.55;
}
.final-body p { margin: 0 0 8px; }
.final-body p:last-child { margin: 0; }
.final-body .meta {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px dashed var(--c-border);
  font-size: 12px;
  color: var(--c-text-3);
  font-style: italic;
  white-space: pre-wrap;
}
.final-body a { color: var(--c-primary); text-decoration: none; font-weight: 500; }
.final-body a:hover { text-decoration: underline; }

/* ===== Social icon row ===== */
.socials {
  display: flex;
  gap: 8px;
  margin: 14px auto 0;
  justify-content: center;
  align-items: stretch;
}
.socials .social-btn {
  flex: 1;
  min-width: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  border-radius: 12px;
  border: 1px solid var(--c-border);
  background: var(--c-surface);
  color: var(--c-text-2);
  cursor: pointer;
  transition: all var(--dur-1) var(--ease);
  text-decoration: none;
  font-family: inherit;
}
.socials .social-btn:hover {
  border-color: var(--c-primary);
  color: var(--c-primary);
  background: var(--c-primary-50);
}
.socials .social-btn:active { transform: scale(.94); }
.socials .social-btn svg { width: 20px; height: 20px; display: block; pointer-events: none; }

/* ===== Phone input ===== */
.phone-input {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color var(--dur-1) var(--ease);
  background: var(--c-surface);
}
.phone-input:focus-within { border-color: var(--c-primary); }
.phone-prefix {
  flex: none;
  white-space: nowrap;
  padding: 0 14px;
  display: flex; align-items: center;
  background: var(--c-surface-2);
  border-right: 1px solid var(--c-border);
  font-size: 14px;
  font-weight: 600;
  color: var(--c-text-2);
}
.phone-input input { min-width: 0; }
.phone-input input {
  flex: 1;
  border: 0;
  outline: none;
  background: transparent;
  font-size: 15px;
  padding: 0 14px;
  height: var(--tap);
  color: var(--c-text);
  font-family: inherit;
}
.phone-error { color: var(--c-danger); font-size: 12px; margin: 8px 4px 0; font-weight: 500; }

/* ===== Comment textarea ===== */
textarea {
  width: 100%;
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14px;
  font-family: inherit;
  color: var(--c-text);
  background: var(--c-surface);
  outline: none;
  resize: vertical;
  min-height: 100px;
  transition: border-color var(--dur-1) var(--ease);
}
textarea:focus { border-color: var(--c-primary); }
textarea::placeholder { color: var(--c-text-3); }

/* ===== Welcome bilingual + language picker ===== */
.hero-logo {
  width: 88px; height: 88px;
  margin: 0 auto 18px;
  display: grid;
  place-items: center;
}
.hero-logo img {
  width: 100%; height: 100%;
  object-fit: contain;
  display: block;
}
.welcome-bilingual {
  display: grid;
  gap: 14px;
  margin: 0 0 22px;
}
.welcome-block .welcome-title {
  font-size: 18px;
  margin: 0 0 6px;
}
.welcome-block .welcome-sub {
  font-size: 13px;
  margin: 0 0 8px;
  color: var(--c-text-2);
}
.welcome-block .privacy {
  font-size: 12px;
  margin: 0;
  color: var(--c-text-3);
  padding: 0;
  line-height: 1.5;
}
.welcome-divider {
  height: 1px;
  background: var(--c-border);
  margin: 4px 12px;
}

.lang-picker-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--c-text-3);
  letter-spacing: .5px;
  text-transform: uppercase;
  margin: 0 0 10px;
  text-align: center;
}
.lang-picker {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.lang-card {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px 10px;
  background: var(--c-surface);
  border: 1.5px solid var(--c-border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all var(--dur-1) var(--ease);
  font-family: inherit;
  color: var(--c-text);
  min-height: 56px;
}
.lang-card:hover { border-color: var(--c-primary); background: var(--c-primary-50); }
.lang-card:active { transform: scale(.97); }
.lang-card.selected { border-color: var(--c-primary); background: var(--c-primary-50); color: var(--c-primary); }
.lang-card.selected .lang-name { color: var(--c-primary); }
.lang-name { font-size: 14px; font-weight: 600; text-align: center; }

/* ===== Tablet ===== */
@media (min-width: 540px) {
  .root { padding: 24px; }
  .q-title-fixed { font-size: 17px; }
  .welcome-block .welcome-title { font-size: 20px; }
}

/* ---------- Percent option that asks for an exact figure ---------- */
/* "5% or less", "31% and above", "Дефляция": no bucket list can express
   these, so the row opens a small numeric field instead of a value grid. */
.pexact { display: flex; flex-direction: column; }
.pexact-head { position: relative; width: 100%; }
.pexact-head .opt-text { display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap; }
.pexact .pdrop-caret { transition: transform var(--dur-2) var(--ease), color var(--dur-1) var(--ease); }
.pexact.open .pdrop-caret { transform: rotate(180deg); color: var(--c-primary); }
.pexact.open .pexact-head { border-color: var(--c-primary); background: var(--c-primary-50); }
.pexact.open .pexact-head .mark { border-color: var(--c-primary); }

.pexact-panel {
  max-height: 0;
  overflow: hidden;
  margin-top: 0;
  padding: 0 4px;
  transition: max-height var(--dur-2) var(--ease), margin-top var(--dur-2) var(--ease), padding var(--dur-2) var(--ease);
}
.pexact.open .pexact-panel {
  max-height: 120px;
  margin-top: 6px;
  padding: 8px 4px 4px;
  animation: pdrop-fade 320ms var(--ease-out);
}

.pexact-field {
  display: flex;
  align-items: center;
  gap: 6px;
  border: 1.5px solid var(--c-border);
  border-radius: 12px;
  background: var(--c-surface);
  padding: 0 14px;
  height: 46px;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.pexact-field:focus-within {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--c-primary) 16%, transparent);
}
.pexact-field input {
  flex: 1;
  min-width: 0;
  border: 0;
  outline: none;
  background: transparent;
  color: var(--c-text);
  font-family: inherit;
  font-size: 16px;
  font-weight: 600;
}
.pexact-suffix { flex: none; font-size: 14px; font-weight: 700; color: var(--c-text-3); }
/* The allowed range already sits in the placeholder, so the hint only
   surfaces when the typed figure falls outside it. */
.pexact-hint { display: none; margin: 6px 2px 0; font-size: 12px; font-weight: 600; }

.pexact.bad .pexact-field { border-color: var(--c-danger); }
.pexact.bad .pexact-hint { display: block; color: var(--c-danger); }

/* A fall is stored as a negative figure; the sign is part of the field so
   the respondent always sees it, in the same ink as what they type. */
.pexact-sign {
  flex: none;
  font-size: 16px;
  font-weight: 600;
  color: var(--c-text);
  line-height: 1;
}

/* Back row on the audience picker. Full width like the buttons elsewhere,
   side gutters coming from .root, and pushed to the foot of the screen. */
.stage-nav { display: flex; margin-top: 18px; }
.stage-nav .btn { width: 100%; }
.stage-biz {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--header-h) - 32px);
}
.stage-biz .stage-nav { margin-top: auto; padding-top: 18px; }

/* Link out to the public results dashboard from the thank-you panel. */
.final-cta { margin-top: 18px; }
.final-cta-hint {
  margin: 0 0 10px;
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--c-text-2);
}
.final-cta a.btn { width: 100%; text-decoration: none; }

/* Pinned "Бошқа" option: ticking it reveals a short free-text field. */
.other-box {
  max-height: 0;
  overflow: hidden;
  padding: 0 2px;
  margin-top: 0;
  transition: max-height var(--dur-2) var(--ease), margin-top var(--dur-2) var(--ease), padding var(--dur-2) var(--ease);
}
.other-box.open { max-height: 90px; margin-top: 8px; padding: 2px; }
.other-input {
  width: 100%;
  height: 46px;
  border: 1.5px solid var(--c-border);
  border-radius: 12px;
  background: var(--c-surface);
  color: var(--c-text);
  font-family: inherit;
  font-size: 16px;
  padding: 0 14px;
  outline: none;
  transition: border-color var(--dur-1) var(--ease), box-shadow var(--dur-1) var(--ease);
}
.other-input:focus {
  border-color: var(--c-primary);
  box-shadow: 0 0 0 3.5px color-mix(in srgb, var(--c-primary) 16%, transparent);
}
/* In a two-column list the pinned option and its field span the full width. */
.q-body.cols-2 .opt-other, .q-body.cols-2 .other-box { grid-column: 1 / -1; }

/* ===== Intro: the three definitions, shown once per run ===== */
.stage-intro {
  display: flex;
  flex-direction: column;
  min-height: calc(100dvh - var(--header-h) - 32px);
}
.stage-intro .stage-nav { margin-top: auto; padding-top: 18px; }
.stage-nav.two { gap: 10px; }
.stage-nav.two .btn.ghost { width: auto; flex: 1; }
.stage-nav.two .btn.primary { width: auto; flex: 1.4; }

.intro-card { padding: 4px 18px 18px; }
.intro-item { padding: 16px 0; border-bottom: 1px dashed var(--c-border); }
.intro-item:last-child { border-bottom: 0; padding-bottom: 4px; }
.intro-term {
  display: block;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--c-primary);
  margin-bottom: 6px;
}
.intro-text {
  margin: 0;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--c-text-2);
}
