/* Наугад — кинорулетка · «Noir» */

:root {
  --bg: #0a0a0b;
  --bg-2: #0e0e10;
  --surface: #141417;
  --surface-2: #1b1b1f;
  --line: rgba(239, 233, 223, .09);
  --line-2: rgba(239, 233, 223, .16);
  --line-3: rgba(239, 233, 223, .30);
  --text: #efe9df;
  --text-2: #aaa59c;
  --text-3: #807b74;
  --accent: #e3a857;
  --accent-hi: #f0bb70;
  --accent-ink: #1a1309;
  --accent-soft: rgba(227, 168, 87, .14);
  --accent-line: rgba(227, 168, 87, .42);
  --neg: #e2826d;
  --neg-text: #e9a493;
  --neg-line: rgba(226, 130, 109, .5);
  --neg-soft: rgba(226, 130, 109, .08);
  --serif: "Cormorant Garamond", "Cormorant", Georgia, "Times New Roman", serif;
  --sans: "Manrope", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --wrap: 1400px;
  --pad: clamp(16px, 4vw, 48px);
  --r: 6px;
  --ease: cubic-bezier(.2, .7, .2, 1);
  --ease-io: cubic-bezier(.65, 0, .35, 1);

  /* type & control scale */
  --fs-cap: 11.5px;
  --fs-xs: 12.5px;
  --fs-sm: 13.5px;
  --fs-md: 15px;
  --h-sm: 32px;
  --h-md: 38px;
  --h-lg: 44px;
  --h-xl: 52px;

  /* reel geometry */
  --rw: clamp(122px, 12.2vw, 184px);
  --rh: calc(var(--rw) * 1.5);
  --rgap: clamp(10px, 1vw, 14px);
  --band: clamp(18px, 1.7vw, 24px);

  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; overflow-anchor: none; }
body, .feed, .sentinel, .feed-end { overflow-anchor: none; }
body {
  position: relative; isolation: isolate;
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
h1, h2, h3, p { margin: 0; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
a { color: inherit; -webkit-tap-highlight-color: transparent; }
svg { display: block; flex: none; }
::selection { background: var(--accent); color: var(--accent-ink); }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 6px; }
.chip:focus-visible, .seg button:focus-visible, .mini-seg button:focus-visible, .ac:focus-visible,
.pill-btn:focus-visible, .icon-btn:focus-visible, .btn:focus-visible, .totop:focus-visible { outline-offset: 2px; }

.wrap { width: 100%; max-width: var(--wrap); margin-inline: auto; padding-inline: var(--pad); }

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 16px; top: -80px; z-index: 100;
  padding: 10px 16px; border-radius: 999px;
  background: var(--text); color: var(--bg); font-weight: 600; text-decoration: none;
  transition: top .2s var(--ease);
}
.skip:focus { top: 12px; }

/* ---------- load bar ---------- */
.loadbar { position: fixed; inset: 0 0 auto; height: 2px; z-index: 60; pointer-events: none; transition: opacity .6s .3s; }
.loadbar span {
  display: block; height: 100%; width: var(--p, 4%);
  background: linear-gradient(90deg, transparent, var(--accent));
  transition: width .4s var(--ease);
}
.loadbar.done { opacity: 0; }

/* ---------- значки ---------- */
/* Один набор линейных значков 24×24 (рисунки — ICONS в app.js). Анимируемые части — класс «a»
   и класс движения «m-…» (раздел «движения значков» ниже): движение играет, пока у хозяина
   значка есть класс is-play — его ставит app.js на наведение, фокус, касание и выбор. */
.ico {
  width: 18px; height: 18px; flex: none; overflow: visible;
  fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round;
}
.ico * { transform-box: fill-box; transform-origin: 50% 50%; }
.ico .f { fill: currentColor; stroke: none; }
.ico .s { fill: currentColor; fill-opacity: var(--fo, .22); }
.ico .s0 { fill: currentColor; fill-opacity: .55; stroke: none; }
.ico .dot { stroke-width: 2.5; }
.ico .hw { stroke-width: 2.6; }
.ico .lw { stroke-width: 1.25; }
.ico .a {
  animation-duration: var(--d, .7s);
  animation-timing-function: var(--e, var(--ease));
  animation-delay: var(--dl, 0s);
  animation-iteration-count: var(--n, 1);
  animation-fill-mode: both;
}
.is-play .ico .a { animation-name: var(--k); }
/* наведение мышью — то же движение, но короче (≤ .8 с у самых длинных) */
.is-quick .ico .a { animation-duration: min(calc(var(--d, .7s) * .75), .8s); animation-delay: calc(var(--dl, 0s) * .75); }
/* части, которых в покое не видно */
.ico .m-run-in, .ico .m-sand-in, .ico .m-glint { opacity: 0; }

/* круглый флаг страны и буква письменности языка — того же размера, что значки */
.flag {
  width: 18px; height: 18px; flex: none;
  clip-path: circle(50%);
  filter: saturate(.72) brightness(.93);
  transition: filter .25s;
}
.flag-ring { fill: none; stroke: rgba(239, 233, 223, .3); stroke-width: 1.4; }
.lg {
  position: relative; flex: none;
  display: inline-grid; place-items: center; width: 20px; height: 20px;
  font: italic 600 13.5px/1 var(--serif); letter-spacing: 0; text-transform: none;
}
.lg::before { content: attr(data-g); }
.lg::after { content: ""; position: absolute; inset: 0; border: 1px solid currentColor; border-radius: 6px; opacity: .35; }
/* надстрочные знаки (Ñ È Ğ Ї) не упираются в рамку, «Th» не слипается */
.lg[data-g="Ñ"], .lg[data-g="È"], .lg[data-g="Ğ"], .lg[data-g="Ї"] { padding-top: 2px; font-size: 12.5px; }
.lg[data-g="Ç"], .lg[data-g="ß"] { padding-bottom: 1px; font-size: 12.5px; }
.lg[data-g="Th"] { letter-spacing: -.04em; font-size: 12.5px; }
.lg .ico { width: 14px; height: 14px; stroke-width: 1.8; }
.is-play .flag { animation: i-flagtilt .6s var(--ease); }
.is-play .lg { animation: i-glyph .6s var(--ease); }

/* ---------- buttons ---------- */

