:root {
  --bg: #0b0a10;
  --bg-2: #14121c;
  --card: #1a1724;
  --line: rgba(255, 255, 255, 0.08);
  --text: #f4f1fa;
  --muted: #9b95ab;
  --accent: #ff3d6e;
  --accent-2: #ffb547;
  --good: #3ddc97;
  --radius: 18px;
  --display: 'Unbounded', system-ui, sans-serif;
  --body: 'Manrope', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font-family: var(--body); }
body { min-height: 100vh; overflow-x: hidden; }
button { font: inherit; color: inherit; cursor: pointer; }
img { display: block; }

.bg-glow {
  position: fixed; inset: -20% -10% auto; height: 80vh; pointer-events: none; z-index: 0;
  background:
    radial-gradient(40% 50% at 20% 30%, rgba(255, 61, 110, 0.18), transparent 70%),
    radial-gradient(35% 45% at 80% 20%, rgba(255, 181, 71, 0.12), transparent 70%);
  filter: blur(40px);
}

/* ---------- Шапка ---------- */
.top {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px clamp(16px, 4vw, 48px);
  background: rgba(11, 10, 16, 0.7); backdrop-filter: blur(16px);
  border-bottom: 1px solid var(--line);
}
.logo { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text);
  font-family: var(--display); font-weight: 700; font-size: 18px; }
.logo em { font-style: normal; color: var(--accent); }
.logo-mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2)); font-size: 14px; color: #fff; }
.tabs { display: flex; gap: 4px; background: var(--bg-2); padding: 4px; border-radius: 14px; border: 1px solid var(--line); }
.tab { border: 0; background: transparent; padding: 9px 16px; border-radius: 10px; font-weight: 600; color: var(--muted);
  transition: .2s; display: flex; align-items: center; gap: 8px; }
.tab:hover { color: var(--text); }
.tab.active { background: var(--card); color: var(--text); box-shadow: 0 2px 12px rgba(0, 0, 0, .4); }
.badge { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--accent); color: #fff;
  font-size: 11px; display: inline-grid; place-items: center; transition: transform .3s; }
.badge.bump { animation: bump .4s; }
@keyframes bump { 50% { transform: scale(1.5); } }

main { position: relative; z-index: 1; padding: 0 clamp(16px, 4vw, 48px) 80px; }
.view { display: none; animation: fade .4s ease; }
.view.active { display: block; }
@keyframes fade { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Hero ---------- */
.hero { position: relative; margin: 24px 0; border-radius: 28px; overflow: hidden; min-height: 420px;
  display: flex; align-items: flex-end; background: var(--bg-2); }
.hero-bg { position: absolute; inset: 0; background-size: cover; background-position: center 20%; transition: opacity .8s; }
.hero::after { content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, rgba(11, 10, 16, .95) 0%, rgba(11, 10, 16, .6) 45%, transparent 75%),
              linear-gradient(0deg, rgba(11, 10, 16, .9), transparent 50%); }
