/* AnyPlayer site v2 — токены и базовые компоненты.
   Фирменный стиль AnyPlayer (утверждённый макет v2): фиолетовая шапка 56 px,
   оранжевые кнопки с прописными подписями, светлый фон, тонкие границы, мелкие скругления.
   Шрифт — Gilroy (файлы владельца; перед публикацией сверить лицензию). */

@font-face { font-family: "Gilroy"; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/Gilroy-Regular.woff2) format("woff2"); }
@font-face { font-family: "Gilroy"; font-style: normal; font-weight: 500; font-display: swap; src: url(../fonts/Gilroy-Medium.woff2) format("woff2"); }
@font-face { font-family: "Gilroy"; font-style: normal; font-weight: 600; font-display: swap; src: url(../fonts/Gilroy-Semibold.woff2) format("woff2"); }
@font-face { font-family: "Gilroy"; font-style: normal; font-weight: 700; font-display: swap; src: url(../fonts/Gilroy-Bold.woff2) format("woff2"); }

:root {
  /* Бренд */
  --purple: #5b69c6;          /* шапка и главный фиолетовый; чуть глубже #606FC9 ради контраста белого текста */
  --purple-600: #4b58ae;      /* ссылки и наведение */
  --purple-700: #3c4790;
  --violet: #97a5f9;
  --tint: #eef0fb;            /* мягкая фиолетовая подложка */
  --tint-2: #e2e6fa;
  --orange: #ff9800;
  --orange-hover: #ffb241;
  --orange-soft: #fff6d4;
  --orange-line: #ffd48a;

  /* Нейтральные */
  --ink: #211449;             /* основной тёмно-фиолетовый текст */
  --ink-2: #3d3566;
  --muted: #625d80;           /* вторичный текст, контраст 6:1 на белом */
  --faint: #8d89a6;
  --line: #e3e2ec;
  --line-2: #d2d0e0;
  --bg: #f5f5f7;
  --surface: #fff;

  /* Состояния */
  --green: #1f8a55;
  --green-soft: #e3f5eb;
  --red: #c7443c;             /* текст ошибок */
  --red-line: #ee8079;        /* рамка ошибки из референса */
  --red-soft: #fdeeed;

  --r-xs: 4px; --r-sm: 6px; --r-md: 8px; --r-lg: 12px;
  --shadow-1: 0 1px 2px rgba(33, 20, 73, .06);
  --shadow-2: 0 6px 20px rgba(33, 20, 73, .08), 0 1px 3px rgba(33, 20, 73, .05);
  --shadow-3: 0 18px 50px rgba(33, 20, 73, .18), 0 4px 12px rgba(33, 20, 73, .08);
  --focus: 0 0 0 3px rgba(91, 105, 198, .35);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --container: 1200px;
  --header-h: 56px;
  font-family: "Gilroy", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "lnum" 1, "pnum" 1;
  color: var(--ink);
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-padding-top: calc(var(--header-h) + 16px); }
body { margin: 0; min-height: 100vh; font-size: 15px; line-height: 1.4; font-weight: 500; letter-spacing: .01em; background: var(--bg); color: var(--ink); overflow-x: hidden; }
body.is-locked { overflow: hidden; }
h1, h2, h3, h4, p { margin: 0; }
h1 { font-size: 30px; line-height: 36px; font-weight: 700; letter-spacing: 0; }
h2 { font-size: 20px; line-height: 26px; font-weight: 600; }
h3 { font-size: 16px; line-height: 22px; font-weight: 600; }
a { color: var(--purple-600); text-underline-offset: 3px; text-decoration-thickness: 1px; }
a:hover { color: var(--purple-700); }
button, input, textarea { font: inherit; color: inherit; letter-spacing: inherit; }
button { cursor: pointer; }
img { max-width: 100%; display: block; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; }
.icon .fill, .icon-fill { fill: currentColor; stroke: none; }
.icon-sm { width: 16px; height: 16px; }
.icon-lg { width: 24px; height: 24px; }
.vh { position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.muted { color: var(--muted); }
.small { font-size: 13px; line-height: 18px; }
:focus { outline: none; }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; border-radius: var(--r-xs); }
/* После мыши рамки фокуса нет (ui.js, .is-pointer); у полей ввода подсветка остаётся — по ней видно, куда печатать. */
.is-pointer :focus-visible:not(input:not([type=checkbox]):not([type=radio])):not(textarea):not(select) { outline: none; --focus: 0 0 0 0 transparent; }
/* Route headings receive focus for screen readers, but are not interactive controls. */
[data-page-title][tabindex="-1"]:focus { outline: none; }

