/* ==========================================================================
   CinemaStats design system
   ========================================================================== */

:root {
  --bg: #09090d;
  --bg-2: #0f0f15;
  --surface: #15151d;
  --surface-2: #1d1d28;
  --surface-3: #272734;
  --line: rgba(255, 255, 255, 0.07);
  --line-strong: rgba(255, 255, 255, 0.13);

  --text: #f4f4f7;
  --text-2: #b5b5c4;
  --text-3: #7d7d8f;

  --gold: #f5c518;
  --gold-2: #ffd84d;
  --gold-soft: rgba(245, 197, 24, 0.14);
  --on-gold: #1c1600;
  --orange: #ff8a3d;
  --red: #f26b68;
  --red-soft: rgba(242, 107, 104, 0.12);
  --green: #3ecf8e;
  --green-soft: rgba(62, 207, 142, 0.12);
  --star-empty: #3a3a4a;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 22px;
  --shadow: 0 12px 30px -12px rgba(0, 0, 0, 0.7);
  --shadow-lg: 0 30px 70px -20px rgba(0, 0, 0, 0.85);

  --topbar-h: 64px;
  --tabbar-h: 62px;
  --container: 1240px;
  --gutter: clamp(16px, 4vw, 32px);
  --font: "Plus Jakarta Sans", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;

  color-scheme: dark;
}

/* ---------- Base ---------- */

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; scroll-padding-top: calc(var(--topbar-h) + 16px); }

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.55;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

main { flex: 1 0 auto; }
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
h1, h2, h3, h4 { margin: 0 0 0.5em; line-height: 1.15; letter-spacing: -0.02em; }
h1, h2, h3, h4, p, dd, blockquote, figcaption { overflow-wrap: anywhere; }
p { margin: 0 0 1em; }
hr { border: 0; border-top: 1px solid var(--line); margin: 24px 0; }
[hidden] { display: none !important; }
::selection { background: var(--gold); color: var(--on-gold); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

.container { width: 100%; max-width: var(--container); margin-inline: auto; padding-inline: max(var(--gutter), env(safe-area-inset-left)) max(var(--gutter), env(safe-area-inset-right)); }
.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-link { position: absolute; left: 16px; top: -60px; z-index: 100; padding: 10px 16px; border-radius: var(--radius-sm); background: var(--gold); color: var(--on-gold); font-weight: 700; }
.skip-link:focus { top: 12px; }

.muted { color: var(--text-2); }
.subtle { color: var(--text-3); }
.small { font-size: 0.85rem; }
.gold { color: var(--gold); }
.eyebrow { display: inline-block; margin-bottom: 10px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; color: var(--gold); }

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 42px;
  padding: 0 18px;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.92rem;
  font-weight: 700;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}
.btn:active { transform: scale(0.97); }
.btn i { font-size: 1.05em; }
.btn--primary { background: var(--gold); color: var(--on-gold); }
.btn--primary:hover { background: var(--gold-2); }
.btn--ghost { background: transparent; border-color: var(--line-strong); }
.btn--ghost:hover { background: var(--surface-2); }
.btn--subtle { background: var(--surface-2); border-color: var(--line); }
.btn--subtle:hover { background: var(--surface-3); }
.btn--glass { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.14); backdrop-filter: blur(10px); }
.btn--glass:hover { background: rgba(255, 255, 255, 0.18); }
.btn--danger { background: var(--red-soft); border-color: rgba(242, 107, 104, 0.25); color: var(--red); }
.btn--danger:hover { background: rgba(242, 107, 104, 0.2); }
.btn--on { background: var(--green-soft); border-color: rgba(62, 207, 142, 0.35); color: var(--green); }
.btn--on:hover { background: var(--red-soft); border-color: rgba(242, 107, 104, 0.3); color: var(--red); }
.btn--sm { height: 34px; padding: 0 13px; font-size: 0.84rem; }
.btn--lg { height: 52px; padding: 0 26px; font-size: 1rem; }
.btn--block { width: 100%; }
.btn[disabled], .btn.is-loading { opacity: 0.6; pointer-events: none; }
.btn.is-loading::after { content: ""; width: 14px; height: 14px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin 0.7s linear infinite; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  flex: none;
  width: 40px;
  height: 40px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--surface-2);
  font-size: 1rem;
  transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}
.icon-btn:hover { background: var(--surface-3); }
.icon-btn--sm { width: 32px; height: 32px; font-size: 0.85rem; }
.icon-btn--danger:hover { background: var(--red-soft); color: var(--red); border-color: rgba(242, 107, 104, 0.3); }

.link { color: var(--gold); font-weight: 600; }
.link:hover { text-decoration: underline; text-underline-offset: 3px; }

.back-link { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 18px; font-size: 0.9rem; font-weight: 600; color: var(--text-2); }
.back-link:hover { color: var(--text); }

@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Top bar ---------- */

.topbar {
  position: sticky;
  top: 0;
  z-index: 70;
  height: var(--topbar-h);
  background: rgba(9, 9, 13, 0.75);
  border-bottom: 1px solid var(--line);
  backdrop-filter: saturate(160%) blur(18px);
  -webkit-backdrop-filter: saturate(160%) blur(18px);
}
.topbar__inner { display: flex; align-items: center; gap: 20px; height: 100%; }
.topbar__actions { display: flex; gap: 10px; margin-left: auto; }

.brand { display: inline-flex; align-items: center; gap: 10px; flex: none; font-size: 1.18rem; font-weight: 800; letter-spacing: -0.03em; }
.brand__mark { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: linear-gradient(135deg, var(--gold), var(--orange)); color: var(--on-gold); font-size: 1.05rem; box-shadow: 0 6px 20px -6px rgba(245, 197, 24, 0.6); }
.brand__name span { color: var(--gold); }

.topnav { display: flex; gap: 2px; }
.topnav__link { padding: 8px 13px; border-radius: 999px; font-size: 0.9rem; font-weight: 600; color: var(--text-2); transition: background-color 0.2s, color 0.2s; }
.topnav__link:hover { color: var(--text); background: var(--surface-2); }
.topnav__link.is-active { color: var(--text); background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- Search + suggestions ---------- */

.search { position: relative; width: min(380px, 100%); margin-left: auto; }
.search__icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.search__input {
  width: 100%;
  height: 42px;
  padding: 0 44px 0 42px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  outline: none;
  transition: border-color 0.2s, background-color 0.2s, box-shadow 0.2s;
}
.search__input::placeholder { color: var(--text-3); }
.search__input:focus { border-color: rgba(245, 197, 24, 0.6); background: var(--surface-2); box-shadow: 0 0 0 4px var(--gold-soft); }
.search__input::-webkit-search-cancel-button { filter: invert(0.6); }
.search--lg .search__input { height: 56px; padding-left: 50px; font-size: 1.05rem; border-radius: var(--radius); }
.search--lg .search__icon { left: 18px; font-size: 1.1rem; }
.search--lg { width: 100%; margin: 0; }

.suggestions {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  z-index: 70;
  max-height: min(70vh, 480px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
}
.suggestion { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: 10px; }
.suggestion:hover, .suggestion.is-active { background: var(--surface-2); }
.suggestion img { flex: none; width: 36px; height: 54px; object-fit: cover; border-radius: 6px; background: var(--surface-3); }
.suggestion__title { font-size: 0.92rem; font-weight: 600; line-height: 1.3; }
.suggestion__meta { font-size: 0.78rem; color: var(--text-3); text-transform: capitalize; }
.suggestion--all { justify-content: center; padding: 11px; font-size: 0.86rem; font-weight: 700; color: var(--gold); }
.suggestion--empty { justify-content: center; padding: 16px; font-size: 0.88rem; color: var(--text-3); }

/* ---------- User menu ---------- */

.menu { position: relative; flex: none; }
.avatar {
  display: grid;
  place-items: center;
  flex: none;
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 50%;
  background: hsl(var(--hue, 45) 55% 42%);
  color: #fff;
  font-size: 0.95rem;
  font-weight: 800;
  text-transform: uppercase;
}
.menu .avatar { box-shadow: 0 0 0 2px var(--bg), 0 0 0 3px var(--line-strong); }
.menu__panel {
  position: absolute;
  top: calc(100% + 12px);
  right: 0;
  min-width: 230px;
  padding: 6px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-lg);
  opacity: 0;
  visibility: hidden;
  transform: translateY(-6px);
  transition: opacity 0.18s, transform 0.18s, visibility 0.18s;
}
.menu.is-open .menu__panel { opacity: 1; visibility: visible; transform: none; }
.menu__panel { max-height: calc(100vh - var(--topbar-h) - 24px); max-height: calc(100dvh - var(--topbar-h) - 24px); overflow-y: auto; overscroll-behavior: contain; }
.menu__header { padding: 10px 12px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--line); font-size: 0.8rem; color: var(--text-3); }
.menu__header strong { display: block; font-size: 0.95rem; color: var(--text); }
.menu__panel form { margin: 0; }
.menu__panel a,
.menu__panel button { display: flex; align-items: center; gap: 11px; width: 100%; padding: 10px 12px; border: 0; border-radius: 10px; background: none; font-size: 0.9rem; font-weight: 500; text-align: left; color: var(--text-2); }
.menu__panel a:hover,
.menu__panel button:hover { background: var(--surface-2); color: var(--text); }
.menu__panel .danger { color: var(--red); }
.menu__panel hr { margin: 6px 0; }

