:root {
  --bg: #0a0a0d;
  --surface: #141419;
  --surface-2: #1c1c23;
  --surface-3: #26262f;
  --border: #2b2b35;
  --text: #f5f3ef;
  --muted: #9b99a6;
  --faint: #6c6a77;
  --accent: #f3b33d;
  --accent-ink: #1a1203;
  --yes: #35d49a;
  --no: #ff5470;
  --maybe: #5aa9ff;
  --warn: #ffb547;
  --radius: 16px;
  --radius-sm: 10px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --nav-h: 64px;
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  --display: 'Instrument Serif', Georgia, 'Times New Roman', serif;
  color-scheme: dark;
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font-family: var(--font); font-size: 15px; line-height: 1.45; }
body { overscroll-behavior-y: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: 0; background: none; padding: 0; }
a { color: var(--accent); text-decoration: none; }
img { display: block; }
h1, h2, h3 { margin: 0; font-weight: 600; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

#app { min-height: 100%; }

/* ---------- layout ---------- */
.screen { padding: calc(var(--safe-top) + 8px) 16px calc(var(--nav-h) + var(--safe-bottom) + 24px); max-width: 760px; margin: 0 auto; }
.screen.bare { padding-bottom: calc(var(--safe-bottom) + 24px); }
.topbar { display: flex; align-items: center; gap: 10px; min-height: 52px; position: sticky; top: 0; z-index: 20; background: linear-gradient(var(--bg) 75%, transparent); margin: 0 -16px; padding: var(--safe-top) 16px 6px; }
.topbar h1 { font-size: 20px; flex: 1; }
.brand { font-family: var(--display); font-size: 26px; font-style: italic; letter-spacing: 0.2px; flex: 1; white-space: nowrap; }
.brand b { color: var(--accent); font-weight: 400; }
.row { display: flex; align-items: center; gap: 8px; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); }
.small { font-size: 13px; }
.tiny { font-size: 12px; }
.center { text-align: center; }
.spacer { height: 16px; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- bottom nav ---------- */
.nav { position: fixed; left: 0; right: 0; bottom: 0; z-index: 40; display: flex; justify-content: space-around; align-items: center; height: calc(var(--nav-h) + var(--safe-bottom)); padding-bottom: var(--safe-bottom); background: rgba(14, 14, 18, 0.92); backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px); border-top: 1px solid var(--border); }
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--faint); font-size: 11px; font-weight: 500; min-width: 64px; padding: 6px 0; position: relative; }
.nav a.on { color: var(--text); }
.nav a .badge { position: absolute; top: 2px; right: 14px; }
.nav .plus { width: 48px; height: 48px; border-radius: 50%; background: var(--accent); color: var(--accent-ink); display: grid; place-items: center; box-shadow: 0 6px 24px rgba(243, 179, 61, 0.35); }

