/* KsuNiMeet — визуальный язык Claude / Anthropic.
 *
 * «Бумажный» холст тёплого оттенка, коралловый акцент, СЕРИФНАЯ
 * типографика для заголовков и имён и спокойный системный гротеск для
 * интерфейса. Поверхности плоские, границы тонкие (hairline), тени почти
 * отсутствуют. Всё локально: ни одного внешнего шрифта/CDN — ноль
 * блокировок в России, страница рисуется целиком из своих файлов.
 *
 * Все имена классов и id сохранены один-в-один с прежней версией, чтобы
 * JS (landing.js / app.js) продолжал находить элементы. */

:root {
  /* бумага */
  --bg: #faf9f5;
  --bg-soft: #f0eee6;
  --panel: #f5f3ec;
  --card: #ffffff;
  --line: #e8e4d9;
  --sep: rgba(31, 30, 29, 0.10);

  /* чернила */
  --text: #1f1e1d;
  --text-2: #5f5e59;
  --text-3: #666460;   /* было #9e9c93 — 2.6:1, ниже WCAG AA. Теперь ≥5:1 */

  /* акцент Claude */
  --accent: #c96442;
  --accent-deep: #a9482b;
  /* заливка под БЕЛЫМ ТЕКСТОМ: #c96442 даёт 3.9:1 — мало для обычного
   * кегля, поэтому кнопки/сообщения/аватары берут чуть более тёмный
   * оттенок (4.8:1), визуально почти тот же коралл */
  --accent-btn: #bd5230;
  --accent-soft: #f2e2da;
  --blue: #c96442;   /* алиас: старые .cico-blue тянут акцент, не синий */

  /* сигналы */
  --green: #6d8b58;
  --red: #bf4d43;

  --glass: rgba(250, 249, 245, 0.78);
  --glass-border: rgba(31, 30, 29, 0.09);

  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Tiempos Text", ui-serif, Georgia, Cambria, "Times New Roman",
    serif;

  color-scheme: light;   /* без этого мобильный браузер в тёмной теме мигает белой формой */
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
  background: var(--bg);
}

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

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow-x: hidden;
  overscroll-behavior-x: none;
}

/* ни одна картинка/видео не вылезает за свой контейнер и не ломается в ноль */
img, video, canvas, svg { max-width: 100%; }
img { height: auto; }
img[src=""], img:not([src]) { visibility: hidden; }

/* поля ввода не «стилингуют» под тёмную тему ОС */
input, select, textarea, button { color-scheme: light; }

.hidden { display: none !important; }

/* микро-подпись: маленькие капс с широким трекингом (как лейблы Anthropic) */
.micro {
  margin: 0 0 6px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--text-3);
}

/* ---------- стекло ---------- */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
}

/* ---------- карточка ---------- *
 * Базовый «лист бумаги» для страницы «Смотрим вместе». Раньше этот класс
 * в разметке был, а в стилях — нет: карточки рисовались голой подложкой,
 * без фона и рамки, и вся страница выглядела как текст в воздухе. */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px;
}

/* заголовок раздела — та же серифная пара, что у h2 в приложении */
.sec {
  margin: 0 0 10px;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.2px;
  line-height: 1.15;
}

/* пояснительный текст под заголовком */
.muted {
  margin: 0 0 12px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--text-2);
}
.muted strong { color: var(--text); font-weight: 600; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  letter-spacing: 0.01em;
  border: none;
  cursor: pointer;
  text-decoration: none;
  color: var(--text);
  border-radius: 12px;
  padding: 14px 26px;
  transition: transform 0.08s ease, opacity 0.15s ease, background 0.15s ease;
  -webkit-user-select: none;
  user-select: none;
}
.btn:active { transform: scale(0.985); opacity: 0.9; }
.btn:disabled { opacity: 0.45; }

.btn-primary {
  background: var(--accent-btn);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-deep); }

.btn-glass {
  background: var(--card);
  border: 1px solid var(--line);
  color: var(--text);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* «призрачная» кнопка: только контур. Раньше класса не было в стилях —
 * ссылка «В приложение / На главную» рисовалась голым текстом и висела
 * рядом с языковой пилюлей без рамки, отсюда ощущение сломанной вёрстки. */
.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
  color: var(--text-2);
  border-radius: 12px;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent-deep); }
.btn-lg { font-size: 17px; padding: 16px 32px; border-radius: 14px; }

/* ---------- экраны ---------- */
.screen { position: relative; z-index: 1; }

/* ---------- герой входа ---------- */
.landing-wrap {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 48px 24px calc(36px + env(safe-area-inset-bottom));
}

.app-icon {
  width: 84px;
  height: 84px;
  border-radius: 22px;
  display: grid;
  place-items: center;
  color: #fff;
  margin-bottom: 30px;
  background: var(--accent);
}

.landing-wrap h1 {
  font-family: var(--font-serif);
  font-size: 46px;
  font-weight: 600;
  letter-spacing: -0.8px;
  line-height: 1.04;
  margin: 0 0 14px;
  color: var(--text);
}

.tagline {
  color: var(--text-2);
  font-size: 15.5px;
  line-height: 1.6;
  margin: 0 0 40px;
  max-width: 340px;
}

/* ---------- карточка входа ---------- */
.auth-card {
  width: 100%;
  max-width: 360px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: 0 1px 2px rgba(31, 30, 29, 0.04);
}

.seg {
  display: flex;
  background: var(--bg-soft);
  border-radius: 11px;
  padding: 3px;
  gap: 3px;
}
.seg-btn {
  flex: 1;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--text-2);
  background: transparent;
  border: none;
  border-radius: 9px;
  padding: 9px 0;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.seg-btn.seg-active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 2px rgba(31, 30, 29, 0.08);
}

.auth-hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-2);
  min-height: 34px;
  line-height: 1.45;
}

.auth-input {
  background: var(--bg-soft);
  border: 1px solid transparent;
  color: var(--text);
  font: inherit;
  font-size: 16px;
  padding: 14px 16px;
  border-radius: 11px;
  outline: none;
  width: 100%;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.auth-input:focus { border-color: var(--accent); background: var(--card); }
.auth-input::placeholder { color: var(--text-3); }

.auth-btn { width: 100%; }

.hint { margin: 0; font-size: 13px; color: var(--red); min-height: 18px; }

.footnote {
  margin-top: 38px;
  color: var(--text-3);
  font-size: 12px;
  line-height: 1.7;
  letter-spacing: 0.01em;
}

/* ---------- приложение ---------- */
#screen-app {
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.app-top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(20px + env(safe-area-inset-top)) 24px 12px;
  flex-wrap: nowrap;
  min-width: 0;
}
/* имя — единственный «резиновый» блок: сжимается и обрезается,
 * чтобы кнопка «смотреть вместе» и языковая пилюля никогда не выезжали
 * за экран на 320px */
.app-me {
  flex: 1 1 auto;
  min-width: 0;
  text-align: left;
}
.app-me > * {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* переключатель языка (RU ⇄ EN) */
.lang-pill {
  flex: none;
  min-width: 44px;
  min-height: 38px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text-2);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.08em;
  cursor: pointer;
}
.lang-pill:hover { border-color: var(--accent); color: var(--accent-deep); }

