:root {
  --brand: #ff6b4a;
  --brand-2: #ff9a3c;
  --brand-ink: #c2401f;
  --ink: #2a1f1a;
  --muted: #7d6e66;
  --line: #f0e4dc;
  --bg: #fff8f3;
  --card: #ffffff;
  --like: #22b07d;
  --nope: #ef4f5f;
  --radius: 22px;
  --shadow: 0 10px 30px rgba(120, 60, 30, .14);
  --safe-b: env(safe-area-inset-bottom, 0px);
}
* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Nunito", system-ui, -apple-system, sans-serif;
  color: var(--ink); background: var(--bg);
  -webkit-font-smoothing: antialiased;
}
button, input, select, textarea { font: inherit; color: inherit; }
img { display: block; max-width: 100%; }
#app { max-width: 480px; margin: 0 auto; min-height: 100dvh; position: relative; display: flex; flex-direction: column; }

/* ---------- Brand ---------- */
.logo { display: flex; align-items: center; gap: 10px; font-weight: 900; font-size: 22px; letter-spacing: -.3px; }
.logo span b { color: var(--brand); }
.logo-mark {
  width: 34px; height: 34px; border-radius: 26%; flex: none;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)) center/cover;
  -webkit-mask: none;
  position: relative;
}
.logo-mark::after {
  content: ""; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns=%22http://www.w3.org/2000/svg%22 viewBox=%22110 100 292 324%22%3E%3Cg fill=%22%23fff%22%3E%3Cg transform=%22translate(0,-12)%22%3E%0A  %3Cellipse cx=%22148%22 cy=%22222%22 rx=%2231%22 ry=%2241%22 transform=%22rotate(-22 148 222)%22/%3E%0A  %3Cellipse cx=%22214%22 cy=%22160%22 rx=%2233%22 ry=%2244%22 transform=%22rotate(-8 214 160)%22/%3E%0A  %3Cellipse cx=%22298%22 cy=%22160%22 rx=%2233%22 ry=%2244%22 transform=%22rotate(8 298 160)%22/%3E%0A  %3Cellipse cx=%22364%22 cy=%22222%22 rx=%2231%22 ry=%2241%22 transform=%22rotate(22 364 222)%22/%3E%0A  %3Cpath d=%22M256 424C198 386 156 350 156 302C156 268 181 244 211 244C232 244 248 255 256 271C264 255 280 244 301 244C331 244 356 268 356 302C356 350 314 386 256 424Z%22/%3E%0A%3C/g%3E%3C/g%3E%3C/svg%3E") center/62% no-repeat;
}
.logo-mark.big { width: 84px; height: 84px; box-shadow: var(--shadow); }
.splash { flex: 1; display: grid; place-items: center; min-height: 100dvh; }
.splash .logo-mark { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); } }

