[hidden] { display: none !important; }
:root {
  --bg: #14111c; --surface: #1f1a2b; --surface-2: #2a2438; --line: #3a3349;
  --text: #f3eefb; --muted: #a69fb8; --accent: #ffb547; --accent-ink: #2a1a00;
  --want: #3ddc97; --pass: #ff6b6b; --seen: #7cb7ff;
  --radius: 18px; --nav-h: 64px;
  --safe-b: env(safe-area-inset-bottom, 0px); --safe-t: env(safe-area-inset-top, 0px);
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text);
  font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; -webkit-tap-highlight-color: transparent; }
button, input { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.2; }
.muted { color: var(--muted); }
.small { font-size: 0.85rem; }

#app { min-height: 100%; display: flex; flex-direction: column; }
header.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: calc(12px + var(--safe-t)) 16px 10px; background: color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter: blur(10px); }
header.top h1 { font-size: 1.25rem; flex: 1; }
.logo { font-weight: 800; letter-spacing: -0.02em; }
.logo span { color: var(--accent); }
main { flex: 1; padding: 0 16px calc(var(--nav-h) + var(--safe-b) + 20px); max-width: 560px; width: 100%; margin: 0 auto; }

nav.tabs { position: fixed; inset: auto 0 0 0; z-index: 10; display: flex; height: calc(var(--nav-h) + var(--safe-b));
  padding-bottom: var(--safe-b); background: var(--surface); border-top: 1px solid var(--line); }
nav.tabs a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
  color: var(--muted); text-decoration: none; font-size: 0.72rem; position: relative; }
nav.tabs a .ico { font-size: 1.35rem; line-height: 1; }
nav.tabs a.on { color: var(--accent); }
.badge { position: absolute; top: 8px; left: 55%; background: var(--pass); color: #fff; border-radius: 99px;
  font-size: 0.65rem; padding: 1px 6px; font-weight: 700; }

.btn { border: 0; border-radius: 12px; padding: 12px 16px; background: var(--surface-2); font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; border: 1px solid var(--line); }
.btn.small { padding: 7px 12px; font-size: 0.85rem; border-radius: 10px; }
.btn:disabled { opacity: 0.5; }
.icon-btn { background: var(--surface-2); border: 0; width: 40px; height: 40px; border-radius: 50%; font-size: 1.1rem; display: grid; place-items: center; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 0.85rem; color: var(--muted); }
input[type=text], input[type=password], input[type=search] { width: 100%; padding: 12px 14px; border-radius: 12px;
  border: 1px solid var(--line); background: var(--surface); outline: none; }
input:focus { border-color: var(--accent); }
.error { color: var(--pass); min-height: 1.2em; font-size: 0.9rem; }

.seg { display: flex; background: var(--surface); border-radius: 12px; padding: 4px; gap: 4px; }
.seg button { flex: 1; border: 0; background: transparent; padding: 8px; border-radius: 9px; color: var(--muted); font-weight: 600; font-size: 0.9rem; }
.seg button.on { background: var(--surface-2); color: var(--text); }

/* ---------- auth ---------- */
.auth { max-width: 380px; margin: 0 auto; padding: calc(48px + var(--safe-t)) 20px 40px; }
.auth .logo { font-size: 2.4rem; text-align: center; }
.auth .tag { text-align: center; color: var(--muted); margin: 6px 0 28px; }
.auth .switch { text-align: center; margin-top: 16px; }
.auth .switch button { background: none; border: 0; color: var(--accent); font-weight: 600; }
.demo-note { background: var(--surface); border: 1px dashed var(--line); border-radius: 12px; padding: 10px 12px; font-size: 0.85rem; color: var(--muted); margin-bottom: 18px; }

