/* Демо-звонок в рамке телефона (phone.js). Только токены. Рамка — var(--text): в тёмной теме телефон «серебряный». */
.cx { display: grid; gap: 40px; align-items: start; }
@media (min-width: 900px) { .cx { grid-template-columns: auto minmax(0, 1fr); gap: 64px; } }
.cx-phone { display: flex; justify-content: center; }
.cx-side { display: grid; gap: 16px; align-content: start; min-width: 0; }
.cx-langs button { min-width: 48px; justify-content: center; }
.cx-log { min-height: 0; height: 440px; overflow: auto; padding: 8px 24px; scroll-behavior: smooth; }
.cx-log:empty::before { content: 'The conversation and what the clinic sees appear here once you call.'; display: block; padding: 16px 0; color: var(--text-muted); font-size: 14px; }
.cx-log .line, .cx-log .event-row { animation: appear var(--d-base) var(--ease-enter) both; }
.event-row.ev-info { background: var(--info-tint); } .event-row.ev-info svg { color: var(--info); }
.event-row.ev-warning { background: var(--warning-tint); } .event-row.ev-warning svg { color: var(--warning); }
@media (max-width: 899px) { .cx-log { height: 320px; } }

.ph { position: relative; width: min(300px, 82vw); aspect-ratio: 300 / 616; padding: 11px; border-radius: 54px; background: var(--text);
  box-shadow: var(--e3), inset 0 0 0 2px color-mix(in srgb, var(--surface) 14%, transparent); flex: none; }
.ph::before, .ph::after { content: ''; position: absolute; width: 3px; border-radius: 2px; background: var(--text); }
.ph::before { left: -3px; top: 120px; height: 56px; }
.ph::after { right: -3px; top: 150px; height: 84px; }
.ph-screen { position: relative; height: 100%; border-radius: 44px; overflow: hidden; display: flex; flex-direction: column;
  background: radial-gradient(120% 70% at 50% 0%, color-mix(in srgb, var(--on-accent) 12%, var(--accent)), var(--accent) 70%); color: var(--on-accent); }
.ph-status { position: relative; height: 48px; flex: none; display: flex; align-items: center; justify-content: space-between; padding: 6px 28px 0 32px; font: 600 14px/1 var(--font-body); }
.ph-island { position: absolute; left: 50%; top: 11px; width: 90px; height: 26px; margin-left: -45px; border-radius: 16px; background: var(--text); }
.ph-sig { display: flex; align-items: flex-end; gap: 2px; height: 11px; }
.ph-sig i { width: 3px; border-radius: 1px; background: currentColor; }
.ph-sig i:nth-child(1) { height: 4px; } .ph-sig i:nth-child(2) { height: 6px; } .ph-sig i:nth-child(3) { height: 8px; } .ph-sig i:nth-child(4) { height: 11px; }

.ph-who { flex: none; display: grid; justify-items: center; text-align: center; padding: 26px 20px 8px; }
.ph-av { width: 76px; height: 76px; border-radius: 50%; display: grid; place-items: center; background: color-mix(in srgb, var(--on-accent) 14%, transparent); margin-bottom: 14px; position: relative; }
.ph-av svg { width: 46px; height: 46px; }
.ph-av rect { transform-box: fill-box; transform-origin: center; transition: transform var(--d-base) var(--ease); }
.ph-name { font: 400 26px/1.15 var(--font-display); letter-spacing: -0.01em; }
.ph-sub { margin-top: 6px; font-size: 14px; opacity: .78; min-height: 20px; }
.ph[data-st="ring"] .ph-av::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid currentColor; opacity: 0; animation: ph-ring 1.2s var(--ease-exit) infinite; }
/* Исходящий: в покое телефон «звонит» — пациентке звонит клиника */
.ph[data-dir="out"][data-st="idle"] .ph-av::after { content: ''; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid currentColor; opacity: 0; animation: ph-ring 1.2s var(--ease-exit) infinite; }
@keyframes ph-ring { from { transform: scale(.9); opacity: .55; } to { transform: scale(1.35); opacity: 0; } }
.ph.agent .ph-av rect { animation: talk 900ms var(--ease) infinite alternate; }
.ph.agent .ph-av rect:nth-child(2n) { animation-duration: 700ms; }
.ph.agent .ph-av rect:nth-child(3n) { animation-duration: 1100ms; animation-delay: -300ms; }
.ph.agent .ph-av rect:nth-child(4n+1) { animation-delay: -500ms; }
.ph.patient .ph-av rect { transform: scaleY(.4); }

.ph-cap { flex: 1; min-height: 0; overflow: hidden; padding: 10px 24px 0; opacity: 0; transition: opacity var(--d-slow) var(--ease); }
.ph[data-st="live"] .ph-cap, .ph[data-st="ended"] .ph-cap { opacity: 1; }
.ph[data-st="ended"] .ph-cap { opacity: .55; }
.ph-cap.swap { animation: ph-in var(--d-slow) var(--ease-enter) both; }
@keyframes ph-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.ph-spk { font: 500 11px/1.3 var(--font-body); letter-spacing: .06em; text-transform: uppercase; opacity: .7; margin-bottom: 6px; }
.ph-txt { margin: 0; font-size: 16px; line-height: 1.42; display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; }
.ph-tr { margin: 8px 0 0; font-size: 13px; line-height: 1.4; opacity: .72; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; overflow: hidden; }
.ph.no-tr .ph-tr { display: none; }
.ph:not(.patient):not(.agent) .ph-spk:empty + .ph-txt:empty { display: none; }