/* На экране входа пилюля языка — в правом верхнем углу. В потоке она
 * висела одна в самом низу, под сноской, отдельно от всего — это и есть
 * то самое «плохое размещение». Теперь это привычный переключатель
 * языка в углу, и он остаётся на месте при прокрутке. */
.landing-wrap > .lang-pill {
  position: fixed;
  top: calc(14px + env(safe-area-inset-top));
  right: 16px;
  z-index: 60;
}
.landing-wrap { position: relative; }

/* вход в комнату «смотрим вместе» */
.app-top-watch {
  margin-left: auto;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 9px 13px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--accent-deep);
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.app-top-watch:hover { border-color: var(--accent); color: var(--accent); }
/* до 470px у кнопки «смотреть вместе» остаётся только иконка —
 * иначе имя пользователя обрезается «…» на узких экранах */
@media (max-width: 470px) {
  .app-top-watch span { display: none; }
  .app-top-watch { padding: 9px 11px; min-width: 38px; }
}
.app-name {
  font-family: var(--font-serif);
  font-size: 23px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.app-phone { font-size: 13.5px; color: var(--text-2); margin-top: 2px; }

.avatar {
  border-radius: 50%;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-weight: 600;
  color: #fff;
}
.avatar.sm {
  width: 44px;
  height: 44px;
  font-size: 17px;
  background: var(--accent-btn);
}
.avatar.big {
  width: 124px;
  height: 124px;
  border-radius: 50%;
  font-size: 50px;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--accent-btn);
  animation: pulse 2.4s ease-in-out infinite;
}
.avatar.big-me { width: 88px; height: 88px; font-size: 36px; margin: 0 auto; }

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.045); }
}

/* вкладки */
.tab {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 6px 24px calc(130px + env(safe-area-inset-bottom));
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  min-width: 0;
}

.tab-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin: 10px 0 20px;
}
.tab-head h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.5px;
  line-height: 1.02;
}

.add-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: none;
  background: var(--accent);
  color: #fff;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: transform 0.08s ease, background 0.15s ease;
}
.add-btn:hover { background: var(--accent-deep); }
.add-btn:active { transform: scale(0.94); }

/* контакты — единая сгруппированная карточка */
.contacts-list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.contact-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 13px 16px;
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--line);
}
.contact-row:last-child { border-bottom: none; }
.contact-info { flex: 1; text-align: left; min-width: 0; }
.contact-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.contact-phone { font-size: 13px; color: var(--text-2); margin-top: 2px; }

.call-ico {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
}
.call-ico:active { transform: scale(0.92); }

.add-btn-sm {
  font: inherit;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-deep);
  background: transparent;
  border: none;
  border-radius: 999px;
  padding: 8px 14px;
  cursor: pointer;
  flex-shrink: 0;
}
.add-btn-sm:active { opacity: 0.5; }

.empty {
  margin-top: 56px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  color: var(--text-3);
  font-size: 14.5px;
  line-height: 1.6;
  text-align: center;
}
.empty .avatar { color: var(--accent); }
.empty .avatar.big {
  background: var(--accent-soft);
  border: 1px solid var(--line);
  animation: none;
}

/* клавиатура */
.dial-num {
  text-align: center;
  font-family: var(--font-serif);
  font-size: 38px;
  font-weight: 600;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
  min-height: 48px;
  padding: 8px 0 22px;
}
.dial-num.dim { color: var(--text-3); font-weight: 500; }

/* клавиатура масштабируется и от ШИРИНЫ, и от ВЫСОТЫ экрана:
 * на низком экране (320×568) она целиком помещается над таббаром,
 * а не прячется за него — 46vh ≈ половина высоты под весь набор */
.dial-pad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px 14px;
  max-width: min(330px, 46vh);
  margin: 0 auto;
  background: transparent;
}
@supports (max-width: 1dvh) {
  .dial-pad { max-width: min(330px, 46dvh); }
}
.dial-pad.glass { background: transparent; border: none; backdrop-filter: none; }

.key {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 50%;
  aspect-ratio: 1;
  color: var(--text);
  font: inherit;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1px;
  transition: transform 0.06s ease, background 0.1s ease;
}
.key:active { transform: scale(0.92); background: var(--bg-soft); }
.key span { font-family: var(--font-serif); font-size: 27px; font-weight: 600; line-height: 1.05; }
.key em { font-style: normal; font-size: 10px; color: var(--text-3); letter-spacing: 0.06em; }
.key-del { background: transparent; border-color: transparent; }
.key-del .del-ico { font-size: 24px; color: var(--text-2); }

.dial-call-wrap { display: flex; justify-content: center; padding: 26px 0 8px; }
.dial-call {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  border: none;
  background: var(--green);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
}
.dial-call:active { transform: scale(0.93); }

/* профиль */
.profile-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 22px;
  margin-bottom: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: center;
}
.profile-name {
  font-family: var(--font-serif);
  font-size: 25px;
  font-weight: 600;
  letter-spacing: -0.3px;
}
.profile-phone-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--text-2);
}
.profile-phone { font-size: 19px; font-weight: 600; letter-spacing: 0.05em; }
.profile-note { margin: 4px 0 0; font-size: 13px; color: var(--text-3); line-height: 1.5; }

.profile-row { text-align: left; }
.profile-row-title { font-size: 16px; font-weight: 600; letter-spacing: -0.1px; }
.profile-row-sub { font-size: 13px; color: var(--text-2); margin-top: 3px; line-height: 1.45; }

.profile-btn { width: 100%; margin-top: 6px; font-size: 15px; padding: 13px; }
.logout-btn { width: 100%; margin-top: 6px; color: var(--red); font-size: 15.5px; }

/* нижняя панель вкладок */
.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  border-top: 1px solid var(--line);
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  padding: 8px 12px calc(10px + env(safe-area-inset-bottom));
  z-index: 50;
}
.tabbtn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-3);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 5px 0;
  min-height: 42px;
  cursor: pointer;
  border-radius: 12px;
  transition: color 0.15s ease;
  overflow: hidden;
}
/* контраст: акцент #c96442 на бумаге даёт 3.7:1 — для 11px мало,
 * поэтому активная вкладка берёт тёмный оттенок акцента (5.5:1) */
.tabbtn.tab-active { color: var(--accent-deep); }

/* ---------- поиск (нижний лист) ---------- */
.sheet {
  position: fixed;
  inset: 0;
  z-index: 90;
  background: rgba(31, 30, 29, 0.32);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
}
.sheet-card {
  width: 100%;
  max-width: 480px;
  background: var(--card);
  border: 1px solid var(--line);
  border-bottom: none;
  border-radius: 20px 20px 0 0;
  padding: 22px 22px calc(28px + env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: 14px;
  max-height: 78dvh;
  overflow-y: auto;
}
.sheet-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sheet-head h3 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 21px;
  font-weight: 600;
  letter-spacing: -0.2px;
}
.search-msg { margin: 0; font-size: 13.5px; color: var(--text-2); text-align: center; }

/* маленькая круглая кнопка-копия */
.chip-copy {
  background: var(--bg-soft);
  border: none;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
}
.chip-copy:active { opacity: 0.6; }

