/* ─── Лерочкин тренажёр ─────────────────────────────────────────── */

:root {
  --bg: #fff7fa;
  --ink: #40222f;
  --muted: #8f6c7c;
  --pink: #ec4f8c;
  --pink-d: #cf3a74;
  --pink-l: #ffe1ec;
  --pink-xl: #fff3f8;
  --lilac: #b98cf0;
  --card: #ffffff;
  --line: #f7dae7;
  --ok: #1f9d76;
  --ok-bg: #e7f8f1;
  --ok-line: #b6e6d4;
  --bad: #e04f6b;
  --bad-bg: #fdecef;
  --bad-line: #f7c9d2;
  --warn: #e0912f;
  --r: 22px;
  --r-sm: 14px;
  --shadow: 0 10px 30px rgba(236, 79, 140, .10);
  --shadow-sm: 0 4px 14px rgba(236, 79, 140, .08);
}

html.t-rus {
  --pink: #d94fa8;
  --pink-d: #bb3a8f;
  --pink-l: #fbdcf3;
  --pink-xl: #fdf2fb;
  --line: #f4d8ee;
  --bg: #fff7fd;
  --shadow: 0 10px 30px rgba(217, 79, 168, .10);
  --shadow-sm: 0 4px 14px rgba(217, 79, 168, .08);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 17px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  overflow-wrap: break-word;
}

.bg-blobs {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: .55;
}

.blob-1 { width: 340px; height: 340px; background: var(--pink-l); top: -120px; left: -100px; }
.blob-2 { width: 300px; height: 300px; background: #ffe9d6; top: 30%; right: -140px; }
.blob-3 { width: 380px; height: 380px; background: #f0e3ff; bottom: -160px; left: -120px; }

.wrap {
  width: 100%;
  max-width: 760px;
  margin: 0 auto;
  padding: 0 18px;
}

h1, h2, h3 { line-height: 1.2; margin: 0; letter-spacing: -.02em; overflow-wrap: break-word; }
p { margin: 0 0 12px; }
p:last-child { margin-bottom: 0; }

/* ─── шапка ─────────────────────────────────────────────────────── */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px 0 6px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 14.5px;
  white-space: nowrap;
  color: var(--pink-d);
}

.brand .dot {
  width: 30px; height: 30px;
  display: grid; place-items: center;
  background: var(--pink-l);
  border-radius: 50%;
  font-size: 16px;
}

.switch {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--pink-d);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease;
}
.switch:active { transform: scale(.97); }

/* ─── герой ─────────────────────────────────────────────────────── */

.hero {
  margin-top: 14px;
  background: linear-gradient(160deg, #fff 0%, var(--pink-xl) 100%);
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 28px 22px 26px;
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}

.hero::after {
  content: "";
  position: absolute;
  width: 180px; height: 180px;
  right: -60px; top: -70px;
  background: radial-gradient(circle, var(--pink-l), transparent 70%);
}

.hi {
  display: inline-block;
  background: var(--pink);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
  padding: 6px 13px;
  border-radius: 999px;
  margin-bottom: 14px;
}

.hero h1 {
  font-size: 32px;
  margin-bottom: 12px;
  position: relative;
}

.hero .lead {
  color: var(--muted);
  font-size: 16px;
  position: relative;
  max-width: 46ch;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  position: relative;
}

.chip {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--pink-d);
}

/* ─── секции ────────────────────────────────────────────────────── */

section.blk { margin-top: 34px; }

.blk-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.blk-head h2 { font-size: 22px; }

.blk-head .note { font-size: 13.5px; color: var(--muted); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

/* ─── как это работает ──────────────────────────────────────────── */

.steps { display: grid; gap: 10px; }

.step {
  display: flex;
  gap: 13px;
  align-items: flex-start;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px 15px;
}

.step .num {
  flex: none;
  width: 27px; height: 27px;
  border-radius: 50%;
  background: var(--pink-l);
  color: var(--pink-d);
  font-weight: 800;
  font-size: 14px;
  display: grid; place-items: center;
}

.step b { display: block; font-size: 15.5px; }
.step span { font-size: 14.5px; color: var(--muted); }

/* ─── режимы ────────────────────────────────────────────────────── */

.modes { display: grid; gap: 12px; }

.mode {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 16px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: transform .15s ease, border-color .15s ease;
}
.mode:hover { border-color: var(--pink); }
.mode:active { transform: scale(.985); }
.mode[hidden] { display: none; }

.mode .ico {
  flex: none;
  width: 46px; height: 46px;
  border-radius: 15px;
  background: var(--pink-xl);
  display: grid; place-items: center;
  font-size: 22px;
}

.mode .txt b { display: block; font-size: 16.5px; }
.mode .txt span { font-size: 14px; color: var(--muted); }

.mode.primary {
  background: linear-gradient(140deg, var(--pink) 0%, var(--pink-d) 100%);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 12px 26px rgba(236, 79, 140, .28);
}
.mode.primary .ico { background: rgba(255, 255, 255, .22); }
.mode.primary .txt span { color: rgba(255, 255, 255, .85); }

.toggle-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 14px;
  padding: 13px 15px;
  background: var(--pink-xl);
  border: 1px dashed var(--line);
  border-radius: var(--r-sm);
  font-size: 14.5px;
  cursor: pointer;
  user-select: none;
}