/* ---------- Mobile tab bar ---------- */

.tabbar { display: none; }

@media (max-width: 360px) {
  .topbar .brand__name { display: none; }
}

@media (max-width: 900px) {
  .topnav, .topbar .search { display: none; }
  .topbar .menu { margin-left: auto; }

  .tabbar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 60;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
    padding: 0 env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
    background: rgba(12, 12, 18, 0.92);
    border-top: 1px solid var(--line);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
  }
  .tabbar a { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; font-size: 0.68rem; font-weight: 600; color: var(--text-3); transition: color 0.2s; }
  .tabbar a i { font-size: 1.25rem; }
  .tabbar a.is-active { color: var(--gold); }
  body.has-tabbar { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
}

/* ---------- Footer ---------- */

.footer { margin-top: 64px; padding: 28px 0; border-top: 1px solid var(--line); font-size: 0.85rem; color: var(--text-3); }
.footer__inner { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px 24px; }
.footer .brand { font-size: 1rem; color: var(--text); }
.footer .brand__mark { width: 28px; height: 28px; font-size: 0.85rem; border-radius: 8px; }
.footer p { margin: 0; }

/* ---------- Toasts ---------- */

.toasts { position: fixed; top: calc(var(--topbar-h) + 12px); right: max(16px, env(safe-area-inset-right)); z-index: 90; display: flex; flex-direction: column; gap: 10px; width: min(380px, calc(100vw - 32px)); pointer-events: none; }
.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 14px;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: rgba(29, 29, 40, 0.96);
  box-shadow: var(--shadow-lg);
  font-size: 0.9rem;
  pointer-events: auto;
  backdrop-filter: blur(12px);
  animation: toast-in 0.35s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
.toast > i { margin-top: 1px; font-size: 1.05rem; }
.toast span { flex: 1; }
.toast--success > i { color: var(--green); }
.toast--error > i { color: var(--red); }
.toast__close { border: 0; padding: 0; background: none; color: var(--text-3); font-size: 1.1rem; line-height: 1; }
.toast__action { flex: none; padding: 0 4px; border: 0; background: none; font-size: 0.85rem; font-weight: 700; color: var(--gold); }
.toast__action:hover { text-decoration: underline; text-underline-offset: 3px; }
.toast__close:hover { color: var(--text); }
.toast.is-leaving { opacity: 0; transform: translateX(20px); transition: opacity 0.25s, transform 0.25s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-10px) scale(0.97); } }

@media (max-width: 600px) {
  .toasts { left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); width: auto; }
}

/* ---------- Layout helpers ---------- */

.page { padding-block: clamp(24px, 5vw, 44px) 24px; }
.page-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px 24px; margin-bottom: 28px; }
.page-head h1 { margin: 0; font-size: clamp(1.75rem, 4.5vw, 2.5rem); font-weight: 800; }
.page-head p { margin: 6px 0 0; color: var(--text-2); }

.section { margin-top: clamp(36px, 6vw, 56px); }
.section__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.section__title { margin: 0; font-size: clamp(1.15rem, 2.6vw, 1.45rem); font-weight: 800; }
.section__sub { margin: 4px 0 0; font-size: 0.88rem; color: var(--text-3); }

.card { padding: clamp(18px, 3vw, 26px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }

.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 5px 12px; border: 1px solid var(--line-strong); border-radius: 999px; font-size: 0.8rem; font-weight: 600; color: var(--text-2); background: transparent; }
a.chip:hover, button.chip:hover { color: var(--text); border-color: var(--text-3); }
.chip.is-active { background: var(--text); border-color: var(--text); color: var(--bg); }

.badge-rated { display: inline-block; padding: 1px 7px; border: 1px solid var(--text-3); border-radius: 5px; font-size: 0.75rem; font-weight: 700; color: var(--text-2); }

.meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; font-size: 0.92rem; color: var(--text-2); }
.meta__dot { width: 4px; height: 4px; border-radius: 50%; background: var(--text-3); }

.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: clamp(40px, 8vw, 72px) 20px;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  text-align: center;
}
.empty__icon { display: grid; place-items: center; width: 64px; height: 64px; margin-bottom: 8px; border-radius: 50%; background: var(--surface-2); font-size: 1.6rem; color: var(--gold); }
.empty h2 { margin: 0; font-size: 1.25rem; }
.empty p { max-width: 42ch; margin: 0 0 12px; color: var(--text-2); }

.select {
  height: 38px;
  padding: 0 34px 0 14px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23b5b5c4' viewBox='0 0 16 16'%3E%3Cpath d='M1.6 5.1a.6.6 0 0 1 .8 0L8 10.6l5.6-5.5a.6.6 0 1 1 .8.8l-6 6a.6.6 0 0 1-.8 0l-6-6a.6.6 0 0 1 0-.8z'/%3E%3C/svg%3E") no-repeat right 13px center;
  font-size: 0.86rem;
  font-weight: 600;
  appearance: none;
  cursor: pointer;
}

.notice { display: flex; align-items: center; gap: 10px; margin-bottom: 22px; padding: 12px 16px; border: 1px solid rgba(245, 197, 24, 0.3); border-radius: var(--radius); background: var(--gold-soft); font-size: 0.9rem; color: var(--text-2); }
.notice i { color: var(--gold); }

.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 22px; }

/* ---------- Stars ---------- */

