:root {
  --ink: #1d1f20;
  --panel: #242628;
  --panel-2: #2a2d2f;
  --line: #34373a;
  --line-2: #43474a;
  --text: #ffffff;
  --muted: #9fa4a7;
  --dim: #7b8083;
  --amber: #ffffff;
  --amber-soft: rgba(255, 255, 255, 0.08);
  --red: #d0604a;
  --green: #7ec87e;
  --mono: "SF Mono", "Cascadia Mono", Consolas, monospace;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --r: 10px;
  --rail: 0px;
  --gutter: clamp(16px, 3vw, 40px);
  --max: 1760px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--ink);
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--ink);
  color: var(--text);
  font: 400 15px/1.45 var(--sans);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

body.player-open {
  overflow: hidden;
}

h1,
h2,
h3,
p {
  margin: 0;
}

button,
input,
select {
  font: inherit;
  color: inherit;
}

button {
  -webkit-tap-highlight-color: transparent;
}

a {
  color: inherit;
}

code {
  font: 12px/1.4 var(--mono);
  color: var(--amber);
  background: var(--amber-soft);
  padding: 1px 4px;
  border-radius: 2px;
}

::selection {
  background: var(--amber);
  color: #1d1f20;
}

:focus-visible {
  outline: 1px solid var(--amber);
  outline-offset: 2px;
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--line-2) transparent;
}

::-webkit-scrollbar {
  width: 9px;
  height: 9px;
}

::-webkit-scrollbar-thumb {
  background: var(--line-2);
}

::-webkit-scrollbar-track {
  background: transparent;
}

.mono {
  font-family: var(--mono);
}

.muted {
  color: var(--muted);
}

.dim {
  color: var(--dim);
}

.eyebrow {
  display: block;
  font: 500 10px/1.3 var(--mono);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--muted);
}

.hint {
  font: 12px/1.55 var(--sans);
  color: var(--dim);
  max-width: 72ch;
}

.hint .mono {
  font-size: 10px;
  color: var(--muted);
}

.lede {
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
  max-width: 72ch;
}

/* ── Каркас ─────────────────────────────────────────── */

.shell {
  min-height: 100vh;
}

.rail {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 30;
  width: var(--rail);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 30px;
  padding: 20px 0 16px;
  background: #17191b;
  border-right: 1px solid var(--line);
}

.brand {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding-top: 14px;
  text-decoration: none;
  color: var(--text);
}

.brand::before {
  content: "";
  width: 6px;
  height: 6px;
  background: var(--amber);
}

.brand-mark {
  writing-mode: vertical-rl;
  font: 600 14px/1 var(--mono);
  letter-spacing: 0.4em;
}

.brand-sub {
  writing-mode: vertical-rl;
  font: 9px/1 var(--mono);
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: var(--dim);
}

.rail-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.rail-nav a {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: var(--r);
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.rail-nav a:hover {
  color: var(--text);
  background: var(--panel);
}

.rail-nav a.is-active {
  color: var(--amber);
  background: var(--panel);
  border-color: var(--line-2);
}

.rail-nav a.is-active::before {
  content: "";
  position: absolute;
  left: -16px;
  width: 2px;
  height: 20px;
  background: var(--amber);
}

.rail-nav svg {
  width: 20px;
  height: 20px;
}

.nav-badge {
  position: absolute;
  top: 4px;
  right: 3px;
  min-width: 15px;
  height: 15px;
  padding: 0 3px;
  display: grid;
  place-items: center;
  background: var(--amber);
  color: #1d1f20;
  font: 600 9px/1 var(--mono);
  border-radius: 2px;
}

.rail-foot {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  writing-mode: vertical-rl;
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--dim);
}

.rail-line {
  width: 1px;
  height: 34px;
  background: var(--line-2);
}

.main {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 0 var(--gutter);
  background: rgba(29, 31, 32, 0.92);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

.topbar-inner {
  width: 100%;
  max-width: var(--max);
  min-height: 64px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.topbar-title {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.topbar h1 {
  font: 600 24px/1.1 var(--sans);
  letter-spacing: -0.025em;
}

.topbar-meta {
  display: flex;
  align-items: center;
  gap: 2px;
  flex: none;
}

.conn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 9px;
  background: none;
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--muted);
  font: 500 10px/1 var(--mono);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  cursor: pointer;
}

.conn:hover {
  color: var(--text);
  border-color: var(--line);
}

.conn.is-readonly {
  cursor: default;
}

.conn.is-readonly:hover {
  color: var(--muted);
  border-color: var(--line);
}

.conn .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dim);
  flex: none;
}

.conn.is-ok .dot {
  background: var(--green);
}

.conn.is-bad .dot {
  background: var(--red);
}

.conn.is-idle .dot {
  background: var(--dim);
}

.conn[hidden] {
  display: none;
}

.conn svg {
  width: 14px;
  height: 14px;
}

.conn.install-app {
  color: var(--amber);
}

.conn.install-app:hover {
  border-color: rgba(255, 255, 255, 0.45);
}

.view {
  flex: 1;
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 26px var(--gutter) 90px;
}

/* ── Кнопки ─────────────────────────────────────────── */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 38px;
  padding: 0 16px;
  background: none;
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  color: var(--text);
  font: 500 13px/1 var(--sans);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn svg {
  width: 16px;
  height: 16px;
  flex: none;
}

.btn:hover {
  background: var(--panel-2);
  border-color: var(--muted);
}

.btn:disabled {
  opacity: 0.55;
  cursor: default;
}

.btn-primary {
  background: var(--amber);
  border-color: var(--amber);
  color: #1d1f20;
  font-weight: 600;
}

.btn-primary:hover {
  background: #e6e6e6;
  border-color: #e6e6e6;
}

.btn-ghost {
  border-color: var(--line);
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--text);
  background: var(--panel);
}

.btn-danger-ghost {
  border-color: rgba(208, 96, 74, 0.35);
  color: var(--red);
}

.btn-danger-ghost:hover {
  background: rgba(208, 96, 74, 0.08);
  border-color: var(--red);
}

.btn-mini {
  height: 30px;
  padding: 0 10px;
  font-size: 11px;
  gap: 6px;
}

.btn-mini svg {
  width: 14px;
  height: 14px;
}

.icon-btn {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  flex: none;
  padding: 0;
  background: none;
  border: 1px solid transparent;
  border-radius: 2px;
  color: var(--dim);
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--panel-2);
  border-color: var(--line);
}

.icon-btn svg {
  width: 16px;
  height: 16px;
}

/* ── Поиск ─────────────────────────────────────────── */

.search-head {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 22px;
}

.search-form {
  display: flex;
  gap: 10px;
}

.search-field {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
  min-width: 0;
}

.search-icon {
  position: absolute;
  left: 14px;
  display: flex;
  color: var(--dim);
  pointer-events: none;
}

.search-icon svg {
  width: 18px;
  height: 18px;
}

.search-field input {
  width: 100%;
  height: 50px;
  padding: 0 66px 0 44px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  color: var(--text);
  font: 500 16px/1 var(--sans);
  transition: border-color 0.15s, background 0.15s;
}

.search-field input::placeholder {
  color: var(--dim);
  font-weight: 400;
}

.search-field input:focus {
  outline: none;
  border-color: var(--amber);
  background: #202325;
}

.search-key {
  position: absolute;
  right: 12px;
  padding: 2px 5px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  font-size: 9px;
  letter-spacing: 0.08em;
  color: var(--dim);
  pointer-events: none;
}

.search-form .btn-primary {
  height: 50px;
  padding: 0 26px;
}

