/* Suslik Media — Современный десктопный и адаптивный редизайн («Матовое стекло» + «Проекторная») */

@font-face {
  font-family: "Unbounded";
  font-weight: 500;
  font-display: swap;
  src: url(fonts/unbounded-cyrillic-500-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Unbounded";
  font-weight: 500;
  font-display: swap;
  src: url(fonts/unbounded-latin-500-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Unbounded";
  font-weight: 700;
  font-display: swap;
  src: url(fonts/unbounded-cyrillic-700-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Unbounded";
  font-weight: 700;
  font-display: swap;
  src: url(fonts/unbounded-latin-700-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Onest";
  font-weight: 400;
  font-display: swap;
  src: url(fonts/onest-cyrillic-400-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest";
  font-weight: 400;
  font-display: swap;
  src: url(fonts/onest-latin-400-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Onest";
  font-weight: 500;
  font-display: swap;
  src: url(fonts/onest-cyrillic-500-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest";
  font-weight: 500;
  font-display: swap;
  src: url(fonts/onest-latin-500-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: "Onest";
  font-weight: 600;
  font-display: swap;
  src: url(fonts/onest-cyrillic-600-normal.woff2) format("woff2");
  unicode-range: U+0301, U+0400-045F, U+0490-0491, U+04B0-04B1, U+2116;
}
@font-face {
  font-family: "Onest";
  font-weight: 600;
  font-display: swap;
  src: url(fonts/onest-latin-600-normal.woff2) format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
  --night: #060911;
  --booth: #10141e;
  --film: #161c28;
  --line: #222838;
  --line2: #2e374c;
  --text: #eef0f5;
  --muted: #8e96a8;
  --lamp: #ffb02e;
  --lamp-soft: rgba(255, 176, 46, 0.16);
  --lamp-ink: #1c1200;
  --electric: #2563eb;
  --electric-soft: rgba(37, 99, 235, 0.18);
  --electric-glow: rgba(37, 99, 235, 0.35);
  --glass-side: rgba(8, 12, 22, 0.88);
  --glass-fill: rgba(24, 32, 50, 0.65);
  --glass-fill-hover: rgba(32, 44, 70, 0.85);
  --glass-edge: rgba(255, 255, 255, 0.08);
  --glass-edge-hover: rgba(96, 165, 250, 0.45);
  --glass-sheet: rgba(11, 16, 32, 0.94);
  --bg: var(--night);
  --panel: var(--booth);
  --accent: var(--electric);
  --accent2: var(--lamp);
  --display: "Unbounded", "Onest", system-ui, sans-serif;
  --ui: "Onest", system-ui, -apple-system, "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.22, 0.8, 0.24, 1);
}

html {
  background: var(--night);
  color-scheme: dark;
  scroll-behavior: smooth;
}

body {
  font-family: var(--ui) !important;
  background: var(--night) !important;
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  position: relative;
  min-height: 100vh;
  margin: 0;
}

/* Мягкое свечение кинозала (Electric Blue + Violet + Projector Beam) */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 65% 45% at 20% 12%, rgba(37, 99, 235, 0.14), transparent 70%),
    radial-gradient(ellipse 55% 50% at 85% 85%, rgba(139, 92, 246, 0.12), transparent 70%),
    radial-gradient(ellipse 50% 35% at 50% 50%, rgba(6, 182, 212, 0.08), transparent 70%),
    conic-gradient(from 198deg at 88% -8%, transparent 0deg, rgba(255, 176, 46, 0.16) 12deg, rgba(255, 176, 46, 0.04) 26deg, transparent 40deg);
  filter: blur(28px);
  animation: beam 1.8s var(--ease) both;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background: radial-gradient(60% 40% at 50% 110%, #060911 0, transparent 70%);
}

@keyframes beam {
  from { transform: rotate(-3deg); opacity: 0; }
  to { transform: none; opacity: 1; }
}

/* Скроллбары */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: transparent;
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.14);
  border-radius: 999px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.28);
}

/* Базовые элементы */
h1, h2, h3 {
  font-family: var(--display);
  font-weight: 500;
  letter-spacing: -0.02em;
  color: #fff;
}
h2 {
  font-size: clamp(20px, 2.4vw, 26px);
  line-height: 1.2;
  margin: 0 0 6px;
}
h3 {
  font-size: 15.5px;
}
p, .file-meta {
  color: var(--muted);
}
.eyebrow {
  font-size: 13px !important;
  color: var(--muted) !important;
  font-weight: 500;
  text-transform: none !important;
  letter-spacing: 0 !important;
}

/* Главный контейнер */
main {
  position: relative;
  z-index: 1;
  width: min(1200px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 90px;
}

/* Панели */
.panel {
  background: var(--booth) !important;
  border: 1px solid var(--glass-edge) !important;
  border-radius: 18px !important;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.35) !important;
  padding: 24px !important;
  margin: 18px 0 !important;
  box-sizing: border-box;
}

/* Инпуты и контролы */
input, select, textarea {
  font-family: var(--ui);
  background: var(--night) !important;
  border: 1px solid var(--line2) !important;
  border-radius: 12px !important;
  color: var(--text) !important;
  transition: border-color 0.2s, box-shadow 0.2s;
  box-sizing: border-box;
}
input:focus-visible, select:focus-visible {
  outline: none;
  border-color: #60a5fa !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.24) !important;
}
label {
  color: #c5cad6;
  font-size: 13px;
  font-weight: 500;
  margin-bottom: 8px;
}

/* Кнопки */
button, .button {
  font-family: var(--ui);
  font-weight: 600;
  border-radius: 12px;
  transition: transform 0.18s var(--ease), background 0.2s, box-shadow 0.25s, border-color 0.2s, opacity 0.2s;
}
button:not(.secondary):not(.mode-card):not(.tile-remove):not(.tile-play):not(.tile-fav):not(.cat-chip):not(.view-btn):not(.clear-search-btn):not(.lib-pill):not(.btn-refresh):not(.lib-menu-btn):not(.sess-btn):not(.hb-thumb),
a.button:not(.secondary) {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #fff !important;
  border: 1px solid rgba(96, 165, 250, 0.4) !important;
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.35) !important;
}
button:not(.secondary):not(.mode-card):not(.tile-remove):not(.tile-play):not(.tile-fav):not(.cat-chip):not(.view-btn):not(.clear-search-btn):not(.lib-pill):not(.btn-refresh):not(.lib-menu-btn):not(.sess-btn):not(.hb-thumb):hover:not(:disabled) {
  box-shadow: 0 6px 26px rgba(37, 99, 235, 0.5) !important;
  filter: brightness(1.06);
  transform: translateY(-1px);
}
button.secondary, a.button.secondary {
  background: var(--glass-fill) !important;
  color: var(--text) !important;
  border: 1px solid var(--line2) !important;
  box-shadow: none !important;
}
button.secondary:hover:not(:disabled), a.button.secondary:hover {
  border-color: rgba(96, 165, 250, 0.45) !important;
  color: #fff !important;
  background: var(--glass-fill-hover) !important;
}

/* Шапка до входа */
.brand {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 22px !important;
}
.brand strong {
  font-family: var(--display);
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.01em;
  color: #fff;
}
.brand .eyebrow {
  margin-bottom: 2px;
}

/* Фирменный логотип Suslik Media (суслик в кнопке Play из desktop app / Android) */
.brand-mark-wrap {
  position: relative;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.brand-mark-wrap::before {
  content: "";
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(109, 91, 240, 0.42) 0%, rgba(37, 99, 235, 0.18) 55%, transparent 75%);
  filter: blur(8px);
  pointer-events: none;
  animation: brandBreathing 4.5s ease-in-out infinite alternate;
}
@keyframes brandBreathing {
  0% { opacity: 0.55; transform: scale(0.92); }
  100% { opacity: 1; transform: scale(1.15); }
}
.brand-logo,
.sidebar-brand-logo,
.mobile-brand-logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  position: relative;
  z-index: 1;
  filter: drop-shadow(0 4px 14px rgba(109, 91, 240, 0.5));
}
.logo {
  width: 44px !important;
  height: 44px !important;
  border-radius: 0 !important;
  background: transparent url("brand-mark.png") center/contain no-repeat !important;
  color: transparent !important;
  font-size: 0 !important;
  box-shadow: none !important;
  filter: drop-shadow(0 4px 14px rgba(109, 91, 240, 0.5)) !important;
  flex-shrink: 0 !important;
}

.hero {
  margin: 4vh 0 26px !important;
  position: relative;
  background: none !important;
  border: 0 !important;
  box-shadow: none !important;
  padding: 0 !important;
}
.hero h1 {
  font-family: var(--display);
  font-weight: 700;
  font-size: clamp(26px, 4.2vw, 44px);
  line-height: 1.1;
  letter-spacing: -0.03em;
  color: #fff;
  max-width: 18ch;
}
.hero p {
  max-width: 44ch;
  font-size: 15px;
  color: var(--muted);
}
.mascot-orbit,
.nav-glider {
  display: none !important;
}

/* Глобальное скрытие элементов с классом hidden */
#appPanel.hidden,
#loginPanel.hidden,
.hidden {
  display: none !important;
}

/* Форма входа (когда сессия не авторизована) */
body:not(.authenticated) main,
body:has(#appPanel.hidden) main {
  width: min(480px, calc(100% - 32px)) !important;
  margin: 10vh auto 60px !important;
  padding: 0 0 60px !important;
}
#loginPanel {
  background: var(--booth) !important;
  border: 1px solid var(--glass-edge) !important;
  border-radius: 20px !important;
  padding: 28px !important;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(255, 255, 255, 0.04) !important;
  margin-top: 20px !important;
}
#loginPanel h2 {
  font-family: var(--display);
  font-size: 24px;
  margin: 0 0 6px;
  color: #fff;
}
#loginPanel p {
  color: var(--muted);
  margin: 0 0 20px;
  font-size: 14px;
}
#loginForm label {
  font-weight: 500;
  font-size: 13px;
  color: #c5cad6;
  margin-bottom: 8px;
  display: block;
}
#loginForm .row {
  display: flex;
  gap: 10px;
}
#loginForm input {
  flex: 1;
  min-width: 0;
  height: 48px;
  padding: 0 16px;
  font-size: 14.5px;
  background: rgba(6, 9, 17, 0.8) !important;
  border: 1px solid var(--line2) !important;
  border-radius: 12px !important;
  color: #fff !important;
}
#loginForm button {
  height: 48px;
  padding: 0 24px;
  font-size: 14px;
  font-weight: 600;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #fff !important;
  border: 1px solid rgba(96, 165, 250, 0.4) !important;
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.4) !important;
  cursor: pointer;
}