/* ---------- Кнопки ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border: 1.5px solid transparent; border-radius: var(--r-xs);
  font-size: 14px; line-height: 20px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; white-space: nowrap; text-decoration: none; background: none;
  transition: background-color .16s var(--ease), border-color .16s var(--ease), color .16s var(--ease), box-shadow .16s var(--ease), transform .08s; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn:focus-visible { outline: none; box-shadow: var(--focus); }
.btn .icon { width: 18px; height: 18px; stroke-width: 2; }
.btn-primary { background: var(--orange); color: var(--ink); }
.btn-primary:hover { background: var(--orange-hover); color: var(--ink); }
.btn-secondary { background: var(--surface); border-color: var(--orange); color: var(--ink); }
.btn-secondary:hover { background: var(--orange-soft); color: var(--ink); }
.btn-quiet { background: transparent; color: var(--purple-600); padding-inline: 10px; }
.btn-quiet:hover { background: var(--tint); color: var(--purple-700); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #ad3831; color: #fff; }
.btn-block { width: 100%; }
.btn:disabled, .btn[aria-disabled=true] { background: #e4e3ea; border-color: transparent; color: #8d89a6; cursor: not-allowed; }
.btn.is-busy { color: transparent !important; position: relative; pointer-events: none; }
.btn.is-busy::after { content: ""; position: absolute; width: 18px; height: 18px; border-radius: 50%; border: 2px solid var(--ink); border-right-color: transparent; animation: spin .7s linear infinite; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: var(--r-xs); background: transparent; color: var(--muted); transition: background-color .16s, color .16s; }
.icon-btn:hover, .icon-btn[aria-expanded=true] { background: var(--tint); color: var(--ink); }
.icon-btn:focus-visible { outline: none; box-shadow: var(--focus); }
.link-btn { border: 0; background: none; padding: 0; color: var(--purple-600); font-weight: 500; text-decoration: underline; text-decoration-color: rgba(75, 88, 174, .35); text-underline-offset: 3px; }
.link-btn:hover { color: var(--purple-700); text-decoration-color: currentColor; }

/* ---------- Поля ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; line-height: 16px; font-weight: 600; color: var(--ink-2); display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.field-label .opt { font-weight: 500; color: var(--faint); }
.input-wrap { position: relative; display: flex; align-items: center; }
.input { width: 100%; min-height: 44px; padding: 10px 14px; border: 1px solid var(--line-2); border-radius: var(--r-xs); background: var(--surface); color: var(--ink);
  font-size: 15px; line-height: 20px; transition: border-color .16s, box-shadow .16s; }
.input::placeholder { color: #a19db8; }
.input:hover { border-color: #b9b6cf; }
.input:focus { border-color: var(--purple); box-shadow: var(--focus); outline: none; }
.input-wrap .input.has-lead { padding-left: 42px; }
.input-wrap .input.has-trail { padding-right: 48px; }
.input-lead { position: absolute; left: 13px; color: var(--faint); pointer-events: none; }
.input-trail { position: absolute; right: 2px; }
.field.is-error .input { border-color: var(--red-line); }
.field.is-error .input:focus { box-shadow: 0 0 0 3px rgba(238, 128, 121, .28); }
.field-msg { font-size: 13px; line-height: 17px; color: var(--muted); }
.field.is-error .field-msg { color: var(--red); display: flex; gap: 6px; align-items: flex-start; }
.field.is-error .field-msg .icon { width: 16px; height: 16px; margin-top: 1px; }
.field-msg:empty { display: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-size: 14px; line-height: 20px; color: var(--ink-2); cursor: pointer; }
.check input { appearance: none; flex: none; width: 20px; height: 20px; margin: 0; border: 1.5px solid var(--line-2); border-radius: var(--r-xs); background: var(--surface); display: grid; place-items: center; transition: background-color .16s, border-color .16s; }
.check input::after { content: ""; width: 10px; height: 6px; border-left: 2px solid #fff; border-bottom: 2px solid #fff; transform: rotate(-45deg) translate(1px, -1px); opacity: 0; }
.check input:checked { background: var(--purple); border-color: var(--purple); }
.check input:checked::after { opacity: 1; }
.check input:focus-visible { box-shadow: var(--focus); outline: none; }
.check.is-error input { border-color: var(--red-line); }

/* Переключатель */
.switch { position: relative; flex: none; width: 40px; height: 24px; }
.switch input { appearance: none; margin: 0; width: 40px; height: 24px; border-radius: 12px; background: #cfcde0; transition: background-color .18s; cursor: pointer; }
.switch input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(33, 20, 73, .25); transition: transform .18s var(--ease); }
.switch input:checked { background: var(--purple); }
.switch input:checked::after { transform: translateX(16px); }
.switch input:focus-visible { box-shadow: var(--focus); outline: none; }