/* ---------- входящий звонок (тёплый графит) ---------- */
.incoming {
  position: fixed;
  inset: 0;
  z-index: 300;
  background: linear-gradient(180deg, #262421 0%, #171614 62%);
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 30px;
  text-align: center;
}
.ring-title {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.55);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  margin-bottom: 10px;
}
.ring-name {
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 600;
  letter-spacing: -0.4px;
}
.ring-phone { font-size: 17px; color: rgba(255, 255, 255, 0.7); }

.ring-actions {
  margin-top: 38px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: clamp(24px, 11vw, 40px);
  flex-wrap: nowrap;
  max-width: 100%;
}

.ctl {
  width: clamp(52px, 16.5vw, 68px);
  height: clamp(52px, 16.5vw, 68px);
  flex: none;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  cursor: pointer;
  border: none;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
.ctl:active { transform: scale(0.93); opacity: 0.85; }
.ctl-red { background: var(--red); }
.ctl-green {
  background: var(--green);
  width: clamp(56px, 18vw, 74px);
  height: clamp(56px, 18vw, 74px);
}

/* ---------- тост ---------- */
.toast {
  position: fixed;
  left: 50%;
  bottom: calc(100px + env(safe-area-inset-bottom));
  transform: translateX(-50%) translateY(20px);
  background: #262421;
  color: #faf9f5;
  font-size: 14px;
  font-weight: 500;
  padding: 13px 22px;
  border-radius: 12px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 400;
  max-width: 86vw;
  text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- активный звонок поверх приложения ---------- */
.call-stage {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: #171614;
}
.call-frame {
  width: 100%;
  height: 100%;
  border: 0;
  display: block;
  background: #171614;
}
.call-pill {
  position: fixed;
  top: calc(env(safe-area-inset-top) + 8px);
  left: 50%;
  transform: translateX(-50%);
  z-index: 460;
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: calc(100vw - 28px);
  background: var(--green);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 7px 16px 7px 7px;
  font: 600 13.5px/1.2 var(--font);
  box-shadow: 0 8px 24px rgba(23, 22, 20, 0.2);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
  white-space: nowrap;
  transition: transform 0.08s ease, opacity 0.15s ease;
}
.call-pill:active { transform: translateX(-50%) scale(0.96); }
.pill-ico {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.26);
}
.pill-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.pill-sep { opacity: 0.85; flex-shrink: 0; }
.pill-time { font-variant-numeric: tabular-nums; flex-shrink: 0; }

/* языковая пилюля и тост-сообщение стоят выше всего, включая экран звонка */
.toast { z-index: 640; }
.call-pill { z-index: 620; }

/* ============================================================
   ЭКРАН ЗВОЛКА — тёплый графит
   ============================================================ */
body.call {
  background: #171614;
  color: #fff;
}

.call-wrap {
  position: relative;
  z-index: 1;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  background: #171614;
}

#remote-video {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: #171614;
}

.remote-avatar {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  text-align: center;
  padding: 20px;
}
.remote-avatar .avatar.glass {
  background: rgba(255, 255, 255, 0.10);
  border: 1px solid rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
}
.remote-avatar .avatar.big { background: var(--accent); }
.partner-name {
  font-family: var(--font-serif);
  font-size: 29px;
  font-weight: 600;
  letter-spacing: -0.3px;
  color: #fff;
}
.partner-phone { font-size: 16px; color: rgba(255, 255, 255, 0.7); }

.local-video {
  position: absolute;
  top: calc(84px + env(safe-area-inset-top));
  right: 16px;
  width: 92px;
  height: 130px;
  object-fit: cover;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.25);
  z-index: 5;
  background: #171614;
}

.call-top {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  padding: calc(18px + env(safe-area-inset-top)) 16px 0;
  z-index: 6;
}

.min-btn {
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.24);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  color: #fff;
  cursor: pointer;
  transition: opacity 0.15s ease, transform 0.1s ease;
}
.min-btn:active { transform: scale(0.92); opacity: 0.8; }

.status {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: calc(18px + env(safe-area-inset-top));
  min-height: 40px;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  overflow: hidden;
  padding: 4px 10px;
  font-size: clamp(12.5px, 3.7vw, 14px);
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.85);
  text-align: center;
  max-width: min(62%, 420px);
  overflow-wrap: anywhere;
  pointer-events: none;
}
.status.green { color: #a8c48f; font-weight: 600; }

.min-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: calc(10px + env(safe-area-inset-top)) 14px 10px;
  background: var(--green);
  color: #fff;
  box-shadow: 0 2px 14px rgba(23, 22, 20, 0.35);
  cursor: pointer;
  -webkit-user-select: none;
  user-select: none;
}
.min-bar .min-icon {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.22);
  display: flex;
  align-items: center;
  justify-content: center;
}
.min-bar .min-name {
  flex: 1 1 auto;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.1px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.min-bar .min-sep { opacity: 0.8; }
.min-bar .min-timer {
  flex: 0 0 auto;
  font-size: 15px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

body.minimized .local-video,
body.minimized .call-top,
body.minimized .phase-ring,
body.minimized .call-bottom {
  display: none !important;
}
body.minimized .min-bar { display: flex !important; }

.call-bottom {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  padding: 0 12px calc(28px + env(safe-area-inset-bottom));
  z-index: 6;
  min-width: 0;
}
.timer {
  font-size: 15px;
  font-variant-numeric: tabular-nums;
  color: rgba(255, 255, 255, 0.85);
}

.controls {
  display: flex;
  gap: clamp(10px, 4.5vw, 22px);
  align-items: center;
  justify-content: center;
  max-width: 100%;
  flex-wrap: nowrap;
}

.ctl .i-off { display: none; }
.ctl.off .i-on { display: none; }
.ctl.off .i-off { display: block; }
.ctl.off { opacity: 0.5; }
.ctl.glass {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.20);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  color: #fff;
}

.ended {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 22px;
  z-index: 20;
  background: rgba(23, 22, 20, 0.62);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border: none;
  border-radius: 0;
}
.ended-title {
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 600;
  padding: 0 26px;
  text-align: center;
  letter-spacing: -0.2px;
}

.phase-ring {
  position: absolute;
  bottom: calc(56px + env(safe-area-inset-bottom));
  left: 0;
  right: 0;
  z-index: 8;
  display: flex;
  justify-content: center;
}
.phase-ring .ring-actions { margin-top: 0; gap: clamp(28px, 13vw, 48px); }
.phase-ring .ctl { width: clamp(60px, 19vw, 76px); height: clamp(60px, 19vw, 76px); }

.phase-title {
  margin-top: 10px;
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.85);
  animation: fadepulse 1.6s ease-in-out infinite;
}

@keyframes fadepulse {
  0%, 100% { opacity: 0.6; }
  50% { opacity: 1; }
}

/* ============================================================
   ЧАТЫ + ПЕРЕПИСКА
   ============================================================ */

