:root {
  color-scheme: dark;
  --bg: #0c1016;
  --bg-glow: #253149;
  --panel: #151b24;
  --panel-2: #1b2330;
  --field-bg: #0f151d;
  --text: #eef3f8;
  --muted: #9da9b8;
  --line: #2a3544;
  --accent: #f2b84b;
  --accent-ink: #1d1609;
  --danger: #ff9d9d;
  --success: #9ee6bb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { background: var(--bg); }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 80% -10%, var(--bg-glow) 0, transparent 34rem), var(--bg); color: var(--text); }
a { color: inherit; }
button, input, select { font: inherit; }
button { cursor: pointer; }

.shell { width: min(1120px, calc(100% - 2rem)); margin: 0 auto; }
.site-header { display: flex; align-items: center; justify-content: space-between; min-height: 72px; gap: 1rem; }
.brand { display: inline-flex; align-items: center; text-decoration: none; }
.nav-actions { display: flex; align-items: center; gap: .8rem; color: var(--muted); }

.hero { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, .65fr); gap: 2rem; padding: 5rem 0 4rem; align-items: center; }
.eyebrow { margin: 0 0 .75rem; color: var(--accent); text-transform: uppercase; letter-spacing: .15em; font-size: .78rem; font-weight: 750; }
h1 { margin: 0; font-size: clamp(2.7rem, 8vw, 5.7rem); line-height: .95; letter-spacing: -.055em; }
.lead { max-width: 42rem; color: var(--muted); font-size: 1.15rem; line-height: 1.65; margin: 1.5rem 0 0; }

.card { background: color-mix(in srgb, var(--panel) 94%, transparent); border: 1px solid var(--line); border-radius: 18px; box-shadow: 0 18px 60px rgb(0 0 0 / .18); }
.login-card { padding: 1.4rem; }
.login-card h2 { margin: 0 0 .35rem; }
.login-card p { color: var(--muted); margin: 0 0 1.2rem; line-height: 1.5; }
.field { display: grid; gap: .4rem; margin-top: .9rem; }
.field label { font-size: .9rem; font-weight: 650; }
input { width: 100%; border: 1px solid var(--line); border-radius: 10px; background: var(--field-bg); color: var(--text); padding: .75rem .85rem; outline: none; }
input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgb(242 184 75 / .12); }
.primary, .secondary { border-radius: 10px; padding: .72rem 1rem; border: 1px solid transparent; font-weight: 720; }
.primary { width: 100%; margin-top: 1rem; background: var(--accent); color: var(--accent-ink); }
.primary:disabled { opacity: .42; cursor: not-allowed; filter: grayscale(.35); }
.secondary { background: transparent; color: var(--text); border-color: var(--line); }
.feedback { min-height: 1.4rem; margin-top: .8rem !important; color: var(--danger) !important; font-size: .92rem; }
.feedback.info, .feedback.ok { color: var(--success) !important; }
.feedback.warning { color: var(--accent) !important; }
.feedback.error { color: var(--danger) !important; }

