/* «Путь врача» — базовая тема: тёплая бумага, зелёный, терракота, графический роман. */

:root {
  --paper: #f4efe3;
  --paper-2: #ebe3d2;
  --paper-3: #e0d5bf;
  --white: #fffaf0;
  --ink: #1e2b27;
  --ink-soft: #3d4a44;
  --muted: #5f6a62;
  --line: #d5cab5;
  --line-strong: #b9ab92;
  --green: #2f5d50;
  --green-2: #4f8574;
  --green-deep: #24483e;
  --green-soft: #dbe7df;
  --rust: #c46a4a;
  --rust-2: #a95438;
  --rust-soft: #f0d8cd;
  --mustard: #d6a13f;
  --mustard-soft: #f2e3bd;
  --blue: #5b7c8d;
  --blue-soft: #d7e2e8;
  --violet: #7a6a8a;
  --violet-soft: #e4dfe9;
  --shadow-soft: 0 18px 50px rgba(30, 43, 39, 0.1);
  --shadow-card: 0 8px 24px rgba(30, 43, 39, 0.07);
  --font-display: Georgia, "Times New Roman", serif;
  --font-body: "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: "Cascadia Mono", Consolas, monospace;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 17px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='180' height='180'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.82' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='180' height='180' filter='url(%23n)' opacity='.35'/%3E%3C/svg%3E");
  mix-blend-mode: multiply;
}

::selection {
  background: var(--green-soft);
  color: var(--green-deep);
}

a { color: var(--green); }

button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
img, svg { max-width: 100%; }

h1, h2, h3, h4 {
  margin: 0;
  font-weight: 700;
  letter-spacing: -0.025em;
  line-height: 1.08;
}

h1, h2 { font-family: var(--font-display); }
h3, h4 { font-family: var(--font-body); }

p { margin: 0 0 14px; }
p:last-child { margin-bottom: 0; }

strong, b { font-weight: 700; }

.app, .stage { position: relative; z-index: 1; }

.stage {
  min-height: 100vh;
  padding-top: 66px;
}

.wrap {
  width: min(1160px, calc(100% - 48px));
  margin: 0 auto;
}
.wrap.narrow { width: min(820px, calc(100% - 48px)); }
.wrap.wide { width: min(1320px, calc(100% - 48px)); }

/* ---------- Шапка ---------- */

.progress-line {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 70;
  width: 0%;
  height: 3px;
  background: linear-gradient(90deg, var(--green), var(--mustard), var(--rust));
  transition: width 0.45s cubic-bezier(.2, .8, .2, 1);
  pointer-events: none;
}

.topbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 60;
  height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 0 26px;
  background: rgba(247, 242, 231, 0.97);
  border-bottom: 1px solid rgba(213, 202, 181, 0.8);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}