/* ---------- deck ---------- */
.discover-bar { display: flex; gap: 8px; align-items: center; margin: 0 0 12px; }
.search-wrap { position: relative; margin: 4px 0 10px; }
.search-wrap input { padding-left: 40px; padding-right: 40px; }
.search-wrap input::-webkit-search-cancel-button { display: none; }
.search-ico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); font-size: 0.95rem; opacity: .7; pointer-events: none; }
.search-clear { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); border: 0; background: var(--surface-2); border-radius: 50%; width: 30px; height: 30px; font-size: 0.8rem; }
.discover-bar .seg { flex: 1; }
.deck-wrap { position: relative; height: min(calc(100dvh - 385px - var(--safe-t) - var(--safe-b)), 620px); min-height: 360px; }
.card { position: absolute; inset: 0; border-radius: var(--radius); overflow: hidden; background: var(--surface);
  box-shadow: 0 12px 30px rgba(0,0,0,.45); touch-action: none; user-select: none; will-change: transform; }
.card.behind { transform: scale(.95) translateY(14px); filter: brightness(.7); }
.card.animate { transition: transform .32s ease, opacity .32s ease; }
.card .poster { position: absolute; inset: 0; background-size: cover; background-position: center; }
.card .poster.fallback { display: flex; align-items: flex-start; justify-content: center; padding: 56px 30px 30px; opacity: .55; text-align: center;
  font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
.card .shade { position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 35%, rgba(10,8,16,.6) 60%, rgba(10,8,16,.97) 100%); }
.card .info { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px; }
.card .info h2 { font-size: 1.55rem; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; color: var(--muted); font-size: 0.85rem; margin: 6px 0 8px; }
.chip { display: inline-flex; align-items: center; gap: 5px; background: rgba(255,255,255,.1); border-radius: 99px; padding: 3px 9px; font-size: 0.75rem; color: var(--text); }
.chip img { width: 16px; height: 16px; border-radius: 4px; }
.chip.mine { background: color-mix(in srgb, var(--want) 25%, transparent); }
.overview { font-size: 0.9rem; color: #d9d2e8; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.seen-btn { display: block; width: 100%; margin-top: 12px; padding: 10px; border-radius: 12px; border: 1px solid rgba(255,255,255,.22);
  background: rgba(255,255,255,.08); color: var(--text); font-weight: 600; font-size: 0.9rem; backdrop-filter: blur(6px); }
.seen-btn:active { background: color-mix(in srgb, var(--seen) 35%, transparent); }
.card.expanded .overview { -webkit-line-clamp: unset; }
.stamp { position: absolute; top: 28px; padding: 6px 14px; border: 4px solid; border-radius: 10px; font-weight: 900;
  font-size: 1.4rem; letter-spacing: .04em; opacity: 0; text-transform: uppercase; background: rgba(0,0,0,.35); }
