:root {
  --bg: #14142b;
  --bg2: #1d1d3d;
  --card: #262650;
  --ink: #f7f5ff;
  --muted: #b3b1d0;
  --red: #e2453c;
  --red2: #bf3029;
  --gold: #f2b84b;
  --green: #2f8a52;
  --green2: #4fbf7a;
  --line: rgba(255, 255, 255, .12);
  --radius: 14px;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: radial-gradient(120% 80% at 50% 0%, #2a2a5a 0%, var(--bg) 60%) fixed; color: var(--ink); }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) 0 env(safe-area-inset-left); -webkit-tap-highlight-color: transparent; }
h1, h2 { margin: 0; font-weight: 700; }
h2 { font-size: 1.05rem; margin-bottom: .6rem; }
.muted { color: var(--muted); font-weight: 400; }
.center { text-align: center; }
[hidden] { display: none !important; }

.screen { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 1rem 1rem 6.5rem; }
.hero { text-align: center; padding: 3rem 0 1.5rem; }
.hero.small { padding: 2rem 0 1rem; }
.hero h1 { font-size: 2.3rem; letter-spacing: .02em; }
.logo { font-size: 3.2rem; filter: drop-shadow(0 0 18px rgba(242, 184, 75, .45)); }
.lead { color: var(--muted); margin: .5rem 0 0; }

.panel { background: rgba(0, 0, 0, .22); border: 1px solid var(--line); border-radius: var(--radius); padding: 1rem; margin-bottom: 1rem; }
label { display: block; font-weight: 600; margin-bottom: .4rem; }
input { width: 100%; font: inherit; font-size: 1.05rem; padding: .8rem .9rem; border-radius: 10px; border: 1px solid var(--line); background: #0e0e22; color: var(--ink); }
input:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.btn { font: inherit; font-weight: 700; border: 0; border-radius: 10px; padding: .8rem 1rem; cursor: pointer; color: var(--ink); }
.btn.primary { background: var(--red); width: 100%; margin-top: .8rem; }
.btn.primary:active, .btn.add:active { background: var(--red2); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.small { padding: .45rem .7rem; font-size: .9rem; }
.btn.add { background: var(--red); }
.btn.wide { width: 100%; font-size: 1.05rem; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.back { display: block; width: 100%; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .3); margin: .4rem 0 0; }
.msg { min-height: 1.2em; margin: .6rem 0 0; color: #ffb4a8; }
.msg:empty { min-height: 0; margin: 0; }
.credit { color: var(--muted); font-size: .75rem; margin: .8rem 0 0; }
.hint { color: var(--muted); font-size: .85rem; margin: -.2rem 0 .7rem; line-height: 1.4; }
.hint.tight { margin: .5rem 0 .1rem; }
.empty { color: var(--muted); font-style: italic; list-style: none; padding: .5rem 0; }

.whoList { display: grid; gap: .7rem; }
.whoList .btn { display: flex; align-items: center; gap: .9rem; background: var(--card); border: 1px solid var(--line); font-size: 1.15rem; padding: 1rem; text-align: left; }
.whoList .btn .grow { flex: 1; display: grid; }
.whoList .btn small { font-size: .75rem; font-weight: 500; color: var(--muted); }
.whoList .btn.locked { opacity: .55; cursor: default; }

/* header + tabs */
.top { display: flex; align-items: center; justify-content: space-between; padding: .4rem 0 1rem; }
.brand { font-size: 1.35rem; }
.chip { font: inherit; display: inline-flex; align-items: center; gap: .35rem; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: .4rem .85rem; cursor: pointer; }
.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 5; display: flex; justify-content: center; gap: .3rem; padding: .5rem .5rem calc(.5rem + env(safe-area-inset-bottom)); background: rgba(14, 14, 34, .95); border-top: 1px solid var(--line); backdrop-filter: blur(8px); }
.tabs button { flex: 1; max-width: 140px; font: inherit; font-size: .8rem; font-weight: 600; background: none; border: 0; color: var(--muted); padding: .45rem .2rem; border-radius: 10px; cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .15rem; }
.tabs button span { font-size: 1.3rem; }
.tabs button.on { color: var(--ink); background: rgba(255, 255, 255, .1); }

/* toggles */
.toggles { margin-top: .2rem; }
.toggle { display: flex; align-items: center; gap: .55rem; font-weight: 600; margin: .7rem 0 0; cursor: pointer; user-select: none; }
.toggle input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.toggle .track { position: relative; width: 42px; height: 24px; border-radius: 999px; background: #3a3a5e; transition: background .2s; flex: none; }
.toggle .track::after { content: ""; position: absolute; top: 3px; left: 3px; width: 18px; height: 18px; border-radius: 50%; background: #fff; transition: transform .2s; }
.toggle input:checked + .track { background: var(--green); }
.toggle input:checked + .track::after { transform: translateX(18px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--gold); outline-offset: 2px; }
.services { display: grid; grid-template-columns: 1fr 1fr; gap: .1rem .8rem; }
.services .toggle { margin: .55rem 0; font-weight: 500; }

/* film lists */
.films { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.panel .films:not(:empty) { margin-top: .8rem; }
.film { display: grid; grid-template-columns: 54px 1fr auto; gap: .7rem; align-items: center; background: rgba(255, 255, 255, .05); border-radius: 10px; padding: .5rem; }
.film.tap { cursor: pointer; }
.film img, .film .ph { width: 54px; height: 80px; object-fit: cover; border-radius: 6px; background: var(--card); }
.film .info { min-width: 0; }
.film .t { font-weight: 700; }
.film .y { color: var(--muted); font-weight: 400; }
.chev { font-size: 1.6rem; color: var(--muted); padding: 0 .3rem; }
.sub { color: var(--muted); font-size: .82rem; margin: .15rem 0; line-height: 1.6; }
.sub .face { margin-right: .1rem; }
.faces { display: inline-flex; align-items: center; gap: .15rem; }
.seen { color: var(--green2); font-weight: 700; }
.badges { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .3rem; }
.badge { font-size: .7rem; padding: .12rem .45rem; border-radius: 999px; background: #0e0e22; border: 1px solid var(--line); white-space: nowrap; }
.badge.s { border-color: rgba(242, 184, 75, .5); }
.badge.f { border-color: rgba(150, 170, 255, .5); }
.badge.r { color: var(--muted); }
.badge.ours { background: var(--green); border-color: var(--green2); color: #fff; font-weight: 600; }
.badge.big { font-size: .85rem; padding: .3rem .7rem; }
.badge a { color: inherit; }
.status { font-size: .75rem; font-weight: 700; padding: .35rem .6rem; border-radius: 8px; text-align: center; line-height: 1.2; max-width: 84px; }
.status.mine { background: #1f4a2c; color: #c8f0d0; border: 1px solid #2f6b3a; }
.status.big { max-width: none; font-size: .95rem; padding: .55rem .8rem; }

/* my films filter */
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: .3rem; background: rgba(0, 0, 0, .25); border: 1px solid var(--line); border-radius: 12px; padding: .25rem; margin-bottom: 1rem; }
.seg button { font: inherit; font-weight: 600; background: none; border: 0; color: var(--muted); padding: .55rem .3rem; border-radius: 9px; cursor: pointer; }
.seg button.on { background: var(--card); color: var(--ink); }
.seg span { font-weight: 400; opacity: .8; }

/* family */
.people { display: flex; gap: .4rem; overflow-x: auto; padding-bottom: .4rem; margin-bottom: .6rem; scrollbar-width: none; }
.personChip { font: inherit; display: inline-flex; align-items: center; gap: .35rem; flex: none; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 999px; padding: .35rem .75rem .35rem .35rem; cursor: pointer; }
.personChip b { font-weight: 600; color: var(--muted); font-size: .85rem; }
.personChip.on { background: var(--gold); color: #24180a; border-color: var(--gold); }
.personChip.on b { color: #5a4210; }
.face.all { background: var(--gold); color: #24180a; }

/* film page */
.sheet { position: fixed; inset: 0; z-index: 20; background: rgba(10, 10, 26, .97); padding: 1rem; overflow-y: auto; }
.sheetBox { position: relative; width: min(440px, 100%); margin: .5rem auto 2rem; }
.close { position: fixed; top: calc(.6rem + env(safe-area-inset-top)); right: .6rem; width: 44px; height: 44px; padding: 0; border-radius: 50%; color: var(--ink); cursor: pointer;
  background: rgba(0, 0, 0, .7); border: 2px solid rgba(255, 255, 255, .8); font-size: 1.7rem; line-height: 1; z-index: 25;
  display: grid; place-items: center; box-shadow: 0 2px 10px rgba(0, 0, 0, .5); }
.sheetBox .panel { background: #1f1f42; margin-bottom: .7rem; }
.filmCard { text-align: center; padding: .5rem 0 .8rem; }
.filmCard img { width: 58%; max-width: 210px; aspect-ratio: 2 / 3; object-fit: cover; border-radius: 10px; box-shadow: 0 10px 30px rgba(0, 0, 0, .5); }
.filmCard h3 { font-size: 1.5rem; margin: .8rem 0 .1rem; }
.filmCard .meta { color: var(--muted); margin: 0 0 .2rem; }
.filmCard .genres { color: var(--gold); font-size: .85rem; margin: 0 0 .5rem; }
.filmCard .blurb { font-size: .92rem; color: var(--muted); text-align: left; margin: .6rem 0 0; line-height: 1.45; }
.actions { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.watch h4, .rate h4, .sheetBox h4 { margin: 0 0 .5rem; font-size: .95rem; }
.watch h4.also { margin-top: .8rem; color: var(--muted); font-weight: 600; }
.famList { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.famList li { display: flex; align-items: center; gap: .6rem; }
.famList .grow { flex: 1; font-weight: 600; }
.sheetBox p { margin: .2rem 0; line-height: 1.4; }
.facts { margin: 0; padding-left: 1.1rem; display: grid; gap: .55rem; font-size: .92rem; line-height: 1.4; }
.links { text-align: center; margin: .6rem 0; }
.links a { color: var(--gold); }

/* stars */
.stars { display: inline-flex; gap: .1rem; vertical-align: middle; }
.star { font-size: 1rem; color: rgba(255, 255, 255, .25); background: none; border: 0; padding: 0; line-height: 1; }
button.star { font-size: 2rem; cursor: pointer; padding: 0 .1rem; }
.star.on { color: var(--gold); }
.star.half { color: transparent; -webkit-background-clip: text; background-clip: text;
  background-image: linear-gradient(90deg, var(--gold) 50%, rgba(255, 255, 255, .25) 50%); }
.rate .btn { margin: .1rem 0 .2rem; }

/* faces */
.face { display: inline-grid; place-items: center; flex: none; width: 28px; height: 28px; border-radius: 50%; background: var(--card) center / cover no-repeat; color: var(--ink); font-weight: 700; font-size: .8rem; border: 2px solid rgba(255, 255, 255, .7); vertical-align: middle; }
.face.sm { width: 22px; height: 22px; font-size: .65rem; border-width: 1px; }
.face.md { width: 34px; height: 34px; }
.face.lg { width: 48px; height: 48px; font-size: 1.2rem; }

/* yes/no card and messages */
.askBox { display: grid; place-items: center; z-index: 40; }
.ask { width: min(360px, 100%); background: #1f1f42; text-align: center; box-shadow: 0 10px 40px rgba(0, 0, 0, .5); }
.ask p { font-size: 1.05rem; line-height: 1.45; margin: .2rem 0 1rem; white-space: pre-line; }
.askBtns { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.toast { position: fixed; left: 50%; bottom: calc(5.5rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 50; background: #f7f5ff; color: #1b1b1b; padding: .7rem 1rem; border-radius: 10px; font-weight: 600; max-width: 90vw; box-shadow: 0 6px 24px rgba(0, 0, 0, .4); }
#switchBtn { margin: .3rem 0 .9rem; }

/* picked for you */
.pickHead { display: flex; align-items: center; justify-content: space-between; gap: .6rem; }
.pickHead h2 { margin: 0; }
.picks .hint { margin: .5rem 0 0; }
.tune { margin-top: .8rem; padding: .9rem; border-radius: 12px; background: rgba(255, 255, 255, .05); border: 1px solid var(--line); }
.tune > label { margin-bottom: .2rem; }
.tune input[type=range] { width: 100%; padding: 0; accent-color: var(--gold); background: none; border: 0; }
.scale { display: flex; justify-content: space-between; font-size: .75rem; color: var(--muted); margin-bottom: .8rem; }
.tuneGrid { display: grid; grid-template-columns: 1fr 1fr; gap: .7rem; align-items: end; }
.tuneGrid label { font-size: .82rem; color: var(--muted); margin: 0; display: grid; gap: .25rem; }
.tuneGrid select, .tuneGrid input { font: inherit; font-size: .95rem; width: 100%; padding: .5rem .55rem; border-radius: 8px; border: 1px solid var(--line); background: #0e0e22; color: var(--ink); }
.tuneGrid .btn { height: 2.45rem; }
.sub.award { color: var(--gold); font-weight: 600; }
.sub.why { color: #c9c4ff; font-style: italic; }
.pickBtns { grid-column: 1 / -1; display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .4rem; }
.pickBtns .btn { padding: .5rem .3rem; font-size: .85rem; }
.picks .film { grid-template-columns: 54px 1fr; }
.picks .film > span:empty { display: none; }
.btn.more { margin-top: .8rem; }