.toggle-row .sw {
  flex: none;
  width: 44px; height: 26px;
  border-radius: 999px;
  background: #e6cdd8;
  position: relative;
  transition: background .18s ease;
}
.toggle-row .sw::after {
  content: "";
  position: absolute;
  top: 3px; left: 3px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: #fff;
  transition: transform .18s ease;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}
.toggle-row.on .sw { background: var(--pink); }
.toggle-row.on .sw::after { transform: translateX(18px); }
.toggle-row .sw-txt b { display: block; }
.toggle-row .sw-txt span { color: var(--muted); font-size: 13.5px; }

/* ─── прогресс / блоки ──────────────────────────────────────────── */

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 14px;
}

.stat {
  background: var(--pink-xl);
  border-radius: var(--r-sm);
  padding: 12px 10px;
  text-align: center;
}
.stat b { display: block; font-size: 22px; color: var(--pink-d); line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat span { font-size: 12.5px; color: var(--muted); }

.bars { display: grid; gap: 11px; }

.bar-row { display: grid; gap: 5px; }

.bar-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 10px;
  font-size: 14.5px;
}
.bar-top .name { font-weight: 600; }
.bar-top .val { font-variant-numeric: tabular-nums; color: var(--muted); font-size: 13.5px; flex: none; }

.track {
  height: 9px;
  border-radius: 999px;
  background: var(--pink-l);
  overflow: hidden;
}
.fill {
  height: 100%;
  border-radius: 999px;
  background: var(--pink);
  width: 0;
  transition: width .7s cubic-bezier(.22, 1, .36, 1);
}
.fill.good { background: linear-gradient(90deg, #35c295, var(--ok)); }
.fill.mid { background: linear-gradient(90deg, #ffc46b, var(--warn)); }
.fill.low { background: linear-gradient(90deg, #ff8fa5, var(--bad)); }
.fill.none { background: #e8d3dd; }

.empty-note {
  text-align: center;
  color: var(--muted);
  font-size: 14.5px;
  padding: 6px 0 2px;
}

/* ─── аккордеон ─────────────────────────────────────────────────── */

details.acc {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 0;
  margin-bottom: 9px;
  overflow: hidden;
}
details.acc > summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-weight: 600;
  font-size: 15px;
  display: flex;
  gap: 10px;
  align-items: center;
}

details.acc > summary .acc-title { flex: 1; min-width: 0; }

details.acc > summary .acc-count {
  flex: none;
  font-weight: 400;
  font-size: 13px;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  text-align: right;
  min-width: 2.4em;
}
details.acc > summary::-webkit-details-marker { display: none; }
details.acc > summary::after {
  content: "+";
  color: var(--pink);
  font-size: 20px;
  font-weight: 700;
  flex: none;
  line-height: 1;
}
details.acc[open] > summary::after { content: "–"; }
details.acc .acc-body {
  padding: 0 16px 15px;
  font-size: 15px;
  color: var(--muted);
}
details.acc .acc-body b { color: var(--ink); }

/* ─── подтверждение ─────────────────────────────────────────────── */

.modal-back {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: rgba(64, 34, 47, .45);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: grid;
  place-items: center;
  padding: 20px;
}
.modal-back[hidden] { display: none; }

.modal {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: 24px;
  padding: 24px 22px 20px;
  box-shadow: 0 20px 50px rgba(64, 34, 47, .25);
  animation: pop .18s cubic-bezier(.22, 1, .36, 1);
}
@keyframes pop { from { transform: scale(.94); opacity: 0; } to { transform: scale(1); opacity: 1; } }

.modal h3 { font-size: 20px; margin-bottom: 10px; }
.modal p { font-size: 15px; color: var(--muted); }
.modal-btns { display: grid; gap: 9px; margin-top: 18px; }

.btn.danger {
  background: linear-gradient(140deg, #ef6a7f, #d94159);
  box-shadow: 0 8px 20px rgba(217, 65, 89, .26);
}

@media (min-width: 480px) {
  .modal-btns { grid-template-columns: 1fr 1fr; }
}

.sync-status {
  margin-top: 12px;
  font-size: 12.5px;
  color: var(--muted);
  text-align: center;
  padding: 7px 10px;
  border-radius: 999px;
  background: var(--pink-xl);
  transition: color .2s ease, background .2s ease;
}
.sync-status::before { content: "☁ "; }
.sync-status.ok { color: #14654c; background: var(--ok-bg); }
.sync-status.ok::before { content: "✓ "; }
.sync-status.busy { color: var(--pink-d); }
.sync-status.off { color: #8a6b2f; background: #fdf1d8; }
.sync-status.off::before { content: "⚠ "; }

.badge-off {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .01em;
  text-transform: lowercase;
  color: #8a6b2f;
  background: #fdf1d8;
  border: 1px solid #f0dcae;
  border-radius: 999px;
  padding: 2px 8px;
  margin-left: 6px;
  vertical-align: middle;
  white-space: nowrap;
}

details.acc.off > summary { color: var(--muted); }

/* ─── письмо ────────────────────────────────────────────────────── */

.letter {
  background: linear-gradient(150deg, var(--pink-xl), #fff);
  border: 1px solid var(--line);
  border-radius: 26px;
  padding: 24px 22px;
  box-shadow: var(--shadow);
  font-size: 16px;
}
.letter h2 { font-size: 21px; margin-bottom: 12px; }
.letter p { color: #5c3b4a; }
.letter .sign {
  margin-top: 14px;
  font-size: 14.5px;
  color: var(--muted);
}

footer {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
  padding: 34px 0 40px;
}
footer a { color: var(--pink-d); }

/* ─── тест ──────────────────────────────────────────────────────── */

.quiz-top {
  position: sticky;
  top: 0;
  z-index: 5;
  background: rgba(255, 247, 250, .92);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 12px 0 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.quiz-top-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 9px;
}

.icon-btn {
  flex: none;
  width: 36px; height: 36px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--pink-d);
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
}

.quiz-meta {
  flex: 1;
  min-width: 0;
  font-size: 13.5px;
  color: var(--muted);
}
.quiz-meta b { color: var(--ink); font-size: 15px; }
.quiz-meta .blkname {
  display: block;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.score-live {
  flex: none;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--pink-d);
  background: var(--pink-l);
  border-radius: 999px;
  padding: 5px 11px;
  font-variant-numeric: tabular-nums;
}

.q-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 20px 18px;
  box-shadow: var(--shadow);
  margin-top: 14px;
}

.q-text {
  font-size: 19px;
  font-weight: 650;
  line-height: 1.35;
  margin-bottom: 16px;
}

.opts { display: grid; gap: 9px; }

.opt {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
  text-align: left;
  font: inherit;
  color: inherit;
  background: #fff;
  border: 1.5px solid var(--line);
  border-radius: var(--r-sm);
  padding: 13px 14px;
  cursor: pointer;
  min-height: 50px;
  transition: border-color .12s ease, background .12s ease, transform .12s ease;
}
.opt:hover:not(:disabled) { border-color: var(--pink); background: var(--pink-xl); }
.opt:active:not(:disabled) { transform: scale(.99); }
.opt:disabled { cursor: default; }

.opt .let {
  flex: none;
  width: 26px; height: 26px;
  border-radius: 8px;
  background: var(--pink-xl);
  color: var(--pink-d);
  font-weight: 700;
  font-size: 13.5px;
  display: grid; place-items: center;
  margin-top: 1px;
}

.opt .lbl { font-size: 15.5px; line-height: 1.4; }

.opt.sel { border-color: var(--pink); background: var(--pink-xl); }
.opt.sel .let { background: var(--pink); color: #fff; }

.opt.right { border-color: var(--ok-line); background: var(--ok-bg); }
.opt.right .let { background: var(--ok); color: #fff; }
.opt.wrong { border-color: var(--bad-line); background: var(--bad-bg); }
.opt.wrong .let { background: var(--bad); color: #fff; }

.verdict {
  margin-top: 14px;
  padding: 13px 15px;
  border-radius: var(--r-sm);
  font-size: 15px;
  border: 1px solid transparent;
}
.verdict.ok { background: var(--ok-bg); border-color: var(--ok-line); color: #14654c; }
.verdict.no { background: var(--bad-bg); border-color: var(--bad-line); color: #932b40; }
.verdict b { display: block; margin-bottom: 3px; }
.verdict .sub { font-size: 14px; opacity: .9; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 15px 20px;
  border: none;
  border-radius: var(--r-sm);
  background: linear-gradient(140deg, var(--pink), var(--pink-d));
  color: #fff;
  font: inherit;
  font-weight: 700;
  font-size: 16px;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(236, 79, 140, .26);
  transition: transform .14s ease, opacity .14s ease;
}
.btn:active { transform: scale(.985); }
.btn[disabled] { opacity: .45; box-shadow: none; cursor: default; }

.btn.ghost {
  background: #fff;
  color: var(--pink-d);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
}

.btn-row { display: grid; gap: 10px; margin-top: 16px; }

.cheer {
  text-align: center;
  font-size: 14.5px;
  color: var(--pink-d);
  background: var(--pink-xl);
  border-radius: var(--r-sm);
  padding: 10px 14px;
  margin-top: 14px;
}

/* ─── результат ─────────────────────────────────────────────────── */

.result-hero {
  text-align: center;
  background: linear-gradient(160deg, #fff, var(--pink-xl));
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 26px 20px;
  box-shadow: var(--shadow);
  margin-top: 16px;
}

.ring {
  width: 148px; height: 148px;
  margin: 4px auto 14px;
  position: relative;
}
.ring svg { transform: rotate(-90deg); display: block; }
.ring .ring-mid {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  text-align: center;
}
.ring .big {
  font-size: 38px;
  font-weight: 800;
  color: var(--pink-d);
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.ring .small { font-size: 12.5px; color: var(--muted); margin-top: 3px; }

.result-hero h2 { font-size: 24px; margin-bottom: 8px; }
.result-hero .msg { color: #5c3b4a; font-size: 15.5px; max-width: 42ch; margin: 0 auto; }

.mini-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 9px;
  margin-top: 18px;
}
.mini {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 11px 6px;
}
.mini b { display: block; font-size: 19px; color: var(--ink); font-variant-numeric: tabular-nums; }
.mini span { font-size: 12px; color: var(--muted); }

.zone {
  border-radius: var(--r-sm);
  padding: 14px 15px;
  margin-bottom: 10px;
  border: 1px solid;
  font-size: 15px;
}
.zone h3 { font-size: 15.5px; margin-bottom: 6px; }
.zone.z-ok { background: var(--ok-bg); border-color: var(--ok-line); }
.zone.z-ok h3 { color: #14654c; }
.zone.z-low { background: var(--bad-bg); border-color: var(--bad-line); }
.zone.z-low h3 { color: #932b40; }
.zone ul { margin: 0; padding-left: 19px; }
.zone li { margin-bottom: 3px; }

.plan-item {
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--pink);
  border-radius: var(--r-sm);
  padding: 15px 16px;
  margin-bottom: 10px;
}
.plan-item .ttl {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: baseline;
  margin-bottom: 7px;
}
.plan-item .ttl b { font-size: 16px; }
.plan-item .ttl .pc {
  flex: none;
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--pink-l);
  color: var(--pink-d);
}
.plan-item p { font-size: 14.8px; color: var(--muted); }
.plan-item .subs {
  margin-top: 9px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.plan-item .subs span {
  font-size: 12.5px;
  background: var(--bad-bg);
  color: #932b40;
  border-radius: 999px;
  padding: 4px 10px;
}

.rev {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 14px 15px;
  margin-bottom: 9px;
  font-size: 15px;
}
.rev .rq { font-weight: 600; margin-bottom: 9px; }
.rev .line { display: flex; gap: 8px; font-size: 14.5px; margin-bottom: 4px; }
.rev .line .tag { flex: none; font-size: 12px; font-weight: 700; padding: 2px 8px; border-radius: 999px; height: fit-content; margin-top: 2px; }
.rev .line.no .tag { background: var(--bad-bg); color: #932b40; }
.rev .line.yes .tag { background: var(--ok-bg); color: #14654c; }
.rev .topic { margin-top: 8px; font-size: 12.5px; color: var(--muted); }

@media (max-width: 360px) {
  .wrap { padding: 0 14px; }
  .hero { padding: 24px 18px 22px; }
  .hero h1 { font-size: 27px; }
  .q-text { font-size: 18px; }
  .stat b { font-size: 19px; }
  .ring .big { font-size: 34px; }
}

@media (max-width: 430px) {
  .topbar { gap: 8px; }
  .brand { font-size: 13px; gap: 7px; }
  .brand .dot { width: 27px; height: 27px; font-size: 14px; }
  .switch { font-size: 12.5px; padding: 7px 11px; gap: 5px; }
}

@media (max-width: 559px) {
  .blk-head { flex-wrap: wrap; }
  .blk-head h2 { flex: 1 1 100%; }
  .blk-head .note { flex: 1 1 100%; margin-top: -2px; }
}

@media (min-width: 640px) {
  body { font-size: 17.5px; }
  .hero { padding: 36px 32px 32px; }
  .hero h1 { font-size: 40px; }
  .wrap { padding: 0 24px; }
  .q-card { padding: 26px 24px; }
  .q-text { font-size: 21px; }
  .btn-row { grid-template-columns: 1fr 1fr; }
  .btn-row .full { grid-column: 1 / -1; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .step { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
