/* Cinema / Randomizer Stage 2 — aligned with Home Alpha 1.0 */
body.cinema-v2 {
  --cinema-bg: #04060c;
  --cinema-panel: #0e1220;
  --cinema-panel-2: #13182a;
  --cinema-text: #f7f5fb;
  --cinema-muted: #a4a7b7;
  --cinema-soft: #74798b;
  --cinema-line: rgba(255,255,255,.095);
  --cinema-purple: #9b5cff;
  --cinema-green: #5de58c;
  --cinema-sidebar: 276px;
  margin: 0;
  background:
    radial-gradient(circle at 68% 7%, rgba(104,48,186,.12), transparent 31rem),
    radial-gradient(circle at 42% 18%, rgba(46,78,116,.06), transparent 36rem),
    var(--cinema-bg);
  color: var(--cinema-text);
}

body.cinema-v2 .app-shell {
  grid-template-columns: var(--cinema-sidebar) minmax(0,1fr);
  background: transparent;
  transition: grid-template-columns .18s ease;
}

/* Stage 2 sidebar */
body.cinema-v2 .sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: 100vh;
  padding: 0 18px 16px;
  overflow: visible;
  border-right: 1px solid rgba(255,255,255,.09);
  background: linear-gradient(180deg,#05070d 0%,#060811 100%);
  box-shadow: 18px 0 60px rgba(0,0,0,.08);
}

body.cinema-v2 .cinema-drawer-header {
  min-height: 92px;
  display: flex;
  align-items: center;
  border-bottom: 1px solid rgba(255,255,255,.08);
}

body.cinema-v2 .cinema-brand {
  min-width: 0;
  display: block;
  text-decoration: none;
}

body.cinema-v2 .cinema-brand-full {
  width: min(216px,100%);
  height: 58px;
  object-fit: contain;
  object-position: left center;
}

body.cinema-v2 .cinema-brand-compact { display: none; }

body.cinema-v2 .sidebar-nav {
  height: calc(100vh - 152px);
  padding-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  overflow: visible;
}

body.cinema-v2 .cinema-drawer-main {
  display: grid;
  gap: 8px;
}

body.cinema-v2 .cinema-drawer-main > a {
  min-height: 56px;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 14px;
  border: 1px solid transparent;
  border-radius: 13px;
  color: #aeb1c0;
  font-size: .96rem;
  font-weight: 760;
  text-decoration: none;
}

body.cinema-v2 .cinema-drawer-main > a:hover {
  color: #f4f1f9;
  background: rgba(255,255,255,.035);
}

body.cinema-v2 .cinema-drawer-main > a.active,
body.cinema-v2 .cinema-drawer-main > a[aria-current="page"] {
  border-color: rgba(164,101,255,.28);
  border-left: 3px solid #a36bff;
  background: linear-gradient(100deg,rgba(91,44,151,.42),rgba(79,37,133,.24));
}

body.cinema-v2 .cinema-nav-icon {
  width: 23px;
  height: 23px;
  flex: 0 0 23px;
  color: #9da1b2;
}

body.cinema-v2 .cinema-nav-icon svg {
  width: 100%;
  height: 100%;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

body.cinema-v2 .cinema-drawer-main > a.active .cinema-nav-icon { color: #c79cff; }
body.cinema-v2 .cinema-drawer-divider { height: 1px; margin-top: 15px; background: rgba(255,255,255,.08); }

body.cinema-v2 .cinema-support-cta {
  min-height: 60px;
  margin-top: auto;
  padding: 0 16px;
  display: flex;
  align-items: center;
  gap: 11px;
  border: 1px solid rgba(155,92,255,.42);
  border-radius: 13px;
  background: linear-gradient(135deg,rgba(79,38,133,.40),rgba(50,28,87,.32));
  color: #d9c4ff;
  text-decoration: none;
}

body.cinema-v2 .cinema-version-footer {
  min-height: 44px;
  padding: 15px 8px 0;
  color: #64697a;
  font-size: .67rem;
}

body.cinema-v2 .cinema-sidebar-edge-toggle {
  position: absolute;
  z-index: 5;
  top: 106px;
  right: -17px;
  width: 34px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255,255,255,.13);
  border-radius: 10px;
  background: #090c14;
  color: #a2a6b6;
  cursor: pointer;
  box-shadow: 0 10px 28px rgba(0,0,0,.24);
}

body.cinema-v2 .cinema-sidebar-edge-toggle svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
}

