:root {
  --bg: #e7f0ea;
  --ink: #1c1915;
  --muted: #6e675e;
  --line: rgba(28, 25, 21, .12);
  --card: #fffdf9;
  --teal: #0e6e68;
  --teal-ink: #f3fffc;
  --coral: #e15a45;
  --sand: #f6f1ea;
  --shadow: 0 22px 50px rgba(36, 48, 42, .16);
  --font: Outfit, "Segoe UI", sans-serif;
  --display: Fraunces, Georgia, serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background:
    radial-gradient(900px 480px at -10% -10%, #f8e4cf, transparent 55%),
    radial-gradient(800px 520px at 110% -20%, #cfe6df, transparent 50%),
    linear-gradient(180deg, #f7f4ee, #e4eee8 40%, #dce8e4);
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.sr {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0); border: 0;
}

.app { min-height: 100vh; }
.workspace { min-height: 100vh; display: flex; flex-direction: column; }
.top {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px 8px;
}
.brand {
  display: flex; align-items: center; gap: 8px;
  margin: 0; font-family: var(--display); font-weight: 560; font-size: 34px;
  letter-spacing: -.03em;
}
.brand svg, .logo svg { width: 28px; height: 28px; display: block; flex: none; }
.spacer { flex: 1; }
.city {
  display: flex; align-items: center; gap: 6px;
  background: rgba(255, 253, 249, .8); border: 1px solid var(--line);
  border-radius: 999px; padding: 6px 10px; font-size: 13px; color: var(--muted);
}
.city select { border: 0; background: transparent; font-weight: 650; color: var(--ink); }
.account {
  border: 0; background: var(--teal); color: var(--teal-ink);
  border-radius: 999px; padding: 8px 14px; font-weight: 650;
}
.rail, .tabbar { display: none; }

main { flex: 1; padding: 6px 16px 18px; }
.where { margin: 0 0 10px; color: var(--muted); font-size: 14px; }
.filters { display: flex; gap: 8px; overflow: auto; padding-bottom: 10px; }
.chip {
  border: 1px solid var(--line); background: rgba(255,253,249,.7);
  border-radius: 999px; padding: 7px 12px; white-space: nowrap; color: var(--ink-2, var(--ink));
}
.chip[aria-pressed="true"] { background: var(--ink); color: #fff; border-color: var(--ink); }

.discover-layout { display: grid; gap: 14px; }
.deck-col { min-width: 0; display: flex; flex-direction: column; height: calc(100dvh - 154px); min-height: 0; }
.deck { position: relative; flex: 1; min-height: 240px; }
.card {
  position: absolute; inset: 0; border-radius: 28px; overflow: hidden;
  background: #d7ddd8; box-shadow: var(--shadow); touch-action: none;
  user-select: none; cursor: grab; transform-origin: 50% 110%;
}
.card.under-1 { transform: scale(.965) translateY(12px); filter: saturate(.92); }
.card.under-2 { transform: scale(.93) translateY(22px); filter: saturate(.84); }
.art, .art svg, .art img { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.art img, .mini img, .person-hero img { object-fit: cover; object-position: center top; }
.scrim {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 1;
  padding: 28px 16px 12px; color: #fff;
  background: linear-gradient(180deg, rgba(17, 16, 14, 0) 0%, rgba(17, 16, 14, .5) 46%, rgba(17, 16, 14, .72) 100%);
}
.kicker { margin: 0 0 4px; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; opacity: .85; }
.scrim h2 {
  margin: 0; font-family: var(--display); font-weight: 560; font-size: 28px;
  letter-spacing: -.03em; line-height: 1;
}
.scrim h2 span { font-family: var(--font); font-size: 22px; font-weight: 500; margin-left: 6px; }
.meta, .bio { margin: 8px 0 0; }
.bio { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; line-height: 1.4; }
.card.open .bio { -webkit-line-clamp: 6; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.tag {
  border: 1px solid rgba(255,255,255,.35); background: rgba(255,255,255,.14);
  border-radius: 999px; padding: 4px 8px; font-size: 12px;
}
.stamp {
  position: absolute; top: 22px; z-index: 2; opacity: 0;
  font-weight: 800; letter-spacing: .14em; font-size: 22px;
  border: 3px solid; border-radius: 10px; padding: 2px 8px;
}
.stamp.like { left: 18px; color: #b7f5c8; border-color: #b7f5c8; transform: rotate(-16deg); }
.stamp.nope { right: 18px; color: #ffd0c6; border-color: #ffd0c6; transform: rotate(16deg); }
.stamp.super { left: 50%; top: 18px; color: #d7fff8; border-color: #d7fff8; transform: translateX(-50%); }

.actions { display: flex; justify-content: center; align-items: center; gap: 12px; padding: 10px 0 0; }
.act {
  width: 56px; height: 56px; border-radius: 50%; border: 1px solid var(--line);
  background: #fff; display: grid; place-items: center; box-shadow: 0 8px 20px rgba(28,25,21,.06);
}
.act svg { width: 24px; height: 24px; }
.act.pass { color: #8d6840; }
.act.super { color: #0e6e68; width: 48px; height: 48px; }
.act.like { width: 68px; height: 68px; background: var(--coral); color: white; border-color: transparent; }
.act.undo { width: 44px; height: 44px; color: var(--muted); }
.act:disabled { opacity: .4; }
.hint { display: none; margin: 4px 0 0; text-align: center; color: var(--muted); font-size: 12px; }

.empty {
  height: 100%; border-radius: 28px; background: rgba(255,253,249,.8);
  border: 1px solid var(--line); display: grid; place-items: center; text-align: center; padding: 24px;
}
.empty h2 { font-family: var(--display); font-weight: 560; margin: 0 0 8px; }
.empty p { margin: 0 0 16px; color: var(--muted); }

.page-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.page-head h2 { font-family: var(--display); font-weight: 560; font-size: 32px; margin: 0; letter-spacing: -.03em; }
.seg { display: flex; background: rgba(255,253,249,.8); border-radius: 999px; padding: 4px; border: 1px solid var(--line); margin-bottom: 14px; }
.seg button { flex: 1; border: 0; background: transparent; border-radius: 999px; padding: 8px; }
.seg button[aria-pressed="true"] { background: white; font-weight: 700; }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.mini {
  position: relative; height: 230px; border: 0; padding: 0; border-radius: 20px; overflow: hidden;
  color: white; text-align: left; box-shadow: var(--shadow);
}
.mini svg, .mini img { position: absolute; inset: 0; width: 100%; height: 100%; }
.mini span {
  position: absolute; left: 10px; right: 10px; bottom: 10px; z-index: 1;
  text-shadow: 0 1px 8px rgba(0,0,0,.35);
}
.mini b { display: block; font-size: 16px; }
.mini small { opacity: .9; }

.list { display: flex; flex-direction: column; gap: 8px; }
.chat-row {
  display: flex; gap: 12px; align-items: center; width: 100%; text-align: left;
  border: 1px solid var(--line); background: rgba(255,253,249,.86); border-radius: 18px; padding: 10px;
}
.avatar { width: 52px; height: 52px; border-radius: 50%; overflow: hidden; flex: none; background: #ddd; }
.avatar svg { width: 100%; height: 130%; display: block; }
.avatar img { width: 100%; height: 100%; object-fit: cover; object-position: center 12%; display: block; }
.chat-row b { display: block; }
.chat-row small { color: var(--muted); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46vw; }
.chat-row time { margin-left: auto; color: var(--muted); font-size: 12px; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--coral); display: inline-block; margin-left: 6px; }

.thread { display: flex; flex-direction: column; height: calc(100vh - 150px); min-height: 420px; }
.thread-top { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.thread-top h2 { font-family: var(--display); font-size: 26px; margin: 0; font-weight: 560; }
.ghost, .solid {
  border-radius: 999px; padding: 10px 14px; font-weight: 650;
}
.ghost { background: transparent; border: 1px solid var(--line); }
.solid { background: var(--teal); color: var(--teal-ink); border: 0; }
.thread-log { flex: 1; overflow: auto; display: flex; flex-direction: column; gap: 8px; padding: 8px 0 12px; }
.bubble { max-width: 78%; padding: 10px 12px; border-radius: 18px; line-height: 1.4; }
.bubble.them { background: white; border: 1px solid var(--line); align-self: flex-start; }
.bubble.you { background: var(--teal); color: var(--teal-ink); align-self: flex-end; }
.bubble time { display: block; margin-top: 4px; font-size: 11px; opacity: .7; }
.composer { display: flex; gap: 8px; }
.composer input {
  flex: 1; border: 1px solid var(--line); background: white; border-radius: 999px; padding: 12px 14px;
}
.note { color: var(--muted); font-size: 13px; margin-top: 0; }

.profile { display: grid; gap: 14px; }
.me-card {
  display: grid; grid-template-columns: 92px 1fr; gap: 12px; align-items: center;
  background: white; border-radius: 22px; padding: 12px; border: 1px solid var(--line);
}
.me-card .avatar { width: 92px; height: 92px; }
.me-card h2 { font-family: var(--display); margin: 0; font-weight: 560; }
.me-card p { margin: 4px 0 0; color: var(--muted); }
form.stack { display: grid; gap: 10px; }
label.field { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], textarea {
  width: 100%; border: 1px solid var(--line); background: white; border-radius: 14px;
  padding: 12px; color: var(--ink);
}
textarea { min-height: 90px; resize: vertical; }
.form-error { color: var(--coral); min-height: 1.2em; margin: 0; font-size: 13px; }
.picks { display: flex; flex-wrap: wrap; gap: 6px; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; }

#overlay { position: fixed; inset: 0; display: none; z-index: 20; background: rgba(22, 20, 16, .48); }
#overlay.on { display: grid; place-items: end center; }
.sheet {
  width: min(460px, 100%); background: var(--card); border-radius: 28px 28px 0 0;
  padding: 18px 18px 26px; box-shadow: var(--shadow); max-height: min(88vh, 760px); overflow: auto;
}
.sheet h2 { font-family: var(--display); font-weight: 560; font-size: 34px; margin: 8px 0; letter-spacing: -.03em; }
.sheet .lead { margin: 0 0 12px; color: var(--muted); }
.match { text-align: center; }
.pair { display: flex; justify-content: center; margin: 8px 0 4px; }
.pair .avatar { width: 108px; height: 108px; border: 4px solid white; }
.pair .avatar + .avatar { margin-left: -24px; }
.sheet-actions { display: flex; gap: 8px; margin-top: 14px; }
.sheet-actions .solid, .sheet-actions .ghost { flex: 1; }
.person-hero { height: 240px; border-radius: 20px; overflow: hidden; position: relative; }
.person-hero svg, .person-hero img { width: 100%; height: 100%; display: block; }

#toast {
  position: fixed; left: 50%; bottom: 86px; transform: translateX(-50%) translateY(12px);
  background: #1c1915; color: white; border-radius: 999px; padding: 10px 14px;
  opacity: 0; pointer-events: none; transition: .2s ease; z-index: 30; font-size: 14px;
}
#toast.on { opacity: 1; transform: translateX(-50%) translateY(0); }

.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 10;
  display: flex; gap: 4px; padding: 6px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 253, 249, .94); border-top: 1px solid var(--line);
  backdrop-filter: blur(12px);
}
.tabbar button {
  flex: 1; border: 0; background: transparent; color: var(--muted);
  display: grid; justify-items: center; gap: 2px; font-size: 11px; padding: 4px;
}
.tabbar button[aria-current="page"] { color: var(--teal); font-weight: 700; }
.tabbar svg { width: 22px; height: 22px; }
.nav-count {
  background: var(--coral); color: white; border-radius: 99px; padding: 0 5px; font-size: 10px; font-weight: 700;
}

@media (min-width: 860px) {
  .app { display: grid; grid-template-columns: 220px minmax(0, 1fr); max-width: 1120px; margin: 0 auto; }
  .rail {
    display: flex; flex-direction: column; gap: 4px;
    position: sticky; top: 0; height: 100vh; padding: 22px 14px;
  }
  .top .brand { display: none; }
  .rail .logo { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-size: 28px; margin: 0 0 16px; }
  .rail button {
    display: flex; align-items: center; gap: 10px; border: 0; background: transparent;
    border-radius: 14px; padding: 12px; text-align: left; color: var(--ink);
  }
  .rail button[aria-current="page"] { background: rgba(255,253,249,.9); }
  .tabbar { display: none; }
  #toast { bottom: 28px; }
  .hint { display: block; }
  .chat-row small { max-width: 360px; }
  .deck-col { height: calc(100dvh - 96px); }
  .thread { height: calc(100vh - 120px); }
}

@media (min-width: 1100px) {
  .discover-layout { grid-template-columns: minmax(320px, 440px) 300px; justify-content: center; align-items: start; }
  .side {
    background: rgba(255,253,249,.78); border: 1px solid var(--line); border-radius: 24px; padding: 16px;
  }
  .side h3 { font-family: var(--display); font-weight: 560; margin: 0 0 8px; }
  .side li { margin: 8px 0; }
}

@media (max-width: 859px) {
  .side { display: none; }
  body { padding-bottom: 0; }
  main { padding-bottom: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; animation: none !important; }
}
