/* Ember. Contrast measured, not eyeballed: white on --ember-1 4.8:1, on
   --ember-2 5.8:1; --muted on white 5.8:1. The raw brand orange (#ff5a36)
   is only ever decoration, never a text or button background. */
:root {
  --ember-1: #d4381f;
  --ember-2: #c21f55;
  --ember-grad: linear-gradient(135deg, var(--ember-1), var(--ember-2));
  --ember-glow: #ff5a36;
  --bg: #faf7f5;
  --surface: #ffffff;
  --surface-2: #f3eeeb;
  --text: #1d1720;
  --muted: #6b6270;
  --line: #e6dfdb;
  --control: #b8aeb0;
  --ok: #1d7a4c;
  --bad: #b3261e;
  --radius: 18px;
  --shadow: 0 10px 30px rgba(40, 20, 30, .12);
  --head: 'Plus Jakarta Sans', system-ui, sans-serif;
  --body: 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--body); color: var(--text); background: var(--bg); line-height: 1.5; }
h1, h2, h3, .brand { font-family: var(--head); letter-spacing: -.01em; }
a { color: var(--ember-2); }
[hidden] { display: none !important; }

.brand { font-weight: 800; font-size: 1.35rem; display: inline-flex; align-items: center; gap: .45rem;
  color: var(--text); text-decoration: none; }
.brand-mark { width: 30px; height: 30px; border-radius: 10px; background: var(--ember-grad);
  display: grid; place-items: center; color: #fff; font-size: 17px; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border: 0; border-radius: 999px; padding: .8rem 1.4rem; font: 600 1rem var(--head);
  cursor: pointer; text-decoration: none; transition: transform .1s, box-shadow .15s; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--ember-grad); color: #fff; box-shadow: 0 6px 18px rgba(194, 31, 85, .28); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1.5px solid var(--control); }
.btn-danger { background: var(--surface); color: var(--bad); border: 1.5px solid var(--bad); }
.btn-block { width: 100%; }
.btn-sm { padding: .45rem .9rem; font-size: .88rem; }

/* ---------- Public pages ---------- */
.public-nav { display: flex; justify-content: space-between; align-items: center;
  max-width: 1080px; margin: 0 auto; padding: 1.2rem 1.25rem; }
.public-nav .links { display: flex; gap: .6rem; }
.hero { max-width: 1080px; margin: 0 auto; padding: 2.5rem 1.25rem 3rem;
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 3rem; align-items: center; }
.hero h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); line-height: 1.05; margin: 0 0 1rem; }
.hero h1 em { font-style: normal; background: var(--ember-grad); -webkit-background-clip: text;
  background-clip: text; color: transparent; }
.hero p { font-size: 1.15rem; color: var(--muted); max-width: 32rem; }
.hero .ctas { display: flex; gap: .75rem; flex-wrap: wrap; margin-top: 1.5rem; }
.hero-art { position: relative; height: 420px; }
.hero-card { position: absolute; width: 230px; height: 320px; border-radius: 22px; box-shadow: var(--shadow);
  background: var(--ember-grad); display: flex; align-items: flex-end; padding: 1rem; color: #fff;
  font: 700 1.2rem var(--head); }