/* ========================================================================================= */
/* ДЕСКТОПНЫЙ APP SHELL (>= 901px)                                                          */
/* ========================================================================================= */
@media (min-width: 901px) {
  body:has(#appPanel:not(.hidden)) main,
  body.authenticated main {
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }
  body:has(#appPanel:not(.hidden)) > main > .brand,
  body:has(#appPanel:not(.hidden)) > main > .hero,
  body.authenticated > main > .brand,
  body.authenticated > main > .hero {
    display: none !important;
  }

  #appPanel:not(.hidden) {
    display: flex !important;
    min-height: 100vh;
    width: 100%;
    position: relative;
    z-index: 1;
  }
  #appPanel.hidden {
    display: none !important;
  }

  /* Левая боковая панель (Sidebar) */
  .app-sidebar {
    width: 254px;
    min-width: 254px;
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    background: var(--glass-side);
    border-right: 1px solid var(--glass-edge);
    box-sizing: border-box;
    padding: 24px 14px 20px;
    z-index: 100;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
  }

  .sidebar-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 4px 6px 18px;
    border-bottom: 1px solid var(--glass-edge);
  }
  .sidebar-brand .brand-mark-wrap {
    width: 42px;
    height: 42px;
  }
  .sidebar-brand-logo {
    width: 40px;
    height: 40px;
  }
  .sidebar-brand .logo {
    width: 40px !important;
    height: 40px !important;
    flex-shrink: 0;
  }
  .sidebar-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
  }
  .sidebar-brand-text strong {
    font-family: var(--display);
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.02em;
  }
  .sidebar-brand-text span {
    font-family: var(--ui);
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.28em;
    background: linear-gradient(90deg, #22d3ee, #6d8cf5, #9b6bff);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    margin-top: 2px;
  }

  /* Вкладки навигации в сайдбаре */
  .navrow {
    display: flex !important;
    flex-direction: column !important;
    gap: 6px !important;
    width: 100% !important;
    margin: 20px 0 auto !important;
    padding: 0 !important;
    background: transparent !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    position: relative;
  }
  .navrow button, .navrow button.secondary {
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    gap: 12px !important;
    width: 100% !important;
    min-height: 44px !important;
    padding: 10px 14px !important;
    border-radius: 12px !important;
    font-size: 13.5px !important;
    font-weight: 500 !important;
    font-family: var(--ui) !important;
    color: var(--muted) !important;
    background: transparent !important;
    border: 1px solid transparent !important;
    text-align: left !important;
    cursor: pointer !important;
    transition: color 0.2s, background 0.2s, border-color 0.2s !important;
    box-sizing: border-box !important;
    white-space: nowrap !important;
    position: relative;
    z-index: 1;
  }
  .navrow button .nav-icon {
    font-size: 17px;
    line-height: 1;
    width: 20px;
    text-align: center;
    flex-shrink: 0;
    display: inline-block;
  }
  .navrow button .nav-long {
    display: inline !important;
  }
  .navrow button .nav-short {
    display: none !important;
  }
  .navrow button:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.05) !important;
    border-color: rgba(255, 255, 255, 0.08) !important;
  }
  .navrow button:not(.secondary) {
    color: #fff !important;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.85), rgba(59, 130, 246, 0.7)) !important;
    border-color: rgba(96, 165, 250, 0.38) !important;
    box-shadow: 0 4px 18px rgba(37, 99, 235, 0.3) !important;
    font-weight: 600 !important;
  }
  .navrow button:not(.secondary) .nav-icon {
    color: #ffd27a;
  }

  /* Профиль и выход внизу сайдбара */
  .sidebar-profile {
    display: flex;
    flex-direction: column;
    gap: 10px;
    padding: 12px;
    border-radius: 14px;
    background: var(--glass-fill);
    border: 1px solid var(--glass-edge);
    margin-top: 18px;
  }
  .sidebar-profile-info {
    display: flex;
    align-items: center;
    gap: 10px;
  }
  .profile-avatar {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, #2563eb, #6366f1);
    color: #fff;
    font-family: var(--ui);
    font-weight: 700;
    font-size: 13.5px;
    display: grid;
    place-items: center;
    border: 1px solid rgba(255, 255, 255, 0.25);
    flex-shrink: 0;
  }
  .profile-meta {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }
  .profile-meta strong {
    font-size: 13px;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .profile-meta .profile-sub {
    font-size: 11px;
    color: #7fe0b0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .sidebar-profile .btn-logout {
    width: 100%;
    min-height: 32px;
    padding: 6px 10px;
    border-radius: 10px;
    font-size: 12.5px;
    font-weight: 500;
    background: rgba(255, 255, 255, 0.04) !important;
    border: 1px solid var(--line2) !important;
    color: var(--muted) !important;
    cursor: pointer;
    transition: all 0.2s;
  }
  .sidebar-profile .btn-logout:hover {
    color: #ff9b8f !important;
    border-color: rgba(255, 155, 143, 0.45) !important;
    background: rgba(255, 155, 143, 0.1) !important;
  }

  .mobile-topline {
    display: none !important;
  }

  /* Основная рабочая область контента */
  .app-viewport {
    flex: 1;
    min-width: 0;
    box-sizing: border-box;
    padding: 32px 48px 60px;
    max-width: 1560px;
    width: 100%;
    margin: 0 auto;
  }

  /* 2-колоночный дашборд для «Открыть ссылку» */
  #linkTab > .panel:first-child {
    display: grid !important;
    grid-template-columns: minmax(0, 1.18fr) minmax(0, 0.82fr) !important;
    gap: 28px !important;
    align-items: start !important;
  }
  #linkForm {
    grid-column: 1;
  }
  #linkStatus {
    grid-column: 1;
  }
  #historyPanel {
    grid-column: 2;
    background: var(--film);
    border: 1px solid var(--line2);
    border-radius: 16px;
    padding: 18px 20px;
    margin: 0 !important;
    max-height: 600px;
    overflow-y: auto;
  }
}

/* ========================================================================================= */
/* МОБИЛЬНЫЙ РЕЖИМ (<= 900px)                                                               */
/* ========================================================================================= */
@media (max-width: 900px) {
  .app-sidebar {
    display: contents !important;
  }
  .sidebar-brand, .sidebar-profile {
    display: none !important;
  }
  .app-viewport {
    display: contents !important;
  }
  .mobile-topline {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    margin: 14px 0 20px;
  }
  .mobile-brand {
    display: flex;
    align-items: center;
    gap: 12px;
  }
  .mobile-brand .brand-mark-wrap {
    width: 36px;
    height: 36px;
  }
  .mobile-brand-logo {
    width: 34px;
    height: 34px;
  }
  .mobile-topline h2 {
    margin: 0;
    font-size: 20px;
  }
  .mobile-topline p {
    margin: 2px 0 0;
    font-size: 12.5px;
  }
  .btn-logout-mobile {
    padding: 8px 14px;
    font-size: 13px;
  }

  /* Нижняя панель-таблетка (Telegram-style) */
  .navrow {
    position: fixed !important;
    z-index: 9999 !important;
    left: 50% !important;
    bottom: max(10px, env(safe-area-inset-bottom)) !important;
    transform: translateX(-50%) !important;
    width: min(340px, calc(100% - 24px)) !important;
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    gap: 3px !important;
    padding: 5px !important;
    margin: 0 !important;
    border-radius: 999px !important;
    background: #0d1017f2 !important;
    backdrop-filter: blur(18px) !important;
    -webkit-backdrop-filter: blur(18px) !important;
    border: 1px solid var(--line2) !important;
    box-shadow: 0 10px 34px rgba(0, 0, 0, 0.6) !important;
    box-sizing: border-box;
  }
  .navrow button, .navrow button.secondary {
    flex: 1 1 0 !important;
    min-width: 0 !important;
    min-height: 44px !important;
    padding: 5px 2px !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    gap: 2px !important;
    border-radius: 999px !important;
    font-size: 10.5px !important;
    line-height: 1.1 !important;
    font-weight: 600 !important;
    background: transparent !important;
    border: 0 !important;
    box-shadow: none !important;
    white-space: nowrap !important;
    overflow: hidden;
  }
  .navrow button .nav-icon {
    font-size: 16px;
    line-height: 1;
  }
  .navrow button .nav-long {
    display: none !important;
  }
  .navrow button .nav-short {
    display: inline !important;
  }
  .navrow button:not(.secondary) {
    background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
    color: #fff !important;
  }
  body {
    padding-bottom: calc(76px + env(safe-area-inset-bottom)) !important;
  }
}

/* ========================================================================================= */
/* РАЗДЕЛ БИБЛИОТЕКИ (Моя медиатека)                                             */
/* ========================================================================================= */
.library-header-panel {
  padding: 24px 28px !important;
  margin-bottom: 24px !important;
}
.library-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 18px;
}
.library-heading-row {
  display: flex;
  align-items: baseline;
  gap: 12px;
}
.library-heading-row h2 {
  font-size: clamp(20px, 2.2vw, 26px);
  margin: 0;
}
.count-badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--ui);
  background: var(--glass-fill);
  border: 1px solid var(--glass-edge);
  color: #93c5fd;
}
.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  font-size: 13.5px;
  border-radius: 12px;
  cursor: pointer;
  background: rgba(96, 165, 250, 0.12) !important;
  color: #93c5fd !important;
  border: 1px solid rgba(96, 165, 250, 0.35) !important;
  box-shadow: 0 0 16px rgba(96, 165, 250, 0.15) !important;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease, color 0.2s ease;
}
.btn-refresh:hover {
  background: rgba(96, 165, 250, 0.22) !important;
  border-color: rgba(96, 165, 250, 0.6) !important;
  color: #bfdbfe !important;
  box-shadow: 0 0 20px rgba(96, 165, 250, 0.3) !important;
}
.refresh-spinner {
  font-size: 16px;
  display: inline-block;
  transition: transform 0.4s ease;
}
.btn-refresh.loading .refresh-spinner {
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

/* Поисковая строка в библиотеке */
.library-search-bar {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
  margin-bottom: 16px;
}
.library-search-bar .search-lens {
  position: absolute;
  left: 14px;
  font-size: 17px;
  color: var(--muted);
  pointer-events: none;
}
.library-search-bar input {
  width: 100%;
  padding: 12px 38px 12px 42px;
  font-size: 14px;
  background: var(--night) !important;
  border: 1px solid var(--line2) !important;
  border-radius: 12px !important;
  color: #fff;
}
.library-search-bar input:focus {
  border-color: #60a5fa !important;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.22) !important;
}
.clear-search-btn {
  position: absolute;
  right: 12px;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1) !important;
  color: var(--muted) !important;
  border: 0 !important;
  font-size: 16px !important;
  line-height: 1 !important;
  padding: 0 !important;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: none !important;
}
.clear-search-btn:hover {
  background: rgba(255, 255, 255, 0.2) !important;
  color: #fff !important;
}

/* Тулбар категорий и сортировки */
.library-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.category-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cat-chip {
  padding: 7px 15px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--ui);
  background: transparent !important;
  color: var(--muted) !important;
  border: 1px solid var(--line2) !important;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: none !important;
}
.cat-chip:hover {
  color: #fff !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
  background: rgba(255, 255, 255, 0.05) !important;
}
.cat-chip.active {
  background: linear-gradient(135deg, #2563eb, #1d4ed8) !important;
  color: #fff !important;
  border-color: rgba(96, 165, 250, 0.45) !important;
  box-shadow: 0 2px 10px rgba(37, 99, 235, 0.3) !important;
  font-weight: 600;
}
.library-tools-right {
  display: flex;
  align-items: center;
  gap: 12px;
}
.library-select {
  padding: 8px 12px;
  font-size: 13px;
  border-radius: 10px;
  background: var(--night) !important;
  border: 1px solid var(--line2) !important;
  color: var(--text);
  cursor: pointer;
}
.library-toggle-label {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  margin: 0;
}
.library-toggle-label input[type="checkbox"] {
  width: auto;
  margin: 0;
  cursor: pointer;
}
.view-switch {
  display: inline-flex;
  border-radius: 10px;
  border: 1px solid var(--line2);
  background: var(--night);
  overflow: hidden;
}
.view-btn {
  padding: 6px 11px;
  font-size: 14px;
  background: transparent !important;
  color: var(--muted) !important;
  border: 0 !important;
  border-radius: 0 !important;
  box-shadow: none !important;
  cursor: pointer;
}
.view-btn.active {
  background: rgba(255, 255, 255, 0.12) !important;
  color: #fff !important;
}

/* Сетка постеров */
.library-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)) !important;
  gap: 22px 18px !important;
  margin: 22px 0 !important;
}
@media (min-width: 1400px) {
  .library-grid {
    grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)) !important;
    gap: 24px 20px !important;
  }
}
@media (max-width: 600px) {
  .library-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 16px 12px !important;
  }
}
.library-tile {
  background: transparent !important;
  border: 0 !important;
  border-radius: 0 !important;
  overflow: visible !important;
  box-shadow: none !important;
  cursor: pointer;
  transition: transform 0.3s var(--ease) !important;
}
.library-tile:hover {
  transform: translateY(-6px) !important;
}
.tile-art {
  position: relative;
  width: 100%;
  aspect-ratio: 2/3 !important;
  border-radius: 14px !important;
  overflow: hidden;
  border: 1px solid var(--line2);
  background: linear-gradient(160deg, #182030, #0c1017 75%) !important;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45);
  transition: border-color 0.3s, box-shadow 0.3s;
}
.library-tile:hover .tile-art {
  border-color: rgba(96, 165, 250, 0.65);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(96, 165, 250, 0.35), 0 0 30px rgba(37, 99, 235, 0.2);
}
.tile-art img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s var(--ease), opacity 0.4s ease !important;
}
.library-tile:hover .tile-art img {
  transform: scale(1.045) !important;
}

/* Бейджи на карточке */
.tile-badges {
  position: absolute;
  top: 8px;
  left: 8px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  z-index: 2;
  pointer-events: none;
}
.tile-badge {
  font-family: var(--ui);
  font-size: 10.5px;
  font-weight: 700;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(9, 11, 16, 0.88);
  border: 1px solid rgba(255, 255, 255, 0.16);
  color: #fff;
  line-height: 1;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
.tile-badge.badge-quality {
  color: #ffd27a;
  border-color: rgba(255, 210, 122, 0.38);
}
.tile-badge.badge-type {
  color: #93c5fd;
  border-color: rgba(147, 197, 253, 0.38);
}

/* Кнопка Play по центру при наведении */
button.tile-play {
  position: absolute !important;
  left: 50% !important;
  top: 50% !important;
  transform: translate(-50%, -50%) scale(0.9) !important;
  width: 56px !important;
  height: 56px !important;
  border-radius: 50% !important;
  display: grid !important;
  place-items: center !important;
  font-size: 22px !important;
  padding-left: 3px !important;
  background: rgba(10, 14, 24, 0.85) !important;
  border: 1px solid rgba(255, 255, 255, 0.32) !important;
  color: #fff !important;
  opacity: 0;
  transition: opacity 0.25s, transform 0.25s var(--ease), background 0.2s, box-shadow 0.2s !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.6) !important;
  z-index: 4;
}
.library-tile:hover button.tile-play {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1) !important;
}
button.tile-play:hover {
  background: #2563eb !important;
  border-color: #60a5fa !important;
  transform: translate(-50%, -50%) scale(1.1) !important;
  box-shadow: 0 0 25px rgba(37, 99, 235, 0.6) !important;
}

/* Избранное в углу */
.tile-art .tile-fav {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 3;
  width: 34px;
  height: 34px;
  min-height: 0;
  padding: 0 !important;
  border-radius: 50% !important;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  background: rgba(9, 11, 16, 0.85) !important;
  color: #eef0f5 !important;
  border: 1px solid rgba(255, 255, 255, 0.25) !important;
  opacity: 0;
  transform: scale(0.9);
  transition: opacity 0.22s var(--ease), transform 0.22s var(--ease), background 0.2s, color 0.2s;
  box-shadow: none !important;
}
.library-tile:hover .tile-fav,
.library-tile:focus-within .tile-fav,
.tile-art .tile-fav.on {
  opacity: 1;
  transform: scale(1);
}
.tile-art .tile-fav:hover {
  border-color: var(--lamp) !important;
  color: var(--lamp) !important;
  transform: scale(1.08);
}
.tile-art .tile-fav.on {
  background: var(--lamp) !important;
  color: var(--lamp-ink) !important;
  border-color: transparent !important;
}
@media (hover: none) {
  .tile-art .tile-fav {
    opacity: 1;
    transform: none;
  }
}