/* ---------- buttons ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 44px; padding: 0 18px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-weight: 600; font-size: 15px; white-space: nowrap; transition: transform 0.12s, background 0.15s; }
.btn:active { transform: scale(0.97); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: transparent; }
.btn.danger { color: var(--no); }
.btn.ghost { background: transparent; }
.btn.block { width: 100%; }
.btn.sm { height: 34px; padding: 0 12px; font-size: 13px; }
.btn.lg { height: 54px; font-size: 16px; }
.btn[disabled] { opacity: 0.5; pointer-events: none; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); border: 1px solid var(--border); flex: none; }
.icon-btn.plain { background: transparent; border-color: transparent; }

/* ---------- inputs ---------- */
.field { display: flex; flex-direction: column; gap: 6px; }
.field > label, .label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.6px; }
.input, textarea.input, select.input { width: 100%; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; font-size: 16px; outline: none; transition: border-color 0.15s; }
.input:focus { border-color: var(--accent); }
textarea.input { min-height: 96px; resize: vertical; line-height: 1.45; }
.input-wrap { position: relative; display: flex; align-items: center; }
.input-wrap .prefix { position: absolute; left: 14px; color: var(--faint); pointer-events: none; }
.input-wrap .prefix + .input { padding-left: 32px; }
.hint { font-size: 13px; color: var(--muted); }
.hint.warn { color: var(--warn); }
.hint.err { color: var(--no); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

.seg { display: flex; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 3px; gap: 3px; overflow-x: auto; scrollbar-width: none; }
.seg::-webkit-scrollbar { display: none; }
.seg button { flex: 1; min-width: max-content; height: 38px; border-radius: 8px; padding: 0 10px; color: var(--muted); font-weight: 500; font-size: 14px; }
.seg button.on { background: var(--surface-3); color: var(--text); }

.check { display: flex; align-items: center; gap: 10px; font-size: 15px; }
.check input { width: 20px; height: 20px; accent-color: var(--accent); }

/* ---------- chips & pills ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); font-size: 13px; color: var(--text); white-space: nowrap; }
.chip.on { background: rgba(243, 179, 61, 0.14); border-color: rgba(243, 179, 61, 0.5); color: var(--accent); }
.chip.add { color: var(--muted); border-style: dashed; }
.chip .x { color: var(--faint); font-size: 16px; line-height: 1; margin-right: -4px; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 600; letter-spacing: 0.3px; text-transform: uppercase; background: var(--surface-3); color: var(--muted); white-space: nowrap; }
.pill.dot::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--no); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }

.st-spotted { color: #b9b7c4; }
.st-contacted { color: var(--maybe); }
.st-interested { color: #c58bff; }
.st-ready { color: var(--accent); }
.st-no_reply, .st-not_interested, .st-not_fit { color: var(--faint); }

/* ---------- tabs (horizontal scroller) ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 4px 16px 10px; }
.tabs::-webkit-scrollbar { display: none; }
.tabs button { flex: none; height: 34px; padding: 0 14px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--muted); font-size: 14px; font-weight: 500; display: inline-flex; align-items: center; gap: 6px; }
.tabs button.on { background: var(--text); color: var(--bg); border-color: var(--text); }
.tabs .n { font-size: 12px; opacity: 0.7; }

/* ---------- search ---------- */
.search { display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--border); border-radius: 999px; padding: 0 6px 0 14px; height: 44px; margin-bottom: 10px; }
.search input { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 16px; }
.filter-dot { position: relative; }
.filter-dot.active::after { content: ''; position: absolute; top: 7px; right: 7px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }

