/* Ремонтофобия: стили. Сначала телефон, потом планшет и десктоп.
 * С 16.11.2026 сайт в чёрных тонах, как в исходнике (прототип от 09.11):
 * чёрный фон, светлый текст, золотой акцент. Справка остаётся светлым бланком. */

:root {
  --paper: #0A0A0A;
  --paper-deep: #1F1F1F;
  --card: #141414;
  --sheet: #191919;
  --ink: #EDE9E1;
  --ink-2: #B3AEA5;
  --ink-3: #85817A;
  --line: #2A2A2A;
  --line-2: #3A3835;
  --gold: #C9A96E;
  --gold-hi: #DCC08C;
  --gold-tint: rgba(201, 169, 110, .13);
  --red: #E5484D;
  --red-deep: #C3262E;
  --red-tint: rgba(229, 72, 77, .14);
  --blue: #7D9BEA;
  --blue-ink: #A9BCF2;
  --green: #4FBF8A;
  --green-tint: rgba(79, 191, 138, .14);
  --todo: #FFE69A;
  --todo-ink: #5E4600;

  --font-ui: "Golos Text", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --font-display: "Cormorant Garamond", "PT Serif", Georgia, serif;
  --font-doc: "PT Serif", Georgia, "Times New Roman", serif;
  --font-mono: "PT Mono", ui-monospace, "Courier New", monospace;
  --font-hand: "Caveat", "Segoe Print", cursive;

  --radius: 14px;
  --radius-sm: 10px;
  --shadow: 0 1px 0 rgba(255, 255, 255, .03) inset, 0 14px 34px -18px rgba(0, 0, 0, .8);
  --shadow-paper: 0 2px 4px rgba(0, 0, 0, .4), 0 28px 60px -22px rgba(0, 0, 0, .85);
  --gutter: 16px;
  color-scheme: dark;
}

/* Справка и её превью на старте остаются бумажным бланком */
.cert, .mini-cert {
  --paper: #F3EEE4;
  --paper-deep: #E8E1D2;
  --card: #FFFCF6;
  --sheet: #FFFDF8;
  --ink: #1E2330;
  --ink-2: #4B5162;
  --ink-3: #7D8190;
  --line: #DDD5C5;
  --line-2: #CBC1AD;
  --red: #C3262E;
  --red-deep: #A11D24;
  --red-tint: #F8E5E1;
  --blue: #2747A0;
  --blue-ink: #1F3C8A;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-padding-top: 16px; }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-ui);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

main { flex: 1 0 auto; }

h1, h2, h3, p { margin: 0; }
button, input, textarea, select { font: inherit; color: inherit; }
a { color: var(--gold); }
.cert a { color: var(--blue-ink); }
html.modal-open { overflow: hidden; }
img, svg { display: block; }
[hidden] { display: none !important; }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

:focus-visible { outline: 3px solid var(--gold); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }

.container {
  width: 100%;
  max-width: 1120px;
  margin: 0 auto;
  padding-left: max(var(--gutter), env(safe-area-inset-left));
  padding-right: max(var(--gutter), env(safe-area-inset-right));
}
.container.narrow { max-width: 760px; }

.eyebrow {
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
}

/* ---------- Шапка ---------- */
.site-header {
  border-bottom: 1px solid var(--line);
  background: rgba(10, 10, 10, .86);
  -webkit-backdrop-filter: saturate(1.2) blur(8px);
  backdrop-filter: saturate(1.2) blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 62px;
  padding-top: 8px;
  padding-bottom: 8px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
  min-width: 0;
}
.brand-emblem { width: 38px; height: 38px; flex: none; color: var(--ink); --emblem-bg: var(--paper); }
.brand-text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.brand-name {
  color: var(--red);
  font-weight: 800;
  font-size: 13px;
  letter-spacing: .06em;
  text-transform: uppercase;
}
.brand-note { color: var(--ink-2); font-size: 13px; }
.header-status {
  display: none;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 6px 12px;
  white-space: nowrap;
  transition: color .3s, border-color .3s, background .3s;
}
.header-status i {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-tint);
}
.header-status.is-noisy { color: var(--red); border-color: rgba(229, 72, 77, .4); background: var(--red-tint); }
.header-status.is-noisy i { background: var(--red); box-shadow: 0 0 0 3px rgba(229, 72, 77, .2); animation: blink .5s steps(2) infinite; }
@keyframes blink { 50% { opacity: .2; } }

/* ---------- Кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 12px 22px;
  border-radius: 6px;
  border: 1.5px solid transparent;
  font-weight: 600;
  font-size: 16px;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s, transform .1s, box-shadow .2s;
  -webkit-tap-highlight-color: transparent;
}
.btn svg { width: 20px; height: 20px; flex: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .65; cursor: progress; }
.btn-primary { background: var(--gold); color: #0A0A0A; box-shadow: 0 8px 22px -12px rgba(201, 169, 110, .75); }
.btn-primary:hover { background: var(--gold-hi); }
.btn-secondary { background: transparent; color: var(--ink); border-color: var(--line-2); }
.btn-secondary:hover { border-color: var(--gold); color: var(--gold-hi); }
.btn-ghost { background: transparent; color: var(--ink-2); border-color: transparent; text-decoration: underline; text-underline-offset: 3px; }
.btn-ghost:hover { color: var(--ink); }
.btn-xl { min-height: 60px; padding: 16px 38px; font-size: 15px; font-weight: 700; letter-spacing: .18em; text-transform: uppercase; }
.btn-block { width: 100%; }
.btn-small { min-height: 44px; padding: 8px 16px; font-size: 15px; }
.btn.is-todo { opacity: .55; cursor: not-allowed; box-shadow: none; }
.btn.is-open { background: transparent; color: var(--gold); border-color: var(--gold); box-shadow: none; }

/* Плашка «заполнить в config.js» */
.todo {
  display: inline-block;
  background: var(--todo);
  color: var(--todo-ink);
  font-family: var(--font-mono);
  font-size: 12.5px;
  line-height: 1.35;
  padding: 2px 7px;
  border-radius: 5px;
  border: 1px dashed rgba(94, 70, 0, .45);
  vertical-align: middle;
}
.todo-badge {
  position: fixed;
  left: max(12px, env(safe-area-inset-left));
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 50;
  max-width: calc(100vw - 24px);
}
.todo-badge-btn {
  border: 1px dashed rgba(94, 70, 0, .5);
  background: var(--todo);
  color: var(--todo-ink);
  font-family: var(--font-mono);
  font-size: 12px;
  border-radius: 8px;
  padding: 6px 10px;
  cursor: pointer;
  box-shadow: var(--shadow);
}
.todo-list {
  margin: 8px 0 0;
  padding: 10px 14px 10px 28px;
  background: #FFF6D6;
  color: var(--todo-ink);
  border: 1px dashed rgba(94, 70, 0, .45);
  border-radius: 8px;
  font-size: 13px;
  max-height: 50vh;
  overflow: auto;
  box-shadow: var(--shadow);
}
.todo-badge-close {
  margin-left: 4px;
  width: 30px; height: 30px;
  border: 1px dashed rgba(94, 70, 0, .5);
  border-radius: 8px;
  background: var(--todo);
  color: var(--todo-ink);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  vertical-align: top;
}
.todo-list li { margin: 3px 0; }
.todo-list code { font-family: var(--font-mono); font-weight: 700; }

