:root {
  --bg-deep: #0b1220;
  --bg-card: rgba(255, 255, 255, 0.06);
  --border: rgba(147, 197, 253, 0.22);
  --text: #f1f5f9;
  --muted: #94a3b8;
  --accent: #38bdf8;
  --accent-2: #2563eb;
  --success: #34d399;
  --danger: #f87171;
  --radius: 20px;
  --radius-md: 16px;
  --radius-sm: 14px;
  --space-1: 8px;
  --space-2: 12px;
  --space-3: 16px;
  --space-4: 20px;
  --shadow: 0 18px 50px rgba(2, 12, 27, 0.55);
  --shadow-soft: 0 10px 28px rgba(2, 12, 27, 0.35);
  --card-bg-soft: rgba(15, 23, 42, 0.36);
  --card-border-soft: rgba(148, 163, 184, 0.26);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, Ubuntu, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  /* ~18px от типичных 16px — лучше читаемость при слабом зрении */
  font-size: 112.5%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100dvh;
  color: var(--text);
  background: var(--bg-deep);
  -webkit-font-smoothing: antialiased;
  line-height: 1.45;
}

.app-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: radial-gradient(120% 80% at 10% 0%, #1d4ed8 0%, transparent 55%),
    radial-gradient(90% 70% at 100% 20%, #0ea5e9 0%, transparent 50%),
    linear-gradient(165deg, #020617 0%, #0f172a 40%, #082f49 100%);
}

.shell {
  max-width: 468px;
  margin: 0 auto;
  padding: calc(12px + env(safe-area-inset-top)) 16px calc(24px + env(safe-area-inset-bottom));
}

.top-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  box-shadow: 0 8px 24px rgba(37, 99, 235, 0.45);
}

.brand-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title {
  font-weight: 700;
  font-size: 1.18rem;
  letter-spacing: 0.02em;
}

.brand-sub {
  font-size: 0.88rem;
  color: var(--muted);
}

.main-card,
.footer-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.main-card {
  padding: var(--space-4) 18px 22px;
  margin-bottom: var(--space-2);
  overflow: hidden;
}

.progress-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
  font-size: 0.9rem;
  color: var(--muted);
}

.progress-track {
  flex: 1;
  height: 6px;
  margin: 0 10px;
  border-radius: 99px;
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent-2), var(--accent));
  transition: width 0.25s ease;
}

.q-num {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--accent);
}

.question-text {
  font-size: 1.15rem;
  line-height: 1.55;
  margin: 0 0 18px;
  font-weight: 500;
}

.opts {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.opt-btn {
  display: block;
  width: 100%;
  text-align: left;
  padding: 16px 18px;
  min-height: 52px;
  border-radius: 14px;
  border: 1px solid rgba(148, 163, 184, 0.25);
  background: rgba(15, 23, 42, 0.5);
  color: var(--text);
  font-size: 1.02rem;
  line-height: 1.4;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, transform 0.1s;
  opacity: 0;
  transform: translateY(8px);
  animation: fadeSlideIn 0.35s ease forwards;
}

.opt-btn:nth-child(1) {
  animation-delay: 0.05s;
}

.opt-btn:nth-child(2) {
  animation-delay: 0.12s;
}

.opt-btn:nth-child(3) {
  animation-delay: 0.19s;
}

.opt-btn:hover {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(30, 58, 138, 0.35);
}

.opt-btn:active {
  transform: scale(0.99);
}

.opt-btn-selected {
  border-color: rgba(56, 189, 248, 0.92);
  background: linear-gradient(145deg, rgba(14, 165, 233, 0.34), rgba(37, 99, 235, 0.28));
  box-shadow: 0 8px 24px rgba(14, 165, 233, 0.28);
}

.opt-btn-dimmed {
  opacity: 0.5 !important;
}

.opt-btn:disabled {
  cursor: default;
}

.opt-key {
  display: inline-block;
  min-width: 1.75rem;
  font-weight: 700;
  color: var(--accent);
  margin-right: 8px;
}

.question-meta {
  margin: 12px 2px 0;
  font-size: 0.9rem;
  color: #93c5fd;
}

.lead {
  color: var(--muted);
  font-size: 1rem;
  line-height: 1.55;
  margin: 0 0 18px;
}

.btn-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn-primary,
.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 18px;
  min-height: 50px;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 1.02rem;
  text-decoration: none;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
}

