/* Общие стили marflow: цвета, шрифт, контейнер, кнопки, поля, карточки.
   Подключаются на всех страницах сайта (лендинг, панель), чтобы сетка и вид совпадали. */

:root {
  --bg: #0b0b0e;
  --surface: #141418;
  --surface-2: #1b1b21;
  --border: #25252d;
  --border-strong: #3a3a45;
  --text: #ededf2;
  --muted: #8b8b98;
  --accent: #c6ff3d;
  --accent-ink: #0b0b0e;
  --danger: #ff5a5f;
  --warn: #ffb547;
  --radius: 14px;
  --container: 1200px;
  --gutter: 28px;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }  /* иначе display у .btn и т.п. перебивает hidden */

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Inter Tight", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.4;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select { font: inherit; color: inherit; }
option { background: var(--surface); color: var(--text); }
a { color: var(--accent); }

/* Единый контейнер для всех страниц */
.container {
  width: 100%;
  max-width: var(--container);
  margin: 0 auto;
  padding: 0 var(--gutter);
}

@media (max-width: 900px) {
  :root { --gutter: 16px; }
}

/* ---------- шапка ---------- */

.topbar { border-bottom: 1px solid var(--border); }
.topbar .container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 68px;
}

.brand { display: flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand-logo { width: 26px; height: 26px; }
.brand-name { font-weight: 700; font-size: 20px; letter-spacing: -0.03em; }

/* переключатель сервисов (services.js) */
.svc { position: relative; display: flex; align-items: center; gap: 4px; }
.svc-toggle {
  display: grid; place-items: center; width: 28px; height: 28px; padding: 0;
  border: 1px solid transparent; border-radius: 8px; background: transparent; color: var(--muted); cursor: pointer;
}
.svc-toggle:hover, .svc.open .svc-toggle { border-color: var(--border); background: var(--surface-2); color: var(--text); }
.svc-toggle svg { width: 12px; height: 12px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.svc.open .svc-toggle svg { transform: rotate(180deg); }
.svc-menu {
  position: absolute; top: calc(100% + 10px); left: 0; z-index: 50; width: 320px; max-width: calc(100vw - 2 * var(--gutter));
  display: flex; flex-direction: column; gap: 4px;   /* промежуток, чтобы подсветки пунктов не сливались */
  padding: 6px; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius);
  box-shadow: 0 16px 40px rgba(0, 0, 0, .5);
}
.svc-menu[hidden] { display: none; }
.svc-item { display: flex; gap: 12px; align-items: flex-start; padding: 10px; border-radius: 10px; color: var(--text); text-decoration: none; }
.svc-item:hover { background: var(--surface-2); }
.svc-item.current { background: var(--surface-2); }
.svc-item img { width: 28px; height: 28px; flex: none; margin-top: 2px; }
.svc-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.svc-text b { font-size: 15px; letter-spacing: -0.02em; display: flex; align-items: center; gap: 6px; }
.svc-text b i { font-style: normal; font-weight: 600; font-size: 11px; padding: 1px 6px; border-radius: 99px; border: 1px solid var(--border-strong); color: var(--muted); }
.svc-text small { font-size: 13px; color: var(--muted); }
.svc-text .svc-url { font-size: 12px; opacity: .7; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- кнопки ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--text);
  border-radius: 10px;
  padding: 9px 16px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .05s, filter .15s;
}
.btn:hover { border-color: var(--border-strong); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.4; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { border-color: var(--accent); filter: brightness(1.05); }
.btn-ghost { background: transparent; }
.btn-wide { width: 100%; }
.btn-lg { padding: 14px 22px; font-size: 16px; border-radius: 12px; }
.btn-icon { padding: 9px; width: 40px; }
.btn-icon svg { width: 18px; height: 18px; }

/* ---------- карточки и поля ---------- */

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
}

.section-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 14px;
}

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; flex: 1; min-width: 0; }
.field > span { font-size: 13px; color: var(--muted); }
.field-row { display: flex; gap: 10px; }

