:root {
  --paper: #F2F0F5;
  --surface: #FBFAFC;
  --ink: #231A33;
  --muted: #655E73;
  --line: #D8D2E0;
  --accent: #0F6E68;
  --accent-ink: #FFFFFF;
  --warn: #B0445F;
  --sa: #6B4FA0;
  --sr: #0F6E68;
  --em: #B0445F;
  --so: #A87414;
  --un: #3567A6;
  --serif: "Literata", "Georgia", "Times New Roman", serif;
  --sans: "Onest", "Segoe UI", system-ui, -apple-system, sans-serif;
  color-scheme: light;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #1A1522; --surface: #231C2D; --ink: #EDE8F3; --muted: #A69EB3;
    --line: #3A3147; --accent: #3FB3A9; --accent-ink: #0E1F1D; --warn: #E07A93;
    --sa: #A68BDB; --sr: #3FB3A9; --em: #E07A93; --so: #D9A441; --un: #7FA8E0;
    color-scheme: dark;
  }
}
*, *::before, *::after { box-sizing: inherit; }
html { height: 100%; }
body {
  margin: 0; min-height: 100%;
  background: var(--paper); color: var(--ink);
  font: 400 1rem/1.55 var(--sans);
  -webkit-font-smoothing: antialiased;
}
#app { max-width: 42rem; margin: 0 auto; padding: 2.5rem 1.25rem 2rem; }
[hidden] { display: none !important; }

/* ---------- intro ---------- */
.hero {
  font: 500 clamp(2rem, 6vw, 3.25rem)/1.08 var(--serif);
  letter-spacing: -0.015em; margin: 1rem 0 1.25rem; max-width: 18ch;
}
.lede { font-size: 1.125rem; color: var(--muted); max-width: 36rem; margin: 0 0 2rem; }
.facts { display: flex; gap: 2.5rem; margin: 0 0 2rem; padding: 1.25rem 0; border-block: 1px solid var(--line); }
.facts div { display: flex; flex-direction: column-reverse; }
.facts dt { color: var(--muted); font-size: .875rem; }
.facts dd { margin: 0; font: 500 1.5rem/1.2 var(--serif); }
.areas { list-style: none; padding: 0; margin: 0 0 2rem; display: flex; flex-wrap: wrap; gap: .5rem; }
.areas li {
  padding: .3rem .8rem .3rem .65rem; border-radius: 999px; font-size: .9rem;
  background: color-mix(in srgb, var(--c) 12%, transparent);
  border-left: 3px solid var(--c);
}
.howto { color: var(--muted); font-size: .95rem; margin-bottom: 2rem; }
.howto p { margin: 0 0 .75rem; }

/* ---------- buttons ---------- */
button { font: inherit; cursor: pointer; }
button:focus-visible { outline: 3px solid var(--accent); outline-offset: 3px; }
.primary {
  background: var(--accent); color: var(--accent-ink); border: 0;
  padding: .85rem 1.6rem; border-radius: .5rem; font-weight: 600; font-size: 1rem;
}
.primary:disabled { opacity: .55; cursor: progress; }
.ghost {
  background: transparent; color: var(--ink); border: 1px solid var(--line);
  padding: .85rem 1.3rem; border-radius: .5rem; font-weight: 500;
}
.ghost:disabled { opacity: .35; cursor: default; }
.error { color: var(--warn); }

/* ---------- test ---------- */
.bar { position: sticky; top: env(safe-area-inset-top, 0px); background: var(--paper); padding: .5rem 0 1rem; z-index: 2; }
.progress { height: 4px; background: var(--line); border-radius: 2px; overflow: hidden; }
.progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .3s ease; }
.barrow { display: flex; justify-content: space-between; margin-top: .6rem; font-size: .9rem; color: var(--muted); font-variant-numeric: tabular-nums; }
#timer.low { color: var(--warn); font-weight: 600; }

#qbox { min-height: 22rem; padding: 1.25rem 0 1.5rem; }
.kind { font-size: .85rem; color: var(--muted); margin: 0 0 .9rem; display: flex; align-items: center; gap: .5rem; }
.kind::before { content: ""; width: .6rem; height: .6rem; border-radius: 50%; background: var(--c, var(--muted)); }
.situation { font: 400 1.3rem/1.5 var(--serif); margin: 0 0 1rem; }
.stem { font-weight: 600; margin: 0 0 1.25rem; font-size: 1.05rem; }

.options { display: grid; gap: .6rem; }
.opt {
  text-align: left; background: var(--surface); color: var(--ink);
  border: 1px solid var(--line); border-left-width: 4px; border-radius: .45rem;
  padding: .85rem 1rem; line-height: 1.45; transition: border-color .15s, background .15s;
}
.opt:hover { border-color: color-mix(in srgb, var(--accent) 55%, var(--line)); }
.opt[aria-pressed="true"] { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, var(--surface)); }
.opt .emo::first-letter { text-transform: uppercase; }