.btn-primary {
  color: #0f172a;
  background: linear-gradient(135deg, #7dd3fc, #38bdf8);
  box-shadow: 0 10px 28px rgba(14, 165, 233, 0.35);
}

.btn-primary:active {
  transform: scale(0.98);
}

.btn-ghost {
  background: transparent;
  color: var(--accent);
  border: 1px solid rgba(56, 189, 248, 0.45);
}

.results h2 {
  margin: 0 0 12px;
  font-size: 1.42rem;
  letter-spacing: 0.01em;
  line-height: 1.25;
}

.stat {
  font-size: 1.06rem;
  margin-bottom: 14px;
}

.stat strong {
  color: var(--accent);
}

.block-title {
  font-size: 0.88rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 16px 0 8px;
}

.block-title:first-of-type {
  margin-top: 0;
}

.topic-list {
  margin: 0;
  padding-left: 1.1rem;
  color: #e2e8f0;
  font-size: 1rem;
  line-height: 1.6;
}

.topic-list-tight li + li {
  margin-top: 7px;
}

.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.kpi-card {
  border: 1px solid var(--card-border-soft);
  border-radius: var(--radius-sm);
  padding: var(--space-2);
  background: linear-gradient(150deg, rgba(30, 64, 175, 0.34), rgba(14, 165, 233, 0.12));
  box-shadow: var(--shadow-soft);
}

.kpi-card-wide {
  grid-column: 1 / -1;
}

.kpi-label {
  font-size: 0.8rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #bfdbfe;
}

.kpi-value {
  margin-top: 6px;
  font-size: 1.55rem;
  font-weight: 700;
  color: #e0f2fe;
  line-height: 1.1;
}

.kpi-main {
  display: inline-block;
  min-width: 1.6ch;
}

.kpi-sub {
  font-size: 0.9rem;
  color: #93c5fd;
  margin-left: 3px;
}

.kpi-hint {
  margin-top: 6px;
  font-size: 0.92rem;
  line-height: 1.5;
  color: #cbd5e1;
}

.section-card {
  margin-top: var(--space-2);
  padding: var(--space-2);
  border-radius: var(--radius-sm);
  border: 1px solid var(--card-border-soft);
  background: var(--card-bg-soft);
  box-shadow: var(--shadow-soft);
}

.section-card-soft {
  border-color: rgba(96, 165, 250, 0.28);
  background: linear-gradient(155deg, rgba(37, 99, 235, 0.18), rgba(15, 23, 42, 0.4));
}

.level-block {
  margin-top: 0;
  padding-top: 0;
  border-top: none;
  font-size: 0.94rem;
  line-height: 1.6;
  color: #dbeafe;
  white-space: pre-wrap;
}

.promo-card {
  margin-top: 16px;
  padding: 14px;
  border-radius: 14px;
  border: 1px solid rgba(56, 189, 248, 0.38);
  background: rgba(14, 165, 233, 0.1);
}

.recommend-card {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  border: 1px solid rgba(125, 211, 252, 0.48);
  background: linear-gradient(140deg, rgba(37, 99, 235, 0.34), rgba(14, 165, 233, 0.16));
  box-shadow: 0 12px 30px rgba(14, 165, 233, 0.2);
  position: relative;
  overflow: hidden;
}

.recommend-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: radial-gradient(80% 120% at 0% 0%, rgba(186, 230, 253, 0.22), transparent 50%);
  pointer-events: none;
}

.recommend-head {
  display: flex;
  align-items: center;
  gap: 8px;
}

.recommend-icon {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(186, 230, 253, 0.24);
  color: #fde68a;
  font-size: 0.9rem;
  flex-shrink: 0;
}

.promo-text {
  margin: 0 0 12px;
  font-size: 0.9rem;
  line-height: 1.5;
}

.recommend-cta {
  margin: 12px 0;
  font-size: 1.02rem;
  line-height: 1.55;
  color: #f8fafc;
}

.cta-stack {
  display: grid;
  gap: var(--space-1);
}

.cta-secondary {
  min-height: 50px;
}

.sticky-cta-wrap {
  display: none;
}

.promo-btn {
  width: 100%;
  font-size: 1.06rem;
  min-height: 52px;
  position: relative;
  overflow: hidden;
}

.promo-btn::after {
  content: "";
  position: absolute;
  top: 0;
  left: -120%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: shimmer 3.8s ease-in-out infinite;
}

.footer-card {
  padding: var(--space-3);
  text-align: center;
}

.footer-title {
  margin: 0 0 8px;
  font-weight: 700;
  font-size: 1.04rem;
  line-height: 1.35;
}

.footer-desc {
  margin: 0 0 14px;
  font-size: 0.92rem;
  color: var(--muted);
  line-height: 1.5;
}

.footer-card .btn-primary {
  width: 100%;
}

.enter-anim {
  animation: fadeUpIn 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.leave-anim {
  animation: fadeOutDown 0.16s ease forwards;
}

.reveal-1,
.reveal-2,
.reveal-3,
.reveal-4 {
  opacity: 0;
  transform: translateY(8px);
  animation: stagedIn 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.reveal-1 {
  animation-delay: 0.04s;
}

.reveal-2 {
  animation-delay: 0.14s;
}

.reveal-3 {
  animation-delay: 0.24s;
}

.reveal-4 {
  animation-delay: 0.34s;
}

@keyframes fadeUpIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeOutDown {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(6px);
  }
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes stagedIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes shimmer {
  0% {
    left: -120%;
  }
  55% {
    left: 140%;
  }
  100% {
    left: 140%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .opt-btn,
  .enter-anim,
  .leave-anim,
  .reveal-1,
  .reveal-2,
  .reveal-3,
  .reveal-4,
  .promo-btn::after {
    animation: none !important;
    transition: none !important;
  }
}

@media (max-width: 420px) {
  .results h2 {
    font-size: 1.32rem;
  }

  .sticky-cta-wrap {
    display: block;
    position: sticky;
    bottom: calc(env(safe-area-inset-bottom) + 8px);
    margin-top: var(--space-2);
    z-index: 4;
  }

  .sticky-cta {
    box-shadow: 0 16px 34px rgba(14, 165, 233, 0.4);
  }
}