.hero-content { position: relative; z-index: 1; padding: clamp(24px, 4vw, 56px); max-width: 640px; }
.hero-tag { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--accent-2); margin-bottom: 12px; }
.hero h1 { font-family: var(--display); font-size: clamp(28px, 4.5vw, 56px); line-height: 1.05; margin: 0 0 14px; }
.hero p { color: #cfc9dc; line-height: 1.6; margin: 0 0 22px; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ---------- Кнопки ---------- */
.btn { border: 0; border-radius: 12px; padding: 12px 20px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px;
  background: linear-gradient(135deg, var(--accent), #ff6b4a); color: #fff; transition: transform .15s, box-shadow .2s;
  box-shadow: 0 6px 24px rgba(255, 61, 110, .35); }
.btn:hover { transform: translateY(-2px); box-shadow: 0 10px 30px rgba(255, 61, 110, .5); }
.btn.ghost { background: rgba(255, 255, 255, .07); box-shadow: none; border: 1px solid var(--line); }
.btn.ghost:hover { background: rgba(255, 255, 255, .12); }
.btn.small { padding: 8px 12px; font-size: 13px; border-radius: 10px; }
.btn.added { background: var(--good); box-shadow: 0 6px 24px rgba(61, 220, 151, .3); color: #0b0a10; }

/* ---------- Фильтры ---------- */
.filters { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.search { position: relative; flex: 1 1 220px; }
.filters input, .filters select {
  width: 100%; background: var(--bg-2); border: 1px solid var(--line); color: var(--text);
  padding: 12px 14px; border-radius: 12px; font: inherit; outline: none; transition: border .2s;
}
.filters select { width: auto; flex: 0 1 auto; cursor: pointer; }
.filters input:focus, .filters select:focus { border-color: var(--accent); }
.suggest { position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 10; background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; display: none; box-shadow: 0 20px 40px rgba(0, 0, 0, .5); }
.suggest.open { display: block; }
.suggest button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: none; text-align: left; }
.suggest button:hover { background: rgba(255, 255, 255, .06); }
.suggest img, .suggest .ph { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; background: var(--bg-2); flex: none; }
.suggest small { color: var(--muted); display: block; font-size: 12px; }

.chips { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 18px; }
.chip { border: 1px solid var(--line); background: var(--bg-2); padding: 8px 14px; border-radius: 999px; font-size: 14px;
  font-weight: 600; color: var(--muted); transition: .2s; }
.chip:hover { color: var(--text); border-color: rgba(255, 255, 255, .2); }
.chip.on { background: var(--accent); border-color: var(--accent); color: #fff; }
.active-person:empty { display: none; }
.active-person { display: inline-flex; align-items: center; gap: 10px; margin-bottom: 18px; padding: 6px 8px 6px 6px;
  background: var(--card); border: 1px solid var(--accent); border-radius: 999px; }
.active-person img { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; }
.active-person button { border: 0; background: rgba(255, 255, 255, .1); width: 24px; height: 24px; border-radius: 50%; }

/* ---------- Сетка ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 20px; }
.card { position: relative; cursor: pointer; animation: rise .5s ease backwards; }
@keyframes rise { from { opacity: 0; transform: translateY(16px) scale(.97); } }
.poster { position: relative; aspect-ratio: 2/3; border-radius: 14px; overflow: hidden; background: var(--card);
  transition: transform .3s, box-shadow .3s; }
.poster img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s; }
.card:hover .poster { transform: translateY(-6px); box-shadow: 0 20px 40px rgba(0, 0, 0, .6), 0 0 0 2px var(--accent); }
.card:hover .poster img { transform: scale(1.06); }
.poster .noimg { display: grid; place-items: center; height: 100%; color: var(--muted); font-size: 40px; }
.rating { position: absolute; top: 10px; left: 10px; padding: 4px 8px; border-radius: 8px; font-size: 13px; font-weight: 800;
  background: rgba(11, 10, 16, .8); backdrop-filter: blur(6px); }
.rating.hi { color: var(--good); } .rating.mid { color: var(--accent-2); } .rating.lo { color: #ff7a7a; }
.add { position: absolute; top: 8px; right: 8px; width: 36px; height: 36px; border-radius: 50%; border: 0;
  background: rgba(11, 10, 16, .8); backdrop-filter: blur(6px); font-size: 18px; font-weight: 700;
  opacity: 0; transform: scale(.8); transition: .2s; }
.card:hover .add, .add.in { opacity: 1; transform: none; }
.add.in { background: var(--good); color: #0b0a10; }
.card h3 { font-size: 15px; margin: 10px 0 2px; line-height: 1.3; }
.card .meta { color: var(--muted); font-size: 13px; }
.more-wrap { display: flex; justify-content: center; margin-top: 30px; }
.empty { grid-column: 1/-1; text-align: center; color: var(--muted); padding: 60px 0; }
.skeleton .poster { background: linear-gradient(100deg, var(--card) 30%, #252134 50%, var(--card) 70%); background-size: 200% 100%;
  animation: shimmer 1.2s infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Модалка ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(0, 0, 0, .75); backdrop-filter: blur(8px); animation: fadein .3s; }
@keyframes fadein { from { opacity: 0; } }
.modal-body { position: relative; width: min(1000px, 100%); max-height: 92vh; overflow-y: auto; background: var(--bg-2);
  border-radius: 24px; border: 1px solid var(--line); animation: pop .4s cubic-bezier(.2, .9, .3, 1.2); }
@keyframes pop { from { opacity: 0; transform: scale(.92) translateY(20px); } }
.m-hero { position: relative; aspect-ratio: 16/7; background-size: cover; background-position: center; }
.m-hero::after { content: ''; position: absolute; inset: 0; background: linear-gradient(0deg, var(--bg-2), transparent 70%); }
.m-close { position: absolute; top: 14px; right: 14px; z-index: 2; width: 40px; height: 40px; border-radius: 50%; border: 0;
  background: rgba(0, 0, 0, .6); font-size: 20px; }
.m-main { display: grid; grid-template-columns: 200px 1fr; gap: 28px; padding: 0 32px 32px; margin-top: -120px; position: relative; z-index: 1; }
.m-poster { width: 200px; border-radius: 14px; box-shadow: 0 20px 50px rgba(0, 0, 0, .7); }
.m-info h2 { font-family: var(--display); font-size: clamp(22px, 3vw, 34px); margin: 60px 0 6px; line-height: 1.1; }
.m-orig { color: var(--muted); margin-bottom: 14px; }
.m-tags { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.m-tags span { padding: 5px 10px; border-radius: 8px; background: rgba(255, 255, 255, .07); font-size: 13px; font-weight: 600; }
.m-tags .score { background: var(--accent-2); color: #0b0a10; }
.m-info p { line-height: 1.7; color: #d8d2e4; }
.m-section { padding: 0 32px 28px; }
.m-section h4 { font-family: var(--display); font-size: 15px; margin: 0 0 14px; color: var(--muted); font-weight: 500; letter-spacing: .05em; text-transform: uppercase; }
.trailer { aspect-ratio: 16/9; border-radius: 14px; overflow: hidden; background: #000; }
.trailer iframe { width: 100%; height: 100%; border: 0; }
.trailer-tabs { display: flex; gap: 6px; margin-bottom: 10px; flex-wrap: wrap; }
.cast { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; scrollbar-width: thin; }
.cast-item { flex: none; width: 96px; text-align: center; font-size: 12px; cursor: pointer; }
.cast-item img, .cast-item .ph { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; background: var(--card); margin-bottom: 6px; transition: .2s; }
.cast-item:hover img { box-shadow: 0 0 0 3px var(--accent); }
.cast-item b { display: block; font-size: 13px; }
.cast-item span { color: var(--muted); }
.similar { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 14px; }
.similar .card h3 { font-size: 13px; }

/* ---------- Подбор ---------- */
.quiz-card { max-width: 760px; margin: 40px auto; padding: clamp(24px, 4vw, 44px); background: var(--bg-2);
  border-radius: 28px; border: 1px solid var(--line); position: relative; overflow: hidden; }
.quiz-progress { height: 4px; background: var(--line); border-radius: 4px; margin-bottom: 30px; overflow: hidden; }
.quiz-progress div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .4s; }
.quiz-step { animation: slide .4s ease; }
@keyframes slide { from { opacity: 0; transform: translateX(30px); } }
.quiz-step h2 { font-family: var(--display); font-size: clamp(22px, 3vw, 32px); margin: 0 0 8px; }
.quiz-step .sub { color: var(--muted); margin: 0 0 24px; }
.options { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px; }
.opt { border: 1px solid var(--line); background: var(--card); padding: 16px; border-radius: 14px; text-align: left;
  transition: .2s; font-weight: 600; }
.opt .e { font-size: 26px; display: block; margin-bottom: 6px; }
.opt:hover { border-color: rgba(255, 255, 255, .25); transform: translateY(-2px); }
.opt.on { border-color: var(--accent); background: rgba(255, 61, 110, .12); }
.quiz-nav { display: flex; justify-content: space-between; margin-top: 28px; gap: 10px; }
.quiz-result-head { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; max-width: 760px; margin: 0 auto 20px; }
#quizGrid { margin-top: 10px; }

/* ---------- Рулетка ---------- */
.roulette-layout { display: grid; grid-template-columns: 1fr 360px; gap: 30px; margin-top: 30px; align-items: start; }
.wheel-zone { display: flex; flex-direction: column; align-items: center; }
.wheel-wrap { position: relative; width: min(560px, 100%); aspect-ratio: 1; }
.wheel-wrap::before { content: ''; position: absolute; inset: -14px; border-radius: 50%;
  background: conic-gradient(from 0deg, var(--accent), var(--accent-2), var(--accent));
  filter: blur(30px); opacity: .35; animation: spinglow 8s linear infinite; }
@keyframes spinglow { to { transform: rotate(360deg); } }
#wheel { position: relative; width: 100%; height: 100%; border-radius: 50%; }
.pointer { position: absolute; top: -8px; left: 50%; transform: translateX(-50%); z-index: 3; width: 0; height: 0;
  border-left: 20px solid transparent; border-right: 20px solid transparent; border-top: 40px solid #fff;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, .6)); }
.pointer.tick { animation: tick .1s; }
@keyframes tick { 50% { transform: translateX(-50%) rotate(-14deg); } }
.spin { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 2; width: 26%; aspect-ratio: 1;
  border-radius: 50%; border: 6px solid #fff; background: radial-gradient(circle at 35% 30%, #ff6b8f, var(--accent) 60%, #b81a45);
  font-family: var(--display); font-weight: 900; font-size: clamp(12px, 2vw, 18px); letter-spacing: .05em;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .6), inset 0 -6px 12px rgba(0, 0, 0, .3); transition: transform .2s; }
.spin:hover:not(:disabled) { transform: translate(-50%, -50%) scale(1.06); }
.spin:disabled { filter: grayscale(.6); cursor: default; }
.hint { color: var(--muted); text-align: center; margin-top: 18px; }

.pool { background: var(--bg-2); border: 1px solid var(--line); border-radius: 24px; padding: 20px; }
.pool-head { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.pool-head h2 { font-family: var(--display); font-size: 18px; margin: 0; }
.pool-actions { display: flex; gap: 6px; }
.pool-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; max-height: 60vh; overflow-y: auto; }
.pool-list li { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 12px; background: var(--card);
  animation: rise .3s ease backwards; border-left: 4px solid var(--c); }
.pool-list img { width: 40px; height: 60px; object-fit: cover; border-radius: 6px; }
.pool-list .t { flex: 1; min-width: 0; }
.pool-list .t b { display: block; font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pool-list .t small { color: var(--muted); }
.pool-list button { border: 0; background: none; color: var(--muted); font-size: 18px; padding: 4px 8px; }
.pool-list button:hover { color: var(--accent); }
.pool-empty { color: var(--muted); text-align: center; padding: 30px 10px; line-height: 1.6; }

/* ---------- Победитель ---------- */
.winner { position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(0, 0, 0, .85);
  backdrop-filter: blur(10px); animation: fadein .4s; padding: 20px; }
.winner[hidden] { display: none; }
#confetti { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.winner-card { position: relative; text-align: center; max-width: 420px; animation: winpop .8s cubic-bezier(.2, 1.4, .4, 1); }
@keyframes winpop { from { opacity: 0; transform: scale(.3) rotate(-8deg); } }
.winner-card .lbl { font-family: var(--display); letter-spacing: .2em; color: var(--accent-2); font-size: 13px; margin-bottom: 16px; }
.winner-card img { width: min(260px, 60vw); margin: 0 auto 20px; border-radius: 16px;
  box-shadow: 0 0 0 3px var(--accent-2), 0 0 80px rgba(255, 181, 71, .5); }
.winner-card h2 { font-family: var(--display); font-size: clamp(24px, 4vw, 34px); margin: 0 0 8px; }
.winner-card .actions { display: flex; gap: 10px; justify-content: center; margin-top: 22px; flex-wrap: wrap; }

.toast { position: fixed; bottom: 24px; left: 50%; transform: translate(-50%, 120px); z-index: 70; background: var(--card);
  border: 1px solid var(--line); padding: 12px 20px; border-radius: 12px; transition: transform .3s; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.toast.show { transform: translate(-50%, 0); }

.setup { max-width: 600px; margin: 60px auto; text-align: center; padding: 40px; background: var(--bg-2); border-radius: 24px; border: 1px solid var(--line); line-height: 1.7; }
.setup code { background: var(--card); padding: 2px 8px; border-radius: 6px; }

@media (max-width: 900px) {
  .roulette-layout { grid-template-columns: 1fr; }
  .m-main { grid-template-columns: 1fr; margin-top: -60px; }
  .m-poster { width: 140px; }
  .m-info h2 { margin-top: 10px; }
}
@media (max-width: 600px) {
  .top { flex-direction: column; gap: 10px; }
  .tab { padding: 8px 12px; font-size: 14px; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 14px; }
  .hero { min-height: 340px; }
  .m-main, .m-section { padding-left: 18px; padding-right: 18px; }
  .filters select { flex: 1 1 45%; }
}

/* ---------- Рейтинги ---------- */
.m-ratings { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.rt-badge { display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: 12px; text-decoration: none;
  color: var(--text); background: var(--card); border: 1px solid var(--line); min-width: 84px; animation: rise .4s ease backwards; transition: transform .15s; }
a.rt-badge:hover { transform: translateY(-2px); }
.rt-badge i { font-style: normal; font-size: 11px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.rt-badge b { font-family: var(--display); font-size: 20px; }
.rt-badge.tmdb { border-color: #01b4e4; } .rt-badge.tmdb b { color: #5fd4f5; }
.rt-badge.kp { border-color: #ff6600; } .rt-badge.kp b { color: #ff8a3d; }
.rt-badge.imdb { border-color: #f5c518; } .rt-badge.imdb b { color: #f5c518; }
.rt-badge.rt { border-color: #fa320a; }
.rt-badge.mc { border-color: #66cc33; } .rt-badge.mc b { color: #7fdc4f; }

/* ---------- Мобильные правки ---------- */
html, body { overflow-x: clip; }
.wheel-zone { overflow: hidden; padding: 20px 6px; }
.pool-list li.pool-empty { display: block; }
@media (max-width: 600px) {
  .filters { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
  .filters .search { grid-column: 1 / -1; }
  .filters input, .filters select { padding: 10px; font-size: 14px; }
  .chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 -16px 16px; padding: 0 16px 4px; scrollbar-width: none; }
  .chip { flex: none; }
  .hero-actions .btn { flex: 1; justify-content: center; }
  .roulette-layout { margin-top: 10px; gap: 20px; }
  .pool-list { max-height: none; }
  .winner-card .actions .btn { flex: 1 1 100%; justify-content: center; }
  .m-hero { aspect-ratio: 16/10; }
}
.wheel-zone { min-width: 0; }
@media (max-width: 900px) { .roulette-layout { grid-template-columns: minmax(0, 1fr); } }
@media (max-width: 600px) {
  .filters { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .filters select { width: 100%; min-width: 0; padding: 10px 6px; font-size: 13px; }
}
.install { margin-left: auto; box-shadow: none; }
@media (max-width: 600px) { .install { position: absolute; top: 14px; right: 16px; } }
@media (max-width: 600px) { .install { top: 16px; right: 12px; width: 36px; height: 36px; padding: 0; justify-content: center; } .install span { display: none; } }

/* ---------- Отзывы ---------- */
.rv-sum { display: inline-flex; gap: 10px; margin-left: 10px; text-transform: none; letter-spacing: 0; }
.rv-sum b { font-family: var(--body); font-weight: 700; font-size: 13px; }
.rv-sum .pos { color: var(--good); } .rv-sum .neg { color: #ff7a7a; } .rv-sum .neu { color: var(--muted); }
.reviews { display: flex; gap: 14px; overflow-x: auto; padding-bottom: 8px; scroll-snap-type: x mandatory; scrollbar-width: thin; }
.review { flex: 0 0 min(380px, 85%); scroll-snap-align: start; background: var(--card); border: 1px solid var(--line);
  border-top: 3px solid var(--muted); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; }
.review.pos { border-top-color: var(--good); } .review.neg { border-top-color: #ff7a7a; }
.review header { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.review header span { color: var(--muted); font-size: 12px; }
.review h5 { margin: 0 0 8px; font-size: 15px; }
.rv-text { color: #d8d2e4; font-size: 14px; line-height: 1.6; max-height: 9.6em; overflow: hidden; position: relative; }
.review:not(.open) .rv-text::after { content: ''; position: absolute; inset: auto 0 0; height: 3em; background: linear-gradient(transparent, var(--card)); }
.review.open .rv-text { max-height: none; }
.rv-more { margin-top: 10px; align-self: flex-start; border: 0; background: none; color: var(--accent); font-weight: 700; padding: 0; }
