:root {
  --bg: #07070b;
  --bg-2: #101018;
  --card: #16161f;
  --line: rgba(255,255,255,.08);
  --text: #f4f1ea;
  --muted: #9a958a;
  --red: #e11d48;
  --gold: #d4a017;
  --gold-2: #f0c14b;
  --ok: #3dd68c;
  --shadow: 0 24px 80px rgba(0,0,0,.45);
  --radius: 22px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); overflow-x: clip; overflow-y: auto; }
body {
  font-family: Manrope, system-ui, sans-serif;
  background:
    radial-gradient(900px 500px at 50% -10%, rgba(225,29,72,.18), transparent 55%),
    radial-gradient(700px 400px at 100% 80%, rgba(212,160,23,.08), transparent 50%),
    var(--bg);
}
body::before {
  content: "";
  pointer-events: none;
  position: fixed;
  inset: 0;
  opacity: .08;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='140' height='140'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='.8' numOctaves='2'/></filter><rect width='100%' height='100%' filter='url(%23n)' opacity='.55'/></svg>");
  mix-blend-mode: overlay;
}
a { color: var(--gold-2); text-decoration: none; }
a:hover { text-decoration: underline; }
button, select, input { font: inherit; }
.wrap { width: min(1120px, calc(100% - 28px)); margin: 0 auto; padding: 20px 0 48px; overflow: visible; }
header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 22px; }
.brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.logo {
  width: 42px; height: 42px; border-radius: 12px;
  background: #0b0b10; border: 1px solid rgba(225,29,72,.45);
  display: grid; place-items: center; color: var(--red);
}
.brand b { font-family: Unbounded, Manrope, sans-serif; font-size: 1.15rem; letter-spacing: .06em; }
.brand span { display: block; color: var(--muted); font-size: .78rem; font-weight: 600; }
.head-right { display: flex; align-items: center; gap: 12px; }
.stats { margin: 0; text-align: right; color: var(--muted); font-size: .82rem; font-weight: 600; }
.stats b { color: var(--gold-2); font-weight: 800; }
.panel {
  background: linear-gradient(180deg, rgba(255,255,255,.03), rgba(255,255,255,.015));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow);
  overflow: visible;
  min-width: 0;
  max-width: 100%;
}
.panel + .panel { margin-top: 12px; }
label { display: block; }
label em, .likes-head em {
  display: block; font-style: normal; color: var(--muted);
  font-size: .72rem; letter-spacing: .08em; text-transform: uppercase;
  margin-bottom: 6px; font-weight: 700;
}
input[type="search"], input[type="password"], .auth-card input, .modal input {
  width: 100%; appearance: none; background: var(--bg-2); color: var(--text);
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 12px; outline: none;
}
input:focus { border-color: rgba(212,160,23,.7); }
.likes-search { position: relative; }
.suggest {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px);
  z-index: 50; max-height: 320px; overflow: auto; box-shadow: var(--shadow);
  background: #12121a; border: 1px solid var(--line);
  border-radius: 14px; box-shadow: var(--shadow); padding: 6px;
}
.suggest button {
  width: 100%; display: grid; grid-template-columns: 40px 1fr auto;
  gap: 10px; align-items: center; text-align: left;
  border: 0; background: transparent; color: inherit;
  padding: 8px; border-radius: 10px; cursor: pointer;
}
.suggest button:hover, .suggest button.on { background: rgba(255,255,255,.05); }
.suggest img { width: 40px; height: 56px; object-fit: cover; border-radius: 6px; background: #0d0d14; border: 1px solid var(--line); }
.suggest b { display: block; font-size: .9rem; }
.suggest span { color: var(--muted); font-size: .75rem; }
.suggest i { font-style: normal; color: var(--gold-2); font-size: .72rem; font-weight: 800; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; }
.chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: #111118; border: 1px solid rgba(212,160,23,.35);
  color: var(--text); border-radius: 999px; padding: 6px 8px 6px 6px;
  font-size: .82rem; font-weight: 700;
}
.chip.dim { border-color: rgba(225,29,72,.35); }
.chip img { width: 22px; height: 22px; object-fit: cover; border-radius: 50%; background: #0d0d14; }
.chip button { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 4px; }
.likes-hint { margin: 8px 0 0; color: var(--muted); font-size: .82rem; }
.filter-bar { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 8px; }
.filter-btn {
  width: 100%; text-align: left; cursor: pointer;
  background: var(--bg-2); color: var(--text); border: 1px solid var(--line);
  border-radius: 12px; padding: 10px 12px; min-height: 58px;
}
.filter-btn em { display: block; font-style: normal; color: var(--muted); font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; }
.filter-btn b { display: block; margin-top: 4px; font-size: .86rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.filter-btn:hover, .filter-btn.on { border-color: rgba(212,160,23,.55); }
.stage {
  margin-top: 16px; min-height: 360px; position: relative; overflow: hidden;
  display: grid; grid-template-rows: 1fr auto; place-items: center; padding-bottom: 8px;
  background: linear-gradient(180deg, rgba(255,255,255,.02), transparent 30%), var(--card);
}
.stage.has-result, .stage.has-person {
  overflow: hidden; min-height: 0; place-items: stretch; grid-template-rows: auto auto;
}
.reel { display: flex; gap: 14px; align-items: center; padding: 20px 0; }
.stage.is-spinning .reel { animation: reel 1.15s cubic-bezier(.2,.8,.2,1) infinite; filter: blur(1.2px); }
@keyframes reel { from { transform: translateX(40px); } to { transform: translateX(-220px); } }
.frame {
  width: 118px; height: 176px; border-radius: 10px; flex: 0 0 auto;
  background: #1c1c28; border: 2px solid rgba(255,255,255,.06);
  box-shadow: inset 0 0 0 6px #0b0b10; position: relative; overflow: hidden;
}
.frame::before, .frame::after {
  content: ""; position: absolute; left: 0; right: 0; height: 10px;
  background: repeating-linear-gradient(90deg, #0b0b10 0 8px, #2a2a36 8px 16px);
}
.frame::after { bottom: 0; top: auto; }
.frame i { position: absolute; inset: 14px 8px; border-radius: 4px; background: linear-gradient(160deg, var(--a, #3a1b24), var(--b, #1a1a28)); }
.spin-copy {
  position: absolute; bottom: 22px; text-align: center;
  font-family: Unbounded, sans-serif; letter-spacing: .12em; font-size: .78rem; color: var(--gold-2);
}
.idle { text-align: center; padding: 28px 16px 18px; }
.idle h1 { font-family: Unbounded, sans-serif; font-size: clamp(1.6rem, 4vw, 2.6rem); margin: 0 0 10px; line-height: 1.15; }
.idle p { margin: 0 auto 8px; max-width: 540px; color: var(--muted); }
.stage > :not(.cta) { grid-area: 1 / 1; }
.cta {
  grid-area: 2 / 1;
  display: block; margin: 10px auto 16px; width: min(280px, calc(100% - 28px));
  min-height: 48px; border: 1px solid rgba(212,160,23,.35); border-radius: 14px; cursor: pointer;
  color: var(--gold-2); font-weight: 800; letter-spacing: .08em; text-transform: uppercase;
  background: #14141c;
}
.cta-ring { display: none; }
.cta-face { display: grid; place-items: center; min-height: 46px; }
.cta:hover { border-color: rgba(212,160,23,.7); background: #19191f; }
.cta.is-busy .cta-face { opacity: .7; }
.cta:disabled { cursor: wait; }
.result, .person-page {
  width: 100%; min-width: 0; max-width: 100%; display: none;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 22px; padding: 22px; align-items: start;
}
.stage.has-result .result { display: grid; }
.stage.has-person .person-page { display: grid; }
.stage.has-result .idle, .stage.has-result .reel, .stage.has-result .spin-copy,
.stage.has-person .idle, .stage.has-person .reel, .stage.has-person .spin-copy,
.stage.has-person .result { display: none; }
.poster { width: 100%; aspect-ratio: 2/3; object-fit: cover; border-radius: 14px; background: #0d0d14; border: 1px solid var(--line); }
.player { display: none; width: 100%; aspect-ratio: 16/9; border-radius: 14px; overflow: hidden; border: 1px solid var(--line); background: #000; }
.player.on { display: block; }
.player iframe { width: 100%; height: 100%; border: 0; }
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  background: rgba(225,29,72,.14); color: #ff7a96;
  border: 1px solid rgba(225,29,72,.3);
  border-radius: 999px; padding: 4px 10px; font-size: .78rem; font-weight: 700;
}
.badge.gold { background: rgba(212,160,23,.12); color: var(--gold-2); border-color: rgba(212,160,23,.3); }
.meta { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0 14px; }
.result h2, .person-page h2, .cabinet h2, .modal h2 {
  font-family: Unbounded, sans-serif; font-size: clamp(1.2rem, 3vw, 1.8rem); margin: 8px 0 0; line-height: 1.2;
}
.orig { color: var(--muted); margin: 6px 0 0; }
.desc { color: #d7d2c8; line-height: 1.55; margin: 14px 0 18px; overflow-wrap: anywhere; }
.desc a, .facts a { color: var(--gold-2); font-weight: 700; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: 44px; padding: 0 16px; border-radius: 12px;
  border: 1px solid var(--line); background: #111118; color: var(--text);
  text-decoration: none; font-weight: 700; cursor: pointer;
}
.btn.primary { background: var(--red); border-color: transparent; color: #fff; }
.btn.ghost { min-height: 38px; }
.btn.on { border-color: rgba(212,160,23,.55); color: var(--gold-2); }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn {
  width: 44px; min-width: 44px; padding: 0; position: relative;
}
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; }
.icon-btn[data-tip]::after {
  content: attr(data-tip); position: absolute; left: 50%; bottom: calc(100% + 8px);
  transform: translateX(-50%); white-space: nowrap; pointer-events: none;
  background: #0b0b10; color: var(--text); border: 1px solid var(--line);
  border-radius: 8px; padding: 5px 8px; font-size: .72rem; font-weight: 700;
  opacity: 0; transition: opacity .15s;
}
.icon-btn:hover::after, .icon-btn:focus-visible::after { opacity: 1; }
.more { grid-column: 1 / -1; display: grid; gap: 18px; min-width: 0; max-width: 100%; overflow: hidden; }
.block { min-width: 0; max-width: 100%; overflow: hidden; }
.block h3 {
  margin: 0 0 10px; font-size: .72rem; letter-spacing: .1em;
  text-transform: uppercase; color: var(--muted);
}
.carousel {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow: visible;
}
.car-track {
  display: flex;
  flex-wrap: nowrap;
  gap: 12px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding: 4px 42px 10px;
  cursor: grab;
  touch-action: manipulation;
  user-select: none;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}
.car-track.is-drag { cursor: grabbing; scroll-snap-type: none; }
.car-track::-webkit-scrollbar { display: none; }
.car-btn {
  position: absolute; top: 58px; z-index: 6;
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line);
  background: #111118; color: var(--text); cursor: pointer; font-size: 1.2rem; line-height: 1;
  pointer-events: auto;
  display: grid; place-items: center;
}
.car-btn.prev { left: 4px; }
.car-btn.next { right: 4px; }
.carousel:not(.is-overflow) .car-btn { display: none; }
.car-track > button,
.thumb,
.poster-grid button {
  flex: 0 0 112px;
  flex-shrink: 0;
  width: 112px;
  min-width: 112px;
  max-width: 112px;
  overflow: hidden;
  scroll-snap-align: start;
  padding: 0; border: 0;
  background: transparent; color: inherit; cursor: pointer; text-align: left;
}
.thumb-art { position: relative; display: block; width: 112px; }
.thumb-rates {
  position: absolute; left: 5px; right: 5px; bottom: 6px;
  display: flex; gap: 4px; flex-wrap: wrap;
}
.thumb-rates i {
  font-style: normal; font-size: .62rem; font-weight: 800;
  padding: 2px 5px; border-radius: 6px; background: rgba(7,7,11,.78);
  border: 1px solid rgba(255,255,255,.08);
}
.thumb-rates .kp { color: var(--gold-2); }
.thumb-rates .imdb { color: #f5c518; }
.thumb-play {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; border-radius: 50%;
  background: rgba(0,0,0,.7); color: #fff;
  display: grid; place-items: center;
}
.thumb-play svg { width: 12px; height: 12px; fill: currentColor; stroke: none; }
.car-track > button.person {
  flex-basis: 112px;
}
.person img {
  width: 112px; height: 112px; object-fit: cover; border-radius: 50%;
  border: 1px solid var(--line); background: #111; display: block;
}
.car-track > button:not(.person):not(.is-still) img,
.thumb img,
.poster-grid img,
.strip img {
  width: 112px; height: 166px; object-fit: cover; border-radius: 12px;
  border: 1px solid var(--line); background: #111; display: block;
}
.car-track > button.is-still {
  flex: 0 0 208px; width: 208px; min-width: 208px; max-width: 208px;
}
.car-track > button.is-still img {
  width: 208px; height: 130px; object-fit: cover; border-radius: 12px;
  border: 1px solid var(--line); background: #111; display: block;
}
.car-track > button b,
.thumb b,
.poster-grid b,
.person b,
.strip b {
  display: block; margin-top: 6px; font-size: .72rem; line-height: 1.25;
  color: #d6d1c7; font-weight: 700;
  width: 100%; max-width: 100%;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.person span {
  display: block; color: var(--muted); font-size: .68rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.facts { margin: 0; padding-left: 18px; color: #d7d2c8; line-height: 1.5; overflow-wrap: anywhere; }
.facts li { margin: 0 0 8px; }
.tabs { display: flex; gap: 8px; margin: 18px 0 10px; flex-wrap: wrap; }
.tab {
  border: 1px solid var(--line); background: #111118; color: var(--muted);
  border-radius: 999px; padding: 8px 12px; cursor: pointer; font-weight: 700; font-size: .82rem;
}
.tab.on { color: var(--text); border-color: rgba(212,160,23,.45); background: #19191f; }
.strip-empty { color: var(--muted); font-size: .86rem; padding: 8px 0 18px; }
.empty, .error { display: none; text-align: center; padding: 48px 20px; }
.stage.is-empty .empty, .stage.is-error .error { display: block; }
.stage.is-empty .idle, .stage.is-error .idle, .stage.is-empty .reel, .stage.is-error .reel { display: none; }
.history { margin-top: 18px; min-width: 0; }
.history h3 { margin: 0 0 10px; font-size: .78rem; letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.cabinet.panel { overflow: visible; min-width: 0; }
.cabinet-head { display: flex; justify-content: space-between; gap: 12px; align-items: center; }
.cabinet-grid { display: grid; gap: 22px; margin-top: 16px; min-width: 0; }
.cabinet-grid .block { overflow: visible; min-width: 0; }
.ai-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.ai-box { margin-top: 14px; min-width: 0; }
#aiResults, #cabAiResults { margin-top: 12px; min-width: 0; position: relative; z-index: 20; }
.poster-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, 112px);
  gap: 14px 12px;
}
.poster-grid button { max-width: 112px; }
.modal, .lightbox {
  position: fixed; inset: 0; z-index: 40; display: none;
  background: rgba(7,7,11,.78); overflow: auto; padding: 20px 12px 40px;
}
.modal.on, .lightbox.on { display: flex; align-items: center; justify-content: center; }
.modal-card, .lightbox-card {
  width: min(720px, 100%); background: var(--card); border: 1px solid var(--line);
  border-radius: 22px; padding: 18px; box-shadow: var(--shadow);
}
.checks { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 4px; max-height: 360px; overflow: auto; }
.check {
  display: inline-flex; align-items: center; gap: 8px; cursor: pointer;
  border: 1px solid var(--line); border-radius: 12px; padding: 8px 12px 8px 10px;
  background: #111118; color: var(--text); font-size: .84rem; font-weight: 700;
}
.check .box {
  width: 16px; height: 16px; flex: 0 0 16px;
  border: 1.5px solid rgba(255,255,255,.22);
  border-radius: 4px; background: #0d0d14;
  display: grid; place-items: center;
}
.check .box::after {
  content: ""; width: 8px; height: 5px;
  border-left: 2px solid #1a1203;
  border-bottom: 2px solid #1a1203;
  transform: rotate(-45deg) translateY(-1px);
  opacity: 0;
}
.check.on { border-color: rgba(212,160,23,.55); color: var(--gold-2); }
.check.on .box { background: var(--gold); border-color: var(--gold); }
.check.on .box::after { opacity: 1; }
.lightbox { gap: 10px; }
.lightbox-card { width: min(980px, 100%); padding: 10px; background: #0b0b10; }
.lightbox-card img { width: 100%; max-height: 78vh; object-fit: contain; border-radius: 12px; display: block; }
.lightbox-card figcaption { text-align: center; color: var(--muted); margin-top: 8px; font-size: .82rem; }
.lightbox .car-btn { position: static; transform: none; width: 44px; height: 44px; }
.auth-error { color: #ff7a96; font-weight: 700; }
.auth-card label { margin-top: 10px; }
footer { margin-top: 28px; color: var(--muted); font-size: .78rem; text-align: center; }
body.is-cabinet .stage, body.is-cabinet #likesPanel, body.is-cabinet #filterPanel, body.is-cabinet #aiPanel,
body.is-cabinet #tabs, body.is-cabinet #listBox { display: none; }
body.is-cabinet #cabinet { display: block; }
body.is-locked .wrap > :not(header) { display: none !important; }
body.is-locked header .stats, body.is-locked #cabinetBtn { display: none; }
body.is-locked #authModal { display: flex; align-items: center; justify-content: center; }
body.is-locked #authModal .auth-card { width: min(420px, 100%); }
@media (max-width: 860px) {
  .filter-bar { grid-template-columns: 1fr 1fr; }
  .result, .person-page { grid-template-columns: 1fr; }
  .poster { width: min(200px, 60vw); justify-self: center; margin: 0 auto; }
  .more { grid-column: 1; }
  .wrap { width: min(1120px, calc(100% - 18px)); padding-top: 14px; padding-bottom: 88px; }
  .stage { min-height: 280px; padding-bottom: 8px; }
  .idle { padding: 16px 12px 8px; }
  .idle h1 { font-size: 1.45rem; }
  .stats { display: none; }
  .panel { overflow: visible; }
  .ai-row { grid-template-columns: 1fr; }
  .ai-row .btn { width: 100%; }
  .car-track { padding-inline: 4px; scroll-padding-inline: 4px; }
  .car-btn { display: grid; width: 38px; height: 38px; }
  .suggest { position: fixed; left: 8px; right: 8px; top: auto; bottom: 80px; z-index: 100; max-height: 50vh; }
  .cta {
    position: fixed;
    left: 16px;
    right: 16px;
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    width: auto;
    margin: 0;
    z-index: 25;
    box-shadow: 0 10px 28px rgba(0,0,0,.45);
    background: #1a1a22;
  }
  body.is-locked .cta, body.is-cabinet .cta { display: none; }
}

.cinema-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}
.cinema-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: linear-gradient(135deg, rgba(212,160,23,.15), rgba(225,29,72,.1));
  border: 1px solid rgba(212,160,23,.3);
  border-radius: 12px;
  color: var(--gold-2);
  font-weight: 700;
  font-size: .84rem;
  text-decoration: none;
  transition: all .2s;
}
.cinema-link:hover {
  background: linear-gradient(135deg, rgba(212,160,23,.25), rgba(225,29,72,.15));
  border-color: rgba(212,160,23,.5);
  transform: translateY(-1px);
}
.cinema-link::before {
  content: "▶";
  font-size: .7rem;
}