.search-extras {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.quick {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 24px;
}

.quick-label {
  margin-right: 5px;
  font-size: 9px;
  letter-spacing: 0.16em;
  color: var(--dim);
}

.chip {
  padding: 4px 8px;
  background: none;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  font: 11px/1.2 var(--mono);
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}

.chip:hover {
  color: var(--text);
  border-color: var(--line-2);
  background: var(--panel);
}

.chip.is-active {
  color: var(--amber);
  border-color: rgba(255, 255, 255, 0.45);
  background: rgba(255, 255, 255, 0.08);
}

.chip-clear {
  border-style: dashed;
  color: var(--dim);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 12px 22px;
}

.segmented {
  display: flex;
  gap: 2px;
}

.segmented button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 10px;
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--muted);
  font: 500 11px/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.segmented button svg {
  width: 14px;
  height: 14px;
}

.segmented button:hover {
  color: var(--text);
}

.segmented button.is-active {
  color: var(--amber);
  border-bottom-color: var(--amber);
}

.field-inline {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.field-inline > span {
  font: 9px/1 var(--mono);
  letter-spacing: 0.14em;
  color: var(--dim);
}

select {
  appearance: none;
  height: 30px;
  padding: 0 26px 0 8px;
  background: var(--panel) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23747c70' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E") no-repeat right 7px center / 10px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--text);
  font: 12px/1 var(--mono);
  cursor: pointer;
}

select:focus {
  outline: none;
  border-color: var(--amber);
}

.check {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 6px;
  color: var(--muted);
  font: 12px/1.2 var(--sans);
  cursor: pointer;
  user-select: none;
}

.check input {
  width: 14px;
  height: 14px;
  accent-color: var(--amber);
}

.result-count {
  margin-left: auto;
  margin-bottom: 8px;
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--dim);
}

/* ── Результаты ─────────────────────────────────────── */

.release-table {
  border-top: 1px solid var(--line-2);
}

.release-head,
.release {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 88px 64px 130px 74px 118px;
  gap: 16px;
  align-items: center;
}

.release-head {
  padding: 9px 8px;
  border-bottom: 1px solid var(--line);
  font: 500 9px/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--dim);
}

.release-head span:nth-child(3),
.release-head span:nth-child(4),
.release-head span:nth-child(6) {
  text-align: right;
}

.release {
  padding: 12px 8px;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s;
}

.release:hover {
  background: var(--panel);
}

.poster {
  position: relative;
  display: grid;
  place-items: center;
  width: 44px;
  height: 60px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
}

.poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.poster:not(.is-fallback) .poster-letter {
  visibility: hidden;
}

.poster-letter {
  font: 600 17px/1 var(--sans);
  letter-spacing: 0.02em;
  color: var(--dim);
}

.release-main {
  min-width: 0;
}

.release-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font: 600 15px/1.35 var(--sans);
  letter-spacing: -0.005em;
  color: var(--text);
  overflow-wrap: anywhere;
}

.release-sub {
  margin-top: 3px;
  font-size: 10px;
  line-height: 1.5;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.release-file {
  margin-top: 2px;
  font-size: 9px;
  line-height: 1.5;
  color: var(--dim);
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.release-group {
  align-items: start;
}

.release-group .poster {
  margin-top: 1px;
}

.variant-pick {
  display: flex;
  margin-top: 7px;
  min-width: 0;
}

.variant-select {
  width: 100%;
  max-width: 620px;
  height: 30px;
  padding: 0 8px;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  color: var(--text);
  font: 10px/1 var(--mono);
  cursor: pointer;
}

.variant-select:hover {
  border-color: var(--line-2);
  background: #26292b;
}

.variant-select:focus-visible {
  outline: 1px solid var(--amber);
  outline-offset: 1px;
}

.variant-select option {
  background: var(--panel-2);
  color: var(--text);
}

.variant-only {
  display: block;
  max-width: 100%;
  overflow: hidden;
  font-size: 10px;
  color: var(--dim);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}

.badge {
  padding: 1px 5px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  font: 9px/1.5 var(--mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.badge-accent {
  color: var(--amber);
  border-color: rgba(255, 255, 255, 0.45);
  background: var(--amber-soft);
}

.badge-bad {
  color: var(--red);
  border-color: rgba(208, 96, 74, 0.45);
}

.release-size {
  text-align: right;
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
}

.release-seed {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  font-size: 12px;
  color: var(--text);
}

.seed-mark {
  width: 5px;
  height: 5px;
  background: var(--dim);
  flex: none;
}

.seed-mark.is-live {
  background: var(--green);
}

.release-indexer {
  overflow: hidden;
  font-size: 12px;
  color: var(--muted);
  white-space: nowrap;
  text-overflow: ellipsis;
}

.release-age {
  text-align: right;
  font-size: 10px;
  color: var(--dim);
  white-space: nowrap;
}

.release-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 4px;
}

.btn-add {
  height: 30px;
  padding: 0 12px;
  background: none;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  color: var(--text);
  font: 500 11px/1 var(--sans);
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}

.btn-add:hover:not(:disabled) {
  background: var(--amber);
  border-color: var(--amber);
  color: #1d1f20;
}

.btn-add:disabled {
  border-color: rgba(255, 255, 255, 0.4);
  color: var(--amber);
  cursor: default;
}

.release-mobile {
  display: none;
}

.release-skeleton {
  opacity: 0.6;
}

.skeleton-block,
.skeleton-line {
  background: var(--panel-2);
}

.skeleton-line {
  height: 9px;
  margin: 7px 0;
}

.skeleton-line.w-40 {
  width: 40%;
}

.skeleton-line.w-60 {
  width: 60%;
}

.skeleton-line.w-80 {
  width: 80%;
}

.release-skeleton .skeleton-line,
.skeleton-block {
  animation: kadr-pulse 1.8s ease-in-out infinite;
}

@keyframes kadr-pulse {
  50% {
    opacity: 0.45;
  }
}

.load-more {
  display: flex;
  justify-content: center;
  padding: 22px 0;
  border-bottom: 1px solid var(--line);
}

/* ── Состояния ─────────────────────────────────────── */

.state {
  max-width: 780px;
  padding: clamp(22px, 4vw, 38px);
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.state h2 {
  margin: 8px 0 10px;
  font: 600 clamp(20px, 2.4vw, 27px)/1.2 var(--sans);
  letter-spacing: -0.02em;
}

.state p {
  margin-bottom: 16px;
  color: var(--muted);
  max-width: 64ch;
  line-height: 1.6;
}

.state p:last-child {
  margin-bottom: 0;
}

.state-setup {
  border-left: 2px solid var(--amber);
}

.state-error {
  border-left: 2px solid var(--red);
}

.state-quiet {
  background: none;
}

.intro-notes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 20px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-size: 10px;
  color: var(--dim);
}

.intro-notes span::before {
  content: "—";
  margin-right: 6px;
  color: var(--line-2);
}

/* ── Популярное (TMDB) ─────────────────────────────── */

.popular-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px 24px;
  margin-bottom: 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.popular-intro {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 62ch;
}

.popular-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(148px, 1fr));
  gap: 24px 16px;
}

.pop-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: var(--r);
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.pop-poster {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color 0.15s;
}

.pop-poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.pop-poster:not(.is-fallback) .poster-letter {
  visibility: hidden;
}

.pop-poster .poster-letter {
  font-size: 22px;
}

.pop-card:hover .pop-poster {
  border-color: var(--line-2);
}

.pop-card:hover .pop-poster img {
  transform: scale(1.035);
}

.pop-card:hover .pop-title {
  color: var(--amber);
}

.pop-card:focus-visible {
  outline: none;
}

.pop-card:focus-visible .pop-poster {
  outline: 1px solid var(--amber);
  outline-offset: 2px;
}

.pop-rating {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 5px;
  background: rgba(13, 15, 13, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 2px;
  color: var(--amber);
  font: 600 10px/1.35 var(--mono);
  backdrop-filter: blur(4px);
}

.pop-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.pop-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font: 500 14px/1.35 var(--sans);
  letter-spacing: -0.005em;
  color: var(--text);
  overflow-wrap: anywhere;
  transition: color 0.15s;
}

.pop-meta {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

.pop-skeleton .pop-poster {
  animation: kadr-pulse 1.8s ease-in-out infinite;
}

.pop-skeleton .pop-body {
  gap: 8px;
  padding-top: 2px;
}

.pop-skeleton .skeleton-line {
  margin: 0;
}

/* ── Каталог (TMDB) и избранное ───────────────────── */

.cat-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px 24px;
  margin-bottom: 20px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.cat-intro {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 64ch;
}

.cat-filters {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 22px;
}

.cat-genres {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.cat-genres .chip {
  flex: none;
  white-space: nowrap;
}

.cat-filter-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 18px;
}

.cat-select {
  width: 132px;
  font-size: 11px;
}

.cat-fav-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
}

.cat-fav-toggle svg {
  width: 13px;
  height: 13px;
}

.cat-fav-toggle.is-active svg {
  fill: currentColor;
}

.cat-count {
  min-width: 12px;
  padding-left: 2px;
  color: var(--dim);
  font-size: 10px;
  text-align: right;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(152px, 1fr));
  gap: 24px 16px;
}

