/* Social Media 2.0 — demo v0.1
   Calm, simple, mobile-first. No noise, no red dots. */

:root {
  --bg: #f6f5f2;
  --card: #ffffff;
  --ink: #1e1e1c;
  --muted: #85837d;
  --line: #e8e6e0;
  --accent: #2f6b4f;
  --accent-soft: #e7efe9;
  --amber-soft: #f5efe2;
  --radius: 18px;
  --nav-h: 64px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  font-size: 16px;
  line-height: 1.45;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
}

/* On desktop, frame the phone experience subtly */
@media (min-width: 560px) {
  body { background: #ecebe7; }
  .app { background: var(--bg); box-shadow: 0 0 40px rgba(0,0,0,.06); }
}

/* ---------- Header ---------- */
.header {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) 20px 12px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}
.header h1 { font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.lang-toggle {
  display: flex; border: 1px solid var(--line); border-radius: 999px;
  overflow: hidden; background: var(--card);
}
.lang-toggle button {
  border: 0; background: transparent; padding: 5px 12px;
  font-size: 13px; font-weight: 600; color: var(--muted); cursor: pointer;
}
.lang-toggle button.on { background: var(--ink); color: #fff; }

/* ---------- Screens / content ---------- */
.screen { padding: 0 16px calc(var(--nav-h) + env(safe-area-inset-bottom) + 24px); }

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 12px;
}

.post-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.avatar {
  width: 42px; height: 42px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; color: #fff; flex-shrink: 0;
}
.post-who { flex: 1; min-width: 0; }
.post-name { font-weight: 650; font-size: 15px; }
.post-meta { font-size: 12.5px; color: var(--muted); }

.chip {
  display: inline-block; font-size: 11.5px; font-weight: 600;
  padding: 2px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent);
}
.chip.warm { background: var(--amber-soft); color: #8a6d1f; }

.post-text { font-size: 15.5px; margin-bottom: 10px; white-space: pre-line; }

.photo {
  border-radius: 14px; height: 210px; margin-bottom: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 64px;
}

.post-actions { display: flex; gap: 18px; align-items: center; }
.act {
  display: flex; align-items: center; gap: 6px;
  border: 0; background: none; cursor: pointer;
  font-size: 13.5px; color: var(--muted); font-weight: 550; padding: 4px 0;
}
.act svg { width: 19px; height: 19px; }
.act.liked { color: var(--accent); }
.act.liked svg { fill: var(--accent); stroke: var(--accent); }
.private-note { font-size: 12px; color: var(--muted); margin-top: 8px; }

/* Intro (second-degree) card */
.intro-card { border-color: var(--accent); border-width: 1.5px; }
.intro-quote {
  font-style: italic; color: var(--muted); font-size: 14.5px;
  border-left: 3px solid var(--line); padding-left: 10px; margin: 8px 0 12px;
}
.btn-row { display: flex; gap: 10px; }
.btn {
  flex: 1; border: 0; border-radius: 12px; padding: 12px;
  font-size: 15px; font-weight: 650; cursor: pointer;
  font-family: inherit;
}
.btn.primary { background: var(--accent); color: #fff; }
.btn.ghost { background: transparent; border: 1px solid var(--line); color: var(--ink); }
.btn.full { width: 100%; flex: none; }
.btn:active { transform: scale(.98); }

/* Caught-up end card */
.caught-up {
  text-align: center; padding: 36px 20px 20px; color: var(--muted);
}
.caught-up .big { font-size: 34px; margin-bottom: 8px; }
.caught-up p { font-size: 14.5px; max-width: 260px; margin: 0 auto; }

/* ---------- Community ---------- */
.seg-chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 14px; scrollbar-width: none; }
.seg-chips::-webkit-scrollbar { display: none; }
.seg-chips button {
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  border-radius: 999px; padding: 8px 16px; font-size: 14px; font-weight: 600;
  cursor: pointer; white-space: nowrap; font-family: inherit;
}
.seg-chips button.on { background: var(--ink); color: #fff; border-color: var(--ink); }

.listing { display: flex; gap: 12px; }
.listing .thumb {
  width: 72px; height: 72px; border-radius: 12px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 34px;
}
.listing .l-body { flex: 1; min-width: 0; }
.listing .l-title { font-weight: 650; font-size: 15.5px; }
.listing .l-price { font-weight: 700; color: var(--accent); font-size: 15.5px; }
.listing .l-trust { font-size: 12.5px; color: var(--muted); margin-top: 4px; }

.trust-badge {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; color: var(--accent); font-weight: 600;
  margin-top: 4px;
}
.trust-badge svg { width: 13px; height: 13px; flex-shrink: 0; }

/* ---------- Messages ---------- */
.thread { display: flex; gap: 12px; align-items: center; padding: 14px 4px; border-bottom: 1px solid var(--line); cursor: pointer; }
.thread:last-child { border-bottom: 0; }
.thread .t-body { flex: 1; min-width: 0; }
.thread .t-name { font-weight: 650; font-size: 15px; }
.thread .t-last { font-size: 13.5px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread .t-time { font-size: 12px; color: var(--muted); }
.e2e-note {
  text-align: center; font-size: 12.5px; color: var(--muted);
  padding: 14px 30px 4px;
}

.chat { display: flex; flex-direction: column; gap: 8px; padding-bottom: 12px; }
.bubble {
  max-width: 78%; padding: 10px 14px; border-radius: 18px; font-size: 15px;
}
.bubble.them { background: var(--card); border: 1px solid var(--line); align-self: flex-start; border-bottom-left-radius: 6px; }
.bubble.me { background: var(--accent); color: #fff; align-self: flex-end; border-bottom-right-radius: 6px; }
.chat-input { display: flex; gap: 8px; position: sticky; bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 12px); }
.chat-input input {
  flex: 1; border: 1px solid var(--line); border-radius: 999px;
  padding: 12px 16px; font-size: 15px; font-family: inherit; background: var(--card);
  outline: none;
}
.chat-input button {
  border: 0; background: var(--accent); color: #fff; border-radius: 999px;
  width: 46px; height: 46px; font-size: 18px; cursor: pointer; flex-shrink: 0;
}
.back-link {
  display: inline-flex; align-items: center; gap: 4px;
  border: 0; background: none; color: var(--accent); font-weight: 650;
  font-size: 15px; cursor: pointer; padding: 8px 0; font-family: inherit;
}

/* ---------- Profile ---------- */
.profile-hero { text-align: center; padding: 18px 0 6px; }
.profile-hero .avatar { width: 76px; height: 76px; font-size: 26px; margin: 0 auto 10px; }
.profile-hero h2 { font-size: 21px; letter-spacing: -0.02em; }
.visibility-line { color: var(--muted); font-size: 14px; margin-top: 4px; }
.visibility-line strong { color: var(--accent); }

.section-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--muted); margin: 20px 4px 8px;
}
.row { display: flex; align-items: center; justify-content: space-between; padding: 13px 0; border-bottom: 1px solid var(--line); gap: 12px; }
.row:last-child { border-bottom: 0; }
.row .r-label { font-size: 15px; font-weight: 550; }
.row .r-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.row .r-val { font-size: 14px; color: var(--muted); white-space: nowrap; }
.danger { color: #a33d2e; }

/* Toggle switch */
.switch { position: relative; width: 46px; height: 28px; flex-shrink: 0; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span {
  position: absolute; inset: 0; border-radius: 999px; background: var(--line);
  transition: .18s; cursor: pointer;
}
.switch span::after {
  content: ""; position: absolute; width: 22px; height: 22px; border-radius: 50%;
  background: #fff; top: 3px; left: 3px; transition: .18s;
  box-shadow: 0 1px 3px rgba(0,0,0,.2);
}
.switch input:checked + span { background: var(--accent); }
.switch input:checked + span::after { transform: translateX(18px); }

.invite-count { font-size: 40px; font-weight: 800; letter-spacing: -0.03em; }

/* ---------- Bottom nav ---------- */
.nav {
  position: fixed; bottom: 0; left: 50%; transform: translateX(-50%);
  width: 100%; max-width: 480px; z-index: 30;
  display: flex;
  background: color-mix(in srgb, var(--card) 92%, transparent);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  padding-bottom: env(safe-area-inset-bottom);
}
.nav button {
  flex: 1; border: 0; background: none; cursor: pointer;
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 10px 0 8px; color: var(--muted); font-size: 11px; font-weight: 600;
  font-family: inherit;
}
.nav button svg { width: 23px; height: 23px; }
.nav button.on { color: var(--ink); }

/* center mark: the circles of your life, dead center and monochrome */
.nav button[data-id="profile"] { flex: 2; }
.nav .nav-circles { flex: 1.6; overflow: visible; padding: 0; }
.nav-circles-mark {
  width: 56px; height: 56px; margin-top: -20px; border-radius: 50%;
  background: var(--card); border: 1px solid var(--line);
  box-shadow: 0 4px 16px rgba(0, 0, 0, .12);
  display: flex; align-items: center; justify-content: center;
}
.nav-circles-mark svg { width: 34px; height: 34px; }
.nav .nav-circles.on .nav-circles-mark { border-color: var(--ink); }

/* Circles tab: people rows + person profile */
.person-row { cursor: pointer; }
.person-row .avatar { flex: none; }
.person-row .p-main { flex: 1; min-width: 0; }
.person-row .chev { color: var(--muted); flex: none; }
.circle-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.circle-pick button {
  border: 1px solid var(--line); background: none; border-radius: 999px;
  padding: 8px 16px; font-size: 14px; font-weight: 600; color: var(--muted);
  font-family: inherit; cursor: pointer;
}
.circle-pick button.on {
  background: var(--accent); border-color: var(--accent); color: #fff;
}
.back-btn {
  border: 0; background: none; font-family: inherit; cursor: pointer;
  color: var(--accent); font-size: 15px; font-weight: 600;
  padding: 0 0 12px; display: inline-flex; align-items: center; gap: 4px;
}

/* ---------- Onboarding ---------- */
.onb {
  min-height: 100dvh; display: flex; flex-direction: column;
  justify-content: center; padding: 32px 24px calc(env(safe-area-inset-bottom) + 32px);
}
.onb .logo-mark {
  width: 84px; height: 84px; display: block; margin: 0 auto 10px;
}
.onb .wordmark {
  font-size: 15px; font-weight: 700; letter-spacing: .04em; color: var(--accent);
  text-align: center; margin-bottom: 26px;
}
.onb h2 { font-size: 25px; letter-spacing: -0.02em; text-align: center; margin-bottom: 10px; }
.onb .sub { text-align: center; color: var(--muted); font-size: 15px; margin-bottom: 26px; }
.onb .card { padding: 22px; }
.onb .big-emoji { font-size: 52px; text-align: center; margin-bottom: 14px; }

.code-boxes { display: flex; gap: 8px; justify-content: center; margin: 18px 0 22px; }
.code-boxes span {
  width: 44px; height: 54px; border: 1.5px solid var(--line); border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  font-size: 24px; font-weight: 700; background: var(--card);
}
.code-boxes span.filled { border-color: var(--accent); }

.field { margin-bottom: 14px; }
.field label { display: block; font-size: 13px; font-weight: 650; color: var(--muted); margin-bottom: 6px; }
.field input {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 13px 14px; font-size: 16px; font-family: inherit; background: var(--card);
  outline: none;
}
.field input:focus { border-color: var(--accent); }

.faceid {
  width: 92px; height: 92px; margin: 6px auto 18px; border-radius: 26px;
  border: 2.5px solid var(--accent); display: flex; align-items: center; justify-content: center;
  font-size: 44px; transition: .3s;
}
.faceid.ok { background: var(--accent-soft); }

.dots { display: flex; gap: 7px; justify-content: center; margin-top: 26px; }
.dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--line); }
.dots i.on { background: var(--accent); }

.fineprint { text-align: center; font-size: 12px; color: var(--muted); margin-top: 18px; }

/* ---------- Create button + Stories ---------- */
.plus-btn {
  width: 34px; height: 34px; border-radius: 50%;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.plus-btn svg { width: 18px; height: 18px; }

.stories-strip {
  display: flex; gap: 14px; overflow-x: auto; padding: 2px 0 14px;
  scrollbar-width: none;
}
.stories-strip::-webkit-scrollbar { display: none; }
.story-bubble {
  border: 0; background: none; cursor: pointer; font-family: inherit;
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  flex-shrink: 0; width: 66px; padding: 0;
}
.story-ring {
  width: 62px; height: 62px; border-radius: 50%; padding: 3px;
  background: conic-gradient(var(--accent), #c98a5b, #4f7fa8, var(--accent));
  display: flex; align-items: center; justify-content: center;
}
.story-ring.add { background: var(--line); }
.story-av {
  width: 100%; height: 100%; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-weight: 700; font-size: 18px;
  border: 2.5px solid var(--bg); box-sizing: border-box; object-fit: cover;
}
.story-name {
  font-size: 11.5px; font-weight: 600; color: var(--muted);
  max-width: 66px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.story-viewer {
  position: fixed; inset: 0; z-index: 60; background: #111;
  display: flex; align-items: center; justify-content: center;
}
.story-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 61;
  display: flex; align-items: center; justify-content: space-between;
  padding: calc(env(safe-area-inset-top) + 14px) 18px 10px;
  background: linear-gradient(rgba(0,0,0,.55), transparent);
}
.story-who { color: #fff; font-size: 14px; font-weight: 600; }
.story-close {
  border: 0; background: none; color: #fff; font-size: 22px; cursor: pointer; padding: 4px 8px;
}
.story-media { max-width: 100%; max-height: 100dvh; object-fit: contain; }

/* ---------- Camera create ---------- */
.cam-shell {
  position: fixed; inset: 0; z-index: 70; background: #000;
  display: flex; flex-direction: column;
}
.cam-shell video#cam-video {
  flex: 1; width: 100%; object-fit: cover; min-height: 0;
}
.cam-top {
  position: absolute; top: 0; left: 0; right: 0; z-index: 71;
  display: flex; justify-content: space-between; align-items: center;
  padding: calc(env(safe-area-inset-top) + 14px) 18px 10px;
  background: linear-gradient(rgba(0,0,0,.45), transparent);
}
.cam-icon {
  border: 0; background: none; color: #fff; font-size: 19px;
  font-weight: 600; cursor: pointer; padding: 6px 8px; font-family: inherit;
}
.cam-bottom {
  position: absolute; bottom: 0; left: 0; right: 0; z-index: 71;
  padding: 14px 24px calc(env(safe-area-inset-bottom) + 18px);
  background: linear-gradient(transparent, rgba(0,0,0,.55));
}
.cam-row { display: flex; align-items: center; justify-content: space-between; }
.cam-shutter {
  width: 72px; height: 72px; border-radius: 50%; cursor: pointer;
  background: rgba(255,255,255,.25); border: 5px solid #fff;
}
.cam-shutter:active { transform: scale(.94); }
.cam-gal { font-size: 30px; cursor: pointer; }
.cam-modes { display: flex; justify-content: center; gap: 26px; margin-top: 16px; }
.cam-modes button {
  border: 0; background: none; color: rgba(255,255,255,.55);
  font-size: 13.5px; font-weight: 700; letter-spacing: .08em; cursor: pointer;
  font-family: inherit; padding: 4px 2px;
}
.cam-modes button.on { color: #fff; border-bottom: 2px solid #fff; }
.cam-preview { flex: 1; width: 100%; object-fit: contain; min-height: 0; }
.cam-panel {
  padding: 14px 16px calc(env(safe-area-inset-bottom) + 16px);
  background: #161614; display: flex; flex-direction: column; gap: 10px;
}
.cam-panel select, .cam-panel textarea {
  width: 100%; border: 1.5px solid #333; border-radius: 12px;
  padding: 12px 14px; font-size: 16px; font-family: inherit;
  background: #222; color: #fff; outline: none;
}

/* ---------- Photos ---------- */
.post-photo {
  width: 100%; max-height: 420px; object-fit: cover;
  border-radius: 14px; margin-bottom: 10px;
}
.avatar-img { object-fit: cover; }
img.avatar { border: 0; }
.photo-pick {
  display: inline-block; cursor: pointer;
  border: 1px solid var(--line); border-radius: 999px;
  padding: 8px 16px; font-size: 14px; font-weight: 600;
  background: var(--card); margin: 6px 0 4px;
}

/* ---------- Composer ---------- */
.composer-overlay {
  position: fixed; inset: 0; z-index: 40;
  background: rgba(20,20,18,.45);
  display: flex; align-items: flex-end; justify-content: center;
}
.composer-card {
  width: 100%; max-width: 480px; margin: 0;
  border-radius: 22px 22px 0 0;
  padding: 22px 20px calc(env(safe-area-inset-bottom) + 22px);
  animation: sheet-up .22s ease;
}
@keyframes sheet-up { from { transform: translateY(30px); opacity: .6; } }
.field select, .field textarea {
  width: 100%; border: 1.5px solid var(--line); border-radius: 12px;
  padding: 13px 14px; font-size: 16px; font-family: inherit; background: var(--card);
  outline: none; resize: vertical;
}
.field select:focus, .field textarea:focus { border-color: var(--accent); }

/* ---------- Toast ---------- */
.toast {
  position: fixed; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--nav-h) + env(safe-area-inset-bottom) + 20px);
  background: var(--ink); color: #fff; font-size: 14px; font-weight: 550;
  padding: 11px 18px; border-radius: 999px; z-index: 50;
  max-width: 88%; text-align: center;
  animation: toast-in .25s ease;
}
@keyframes toast-in { from { opacity: 0; transform: translateX(-50%) translateY(8px); } }

.fade-in { animation: fade .3s ease; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } }
