:root {
  color-scheme: dark;
  --bg: #1a0816;
  --plum: #2a0d24;
  --plum-deep: #140610;
  --card: rgba(42, 13, 36, 0.72);
  --line: rgba(255, 140, 150, 0.18);
  --text: #f7f0f4;
  --muted: #c9a8b4;
  --accent: #ff6b6b;
  --accent-2: #ff8a8a;
  --ink: #2a0d18;
  --ok: #7fd99a;
  --run: #ffb4a8;
  --danger: #ff7a82;
  --pad: 16px;
  --top: env(safe-area-inset-top, 0px);
  --bot: env(safe-area-inset-bottom, 0px);
  --tabbar: calc(62px + var(--bot));
  --phone: 430px;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
html { background: var(--plum-deep); }
body {
  font-family: "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  background: transparent;
  color: var(--text);
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
}
.site-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: var(--plum-deep) url("/cinema-bg.jpg") center / cover no-repeat;
  pointer-events: none;
}

button, input { font: inherit; }
button { cursor: pointer; }
.hidden { display: none !important; }
.lede, .muted { color: var(--muted); }
.error { color: var(--danger); min-height: 1.2em; margin: 0.4rem 0 0; }
.break { overflow-wrap: anywhere; }

.phone {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  max-width: var(--phone);
  margin: 0 auto;
  background: transparent;
}