body.cinema-v2.cinema-sidebar-minimized { --cinema-sidebar: 88px; }
body.cinema-v2.cinema-sidebar-minimized .sidebar { padding-inline: 14px; }
body.cinema-v2.cinema-sidebar-minimized .cinema-drawer-header { justify-content: center; }
body.cinema-v2.cinema-sidebar-minimized .cinema-brand-full { display: none; }
body.cinema-v2.cinema-sidebar-minimized .cinema-brand-compact {
  width: 58px;
  height: 58px;
  display: block;
  object-fit: contain;
}
body.cinema-v2.cinema-sidebar-minimized .cinema-nav-label,
body.cinema-v2.cinema-sidebar-minimized .cinema-support-cta strong,
body.cinema-v2.cinema-sidebar-minimized .cinema-version-full { display: none; }
body.cinema-v2.cinema-sidebar-minimized .cinema-drawer-main > a,
body.cinema-v2.cinema-sidebar-minimized .cinema-support-cta {
  width: 58px;
  min-width: 58px;
  padding: 0;
  justify-content: center;
}
body.cinema-v2.cinema-sidebar-minimized .cinema-sidebar-edge-toggle svg { transform: rotate(180deg); }

/* Main canvas + top bar */
body.cinema-v2 .main-content {
  min-width: 0;
  padding: 0 0 82px;
}

body.cinema-v2 .topbar {
  min-height: 76px;
  margin: 0;
  padding: 0 clamp(26px,3vw,48px);
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 1px solid rgba(255,255,255,.085);
  background: rgba(4,6,12,.93);
  backdrop-filter: blur(20px);
}