.cat-card {
  display: flex;
  flex-direction: column;
  gap: 9px;
  min-width: 0;
}

.cat-poster {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color 0.15s;
}

.cat-open {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  cursor: pointer;
}

.cat-open img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.cat-poster:not(.is-fallback) .poster-letter {
  visibility: hidden;
}

.cat-poster .poster-letter {
  font-size: 22px;
}

.cat-card:hover .cat-poster {
  border-color: var(--line-2);
}

.cat-card:hover .cat-open img {
  transform: scale(1.035);
}

.cat-card:hover .cat-title {
  color: var(--amber);
}

.cat-open:focus-visible {
  outline: 1px solid var(--amber);
  outline-offset: -3px;
}

.cat-rating {
  position: absolute;
  top: 8px;
  left: 8px;
  padding: 2px 5px;
  background: rgba(13, 15, 13, 0.82);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 2px;
  color: var(--amber);
  font: 600 10px/1.35 var(--mono);
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.cat-star {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 1;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  padding: 0;
  background: rgba(13, 15, 13, 0.78);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  color: var(--muted);
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: color 0.15s, border-color 0.15s;
}

.cat-star svg {
  width: 15px;
  height: 15px;
}

.cat-star:hover {
  color: var(--text);
  border-color: var(--muted);
}

.cat-star.is-on {
  color: var(--amber);
  border-color: rgba(255, 255, 255, 0.45);
}

.cat-star.is-on svg {
  fill: currentColor;
}

.cat-title {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font: 500 14px/1.35 var(--sans);
  color: var(--text);
  overflow-wrap: anywhere;
  transition: color 0.15s;
}

.cat-meta {
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--dim);
}

.cat-skeleton .cat-poster {
  animation: kadr-pulse 1.8s ease-in-out infinite;
}

.cat-skeleton .skeleton-line {
  margin: 0;
}

.chip-static {
  display: inline-block;
  margin: 0 6px 6px 0;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--muted);
  font: 10px/1.2 var(--mono);
  pointer-events: none;
}

.cat-detail {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.cat-back {
  align-self: flex-start;
}

.cat-hero {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.cat-hero-bg {
  position: absolute;
  inset: 0;
  background-position: center 20%;
  background-size: cover;
  opacity: 0.22;
  filter: saturate(0.7);
  pointer-events: none;
}

.cat-hero-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, var(--panel) 12%, rgba(20, 23, 20, 0.82) 55%, rgba(20, 23, 20, 0.55));
}

.cat-hero-wrap {
  position: relative;
  display: flex;
  gap: 24px;
  padding: 24px;
}

.cat-hero-poster {
  position: relative;
  display: grid;
  place-items: center;
  flex: none;
  width: 208px;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
}

.cat-hero-poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cat-hero-poster:not(.is-fallback) .poster-letter {
  visibility: hidden;
}

.cat-hero-poster .poster-letter {
  font-size: 34px;
}

.cat-hero-main {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}

.cat-hero-name {
  font: 600 clamp(24px, 3vw, 36px)/1.05 var(--sans);
  letter-spacing: -0.02em;
}

.cat-hero-original {
  font-size: 11px;
  letter-spacing: 0.06em;
  color: var(--dim);
}

.cat-hero-meta {
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.cat-hero-genres {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  margin-top: 2px;
}

.cat-hero-tagline {
  font: 500 15px/1.4 var(--sans);
  color: var(--amber);
}

.cat-hero-overview {
  max-width: 74ch;
  font-size: 14px;
  line-height: 1.6;
  color: var(--muted);
}

.cat-hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 6px;
}

.cat-title-fav svg {
  width: 16px;
  height: 16px;
}

.cat-title-fav.is-on svg {
  fill: currentColor;
}

.cat-hero-skeleton {
  display: flex;
  gap: 24px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--panel);
}

.cat-hero-skeleton .cat-hero-poster {
  animation: kadr-pulse 1.8s ease-in-out infinite;
}

.cat-hero-lines {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1;
  padding-top: 8px;
}

.cat-hero-lines .skeleton-line {
  margin: 0;
}

.cat-releases-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--line);
}