.cinema {
  position: relative;
  z-index: 1;
  min-height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: calc(28px + var(--top)) 22px calc(22px + var(--bot));
  background: transparent;
  color: var(--text);
}
.cinema-shade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(20, 6, 16, 0.35) 0%, rgba(42, 13, 36, 0.28) 45%, rgba(20, 6, 16, 0.5) 100%);
  pointer-events: none;
}
.cinema-app {
  position: relative;
}
.cinema-app > .cinema-shade {
  background:
    linear-gradient(180deg, rgba(20, 6, 16, 0.52) 0%, rgba(42, 13, 36, 0.4) 42%, rgba(20, 6, 16, 0.62) 100%);
}
.cinema-card {
  position: relative;
  z-index: 1;
  width: min(420px, 100%);
}
.login-logo,
.brand-mark {
  background: transparent;
}
.login-logo {
  width: min(280px, 78vw);
  height: auto;
  display: block;
  margin: 0 auto;
}
.wordmark {
  margin: 0.15rem 0 0;
  text-align: center;
  font-size: clamp(2.4rem, 10vw, 3.5rem);
  font-weight: 800;
  letter-spacing: -0.05em;
  line-height: 1;
}
.wordmark span:last-child { color: var(--accent); }
.tagline {
  margin: 0.7rem 0 1.5rem;
  text-align: center;
  letter-spacing: 0.28em;
  text-transform: uppercase;
  font-size: 0.68rem;
  color: rgba(232, 196, 206, 0.7);
}
.field {
  position: relative;
  display: block;
  margin: 0 0 12px;
}
.field svg {
  position: absolute;
  left: 16px;
  top: 50%;
  width: 18px;
  height: 18px;
  transform: translateY(-50%);
  fill: none;
  stroke: #d4a8b4;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
  pointer-events: none;
}
.field input {
  margin: 0;
  padding: 0.95rem 2.6rem 0.95rem 2.7rem;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(42, 13, 36, 0.78);
}
.eye {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 40px;
  height: 40px;
  border: 0;
  background: none;
  color: #d4a8b4;
  display: grid;
  place-items: center;
}
.eye svg {
  position: static;
  transform: none;
  pointer-events: none;
}
.btn-signin {
  width: 100%;
  min-height: 50px;
  margin-top: 8px;
  border: 0;
  border-radius: 999px;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(90deg, #ff9a9e, #ff4d6d);
  box-shadow: 0 10px 28px rgba(255, 77, 109, 0.32);
}
.invite-note, .cinema-foot {
  text-align: center;
  color: rgba(232, 196, 206, 0.58);
  font-size: 0.82rem;
}
.invite-note { margin: 1.15rem 0 0; }
.forgot-row { display: flex; justify-content: flex-end; margin: 0.15rem 0 0.4rem; }
.link-btn {
  border: 0;
  background: none;
  color: var(--accent-2);
  font-weight: 600;
  padding: 0;
  width: auto;
  min-height: 0;
}
.cinema-foot {
  position: relative;
  z-index: 1;
  margin: 2rem 0 0;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  font-size: 0.68rem;
}
.cinema-foot::after {
  content: "";
  display: block;
  width: 36px;
  height: 2px;
  margin: 10px auto 0;
  background: var(--accent);
  border-radius: 99px;
}
.panel label {
  display: block;
  margin: 0.85rem 0;
  color: var(--muted);
  font-size: 0.86rem;
}
input, select {
  width: 100%;
  margin-top: 0.4rem;
  padding: 0.9rem 0.95rem;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: rgba(42, 13, 36, 0.82);
  color: var(--text);
  font-size: 16px;
}
select { min-height: 48px; }

.btn-primary, .btn-danger {
  min-height: 48px;
  border: 0;
  border-radius: 999px;
  padding: 0.75rem 1rem;
  font-weight: 700;
  width: 100%;
}
.btn-primary {
  background: linear-gradient(90deg, #ff9a9e, #ff4d6d);
  color: #fff;
  box-shadow: 0 8px 22px rgba(255, 77, 109, 0.26);
}
.btn-danger { background: rgba(80, 18, 28, 0.72); color: var(--danger); border-radius: 14px; }

.app-shell { padding-bottom: var(--tabbar); position: relative; }

.homebar {
  position: sticky;
  top: 0;
  z-index: 6;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  padding: calc(8px + var(--top)) 12px 8px;
  background: color-mix(in srgb, var(--plum-deep) 78%, transparent);
  backdrop-filter: blur(14px);
}
.icon-btn {
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 12px;
  background: transparent;
  color: var(--text);
  display: grid;
  place-items: center;
}
.icon-btn svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.toplinks {
  display: flex;
  justify-content: center;
  gap: 16px;
}
.toplinks button {
  border: 0;
  background: none;
  color: var(--muted);
  font-weight: 700;
  padding: 0;
}
.toplinks button.on { color: var(--text); }
.brand-mark {
  width: 44px;
  height: 44px;
  object-fit: contain;
}

.tab { padding: 6px 0 18px; }

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px var(--pad) 8px;
}
.section-head h2 { margin: 0; font-size: 1.05rem; }
.section-head span { color: var(--muted); font-size: 0.78rem; }

.chips {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 4px var(--pad) 12px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: 0 0 auto;
  border: 0;
  border-radius: 999px;
  padding: 0.4rem 0.85rem;
  background: rgba(42, 13, 36, 0.7);
  color: var(--muted);
  font-weight: 700;
  font-size: 0.78rem;
}
.chip.on { background: var(--accent); color: #fff; }

.rail {
  display: flex;
  gap: 10px;
  overflow-x: auto;
  padding: 0 var(--pad) 8px;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
}
.rail::-webkit-scrollbar { display: none; }

.poster-card {
  flex: 0 0 118px;
  border: 0;
  padding: 0;
  background: none;
  text-align: left;
  scroll-snap-align: start;
}
.poster-card.wide { flex-basis: 148px; }
.frame {
  position: relative;
  aspect-ratio: 2 / 3;
  border-radius: 16px;
  overflow: hidden;
  background: rgba(42, 13, 36, 0.85);
}
.poster, .poster-ph {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.poster-ph {
  display: grid;
  place-items: end center;
  padding: 10px;
  background:
    radial-gradient(circle at 30% 20%, var(--c2, #ff6b6b) 0%, transparent 42%),
    linear-gradient(160deg, var(--c1, #4a1840), #140610);
  color: #fff;
  font-weight: 800;
  font-size: 0.78rem;
  line-height: 1.2;
  text-align: center;
}
.poster { z-index: 1; }
.poster-ph img { width: 42%; margin-bottom: auto; opacity: 0.92; }
.poster-card figcaption {
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.poster-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  padding: 0 var(--pad);
}
.poster-grid .poster-card { flex-basis: auto; width: 100%; }

.empty {
  text-align: center;
  padding: 3rem 1.4rem;
  color: var(--muted);
}
.empty img { width: 120px; margin-bottom: 12px; }

.search-wrap { padding: 8px var(--pad) 12px; }
.search-wrap input { margin: 0; border-radius: 16px; }

.panel {
  margin: 0 var(--pad) 14px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 14px;
  backdrop-filter: blur(12px);
}
.panel strong { display: block; margin-bottom: 0.25rem; }
.meter-top { display: flex; justify-content: space-between; gap: 8px; font-size: 0.92rem; }
.bar { height: 8px; margin-top: 10px; background: rgba(20, 6, 16, 0.7); border-radius: 99px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: linear-gradient(90deg, #ff9a9e, #ff4d6d); }

.job, .member { display: grid; gap: 6px; }
.title-row { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.pill {
  flex: 0 0 auto;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.24rem 0.5rem;
  border-radius: 999px;
  background: rgba(20, 6, 16, 0.55);
  color: var(--muted);
}
.status-queued { color: #ffc4b8; }
.status-running { color: var(--run); }
.status-done { color: var(--ok); }
.status-failed { color: var(--danger); }

.detail {
  position: fixed;
  inset: 0;
  z-index: 20;
  max-width: var(--phone);
  margin: 0 auto;
  background: rgba(20, 6, 16, 0.28);
  overflow: auto;
}
.hero {
  position: relative;
  min-height: 58vh;
  background: var(--plum-deep) center/cover no-repeat;
}
.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(20, 6, 16, 0.96) 8%, transparent 48%);
}
.hero-actions {
  position: absolute;
  top: calc(10px + var(--top));
  left: 10px;
  right: 10px;
  z-index: 2;
  display: flex;
  justify-content: space-between;
}
.close-x, .heart {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 50%;
  background: rgba(42, 13, 36, 0.55);
  color: #fff;
  display: grid;
  place-items: center;
}
.close-x svg, .heart svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
}
.detail-body { padding: 0 18px 120px; margin-top: -42px; position: relative; }
.detail-body h1 { margin: 0 0 8px; font-size: 1.55rem; letter-spacing: -0.03em; }
.meta { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; color: var(--muted); font-size: 0.84rem; }
.star { color: #ffb4a8; }
.detail-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 14px 0; }
.plot { color: #e8c8d0; line-height: 1.5; font-size: 0.94rem; }
.watch-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 10px;
  padding: 12px 18px calc(16px + var(--bot));
  background: linear-gradient(to top, rgba(20, 6, 16, 0.96) 70%, transparent);
}
.watch-bar .btn-primary { flex: 1; }
.watch-bar .icon-btn {
  width: 48px;
  height: 48px;
  background: rgba(42, 13, 36, 0.78);
  border-radius: 50%;
}

.tabbar {
  position: fixed;
  z-index: 8;
  left: 50%;
  bottom: 0;
  width: min(var(--phone), 100%);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  padding: 8px 10px calc(8px + var(--bot));
  background: color-mix(in srgb, var(--plum-deep) 82%, transparent);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
}
.tabbar button {
  min-height: 44px;
  border: 0;
  background: none;
  color: var(--muted);
  display: grid;
  place-items: center;
}
.tabbar svg {
  width: 22px;
  height: 22px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.tabbar button.active { color: var(--accent); }
.tabbar button.active svg { fill: currentColor; stroke: none; }
.tabbar button[data-tab="search"].active svg,
.tabbar button[data-tab="queue"].active svg,
.tabbar button[data-tab="settings"].active svg {
  fill: none;
  stroke: currentColor;
  stroke-width: 2.1;
}

@media (min-width: 720px) {
  .phone {
    min-height: 100dvh;
  }
}