input, textarea, select {
  width: 100%;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
textarea { resize: vertical; min-height: 64px; }
input:focus, textarea:focus, select:focus { border-color: var(--accent); }
select { cursor: pointer; }

.hint { margin: 12px 0 0; font-size: 12px; color: var(--muted); }
.muted { color: var(--muted); font-size: 13px; }

/* переключатель */
.switch { display: flex; align-items: center; gap: 10px; cursor: pointer; margin-bottom: 14px; user-select: none; }
.switch input { display: none; }
.switch .track {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 99px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  transition: background .15s;
  flex-shrink: 0;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--muted);
  transition: transform .15s, background .15s;
}
.switch input:checked + .track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .track::after { transform: translateX(16px); background: var(--accent-ink); }

/* ---------- уведомление ---------- */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 10;
  transform: translate(-50%, 20px);
  max-width: calc(100% - 32px);
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.error { border-color: var(--danger); color: #ffd5d6; }
.toast.ok { border-color: var(--accent); }

/* ---------- блок «Звук» (панель и док-панель OBS) ---------- */
/* Громкость — широкая плашка: вся плашка — ползунок, заливка — уровень.
   Настоящий input range лежит поверх невидимым (клавиатура, перетаскивание, доступность),
   --p (0..1) ставит sound.js. Два слоя текста: приглушённый на тёмном и яркий на заливке,
   верхний обрезан по уровню — буквы меняют цвет ровно на границе заливки. */
.vol-pill {
  --p: 1;
  position: relative;
  display: block;
  height: 44px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  overflow: hidden;
  user-select: none;
}
.vol-pill input {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  opacity: 0;
  cursor: ew-resize;
  -webkit-appearance: none;
  appearance: none;
}
/* тонкий невидимый «кружок» — значение идёт ровно от левого края до правого */
.vol-pill input::-webkit-slider-thumb { -webkit-appearance: none; width: 1px; height: 44px; }
.vol-pill input::-moz-range-thumb { width: 1px; height: 44px; border: 0; }
.vp-layer {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}
.vp-name { display: flex; align-items: center; gap: 8px; white-space: nowrap; }
.vp-name .ic { width: 18px; height: 18px; }
.vp-val { font-variant-numeric: tabular-nums; }
.vp-base { color: var(--text); }
.vp-base .vp-name { color: var(--muted); }
.vp-top {
  background: #3a3a46;  /* спокойный серый: громкость — не главное на экране */
  color: var(--text);
  clip-path: inset(0 calc((1 - var(--p)) * 100%) 0 0);
}
.vol-pill:focus-within { border-color: var(--border-strong); }
.vol-pills { display: grid; gap: 10px; }

/* плеер «для меня»: по правилам YouTube видео должно быть видно и не меньше 200 px */
.listen-video { position: relative; width: 100%; margin-top: 12px; aspect-ratio: 16 / 9; min-height: 200px; border-radius: 10px; overflow: hidden; background: #000; }
.listen-video iframe, .listen-video > div { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; }
.listen-video .yt-slot, .listen-video .vk-slot { display: none; }
.listen-video[data-source="youtube"] .yt-slot, .listen-video[data-source="vk"] .vk-slot { display: block; }
.listen-unlock {
  position: absolute; inset: 0; display: none; align-items: center; justify-content: center;
  background: rgba(0, 0, 0, 0.6); color: var(--text); font-weight: 600; cursor: pointer; text-align: center; padding: 12px;
}
.listen-video.blocked .listen-unlock { display: flex; }

/* ---------- кнопки-иконки ---------- */
.ic { width: 20px; height: 20px; fill: currentColor; flex-shrink: 0; }
.ic-line { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-round { width: 44px; height: 44px; padding: 0; border-radius: 50%; }
.btn-round.btn-lg-round { width: 52px; height: 52px; }
.btn-round.btn-lg-round .ic { width: 22px; height: 22px; }
/* пауза / играть: одна кнопка, на паузе показывает «играть» */
.js-play .ic-play { display: none; }
.js-play.is-paused .ic-play { display: block; }
.js-play.is-paused .ic-pause { display: none; }
.btn-danger-hover:hover { color: var(--danger); border-color: rgba(255, 90, 95, 0.5); }

/* ---------- своё окно вместо системных prompt / confirm ---------- */
.modal {
  width: min(420px, calc(100% - 32px));
  padding: 24px;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
}
.modal::backdrop { background: rgba(5, 5, 8, 0.6); backdrop-filter: blur(3px); }
.modal[open] { animation: modal-in .16s ease-out; }
@keyframes modal-in { from { opacity: 0; transform: translateY(8px) scale(0.98); } }
.modal-title { margin: 0; font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.modal-text { margin: 8px 0 0; color: var(--muted); }
.modal input { margin-top: 16px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 22px; }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }

/* ---------- всплывающее меню (ui.js): выбор плейлиста и свои выпадающие списки ---------- */
.menu {
  position: fixed;
  z-index: 50;
  max-width: calc(100vw - 16px);
  max-height: min(360px, calc(100vh - 16px));
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  background: var(--surface-2);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45);
  animation: menu-in .12s ease-out;
}
@keyframes menu-in { from { opacity: 0; transform: translateY(-4px); } }
.menu-title { padding: 8px 10px 6px; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em; color: var(--muted); }
.menu-sep { height: 1px; margin: 6px 4px; background: var(--border); }
.menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 9px 10px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.menu-item:hover, .menu-item:focus-visible { background: var(--border); outline: none; }
.menu-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-hint { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.menu-item.accent { color: var(--accent); }
/* выбранный пункт списка — галочка справа */
.menu-item[aria-checked="true"]::after {
  content: "";
  width: 14px;
  height: 8px;
  margin: 0 2px 4px 0;
  border: solid var(--accent);
  border-width: 0 0 2px 2px;
  transform: rotate(-45deg);
  flex-shrink: 0;
}

/* свой выпадающий список: кнопка как поле ввода, системный select спрятан */
.select-native { display: none !important; }
.select-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  text-align: left;
  cursor: pointer;
}
.select-btn:hover { border-color: var(--border-strong); }
.select-btn[aria-expanded="true"], .select-btn:focus-visible { border-color: var(--accent); outline: none; }
.select-btn:disabled { opacity: 0.5; cursor: default; }
.select-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.select-chevron { width: 16px; height: 16px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; transition: transform .15s; }
.select-btn[aria-expanded="true"] .select-chevron { transform: rotate(180deg); }

/* обложка трека в очереди: при наведении — «играть сейчас» */
.q-cover-play {
  position: relative;
  flex-shrink: 0;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  line-height: 0;
  cursor: pointer;
}
.q-cover-play::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  background: rgba(0, 0, 0, 0.55);
  opacity: 0;
  transition: opacity .12s;
}
.q-cover-play .ic {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 18px;
  height: 18px;
  color: #fff;
  opacity: 0;
  transition: opacity .12s, transform .12s;
  transform: scale(0.85);
}
.q-cover-play:hover::before, .q-cover-play:focus-visible::before { opacity: 1; }
.q-cover-play:hover .ic, .q-cover-play:focus-visible .ic { opacity: 1; transform: none; }
.q-cover-play:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
/* на телефоне наведения нет — иконку видно всегда, но приглушённо */
@media (hover: none) {
  .q-cover-play::before { opacity: 0.35; }
  .q-cover-play .ic { opacity: 0.9; transform: none; }
}

/* полоска прогресса с перемоткой: зона нажатия выше самой полоски, при наведении — кружок */
.bar.seekable { position: relative; height: 16px; background: none; overflow: visible; cursor: pointer; touch-action: none; }
.bar.seekable::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: 6px;
  height: 4px;
  border-radius: 4px;
  background: var(--surface-2);
  transition: top .12s, height .12s;
}
.bar.seekable .bar-fill { position: absolute; left: 0; top: 6px; height: 4px; border-radius: 4px; transition: width 1s linear, top .12s, height .12s; }
.bar.seekable:hover::before, .bar.seekable.dragging::before,
.bar.seekable:hover .bar-fill, .bar.seekable.dragging .bar-fill { top: 5px; height: 6px; }
.bar.seekable.dragging .bar-fill { transition: none; }
.bar.seekable .bar-fill::after {
  content: "";
  position: absolute;
  right: -6px;
  top: 50%;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text);
  transform: translateY(-50%) scale(0);
  transition: transform .12s;
}
.bar.seekable:hover .bar-fill::after, .bar.seekable.dragging .bar-fill::after { transform: translateY(-50%) scale(1); }

/* ---------- прокрутка: тонкая и тёмная вместо белой системной ---------- */
* { scrollbar-width: thin; scrollbar-color: var(--border-strong) transparent; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 99px;
  background: var(--border-strong) padding-box;
}
::-webkit-scrollbar-thumb:hover { background-color: #55555f; }
::-webkit-scrollbar-corner { background: transparent; }