/* ---------- Фирменное выпадающее меню (без системного select) ---------- */
.dd-trigger { display: inline-flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 40px; max-width: 100%; padding: 8px 10px 8px 12px; border: 1px solid var(--line-2);
  border-radius: var(--r-xs); background: var(--surface); color: var(--ink); text-align: left; font-size: 14px; line-height: 18px; font-weight: 500; transition: border-color .16s, box-shadow .16s, background-color .16s; }
.dd-trigger:hover { border-color: #b3afcb; }
.dd-trigger[aria-expanded=true] { border-color: var(--purple); box-shadow: var(--focus); }
.dd-trigger:focus-visible { outline: none; border-color: var(--purple); box-shadow: var(--focus); }
.dd-trigger .dd-value { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dd-trigger .dd-sub { color: var(--faint); font-weight: 500; margin-left: 6px; }
.dd-trigger .icon { width: 18px; height: 18px; color: var(--muted); transition: transform .18s var(--ease); }
.dd-trigger[aria-expanded=true] .icon { transform: rotate(180deg); }
.dd-trigger.is-block { width: 100%; min-height: 44px; }
.dd-trigger.is-placeholder .dd-value { color: var(--faint); }
.pop { position: fixed; z-index: 900; min-width: 200px; max-width: calc(100vw - 24px); overflow: auto; overscroll-behavior: contain; padding: 6px; border: 1px solid var(--line); border-radius: var(--r-md);
  background: var(--surface); box-shadow: var(--shadow-3); animation: pop-in .14s var(--ease); }
.pop-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 40px; padding: 8px 10px; border: 0; border-radius: var(--r-xs); background: transparent; color: var(--ink); text-align: left; font-size: 14px; line-height: 18px; font-weight: 500; }
.pop-item:hover, .pop-item:focus { background: var(--tint); outline: none; }
.pop-item:focus-visible { box-shadow: inset 0 0 0 2px var(--purple); }
.pop-item .icon { color: var(--muted); width: 18px; height: 18px; }
.pop-item .pop-text { flex: 1; min-width: 0; }
.pop-item .pop-sub { display: block; font-size: 12px; line-height: 16px; color: var(--faint); font-weight: 500; margin-top: 1px; }
.pop-item .pop-check { width: 18px; height: 18px; color: var(--purple); visibility: hidden; }
.pop-item[aria-selected=true] { color: var(--purple-700); font-weight: 600; }
.pop-item[aria-selected=true] .pop-check { visibility: visible; }
.pop-item.is-danger { color: var(--red); }
.pop-item.is-danger .icon { color: var(--red); }
.pop-item.is-danger:hover, .pop-item.is-danger:focus { background: var(--red-soft); }
.pop-item:disabled { color: var(--faint); cursor: not-allowed; background: none; }
.pop-sep { height: 1px; margin: 6px 4px; background: var(--line); }
.pop-head { padding: 8px 10px 6px; font-size: 12px; line-height: 16px; color: var(--faint); font-weight: 500; }

/* ---------- Модальные окна и боковая панель ---------- */
.scrim { position: fixed; inset: 0; z-index: 800; background: rgba(33, 20, 73, .42); animation: fade-in .18s var(--ease); }
.modal { position: fixed; z-index: 810; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 48px); display: flex; flex-direction: column;
  background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-3); animation: modal-in .2s var(--ease); }