/* Прогресс-бар на карточке */
.tile-progress-track {
  position: absolute;
  left: 10px;
  right: 10px;
  bottom: 34px;
  height: 5px;
  background: rgba(255, 255, 255, 0.25);
  border-radius: 9px;
  overflow: hidden;
  z-index: 2;
}
.tile-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, #2563eb, #ffd27a) !important;
}
.tile-progress-label {
  position: absolute;
  left: 10px;
  bottom: 8px;
  z-index: 2;
  font-size: 11px;
  font-weight: 700;
  background: rgba(9, 11, 16, 0.85) !important;
  border-radius: 6px !important;
  padding: 3px 7px;
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

/* Инфо под постером */
.tile-info {
  padding: 10px 2px 0 !important;
}
.tile-info strong {
  font-size: 14px;
  font-weight: 600;
  line-height: 1.35;
  color: #fff;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: 4px;
}
.tile-info .file-meta {
  font-size: 12.5px;
  color: var(--muted);
  line-height: 1.35;
}
.tile-remove {
  margin-top: 8px;
  padding: 5px 11px;
  min-height: 28px;
  border-radius: 8px;
  font-size: 12px;
  border: 1px solid rgba(255, 107, 107, 0.4);
  background: rgba(255, 107, 107, 0.12);
  color: #ffb3b3;
  cursor: pointer;
}
.tile-remove:hover {
  background: rgba(255, 107, 107, 0.22);
  border-color: rgba(255, 107, 107, 0.6);
}
.tile-remove.cancel {
  border-color: rgba(255, 184, 107, 0.4);
  background: rgba(255, 184, 107, 0.12);
  color: #ffd9a8;
}
.tile-remove.armed {
  background: #ff4d4d;
  color: #fff;
  border-color: #ff4d4d;
}

/* Режим отображения списком на десктопе */
.library-results.library-list {
  display: flex !important;
  flex-direction: column !important;
  gap: 10px !important;
  margin: 22px 0 !important;
}
.library-list .library-tile {
  display: flex !important;
  align-items: center !important;
  gap: 16px !important;
  padding: 12px 18px !important;
  border-radius: 14px !important;
  background: var(--booth) !important;
  border: 1px solid var(--line2) !important;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25) !important;
  transition: transform 0.2s, border-color 0.2s, background 0.2s !important;
}
.library-list .library-tile:hover {
  transform: translateY(-2px) !important;
  border-color: rgba(96, 165, 250, 0.45) !important;
  background: rgba(24, 32, 50, 0.75) !important;
}
.library-list .tile-art {
  width: 52px !important;
  height: 76px !important;
  min-width: 52px !important;
  aspect-ratio: auto !important;
  border-radius: 8px !important;
  flex-shrink: 0;
}
.library-list .tile-info {
  flex: 1;
  min-width: 0;
  padding: 0 !important;
}
.library-list .tile-info strong {
  -webkit-line-clamp: 1;
  font-size: 15px;
}
.library-list .tile-controls {
  display: none !important;
}

/* ========================================================================================= */
/* РАЗДЕЛ ПОИСКА РАЗДАЧ                                                                      */
/* ========================================================================================= */
.search-form {
  display: flex;
  gap: 10px;
}
.search-form input {
  flex: 1;
  min-width: 0;
  padding: 13px 16px;
  font-size: 15px;
}
.search-form button {
  padding: 12px 28px;
  font-size: 15px;
  white-space: nowrap;
}
.search-providers {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 12px 0 4px;
}
.search-providers .chip {
  background: var(--film);
  border: 1px solid var(--line2);
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12px;
  color: var(--muted);
}
.chip.ok {
  color: #7fe0b0;
  border-color: #27533f;
  background: #0f1f19;
}
.chip.bad {
  color: #ff9b8f;
  border-color: #6a3330;
  background: #241211;
}

.search-tools {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 12px 16px;
  margin: 16px 0;
  background: var(--film);
  border: 1px solid var(--line2);
  border-radius: 14px;
}
.search-tools select {
  padding: 8px 12px;
  font-size: 13px;
}
.search-tools label {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  font-size: 13px;
  white-space: nowrap;
  color: var(--text);
  cursor: pointer;
}
.search-tools input[type="search"] {
  flex: 1;
  min-width: 160px;
  padding: 8px 12px;
  font-size: 13px;
}

/* Строки поисковой выдачи на десктопе */
.sr-row {
  display: grid !important;
  grid-template-columns: minmax(0, 1fr) auto !important;
  gap: 16px !important;
  align-items: center !important;
  padding: 14px 18px !important;
  border-radius: 12px !important;
  border-top: 1px solid var(--line) !important;
  position: relative;
  transition: background 0.2s, border-color 0.2s;
}
.sr-row:hover {
  background: rgba(255, 255, 255, 0.04) !important;
}
.sr-row:has(.ru-badge)::before {
  content: "";
  position: absolute;
  left: 0;
  top: 14px;
  bottom: 14px;
  width: 3px;
  border-radius: 3px;
  background: var(--lamp);
}
.sr-title {
  font-size: 14.5px;
  font-weight: 600;
  line-height: 1.4;
  color: #fff;
  overflow-wrap: anywhere;
}
.sr-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px 14px;
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 5px;
}
.sr-meta .seed {
  color: #7fe0b0;
  font-weight: 600;
}
.sr-meta .seed.zero {
  color: var(--muted);
}
.ru-badge {
  background: var(--lamp-soft) !important;
  color: var(--lamp) !important;
  border-radius: 6px;
  font-weight: 700;
  font-size: 10px;
  letter-spacing: 0.04em;
  padding: 2px 7px;
}
.sr-actions button {
  padding: 9px 16px;
  font-size: 13px;
  border-radius: 10px;
}

/* ========================================================================================= */
/* РАЗДЕЛ «ОТКРЫТЬ ССЫЛКУ» (Добавить magnet/torrent)                                         */
/* ========================================================================================= */
.input-modes {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin: 10px 0 20px;
}
.mode-card {
  display: flex;
  align-items: center;
  gap: 12px;
  text-align: left;
  min-height: 72px;
  background: var(--film) !important;
  color: var(--text) !important;
  border: 1px solid var(--line2) !important;
  border-radius: 14px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: none !important;
}
.mode-card:hover {
  background: var(--glass-fill-hover) !important;
  border-color: rgba(96, 165, 250, 0.4) !important;
  transform: translateY(-1px);
}
.mode-card.selected {
  border-color: #60a5fa !important;
  background: rgba(37, 99, 235, 0.15) !important;
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.3) inset !important;
}
.mode-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: rgba(37, 99, 235, 0.2) !important;
  color: #93c5fd !important;
  font-size: 20px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.mode-card.selected .mode-icon {
  background: #2563eb !important;
  color: #fff !important;
}

.torrent-dropzone {
  border: 1.5px dashed var(--line2);
  background: var(--film);
  border-radius: 16px;
  min-height: 160px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 20px;
  cursor: pointer;
  transition: all 0.2s;
}
.torrent-dropzone:hover, .torrent-dropzone.dragover {
  border-color: #60a5fa;
  background: rgba(37, 99, 235, 0.08);
}
.drop-icon {
  font-size: 28px;
  color: #60a5fa;
  margin-bottom: 6px;
}
.torrent-chosen {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--film);
  border: 1px solid var(--line2);
  border-radius: 12px;
}
.torrent-file-icon {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.05em;
  background: rgba(37, 99, 235, 0.2);
  color: #93c5fd;
  padding: 6px 8px;
  border-radius: 6px;
}
.torrent-chosen-name {
  flex: 1;
  min-width: 0;
  overflow-wrap: anywhere;
  font-size: 13.5px;
  font-weight: 500;
}

/* Карточки истории */
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.history-value {
  flex: 1;
  min-width: 0;
  font-size: 13px;
}
.history-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.history-progress {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 120px;
}
.history-progress-track {
  width: 84px;
  height: 6px;
  background: var(--night);
  border: 1px solid var(--line2);
  border-radius: 999px;
  overflow: hidden;
}
.history-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #60a5fa, #2563eb);
}
.history-percent {
  font-size: 11.5px;
  color: var(--muted);
}
.history-actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.history-actions button {
  padding: 6px 10px;
  font-size: 12px;
  border-radius: 8px;
}

/* ========================================================================================= */
/* РАЗДЕЛ «ПРИЛОЖЕНИЯ»                                                                      */
/* ========================================================================================= */
.apps-hero {
  position: relative;
  overflow: visible;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 440px);
  gap: 28px;
  align-items: center;
  border-radius: 24px;
  border: 1px solid var(--glass-edge);
  background: linear-gradient(160deg, #151c2c, #0c1017 75%);
  padding: 34px 30px;
  margin-bottom: 24px;
}
@media (max-width: 900px) {
  .apps-hero {
    grid-template-columns: 1fr;
    padding: 24px 20px;
  }
}
.apps-kicker {
  display: inline-block;
  font: 700 11.5px/1 var(--ui);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #60a5fa;
  background: rgba(37, 99, 235, 0.18);
  border: 1px solid rgba(96, 165, 250, 0.35);
  border-radius: 999px;
  padding: 6px 12px;
  margin-bottom: 12px;
}
.apps-hero h2 {
  font-size: clamp(24px, 3.2vw, 34px);
  line-height: 1.15;
  margin: 0 0 10px;
}
.apps-hero p {
  color: var(--muted);
  font-size: 15px;
  line-height: 1.55;
  margin: 0;
}
.apps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.app-card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 16px;
  border-radius: 20px;
  border: 1px solid var(--line2);
  background: var(--booth);
  padding: 24px;
  transition: transform 0.3s var(--ease), border-color 0.3s, box-shadow 0.3s var(--ease);
}
.app-card:hover {
  transform: translateY(-4px);
  border-color: rgba(96, 165, 250, 0.55);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5), 0 0 30px rgba(37, 99, 235, 0.2);
}
.app-card.own {
  border-color: #60a5fa;
  box-shadow: 0 0 0 1px rgba(96, 165, 250, 0.4), 0 14px 40px rgba(37, 99, 235, 0.15);
}
.app-card-head {
  display: flex;
  align-items: center;
  gap: 14px;
}
.app-card-head h3 {
  margin: 0;
  font-size: 20px;
}
.app-icon {
  width: 52px;
  height: 52px;
  border-radius: 16px;
  display: grid;
  place-items: center;
  background: linear-gradient(150deg, #26334d, #141c2a);
  border: 1px solid var(--line2);
  color: #fff;
  flex-shrink: 0;
}
.app-card:hover .app-icon, .app-card.own .app-icon {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border-color: rgba(96, 165, 250, 0.5);
}
.app-badge {
  margin-left: auto;
  align-self: flex-start;
  font: 700 11px/1 var(--ui);
  color: #fff;
  background: #2563eb;
  border-radius: 999px;
  padding: 6px 11px;
}
.app-download {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 48px;
  border-radius: 12px;
  text-decoration: none;
  font: 600 15px/1 var(--ui);
  color: #fff;
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  border: 1px solid rgba(96, 165, 250, 0.4);
  box-shadow: 0 4px 18px rgba(37, 99, 235, 0.35);
  transition: all 0.2s;
}
.app-download:hover:not(.disabled) {
  filter: brightness(1.08);
  transform: translateY(-1px);
  box-shadow: 0 8px 28px rgba(37, 99, 235, 0.5);
}
.app-download.disabled {
  pointer-events: none;
  background: var(--film);
  color: var(--muted);
  box-shadow: none;
  border-color: var(--line2);
}

.apps-steps {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
}
.apps-step {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  border: 1px solid var(--glass-edge);
  border-radius: 16px;
  background: var(--film);
  padding: 18px;
}
.apps-step b {
  flex-shrink: 0;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font: 700 14px/1 var(--display);
  color: #93c5fd;
  background: rgba(37, 99, 235, 0.2);
  border: 1px solid rgba(96, 165, 250, 0.4);
}

/* ========================================================================================= */
/* МОДАЛЬНЫЕ ОКНА И ОВЕРЛЕИ                                                                  */
/* ========================================================================================= */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(4, 6, 12, 0.82) !important;
  backdrop-filter: blur(12px) !important;
  -webkit-backdrop-filter: blur(12px) !important;
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  box-sizing: border-box;
  animation: fadeIn 0.22s ease both;
}
.library-modal {
  width: min(980px, 94vw) !important;
  max-height: min(88vh, 920px) !important;
  overflow-y: auto;
  background: var(--booth) !important;
  border: 1px solid var(--line2) !important;
  border-radius: 20px !important;
  padding: 28px !important;
  box-shadow: 0 30px 90px rgba(0, 0, 0, 0.8) !important;
  animation: popIn 0.28s var(--ease) both;
}
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes popIn { from { opacity: 0; transform: translateY(16px) scale(0.98); } to { opacity: 1; transform: none; } }

.modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}
.file-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 12px !important;
  border-top: 1px solid var(--line) !important;
  border-radius: 8px;
  transition: background 0.2s;
}
.file-row:hover {
  background: rgba(255, 255, 255, 0.04) !important;
}