.stamp.want { left: 20px; color: var(--want); border-color: var(--want); transform: rotate(-14deg); }
.stamp.seen { left: 50%; top: 40%; color: var(--seen); border-color: var(--seen); transform: translateX(-50%); }
.stamp.pass { right: 20px; color: var(--pass); border-color: var(--pass); transform: rotate(14deg); text-align: center; font-size: 1.05rem; }
.deck-actions { display: flex; justify-content: center; align-items: center; gap: 22px; margin-top: 18px; }
.round { border: 0; border-radius: 50%; display: grid; place-items: center; box-shadow: 0 6px 16px rgba(0,0,0,.4); }
.round.big { width: 68px; height: 68px; font-size: 1.8rem; }
.round.mid { width: 48px; height: 48px; font-size: 1.2rem; background: var(--surface-2); }
.round.pass { background: var(--surface); color: var(--pass); border: 2px solid var(--pass); }
.round.want { background: var(--want); color: #062a1a; }
.deck-legend { display: flex; justify-content: space-between; font-size: 0.75rem; color: var(--muted); margin: 8px 6px 0; }
.empty { text-align: center; padding: 50px 16px; color: var(--muted); }
.empty .big { font-size: 3rem; margin-bottom: 8px; }

/* ---------- lists ---------- */
.list { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.row { display: flex; gap: 12px; align-items: center; background: var(--surface); border-radius: 14px; padding: 10px; }
.thumb { width: 54px; height: 80px; border-radius: 8px; flex: none; background: var(--surface-2) center/cover; display: grid; place-items: center;
  font-size: 0.65rem; text-align: center; padding: 4px; color: var(--muted); overflow: hidden; }
.row .body { flex: 1; min-width: 0; }
.row .body h3 { font-size: 1rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row .actions { display: flex; gap: 6px; flex: none; }
.pill-btn { border: 1px solid var(--line); background: transparent; border-radius: 99px; width: 38px; height: 38px; font-size: 1rem; }
.pill-btn.want.on { background: var(--want); border-color: var(--want); color: #062a1a; }
.pill-btn.pass.on { background: var(--pass); border-color: var(--pass); color: #fff; }
.pill-btn.seen.on { background: var(--seen); border-color: var(--seen); color: #0b1a2e; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; margin: 22px 0 4px; }
.section-title h2 { font-size: 1.05rem; }

/* ---------- people & groups ---------- */
.person { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 14px; padding: 10px 12px; }
.avatar { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; flex: none; color: #1a1426; }
.person .body { flex: 1; min-width: 0; }
.person input[type=checkbox] { width: 24px; height: 24px; accent-color: var(--accent); }
.avatars { display: flex; }
.avatars .avatar { width: 30px; height: 30px; font-size: 0.8rem; border: 2px solid var(--surface); margin-left: -8px; }
.avatars .avatar:first-child { margin-left: 0; }
.group-card { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: 14px; padding: 14px; text-decoration: none; color: inherit; }
.group-card .body { flex: 1; min-width: 0; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-top: 12px; }
.tile { background: var(--surface); border-radius: 14px; overflow: hidden; display: flex; flex-direction: column; }
.tile .art { aspect-ratio: 2/3; background: var(--surface-2) center/cover; display: grid; place-items: center; padding: 10px; text-align: center; font-weight: 800; }
.tile .body { padding: 10px; }
.tile h3 { font-size: 0.95rem; }
.tile.unavailable .art { filter: grayscale(.8) brightness(.6); }
.callout { background: color-mix(in srgb, var(--accent) 14%, var(--surface)); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  border-radius: 14px; padding: 14px; display: flex; gap: 12px; align-items: center; margin-top: 14px; }
.callout .body { flex: 1; }
.services { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 8px; }
.svc { display: flex; align-items: center; gap: 8px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); text-align: left; font-size: 0.9rem; }
.svc img, .svc .ph { width: 28px; height: 28px; border-radius: 7px; flex: none; background: var(--surface-2); display: grid; place-items: center; font-size: 0.75rem; font-weight: 800; }
.svc.on { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 16%, var(--surface)); }
.sticky-foot { position: sticky; bottom: calc(var(--nav-h) + var(--safe-b) + 10px); margin-top: 16px; }
.sticky-foot .btn { width: 100%; box-shadow: 0 8px 20px rgba(0,0,0,.5); }

.overlay { position: fixed; inset: 0; z-index: 30; background: rgba(0,0,0,.6); display: flex; align-items: flex-end; justify-content: center; }
.sheet { background: var(--bg); width: 100%; max-width: 560px; max-height: 92vh; border-radius: 22px 22px 0 0; overflow: auto;
  padding: 18px 16px calc(24px + var(--safe-b)); position: relative; }
.sheet .close { position: absolute; top: 12px; right: 12px; }
.deck-sheet .deck-wrap { height: min(calc(100dvh - 300px), 540px); }

#toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-b) + 16px); transform: translateX(-50%) translateY(20px);
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 12px; font-weight: 600; font-size: 0.9rem;
  opacity: 0; pointer-events: none; transition: all .25s; z-index: 50; max-width: 90vw; text-align: center; }
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
footer.attrib { text-align: center; font-size: 0.72rem; color: var(--muted); margin-top: 28px; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
