:root {
  --bg: #0f2a1f;
  --bg2: #163b2c;
  --card: #1c4636;
  --ink: #fdf7ec;
  --muted: #b9cbbf;
  --red: #c8332b;
  --red2: #a3241e;
  --gold: #e8c26a;
  --gold2: #b88a2c;
  --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%, #1d4a37 0%, var(--bg) 60%); 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; }
[hidden] { display: none !important; }

/* falling snow */
#snow { position: fixed; inset: 0; pointer-events: none; overflow: hidden; z-index: 0; }
.flake { position: absolute; top: -10px; color: #fff; opacity: .7; animation: fall linear infinite; }
@keyframes fall { to { transform: translateY(105vh) translateX(20px); } }
@media (prefers-reduced-motion: reduce) { .flake { display: none; } }

.screen { position: relative; z-index: 1; max-width: 560px; margin: 0 auto; padding: 1rem 1rem 6rem; }
.hero { text-align: center; padding: 3rem 0 1.5rem; }
.hero.small { padding: 2rem 0 1rem; }
.hero h1 { font-size: 2.3rem; letter-spacing: .02em; }
.star { font-size: 3rem; color: var(--gold); text-shadow: 0 0 24px rgba(232, 194, 106, .6); }
.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: #0b1f17; 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 { 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:disabled { opacity: .5; cursor: default; }
.msg { min-height: 1.2em; margin: .6rem 0 0; color: #ffb4a8; }
.note { color: var(--muted); text-align: center; margin: .2rem 0 1rem; }
.credit { color: var(--muted); font-size: .75rem; margin: .8rem 0 0; }

.intro { background: linear-gradient(160deg, rgba(200, 51, 43, .35), rgba(0, 0, 0, .2)); border-color: rgba(232, 194, 106, .35); }
.intro h2 { font-size: 1.3rem; color: var(--gold); }
.intro p { margin: 0; line-height: 1.45; }
.whoList { display: grid; gap: .7rem; }
.whoList .btn { background: var(--card); border: 1px solid var(--line); font-size: 1.15rem; padding: 1rem; text-align: left; }

/* header + tabs */
.top { display: flex; align-items: center; justify-content: space-between; padding: .4rem 0 1rem; }
.brand { font-size: 1.35rem; }
.brand span { color: var(--gold); }
.chip { font: inherit; 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: .4rem; padding: .5rem .5rem calc(.5rem + env(safe-area-inset-bottom)); background: rgba(9, 26, 19, .94); border-top: 1px solid var(--line); backdrop-filter: blur(8px); }
.tabs button { flex: 1; max-width: 260px; font: inherit; font-weight: 600; background: none; border: 0; color: var(--muted); padding: .55rem; 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, .08); }

/* the calendar */
.doors { display: grid; grid-template-columns: repeat(5, 1fr); gap: .5rem; }
.door { position: relative; aspect-ratio: 3 / 4; border-radius: 10px; border: 0; padding: 0; cursor: pointer; font: inherit; color: var(--ink); overflow: hidden; }
.door .num { position: absolute; inset: 0; display: grid; place-items: center; font-size: clamp(1.2rem, 6vw, 1.9rem); font-weight: 800; text-shadow: 0 2px 0 rgba(0, 0, 0, .3); }
.door.locked { background: linear-gradient(160deg, #2a5a45, #1c4636); box-shadow: inset 0 0 0 2px rgba(232, 194, 106, .25); }
.door.locked:nth-child(3n) { background: linear-gradient(160deg, #b23a31, #8f2620); }
.door.locked:nth-child(4n+1) { background: linear-gradient(160deg, #31556e, #213d52); }
.door.locked .num { color: rgba(255, 255, 255, .85); }
.door.ready { background: linear-gradient(160deg, var(--gold), var(--gold2)); box-shadow: 0 0 0 2px #fff6, 0 0 22px rgba(232, 194, 106, .65); animation: glow 1.8s ease-in-out infinite; }
.door.ready .num { color: #3a2a06; text-shadow: none; }
.door.ready::after { content: "Open me!"; position: absolute; left: 0; right: 0; bottom: 6%; font-size: .62rem; font-weight: 700; color: #3a2a06; text-align: center; }
.door.open { background: #000; }
.door.open img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.door.open .num { inset: auto 4px auto auto; top: 4px; font-size: .8rem; background: rgba(0, 0, 0, .7); border-radius: 6px; padding: 1px 5px; display: block; }
.door.open .noimg { position: absolute; inset: 0; display: grid; place-items: center; padding: 4px; font-size: .7rem; text-align: center; background: var(--card); }
.door.shake { animation: shake .4s; }
@keyframes glow { 50% { box-shadow: 0 0 0 2px #fff9, 0 0 34px rgba(232, 194, 106, .95); } }
@keyframes shake { 25% { transform: translateX(-4px) rotate(-2deg); } 75% { transform: translateX(4px) rotate(2deg); } }

/* film lists */
.films { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.film { display: grid; grid-template-columns: 54px 1fr auto; gap: .7rem; align-items: center; background: rgba(255, 255, 255, .04); border-radius: 10px; padding: .5rem; }
.film img, .film .ph { width: 54px; height: 80px; object-fit: cover; border-radius: 6px; background: var(--card); }
.film .t { font-weight: 700; }
.film .y { color: var(--muted); font-weight: 400; }
.film.taken > :not(:last-child) { opacity: .5; }
.badges { display: flex; flex-wrap: wrap; gap: .25rem; margin-top: .3rem; }
.badge { font-size: .7rem; padding: .12rem .45rem; border-radius: 999px; background: #0b1f17; border: 1px solid var(--line); white-space: nowrap; }
.badge.s { border-color: rgba(232, 194, 106, .55); }
.badge.f { border-color: rgba(120, 200, 140, .6); }
.badge.r { color: var(--muted); }
.status { font-size: .75rem; font-weight: 700; padding: .35rem .6rem; border-radius: 8px; text-align: center; line-height: 1.2; max-width: 78px; }
.status.taken { background: #4a1f1c; color: #ffc9c2; border: 1px solid #8f2620; }
.status.notours { background: #2b2f2d; color: #c9d2cc; border: 1px solid #4a524d; }
.status.mine { background: #1f4a2c; color: #c8f0d0; border: 1px solid #2f6b3a; }
.toggles { margin-top: .3rem; }
.toggles .hint { margin: .6rem 0 0; font-size: .8rem; color: var(--muted); }
.badge.ours { background: #2f6b3a; border-color: #4f9a5c; color: #fff; }
.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: #33493f; 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(--red); }
.toggle input:checked + .track::after { transform: translateX(18px); }
.toggle input:focus-visible + .track { outline: 2px solid var(--gold); outline-offset: 2px; }
.empty { color: var(--muted); font-style: italic; }
.progress { display: flex; flex-wrap: wrap; gap: .5rem; }
.person { background: var(--card); border-radius: 999px; padding: .35rem .75rem; font-size: .9rem; }
.person.done { background: #2f6b3a; }
.person b { font-variant-numeric: tabular-nums; }

/* reveal */
.reveal { position: fixed; inset: 0; z-index: 20; background: rgba(4, 12, 8, .86); display: grid; place-items: center; padding: 1rem; overflow-y: auto; }
.revealBox { position: relative; width: min(420px, 100%); text-align: center; }
.close { position: absolute; right: -4px; top: -8px; font-size: 2rem; line-height: 1; background: none; border: 0; color: var(--ink); cursor: pointer; padding: .2rem .5rem; z-index: 3; }
.revealDay { font-weight: 800; font-size: 1.3rem; margin: 0 0 .7rem; color: var(--gold); }
.scratchWrap { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--bg2); }
#scratch { position: absolute; inset: 0; width: 100%; height: 100%; touch-action: none; cursor: grab; transition: opacity .6s; }
#scratch.gone { opacity: 0; pointer-events: none; }
#justOpen { margin-top: .8rem; }
.filmCard { padding: 1rem; min-height: 420px; }
.filmCard img { width: 62%; max-width: 220px; 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 .5rem; }
.filmCard .who { display: inline-block; background: var(--red); border-radius: 999px; padding: .25rem .8rem; font-weight: 700; margin: .2rem 0 .7rem; }
.filmCard .blurb { font-size: .9rem; color: var(--muted); text-align: left; margin: .6rem 0; }
.filmCard .watch { text-align: left; }
.filmCard .watch h4 { margin: .6rem 0 .3rem; font-size: .9rem; }
.filmCard .watch a { color: var(--ink); }
.filmCard .links { margin-top: .8rem; font-size: .9rem; }
.filmCard .links a { color: var(--gold); }

.toast { position: fixed; left: 50%; bottom: calc(5.5rem + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 30; background: #fdf7ec; color: #1b1b1b; padding: .7rem 1rem; border-radius: 10px; font-weight: 600; max-width: 90vw; box-shadow: 0 6px 24px rgba(0, 0, 0, .4); }

/* 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; }
.whoList .btn { display: flex; align-items: center; gap: .9rem; }
.person { display: inline-flex; align-items: center; gap: .35rem; padding-left: .3rem; }
.filmCard .who { display: inline-flex; align-items: center; gap: .5rem; padding: .25rem .9rem .25rem .3rem; }
.watchedBy { display: flex; align-items: center; gap: .25rem; margin-top: .6rem; flex-wrap: wrap; }

/* the reveal can be long now: scroll the whole overlay */
.reveal { display: block; }
.revealBox { margin: .5rem auto 2rem; }
.filmMore { text-align: left; margin-top: .9rem; }
.filmMore .panel { background: #173a2c; margin-bottom: .7rem; }
.filmMore .links { text-align: center; }
.filmMore .links a { color: var(--gold); }
.filmMore h4 { margin: 0 0 .5rem; }
.filmMore 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; }
.rate .btn { margin: .1rem 0 .4rem; }
.rate .hint { margin: .3rem 0 .1rem; }

/* 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); }

/* lists */
.film.tap { cursor: pointer; grid-template-columns: 54px 1fr auto; }
.chev { font-size: 1.6rem; color: var(--muted); padding: 0 .3rem; }
.sub { color: var(--muted); font-size: .85rem; margin: .1rem 0 .3rem; }
.hint { color: var(--muted); font-size: .85rem; margin: -.2rem 0 .7rem; }
.stack { display: grid; gap: .35rem; justify-items: end; }
.trophy { background: linear-gradient(160deg, rgba(232, 194, 106, .25), rgba(0, 0, 0, .2)); border-color: rgba(232, 194, 106, .5); }
.quizCall { background: linear-gradient(160deg, rgba(200, 51, 43, .3), rgba(0, 0, 0, .2)); }
.quizCall p { margin: 0 0 .2rem; }
.quizCall .progress { margin-top: .8rem; }
.favs { list-style: none; margin: 0; padding: 0; display: grid; gap: .5rem; }
.fav { display: flex; align-items: center; gap: .7rem; background: rgba(255, 255, 255, .05); border-radius: 10px; padding: .55rem .7rem; }
.fav.top { background: rgba(232, 194, 106, .14); }
.fav .rank { font-size: 1.3rem; width: 1.8rem; text-align: center; font-weight: 800; }
.fav .t { font-weight: 700; }

/* quiz */
.quizBox .panel { text-align: left; background: #173a2c; }
.quizBox h3 { margin: 0 0 .6rem; }
.question { font-size: 1.1rem; font-weight: 600; white-space: pre-line; line-height: 1.45; }
.options { display: grid; gap: .5rem; margin: .8rem 0; }
.opt { font: inherit; text-align: left; padding: .8rem .9rem; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--ink); cursor: pointer; }
.opt.right { background: #2f6b3a; border-color: #6fcf86; }
.opt.wrong { background: #8f2620; border-color: #ff8a80; }
.opt:disabled { cursor: default; }
.fav .grow { flex: 1; min-width: 0; }
.btn.own { display: grid; justify-items: center; line-height: 1.15; padding: .4rem .7rem; }
.btn.own small { font-size: .68rem; font-weight: 600; opacity: .9; }
.status.streaming { background: #1f4a2c; color: #c8f0d0; border: 1px solid #2f6b3a; }
.askBox { display: grid; place-items: center; z-index: 40; }
.ask { width: min(360px, 100%); background: #173a2c; 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; }
.askBtns { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.xmasBar { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; margin-top: 1rem; }

/* always-obvious ways back */
.btn.back { display: block; width: 100%; background: rgba(255, 255, 255, .1); border: 1px solid rgba(255, 255, 255, .3); margin: 0 0 1rem; }
.panel .btn.back { margin: 1rem 0 0; }
.filmMore .btn.back { margin: .4rem 0 0; }
.close { position: fixed; top: calc(.6rem + env(safe-area-inset-top)); right: .6rem; width: 44px; height: 44px; padding: 0; border-radius: 50%;
  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); }
.brand .year { color: var(--gold); font-weight: 600; }
.ask p { white-space: pre-line; }
.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; }
.chip { display: inline-flex; align-items: center; gap: .35rem; }
.swapBar { display: flex; align-items: center; gap: .7rem; background: rgba(232, 194, 106, .15); border: 1px solid rgba(232, 194, 106, .5); border-radius: 10px; padding: .6rem .7rem; margin: 0 0 .7rem; font-size: .92rem; }
.swapBar span { flex: 1; }
