@font-face {
  font-family: "Manrope";
  src: url("Manrope-Regular.ttf") format("truetype");
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("Manrope-SemiBold.ttf") format("truetype");
  font-weight: 600;
  font-display: swap;
}
@font-face {
  font-family: "Manrope";
  src: url("Manrope-Bold.ttf") format("truetype");
  font-weight: 700 800;
  font-display: swap;
}

:root {
  /* Палитра сайта клиники: примитивы → семантика → компоненты. */
  --pc-navy-900: oklch(27.5% .075 278);
  --pc-navy-800: oklch(34% .085 278);
  --pc-navy-950: oklch(21% .055 278);
  --pc-violet-600: oklch(51% .15 283);
  --pc-periwinkle-400: oklch(70% .11 267);
  --pc-lavender-100: oklch(93.5% .025 278);
  --pc-lavender-50: oklch(97.5% .01 278);
  --pc-paper: oklch(99% .003 278);
  --pc-ink-soft: oklch(43% .055 280);
  --pc-ink-on-dark: oklch(94% .018 278);
  --pc-ink-on-dark-soft: oklch(82% .035 278);
  --pc-danger: oklch(51% .15 12);
  --pc-danger-hover: oklch(57% .16 12);

  --page-bg: var(--pc-lavender-50);
  --text: var(--pc-navy-900);
  --text-soft: var(--pc-ink-soft);
  --accent: var(--pc-violet-600);
  --focus: var(--pc-violet-600);
  --button-bg: var(--pc-navy-900);
  --button-bg-hover: var(--pc-navy-800);
  --button-text: var(--pc-paper);
  --surface: var(--pc-paper);
  --border: oklch(89% .022 278);
  --shadow: 0 24px 64px -36px oklch(27.5% .075 278 / .45);
}

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

html, body {
  min-height: 100%;
  margin: 0;
}

body {
  min-height: 100dvh;
  background: var(--page-bg);
  color: var(--text);
  font-family: "Manrope", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background:
    radial-gradient(48% 55% at 100% 0%, oklch(70% .11 267 / .24), transparent 72%),
    radial-gradient(42% 50% at 0% 100%, oklch(70% .11 267 / .13), transparent 74%);
}

body[data-view="call"] {
  background: var(--pc-navy-950);
  color: var(--pc-ink-on-dark);
}
body[data-view="call"]::before { display: none; }

.sprite { display: none; }
main { position: relative; z-index: 1; }

h1 {
  margin: 0;
  font-size: clamp(2rem, 1.45rem + 2.2vw, 3rem);
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -.035em;
  text-wrap: balance;
}

p { margin: 0; }

button {
  font: inherit;
  color: inherit;
  border: 0;
  cursor: pointer;
  background: none;
  -webkit-tap-highlight-color: transparent;
}

button:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 3px;
}
button:active:not(:disabled) { transform: scale(.97); }
button:disabled { cursor: default; }

/* Фирменная шапка: без навигации, чтобы не уводить человека со встречи. */
.app-header {
  position: absolute;
  z-index: 20;
  top: 0;
  left: 0;
  right: 0;
  max-width: 1248px;
  margin: 0 auto;
  padding: calc(24px + env(safe-area-inset-top)) 32px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -.015em;
  white-space: nowrap;
}
.brand-mark { width: 30px; height: 30px; flex: none; }

.meeting-label {
  padding: 6px 12px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: oklch(99% .003 278 / .65);
  color: var(--text-soft);
  font-size: .8125rem;
  font-weight: 600;
  line-height: 1.4;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

body[data-view="call"] .app-header { color: var(--pc-ink-on-dark); }
body[data-view="call"] .meeting-label {
  color: var(--pc-ink-on-dark);
  border-color: oklch(94% .018 278 / .18);
  background: oklch(21% .055 278 / .42);
}

.primary {
  min-height: 56px;
  padding: 0 28px;
  border-radius: 14px;
  background: var(--button-bg);
  color: var(--button-text);
  font-weight: 700;
  box-shadow: 0 12px 26px -18px oklch(27.5% .075 278 / .9);
  transition: background-color .18s ease, box-shadow .18s ease, transform .18s ease;
}
.primary:hover:not(:disabled) {
  background: var(--button-bg-hover);
  box-shadow: 0 16px 30px -18px oklch(27.5% .075 278 / .9);
}
.primary:disabled { opacity: .55; }

/* Ранняя, просроченная ссылка и выход из встречи. */
.message {
  min-height: 100dvh;
  max-width: 40rem;
  margin: 0 auto;
  padding: 128px 24px 64px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 20px;
}
.message h1 { max-width: 15ch; }
.message p { max-width: 34rem; color: var(--text-soft); }
.message .primary { margin-top: 8px; }

/* Предпросмотр перед входом. */
.prejoin {
  min-height: 100dvh;
  max-width: 1184px;
  margin: 0 auto;
  padding: 112px 32px 48px;
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, .85fr);
  gap: 64px;
  align-items: center;
}

.preview {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px solid oklch(99% .003 278 / .85);
  border-radius: 24px;
  overflow: hidden;
  background:
    radial-gradient(70% 75% at 85% 10%, oklch(51% .15 283 / .32), transparent 75%),
    var(--pc-navy-900);
  box-shadow: var(--shadow);
}
.preview video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  display: block;
}
.preview-empty {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px 32px 104px;
  text-align: center;
  color: var(--pc-ink-on-dark-soft);
}
.preview-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 20px;
  display: flex;
  justify-content: center;
  gap: 12px;
}

.prejoin-text {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 20px;
}
.prejoin-text > p { color: var(--text-soft); max-width: 28rem; }
.prejoin-text .primary { margin-top: 8px; }
.status:empty { display: none; }
.prejoin-text > .status { color: var(--pc-danger); font-size: .9375rem; }
.prejoin-text > .note {
  margin-top: 4px;
  font-size: .8125rem;
  line-height: 1.5;
}