.cat-releases-head h3 {
  font: 600 13px/1 var(--mono);
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.cat-releases-head span {
  font-size: 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}

.cat-release-list {
  display: flex;
  flex-direction: column;
  border-top: 1px solid var(--line);
}

.cat-release {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 12px 18px;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.cat-release-main {
  min-width: 0;
}

.cat-release-title {
  overflow: hidden;
  font: 500 13px/1.4 var(--sans);
  color: var(--text);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-release-sub {
  margin-top: 3px;
  overflow: hidden;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--dim);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-release .badges {
  margin: 0;
}

.cat-watch {
  height: 32px;
  padding: 0 14px;
  font-size: 12px;
}

.cat-watch svg {
  width: 14px;
  height: 14px;
}

.cat-release-skeleton {
  grid-template-columns: 1fr;
}

.cat-releases-state {
  margin: 0;
}

.cat-best {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 18px;
  margin-bottom: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.07), rgba(255, 255, 255, 0.03));
  border: 1px solid var(--line-2);
  border-radius: 12px;
}

.cat-best-body {
  flex: 1;
  min-width: 0;
}

.cat-best-label {
  display: inline-block;
  padding: 4px 7px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  color: #fff;
  font: 600 10px/1 var(--mono);
  letter-spacing: 0.16em;
}

.cat-best-name {
  margin-top: 9px;
  font: 600 16px/1.3 var(--sans);
}

.cat-best-file {
  margin-top: 4px;
  overflow: hidden;
  font-size: 10px;
  color: var(--dim);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cat-best-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.cat-best-row .badges {
  margin: 0;
}

.cat-best-reason {
  margin-top: 7px;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}

.cat-best-watch {
  flex: none;
  height: 40px;
  padding: 0 20px;
  font-size: 13px;
}

.cat-subhead {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 2px 0 6px;
}

.cat-subhead h4 {
  font: 600 12px/1 var(--sans);
  color: var(--muted);
}

.cat-subhead span {
  font-size: 10px;
  color: var(--dim);
}

@media (max-width: 720px) {
  .cat-hero-wrap {
    flex-direction: column;
    padding: 18px;
  }

  .cat-hero-poster {
    width: 140px;
  }

  .cat-best {
    flex-direction: column;
    align-items: stretch;
  }

  .cat-best-watch {
    width: 100%;
  }

  .cat-release {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .cat-release .badges {
    display: none;
  }

  .cat-release-title {
    white-space: normal;
  }
}

/* ── Телеканалы (IPTV) ─────────────────────────────── */

.tv-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 18px 24px;
  margin-bottom: 16px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.tv-tools {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.tv-search {
  position: relative;
  display: block;
}

.tv-search .search-icon {
  position: absolute;
  top: 50%;
  left: 12px;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  color: var(--dim);
  pointer-events: none;
}

.tv-search input {
  width: 210px;
  height: 38px;
  padding: 0 12px 0 38px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
  color: var(--text);
  font: 500 14px/1 var(--sans);
  transition: border-color 0.15s, background 0.15s;
}

.tv-search input::placeholder {
  color: var(--dim);
  font-weight: 400;
}

.tv-search input:focus {
  outline: none;
  border-color: var(--amber);
  background: #202325;
}

.tv-groups {
  margin-bottom: 18px;
}

.tv-chip-count {
  margin-left: 4px;
  color: var(--dim);
  font-size: 10px;
}

.chip.is-active .tv-chip-count {
  color: var(--amber);
}

.tv-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr));
  gap: 14px;
}

.tv-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 10px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: inherit;
  text-align: left;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.tv-card:hover {
  background: var(--panel-2);
  border-color: var(--line-2);
}

.tv-card:focus-visible {
  outline: 1px solid var(--amber);
  outline-offset: 2px;
}

.tv-logo {
  position: relative;
  display: grid;
  place-items: center;
  height: 72px;
  overflow: hidden;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.tv-logo img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  padding: 8px;
  background: #fff;
}

.tv-logo.is-fallback .tv-letter {
  font-size: 22px;
}

.tv-letter {
  font: 600 20px/1 var(--mono);
  color: var(--muted);
}

.tv-name {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  font: 500 13px/1.35 var(--sans);
  color: var(--text);
  overflow-wrap: anywhere;
}

.tv-sub {
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--dim);
}

.tv-skeleton {
  cursor: default;
  animation: kadr-pulse 1.8s ease-in-out infinite;
}

.tv-skeleton .tv-logo {
  border: 0;
}

.tv-skeleton .skeleton-line {
  margin: 0;
}

.tv-sources {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font: 10px/1.4 var(--mono);
  color: var(--dim);
}

.tv-source::before {
  content: "●";
  margin-right: 5px;
  color: var(--line-2);
}

.tv-source.is-ok::before {
  color: var(--green, #6fbf73);
}

.tv-source.is-bad {
  color: #cf7b6b;
}

.tv-note {
  margin: 0 0 14px;
  padding: 10px 12px;
  border: 1px solid rgba(207, 123, 107, 0.35);
  border-radius: var(--r);
  background: rgba(207, 123, 107, 0.07);
  font: 11px/1.5 var(--mono);
  color: #cf7b6b;
}

.tv-note code {
  color: var(--text);
}

.tv-source.is-bad::before {
  color: #cf7b6b;
}

.tv-code {
  margin: 0 0 16px;
  padding: 12px 14px;
  background: #17191b;
  border: 1px solid var(--line);
  border-radius: var(--r);
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
}

.tv-watch {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tv-stage {
  position: relative;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #000;
  border: 1px solid var(--line);
  border-radius: var(--r);
  aspect-ratio: 16 / 9;
  max-height: 74vh;
}

.tv-video {
  width: 100%;
  height: 100%;
  background: #000;
}

.tv-status {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  max-width: min(90%, 520px);
  padding: 6px 10px;
  background: rgba(10, 12, 10, 0.86);
  border: 1px solid var(--line-2);
  border-radius: 2px;
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-align: center;
  backdrop-filter: blur(4px);
  pointer-events: none;
}

.tv-status[data-tone="error"] {
  border-color: rgba(207, 123, 107, 0.5);
  color: #e2a093;
}

.tv-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}

.tv-bar-title {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
  min-width: 0;
}

.tv-bar-name {
  font: 600 17px/1.25 var(--sans);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.tv-bar-actions {
  display: flex;
  gap: 8px;
  flex: none;
}

.tv-hint {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  max-width: 78ch;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.6;
}

.tv-hint svg {
  flex: none;
  width: 16px;
  height: 16px;
  margin-top: 2px;
  color: var(--amber);
}

/* ── Библиотека ─────────────────────────────────────── */

.lib-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 18px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.lib-intro {
  max-width: 72ch;
}

.lib-actions {
  display: flex;
  gap: 8px;
  flex: none;
}

.lib-list {
  border-top: 1px solid var(--line-2);
}

.lib-row {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 104px 150px;
  gap: 18px;
  align-items: center;
  padding: 14px 8px;
  border-bottom: 1px solid var(--line);
  transition: background 0.12s;
}

.lib-row:hover {
  background: var(--panel);
}

.lib-poster {
  width: 56px;
  height: 78px;
}

.lib-title {
  padding: 0;
  background: none;
  border: none;
  text-align: left;
  color: var(--text);
  font: 600 16px/1.3 var(--sans);
  cursor: pointer;
  overflow-wrap: anywhere;
}

.lib-title:hover {
  color: var(--amber);
}

.lib-meta {
  margin: 4px 0 8px;
  font-size: 10px;
  color: var(--dim);
}

.lib-file {
  margin-top: 4px;
  font-size: 9px;
  color: var(--dim);
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.progress-line {
  position: relative;
  height: 2px;
  overflow: hidden;
  background: var(--line);
}

.progress-line span {
  display: block;
  height: 100%;
  background: var(--amber);
}

.lib-sub {
  margin-top: 6px;
  font-size: 10px;
  color: var(--muted);
}

.lib-state {
  display: flex;
  justify-content: flex-end;
}

.state-chip {
  padding: 3px 7px;
  border: 1px solid var(--line-2);
  border-radius: 2px;
  font: 9px/1.4 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}

.tone-ok {
  color: var(--green);
  border-color: rgba(147, 178, 126, 0.4);
}

.tone-wait {
  color: var(--amber);
  border-color: rgba(255, 255, 255, 0.4);
}

.tone-bad {
  color: var(--red);
  border-color: rgba(208, 96, 74, 0.4);
}

.lib-actions {
  justify-content: flex-end;
}

.lib-skeleton {
  opacity: 0.6;
}

.lib-skeleton .skeleton-line {
  animation: kadr-pulse 1.8s ease-in-out infinite;
}

.magnet-panel {
  display: grid;
  grid-template-columns: 1.4fr 1fr auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 18px;
  padding: 16px;
  background: var(--panel);
  border: 1px solid var(--line-2);
  border-radius: var(--r);
}

.magnet-panel[hidden] {
  display: none;
}

.magnet-actions {
  display: flex;
  gap: 6px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.field-label {
  font-size: 9px;
  letter-spacing: 0.13em;
  color: var(--dim);
}

.field input,
.field select {
  width: 100%;
  height: 38px;
  padding: 0 10px;
  background: #1a1d1f;
  border: 1px solid var(--line);
  border-radius: 2px;
  color: var(--text);
  font: 13px/1 var(--sans);
}

.field input::placeholder {
  color: var(--dim);
}

.field input:focus {
  outline: none;
  border-color: var(--amber);
}

/* ── Инспектор раздачи ─────────────────────────────── */

.scrim {
  position: fixed;
  inset: 0;
  z-index: 40;
  background: rgba(3, 4, 3, 0.64);
  opacity: 0;
  transition: opacity 0.2s;
}

.scrim.is-open {
  opacity: 1;
}

.scrim[hidden] {
  display: none;
}

.drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 50;
  width: min(620px, 100vw);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: #1a1d1f;
  border-left: 1px solid var(--line-2);
  opacity: 0;
  transform: translateX(26px);
  transition: transform 0.22s ease, opacity 0.22s ease;
}

.drawer.is-open {
  opacity: 1;
  transform: none;
}

.drawer[hidden] {
  display: none;
}

.drawer-head {
  flex: none;
  padding: 20px 24px 16px;
  border-bottom: 1px solid var(--line);
}

.drawer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.drawer-top-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.drawer h2 {
  margin: 10px 0 6px;
  font: 600 20px/1.3 var(--sans);
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
}

.drawer-meta {
  margin-bottom: 10px;
  font-size: 10px;
  color: var(--muted);
}

.drawer-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 0;
  margin-bottom: 8px;
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--amber);
}

.drawer-tags span + span::before {
  content: "·";
  margin: 0 8px;
  color: var(--dim);
}

.drawer-synopsis {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 3;
  margin-bottom: 8px;
  font: 12px/1.55 var(--sans);
  color: var(--muted);
}

.drawer-origin {
  margin-bottom: 8px;
  font-size: 9px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.drawer-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.drawer-poster {
  display: block;
  width: 40px;
  height: 56px;
  margin-left: auto;
  overflow: hidden;
  border: 1px solid var(--line-2);
}

.drawer-poster img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.drawer-poster.is-empty {
  display: none;
}

.drawer-body {
  flex: 1;
  overflow: auto;
  padding: 16px 24px 28px;
}

.drawer-switch {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line);
}

.drawer-switch > .mono {
  font-size: 9px;
}

.drawer-tree {
  min-height: 120px;
}

.tree-summary {
  padding: 10px 4px 6px;
  font-size: 9px;
  color: var(--dim);
  letter-spacing: 0.04em;
}

.season {
  border-bottom: 1px solid var(--line);
}

.season summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 4px;
  list-style: none;
  cursor: pointer;
}