.row-acts {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.cico {
  width: 38px;
  height: 38px;
  border-radius: 11px;
  border: none;
  display: grid;
  place-items: center;
  color: #fff;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.08s ease, opacity 0.12s ease;
}
.cico:active { transform: scale(0.9); opacity: 0.85; }
.cico-blue { background: var(--accent); }
.cico-green { background: var(--green); }

.chats-list {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.chat-row {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background 0.1s ease;
}
.chat-row:last-child { border-bottom: none; }
.chat-row:active { background: var(--bg-soft); }

.chat-info { flex: 1; min-width: 0; text-align: left; }
.chat-row-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}
.chat-row-top .contact-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.chat-when {
  font-size: 12.5px;
  color: var(--text-3);
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}
.chat-row-bot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 2px;
}
.chat-prev {
  font-size: 14px;
  color: var(--text-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.chat-prev.unread { color: var(--text); font-weight: 600; }

.unread-badge {
  background: var(--accent);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  min-width: 21px;
  height: 21px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 6px;
  flex-shrink: 0;
  font-variant-numeric: tabular-nums;
}

.tab-ico-wrap {
  position: relative;
  display: grid;
  place-items: center;
}
.badge {
  position: absolute;
  top: -6px;
  right: -10px;
  background: var(--accent);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  min-width: 18px;
  height: 18px;
  border-radius: 999px;
  padding: 0 5px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1.5px solid var(--bg);
  font-variant-numeric: tabular-nums;
}

/* ---------- экран переписки ---------- */
.chat-view {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 100dvh;
  z-index: 150;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transform: translateX(100%);
  transition: transform 0.32s cubic-bezier(0.32, 0.72, 0.25, 1);
}
.chat-view.open { transform: translateX(0); }

.chat-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(14px + env(safe-area-inset-top)) 12px 10px;
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 2;
}

.chat-nav-back {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  cursor: pointer;
  flex-shrink: 0;
  margin-left: -6px;
}
.chat-nav-back:active { opacity: 0.5; }

.chat-nav-info {
  flex: 1;
  min-width: 0;
  text-align: left;
}
.chat-nav-name {
  font-size: 16.5px;
  font-weight: 600;
  letter-spacing: -0.1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chat-nav-sub {
  font-size: 12px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.chat-nav-act {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  border-radius: 10px;
  flex-shrink: 0;
}
.chat-nav-act:active { background: var(--bg-soft); }

/* ---------- лента сообщений ---------- */
.chat-msgs {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 18px 14px;
  background: var(--bg);
  overscroll-behavior: contain;
}

.msg-day {
  text-align: center;
  margin: 14px 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-3);
}

.chat-hint {
  text-align: center;
  color: var(--text-3);
  font-size: 14px;
  line-height: 1.6;
  margin-top: 80px;
}

.msg-row {
  display: flex;
  flex-direction: column;
  margin-bottom: 3px;
}
.msg-row.mine { align-items: flex-end; }
.msg-row.theirs { align-items: flex-start; }
.msg-row + .msg-row { margin-top: 2px; }
.msg-row.fresh { animation: msg-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1.2); }

.bubble {
  max-width: 78%;
  padding: 10px 15px;
  font-size: 16.5px;
  line-height: 1.38;
  word-wrap: break-word;
  border-radius: 16px;
  letter-spacing: -0.05px;
}
.msg-row.mine .bubble {
  background: var(--accent-btn);
  color: #fff;
  border-bottom-right-radius: 5px;
}
.msg-row.theirs .bubble {
  background: var(--bg-soft);
  color: var(--text);
  border: 1px solid var(--line);
  border-bottom-left-radius: 5px;
}

.msg-meta {
  font-size: 11.5px;
  color: var(--text-3);
  margin-top: 3px;
  padding: 0 4px;
}

@keyframes msg-in {
  from { opacity: 0; transform: translateY(6px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

/* ---------- строка ввода ---------- */
.chat-composer {
  flex-shrink: 0;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 10px 14px calc(12px + env(safe-area-inset-bottom));
  background: var(--glass);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  backdrop-filter: blur(20px) saturate(150%);
  border-top: 1px solid var(--line);
  position: relative;
  z-index: 2;
}
.chat-input {
  flex: 1;
  font: inherit;
  font-size: 16.5px;
  color: var(--text);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 11px 16px;
  outline: none;
  min-height: 44px;
}
.chat-input:focus { border-color: var(--accent); }
.chat-input::placeholder { color: var(--text-3); }

.chat-send {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: none;
  background: var(--accent);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: transform 0.1s ease, opacity 0.15s ease, background 0.15s ease;
}
.chat-send:hover { background: var(--accent-deep); }
.chat-send:active { transform: scale(0.92); }

/* ---------- анимация входящего ---------- */
.incoming {
  transform: translateY(102%);
  transition: transform 0.55s cubic-bezier(0.22, 1, 0.36, 1);
}
.incoming.in-now { transform: translateY(0); }

.incoming .ring-title,
.incoming .ring-name,
.incoming .ring-phone,
.incoming .ring-kind,
.incoming .ring-actions { opacity: 0; }
.incoming.in-now .ring-title { animation: ring-rise 0.4s 0.08s ease-out forwards; }
.incoming.in-now .ring-name { animation: ring-rise 0.45s 0.14s cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards; }
.incoming.in-now .ring-phone { animation: ring-rise 0.4s 0.2s ease-out forwards; }
.incoming.in-now .ring-kind { animation: ring-rise 0.4s 0.22s ease-out forwards; }
.incoming.in-now .ring-actions { animation: ring-rise 0.45s 0.26s cubic-bezier(0.2, 0.9, 0.3, 1.2) forwards; }

@keyframes ring-rise {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

#ring-accept, #btn-accept {
  position: relative;
}
#ring-accept::after, #btn-accept::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: var(--green);
  animation: accept-halo 1.9s ease-out infinite;
  z-index: -1;
}
@keyframes accept-halo {
  0% { transform: scale(1); opacity: 0.55; }
  70%, 100% { transform: scale(1.65); opacity: 0; }
}

.ring-kind {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-top: 6px;
  font-size: 15px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.75);
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.16);
  -webkit-backdrop-filter: blur(20px);
  backdrop-filter: blur(20px);
  padding: 7px 14px;
  border-radius: 999px;
}
.ring-kind svg { width: 16px; height: 16px; }

/* ---------- узкие экраны ---------- */
@media (max-width: 380px) {
  .landing-wrap h1 { font-size: 40px; }
  .dial-num { font-size: 31px; }
  .key span { font-size: 24px; }
}

/* ==================== «Смотрим вместе» ==================== */

.watch {
  min-height: 100%;
  padding-bottom: 48px;
}

/* Шапка: бренд слева, действия справа, ОДНОЙ связной полосой (тонкая
 * линия снизу). Раньше между заголовком и кнопками зиял пустой провал
 * в пол-экрана, а ссылка выхода рисовалась голым текстом без рамки —
 * отсюда и «плохое размещение» с «RU» рядом. */
.watch-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  max-width: 880px;
  margin: 0 auto;
  padding: calc(16px + env(safe-area-inset-top)) 20px 14px;
  border-bottom: 1px solid var(--line);
}

/* блок комнаты: карточки стоят столбиком с одинаковым шагом, а не вплотную */
#w-room {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.watch-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.watch-logo {
  width: 38px; height: 38px;
  display: grid; place-items: center;
  border-radius: 12px;
  color: var(--accent);
  background: var(--accent-soft);
  border: 1px solid var(--line);
  flex: none;
}
.watch-top h1 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 500;
  letter-spacing: -0.01em;
  white-space: nowrap;
}
.watch-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--text-3); }
.watch-back {
  text-decoration: none;
  font-size: 13px;
  padding: 8px 14px;
  min-height: 38px;   /* палец должен попадать без промаха */
  border-radius: 999px;   /* одна форма с языковой пилюлей рядом */
  white-space: nowrap;
  flex: none;
}