.stars { --size: 1rem; display: inline-block; font-size: var(--size); line-height: 1; letter-spacing: 2px; white-space: nowrap; }
.stars::before {
  content: "★★★★★";
  background: linear-gradient(90deg, var(--gold) calc(var(--rating) / 5 * 100%), var(--star-empty) calc(var(--rating) / 5 * 100%));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.stars--lg { --size: 1.4rem; }
.stars--sm { --size: 0.82rem; letter-spacing: 1px; }

.star-input { display: inline-flex; gap: 4px; margin: 0; padding: 0; border: 0; }
.star-input input { position: absolute; opacity: 0; pointer-events: none; }
.star-input label { font-size: 2rem; line-height: 1; color: var(--star-empty); cursor: pointer; transition: color 0.15s, transform 0.15s; }
.star-input label:active { transform: scale(0.88); }
/* Stars are in natural 1-5 order (so arrow keys match what you see); :has() lights up
   every star before the checked or hovered one. */
.star-input input:checked + label,
.star-input label:has(~ input:checked) { color: var(--gold); }
.star-input:hover input ~ label { color: var(--star-empty); }
.star-input:hover label:hover,
.star-input:hover label:has(~ label:hover) { color: var(--gold-2); }
.star-input input:focus-visible + label { outline: 2px solid var(--gold); outline-offset: 2px; border-radius: 4px; }
.star-field { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-bottom: 16px; }
.star-hint { font-size: 0.9rem; font-weight: 600; color: var(--text-3); }

/* ---------- Forms ---------- */

.field { display: flex; flex-direction: column; gap: 7px; margin-bottom: 16px; }
.field__label { font-size: 0.85rem; font-weight: 600; color: var(--text-2); }
.field__control { position: relative; }
.field__control > i:first-child { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: var(--text-3); pointer-events: none; }
.input,
.textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  background: var(--bg-2);
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s, background-color 0.2s;
}
.input { height: 48px; padding: 0 14px; }
.field__control > i:first-child ~ .input { padding-left: 42px; }
.textarea { min-height: 120px; padding: 12px 14px; line-height: 1.55; resize: vertical; }
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.input:focus, .textarea:focus { border-color: rgba(245, 197, 24, 0.6); background: var(--surface); box-shadow: 0 0 0 4px var(--gold-soft); }
.input--sm { height: 40px; font-size: 0.9rem; }
.input--toggle { padding-right: 84px; }
.field__toggle { position: absolute; right: 6px; top: 50%; display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 10px; border: 0; border-radius: 8px; background: none; color: var(--text-2); font-size: 0.78rem; font-weight: 700; transform: translateY(-50%); }
.field__toggle:hover { background: var(--surface-2); color: var(--text); }
.field__caps { display: flex; align-items: center; gap: 6px; font-size: 0.78rem; font-weight: 600; color: var(--gold); }
.field__hint { font-size: 0.8rem; color: var(--text-3); }
.field__error { display: none; font-size: 0.8rem; color: var(--red); }
.was-validated .input:invalid, .was-validated .textarea:invalid { border-color: rgba(242, 107, 104, 0.7); }
.was-validated .input:invalid ~ .field__error,
.was-validated .field__control:has(.input:invalid) ~ .field__error { display: block; }
.field-row { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 14px; }
@media (max-width: 520px) { .field-row--stack { grid-template-columns: minmax(0, 1fr); } }

.rules { display: flex; flex-wrap: wrap; gap: 4px 14px; margin: 0; padding: 0; list-style: none; font-size: 0.78rem; color: var(--text-3); }
.rules li { display: flex; align-items: center; gap: 5px; transition: color 0.2s; }
.rules li::before { content: "\F28A"; font-family: "bootstrap-icons"; font-size: 0.72rem; }
.rules li.is-ok { color: var(--green); }
.rules li.is-ok::before { content: "\F26B"; }

.check { display: flex; align-items: center; gap: 10px; margin: 0 0 clamp(14px, 2.6vh, 22px); font-size: 0.88rem; color: var(--text-2); cursor: pointer; user-select: none; }
.check input { display: grid; flex: none; place-items: center; width: 18px; height: 18px; margin: 0; border: 1.5px solid var(--text-3); border-radius: 5px; background: var(--bg-2); appearance: none; cursor: pointer; transition: background-color 0.15s, border-color 0.15s; }
.check input::after { content: ""; width: 5px; height: 9px; margin-top: -2px; border: solid var(--on-gold); border-width: 0 2px 2px 0; transform: rotate(45deg) scale(0); transition: transform 0.15s; }
.check input:checked { border-color: var(--gold); background: var(--gold); }
.check input:checked::after { transform: rotate(45deg) scale(1); }
.check input:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Poster cards ---------- */

.poster-card { position: relative; display: block; min-width: 0; }
.poster-card__media {
  position: relative;
  overflow: hidden;
  aspect-ratio: 2 / 3;
  border-radius: var(--radius);
  background: var(--surface-2);
  box-shadow: var(--shadow);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.poster-card__media img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.5s ease; }
.poster-card__media::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, transparent 60%, rgba(0, 0, 0, 0.7)); pointer-events: none; }
.poster-card:hover .poster-card__media { transform: translateY(-4px); box-shadow: 0 22px 40px -14px rgba(0, 0, 0, 0.9), 0 0 0 1px rgba(245, 197, 24, 0.4); }
.poster-card:hover .poster-card__media img { transform: scale(1.05); }
.poster-card__score { position: absolute; top: 8px; left: 8px; z-index: 1; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; background: rgba(0, 0, 0, 0.7); font-size: 0.74rem; font-weight: 700; backdrop-filter: blur(6px); }
.poster-card__score i { font-size: 0.66rem; color: var(--gold); }
.poster-card__type { position: absolute; right: 8px; bottom: 8px; z-index: 1; padding: 3px 7px; border-radius: 6px; background: rgba(255, 255, 255, 0.16); font-size: 0.62rem; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; backdrop-filter: blur(6px); }
.poster-card__body { padding: 10px 2px 0; }
.poster-card__title { display: -webkit-box; margin: 0 0 2px; overflow: hidden; font-size: 0.92rem; font-weight: 700; line-height: 1.3; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.poster-card__meta { margin: 0; font-size: 0.8rem; color: var(--text-3); }
.poster-card__meta .gold { font-weight: 700; }

.poster-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(165px, 1fr)); gap: 28px 18px; }
@media (max-width: 560px) { .poster-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 22px 12px; } }

/* Horizontal rows */
.scroller-wrap { position: relative; }
.scroller {
  display: grid;
  grid-auto-columns: clamp(140px, 17vw, 185px);
  grid-auto-flow: column;
  gap: 16px;
  margin-inline: calc(var(--gutter) * -1);
  padding: 4px var(--gutter) 10px;
  overflow-x: auto;
  scroll-padding-inline: var(--gutter);
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  overscroll-behavior-x: contain;
}
.scroller::-webkit-scrollbar { display: none; }
.scroller > * { scroll-snap-align: start; }
.scroller-btn {
  position: absolute;
  top: calc(50% - 30px);
  z-index: 5;
  display: none;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--line-strong);
  border-radius: 50%;
  background: rgba(21, 21, 29, 0.92);
  box-shadow: var(--shadow);
  font-size: 1.1rem;
  transform: translateY(-50%);
  transition: opacity 0.2s, background-color 0.2s;
  backdrop-filter: blur(8px);
}
.scroller-btn:hover { background: var(--surface-3); }
.scroller-btn--prev { left: -14px; }
.scroller-btn--next { right: -14px; }
.scroller-btn[disabled] { opacity: 0; pointer-events: none; }
@media (hover: hover) and (min-width: 700px) { .scroller-btn { display: grid; } }

/* ---------- Landing ---------- */