.ph-keys, .ph-go { flex: none; height: 132px; display: flex; align-items: flex-start; justify-content: center; padding-top: 10px; transition: opacity var(--d-base) var(--ease), transform var(--d-base) var(--ease); }
.ph-keys { gap: 22px; }
.ph-go { flex-direction: column; align-items: center; gap: 10px; }
.ph[data-st="idle"] .ph-keys, .ph[data-st="ended"] .ph-keys, .ph[data-st="ring"] .ph-go, .ph[data-st="live"] .ph-go { display: none; }
.ph-k { display: grid; justify-items: center; gap: 6px; padding: 0; border: 0; background: none; color: inherit; cursor: pointer; font: 500 11px/1.2 var(--font-body); }
.ph-k > svg, .ph-k > .ph-cc { box-sizing: content-box; width: 22px; height: 22px; padding: 17px; border-radius: 50%; background: color-mix(in srgb, var(--on-accent) 16%, transparent); transition: background var(--d-fast) var(--ease), color var(--d-fast) var(--ease); }
.ph-cc { display: grid; place-items: center; font: 600 11px/1 var(--font-mono); }
.ph-k[aria-pressed="true"] > svg, .ph-k[aria-pressed="true"] > .ph-cc { background: var(--on-accent); color: var(--accent); }
.ph-end > svg { background: var(--danger); color: var(--on-danger); }
.ph-kl { opacity: .8; }
.ph-k:focus-visible > svg, .ph-k:focus-visible > .ph-cc, .ph-call:focus-visible { outline: 2px solid var(--on-accent); outline-offset: 3px; }
/* T13: кольцо цвета on-accent — кнопка отделена от экрана ≥3:1 (WCAG 1.4.11) и на тёмно-зелёном, и на мятном (тёмная тема) */
.ph-call { width: 72px; height: 72px; border-radius: 50%; border: 3px solid var(--on-accent); cursor: pointer; display: grid; place-items: center; background: var(--success); color: var(--on-accent);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 60%, transparent); animation: ph-pulse 2.2s var(--ease) infinite; transition: transform var(--d-fast) var(--ease); }
.ph-call:hover { transform: scale(1.05); } .ph-call:active { transform: scale(.96); }
.ph-call svg { width: 30px; height: 30px; }
@keyframes ph-pulse { 0% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--success) 55%, transparent); } 70%, 100% { box-shadow: 0 0 0 18px color-mix(in srgb, var(--success) 0%, transparent); } }
.ph-hint { font-size: 13px; font-weight: 500; opacity: .85; }

.ph-wa { position: absolute; z-index: 3; left: 10px; right: 10px; top: 52px; display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 20px;
  background: var(--surface); color: var(--text); box-shadow: var(--e3); font-size: 13px; line-height: 1.35;
  opacity: 0; transform: translateY(-140%); transition: transform var(--d-slow) var(--ease-spring), opacity var(--d-base) var(--ease); pointer-events: none; }
.ph.wa-on .ph-wa { opacity: 1; transform: none; }
.ph-wa b { font-weight: 600; font-size: 12px; }
.ph-wa p { margin: 2px 0 0; color: var(--text-subtle); }
.ph-wa-ic { flex: none; width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; background: var(--success); color: var(--on-accent); }
.ph-wa-ic svg { width: 16px; height: 16px; }

@media (prefers-reduced-motion: reduce) {
  .ph-call, .ph.agent .ph-av rect, .ph[data-st="ring"] .ph-av::after, .ph[data-dir="out"][data-st="idle"] .ph-av::after, .ph-cap.swap { animation: none; }
  .ph-wa { transition: opacity var(--d-base) var(--ease); transform: none; }
}
.callscr.cx { max-width: 1040px; margin: 0; }
.callscr.cx.show { display: grid; }

/* Лендинг: текст и языки слева сверху, телефон справа, лог слева снизу; на мобильном — текст, телефон, лог */
.cx-land { grid-template-areas: "head" "phone" "rest"; }
.cx-land .cx-head { grid-area: head; }
.cx-land .cx-phone { grid-area: phone; }
.cx-land .cx-rest { grid-area: rest; display: grid; gap: 12px; min-width: 0; }
.cx-land .lead { margin-bottom: 28px; }
.cx-lang-row { justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.cx-rows { display: grid; gap: 12px; }
@media (min-width: 900px) {
  .cx-land { grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "head phone" "rest phone"; row-gap: 24px; column-gap: 80px; }
  .cx-land .cx-log { height: 260px; }
}
/* «Островок» всегда тёмный, даже у «серебряного» телефона в тёмной теме */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .ph-island { background: var(--bg); } }
:root[data-theme="dark"] .ph-island { background: var(--bg); }