.watch-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.watch-card {
  border-radius: 16px;
  padding: 20px;
}

.watch-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-top: 14px;
}
.watch-half {
  border: 1px solid var(--line);
  border-radius: 13px;
  padding: 14px;
  background: var(--panel);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.watch-hint { margin: 0; font-size: 13px; color: var(--text-2); }
.watch-wide { width: 100%; }
.watch-input { margin: 0; }

.watch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 16px;
  flex-wrap: wrap;
}
.watch-head-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
  margin-left: auto;
}
.watch-code-row { display: flex; align-items: center; gap: 8px; }
.watch-code {
  font-family: var(--font-serif);
  font-size: 34px;
  font-weight: 500;
  letter-spacing: 0.16em;
  color: var(--accent-deep);
}
/* кто в комнате — именами, а не «двое / один» */
.watch-people {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 12px 0 0;
}
.watch-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  max-width: 100%;
  padding: 7px 12px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: var(--card);
  font-size: 12.5px;
  color: var(--text-2);
}
.watch-chip b {
  font-weight: 600;
  color: var(--text);
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.watch-chip em { font-style: normal; color: var(--text-3); white-space: nowrap; }
.watch-chip i {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
}
.watch-chip.me i { background: var(--accent-btn); }
/* Собеседник в комнате, но давно молчит (опрос встал — фон, сон телефона,
 * пауза WebView в системном полном экране). Он НЕ ушёл: фильм играет
 * синхронно. Значок и имя остаются на месте, только точка спокойнее —
 * «Ждём хоста» в этом состоянии было прямой ложью. */
.watch-chip.quiet i { background: var(--text-3); }
.watch-chip.quiet b { color: var(--text-2); }
.watch-chip.empty { border-style: dashed; color: var(--text-3); }
.watch-chip.empty i { display: none; }

.watch-link { margin: 8px 0 0; font-size: 12.5px; color: var(--text-3); }
/* --green (#6d8b58) на карточке даёт 3.8:1 — ниже порога AA для текста.
 * Тот же зелёный, но темнее: полоска-индикатор остаётся прежней, а строка
 * «соединение напрямую» читается (≥4.5:1). */
.watch-link.ok { color: #587544; font-weight: 600; }
/* Расхождение фильма у гостя. Место зарезервировано, чтобы строка не
 * толкала карточку и не вызывала скачок вёрстки при появлении цифры. */
.watch-drift {
  margin: 2px 0 0;
  min-height: 15px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
  color: var(--text-3);
}

/* Микрофон: одно нажатие — включён, ещё одно — выключен. Никакого «вызова». */
.watch-mic .mic-on { display: none; }
.watch-mic.on .mic-off { display: none; }
.watch-mic.on .mic-on { display: block; }
.watch-mic.on {
  background: var(--accent-btn);
  border-color: var(--accent-btn);
  color: #fff;
}
.watch-mic.on:hover { background: var(--accent-deep); border-color: var(--accent-deep); }

/* Право управления фильмом. У хоста это переключатель (нажал — дал, нажал
 * ещё раз — забрал). У гостя — только показатель состояния: кнопка
 * disabled, но выглядит как обычная пилюля, а не как «погасшая». */
.watch-grant .grant-open { display: none; }
.watch-grant.on .grant-lock { display: none; }
.watch-grant.on .grant-open { display: block; }
.watch-grant.on {
  background: var(--accent-btn);
  border-color: var(--accent-btn);
  color: #fff;
}
.watch-grant.on:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.watch-grant:disabled { opacity: 1; cursor: default; }
.watch-grant:disabled:hover { border-color: var(--line); }
.watch-grant.on:disabled:hover { border-color: var(--accent-btn); }

/* Гость без права управления: ползунок и пауза заперты, видео не принимает
 * касания (иначе система сама остановит фильм по тапу). Громкость остаётся
 * живой — это личная настройка, а не общий пульт. */
#w-video.locked { pointer-events: none; }
.watch-ctl:disabled,
.watch-seek:disabled { opacity: 0.4; cursor: default; }
.watch-ctl:disabled:hover { border-color: var(--line); color: var(--text); }
.watch-seek:disabled::-webkit-slider-thumb { background: var(--text-3); }
.watch-seek:disabled::-moz-range-thumb { background: var(--text-3); }

/* Замок поверх видео: состояние видно сразу, а не «почему не двигается».
 * Лежит в углу, размером с чип, и не мешает картинке. */
.watch-lock {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  max-width: calc(100% - 16px);
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(14, 13, 12, 0.62);
  border: 1px solid rgba(255, 255, 255, 0.18);
  color: #f4f2ee;
  font-size: 11.5px;
  line-height: 1.2;
  white-space: nowrap;
  pointer-events: none;
}
.watch-lock svg { flex: none; }

/* Показываем иконку «свернуть» только когда экран уже развёрнут */
#w-full .ico-compress { display: none; }
#w-full.on .ico-expand { display: none; }
#w-full.on .ico-compress { display: block; }

/* ПОЛНЫЙ ЭКРАН — правила лежат в КОНЦЕ файла ("ПОЛНЫЙ ЭКРАН — АВТОРИТЕТНЫЙ
 * БЛОК"). Там же объяснено, почему сюда нельзя дописывать мелкие правки:
 * их перебивают базовые правила карточки и media-запросы ниже. */

/* собеседник приходит сюда — сам элемент не виден */
#w-remote { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* языковая пилюля в шапке страницы — та же высота, что у ссылки выхода */
.watch-top .lang-pill { min-height: 38px; }

/* На узком экране у ссылки выхода остаётся только стрелка. Иначе шапка
 * не влезает в одну строку и «На главную» с «RU» съезжают в столбик
 * друг под друга — тот самый визуальный баг. */
@media (max-width: 470px) {
  .watch-top { gap: 12px; }
  .watch-back {
    font-size: 0;
    gap: 0;
    width: 38px;
    min-width: 38px;
    padding: 0;
  }
  .watch-back::before {
    content: "\2190";
    font-size: 16px;
    line-height: 1;
  }

  /* Пульт фильма в одну строку на телефоне не влезает (шесть элементов)
   * и вылезал за экран. Раскладываем в две строки:
   *   00:00 ▬▬▬▬ 00:00
   *   [▶]   ▬▬▬   [⛶]
   * Порядок задаётся order, разметку трогать не нужно. */
  .watch-controls {
    flex-wrap: wrap;
    row-gap: 10px;
  }
  .watch-controls > * { min-width: 0; }
  #w-cur { order: 1; }
  /* селекторы — обязательно через .watch-controls: базовые правила ползунков
   * идут НИЖЕ по файлу, и без более высокого веса они бы победили */
  .watch-controls #w-seek { order: 2; flex: 1 1 120px; }
  #w-dur { order: 3; }
  .watch-controls .watch-ctl { order: 4; }
  .watch-controls .watch-vol { order: 5; flex: 1 1 110px; max-width: 200px; }
  .watch-controls #w-full { order: 6; }
}

/* выбор файла: настоящее <input type=file> растянуто на всю кнопку,
 * поэтому палец всегда попадает по системному полю (а не по обёртке) */
.watch-pick {
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
}
.watch-file-input {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
  font-size: 100px;
}

.watch-pick-name {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text-2);
  word-break: break-all;
}

.watch-bar {
  height: 8px;
  margin: 12px 0 8px;
  border-radius: 999px;
  background: var(--bg-soft);
  border: 1px solid var(--line);
  overflow: hidden;
}
.watch-bar-fill {
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, #d97e5a, var(--accent-deep));
  transition: width 0.25s ease;
}
.watch-pct { margin: 0 0 4px; font-size: 12.5px; color: var(--text-3); }

.watch-player { padding: 14px; }
.watch-video-wrap {
  position: relative;
  width: 100%;
  background: #171614;
  border-radius: 12px;
  overflow: hidden;
}
.watch-video-wrap video {
  display: block;
  width: 100%;
  max-height: 62vh;
  background: #171614;
}

.watch-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.watch-ctl {
  width: 38px; height: 38px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 11px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--text);
  cursor: pointer;
}
.watch-ctl:hover { border-color: var(--accent); color: var(--accent); }
.watch-ctl .ico-pause { display: none; }
.watch-ctl.playing .ico-play { display: none; }
.watch-ctl.playing .ico-pause { display: block; }