.landing-hero { position: relative; display: grid; align-items: center; min-height: min(88vh, 820px); overflow: hidden; isolation: isolate; }
.poster-wall { position: absolute; inset: -10% -5%; z-index: -2; display: flex; flex-direction: column; gap: 16px; transform: rotate(-8deg); opacity: 0.8; }
.poster-wall__row { display: flex; gap: 16px; width: max-content; animation: marquee 80s linear infinite; }
.poster-wall__row:nth-child(2) { animation-direction: reverse; animation-duration: 95s; }
.poster-wall__row:nth-child(3) { animation-duration: 110s; }
.poster-wall__row:nth-child(4) { animation-direction: reverse; animation-duration: 70s; }
.poster-wall img { width: 150px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 12px; }
.landing-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(9, 9, 13, 0.96) 0%, rgba(9, 9, 13, 0.8) 42%, rgba(9, 9, 13, 0.35) 100%), linear-gradient(180deg, rgba(9, 9, 13, 0.5) 0%, transparent 25%, transparent 70%, var(--bg) 100%); }
@media (max-width: 700px) { .landing-hero::before { background: linear-gradient(180deg, rgba(9, 9, 13, 0.7), rgba(9, 9, 13, 0.88) 50%, var(--bg)); } }
.landing-hero__content { max-width: 680px; padding-block: 80px; }
.landing-hero h1 { margin-bottom: 18px; font-size: clamp(2.6rem, 8vw, 5rem); font-weight: 800; line-height: 1.02; letter-spacing: -0.04em; }
.landing-hero h1 em { font-style: normal; background: linear-gradient(90deg, var(--gold), var(--orange)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.landing-hero p { max-width: 52ch; margin-bottom: 30px; font-size: clamp(1rem, 2.2vw, 1.15rem); color: var(--text-2); }
.landing-hero__cta { display: flex; gap: 12px; }
@media (max-width: 520px) {
  /* Keep both calls to action side by side on phones. */
  .landing-hero__cta .btn { flex: 1 1 0; min-width: 0; height: 48px; padding: 0 12px; font-size: 0.88rem; }
}
@media (max-width: 360px) {
  .landing-hero__cta .btn { font-size: 0.8rem; }
  .landing-hero__cta .btn i { display: none; }
}
@keyframes marquee { to { transform: translateX(-50%); } }

.features { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 16px; }
.feature { padding: 24px; border: 1px solid var(--line); border-radius: var(--radius-lg); background: linear-gradient(180deg, var(--surface), var(--bg-2)); transition: border-color 0.25s, transform 0.25s; }
.feature:hover { border-color: rgba(245, 197, 24, 0.35); transform: translateY(-3px); }
.feature__icon { display: grid; place-items: center; width: 46px; height: 46px; margin-bottom: 18px; border-radius: 12px; background: var(--gold-soft); color: var(--gold); font-size: 1.3rem; }
.feature h3 { margin-bottom: 6px; font-size: 1.05rem; }
.feature p { margin: 0; font-size: 0.92rem; color: var(--text-2); }

.cta-band { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; padding: clamp(24px, 5vw, 44px); border: 1px solid rgba(245, 197, 24, 0.25); border-radius: var(--radius-lg); background: radial-gradient(circle at 100% 0%, rgba(255, 138, 61, 0.18), transparent 50%), radial-gradient(circle at 0% 100%, rgba(245, 197, 24, 0.12), transparent 50%), var(--surface); }
.cta-band h2 { margin: 0 0 6px; font-size: clamp(1.4rem, 3.5vw, 2rem); }
.cta-band p { margin: 0; color: var(--text-2); }

/* ---------- Featured hero (discover) ---------- */

.feature-hero { position: relative; overflow: hidden; margin-top: 8px; border: 1px solid var(--line); border-radius: var(--radius-lg); isolation: isolate; }
.feature-hero__bg, .detail-hero__bg { position: absolute; inset: -60px; z-index: -2; background-position: center; background-size: cover; filter: blur(40px) saturate(1.4); opacity: 0.55; }
.feature-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(90deg, rgba(9, 9, 13, 0.92) 20%, rgba(9, 9, 13, 0.55)), linear-gradient(0deg, rgba(9, 9, 13, 0.6), transparent); }
.feature-hero__inner { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: clamp(20px, 4vw, 44px); padding: clamp(20px, 4.5vw, 48px); }
.feature-hero__poster { width: clamp(130px, 18vw, 210px); border-radius: var(--radius); box-shadow: var(--shadow-lg); }
.feature-hero h1 { margin-bottom: 12px; font-size: clamp(1.7rem, 4.5vw, 3rem); font-weight: 800; }
.feature-hero__plot { max-width: 62ch; margin: 16px 0 22px; color: var(--text-2); }
.feature-hero__actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 640px) {
  .feature-hero__inner { grid-template-columns: 1fr; }
  .feature-hero__poster { width: 120px; }
  .feature-hero__plot { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
}

/* ---------- Review cards ---------- */

.review { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.review__head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.review__who { flex: 1; min-width: 0; line-height: 1.3; }
.review__who strong { display: block; overflow: hidden; font-size: 0.95rem; white-space: nowrap; text-overflow: ellipsis; }
.review__who span { font-size: 0.8rem; color: var(--text-3); }
.review__body { margin: 0; color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere; }
.review--mine { border-color: rgba(245, 197, 24, 0.35); background: linear-gradient(180deg, rgba(245, 197, 24, 0.06), var(--surface) 60%); }
.review__actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 14px; }
.review__tag { padding: 2px 8px; border-radius: 999px; background: var(--gold-soft); font-size: 0.7rem; font-weight: 700; color: var(--gold); }

.feed { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 16px; }
.feed-item { position: relative; display: flex; gap: 16px; padding: 16px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color 0.2s, background-color 0.2s; }
.feed-item:hover { border-color: var(--line-strong); background: var(--surface-2); }
.feed-item img { flex: none; width: 64px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 8px; }
.feed-item__body { min-width: 0; }
.feed-item__title { margin: 0 0 4px; font-size: 0.95rem; font-weight: 700; }
.feed-item__title a::after { content: ""; position: absolute; inset: 0; border-radius: inherit; }
.feed-item__poster { flex: none; }
.feed-item__author { position: relative; z-index: 1; font-weight: 600; color: var(--text-2); }
.feed-item__author:hover { color: var(--text); text-decoration: underline; text-underline-offset: 3px; }
.feed-item__text { display: -webkit-box; margin: 8px 0 6px; overflow: hidden; font-size: 0.88rem; color: var(--text-2); -webkit-line-clamp: 2; -webkit-box-orient: vertical; }

/* ---------- Movie detail ---------- */

.detail-hero { position: relative; overflow: hidden; padding-block: clamp(24px, 5vw, 56px); border-bottom: 1px solid var(--line); isolation: isolate; }
.detail-hero__bg { inset: -80px; opacity: 0.5; }
.detail-hero::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(9, 9, 13, 0.55), rgba(9, 9, 13, 0.85) 70%, var(--bg)); }
.detail-hero__inner { display: grid; grid-template-columns: minmax(200px, 300px) 1fr; align-items: start; gap: clamp(24px, 5vw, 56px); }
.detail-hero__poster { overflow: hidden; border-radius: var(--radius-lg); background: var(--surface-2); box-shadow: var(--shadow-lg), 0 0 0 1px var(--line); }
.detail-hero__poster img { width: 100%; aspect-ratio: 2 / 3; object-fit: cover; }
.detail-hero h1 { margin: 0 0 14px; font-size: clamp(2rem, 5.5vw, 3.6rem); font-weight: 800; letter-spacing: -0.035em; }
.detail-hero .chips { margin: 18px 0; }
.detail-hero__plot { max-width: 68ch; margin-bottom: 24px; font-size: 1.02rem; color: var(--text-2); }
.detail-hero__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.detail-hero__actions form { display: contents; }

@media (max-width: 760px) {
  .detail-hero__inner { grid-template-columns: 1fr; }
  .detail-hero__poster { width: min(220px, 55vw); margin-inline: auto; }
  .detail-hero__info { text-align: center; }
  .detail-hero .meta, .detail-hero .chips, .detail-hero__actions, .scores { justify-content: center; }
  .detail-hero__plot { margin-inline: auto; text-align: left; }
  .detail-hero__plot:not(.is-expanded) { display: -webkit-box; overflow: hidden; -webkit-line-clamp: 5; -webkit-box-orient: vertical; margin-bottom: 8px; }
}
.read-more { display: block; margin: 0 0 24px; padding: 0; border: 0; background: none; font-size: 0.88rem; font-weight: 700; color: var(--gold); }
@media (min-width: 761px) { .read-more { display: none; } }