/* ---------- Экраны ---------- */
.screen { padding: 28px 0 56px; }
.screen.enter { animation: screen-in .45s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes screen-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- 1. Старт ---------- */
.hero { display: grid; gap: 36px; align-items: center; }
.hero-title {
  font-family: var(--font-display);
  font-size: clamp(34px, 9.6vw, 64px);
  line-height: 1.05;
  font-weight: 600;
  letter-spacing: 0;
  text-wrap: balance;
}
.hero-accent {
  display: block;
  margin-bottom: 10px;
  color: var(--ink);
  font-size: clamp(28px, 7.4vw, 60px);
  font-weight: 700;
  letter-spacing: .03em;
  text-transform: uppercase;
}
.hero-accent::after {
  content: "";
  display: block;
  width: 72px;
  height: 2px;
  margin-top: 14px;
  background: var(--gold);
}
.hero-eyebrow { margin-bottom: 14px; }
.hero-question { margin-top: 16px; font-family: var(--font-display); font-size: clamp(22px, 5.6vw, 28px); line-height: 1.25; color: var(--ink); max-width: 26em; text-wrap: pretty; }
.hero-help { margin-top: 18px; font-weight: 800; font-size: 17px; letter-spacing: .2em; text-transform: uppercase; color: var(--gold); }
.hero-lead { margin-top: 10px; font-size: 18px; color: var(--ink-2); max-width: 34em; text-wrap: pretty; }
.hero .btn-xl { margin-top: 28px; width: 100%; }
.hero-disclaimer { margin-top: 14px; font-size: 13.5px; color: var(--ink-3); max-width: 30em; }
.hero-resume { margin-top: 18px; font-size: 15px; }
.hero-resume a { font-weight: 600; }

.hero-visual { position: relative; display: flex; justify-content: center; padding: 8px 0 12px; }
.mini-cert {
  position: relative;
  width: min(100%, 340px);
  aspect-ratio: 210 / 250;
  background: var(--sheet);
  color: var(--ink);
  border-radius: 6px;
  box-shadow: 0 0 0 1px rgba(201, 169, 110, .25), 0 30px 70px -20px rgba(0, 0, 0, .9), 0 0 90px -30px rgba(201, 169, 110, .35);
  padding: 22px 22px 18px;
  overflow: hidden;
  transform: rotate(-2.5deg);
}
.mini-cert::before {
  content: "";
  position: absolute; inset: 9px;
  border: 1px solid rgba(30, 35, 48, .55);
  border-radius: 3px;
  pointer-events: none;
}
.mini-rosette { position: absolute; width: 120%; left: -10%; top: 30%; opacity: .9; pointer-events: none; }
.mini-rosette path, .cert-rosette path { fill: none; stroke: rgba(39, 71, 160, .1); stroke-width: .35; }
.mini-head { position: relative; display: flex; align-items: center; gap: 8px; padding-bottom: 10px; border-bottom: 2px solid var(--ink); }
.mini-head svg { width: 24px; height: 24px; color: var(--ink); --emblem-bg: var(--sheet); }
.mini-head span { color: var(--red); font-size: 9px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.mini-title { position: relative; margin-top: 18px; text-align: center; font-family: var(--font-doc); font-weight: 700; font-size: 21px; letter-spacing: .06em; text-transform: uppercase; }
.mini-blank { display: inline-block; width: 46px; border-bottom: 1.5px solid var(--ink); vertical-align: -2px; }
.mini-sub { position: relative; text-align: center; font-family: var(--font-doc); font-style: italic; color: var(--ink-2); font-size: 13px; margin-top: 2px; }
.mini-lines { position: relative; margin-top: 20px; display: grid; gap: 13px; }
.mini-lines i { display: block; height: 8px; border-radius: 4px; background: rgba(30, 35, 48, .09); }
.mini-lines i.short { width: 60%; }
.mini-stamp { position: absolute; left: 20px; bottom: 34px; font-size: 13px; transform: rotate(-10deg); }
.mini-seal { position: absolute; right: 16px; bottom: 14px; width: 104px; height: 104px; transform: rotate(14deg); }

/* штампы и печать (общие) */
.stamp-rect {
  display: inline-block;
  color: var(--red);
  border: 3px solid currentColor;
  outline: 1px solid currentColor;
  outline-offset: -8px;
  border-radius: 8px;
  padding: .55em .9em;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .08em;
  line-height: 1.15;
  text-align: center;
  mix-blend-mode: multiply;
  filter: url(#ink-rough);
  opacity: .9;
}
.seal { color: var(--blue); mix-blend-mode: multiply; filter: url(#ink-rough); opacity: .88; }

/* ---------- 2. Квиз ---------- */
.medcard {
  position: relative;
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--line);
  overflow: hidden;
}
.medcard::before {
  content: "";
  position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: var(--gold);
}
.medcard-top {
  padding: 18px 18px 16px 22px;
  border-bottom: 1px dashed var(--line-2);
  background:
    repeating-linear-gradient(0deg, transparent 0 23px, rgba(255, 255, 255, .035) 23px 24px),
    var(--sheet);
}
.medcard-label { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3); }
.medcard-progress { margin-top: 4px; font-family: var(--font-mono); font-size: 17px; font-weight: 700; color: var(--gold); }
.progress { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; margin-top: 12px; }
.progress i { height: 4px; border-radius: 2px; background: var(--paper-deep); transition: background .3s; }
.progress i.done { background: var(--ink-3); }
.progress i.now { background: var(--gold); }

.medcard-body { padding: 22px 18px 8px 22px; }
.medcard-body.q-enter { animation: q-in .35s cubic-bezier(.2, .7, .2, 1) both; }
@keyframes q-in { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
.q-title { font-family: var(--font-display); font-size: clamp(25px, 6.6vw, 34px); line-height: 1.18; font-weight: 600; letter-spacing: 0; text-wrap: pretty; }
.q-hint {
  display: flex; gap: 8px; align-items: flex-start;
  margin-top: 12px; font-size: 14px; color: var(--ink-2);
}
.q-hint svg { width: 18px; height: 18px; flex: none; color: var(--gold); margin-top: 1px; }
.options { display: grid; gap: 12px; margin-top: 20px; }
.option-row {
  display: flex;
  align-items: stretch;
  border: 1.5px solid var(--line);
  border-radius: 14px;
  background: var(--sheet);
  transition: border-color .2s, background .2s, transform .2s, box-shadow .2s;
}
.option-row:hover { border-color: var(--ink-3); }
.option-row.is-prev { border-color: var(--ink-3); background: rgba(255, 255, 255, .035); }
.option-row.is-chosen { border-color: var(--gold); background: var(--gold-tint); transform: scale(.99); }
.option {
  flex: 1;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  text-align: left;
  background: none;
  border: 0;
  padding: 15px 14px;
  cursor: pointer;
  border-radius: 13px;
  font-size: 16px;
  line-height: 1.45;
  -webkit-tap-highlight-color: transparent;
}
.option-letter {
  flex: none;
  width: 30px; height: 30px;
  display: grid; place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--line-2);
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink-2);
  background: var(--card);
  transition: background .2s, color .2s, border-color .2s;
}
.option-row:hover .option-letter { border-color: var(--ink); color: var(--ink); }
.option-row.is-chosen .option-letter { background: var(--gold); border-color: var(--gold); color: #0A0A0A; }
.option-body b { font-weight: 700; }
.option-body { color: var(--ink-2); }
.option-body b { color: var(--ink); }
.sound-btn {
  flex: none;
  width: 74px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
  border: 0;
  border-left: 1.5px dashed var(--line);
  background: none;
  color: var(--gold);
  font-size: 11.5px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 0 13px 13px 0;
  -webkit-tap-highlight-color: transparent;
  transition: background .2s, color .2s;
}
.sound-btn svg { width: 24px; height: 24px; }
.sound-btn:hover { background: var(--gold-tint); }
.sound-btn.is-playing { background: var(--gold); color: #0A0A0A; }
.sound-btn.is-playing svg { animation: shake .12s linear infinite; }
@keyframes shake { 0% { transform: translate(0, 0); } 25% { transform: translate(1px, -1px); } 50% { transform: translate(-1px, 1px); } 75% { transform: translate(1px, 1px); } }

.link-back {
  display: inline-flex; align-items: center; gap: 4px;
  margin: 6px 0 14px 14px;
  min-height: 44px;
  padding: 0 8px;
  border: 0; background: none;
  color: var(--ink-2);
  font-size: 15px;
  cursor: pointer;
}
.link-back svg { width: 18px; height: 18px; }
.link-back:hover { color: var(--ink); }
.screen-quiz .medcard-body { padding-bottom: 22px; }

/* ---------- 3. Консилиум ---------- */
.consilium {
  text-align: center;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 40px 20px 36px;
  margin-top: 4vh;
}
.ecg { width: 100%; height: 110px; margin: 22px 0 18px; overflow: visible; }
.ecg-grid { stroke: rgba(229, 72, 77, .16); stroke-width: 1; fill: none; }
.ecg-line {
  fill: none; stroke: var(--red); stroke-width: 3; stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 1400; stroke-dashoffset: 1400;
  animation: ecg 1.6s linear infinite;
}
@keyframes ecg { to { stroke-dashoffset: 0; } }
.consilium-text {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(25px, 6.6vw, 34px);
  line-height: 1.3;
  min-height: 2.6em;
  display: flex; align-items: center; justify-content: center;
  text-wrap: balance;
}
.consilium-text.fade { animation: fade-in .35s ease both; }
@keyframes fade-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.consilium-steps { list-style: none; display: flex; gap: 8px; justify-content: center; padding: 0; margin: 22px 0 0; }
.consilium-steps li { width: 34px; height: 5px; border-radius: 3px; background: var(--paper-deep); transition: background .3s; }
.consilium-steps li.done { background: var(--ink-3); }
.consilium-steps li.now { background: var(--gold); }

/* ---------- 4. Справка ---------- */
.result-intro { text-align: center; margin-bottom: 22px; }
.result-title { margin-top: 6px; font-family: var(--font-display); font-size: clamp(34px, 8.4vw, 50px); font-weight: 600; letter-spacing: 0; line-height: 1.1; }
.result-note { margin-top: 6px; color: var(--ink-2); }

.cert-wrap { display: flex; justify-content: center; }
.cert {
  position: relative;
  width: 100%;
  max-width: 780px;
  background: var(--sheet);
  border-radius: 4px;
  box-shadow: var(--shadow-paper);
  overflow: hidden;
  isolation: isolate;
  color: var(--ink);
}
.cert.issued { animation: issue .8s cubic-bezier(.2, .8, .2, 1) both; }
@keyframes issue { from { opacity: 0; transform: translateY(-24px) rotate(-1.5deg); } to { opacity: 1; transform: none; } }
.cert.issued .cert-stamp { animation: stamp-in .5s .55s cubic-bezier(.3, 1.6, .5, 1) both; }
.cert.issued .cert-seal { animation: seal-in .5s .85s cubic-bezier(.3, 1.6, .5, 1) both; }
@keyframes stamp-in { from { opacity: 0; transform: scale(1.7) rotate(-9deg); } to { opacity: .9; transform: rotate(-9deg); } }
@keyframes seal-in { from { opacity: 0; transform: scale(1.7) rotate(12deg); } to { opacity: .88; transform: rotate(12deg); } }

.cert-rosette { position: absolute; width: 112%; left: -6%; top: 36%; z-index: -1; pointer-events: none; }
.cert-watermark {
  position: absolute; inset: -40%;
  z-index: -1;
  pointer-events: none;
  transform: rotate(-30deg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='420' height='130'%3E%3Ctext x='0' y='60' font-family='Georgia,serif' font-weight='700' font-size='40' fill='%231E2330' fill-opacity='0.026' letter-spacing='3'%3E%D0%A0%D0%95%D0%9C%D0%9E%D0%9D%D0%A2%D0%9E%D0%A4%D0%9E%D0%91%D0%98%D0%AF%3C/text%3E%3Ctext x='-210' y='125' font-family='Georgia,serif' font-weight='700' font-size='40' fill='%231E2330' fill-opacity='0.026' letter-spacing='3'%3E%D0%A0%D0%95%D0%9C%D0%9E%D0%9D%D0%A2%D0%9E%D0%A4%D0%9E%D0%91%D0%98%D0%AF%3C/text%3E%3Ctext x='210' y='125' font-family='Georgia,serif' font-weight='700' font-size='40' fill='%231E2330' fill-opacity='0.026' letter-spacing='3'%3E%D0%A0%D0%95%D0%9C%D0%9E%D0%9D%D0%A2%D0%9E%D0%A4%D0%9E%D0%91%D0%98%D0%AF%3C/text%3E%3C/svg%3E");
  background-size: 340px auto;
}
.cert-inner {
  position: relative;
  margin: 10px;
  border: 1px solid rgba(30, 35, 48, .7);
  outline: 2px solid rgba(30, 35, 48, .85);
  outline-offset: 5px;
  padding: 18px 16px 16px;
  min-height: calc(100% - 20px);
  display: flex;
  flex-direction: column;
}
.cert-head { display: flex; flex-direction: column; gap: 10px; padding-bottom: 12px; border-bottom: 3px double var(--ink); }
.cert-org { display: flex; align-items: center; gap: 10px; }
.cert-emblem { width: 40px; height: 40px; flex: none; color: var(--ink); --emblem-bg: var(--sheet); }
.cert-org-name { color: var(--red); font-weight: 800; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; line-height: 1.25; }
.cert-org-note { color: var(--ink-2); font-size: 12.5px; }
.cert-form { display: flex; justify-content: space-between; font-family: var(--font-mono); font-size: 11.5px; color: var(--ink-3); }
.cert-form b { color: var(--ink); white-space: nowrap; } /* «Форма № 0 дБ» одной строкой на узком телефоне */
.cert-title {
  margin-top: 20px;
  text-align: center;
  font-family: var(--font-doc);
  font-weight: 700;
  font-size: clamp(27px, 7.4vw, 44px);
  letter-spacing: .06em;
  text-transform: uppercase;
  line-height: 1.1;
}
.cert-subtitle { text-align: center; font-family: var(--font-doc); font-style: italic; font-size: clamp(17px, 4.4vw, 22px); color: var(--ink-2); }

.cert-fields { margin-top: 20px; display: grid; gap: 14px; }
.cert-row { display: grid; gap: 2px; }
.cert-label { font-family: var(--font-mono); font-size: 11.5px; letter-spacing: .14em; text-transform: uppercase; color: var(--ink-3); }
.cert-value {
  position: relative;
  font-family: var(--font-doc);
  font-size: 18px;
  padding-bottom: 5px;
  border-bottom: 1.5px dotted rgba(30, 35, 48, .45);
  min-height: 34px;
  display: flex; flex-wrap: wrap; align-items: baseline; column-gap: 10px;
}
.cert-value-name { padding-right: 28px; }
.cert-name-input {
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  font-family: var(--font-hand);
  font-weight: 700;
  font-size: clamp(22px, 6.4vw, 30px);
  line-height: 1.1;
  color: var(--blue-ink);
  border-radius: 4px;
  text-overflow: ellipsis;
}
.cert-name-input::placeholder { color: var(--blue-ink); opacity: .5; }
.cert-name-input:focus { outline: none; background: rgba(39, 71, 160, .06); }
.cert-name-print { display: none; }
.cert-pencil { position: absolute; right: 2px; bottom: 8px; width: 20px; height: 20px; color: var(--ink-3); pointer-events: none; }
.cert-value-name:not(.is-empty) .cert-pencil { opacity: .35; }
.cert-diagnosis { font-weight: 700; font-size: 20px; }
.cert-stage-name { color: var(--red); font-size: 18px; }

.cert-conclusion {
  margin-top: 20px;
  padding: 14px 14px 16px 18px;
  background: rgba(39, 71, 160, .045);
  border-left: 4px solid var(--red);
}
.cert-conclusion p { margin-top: 6px; font-family: var(--font-doc); font-size: 17px; line-height: 1.55; text-wrap: pretty; }

/* Низ справки: штамп слева, подпись справа, печать ложится на начало подписи */
.cert-bottom {
  position: relative;
  margin-top: 22px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cert-stamp { align-self: flex-start; flex: none; font-size: 14px; transform: rotate(-9deg); margin: 4px 0 0 6px; }
.cert-sign {
  position: relative;
  align-self: flex-end;
  display: flex; flex-direction: column; align-items: flex-end;
  text-align: right;
}
.cert-sign-role { position: relative; z-index: 1; font-size: 12.5px; color: var(--ink-2); max-width: 12em; line-height: 1.3; }
.cert-signature { position: relative; z-index: 1; width: 150px; height: 56px; color: var(--blue-ink); margin-top: 2px; }
.cert-sign-name { position: relative; z-index: 1; font-family: var(--font-hand); font-weight: 700; font-size: 28px; line-height: 1; }
.cert-seal { position: absolute; z-index: 2; width: 116px; height: 116px; right: calc(100% - 44px); top: 50%; margin-top: -48px; transform: rotate(12deg); }

.cert-foot {
  margin-top: 18px;
  padding-top: 12px;
  border-top: 1px solid rgba(30, 35, 48, .2);
  font-family: var(--font-doc);
  font-style: italic;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-3);
  text-align: center;
}
.cert-domain { font-family: var(--font-mono); font-size: 11px; color: var(--ink-3); text-align: center; margin-top: 4px; }
.cert-domain:empty { display: none; }

.cert-actions {
  display: grid;
  gap: 10px;
  margin: 22px auto 0;
  max-width: 780px;
}

/* ---------- 5. Лечение ---------- */
.treatment { margin-top: 56px; scroll-margin-top: 80px; }
.treatment-head { text-align: center; }
.treatment-title { margin-top: 6px; font-family: var(--font-display); font-size: clamp(34px, 8.4vw, 54px); font-weight: 600; letter-spacing: 0; line-height: 1.08; }
.treatment-sub { display: block; color: var(--ink-2); font-family: var(--font-ui); font-weight: 400; font-size: 18px; letter-spacing: 0; margin-top: 8px; }

.rx-nav {
  display: flex;
  gap: 8px;
  margin: 22px calc(-1 * var(--gutter)) 0;
  padding: 2px var(--gutter) 10px;
  overflow-x: auto;
  scrollbar-width: none;
  -webkit-overflow-scrolling: touch;
}
.rx-nav::-webkit-scrollbar { display: none; }
.rx-nav a {
  flex: none;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 40px;
  padding: 6px 14px 6px 6px;
  border-radius: 999px;
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  white-space: nowrap;
}
.rx-nav a span {
  width: 28px; height: 28px; display: grid; place-items: center;
  border-radius: 50%;
  background: var(--paper-deep);
  font-family: var(--font-mono); font-weight: 700; font-size: 13px;
}
.rx-nav a:hover { border-color: var(--gold); }
.rx-nav a span { color: var(--gold); }

.rx-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; margin-top: 18px; } /* minmax(0): карточка не шире экрана даже с длинным словом */
.rx {
  position: relative;
  display: flex;
  flex-direction: column;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 22px 18px 20px;
  scroll-margin-top: 80px;
}
.rx.flash { animation: flash 1.2s ease; }
@keyframes flash { 0%, 40% { box-shadow: 0 0 0 3px rgba(201, 169, 110, .55), var(--shadow); } 100% { box-shadow: var(--shadow); } }
.rx-num {
  font-family: var(--font-mono);
  font-size: 12.5px;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--gold);
  display: flex; align-items: center; gap: 8px;
}
.rx-num::before { content: "Rp."; font-family: var(--font-display); font-style: italic; font-weight: 700; letter-spacing: 0; text-transform: none; font-size: 18px; color: var(--ink); }
.rx-title { margin-top: 8px; font-family: var(--font-display); font-size: 27px; line-height: 1.15; font-weight: 600; letter-spacing: 0; text-wrap: balance; }
.rx-text { margin-top: 10px; color: var(--ink-2); text-wrap: pretty; }
.rx-text b { color: var(--red); }
.rx-dynamic {
  font-family: var(--font-display);
  font-size: 22px;
  line-height: 1.35;
  color: var(--ink);
  padding: 14px 16px;
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 10px;
  position: relative;
}
.rx-side {
  margin-top: 14px;
  font-size: 14.5px;
  color: var(--ink-2);
  padding: 10px 12px;
  border: 1px dashed var(--line-2);
  border-radius: 10px;
  background: repeating-linear-gradient(-45deg, transparent 0 8px, rgba(255, 255, 255, .025) 8px 16px);
}
.rx-side b { color: var(--ink); }
.rx-cta, .rx > [data-aspen-link] { margin-top: 18px; }
.rx-cta { width: 100%; }
.rx-cta-label { margin-top: 18px; font-weight: 700; }
.rx-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; align-items: center; }
.rx-links .btn { flex: 1 1 140px; }
.rx > [data-aspen-link] .btn { width: 100%; }
[data-aspen-link] .todo, .rx-links .todo { margin-top: 8px; }
.rx-buttons { display: grid; gap: 10px; margin-top: 18px; }

/* плеер */
.player {
  margin-top: 14px;
  padding: 14px;
  border-radius: 14px;
  background: #050505;
  border: 1px solid var(--line);
  color: var(--ink);
}
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 4px; background: rgba(255, 255, 255, .06); border-radius: 11px; }
.seg button {
  min-height: 44px;
  border: 0; border-radius: 8px;
  background: transparent;
  color: rgba(243, 238, 228, .75);
  font-size: 14px; font-weight: 600; line-height: 1.15;
  padding: 6px 4px;
  cursor: pointer;
}
.seg button[aria-checked="true"] { background: var(--gold); color: #0A0A0A; }
.player-row { display: flex; align-items: center; gap: 14px; margin-top: 14px; }
.player-toggle {
  flex: none;
  width: 56px; height: 56px; border-radius: 50%;
  border: 0;
  background: var(--gold);
  color: #0A0A0A;
  display: grid; place-items: center;
  cursor: pointer;
}
.player-toggle svg { width: 26px; height: 26px; }
.player .ic-pause { display: none; }
.player.is-playing .ic-pause { display: block; }
.player.is-playing .ic-play { display: none; }
.player-viz { flex: 1; height: 48px; display: flex; align-items: center; gap: 3px; }
.player-viz i {
  flex: 1;
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(to top, rgba(220, 192, 140, .95), rgba(201, 169, 110, .3));
  transform: scaleY(.12);
  transform-origin: 50% 50%;
  transition: transform .08s linear;
}
.player.viz-css.is-playing .player-viz i { animation: viz 1.1s ease-in-out var(--d) infinite alternate; }
@keyframes viz { from { transform: scaleY(.15); } to { transform: scaleY(.8); } }
.vol { display: flex; align-items: center; gap: 12px; margin-top: 12px; font-size: 13px; color: var(--ink-2); }
.vol input { flex: 1; accent-color: var(--gold); }

/* шкала берушей */
.meter { margin-top: 14px; padding: 16px 14px; border-radius: 14px; background: var(--sheet); border: 1px solid var(--line); }
.meter-track {
  position: relative;
  height: 18px;
  border-radius: 9px;
  background: linear-gradient(90deg, #2F6B4F 0%, #A8873F 48%, #B8573F 76%, #C2363C 100%);
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08);
}
.meter-fill { position: absolute; left: 0; top: 0; bottom: 0; width: 50%; border-radius: 9px; background: rgba(0, 0, 0, .28); transition: width .15s; }
.meter-pointer {
  position: absolute; top: 50%; left: 50%;
  width: 28px; height: 28px; margin: -14px 0 0 -14px;
  border-radius: 50%;
  background: var(--paper);
  border: 3px solid var(--ink);
  box-shadow: 0 2px 8px rgba(0, 0, 0, .6);
  transition: left .15s;
}
.meter.is-live .meter-pointer { border-color: var(--gold); }
.meter-ends { display: flex; justify-content: space-between; gap: 12px; margin-top: 10px; font-family: var(--font-doc); font-style: italic; font-size: 14px; line-height: 1.3; color: var(--ink-2); }
.meter-ends span:last-child { text-align: right; }
.meter-readout { margin-top: 14px; }
.meter-db { font-family: var(--font-mono); font-size: 13px; color: var(--ink-3); }
.meter-size { margin-top: 4px; font-size: 17px; }
.meter-size b { color: var(--gold); }
.meter-actions { display: grid; gap: 6px; margin-top: 14px; }
.meter-manual { margin-top: 12px; }
.meter-manual label { font-weight: 600; font-size: 15px; }
.meter-manual input { width: 100%; margin-top: 10px; accent-color: var(--gold); }
.manual-ends { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--ink-3); }
.meter-note { margin-top: 12px; font-size: 13px; color: var(--ink-3); }

/* адрес */
.address { margin-top: 14px; padding: 16px; border-radius: 14px; background: var(--sheet); border: 1px solid var(--line); }
.address-list { list-style: none; margin: 0 0 14px; padding: 0; display: grid; gap: 10px; }
.address-list li { display: flex; gap: 10px; align-items: flex-start; }
.address-list svg { width: 20px; height: 20px; flex: none; color: var(--gold); margin-top: 2px; }
.address-note { margin-top: 12px; font-size: 14px; color: var(--ink-2); }

/* формы */
.rx-form { display: grid; gap: 14px; margin-top: 18px; }
.field { display: grid; gap: 6px; border: 0; margin: 0; padding: 0; min-width: 0; }
.field > label, .field > legend { font-weight: 600; font-size: 15px; padding: 0; }
.field > legend { margin-bottom: 6px; }
.field input, .field textarea {
  width: 100%;
  min-height: 50px;
  padding: 12px 14px;
  border: 1.5px solid var(--line-2);
  border-radius: 11px;
  background: var(--sheet);
  font-size: 17px;
  transition: border-color .2s, box-shadow .2s;
}
.field textarea { resize: vertical; min-height: 120px; line-height: 1.45; }
.field input::placeholder, .field textarea::placeholder { color: #6E6A63; }
.field input:focus, .field textarea:focus { outline: none; border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 169, 110, .2); }
.field.has-error input, .field.has-error textarea { border-color: var(--red); }
.field-error { color: var(--red); font-size: 13.5px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.chips label {
  display: inline-flex; align-items: center;
  min-height: 44px;
  padding: 8px 14px;
  border: 1.5px solid var(--line-2);
  border-radius: 999px;
  background: var(--sheet);
  font-size: 15px;
  cursor: pointer;
  transition: background .15s, border-color .15s, color .15s;
}
.chips input:checked + label { background: var(--gold); border-color: var(--gold); color: #0A0A0A; }
.chips input:focus-visible + label { outline: 3px solid var(--gold); outline-offset: 2px; }
.field.has-error .chips label { border-color: var(--red); }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; color: var(--ink-2); cursor: pointer; line-height: 1.4; }
.check input { flex: none; width: 22px; height: 22px; margin: 0; accent-color: var(--gold); }
.consent.has-error .check { color: var(--red); }
.consent .field-error { margin: 4px 0 0 32px; }
.form-error {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--red-tint);
  color: #FF9A9D;
  font-size: 15px;
  font-weight: 500;
}
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.form-success {
  margin-top: 18px;
  display: flex; gap: 12px; align-items: flex-start;
  padding: 16px;
  border-radius: 14px;
  background: var(--green-tint);
  color: #A6E5C6;
  font-size: 16.5px;
  font-weight: 500;
  animation: fade-in .35s ease both;
}
.form-success svg { width: 28px; height: 28px; flex: none; color: var(--green); }
.form-success-extra { margin-top: 6px; font-weight: 400; font-size: 15px; }

.restart { text-align: center; margin-top: 28px; }

/* ---------- Назначения от Аспен Парка: фирменный стиль из брендбука ----------
 * Палитра брендбука: зелёный #003D34, сине-зелёный #00353A, бежевый #ECE5DB,
 * терракотовый #A97160, светло-серый #D6D6D6. Шрифты: Montserrat (заголовки), Mulish (текст).
 * Внутри блоков переопределены переменные, поэтому формы, кнопки и адрес
 * перекрашиваются сами. */
.rx-aspen, .aspen-head {
  --card: #003D34;
  --sheet: #00353A;
  --paper: #002F29;
  --paper-deep: #00463C;
  --ink: #ECE5DB;
  --ink-2: #C9CCC3;
  --ink-3: #9FB0A8;
  --line: #24584F;
  --line-2: #3D6E64;
  --gold: #ECE5DB;
  --gold-hi: #FFFFFF;
  --gold-tint: rgba(236, 229, 219, .12);
  --red: #F4B4A4;
  --red-tint: rgba(244, 180, 164, .14);
  --shadow: 0 18px 40px -22px rgba(0, 0, 0, .85);
  font-family: "Mulish", var(--font-ui);
  color: var(--ink);
}
.rx-aspen {
  border-color: #0B5045;
  box-shadow: inset 0 4px 0 #A97160, var(--shadow);
}
.rx-aspen .rx-num, .rx-aspen .rx-title { padding-right: 70px; }
.rx-brand { position: absolute; top: 20px; right: 18px; width: 56px; height: auto; pointer-events: none; }
.rx-aspen .rx-num { color: #D6D6D6; font-family: "Montserrat", var(--font-ui); font-weight: 600; letter-spacing: .14em; }
.rx-aspen .rx-num::before { content: none; }
.rx-aspen .rx-title { font-family: "Montserrat", var(--font-ui); font-weight: 600; font-size: 23px; line-height: 1.25; }
.rx-aspen .rx-text { color: var(--ink-2); }
.rx-aspen .rx-text b { color: var(--ink); }
.rx-aspen .rx-dynamic { font-family: "Mulish", var(--font-ui); font-size: 18.5px; line-height: 1.45; background: rgba(236, 229, 219, .07); border-color: var(--line-2); }
.rx-aspen .rx-cta-label { font-family: "Montserrat", var(--font-ui); font-weight: 600; }
.rx-aspen .btn { font-family: "Montserrat", var(--font-ui); font-weight: 600; }
.rx-aspen .btn-primary { background: #ECE5DB; color: #003D34; box-shadow: 0 10px 24px -14px rgba(0, 0, 0, .8); }
.rx-aspen .btn-primary:hover { background: #FFFFFF; }
.rx-aspen .btn-secondary { border-color: rgba(236, 229, 219, .55); }
.rx-aspen .btn-secondary:hover { border-color: #ECE5DB; color: #FFFFFF; background: rgba(236, 229, 219, .08); }
.rx-aspen .btn.is-open { color: #ECE5DB; border-color: #ECE5DB; background: transparent; }
.rx-aspen .chips input:checked + label { background: #ECE5DB; border-color: #ECE5DB; color: #003D34; }
.rx-aspen .field input::placeholder, .rx-aspen .field textarea::placeholder { color: #8FA39A; }
.rx-aspen .field input:focus, .rx-aspen .field textarea:focus { box-shadow: 0 0 0 3px rgba(236, 229, 219, .2); }
.rx-aspen .form-error { color: #F4B4A4; }
.rx-aspen .address-list svg { color: #D6A08E; }
.rx-aspen.flash { animation: flash-aspen 1.2s ease; }
@keyframes flash-aspen { 0%, 40% { box-shadow: inset 0 4px 0 #A97160, 0 0 0 3px rgba(236, 229, 219, .6), var(--shadow); } 100% { box-shadow: inset 0 4px 0 #A97160, var(--shadow); } }

.aspen-head {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 18px 20px;
  border-radius: var(--radius);
  background: #003D34;
  border: 1px solid #0B5045;
}
.aspen-logo { width: 92px; height: auto; flex: none; }
.aspen-head-text { font-family: "Montserrat", var(--font-ui); font-weight: 600; font-size: 17px; line-height: 1.35; letter-spacing: .01em; text-wrap: balance; }
/* Узкие телефоны (320-379 px): значок меньше и выше, заголовок идёт под ним на всю ширину,
 * иначе «терапевтическим» с отступом под значок не помещается и страница едет вбок */
@media (max-width: 379px) {
  .rx-brand { top: 16px; right: 14px; width: 44px; }
  .rx-aspen .rx-num { padding-right: 56px; }
  .rx-aspen .rx-title { padding-right: 0; font-size: 21px; }
  .aspen-head { gap: 14px; padding: 16px; }
  .aspen-logo { width: 80px; }
  .aspen-head-text { font-size: 16px; }
  .cert-name-input { font-size: 5.9vw; } /* «Анонимный пострадавший» целиком, без обрезки */
  .medcard-label { font-size: 11px; letter-spacing: .04em; } /* «онлайн-приём» не рвётся по дефису */
}
.rx-group-label {
  margin-top: 10px;
  font-family: var(--font-ui);
  font-weight: 600;
  font-size: 12px;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold);
  display: flex; align-items: center; gap: 14px;
}
.rx-group-label::after { content: ""; flex: 1; height: 1px; background: var(--line-2); }

.rx-nav a.is-aspen { background: #003D34; border-color: #0B5045; color: #ECE5DB; font-family: "Mulish", var(--font-ui); font-weight: 600; }
.rx-nav a.is-aspen span { background: #ECE5DB; color: #003D34; }
.rx-nav a.is-aspen:hover { border-color: #ECE5DB; }

/* ---------- Подвал ---------- */
.site-footer { border-top: 1px solid var(--line); background: #050505; color: var(--ink-2); font-size: 13.5px; padding: 22px 0 calc(28px + env(safe-area-inset-bottom)); }
.footer-inner { display: grid; gap: 10px; }
.footer-brand { display: flex; gap: 10px; align-items: center; color: var(--ink); font-weight: 500; }
.footer-brand svg { width: 28px; height: 28px; flex: none; --emblem-bg: #050505; }
.footer-legal { color: var(--ink-3); font-size: 12.5px; }
.noscript { padding: 16px; text-align: center; background: var(--todo); color: var(--todo-ink); }

/* ---------- Розыгрыш в соцсетях: кнопки и QR-коды (раунд 8) ---------- */
.contest-go { margin-top: 14px; }
.contest-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.contest-net { flex: 1 1 140px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.contest-net .btn { width: 100%; }
.contest-qr { display: none; width: 132px; height: 132px; padding: 8px; background: #fff; border-radius: 10px; }
.contest-qr-note { display: none; margin-top: 10px; text-align: center; font-size: 14px; color: var(--ink-3); }
@media (min-width: 700px) {
  .contest-qr { display: block; }
  .contest-qr-note { display: block; }
}

/* ---------- Окно при попытке уйти с сайта ---------- */
.exit-pop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: max(12px, env(safe-area-inset-top)) max(12px, env(safe-area-inset-right)) max(12px, env(safe-area-inset-bottom)) max(12px, env(safe-area-inset-left));
}
.exit-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .78); animation: fade-in .25s ease both; }
.exit-card {
  position: relative;
  width: 100%;
  max-width: 560px;
  max-height: 100%;
  overflow-y: auto;
  overscroll-behavior: contain;
  background: var(--card);
  border: 1px solid rgba(201, 169, 110, .35);
  border-radius: var(--radius);
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .9);
  padding: 26px 18px 14px;
  animation: pop-in .35s cubic-bezier(.2, .8, .2, 1) both;
}
.exit-card:focus { outline: none; }
@keyframes pop-in { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: none; } }
.exit-x {
  position: absolute; top: 8px; right: 8px;
  width: 44px; height: 44px;
  border: 0; border-radius: 50%;
  background: transparent;
  color: var(--ink-2);
  font-size: 26px; line-height: 1;
  cursor: pointer;
}
.exit-x:hover { color: var(--ink); background: rgba(255, 255, 255, .06); }
.exit-title { margin-top: 8px; padding-right: 30px; font-family: var(--font-display); font-weight: 600; font-size: clamp(26px, 7vw, 34px); line-height: 1.15; text-wrap: balance; }
.exit-text { margin-top: 10px; color: var(--ink-2); text-wrap: pretty; }
.exit-go { margin-top: 18px; }
.exit-later { display: flex; margin: 6px auto 0; }

/* ---------- Планшет ---------- */
@media (min-width: 600px) {
  :root { --gutter: 24px; }
  .hero .btn-xl { width: auto; }
  .header-status { display: inline-flex; }
  .medcard-top { padding: 22px 30px 18px 34px; }
  .medcard-body { padding: 28px 30px 10px 34px; }
  .option { padding: 18px 18px; font-size: 17px; }
  .sound-btn { width: 96px; font-size: 12.5px; }
  .link-back { margin-left: 24px; }
  .consilium { padding: 56px 40px 48px; }

  .cert-inner { margin: 18px; padding: 30px 34px 22px; outline-offset: 7px; min-height: calc(100% - 36px); }
  .cert-head { flex-direction: row; justify-content: space-between; align-items: flex-end; }
  .cert-emblem { width: 52px; height: 52px; }
  .cert-org-name { font-size: 14px; }
  .cert-org-note { font-size: 14px; }
  .cert-form { flex-direction: column; align-items: flex-end; font-size: 12.5px; gap: 2px; }
  .cert-form b { font-size: 14px; }
  .cert-title { margin-top: 34px; }
  .cert-fields { margin-top: 30px; gap: 18px; }
  .cert-row { grid-template-columns: 150px 1fr; align-items: baseline; gap: 12px; }
  .cert-label { padding-bottom: 8px; }
  .cert-value { font-size: 20px; }
  .cert-name-input { font-size: 34px; }
  .cert-diagnosis { font-size: 22px; }
  .cert-stage-name { font-size: 20px; }
  .cert-conclusion { margin-top: 28px; padding: 18px 22px 20px 26px; }
  .cert-conclusion p { font-size: 19px; }
  .cert-bottom { margin-top: auto; padding-top: 30px; flex-direction: row; justify-content: space-between; align-items: center; }
  .cert-stamp { align-self: center; font-size: 19px; margin: 0 0 0 10px; }
  .cert-sign-role { font-size: 14px; max-width: none; }
  .cert-signature { width: 200px; height: 74px; }
  .cert-sign-name { font-size: 34px; }
  .cert-seal { width: 156px; height: 156px; right: calc(100% - 56px); margin-top: -62px; }
  .cert-foot { font-size: 13.5px; margin-top: 22px; }

  .cert-actions { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
  .rx { padding: 26px 26px 24px; }
  .rx-buttons { grid-template-columns: 1fr 1fr; }
  .meter-actions { grid-template-columns: auto auto; justify-content: start; }
  .rx-nav { flex-wrap: wrap; justify-content: center; margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; overflow: visible; }
  .site-footer .footer-inner { grid-template-columns: 1fr; }
  .exit-card { padding: 34px 34px 18px; }
}

/* Шапка в одну строку только там, где она целиком помещается (на 768 px подпись переносилась и точка висела в начале строки) */
@media (min-width: 820px) {
  .brand-text { flex-direction: row; gap: 10px; align-items: baseline; }
  .brand-note::before { content: "·"; margin-right: 10px; color: var(--ink-3); }
}

/* ---------- Десктоп ---------- */
@media (min-width: 960px) {
  .screen { padding: 48px 0 80px; }
  .screen-start { padding-top: 64px; }
  .hero { grid-template-columns: minmax(0, 880px); gap: 56px; } /* рисунка справки справа больше нет (раунд 6) */
  .hero-lead { font-size: 20px; }
  .mini-cert { width: 380px; }
  .mini-seal { width: 118px; height: 118px; }
  .rx-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 20px; align-items: start; }
  .rx-wide { grid-column: 1 / -1; }
  .rx-form-wide { grid-template-columns: 1.4fr 1fr; align-items: start; column-gap: 20px; }
  .rx-form-wide .field-story { grid-row: span 4; }
  .rx-form-wide .field-story textarea { min-height: 218px; }
  .rx-wide .rx-text { max-width: 46em; }
  .rx-wide .rx-buttons { max-width: 720px; }
  .cert-actions { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
  .aspen-head, .rx-group-label { grid-column: 1 / -1; }
  .aspen-head { padding: 22px 26px; gap: 24px; }
  .aspen-logo { width: 110px; }
  .aspen-head-text { font-size: 20px; }
}

/* ---------- Широкий экран: справка слева, лечение справа (раунд 2, правка 2.4) ---------- */
@media (min-width: 1200px) {
  .screen-result > .container { max-width: 1400px; }
  .result-layout { display: grid; grid-template-columns: 560px minmax(0, 1fr); gap: 44px; align-items: start; }
  .result-side { position: relative; }
  /* справка та же, только уменьшена целиком; печать и картинка не меняются */
  .result-side .cert-wrap { zoom: .7; }
  .result-side .cert-actions { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); max-width: none; margin-top: 14px; }
  .result-side .cert-actions .btn { padding: 10px 14px; min-height: 50px; font-size: 15px; line-height: 1.25; }
  .treatment { margin-top: 0; }
  .treatment-head { text-align: left; }
  .rx-nav { justify-content: flex-start; }
  .rx-grid { grid-template-columns: minmax(0, 1fr); }
  .rx-wide { grid-column: auto; }
}
/* справка остаётся на экране, пока листаются назначения, если помещается по высоте */
@media (min-width: 1200px) and (min-height: 860px) {
  .result-side { position: sticky; top: 76px; }
}
@media (min-width: 1440px) {
  .result-layout { grid-template-columns: 580px minmax(0, 1fr); gap: 56px; }
  .result-side .cert-wrap { zoom: .74; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .ecg-line { stroke-dashoffset: 0; }
}

/* ---------- Печать: только справка, ровно на лист А4 ---------- */
@media print {
  @page { size: A4 portrait; margin: 0; }
  html, body { background: #fff !important; }
  body { display: block; min-height: 0; }
  .site-header, .site-footer, .todo-badge, .result-intro, .cert-actions, .treatment, noscript, .exit-pop,
  .screen:not(.screen-result) { display: none !important; }
  .screen-result { display: block !important; padding: 0 !important; animation: none !important; }
  .screen-result > .container { max-width: none; padding: 0; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .cert-wrap { display: block; }
  .result-layout, .result-side { display: block !important; position: static !important; }
  .result-side .cert-wrap { zoom: 1 !important; }
  .cert {
    width: 210mm; height: 296mm; max-width: none; aspect-ratio: auto;
    box-shadow: none; border-radius: 0; animation: none !important;
    page-break-inside: avoid; break-inside: avoid;
  }
  .cert * { animation: none !important; }
  .cert-inner { margin: 9mm; min-height: calc(296mm - 18mm); height: calc(296mm - 18mm); padding: 9mm 11mm 6mm; outline-offset: 2mm; }
  .cert-head { flex-direction: row; justify-content: space-between; align-items: flex-end; }
  .cert-emblem { width: 15mm; height: 15mm; }
  .cert-org-name { font-size: 11pt; }
  .cert-org-note { font-size: 10.5pt; }
  .cert-form { flex-direction: column; align-items: flex-end; font-size: 9.5pt; gap: 1mm; }
  .cert-form b { font-size: 11pt; }
  .cert-title { margin-top: 10mm; font-size: 30pt; }
  .cert-subtitle { font-size: 15pt; }
  .cert-fields { margin-top: 10mm; gap: 5mm; }
  .cert-row { grid-template-columns: 40mm 1fr; align-items: baseline; gap: 3mm; }
  .cert-label { font-size: 9pt; padding-bottom: 2mm; }
  .cert-value { font-size: 15pt; min-height: 10mm; }
  .cert-name-input, .cert-pencil { display: none !important; }
  .cert-name-print { display: block; font-family: var(--font-hand); font-weight: 700; font-size: 25pt; line-height: 1.1; color: var(--blue-ink); }
  .cert-diagnosis { font-size: 16pt; }
  .cert-stage-name { font-size: 15pt; }
  .cert-conclusion { margin-top: 9mm; padding: 5mm 7mm 6mm 8mm; }
  .cert-conclusion p { font-size: 13.5pt; }
  .cert-bottom { margin-top: auto; padding-top: 6mm; flex-direction: row; justify-content: space-between; align-items: center; }
  .cert-stamp { align-self: center; font-size: 15pt; margin: 0 0 0 3mm; opacity: .9; transform: rotate(-9deg); }
  .cert-sign-role { font-size: 11pt; max-width: none; }
  .cert-signature { width: 58mm; height: 22mm; }
  .cert-sign-name { font-size: 25pt; }
  .cert-seal { width: 44mm; height: 44mm; right: calc(100% - 16mm); margin-top: -17mm; opacity: .88; transform: rotate(12deg); }
  .cert-foot { font-size: 9.5pt; margin-top: 7mm; }
  .cert-domain { font-size: 8.5pt; }
}