.section { padding: 2.5rem 0 4.5rem; }
.section-head { display: flex; justify-content: space-between; align-items: end; gap: 1.5rem; margin-bottom: 1.25rem; }
.section h2 { margin: 0; font-size: clamp(1.6rem, 4vw, 2.3rem); letter-spacing: -.025em; }
.section-subtitle { margin: .4rem 0 0; color: var(--muted); line-height: 1.5; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(230px, 1fr)); gap: 1rem; }
.catalog-card { min-height: 180px; padding: 1.25rem; display: flex; flex-direction: column; justify-content: end; background: linear-gradient(145deg, #1d2634, #121820 68%); }
.catalog-card .tag { align-self: flex-start; margin-bottom: auto; color: var(--accent); font-size: .78rem; text-transform: uppercase; letter-spacing: .12em; }
.catalog-card h3 { margin: 1rem 0 .35rem; font-size: 1.3rem; }
.catalog-card p { margin: 0; color: var(--muted); line-height: 1.45; }

.member-hero { padding: 3.8rem 0 2.2rem; }
.member-hero h1 { font-size: clamp(2.5rem, 7vw, 4.8rem); }
.user-chip { color: var(--text); background: var(--panel); border: 1px solid var(--line); border-radius: 999px; padding: .45rem .75rem; }
.movie-card { padding: 1.2rem; display: grid; min-height: 210px; }
.movie-card h3 { margin: 0 0 .45rem; font-size: 1.35rem; }
.movie-card p { margin: 0; color: var(--muted); line-height: 1.5; }
.movie-card .movie-actions { align-self: end; margin-top: 1.2rem; display: flex; gap: .7rem; align-items: center; }
.movie-card .primary { width: auto; margin: 0; }
.lock-note { color: var(--muted); font-size: .82rem; }

.player-panel { padding: 1rem; margin-top: 1rem; }
.player-panel[hidden] { display: none; }
video { width: 100%; display: block; background: #050608; border-radius: 12px; aspect-ratio: 16/9; }
.player-meta { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .7rem; margin-top: .9rem; }
.meta { border: 1px solid var(--line); background: var(--panel-2); border-radius: 10px; padding: .7rem .8rem; }
.meta small { display: block; color: var(--muted); margin-bottom: .2rem; }
.status { white-space: pre-wrap; color: var(--muted); margin: 1rem .25rem .25rem; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .88rem; }
.status.error { color: var(--danger); }
.status.ok { color: var(--success); }

.boundary { border: 1px dashed var(--line); border-radius: 14px; padding: 1rem; color: var(--muted); line-height: 1.55; }
.boundary strong { color: var(--text); }
footer { border-top: 1px solid var(--line); color: var(--muted); padding: 1.5rem 0 2.5rem; font-size: .9rem; }

@media (max-width: 760px) {
  .hero { grid-template-columns: 1fr; padding-top: 3rem; }
  .site-header { min-height: 64px; }
  .nav-actions .session-expiry { display: none; }
}

/* Member library */
.movie-grid { grid-template-columns: repeat(auto-fit, minmax(min(100%, 460px), 1fr)); align-items: start; }
.playback-card { min-height: 0; gap: 1rem; }
.movie-heading h3 { margin-bottom: .35rem; }
.video-shell { position: relative; border-radius: 12px; overflow: hidden; background: #050608; }
.video-shell video { border-radius: 0; }
.video-lock {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: grid;
  place-content: center;
  gap: .35rem;
  padding: 1.25rem;
  text-align: center;
  background: rgb(5 6 8 / .82);
  backdrop-filter: blur(2px);
  color: var(--text);
}
.video-lock[hidden] { display: none; }
.video-lock span { color: var(--muted); font-size: .88rem; font-weight: 500; }
.playback-card.authorized { border-color: color-mix(in srgb, var(--success) 45%, var(--line)); }
.playback-card .player-meta { margin-top: 0; }
.playback-card .status { min-height: 2.6rem; margin-top: 0; }


/* Gallery browser */
.gallery-modal-open { overflow: hidden; }
.member-gallery-grid,
#galleries { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); align-items: start; }
.gallery-cover-card { overflow: hidden; padding: 0; min-width: 0; }
.gallery-cover-button {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  background: transparent;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.gallery-cover-button:disabled { cursor: default; opacity: .6; }
.gallery-cover-button:focus-visible { outline: 3px solid var(--accent); outline-offset: -3px; }
.gallery-cover-visual { width: 100%; height: 190px; overflow: hidden; background: #07090d; }
.gallery-cover-image { display: block; width: 100%; height: 100%; object-fit: cover; }
.gallery-cover-empty { display: grid; place-items: center; width: 100%; height: 100%; color: var(--muted); }
.gallery-cover-body { padding: 1rem 1.05rem 1.1rem; }
.gallery-cover-body h3 { margin: 0 0 .35rem; font-size: 1.14rem; }
.gallery-cover-body p { margin: 0; color: var(--muted); font-size: .9rem; }

.gallery-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  overflow: auto;
  padding: clamp(.75rem, 2vw, 2rem);
  background: rgb(6 9 13 / .94);
  backdrop-filter: blur(8px);
}
.gallery-browser-stage,
.gallery-viewer-stage {
  width: min(1240px, 100%);
  min-height: calc(100vh - clamp(1.5rem, 4vw, 4rem));
  margin: 0 auto;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--panel);
  box-shadow: 0 24px 90px rgb(0 0 0 / .45);
}
.gallery-browser-stage { padding: clamp(1rem, 2.5vw, 2rem); }
.gallery-browser-header,
.gallery-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  min-height: 64px;
}
.gallery-browser-header { margin-bottom: 1.35rem; }
.gallery-browser-header h2 { margin: 0; font-size: clamp(1.5rem, 4vw, 2.3rem); }
.gallery-browser-meta { margin: .2rem 0 0; color: var(--muted); }
.gallery-text-button,
.gallery-icon-button {
  border: 1px solid var(--line);
  background: var(--panel-2);
  color: var(--text);
  border-radius: 10px;
}
.gallery-text-button { padding: .65rem .85rem; white-space: nowrap; }
.gallery-icon-button {
  display: inline-grid;
  place-items: center;
  width: 46px;
  height: 46px;
  padding: 0;
  font-size: 1.45rem;
  line-height: 1;
}
.gallery-text-button:hover,
.gallery-icon-button:hover { border-color: var(--accent); }
.gallery-thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: .85rem;
}
.gallery-thumbnail {
  position: relative;
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #06080b;
}
.gallery-thumbnail img { display: block; width: 100%; height: 100%; object-fit: cover; transition: transform .18s ease; }
.gallery-thumbnail:hover img { transform: scale(1.025); }
.gallery-thumbnail-number {
  position: absolute;
  right: .55rem;
  bottom: .5rem;
  min-width: 1.7rem;
  padding: .2rem .45rem;
  border-radius: 999px;
  background: rgb(5 7 10 / .78);
  color: white;
  font-size: .78rem;
  text-align: center;
  backdrop-filter: blur(4px);
}

.gallery-viewer-stage { display: grid; grid-template-rows: auto 1fr; overflow: hidden; }
.gallery-viewer-header { padding: .75rem 1rem; border-bottom: 1px solid var(--line); }
.gallery-viewer-identity { min-width: 0; flex: 1; text-align: center; }
.gallery-viewer-identity strong,
.gallery-viewer-identity span { display: block; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.gallery-viewer-identity span { margin-top: .18rem; color: var(--muted); font-size: .88rem; }
.gallery-near-full-frame {
  position: relative;
  display: grid;
  place-items: center;
  min-height: 0;
  padding: clamp(.75rem, 2vw, 1.5rem);
  background: #050608;
}
.gallery-near-full-image {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 150px);
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
  box-shadow: 0 12px 50px rgb(0 0 0 / .35);
}
.gallery-image-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 58px;
  border-color: rgb(255 255 255 / .22);
  background: rgb(4 6 9 / .62);
  backdrop-filter: blur(5px);
}
.gallery-image-nav-prev { left: .8rem; }
.gallery-image-nav-next { right: .8rem; }

.gallery-fullscreen {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: #000;
  cursor: none;
}
.gallery-fullscreen-image {
  display: block;
  max-width: 100vw;
  max-height: 100vh;
  width: auto;
  height: auto;
  object-fit: contain;
  user-select: none;
  -webkit-user-drag: none;
}
.gallery-fullscreen-controls {
  position: fixed;
  top: 1rem;
  right: 1rem;
  display: flex;
  gap: .65rem;
  opacity: 0;
  pointer-events: none;
  transform: translateY(-4px);
  transition: opacity .15s ease, transform .15s ease;
}
.gallery-fullscreen.controls-visible { cursor: default; }
.gallery-fullscreen.controls-visible .gallery-fullscreen-controls {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}
.gallery-fullscreen-button {
  border-color: rgb(255 255 255 / .22);
  background: rgb(8 10 13 / .66);
  color: #fff;
  backdrop-filter: blur(8px);
}

@media (max-width: 640px) {
  .gallery-cover-visual { height: 160px; }
  .gallery-thumbnail-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .gallery-browser-header { align-items: flex-start; }
  .gallery-viewer-header { gap: .5rem; }
  .gallery-viewer-identity { text-align: left; }
  .gallery-image-nav { width: 38px; height: 50px; }
}

/* Keep top-level gallery tiles visually uniform without clipping longer member labels. */
.gallery-cover-button { min-height: 270px; display: grid; grid-template-rows: 190px minmax(80px, auto); }
.gallery-cover-body { min-width: 0; overflow: hidden; align-self: stretch; }
.gallery-cover-body h3 { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
@media (max-width: 640px) {
  .gallery-cover-button { min-height: 240px; grid-template-rows: 160px minmax(80px, auto); }
}

/* Pre-access teaser / privacy gate */
.access-pending body { visibility: hidden; }
.gate-page { display: grid; place-items: center; padding: 2rem 0; }
.gate-shell { width: min(680px, calc(100% - 2rem)); margin: auto; }
.privacy-shell { width: min(920px, calc(100% - 2rem)); margin: auto; }
.gate-card,
.privacy-card { padding: clamp(1.3rem, 4vw, 2.4rem); }
.gate-brand { display: inline-flex; align-items: center; margin-bottom: 2.2rem; }
.gate-title { font-size: clamp(2.7rem, 10vw, 5.2rem); }
.privacy-title { font-size: clamp(2.3rem, 7vw, 4.3rem); }
.gate-lead { color: var(--muted); line-height: 1.65; font-size: 1.06rem; max-width: 48rem; }
.gate-form { margin-top: 1.8rem; }
.gate-fineprint { margin: 1.25rem 0 0; color: var(--muted); font-size: .85rem; line-height: 1.55; }
.privacy-notice { margin-top: 2rem; display: grid; gap: 1.5rem; }
.privacy-notice section { border-top: 1px solid var(--line); padding-top: 1.25rem; }
.privacy-notice h2 { margin: 0 0 .65rem; font-size: 1.25rem; }
.privacy-notice p,
.privacy-notice li { color: var(--muted); line-height: 1.62; }
.privacy-notice ul { padding-left: 1.3rem; }
.cookie-table-wrap { overflow-x: auto; }
.cookie-table { width: 100%; border-collapse: collapse; margin: .8rem 0; min-width: 620px; }
.cookie-table th,
.cookie-table td { padding: .75rem; border: 1px solid var(--line); text-align: left; vertical-align: top; }
.cookie-table th { background: var(--panel-2); }
.cookie-table td { color: var(--muted); }
.cookie-table code { color: var(--text); }
.consent-form { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); }
.check-row { display: grid; grid-template-columns: auto 1fr; gap: .8rem; align-items: start; margin: 1rem 0; color: var(--text); line-height: 1.5; }
.check-row input { width: 1.2rem; height: 1.2rem; margin-top: .15rem; accent-color: var(--accent); }

/* Account and payment layout */
.account-grid {
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  align-items: stretch;
}
.account-card,
.payment-card {
  display: flex;
  flex-direction: column;
  gap: .75rem;
}
.payment-card { border-style: dashed; }
.payment-card #pendingPaymentDetails p { margin: .25rem 0; }
.purchase-actions { flex-wrap: wrap; align-items: center; }
.purchase-actions button { white-space: normal; }


/* Payment basket/history and transparent playback-session UI */
.video-play-button { justify-self: center; margin-top: .55rem; min-width: 120px; }
.payment-history-card { padding: 0; overflow: hidden; }
.payment-history-wrap { overflow-x: auto; }
.payment-history-table { width: 100%; border-collapse: collapse; min-width: 760px; }
.payment-history-table th,
.payment-history-table td { padding: .8rem .9rem; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
.payment-history-table th { background: var(--panel-2); color: var(--text); font-size: .82rem; }
.payment-history-table td { color: var(--muted); font-size: .88rem; }
.payment-history-table tbody tr:last-child td { border-bottom: 0; }

/* Basket controls */
.basket-actions { display: flex; gap: .65rem; margin-top: 1rem; }
.basket-actions .primary,
.basket-actions .secondary { margin-top: 0; }
.basket-actions .primary { flex: 1 1 auto; width: auto; }
.basket-actions .secondary { flex: 0 0 auto; }
.basket-actions .secondary:disabled { opacity: .42; cursor: not-allowed; }