.modal.is-wide { width: min(640px, calc(100vw - 32px)); }
.modal-head { display: flex; gap: 12px; align-items: flex-start; padding: 22px 20px 0 24px; }
.modal-head h2 { flex: 1; padding-top: 6px; }
.modal-body { padding: 14px 24px 22px; overflow: auto; color: var(--ink-2); }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 24px; border-top: 1px solid var(--line); }
.modal-mark { flex: none; width: 36px; height: 36px; border-radius: var(--r-md); display: grid; place-items: center; margin-top: 2px; }
.modal-mark.is-danger { background: var(--red-soft); color: var(--red); }
.modal-mark.is-info { background: var(--tint); color: var(--purple-600); }
.drawer { position: fixed; z-index: 810; top: 0; right: 0; bottom: 0; width: min(460px, 100vw); display: flex; flex-direction: column; background: var(--surface); box-shadow: var(--shadow-3); animation: drawer-in .24s var(--ease); }

/* ---------- Уведомления ---------- */
.toast-region { position: fixed; z-index: 950; left: 50%; bottom: 24px; transform: translateX(-50%); display: grid; gap: 8px; width: min(460px, calc(100vw - 32px)); pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 10px 10px 10px 16px; border-radius: var(--r-md); background: var(--ink); color: #fff; box-shadow: var(--shadow-3); animation: toast-in .22s var(--ease); font-size: 14px; line-height: 19px; }
.toast .icon { color: #9be3b9; }
.toast.is-error .icon { color: #ffb3ad; }
.toast-text { flex: 1; min-width: 0; }
.toast .toast-action { border: 0; background: rgba(255, 255, 255, .12); color: #fff; border-radius: var(--r-xs); padding: 8px 12px; font-size: 13px; font-weight: 600; letter-spacing: .03em; text-transform: uppercase; }
.toast .toast-action:hover { background: rgba(255, 255, 255, .22); }
.toast .icon-btn { color: #cfcbe6; width: 36px; height: 36px; }
.toast .icon-btn:hover { background: rgba(255, 255, 255, .12); color: #fff; }

/* ---------- Мелочи ---------- */
.badge { display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 8px; border-radius: var(--r-xs); font-size: 12px; line-height: 16px; font-weight: 600; white-space: nowrap; }
.badge-soft { background: var(--tint); color: var(--purple-700); }
.badge-orange { background: var(--orange-soft); color: #8a5200; }
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--faint); }
.dot.is-online { background: #2fb36e; box-shadow: 0 0 0 3px rgba(47, 179, 110, .16); }
.dot.is-attention { background: var(--orange); box-shadow: 0 0 0 3px rgba(255, 152, 0, .18); }
.dot.is-offline { background: #b7b4c9; }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 2.5px solid var(--tint-2); border-top-color: var(--purple); animation: spin .8s linear infinite; }
.skel { display: block; border-radius: var(--r-xs); background: linear-gradient(90deg, #ecebf2 0%, #f6f5fa 50%, #ecebf2 100%); background-size: 200% 100%; animation: shimmer 1.3s linear infinite; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px); } }
@keyframes modal-in { from { opacity: 0; transform: translate(-50%, calc(-50% + 10px)); } }
@keyframes drawer-in { from { transform: translateX(24px); opacity: 0; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }
@keyframes sheet-in { from { transform: translateY(24px); opacity: 0; } }

@media (max-width: 640px) {
  body { font-size: 15px; }
  h1 { font-size: 24px; line-height: 30px; }
  .modal { left: 0; right: 0; top: auto; bottom: 0; transform: none; width: 100%; max-height: calc(100vh - 40px); border-radius: var(--r-lg) var(--r-lg) 0 0; animation: sheet-in .22s var(--ease); padding-bottom: env(safe-area-inset-bottom); }
  .modal.is-wide { width: 100%; }
  .modal-foot { flex-direction: column-reverse; }
  .modal-foot .btn { width: 100%; min-height: 48px; }
  .drawer { width: 100%; top: 0; animation: sheet-in .22s var(--ease); }
  .toast-region { bottom: 16px; }
  .icon-btn { width: 44px; height: 44px; }
  .input { min-height: 48px; font-size: 16px; }
  .dd-trigger.is-block { min-height: 48px; }
  .pop-item { min-height: 44px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
.icon-xs { width: 12px; height: 12px; stroke-width: 2.6; }

/* Gilroy: прописные буквы сидят примерно на 1 px выше центра строки — опускаем подпись, иконки не трогаем. */
.btn { padding-top: 9px; padding-bottom: 7px; }
.btn > .icon { margin-top: -2px; }
.toast .toast-action { padding: 9px 12px 7px; }
.top-btn .lang-code { position: relative; top: 1px; }

/* Иконка «Скопировать» — единая во всём прототипе */
.copy-ico { position: relative; flex: none; display: inline-grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 0; border-radius: var(--r-xs); background: transparent; color: var(--orange); cursor: pointer; transition: background-color .16s, color .16s, transform .12s; }
.copy-ico .icon { width: 22px; height: 22px; stroke-width: 2; grid-area: 1 / 1; transition: opacity .18s, transform .22s var(--ease); }
.copy-ico .ci-done { opacity: 0; transform: scale(.5); color: var(--green); stroke-width: 2.6; }
.copy-ico:hover { background: var(--orange-soft); color: #e07f00; }
.copy-ico:active { transform: scale(.92); }
.copy-ico:focus-visible { outline: none; box-shadow: var(--focus); }
.copy-ico.is-done { background: var(--green-soft); }
.copy-ico.is-done .ci-copy { opacity: 0; transform: scale(.5); }
.copy-ico.is-done .ci-done { opacity: 1; transform: scale(1); }
.copy-ico::after { content: attr(data-tip); position: absolute; bottom: calc(100% + 6px); left: 50%; transform: translate(-50%, 4px); padding: 4px 8px; border-radius: var(--r-xs); background: var(--ink); color: #fff; font-size: 12px; font-weight: 600; letter-spacing: 0; text-transform: none; white-space: nowrap; opacity: 0; pointer-events: none; transition: opacity .15s, transform .15s; z-index: 5; }
.copy-ico:hover::after, .copy-ico:focus-visible::after, .copy-ico.is-done::after { opacity: 1; transform: translate(-50%, 0); }
.copy-ico.is-done::after { background: var(--green); }
.enter.is-cmd .copy-ico:hover { background: rgba(255, 255, 255, .08); }

/* Подсказка при наведении мышью (data-tip, core.js hoverTips): одна плашка на страницу, вне разметки Preact. */
.hover-tip { position: fixed; left: 0; top: 0; z-index: 1000; max-width: min(360px, calc(100vw - 16px)); padding: 6px 10px; border-radius: var(--r-xs); background: var(--ink); color: #fff; font-size: 13px; font-weight: 600; line-height: 18px; overflow-wrap: anywhere; box-shadow: 0 6px 18px rgba(20, 16, 40, .18); pointer-events: none; opacity: 0; transform: translateY(4px); transition: opacity .12s, transform .12s; }
.hover-tip.is-on { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) { .hover-tip { transition: none; } }

/* Подвал всегда у нижнего края окна (владелец 01.10: «во время загрузки подвал вверх уползает, потом резко вниз»):
   экран — колонка высотой не меньше окна, содержимое растягивается, подвал стоит внизу и пока страница грузится. */
#app { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
#app > main { flex: 1 0 auto; }
#app > .site-foot { flex: none; }
#app.is-wide { --container: 1600px; }