/* Экран входа на десктопе */
@media (min-width: 901px) {
  #loginPanel {
    max-width: 440px !important;
    margin: 14vh auto 0 !important;
    padding: 34px !important;
    border-radius: 22px !important;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.5) !important;
  }
}

/* Статусы */
.status {
  font-size: 13px;
  min-height: 20px;
  margin-top: 10px;
  color: var(--muted);
}
.status.success { color: #7fe0b0; }
.status.error { color: #ff9b8f; }

/* Подвал */
.foot {
  font-size: 12px;
  color: #555d72;
  margin-top: 24px;
  line-height: 1.5;
}

@media (prefers-reduced-motion: reduce) {
  body::before, .btn-refresh.loading .refresh-spinner, .library-tile, .app-card {
    animation: none !important;
    transition: none !important;
  }
}

/* ========================================================================================= */
/* СБРОС СТАРЫХ СТИЛЕЙ из index.html (лесной редизайн, старая нижняя панель)                 */
/* Они лежат в <style> перед этим файлом и ломали вход, заголовок и иконки сайдбара.        */
/* ========================================================================================= */
.navrow button::before {
  content: none !important;
  display: none !important;
}
h1 {
  background: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
  -webkit-text-fill-color: currentColor !important;
  color: #fff !important;
}
.hero {
  overflow: visible !important;
  isolation: auto !important;
  border-radius: 0 !important;
}
.hero::before,
.tile-art::before,
.tile-art::after {
  content: none !important;
  display: none !important;
}
.hero .eyebrow {
  margin-bottom: 10px;
}
.panel:hover,
.magnet-card:hover {
  border-color: var(--glass-edge) !important;
}
.logo {
  transform: none !important;
  animation: none !important;
}

/* Фон как в ПК-приложении (Theme.kt, ambientBackdrop): синее, фиолетовое и бирюзовое свечение, без жёлтого луча. */
body::before {
  background:
    radial-gradient(circle at 25% 22%, rgba(37, 99, 235, 0.19), transparent 55%),
    radial-gradient(circle at 95% 95%, rgba(139, 92, 246, 0.18), transparent 50%),
    radial-gradient(circle at 55% 45%, rgba(6, 182, 212, 0.14), transparent 42%) !important;
  filter: none !important;
  animation: none !important;
}

/* ========================================================================================= */
/* ДЕСКТОП ПО ОБРАЗЦУ ПРИЛОЖЕНИЯ (Sidebar.kt, Theme.kt)                                      */
/* ========================================================================================= */
@media (min-width: 901px) {
  /* Вход: колонка по центру экрана, заголовок не вылезает за карточку. */
  body:not(.authenticated) main,
  body:has(#appPanel.hidden) main {
    width: min(460px, calc(100% - 48px)) !important;
    min-height: 100vh;
    margin: 0 auto !important;
    padding: 48px 0 !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  body:not(.authenticated) main > .hero,
  body:has(#appPanel.hidden) main > .hero {
    margin: 6px 0 22px !important;
  }
  body:not(.authenticated) .hero h1,
  body:has(#appPanel.hidden) .hero h1 {
    font-size: 30px;
    line-height: 1.15;
    max-width: none;
    margin: 0 0 12px;
  }
  body:not(.authenticated) .hero p,
  body:has(#appPanel.hidden) .hero p {
    margin: 0;
    font-size: 14.5px;
  }
  #loginPanel {
    max-width: none !important;
    margin: 0 !important;
    padding: 28px !important;
    background: var(--glass-sheet) !important;
    border: 1px solid rgba(255, 255, 255, 0.18) !important;
  }
  body:not(.authenticated) main > .foot,
  body:has(#appPanel.hidden) main > .foot {
    text-align: center;
  }

  /* Сайдбар: 244 px, пункты 42 px, активный — синий 78 %, как NavItem. */
  .app-sidebar {
    width: 244px;
    min-width: 244px;
    padding: 18px 14px;
    background: rgba(8, 12, 22, 0.58);
    border-right: 1px solid rgba(255, 255, 255, 0.08);
  }
  .sidebar-brand {
    height: 52px;
    padding: 0 0 0 1px;
    border-bottom: 0;
  }
  .sidebar-brand-text strong {
    font-size: 17px;
  }
  .sidebar-brand-text span {
    font-size: 10.5px;
    font-weight: 600;
    letter-spacing: 0.48em;
  }
  .navrow {
    gap: 4px !important;
    margin: 22px 0 auto !important;
  }
  .navrow button, .navrow button.secondary {
    min-height: 42px !important;
    height: 42px;
    padding: 0 8px 0 15px !important;
    font-size: 14px !important;
    color: #cbd2e0 !important;
    transform: none !important;
  }
  .navrow button:hover {
    color: #fff !important;
    background: rgba(255, 255, 255, 0.06) !important;
    border-color: transparent !important;
    box-shadow: none !important;
  }
  .navrow button:not(.secondary),
  .navrow button:not(.secondary):hover {
    background: rgba(37, 99, 235, 0.78) !important;
    border-color: rgba(96, 165, 250, 0.3) !important;
    box-shadow: none !important;
    filter: none !important;
  }
  .navrow button .nav-icon,
  .navrow button:not(.secondary) .nav-icon {
    width: 18px;
    font-size: 16px;
    color: inherit;
  }

  /* Панели — «матовое стекло» поверх свечения. */
  .app-viewport .panel {
    background: rgba(42, 58, 92, 0.3) !important;
    border: 1px solid rgba(255, 255, 255, 0.09) !important;
    box-shadow: none !important;
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }
  .app-viewport {
    padding: 28px 40px 60px;
  }
  .app-viewport > .foot {
    color: #5b6272;
  }
}

/* ========================================================================================= */
/* ВОЗВРАЩЕНО из версии до десктопного редизайна (3ff9139 потерял эти правила)               */
/* ========================================================================================= */

/* Приложение 1.2+: библиотека и нижняя панель нативные, своя панель сайта не нужна. */
html.suslik-native .navrow{display:none!important}
html.suslik-native body{padding-bottom:16px!important}

/* Избранное: короткий «щелчок» звезды */
.tile-art .tile-fav.pop{animation:favPop .32s var(--ease,ease)}
@keyframes favPop{0%{transform:scale(1)}45%{transform:scale(1.25)}100%{transform:scale(1)}}

/* Библиотека: плавное появление без моргания. Старая «мозаика» отключена: она сначала показывала плитку,
   а когда приходил постер — прятала и проявляла заново. Переиспользованные плитки не анимируются вовсе. */
.library-tile,.library-tile:not(.mosaic-pending),.library-tile.mosaic-pending{animation:none!important;opacity:1;filter:none}
.library-tile.tile-enter{animation:tileIn .56s cubic-bezier(.22,.8,.24,1) both!important;animation-delay:calc(min(var(--tile-index,0),24)*34ms)!important}
@keyframes tileIn{from{opacity:0;transform:translateY(18px) scale(.975)}to{opacity:1;transform:none}}
.tile-art img{transition:opacity .45s ease,transform .5s var(--ease,ease)!important}
@media (prefers-reduced-motion:reduce){.library-tile.tile-enter{animation:none!important}}

/* Приложения: карточки */
.apps-hero-glow{position:absolute;inset:-40% -10% auto auto;width:520px;height:520px;border-radius:50%;
  background:radial-gradient(closest-side,rgba(37,99,235,.28),rgba(37,99,235,.08) 55%,transparent 72%);pointer-events:none;animation:appsGlow 9s ease-in-out infinite alternate}
@keyframes appsGlow{from{transform:translate(0,0) scale(1)}to{transform:translate(-40px,30px) scale(1.08)}}
.app-req{margin:3px 0 0;color:var(--muted);font-size:13px}
.app-icon svg{width:26px;height:26px}
.app-meta{display:flex;flex-wrap:wrap;gap:6px}
.app-meta span:empty{display:none}
.app-meta span{font:600 12.5px/1 var(--ui);color:var(--text);background:var(--film);border:1px solid var(--line2);border-radius:999px;padding:7px 11px}
.app-meta .app-version{color:#93c5fd;border-color:rgba(96,165,250,.38);background:rgba(37,99,235,.16)}
.app-meta .app-version.muted{color:var(--muted);border-color:var(--line2);background:var(--film)}
.app-features{list-style:none;margin:0;padding:0;display:grid;gap:8px;color:var(--muted);font-size:14px;line-height:1.45}
.app-features li{position:relative;padding-left:18px}
.app-features li::before{content:"";position:absolute;left:2px;top:.55em;width:7px;height:7px;border-radius:50%;background:#60a5fa;box-shadow:0 0 10px rgba(96,165,250,.55)}
.app-features a{color:#93c5fd}
.app-notes{border:1px solid var(--line);border-radius:14px;background:var(--film);padding:10px 14px}
.app-notes summary{cursor:pointer;font-weight:600;font-size:13.5px;color:var(--text);list-style:none}
.app-notes summary::-webkit-details-marker{display:none}
.app-notes summary::after{content:"▾";float:right;color:var(--muted);transition:transform .25s var(--ease)}
.app-notes[open] summary::after{transform:rotate(180deg)}
.app-notes-text{white-space:pre-wrap;color:var(--muted);font-size:13.5px;line-height:1.5;margin-top:8px;max-height:200px;overflow:auto}
.app-card-head h3{margin:0}
.apps-step strong{display:block;font-size:14.5px;margin-bottom:3px}
.apps-step span{color:var(--muted);font-size:13.5px;line-height:1.45}
@media(max-width:520px){.app-badge{font-size:10.5px;padding:5px 8px}.app-card-head{flex-wrap:wrap}}

/* ---- Приложения: график роста версий ------------------------------------------------------------- */
.apps-hero{overflow:visible;display:grid;grid-template-columns:minmax(0,1fr) minmax(300px,440px);gap:28px;align-items:center;z-index:2}
.apps-hero-clip{position:absolute;inset:0;overflow:hidden;border-radius:inherit;pointer-events:none}
.apps-hero-text{position:relative;min-width:0}
.growth{position:relative;animation:tileIn .6s .12s var(--ease) both}
.growth-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px}
.growth-title{font:600 12px/1 var(--ui);letter-spacing:.06em;text-transform:uppercase;color:var(--muted)}
.growth-switch{position:relative;display:flex;padding:3px;border-radius:999px;background:#0d1017;border:1px solid var(--line2)}
.growth-switch span{position:relative;z-index:1;cursor:pointer;user-select:none;padding:6px 12px;border-radius:999px;font:600 12px/1 var(--ui);color:var(--muted);transition:color .25s}
.growth-switch span:hover{color:var(--text)}
.growth-switch span.on{color:#ffffff}
.growth-switch span:focus-visible{outline:2px solid #60a5fa;outline-offset:1px}
.growth-lens{position:absolute;top:3px;bottom:3px;left:3px;border-radius:999px;background:linear-gradient(135deg, #2563eb, #1d4ed8);box-shadow:0 0 16px rgba(37,99,235,.55);transition:transform .42s var(--ease),width .42s var(--ease)}
.growth-plot{position:relative;aspect-ratio:2/1;width:100%}
.growth-plot svg{position:absolute;inset:0;width:100%;height:100%;overflow:visible}
.growth-grid line{stroke:#ffffff0d;stroke-width:1;stroke-dasharray:3 6;vector-effect:non-scaling-stroke}
.growth-line,.growth-line-glow{fill:none;stroke-linecap:round;stroke-linejoin:round;stroke-dasharray:1;stroke-dashoffset:1;vector-effect:non-scaling-stroke}
.growth-line{stroke:url(#growthStroke);stroke-width:2.5}
.growth-line-glow{stroke:#3b82f6;stroke-width:7;opacity:.4;filter:url(#growthGlow)}
.growth-line.drawn,.growth-line-glow.drawn{stroke-dashoffset:0;transition:stroke-dashoffset 1.1s var(--ease)}
.growth-area{fill:url(#growthFill);opacity:0}
.growth-area.drawn{opacity:1;transition:opacity .9s .35s ease}
.growth-points{position:absolute;inset:0}
.growth-dot{position:absolute;width:30px;height:30px;margin:-15px 0 0 -15px;border-radius:50%;cursor:pointer;outline:none;
  opacity:0;transform:scale(.4);animation:growthPop .5s var(--d,0s) var(--ease) forwards}
.growth-dot::before{content:"";position:absolute;inset:3px;border-radius:50%;background:radial-gradient(closest-side,rgba(96,165,250,.45),rgba(96,165,250,0));
  animation:growthBreath 2.8s var(--b,0s) ease-in-out infinite}
.growth-dot i{position:absolute;left:50%;top:50%;width:10px;height:10px;margin:-5px 0 0 -5px;border-radius:50%;background:#93c5fd;
  border:2px solid #2563eb;box-shadow:0 0 0 4px rgba(37,99,235,.2),0 0 14px rgba(96,165,250,.7);transition:transform .3s var(--ease),box-shadow .3s}
.growth-dot.latest i{background:#e0f2fe;box-shadow:0 0 0 5px rgba(37,99,235,.3),0 0 20px rgba(96,165,250,.9)}
.growth-dot em{position:absolute;left:50%;top:100%;transform:translateX(-50%);font:600 11px/1 var(--ui);font-style:normal;color:var(--muted);white-space:nowrap;transition:color .25s}
.growth-dot:hover i,.growth-dot:focus-visible i,.growth-dot.active i{transform:scale(1.35);box-shadow:0 0 0 6px rgba(37,99,235,.4),0 0 24px #60a5fa}
.growth-dot:hover em,.growth-dot.active em,.growth-dot:focus-visible em{color:#60a5fa}
@keyframes growthPop{to{opacity:1;transform:scale(1)}}
@keyframes growthBreath{0%,100%{transform:scale(.75);opacity:.55}50%{transform:scale(1.45);opacity:1}}
.growth-tip{position:fixed;z-index:10000;top:0;left:0;pointer-events:none;opacity:0;transform:translateY(8px) scale(.97);transform-origin:var(--arrow,50%) 100%;
  padding:14px 16px 12px;border-radius:16px;background:#151925f2;border:1px solid rgba(96,165,250,.38);
  box-shadow:0 22px 50px #000b,0 0 0 1px rgba(96,165,250,.15),0 0 36px rgba(37,99,235,.22);backdrop-filter:blur(10px);
  transition:opacity .26s var(--ease),transform .32s var(--ease)}
.growth-tip.below{transform:translateY(-8px) scale(.97);transform-origin:var(--arrow,50%) 0}
.growth-tip.on{opacity:1;transform:none;pointer-events:auto}
.growth-tip::after{content:"";position:absolute;left:var(--arrow,50%);bottom:-6px;width:10px;height:10px;margin-left:-5px;transform:rotate(45deg);
  background:#151925;border-right:1px solid rgba(96,165,250,.38);border-bottom:1px solid rgba(96,165,250,.38)}
.growth-tip.below::after{bottom:auto;top:-6px;border:0;border-left:1px solid rgba(96,165,250,.38);border-top:1px solid rgba(96,165,250,.38)}
.growth-tip-head{display:flex;align-items:center;gap:9px;margin-bottom:8px}
.growth-tip-head b{font:700 11.5px/1 var(--ui);padding:5px 8px;border-radius:7px;background:var(--film);color:var(--muted)}
.growth-tip-head b.new{background:linear-gradient(135deg, #2563eb, #1d4ed8);color:#fff}
.growth-tip-head span{font:600 14.5px/1.25 var(--ui);color:var(--text)}
.growth-tip ul{margin:0;padding:0;list-style:none;display:grid;gap:6px}
.growth-tip li{position:relative;padding-left:15px;color:#c9cedb;font-size:13px;line-height:1.45;opacity:0;transform:translateY(4px)}
.growth-tip.on li{opacity:1;transform:none;transition:opacity .3s var(--ease),transform .35s var(--ease)}
.growth-tip.on li:nth-child(2){transition-delay:.04s}.growth-tip.on li:nth-child(3){transition-delay:.08s}
.growth-tip.on li:nth-child(4){transition-delay:.12s}.growth-tip.on li:nth-child(5){transition-delay:.16s}.growth-tip.on li:nth-child(6){transition-delay:.2s}
.growth-tip li::before{content:"";position:absolute;left:2px;top:.55em;width:5px;height:5px;border-radius:50%;background:#60a5fa;box-shadow:0 0 8px rgba(96,165,250,.6)}
.growth-hint{margin-top:14px;text-align:right;color:var(--muted);font-size:12px;opacity:.8}
@media(max-width:900px){.apps-hero{grid-template-columns:1fr;gap:18px}.growth-hint{text-align:left}.growth-hint::after{content:" (на телефоне — нажмите)"}}
@media (prefers-reduced-motion:reduce){.growth,.growth-dot,.growth-dot::before{animation:none!important;opacity:1;transform:none}
  .growth-line,.growth-line-glow{stroke-dashoffset:0}.growth-area{opacity:1}}
.growth.empty .growth-hint{visibility:hidden}

/* Пункты и версия на карточках — в синем акценте нового дизайна. */
.app-meta .app-version{color:#93c5fd;border-color:rgba(96,165,250,.38);background:rgba(37,99,235,.16)}
.app-features li::before{background:#60a5fa;box-shadow:0 0 10px rgba(96,165,250,.55)}
.app-features a{color:#93c5fd}

/* «Открыть ссылку»: история справа от формы с самого верха, а не под строкой статуса. */
@media (min-width: 901px) {
  #historyPanel {
    grid-row: 1 / span 2;
    align-self: start;
  }
}

/* После входа шапка и заголовок страницы входа не нужны и на телефоне: там своя верхняя строка. */
body.authenticated > main > .brand,
body.authenticated > main > .hero,
body:has(#appPanel:not(.hidden)) > main > .brand,
body:has(#appPanel:not(.hidden)) > main > .hero {
  display: none !important;
}

/* Discord Auth & Profile Card */
.discord-login-box {
  margin-bottom: 20px;
}
.btn-discord {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  box-sizing: border-box;
  padding: 12px 20px;
  background: #5865F2;
  color: #ffffff !important;
  font-family: var(--ui, "Onest", sans-serif);
  font-weight: 600;
  font-size: 15px;
  border-radius: 12px;
  text-decoration: none;
  border: 1px solid rgba(255, 255, 255, 0.15);
  box-shadow: 0 4px 14px rgba(88, 101, 242, 0.35);
  transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}
.btn-discord[hidden] {
  display: none;
}
.btn-discord:hover {
  background: #4752C4;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(88, 101, 242, 0.45);
}
.auth-divider {
  display: flex;
  align-items: center;
  margin: 18px 0;
  color: #94a3b8;
  font-size: 13px;
  font-family: var(--ui, "Onest", sans-serif);
}
.auth-divider::before, .auth-divider::after {
  content: "";
  flex: 1;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}
.auth-divider span {
  padding: 0 12px;
}
.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-top: auto;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.sidebar-user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  object-fit: cover;
  background: #2a2e3d;
  flex-shrink: 0;
}
.sidebar-user-info {
  flex: 1;
  min-width: 0;
}
.sidebar-user-name {
  font-size: 13.5px;
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-user-role {
  font-size: 11.5px;
  color: #94a3b8;
}
.device-link-btn {
  font-size: 11.5px;
  padding: 3px 8px;
  border-radius: 6px;
  background: rgba(96, 165, 250, 0.15);
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.25);
  cursor: pointer;
  margin-top: 4px;
}
.device-link-btn:hover {
  background: rgba(96, 165, 250, 0.25);
}

/* ===== Боковая панель: коллекции и «Сервис» (как в приложении для ПК) ===== */
.side-collection { display: none; }
@media (min-width: 901px) {
  html:not(.suslik-native) .side-collection {
    display: flex; flex-direction: column; gap: 4px; flex: 1 1 auto; min-height: 0; overflow-y: auto; margin-top: 4px; padding: 0 0 8px;
    scrollbar-width: thin;
  }
  .navrow { margin-bottom: 0 !important; }
  .navrow #showAppsTab { display: none !important; }
  .side-caption {
    margin: 10px 0 2px; padding: 10px 14px 4px; border-top: 1px solid rgba(255, 255, 255, 0.1);
    font: 600 11px/1 var(--ui); letter-spacing: 0.14em; text-transform: uppercase; color: #8e96a8;
  }
  .side-cat {
    display: flex !important; align-items: center; gap: 12px; width: 100%; min-height: 40px; padding: 8px 14px !important;
    border-radius: 12px !important; border: 1px solid transparent !important; background: transparent !important; box-shadow: none !important;
    color: var(--muted) !important; font: 500 13.5px var(--ui) !important; text-align: left; cursor: pointer; box-sizing: border-box;
    transition: color .2s, background .2s, border-color .2s;
  }
  .side-cat:hover { color: #fff !important; background: rgba(255, 255, 255, 0.05) !important; border-color: rgba(255, 255, 255, 0.08) !important; }
  .side-cat.active {
    color: #fff !important; font-weight: 600 !important;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.85), rgba(59, 130, 246, 0.7)) !important;
    border-color: rgba(96, 165, 250, 0.38) !important; box-shadow: 0 4px 18px rgba(37, 99, 235, 0.3) !important;
  }
  .side-ico { display: inline-flex; width: 20px; justify-content: center; flex-shrink: 0; font-size: 17px; }
  .side-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .side-count { font-size: 12px; font-weight: 500; color: #8e96a8; }
  .side-cat.active .side-count { color: #fff; }
  /* категории теперь выбираются в боковой панели */
  .category-chips { display: none !important; }
}

/* ===== Баннер «Продолжить просмотр» ===== */
.hero-banner {
  position: relative; display: flex; justify-content: space-between; align-items: stretch; gap: 20px;
  height: 340px; margin: 0 0 22px; border-radius: 20px; overflow: hidden; background: #0b1226;
  border: 1px solid var(--glass-edge, rgba(255, 255, 255, 0.08));
}
.hero-banner.hidden { display: none; }
.hb-bg { position: absolute; inset: 0; background-size: cover; background-position: right center; opacity: 0; transition: opacity .5s; }
.hb-bg.ready { opacity: 1; }
.hb-shade {
  position: absolute; inset: 0;
  background: linear-gradient(90deg, #0b1226 0%, rgba(11, 18, 38, .95) 42%, rgba(11, 18, 38, .2) 78%, rgba(11, 18, 38, 0) 100%),
              linear-gradient(180deg, transparent 60%, rgba(11, 18, 38, .67) 100%);
}
.hb-text { position: relative; z-index: 1; display: flex; flex-direction: column; flex: 0 1 560px; min-width: 0; padding: 26px 0 26px 30px; }
.hb-eyebrow { font: 500 12px var(--ui); letter-spacing: .16em; color: #9aa3b8; }
.hb-title { margin-top: 8px; }
.hb-title h2 { margin: 0; font: 700 32px/1.12 var(--ui); color: #fff; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.hb-logo { display: block; max-height: 68px; max-width: 360px; object-fit: contain; object-position: left center; }
.hb-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 10px; }
.hb-chip { padding: 4px 10px; border-radius: 8px; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .15); font: 500 12.5px var(--ui); color: #d6dbe4; }
.hb-rating { font: 600 13px var(--ui); color: #facc15; }
.hb-overview { margin: 12px 0 0; font: 14.5px/1.45 var(--ui); color: #c3c9d6; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hb-spacer { flex: 1; }
.hb-meta { display: flex; justify-content: space-between; gap: 12px; margin-bottom: 6px; font: 13px var(--ui); color: #c3c9d6; }
.hb-left { color: #8e96a8; font-size: 12.5px; white-space: nowrap; }
.hb-bar { height: 4px; border-radius: 2px; background: rgba(255, 255, 255, .2); overflow: hidden; }
.hb-bar i { display: block; height: 100%; border-radius: 2px; background: linear-gradient(90deg, #2563eb, #38bdf8); }
.hb-play {
  align-self: flex-start; display: inline-flex; align-items: center; gap: 10px; margin-top: 16px; height: 44px; padding: 0 26px;
  border-radius: 12px; border: 1px solid rgba(96, 165, 250, .3); background: #2563eb; color: #fff; font: 600 15px var(--ui); cursor: pointer;
}
.hb-play:hover { background: #3b74f0; }
.hb-play span:first-child { font-size: 13px; }
.hb-thumbs { position: relative; z-index: 1; display: flex; align-items: flex-end; gap: 10px; padding: 0 16px 20px 0; flex: 0 0 auto; }
.hb-thumb {
  position: relative; width: 96px; height: 144px; padding: 0; overflow: hidden; border-radius: 10px; cursor: pointer;
  border: 1px solid rgba(255, 255, 255, .15) !important; background: #222736 !important; box-shadow: none !important;
  transition: transform .22s, border-color .18s;
  display: flex; align-items: center; justify-content: center; text-align: center;
}
.hb-thumb:hover, .hb-thumb.on { transform: translateY(-3px); }
.hb-thumb.on { border: 2px solid #7dd3fc !important; }
.hb-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; position: absolute; left: 0; top: 0; z-index: 1; opacity: 0; transition: opacity .22s ease; }
.hb-thumb img.loaded { opacity: 1; }
.hb-thumb-title { position: relative; z-index: 0; padding: 8px; font-size: 11px; font-weight: 500; color: #8e96a8; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 4; -webkit-box-orient: vertical; word-break: break-word; }
.hb-thumb-bar { position: absolute; left: 0; bottom: 0; height: 3px; background: #38bdf8; z-index: 2; }
@media (max-width: 900px) {
  .hero-banner { height: auto; min-height: 0; flex-direction: column; }
  .hb-text { padding: 20px; flex: none; }
  .hb-spacer { height: 14px; flex: none; }
  .hb-thumbs { display: none; }
  .hb-title h2 { font-size: 24px; }
}
@media (max-width: 1200px) and (min-width: 901px) {
  .hb-thumb { width: 72px; height: 108px; }
  .hb-text { flex-basis: 420px; }
}
@media (prefers-reduced-motion: reduce) { .hb-bg, .hb-thumb { transition: none; } }

/* Страницы библиотеки: 3 ряда постеров (на телефоне 5) */
.library-pager { display: flex; justify-content: center; align-items: center; flex-wrap: wrap; gap: 6px; margin: 18px 0 8px; }
.library-pager:empty { display: none; }
.library-pager .pager-btn { min-width: 38px; height: 38px; padding: 0 10px; border-radius: 10px; border: 1px solid var(--glass-edge, rgba(255,255,255,.08)) !important; background: rgba(255,255,255,.07) !important; color: #fff !important; font: 500 14px var(--ui) !important; cursor: pointer; box-shadow: none !important; }
.library-pager .pager-btn:hover:not(:disabled) { background: rgba(255,255,255,.15) !important; }
.library-pager .pager-btn.active { background: var(--accent, #2563eb) !important; border-color: rgba(96,165,250,.4) !important; font-weight: 700 !important; }
.library-pager .pager-btn:disabled:not(.active) { color: #5b6272 !important; cursor: default; }
.library-pager .pager-gap { color: #8e96a8; padding: 0 4px; }

/* Метки релиза на постере: Dolby Vision, HDR, DTS */
.tile-badge.badge-tag { font-size: 12px; font-weight: 800; letter-spacing: 0; text-transform: none; padding: 5px 9px; border-radius: 8px; background: rgba(14, 11, 26, 0.8); }
.tile-badge.badge-dv { color: #c4b5fd; border-color: rgba(196, 181, 253, 0.7); }
.tile-badge.badge-hdr { color: #fcd34d; border-color: rgba(252, 211, 77, 0.7); }
.tile-badge.badge-dts { color: #7dd3fc; border-color: rgba(125, 211, 252, 0.7); }

/* Пока неизвестно, вошли ли вы (ответ /api/session), страница прозрачна — без мелькания формы входа */
main { transition: opacity .25s ease; }
html.auth-pending main { opacity: 0; pointer-events: none; }


/* ===== Библиотека как в Android TV: строка поиска сверху, баннер, под ним кнопки ===== */
.library-search-top { margin: 0 0 18px; }
.library-search-top input { height: 52px; border-radius: 16px !important; font-size: 15px; }
.library-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 16px; margin: 0 0 12px; }
.library-controls .category-chips { flex-basis: 100%; }
.library-controls .status { flex: 1 1 200px; margin: 0; padding: 0; background: none; border: 0; text-align: left; color: #8e96a8; font-size: 14px; }
.lib-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-left: auto; }
.lib-seg { display: inline-flex; gap: 10px; padding: 0; background: none; border: 0; }
.lib-pill, .library-controls .btn-refresh {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 18px; border-radius: 10px;
  font-size: 13.5px; font-weight: 600; font-family: var(--ui); cursor: pointer; white-space: nowrap;
  background: #131a2b !important; color: #e6eaf2 !important; border: 1px solid #212a40 !important; box-shadow: none !important;
  transition: background .18s, border-color .18s, color .18s;
}
.lib-pill:hover, .library-controls .btn-refresh:hover { background: #1a2338 !important; border-color: #2e3a57 !important; color: #fff !important; }
.lib-pill.active { background: #2563eb !important; border-color: #3b82f6 !important; color: #fff !important; }
.lib-ic { flex: 0 0 auto; }
.library-controls .view-switch { display: inline-flex; gap: 0; border: 1px solid #212a40; border-radius: 10px; overflow: hidden; background: #131a2b; }
.library-controls .view-btn { height: 38px; width: 46px; display: grid; place-items: center; padding: 0; border-radius: 0 !important; background: transparent !important; color: #8e96a8 !important; }
.library-controls .view-btn.active { background: #222c45 !important; color: #fff !important; }
.library-controls .btn-refresh .refresh-spinner { font-size: 0; }
@media (max-width: 760px) { .lib-actions { margin-left: 0; width: 100%; } .lib-seg { flex-wrap: wrap; } }

/* ===== Окно фильма: как PlayDialog на ПК (токены desktop/.../ui/Theme.kt), на узком экране — шторка PlaySheet из Android =====
   #playSheet в селекторах — чтобы общие правила кнопок (синий градиент у всех button) сюда не попадали */
#playSheet { background: rgba(9, 11, 16, 0.8); -webkit-backdrop-filter: none; backdrop-filter: none; font-family: var(--ui); }
#playSheet.open { animation: fadeIn 0.26s var(--ease) both; }
#playSheet .ps-card {
  position: relative; display: block; width: min(620px, 100%); max-height: calc(100vh - 48px); overflow: auto; padding: 22px; gap: 0;
  background: rgba(11, 16, 32, 0.94); border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 22px; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: none; backdrop-filter: none; scrollbar-width: thin; scrollbar-color: rgba(142, 150, 168, 0.35) transparent;
}
#playSheet.open .ps-card { animation: psRise 0.26s var(--ease) both; }
@keyframes psRise { from { opacity: 0; transform: translateY(24px) scale(0.97); } to { opacity: 1; transform: none; } }
#playSheet[data-kind="series"] .ps-card { width: min(540px, 100%); }
#playSheet[data-kind="collection"] .ps-card { width: min(660px, 100%); }
#playSheet .ps-grip { display: none; }
#playSheet .hidden { display: none !important; }
#playSheet button { font-family: var(--ui); transform: none !important; filter: none !important; box-shadow: none !important; }

#playSheet .ps-close {
  position: absolute; top: 22px; right: 22px; z-index: 2; width: 32px; height: 32px; min-height: 0; padding: 0; display: grid; place-items: center;
  border-radius: 50% !important; background: #181e2b !important; border: 1px solid #262f40 !important; color: #b0b9c9 !important; cursor: pointer;
}
#playSheet .ps-close:hover { background: #262f42 !important; border-color: #3b4863 !important; color: #fff !important; }

#playSheet .ps-top { display: flex; gap: 20px; }
#playSheet .ps-poster { flex: 0 0 150px; height: 225px; border-radius: 14px; overflow: hidden; background: linear-gradient(rgba(255, 255, 255, 0.09), #10131b); border: 1px solid rgba(255, 255, 255, 0.09); }
#playSheet .ps-poster img { width: 100%; height: 100%; object-fit: cover; display: block; }
#playSheet .ps-poster img:not([src]), #playSheet .ps-film-art img:not([src]) { visibility: hidden; }
#playSheet .ps-info { flex: 1; min-width: 0; padding-right: 40px; }
#playSheet .ps-title { font: 700 22px/28px var(--display); color: #fff; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
#playSheet .ps-chips { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
#playSheet .ps-chip { padding: 4px 10px; border-radius: 8px; font: 500 12.5px var(--ui); color: #d6dbe4; background: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.15); white-space: nowrap; }
#playSheet .ps-chip-films { display: none; }
#playSheet .ps-rating { font: 600 13px var(--ui); color: #facc15; white-space: nowrap; }
#playSheet .ps-overview { margin: 14px 0 0; font: 400 14px/21px var(--ui); color: #c3c9d6; display: -webkit-box; -webkit-line-clamp: 5; -webkit-box-orient: vertical; overflow: hidden; }
#playSheet .ps-overview:empty { display: none; }

#playSheet .ps-status { margin: 18px 0 8px; font: 400 13px var(--ui); color: #8e96a8; }
#playSheet .ps-status.err { color: #ff9b8f; }

/* «С 10:54»: как левая карточка «С … / С начала» на ПК, с полосой просмотра */
#playSheet .ps-resume { margin: 0 0 12px; padding: 14px; border-radius: 16px; background: #12203f; border: 1.5px solid #3b82f6; }
#playSheet .ps-resume-top { display: flex; align-items: center; gap: 12px; }
#playSheet .ps-resume-ic { flex: 0 0 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: #2563eb; color: #fff; }
#playSheet .ps-resume-ic svg { width: 14px; height: 14px; }
#playSheet .ps-resume-text { display: flex; flex-direction: column; min-width: 0; }
#playSheet .ps-resume-text b { font: 600 15px var(--ui); color: #fff; }
#playSheet .ps-resume-text small { font: 400 12px var(--ui); color: #8e96a8; }
#playSheet .ps-resume-bar { display: flex; align-items: center; gap: 10px; margin-top: 10px; }
#playSheet .ps-bar { flex: 1; height: 4px; border-radius: 2px; background: rgba(255, 255, 255, 0.2); overflow: hidden; }
#playSheet .ps-bar i { display: block; height: 100%; border-radius: 2px; background: #2563eb; }
#playSheet .ps-resume-bar em { font: 400 12px var(--ui); font-style: normal; color: #c3c9d6; }

#playSheet a.ps-watch {
  display: flex; flex-direction: row; align-items: center; justify-content: center; gap: 8px; width: 100%; height: 52px; min-height: 0; padding: 0 16px; box-sizing: border-box;
  border-radius: 12px; background: #2563eb; border: 1px solid rgba(96, 165, 250, 0.3); color: #fff; font: 600 14px var(--ui); text-decoration: none; opacity: 1;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}
#playSheet a.ps-watch svg { width: 12px; height: 12px; flex: 0 0 auto; }
#playSheet a.ps-watch:hover { background: #3b74f0; border-color: #4d86ff; }
#playSheet a.ps-watch.disabled { background: #161c28; border-color: #202736; color: #5a6478; pointer-events: none; }

#playSheet .ps-pick { display: flex; gap: 12px; margin-top: 14px; }
#playSheet .ps-field { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 6px; margin: 0; font: 400 13px var(--ui); color: #8e96a8; }
#playSheet .ps-field select {
  width: 100%; height: 46px; padding: 0 36px 0 14px; border-radius: 12px; border: 1px solid rgba(255, 255, 255, 0.09); color: #fff; font: 400 14px var(--ui);
  background: rgba(42, 58, 92, 0.3) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='8'%3E%3Cpath d='M1.5 1.5l5 5 5-5' fill='none' stroke='%238e96a8' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") no-repeat right 14px center/13px 8px;
  -webkit-appearance: none; appearance: none; color-scheme: dark; cursor: pointer; text-overflow: ellipsis; transition: background-color 0.2s, border-color 0.2s;
}
#playSheet .ps-field select:hover { background-color: #161a26; border-color: #323b50; }
#playSheet .ps-field select:focus-visible { outline: none; border-color: #3b82f6; }
#playSheet .ps-field select option { background: #181d2a; color: #fff; }

#playSheet .ps-shelf { display: flex; gap: 12px; margin-top: 12px; }
#playSheet .ps-btn {
  flex: 1; min-width: 0; height: 48px; min-height: 0; padding: 0 10px; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border-radius: 12px !important; background: #141824 !important; border: 1px solid #242a3a !important; color: #fff !important; font: 600 14px var(--ui) !important; cursor: pointer;
}
#playSheet .ps-btn span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#playSheet .ps-btn svg { flex: 0 0 auto; color: #c4cbd8; }
#playSheet .ps-btn:hover { background: #1c2232 !important; border-color: #323b50 !important; }
#playSheet .ps-btn.on { background: #16203a !important; border-color: rgba(59, 130, 246, 0.33) !important; }
#playSheet .ps-btn.on:hover { background: #1c2232 !important; border-color: #323b50 !important; }
#playSheet .ps-btn[data-act="mine"].on svg { color: #7fb2ff; fill: #7fb2ff; }
#playSheet .ps-btn[data-act="fav"].on svg { color: #ff6b8a; fill: #ff6b8a; }
#playSheet .ps-btn[hidden], #playSheet[data-kind="file"] .ps-shelf { display: none; }

/* Название от ИИ: на ПК — меню плитки; здесь тихая строка внизу окна */
#playSheet .ps-ai { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; padding-top: 12px; border-top: 1px solid #1c2232; }
#playSheet .ps-ai-row { display: flex; align-items: center; gap: 10px; }
#playSheet .ps-ai-text { flex: 1; min-width: 0; }
#playSheet .ps-ai-note { color: #c3c9d6; font: 400 13px/18px var(--ui); }
#playSheet .ps-ai-src { color: #8e96a8; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#playSheet .ps-ai-btns { display: flex; gap: 8px; flex: 0 0 auto; }
#playSheet .ps-ai-btn {
  height: 34px; min-height: 0; padding: 0 12px; border-radius: 10px !important; font: 500 13px var(--ui) !important; cursor: pointer; white-space: nowrap;
  background: #141720 !important; border: 1px solid #242a38 !important; color: #fff !important;
}
#playSheet .ps-ai-btn:hover:not(:disabled) { background: #1c202b !important; border-color: #3e475c !important; }
#playSheet .ps-ai-btn.on { background: #2563eb !important; border-color: rgba(96, 165, 250, 0.3) !important; }
#playSheet .ps-ai-btn.on:hover:not(:disabled) { background: #3b74f0 !important; border-color: #4d86ff !important; }
#playSheet .ps-ai-btn.ps-ai-ask { align-self: flex-start; background: transparent !important; border-color: transparent !important; color: #8e96a8 !important; padding: 0 2px; height: 28px; }
#playSheet .ps-ai-btn.ps-ai-ask:hover:not(:disabled) { background: transparent !important; border-color: transparent !important; color: #fff !important; }
#playSheet .ps-ai-btn:disabled { opacity: 0.55; cursor: default; }

/* Сборник на ПК: постер слева, справа подпись, подсказка и список фильмов; внизу «Закрыть» */
#playSheet .ps-coll { display: none; gap: 18px; }
#playSheet .ps-coll .ps-poster { flex: 0 0 155px; height: 245px; }
#playSheet .ps-coll-main { flex: 1; min-width: 0; }
#playSheet .ps-coll-title { padding-right: 44px; font: 700 20px/26px var(--display); color: #fff; overflow-wrap: anywhere; }
#playSheet .ps-coll-sub { margin-top: 4px; padding-right: 44px; font: 400 13.5px var(--ui); color: #8e96a8; }
#playSheet .ps-coll-note { display: flex; align-items: center; gap: 8px; margin: 10px 0; padding: 8px 12px; border-radius: 10px; background: rgba(42, 58, 92, 0.3); border: 1px solid rgba(255, 255, 255, 0.09); font: 400 12.5px var(--ui); color: #c0c7d6; }
#playSheet .ps-coll-note svg { flex: 0 0 auto; color: #60a5fa; }
#playSheet .ps-films { display: flex; flex-direction: column; gap: 7px; max-height: 240px; overflow: auto; padding-right: 4px; scrollbar-width: thin; scrollbar-color: rgba(142, 150, 168, 0.35) transparent; }
#playSheet .ps-film {
  flex: 0 0 auto; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 0; padding: 7px 10px; text-align: left; cursor: pointer;
  border-radius: 12px !important; background: rgba(42, 58, 92, 0.3) !important; border: 1px solid rgba(255, 255, 255, 0.09) !important; color: #fff !important;
}
#playSheet .ps-film:hover { background: rgba(28, 40, 68, 0.68) !important; border-color: rgba(96, 165, 250, 0.4) !important; }
#playSheet .ps-film.on { background: rgba(37, 99, 235, 0.25) !important; border-color: rgba(96, 165, 250, 0.3) !important; }
#playSheet .ps-film-art { flex: 0 0 34px; height: 44px; border-radius: 6px; overflow: hidden; background: #181d2a; border: 1px solid #262e40; }
#playSheet .ps-film-art img { width: 100%; height: 100%; object-fit: cover; display: block; }
#playSheet .ps-film-num { flex: 0 0 24px; height: 24px; border-radius: 6px; display: grid; place-items: center; background: #1d2638; font: 700 12px var(--ui); color: #fff; }
#playSheet .ps-film-text { flex: 1; min-width: 0; display: flex; flex-direction: column; }
#playSheet .ps-film-text b { font: 600 13.5px var(--ui); color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#playSheet .ps-film-text small { font: 400 12px var(--ui); color: #7e879b; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#playSheet .ps-film-radio { flex: 0 0 20px; height: 20px; border-radius: 50%; border: 1.5px solid #384359; box-sizing: border-box; display: grid; place-items: center; }
#playSheet .ps-film.on .ps-film-radio { border-color: #4a80f5; }
#playSheet .ps-film.on .ps-film-radio::after { content: ""; width: 10px; height: 10px; border-radius: 50%; background: #4a80f5; }
#playSheet .ps-close-bottom {
  display: none; width: 100%; height: 44px; min-height: 0; margin-top: 14px; border-radius: 12px !important; cursor: pointer;
  background: #141824 !important; border: 1px solid #242a3a !important; color: #fff !important; font: 600 14px var(--ui) !important;
}
#playSheet .ps-close-bottom:hover { background: #1c2232 !important; border-color: #323b50 !important; }

@media (min-width: 700px) {
  #playSheet[data-kind="collection"] .ps-top,
  #playSheet[data-kind="collection"] .ps-pick,
  #playSheet[data-kind="collection"] .ps-shelf,
  #playSheet[data-kind="collection"] .ps-status:not(.err) { display: none; }
  #playSheet[data-kind="collection"] .ps-coll { display: flex; margin-bottom: 16px; }
  #playSheet[data-kind="collection"] .ps-close-bottom { display: block; }
}

/* Узкий экран: шторка снизу, как PlaySheet в Android */
@media (max-width: 699px) {
  #playSheet { align-items: flex-end; }
  #playSheet .ps-card,
  #playSheet[data-kind] .ps-card { width: 100%; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); padding: 0 18px calc(18px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; border-width: 1px 0 0; }
  #playSheet.open .ps-card { animation: psSheetUp 0.3s var(--ease) both; }
  #playSheet .ps-grip { display: block; width: 32px; height: 4px; margin: 22px auto; border-radius: 2px; background: rgba(196, 203, 216, 0.4); }
  #playSheet .ps-close { top: 48px; right: 18px; }
  #playSheet .ps-top { gap: 14px; }
  #playSheet .ps-poster { flex-basis: 104px; height: 156px; border-radius: 12px; }
  #playSheet .ps-info { padding-right: 36px; }
  #playSheet .ps-title { font-size: 18px; line-height: 23px; }
  #playSheet .ps-chips { flex-wrap: nowrap; gap: 6px; margin-top: 10px; overflow-x: auto; scrollbar-width: none; }
  #playSheet .ps-chips::-webkit-scrollbar { display: none; }
  #playSheet .ps-chip { padding: 3px 8px; font-size: 11.5px; }
  #playSheet[data-kind="collection"] .ps-chip-films { display: inline; }
  #playSheet .ps-rating { font-size: 12.5px; }
  #playSheet .ps-overview { margin-top: 10px; font-size: 13px; line-height: 18px; -webkit-line-clamp: 4; }
  #playSheet .ps-status { margin: 16px 0 8px; }
  #playSheet .ps-resume { padding: 13px 14px; }
  #playSheet .ps-resume-top { gap: 11px; }
  #playSheet .ps-resume-ic { flex-basis: 38px; height: 38px; }
  #playSheet .ps-resume-text b { font-size: 14.5px; }
  #playSheet .ps-resume-text small { color: #93c5fd; }
  #playSheet .ps-resume-bar { gap: 8px; }
  #playSheet .ps-resume-bar em { font-size: 11.5px; }
  #playSheet a.ps-watch { height: 50px; font-size: 13.5px; border-color: rgba(96, 165, 250, 0.3); box-shadow: 0 6px 18px rgba(37, 99, 235, 0.35); }
  #playSheet a.ps-watch.disabled { background: rgba(37, 99, 235, 0.5); border-color: transparent; color: rgba(255, 255, 255, 0.55); box-shadow: none; }
  #playSheet .ps-pick { gap: 10px; }
  #playSheet .ps-field { font-size: 12.5px; }
  #playSheet .ps-field select { height: 48px; }
  #playSheet .ps-shelf { gap: 10px; }
  #playSheet .ps-btn { gap: 7px; padding: 0 8px; font-size: 13px !important; }
  #playSheet .ps-ai-row { flex-direction: column; align-items: stretch; gap: 6px; }
}
@keyframes psSheetUp { from { transform: translateY(100%); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { #playSheet.open, #playSheet.open .ps-card, .vp-back, .vp-card { animation: none !important; } }

/* ===== «Какую версию включить?»: как VersionPicker на ПК, на узком экране — VersionSheet из Android ===== */
.modal-backdrop.vp-back { background: rgba(9, 11, 16, 0.8) !important; -webkit-backdrop-filter: none !important; backdrop-filter: none !important; font-family: var(--ui); }
.vp-card {
  width: min(560px, 100%); max-height: calc(100vh - 48px); display: flex; flex-direction: column; box-sizing: border-box; padding: 22px;
  background: rgba(11, 16, 32, 0.94); border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 22px; box-shadow: 0 30px 90px rgba(0, 0, 0, 0.6);
  animation: psRise 0.26s var(--ease) both;
}
.vp-card .ps-grip { display: none; }
.vp-card .vp-title { margin: 0; font: 500 20px/1.3 var(--display); color: #eef0f5; letter-spacing: 0; }
.vp-card .vp-sub { margin: 4px 0 14px; font: 400 13.5px var(--ui); color: #8e96a8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp-card .vp-list { display: flex; flex-direction: column; gap: 8px; max-height: 440px; min-height: 0; overflow: auto; scrollbar-width: thin; scrollbar-color: rgba(142, 150, 168, 0.35) transparent; }
.vp-card .vp-sec { display: flex; align-items: center; gap: 10px; padding: 6px 0 2px; font: 700 11.5px var(--ui); letter-spacing: 1px; text-transform: uppercase; color: #8e96a8; }
.vp-card .vp-sec::after { content: ""; flex: 1; height: 1px; background: #252a37; }
.vp-card button.vp-row {
  flex: 0 0 auto; display: block; width: 100%; min-height: 0; padding: 11px 14px; text-align: left; cursor: pointer; transform: none !important; box-shadow: none !important;
  border-radius: 14px !important; background: rgba(42, 58, 92, 0.3) !important; border: 1px solid rgba(255, 255, 255, 0.09) !important; color: #fff !important; font-family: var(--ui);
}
.vp-card button.vp-row:hover, .vp-card button.vp-row:focus-visible { background: rgba(28, 40, 68, 0.68) !important; border-color: rgba(96, 165, 250, 0.4) !important; outline: none; }
.vp-card .vp-head { display: flex; align-items: center; gap: 10px; }
.vp-card .vp-line { flex: 1; min-width: 0; font: 600 14.5px var(--ui); color: #fff; }
.vp-card .vp-size { flex: 0 0 auto; font: 400 13px var(--ui); color: #8e96a8; }
.vp-card .vp-name { margin-top: 3px; font: 400 12px var(--ui); color: #8e96a8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vp-card .vp-bar { margin-top: 8px; height: 3px; border-radius: 2px; background: #202636; overflow: hidden; }
.vp-card .vp-bar.hidden { display: none; }
.vp-card .vp-bar i { display: block; height: 3px; background: #2563eb; }
.vp-card .vp-foot { display: flex; justify-content: flex-end; margin-top: 16px; }
.vp-card button.vp-close {
  min-height: 38px; padding: 9px 14px; cursor: pointer; transform: none !important; box-shadow: none !important;
  border-radius: 12px !important; background: #141720 !important; border: 1px solid #242a38 !important; color: #fff !important; font: 500 13.5px var(--ui) !important;
}
.vp-card button.vp-close:hover { background: #1c202b !important; border-color: #3e475c !important; }
@media (max-width: 699px) {
  .modal-backdrop.vp-back { align-items: flex-end; padding: 0 !important; }
  .vp-card { width: 100%; max-height: calc(100vh - 32px); max-height: calc(100dvh - 32px); padding: 0 18px calc(16px + env(safe-area-inset-bottom)); border-radius: 24px 24px 0 0; border-width: 1px 0 0; background: #10131b; animation: psSheetUp 0.3s var(--ease) both; }
  .vp-card .ps-grip { display: block; width: 32px; height: 4px; margin: 22px auto; border-radius: 2px; background: rgba(196, 203, 216, 0.4); }
  .vp-card .vp-title { font-size: 17px; }
  .vp-card .vp-sub { margin-bottom: 12px; font-size: 13px; }
  .vp-card .vp-list { max-height: none; }
  .vp-card .vp-sec { font-size: 11px; }
  .vp-card .vp-sec::after { background: rgba(255, 255, 255, 0.13); }
  .vp-card button.vp-row { background: rgba(255, 255, 255, 0.08) !important; }
  .vp-card .vp-line { font-size: 14px; }
  .vp-card .vp-size { font-size: 12.5px; }
  .vp-card .vp-name { font-size: 11.5px; }
  .vp-card .vp-foot { display: none; }
}


/* ===== Плитка как в приложениях: закладка «Мои» и сердце «Избранное» в углу, значки справа ===== */
.tile-art .tile-fav svg { width: 16px; height: 16px; display: block; fill: none; }
.tile-art .tile-fav.tile-mine { left: 8px; right: auto; }
.tile-art .tile-fav.on, .tile-art .tile-fav.on:hover {
  background: rgba(9, 11, 16, 0.78) !important;
  border-color: rgba(255, 255, 255, 0.25) !important;
}
.tile-art .tile-fav.tile-mine.on { color: #7fb2ff !important; }
.tile-art .tile-fav.tile-mine.on svg { fill: #7fb2ff; }
.tile-art .tile-fav.tile-heart.on { color: #ff6b8a !important; }
.tile-art .tile-fav.tile-heart.on svg { fill: #ff6b8a; }
.tile-art .tile-fav:hover { border-color: rgba(255, 255, 255, 0.55) !important; color: #fff !important; }
.tile-status { display: none; }
.tile-media:empty, .tile-sub:empty { display: none; }

/* ---------- Десктоп: плитка ПК (LibraryView.kt, Tile) — название на постере, подробности при наведении ---------- */
@media (min-width: 901px) {
  .library-grid .library-tile { position: relative; }
  .library-grid .library-tile:hover { transform: translateY(-6px) scale(1.025) !important; }
  .library-grid .tile-art { border-color: #202430; box-shadow: none; }
  .library-grid .library-tile:hover .tile-art { border-color: #5a6680; box-shadow: 0 16px 36px rgba(0, 0, 0, 0.55); }
  .library-grid .library-tile:hover .tile-art img { transform: scale(1.06) !important; }
  .library-grid .tile-art .tile-fav.tile-heart { right: auto; left: 44px; }
  .library-grid .tile-art .tile-fav { width: 30px; height: 30px; background: rgba(0, 0, 0, 0.33) !important; border: 0 !important; }
  .library-grid .tile-art .tile-fav:hover { background: rgba(0, 0, 0, 0.6) !important; transform: scale(1.12); }
  .library-grid .tile-art .tile-fav svg { width: 15px; height: 15px; }
  /* верхняя тень под кнопками */
  .library-grid .tile-art::before {
    content: "" !important; display: block !important; position: absolute; left: 0; right: 0; top: 0; height: 60px; z-index: 1;
    background: linear-gradient(rgba(0, 0, 0, 0.6), transparent); pointer-events: none;
  }
  /* значки справа сверху */
  .library-grid .tile-badges { left: auto; right: 8px; align-items: flex-end; }
  .library-grid .tile-badge.badge-quality, .library-grid .tile-badge.badge-type:not(.badge-ver) { display: none; }
  .library-grid .tile-badge.badge-ver { color: #fff; background: rgba(0, 0, 0, 0.6); border-color: rgba(255, 255, 255, 0.2); text-transform: none; font-weight: 500; font-size: 11px; padding: 4px 8px; border-radius: 10px; }
  .library-grid .tile-badge.badge-tag { font-size: 12px; font-weight: 700; padding: 0 9px; height: 22px; display: inline-flex; align-items: center; background: rgba(14, 11, 26, 0.8); }
  /* название поверх нижнего градиента, подробности выезжают при наведении */
  .library-grid .tile-info {
    position: absolute; left: 0; right: 0; bottom: 0; z-index: 3; pointer-events: none;
    padding: 46px 12px 11px !important; border-radius: 0 0 14px 14px;
    background: linear-gradient(transparent, rgba(11, 14, 20, 0.8) 45%, #0b0e14);
  }
  .library-grid .tile-info strong { font-size: 13.5px; line-height: 17px; margin: 0; }
  .library-grid .tile-more { max-height: 0; opacity: 0; overflow: hidden; transition: max-height 0.3s var(--ease), opacity 0.2s; }
  .library-grid .library-tile:hover .tile-more, .library-grid .library-tile:focus-within .tile-more, .library-grid .tile-more.open { max-height: 150px; opacity: 1; }
  .library-grid .tile-sub { margin-top: 2px; font-size: 11.5px; color: #9ba4b5; }
  .library-grid .tile-status {
    display: inline-block; margin-top: 5px; padding: 2px 7px; border-radius: 6px; font-size: 10.5px; font-weight: 500; color: #fff;
    background: #181b24; border: 1px solid #2a3040;
  }
  .library-grid .tile-media { margin-top: 5px; font-size: 11px; font-weight: 400; color: #c0c7d5; }
  .library-grid .tile-remove { pointer-events: auto; margin-top: 7px; }
  /* «Готово» и дорожка загрузки — в подробностях, а не поверх постера */
  .library-grid .tile-progress-label, .library-grid .tile-progress-track { display: none; }
}

/* ---------- Телефон: плитка Android (LibraryScreen.kt, PosterTile) ---------- */
@media (max-width: 900px) {
  .library-grid { gap: 18px 12px !important; }
  .library-grid .tile-art { border: 1px solid var(--glass-edge); box-shadow: none; background: #13161f !important; }
  .library-grid .library-tile:hover { transform: none !important; }
  .library-grid .library-tile:active .tile-art { transform: scale(0.975); }
  .library-grid .tile-art { transition: transform 0.2s var(--ease); }
  .library-grid .tile-art .tile-fav { width: 34px; height: 34px; opacity: 1; transform: none; background: rgba(9, 11, 16, 0.6) !important; border: 1px solid rgba(255, 255, 255, 0.18) !important; }
  .library-grid .tile-art .tile-fav.tile-heart { right: 8px; }
  /* Dolby Vision / HDR / DTS — под сердцем */
  .library-grid .tile-badges { left: auto; right: 8px; top: 50px; align-items: flex-end; }
  .library-grid .tile-badge.badge-quality, .library-grid .tile-badge.badge-type:not(.badge-ver) { display: none; }
  .library-grid .tile-badge.badge-ver { position: absolute; right: auto; left: 10px; bottom: 36px; white-space: nowrap; color: #fff; background: rgba(0, 0, 0, 0.6); border-color: rgba(255, 255, 255, 0.2); text-transform: none; font-weight: 500; font-size: 11px; padding: 4px 8px; border-radius: 10px; }
  .library-grid .tile-badge.badge-tag { height: 22px; padding: 0 8px; display: inline-flex; align-items: center; }
  .library-grid .tile-progress-label { left: 10px; bottom: 10px; font-size: 11.5px; font-weight: 600; padding: 3px 8px; border-radius: 7px !important; background: rgba(16, 19, 27, 0.85) !important; border: 1px solid var(--glass-edge); }
  .library-grid .tile-progress-track { left: 10px; right: 10px; bottom: 38px; }
  /* кнопка «Смотреть» всегда видна, немного выше центра */
  .library-grid button.tile-play { opacity: 1; top: 44% !important; width: 50px !important; height: 50px !important; font-size: 20px !important; background: rgba(11, 16, 32, 0.8) !important; border-color: rgba(255, 255, 255, 0.25) !important; }
  .library-grid .library-tile:hover button.tile-play { transform: translate(-50%, -50%) scale(1) !important; }
  /* название, «год • тип · размер», параметры видео — под постером */
  .library-grid .tile-info { padding: 8px 2px 0 !important; }
  .library-grid .tile-info strong { font-size: 13.5px; line-height: 18px; font-weight: 600; margin: 0; color: var(--text); }
  .library-grid .tile-sub { margin-top: 2px; font-size: 12px; color: var(--muted); }
  .library-grid .tile-media { margin-top: 2px; font-size: 11.5px; font-weight: 400; color: #b0b7c6; }
  .library-grid .tile-remove { margin-top: 6px; }
}

/* ---------- Телефон: шапка, категории и нижняя панель как в Android (LibraryScreen.kt, NavBar.kt) ---------- */
@media (max-width: 900px) {
  .mobile-topline h2 { font: 700 15px var(--display); }
  .mobile-topline p { color: var(--muted); font-size: 12.5px; }
  .library-search-top input { height: 48px; border-radius: 14px !important; }
  /* категории — одной прокручиваемой строкой */
  .library-controls .category-chips { flex-wrap: nowrap; overflow-x: auto; gap: 8px; margin: 0 -16px; padding: 0 16px; scrollbar-width: none; }
  .library-controls .category-chips::-webkit-scrollbar { display: none; }
  .library-controls .cat-chip { flex: 0 0 auto; padding: 9px 14px; border-radius: 12px; font: 500 13px var(--ui); background: #131a2b; border: 1px solid #212a40; color: #c4cbd8; }
  .library-controls .cat-chip.active { background: var(--accent); border-color: rgba(96, 165, 250, 0.3); color: #fff; font-weight: 600; }
  /* сортировка и вид — компактной строкой */
  .lib-actions { gap: 8px; }
  .lib-seg { flex-wrap: nowrap; overflow-x: auto; gap: 8px; max-width: 100%; scrollbar-width: none; }
  .lib-seg::-webkit-scrollbar { display: none; }
  .lib-pill, .library-controls .btn-refresh { height: 36px; padding: 0 13px; font-size: 12.5px; border-radius: 12px; }
  /* нижняя панель: матовое стекло и синяя «линза» */
  .navrow { width: min(440px, calc(100% - 20px)) !important; border-radius: 26px !important; padding: 4px !important; background: rgba(8, 12, 22, 0.92) !important; border-color: var(--glass-edge) !important; }
  .navrow button, .navrow button.secondary { border-radius: 22px !important; min-height: 50px !important; color: #8e96a8 !important; font-weight: 500 !important; }
  .navrow button:not(.secondary) { background: var(--accent) !important; color: #fff !important; font-weight: 600 !important; box-shadow: 0 0 18px rgba(37, 99, 235, 0.45) !important; }
}

/* Кнопки сортировки и вида — тёмные «пилюли», активная — синяя (общий стиль кнопок их перекрашивал в синий) */
.library-controls .lib-pill, .library-controls button.btn-refresh {
  background: #131a2b !important; border: 1px solid #212a40 !important; color: #e6eaf2 !important; box-shadow: none !important;
}
.library-controls .lib-pill:hover, .library-controls button.btn-refresh:hover { background: #1a2338 !important; border-color: #2e3a57 !important; }
.library-controls .lib-pill.active { background: #2563eb !important; border-color: #3b82f6 !important; color: #fff !important; }
.library-controls .lib-pill, .library-controls button.btn-refresh { background-image: none !important; }
.library-controls .lib-pill.active { background-color: #2563eb !important; }

/* ---------- Компактная панель: «Вид ▾» (сортировка, сетка/список, «только готовые») и кнопка обновления ---------- */
.lib-actions { flex-wrap: nowrap; gap: 8px; }
.lib-menu-wrap { position: relative; }
.library-controls .lib-menu-btn, .library-controls button.btn-refresh {
  display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 12px;
  font: 600 13.5px var(--ui); cursor: pointer; white-space: nowrap;
  background: #131a2b !important; background-image: none !important; color: #e6eaf2 !important; border: 1px solid #212a40 !important; box-shadow: none !important;
}
.library-controls .lib-menu-btn:hover, .library-controls .lib-menu-btn.open, .library-controls button.btn-refresh:hover { background: #1a2338 !important; border-color: #2e3a57 !important; }
.library-controls .lib-menu-btn.open .lib-caret { transform: rotate(180deg); }
.lib-caret { transition: transform .2s; opacity: .7; }
.library-controls button.btn-refresh { width: 40px; padding: 0; justify-content: center; }
.btn-refresh-text { display: none; }
.lib-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 60; min-width: 210px; padding: 8px;
  display: flex; flex-direction: column; gap: 6px; border-radius: 14px;
  background: rgba(11, 16, 32, 0.97); border: 1px solid rgba(255, 255, 255, 0.14); box-shadow: 0 18px 44px rgba(0, 0, 0, 0.6);
}
.lib-menu[hidden] { display: none; }
.lib-menu .lib-seg { flex-direction: column; gap: 2px; overflow: visible; align-items: stretch; }
.lib-menu .lib-seg + .lib-seg { border-top: 1px solid #252b3b; padding-top: 6px; }
.lib-menu .lib-pill {
  justify-content: flex-start; height: 36px; padding: 0 10px; border: 0 !important; background: transparent !important; background-image: none !important; font-size: 13.5px; font-weight: 500; border-radius: 9px;
}
.lib-menu .lib-pill:hover { background: rgba(255, 255, 255, 0.08) !important; }
.lib-menu .lib-pill.active, .lib-menu .lib-pill[aria-pressed="true"] { background: rgba(37, 99, 235, 0.28) !important; color: #fff !important; }
.lib-menu .view-switch { flex-direction: row !important; border: 0; background: none; overflow: visible; gap: 6px; }
.lib-menu .view-btn { flex: 1; width: auto; height: 36px; border-radius: 9px !important; background: rgba(255, 255, 255, 0.05) !important; }
.lib-menu .view-btn.active { background: rgba(37, 99, 235, 0.28) !important; color: #fff !important; }
@media (max-width: 900px) {
  .library-controls .status:empty { display: none; }
  .library-controls { gap: 8px; }
  .library-controls .lib-actions { width: auto; margin-left: auto; }
}
@media (max-width: 900px) {
  .library-controls { flex-wrap: wrap; }
  .library-controls .category-chips { flex: 1 1 0 !important; flex-basis: 0 !important; min-width: 0; margin: 0; padding: 0; }
  .library-controls .status { order: 5; flex-basis: 100%; }
  .lib-menu { right: 0; }
}

/* ---------- Активные сессии ---------- */
.sessions-panel { padding: 22px 24px !important; }
.sessions-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.sessions-head h2 { margin: 0 0 6px; font-size: clamp(20px, 2.2vw, 26px); }
.sessions-hint { margin: 0; color: var(--muted); font-size: 14px; line-height: 1.5; max-width: 560px; }
.sessions-list { display: flex; flex-direction: column; gap: 10px; }
.sess-row { display: flex; align-items: center; gap: 14px; padding: 12px 14px; border-radius: 14px; background: var(--glass-fill); border: 1px solid var(--glass-edge); }
.sess-row.current { border-color: rgba(96, 165, 250, 0.4); background: rgba(37, 99, 235, 0.12); }
.sess-ico { flex: 0 0 38px; height: 38px; display: grid; place-items: center; border-radius: 12px; background: rgba(255, 255, 255, 0.07); font-size: 18px; color: #93c5fd; }
.sess-info { flex: 1; min-width: 0; }
.sess-info strong { font-size: 14.5px; font-weight: 600; color: #fff; }
.sess-badge { display: inline-block; margin-left: 6px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; color: #93c5fd; background: rgba(37, 99, 235, 0.22); border: 1px solid rgba(96, 165, 250, 0.35); }
.sess-meta { margin-top: 3px; font-size: 12.5px; color: var(--muted); }
button.sess-btn { height: 36px; padding: 0 14px; border-radius: 10px; font: 600 13px var(--ui); cursor: pointer; white-space: nowrap; background: #131a2b !important; background-image: none !important; color: #e6eaf2 !important; border: 1px solid #212a40 !important; box-shadow: none !important; }
button.sess-btn.danger { color: #ffb3b3 !important; border-color: rgba(255, 107, 107, 0.4) !important; background: rgba(255, 107, 107, 0.1) !important; }
button.sess-btn.danger:hover:not(:disabled) { background: rgba(255, 107, 107, 0.22) !important; }
button.sess-btn:disabled { opacity: .6; cursor: default; }
button.sess-btn.hidden { display: none; }
#mobileSessions { display: none; }
@media (max-width: 900px) {
  #mobileSessions { display: inline-flex; padding: 8px 12px; font-size: 13px; margin-right: 8px; }
  .mobile-topline { gap: 6px; }
  .sess-row { flex-wrap: wrap; }
  .sess-row button.sess-btn { margin-left: 52px; }
  .sessions-head button.sess-btn { width: 100%; }
}
@media (max-width: 900px) {
  .sess-row { display: grid; grid-template-columns: 38px minmax(0, 1fr); gap: 10px 12px; }
  .sess-row button.sess-btn { grid-column: 1 / -1; margin-left: 0; width: 100%; }
  .sess-ico { flex: none; }
}
.sessions-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.sess-row.stale { opacity: .6; }
.sess-row.stale .sess-meta { color: #d6a46a; }
@media (max-width: 900px) { .sessions-actions { width: 100%; flex-direction: column; } .sessions-actions button.sess-btn { width: 100%; } }