.scale { display: grid; grid-template-columns: repeat(5, 1fr); gap: .4rem; }
.scale .opt { text-align: center; padding: .9rem .3rem; border-left-width: 1px; border-bottom-width: 4px; font-size: .9rem; }
.scale .opt b { display: block; font: 500 1.25rem/1 var(--serif); margin-bottom: .35rem; }
@media (max-width: 34rem) {
  .scale { grid-template-columns: 1fr; }
  .scale .opt { display: flex; align-items: center; gap: .9rem; text-align: left; border-bottom-width: 1px; border-left-width: 4px; }
  .scale .opt b { margin: 0; width: 1.2rem; }
}
.nav { display: flex; justify-content: space-between; gap: 1rem; padding-top: 1rem; border-top: 1px solid var(--line); }

/* ---------- result ---------- */
.rtitle { font: 500 clamp(1.8rem, 5vw, 2.6rem)/1.15 var(--serif); margin: 1rem 0 .5rem; letter-spacing: -0.01em; }
.rsum { font-size: 1.1rem; color: var(--muted); margin: 0 0 2rem; }
@media (prefers-reduced-motion: reduce) { .progress span { animation: none; transition: none; } }

.domain { padding: 1.1rem 0; border-top: 1px solid var(--line); }
.dhead { display: flex; justify-content: space-between; align-items: baseline; gap: 1rem; }
.dname { font: 500 1.2rem/1.3 var(--serif); margin: 0; }
.dscore { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.dbar { height: 6px; background: var(--line); border-radius: 3px; margin: .6rem 0 .75rem; overflow: hidden; }
.dbar span { display: block; height: 100%; background: var(--c); border-radius: 3px; }
.domain p { margin: 0 0 .4rem; color: var(--muted); font-size: .95rem; }
.domain p.tip { color: var(--ink); }
.rmeta { color: var(--muted); font-size: .9rem; margin: 1.5rem 0; }
.ractions { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.5rem 0 1rem; }
.foot { margin-top: 3rem; color: var(--muted); font-size: .8rem; }

/* ---------- езици ---------- */
.langs { display: flex; gap: .25rem; justify-content: flex-end; min-height: 2rem; }
.langs button { background: none; border: 0; color: var(--muted); padding: .3rem .6rem; border-radius: .35rem; font-size: .9rem; }
.langs button[aria-current="true"] { color: var(--ink); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- анкета ---------- */
.survey { margin-top: 2.5rem; padding: 1.5rem; background: var(--surface); border: 1px solid var(--line); border-radius: .6rem; }
.survey h2 { font: 500 1.35rem/1.25 var(--serif); margin: 0 0 .4rem; }
.survey > p { color: var(--muted); margin: 0 0 1.25rem; font-size: .95rem; }
.fgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem 1.25rem; }
.fgrid .wide { grid-column: 1 / -1; }
@media (max-width: 34rem) { .fgrid { grid-template-columns: 1fr; } }
.fgrid label { display: flex; flex-direction: column; gap: .35rem; font-size: .9rem; }
.fgrid select, .fgrid input[type=text] {
  font: inherit; color: var(--ink); background: var(--paper); border: 1px solid var(--line);
  border-radius: .4rem; padding: .6rem .7rem; min-height: 2.75rem;
}
.fgrid select:focus-visible, .fgrid input:focus-visible { outline: 3px solid var(--accent); outline-offset: 1px; }
.consent { display: flex; gap: .7rem; align-items: flex-start; margin: 1.4rem 0 1.2rem; font-size: .9rem; color: var(--muted); }
.consent input { width: 1.2rem; height: 1.2rem; margin-top: .15rem; accent-color: var(--accent); flex: none; }
.smsg { margin: .9rem 0 0; font-size: .95rem; }
.smsg.ok { color: var(--accent); font-weight: 600; }

/* ---------- покана от организация (част 8) ---------- */
.orgnote { margin: -1rem 0 2rem; padding: .8rem 1rem; border-left: 3px solid var(--accent); background: var(--surface); font-size: .95rem; border-radius: 0 .4rem .4rem 0; }

/* ---------- печат / PDF на личния резултат ---------- */
@media print {
  :root { --paper: #fff; --surface: #fff; --ink: #111; --muted: #444; --line: #ccc; color-scheme: light; }
  body { background: #fff; }
  #app { max-width: none; padding: 0; }
  .langs, .survey, .ractions, #intro, #test { display: none !important; }
  .domain { break-inside: avoid; }
  .dbar, .dbar span { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
}