.season summary::-webkit-details-marker,
.extras summary::-webkit-details-marker {
  display: none;
}

.season-code {
  padding: 2px 5px;
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 2px;
  font-size: 10px;
  font-weight: 600;
  color: var(--amber);
}

.season-name {
  font: 600 14px/1.2 var(--sans);
}

.season-meta {
  margin-left: auto;
  font-size: 9px;
  color: var(--dim);
  white-space: nowrap;
}

.season-chevron {
  display: flex;
  width: 16px;
  height: 16px;
  color: var(--dim);
  transition: transform 0.18s;
}

.season-chevron svg {
  width: 16px;
  height: 16px;
}

.season[open] > summary .season-chevron {
  transform: rotate(180deg);
}

.episodes {
  padding-bottom: 8px;
}

.episode {
  position: relative;
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 28px;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 9px 6px;
  background: none;
  border: none;
  border-top: 1px solid var(--line);
  text-align: left;
  color: var(--text);
  cursor: pointer;
  transition: background 0.12s;
}

.episode:hover {
  background: var(--panel);
}

.ep-code {
  font-size: 10px;
  color: var(--muted);
}

.ep-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.ep-name {
  font: 13px/1.35 var(--sans);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ep-size {
  font-size: 9px;
  color: var(--dim);
}

.ep-play {
  display: flex;
  justify-content: flex-end;
  color: var(--dim);
}

.ep-play svg {
  width: 13px;
  height: 13px;
}

.episode:hover .ep-play {
  color: var(--amber);
}

.episode.is-done .ep-code {
  color: var(--green);
}

.ep-progress {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 1px;
  background: var(--amber);
}

.feature {
  display: flex;
  align-items: center;
  gap: 16px;
  width: 100%;
  padding: 18px 6px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--line);
  text-align: left;
  color: var(--text);
  cursor: pointer;
}

.feature:hover {
  background: var(--panel);
}

.feature-play {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  flex: none;
  background: var(--amber-soft);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 2px;
  color: var(--amber);
}

.feature-play svg {
  width: 18px;
  height: 18px;
}

.feature-body {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.feature-body strong {
  font: 600 15px/1.35 var(--sans);
  overflow-wrap: anywhere;
}

.feature-body > .mono {
  font-size: 9px;
  color: var(--dim);
}

.loose-list {
  border-bottom: 1px solid var(--line);
}

.extras {
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
}

.extras summary {
  display: flex;
  align-items: center;
  padding: 4px 6px;
  font: 11px/1.4 var(--mono);
  color: var(--muted);
  list-style: none;
  cursor: pointer;
}

.extras summary .season-chevron {
  margin-left: auto;
}

.extra-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 6px;
  border-top: 1px solid var(--line);
  font-size: 9px;
  color: var(--dim);
}

.extra-row span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.paths {
  display: flex;
  flex-direction: column;
}

.path-group {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.path-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 4px 6px;
  font-size: 10px;
  color: var(--muted);
}

.path-head svg {
  width: 14px;
  height: 14px;
  flex: none;
  color: var(--dim);
}