.scores { display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 26px; }
.score { display: flex; align-items: center; gap: 12px; padding: 10px 16px 10px 12px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: rgba(21, 21, 29, 0.7); backdrop-filter: blur(8px); text-align: left; }
.score__logo { display: grid; place-items: center; flex: none; min-width: 38px; height: 26px; padding: 0 6px; border-radius: 6px; font-size: 0.7rem; font-weight: 800; letter-spacing: 0.02em; }
.score__logo--imdb { background: var(--gold); color: #000; }
.score__logo--rt { background: #fa320a; color: #fff; }
.score__logo--mc { background: #66cc33; color: #000; }
.score__logo--cs { background: linear-gradient(135deg, var(--gold), var(--orange)); color: var(--on-gold); }
.score__value { display: block; font-size: 1.05rem; font-weight: 800; line-height: 1.1; }
.score__value small { font-size: 0.75rem; font-weight: 600; color: var(--text-3); }
.score__label { display: block; font-size: 0.72rem; color: var(--text-3); }
@media (max-width: 760px) {
  .scores { display: grid; grid-template-columns: 1fr 1fr; }
  .score { padding-right: 10px; }
}

.detail-grid { display: grid; grid-template-columns: 1fr 340px; gap: clamp(24px, 4vw, 48px); align-items: start; }
@media (max-width: 900px) { .detail-grid { grid-template-columns: 1fr; } }

.credits { display: grid; gap: 22px; }
.credits h3 { margin-bottom: 10px; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-3); }
.people { display: flex; flex-wrap: wrap; gap: 10px; }
.person { display: flex; align-items: center; gap: 10px; padding: 6px 14px 6px 6px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); font-size: 0.9rem; font-weight: 600; }
.person .avatar { width: 30px; height: 30px; font-size: 0.75rem; }

.facts { margin: 0; }
.facts div { display: flex; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); font-size: 0.9rem; }
.facts div:last-child { border-bottom: 0; padding-bottom: 0; }
.facts div:first-child { padding-top: 0; }
.facts dt { flex: none; color: var(--text-3); }
.facts dd { margin: 0; font-weight: 600; text-align: right; }

.reviews-layout { display: grid; grid-template-columns: 320px 1fr; gap: clamp(20px, 4vw, 40px); align-items: start; }
.reviews-summary { position: sticky; top: calc(var(--topbar-h) + 20px); }
@media (max-width: 900px) {
  .reviews-layout { grid-template-columns: 1fr; }
  .reviews-summary { position: static; }
}
.big-score { display: flex; align-items: center; gap: 16px; margin-bottom: 18px; }
.big-score__value { font-size: 3.2rem; font-weight: 800; line-height: 1; letter-spacing: -0.04em; }
.histogram { display: grid; gap: 8px; }
.histogram__row { display: grid; grid-template-columns: 28px 1fr 28px; align-items: center; gap: 10px; font-size: 0.8rem; color: var(--text-3); }
.histogram__bar { height: 8px; overflow: hidden; border-radius: 999px; background: var(--surface-3); }
.histogram__bar span { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--gold), var(--orange)); }
.histogram__row b { font-weight: 600; text-align: right; }
.reviews-list { display: grid; gap: 14px; }
.review-form .textarea { background: var(--bg-2); }
.review-form__foot { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 12px; }

.edit-review { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- Search page ---------- */

.search-panel { display: grid; gap: 14px; margin-bottom: 28px; }
.search-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.segmented { display: inline-flex; padding: 4px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); }
.segmented input { position: absolute; opacity: 0; pointer-events: none; }
.segmented label { padding: 6px 14px; border-radius: 999px; font-size: 0.84rem; font-weight: 600; color: var(--text-2); cursor: pointer; transition: background-color 0.2s, color 0.2s; }
.segmented input:checked + label { background: var(--text); color: var(--bg); }
.segmented input:focus-visible + label { outline: 2px solid var(--gold); }
.year-input { width: 110px; height: 40px; padding: 0 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); outline: none; font-size: 0.86rem; }
.year-input:focus { border-color: rgba(245, 197, 24, 0.6); }

.pagination { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px; margin-top: 40px; }
.pagination a, .pagination span { display: grid; place-items: center; min-width: 40px; height: 40px; padding: 0 12px; border: 1px solid var(--line); border-radius: 999px; font-size: 0.88rem; font-weight: 600; color: var(--text-2); }
.pagination a:hover { border-color: var(--line-strong); background: var(--surface-2); color: var(--text); }
.pagination .is-current { border-color: var(--gold); background: var(--gold); color: var(--on-gold); }
.pagination .gap { border: 0; min-width: 20px; padding: 0; }

.try-list { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; }

/* ---------- Stats ---------- */