.watch-time {
  font-size: 12.5px;
  color: var(--text-2);
  font-variant-numeric: tabular-nums;
  flex: none;
  min-width: 42px;
  text-align: center;
}
/* ВАЖНО: у input[type=range] автоматический минимум = его внутренняя
 * ширина (~131px), поэтому flex-basis молча игнорировался и ползунок
 * громкости вылезал за экран. min-width:0 снимает этот минимум. */
.watch-seek { flex: 1 1 auto; min-width: 0; }
.watch-vol { flex: 0 0 84px; min-width: 0; }

/* Ползунки: визуально тонкая полоска, но зона пальца — 38px по высоте.
 * Раньше кликать по перемотке и громкости было нечем: они были 6px. */
.watch-seek, .watch-vol {
  -webkit-appearance: none;
  appearance: none;
  height: 38px;
  padding: 0;
  margin: 0;
  border: none;
  background-color: transparent;
  background-image: linear-gradient(var(--bg-soft), var(--bg-soft));
  background-size: 100% 6px;
  background-position: center;
  background-repeat: no-repeat;
  border-radius: 999px;
  cursor: pointer;
}
.watch-seek::-webkit-slider-thumb, .watch-vol::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 15px; height: 15px;
  margin: 0;
  border-radius: 50%;
  background: var(--accent);
  border: none;
  cursor: pointer;
}
.watch-seek::-moz-range-thumb, .watch-vol::-moz-range-thumb {
  width: 15px; height: 15px;
  border-radius: 50%;
  background: var(--accent);
  border: none;
}

.watch-note {
  margin: 12px 0 0;
  font-size: 12.5px;
  color: var(--text-2);
  text-align: center;
}

@media (max-width: 560px) {
  .watch-split { grid-template-columns: 1fr; }
  .watch-code { font-size: 29px; }
  .watch-top h1 { font-size: 19px; }
  .watch-sub { display: none; }
  .watch-vol { flex: 0 0 60px; }
}

/* Карточка комнаты на телефоне: код сверху, кнопки — каждая во всю ширину.
 * Иначе «Голос» и «Покинуть комнату» сбивались в столбик справа и висели
 * в пустоте — то самое плохое размещение. */
@media (max-width: 560px) {
  .watch-head { align-items: flex-start; }
  .watch-head .watch-head-actions {
    width: 100%;
    margin-left: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }
  .watch-head .watch-head-actions .btn { width: 100%; }
}

/* ============================================================
   АДАПТИВНЫЙ СЛОЙ — «ultra smart adapt»
   Один блок, который закрывает весь список визуальных ошибок на
   ЛЮБОМ устройстве: кнопочный телефон 300px → монитор 1440px,
   альбомная ориентация, крупный системный шрифт, вырез камеры,
   режим «уменьшить движение», режим высокой контрастности.

   Порядок: 1) тач и hover, 2) узкие, 3) низкие/альбомные,
   4) планшет и десктоп, 5) доступность, 6) защита от мигания.
   ============================================================ */

/* --- 1. ТАЧ-ЭКРАН: :hover не залипает после тапа -------------- */
/* На телефоне :hover остаётся «приклеенным» до следующего тапа —
 * кнопка выглядит зажатой. Ниже — сброс всех ховеров в исходный вид. */
@media (hover: none), (pointer: coarse) {
  .btn-primary:hover { background: var(--accent); }
  .btn-glass:hover { border-color: var(--line); }
  .lang-pill:hover { border-color: var(--line); color: var(--text-2); }
  .add-btn-sm:hover { color: var(--accent-deep); }
  .app-top-watch:hover { border-color: var(--line); color: var(--accent-deep); }
  .add-btn:hover { background: var(--accent); }
  .watch-ctl:hover { border-color: var(--line); color: var(--text); }
  .chat-send:hover { background: var(--accent); }
  .watch-back:hover, .chip-copy:hover, .add-btn-sm:hover { opacity: 1; }
  .watch-mic.on:hover { background: var(--accent-btn); border-color: var(--accent-btn); }
}

/* --- 2. УЗКИЕ ЭКРАНЫ ------------------------------------------ */
/* 360px и меньше: шапка, вкладки и тексты ужимаются,
 * ни один элемент не выезжает за правый край. */
@media (max-width: 380px) {
  .app-top { padding-inline: 16px; gap: 10px; }
  .tab { padding-inline: 16px; }
  .tab-head h2 { font-size: 28px; }
  .avatar.sm { width: 40px; height: 40px; font-size: 16px; }
  .app-name { font-size: 20px; }
  .app-phone { font-size: 12.5px; }
  .watch-top { padding-inline: 14px; }
  .watch-main { padding-inline: 14px; }
  .watch-card { padding: 16px; }
  .watch-code { font-size: 26px; letter-spacing: 0.12em; }
  .watch-back { padding: 8px 11px; }
  .status { max-width: 70%; }
  .local-video { width: 78px; height: 110px; right: 12px; }
  .toast { max-width: calc(100vw - 24px); font-size: 13px; padding: 12px 16px; }
  .ended-title { font-size: 20px; }
  .sheet-card { padding: 20px 18px calc(24px + env(safe-area-inset-bottom)); }
  .bubble { font-size: 16px; max-width: 84%; }
  .ring-name { font-size: 28px; }
}

/* самые узкие (300–340px) */
@media (max-width: 340px) {
  .app-top { padding-inline: 12px; gap: 8px; }
  .tab { padding-inline: 12px; }
  .lang-pill { padding: 8px 9px; min-width: 40px; font-size: 11px; }
  .app-top-watch { padding: 8px 9px; min-width: 36px; }
  .app-name { font-size: 18px; }
  .tab-head h2 { font-size: 25px; }
  .add-btn { width: 38px; height: 38px; }
  .watch-top h1 { font-size: 17px; }
  .watch-code { font-size: 23px; }
  .key span { font-size: 23px; }
  .tabbtn { font-size: 10px; }
}