.path-head span:nth-child(2) {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.path-count {
  margin-left: auto;
  padding: 0 4px;
  border: 1px solid var(--line);
  color: var(--dim);
}

.path-file {
  display: grid;
  grid-template-columns: 44px minmax(0, 1fr) 80px;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 7px 4px;
  background: none;
  border: none;
  border-top: 1px solid var(--line);
  text-align: left;
  color: var(--text);
  font: 12px/1.3 var(--sans);
  cursor: pointer;
}

.path-file:hover:not(:disabled) {
  background: var(--panel);
}

.path-file.is-muted {
  color: var(--dim);
  cursor: default;
}

.path-id {
  font-size: 9px;
  color: var(--dim);
}

.path-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.path-size {
  font-size: 9px;
  text-align: right;
  color: var(--dim);
}

.drawer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.drawer-footer .mono {
  overflow: hidden;
  font-size: 9px;
  color: var(--dim);
  text-overflow: ellipsis;
}

.drawer-loading {
  padding: 26px 4px;
}

.drawer-loading .progress-line {
  margin: 14px 0;
}

.drawer-loading .hint {
  margin-top: 12px;
}

/* ── Плеер ─────────────────────────────────────────── */

.player {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: flex;
  flex-direction: column;
  background: #151718;
}

.player[hidden] {
  display: none;
}

.player-shell {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.player-head {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  flex: none;
  padding: 14px clamp(16px, 3vw, 32px);
  background: var(--ink);
  border-bottom: 1px solid var(--line);
}

.player-heading {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.player-heading h2 {
  font: 600 17px/1.3 var(--sans);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-sub {
  font-size: 9px;
  color: var(--dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.player-tools {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.resume-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  flex: none;
  padding: 8px clamp(16px, 3vw, 32px);
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  font: 12px/1.3 var(--sans);
  color: var(--muted);
}

.resume-strip[hidden] {
  display: none;
}

.resume-strip strong {
  font-weight: 500;
  color: var(--amber);
}

.player-stage {
  position: relative;
  display: flex;
  flex: 1;
  align-items: center;
  justify-content: center;
  min-height: 0;
  background: #000;
}

.player-stage video {
  width: 100%;
  height: 100%;
  max-height: 100%;
  background: #000;
  object-fit: contain;
}

.buffer {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 20px;
  background: rgba(7, 9, 7, 0.88);
  text-align: center;
  pointer-events: none;
  transition: opacity 0.2s;
}

.buffer.is-hidden {
  opacity: 0;
}

.buffer.is-error .buffer-label {
  color: var(--red);
}

.buffer-label {
  font: 500 10px/1 var(--mono);
  letter-spacing: 0.22em;
  color: var(--muted);
}

.buffer-value {
  font: 600 28px/1 var(--mono);
  color: var(--amber);
}

.buffer-meta {
  max-width: 46ch;
  font-size: 10px;
  line-height: 1.5;
  color: var(--dim);
}

.unmute-hint {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 3;
  padding: 10px 14px;
  border: 1px solid rgba(214, 164, 74, 0.55);
  border-radius: 999px;
  background: rgba(10, 12, 10, 0.74);
  color: var(--amber);
  font: 600 11px/1 var(--mono);
  letter-spacing: 0.12em;
  cursor: pointer;
  backdrop-filter: blur(6px);
}

.unmute-hint:hover {
  border-color: var(--amber);
}

.player-tools .btn[data-subs].is-active {
  color: var(--amber);
  border-color: rgba(255, 255, 255, 0.45);
}

.player-tools .btn[data-subs].is-open {
  background: var(--amber-soft);
}

.player-stage video::cue {
  font-size: var(--cue-size, clamp(16px, 2.5vw, 34px));
  color: #ffffff;
  background: rgba(8, 10, 8, 0.72);
  font-family: var(--sans);
  line-height: 1.32;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.85);
}

.subs-panel {
  position: absolute;
  top: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 4;
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100% - 28px));
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 15, 13, 0.94);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(10px);
  overflow: hidden;
}

.subs-panel[hidden] {
  display: none;
}

.subs-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex: none;
  padding: 8px 8px 8px 14px;
  border-bottom: 1px solid var(--line);
}

.subs-body {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  padding: 12px 14px 16px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.subs-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.subs-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
}

.subs-heading .mono {
  font-size: 9px;
}

.subs-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.subs-row {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font: 12px/1.3 var(--sans);
  text-align: left;
  cursor: pointer;
}

.subs-row:hover {
  background: var(--panel-2);
  color: var(--text);
}

.subs-row.is-active {
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
}

.subs-row.is-muted {
  opacity: 0.65;
}

.subs-mark {
  flex: none;
  width: 8px;
  height: 8px;
  border: 1px solid var(--line-2);
  border-radius: 50%;
}

.subs-row.is-active .subs-mark {
  border-color: var(--amber);
  background: var(--amber);
}

.subs-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.subs-tag {
  flex: none;
  padding: 2px 5px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  border-radius: 3px;
  color: var(--amber);
  font: 500 8px/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.subs-auto-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 4px 10px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--panel);
}

.subs-auto-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.subs-auto-info strong {
  font: 500 12px/1.3 var(--sans);
  color: var(--text);
}

.subs-state {
  font: 10px/1.35 var(--mono);
  color: var(--dim);
}

.subs-state.is-done {
  color: var(--green);
}

.subs-state.is-error {
  color: var(--red);
}

.subs-bar {
  grid-column: 1 / -1;
  height: 3px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--line);
}

.subs-bar span {
  display: block;
  height: 100%;
  background: var(--amber);
  transition: width 0.3s;
}

.subs-note {
  font: 11px/1.5 var(--sans);
  color: var(--dim);
}

.subs-tune {
  gap: 10px;
  border-top: 1px solid var(--line);
  padding-top: 12px;
}

.subs-tune-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.subs-stepper {
  display: flex;
  align-items: center;
  gap: 4px;
}

.subs-stepper .btn.is-active {
  color: var(--amber);
  border-color: rgba(255, 255, 255, 0.45);
  background: var(--amber-soft);
}

.subs-lang {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--line);
}

.subs-stepper .mono {
  min-width: 58px;
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.subs-status {
  font: 10px/1.4 var(--mono);
  color: var(--dim);
}

.subs-status.is-error {
  color: var(--red);
}

.player-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 20px;
  flex: none;
  padding: 10px clamp(16px, 3vw, 32px);
  background: var(--ink);
  border-top: 1px solid var(--line);
}

.ep-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.counter {
  font-size: 10px;
  color: var(--muted);
}

.player-foot-right {
  display: flex;
  align-items: center;
  gap: 18px;
}

.player-foot .check {
  margin-bottom: 0;
}

.player-foot [data-speed] {
  font-size: 9px;
  color: var(--dim);
}

.player-foot [data-audio-note] {
  font-size: 9px;
  letter-spacing: 0.04em;
  color: var(--dim);
}

/* ── Настройки ─────────────────────────────────────── */

.settings {
  display: flex;
  flex-direction: column;
  gap: 22px;
  max-width: 960px;
}

.demo-note {
  align-self: flex-start;
  padding: 6px 9px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--amber);
}

.settings-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

.form-section {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.form-section-wide {
  grid-column: 1 / -1;
}

.form-section-head h2 {
  margin-top: 4px;
  font: 600 18px/1.2 var(--sans);
}

.form-section .hint {
  padding-top: 2px;
}

.field-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.field-with-action {
  display: flex;
  gap: 6px;
}

.field-with-action input {
  flex: 1;
  min-width: 0;
}

.form-actions {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  padding-top: 16px;
  border-top: 1px solid var(--line-2);
}

.form-note {
  margin-left: auto;
  font-size: 9px;
  color: var(--dim);
}

.status-panel {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding-top: 18px;
  border-top: 1px solid var(--line-2);
}

.status-row {
  display: grid;
  grid-template-columns: 10px 120px 1fr;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font: 13px/1.3 var(--sans);
}

.status-row .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dim);
}

.status-row .dot.is-ok {
  background: var(--green);
}

.status-row .dot.is-bad {
  background: var(--red);
}

.status-row .mono {
  font-size: 10px;
  text-align: right;
  color: var(--dim);
  overflow-wrap: anywhere;
}

.status-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 6px;
}

.status-actions .mono {
  font-size: 9px;
  overflow-wrap: anywhere;
}

.safety .hint {
  margin: 0;
}

/* ── Тост ───────────────────────────────────────────── */

.toast-stack {
  position: fixed;
  left: calc(var(--rail) + 20px);
  bottom: 20px;
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: min(380px, calc(100vw - var(--rail) - 40px));
}

@media (min-width: 721px) {
  body.drawer-open .toast-stack {
    max-width: max(240px, min(380px, calc(100vw - var(--rail) - 660px)));
  }
}

.toast {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 11px 14px;
  background: #202325;
  border: 1px solid var(--line-2);
  border-left: 2px solid var(--amber);
  border-radius: 2px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  font: 12px/1.45 var(--sans);
  color: var(--text);
  cursor: pointer;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.2s, transform 0.2s;
}

.toast.is-in {
  opacity: 1;
  transform: none;
}

.toast-error {
  border-left-color: var(--red);
}

.toast-mark {
  width: 6px;
  height: 6px;
  margin-top: 5px;
  flex: none;
  background: var(--amber);
}

.toast-error .toast-mark {
  background: var(--red);
}

/* ── Адаптив ────────────────────────────────────────── */