/* Кнопки камеры и микрофона. */
.round {
  width: 56px;
  height: 56px;
  flex: none;
  border: 1px solid oklch(94% .018 278 / .16);
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: oklch(21% .055 278 / .58);
  color: var(--pc-ink-on-dark);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  transition: background-color .18s ease, color .18s ease, transform .18s ease;
}
.round:hover:not(:disabled) { background: oklch(34% .085 278 / .82); }
.round:disabled { opacity: .42; }
.round[aria-pressed="true"] {
  background: var(--pc-ink-on-dark);
  color: var(--pc-navy-900);
}
.round.end {
  width: 68px;
  border-radius: 28px;
  border-color: transparent;
  background: var(--pc-danger);
  color: var(--pc-paper);
}
.round.end:hover:not(:disabled) { background: var(--pc-danger-hover); }
.round svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* Сам звонок: интерфейс поверх видео, без лишних панелей. */
.call {
  position: fixed;
  inset: 0;
  overflow: hidden;
  background: var(--pc-navy-950);
}

#remote-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: var(--pc-navy-950);
}
#remote-video.off { visibility: hidden; }
@media (orientation: portrait) {
  #remote-video { object-fit: cover; }
}

.waiting {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 104px 24px 128px;
  text-align: center;
}
.waiting-title { font-size: 1.375rem; font-weight: 600; letter-spacing: -.02em; }
.waiting-text { color: var(--pc-ink-on-dark-soft); max-width: 28rem; }

/* Спокойный фирменный акцент во время ожидания собеседника. */
.orb {
  position: relative;
  width: clamp(160px, 30vmin, 256px);
  aspect-ratio: 1;
  margin-bottom: 28px;
}
.orb::after {
  content: "";
  position: absolute;
  inset: 38%;
  border-radius: 22%;
  background: var(--pc-periwinkle-400);
  box-shadow: 0 0 48px oklch(70% .11 267 / .28);
  transform: rotate(45deg);
}
.orb i {
  position: absolute;
  inset: 0;
  border: 1px solid oklch(70% .11 267 / .25);
  border-radius: 50%;
  animation: breathe 10s ease-in-out infinite;
}
.orb i:nth-child(1) { opacity: .45; }
.orb i:nth-child(2) { opacity: .65; inset: 15%; animation-delay: .25s; }
.orb i:nth-child(3) { opacity: .9; inset: 30%; animation-delay: .5s; }

@keyframes breathe {
  0%, 100% { transform: scale(.82); opacity: .25; }
  45%, 55% { transform: scale(1); opacity: .8; }
}

.banner {
  position: absolute;
  z-index: 12;
  top: calc(92px + env(safe-area-inset-top));
  left: 50%;
  transform: translateX(-50%);
  width: max-content;
  max-width: calc(100% - 32px);
  padding: 10px 18px;
  border: 1px solid oklch(99% .003 278 / .14);
  border-radius: 14px;
  background: oklch(99% .003 278 / .92);
  color: var(--pc-navy-900);
  font-size: .875rem;
  font-weight: 600;
  text-align: center;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.banner-action {
  position: absolute;
  z-index: 12;
  top: 40%;
  left: 50%;
  transform: translateX(-50%);
}
.banner-action:active:not(:disabled) { transform: translateX(-50%) scale(.97); }

.self {
  position: absolute;
  z-index: 10;
  right: 24px;
  bottom: calc(116px + env(safe-area-inset-bottom));
  width: clamp(112px, 18vw, 216px);
  aspect-ratio: 4 / 3;
  border: 1px solid oklch(94% .018 278 / .2);
  border-radius: 18px;
  overflow: hidden;
  background: var(--pc-navy-900);
  box-shadow: 0 18px 48px -20px oklch(10% .03 278 / .65);
}
.self video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
  display: block;
}
.self-off {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 8px;
  text-align: center;
  font-size: .75rem;
  color: var(--pc-ink-on-dark-soft);
}
@media (orientation: portrait) {
  .self { aspect-ratio: 3 / 4; width: clamp(96px, 26vw, 164px); }
}
@media (orientation: portrait) and (min-width: 600px) {
  .self { top: calc(96px + env(safe-area-inset-top)); bottom: auto; }
}

.dock {
  position: absolute;
  z-index: 10;
  left: 50%;
  bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid oklch(94% .018 278 / .14);
  border-radius: 32px;
  background: oklch(21% .055 278 / .48);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
}

@media (max-width: 760px) {
  .app-header { padding: calc(16px + env(safe-area-inset-top)) 16px 12px; }
  .brand { font-size: .9375rem; }
  .brand-mark { width: 28px; height: 28px; }
  .prejoin {
    grid-template-columns: minmax(0, 1fr);
    gap: 24px;
    padding: 92px 16px 32px;
    align-content: start;
  }
  .preview { border-radius: 20px; }
  .prejoin-text { gap: 16px; }
  .prejoin-text .primary { width: 100%; }
  .message { padding: 112px 20px 48px; }
  .self { right: 16px; bottom: calc(108px + env(safe-area-inset-bottom)); }
  .dock { bottom: calc(16px + env(safe-area-inset-bottom)); }
}

@media (max-width: 420px) {
  .meeting-label { display: none; }
  .round { width: 52px; height: 52px; }
  .round.end { width: 64px; }
}

@media (prefers-reduced-motion: reduce) {
  .orb i { animation: none; }
  .primary, .round { transition: none; }
  button:active:not(:disabled) { transform: none; }
  .banner-action:active:not(:disabled) { transform: translateX(-50%); }
}