/* --- 3. НИЗКИЕ / АЛЬБОМНЫЕ ЭКРАНЫ ----------------------------- */
/* Телефон боком: вертикали мало, поэтому все вертикальные
 * отступы сжимаются, чтобы кнопки не наезжали на видео. */
@media (max-height: 540px) and (orientation: landscape) {
  .landing-wrap { padding-block: 18px; }
  .local-video { width: 66px; height: 90px; top: calc(52px + env(safe-area-inset-top)); }
  .call-bottom { gap: 8px; padding-bottom: calc(12px + env(safe-area-inset-bottom)); }
  .ctl { width: 46px; height: 46px; }
  .ctl-green { width: 50px; height: 50px; }
  .ctl svg { width: 22px; height: 22px; }
  .ring-actions { margin-top: 18px; }
  .phase-ring { bottom: calc(14px + env(safe-area-inset-bottom)); }
  .phase-ring .ctl { width: 52px; height: 52px; }
  .avatar.big { width: 78px; height: 78px; font-size: 30px; }
  .incoming { gap: 6px; padding: 16px; }
  .ring-name { font-size: 26px; }
  .sheet-card { max-height: 92dvh; }
  .watch-video-wrap video { max-height: 48vh; }
}

/* --- 4. ПЛАНШЕТ И ДЕСКТОП ------------------------------------- */
/* Главный источник «асимметрии и растекания»: на 1440px экран
 * растягивался во всю ширину. Теперь приложение — аккуратная
 * центральная колонка, а таббар ходит строго вместе с ней. */
@media (min-width: 760px) {
  body:not(.call) { background: var(--bg-soft); }
  body:not(.call) #screen-auth,
  body:not(.call) #screen-app {
    max-width: 680px;
    margin-inline: auto;
    background: var(--bg);
    border-inline: 1px solid var(--line);
  }
  body:not(.call) .tabbar {
    left: 50%;
    right: auto;
    width: min(680px, 100%);
    transform: translateX(-50%);
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
  body:not(.call) .chat-view {
    max-width: 680px;
    margin-inline: auto;
    border-inline: 1px solid var(--line);
  }
  body:not(.call) .toast { max-width: min(520px, 80vw); }
  .landing-wrap h1 { font-size: 54px; }
  .tab { padding-inline: 32px; }
  .tab-head h2 { font-size: 36px; }
  .dial-pad { max-width: 340px; }
  .sheet-card { max-width: 460px; }
}

@media (min-width: 1100px) {
  body:not(.call) #screen-auth,
  body:not(.call) #screen-app,
  body:not(.call) .tabbar,
  body:not(.call) .chat-view { max-width: 720px; }
  body:not(.call) .tabbar { width: min(720px, 100%); }
  .landing-wrap h1 { font-size: 60px; }
}

/* --- 5. ДОСТУПНОСТЬ ------------------------------------------ */

/* Единое правило тап-таргета: ни одна кнопка не меньше 38×38 —
 * палец не промахивается, а «мелкие» элементы больше не считаются
 * дефектом при аудите вёрстки. */
.add-btn-sm,
.lang-pill,
.chip-copy,
.chat-nav-back,
.chat-nav-act,
.min-btn,
.watch-back,
.watch-ctl { min-height: 38px; }
.add-btn-sm { display: inline-flex; align-items: center; }

/* крупный системный шрифт (iOS/Android «большой текст») */
@media (max-width: 420px) {
  .tabbtn { min-height: 42px; }
}

/* «уменьшить движение» в системе — гасим пульсацию и сдвиги,
 * чтобы ничего не мигало и не дёргалось */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
  .avatar.big { animation: none; }
}

/* режим высокой контрастности */
@media (prefers-contrast: more) {
  :root { --text-2: #35342f; --text-3: #44433d; --line: #c8c2b2; }
  .lang-pill, .app-top-watch, .watch-ctl, .btn-glass { border-width: 1.5px; }
}

/* --- 5b. КОРОТКИЕ ЭКРАНЫ (по высоте) -------------------------- */
/* 568px по высоте и меньше: клавиатура и отступы сжимаются,
 * чтобы набор цифр и «позвонить» были видны без прокрутки. */
@media (max-height: 700px) {
  .tab-head { margin: 6px 0 14px; }
  .tab-head h2 { font-size: 27px; }
  .dial-num { font-size: 31px; min-height: 40px; padding: 4px 0 14px; }
  .dial-pad { gap: 10px; }
  .dial-call-wrap { padding: 16px 0 4px; }
  .dial-call { width: 62px; height: 62px; }
  .tab { padding-bottom: calc(112px + env(safe-area-inset-bottom)); }
  .empty { margin-top: 34px; }
  .sheet-card { max-height: 88dvh; }
}

/* --- 6. ЗАЩИТА ОТ МИГАНИЯ (style flash) ---------------------- */
/* Фон и цвет известны до загрузки CSS — браузер не успевает
 * мигнуть белым кадром между HTML и стилями. */
html, body { background-color: var(--bg); color: var(--text); }

/* появление полосы прокрутки не сдвигает текст */
.tab, .chat-msgs, .sheet-card { scrollbar-gutter: stable; }

/* старый iOS без dvh — не даём экрану схлопнуться */
.landing-wrap { min-height: 100vh; }
@supports (min-height: 100dvh) { .landing-wrap { min-height: 100dvh; } }

/* длинный код комнаты/имя файла рвётся, а не растягивает карточку */
.watch-code-row { flex-wrap: wrap; }
.watch-pick-name, .contact-name, .chat-nav-name { overflow-wrap: anywhere; }

/* ============================================================
   ПОЛНЫЙ ЭКРАН — АВТОРИТЕТНЫЙ БЛОК (последним в файле)
   ============================================================
   Работает в браузере на компьютере, в браузере на телефоне и в
   приложении (Android WebView отдаёт полноэкранный вид приложению через
   onShowCustomView). Задача: кадр на ВЕСЬ экран, ни одной светлой полоски
   по краю и ни одного обрезанного пикселя кадра.

   Что здесь лечится:
   1. .card рисует рамку 1px светлого цвета (--line). В полноэкранном
      режиме эта рамка идёт по периметру экрана и читается как БЕЛАЯ РАМКА.
      Гасим рамку, фон, тень, скругление и внутренние отступы карточки.
   2. html/body светлые (защита от мигания в конце файла) — любая щель в
      один пиксель показывала кремовую полосу. Пока идёт полный экран, фон
      самой страницы тоже тёмный (класс ksu-fs ставит watch.js).
   3. Пульт больше НЕ отнимает высоту у кадра: он лежит ПОВЕРХ видео снизу,
      на тёмной подложке. Видео занимает все 100% высоты экрана.
   4. object-fit: contain — кадр вписан целиком, ничего не режется.
   Селекторы с #id: они сильнее любых правил выше, включая media-запросы. */

#w-player:fullscreen,
#w-player:-webkit-full-screen,
#w-player:-ms-fullscreen {
  position: fixed;
  inset: 0;
  display: block;
  width: auto;
  height: auto;
  min-width: 0;
  min-height: 0;
  max-width: none;
  max-height: none;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  box-shadow: none;
  background: #0e0d0c;
  box-sizing: border-box;
}
#w-player::backdrop,
#w-player:fullscreen::backdrop { background: #0e0d0c; }