.hero-card:nth-child(1) { left: 8%; top: 40px; transform: rotate(-8deg); background: linear-gradient(160deg, #f6a15b, #d4381f); }
.hero-card:nth-child(2) { left: 30%; top: 10px; transform: rotate(5deg); }
.hero-card small { display: block; font: 500 .85rem var(--body); opacity: .9; }
.features { max-width: 1080px; margin: 0 auto; padding: 0 1.25rem 3rem;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.feature { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.3rem; }
.feature h3 { margin: 0 0 .4rem; font-size: 1.05rem; }
.feature p { margin: 0; color: var(--muted); font-size: .95rem; }
.footer { max-width: 1080px; margin: 0 auto; padding: 2rem 1.25rem; color: var(--muted);
  font-size: .9rem; display: flex; gap: 1.2rem; flex-wrap: wrap; border-top: 1px solid var(--line); }
.footer a { color: var(--muted); }

.auth-wrap { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 1.5rem 1rem;
  background: radial-gradient(circle at 20% 10%, #ffe3d6, transparent 45%),
              radial-gradient(circle at 90% 90%, #ffd6e4, transparent 45%), var(--bg); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border-radius: 24px;
  box-shadow: var(--shadow); padding: 2rem 1.6rem; }
.auth-card h1 { margin: .8rem 0 .3rem; font-size: 1.6rem; }
.auth-card .sub { color: var(--muted); margin: 0 0 1.4rem; }
.field { margin-bottom: 1rem; }
.field label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .35rem; }
.field input, .field textarea, .field select { width: 100%; padding: .75rem .9rem; border-radius: 12px;
  border: 1.5px solid var(--control); font: 400 1rem var(--body); background: var(--surface); color: var(--text); }
.field input:focus, .field textarea:focus, .field select:focus { outline: 3px solid rgba(212, 56, 31, .25); border-color: var(--ember-1); }
.field .help { font-size: .82rem; color: var(--muted); margin-top: .25rem; }
.check { display: flex; gap: .6rem; align-items: flex-start; font-size: .9rem; margin: .4rem 0 1.2rem; }
.check input { margin-top: .25rem; width: 18px; height: 18px; accent-color: var(--ember-1); }
.errors { background: #fdecea; color: var(--bad); border-radius: 12px; padding: .7rem .9rem; font-size: .9rem; margin-bottom: 1rem; }
.errors p { margin: 0; }
.fine { text-align: center; color: var(--muted); font-size: .92rem; margin-top: 1.2rem; }
.prose { max-width: 760px; margin: 0 auto; padding: 1rem 1.25rem 3rem; }
.prose h1 { font-size: 2rem; }
.prose h2 { font-size: 1.2rem; margin-top: 2rem; }
.prose p, .prose li { color: #3a3240; }

/* ---------- Ads ---------- */
.ad-slot { margin: 1rem auto 0; width: 100%; max-width: 468px; text-align: center; }
.ad-slot .ad-label { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.ad-placeholder { height: 90px; border: 2px dashed var(--control); border-radius: 12px; display: grid;
  place-items: center; color: var(--muted); font-size: .85rem; background: var(--surface); }

/* ---------- App shell ---------- */
.app { max-width: 520px; margin: 0 auto; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar { display: flex; justify-content: space-between; align-items: center; padding: .9rem 1rem;
  position: sticky; top: 0; background: var(--bg); z-index: 5; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; border: 1.5px solid var(--control);
  background: var(--surface); display: grid; place-items: center; cursor: pointer; color: var(--text); font-size: 1rem; }
.view { flex: 1; padding: 0 1rem 6rem; min-height: 0; }
.tabbar { position: fixed; bottom: 0; left: 0; right: 0; background: var(--surface); border-top: 1px solid var(--line);
  display: flex; justify-content: center; z-index: 10; padding-bottom: env(safe-area-inset-bottom); }
.tabbar-inner { display: flex; width: 100%; max-width: 520px; }
.tab { flex: 1; background: none; border: 0; padding: .7rem 0 .8rem; font: 600 .78rem var(--head);
  color: var(--muted); cursor: pointer; display: flex; flex-direction: column; align-items: center; gap: .15rem; position: relative; }
.tab .ico { font-size: 1.3rem; line-height: 1; }
.tab[aria-selected="true"] { color: var(--ember-2); }
.badge { position: absolute; top: .35rem; left: calc(50% + 6px); background: var(--ember-2); color: #fff;
  border-radius: 999px; font-size: .68rem; padding: 0 .38rem; min-width: 18px; }

/* Deck */
/* Sized to leave room for the actions and one banner above the tab bar, so
   the ad is seen without scrolling - an ad below the fold earns nothing. */
.deck { position: relative; height: clamp(320px, calc(100vh - 360px), 580px);
  height: clamp(320px, calc(100dvh - 360px), 580px); margin-top: .25rem; }
.card { position: absolute; inset: 0; border-radius: 22px; overflow: hidden; background: #2a2226;
  box-shadow: var(--shadow); touch-action: none; user-select: none; cursor: grab; }
.card.dragging { cursor: grabbing; transition: none; }
.card.flying { transition: transform .35s ease-out, opacity .35s; }
.card img { width: 100%; height: 100%; object-fit: cover; pointer-events: none; display: block; }
.card .photo-bars { position: absolute; top: .6rem; left: .6rem; right: .6rem; display: flex; gap: 4px; }
.card .photo-bars span { flex: 1; height: 4px; border-radius: 2px; background: rgba(255,255,255,.4); }
.card .photo-bars span.on { background: #fff; }
.card .info { position: absolute; left: 0; right: 0; bottom: 0; padding: 4rem 1.1rem 1.1rem; color: #fff;
  background: linear-gradient(transparent, rgba(0,0,0,.82)); }
.card .info h2 { margin: 0; font-size: 1.7rem; }
.card .info h2 span { font-weight: 500; }
.card .info .meta { font-size: .92rem; opacity: .92; }
.card .info p { margin: .4rem 0 0; font-size: .95rem; max-height: 4.5em; overflow: hidden; }
.stamp { position: absolute; top: 2rem; padding: .3rem .8rem; border: 4px solid; border-radius: 10px;
  font: 800 2rem var(--head); opacity: 0; text-transform: uppercase; }
.stamp.like { left: 1.2rem; color: #3ddc84; border-color: #3ddc84; transform: rotate(-14deg); }
.stamp.nope { right: 1.2rem; color: #ff4d6d; border-color: #ff4d6d; transform: rotate(14deg); }
.deck-actions { display: flex; justify-content: center; gap: 1.4rem; margin-top: 1rem; }
.round { width: 64px; height: 64px; border-radius: 50%; border: 0; background: var(--surface); box-shadow: var(--shadow);
  font-size: 1.6rem; cursor: pointer; display: grid; place-items: center; }
.round.pass { color: #b3261e; }
.round.like { background: var(--ember-grad); color: #fff; }
.round:disabled { opacity: .45; cursor: default; }
.empty { text-align: center; padding: 3rem 1rem; color: var(--muted); }
.empty .big { font-size: 3rem; }
.empty h2 { color: var(--text); margin: .5rem 0; }

/* Matches */
.section-title { font: 700 1rem var(--head); margin: 1rem 0 .6rem; }
.new-matches { display: flex; gap: .8rem; overflow-x: auto; padding-bottom: .4rem; }
.new-match { flex: 0 0 auto; width: 76px; text-align: center; cursor: pointer; background: none; border: 0; padding: 0; color: var(--text); font: 600 .82rem var(--body); }
.new-match img { width: 76px; height: 96px; border-radius: 14px; object-fit: cover; display: block; margin-bottom: .3rem; border: 2.5px solid var(--ember-1); }
.convo { display: flex; gap: .8rem; align-items: center; padding: .7rem .2rem; border-bottom: 1px solid var(--line);
  cursor: pointer; background: none; border-left: 0; border-right: 0; border-top: 0; width: 100%; text-align: left; color: var(--text); font: inherit; }
.avatar { width: 56px; height: 56px; border-radius: 50%; object-fit: cover; flex: 0 0 auto; background: var(--surface-2); }
.convo .who { font-weight: 700; }
.convo .last { color: var(--muted); font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.convo .grow { min-width: 0; flex: 1; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--ember-2); flex: 0 0 auto; }

/* Chat */
.chat { position: fixed; inset: 0; background: var(--bg); z-index: 20; display: flex; flex-direction: column;
  height: 100vh; height: 100dvh; max-width: 520px; margin: 0 auto; }
.chat-head { display: flex; align-items: center; gap: .7rem; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: var(--surface); }
.chat-head .avatar { width: 40px; height: 40px; }
.chat-head .who { flex: 1; font-weight: 700; }
.chat-body { flex: 1; min-height: 0; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .35rem; }
.bubble { max-width: 78%; padding: .55rem .85rem; border-radius: 18px; background: var(--surface);
  border: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.bubble.mine { align-self: flex-end; background: var(--ember-grad); color: #fff; border: 0; }
.chat-note { text-align: center; color: var(--muted); font-size: .85rem; margin: 1rem 0; }
.seen { align-self: flex-end; font-size: .75rem; color: var(--muted); }
.compose { display: flex; gap: .5rem; padding: .7rem; border-top: 1px solid var(--line); background: var(--surface);
  padding-bottom: calc(.7rem + env(safe-area-inset-bottom)); }
.compose textarea { flex: 1; resize: none; border-radius: 20px; border: 1.5px solid var(--control); padding: .6rem .9rem;
  font: 400 1rem var(--body); max-height: 120px; }
.menu { position: absolute; right: 1rem; top: 3.6rem; background: var(--surface); border-radius: 12px; box-shadow: var(--shadow);
  overflow: hidden; z-index: 30; }
.menu button { display: block; width: 100%; padding: .75rem 1.2rem; background: none; border: 0; text-align: left; font: 500 .95rem var(--body); cursor: pointer; color: var(--text); }
.menu button.danger { color: var(--bad); }

/* Profile */
.photos { display: grid; grid-template-columns: repeat(3, 1fr); gap: .6rem; }
.slot { position: relative; aspect-ratio: 3/4; border-radius: 14px; overflow: hidden; background: var(--surface-2);
  border: 2px dashed var(--control); display: grid; place-items: center; }
.slot img { width: 100%; height: 100%; object-fit: cover; }
.slot .tag { position: absolute; left: .35rem; bottom: .35rem; font-size: .68rem; background: rgba(0,0,0,.65); color: #fff; padding: .1rem .45rem; border-radius: 999px; }
.slot .x { position: absolute; right: .3rem; top: .3rem; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; cursor: pointer; }
.slot .main { position: absolute; left: .3rem; top: .3rem; border: 0; border-radius: 999px; font-size: .68rem; padding: .15rem .5rem; cursor: pointer; background: rgba(255,255,255,.9); color: var(--text); }
.slot label { cursor: pointer; color: var(--muted); font-size: 2rem; width: 100%; height: 100%; display: grid; place-items: center; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 1.1rem; margin-top: 1rem; }
.panel h3 { margin: 0 0 .8rem; font-size: 1rem; }
.chips { display: flex; gap: .5rem; flex-wrap: wrap; }
.chip { border: 1.5px solid var(--control); border-radius: 999px; padding: .45rem .95rem; background: var(--surface); cursor: pointer; font: 600 .9rem var(--body); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--text); color: #fff; border-color: var(--text); }
.row { display: flex; gap: .8rem; }
.row .field { flex: 1; }
.notice { background: #fff4e5; border: 1px solid #f4cf9a; border-radius: 14px; padding: .8rem 1rem; font-size: .92rem; margin-top: .8rem; }
.notice.ok { background: #e8f5ee; border-color: #a9d8bd; }
.toast { position: fixed; left: 50%; bottom: 5.5rem; transform: translateX(-50%); background: var(--text); color: #fff;
  padding: .7rem 1.1rem; border-radius: 12px; z-index: 50; font-size: .92rem; max-width: 90vw; }

/* Modal */
.modal { position: fixed; inset: 0; background: rgba(20, 10, 15, .6); z-index: 40; display: grid; place-items: center; padding: 1rem; }
.modal-card { background: var(--surface); border-radius: 24px; padding: 1.6rem; width: 100%; max-width: 400px; text-align: center; }
.modal-card.match { background: var(--ember-grad); color: #fff; }
.modal-card.match h2 { font-size: 2.2rem; margin: .2rem 0 1rem; }
.pair { display: flex; justify-content: center; margin-bottom: 1.2rem; }
.pair img { width: 104px; height: 104px; border-radius: 50%; object-fit: cover; border: 4px solid #fff; }
.pair img + img { margin-left: -18px; }
.modal-card .stack { display: flex; flex-direction: column; gap: .6rem; }
.modal-card.match .btn-ghost { background: transparent; color: #fff; border-color: #fff; }
.modal-card.match .btn-light { background: #fff; color: var(--ember-2); }
.reasons { text-align: left; display: flex; flex-direction: column; gap: .4rem; margin: .8rem 0; }
.reasons label { display: flex; gap: .6rem; align-items: center; padding: .5rem .6rem; border: 1.5px solid var(--line); border-radius: 10px; cursor: pointer; }

@media (max-width: 800px) {
  .hero { grid-template-columns: 1fr; padding-top: 1rem; gap: 1rem; }
  .hero-art { height: 300px; }
  .hero-card { width: 170px; height: 240px; }
  .features { grid-template-columns: 1fr; }
}