body.cinema-v2 .cinema-topbar-copy h1 {
  margin: 0;
  color: #f5f2f8;
  font-size: 1.05rem;
  font-weight: 850;
}
body.cinema-v2 .cinema-topbar-copy p { margin: 3px 0 0; color: #73788a; font-size: .72rem; }

body.cinema-v2 .cinema-topbar-actions { display: flex; align-items: center; gap: 12px; }
body.cinema-v2 .guest-button {
  min-height: 44px;
  border-radius: 13px;
  background: rgba(255,255,255,.025);
}

body.cinema-v2 .cinema-page {
  width: min(1420px,calc(100% - clamp(44px,5vw,82px)));
  margin: 0 auto;
  padding-top: clamp(30px,3.5vw,52px);
}

body.cinema-v2 .cinema-subnav {
  margin-bottom: 26px;
  display: flex;
  align-items: center;
  gap: 7px;
  overflow-x: auto;
  scrollbar-width: none;
}
body.cinema-v2 .cinema-subnav::-webkit-scrollbar { display: none; }
body.cinema-v2 .cinema-subnav a {
  min-height: 38px;
  padding: 0 14px;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  border: 1px solid transparent;
  border-radius: 10px;
  color: #858a9b;
  font-size: .78rem;
  font-weight: 780;
  text-decoration: none;
}
body.cinema-v2 .cinema-subnav a:hover { color: #e9e5ef; background: rgba(255,255,255,.03); }
body.cinema-v2 .cinema-subnav a.is-active {
  border-color: rgba(155,92,255,.28);
  background: rgba(112,55,184,.22);
  color: #d8bfff;
}

/* Hero */
body.cinema-v2 .page-intro.compact-page-intro {
  min-height: 250px;
  margin: 0 0 18px;
  padding: clamp(26px,3.4vw,46px);
  display: grid;
  grid-template-columns: minmax(0,1.35fr) minmax(220px,.65fr);
  align-items: center;
  gap: 30px;
  overflow: hidden;
  border: 1px solid rgba(255,255,255,.095);
  border-radius: 22px;
  background:
    radial-gradient(circle at 86% 40%, rgba(104,55,181,.20), transparent 21rem),
    linear-gradient(145deg,rgba(18,23,39,.96),rgba(10,13,22,.98));
  box-shadow: 0 18px 50px rgba(0,0,0,.22);
}
body.cinema-v2 .page-intro-content h2 {
  max-width: 760px;
  margin: 8px 0 13px;
  color: #f7f5fb;
  font-size: clamp(2rem,4vw,4rem);
  line-height: .98;
  letter-spacing: -.052em;
}
body.cinema-v2 .page-intro-content p { max-width: 650px; margin: 0; color: #9da1b2; line-height: 1.65; }
body.cinema-v2 .page-mascot {
  justify-self: center;
  width: min(290px,100%);
  max-height: 220px;
  object-fit: contain;
  border-radius: 0;
  filter: drop-shadow(0 22px 35px rgba(0,0,0,.32));
}

/* Primary randomizer card */
body.cinema-v2 .content-section {
  margin-top: 18px;
  padding: clamp(22px,2.6vw,34px);
  border: 1px solid rgba(255,255,255,.10);
  border-radius: 22px;
  background: linear-gradient(145deg,rgba(17,22,38,.97),rgba(10,13,23,.985));
  box-shadow: 0 18px 50px rgba(0,0,0,.22);
}
body.cinema-v2 .section-header { margin-bottom: 22px; align-items: flex-start; }
body.cinema-v2 .section-header h2 { margin-top: 5px; color: #f4f1f7; font-size: clamp(1.35rem,2.2vw,2rem); }
body.cinema-v2 .section-header p { max-width: 720px; color: #858a9b; line-height: 1.55; }
body.cinema-v2 .eyebrow { color: #65e795; font-size: .68rem; letter-spacing: .14em; }

/* Saved filters are part of the main flow, not a developer-looking toolbar. */
body.cinema-v2 .randomizer-tool-row {
  margin: 0 0 22px;
  padding: 14px;
  display: grid;
  grid-template-columns: minmax(220px,1fr) auto auto auto;
  align-items: end;
  gap: 9px;
  border: 1px solid rgba(255,255,255,.075);
  border-radius: 15px;
  background: rgba(255,255,255,.025);
}
body.cinema-v2 .randomizer-preset-field { min-width: 0; display: grid; gap: 7px; }
body.cinema-v2 .randomizer-preset-field > span { color: #858a9b; font-size: .72rem; font-weight: 760; }
body.cinema-v2 .randomizer-preset-field select,
body.cinema-v2 .filter-field select,
body.cinema-v2 .genre-dropdown summary,
body.cinema-v2 .decade-dropdown summary {
  min-height: 46px;
  border: 1px solid rgba(255,255,255,.11);
  border-radius: 12px;
  background: #111624;
  color: #efedf4;
  box-shadow: none;
}
body.cinema-v2 .randomizer-preset-field select,
body.cinema-v2 .filter-field select { padding: 0 13px; }
body.cinema-v2 .randomizer-tool-status { grid-column: 1 / -1; min-height: 0; color: #67e995; font-size: .72rem; }
body.cinema-v2 .randomizer-tool-status:empty { display: none; }

body.cinema-v2 .randomizer-filter-panel {
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 14px;
  align-items: start;
}
body.cinema-v2 .filter-field { gap: 7px; }
body.cinema-v2 .filter-field > label { color: #858a9b; font-size: .72rem; font-weight: 750; }
body.cinema-v2 .genre-field { grid-column: 1 / -1; }
body.cinema-v2 .genre-dropdown-panel {
  max-height: 300px;
  padding: 13px;
  gap: 8px;
  border-color: rgba(255,255,255,.10);
  border-radius: 14px;
  background: #0b0f19;
}
body.cinema-v2 .check-pill span {
  padding: 8px 11px;
  border-radius: 9px;
  font-size: .75rem;
}
body.cinema-v2 .check-pill input:checked + span {
  border-color: rgba(155,92,255,.50);
  background: rgba(117,56,190,.27);
}

body.cinema-v2 .cinema-advanced-filters {
  grid-column: 1 / -1;
  margin-top: 1px;
  border: 1px solid rgba(255,255,255,.075);
  border-radius: 14px;
  background: rgba(255,255,255,.018);
}
body.cinema-v2 .cinema-advanced-filters > summary {
  min-height: 48px;
  padding: 0 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #aaaebe;
  font-size: .78rem;
  font-weight: 780;
  cursor: pointer;
  list-style: none;
}
body.cinema-v2 .cinema-advanced-filters > summary::-webkit-details-marker { display: none; }
body.cinema-v2 .cinema-advanced-filters > summary::after { content: "+"; color: #a96eff; font-size: 1.1rem; }
body.cinema-v2 .cinema-advanced-filters[open] > summary::after { content: "−"; }
body.cinema-v2 .cinema-advanced-filter-grid {
  padding: 0 14px 14px;
  display: grid;
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: 14px;
}

body.cinema-v2 .pick-field {
  grid-column: 1 / -1;
  margin-top: 4px;
}
body.cinema-v2 .pick-field > label { display: none; }
body.cinema-v2 .filter-action-row {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}
body.cinema-v2 .filter-action-row .primary-button {
  min-width: 190px;
  min-height: 50px;
  border-radius: 13px;
  background: linear-gradient(135deg,#8f4ef1,#7132d7);
  box-shadow: 0 12px 28px rgba(111,53,223,.26);
  font-weight: 850;
}
body.cinema-v2 .secondary-button {
  min-height: 44px;
  border-radius: 11px;
  background: rgba(255,255,255,.025);
}

body.cinema-v2 .filter-summary {
  margin: 18px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(93,229,140,.045);
  color: #9297a8;
  font-size: .73rem;
  line-height: 1.5;
}
body.cinema-v2 .status-message { margin: 12px 0 0; font-size: .76rem; }

/* Results */
body.cinema-v2 [data-randomizer-result] {
  grid-template-columns: repeat(4,minmax(0,1fr));
  gap: clamp(14px,1.5vw,20px);
}
body.cinema-v2 .poster-card { gap: 10px; }
body.cinema-v2 .poster-frame {
  border-radius: 16px;
  background: #0a0e18;
  box-shadow: 0 16px 34px rgba(0,0,0,.28);
}
body.cinema-v2 .poster-frame img { object-fit: cover; }
body.cinema-v2 .poster-title { color: #f2eff6; font-size: .94rem; }
body.cinema-v2 .poster-meta { color: #7f8496; font-size: .76rem; }
body.cinema-v2 .below-results-actions { margin-top: 20px; display: flex; justify-content: center; }
body.cinema-v2 .below-results-actions [data-try-again] { min-width: 180px; }

body.cinema-v2 .cinema-randomizer-idle,
body.cinema-v2 .cinema-randomizer-loading,
body.cinema-v2 .cinema-randomizer-no-match {
  width: 100%;
  min-height: 330px;
  border-radius: 18px;
}
body.cinema-v2 .cinema-randomizer-idle > img,
body.cinema-v2 .cinema-randomizer-loading-mascot img,
body.cinema-v2 .cinema-randomizer-no-match > img {
  width: min(260px,80%);
  aspect-ratio: auto;
  object-fit: contain;
  border-radius: 0;
}

body.cinema-v2 .rpg-randomizer-quest { margin-top: 18px; }
body.cinema-v2 .randomizer-source-health,
body.cinema-v2 .randomizer-diagnostics,
body.cinema-v2 .randomizer-debug-export { border-radius: 14px; }

/* Mobile bottom navigation */
body.cinema-v2 .cinema-bottom-nav { display: none; }

@media (max-width: 1180px) {
  body.cinema-v2 .randomizer-filter-panel,
  body.cinema-v2 .cinema-advanced-filter-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  body.cinema-v2 .randomizer-tool-row { grid-template-columns: minmax(220px,1fr) repeat(3,auto); }
}

@media (max-width: 980px) {
  body.cinema-v2 .app-shell { grid-template-columns: 1fr; }
  body.cinema-v2 .sidebar {
    position: fixed;
    width: min(320px,88vw);
    transform: translateX(-105%);
    transition: transform .2s ease;
  }
  body.cinema-v2 .sidebar-toggle:checked ~ .sidebar { transform: translateX(0); }
  body.cinema-v2 .cinema-sidebar-edge-toggle { display: none; }
  body.cinema-v2 .cinema-brand-compact { display: none !important; }
  body.cinema-v2 .cinema-brand-full { display: block !important; }
  body.cinema-v2 .cinema-nav-label,
  body.cinema-v2 .cinema-support-cta strong,
  body.cinema-v2 .cinema-version-full { display: initial !important; }
  body.cinema-v2 .cinema-drawer-main > a,
  body.cinema-v2 .cinema-support-cta { width: auto; min-width: 0; padding: 0 16px; justify-content: flex-start; }
  body.cinema-v2 .sidebar-open { display: grid; }
  body.cinema-v2 .cinema-topbar-copy { flex: 1; }
  body.cinema-v2 .cinema-page { width: min(100% - 36px,900px); }
  body.cinema-v2 .page-intro.compact-page-intro { grid-template-columns: 1fr 200px; }
  body.cinema-v2 [data-randomizer-result] { grid-template-columns: repeat(2,minmax(0,1fr)); }
}

@media (max-width: 700px) {
  body.cinema-v2 .main-content { padding-bottom: 92px; }
  body.cinema-v2 .topbar { min-height: 70px; padding: 0 16px; }
  body.cinema-v2 .cinema-topbar-copy p { display: none; }
  body.cinema-v2 .guest-button .guest-button-copy { display: none; }
  body.cinema-v2 .cinema-page { width: calc(100% - 28px); padding-top: 18px; }
  body.cinema-v2 .cinema-subnav { margin-bottom: 16px; }
  body.cinema-v2 .page-intro.compact-page-intro {
    min-height: 0;
    padding: 22px;
    grid-template-columns: 1fr;
  }
  body.cinema-v2 .page-intro-content h2 { font-size: clamp(2rem,10vw,3rem); }
  body.cinema-v2 .page-mascot { width: 170px; max-height: 135px; }
  body.cinema-v2 .content-section { padding: 18px; border-radius: 18px; }
  body.cinema-v2 .randomizer-tool-row { grid-template-columns: 1fr 1fr; }
  body.cinema-v2 .randomizer-preset-field { grid-column: 1 / -1; }
  body.cinema-v2 .randomizer-tool-row [data-copy-randomizer-link] { grid-column: 1 / -1; }
  body.cinema-v2 .randomizer-filter-panel,
  body.cinema-v2 .cinema-advanced-filter-grid { grid-template-columns: 1fr; }
  body.cinema-v2 .filter-action-row { display: grid; grid-template-columns: 1fr; }
  body.cinema-v2 .filter-action-row .primary-button,
  body.cinema-v2 .filter-action-row .secondary-button { width: 100%; min-width: 0; }
  body.cinema-v2 .genre-dropdown-panel { max-height: 340px; }
  body.cinema-v2 .filter-summary { display: none; }
  body.cinema-v2 [data-randomizer-result] { grid-template-columns: repeat(2,minmax(0,1fr)); gap: 12px; }

  body.cinema-v2 .cinema-bottom-nav {
    position: fixed;
    z-index: 25;
    left: 0;
    right: 0;
    bottom: 0;
    min-height: 72px;
    padding: 7px max(10px,env(safe-area-inset-right)) max(7px,env(safe-area-inset-bottom)) max(10px,env(safe-area-inset-left));
    display: grid;
    grid-template-columns: repeat(4,1fr);
    border-top: 1px solid rgba(255,255,255,.10);
    background: rgba(4,6,12,.97);
    backdrop-filter: blur(20px);
  }
  body.cinema-v2 .cinema-bottom-nav a {
    display: grid;
    place-items: center;
    align-content: center;
    gap: 4px;
    color: #7d8294;
    font-size: .68rem;
    text-decoration: none;
  }
  body.cinema-v2 .cinema-bottom-nav a.is-active { color: #b881ff; }
  body.cinema-v2 .cinema-bottom-nav svg {
    width: 23px;
    height: 23px;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
  }
}

@media (prefers-reduced-motion: reduce) {
  body.cinema-v2 .app-shell,
  body.cinema-v2 .sidebar { transition: none !important; }
}