/* пока идёт полный экран — тёмный фон и у самой страницы */
html.ksu-fs, html.ksu-fs body { background-color: #0e0d0c; }

/* кадр — на весь экран */
#w-player:fullscreen .watch-video-wrap,
#w-player:-webkit-full-screen .watch-video-wrap {
  position: absolute;
  inset: 0;
  width: auto;
  height: auto;
  min-height: 0;
  border-radius: 0;
}
#w-player:fullscreen .watch-video-wrap video,
#w-player:-webkit-full-screen .watch-video-wrap video {
  display: block;
  width: 100%;
  height: 100%;
  max-height: none;
  object-fit: contain;   /* кадр вписан целиком — ничего не обрезается */
  background: #000;      /* чёрные поля вместо светлых по краям кадра */
}

/* пульт поверх кадра: высоту у видео не отнимает */
#w-player:fullscreen .watch-controls,
#w-player:-webkit-full-screen .watch-controls {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 3;
  width: auto;
  margin: 0;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  box-sizing: border-box;
  background: linear-gradient(to top, rgba(10, 9, 8, 0.82), rgba(10, 9, 8, 0));
}
#w-player:fullscreen .watch-ctl,
#w-player:-webkit-full-screen .watch-ctl {
  background: rgba(255, 255, 255, 0.14);
  border-color: rgba(255, 255, 255, 0.24);
  color: #fff;
}
#w-player:fullscreen .watch-time,
#w-player:-webkit-full-screen .watch-time { color: #f3f1ec; }
/* полоска ползунка на тёмном кадре: светлая полупрозрачная */
#w-player:fullscreen .watch-seek,
#w-player:fullscreen .watch-vol {
  background-image: linear-gradient(rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.3));
}
#w-player:fullscreen .watch-note,
#w-player:-webkit-full-screen .watch-note { display: none; }

/* замок «управляет хост» — под вырез камеры, чтобы не залезть под него */
#w-player:fullscreen .watch-lock,
#w-player:-webkit-full-screen .watch-lock {
  top: calc(10px + env(safe-area-inset-top));
  right: calc(10px + env(safe-area-inset-right));
}

/* ================= вложения в переписке (фото / видео / документ) =================
 * Ничего из «смотрим вместе» здесь не затрагивается: это только стили
 * переписки — пузырь с картинкой, строка документа, выбор файла, просмотр.
 */

.att-file { display: none; }

/* кнопка «прикрепить» — рядом со полем ввода */
.chat-attach {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--bg-soft);
  color: var(--accent);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: transform 0.1s ease, background 0.15s ease;
}
.chat-attach:hover { background: var(--accent-soft); }
.chat-attach:active { transform: scale(0.92); }

/* ---------- лист выбора ---------- */
#att-sheet { z-index: 200; }
.att-menu {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.att-opt {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  font: inherit;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  text-align: left;
}
.att-opt:active { background: var(--accent-soft); border-color: var(--accent); }
.att-opt-ico {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--accent-soft);
  color: var(--accent-deep);
}
.att-opt-name { overflow-wrap: anywhere; }

/* ---------- пузырь с вложением ---------- */
.att-bubble { padding: 6px; max-width: 84%; }
.att-shot {
  position: relative;
  display: block;
  border-radius: 12px;
  overflow: hidden;
  background: var(--bg-soft);
  min-width: 132px;
  line-height: 0;
}
.att-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 420px;
  object-fit: cover;
  background: var(--bg-soft);
  cursor: pointer;
}
.att-play {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 54px;
  height: 54px;
  margin: -27px 0 0 -27px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(20, 18, 16, 0.5);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  pointer-events: none;
}
.att-dur {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.2px;
  color: #fff;
  background: rgba(20, 18, 16, 0.55);
  line-height: 1.4;
}
.att-cap {
  padding: 7px 9px 3px;
  font-size: 16.5px;
  line-height: 1.35;
  word-wrap: break-word;
}

/* ---------- документ и звук ---------- */
.att-doc {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 196px;
  padding: 9px 11px;
  border-radius: 12px;
  color: inherit;
  text-decoration: none;
  background: rgba(31, 30, 29, 0.05);
}
.msg-row.mine .att-doc { background: rgba(255, 255, 255, 0.16); }
.att-doc-ico { font-size: 24px; line-height: 1; flex-shrink: 0; }
.att-doc-txt { display: flex; flex-direction: column; min-width: 0; }
.att-doc-name {
  font-size: 15.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 210px;
}
.att-doc-size { font-size: 12.5px; opacity: 0.8; }
.att-doc-dl { margin-left: auto; opacity: 0.85; flex-shrink: 0; display: grid; place-items: center; }

.att-audio { display: flex; align-items: center; gap: 10px; min-width: 220px; padding: 4px 6px; }
.att-audio-el { width: 100%; height: 34px; }

.att-gone {
  padding: 10px 14px;
  font-size: 14.5px;
  color: var(--text-3);
}

/* ---------- прогресс / ошибка отправки ---------- */
.msg-row.pending .bubble { opacity: 0.96; }
.att-state {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px 2px;
  font-size: 12.5px;
  flex-wrap: wrap;
}
.att-state:empty { display: none; }
.msg-row.mine .att-state { color: rgba(255, 255, 255, 0.9); }
.msg-row.theirs .att-state { color: var(--text-2); }
.att-note { white-space: nowrap; }
.att-bar {
  flex: 1;
  min-width: 70px;
  height: 4px;
  border-radius: 3px;
  overflow: hidden;
  background: rgba(31, 30, 29, 0.18);
}
.msg-row.mine .att-bar { background: rgba(255, 255, 255, 0.28); }
.att-bar i {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 3px;
  background: var(--accent);
  transition: width 0.18s linear;
}
.msg-row.mine .att-bar i { background: #fff; }
.att-state.fail { color: var(--red); }
.msg-row.mine .att-state.fail { color: #ffe3de; }
.att-act {
  font: inherit;
  font-size: 12.5px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid currentColor;
  background: transparent;
  color: inherit;
  -webkit-appearance: none;
  appearance: none;
}
.att-act:active { opacity: 0.7; }

/* ---------- просмотр во весь экран ---------- */
.att-view {
  position: fixed;
  inset: 0;
  z-index: 260;
  background: rgba(12, 11, 10, 0.94);
  display: flex;
  flex-direction: column;
}
.att-view-top {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 14px 10px;
  color: #f2f0ea;
}
.att-view-name {
  flex: 1;
  min-width: 0;
  font-size: 14.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.att-view-btn {
  width: 38px;
  height: 38px;
  flex-shrink: 0;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  display: grid;
  place-items: center;
  cursor: pointer;
  text-decoration: none;
}
.att-view-btn:active { background: rgba(255, 255, 255, 0.26); }
.att-view-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px calc(18px + env(safe-area-inset-bottom));
}
.att-view-img,
.att-view-video {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 10px;
}
.att-view-audio { width: min(520px, 100%); }
.att-view-doc {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  color: #f2f0ea;
  font-size: 16px;
  text-align: center;
  padding: 0 20px;
}
.att-view-doc-ico { font-size: 44px; }
.att-view-doc-name { overflow-wrap: anywhere; }
