:root {
  --bg: #f6f2fb;
  --card: #ffffff;
  --text: #241a35;
  --muted: #6f6485;
  --line: #e6ddf1;
  --accent: #6c3fb0;
  --accent-text: #ffffff;
  --accent-soft: #efe6fb;
  --hero-1: #2b1a4d;
  --hero-2: #6a3fa8;
  --high: #d4434b;
  --high-soft: #fde8e9;
  --mid: #b07a00;
  --mid-soft: #fdf3d8;
  --low: #23855a;
  --low-soft: #e2f5ec;
  --shadow: 0 1px 2px rgba(36, 26, 53, .06), 0 6px 20px rgba(36, 26, 53, .06);
  --serif: Georgia, "Noto Serif", "Times New Roman", serif;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #150f22;
    --card: #211835;
    --text: #f1ecf9;
    --muted: #a99dc0;
    --line: #342a4b;
    --accent: #a77ef0;
    --accent-text: #160f24;
    --accent-soft: #2d2147;
    --hero-1: #241640;
    --hero-2: #4f2d86;
    --high: #ff7a80;
    --high-soft: #3a1c26;
    --mid: #f0c14b;
    --mid-soft: #362b17;
    --low: #5fd39a;
    --low-soft: #17322a;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

:root[data-theme="dark"] {
  --bg: #150f22;
  --card: #211835;
  --text: #f1ecf9;
  --muted: #a99dc0;
  --line: #342a4b;
  --accent: #a77ef0;
  --accent-text: #160f24;
  --accent-soft: #2d2147;
  --hero-1: #241640;
  --hero-2: #4f2d86;
  --high: #ff7a80;
  --high-soft: #3a1c26;
  --mid: #f0c14b;
  --mid-soft: #362b17;
  --low: #5fd39a;
  --low-soft: #17322a;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

html, body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-text-size-adjust: 100%;
  -webkit-tap-highlight-color: transparent;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  padding: 16px 16px calc(24px + env(safe-area-inset-bottom));
  min-height: 100vh;
}

.screen { display: none; }
.screen.is-active { display: block; animation: fade .25s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.center {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 16px;
}

.spinner {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.message-icon {
  width: 64px; height: 64px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--accent-soft); color: var(--accent);
}
.message-icon .ico { width: 30px; height: 30px; margin: 0; }
.message-text { margin: 0; font-size: 18px; max-width: 340px; }

/* ── приветствие ── */
.hero {
  position: relative;
  overflow: hidden;
  border-radius: 22px;
  padding: 28px 22px 26px;
  color: #fff;
  background: radial-gradient(120% 90% at 100% 0%, rgba(214, 170, 255, .55), transparent 55%),
              linear-gradient(135deg, var(--hero-1), var(--hero-2));
  box-shadow: var(--shadow);
}
.eyebrow {
  font-size: 12px;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .8;
}
.hero-title {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 28px;
  line-height: 1.2;
  margin: 10px 0 0;
}

.prose { padding: 18px 4px 4px; }
.prose p { margin: 0 0 12px; }

/* ── кнопки ── */
.actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }
.btn {
  appearance: none;
  border: 0;
  width: 100%;
  min-height: 52px;
  padding: 14px 18px;
  border-radius: 14px;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition: transform .08s ease, opacity .15s ease;
}
.btn:active { transform: scale(.985); }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 10px; }
.ico {
  width: 20px; height: 20px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.btn-primary { background: var(--accent); color: var(--accent-text); }
.btn-ghost { background: var(--accent-soft); color: var(--text); }
.btn-video {
  justify-content: flex-start;
  min-height: 46px;
  margin-top: 12px;
  background: var(--accent-soft);
  color: var(--text);
  text-align: left;
}

/* ── вопрос ── */
.q-top { display: flex; align-items: center; gap: 8px; min-height: 40px; }
.icon-btn {
  appearance: none; border: 0; background: transparent; color: var(--text);
  width: 40px; height: 40px; border-radius: 12px; margin-left: -8px;
  display: grid; place-items: center; cursor: pointer;
}
.icon-btn:active { background: var(--accent-soft); }
.q-counter { color: var(--muted); font-size: 14px; font-weight: 600; }

.progress { height: 6px; border-radius: 6px; background: var(--line); overflow: hidden; margin: 8px 0 22px; }
.progress-bar { height: 100%; width: 0; border-radius: 6px; background: var(--accent); transition: width .3s ease; }

.q-body.is-leaving { animation: leave .18s ease forwards; }
.q-body.is-entering { animation: fade .25s ease; }
@keyframes leave { to { opacity: 0; transform: translateY(-6px); } }

.q-text {
  font-family: var(--serif);
  font-weight: 700;
  font-size: 22px;
  line-height: 1.3;
  margin: 0 0 20px;
}
.options { display: flex; flex-direction: column; gap: 10px; }
.option {
  appearance: none;
  width: 100%;
  text-align: left;
  font: inherit;
  color: var(--text);
  background: var(--card);
  border: 1.5px solid var(--line);
  border-radius: 16px;
  padding: 16px 18px;
  min-height: 58px;
  cursor: pointer;
  box-shadow: var(--shadow);
  transition: border-color .15s ease, background .15s ease, transform .08s ease;
}
.option:active { transform: scale(.99); }
.option.is-chosen { border-color: var(--accent); background: var(--accent-soft); }

/* ── результат ── */
.result-head h1 {
  font-family: var(--serif);
  font-size: 26px;
  line-height: 1.25;
  margin: 8px 0 10px;
}
.result-head p { margin: 0 0 18px; color: var(--muted); }

.cards { display: flex; flex-direction: column; gap: 12px; }
.card {
  background: var(--card);
  border-radius: 18px;
  padding: 18px;
  box-shadow: var(--shadow);
}
.card-title { font-weight: 700; font-size: 17px; line-height: 1.4; margin: 0; display: flex; align-items: flex-start; gap: 10px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex: none; margin-top: .45em; }
.dot[data-level="high"] { background: var(--high); }
.dot[data-level="mid"] { background: var(--mid); }
.dot[data-level="low"] { background: var(--low); }
.chip {
  display: inline-block;
  margin: 8px 0 10px;
  padding: 4px 10px;
  border-radius: 8px;
  line-height: 1.35;
  font-size: 13px;
  font-weight: 600;
}
.chip[data-level="high"] { color: var(--high); background: var(--high-soft); }
.chip[data-level="mid"] { color: var(--mid); background: var(--mid-soft); }
.chip[data-level="low"] { color: var(--low); background: var(--low-soft); }
.card p { margin: 0 0 8px; }
.card p:last-child { margin-bottom: 0; }
.card-footer { margin-top: 12px; background: var(--accent-soft); box-shadow: none; }
.card-footer p:first-child { font-family: var(--serif); font-size: 18px; }
