:root {
  --bg: #0c0a10;
  --panel: #17141d;
  --panel2: #211d29;
  --line: #2e2938;
  --text: #f4f1f7;
  --dim: #a59fb0;
  --hot: #ff3d7f;
  --hot2: #ff8a3d;
  --grad: linear-gradient(135deg, var(--hot), var(--hot2));
  --nope: #ff5a5a;
  --like: #3ddc97;
  --display: 'Bricolage Grotesque', system-ui, sans-serif;
  --body: system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: #050407; color: var(--text); font-family: var(--body); }
body { overscroll-behavior: none; -webkit-tap-highlight-color: transparent; }
button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea { font: inherit; color: var(--text); }
svg { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

#app {
  position: relative;
  max-width: 460px; margin: 0 auto;
  height: 100dvh;
  display: flex; flex-direction: column;
  background: var(--bg);
  overflow: hidden;
}
@media (min-width: 600px) {
  #app { border-left: 1px solid var(--line); border-right: 1px solid var(--line); }
}

/* ---------- logo / top ---------- */
.logo { font-family: var(--display); font-weight: 800; font-size: 24px; letter-spacing: -0.02em; }
.logo span { background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.logo.big { font-size: 44px; }
.top { padding: 14px 18px 8px; padding-top: max(14px, env(safe-area-inset-top)); display: flex; align-items: center; }

main { flex: 1; min-height: 0; position: relative; }
.view { position: absolute; inset: 0; display: flex; flex-direction: column; }

/* ---------- onboarding ---------- */
.screen { position: absolute; inset: 0; z-index: 50; background: var(--bg); display: flex; padding: 24px; overflow-y: auto; }
.ob-inner { width: 100%; max-width: 340px; margin: auto; display: flex; flex-direction: column; gap: 22px; text-align: center; }
.ob-inner h2 { font-family: var(--display); font-weight: 600; font-size: 22px; margin: 12px 0 0; }
.ob-roles { display: flex; flex-direction: column; gap: 12px; }
.role-btn { padding: 18px; border-radius: 16px; background: var(--panel); border: 2px solid var(--line); font-family: var(--display); font-weight: 600; font-size: 19px; }
.role-btn.on { border-color: var(--hot); background: var(--panel2); }
#obForm { display: flex; flex-direction: column; gap: 14px; text-align: left; }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > span { font-size: 13px; color: var(--dim); font-weight: 600; }
.field input, .field textarea {
  width: 100%; padding: 13px 14px; border-radius: 12px; background: var(--panel); border: 1px solid var(--line); outline: none;
}
.field textarea { resize: vertical; min-height: 84px; }
.field input:focus, .field textarea:focus { border-color: var(--hot); }

.primary { padding: 15px 20px; border-radius: 999px; background: var(--grad); color: #fff; font-weight: 700; font-size: 16px; }
.ghost { padding: 13px 20px; border-radius: 999px; border: 1px solid var(--line); color: var(--text); font-weight: 600; font-size: 15px; }

/* ---------- segmented control ---------- */
.seg { display: flex; gap: 4px; margin: 0 18px 12px; padding: 4px; background: var(--panel); border-radius: 999px; }
.seg button { flex: 1; padding: 9px 0; border-radius: 999px; font-weight: 600; font-size: 14px; color: var(--dim); }
.seg button.on { background: var(--panel2); color: var(--text); box-shadow: inset 0 0 0 1px var(--line); }

/* ---------- deck + cards ---------- */
.deck { flex: 1; min-height: 0; position: relative; margin: 0 14px; }
.card {
  position: absolute; inset: 0;
  border-radius: 22px; overflow: hidden;
  touch-action: none; user-select: none; -webkit-user-select: none;
  box-shadow: 0 10px 30px rgba(0,0,0,.45);
  will-change: transform;
  cursor: grab;
}
.card:active { cursor: grabbing; }
.card.behind { transform: scale(.95) translateY(14px); filter: brightness(.7); transition: transform .3s, filter .3s; }
.card.behind2 { transform: scale(.9) translateY(28px); filter: brightness(.5); }
.card .art { position: absolute; inset: 0; }
.card .art::after { /* grain + vignette */
  content: ''; position: absolute; inset: 0;
  background:
    radial-gradient(120% 80% at 20% 10%, rgba(255,255,255,.18), transparent 60%),
    linear-gradient(to bottom, transparent 35%, rgba(6,4,10,.92) 82%);
}
.card .kind {
  position: absolute; top: 16px; left: 16px; z-index: 2;
  padding: 5px 10px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .12em;
  background: rgba(0,0,0,.35); backdrop-filter: blur(6px); -webkit-backdrop-filter: blur(6px);
}
.card .when { position: absolute; top: 16px; right: 16px; z-index: 2; padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; background: rgba(0,0,0,.35); }
.card .poster {
  position: absolute; left: 16px; right: 16px; top: 52px; z-index: 2;
  font-family: var(--display); font-weight: 800; text-transform: uppercase;
  font-size: clamp(40px, 13vw, 60px); line-height: .88; letter-spacing: -0.03em;
  overflow-wrap: normal; text-shadow: 0 2px 20px rgba(0,0,0,.25);
}
.card .poster.squeeze { overflow-wrap: anywhere;
}
.card .info { position: absolute; left: 0; right: 0; bottom: 0; z-index: 2; padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.card .line1 { font-weight: 700; font-size: 17px; }
.card .line2 { color: #d9d3e0; font-size: 14px; }
.card .slots { font-weight: 800; font-size: 15px; color: #ffd166; }
.card .bio { color: #cfc8d8; font-size: 14px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 5px 10px; border-radius: 999px; font-size: 12px; font-weight: 600; background: rgba(255,255,255,.12); border: 1px solid rgba(255,255,255,.14); white-space: nowrap; }

.stamp {
  position: absolute; top: 60px; z-index: 3; padding: 4px 12px; border: 4px solid; border-radius: 10px;
  font-family: var(--display); font-weight: 800; font-size: 34px; letter-spacing: .04em; opacity: 0; pointer-events: none;
}
.stamp.like { left: 22px; color: var(--like); transform: rotate(-14deg); }
.stamp.nope { right: 22px; color: var(--nope); transform: rotate(14deg); }

.empty { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 16px; text-align: center; padding: 24px; color: var(--dim); }
.empty b { color: var(--text); font-family: var(--display); font-size: 22px; }

/* ---------- action buttons ---------- */
.actions { display: flex; justify-content: center; align-items: center; gap: 22px; padding: 16px 0 14px; }
.act { width: 66px; height: 66px; border-radius: 50%; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--line); transition: transform .12s; }
.act:active { transform: scale(.9); }
.act svg { width: 30px; height: 30px; stroke-width: 2.6; }
.act.small { width: 48px; height: 48px; color: #ffd166; }
.act.small svg { width: 22px; height: 22px; }
.act.nope { color: var(--nope); }
.act.like { color: var(--like); }
.act.like svg { fill: currentColor; stroke-width: 0; }
.act:disabled { opacity: .35; }

/* ---------- tabs ---------- */
.tabs { display: flex; border-top: 1px solid var(--line); background: var(--bg); padding-bottom: env(safe-area-inset-bottom); }
.tabs button { flex: 1; position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 9px 0 10px; color: var(--dim); font-size: 11px; font-weight: 600; }
.tabs button.on { color: var(--hot); }
.badge { position: absolute; top: 5px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--hot); color: #fff; font-size: 11px; font-style: normal; font-weight: 800; line-height: 18px; text-align: center; }

/* ---------- avatars ---------- */
.avatar { flex: none; width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; font-family: var(--display); font-weight: 800; font-size: 18px; color: #fff; text-transform: uppercase; }
.avatar.xl { width: 72px; height: 72px; font-size: 26px; }
.avatar.xxl { width: 110px; height: 110px; font-size: 38px; border: 4px solid var(--bg); }

/* ---------- matches ---------- */
#v-matches { overflow-y: auto; padding-bottom: 20px; }
.sec-title { margin: 6px 18px 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .1em; color: var(--hot); }
.new-row { display: flex; gap: 14px; overflow-x: auto; padding: 0 18px 16px; scrollbar-width: none; }
.new-row::-webkit-scrollbar { display: none; }
.new-match { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 72px; flex: none; }
.new-match .avatar { width: 64px; height: 64px; font-size: 22px; box-shadow: 0 0 0 2px var(--bg), 0 0 0 4px var(--hot); }
.new-match span { font-size: 12px; font-weight: 600; width: 100%; text-align: center; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.convos { display: flex; flex-direction: column; }
.convo { display: flex; align-items: center; gap: 12px; padding: 10px 18px; text-align: left; width: 100%; }
.convo:active { background: var(--panel); }
.convo .txt { flex: 1; min-width: 0; }
.convo .nm { font-weight: 700; display: flex; align-items: center; gap: 8px; }
.convo .nm i { width: 8px; height: 8px; border-radius: 50%; background: var(--hot); }
.convo .last { color: var(--dim); font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-top: 2px; }
.muted { color: var(--dim); font-size: 14px; padding: 0 18px 12px; }

/* ---------- chat ---------- */
.chat-head { display: flex; align-items: center; gap: 6px; padding: 4px 12px 10px; border-bottom: 1px solid var(--line); }
.icon-btn { width: 40px; height: 40px; display: grid; place-items: center; border-radius: 50%; flex: none; }
.chat-who { display: flex; align-items: center; gap: 10px; text-align: left; min-width: 0; }
.chat-who .avatar { width: 40px; height: 40px; font-size: 15px; }
.chat-who b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-who small { display: block; color: var(--dim); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-who > div { min-width: 0; }
.msgs { flex: 1; min-height: 0; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 20px; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.msg.me { align-self: flex-end; background: var(--grad); color: #fff; border-bottom-right-radius: 6px; }
.msg.them { align-self: flex-start; background: var(--panel2); border-bottom-left-radius: 6px; }
.msg.typing { color: var(--dim); }
.chat-start { text-align: center; color: var(--dim); font-size: 13px; margin: 4px 0 12px; }
.composer { display: flex; gap: 8px; padding: 10px 12px 12px; border-top: 1px solid var(--line); }
.composer input { flex: 1; min-width: 0; padding: 12px 16px; border-radius: 999px; background: var(--panel); border: 1px solid var(--line); outline: none; }
.composer input:focus { border-color: var(--hot); }
.composer button { width: 46px; height: 46px; border-radius: 50%; background: var(--grad); color: #fff; display: grid; place-items: center; flex: none; }

/* ---------- profile ---------- */
#v-me { overflow-y: auto; padding: 8px 18px 24px; gap: 18px; }
.me-head { display: flex; align-items: center; gap: 16px; }
.me-name { font-family: var(--display); font-weight: 800; font-size: 24px; overflow-wrap: anywhere; }
.me-role { color: var(--dim); font-size: 14px; margin-top: 2px; }
.me-form { display: flex; flex-direction: column; gap: 14px; }
.pick { display: flex; flex-wrap: wrap; gap: 8px; }
.pick button { padding: 8px 14px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); font-size: 14px; font-weight: 600; color: var(--dim); }
.pick button.on { border-color: var(--hot); color: var(--text); background: var(--panel2); }
.me-buttons { display: flex; flex-direction: column; gap: 10px; }

/* ---------- match overlay ---------- */
.overlay { position: absolute; inset: 0; z-index: 40; background: rgba(8,5,12,.94); display: flex; align-items: center; justify-content: center; padding: 24px; animation: fade .25s; }
.mo-inner { width: 100%; max-width: 340px; display: flex; flex-direction: column; align-items: center; gap: 14px; text-align: center; }
.mo-title { font-family: var(--display); font-weight: 800; font-size: 48px; line-height: 1; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; transform: rotate(-4deg); animation: pop .5s cubic-bezier(.2,1.6,.4,1); }
.mo-sub { color: var(--dim); }
.mo-avatars { display: flex; margin: 18px 0 24px; }
.mo-avatars .avatar:first-child { transform: rotate(-8deg) translateX(10px); }
.mo-avatars .avatar:last-child { transform: rotate(8deg) translateX(-10px); }
.mo-inner .primary, .mo-inner .ghost { width: 100%; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { transform: rotate(-4deg) scale(.3); opacity: 0; } }

/* ---------- profile sheet ---------- */
.sheet-wrap { position: absolute; inset: 0; z-index: 30; background: rgba(0,0,0,.55); display: flex; align-items: flex-end; animation: fade .2s; }
.sheet { width: 100%; max-height: 92%; overflow-y: auto; background: var(--panel); border-radius: 24px 24px 0 0; animation: up .28s cubic-bezier(.2,.9,.3,1); padding-bottom: env(safe-area-inset-bottom); }
@keyframes up { from { transform: translateY(100%); } }
.sh-art { position: relative; height: 200px; padding: 18px; display: flex; align-items: flex-end; }
.sh-art .poster { font-family: var(--display); font-weight: 800; text-transform: uppercase; font-size: 40px; line-height: .9; letter-spacing: -0.03em; position: relative; z-index: 1; overflow-wrap: anywhere; }
.sh-art::after { content: ''; position: absolute; inset: 0; background: linear-gradient(to bottom, transparent 30%, rgba(23,20,29,.9)); }
.sh-close { position: absolute; top: 12px; right: 12px; z-index: 2; width: 36px; height: 36px; border-radius: 50%; background: rgba(0,0,0,.45); display: grid; place-items: center; }
.sh-close svg { width: 20px; height: 20px; }
.sh-body { padding: 4px 18px 22px; display: flex; flex-direction: column; gap: 14px; }
.sh-body p { margin: 0; line-height: 1.45; color: #ddd6e6; }
.rows { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
.rows dt { color: var(--dim); }
.rows dd { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.sh-actions { display: flex; justify-content: center; gap: 22px; padding-top: 4px; }
.sh-done { text-align: center; color: var(--dim); font-size: 14px; }

/* ================= real-site additions ================= */
.ob-step { display: flex; flex-direction: column; gap: 18px; }
.ob-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.ob-form h2 { text-align: center; }
.link-btn { color: var(--dim); font-size: 14px; font-weight: 600; text-decoration: underline; text-underline-offset: 3px; padding: 6px; align-self: center; }
.form-err { color: var(--nope); font-size: 14px; min-height: 0; }
.form-err:empty { display: none; }
button:disabled { opacity: .5; cursor: default; }
.danger { color: var(--nope); border-color: rgba(255,90,90,.35); }
.flush { margin-left: 0; margin-right: 0; padding-left: 0; padding-right: 0; }

.toast {
  position: absolute; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 60;
  max-width: calc(100% - 32px); padding: 11px 16px; border-radius: 14px;
  background: #2b2633; border: 1px solid var(--line); font-size: 14px; font-weight: 600; text-align: center;
  box-shadow: 0 8px 24px rgba(0,0,0,.5); animation: fade .2s;
}
.spin { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--hot); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* photos on cards */
.card .art .ph { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; }
.card .art .ph.on { opacity: 1; }
.card .bars { position: absolute; top: 8px; left: 10px; right: 10px; z-index: 3; display: flex; gap: 4px; }
.card .bars i { flex: 1; height: 3px; border-radius: 2px; background: rgba(255,255,255,.35); }
.card .bars i.on { background: #fff; }
.card .kind.low, .card .when.low { top: 22px; }
.card .nm { font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1; letter-spacing: -0.02em; overflow-wrap: anywhere; }

.avatar { background-size: cover; background-position: center; }

/* profile sheet */
.sh-photos { position: relative; }
.sh-strip { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; border-radius: 24px 24px 0 0; }
.sh-strip::-webkit-scrollbar { display: none; }
.sh-strip img { flex: none; width: 100%; aspect-ratio: 4 / 5; max-height: 60vh; object-fit: cover; scroll-snap-align: start; }
.sh-dots { position: absolute; left: 0; right: 0; bottom: 10px; display: flex; justify-content: center; gap: 6px; }
.sh-dots i { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.4); }
.sh-dots i.on { background: #fff; }
.sh-name { font-family: var(--display); font-weight: 800; font-size: 30px; line-height: 1.05; padding: 14px 18px 4px; overflow-wrap: anywhere; }
.sh-sub { color: var(--dim); font-size: 14px; margin-top: -6px; }
.sh-links { display: flex; flex-wrap: wrap; gap: 8px; }
.sh-links a { padding: 8px 14px; border-radius: 999px; background: var(--panel2); border: 1px solid var(--line); color: var(--text); font-size: 14px; font-weight: 600; text-decoration: none; overflow-wrap: anywhere; }
.sh-safety { display: flex; justify-content: center; gap: 18px; padding-top: 6px; border-top: 1px solid var(--line); }
.sh-plain { position: relative; padding: 20px 18px 6px; }
.sh-plain h3 { margin: 0; padding-right: 44px; font-family: var(--display); font-size: 22px; overflow-wrap: anywhere; }
.sh-plain .sh-close { background: var(--panel2); }
.person { display: flex; align-items: center; gap: 12px; padding: 10px; border-radius: 16px; background: var(--panel2); text-align: left; }
.person b, .person small { display: block; }
.person small { color: var(--dim); font-size: 13px; margin-top: 2px; }
.reasons { display: flex; flex-direction: column; gap: 8px; }
.reasons button { padding: 13px 16px; border-radius: 14px; border: 1px solid var(--line); background: var(--panel2); text-align: left; font-weight: 600; }
.reasons button.on { border-color: var(--hot); }

/* your profile */
.me-id { min-width: 0; }
.photo-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.ph-slot { position: relative; aspect-ratio: 3 / 4; border-radius: 14px; background: var(--panel) center / cover no-repeat; border: 1px solid var(--line); overflow: hidden; }
.ph-slot.add { display: grid; place-items: center; font-size: 30px; font-weight: 300; color: var(--hot); border-style: dashed; }
.ph-slot.add:disabled { opacity: .35; }
.ph-del, .ph-first { position: absolute; top: 6px; width: 28px; height: 28px; border-radius: 50%; background: rgba(0,0,0,.6); display: grid; place-items: center; font-size: 14px; color: #ffd166; }
.ph-del { right: 6px; color: #fff; }
.ph-first { left: 6px; }
.ph-del svg { width: 16px; height: 16px; }
.me-block { display: flex; flex-direction: column; gap: 12px; }
.gig-list { display: flex; flex-direction: column; gap: 8px; }
.gig-list:empty { display: none; }
.gig-row { display: flex; flex-direction: column; gap: 3px; padding: 12px 14px; border-radius: 14px; background: var(--panel); border: 1px solid var(--line); text-align: left; }
.gig-row b { overflow-wrap: anywhere; }
.gig-row small { color: var(--dim); font-size: 13px; }
#shGigs { display: flex; flex-direction: column; gap: 8px; }
#shGigs:empty { display: none; }
#shGigs .gig-row { background: var(--panel2); }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.flyer-row { display: flex; align-items: center; gap: 12px; }
.flyer { width: 64px; height: 80px; border-radius: 10px; background: var(--panel2) center / cover no-repeat; border: 1px solid var(--line); flex: none; }
#gigForm .ghost, #gigForm .primary { width: 100%; }
#gigForm .flyer-row .ghost { width: auto; }

/* small phones: card details trimmed step by step (fitPoster in app.js) */
.card .info.t1 .bio { -webkit-line-clamp: 1; }
.card .info.t2 .bio { display: none; }
.card .info.t3 .chips { flex-wrap: nowrap; overflow: hidden; }
.card .info.t4 .by { display: none; }
.card .info.t5 .nm { font-size: 24px; }
