/* MoviEEZ — dark-first cinema look: deep ink, marquee gold, warm red. iPhone-first. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --display: ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", system-ui, sans-serif;
  --radius: 18px;
  --radius-sm: 12px;
  --tab-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px);
  --safe-t: env(safe-area-inset-top, 0px);
  --ease: cubic-bezier(.2, .8, .2, 1);
  --spring: cubic-bezier(.34, 1.56, .64, 1);
}

:root, [data-theme="dark"] {
  --bg: #0b0a12;
  --bg-2: #110f1b;
  --surface: #181624;
  --surface-2: #221f31;
  --surface-3: #2c2840;
  --line: rgba(255, 255, 255, .08);
  --line-2: rgba(255, 255, 255, .14);
  --text: #f6f4ff;
  --muted: #a7a3bd;
  --faint: #6f6b88;
  --gold: #ffc94a;
  --gold-2: #ff9a3d;
  --gold-ink: #2a1a00;
  --gold-text: #ffd36e;
  --red: #ff4d6d;
  --green: #3ddc97;
  --blue: #6aa8ff;
  --shadow: 0 12px 40px rgba(0, 0, 0, .45);
  --glass: rgba(14, 12, 22, .78);
  --scrim: rgba(5, 4, 10, .66);
  color-scheme: dark;
}

[data-theme="light"] {
  --bg: #f6f3ee;
  --bg-2: #efebe4;
  --surface: #ffffff;
  --surface-2: #f2eee8;
  --surface-3: #e7e1d8;
  --line: rgba(20, 14, 40, .08);
  --line-2: rgba(20, 14, 40, .16);
  --text: #18151f;
  --muted: #625d70;
  --faint: #9a95a6;
  --gold: #ffbf2e;
  --gold-2: #ff8a2a;
  --gold-ink: #2a1a00;
  --gold-text: #a86500;
  --red: #e5304f;
  --green: #12a66a;
  --blue: #2f6fe0;
  --shadow: 0 10px 30px rgba(40, 30, 10, .14);
  --glass: rgba(250, 248, 244, .82);
  --scrim: rgba(20, 16, 30, .45);
  color-scheme: light;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html { background: var(--bg); -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100dvh;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.4 var(--font);
  overscroll-behavior-y: none;
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
img { display: block; max-width: 100%; }
a { color: var(--gold-text); }
h1, h2, h3 { font-family: var(--display); margin: 0; letter-spacing: -.01em; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }

/* ---------- Brand ---------- */
.brand-mark {
  font: 800 22px/1 var(--display);
  letter-spacing: -.02em;
}
.brand-mark span {
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-mark.big { font-size: 46px; }
.boot { min-height: 100dvh; display: grid; place-items: center; animation: pulse 1.6s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .55; } }

/* ---------- Shell ---------- */
.shell { min-height: 100dvh; padding-bottom: calc(var(--tab-h) + var(--safe-b) + 12px); }
.topbar {
  position: sticky; top: 0; z-index: 20;
  padding: calc(var(--safe-t) + 10px) 16px 10px;
  display: flex; align-items: center; gap: 12px;
  background: linear-gradient(var(--bg) 60%, transparent);
}
.topbar h1 { font-size: 28px; font-weight: 800; flex: 1; min-width: 0; }
.topbar .sub { color: var(--muted); font-size: 13px; font-weight: 500; display: block; font-family: var(--font); letter-spacing: 0; }
.screen { padding: 0 16px; max-width: 1100px; margin: 0 auto; animation: screen-in .35s var(--ease); }
.screen.narrow { max-width: 640px; }
@keyframes screen-in { from { opacity: 0; transform: translateY(8px); } }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
  padding: 6px 8px calc(var(--safe-b) + 6px);
  display: flex; justify-content: center;
  background: var(--glass);
  backdrop-filter: blur(20px) saturate(1.6); -webkit-backdrop-filter: blur(20px) saturate(1.6);
  border-top: 1px solid var(--line);
}
.tabbar-inner { display: flex; width: 100%; max-width: 560px; }
.tab {
  flex: 1; height: 52px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--faint); font-size: 10.5px; font-weight: 600; border-radius: 14px; text-decoration: none; position: relative;
  transition: color .2s;
}
.tab svg { width: 25px; height: 25px; }
.tab.on { color: var(--text); }
.tab.on svg { color: var(--gold); filter: drop-shadow(0 0 10px rgba(255, 201, 74, .45)); }
.tab.tonight.on svg { animation: twinkle 2.4s ease-in-out infinite; }
@keyframes twinkle { 50% { transform: scale(1.08) rotate(-4deg); } }
.tab .dot { position: absolute; top: 6px; left: calc(50% + 8px); width: 8px; height: 8px; border-radius: 50%; background: var(--red); box-shadow: 0 0 0 2px var(--bg); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 20px; border-radius: 999px;
  font-weight: 700; font-size: 16px; white-space: nowrap;
  background: var(--surface-2); color: var(--text);
  transition: transform .15s var(--ease), opacity .2s, background .2s;
  user-select: none; -webkit-user-select: none;
}
.btn:active { transform: scale(.96); }
.btn[disabled] { opacity: .4; pointer-events: none; }
.btn.primary {
  background: linear-gradient(135deg, var(--gold), var(--gold-2));
  color: var(--gold-ink);
  box-shadow: 0 8px 24px rgba(255, 160, 50, .28), inset 0 1px 0 rgba(255, 255, 255, .5);
}
.btn.ghost { background: transparent; color: var(--muted); }
.btn.outline { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line-2); }
.btn.danger { background: rgba(255, 77, 109, .14); color: var(--red); }
.btn.block { width: 100%; }
.btn.lg { min-height: 58px; font-size: 18px; padding: 0 28px; }
.btn.sm { min-height: 36px; padding: 0 14px; font-size: 14px; }
.icon-btn {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--surface-2); color: var(--text); transition: transform .15s;
}
.icon-btn:active { transform: scale(.92); }
.icon-btn svg { width: 22px; height: 22px; }
.icon-btn.plain { background: transparent; }
.link-btn { color: var(--gold-text); font-weight: 600; font-size: 15px; padding: 8px 4px; }

/* ---------- Chips & segmented ---------- */
.chips { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; padding: 2px 16px 2px; margin: 0 -16px; }
.chips::-webkit-scrollbar { display: none; }
.chips.wrap { flex-wrap: wrap; overflow: visible; margin: 0; padding: 0; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 36px; padding: 0 14px; border-radius: 999px;
  background: var(--surface-2); color: var(--muted); font-size: 14px; font-weight: 600;
  border: 1px solid transparent; transition: all .18s;
}
.chip.on { background: rgba(255, 201, 74, .14); color: var(--gold-text); border-color: rgba(255, 201, 74, .45); }
.chip.small { min-height: 26px; padding: 0 10px; font-size: 12px; }
.chip .x { opacity: .6; margin-left: 2px; }
.tag {
  display: inline-flex; align-items: center; gap: 4px; padding: 3px 8px; border-radius: 6px;
  background: var(--surface-2); color: var(--muted); font-size: 12px; font-weight: 600; white-space: nowrap;
}
.tag.gold { background: rgba(255, 201, 74, .14); color: var(--gold-text); }
.tag.red { background: rgba(255, 77, 109, .14); color: var(--red); }
.tag.green { background: rgba(61, 220, 151, .14); color: var(--green); }
.seg {
  display: flex; background: var(--surface); border-radius: 14px; padding: 4px; gap: 4px;
  border: 1px solid var(--line);
}
.seg button {
  flex: 1; min-height: 38px; border-radius: 10px; color: var(--muted); font-weight: 700; font-size: 14px;
  transition: all .2s;
}
.seg button.on { background: var(--surface-3); color: var(--text); box-shadow: 0 2px 8px rgba(0, 0, 0, .2); }
.count-badge { display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--surface-3); font-size: 12px; margin-left: 4px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; }
.field > label, .label { font-size: 13px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; }
.input, .select, textarea.input {
  width: 100%; min-height: 50px; padding: 12px 14px; border-radius: 14px;
  background: var(--surface-2); border: 1px solid var(--line); outline: none;
  font-size: 17px; /* ≥16px stops iOS zooming in */
  transition: border-color .2s, box-shadow .2s;
}
textarea.input { min-height: 90px; resize: vertical; }
.input:focus { border-color: rgba(255, 201, 74, .6); box-shadow: 0 0 0 4px rgba(255, 201, 74, .12); }
.row { display: flex; gap: 12px; }
.row > * { flex: 1; min-width: 0; }
.search {
  position: relative; display: flex; align-items: center;
}
.search svg { position: absolute; left: 14px; width: 18px; height: 18px; color: var(--faint); pointer-events: none; }
.search .input { padding-left: 42px; min-height: 46px; border-radius: 999px; background: var(--surface); }
.hint { color: var(--faint); font-size: 13px; }
.switch-row {
  display: flex; align-items: center; gap: 14px; padding: 14px 0; border-bottom: 1px solid var(--line);
}
.switch-row:last-child { border-bottom: 0; }
.switch-row .txt { flex: 1; min-width: 0; }
.switch-row .t { font-weight: 600; }
.switch-row .d { color: var(--muted); font-size: 13px; margin-top: 2px; }
.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { opacity: 0; position: absolute; inset: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 16px; background: var(--surface-3); transition: background .2s; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 6px rgba(0, 0, 0, .3); transition: transform .25s var(--spring); }
.switch input:checked + span { background: var(--green); }
.switch input:checked + span::after { transform: translateX(20px); }
.stepper { display: flex; align-items: center; gap: 4px; background: var(--surface-2); border-radius: 999px; padding: 3px; flex: none; }
.stepper button { width: 34px; height: 34px; border-radius: 50%; font-size: 20px; font-weight: 700; color: var(--text); }
.stepper button:active { background: var(--surface-3); }
.stepper output { min-width: 34px; text-align: center; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- Cards / sections ---------- */
.section { margin: 22px 0 10px; display: flex; align-items: baseline; gap: 10px; }
.section h2 { font-size: 20px; font-weight: 800; flex: 1; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; }
.card + .card { margin-top: 12px; }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.list-row {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; min-height: 60px; width: 100%; text-align: left;
  border-bottom: 1px solid var(--line);
}
.list-row:last-child { border-bottom: 0; }
.list-row .main { flex: 1; min-width: 0; }
.list-row .title { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-row .meta { color: var(--muted); font-size: 13px; margin-top: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
button.list-row:active { background: var(--surface-2); }
.chev { color: var(--faint); width: 18px; height: 18px; flex: none; }

.empty { text-align: center; padding: 48px 24px; color: var(--muted); }
.empty .art { font-size: 54px; margin-bottom: 12px; filter: drop-shadow(0 8px 20px rgba(255, 201, 74, .25)); }
.empty h3 { color: var(--text); font-size: 20px; margin-bottom: 6px; }
.empty p { margin: 0 auto 18px; max-width: 320px; }

.banner {
  margin: 0 16px 12px; padding: 10px 14px; border-radius: 12px; font-size: 14px; font-weight: 600;
  background: rgba(255, 77, 109, .12); color: var(--red); display: flex; gap: 8px; align-items: center;
}

/* ---------- Avatars ---------- */
.avatar {
  --size: 40px;
  width: var(--size); height: var(--size); border-radius: 50%; flex: none;
  display: grid; place-items: center; overflow: hidden; position: relative;
  font-size: calc(var(--size) * .52); line-height: 1;
  background: var(--c, var(--surface-3));
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .12);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar .initial { font: 800 calc(var(--size) * .42) / 1 var(--display); color: #fff; }
.avatar.sm { --size: 28px; }
.avatar.xs { --size: 22px; box-shadow: 0 0 0 2px var(--surface); }
.avatar.lg { --size: 64px; }
.avatar.xl { --size: 96px; }
.avatar.off { filter: grayscale(1); opacity: .35; }
.stack { display: flex; }
.stack .avatar + .avatar { margin-left: -7px; }

/* ---------- Stars ---------- */
.stars { display: inline-flex; gap: 2px; color: var(--gold); }
.stars svg { width: var(--s, 14px); height: var(--s, 14px); }
.stars .off { color: var(--surface-3); }
.stars.input-stars { gap: 4px; }
.stars.input-stars button { padding: 4px; transition: transform .2s var(--spring); }
.stars.input-stars button:active { transform: scale(1.3); }
.stars.input-stars svg { width: 30px; height: 30px; }
.score { font-weight: 800; font-variant-numeric: tabular-nums; }

/* ---------- Posters ---------- */
.poster {
  position: relative; aspect-ratio: 2 / 3; border-radius: 12px; overflow: hidden; flex: none;
  background: var(--surface-2); box-shadow: 0 6px 18px rgba(0, 0, 0, .35);
  isolation: isolate;
}
.poster img { width: 100%; height: 100%; object-fit: cover; }
.poster.gen {
  background: linear-gradient(160deg, hsl(var(--h) 70% 52%), hsl(calc(var(--h) + 40) 75% 22%) 70%, hsl(calc(var(--h) + 60) 80% 10%));
  color: #fff; container-type: inline-size;
}
.poster.gen .pin { position: absolute; inset: 0; display: flex; flex-direction: column; justify-content: flex-end; padding: 10cqw; }
.poster.gen::before {
  content: ""; position: absolute; z-index: -1; width: 130%; aspect-ratio: 1; left: -15%; top: -35%;
  border-radius: 50%;
  background: radial-gradient(circle, hsla(calc(var(--h) + 180), 90%, 70%, .55), transparent 62%);
}
.poster.gen.v1::before { left: 25%; top: -10%; }
.poster.gen.v2::before { border-radius: 0; transform: rotate(45deg); top: -55%; background: repeating-linear-gradient(90deg, rgba(255,255,255,.10) 0 8px, transparent 8px 22px); }
.poster.gen::after {
  content: attr(data-initial); position: absolute; z-index: -1; right: -6%; top: 2%;
  font: 900 90cqw / 1 var(--display); color: rgba(255, 255, 255, .13);
}
.poster.gen .pt { font: 800 var(--fs, 13cqw) / 1.05 var(--display); text-transform: uppercase; letter-spacing: .01em; text-shadow: 0 2px 12px rgba(0, 0, 0, .4); overflow-wrap: break-word; }
.poster.gen .py { margin-top: 6%; font-size: 8.5cqw; font-weight: 700; opacity: .75; letter-spacing: .2em; }
.poster.gen .pline { width: 30%; height: 2px; background: rgba(255, 255, 255, .7); margin-bottom: 7%; }
.poster .badge {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(10, 8, 16, .75); color: var(--green); display: grid; place-items: center;
  backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.poster .badge svg { width: 14px; height: 14px; }
.poster .badge.cool { color: var(--blue); left: 6px; right: auto; }

.wall {
  display: grid; gap: 18px 12px;
  grid-template-columns: repeat(auto-fill, minmax(104px, 1fr));
}
@media (min-width: 700px) { .wall { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 24px 18px; } }
.tile { text-align: left; display: flex; flex-direction: column; justify-content: flex-start; align-self: start; width: 100%; transition: transform .2s var(--ease); }
.tile:active { transform: scale(.96); }
.tile .poster { width: 100%; }
.tile .tt { margin-top: 8px; font-size: 13.5px; font-weight: 700; line-height: 1.2; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .tm { color: var(--muted); font-size: 12px; margin-top: 3px; display: flex; gap: 6px; align-items: center; }

/* ---------- Sheets ---------- */
.layer { position: fixed; inset: 0; z-index: 100; }
.scrim { position: absolute; inset: 0; background: var(--scrim); animation: fade-in .25s ease; backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.sheet {
  position: absolute; left: 0; right: 0; bottom: 0; margin: 0 auto; max-width: 640px;
  max-height: calc(100dvh - var(--safe-t) - 24px);
  background: var(--bg-2); border-radius: 26px 26px 0 0;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .4);
  display: flex; flex-direction: column;
  animation: sheet-in .38s var(--ease);
  border: 1px solid var(--line); border-bottom: 0;
}
.sheet.full { height: calc(100dvh - var(--safe-t) - 24px); }
@media (min-width: 700px) {
  .sheet { bottom: auto; top: 50%; transform: translateY(-50%); border-radius: 26px; border-bottom: 1px solid var(--line); max-height: 88dvh; animation: pop-in .3s var(--ease); }
  .sheet.full { height: 88dvh; }
}
.layer.closing .sheet { animation: sheet-out .25s ease forwards; }
.layer.closing .scrim { animation: fade-out .25s ease forwards; }
@keyframes sheet-in { from { transform: translateY(100%); } }
@keyframes sheet-out { to { transform: translateY(100%); } }
@keyframes pop-in { from { opacity: 0; transform: translateY(-46%) scale(.97); } }
@keyframes fade-in { from { opacity: 0; } }
@keyframes fade-out { to { opacity: 0; } }
.sheet-grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-2); margin: 8px auto 0; flex: none; }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 10px 16px 8px; flex: none; }
.sheet-head h2 { flex: 1; font-size: 20px; font-weight: 800; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sheet-body { overflow-y: auto; padding: 6px 16px 20px; flex: 1; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.sheet-foot { padding: 12px 16px calc(var(--safe-b) + 14px); border-top: 1px solid var(--line); display: flex; gap: 10px; flex: none; background: var(--bg-2); }
.sheet-foot .btn { flex: 1; }

/* ---------- Toasts ---------- */
#toasts { position: fixed; left: 0; right: 0; top: calc(var(--safe-t) + 10px); z-index: 300; display: flex; flex-direction: column; align-items: center; gap: 8px; pointer-events: none; padding: 0 16px; }
.toast {
  pointer-events: auto; max-width: 440px; padding: 12px 18px; border-radius: 16px; font-weight: 600; font-size: 15px;
  background: var(--surface-3); color: var(--text); box-shadow: var(--shadow); animation: toast-in .35s var(--spring);
  display: flex; gap: 10px; align-items: center;
}
.toast.error { background: #3a1420; color: #ffd0d8; }
[data-theme="light"] .toast.error { background: #ffe1e6; color: #8a1027; }
.toast.out { animation: fade-out .3s forwards; }
@keyframes toast-in { from { opacity: 0; transform: translateY(-14px) scale(.96); } }

/* ---------- Tonight ---------- */
.marquee {
  position: relative; border-radius: 26px; padding: 26px 20px 22px; margin-top: 6px; overflow: hidden;
  background:
    radial-gradient(120% 90% at 50% -20%, rgba(255, 180, 60, .32), transparent 60%),
    radial-gradient(80% 60% at 100% 110%, rgba(255, 77, 109, .22), transparent 60%),
    linear-gradient(180deg, #1d1530, #120e1d);
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 210, 120, .18), 0 20px 50px rgba(0, 0, 0, .35);
}
[data-theme="light"] .marquee { box-shadow: inset 0 0 0 1px rgba(255, 210, 120, .3), 0 18px 40px rgba(60, 30, 0, .18); }
.bulbs { position: absolute; inset: 8px; pointer-events: none; border-radius: 20px; }
.bulbs i {
  position: absolute; width: 6px; height: 6px; border-radius: 50%; background: #ffe2a0;
  box-shadow: 0 0 8px 2px rgba(255, 200, 90, .7);
  animation: bulb 1.2s steps(1) infinite;
}
.bulbs i:nth-child(odd) { animation-delay: .6s; }
@keyframes bulb { 50% { opacity: .25; box-shadow: none; } }
.marquee .eyebrow { font-size: 13px; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: #ffd98a; }
.marquee h2 { font-size: 34px; line-height: 1.05; font-weight: 900; margin: 8px 0 6px; }
.marquee p { margin: 0; color: rgba(255, 255, 255, .72); }

.modes { display: grid; gap: 12px; margin-top: 16px; }
.mode-card {
  position: relative; display: flex; align-items: center; gap: 16px; text-align: left; width: 100%;
  padding: 18px; border-radius: 22px; background: var(--surface); border: 1px solid var(--line);
  transition: transform .2s var(--ease), border-color .2s;
  overflow: hidden;
}
.mode-card:active { transform: scale(.98); }
.mode-card:hover { border-color: rgba(255, 201, 74, .35); }
.mode-card .ico {
  width: 62px; height: 62px; border-radius: 18px; flex: none; display: grid; place-items: center; font-size: 32px;
  background: linear-gradient(135deg, rgba(255, 201, 74, .22), rgba(255, 120, 60, .12));
  box-shadow: inset 0 0 0 1px rgba(255, 201, 74, .25);
}
.mode-card.spin .ico { background: linear-gradient(135deg, rgba(106, 168, 255, .25), rgba(200, 107, 250, .15)); box-shadow: inset 0 0 0 1px rgba(106, 168, 255, .3); }
.mode-card h3 { font-size: 18px; font-weight: 800; }
.mode-card p { margin: 3px 0 0; color: var(--muted); font-size: 14px; }

.night-head { display: flex; align-items: center; gap: 12px; margin: 4px 0 14px; }
.night-head .grow { flex: 1; min-width: 0; }
.night-head h2 { font-size: 24px; font-weight: 900; }
.night-head .meta { color: var(--muted); font-size: 14px; }
.progress { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; margin: 2px 0 16px; }
.progress i { display: block; height: 100%; background: linear-gradient(90deg, var(--gold), var(--gold-2)); border-radius: 3px; transition: width .5s var(--ease); }

.nominee {
  display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 20px;
  background: var(--surface); border: 1px solid var(--line); margin-bottom: 10px;
  animation: screen-in .4s var(--ease) both;
}
.nominee .who { width: 70px; flex: none; text-align: center; font-size: 13px; font-weight: 700; }
.nominee .who .avatar { margin: 0 auto 6px; }
.nominee .slots { flex: 1; display: flex; gap: 12px; min-width: 0; overflow-x: auto; scrollbar-width: none; padding: 8px 8px 2px 0; margin: -8px 0 -2px; }
.slot {
  position: relative; width: 74px; flex: none; text-align: left;
}
.slot .poster { width: 74px; }
.slot .remove {
  position: absolute; top: -6px; right: -6px; width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface-3); display: grid; place-items: center; box-shadow: 0 2px 8px rgba(0, 0, 0, .4);
}
.slot .remove svg { width: 14px; height: 14px; }
.slot-empty {
  width: 74px; aspect-ratio: 2 / 3; border-radius: 12px; flex: none;
  border: 2px dashed var(--line-2); color: var(--muted); display: grid; place-items: center; text-align: center;
  font-size: 12px; font-weight: 700; padding: 6px; transition: all .2s;
}
.slot-empty:active { transform: scale(.95); }
.slot-empty.next { border-color: rgba(255, 201, 74, .6); color: var(--gold-text); background: rgba(255, 201, 74, .06); animation: breathe 2s ease-in-out infinite; }
@keyframes breathe { 50% { box-shadow: 0 0 0 6px rgba(255, 201, 74, .08); } }
.slot-empty svg { width: 22px; height: 22px; display: block; margin: 0 auto 4px; }
.slot .st { font-size: 12px; font-weight: 700; margin-top: 5px; line-height: 1.15; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.odds { color: var(--faint); font-size: 11px; font-weight: 700; margin-top: 2px; }

.cta-dock {
  position: sticky; bottom: calc(var(--tab-h) + var(--safe-b) + 8px); z-index: 10;
  padding: 12px 0 4px; margin-top: 8px;
  background: linear-gradient(transparent, var(--bg) 30%);
}
.cta-note { text-align: center; color: var(--muted); font-size: 13px; margin-top: 8px; }

.raffle-btn {
  position: relative; overflow: hidden;
}
.raffle-btn::after {
  content: ""; position: absolute; inset: 0; transform: translateX(-100%);
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, .55) 50%, transparent 70%);
  animation: shine 2.6s ease-in-out infinite;
}
@keyframes shine { 60%, 100% { transform: translateX(100%); } }

.winner-hero { text-align: center; padding: 4px 0 8px; }
.winner-hero .poster { width: min(56vw, 240px); margin: 10px auto 18px; box-shadow: 0 20px 60px rgba(255, 170, 60, .35), 0 0 0 1px rgba(255, 210, 120, .3); }
.winner-hero h2 { font-size: 30px; font-weight: 900; line-height: 1.1; }
.winner-hero .by { color: var(--muted); margin-top: 6px; display: flex; gap: 8px; justify-content: center; align-items: center; flex-wrap: wrap; }
.actions { display: grid; gap: 10px; margin-top: 20px; }

.rate-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--line); }
.rate-row:last-child { border-bottom: 0; }
.rate-row .nm { flex: 1; font-weight: 700; }

.side-card { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); width: 100%; text-align: left; }
.side-card .poster { width: 52px; }
.side-card .main { flex: 1; min-width: 0; }
.side-card .k { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-text); }
.side-card .t { font-weight: 800; margin-top: 2px; }
.side-card .m { color: var(--muted); font-size: 13px; margin-top: 2px; }
.strip { display: flex; gap: 12px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 8px 16px 6px; }
.strip::-webkit-scrollbar { display: none; }
.strip .tile { width: 92px; flex: none; }

/* ---------- Picker ---------- */
.pick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 14px 10px; }
.pick-grid .tile.off { opacity: .38; }
.pick-grid .why { color: var(--red); font-size: 11px; font-weight: 700; margin-top: 3px; line-height: 1.2; }
.pick-grid .tile.sel .poster { box-shadow: 0 0 0 3px var(--gold), 0 8px 20px rgba(255, 180, 60, .4); }
.pick-grid .tile.sel .poster::after { content: "✓"; position: absolute; inset: auto 6px 6px auto; width: 26px; height: 26px; border-radius: 50%; background: var(--gold); color: var(--gold-ink); display: grid; place-items: center; font-weight: 900; }

/* ---------- Raffle stage ---------- */
.stage {
  position: fixed; inset: 0; z-index: 200; overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, #2a1b3e 0%, #0d0a16 55%, #050409 100%);
  color: #fff; display: flex; flex-direction: column; align-items: center;
  padding: calc(var(--safe-t) + 16px) 16px calc(var(--safe-b) + 20px);
  animation: fade-in .4s ease;
}
.stage .curtain { position: absolute; top: 0; bottom: 0; width: 52%; z-index: 5; background: repeating-linear-gradient(90deg, #6e0f22 0 18px, #8c1830 18px 34px, #5a0b1c 34px 44px); box-shadow: inset -30px 0 60px rgba(0, 0, 0, .5); transition: transform 1.1s cubic-bezier(.7, 0, .3, 1); }
.stage .curtain.l { left: 0; }
.stage .curtain.r { right: 0; transform-origin: right; box-shadow: inset 30px 0 60px rgba(0, 0, 0, .5); }
.stage.open .curtain.l { transform: translateX(-102%); }
.stage.open .curtain.r { transform: translateX(102%); }
.stage-top { width: 100%; max-width: 560px; display: flex; align-items: center; z-index: 6; }
.stage-top .ttl { flex: 1; text-align: center; font: 800 13px/1 var(--font); letter-spacing: .24em; text-transform: uppercase; color: #ffd98a; }
.stage-top .icon-btn { background: rgba(255, 255, 255, .1); color: #fff; }
.stage-msg { z-index: 4; text-align: center; margin: 14px 0 6px; min-height: 64px; }
.stage-msg .big { font: 900 30px/1.1 var(--display); }
.stage-msg .small { color: rgba(255, 255, 255, .65); margin-top: 4px; font-size: 15px; }
.countdown { font: 900 120px/1 var(--display); color: #ffd98a; text-shadow: 0 0 40px rgba(255, 190, 80, .7); animation: count .9s ease-out both; }
@keyframes count { from { transform: scale(2.2); opacity: 0; } 30% { opacity: 1; } to { transform: scale(.9); opacity: 0; } }

.hat { z-index: 3; flex: 1; width: 100%; max-width: 560px; display: grid; align-content: center; justify-items: center; gap: 14px; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); }
.ticket { position: relative; width: 100%; max-width: 150px; transition: transform .25s var(--ease), opacity .5s, filter .4s; }
.ticket .poster { width: 100%; box-shadow: 0 10px 30px rgba(0, 0, 0, .6); transition: box-shadow .12s; }
.ticket .who { display: flex; align-items: center; gap: 6px; justify-content: center; margin-top: 8px; font-size: 13px; font-weight: 700; color: rgba(255, 255, 255, .8); }
.ticket.lit { transform: scale(1.07); }
.ticket.lit .poster { box-shadow: 0 0 0 3px #ffd36e, 0 0 40px 8px rgba(255, 190, 80, .65); }
.ticket.out { opacity: .1; transform: scale(.85); filter: grayscale(1) blur(1px); }
.spot { position: absolute; z-index: 2; width: 360px; height: 360px; border-radius: 50%; pointer-events: none; background: radial-gradient(circle, rgba(255, 220, 140, .22), transparent 65%); transition: left .12s, top .12s; transform: translate(-50%, -50%); }

.reveal { position: absolute; inset: 0; z-index: 7; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: calc(var(--safe-t) + 60px) 24px calc(var(--safe-b) + 24px); text-align: center; }
.rays { position: absolute; width: 900px; height: 900px; left: 50%; top: 42%; margin: -450px 0 0 -450px; z-index: -1; opacity: .5;
  background: repeating-conic-gradient(from 0deg, rgba(255, 210, 120, .22) 0 6deg, transparent 6deg 18deg);
  -webkit-mask: radial-gradient(circle, #000 10%, transparent 62%); mask: radial-gradient(circle, #000 10%, transparent 62%);
  animation: spin 24s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.reveal .poster { width: min(58vw, 250px); box-shadow: 0 0 0 2px rgba(255, 220, 140, .6), 0 30px 80px rgba(255, 170, 60, .5); animation: winner-in .9s var(--spring) both; }
.reveal .k { font: 800 13px/1 var(--font); letter-spacing: .3em; text-transform: uppercase; color: #ffd98a; margin-bottom: 16px; animation: fade-in .6s .2s both; }
.reveal h2 { font-size: 34px; font-weight: 900; line-height: 1.05; margin-top: 22px; animation: rise .6s .45s both; }
.reveal .by { margin-top: 10px; display: flex; gap: 8px; align-items: center; justify-content: center; color: rgba(255, 255, 255, .78); animation: rise .6s .6s both; }
.reveal .btn { margin-top: 28px; animation: rise .6s .8s both; }
@keyframes winner-in { from { transform: scale(.3) rotate(-12deg); opacity: 0; } }
@keyframes rise { from { transform: translateY(16px); opacity: 0; } }
.confetti { position: absolute; inset: 0; z-index: 8; pointer-events: none; }

.wheel-wrap { position: relative; z-index: 3; width: min(92vw, 62dvh, 520px); aspect-ratio: 1; margin: auto 0; }
.wheel-wrap canvas { width: 100%; height: 100%; display: block; filter: drop-shadow(0 20px 50px rgba(0, 0, 0, .6)); }
.wheel-pointer { position: absolute; left: 50%; top: -6px; width: 34px; height: 44px; margin-left: -17px; z-index: 2; transform-origin: 50% 20%; filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .5)); }
.wheel-hub { position: absolute; left: 50%; top: 50%; width: 22%; aspect-ratio: 1; transform: translate(-50%, -50%); border-radius: 50%; display: grid; place-items: center; z-index: 2;
  background: radial-gradient(circle at 35% 30%, #fff3c4, #ffc94a 45%, #d47a10); color: #2a1a00; font: 900 clamp(13px, 3.6vw, 18px)/1 var(--display); box-shadow: 0 6px 20px rgba(0, 0, 0, .5), inset 0 -4px 8px rgba(0, 0, 0, .2); }
.stage-foot { z-index: 4; width: 100%; max-width: 420px; }

/* ---------- Detail sheet ---------- */
.detail-top { display: flex; gap: 16px; }
.detail-top .poster { width: 120px; }
.detail-top .info { flex: 1; min-width: 0; }
.detail-top h3 { font-size: 22px; font-weight: 900; line-height: 1.15; }
.detail-top .meta { color: var(--muted); font-size: 14px; margin-top: 6px; display: flex; flex-wrap: wrap; gap: 6px; }
.big-score { display: flex; align-items: center; gap: 10px; margin-top: 12px; }
.big-score .n { font: 900 30px/1 var(--display); }
.overview { color: var(--muted); font-size: 15px; margin: 14px 0 0; }
.quick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 16px 0 4px; }
.quick button { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border-radius: 16px; background: var(--surface); border: 1px solid var(--line); font-size: 12.5px; font-weight: 700; color: var(--muted); }
.quick button svg { width: 22px; height: 22px; color: var(--text); }
.quick button.on svg { color: var(--gold); }
.quick button:active { transform: scale(.96); }

/* ---------- Family ---------- */
.people { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; }
.person {
  display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 20px 12px 16px; border-radius: 22px;
  background: var(--surface); border: 1px solid var(--line); text-align: center; transition: transform .2s var(--ease);
}
.person:active { transform: scale(.97); }
.person .nm { font: 800 18px/1.1 var(--display); }
.person .sub { color: var(--muted); font-size: 12.5px; }
.person.add { border-style: dashed; color: var(--muted); justify-content: center; min-height: 170px; }
.profile-hero { text-align: center; padding: 8px 0 4px; }
.profile-hero h2 { font-size: 28px; font-weight: 900; margin-top: 10px; }
.kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-top: 16px; }
.kpi { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px 10px; text-align: center; }
.kpi .n { font: 900 26px/1 var(--display); }
.kpi .l { color: var(--muted); font-size: 12px; font-weight: 600; margin-top: 6px; }
.kpi.gold .n { color: var(--gold-text); }
.who-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 14px; }
.who-grid button { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px 6px; border-radius: 20px; font-weight: 700; transition: background .2s; }
.who-grid button:active, .who-grid button.on { background: var(--surface-2); }
.emoji-grid { display: grid; grid-template-columns: repeat(8, 1fr); gap: 6px; }
.emoji-grid button { aspect-ratio: 1; border-radius: 12px; font-size: 24px; background: var(--surface-2); }
.emoji-grid button.on { box-shadow: 0 0 0 2px var(--gold); background: var(--surface-3); }
.color-row { display: flex; gap: 10px; flex-wrap: wrap; }
.color-row button { width: 34px; height: 34px; border-radius: 50%; }
.color-row button.on { box-shadow: 0 0 0 3px var(--bg-2), 0 0 0 5px var(--text); }
.picker-toggle { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- History ---------- */
.month { font: 800 13px/1 var(--font); letter-spacing: .12em; text-transform: uppercase; color: var(--faint); margin: 24px 4px 10px; }
.hist {
  display: flex; gap: 14px; align-items: center; padding: 12px; border-radius: 20px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--line); margin-bottom: 10px;
}
.hist .poster { width: 58px; }
.hist .main { flex: 1; min-width: 0; }
.hist .t { font-weight: 800; font-size: 16px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hist .d { color: var(--muted); font-size: 13px; margin-top: 2px; }
.hist .bottom { display: flex; align-items: center; gap: 10px; margin-top: 8px; flex-wrap: wrap; }
.datebox { width: 48px; text-align: center; flex: none; }
.datebox .m { font-size: 11px; font-weight: 800; text-transform: uppercase; color: var(--red); letter-spacing: .08em; }
.datebox .dd { font: 900 24px/1 var(--display); }

/* ---------- Stats ---------- */
.stat-hero { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 700px) { .stat-hero { grid-template-columns: repeat(4, 1fr); } }
.stat { padding: 16px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
.stat .n { font: 900 32px/1 var(--display); }
.stat .l { color: var(--muted); font-size: 13px; font-weight: 600; margin-top: 6px; }
.stat.feature { background: linear-gradient(140deg, rgba(255, 201, 74, .2), rgba(255, 77, 109, .1)); border-color: rgba(255, 201, 74, .3); }
.bars { display: grid; gap: 12px; }
.bar-row { display: grid; grid-template-columns: 96px 1fr auto; align-items: center; gap: 10px; font-size: 14px; }
.bar-row .lbl { font-weight: 700; display: flex; align-items: center; gap: 8px; min-width: 0; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.bar { height: 12px; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 6px; background: linear-gradient(90deg, var(--gold), var(--gold-2)); transform-origin: left; animation: grow .9s var(--ease) both; }
.bar.alt i { background: linear-gradient(90deg, var(--blue), #9d7bff); }
@keyframes grow { from { transform: scaleX(0); } }
.bar-row .v { font-weight: 800; font-variant-numeric: tabular-nums; color: var(--muted); min-width: 36px; text-align: right; }
.rank { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); width: 100%; text-align: left; }
.rank:last-child { border-bottom: 0; }
.rank .num { font: 900 18px/1 var(--display); color: var(--faint); width: 22px; text-align: center; }
.rank .poster { width: 40px; border-radius: 8px; }
.rank .main { flex: 1; min-width: 0; }
.rank .t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.rank .m { color: var(--muted); font-size: 12.5px; margin-top: 2px; }
.award { display: flex; gap: 14px; align-items: center; padding: 14px; border-radius: 20px; background: var(--surface); border: 1px solid var(--line); }
.award .medal { width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-size: 26px; flex: none; background: radial-gradient(circle at 35% 30%, #fff1b8, #ffc94a 50%, #c77a12); box-shadow: 0 6px 16px rgba(255, 170, 60, .3); }
.award .k { font-size: 12px; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--gold-text); }
.award .t { font-weight: 800; margin-top: 2px; }
.award .m { color: var(--muted); font-size: 13px; }
.awards { display: grid; gap: 10px; }
@media (min-width: 700px) { .awards { grid-template-columns: 1fr 1fr; } }

/* ---------- Onboarding ---------- */
.welcome {
  min-height: 100dvh; display: flex; flex-direction: column; padding: calc(var(--safe-t) + 24px) 24px calc(var(--safe-b) + 24px);
  max-width: 520px; margin: 0 auto;
}
.welcome .hero { flex: 1; display: flex; flex-direction: column; justify-content: center; text-align: center; }
.welcome .reel { position: relative; height: 210px; margin-bottom: 24px; }
.welcome .reel .poster { position: absolute; width: 104px; left: 50%; top: 10px; }
.welcome h1 { font-size: 40px; font-weight: 900; line-height: 1.02; margin: 10px 0 12px; }
.welcome p.lead { color: var(--muted); font-size: 17px; margin: 0 auto; max-width: 340px; }
.welcome .acts { display: grid; gap: 10px; }
.steps { display: flex; gap: 6px; justify-content: center; margin-bottom: 18px; }
.steps i { width: 26px; height: 4px; border-radius: 2px; background: var(--surface-3); }
.steps i.on { background: var(--gold); }
.member-edit-row { display: flex; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.member-edit-row .input { min-height: 44px; }
.member-edit-row select.input { width: 110px; flex: none; }

.code-box { font: 900 34px/1 ui-monospace, "SF Mono", Menlo, monospace; letter-spacing: .12em; text-align: center; padding: 18px; border-radius: 18px; background: var(--surface-2); border: 1px dashed var(--line-2); user-select: all; -webkit-user-select: all; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; }
}