.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-bottom: 32px; }
.stat--wide { grid-column: span 2; }
.stat__note { margin-top: 6px; font-size: 0.78rem; color: var(--text-3); }
@media (max-width: 900px) { .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.stat { padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
.stat__label { margin-bottom: 8px; font-size: 0.78rem; font-weight: 600; color: var(--text-3); }
.stat__value { font-size: 1.7rem; font-weight: 800; line-height: 1.1; letter-spacing: -0.03em; }
.stat__value small { font-size: 0.9rem; font-weight: 600; color: var(--text-3); }
.stat .histogram { gap: 4px; }
.stat .histogram__row { grid-template-columns: 14px 1fr 18px; font-size: 0.72rem; }
.stat .histogram__bar { height: 6px; }
@media (max-width: 560px) {
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; }
  .stat { padding: 14px 16px; }
  .stat--wide { grid-column: 1 / -1; }
  .stat__value { font-size: 1.4rem; }
}

.rating-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 14px; }
.rating-item { display: flex; gap: 16px; padding: 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color 0.2s, background-color 0.2s; }
.rating-item:hover { border-color: var(--line-strong); background: var(--surface-2); }
.rating-item img { flex: none; width: 84px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; }
.rating-item__body { display: flex; flex-direction: column; min-width: 0; }
.rating-item h3 { margin: 0 0 2px; font-size: 1rem; }
.rating-item__text { display: -webkit-box; margin: 8px 0; overflow: hidden; font-size: 0.88rem; color: var(--text-2); -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.rating-item__date { margin-top: auto; font-size: 0.76rem; color: var(--text-3); }

/* ---------- Watchlist ---------- */

.watch-item { position: relative; }
.watch-item__remove { position: absolute; top: 8px; right: 8px; z-index: 3; }
.watch-item__remove .icon-btn { background: rgba(0, 0, 0, 0.65); border-color: rgba(255, 255, 255, 0.15); backdrop-filter: blur(6px); }
.watch-item__remove .icon-btn:hover { background: var(--red); border-color: var(--red); color: #fff; }

/* ---------- Photos ---------- */

.upload { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; margin-bottom: 28px; }
.dropzone {
  position: relative;
  display: flex;
  flex: 1 1 320px;
  align-items: center;
  gap: 16px;
  min-height: 92px;
  padding: 16px 20px;
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  cursor: pointer;
  transition: border-color 0.2s, background-color 0.2s;
}
.dropzone:hover, .dropzone.is-over { border-color: var(--gold); background: var(--gold-soft); }
.dropzone input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.dropzone__icon { display: grid; place-items: center; flex: none; width: 52px; height: 52px; border-radius: 12px; background: var(--surface-2); font-size: 1.4rem; color: var(--gold); overflow: hidden; }
.dropzone__icon img { width: 100%; height: 100%; object-fit: cover; }
.dropzone strong { display: block; }
.dropzone span { font-size: 0.85rem; color: var(--text-3); }

.gallery { columns: 4 240px; column-gap: 14px; }
.gallery__item { position: relative; margin: 0 0 14px; overflow: hidden; border-radius: var(--radius); background: var(--surface-2); break-inside: avoid; }
.gallery__item button.gallery__open { display: block; width: 100%; padding: 0; border: 0; background: none; }
.gallery__item img { width: 100%; transition: transform 0.4s ease; }
.gallery__item:hover img { transform: scale(1.03); }
.gallery__caption { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; padding: 30px 12px 10px; background: linear-gradient(transparent, rgba(0, 0, 0, 0.85)); font-size: 0.78rem; pointer-events: none; }
.gallery__caption strong { display: block; font-size: 0.85rem; }
.gallery__caption span { color: rgba(255, 255, 255, 0.7); }
.gallery__caption form { pointer-events: auto; }
@media (max-width: 560px) { .gallery { columns: 2; column-gap: 10px; } .gallery__item { margin-bottom: 10px; } }

.lightbox { width: 100vw; max-width: none; height: 100vh; height: 100dvh; max-height: none; margin: 0; padding: 0; border: 0; background: rgba(5, 5, 8, 0.94); color: var(--text); }
.lightbox::backdrop { background: rgba(0, 0, 0, 0.8); }
.lightbox[open] { display: grid; place-items: center; }
.lightbox figure { display: flex; flex-direction: column; align-items: center; gap: 12px; margin: 0; padding: 60px 16px; }
.lightbox img { max-width: min(1100px, 92vw); max-height: 78vh; max-height: 78dvh; object-fit: contain; border-radius: var(--radius); }
.lightbox figcaption { font-size: 0.88rem; color: var(--text-2); text-align: center; }
.lightbox__close { position: absolute; top: 16px; right: 16px; }
.lightbox__nav { position: absolute; top: 50%; transform: translateY(-50%); }
.lightbox__nav--prev { left: 16px; }
.lightbox__nav--next { right: 16px; }

/* ---------- Auth ---------- */

/* The auth screens are locked to one viewport; spacing scales with the viewport height so the
   form fits without scrolling, and the panel only scrolls as a last resort on very short screens. */
.auth { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); height: 100vh; height: 100dvh; overflow: hidden; }
.auth__art { position: relative; display: flex; flex-direction: column; justify-content: flex-end; padding: clamp(28px, 6vh, 56px); overflow: hidden; background: #111 url("https://images.unsplash.com/photo-1489599849927-2ee91cede3ba?auto=format&fit=crop&w=1400&q=70") center / cover; isolation: isolate; }
.auth__art::before { content: ""; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgba(9, 9, 13, 0.2), rgba(9, 9, 13, 0.92)); }
.auth__art blockquote { max-width: 30ch; margin: 0; font-size: clamp(1.5rem, 2.6vw, 2.2rem); font-weight: 800; line-height: 1.2; letter-spacing: -0.03em; }
.auth__art p { margin: 12px 0 0; color: var(--text-2); }
.auth__panel { display: flex; flex-direction: column; gap: 8px; min-height: 0; overflow-y: auto; padding: clamp(14px, 3vh, 28px) clamp(18px, 5vw, 56px); }
.auth__top { display: flex; flex: none; align-items: center; justify-content: space-between; gap: 12px; }
.auth__top .brand { font-size: 1.05rem; }
.auth__top .brand__mark { width: 30px; height: 30px; border-radius: 9px; font-size: 0.9rem; }
.auth__form { width: 100%; max-width: 440px; margin: auto; padding-block: clamp(4px, 2vh, 24px); }
.auth__form h1 { margin-bottom: 4px; font-size: clamp(1.5rem, 1rem + 2.2vh, 2.15rem); font-weight: 800; }
.auth__lead { margin: 0 0 clamp(14px, 3.4vh, 30px); color: var(--text-2); }
.auth .field { gap: 6px; margin-bottom: clamp(10px, 1.9vh, 16px); }
.auth .input { height: clamp(42px, 5.4vh, 48px); }
.auth .btn--lg { height: clamp(44px, 5.8vh, 52px); }
.auth .rules { margin: calc(clamp(10px, 1.9vh, 16px) * -0.4) 0 clamp(14px, 2.6vh, 22px); }
.auth__switch { margin: clamp(12px, 2.4vh, 22px) 0 0; font-size: 0.92rem; text-align: center; color: var(--text-2); }
@media (max-height: 700px) {
  .auth--compact .auth__lead { display: none; }
  .auth--compact .auth__form h1 { margin-bottom: 16px; }
}
@media (max-height: 620px) {
  .auth .field { gap: 4px; margin-bottom: 8px; }
  .auth .input { height: 38px; }
  .auth .btn--lg { height: 42px; }
  .auth .field__label { font-size: 0.8rem; }
  .auth .rules { gap: 2px 10px; font-size: 0.72rem; }
  .auth--compact .auth__form h1 { margin-bottom: 10px; font-size: 1.4rem; }
  .auth__top .btn--sm { height: 30px; }
}
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth__art { display: none; }
}
@media (max-width: 360px) {
  .auth__top .brand__name { display: none; }
}

/* ---------- Error ---------- */

.error-page { display: grid; place-items: center; padding-block: clamp(48px, 12vw, 120px); text-align: center; }
.error-page__code { font-size: clamp(5rem, 20vw, 9rem); font-weight: 800; line-height: 1; letter-spacing: -0.06em; background: linear-gradient(180deg, var(--text), var(--surface-3)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.error-page h1 { margin: 12px 0 8px; font-size: clamp(1.4rem, 4vw, 1.9rem); }
.error-page p { max-width: 52ch; margin: 0 auto 26px; color: var(--text-2); overflow-wrap: anywhere; }
.error-page__actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; }

/* ---------- Map ---------- */

body.map-body { height: 100vh; height: 100dvh; overflow: hidden; }
.map-layout { display: grid; grid-template-columns: 380px 1fr; height: calc(100vh - var(--topbar-h)); height: calc(100dvh - var(--topbar-h)); }
.map-panel { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); background: var(--bg-2); }
.map-panel__head { padding: 22px 20px 16px; border-bottom: 1px solid var(--line); }
.map-panel__head h1 { margin: 0; font-size: 1.4rem; font-weight: 800; }
.map-panel__head p { margin: 2px 0 14px; font-size: 0.88rem; color: var(--text-3); }
.map-panel__scroll { flex: 1; min-height: 0; padding: 16px 20px 24px; overflow-y: auto; }
.map-canvas { position: relative; min-height: 0; background: var(--surface); }
.map-canvas__map { position: absolute; inset: 0; }
.map-canvas .map-hint { position: absolute; top: 14px; left: 50%; z-index: 2; padding: 8px 16px; border-radius: 999px; background: rgba(9, 9, 13, 0.85); box-shadow: var(--shadow); font-size: 0.85rem; font-weight: 600; transform: translateX(-50%); white-space: nowrap; pointer-events: none; }
.map-canvas .map-hint i { color: var(--gold); }

.add-form { margin-bottom: 18px; padding: 16px; border: 1px solid rgba(245, 197, 24, 0.3); border-radius: var(--radius); background: var(--surface); }
.add-form h2 { margin: 0 0 4px; font-size: 1rem; }
.add-form > p { margin: 0 0 14px; font-size: 0.82rem; color: var(--text-3); }
.add-form .field { margin-bottom: 12px; }
.add-form__actions { display: flex; gap: 8px; }
.add-form__actions .btn { flex: 1; }
.geo-results { margin-top: 6px; padding: 4px; border: 1px solid var(--line-strong); border-radius: 12px; background: var(--surface-2); }
.geo-results button { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 8px; background: none; font-size: 0.84rem; text-align: left; }
.geo-results button:hover { background: var(--surface-3); }
.geo-results small { display: block; overflow: hidden; color: var(--text-3); white-space: nowrap; text-overflow: ellipsis; }