.brand-mark {
  width: 34px;
  height: 34px;
  flex: none;
  color: var(--green);
}
.brand-text {
  display: flex;
  flex-direction: column;
  font-weight: 750;
  font-size: 15px;
  line-height: 1.05;
  letter-spacing: -0.02em;
}
.brand-text small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.topbar-note {
  color: var(--muted);
  font-size: 12px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.sound-toggle {
  width: 42px;
  height: 42px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: var(--white);
  color: var(--muted);
  transition: color .2s, border-color .2s, background .2s, transform .15s;
}
.sound-toggle:hover {
  color: var(--ink);
  border-color: var(--line-strong);
  transform: translateY(-1px);
}
.sound-toggle svg {
  width: 19px;
  height: 19px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.sound-toggle .icon-on { display: none; }
.sound-toggle[aria-pressed="true"] { color: var(--green); background: var(--green-soft); border-color: var(--green); }
.sound-toggle[aria-pressed="true"] .icon-on { display: block; }
.sound-toggle[aria-pressed="true"] .icon-off { display: none; }

/* ---------- Типографика ---------- */

.eyebrow {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 14px;
  color: var(--green);
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}
.eyebrow::before {
  content: "";
  width: 24px;
  height: 2px;
  flex: none;
  background: var(--rust);
  border-radius: 2px;
}
.eyebrow.center { justify-content: center; }
.eyebrow.center::before { display: none; }

.display {
  font-family: var(--font-display);
  font-size: clamp(38px, 5.4vw, 74px);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 0.98;
}
h2.section {
  font-size: clamp(30px, 4vw, 52px);
  letter-spacing: -0.03em;
  margin-bottom: 18px;
}
h3.sub {
  font-family: var(--font-display);
  font-size: clamp(22px, 2.5vw, 30px);
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
.lead {
  max-width: 66ch;
  color: var(--ink-soft);
  font-size: clamp(17px, 1.8vw, 20px);
  line-height: 1.55;
}
.dim { color: var(--muted); }
.small { font-size: 14px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.nowrap { white-space: nowrap; }

.quote {
  margin: 0;
  padding: 4px 0 4px 22px;
  border-left: 3px solid var(--rust);
  font-family: var(--font-display);
  font-size: clamp(22px, 3vw, 36px);
  font-style: italic;
  line-height: 1.28;
  letter-spacing: -0.02em;
  color: var(--green-deep);
}

.mark {
  background: linear-gradient(transparent 62%, var(--mustard-soft) 0);
  padding: 0 2px;
}

/* ---------- Кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-height: 52px;
  padding: 13px 24px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--white);
  color: var(--ink);
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
  text-decoration: none;
  transition: transform .14s, background .2s, border-color .2s, box-shadow .2s, color .2s;
}
.btn:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 8px 20px rgba(30, 43, 39, .08);
}
.btn:active { transform: translateY(0); }
.btn:focus-visible { outline: 2px solid var(--rust); outline-offset: 3px; }

.btn-primary {
  border-color: var(--green);
  background: var(--green);
  color: #fffdf6;
  box-shadow: 0 10px 26px rgba(47, 93, 80, .22);
}
.btn-primary:hover {
  background: var(--green-deep);
  border-color: var(--green-deep);
  box-shadow: 0 14px 30px rgba(47, 93, 80, .26);
}
.btn-accent {
  border-color: var(--rust);
  background: var(--rust);
  color: #fffdf6;
  box-shadow: 0 10px 26px rgba(196, 106, 74, .22);
}
.btn-accent:hover { background: var(--rust-2); border-color: var(--rust-2); }
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink-soft);
}
.btn-ghost:hover { background: var(--white); color: var(--ink); }
.btn-link {
  min-height: 34px;
  padding: 6px 2px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--green);
  font-size: 14px;
  font-weight: 650;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.btn-link:hover { transform: none; box-shadow: none; color: var(--green-deep); }
.btn-block { width: 100%; }
.btn-lg { min-height: 58px; padding: 16px 32px; font-size: 17px; }
.btn-sm { min-height: 42px; padding: 9px 16px; font-size: 14px; }
.btn[disabled] { opacity: .4; pointer-events: none; }

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  margin-top: 28px;
}
.actions.center { justify-content: center; }
.actions.spread { justify-content: space-between; }

/* ---------- Поля и чипы ---------- */

.field { margin-bottom: 24px; }
.field > label {
  display: block;
  margin-bottom: 9px;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 750;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.input {
  width: 100%;
  min-height: 52px;
  padding: 13px 16px;
  border-radius: 14px;
  border: 1.5px solid var(--line);
  background: var(--white);
  color: var(--ink);
  font-size: 16px;
  transition: border-color .18s, box-shadow .18s;
}
.input::placeholder { color: #9b9f94; }
.input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(47, 93, 80, .1);
}

.chip-group { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  padding: 9px 14px;
  border-radius: 999px;
  border: 1.5px solid var(--line);
  background: var(--white);
  color: var(--ink-soft);
  font-size: 14px;
  font-weight: 550;
  transition: all .16s;
}
.chip:hover { border-color: var(--green-2); color: var(--ink); }
.chip[aria-pressed="true"], .chip.is-on {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green-deep);
}
.chip[aria-pressed="true"]::before {
  content: "✓";
  display: inline-block;
  margin-right: 6px;
  font-size: 12px;
}

/* ---------- Карточки, панели, рамки ---------- */

.card {
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: 22px;
  box-shadow: var(--shadow-card);
}
.card-pad { padding: clamp(24px, 4vw, 40px); }

.note {
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, .6);
  color: var(--ink-soft);
  font-size: 14px;
}
.note.warm { background: var(--rust-soft); border-color: #e3c1b3; }
.note.green { background: var(--green-soft); border-color: #c3d8cc; }

.comic-frame {
  position: relative;
  overflow: hidden;
  border: 4px solid var(--ink);
  border-radius: 6px;
  background: var(--paper-2);
  box-shadow: 10px 10px 0 rgba(30, 43, 39, .16);
}
.comic-frame svg { display: block; width: 100%; height: 100%; }

.art-fill {
  position: absolute;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}
.art-fill svg { width: 100%; height: 100%; display: block; }

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
}

.divider {
  height: 1px;
  margin: 26px 0;
  border: 0;
  background: var(--line);
}

/* ---------- Экран и анимации ---------- */

.screen {
  position: relative;
  min-height: calc(100vh - 66px);
  animation: screen-in .55s cubic-bezier(.2, .8, .2, 1) both;
}
.screen-pad {
  padding: clamp(44px, 7vw, 96px) 0;
}
.screen-scroll { padding-bottom: 80px; }

@keyframes screen-in {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: none; }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes rise {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: none; }
}

@keyframes art-in {
  from { opacity: 0; transform: scale(1.035); }
  to { opacity: 1; transform: none; }
}

.reveal { animation: rise .65s cubic-bezier(.2, .8, .2, 1) both; }
.reveal-2 { animation-delay: .08s; }
.reveal-3 { animation-delay: .16s; }

/* ---------- Звуковая подсказка ---------- */

.sound-hint {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
  padding: 8px 14px 8px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: rgba(255, 250, 240, .72);
  color: var(--muted);
  font-size: 13px;
}
.sound-hint button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--green);
  background: var(--green-soft);
  color: var(--green-deep);
  font-size: 12px;
  font-weight: 700;
}
.sound-hint svg {
  width: 15px;
  height: 15px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
}

/* ---------- Тост и служебное ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 28px;
  z-index: 90;
  transform: translateX(-50%);
  max-width: min(640px, 92vw);
  padding: 14px 20px;
  border-radius: 16px;
  border: 1.5px solid var(--line);
  background: var(--white);
  box-shadow: var(--shadow-soft);
  font-size: 14.5px;
  animation: rise .25s ease both;
}
.toast[hidden] { display: none; }
.toast.is-good { border-color: var(--green); }
.toast.is-bad { border-color: var(--rust); }

.noscript {
  position: fixed;
  inset: 0;
  z-index: 999;
  display: grid;
  place-items: center;
  padding: 40px;
  background: var(--paper);
  color: var(--ink);
  text-align: center;
}

.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;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001s !important;
    animation-delay: 0s !important;
    transition-duration: .001s !important;
    scroll-behavior: auto !important;
  }
}