.pill-btn {
  display: inline-flex; align-items: center; gap: 9px;
  min-height: 44px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: transparent; color: var(--text-2);
  font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: color .2s, border-color .2s, background-color .2s;
}
.pill-btn:hover { color: var(--text); border-color: var(--line-3); background: rgba(239, 233, 223, .03); }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 44px; height: 44px; padding: 0;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: transparent; color: var(--text-2);
  transition: color .2s, border-color .2s, background-color .2s;
}
.icon-btn:hover { color: var(--text); border-color: var(--line-3); background: rgba(239, 233, 223, .03); }
/* ✕ поворачивается, стрелка «Смотреть» делает шаг вперёд, ползунки «Фильтров» разъезжаются (и стоят так, пока панель открыта) */
.ico-x { transition: transform .4s var(--ease); }
.btn .ico-out { transition: transform .3s var(--ease); }
.ico-sliders .knob { transition: transform .45s var(--ease); }
.filters-btn[aria-expanded="true"] .k1 { transform: translateX(-6px); }
.filters-btn[aria-expanded="true"] .k2 { transform: translateX(6px); }
@media (hover: hover) {
  .icon-btn:hover .ico-x, .search-clear:hover .ico-x { transform: rotate(90deg); }
  .btn:hover .ico-out { transform: translate(2px, -2px); }
  .filters-btn:hover .k1 { transform: translateX(-6px); }
  .filters-btn:hover .k2 { transform: translateX(6px); }
}

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 10px;
  min-height: 52px; padding: 0 26px;
  border: 1px solid transparent; border-radius: 999px;
  font-size: 15px; font-weight: 600; letter-spacing: .01em; white-space: nowrap;
  text-decoration: none;
  transition: background-color .25s, color .25s, border-color .25s, transform .25s var(--ease), box-shadow .25s, opacity .25s;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary {
  background: var(--accent); color: var(--accent-ink);
  box-shadow: 0 10px 30px -12px rgba(227, 168, 87, .55), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.btn-primary:hover { background: var(--accent-hi); box-shadow: 0 14px 34px -12px rgba(227, 168, 87, .65), inset 0 1px 0 rgba(255, 255, 255, .3); }
.btn-ghost { background: transparent; color: var(--text); border-color: var(--line-2); }
.btn-ghost:hover { border-color: var(--line-3); background: rgba(239, 233, 223, .04); }
.btn-light { background: var(--text); color: var(--bg); }
.btn-light:hover { background: #fff; }
.btn-sm { min-height: 44px; padding: 0 20px; font-size: 14px; }
.btn[disabled] { opacity: .45; cursor: default; box-shadow: none; transform: none; }
/* недоступная главная кнопка — спокойный контур, а не мутное янтарное пятно */
.btn-primary[disabled] { opacity: 1; background: transparent; color: var(--text-3); border-color: var(--line-2); box-shadow: none; }
.btn-spin[aria-disabled="true"] { opacity: .6; box-shadow: none; transform: none; cursor: progress; }

.link-btn {
  min-height: 44px; padding: 0 6px; border: 0; background: none;
  color: var(--text-2); font-size: 14px; font-weight: 500;
  text-decoration: underline; text-decoration-color: var(--line-3); text-underline-offset: 4px;
}
.link-btn:hover { color: var(--text); text-decoration-color: currentColor; }

/* ---------- header ---------- */
.top { position: relative; z-index: 5; }
.top-in { display: flex; align-items: center; gap: 20px; height: 76px; }
.brand {
  font: italic 600 31px/1 var(--serif);
  letter-spacing: .005em; text-decoration: none; color: var(--text);
  padding: 6px 0;
}
.brand-dot { color: var(--accent); font-style: normal; }
.top-meta { margin-left: auto; color: var(--text-3); font-size: 13px; letter-spacing: .02em; }
.top-meta span:first-child { color: var(--text-2); font-variant-numeric: tabular-nums; }
.mirror-btn .mirror-label { max-width: 16ch; overflow: hidden; text-overflow: ellipsis; }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  padding: clamp(6px, 1.6vh, 22px) 0 clamp(16px, 2vh, 44px);
}
.backdrop {
  position: absolute; top: 0; left: 0; right: 0; height: min(1100px, 125vh); z-index: -1; pointer-events: none;
  -webkit-mask-image: linear-gradient(180deg, #000 70%, transparent);
          mask-image: linear-gradient(180deg, #000 70%, transparent);
}
.backdrop::before {
  content: ""; position: absolute; inset: 0;
  background:
    radial-gradient(46% 30% at 50% 44%, rgba(227, 168, 87, .08), transparent 72%),
    radial-gradient(130% 70% at 50% 30%, transparent 50%, rgba(0, 0, 0, .5) 100%);
}
.backdrop::after {
  content: ""; position: absolute; inset: 0; opacity: .045;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 0 0 0 .9 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E");
}
.hero-head { text-align: center; }
.overline {
  display: inline-flex; align-items: center; gap: 14px;
  color: var(--text-3); font-size: 11.5px; font-weight: 600; letter-spacing: .26em; text-transform: uppercase;
}
.overline::before, .overline::after { content: ""; width: 30px; height: 1px; background: var(--line-2); }
.hero h1 {
  margin-top: clamp(8px, 1.4vh, 14px);
  font: 500 clamp(38px, 5.2vw, 74px)/1.02 var(--serif);
  letter-spacing: -.012em;
  text-wrap: balance;
}
.hero h1 em { font-style: italic; color: var(--accent); padding-right: .04em; }
/* первое появление: надзаголовок, заголовок, барабан, подпись и посвящение выходят по очереди */
@media (prefers-reduced-motion: no-preference) {
  .hero-head > *, .reel, .result, #dedication { animation: rise .9s var(--ease) both; }
  .hero-head > h1 { animation-delay: .07s; }
  .reel { animation-name: fade; animation-duration: 1.1s; animation-delay: .14s; }
  .result { animation-delay: .24s; }
  #dedication { animation-delay: .36s; }
}

/* ---------- reel ---------- */
.reel {
  position: relative;
  height: calc(var(--rh) + 2 * var(--band));
  margin-top: clamp(16px, 2.8vh, 38px);
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 13%, #000 87%, transparent 100%);
          mask-image: linear-gradient(90deg, transparent 0, #000 13%, #000 87%, transparent 100%);
  user-select: none; -webkit-user-select: none;
}
.reel::before {
  /* the strip beyond the track ends (always masked out, just in case) */
  content: ""; position: absolute; inset: 0; background: rgba(239, 233, 223, .025);
}
.reel-track {
  position: absolute; top: 0; left: 0; height: 100%;
  display: flex; align-items: center; gap: var(--rgap);
  padding: 0 var(--rgap);
  will-change: transform;
  background-color: rgba(239, 233, 223, .028);
}
.reel-track::before, .reel-track::after {
  /* sprocket holes, moving with the strip */
  content: ""; position: absolute; left: 0; right: 0; height: var(--band); pointer-events: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='22' height='8'%3E%3Crect x='6' y='0.5' width='10' height='7' rx='1.8' fill='%23000' fill-opacity='.62'/%3E%3Crect x='6.5' y='1' width='9' height='6' rx='1.5' fill='none' stroke='%23fff' stroke-opacity='.05'/%3E%3C/svg%3E");
  background-repeat: repeat-x; background-size: 22px 8px; background-position: 0 50%;
}
.reel-track::before { top: 0; }
.reel-track::after { bottom: 0; }
.reel.is-spinning .reel-track { pointer-events: none; }

.rc {
  position: relative; display: block; flex: 0 0 var(--rw); height: var(--rh);
  border-radius: 4px; text-decoration: none;
  transition: opacity .7s var(--ease), filter .7s var(--ease);
}
.rc .poster {
  width: 100%; height: 100%; border-radius: 4px; aspect-ratio: auto;
  transition: transform .7s var(--ease), box-shadow .7s var(--ease);
}
.rc-empty { overflow: hidden; background: rgba(239, 233, 223, .035); box-shadow: inset 0 0 0 1px rgba(239, 233, 223, .04); }
/* загрузка: по пустым рамкам барабана проходит мягкая полоса света (transform — без перерисовки фона);
   постеры ленты по-прежнему «проявляются» тонированной подложкой — десятки анимаций на телефоне ни к чему */
.rc-empty::before {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(100deg, transparent 25%, rgba(239, 233, 223, .07) 45%, rgba(227, 168, 87, .06) 55%, transparent 75%);
  transform: translateX(-100%);
  animation: sheen 1.8s var(--ease-io) infinite;
}
.reel[data-empty] .rc-empty::before { display: none; }
@keyframes sheen { to { transform: translateX(100%); } }

.reel.has-winner .rc:not(.win) { opacity: .3; filter: grayscale(.75); }
.reel.has-winner .rc:not(.win):hover { opacity: .6; }
.rc.win { z-index: 2; }
.rc.win .poster {
  transform: scale(1.045);
  box-shadow: 0 0 0 1px rgba(227, 168, 87, .55), 0 26px 60px -16px rgba(227, 168, 87, .38), 0 30px 70px -20px rgba(0, 0, 0, .9);
}

.gate {
  position: absolute; left: 50%; top: 50%; z-index: 3; pointer-events: none;
  width: calc(var(--rw) + 16px); height: calc(var(--rh) + 16px);
  transform: translate(-50%, -50%);
  transition: width .7s var(--ease), height .7s var(--ease);
}
.reel.has-winner .gate { width: calc(var(--rw) * 1.045 + 16px); height: calc(var(--rh) * 1.045 + 14px); }
.gc { position: absolute; width: 18px; height: 18px; border: 0 solid var(--accent); }
.gc-tl { top: 0; left: 0; border-top-width: 1.5px; border-left-width: 1.5px; border-top-left-radius: 3px; }
.gc-tr { top: 0; right: 0; border-top-width: 1.5px; border-right-width: 1.5px; border-top-right-radius: 3px; }
.gc-bl { bottom: 0; left: 0; border-bottom-width: 1.5px; border-left-width: 1.5px; border-bottom-left-radius: 3px; }
.gc-br { bottom: 0; right: 0; border-bottom-width: 1.5px; border-right-width: 1.5px; border-bottom-right-radius: 3px; }
.pin {
  position: absolute; left: 50%; width: 0; height: 0;
  border-left: 6px solid transparent; border-right: 6px solid transparent;
  transform-origin: 50% 0;
}
.pin-top { top: -9px; border-top: 8px solid var(--accent); transform: translateX(-50%); }
.pin-bottom { bottom: -9px; border-bottom: 8px solid var(--accent); transform: translateX(-50%); transform-origin: 50% 100%; }
.reel.landed .gate { animation: gate-pulse .9s var(--ease); }
@keyframes gate-pulse {
  0% { filter: drop-shadow(0 0 0 rgba(227, 168, 87, 0)); }
  35% { filter: drop-shadow(0 0 10px rgba(227, 168, 87, .9)); }
  100% { filter: drop-shadow(0 0 0 rgba(227, 168, 87, 0)); }
}

/* ---------- result caption ---------- */
.result {
  display: flex; flex-direction: column; align-items: center; text-align: center;
  padding-top: clamp(16px, 2.6vh, 28px);
}
.res-kicker {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  min-height: 18px;
  color: var(--accent); font-size: 12px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase;
  font-variant-numeric: tabular-nums;
}
.res-kind { display: inline-flex; }
.res-kind:empty { display: none; }
.res-kind .ico { width: 17px; height: 17px; }
.res-title {
  max-width: 24em;
  margin-top: 8px;
  font: 600 clamp(28px, 3.1vw, 44px)/1.08 var(--serif);
  letter-spacing: -.005em;
  text-wrap: balance;
  min-height: 1.08em;
  overflow-wrap: anywhere;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.result[data-state="idle"] .res-title,
.result[data-state="loading"] .res-title,
.result[data-state="empty"] .res-title { font-style: italic; font-weight: 500; color: var(--text-2); }
.result[data-state="spin"] .res-title {
  color: var(--text-3); display: block; white-space: nowrap; text-overflow: ellipsis; max-width: min(24em, 100%);
}
.res-meta {
  min-height: 24px; margin-top: 8px; max-width: 46em;
  color: var(--text-2); font-size: 14.5px; line-height: 1.6;
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; column-gap: 0;
}
.res-meta .sep { color: var(--text-3); padding: 0 .6em; }
.res-meta i { font-family: var(--serif); font-size: 1.12em; font-style: italic; color: var(--text); }
.rate { display: inline-flex; align-items: center; gap: 5px; color: var(--text); font-variant-numeric: tabular-nums; font-weight: 600; }
.rate .ico { width: 12px; height: 12px; color: var(--accent); stroke: none; --fo: 1; }
.res-actions { display: flex; gap: 12px; margin-top: clamp(16px, 2.4vh, 24px); justify-content: center; }
.btn-spin { min-width: 200px; }
.btn-spin .spin-ico { width: 20px; height: 20px; }
.btn-spin.is-secondary {
  background: transparent; color: var(--text); border-color: var(--line-2); box-shadow: none; min-width: 0;
}
.btn-spin.is-secondary:hover { border-color: var(--line-3); background: rgba(239, 233, 223, .04); }
.result[data-state="spin"] .spin-ico { animation: rot .9s linear infinite; }
@keyframes rot { to { transform: rotate(360deg); } }
.res-hint { margin-top: 8px; color: var(--text-3); font-size: var(--fs-xs); min-height: 20px; }
kbd {
  display: inline-block; padding: 1px 7px; margin: 0 2px;
  border: 1px solid var(--line-2); border-bottom-width: 2px; border-radius: 5px;
  font: 500 11.5px/1.5 var(--sans); color: var(--text-2);
}
.result.reveal .res-kicker, .result.reveal .res-title, .result.reveal .res-meta, .result.reveal .res-actions {
  animation: rise .7s var(--ease) both;
}
.result.reveal .res-title { animation-delay: .06s; }
.result.reveal .res-meta { animation-delay: .14s; }
.result.reveal .res-actions { animation-delay: .22s; }
@keyframes rise { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }

/* ---------- dedication ---------- */
.dedication {
  margin: clamp(18px, 2.6vh, 32px) auto 0; padding-inline: var(--pad);
  text-align: center; color: var(--text-3);
  font: italic 500 17px/1.3 var(--serif); letter-spacing: .03em;
}
/* те же линейки, что у «— Кинорулетка —» наверху: подпись закрывает героя, как титр */
.dedication::before, .dedication::after {
  content: ""; display: inline-block; width: 30px; height: 1px; margin: 0 14px;
  background: var(--line-2); vertical-align: middle;
}
.dedication .heart { display: inline-block; font-style: normal; font-size: .78em; margin: 0 .06em; vertical-align: .06em; }
@media (prefers-reduced-motion: no-preference) {
  .dedication .heart { animation: heartbeat 2.8s ease-in-out infinite; }
}
/* подпись ушла с экрана — сердце замирает (app.js, IntersectionObserver) */
.dedication .heart.is-off { animation-play-state: paused; }
@keyframes heartbeat { 0%, 24%, 48%, 100% { transform: none; } 12% { transform: scale(1.13); } 36% { transform: scale(1.07); } }

/* ---------- toolbar ---------- */
.bar-sentinel { height: 1px; margin-bottom: -1px; }
.bar {
  position: sticky; top: 0; z-index: 30;
  border-top: 1px solid var(--line);
  transition: background-color .3s, box-shadow .3s, border-color .3s;
}
.bar.stuck, .bar.panel-open {
  background: rgba(10, 10, 11, .86);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
          backdrop-filter: blur(16px) saturate(1.15);
  box-shadow: 0 1px 0 var(--line), 0 20px 40px -30px rgba(0, 0, 0, .9);
}
.bar.stuck { border-top-color: transparent; }
.bar-in { display: flex; align-items: center; gap: 12px; padding-block: 14px; }

.seg {
  display: inline-flex; flex: none; padding: 3px; gap: 2px;
  border: 1px solid var(--line-2); border-radius: 999px;
}
.seg button {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 16px 0 13px; border: 0; border-radius: 999px;
  background: transparent; color: var(--text-2); font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background-color .25s var(--ease), color .25s;
}
.seg .ico { width: 17px; height: 17px; }
.seg button:hover { color: var(--text); }
@media (hover: hover) { .seg button[aria-checked="false"]:hover .ico { color: var(--accent); } }
.seg button[aria-pressed="true"], .seg button[aria-checked="true"] {
  background: var(--text); color: var(--bg); font-weight: 600;
  box-shadow: 0 6px 18px -10px rgba(239, 233, 223, .5);
  transition-duration: .08s;
}

.search {
  position: relative; display: flex; align-items: center;
  flex: 1 1 260px; max-width: 440px; min-width: 0;
}
.search-ico { position: absolute; left: 16px; color: var(--text-3); pointer-events: none; transition: color .2s; }
.search:focus-within .search-ico { color: var(--accent); }
.search:focus-within .search-ico .m-wiggle { animation: i-wiggle .65s var(--ease); }
.search input {
  width: 100%; min-height: 44px; padding: 0 44px 0 44px;
  text-overflow: ellipsis;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: rgba(239, 233, 223, .03);
  font-size: 14.5px; color: var(--text);
  transition: border-color .2s, background-color .2s;
  -webkit-appearance: none; appearance: none;
}
.search input::placeholder { color: var(--text-3); }
.search input:placeholder-shown { padding-right: 16px; }
.search input:hover { border-color: var(--line-3); }
.search input:focus { outline: none; border-color: var(--accent); background: rgba(239, 233, 223, .05); }
.search input:focus-visible { outline: none; }
.search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.search-clear {
  position: absolute; right: 0; top: 0; width: 44px; height: 44px; display: grid; place-items: center;
  border: 0; background: none; color: var(--text-2); border-radius: 999px;
}
.search-clear:hover { color: var(--text); }
.search-toggle { display: none; }

.filters-btn { position: relative; }
.filters-btn[aria-expanded="true"] { color: var(--text); border-color: var(--line-3); background: rgba(239, 233, 223, .05); }
.badge {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px; background: var(--accent); color: var(--accent-ink);
  font-size: 11.5px; font-weight: 700; font-variant-numeric: tabular-nums;
}
.found { margin-left: auto; color: var(--text-3); font-size: 13.5px; white-space: nowrap; }
.found b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }

/* active filters — removable chips under the toolbar */
.active-row { padding-bottom: 12px; margin-top: -4px; }
.active-chips {
  list-style: none; margin-block: 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.active-chips li { display: flex; flex: none; }
.ac {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: var(--h-sm); padding: 0 7px 0 9px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: rgba(239, 233, 223, .05); color: var(--text);
  font-size: var(--fs-sm); font-weight: 500; white-space: nowrap;
  transition: background-color .2s, border-color .2s, color .2s;
}
.ac > .ico, .ac > .flag, .ac > .lg { width: 16px; height: 16px; }
.ac > .lg { font-size: 12.5px; }
.ac > .lg .ico { width: 12px; height: 12px; }
.ac .ac-x { width: 16px; height: 16px; stroke-width: 1.7; opacity: .5; transition: opacity .2s, transform .3s var(--ease); }
.ac:hover { border-color: var(--line-3); background: rgba(239, 233, 223, .09); }
.ac:hover .ac-x { opacity: 1; transform: rotate(90deg); }
.ac-ex { border-color: var(--neg-line); background: var(--neg-soft); color: var(--neg-text); }
.ac-ex:hover { border-color: var(--neg); background: var(--neg-soft); }
.ac-ex::after {
  content: ""; position: absolute; left: 7px; top: 50%; width: 20px; height: 1.6px; margin-top: -.8px;
  border-radius: 1px; background: var(--neg); pointer-events: none; transform: rotate(-45deg);
}
.ac-mode { border-style: dashed; background: transparent; color: var(--text-2); font-style: italic; }
.ac-mode > .ico { color: var(--accent); }
.ac-reset { position: relative; min-height: var(--h-sm); margin-left: 4px; font-size: var(--fs-sm); color: var(--text-3); }

/* затемнение под выпадающей панелью (вне .bar: её backdrop-filter стал бы рамкой для fixed) */
.scrim { position: fixed; inset: 0; z-index: 29; background: rgba(5, 5, 6, .62); animation: fade .3s var(--ease); }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }

/* filter panel — desktop: overlay dropdown under the toolbar */
.panel {
  position: absolute; left: 0; right: 0; top: 100%;
  display: flex; flex-direction: column;
  max-height: calc(100vh - var(--bar-h, 80px)); max-height: calc(100dvh - var(--bar-h, 80px));
  background: #0b0b0c;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line-2);
  box-shadow: 0 50px 90px -40px rgba(0, 0, 0, .95);
  animation: drop .35s var(--ease);
}
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: none; } }
.sheet-head { display: none; }
.panel-scroll { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
.panel-in {
  display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr);
  gap: 28px 0; padding-block: 26px 24px;
}
.pcol { display: flex; flex-direction: column; gap: 26px; min-width: 0; }
.pcol-a { padding-right: clamp(28px, 3.4vw, 56px); }
.pcol-b { padding-left: clamp(28px, 3.4vw, 56px); border-left: 1px solid var(--line); }
.fgroup { min-width: 0; }
.fg-head { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 14px; min-height: 32px; margin-bottom: 10px; }
.legend {
  display: inline-flex; align-items: center; gap: 10px;
  margin: 0; color: var(--text-3);
  font: 600 11.5px/1.4 var(--sans); letter-spacing: .2em; text-transform: uppercase;
}
.legend .ico { width: 18px; height: 18px; color: var(--accent); }
.fg-note { color: var(--text-3); font-size: var(--fs-xs); }
.fg-hint { margin: -4px 0 12px; color: var(--text-3); font-size: var(--fs-xs); line-height: 1.45; }
.fg-hint s { color: var(--neg-text); text-decoration-color: var(--neg); text-decoration-thickness: 1.5px; }

.mini-seg {
  display: inline-flex; margin-left: auto; padding: 2px; gap: 2px;
  border: 1px solid var(--line-2); border-radius: 999px;
  transition: opacity .2s;
}
.mini-seg button {
  position: relative;
  display: inline-flex; align-items: center; gap: 6px;
  min-height: 26px; padding: 0 11px 0 8px; border: 0; border-radius: 999px;
  background: none; color: var(--text-3); font-size: var(--fs-xs); font-weight: 500; white-space: nowrap;
  transition: background-color .2s, color .2s;
}
.mini-seg button:hover { color: var(--text); }
.mini-seg .ico { width: 15px; height: 15px; stroke-width: 1.9; }
.mini-seg button[aria-checked="true"] { background: rgba(239, 233, 223, .11); color: var(--text); }
/* пока выбрано меньше двух жанров, режим ни на что не влияет — приглушаем подложку, текст остаётся читаемым */
.mini-seg.is-idle { border-style: dashed; }
.mini-seg.is-idle button[aria-checked="true"] { background: rgba(239, 233, 223, .06); color: var(--text-2); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 38px; padding: 0 15px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: transparent; color: var(--text-2);
  font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background-color .25s var(--ease), color .2s, border-color .2s, transform .2s var(--ease);
}
.chip:hover { color: var(--text); border-color: var(--line-3); background: rgba(239, 233, 223, .03); }
.chip:active { transform: scale(.97); }
.chip[aria-pressed="true"], .chip[aria-checked="true"] {
  background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 600;
  box-shadow: 0 6px 18px -10px rgba(239, 233, 223, .45);
  transition-duration: .08s; /* выбор — сразу, без серого полутона; «щелчок» делает chip-pop */
}
/* значок стоит в разметке после подписи (текст — первый узел кнопки), на экране — перед ней */
.chip > .ico, .chip > .flag, .chip > .lg { order: -1; }
.chip > .ico { width: 18px; height: 18px; }
@media (hover: hover) {
  .chip[aria-pressed="false"]:hover > .ico, .chip[aria-checked="false"]:hover > .ico { color: var(--accent); }
  .chip:hover > .flag { filter: none; }
}
.chip[aria-pressed="true"] > .flag { filter: none; }
.chip[aria-pressed="true"] .flag-ring { stroke: rgba(10, 10, 11, .22); }
.panel .chips { gap: 7px; }
.panel .chip { min-height: var(--h-md); padding: 0 14px 0 11px; font-size: var(--fs-sm); }
#yearChips .chip { padding: 0 12px 0 10px; }
/* рейтинг — один вариант из шести: сегментированный переключатель, как «Всё / Фильмы / Сериалы» */
#ratingChips {
  display: grid; grid-template-columns: auto repeat(5, minmax(0, 1fr)); gap: 2px;
  max-width: 460px; padding: 3px;
  border: 1px solid var(--line-2); border-radius: 999px;
}
#ratingChips .chip { border: 0; min-height: var(--h-sm); padding: 0 10px; gap: 5px; box-shadow: none; }
#ratingChips .chip > .ico { width: 16px; height: 16px; }
#ratingChips .chip[aria-checked="true"] { background: var(--text); color: var(--bg); }
/* genre excluded: struck through, muted red outline; значок перечёркивается косой чертой */
.chip.chip-g[data-state="exc"] {
  background: var(--neg-soft); border-color: var(--neg-line); color: var(--neg-text); font-weight: 500;
  text-decoration: line-through; text-decoration-thickness: 1.5px; text-decoration-color: var(--neg);
  box-shadow: none;
}
.chip.chip-g[data-state="exc"]:hover { border-color: var(--neg); }
.chip-g { position: relative; }
.chip-g::after {
  content: ""; position: absolute; left: 9px; top: 50%; width: 22px; height: 1.6px; margin-top: -.8px;
  border-radius: 1px; background: var(--neg); pointer-events: none;
  transform: rotate(-45deg) scaleX(0); transition: transform .3s var(--ease);
}
.chip-g[data-state="exc"]::after { transform: rotate(-45deg) scaleX(1); }
/* «Новинки» — янтарная искра */
.chip-new[aria-pressed="false"] > .ico { color: var(--accent); }
.chip-more {
  display: inline-flex; align-items: center; gap: 4px; padding-right: 10px;
  border-style: dashed; color: var(--text-3);
}
.chip-more > .ico { order: 0; width: 16px; height: 16px; stroke-width: 1.7; transition: transform .25s var(--ease); }
.chip-more[aria-expanded="true"] { color: var(--text); border-color: var(--line-3); border-style: solid; }
.chip-more[aria-expanded="true"] > .ico { transform: rotate(180deg); }

/* full index of countries / languages */
.more {
  margin-top: 12px; padding: 10px;
  border: 1px solid var(--line); border-radius: 14px;
  background: rgba(239, 233, 223, .018);
  animation: drop .3s var(--ease);
}
.more-search { position: relative; }
.more-search .ico {
  position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; margin-top: -8px;
  color: var(--text-3); pointer-events: none;
}
.more-search input {
  width: 100%; min-height: 40px; padding: 0 12px 0 36px;
  border: 1px solid var(--line-2); border-radius: 10px;
  background: rgba(239, 233, 223, .03); font-size: 14px; color: var(--text);
  -webkit-appearance: none; appearance: none;
}
.more-search input::placeholder { color: var(--text-3); }
.more-search input:focus { outline: none; border-color: var(--accent); }
.more-search input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.opts {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 0 8px;
  margin-top: 8px; max-height: 236px; overflow-y: auto; overscroll-behavior: contain;
  scrollbar-width: thin; scrollbar-color: var(--line-2) transparent;
}
.opt {
  display: flex; align-items: center; gap: 10px; min-width: 0; min-height: 36px; padding: 6px 8px;
  border: 0; border-radius: 8px; background: none; color: var(--text-2);
  font-size: 13.5px; text-align: left;
  transition: background-color .15s, color .15s;
}
.opt:hover { background: rgba(239, 233, 223, .05); color: var(--text); }
.opt:focus-visible { outline-offset: -2px; }
.opt-box {
  flex: none; width: 16px; height: 16px; border: 1px solid var(--line-3); border-radius: 4px;
  background: transparent no-repeat center / 12px 12px;
}
.opt[aria-pressed="true"] { color: var(--text); font-weight: 600; }
.opt[aria-pressed="true"] .opt-box {
  border-color: var(--text); background-color: var(--text);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5' fill='none' stroke='%230a0a0b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.opt-name { flex: 1 1 auto; min-width: 0; overflow-wrap: break-word; line-height: 1.25; }
.opt-n { flex: none; color: var(--text-3); font-size: 11.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.opt-empty { grid-column: 1 / -1; padding: 10px 8px 4px; color: var(--text-3); font-size: 13px; font-style: italic; }

.panel-foot { flex: none; border-top: 1px solid var(--line); }
.panel-foot-in { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding-block: 14px; }
#panelDoneNum { font-variant-numeric: tabular-nums; }
/* ноль результатов: «Показать 0» гаснет, главным становится «Сбросить всё» */
#panelDone.is-zero { background: transparent; color: var(--text-3); border-color: var(--line-2); }
#panelReset.is-emph { background: var(--text); color: var(--bg); border-color: var(--text); }
.is-panel-open .totop { display: none; }
.result[data-state="empty"] .res-hint, .result[data-state="loading"] .res-hint { visibility: hidden; }
.res-meta .link-btn { min-height: 36px; padding: 0 2px; }

/* ---------- posters (shared) ---------- */
.poster {
  position: relative; display: block; overflow: hidden;
  aspect-ratio: 2 / 3;
  border-radius: var(--r);
  background:
    radial-gradient(90% 70% at var(--gx, 30%) 12%, rgba(255, 255, 255, .09), transparent 62%),
    linear-gradient(var(--ang, 165deg), var(--c1, #23232a), var(--c2, #0d0d10));
  container-type: inline-size;
  isolation: isolate;
}
.poster img {
  position: absolute; inset: 0; z-index: 1; width: 100%; height: 100%;
  object-fit: cover; opacity: 0;
  transition: opacity .45s var(--ease);
}
.poster img.ok { opacity: 1; }
/* пока фото грузится — только тонированная подложка («проявка»); типографский постер — если фото
   нет, оно не загрузилось или запаздывает больше секунды */
.poster.has-img:not(.is-loaded) > .fb { opacity: 0; animation: fb-late .4s var(--ease) 1s forwards; }
.poster.is-loaded > .fb { opacity: 0; transition: opacity .2s; }
/* фото пришло — типографская заглушка под ним больше не раскладывается (дорогая вёрстка cqi на каждой
   карточке при прокрутке на телефоне); где браузер умеет, — после того как она дотаяла */
.poster.is-loaded > .fb { content-visibility: hidden; transition: opacity .2s, content-visibility .2s allow-discrete; }
@keyframes fb-late { to { opacity: 1; } }

/* typographic fallback — a minimal art-house poster */
.fb {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  padding: 10cqi 9cqi 9cqi;
  color: #f3ede3;
  font-size: 16px;
}
.fb::after {
  content: ""; position: absolute; inset: 4.5cqi; pointer-events: none;
  border: 1px solid rgba(243, 237, 227, .1); border-radius: 2px;
}
.fb-ini {
  position: absolute; right: -4cqi; top: -16cqi; z-index: -1;
  font: italic 600 96cqi/1 var(--serif);
  color: rgba(243, 237, 227, .075);
  pointer-events: none;
}
.fb-kind {
  font: 600 max(7.5px, 4.4cqi)/1.2 var(--sans); letter-spacing: .22em; text-transform: uppercase;
  color: rgba(243, 237, 227, .62);
}
.fb-title {
  margin-top: auto;
  font: 600 16px/1.02 var(--serif);
  font-size: var(--fs, 12cqi);
  letter-spacing: -.005em;
  overflow-wrap: anywhere; hyphens: auto;
  display: -webkit-box; -webkit-line-clamp: 7; -webkit-box-orient: vertical; overflow: hidden;
  padding-bottom: .04em;
}
.fb-rule { width: 12cqi; height: 1px; margin: 6cqi 0 4.6cqi; background: var(--accent); opacity: .8; }
.fb-year { font: 500 max(8px, 4.8cqi)/1 var(--sans); letter-spacing: .14em; color: rgba(243, 237, 227, .7); font-variant-numeric: tabular-nums; }

/* variant 1 — centred, rules around */
.fb-1 { align-items: center; text-align: center; justify-content: center; }
.fb-1 .fb-kind { position: absolute; top: 10cqi; left: 0; right: 0; }
.fb-1 .fb-title { margin-top: 0; }
.fb-1 .fb-rule { order: -1; margin: 0 auto 6cqi; }
.fb-1 .fb-year { position: absolute; bottom: 10cqi; left: 0; right: 0; }
.fb-1 .fb-ini { right: auto; left: 50%; top: 50%; transform: translate(-50%, -54%); font-size: 120cqi; }

/* variant 2 — title on top, oversized outlined year at the foot */
.fb-2 .fb-title { margin-top: 7cqi; }
.fb-2 .fb-kind { order: -1; }
.fb-2 .fb-rule { margin-top: 6cqi; }
.fb-2 .fb-year {
  position: absolute; left: 7cqi; bottom: 7cqi;
  transition: opacity .3s var(--ease);
  font: italic 600 31cqi/1 var(--serif); letter-spacing: -.02em;
  color: transparent; -webkit-text-stroke: 1px rgba(243, 237, 227, .32);
}
.fb-2 .fb-ini { display: none; }
@media (hover: hover) { .card-link:hover .fb-2 .fb-year { opacity: 0; } }
.card-link:focus-visible .fb-2 .fb-year { opacity: 0; }

/* ---------- feed ---------- */
.feed { padding: clamp(34px, 5vw, 64px) 0 clamp(72px, 10vw, 140px); outline: none; }
/* лента всегда не короче экрана под липкой панелью: при смене фильтров страница не «проваливается» */
.feed { min-height: calc(100vh - var(--bar-h, 80px)); }
/* у ленты есть конец — недостающую до экрана высоту добирает футер (под подписью, см. fitFoot) */
.has-foot .feed { min-height: 0; }
.feed-head {
  display: flex; align-items: flex-end; justify-content: space-between; flex-wrap: wrap;
  gap: 14px 24px; margin-bottom: clamp(20px, 2.6vw, 32px);
}
.feed-titles { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
/* порядок подборки: вперемешку / лучшие / новые — та же «мини-пилюля», что у режима жанров, чуть крупнее */
.sort-seg { flex: none; }
.sort-seg button { min-height: 34px; padding: 0 14px 0 11px; font-size: 13.5px; }
.sort-seg .ico { width: 16px; height: 16px; }
.sort-seg button[aria-checked="true"] .ico { color: var(--accent); }
.feed-head h2 { font: 500 clamp(32px, 3.4vw, 50px)/1.05 var(--serif); letter-spacing: -.01em; }
.feed-sub { color: var(--text-3); font-size: 14px; text-wrap: pretty; }
.feed-sub b { color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }

.grid {
  list-style: none; margin: 0; padding: 0;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(var(--cw, 168px), 1fr));
  gap: clamp(24px, 2.4vw, 38px) clamp(12px, 1.5vw, 22px);
  overflow-anchor: none;
}
.card {
  content-visibility: auto;
  contain-intrinsic-size: auto 340px;
  /* room for hover lift and focus ring inside the paint-contained box */
  padding: 8px; margin: -8px;
}
.card-link { display: block; text-decoration: none; color: inherit; border-radius: 8px; }
.card-link:focus-visible { outline-offset: 5px; }
.card-media { position: relative; display: block; transition: transform .55s var(--ease); }
.card-media .poster { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .04); }
/* наведение: постер приподнимается, вокруг — тонкий янтарный контур и тёплое свечение (их слой проявляется
   прозрачностью — без перерисовки тени), по постеру проходит блик */
.card-media::before {
  content: ""; position: absolute; inset: 0; border-radius: var(--r); pointer-events: none;
  box-shadow: 0 0 0 1px rgba(227, 168, 87, .34), 0 14px 24px -16px rgba(227, 168, 87, .6);
  opacity: 0; transition: opacity .45s var(--ease);
}
.card-media .poster::after {
  content: ""; position: absolute; inset: 0; z-index: 2; pointer-events: none;
  background: linear-gradient(105deg, transparent 36%, rgba(255, 246, 228, .15) 50%, transparent 64%);
  transform: translateX(-101%);
}
.card-media::after {
  content: ""; position: absolute; inset: 0; border-radius: var(--r); pointer-events: none;
  background: linear-gradient(180deg, transparent 45%, rgba(6, 6, 7, .88) 100%);
  opacity: 0; transition: opacity .35s var(--ease);
}
.peek {
  position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  color: var(--accent); font-size: 13px; font-weight: 600;
  opacity: 0; transform: translateY(6px);
  transition: opacity .35s var(--ease), transform .35s var(--ease);
}
.peek svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
@media (hover: hover) {
  .card-link:hover .card-media { transform: translateY(-6px); }
  .card-link:hover .card-media::before, .card-link:hover .card-media::after, .card-link:hover .peek { opacity: 1; transform: none; }
  .card-link:hover .card-media .poster::after { transform: translateX(101%); transition: transform 1.1s var(--ease); }
  .card-link:hover .ico-kind { color: var(--accent); }
}
.card-link:focus-visible .card-media::before, .card-link:focus-visible .card-media::after, .card-link:focus-visible .peek { opacity: 1; transform: none; }
.card-body { display: block; padding-top: 12px; }
.card-title {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  font-size: 14.5px; font-weight: 600; line-height: 1.32; color: var(--text);
  overflow-wrap: anywhere;
}
.card-meta {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-top: 5px; color: var(--text-3); font-size: 12.5px;
}
.card-meta > .cm { display: flex; align-items: center; gap: 6px; min-width: 0; }
.cm-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ico-kind { width: 14px; height: 14px; stroke-width: 2; transition: color .3s; }
.card-meta .rate { color: var(--text-2); font-weight: 600; gap: 4px; }
.card-meta .rate .ico { width: 11px; height: 11px; stroke-width: 2; }

.feed-divider {
  grid-column: 1 / -1; display: flex; align-items: center; gap: 16px;
  color: var(--text-3); font: italic 500 15px/1 var(--serif); letter-spacing: .02em;
  padding: 2px 0;
}
.feed-divider::before, .feed-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.feed-divider > span { display: inline-flex; align-items: center; gap: 10px; }
.feed-divider .ico { width: 18px; height: 18px; color: var(--accent); }
.feed-divider::before { max-width: 64px; }
.feed-divider::before, .feed-divider::after { min-width: 16px; }
.feed-divider > span { line-height: 1.3; text-wrap: balance; }

.feed-empty { padding: clamp(56px, 12vh, 120px) 0 clamp(40px, 8vh, 80px); text-align: center; }
.empty-ico { display: block; width: 56px; height: 56px; margin: 0 auto 18px; color: var(--accent); stroke-width: 1.15; }
.feed-empty:not([hidden]) .empty-ico .a { animation-name: var(--k); }
.feed-empty-title { font: italic 500 34px/1.1 var(--serif); color: var(--text); }
.feed-empty-text { margin: 10px 0 22px; color: var(--text-2); }
.sentinel { height: 1px; }
.feed-end { padding: 48px 0 0; text-align: center; color: var(--text-3); font: italic 500 20px var(--serif); text-wrap: balance; }
.feed-end .link-btn { margin-left: 12px; font: 500 15px var(--sans); }
/* каталог ещё догружается — под лентой тихая строка, а не обрыв */
.feed-end.is-loading { padding-top: 32px; font: 500 14px var(--sans); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: no-preference) {
  .feed-end.is-loading { animation: load-pulse 1.6s ease-in-out infinite; }
}
@keyframes load-pulse { 50% { opacity: .45; } }
.has-foot .feed { padding-bottom: 28px; }
.site-foot { padding: 0 0 calc(44px + env(safe-area-inset-bottom)); }
.site-foot-in { display: flex; justify-content: center; }
.site-foot .dedication { margin: 0; padding: 18px 0 0; }

/* ---------- to top ---------- */
.totop {
  position: fixed; right: max(16px, env(safe-area-inset-right)); bottom: max(16px, env(safe-area-inset-bottom)); z-index: 40;
  display: inline-flex; align-items: center; gap: 8px;
  min-height: 46px; padding: 0 18px 0 14px;
  border: 1px solid var(--line-2); border-radius: 999px;
  background: rgba(20, 20, 23, .88);
  -webkit-backdrop-filter: blur(12px); backdrop-filter: blur(12px);
  color: var(--text); font-size: 14px; font-weight: 600;
  box-shadow: 0 16px 40px -16px rgba(0, 0, 0, .9);
  animation: rise .4s var(--ease);
}
.totop:hover { border-color: var(--line-3); }
/* пока ленту листают вниз — кнопка уезжает и не закрывает рейтинг карточек в правом нижнем углу */
.totop { transition: transform .35s var(--ease), opacity .25s; }
.totop.away { transform: translateY(calc(100% + 28px)); opacity: 0; pointer-events: none; }
.totop .ico { color: var(--accent); }

/* ---------- dialog ---------- */
.dlg {
  width: min(440px, calc(100vw - 32px)); max-height: calc(100dvh - 32px);
  padding: 0; border: 1px solid var(--line-2); border-radius: 18px;
  background: #121214; color: var(--text);
  box-shadow: 0 40px 120px -20px rgba(0, 0, 0, .95);
}
.dlg[open] { animation: rise .35s var(--ease); }
.dlg::backdrop { background: rgba(4, 4, 5, .72); -webkit-backdrop-filter: blur(3px); backdrop-filter: blur(3px); }
.dlg-in { padding: 26px 24px 22px; }
.dlg-title { display: flex; align-items: center; gap: 12px; font: 600 30px/1.1 var(--serif); }
.dlg-title .ico { width: 22px; height: 22px; color: var(--accent); stroke-width: 1.4; }
.dlg-text { margin: 8px 0 18px; color: var(--text-2); font-size: 14px; }
.dlg-label { display: block; margin: 20px 0 8px; color: var(--text-3); font-size: 11.5px; font-weight: 600; letter-spacing: .2em; text-transform: uppercase; }
.dlg-input {
  width: 100%; min-height: 46px; padding: 0 16px;
  border: 1px solid var(--line-2); border-radius: 12px; background: rgba(239, 233, 223, .03);
  font-size: 15px;
}
.dlg-input:focus { outline: none; border-color: var(--accent); }
.dlg-input[aria-invalid="true"] { border-color: #e0715a; }
.dlg-err { margin-top: 8px; color: #f08a74; font-size: 13px; }
.dlg-preview { margin-top: 10px; color: var(--text-3); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#mirrorPresets { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
#mirrorPresets .chip { padding: 0 6px; font-size: 13px; }
.dlg-preview b { color: var(--text-2); font-weight: 600; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 22px; }
.dlg-note { margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--line); color: var(--text-3); font-size: 12px; }

.noscript { padding: 40px var(--pad); text-align: center; color: var(--text-2); }

/* ---------- движения значков ---------- */
/* у каждой части: --k — имя движения, --d — длительность, --n — повторы, --e — кривая, --dl — задержка */
.ico .m-pop { --k: i-pop; --d: .55s; }
@keyframes i-pop { 0%, 100% { transform: none; } 30% { transform: scale(.55); } 65% { transform: scale(1.14); } }

.ico .m-run { --k: i-run; --d: .42s; --n: 3; --e: linear; }
.ico .m-run-in { --k: i-run-in; --d: .42s; --n: 3; --e: linear; }
.ico .m-run-out { --k: i-run-out; --d: .42s; --n: 3; --e: linear; }
@keyframes i-run { from { transform: none; } to { transform: translateY(4.5px); } }
@keyframes i-run-in { from { transform: none; opacity: 0; } to { transform: translateY(4.5px); opacity: 1; } }
@keyframes i-run-out { from { transform: none; opacity: 1; } to { transform: translateY(4.5px); opacity: 0; } }

.ico .m-ant { --k: i-ant; --d: .9s; transform-origin: 50% 100%; }
@keyframes i-ant { 0%, 100% { transform: none; } 20% { transform: rotate(-16deg); } 42% { transform: rotate(13deg); } 62% { transform: rotate(-8deg); } 80% { transform: rotate(4deg); } }

.ico .m-clap { --k: i-clap; --d: .75s; transform-box: view-box; transform-origin: 4px 10.2px; }
@keyframes i-clap { 0%, 100% { transform: none; } 28% { transform: rotate(-10deg); } 46%, 58% { transform: rotate(13deg); } 52% { transform: rotate(10.5deg); } }

.ico .m-globe { --k: i-globe; --d: 1.3s; --e: cubic-bezier(.45, 0, .55, 1); }
@keyframes i-globe { 0%, 100% { transform: none; } 25%, 75% { transform: scaleX(.1); } 50% { transform: scaleX(1); } }

.ico .m-dot { --k: i-dot; --d: .46s; --n: 2; --e: ease-in-out; }
@keyframes i-dot { 0%, 100% { transform: none; } 45% { transform: translateY(-2.2px); } }

.ico .m-hop { --k: i-hop; --d: 1.15s; --e: ease-in-out; }
@keyframes i-hop {
  0% { transform: none; opacity: 1; }
  18% { transform: translate(2.2px, -2px); }
  32% { transform: translate(4.4px, 0); }
  50% { transform: translate(6.6px, -2px); }
  64%, 82% { transform: translate(8.8px, 0); opacity: 1; }
  90% { transform: translate(8.8px, 0); opacity: 0; }
  91% { transform: none; opacity: 0; }
  100% { transform: none; opacity: 1; }
}

.ico .m-twinkle { --k: i-twinkle; --d: .75s; }
@keyframes i-twinkle { 0%, 100% { transform: none; } 38% { transform: scale(1.24) rotate(16deg); } 68% { transform: scale(.94) rotate(-5deg); } }

.ico .m-tick { --k: i-tick; --d: 1.2s; --e: steps(12, end); transform-origin: 50% 100%; }
@keyframes i-tick { from { transform: none; } to { transform: rotate(360deg); } }

.ico .m-trend { --k: i-trend; --d: .5s; --n: 2; --e: ease-in-out; }
@keyframes i-trend { 0%, 100% { transform: none; } 50% { transform: translate(1.4px, -1.6px); } }

.ico .m-boom { --k: i-boom; --d: .6s; }
@keyframes i-boom { 0%, 100% { transform: none; } 22% { transform: scale(.7) rotate(-10deg); } 55% { transform: scale(1.2) rotate(7deg); } 78% { transform: scale(.96) rotate(-2deg); } }

.ico .m-needle { --k: i-needle; --d: 1.3s; --e: ease-out; }
@keyframes i-needle { 0%, 100% { transform: none; } 16% { transform: rotate(-48deg); } 36% { transform: rotate(32deg); } 56% { transform: rotate(-16deg); } 74% { transform: rotate(8deg); } 88% { transform: rotate(-3deg); } }

.ico .m-wand { --k: i-wand; --d: .7s; transform-origin: 0% 100%; }
@keyframes i-wand { 0%, 100% { transform: none; } 35% { transform: rotate(-16deg); } 65% { transform: rotate(7deg); } }
.ico .m-blink2 { --k: i-blink2; --d: .6s; }
@keyframes i-blink2 { 0%, 100% { transform: none; opacity: 1; } 30% { transform: scale(0); opacity: 0; } 70% { transform: scale(1.35); opacity: 1; } }

.ico .m-nod { --k: i-nod; --d: .8s; transform-origin: 50% 100%; }
@keyframes i-nod { 0%, 100% { transform: none; } 30% { transform: translateY(-1.2px) rotate(-12deg); } 62% { transform: rotate(9deg); } }

.ico .m-laugh { --k: i-laugh; --d: .75s; transform-origin: 50% 90%; }
@keyframes i-laugh { 0%, 100% { transform: none; } 15% { transform: translateY(-1px) rotate(-9deg); } 32% { transform: translateY(-1px) rotate(8deg); } 49% { transform: rotate(-7deg); } 66% { transform: rotate(5deg); } 83% { transform: rotate(-2deg); } }

.ico .m-cuff { --k: i-cuff; --d: .9s; transform-origin: 50% 0%; }
@keyframes i-cuff { 0%, 100% { transform: none; } 22% { transform: rotate(24deg); } 48% { transform: rotate(-14deg); } 70% { transform: rotate(7deg); } 86% { transform: rotate(-2deg); } }

.ico .m-rec { --k: i-rec; --d: 1s; --e: steps(1, end); }
@keyframes i-rec { 0%, 50% { opacity: 1; } 25%, 75% { opacity: .1; } 100% { opacity: 1; } }

.ico .m-tear { --k: i-tear; --d: 1.2s; --e: ease-in; }
@keyframes i-tear { 0% { transform: none; opacity: 1; } 55% { transform: translateY(5px) scale(.8); opacity: 0; } 56% { transform: none; opacity: 0; } 100% { transform: none; opacity: 1; } }

.ico .m-hop2 { --k: i-hop2; --d: .8s; --e: ease-in-out; }
@keyframes i-hop2 { 0%, 50%, 100% { transform: none; } 25% { transform: translateY(-2.8px); } 72% { transform: translateY(-1.4px); } }

.ico .m-flag { --k: i-flag; --d: 1s; --e: ease-in-out; transform-origin: 0% 50%; }
@keyframes i-flag { 0%, 100% { transform: none; } 25% { transform: skewY(-14deg) scaleX(.84); } 50% { transform: skewY(9deg); } 75% { transform: skewY(-5deg) scaleX(.92); } }

.ico .m-tip { --k: i-tip; --d: .9s; transform-origin: 50% 100%; }
@keyframes i-tip { 0%, 100% { transform: none; } 30%, 55% { transform: translateY(-1.8px) rotate(-14deg); } 78% { transform: rotate(3deg); } }

.ico .m-flip { --k: i-flip; --d: 1.5s; --e: linear; }
@keyframes i-flip { 0% { transform: none; animation-timing-function: cubic-bezier(.65, 0, .35, 1); } 40%, 100% { transform: rotate(180deg); } }
.ico .m-sand-in { --k: i-sand-in; --d: 1.5s; --e: linear; transform-origin: 50% 0%; }
.ico .m-sand-out { --k: i-sand-out; --d: 1.5s; --e: linear; transform-origin: 50% 0%; }
@keyframes i-sand-in { 0%, 45% { opacity: 0; transform: scale(.2); } 100% { opacity: 1; transform: none; } }
@keyframes i-sand-out { 0%, 45% { opacity: 1; transform: none; } 100% { opacity: 0; transform: scale(.2); } }

.ico .m-float { --k: i-float; --d: 1.5s; --e: ease-in-out; }
@keyframes i-float { 0%, 100% { transform: none; } 30% { transform: translateY(-2.6px) rotate(-5deg); } 65% { transform: translateY(-1px) rotate(4deg); } }

.ico .m-bounce { --k: i-bounce; --d: .85s; --e: ease-in-out; }
@keyframes i-bounce { 0%, 50%, 100% { transform: none; } 22% { transform: translateY(-3px) rotate(-7deg); } 72% { transform: translateY(-1.5px) rotate(4deg); } }

.ico .m-sway { --k: i-sway; --d: .9s; transform-origin: 50% 100%; }
@keyframes i-sway { 0%, 100% { transform: none; } 22% { transform: rotate(-14deg); } 50% { transform: rotate(11deg); } 76% { transform: rotate(-5deg); } }

.ico .m-sweep { --k: i-sweep; --d: 1s; --e: ease-in-out; }
@keyframes i-sweep { 0%, 100% { transform: none; } 25% { transform: translate(-2px, 1px) rotate(-10deg); } 50% { transform: translate(1px, -1.8px) rotate(4deg); } 75% { transform: translate(2px, 1px) rotate(9deg); } }

.ico .m-beat { --k: i-beat; --d: 1s; --e: ease-in-out; }
@keyframes i-beat { 0%, 30%, 60%, 100% { transform: none; } 15% { transform: scale(1.24); } 45% { transform: scale(1.14); } }

.ico .m-lift { --k: i-lift; --d: 1.1s; --e: cubic-bezier(.5, 0, .3, 1); }
@keyframes i-lift { 0%, 100% { transform: none; } 15% { transform: translateY(1px); } 55%, 70% { transform: translateY(-4.5px); } }
.ico .m-flame { --k: i-flame; --d: .27s; --n: 4; --e: ease-in-out; transform-origin: 50% 0%; }
@keyframes i-flame { 0%, 100% { transform: none; } 50% { transform: scaleY(1.7); } }

.ico .m-ball { --k: i-ball; --d: 1s; --e: linear; }
@keyframes i-ball {
  0% { transform: none; animation-timing-function: cubic-bezier(.2, .6, .4, 1); }
  38% { transform: translateY(-5.5px) rotate(140deg); animation-timing-function: cubic-bezier(.6, 0, .8, .4); }
  66% { transform: translateY(0) rotate(240deg); }
  72% { transform: translateY(.6px) scale(1.1, .86) rotate(250deg); animation-timing-function: cubic-bezier(.2, .6, .4, 1); }
  86% { transform: translateY(-1.6px) rotate(320deg); animation-timing-function: cubic-bezier(.6, 0, .8, .4); }
  100% { transform: rotate(360deg); }
}

.ico .m-hypno { --k: i-hypno; --d: 1.2s; --e: cubic-bezier(.65, 0, .35, 1); }
@keyframes i-hypno { from { transform: none; } to { transform: rotate(-360deg); } }

.ico .m-medal { --k: i-medal; --d: 1.1s; --e: ease-out; transform-origin: 50% 0%; }
@keyframes i-medal { 0%, 100% { transform: none; } 18% { transform: rotate(16deg); } 40% { transform: rotate(-12deg); } 62% { transform: rotate(6deg); } 82% { transform: rotate(-2deg); } }

.ico .m-cactus { --k: i-cactus; --d: 1s; --e: ease-in-out; transform-origin: 50% 100%; }
@keyframes i-cactus { 0%, 100% { transform: none; } 25% { transform: rotate(-7deg); } 55% { transform: rotate(5deg); } 80% { transform: rotate(-2deg); } }

.ico .m-reel { --k: i-reel; --d: .9s; --e: cubic-bezier(.65, 0, .35, 1); }
@keyframes i-reel { from { transform: none; } to { transform: rotate(360deg); } }
.ico .m-disco { --k: i-disco; --d: 1s; --e: ease-in-out; transform-origin: 50% 0%; }
@keyframes i-disco { 0%, 100% { transform: none; } 30% { transform: rotate(9deg); } 65% { transform: rotate(-6deg); } }
.ico .m-glint { --k: i-glint; --d: .8s; --dl: .15s; }
@keyframes i-glint { 0%, 100% { transform: scale(0); opacity: 0; } 50% { transform: scale(1.2) rotate(45deg); opacity: 1; } }
.ico .m-thump { --k: i-thump; --d: .32s; --n: 3; --e: ease-out; }
@keyframes i-thump { 0%, 100% { transform: none; } 35% { transform: scale(1.22); } }
.ico .m-disc { --k: i-reel; --d: 1s; transform-box: view-box; transform-origin: 12px 12px; }
.ico .m-play { --k: i-play; --d: .45s; --n: 2; --e: ease-in-out; }
@keyframes i-play { 0%, 100% { transform: none; } 50% { transform: scale(1.3); } }

.ico .m-fill { --k: i-fill; --d: .7s; transform-box: view-box; transform-origin: 12px 12px; }
@keyframes i-fill { from { transform: scale(0); } to { transform: none; } }

.ico .m-flicker { --k: i-flicker; --d: .8s; --e: ease-in-out; transform-origin: 50% 100%; }
@keyframes i-flicker { 0%, 100% { transform: none; } 25% { transform: scaleY(1.1) skewX(-4deg); } 50% { transform: scaleY(.94) skewX(3deg); } 75% { transform: scaleY(1.06) skewX(-2deg); } }
.ico .m-flicker2 { --k: i-flicker2; --d: .4s; --n: 2; --e: ease-in-out; transform-origin: 50% 100%; }
@keyframes i-flicker2 { 0%, 100% { transform: none; } 50% { transform: scaleY(1.3); } }

.ico .m-blink { --k: i-blink; --d: 1s; }
@keyframes i-blink { 0%, 55%, 100% { transform: none; } 62% { transform: scaleY(.08); } 70% { transform: none; } }
.ico .m-look { --k: i-look; --d: 1s; --e: ease-in-out; }
@keyframes i-look { 0%, 100% { transform: none; } 20%, 32% { transform: translateX(-2px); } 45%, 55% { transform: translateX(2px); } }

.ico .m-gem { --k: i-gem; --d: .8s; }
@keyframes i-gem { 0%, 100% { transform: none; } 35% { transform: rotate(-9deg) scale(1.08); } 68% { transform: rotate(5deg); } }

.ico .m-shuffle { --k: i-sh1; --d: .7s; --e: ease-in-out; }
.ico .m-shuffle2 { --k: i-sh2; --d: .7s; --e: ease-in-out; }
@keyframes i-sh1 { 0%, 100% { transform: none; } 50% { transform: translateX(1.8px); } }
@keyframes i-sh2 { 0%, 100% { transform: none; } 50% { transform: translateX(-1.8px); } }

.ico .m-bob { --k: i-bob; --d: .9s; --e: ease-in-out; }
@keyframes i-bob { 0%, 50%, 100% { transform: none; } 25% { transform: translateY(-3px); } 75% { transform: translateY(-1.4px); } }
.ico .m-out { --k: i-out; --d: .55s; --e: ease-in-out; }
@keyframes i-out { 0%, 100% { transform: none; } 50% { transform: translate(2.2px, -2.2px); } }
.ico .m-wiggle { --k: i-wiggle; --d: .65s; transform-origin: 45% 45%; }
@keyframes i-wiggle { 0%, 100% { transform: none; } 20% { transform: rotate(-16deg); } 45% { transform: rotate(12deg); } 70% { transform: rotate(-6deg); } }
.ico .m-rot { --k: i-reel; --d: .9s; --e: cubic-bezier(.65, 0, .35, 1); }
.ico .m-k1 { --k: i-k; --d: .9s; --e: ease-out; }
.ico .m-k2 { --k: i-k; --d: .9s; --dl: .18s; --e: ease-out; }
@keyframes i-k { 0%, 100% { transform: none; } 40% { transform: translateY(-3px) rotate(30deg); } 70% { transform: translateY(.6px); } }
.ico .m-sneak { --k: i-sneak; --d: 1s; --e: ease-in-out; }
@keyframes i-sneak { 0%, 100% { transform: none; } 25%, 38% { transform: translateX(-2px) rotate(-4deg); } 62%, 75% { transform: translateX(2px) rotate(4deg); } }
.ico .m-glasses { --k: i-glasses; --d: .9s; --e: ease-in-out; }
@keyframes i-glasses { 0%, 100% { transform: none; } 30% { transform: translateY(-1.6px) rotate(-6deg); } 65% { transform: translateY(-.6px) rotate(4deg); } }
.ico .m-l { --k: i-l; --d: .7s; --e: ease-in-out; }
.ico .m-r { --k: i-r; --d: .7s; --e: ease-in-out; }
.ico .m-core { --k: i-core; --d: .7s; --e: ease-in-out; }
@keyframes i-l { 0%, 100% { transform: none; } 50% { transform: translateX(1.6px); } }
@keyframes i-r { 0%, 100% { transform: none; } 50% { transform: translateX(-1.6px); } }
@keyframes i-core { 0%, 100% { transform: none; } 50% { transform: scaleX(1.5); } }
@keyframes i-flagtilt { 0%, 100% { transform: none; } 35% { transform: rotate(-14deg) scale(1.14); } 70% { transform: rotate(6deg); } }
@keyframes i-glyph { 0%, 100% { transform: none; } 35% { transform: rotate(-10deg) scale(1.16); } 70% { transform: rotate(4deg); } }

/* выбор чипа — «щелчок», исключение жанра — короткое «нет»; значок при выборе подпрыгивает */
.is-pop { animation: chip-pop .45s var(--ease); }
.is-shake { animation: chip-shake .45s var(--ease); }
.is-pop > .ico, .is-pop > .flag { animation: ico-pop .5s var(--ease); }
@keyframes chip-pop { 0%, 100% { transform: none; } 30% { transform: scale(.93); } 65% { transform: scale(1.045); } }
@keyframes chip-shake { 0%, 100% { transform: none; } 18% { transform: translateX(-4px); } 38% { transform: translateX(3.5px); } 58% { transform: translateX(-2.5px); } 78% { transform: translateX(1.2px); } }
@keyframes ico-pop { 0%, 100% { transform: none; } 35% { transform: scale(.8) rotate(-8deg); } 70% { transform: scale(1.22); } }

/* ---------- responsive ---------- */
/* касание: зона нажатия не меньше 44 px (где пилюля визуально меньше — добираем невидимым ::before) */
@media (pointer: coarse) {
  .chip, .panel .chip, .opt, .more-search input, .res-meta .link-btn { min-height: var(--h-lg); }
  #ratingChips .chip { min-height: 38px; }
  .seg button { position: relative; min-height: 40px; }
  .seg button::before, #ratingChips .chip::before { content: ""; position: absolute; inset: -4px 0; }
  #ratingChips .chip { position: relative; }
  .mini-seg button { min-height: 36px; }
  .mini-seg button::before { content: ""; position: absolute; inset: -4px 0; }
  .ac, .ac-reset { min-height: 36px; }
  .ac::before, .ac-reset::before { content: ""; position: absolute; inset: -4px 0; }
  .brand { display: inline-flex; align-items: center; min-height: var(--h-lg); }
  .res-hint { display: none; }
}
@media (hover: none) { .res-hint { display: none; } }

/* невысокие экраны ноутбуков: ужимаем героя, чтобы под ним выглядывала панель фильтров */
@media (min-width: 760px) and (max-height: 820px) {
  :root { --rw: clamp(118px, 10.4vw, 160px); --band: clamp(16px, 1.5vw, 22px); }
  .top-in { height: 60px; }
  .hero { padding: 0 0 18px; }
  .hero h1 { font-size: clamp(36px, 4.1vw, 58px); margin-top: 6px; }
  .reel { margin-top: 14px; }
  .result { padding-top: 12px; }
  .res-title { margin-top: 4px; font-size: clamp(26px, 2.6vw, 36px); }
  .res-meta { margin-top: 2px; }
  .res-actions { margin-top: 12px; }
  .res-actions .btn { min-height: 46px; }
  .res-hint { margin-top: 6px; }
  .dedication { margin-top: 12px; font-size: 16px; }
  .panel-in { padding-block: 20px 18px; }
  .pcol { gap: 20px; }
}

@media (max-width: 1023px) {
  .top-meta { display: none; }
  .mirror-btn { margin-left: auto; }

  /* active chips: one row, scrolls sideways inside itself */
  .active-row {
    padding-top: 6px; margin-top: -10px; padding-bottom: 10px;
    overflow-x: auto; overflow-y: hidden; overscroll-behavior-x: contain;
    scrollbar-width: none; -webkit-overflow-scrolling: touch;
  }
  .active-row::-webkit-scrollbar { display: none; }
  .active-row.overflows {
    -webkit-mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
            mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent);
  }
  .active-chips { flex-wrap: nowrap; width: max-content; max-width: none; margin: 0; }
}
/* планшет: «Фильтры» — круглая кнопка со значком, поиску достаётся место */
@media (min-width: 760px) and (max-width: 1023px) {
  .seg button { padding: 0 12px 0 10px; gap: 5px; }
  .filters-btn { width: 44px; padding: 0; justify-content: center; }
  .filters-btn .filters-label { display: none; }
  .filters-btn .badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; font-size: 10.5px; padding: 0 5px; }
  #resetBtn { display: none !important; }
}
@media (min-width: 760px) and (max-width: 959px) {
  .panel-in { grid-template-columns: minmax(0, 1fr); gap: 24px; }
  .pcol-a { padding-right: 0; }
  .pcol-b { padding-left: 0; border-left: 0; padding-top: 24px; border-top: 1px solid var(--line); }
}

@media (max-width: 759px) {
  :root { --rgap: 10px; }
  .top-in { height: 62px; }
  .brand { font-size: 28px; }
  .mirror-btn { padding: 0; width: 44px; justify-content: center; }
  .mirror-btn .mirror-label { display: none; }

  .bar-in { flex-wrap: wrap; gap: 8px; padding-block: 10px; }
  .seg { flex: 1 1 0; min-width: 0; }
  /* ширина кнопок — по содержимому: короткому «Всё» хватает меньше места, «Сериалам» со значком — больше */
  .seg button { flex: 1 1 auto; padding: 0 6px; gap: 5px; min-width: 0; font-size: 13.5px; }
  .seg button > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .seg .ico { width: 15px; height: 15px; stroke-width: 1.8; }
  .search-toggle { display: inline-grid; }
  .search-toggle[aria-expanded="true"] { color: var(--text); border-color: var(--line-3); background: rgba(239, 233, 223, .05); }
  .search { order: 10; flex: 1 1 100%; max-width: none; display: none; }
  .bar.search-open .search { display: flex; }
  .filters-btn { width: 44px; padding: 0; justify-content: center; }
  .filters-btn .filters-label { display: none; }
  .filters-btn .badge { position: absolute; top: -4px; right: -4px; min-width: 18px; height: 18px; font-size: 10.5px; padding: 0 5px; }
  .found, #resetBtn { display: none !important; }
  .active-row { margin-top: -8px; }

  /* filters: full-height sheet with a sticky footer */
  .bar.panel-open { -webkit-backdrop-filter: none; backdrop-filter: none; }
  body.is-panel-open { overflow: hidden; }
  .panel {
    position: fixed; inset: 0; z-index: 80;
    max-height: none; height: 100%; height: 100dvh;
    background: var(--bg); border: 0; box-shadow: none;
    animation: sheet-in .34s var(--ease);
  }
  @keyframes sheet-in { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
  .sheet-head {
    display: flex; align-items: center; gap: 12px; flex: none;
    min-height: 62px; padding: max(8px, env(safe-area-inset-top)) var(--pad) 8px;
    border-bottom: 1px solid var(--line);
  }
  .sheet-title { display: flex; align-items: center; gap: 10px; font: 600 28px/1 var(--serif); }
  .sheet-title .ico { width: 20px; height: 20px; color: var(--accent); }
  .sheet-found { margin-left: auto; color: var(--text-3); font-size: 13px; white-space: nowrap; }
  .sheet-found b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
  .panel-in { grid-template-columns: minmax(0, 1fr); gap: 26px; padding-block: 20px 28px; }
  .pcol { gap: 26px; }
  .pcol-a { padding-right: 0; }
  .pcol-b { padding-left: 0; border-left: 0; padding-top: 26px; border-top: 1px solid var(--line); }
  .mini-seg { margin-left: 0; }
  .fg-head .mini-seg { order: 3; flex-basis: auto; }
  /* полный список стран/языков — в своей рамке с прокруткой, поиск прилипает к её верху */
  .more-search {
    position: sticky; top: 0; z-index: 2;
    margin: -10px -10px 0; padding: 10px;
    background: var(--bg); border-radius: 14px 14px 0 0;
  }
  .opts { max-height: min(56vh, 440px); grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .panel-foot { background: rgba(12, 12, 14, .98); padding-bottom: env(safe-area-inset-bottom); }
  .panel-foot-in { padding-block: 12px; }
  .panel-foot .btn-sm { flex: 1 1 0; padding: 0 12px; }
  .panel-foot #panelDone { flex-grow: 1.6; }

  .res-actions { flex-direction: column; align-items: stretch; width: 100%; max-width: 340px; }
  .res-actions .btn { width: 100%; }
  .res-meta { font-size: 13.5px; }
  /* оригинальное название — своей строкой, жанры и рейтинг — следующей, без висящей «·» */
  .res-meta > i { flex-basis: 100%; }
  .res-meta > i + .sep { display: none; }
  .res-meta .rate { white-space: nowrap; }
  .dedication { font-size: 16px; }
  .dedication::before, .dedication::after { width: 22px; margin: 0 12px; }
  .fs-tail { display: none; }
  .sort-seg { width: 100%; }
  /* конец ленты на телефоне: фраза целиком, кнопка — своей строкой под ней */
  .feed-end:not([hidden]):not(.is-loading) { display: flex; flex-direction: column; align-items: center; gap: 6px; }
  .feed-end .link-btn { margin-left: 0; }
  .sort-seg button { flex: 1 1 0; justify-content: center; padding: 0 8px; }
  .has-foot .site-foot { padding-bottom: calc(88px + env(safe-area-inset-bottom)); }
  .grid { --cw: 140px; }
  .totop span { display: none; }
  .totop { padding: 0; width: 48px; height: 48px; justify-content: center; }
}

/* узкий телефон: длинные «Великобритания», «Сербохорватский» — в одну колонку, без переносов посреди слова */
@media (max-width: 479px) {
  .opts { grid-template-columns: minmax(0, 1fr); }
  /* рейтинг на узком экране: звезда над числом; «Любой» — шире, чтобы слово не упиралось в края пилюли */
  #ratingChips { grid-template-columns: minmax(0, 1.5fr) repeat(5, minmax(0, 1fr)); border-radius: 22px; }
  #ratingChips .chip { flex-direction: column; gap: 2px; padding: 4px 2px; line-height: 1.15; border-radius: 19px; }
  #ratingChips .chip > .ico { width: 15px; height: 15px; }
  /* подпись карточки «год · жанр» не обрезается: значок вида и зазоры — компактнее */
  .card-meta { gap: 5px; font-size: 12px; }
  .card-meta > .cm { gap: 4px; }
  .ico-kind { width: 12px; height: 12px; }
  .card-meta .rate { gap: 2px; }
  .card-meta .rate .ico { width: 10px; height: 10px; }
}
@media (max-width: 379px) {
  .card-meta { gap: 4px; font-size: 11.5px; }
  .card-meta > .cm { gap: 3px; }
}

@media (max-width: 389px) {
  .bar-in { gap: 6px; }
  .seg button { font-size: 13px; padding: 0 4px; gap: 4px; }
  .panel-foot .btn-sm { padding: 0 10px; }
  #durChips { display: grid; grid-template-columns: 1fr 1fr; }
  #durChips .chip { padding: 0 8px; }
}

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