/* ---------- Auth ---------- */
.auth { flex: 1; display: flex; flex-direction: column; padding: 28px 22px calc(28px + var(--safe-b)); }
.auth-hero { text-align: center; padding: 36px 0 26px; }
.auth-hero .logo-mark { margin: 0 auto 18px; }
.auth-hero h1 { font-size: 34px; font-weight: 900; margin: 0 0 8px; letter-spacing: -.8px; }
.auth-hero h1 b { color: var(--brand); }
.auth-hero p { margin: 0; color: var(--muted); font-size: 17px; }
.seg { display: grid; grid-template-columns: 1fr 1fr; background: #fbeee6; padding: 4px; border-radius: 14px; margin-bottom: 18px; }
.seg button { border: 0; background: transparent; padding: 10px; border-radius: 11px; font-weight: 800; color: var(--muted); cursor: pointer; }
.seg button.on { background: #fff; color: var(--ink); box-shadow: 0 2px 8px rgba(0,0,0,.06); }
.fine { font-size: 13px; color: var(--muted); text-align: center; margin-top: 16px; line-height: 1.45; }
.link { background: none; border: 0; color: var(--brand-ink); font-weight: 800; cursor: pointer; padding: 6px; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Forms ---------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field label { font-weight: 800; font-size: 14px; }
.field small { color: var(--muted); font-size: 12.5px; }
.input, .field select, .field textarea {
  width: 100%; padding: 13px 14px; border: 1.5px solid var(--line); border-radius: 14px; background: #fff;
  outline: none; transition: border-color .15s, box-shadow .15s; font-size: 16px;
}
.input:focus, .field select:focus, .field textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 4px rgba(255,107,74,.15); }
.field textarea { min-height: 92px; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chips input { position: absolute; opacity: 0; pointer-events: none; }
.chips label { padding: 9px 14px; border: 1.5px solid var(--line); border-radius: 999px; background: #fff; font-weight: 700; font-size: 14px; cursor: pointer; }
.chips input:checked + label { background: var(--ink); border-color: var(--ink); color: #fff; }
.chips input:focus-visible + label { box-shadow: 0 0 0 4px rgba(255,107,74,.3); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  border: 0; border-radius: 16px; padding: 15px 18px; font-weight: 900; font-size: 16px; cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; width: 100%;
  box-shadow: 0 8px 20px rgba(255,107,74,.35); transition: transform .1s, opacity .15s;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .6; pointer-events: none; }
.btn.ghost { background: #fff; color: var(--ink); box-shadow: none; border: 1.5px solid var(--line); }
.btn.danger { background: #fff; color: var(--nope); box-shadow: none; border: 1.5px solid #f6d0d4; }

/* ---------- Photos picker ---------- */
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.photo-slot {
  aspect-ratio: 3/4; border-radius: 16px; border: 2px dashed #ecd5c8; background: #fff;
  display: grid; place-items: center; position: relative; overflow: hidden; cursor: pointer; color: var(--muted);
}
.photo-slot img { width: 100%; height: 100%; object-fit: cover; }
.photo-slot .x {
  position: absolute; top: 6px; right: 6px; width: 26px; height: 26px; border-radius: 50%; border: 0;
  background: rgba(0,0,0,.6); color: #fff; font-weight: 900; cursor: pointer; line-height: 1;
}
.photo-slot.add { font-size: 30px; font-weight: 400; }

/* ---------- Shell ---------- */
.topbar {
  position: sticky; top: 0; z-index: 5; display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px; background: rgba(255,248,243,.92); backdrop-filter: blur(10px);
}
.topbar h2 { margin: 0; font-size: 20px; font-weight: 900; }
.page { flex: 1; padding: 6px 16px calc(96px + var(--safe-b)); }
.page.pad { padding: 8px 20px calc(110px + var(--safe-b)); }
.nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%); width: 100%; max-width: 480px; z-index: 10;
  display: grid; grid-template-columns: repeat(3, 1fr); background: #fff; border-top: 1px solid var(--line);
  padding: 8px 8px calc(8px + var(--safe-b));
}
.nav a { display: flex; flex-direction: column; align-items: center; gap: 3px; text-decoration: none; color: #b3a39a; font-size: 12px; font-weight: 800; padding: 4px; position: relative; }
.nav a svg { width: 26px; height: 26px; }
.nav a.on { color: var(--brand); }
.nav .dot { position: absolute; top: 2px; right: calc(50% - 20px); width: 9px; height: 9px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; }
.icon-btn { color: var(--ink); width: 40px; height: 40px; border-radius: 12px; border: 0; background: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.06); }

/* ---------- Deck ---------- */
.deck { position: relative; height: min(66dvh, 600px); margin-top: 4px; }
.card {
  position: absolute; inset: 0; border-radius: var(--radius); overflow: hidden; background: #eadbd2;
  box-shadow: var(--shadow); touch-action: none; user-select: none; will-change: transform;
}
.card.back { transform: scale(.95) translateY(14px); filter: brightness(.96); }
.card .ph { position: absolute; inset: 0; background-size: cover; background-position: center; }
.card .ph.empty { display: grid; place-items: center; background: linear-gradient(135deg, #ffd8c7, #ffe9d2); }
.card .ph.empty .logo-mark { width: 90px; height: 90px; border-radius: 28px; opacity: .8; }
.card .bars { position: absolute; top: 10px; left: 10px; right: 10px; display: flex; gap: 5px; z-index: 2; }
.card .bars i { flex: 1; height: 4px; border-radius: 4px; background: rgba(255,255,255,.4); }
.card .bars i.on { background: #fff; }
.card .tap { position: absolute; top: 0; bottom: 40%; width: 50%; z-index: 1; }
.card .tap.l { left: 0; } .card .tap.r { right: 0; }
.card .info {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 70px 20px 20px; color: #fff; z-index: 2; pointer-events: none;
  background: linear-gradient(to top, rgba(20,10,5,.85), rgba(20,10,5,0));
}
.card h3 { margin: 0; font-size: 30px; font-weight: 900; letter-spacing: -.5px; }
.card h3 small { font-weight: 700; font-size: 22px; opacity: .92; }
.card .meta { margin: 4px 0 8px; font-weight: 700; opacity: .92; }
.card .bio { margin: 0; font-size: 15px; opacity: .92; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.tag { display: inline-block; padding: 4px 10px; border-radius: 999px; font-size: 12.5px; font-weight: 800; background: rgba(255,255,255,.22); backdrop-filter: blur(6px); margin-right: 6px; }
.stamp {
  position: absolute; top: 34px; z-index: 3; padding: 6px 14px; border: 4px solid; border-radius: 12px;
  font-size: 30px; font-weight: 900; letter-spacing: 1px; opacity: 0; text-transform: uppercase;
}
.stamp.like { left: 22px; color: var(--like); transform: rotate(-14deg); }
.stamp.nope { right: 22px; color: var(--nope); transform: rotate(14deg); }

.actions { display: flex; justify-content: center; gap: 26px; margin-top: 18px; }
.round {
  width: 68px; height: 68px; border-radius: 50%; border: 0; background: #fff; box-shadow: var(--shadow);
  display: grid; place-items: center; cursor: pointer; transition: transform .12s;
}
.round:active { transform: scale(.9); }
.round svg { width: 32px; height: 32px; }
.round.nope { color: var(--nope); } .round.like { color: var(--like); }

.empty-state { text-align: center; padding: 60px 24px; color: var(--muted); }
.empty-state .logo-mark { margin: 0 auto 18px; width: 70px; height: 70px; border-radius: 22px; }
.empty-state h3 { color: var(--ink); font-size: 22px; margin: 0 0 6px; font-weight: 900; }
.empty-state p { margin: 0 0 18px; }

/* ---------- Matches list ---------- */
.new-row { display: flex; gap: 14px; overflow-x: auto; padding: 6px 2px 16px; scrollbar-width: none; }
.new-row a { flex: none; width: 82px; text-decoration: none; color: var(--ink); text-align: center; font-weight: 800; font-size: 13px; }
.av { width: 56px; height: 56px; border-radius: 50%; background: #f2dfd4 center/cover; flex: none; }
.new-row .av { width: 78px; height: 78px; margin-bottom: 6px; border: 3px solid var(--brand); }
.section-t { font-size: 13px; font-weight: 900; color: var(--muted); text-transform: uppercase; letter-spacing: .6px; margin: 6px 2px 10px; }
.list a { display: flex; align-items: center; gap: 14px; padding: 12px 6px; text-decoration: none; color: inherit; border-bottom: 1px solid var(--line); }
.list .t { flex: 1; min-width: 0; }
.list b { display: block; font-size: 16px; }
.list span { display: block; color: var(--muted); font-size: 14px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; height: 100dvh; }
.chat .topbar { gap: 12px; justify-content: flex-start; border-bottom: 1px solid var(--line); }
.chat .topbar .av { width: 40px; height: 40px; }
.msgs { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.msg { max-width: 78%; padding: 10px 14px; border-radius: 18px; font-size: 15.5px; line-height: 1.35; word-wrap: break-word; white-space: pre-wrap; }
.msg.them { align-self: flex-start; background: #fff; border-bottom-left-radius: 6px; box-shadow: 0 1px 4px rgba(0,0,0,.05); }
.msg.me { align-self: flex-end; background: var(--brand); color: #fff; border-bottom-right-radius: 6px; }
.msg time { display: block; font-size: 11px; opacity: .65; margin-top: 3px; text-align: right; }
.composer { display: flex; gap: 10px; padding: 10px 12px calc(10px + var(--safe-b)); border-top: 1px solid var(--line); background: #fff; }
.composer input { flex: 1; border: 1.5px solid var(--line); border-radius: 999px; padding: 12px 16px; outline: none; font-size: 16px; }
.composer input:focus { border-color: var(--brand); }
.composer button { width: 46px; height: 46px; border-radius: 50%; border: 0; background: var(--brand); color: #fff; display: grid; place-items: center; cursor: pointer; flex: none; }
.chat-hint { text-align: center; color: var(--muted); font-size: 14px; margin: auto 20px; }

/* ---------- Profile ---------- */
.profile-card { background: #fff; border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); margin-bottom: 18px; }
.profile-card .cover { aspect-ratio: 4/3; background: #f2dfd4 center/cover; }
.profile-card .body { padding: 16px 18px 18px; }
.profile-card h3 { margin: 0 0 4px; font-size: 24px; font-weight: 900; }
.profile-card p { margin: 0; color: var(--muted); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; background: #fff; border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; border: 1.5px solid var(--line); }
.toggle-row small { display: block; color: var(--muted); }
.switch { position: relative; width: 50px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: #e3d6cf; border-radius: 999px; cursor: pointer; transition: .2s; }
.switch span::before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; box-shadow: 0 1px 3px rgba(0,0,0,.2); }
.switch input:checked + span { background: var(--like); }
.switch input:checked + span::before { transform: translateX(20px); }
.stack { display: grid; gap: 10px; }

/* ---------- Match modal ---------- */
.overlay {
  position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at 50% 30%, rgba(255,154,60,.96), rgba(255,107,74,.97));
  animation: fade .25s ease;
}
@keyframes fade { from { opacity: 0; } }
.match { text-align: center; color: #fff; width: 100%; max-width: 360px; }
.match h2 { font-size: 44px; font-weight: 900; margin: 0 0 6px; letter-spacing: -1px; animation: pop .5s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { from { transform: scale(.3); opacity: 0; } }
.match p { margin: 0 0 28px; font-size: 17px; font-weight: 700; }
.match .pair { display: flex; justify-content: center; margin-bottom: 34px; }
.match .pair .av { width: 120px; height: 120px; border: 5px solid #fff; box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.match .pair .av:first-child { transform: rotate(-8deg) translateX(14px); }
.match .pair .av:last-child { transform: rotate(8deg) translateX(-14px); }
.match .btn { background: #fff; color: var(--brand-ink); box-shadow: none; margin-bottom: 10px; }
.match .btn.ghost { background: transparent; color: #fff; border-color: rgba(255,255,255,.6); }

#toast {
  position: fixed; left: 50%; bottom: calc(96px + var(--safe-b)); transform: translateX(-50%) translateY(20px);
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 14px; font-weight: 700; font-size: 14.5px;
  opacity: 0; pointer-events: none; transition: .25s; z-index: 100; max-width: 90vw; text-align: center;
}
#toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.spinner { width: 26px; height: 26px; border: 3px solid #f3d9cc; border-top-color: var(--brand); border-radius: 50%; animation: spin .8s linear infinite; margin: 60px auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Instalar app ---------- */
.install-card { display: flex; align-items: center; gap: 14px; background: #fff; border: 1.5px solid var(--line); border-radius: 16px; padding: 14px 16px; margin-bottom: 12px; }
.install-card img { width: 46px; height: 46px; border-radius: 12px; flex: none; }
.install-card .t { flex: 1; min-width: 0; }
.install-card small { display: block; color: var(--muted); }
.install-card button { border: 0; background: var(--ink); color: #fff; font-weight: 800; padding: 10px 14px; border-radius: 12px; cursor: pointer; flex: none; }
.sheet-bg { position: fixed; inset: 0; z-index: 60; background: rgba(20,10,5,.45); 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 22px calc(22px + var(--safe-b)); }
.sheet h3 { margin: 0 0 12px; font-size: 20px; font-weight: 900; }
.sheet ol { margin: 0 0 18px; padding-left: 20px; line-height: 1.7; }
.sheet .ios-share { display: inline-block; vertical-align: -3px; width: 18px; height: 18px; }
@media (display-mode: standalone) { .install-card { display: none; } }