/* ---------- profile grid ---------- */
.grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
@media (min-width: 560px) { .grid { grid-template-columns: repeat(3, 1fr); } }
.card { position: relative; border-radius: var(--radius); overflow: hidden; background: var(--surface); aspect-ratio: 3 / 4; display: block; color: var(--text); animation: rise 0.3s ease both; }
.card img { width: 100%; height: 100%; object-fit: cover; }
.card .noimg { width: 100%; height: 100%; display: grid; place-items: center; color: var(--faint); font-family: var(--display); font-size: 48px; font-style: italic; background: radial-gradient(circle at 30% 20%, #23232c, #121217); }
.card .shade { position: absolute; inset: 0; background: linear-gradient(transparent 45%, rgba(0, 0, 0, 0.85)); }
.card .top { position: absolute; top: 8px; left: 8px; right: 8px; display: flex; justify-content: space-between; gap: 4px; }
.card .top .pill { background: rgba(10, 10, 13, 0.7); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.card .info { position: absolute; left: 10px; right: 10px; bottom: 10px; }
.card .name { font-weight: 600; font-size: 15px; }
.card .meta { font-size: 12px; color: rgba(255, 255, 255, 0.72); }
.card .stars { font-size: 11px; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.empty { text-align: center; padding: 56px 20px; color: var(--muted); }
.empty .big { font-family: var(--display); font-size: 30px; font-style: italic; color: var(--text); margin-bottom: 6px; }

/* ---------- list rows ---------- */
.list { display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.list > * + * { border-top: 1px solid var(--border); }
.li { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: var(--text); min-height: 56px; }
.li .thumb { width: 48px; height: 60px; border-radius: 8px; object-fit: cover; background: var(--surface-3); flex: none; }
.avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; font-weight: 600; flex: none; }

/* ---------- section ---------- */
.section { margin-top: 22px; }
.section > h3 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.7px; color: var(--muted); margin-bottom: 10px; display: flex; align-items: center; gap: 8px; }
.panel { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 10px 12px; font-size: 14px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------- profile detail ---------- */
.gallery { margin: 0 -16px; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; gap: 8px; padding: 0 16px; }
.gallery::-webkit-scrollbar { display: none; }
.gallery .ph { flex: none; width: 78%; max-width: 380px; aspect-ratio: 3 / 4; border-radius: var(--radius); overflow: hidden; position: relative; scroll-snap-align: center; background: var(--surface); }
.gallery .ph img { width: 100%; height: 100%; object-fit: cover; }
.gallery .ph .tools { position: absolute; right: 8px; bottom: 8px; display: flex; gap: 6px; }
.gallery .ph .cover-tag { position: absolute; left: 8px; top: 8px; }
.gallery .add-ph { flex: none; width: 46%; max-width: 220px; aspect-ratio: 3 / 4; border-radius: var(--radius); border: 1.5px dashed var(--border); display: grid; place-items: center; color: var(--muted); text-align: center; font-size: 13px; scroll-snap-align: center; }
.hero-name { font-family: var(--display); font-size: 38px; line-height: 1.05; font-weight: 400; margin-top: 16px; }
.socials { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.stage-picker { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; margin: 0 -16px; padding: 0 16px; }
.stage-picker::-webkit-scrollbar { display: none; }
.stage-picker button { flex: none; height: 36px; padding: 0 14px; border-radius: 999px; border: 1px solid var(--border); background: var(--surface); font-size: 13px; font-weight: 500; color: var(--muted); }
.stage-picker button.on { background: currentColor; }
.stage-picker button.on span { color: var(--bg); }
.alert { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: var(--radius-sm); background: rgba(255, 181, 71, 0.1); border: 1px solid rgba(255, 181, 71, 0.35); color: var(--warn); font-size: 14px; }
.alert.red { background: rgba(255, 84, 112, 0.1); border-color: rgba(255, 84, 112, 0.35); color: var(--no); }

.rate { display: inline-flex; gap: 2px; }
.rate button { font-size: 26px; line-height: 1; color: var(--surface-3); padding: 2px; transition: transform 0.1s; }
.rate button.on { color: var(--accent); }
.rate button:active { transform: scale(1.25); }
.stars-static { color: var(--accent); letter-spacing: 1px; }

.comment { display: flex; gap: 10px; }
.comment .bubble { background: var(--surface-2); border-radius: 4px 14px 14px 14px; padding: 8px 12px; flex: 1; }
.comment .who { font-size: 12px; color: var(--muted); }
.timeline { font-size: 13px; color: var(--muted); display: flex; flex-direction: column; gap: 6px; }

/* ---------- sheet & toast ---------- */
.backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.6); z-index: 60; animation: fade 0.2s ease; }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 61; max-height: 92vh; overflow-y: auto; background: var(--surface); border-radius: 22px 22px 0 0; border-top: 1px solid var(--border); padding: 10px 16px calc(var(--safe-bottom) + 20px); animation: up 0.28s cubic-bezier(0.2, 0.9, 0.3, 1); max-width: 760px; margin: 0 auto; }
.sheet .grab { width: 40px; height: 5px; border-radius: 3px; background: var(--surface-3); margin: 0 auto 14px; }
.sheet h2 { font-size: 18px; margin-bottom: 14px; }
@keyframes up { from { transform: translateY(100%); } }
@keyframes fade { from { opacity: 0; } }
.toast { position: fixed; left: 50%; bottom: calc(var(--nav-h) + var(--safe-bottom) + 16px); transform: translateX(-50%); z-index: 90; background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 999px; font-weight: 500; font-size: 14px; box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); animation: toast 0.25s ease; max-width: calc(100vw - 32px); text-align: center; }
.toast.err { background: var(--no); color: #fff; }
@keyframes toast { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- auth screens ---------- */
.auth { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; justify-content: flex-end; padding: calc(var(--safe-top) + 24px) 24px calc(var(--safe-bottom) + 32px); position: relative; overflow: hidden; }
.auth::before { content: ''; position: absolute; inset: -20%; background: radial-gradient(ellipse at 70% 15%, rgba(243, 179, 61, 0.22), transparent 55%), radial-gradient(ellipse at 10% 60%, rgba(90, 169, 255, 0.12), transparent 50%); animation: drift 14s ease-in-out infinite alternate; z-index: -1; }
@keyframes drift { to { transform: translate(-4%, 3%) scale(1.06); } }
.auth .logo { font-family: var(--display); font-style: italic; font-size: 64px; line-height: 0.92; margin-bottom: 14px; }
.auth .logo b { color: var(--accent); font-weight: 400; display: block; }
.auth .tag { color: var(--muted); font-size: 16px; max-width: 320px; margin-bottom: 36px; }
.auth .grain { position: absolute; inset: 0; opacity: 0.07; pointer-events: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E"); z-index: -1; }

/* ---------- director deck ---------- */
.deck-screen { height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: calc(var(--safe-top) + 6px) 12px calc(var(--nav-h) + var(--safe-bottom) + 10px); max-width: 520px; margin: 0 auto; overflow: hidden; touch-action: none; }
.deck-screen.preview { padding-bottom: calc(var(--safe-bottom) + 10px); }
.deck-head { display: flex; align-items: center; gap: 10px; height: 46px; flex: none; }
.deck { position: relative; flex: 1; min-height: 0; margin: 6px 0 12px; }
.swipe { position: absolute; inset: 0; border-radius: 22px; overflow: hidden; background: var(--surface); box-shadow: 0 18px 50px rgba(0, 0, 0, 0.55); will-change: transform; user-select: none; -webkit-user-select: none; touch-action: none; }
.swipe.behind { transform: scale(0.94) translateY(14px); filter: brightness(0.6); transition: transform 0.3s, filter 0.3s; }
.swipe.behind.rising { transform: scale(1) translateY(0); filter: none; }
.swipe img.photo { width: 100%; height: 100%; object-fit: cover; pointer-events: none; -webkit-user-drag: none; }
.swipe .noimg { width: 100%; height: 100%; display: grid; place-items: center; color: var(--faint); }
.swipe .bars { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 4px; z-index: 2; }
.swipe .bars i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255, 255, 255, 0.3); }
.swipe .bars i.on { background: #fff; }
.swipe .shade { position: absolute; inset: 0; background: linear-gradient(transparent 50%, rgba(0, 0, 0, 0.92)); pointer-events: none; }
.swipe .about { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 18px 20px; }
.swipe .about .nm { font-family: var(--display); font-size: 40px; line-height: 1; }
.swipe .about .nm span { font-family: var(--font); font-size: 24px; font-weight: 300; margin-left: 6px; }
.swipe .about .sub { color: rgba(255, 255, 255, 0.78); margin-top: 6px; font-size: 14px; }
.swipe .about .chips { margin-top: 10px; }
.swipe .about .chip { background: rgba(255, 255, 255, 0.12); border-color: transparent; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.swipe .more { position: absolute; right: 14px; bottom: 22px; width: 40px; height: 40px; border-radius: 50%; background: rgba(255, 255, 255, 0.16); display: grid; place-items: center; backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px); }
.stamp { position: absolute; top: 46px; padding: 6px 14px; border: 4px solid; border-radius: 10px; font-size: 34px; font-weight: 800; letter-spacing: 2px; opacity: 0; pointer-events: none; z-index: 3; }
.stamp.yes { left: 22px; color: var(--yes); transform: rotate(-14deg); }
.stamp.no { right: 22px; color: var(--no); transform: rotate(14deg); }
.stamp.maybe { left: 50%; top: auto; bottom: 34%; color: var(--maybe); transform: translateX(-50%) rotate(-4deg); }
.actions { display: flex; justify-content: center; align-items: center; gap: 18px; flex: none; }
.act { border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 1px solid var(--border); box-shadow: 0 8px 22px rgba(0, 0, 0, 0.4); transition: transform 0.12s; }
.act:active { transform: scale(0.9); }
.act.big { width: 66px; height: 66px; }
.act.mid { width: 52px; height: 52px; }
.act.small { width: 42px; height: 42px; }
.act.no { color: var(--no); }
.act.yes { color: var(--yes); }
.act.maybe { color: var(--maybe); }
.act.undo { color: var(--accent); }
.act[disabled] { opacity: 0.35; pointer-events: none; }

.done { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; position: relative; }
.done .big { font-family: var(--display); font-style: italic; font-size: 44px; line-height: 1; }
.done .ring { width: 120px; height: 120px; border-radius: 50%; display: grid; place-items: center; background: radial-gradient(circle, rgba(243, 179, 61, 0.25), transparent 70%); animation: pulse 2.4s ease-in-out infinite; font-size: 54px; margin-bottom: 8px; }
@keyframes pulse { 50% { transform: scale(1.08); } }
.confetti { position: absolute; inset: 0; pointer-events: none; overflow: hidden; }
.confetti i { position: absolute; top: -10px; width: 8px; height: 14px; border-radius: 2px; animation: fall linear forwards; }
@keyframes fall { to { transform: translateY(110vh) rotate(720deg); opacity: 0.2; } }

.tally { display: flex; gap: 8px; }
.tally span { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; font-weight: 600; }

/* ---------- results ---------- */
.res-row { display: flex; gap: 12px; align-items: center; padding: 10px 12px; color: var(--text); }
.res-row img, .res-row .noimg-s { width: 56px; height: 70px; border-radius: 10px; object-fit: cover; background: var(--surface-3); flex: none; }
.vote-tag { font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; }
.vote-tag.yes { background: rgba(53, 212, 154, 0.15); color: var(--yes); }
.vote-tag.no { background: rgba(255, 84, 112, 0.15); color: var(--no); }
.vote-tag.maybe { background: rgba(90, 169, 255, 0.15); color: var(--maybe); }

.spinner { width: 28px; height: 28px; border: 3px solid var(--surface-3); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

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