@media (max-width: 1080px) {
  .release-head,
  .release {
    grid-template-columns: 44px minmax(0, 1fr) 78px 58px 110px;
    gap: 12px;
  }

  .release-head span:nth-child(5),
  .release-head span:nth-child(6),
  .release-indexer,
  .release-age {
    display: none;
  }

  .lib-row {
    grid-template-columns: 56px minmax(0, 1fr) auto;
  }

  .lib-state {
    display: none;
  }

  .settings-form {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 860px) {
  .release-head,
  .release {
    grid-template-columns: 44px minmax(0, 1fr) 96px;
    grid-template-areas: "poster main actions";
  }

  .release .poster {
    grid-area: poster;
  }

  .release-main {
    grid-area: main;
  }

  .release-actions {
    grid-area: actions;
  }

  .release-size,
  .release-seed,
  .release-head {
    display: none;
  }

  .release-mobile {
    display: block;
    margin-top: 6px;
    font-size: 9px;
    color: var(--dim);
  }

  .release-actions {
    flex-direction: column;
    align-items: flex-end;
    gap: 2px;
  }

  .lib-head {
    flex-direction: column;
  }

  .lib-row {
    grid-template-columns: 48px minmax(0, 1fr);
    grid-template-areas: "poster main" "poster actions";
    row-gap: 8px;
  }

  .lib-poster {
    grid-area: poster;
    width: 48px;
    height: 68px;
  }

  .lib-main {
    grid-area: main;
  }

  .lib-actions {
    grid-area: actions;
    justify-content: flex-start;
  }

  .lib-row .lib-actions {
    padding-left: 66px;
  }

  .magnet-panel {
    grid-template-columns: 1fr;
  }

  .form-actions .btn {
    flex: 1;
  }

  .form-note {
    width: 100%;
    margin-left: 0;
  }
}

@media (max-width: 720px) {
  :root {
    --rail: 0px;
    --gutter: 16px;
  }

  .rail {
    inset: auto 0 0 0;
    width: auto;
    height: 62px;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 0 14px;
    border-top: 1px solid var(--line);
    border-right: none;
    background: #17191b;
  }

  .brand {
    flex-direction: row;
    gap: 0;
    padding: 0;
  }

  .brand::before {
    margin-right: 8px;
  }

  .brand-mark {
    writing-mode: horizontal-tb;
    font-size: 11px;
    letter-spacing: 0.28em;
  }

  .brand-sub {
    display: none;
  }

  .rail-nav {
    flex-direction: row;
    gap: 2px;
  }

  .rail-nav a {
    width: 44px;
    height: 44px;
  }

  .rail-nav a.is-active::before {
    left: 50%;
    top: auto;
    bottom: 0;
    width: 18px;
    height: 2px;
    transform: translateX(-50%);
  }

  .rail-foot {
    display: none;
  }

  .main {
    margin-left: 0;
    padding-bottom: 62px;
  }

  .topbar {
    padding: 12px var(--gutter) 10px;
  }

  .topbar h1 {
    font-size: 20px;
  }

  .conn {
    padding: 0 5px;
  }

  .conn-label {
    display: none;
  }

  .view {
    padding: 18px var(--gutter) 40px;
  }

  .popular-head {
    align-items: flex-start;
  }

  .popular-grid {
    grid-template-columns: repeat(auto-fill, minmax(112px, 1fr));
    gap: 18px 12px;
  }

  .tv-head {
    align-items: flex-start;
  }

  .tv-tools {
    width: 100%;
  }

  .tv-search {
    flex: 1;
  }

  .tv-search input {
    width: 100%;
  }

  .tv-grid {
    grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
    gap: 10px;
  }

  .tv-logo {
    height: 60px;
  }

  .tv-bar-actions {
    width: 100%;
  }

  .tv-bar-actions .btn {
    flex: 1;
  }

  .tv-stage {
    aspect-ratio: 16 / 10;
  }

  .pop-title {
    font-size: 13px;
  }

  .search-form {
    flex-wrap: wrap;
  }

  .search-form .btn-primary {
    width: 100%;
  }

  .search-field input {
    height: 46px;
    font-size: 15px;
  }

  .filters {
    gap: 10px 16px;
  }

  .result-count {
    width: 100%;
    margin-left: 0;
    margin-bottom: 0;
  }

  .drawer {
    width: 100vw;
    border-left: none;
  }

  .drawer-head {
    padding: 16px var(--gutter) 14px;
  }

  .drawer-body {
    padding: 14px var(--gutter) 24px;
  }

  .drawer h2 {
    font-size: 18px;
  }

  .episode {
    grid-template-columns: 58px minmax(0, 1fr) 24px;
  }

  .player-head {
    flex-wrap: wrap;
    padding: 10px var(--gutter);
  }

  .player-tools .btn span {
    display: none;
  }

  .player-tools .btn {
    padding: 0 8px;
  }

  .player-foot {
    padding: 8px var(--gutter);
  }

  .player-foot-right {
    width: 100%;
    justify-content: space-between;
    gap: 10px;
  }

  .ep-nav {
    width: 100%;
    justify-content: space-between;
    gap: 6px;
  }

  .settings-form {
    gap: 16px;
  }

  .form-section {
    padding: 16px;
  }

  .field-grid {
    grid-template-columns: 1fr;
  }

  .status-row {
    grid-template-columns: 10px 84px 1fr;
  }

  .toast-stack {
    left: 16px;
    right: 16px;
    bottom: 76px;
    max-width: none;
  }

  body.drawer-open .toast-stack {
    max-width: none;
  }
}

@media (max-width: 420px) {
  .segmented button {
    padding: 7px 7px;
    letter-spacing: 0.04em;
  }

  .popular-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .badges {
    gap: 3px;
  }

  .episode {
    grid-template-columns: 52px minmax(0, 1fr) 22px;
  }

  .tv-grid {
    grid-template-columns: 1fr 1fr;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* ══ Powerfilm: тёмная тема в духе Lampa ═══════════════ */

.brand {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 10px;
  flex: none;
  padding: 0;
  text-decoration: none;
}

.brand::before {
  display: none;
}

.brand-logo {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  background: #fff;
  border-radius: 8px;
}

.brand-logo svg {
  width: 18px;
  height: 18px;
  display: block;
}

.brand-name {
  font: 600 17px/1 var(--sans);
  letter-spacing: -0.015em;
  color: #fff;
}

.topnav {
  display: flex;
  align-items: center;
  gap: 2px;
  min-width: 0;
  overflow-x: auto;
  scrollbar-width: none;
}

.topnav::-webkit-scrollbar {
  display: none;
}

.topnav a {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  flex: none;
  height: 34px;
  padding: 0 13px;
  border-radius: 9px;
  color: var(--muted);
  font: 500 13.5px/1 var(--sans);
  text-decoration: none;
  white-space: nowrap;
  transition: color 0.15s, background 0.15s;
}

.topnav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.topnav a.is-active {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.topnav .nav-badge {
  position: static;
  display: inline-block;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  border-radius: 8px;
  background: #fff;
  color: #1d1f20;
  font: 600 10px/16px var(--sans);
  text-align: center;
}

.topbar-meta {
  gap: 4px;
}

.conn {
  height: 32px;
  border-radius: 8px;
  letter-spacing: 0.06em;
}

.page-head {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding: 26px var(--gutter) 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.page-head h1 {
  font: 600 26px/1.15 var(--sans);
  letter-spacing: -0.02em;
}

body[data-route="home"] .page-head {
  display: none;
}

.view {
  padding: 24px var(--gutter) 90px;
}

body[data-route="home"] .view {
  padding-top: 14px;
}

.home-root {
  display: flex;
  flex-direction: column;
  gap: 36px;
}

.shelf {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.shelf-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
}

.shelf-title {
  font: 600 19px/1.2 var(--sans);
  letter-spacing: -0.01em;
}

.shelf-more {
  flex: none;
  height: 28px;
  padding: 0 13px;
  background: rgba(255, 255, 255, 0.08);
  border: 0;
  border-radius: 14px;
  color: #fff;
  font: 500 12px/1 var(--sans);
  cursor: pointer;
  transition: background 0.15s;
}

.shelf-more:hover {
  background: rgba(255, 255, 255, 0.16);
}

.shelf-row {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(122px, 10.6vw, 172px);
  gap: 14px;
  padding: 2px 2px 10px;
  margin: 0 -2px;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x proximity;
  overscroll-behavior-x: contain;
  scrollbar-width: none;
}

.shelf-row::-webkit-scrollbar {
  display: none;
}

.pf-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
  padding: 0;
  background: none;
  border: 0;
  color: inherit;
  text-align: left;
  cursor: pointer;
  scroll-snap-align: start;
}

.pf-poster {
  position: relative;
  display: grid;
  place-items: center;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  background: var(--panel-2);
  border-radius: 12px;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}

.pf-poster img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.pf-poster:not(.is-fallback) .poster-letter {
  visibility: hidden;
}

.pf-poster .poster-letter {
  font-size: 26px;
}

.pf-rating {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 7px;
  background: rgba(20, 22, 23, 0.85);
  border-radius: 7px;
  color: #fff;
  font: 600 11px/1 var(--sans);
}

.pf-rating.is-high {
  color: #8ee08e;
}

.pf-name {
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  color: #fff;
  font: 500 13.5px/1.3 var(--sans);
}

.pf-year {
  color: var(--dim);
  font: 400 12px/1.2 var(--sans);
}

.pf-card:hover .pf-poster,
.pf-card:focus-visible .pf-poster {
  transform: scale(1.04);
  box-shadow: 0 10px 26px rgba(0, 0, 0, 0.45);
}

.pf-card:focus-visible {
  outline: none;
}

.pf-card:focus-visible .pf-poster {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.pf-card.pf-skeleton {
  pointer-events: none;
}

.home-root .state {
  max-width: 640px;
}

/* Карточки каталога и популярного — те же постеры, что на полках */

.pop-poster,
.cat-poster {
  border: 0;
  border-radius: 12px;
}

.pop-card:hover .pop-poster,
.cat-card:hover .cat-poster {
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.4);
}

.pop-card:focus-visible .pop-poster,
.cat-open:focus-visible {
  outline: 3px solid #fff;
  outline-offset: 2px;
}

.pop-card:hover .pop-title,
.cat-card:hover .cat-title {
  color: #fff;
}

.pop-rating,
.cat-rating {
  border-radius: 7px;
  font-weight: 600;
}

.btn,
.chip,
.segmented,
.release-card,
.lib-row,
.tv-card,
.settings-card,
.cat-release {
  border-radius: 10px;
}

.btn-primary {
  color: #1d1f20;
}

.btn-primary:hover {
  background: #e6e6e6;
  border-color: #e6e6e6;
}

/* Сегменты — пилюли как в Lampa */

.segmented {
  gap: 3px;
  padding: 3px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 11px;
}

.segmented button {
  border: 0;
  border-radius: 8px;
  padding: 7px 13px;
  color: var(--muted);
  font: 500 13px/1 var(--sans);
  letter-spacing: 0;
  text-transform: none;
  transition: color 0.15s, background 0.15s;
}

.segmented button:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}

.segmented button.is-active {
  color: #1d1f20;
  background: #fff;
  border-bottom-color: transparent;
}

.cat-head {
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 0;
  border-bottom: 0;
}

select {
  border-radius: 8px;
}

.variant-select {
  background: rgba(255, 255, 255, 0.06);
  border-color: transparent;
  border-radius: 8px;
}

.variant-select:hover {
  background: rgba(255, 255, 255, 0.1);
}

.cat-genres {
  flex-wrap: wrap;
  overflow-x: visible;
  padding-bottom: 0;
  scrollbar-width: none;
}

@media (max-width: 900px) {
  .topbar-inner {
    flex-wrap: wrap;
    min-height: 0;
    padding: 10px 0 8px;
    gap: 10px 14px;
  }

  .brand {
    order: 0;
  }

  .topnav {
    order: 2;
    width: 100%;
    margin: 0 calc(var(--gutter) * -1);
    padding: 0 var(--gutter);
  }

  .topbar-meta {
    order: 1;
    margin-left: auto;
  }

  .conn {
    padding: 0 6px;
  }

  .conn-label {
    display: none;
  }

  .page-head {
    padding-top: 18px;
  }

  .page-head h1 {
    font-size: 22px;
  }

  .view {
    padding-bottom: 60px;
  }

  .home-root {
    gap: 28px;
  }

  .shelf-row {
    grid-auto-columns: clamp(120px, 38vw, 168px);
    gap: 12px;
  }

  .shelf-title {
    font-size: 17px;
  }
}

/* ── Вход ───────────────────────────────────────────── */

.auth-body {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 24px;
  background:
    radial-gradient(900px 420px at 50% -10%, rgba(255, 255, 255, 0.06), transparent 70%),
    var(--ink);
}

.auth-card {
  width: min(380px, 100%);
  padding: 30px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 16px;
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.auth-head {
  margin-top: 26px;
}

.auth-head h1 {
  margin-top: 6px;
  font-size: 28px;
  letter-spacing: -0.02em;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 22px;
}

.auth-form .field input {
  height: 44px;
  font-size: 15px;
}

.auth-submit {
  height: 44px;
  margin-top: 4px;
  width: 100%;
}

.auth-error {
  color: var(--red);
  font-size: 13px;
}

.auth-note {
  margin-top: 18px;
  color: var(--dim);
  font-size: 12px;
  line-height: 1.5;
}

.auth-code {
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line);
}

.auth-code-toggle {
  padding: 0;
  border: 0;
  background: none;
  color: var(--muted);
  font: 500 11px/1.4 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.auth-code-toggle:hover {
  color: var(--text);
}

.auth-code-panel {
  margin-top: 14px;
  text-align: center;
}

.auth-code-hint {
  color: var(--dim);
  font-size: 12px;
  line-height: 1.5;
}

.auth-code-value {
  margin: 12px 0 6px;
  font-size: 34px;
  letter-spacing: 0.18em;
}

.auth-code-status {
  color: var(--muted);
  font-size: 10px;
  letter-spacing: 0.16em;
}

.auth-code-reset {
  margin-top: 12px;
}

@media (min-width: 1200px) {
  .auth-code-value {
    font-size: 46px;
  }
}

@media (min-width: 1200px) {
  .auth-card {
    width: min(460px, 100%);
    padding: 40px;
  }

  .auth-head h1 {
    font-size: 34px;
  }

  .auth-form .field input,
  .auth-submit {
    height: 54px;
    font-size: 17px;
  }
}

/* ── Аккаунт в настройках ───────────────────────────── */

.account-actions {
  display: flex;
  gap: 10px;
  margin-top: 14px;
}

.account-form {
  display: grid;
  gap: 14px;
  margin-top: 20px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.account-users {
  display: grid;
  gap: 6px;
  margin-top: 16px;
}

.account-user {
  display: grid;
  gap: 6px;
  padding: 8px 10px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: 12px;
  overflow-wrap: anywhere;
}

.account-user-main {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.account-user-main[hidden] {
  display: none;
}

.account-user-actions {
  display: flex;
  gap: 6px;
}

.account-reset {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.account-reset[hidden],
.account-confirm[hidden] {
  display: none;
}

.account-confirm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.account-reset input {
  flex: 1 1 160px;
  min-width: 0;
  height: 32px;
  padding: 0 10px;
  background: var(--ink);
  border: 1px solid var(--line-2);
  border-radius: 6px;
  font: 13px var(--sans);
}

.account-forms {
  display: grid;
  gap: 0;
}

.account-forms .account-form:first-child {
  margin-top: 18px;
}
