/* Общая основа для всех страниц сайта. Цвета берутся из токенов темы (pm.css или club.css). */
*, *::before, *::after { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; background: var(--bg); }
:root {
  --sans: "Onest", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Roboto, Arial, sans-serif;
  --serif: "Spectral", Georgia, "Times New Roman", serif;
  --ease: cubic-bezier(.22, .8, .24, 1);
  --safe-t: env(safe-area-inset-top, 0px);
  --safe-b: env(safe-area-inset-bottom, 0px);
  --r-sm: 10px; --r: 16px; --r-lg: 22px;
  /* зерно как у печати: снимает «пластиковость» ровных цветов */
  --grain: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .5 0 0 0 0 .5 0 0 0 0 .5 0 0 0 1 0'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}
body {
  margin: 0; min-height: 100vh; min-height: 100dvh;
  font-family: var(--sans); font-size: 16px; line-height: 1.55; font-feature-settings: "ss01";
  color: var(--text); background: var(--bg); -webkit-font-smoothing: antialiased;
  transition: background-color .3s var(--ease), color .3s var(--ease);
}
body::after {
  content: ""; position: fixed; inset: 0; z-index: 90; pointer-events: none;
  background-image: var(--grain); background-size: 160px; opacity: var(--grain-o, .05); mix-blend-mode: var(--grain-blend, overlay);
}
h1, h2, h3, h4, p { margin: 0; }
h1, h2, h3 { text-wrap: balance; font-weight: 600; }
p { text-wrap: pretty; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
input, textarea { font: inherit; color: inherit; }
svg { display: block; }
em { font-style: italic; }
[hidden] { display: none !important; }
.ic { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; flex: none; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 3px; }
.scene { width: 100%; height: 100%; }

/* ---------- кнопки ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 54px; padding: 0 28px; border-radius: 999px;
  font-weight: 500; font-size: 16px; line-height: 1.2; letter-spacing: .005em; text-align: center;
  color: var(--btn-ink); background: var(--btn-bg);
  transition: transform .18s var(--ease), background-color .2s var(--ease), color .2s, opacity .2s, box-shadow .2s;
}
.btn:hover { background: var(--btn-hover, var(--btn-bg)); }
.btn:active { transform: scale(.985); }
.btn[disabled], .btn[aria-disabled="true"] { opacity: .45; cursor: not-allowed; transform: none; }
.btn.block { width: 100%; }
.btn.sm { min-height: 44px; padding: 0 18px; font-size: 15px; }
.btn.ghost { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn.ghost:hover { box-shadow: inset 0 0 0 1px var(--text); }
.btn.soft { background: var(--accent-soft); color: var(--accent-ink); }
.btn.danger { background: var(--danger); color: #fff; }
.btn .ic { width: 19px; height: 19px; }

.icon-btn {
  width: 44px; height: 44px; flex: none; border-radius: 50%;
  display: grid; place-items: center; color: var(--text);
  transition: background-color .2s var(--ease), transform .18s var(--ease);
}
.icon-btn:hover { background: var(--hover); }
.icon-btn:active { transform: scale(.94); }
.icon-btn .ic { width: 21px; height: 21px; }

/* ---------- уведомления ---------- */
.toasts { position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%); z-index: 100; display: grid; gap: 8px; width: min(92vw, 420px); pointer-events: none; }
.toast { padding: 14px 18px; border-radius: 14px; font-size: 15px; background: var(--toast-bg); color: var(--toast-ink); box-shadow: 0 12px 30px -14px rgba(0, 0, 0, .5); animation: toast-in .3s var(--ease); }
.toast.out { opacity: 0; transform: translateY(8px); transition: all .3s var(--ease); }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

/* ---------- нижний лист / диалог ---------- */
dialog.sheet {
  border: 0; padding: 0; margin: auto auto 0; width: min(100%, 520px); max-height: 88dvh;
  border-radius: 22px 22px 0 0; color: var(--text); background: var(--bg);
  box-shadow: 0 -1px 0 var(--line), 0 -20px 60px -20px rgba(0, 0, 0, .5);
}
dialog.sheet[open] { animation: sheet-in .32s var(--ease); }
dialog.sheet::backdrop { background: rgba(8, 8, 12, .55); }
dialog.sheet form { padding: 26px 22px calc(22px + var(--safe-b)); display: grid; gap: 12px; }
dialog.sheet h2 { font-size: 22px; }
dialog.sheet p { color: var(--muted); font-size: 15px; }
.sheet-actions { display: grid; gap: 10px; margin-top: 8px; }
@keyframes sheet-in { from { transform: translateY(40px); opacity: 0; } }
@media (min-width: 640px) { dialog.sheet { margin: auto; border-radius: 22px; } }

/* ---------- демо-панель (видна только при открытии демо-ссылки) ---------- */
.demo-fab {
  /* язычок у правого края: не перекрывает кнопки и текст */
  position: fixed; right: 0; top: 50%; z-index: 60; transform: translateY(-50%);
  writing-mode: vertical-rl; padding: 12px 6px; border-radius: 10px 0 0 10px;
  font-size: 11px; font-weight: 600; letter-spacing: .06em;
  color: #fff; background: rgba(30, 30, 36, .72); backdrop-filter: blur(8px); opacity: .75;
}
.demo-fab:hover { opacity: 1; }
.demo-list { display: grid; gap: 8px; }
.demo-opt { display: grid; gap: 2px; text-align: left; padding: 12px 14px; border-radius: 12px; box-shadow: inset 0 0 0 1px var(--line); }
.demo-opt span { font-size: 13px; color: var(--muted); }
.demo-opt.on { box-shadow: inset 0 0 0 1.5px var(--text); }

/* ---------- плеер ---------- */
.pl { --p: 0%; }
.pl-screen { position: relative; aspect-ratio: 16 / 9; border-radius: var(--r); overflow: hidden; background: var(--surface-2); isolation: isolate; }
.pl-screen > svg, .pl-screen > .cosmos { position: absolute; inset: 0; }
.pl-screen > svg.scene { transition: transform 8s linear; }
.pl.is-playing .pl-screen > svg.scene { transform: scale(1.05); }
.pl-big {
  position: absolute; inset: 0; margin: auto; width: 68px; height: 68px; border-radius: 50%;
  display: grid; place-items: center; color: #111; background: rgba(255, 255, 255, .92);
  transition: opacity .25s var(--ease), transform .25s var(--ease);
}
.pl-big .ic { width: 24px; height: 24px; margin-left: 3px; }
.pl.is-playing .pl-big { opacity: 0; transform: scale(.85); pointer-events: none; }
.pl-demo { position: absolute; top: 10px; right: 10px; padding: 2px 8px; border-radius: 999px; font-size: 11px; color: #fff; background: rgba(10, 10, 14, .45); }
.pl-panel { padding: 12px 0 0; }
.pl-title { font-weight: 500; margin-bottom: 8px; }
.pl-seek { -webkit-appearance: none; appearance: none; width: 100%; height: 24px; margin: 0; background: transparent; cursor: pointer; }
.pl-seek::-webkit-slider-runnable-track { height: 3px; border-radius: 99px; background: linear-gradient(90deg, var(--text) var(--p), var(--track) var(--p)); }
.pl-seek::-moz-range-track { height: 3px; border-radius: 99px; background: var(--track); }
.pl-seek::-moz-range-progress { height: 3px; border-radius: 99px; background: var(--text); }
.pl-seek::-webkit-slider-thumb { -webkit-appearance: none; width: 13px; height: 13px; margin-top: -5px; border-radius: 50%; background: var(--text); }
.pl-seek::-moz-range-thumb { width: 13px; height: 13px; border: 0; border-radius: 50%; background: var(--text); }
.pl-times { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pl-ctrl { display: flex; align-items: center; justify-content: center; gap: 22px; margin-top: 6px; }
.pl-btn { position: relative; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; color: var(--text); transition: transform .18s var(--ease), background-color .2s; }
.pl-btn:hover { background: var(--hover); }
.pl-btn:active { transform: scale(.92); }
.pl-btn small { position: absolute; font-size: 8.5px; font-weight: 600; top: 50%; left: 50%; transform: translate(-50%, -38%); }
.pl-main { width: 62px; height: 62px; color: var(--btn-ink); background: var(--btn-bg); }
.pl-main:hover { background: var(--btn-hover, var(--btn-bg)); }
.pl-main .ic { width: 24px; height: 24px; }
.pl-speed { font-size: 14px; font-weight: 500; font-variant-numeric: tabular-nums; }
.pl-audio { display: grid; gap: 4px; }
.pl-cover { position: relative; aspect-ratio: 1 / 1; max-width: 280px; width: 72%; margin: 0 auto 10px; border-radius: var(--r-lg); overflow: hidden; background: var(--surface-2); }
.pl-cover > svg, .pl-cover > .cosmos { position: absolute; inset: 0; }
.pl-audio .pl-title { text-align: center; font-size: 17px; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* настоящее видео: видно сразу (первый кадр), обложка не нужна; пока грузится — крутится индикатор */
.pl-screen > video.pl-media { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; z-index: -1; cursor: pointer; }
.pl-spin { position: absolute; inset: 0; margin: auto; width: 46px; height: 46px; border-radius: 50%; border: 3px solid rgba(255, 255, 255, .25); border-top-color: #fff; opacity: 0; pointer-events: none; transition: opacity .2s; }
.pl.is-loading .pl-spin { opacity: 1; animation: pl-spin .8s linear infinite; }
.pl.is-loading .pl-big { opacity: 0; pointer-events: none; }
@keyframes pl-spin { to { transform: rotate(360deg); } }

/* долгое нажатие на видео в iPhone не открывает меню «Сохранить» */
.pl-media, .preview-video { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