.loc-filter { margin-bottom: 12px; }
.loc-list { display: grid; gap: 8px; margin: 0; padding: 0; list-style: none; }
.loc { display: flex; align-items: center; gap: 8px; padding: 6px 6px 6px 8px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); transition: border-color 0.2s, background-color 0.2s; }
.loc:hover, .loc.is-active { border-color: rgba(245, 197, 24, 0.4); background: var(--surface-2); }
.loc__main { display: flex; flex: 1; align-items: center; gap: 12px; min-width: 0; padding: 4px; border: 0; background: none; text-align: left; }
.loc__pin { display: grid; place-items: center; flex: none; width: 36px; height: 36px; border-radius: 10px; background: var(--gold-soft); color: var(--gold); }
.loc__text { min-width: 0; }
.loc__text strong { display: block; overflow: hidden; font-size: 0.92rem; white-space: nowrap; text-overflow: ellipsis; }
.loc__text span { font-size: 0.74rem; color: var(--text-3); }

.pin { display: grid; place-items: center; width: 34px; height: 34px; border: 3px solid #fff; border-radius: 50% 50% 50% 0; background: var(--gold); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.5); color: var(--on-gold); font-size: 0.85rem; transform: rotate(-45deg); cursor: pointer; }
.pin i { display: block; transform: rotate(45deg); }
.pin-wrap { width: 34px; height: 34px; cursor: pointer; }
.pin--draft { background: var(--orange); animation: pin-bounce 0.5s ease; }
@keyframes pin-bounce { 0% { transform: rotate(-45deg) translate(0, -20px); opacity: 0; } 100% { transform: rotate(-45deg); } }

.mapboxgl-popup-content { padding: 12px 16px !important; border-radius: 12px !important; background: var(--surface) !important; color: var(--text); box-shadow: var(--shadow-lg) !important; font-family: var(--font); }
.mapboxgl-popup-content strong { display: block; font-size: 0.95rem; }
.mapboxgl-popup-content a { font-size: 0.8rem; color: var(--gold); }
.mapboxgl-popup-tip { border-top-color: var(--surface) !important; border-bottom-color: var(--surface) !important; }
.mapboxgl-popup-close-button { color: var(--text-3); font-size: 18px; padding: 2px 8px; }
.map-empty { position: absolute; inset: 0; display: grid; place-items: center; padding: 24px; text-align: center; color: var(--text-3); }

@media (max-width: 900px) {
  body.map-body { height: auto; overflow: auto; }
  .map-layout { display: flex; flex-direction: column-reverse; height: auto; }
  .map-canvas { height: 52vh; height: 52dvh; flex: none; }
  .map-panel { border-right: 0; }
  .map-panel__scroll { overflow: visible; }
}

/* ---------- Poster card extras ---------- */

.poster-card__link { display: block; }
.poster-card__save-form { position: absolute; top: 8px; right: 8px; z-index: 3; margin: 0; transition: transform 0.3s ease; }
.poster-card__save {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 50%;
  background: rgba(9, 9, 13, 0.62);
  color: #fff;
  font-size: 0.95rem;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  transition: background-color 0.2s, border-color 0.2s, color 0.2s, transform 0.15s;
}
.poster-card__save:hover { background: rgba(9, 9, 13, 0.88); }
.poster-card__save:active { transform: scale(0.9); }
.poster-card:hover .poster-card__save-form { transform: translateY(-4px); }
.poster-card__save[data-saved="true"] { border-color: var(--gold); background: var(--gold); color: var(--on-gold); }
.poster-card__save[data-saved="true"] .save-off,
.poster-card__save[data-saved="false"] .save-on { display: none; }
.poster-card__mine { position: absolute; bottom: 8px; left: 8px; z-index: 1; display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 999px; background: var(--gold); font-size: 0.7rem; font-weight: 800; color: var(--on-gold); }

/* Labelled watchlist toggle: label, icon and colour all follow data-saved */
.btn--watch { background: var(--gold); color: var(--on-gold); }
.btn--watch:hover { background: var(--gold-2); }
.btn--watch-glass[data-saved="false"] { border-color: rgba(255, 255, 255, 0.14); background: rgba(255, 255, 255, 0.1); color: var(--text); backdrop-filter: blur(10px); }
.btn--watch-glass[data-saved="false"]:hover { background: rgba(255, 255, 255, 0.18); }
.btn--watch[data-saved="true"] { border-color: rgba(62, 207, 142, 0.35); background: var(--green-soft); color: var(--green); }
.btn--watch .watch-add,
.btn--watch .watch-saved,
.btn--watch .watch-remove { display: none; }
.btn--watch[data-saved="false"] .watch-add,
.btn--watch[data-saved="true"] .watch-saved { display: inline; }
@media (hover: hover) {
  .btn--watch[data-saved="true"]:hover { border-color: rgba(242, 107, 104, 0.3); background: var(--red-soft); color: var(--red); }
  .btn--watch[data-saved="true"]:hover .watch-saved { display: none; }
  .btn--watch[data-saved="true"]:hover .watch-remove { display: inline; }
}
.icon-btn--lg { width: 42px; height: 42px; }
.watch-form { margin: 0; }
.feature-hero__actions form { display: contents; }

/* Watchlist page */
.watch-item { transition: opacity 0.25s, transform 0.25s; }
.watch-item.is-leaving { opacity: 0; transform: scale(0.94); }
.watch-item.is-picking .poster-card__media { box-shadow: 0 0 0 3px var(--gold), var(--shadow); transform: translateY(-4px); }
.watch-item.is-picked .poster-card__media { box-shadow: 0 0 0 3px var(--gold), 0 0 44px rgba(245, 197, 24, 0.55); transform: translateY(-6px) scale(1.04); }

/* ---------- Search extras ---------- */

.search__kbd { position: absolute; top: 50%; right: 12px; display: grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border: 1px solid var(--line-strong); border-radius: 6px; font: 600 0.72rem var(--font); color: var(--text-3); transform: translateY(-50%); pointer-events: none; }
.search__input:focus ~ .search__kbd,
.search__input:not(:placeholder-shown) ~ .search__kbd { display: none; }
.suggestion__head { display: flex; align-items: center; justify-content: space-between; padding: 6px 8px 4px; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-3); }
.suggestion__head button { padding: 2px 4px; border: 0; background: none; font-size: 0.75rem; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--text-3); }
.suggestion__head button:hover { color: var(--text); }
.suggestion--recent { padding: 9px 10px; font-size: 0.9rem; }
.suggestion--recent i { color: var(--text-3); }
.try-list__label { width: 100%; text-align: center; }
.try-list + .try-list { margin-top: 14px; }

/* ---------- Episodes (series pages) ---------- */

.crumb { display: inline-flex; align-items: center; gap: 8px; margin-bottom: 12px; padding: 5px 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: rgba(21, 21, 29, 0.6); font-size: 0.82rem; font-weight: 600; color: var(--text-2); backdrop-filter: blur(8px); }
.crumb:hover { border-color: var(--text-3); color: var(--text); }
.crumb i { color: var(--gold); }

