/* ПК-адаптация Companion visual language. Runtime and data rendering are intentionally separate. */
:root { --desktop-width: 1880px; }
html, body { min-width: 320px; }
.desktop-shell { width: min(calc(100% - 32px), var(--desktop-width)); margin: 0 auto; }
.desktop-topbar { min-height: 66px; display: flex; align-items: center; gap: 28px; position: sticky; top: 0; z-index: 20; padding: 10px 0; background: var(--bg, #0c1220eF); backdrop-filter: blur(12px); }
.desktop-brand { color: inherit; font-weight: 900; letter-spacing: .14em; text-decoration: none; white-space: nowrap; }
.desktop-topbar .tabs { display: flex; gap: 8px; flex: 0 0 auto; }
.desktop-topbar .tab { min-height: 38px; padding: 0 16px; }
.desktop-device-summary { margin-left: auto; display: flex; align-items: center; gap: 8px; min-width: 0; }
.desktop-device-summary select, .desktop-settings-panel input, .desktop-settings-panel select { min-height: 38px; max-width: 190px; border: 1px solid var(--line, #33405c); border-radius: 10px; background: var(--surface, #121a2b); color: inherit; padding: 0 10px; }
.desktop-hero { min-height: 260px; max-height: 365px; overflow: hidden; position: relative; isolation: isolate; }
.desktop-hero .hero-media { background: radial-gradient(circle at 75% 20%, #526cff, transparent 38%), linear-gradient(120deg, #151d39, #111827 65%, #27365e); }
.desktop-hero .hero-copy { position: relative; z-index: 1; align-self: end; max-width: 680px; padding: 28px; }
.desktop-hero .hero-media { position: absolute; inset: 0; z-index: -1; }
.desktop-tools { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 16px 0; }
.desktop-search { flex: 1 1 280px; position: relative; min-width: 0; }
.desktop-search input { width: 100%; min-height: 42px; padding-right: 42px; }
.desktop-search input::-webkit-search-cancel-button { display: none; }
.desktop-search-clear { position: absolute; top: 5px; right: 5px; z-index: 3; width: 32px; height: 32px; padding: 0; border: 0; border-radius: 50%; background: transparent; color: var(--muted, #9da8c0); font-size: 24px; line-height: 1; cursor: pointer; }
.desktop-search-clear:hover, .desktop-search-clear:focus-visible { color: var(--text, #fff); background: #ffffff12; }
.desktop-genre-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 45; width: min(100%, 420px); max-height: min(48vh, 360px); overflow-y: auto; display: grid; gap: 3px; padding: 8px; border: 1px solid var(--line, #33405c); border-radius: 12px; background: var(--surface, #121a2b); box-shadow: 0 18px 46px #000a; }
.desktop-genre-menu[hidden] { display: none; }
.desktop-genre-option { width: 100%; min-height: 38px; padding: 8px 10px; border: 0; border-radius: 8px; background: transparent; color: inherit; text-align: left; cursor: pointer; }
.desktop-genre-option:hover, .desktop-genre-option:focus-visible, .desktop-genre-option.active { background: color-mix(in srgb, var(--accent, #6d8cff) 22%, transparent); outline: none; }
.quick-filters, .density-switch { display: flex; gap: 6px; }
.quick-filter, .card-size-button, .secondary-button, .primary-button { min-height: 38px; padding: 0 13px; border-radius: 10px; cursor: pointer; transition: border-color .18s, background .18s, transform .18s; }
.quick-filter:hover, .card-size-button:hover, .secondary-button:hover, .primary-button:hover, .desktop-topbar .tab:hover, .desktop-topbar .topbar-icon:hover { transform: translateY(-1px); }
.quick-filter.active, .card-size-button.active, .desktop-topbar .tab.active { border-color: var(--accent, #6d8cff); background: color-mix(in srgb, var(--accent, #6d8cff) 22%, transparent); }
.desktop-search input:focus, .desktop-device-summary select:focus, .desktop-settings-panel input:focus, .desktop-settings-panel select:focus { outline: 2px solid var(--accent, #6d8cff); outline-offset: 2px; }
.card-size-button { min-width: 38px; }
.desktop-notice { min-height: 22px; color: var(--muted, #9da8c0); }
.desktop-program-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.desktop-settings-panel { position: fixed; top: 82px; right: max(16px, calc((100vw - var(--desktop-width)) / 2)); z-index: 50; width: min(360px, calc(100vw - 32px)); display: grid; gap: 10px; padding: 20px; border: 1px solid var(--line, #33405c); border-radius: 16px; background: var(--surface, #121a2b); box-shadow: 0 20px 60px #0008; }
.desktop-settings-panel[hidden] { display: none; }
.settings-heading { display: flex; justify-content: space-between; align-items: center; }
.desktop-details { width: min(1100px, calc(100vw - 32px)); max-height: calc(100vh - 32px); margin: auto; border: 0; padding: 0; background: transparent; color: inherit; }
.desktop-details::backdrop { background: #0009; }
.desktop-details .detail-card { display: block; padding: 0 20px 20px; border-radius: 18px; background: var(--surface, #121a2b); max-height: calc(100vh - 32px); overflow-y: auto; overscroll-behavior: contain; }
.desktop-details .detail-header { position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between; gap: 16px; min-height: 66px; padding: 12px 0; background: linear-gradient(var(--surface, #121a2b) 78%, transparent); }
.desktop-details .detail-title { margin: 0; min-width: 0; }
.desktop-details .detail-header .topbar-icon { flex: 0 0 auto; color: #fff; background: #05090fe6; border-color: #fff8; box-shadow: 0 4px 14px #0008; }
.desktop-details .detail-media { width: 100%; min-height: 0; aspect-ratio: 16 / 9; position: relative; overflow: hidden; border-radius: 12px; background: #18233d; }
.desktop-details .detail-video-wrap, .desktop-details .detail-video-wrap video, .desktop-details .detail-image, .desktop-details .detail-embed { width: 100%; height: 100%; object-fit: cover; }
.desktop-details .detail-embed { display: block; border: 0; background: #000; }
.desktop-details .media-play { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); }
.desktop-details .detail-copy { min-width: 0; padding-top: 18px; }
.desktop-details .detail-copy > p, .desktop-details .detail-copy .description { display: block; -webkit-line-clamp: unset; line-clamp: unset; -webkit-box-orient: initial; overflow: visible; white-space: normal; }
.desktop-details .detail-versions { display: grid; gap: 12px; max-height: none; overflow: visible; margin-top: 24px; }
.desktop-details .detail-versions .version-item { width: 100%; align-items: stretch; gap: 18px; padding: 16px; }
.desktop-details .detail-versions .version-info { flex: 1 1 auto; gap: 7px; }
.desktop-details .version-changelog { margin: 3px 0 0; color: var(--text, #eef3ff); line-height: 1.5; white-space: pre-wrap; }
.desktop-details .version-changelog-label { color: var(--muted, #9da8c0); font-weight: 700; }
.desktop-details .detail-versions .version-item > button { flex: 0 0 auto; align-self: center; }
.detail-actions { display: flex; gap: 10px; margin-top: 18px; }
@media (max-width: 1100px) { .desktop-program-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 760px) { .desktop-shell { width: min(calc(100% - 20px), var(--desktop-width)); } .desktop-topbar { flex-wrap: wrap; gap: 12px; } .desktop-device-summary { width: 100%; justify-content: flex-end; } .desktop-program-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .desktop-program-grid { grid-template-columns: 1fr; } .desktop-device-summary select { max-width: 145px; } }
:root { --desktop-hover-ghost-opacity: .30; --desktop-hover-active-opacity: .92; --desktop-hover-dwell-duration: 300ms; --desktop-hover-transition: opacity .16s ease, transform .16s ease, visibility .16s ease; }
@media (hover: hover) and (pointer: fine) and (min-width: 761px) {
  .desktop-shell .hover-preview-panel { width: min(580px, calc(100vw - 24px)); opacity: 0; visibility: hidden; pointer-events: none; transition: var(--desktop-hover-transition); transform-origin: var(--hover-origin-x, 50%) var(--hover-origin-y, 50%); }
  .desktop-shell .hover-preview-panel.is-visible { visibility: visible; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }
  .desktop-shell .hover-preview-panel.is-visible.is-ghost { opacity: var(--desktop-hover-ghost-opacity); }
  .desktop-shell .hover-preview-panel.is-visible.is-active { opacity: var(--desktop-hover-active-opacity); }
  .desktop-shell .hover-preview-panel.is-ghost .hover-preview-title, .desktop-shell .hover-preview-panel.is-ghost .hover-preview-description { opacity: .42; }
  .desktop-shell .hover-preview-panel.is-active .hover-preview-title, .desktop-shell .hover-preview-panel.is-active .hover-preview-description { opacity: 1; }
}
@media (hover: none), (pointer: coarse), (max-width: 760px) {
  .desktop-shell .hover-preview-panel { display: none !important; pointer-events: none !important; }
  .desktop-shell .catalog-card:hover, .desktop-shell .catalog-card:focus-within { transform: none; }
  .desktop-topbar { position: sticky; top: 0; height: auto; min-height: 58px; padding: 8px 0; }
  .desktop-topbar .tab, .desktop-device-summary select, .desktop-device-summary button, .desktop-tools button, .desktop-tools input { min-height: 44px; }
  .desktop-device-summary { min-width: 0; max-width: 100%; }
  .desktop-device-summary select { width: min(100%, 220px); max-width: 100%; }
  .desktop-hero { min-height: 220px; max-height: 320px; }
  .desktop-details { width: calc(100vw - 20px); max-width: calc(100vw - 20px); max-height: calc(100vh - 20px); }
  .desktop-details .detail-card { width: 100%; max-height: calc(100vh - 20px); overflow-y: auto; padding: 0 14px 14px; }
  .desktop-details .detail-media { min-height: 0; aspect-ratio: 16 / 9; }
  .desktop-details .detail-copy { max-height: none; overflow: visible; }
  .desktop-details .detail-versions { max-height: none; overflow: visible; }
}

.desktop-auth { display: grid; gap: 8px; padding: 12px 0; border-bottom: 1px solid var(--line, #33405c); }
.auth-heading { margin: 0; font-size: 16px; }
.auth-mode-switch { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.auth-mode-switch button { min-height: 38px; border: 1px solid var(--line, #33405c); border-radius: 9px; background: transparent; color: inherit; cursor: pointer; }
.auth-mode-switch button.active, .auth-mode-switch button:hover, .auth-mode-switch button:focus-visible { border-color: var(--accent, #6d8cff); background: color-mix(in srgb, var(--accent, #6d8cff) 20%, transparent); }
.auth-form { display: grid; gap: 8px; }
.auth-form input { width: 100%; min-width: 0; min-height: 40px; box-sizing: border-box; }
.auth-form .primary-button, .desktop-auth > .secondary-button { width: 100%; min-height: 42px; }
.auth-signed { margin: 0; color: var(--muted, #9da8c0); overflow-wrap: anywhere; }
.auth-status { min-height: 1.3em; margin: 0; color: #ffb4b4; font-size: 12px; }
.auth-recovery { display: grid; gap: 8px; padding: 10px; border: 1px solid var(--accent, #6d8cff); border-radius: 10px; background: color-mix(in srgb, var(--accent, #6d8cff) 12%, transparent); }
.auth-recovery-code { display: block; padding: 8px; border-radius: 8px; background: #05090f; color: #fff; font: 700 16px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; user-select: all; }
.auth-recovery button { width: 100%; min-height: 40px; }
.desktop-legacy-access { display: grid; gap: 8px; padding-top: 8px; }
.desktop-legacy-access summary { color: var(--muted, #9da8c0); cursor: pointer; }
.desktop-legacy-access[open] { padding-bottom: 4px; }
@media (max-width: 760px) {
  .auth-mode-switch button, .auth-form input, .auth-form button, .desktop-auth > .secondary-button, .auth-recovery button { min-height: 44px; }
}

.desktop-pairing { display: grid; gap: 10px; margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line, #33405c); }
.desktop-settings-panel { max-height: calc(100vh - 100px); overflow-y: auto; }
.pairing-heading { margin: 0; font-size: 16px; }
.pairing-linked { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-width: 0; padding: 8px 10px; border: 1px solid var(--line, #33405c); border-radius: 10px; background: #0b1520; }
.pairing-linked span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pairing-methods { display: grid; gap: 10px; }
.pairing-card { display: grid; gap: 7px; min-width: 0; padding: 10px; border: 1px solid var(--line, #33405c); border-radius: 11px; background: #0b1520; }
.pairing-card h4, .pairing-card p { margin: 0; }
.pairing-card input { width: 100%; min-height: 42px; border: 1px solid var(--line, #33405c); border-radius: 9px; background: var(--surface, #121a2b); padding: 0 10px; letter-spacing: .22em; }
.pairing-card .primary-button, .pairing-card .secondary-button { width: 100%; min-height: 42px; border: 1px solid var(--line, #33405c); border-radius: 9px; background: var(--surface, #121a2b); color: inherit; }
.pairing-card .primary-button:hover, .pairing-card .secondary-button:hover, .pairing-card .primary-button:focus-visible, .pairing-card .secondary-button:focus-visible { border-color: var(--accent, #6d8cff); }
.pairing-status { min-height: 1.3em; color: var(--muted, #9da8c0); font-size: 12px; }
.pairing-qr { display: grid; place-items: center; gap: 6px; padding: 8px; border-radius: 9px; background: #fff; }
.pairing-qr-image { display: block; width: min(180px, 100%); height: auto; aspect-ratio: 1; object-fit: contain; }
.pairing-payload { max-width: 100%; margin: 0; color: #182033; font: 11px/1.3 ui-monospace, SFMono-Regular, Consolas, monospace; overflow-wrap: anywhere; }
@media (max-width: 760px) { .pairing-card .primary-button, .pairing-card .secondary-button, .pairing-card input { min-height: 44px; } .pairing-linked { align-items: stretch; flex-direction: column; } }
@media (max-width: 480px) {
  .desktop-shell { width: calc(100% - 20px); }
  .desktop-topbar { align-items: stretch; gap: 8px; }
  .desktop-topbar .tabs { width: 100%; overflow-x: auto; }
  .desktop-topbar .tab { flex: 1 0 auto; }
  .desktop-device-summary { width: 100%; justify-content: stretch; flex-wrap: wrap; }
  .desktop-device-summary select { flex: 1 1 100%; }
  .desktop-device-summary .state-pill { flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .desktop-tools { align-items: stretch; }
  .desktop-search { flex-basis: 100%; }
  .desktop-genre-menu { width: 100%; max-height: 45vh; }
  .quick-filters, .density-switch { overflow-x: auto; max-width: 100%; }
  .desktop-details .detail-copy, .desktop-details .detail-versions { max-height: none; }
}
@media (hover: none), (pointer: coarse), (max-width: 760px) {
  .desktop-tools .density-switch { display: none; }
  .desktop-details .topbar-icon { width: 44px; min-width: 44px; height: 44px; min-height: 44px; }
  .desktop-details .detail-actions { flex-direction: column; align-items: stretch; width: 100%; }
  .desktop-details .detail-actions button, .desktop-details .detail-versions .version-item button { width: 100%; min-height: 44px; }
  .desktop-details .detail-versions .version-item { flex-direction: column; align-items: stretch; }
  .desktop-details .media-play { width: 52px; min-width: 52px; height: 52px; min-height: 52px; padding: 0; border-radius: 50%; display: grid; place-items: center; }
  .desktop-details .detail-header .topbar-icon { width: 44px; min-width: 44px; height: 44px; min-height: 44px; color: #fff; background: #05090fcc; border-color: #fff8; box-shadow: 0 4px 14px #000b; }
}
