:root {
  --rose: #e8475f;
  --rose-dark: #c42e47;
  --rose-soft: #fde8ec;
  --peach: #ff8a65;
  --ink: #1d1b22;
  --ink-2: #4a4652;
  --muted: #8a8593;
  --line: #ece9ef;
  --bg: #faf8fb;
  --card: #ffffff;
  --green: #22a06b;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(29, 27, 34, .08);
  --shadow-lg: 0 20px 50px rgba(29, 27, 34, .16);
  --grad: linear-gradient(135deg, var(--rose) 0%, var(--peach) 100%);
  font-family: 'Plus Jakarta Sans', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); min-height: 100%; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--rose); }
.hidden { display: none !important; }

/* ---------- Layout ---------- */
.shell { max-width: 480px; margin: 0 auto; min-height: 100dvh; display: flex; flex-direction: column; background: var(--bg); position: relative; }
.topbar { display: flex; align-items: center; gap: 12px; padding: 14px 18px; position: sticky; top: 0; z-index: 5; background: rgba(250, 248, 251, .9); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.topbar h1 { font-size: 20px; margin: 0; flex: 1; font-weight: 800; letter-spacing: -.02em; }
.brand { font-weight: 800; font-size: 22px; letter-spacing: -.03em; background: var(--grad); -webkit-background-clip: text; background-clip: text; color: transparent; }
.content { flex: 1; padding: 18px; padding-bottom: 100px; }
.bottomnav { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; display: flex; background: #fff; border-top: 1px solid var(--line); padding: 8px 8px calc(8px + env(safe-area-inset-bottom)); z-index: 10; }
.bottomnav button { flex: 1; background: none; border: 0; padding: 8px 4px; display: flex; flex-direction: column; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; color: var(--muted); border-radius: 12px; position: relative; }
.bottomnav button.active { color: var(--rose); }
.bottomnav svg { width: 24px; height: 24px; }
.badge { position: absolute; top: 2px; right: calc(50% - 22px); background: var(--rose); color: #fff; font-size: 10px; min-width: 18px; height: 18px; border-radius: 9px; display: grid; place-items: center; padding: 0 5px; font-weight: 700; }

/* ---------- Buttons & forms ---------- */
.btn { border: 0; border-radius: 14px; padding: 14px 18px; font-weight: 700; font-size: 15px; background: var(--grad); color: #fff; width: 100%; box-shadow: 0 8px 20px rgba(232, 71, 95, .28); transition: transform .1s, opacity .2s; }
.btn:active { transform: scale(.98); }
.btn:disabled { opacity: .6; cursor: default; }
.btn.secondary { background: #fff; color: var(--ink); border: 1.5px solid var(--line); box-shadow: none; }
.btn.danger { background: #fff; color: #c62828; border: 1.5px solid #f5c6c6; box-shadow: none; }
.btn.small { width: auto; padding: 9px 14px; font-size: 13px; border-radius: 11px; }
.link { background: none; border: 0; color: var(--rose); font-weight: 600; padding: 4px; }
.iconbtn { background: none; border: 0; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ink-2); }
.iconbtn:hover { background: var(--line); }
.iconbtn svg { width: 22px; height: 22px; }

.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.field .hint { font-size: 12px; color: var(--muted); }
.field .hint.ok { color: var(--green); font-weight: 600; }
.field .hint.bad { color: #c62828; font-weight: 600; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=number], select, textarea {
  width: 100%; border: 1.5px solid var(--line); background: #fff; border-radius: 13px; padding: 13px 14px; font-size: 15px; outline: none; transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--rose); box-shadow: 0 0 0 4px var(--rose-soft); }
textarea { resize: vertical; min-height: 90px; }
.row { display: flex; gap: 10px; }
.row > * { flex: 1; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { border: 1.5px solid var(--line); background: #fff; border-radius: 999px; padding: 8px 14px; font-size: 14px; font-weight: 600; color: var(--ink-2); }
.chip.on { border-color: var(--rose); background: var(--rose-soft); color: var(--rose-dark); }
.tag { display: inline-flex; align-items: center; gap: 4px; background: var(--rose-soft); color: var(--rose-dark); border-radius: 999px; padding: 5px 11px; font-size: 13px; font-weight: 600; }
.tag button { border: 0; background: none; color: inherit; padding: 0 0 0 2px; font-size: 15px; line-height: 1; }
.error { color: #c62828; font-size: 14px; margin: 4px 0 12px; font-weight: 500; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; margin-bottom: 16px; }
.card h3 { margin: 0 0 14px; font-size: 16px; }
.muted { color: var(--muted); }
.center { text-align: center; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.switch input { width: 46px; height: 26px; appearance: none; background: var(--line); border-radius: 13px; position: relative; transition: background .2s; cursor: pointer; flex: none; }
.switch input::after { content: ''; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; background: #fff; border-radius: 50%; transition: left .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked { background: var(--rose); }
.switch input:checked::after { left: 23px; }

/* ---------- Landing / Auth ---------- */
.landing { min-height: 100dvh; display: flex; flex-direction: column; background: radial-gradient(1200px 600px at 10% -10%, #ffd9d0 0%, transparent 60%), radial-gradient(900px 500px at 110% 10%, #ffd0dc 0%, transparent 55%), var(--bg); }
.landing-inner { max-width: 440px; width: 100%; margin: 0 auto; padding: 40px 22px 30px; flex: 1; display: flex; flex-direction: column; }
.hero { text-align: center; margin: 20px 0 28px; }
.hero .logo { width: 72px; height: 72px; border-radius: 22px; background: var(--grad); display: grid; place-items: center; margin: 0 auto 18px; box-shadow: 0 14px 30px rgba(232, 71, 95, .35); }
.hero .logo svg { width: 38px; height: 38px; color: #fff; }
.hero h1 { font-size: 34px; margin: 0 0 8px; letter-spacing: -.03em; font-weight: 800; }
.hero p { margin: 0; color: var(--ink-2); font-size: 16px; line-height: 1.5; }
.perks { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 24px; }
.perk { background: rgba(255,255,255,.7); border-radius: 14px; padding: 12px 8px; text-align: center; font-size: 12px; font-weight: 600; color: var(--ink-2); }
.perk span { display: block; font-size: 20px; margin-bottom: 4px; }
.tabs { display: flex; background: #fff; border-radius: 14px; padding: 4px; margin-bottom: 18px; box-shadow: var(--shadow); }
.tabs button { flex: 1; border: 0; background: none; padding: 11px; border-radius: 11px; font-weight: 700; color: var(--muted); }
.tabs button.on { background: var(--grad); color: #fff; }
.disclaimer { font-size: 12px; color: var(--muted); text-align: center; margin-top: 22px; line-height: 1.5; }

/* ---------- Discover ---------- */
.empty { text-align: center; padding: 60px 20px; color: var(--ink-2); }
.empty .big { font-size: 56px; margin-bottom: 12px; }
.empty h2 { margin: 0 0 8px; font-size: 20px; }
.empty p { margin: 0 0 20px; color: var(--muted); line-height: 1.5; }

/* ---------- Matches ---------- */
.newmatches { display: flex; gap: 14px; overflow-x: auto; padding: 4px 2px 14px; margin-bottom: 8px; scrollbar-width: none; }
.newmatches button { border: 0; background: none; padding: 0; display: flex; flex-direction: column; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; flex: none; width: 72px; }
.newmatches .av { width: 68px; height: 68px; border-radius: 50%; padding: 3px; background: var(--grad); }
.newmatches .av > * { width: 100%; height: 100%; border-radius: 50%; border: 3px solid #fff; }
.section-title { font-size: 13px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 6px 0 12px; }
.convo { display: flex; align-items: center; gap: 14px; padding: 12px; border-radius: 16px; background: #fff; border: 0; width: 100%; text-align: left; margin-bottom: 8px; box-shadow: 0 2px 8px rgba(0,0,0,.04); }
.convo:hover { background: #fffafb; }
.convo .txt { flex: 1; min-width: 0; }
.convo .name { font-weight: 700; font-size: 15px; display: flex; justify-content: space-between; gap: 8px; }
.convo .name time { font-weight: 500; font-size: 12px; color: var(--muted); }
.convo .last { font-size: 14px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.convo.unread .last { color: var(--ink); font-weight: 600; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--rose); flex: none; }
.avatar { width: 54px; height: 54px; border-radius: 50%; background-size: cover; background-position: center; background-color: var(--rose-soft); flex: none; display: grid; place-items: center; font-weight: 800; color: var(--rose); font-size: 20px; }
.avatar.sm { width: 40px; height: 40px; font-size: 16px; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: 100dvh; }
.chat .topbar .who { flex: 1; display: flex; align-items: center; gap: 10px; background: none; border: 0; padding: 0; text-align: left; min-width: 0; }
.chat .who b { display: block; font-size: 16px; }
.chat .who small { color: var(--muted); font-size: 12px; }
.chat .who small.on { color: var(--green); }
.msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 20px; font-size: 15px; line-height: 1.4; word-wrap: break-word; white-space: pre-wrap; }
.msg.them { background: #fff; align-self: flex-start; border-bottom-left-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.msg.me { background: var(--grad); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.msg time { display: block; font-size: 10px; opacity: .7; margin-top: 3px; text-align: right; }
.daysep { text-align: center; font-size: 12px; color: var(--muted); margin: 10px 0; font-weight: 600; }
.composer { display: flex; gap: 10px; padding: 12px 14px calc(12px + env(safe-area-inset-bottom)); background: #fff; border-top: 1px solid var(--line); }
.composer textarea { min-height: 46px; max-height: 120px; border-radius: 23px; padding: 12px 16px; resize: none; }
.composer button { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--grad); color: #fff; flex: none; display: grid; place-items: center; }
.composer button svg { width: 20px; height: 20px; }
.chat-intro { text-align: center; padding: 30px 20px; color: var(--muted); }
.chat-intro .avatar { width: 90px; height: 90px; margin: 0 auto 12px; font-size: 34px; }

/* ---------- Profile edit ---------- */
.photogrid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.ph { aspect-ratio: 3/4; border-radius: 16px; background: var(--rose-soft) center/cover; position: relative; overflow: hidden; border: 2px dashed transparent; }
.ph.add { border-color: #f4b9c3; display: grid; place-items: center; color: var(--rose); font-weight: 700; font-size: 14px; cursor: pointer; }
.ph.add input { display: none; }
.ph .ph-actions { position: absolute; bottom: 8px; left: 8px; right: 8px; display: flex; gap: 6px; justify-content: flex-end; }
.ph .ph-actions button { border: 0; background: rgba(0,0,0,.55); color: #fff; border-radius: 10px; padding: 6px 10px; font-size: 12px; font-weight: 600; }
.ph .main { position: absolute; top: 8px; left: 8px; background: var(--rose); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 8px; }
.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.steps i { flex: 1; height: 5px; border-radius: 3px; background: var(--line); }
.steps i.on { background: var(--grad); }

/* ---------- Modal / sheet ---------- */
.overlay { position: fixed; inset: 0; background: rgba(20, 16, 24, .55); z-index: 50; display: flex; align-items: flex-end; justify-content: center; animation: fade .2s; }
.sheet { background: #fff; width: 100%; max-width: 480px; border-radius: 24px 24px 0 0; padding: 22px 20px calc(22px + env(safe-area-inset-bottom)); max-height: 92dvh; overflow-y: auto; animation: up .25s ease-out; }
.sheet h2 { margin: 0 0 6px; font-size: 20px; }
.sheet .menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 15px 4px; font-size: 16px; font-weight: 600; border-bottom: 1px solid var(--line); }
.sheet .menu button.red { color: #c62828; }
.sheet .menu button:last-child { border-bottom: 0; }
.matchpop { position: fixed; inset: 0; z-index: 60; background: linear-gradient(160deg, rgba(232,71,95,.96), rgba(255,138,101,.96)); display: flex; flex-direction: column; align-items: center; justify-content: center; color: #fff; padding: 30px; text-align: center; animation: fade .3s; }
.matchpop h1 { font-size: 44px; margin: 0 0 8px; font-weight: 800; letter-spacing: -.03em; }
.matchpop .pair { display: flex; margin: 30px 0; }
.matchpop .pair .avatar { width: 120px; height: 120px; border: 4px solid #fff; font-size: 44px; }
.matchpop .pair .avatar + .avatar { margin-left: -24px; }
.matchpop .btn { background: #fff; color: var(--rose); max-width: 320px; margin-bottom: 10px; }
.matchpop .btn.secondary { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }
/* ---------- Profile view (photos + prompts) ---------- */
.pv { display: flex; flex-direction: column; gap: 14px; }
.pv-head { padding: 2px 4px 0; }
.pv-head h2 { margin: 0; font-size: 30px; font-weight: 800; letter-spacing: -.03em; }
.compat { display: inline-flex; align-items: center; gap: 4px; background: #fff4d6; color: #8a5a00; font-size: 12px; font-weight: 700; padding: 5px 10px; border-radius: 999px; margin-bottom: 8px; }
.pv-photo { position: relative; width: 100%; aspect-ratio: 4/5; border-radius: 20px; background: var(--rose-soft) center/cover; box-shadow: var(--shadow); }
.pv-photo.empty { display: grid; place-items: center; background: var(--grad); font-size: 120px; font-weight: 800; color: rgba(255,255,255,.9); }
.pv-prompt { position: relative; background: #fff; border-radius: 20px; padding: 24px 22px 30px; box-shadow: var(--shadow); }
.pv-prompt .q { font-size: 14px; font-weight: 700; color: var(--ink-2); margin-bottom: 10px; padding-right: 40px; }
.pv-prompt .a { font-size: 25px; line-height: 1.3; font-weight: 700; letter-spacing: -.02em; word-wrap: break-word; padding-right: 48px; }
.pv-prompt .a.small { font-size: 16px; font-weight: 500; line-height: 1.55; letter-spacing: 0; }
.pv-vitals { background: #fff; border-radius: 20px; padding: 14px 16px; box-shadow: var(--shadow); display: flex; flex-wrap: wrap; gap: 8px 18px; }
.pv-vitals span { font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 6px; color: var(--ink); }
.pv-vitals i { font-style: normal; }
.likebtn { position: absolute; right: 14px; bottom: 14px; width: 52px; height: 52px; border-radius: 50%; border: 0; background: #fff; color: var(--rose); display: grid; place-items: center; box-shadow: 0 6px 18px rgba(0,0,0,.18); transition: transform .12s; }
.likebtn:hover { transform: scale(1.06); }
.likebtn:active { transform: scale(.92); }
.likebtn svg { width: 26px; height: 26px; }
.pv-prompt .likebtn { bottom: 14px; right: 14px; width: 46px; height: 46px; box-shadow: 0 3px 12px rgba(0,0,0,.14); }
.pv-prompt .likebtn svg { width: 22px; height: 22px; }
.pv-foot { text-align: center; padding: 26px 0 40px; }
.pv-foot .link { font-size: 13px; }
.skipbtn { position: fixed; z-index: 9; bottom: calc(84px + env(safe-area-inset-bottom)); left: max(18px, calc(50% - 222px)); width: 60px; height: 60px; border-radius: 50%; border: 0; background: #fff; color: var(--ink-2); display: grid; place-items: center; box-shadow: var(--shadow-lg); transition: transform .12s; }
.skipbtn:active { transform: scale(.9); }
.skipbtn svg { width: 26px; height: 26px; }
.likes-pill { font-size: 12px; font-weight: 700; color: var(--rose-dark); background: var(--rose-soft); padding: 5px 10px; border-radius: 999px; margin-right: 4px; white-space: nowrap; }
.like-preview { margin-bottom: 14px; }
.like-preview .pv-prompt { box-shadow: none; border: 1.5px solid var(--line); padding: 18px; }
.like-preview .pv-prompt .a { font-size: 20px; }
.lp-photo { width: 140px; aspect-ratio: 4/5; border-radius: 16px; background: center/cover; margin: 0 auto; box-shadow: var(--shadow); }
.prompt-slot { border: 1.5px dashed #f1c4cc; border-radius: 16px; padding: 12px; margin-bottom: 10px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.prompt-slot select, .prompt-slot textarea { width: 100%; }

/* Likes You */
.likes-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.like-card { border: 0; padding: 0; background: #fff; border-radius: 18px; overflow: hidden; text-align: left; box-shadow: var(--shadow); display: flex; flex-direction: column; }
.lc-photo { aspect-ratio: 4/5; background: var(--grad) center/cover; display: grid; place-items: center; color: #fff; font-size: 54px; font-weight: 800; }
.lc-body { padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 3px; }
.lc-body b { font-size: 15px; }
.lc-body small { color: var(--muted); font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-comment { font-size: 13px; color: var(--rose-dark); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Full-screen profile viewer */
.viewer { position: fixed; inset: 0; z-index: 55; background: var(--bg); overflow-y: auto; animation: up .25s; }
.viewer-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; gap: 10px; padding: 10px 14px; background: rgba(250,248,251,.92); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
.viewer .vbody { padding: 16px 18px 200px; max-width: 480px; margin: 0 auto; }
.viewer-actions { position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; background: #fff; padding: 14px 18px calc(16px + env(safe-area-inset-bottom)); border-radius: 22px 22px 0 0; box-shadow: 0 -10px 30px rgba(0,0,0,.08); }
.they-liked { margin-bottom: 12px; display: flex; flex-direction: column; gap: 6px; }
.they-liked small { color: var(--muted); font-weight: 600; }
.they-liked .msg { max-width: 100%; }

/* Matches & chat extras */
.turn { font-size: 11px; font-weight: 800; color: var(--rose-dark); background: var(--rose-soft); padding: 4px 9px; border-radius: 999px; white-space: nowrap; }
.msg-context { font-size: 12px; color: var(--muted); font-weight: 600; max-width: 78%; margin-top: 6px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.msg-context.me { align-self: flex-end; }
.msg-context.them { align-self: flex-start; }

.devnote { background: #fff8e1; border: 1.5px solid #ffe08a; color: #6b4e00; border-radius: 12px; padding: 12px 14px; font-size: 13px; line-height: 1.5; margin-bottom: 14px; }
.devnote b { font-size: 16px; letter-spacing: .12em; color: #3d2c00; }

.code { background: var(--ink); color: #fff; padding: 14px 16px; border-radius: 12px; font: 14px/1.6 ui-monospace, Menlo, monospace; white-space: pre-wrap; margin: 0 0 12px; }

#toast { position: fixed; top: 18px; left: 50%; transform: translateX(-50%) translateY(-120px); background: var(--ink); color: #fff; padding: 12px 20px; border-radius: 14px; font-weight: 600; font-size: 14px; z-index: 100; transition: transform .3s; max-width: 90vw; box-shadow: var(--shadow-lg); }
#toast.show { transform: translateX(-50%) translateY(0); }
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: 14px; padding: 14px; text-align: center; box-shadow: var(--shadow); }
.stat b { display: block; font-size: 22px; }
.stat small { color: var(--muted); font-size: 12px; font-weight: 600; }
.report { border-left: 4px solid var(--rose); }
.report.done { border-left-color: var(--line); opacity: .7; }
.spinner { width: 34px; height: 34px; border: 4px solid var(--rose-soft); border-top-color: var(--rose); border-radius: 50%; animation: spin .8s linear infinite; margin: 60px auto; }

@keyframes fade { from { opacity: 0; } }
@keyframes up { from { transform: translateY(40px); opacity: 0; } }
@keyframes spin { to { transform: rotate(360deg); } }

@media (min-width: 700px) {
  .content { padding: 24px; padding-bottom: 110px; }
  .overlay { align-items: center; }
  .sheet { border-radius: 24px; }
}