.episode-nav { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; max-width: 640px; margin-top: 18px; text-align: left; }
.episode-nav__link { display: flex; align-items: center; gap: 12px; min-width: 0; padding: 10px 14px; border: 1px solid var(--line-strong); border-radius: var(--radius); background: rgba(21, 21, 29, 0.7); transition: border-color 0.2s, background-color 0.2s; }
.episode-nav__link:hover { border-color: var(--text-3); background: var(--surface-2); }
.episode-nav__link--next { grid-column: 2; justify-content: flex-end; text-align: right; }
.episode-nav__text { display: flex; flex-direction: column; min-width: 0; }
.episode-nav__text small { font-size: 0.72rem; font-weight: 600; color: var(--text-3); }
.episode-nav__text b { overflow: hidden; font-size: 0.9rem; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
@media (max-width: 760px) { .episode-nav { margin-inline: auto; } }

.episodes__loading, .episodes__empty { display: flex; align-items: center; justify-content: center; gap: 10px; padding: 28px; border: 1px dashed var(--line-strong); border-radius: var(--radius-lg); color: var(--text-3); }
.spinner { width: 18px; height: 18px; border: 2px solid var(--line-strong); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.8s linear infinite; }
.heatmap-card { padding: clamp(14px, 3vw, 22px); border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); }
.heatmap-scroll { overflow-x: auto; padding: 4px 2px 8px; }
.heatmap { display: grid; grid-template-columns: 40px repeat(var(--cols), 38px); gap: 2px; width: max-content; }
.heatmap__col, .heatmap__corner { display: grid; place-items: center; height: 22px; font-size: 0.7rem; font-weight: 600; color: var(--text-3); }
.heatmap__row { display: flex; align-items: center; height: 32px; padding: 0 4px; border: 0; border-radius: 6px; background: none; font-size: 0.74rem; font-weight: 700; color: var(--text-3); }
.heatmap__row:hover, .heatmap__row[aria-pressed="true"] { background: var(--surface-2); color: var(--text); }
.heatmap__cell { position: relative; display: grid; place-items: center; height: 32px; border-radius: 4px; background: var(--fill); font-size: 0.74rem; font-weight: 700; color: var(--ink); transition: transform 0.12s, box-shadow 0.12s; }
.heatmap__cell:hover, .heatmap__cell:focus-visible { z-index: 2; box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--text); outline: none; transform: scale(1.1); }
.heatmap__cell--empty { background: var(--surface-2); font-weight: 600; color: var(--text-3); }
.heatmap__foot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin-top: 14px; font-size: 0.75rem; color: var(--text-3); }
.heatmap__legend { display: flex; align-items: center; gap: 8px; }
.heatmap__scale { display: flex; gap: 2px; }
.heatmap__scale span { width: 20px; height: 10px; border-radius: 3px; background: var(--fill); }
.heatmap-tip { position: fixed; z-index: 95; max-width: 260px; padding: 8px 12px; border: 1px solid var(--line-strong); border-radius: 10px; background: var(--surface-3); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.35); font-size: 0.8rem; color: var(--text-2); pointer-events: none; }
.heatmap-tip strong { display: block; font-size: 1.05rem; color: var(--text); }

.highlights { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px; margin-top: 16px; }
.highlight { display: flex; align-items: center; gap: 14px; min-width: 0; padding: 12px 14px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); transition: border-color 0.2s; }
.highlight:hover { border-color: var(--line-strong); }
.highlight__swatch { display: grid; flex: none; place-items: center; width: 44px; height: 44px; border-radius: 10px; background: var(--fill); font-weight: 800; color: var(--ink); }
.highlight__text { min-width: 0; }
.highlight__text small { display: block; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.highlight__text b { display: block; overflow: hidden; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }

.season-tabs { display: flex; gap: 6px; margin: 22px 0 12px; padding-bottom: 4px; overflow-x: auto; scrollbar-width: none; }
.season-tabs::-webkit-scrollbar { display: none; }
.season-tabs button { flex: none; padding: 6px 14px; border: 1px solid var(--line-strong); border-radius: 999px; background: transparent; font-size: 0.84rem; font-weight: 600; color: var(--text-2); }
.season-tabs button:hover { color: var(--text); }
.season-tabs button[aria-pressed="true"] { border-color: var(--text); background: var(--text); color: var(--bg); }
.episode-list { display: grid; gap: 6px; margin: 0; padding: 0; list-style: none; }
.episode-row { display: grid; grid-template-columns: 38px minmax(0, 1fr) auto; align-items: center; gap: 12px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); transition: border-color 0.2s, background-color 0.2s; }
.episode-row:hover { border-color: var(--line-strong); background: var(--surface-2); }
.episode-row__n { font-size: 0.85rem; font-weight: 800; color: var(--text-3); }
.episode-row__main { min-width: 0; }
.episode-row__title { display: block; overflow: hidden; font-weight: 600; white-space: nowrap; text-overflow: ellipsis; }
.episode-row__date { font-size: 0.75rem; color: var(--text-3); }
.episode-row__rating { display: inline-flex; align-items: center; gap: 8px; font-size: 0.88rem; font-weight: 700; }
.episode-row__swatch { width: 10px; height: 10px; border-radius: 3px; background: var(--fill); }

/* ---------- Review extras ---------- */

a.avatar { color: #fff; }
.review__name:hover { text-decoration: underline; text-underline-offset: 3px; }
.review__foot { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.review-form__foot .review__actions { margin-top: 0; }
.check--inline { margin: 0; }
.like-btn { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border: 1px solid var(--line-strong); border-radius: 999px; background: transparent; font-size: 0.8rem; font-weight: 600; color: var(--text-2); transition: background-color 0.2s, border-color 0.2s, color 0.2s; }
.like-btn:hover { border-color: var(--text-3); color: var(--text); }
.like-btn[aria-pressed="true"] { border-color: rgba(245, 197, 24, 0.4); background: var(--gold-soft); color: var(--gold); }
.like-btn:disabled { opacity: 0.6; }
.spoiler { position: relative; }
.spoiler:not(.is-revealed) .review__body { min-height: 3.1em; filter: blur(7px); -webkit-user-select: none; user-select: none; pointer-events: none; }
.spoiler__reveal { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 10px; background: rgba(21, 21, 29, 0.35); font-size: 0.86rem; font-weight: 700; color: var(--text); }
.spoiler__reveal span { text-decoration: underline; text-underline-offset: 3px; }
.spoiler.is-revealed .spoiler__reveal { display: none; }
.char-count { font-size: 0.75rem; color: var(--text-3); text-align: right; }
.char-count.is-near { color: var(--gold); }

/* ---------- Profiles ---------- */

.profile-head { display: flex; flex-wrap: wrap; align-items: center; gap: 16px 22px; margin-bottom: 26px; }
.avatar--xl { width: 84px; height: 84px; font-size: 2.2rem; box-shadow: 0 0 0 4px var(--bg), 0 0 0 5px var(--line-strong); }
.profile-head__text { flex: 1; min-width: 200px; }
.profile-head__text h1 { margin: 0; font-size: clamp(1.7rem, 4.5vw, 2.4rem); font-weight: 800; }
.profile-head__text p { margin: 4px 0 0; color: var(--text-2); }
.profile-head__actions { display: flex; flex-wrap: wrap; gap: 8px; }
.match { display: flex; align-items: center; gap: 18px; margin-bottom: 28px; padding: 16px 20px; border: 1px solid rgba(245, 197, 24, 0.3); border-radius: var(--radius-lg); background: linear-gradient(90deg, var(--gold-soft), transparent 70%), var(--surface); }
.match p { margin: 2px 0 0; font-size: 0.9rem; color: var(--text-2); }
.match__ring { display: grid; flex: none; place-items: center; width: 64px; height: 64px; border-radius: 50%; background: conic-gradient(var(--gold) calc(var(--pct) * 1%), var(--surface-3) 0); }
.match__ring span { display: grid; place-items: center; width: 50px; height: 50px; border-radius: 50%; background: var(--surface); font-size: 0.9rem; font-weight: 800; }
.match--empty { border-style: dashed; border-color: var(--line-strong); background: var(--surface); }
.match--empty i { font-size: 1.4rem; color: var(--gold); }
.match--empty p { margin: 0; }
.chip--gold { border-color: rgba(245, 197, 24, 0.45); color: var(--gold); }

/* ---------- Map extras ---------- */

.map-panel__actions { display: flex; flex-wrap: wrap; gap: 8px; }
[data-distance]:not(:empty) { font-weight: 700; color: var(--gold); }
[data-distance]:not(:empty)::after { content: " · "; font-weight: 400; color: var(--text-3); }
.me-dot { width: 18px; height: 18px; border: 3px solid #fff; border-radius: 50%; background: #4c8dff; box-shadow: 0 0 0 6px rgba(76, 141, 255, 0.3); }

/* iOS Safari zooms into any focused field whose text is smaller than 16px. */
@media (max-width: 900px) {
  .input, .textarea, .search__input, .year-input, .select { font-size: 16px; }
}

/* ---------- Motion ---------- */

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