:root {
  --bg: #f6f8f7;
  --surface: #ffffff;
  --surface-2: #eef3f1;
  --text: #15201c;
  --muted: #5d6b66;
  --line: #dde5e2;
  --brand: #2fbf8f;
  --brand-ink: #0b3d2c;
  --danger: #c2413b;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(0,0,0,.05), 0 4px 16px rgba(0,0,0,.05);
  --accent: var(--brand);
  --accent-ink: #ffffff;
  --brand-dark: #1f9c72;
  --on-brand: #15201c;    /* text on accent-coloured buttons (dark reads better on the default mint) */
  --brand-text: #1a8461;  /* accent used as text, readable on the background */
}
/* Default dark colours for signed-out visitors. Signed-in users get their own theme from app.js. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0e1412;
    --surface: #161e1b;
    --surface-2: #1d2724;
    --text: #e7efec;
    --muted: #93a39d;
    --line: #2a3632;
    --brand-ink: #c9f3e3;
    --brand-text: #3fd1a0;
    --shadow: none;
  }
}
:root[data-theme="dark"] { --shadow: none; }

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 16px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  padding-bottom: calc(72px + env(safe-area-inset-bottom));
}
a { color: inherit; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.15rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

.topbar {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-size: 1.2rem; text-decoration: none; display: flex; align-items: center; gap: 8px; }
.brand-dot { width: 14px; height: 14px; border-radius: 50%; background: var(--brand); display: inline-block; }
.brand-logo { width: 26px; height: 26px; display: block; flex: none; object-fit: contain; }
.proto-tag { font-size: .7rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); border: 1px solid var(--line); border-radius: 99px; padding: 2px 8px; }

main { max-width: 720px; margin: 0 auto; padding: 16px; outline: none; }

.tabbar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 5;
  display: flex; justify-content: space-around;
  background: var(--surface); border-top: 1px solid var(--line);
  padding: 6px 0 calc(6px + env(safe-area-inset-bottom));
}
.tabbar[hidden] { display: none; }
.tabbar a { flex: 1; text-align: center; text-decoration: none; color: var(--muted); font-size: .75rem; padding: 4px 0; }
.tabbar a .ico { display: block; width: 24px; height: 24px; margin: 0 auto 2px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tabbar a.active .ico { stroke-width: 2.4; }
.ico-wrap { position: relative; display: block; width: 24px; margin: 0 auto; }
.badge { position: absolute; top: -4px; right: -10px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 99px; background: var(--danger); color: #fff; font-size: .68rem; font-weight: 800; line-height: 18px; text-align: center; border: 2px solid var(--surface); }
.badge[hidden] { display: none; }
.tabbar a.active { color: var(--brand-text); font-weight: 600; }

.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 14px; box-shadow: var(--shadow); }
.card > h2 { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 10px; padding: 10px 16px; font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
  min-height: 44px;
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--brand-fill, var(--brand)); border-color: var(--brand-fill, var(--brand)); color: var(--on-brand); }
.btn.primary:hover { filter: brightness(.95); }
.btn.danger { color: var(--danger); }
.btn.small { padding: 6px 10px; min-height: 34px; font-size: .85rem; }
.btn.block { width: 100%; }
.btn[disabled] { opacity: .55; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.spacer { flex: 1; }

label { display: block; font-weight: 600; font-size: .9rem; margin: 10px 0 4px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], textarea, select {
  width: 100%; font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; min-height: 44px;
}
textarea { min-height: 84px; resize: vertical; }
input:focus, textarea:focus, select:focus, .btn:focus-visible { outline: 2px solid var(--brand); outline-offset: 1px; }
input[type=color] { width: 52px; height: 44px; border: 1px solid var(--line); border-radius: 10px; padding: 2px; background: var(--surface); }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; }
.check input { margin-top: 4px; width: 18px; height: 18px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
@media (max-width: 480px) { .grid2 { grid-template-columns: 1fr; } }

.vis { width: auto; min-height: 34px; padding: 4px 8px; font-size: .8rem; font-weight: 500; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 6px 0; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 99px; padding: 4px 10px; font-size: .85rem; }
.chip.shared { background: color-mix(in srgb, var(--brand) 18%, var(--surface)); border-color: var(--brand); font-weight: 600; }
.chip button { border: 0; background: none; color: var(--muted); cursor: pointer; font-size: 1rem; line-height: 1; padding: 0 0 0 2px; }
.chip .lvl { color: var(--muted); font-size: .75rem; }

.list-item { border-top: 1px solid var(--line); padding: 10px 0; display: flex; gap: 10px; align-items: flex-start; }
.list-item:first-of-type { border-top: 0; }
.list-item .grow { flex: 1; min-width: 0; }

/* Profile */
.hero { border-radius: var(--radius); padding: 22px 18px; background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 72%, #000)); color: var(--accent-ink); margin-bottom: 14px; position: relative; overflow: hidden; }
.hero::after { content: ""; position: absolute; right: -60px; top: -60px; width: 200px; height: 200px; border-radius: 50%; border: 24px solid rgba(255,255,255,.08); pointer-events: none; }
.welcome-logo { width: 72px; height: 72px; border-radius: 18px; margin: 0 auto 16px; display: block; box-shadow: 0 8px 24px rgba(0,0,0,.18); }
.hero .avatar { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1.6rem; background: rgba(255,255,255,.22); border: 2px solid currentColor; margin-bottom: 10px; }
.hero h1 { margin: 0; }
.hero .handle { opacity: .85; }
.hero .meta { margin-top: 8px; font-size: .9rem; opacity: .9; }
.hero .actions { margin-top: 14px; }
.hero .btn { background: rgba(255,255,255,.92); color: #15201c; border-color: transparent; }
.hero .btn.ghost { background: transparent; color: inherit; border-color: currentColor; }
.avatar, .avatar-sm { overflow: hidden; }
.avatar img, .avatar-sm img { width: 100%; height: 100%; object-fit: cover; display: block; }
.has-photo { background: var(--surface-2) !important; }
.photo-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
.photo-preview { width: 88px; height: 88px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 1.8rem; flex: none; border: 2px solid var(--line); }
.photo-row .grow { flex: 1; min-width: 200px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.notice { border-color: #e0b100; background: color-mix(in srgb, #e0b100 10%, var(--surface)); }
.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 10px 0 6px; }
.stat { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; text-align: center; }
.stat strong { display: block; font-size: 1.3rem; }
.stat span { font-size: .75rem; color: var(--muted); }
.pill { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: 2px 8px; border-radius: 99px; background: var(--surface-2); color: var(--muted); }
.pill.danger { background: color-mix(in srgb, var(--danger) 18%, var(--surface)); color: var(--danger); }
.colour-swatch { display: inline-block; width: 14px; height: 14px; border-radius: 4px; vertical-align: -2px; border: 1px solid rgba(0,0,0,.2); }
.fav-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.fav { background: var(--surface-2); border-radius: 10px; padding: 10px; }
.fav.is-shared { background: color-mix(in srgb, var(--brand) 18%, var(--surface)); outline: 1px solid var(--brand); font-weight: 600; }
.fav .k { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.lock { font-size: .75rem; color: var(--muted); font-weight: 500; }

.meter { height: 8px; background: var(--surface-2); border-radius: 99px; overflow: hidden; margin: 6px 0; }
.meter > span { display: block; height: 100%; background: var(--brand); border-radius: 99px; transition: width .3s; }

/* Discover */
.person { display: flex; gap: 12px; align-items: flex-start; text-decoration: none; }
.person .avatar-sm { flex: none; width: 48px; height: 48px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; color: #fff; }
.person .grow { flex: 1; min-width: 0; }
.score { font-weight: 800; color: var(--brand-text); white-space: nowrap; }
.segmented { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0 14px; }
.segmented button { border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 99px; padding: 6px 12px; font: inherit; font-size: .85rem; cursor: pointer; min-height: 36px; }
.segmented button.on { background: var(--brand-fill, var(--brand)); color: var(--on-brand); border-color: var(--brand-fill, var(--brand)); }

.welcome { text-align: center; padding: 24px 4px; }
.welcome .big { font-size: 2rem; font-weight: 800; line-height: 1.15; margin-bottom: 10px; }
.empty { text-align: center; padding: 28px 10px; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: calc(84px + env(safe-area-inset-bottom)); transform: translateX(-50%) translateY(20px); background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 10px; font-size: .9rem; opacity: 0; pointer-events: none; transition: .2s; z-index: 10; max-width: calc(100% - 32px); }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Appearance editor */
.swatches { display: grid; grid-template-columns: repeat(8, 1fr); gap: 8px; margin: 4px 0 6px; }
.swatch { aspect-ratio: 1; width: 100%; min-height: 34px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.swatch[aria-checked="true"] { outline: 3px solid var(--text); outline-offset: 2px; }
.hue-range, .sat-range { -webkit-appearance: none; appearance: none; width: 100%; height: 14px; border-radius: 99px; border: 1px solid var(--line); margin: 4px 0; padding: 0; }
.hue-range { background: linear-gradient(90deg, hsl(0 80% 50%), hsl(60 80% 50%), hsl(120 80% 50%), hsl(180 80% 50%), hsl(240 80% 50%), hsl(300 80% 50%), hsl(359 80% 50%)); }
.sat-range { background: linear-gradient(90deg, hsl(var(--h, 160) 25% 50%), hsl(var(--h, 160) 95% 50%)); }
.hue-range::-webkit-slider-thumb, .sat-range::-webkit-slider-thumb { -webkit-appearance: none; width: 26px; height: 26px; border-radius: 50%; background: #fff; border: 2px solid #15201c; box-shadow: 0 1px 4px rgba(0,0,0,.3); cursor: pointer; }
.hue-range::-moz-range-thumb, .sat-range::-moz-range-thumb { width: 24px; height: 24px; border-radius: 50%; background: #fff; border: 2px solid #15201c; cursor: pointer; }
.accent-chip { width: 28px; height: 28px; border-radius: 8px; border: 1px solid var(--line); display: inline-block; }
.theme-preview { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; padding: 12px; border-radius: 12px; background: var(--bg); border: 1px dashed var(--line); }
@media (max-width: 380px) { .swatches { grid-template-columns: repeat(6, 1fr); } }
/* Polish: transitions, loading placeholders, sheets, empty states */
main.enter { animation: pond-enter .22s ease-out; }
@keyframes pond-enter { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.skel-card { display: flex; gap: 12px; align-items: center; }
.skel { background: linear-gradient(90deg, var(--surface-2) 0%, var(--line) 50%, var(--surface-2) 100%); background-size: 200% 100%; animation: pond-shimmer 1.2s linear infinite; border-radius: 8px; }
.skel-avatar { width: 48px; height: 48px; border-radius: 50%; flex: none; }
.skel-line { height: 12px; margin: 8px 0; }
@keyframes pond-shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.sheet-backdrop { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,0); display: flex; align-items: flex-end; justify-content: center; transition: background .18s; }
.sheet-backdrop[hidden] { display: none; }
.sheet-backdrop.open { background: rgba(0,0,0,.45); }
.sheet { width: 100%; max-width: 560px; max-height: 88vh; overflow: auto; background: var(--surface); color: var(--text); border-radius: 20px 20px 0 0; padding: 10px 18px calc(18px + env(safe-area-inset-bottom)); transform: translateY(100%); transition: transform .2s ease-out; box-shadow: 0 -8px 30px rgba(0,0,0,.25); }
.sheet-backdrop.open .sheet { transform: none; }
@media (min-width: 600px) { .sheet-backdrop { align-items: center; } .sheet { border-radius: 20px; } }
.sheet-grip { width: 40px; height: 5px; border-radius: 99px; background: var(--line); margin: 0 auto 14px; }
.sheet h2 { margin-bottom: 6px; }
.sheet-actions { display: flex; gap: 10px; margin-top: 16px; }
.sheet-actions .btn { flex: 1; }
.btn.danger-fill { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn.danger-fill:hover { filter: brightness(.95); background: var(--danger); }
.reasons { display: grid; gap: 6px; margin: 12px 0 4px; }
.reason { display: flex; gap: 10px; align-items: center; font-weight: 500; margin: 0; padding: 12px; border: 1px solid var(--line); border-radius: 12px; cursor: pointer; }
.reason:has(input:checked) { border-color: var(--brand-fill, var(--brand)); background: color-mix(in srgb, var(--brand) 10%, var(--surface)); }
.reason input { width: 18px; height: 18px; accent-color: var(--brand-fill, var(--brand)); }
.empty-state { text-align: center; padding: 32px 16px; }
.empty-state img { border-radius: 16px; margin-bottom: 10px; }
.empty-state h2 { margin-bottom: 6px; }
.empty-state p { max-width: 340px; margin: 0 auto 16px; }
@media (prefers-reduced-motion: reduce) {
  main.enter, .skel { animation: none; }
  .sheet, .sheet-backdrop { transition: none; }
}
/* Profile: basics, personality, own boxes */
.facts { display: grid; gap: 8px; }
.fact { display: flex; align-items: baseline; gap: 10px; padding: 10px 12px; background: var(--surface-2); border-radius: 10px; flex-wrap: wrap; }
.fact .k { font-size: .75rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); min-width: 92px; }
.fact .v { font-weight: 600; flex: 1; }
.type-chip { background: var(--brand-fill, var(--brand)); color: var(--on-brand); border-color: transparent; font-weight: 800; letter-spacing: .04em; }
.basic-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 12px; }
.basic-row label { margin: 0; }
.custom-box { border: 1px solid var(--line); border-radius: 12px; padding: 10px 12px; margin: 8px 0; }

/* Groups */
.group-card { display: flex; gap: 12px; align-items: flex-start; text-decoration: none; }
.group-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; font-weight: 800; flex: none; }
.group-icon.lg { width: 60px; height: 60px; border-radius: 18px; font-size: 1.3rem; border: 2px solid rgba(255,255,255,.5); }
.clamp2, .clamp3 { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; }
.clamp2 { -webkit-line-clamp: 2; }
.clamp3 { -webkit-line-clamp: 3; }
.group-hero { margin: 8px 0 12px; padding: 18px; border-radius: var(--radius); background: linear-gradient(140deg, var(--gc), color-mix(in srgb, var(--gc) 70%, #000)); color: var(--gi); }
.group-hero h1 { margin: 0; font-size: 1.4rem; }
.group-hero .btn { background: rgba(255,255,255,.92); color: #15201c; border-color: transparent; }
.group-hero .btn.ghost { background: transparent; color: inherit; border-color: currentColor; }
.channels { display: flex; gap: 6px; overflow-x: auto; padding: 2px 0 8px; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.channels::-webkit-scrollbar { display: none; }
.channels button { flex: none; border: 1px solid var(--line); background: var(--surface); color: var(--text); border-radius: 10px; padding: 7px 12px; font: inherit; font-size: .88rem; font-weight: 600; cursor: pointer; min-height: 38px; }
.channels button.on { background: var(--surface-2); border-color: var(--brand-text); color: var(--brand-text); }
.post-card { display: flex; gap: 10px; align-items: flex-start; }
.post-link { text-decoration: none; min-width: 0; }
.post-title { margin: 4px 0 6px; font-size: 1.05rem; overflow-wrap: anywhere; }
.chan { color: var(--brand-text); font-weight: 600; }
.votes { display: flex; flex-direction: column; align-items: center; gap: 2px; min-width: 40px; }
.vote { border: 0; background: none; color: var(--muted); font-size: 1rem; cursor: pointer; width: 40px; height: 32px; border-radius: 8px; }
.vote:hover { background: var(--surface-2); }
.vote.up.on { color: var(--brand-text); }
.vote.down.on { color: var(--danger); }
.score-n { font-weight: 800; font-size: .95rem; }
.post-body { white-space: pre-line; overflow-wrap: anywhere; margin: 12px 0 0; }
.author-line { display: inline-flex; align-items: center; gap: 8px; text-decoration: none; font-size: .9rem; }
.avatar-xs { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .75rem; flex: none; overflow: hidden; }
.avatar-xs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.comment { display: flex; gap: 10px; padding: 12px 0; border-top: 1px solid var(--line); }
.comment a { text-decoration: none; }
.comment-body { margin: 2px 0 4px; white-space: pre-line; overflow-wrap: anywhere; }
.comment-actions { gap: 14px; }
.linkish { border: 0; background: none; padding: 4px 0; color: var(--muted); font: inherit; font-size: .8rem; font-weight: 600; cursor: pointer; }
.linkish:hover { color: var(--text); }
.small-swatches { grid-template-columns: repeat(10, 1fr); }
@media (max-width: 400px) { .small-swatches { grid-template-columns: repeat(5, 1fr); } }
.reported-content { margin-top: 10px; padding: 10px 12px; border-left: 3px solid var(--danger); background: var(--surface-2); border-radius: 0 10px 10px 0; }
.tabbar a { font-size: .7rem; }
/* Boards, aesthetic collage, photo viewer */
.collage { columns: 3 110px; column-gap: 6px; }
.collage-item { display: block; width: 100%; margin: 0 0 6px; padding: 0; border: 0; border-radius: 10px; overflow: hidden; cursor: zoom-in; break-inside: avoid; background: var(--surface-2); }
.collage-item img { width: 100%; height: auto; display: block; }
.thumb-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; }
.thumb-grid.four { grid-template-columns: repeat(4, 1fr); }
.thumb { position: relative; aspect-ratio: 1; border-radius: 10px; overflow: hidden; border: 0; padding: 0; background: var(--surface-2); cursor: zoom-in; display: block; }
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.thumb .more { position: absolute; inset: 0; display: grid; place-items: center; background: rgba(0,0,0,.5); color: #fff; font-weight: 800; font-size: 1.2rem; }
.add-thumb { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border: 2px dashed var(--line); background: transparent; color: var(--muted); cursor: pointer; margin: 0; font-weight: 600; }
.add-thumb span[aria-hidden] { font-size: 1.6rem; line-height: 1; }
.thumb-x { position: absolute; top: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 1.1rem; line-height: 1; cursor: pointer; }
.viewer { position: fixed; inset: 0; z-index: 30; background: #000; display: flex; flex-direction: column; }
.viewer-bar { display: flex; align-items: center; gap: 6px; padding: 10px 12px calc(10px); padding-top: calc(10px + env(safe-area-inset-top)); color: #fff; }
.viewer-count { font-size: .9rem; opacity: .85; }
.viewer-btn { border: 1px solid rgba(255,255,255,.35); background: transparent; color: #fff; border-radius: 10px; min-height: 40px; min-width: 40px; padding: 0 12px; font: inherit; font-weight: 600; font-size: .9rem; cursor: pointer; }
.viewer-btn[data-vclose] { font-size: 1.5rem; padding: 0; }
.viewer-track { flex: 1; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; }
.viewer-track::-webkit-scrollbar { display: none; }
.viewer-slide { flex: 0 0 100%; scroll-snap-align: center; display: grid; place-items: center; padding: 8px 8px calc(16px + env(safe-area-inset-bottom)); }
.viewer-slide img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 6px; }

/* Preloved */
.pill-switch button { min-height: 34px; }
.hscroll { display: flex; gap: 10px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; scrollbar-width: thin; }
.hscroll .listing-tile { flex: 0 0 150px; scroll-snap-align: start; }
.listing-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 12px; margin-bottom: 14px; }
.listing-tile { text-decoration: none; display: block; min-width: 0; }
.listing-img { position: relative; aspect-ratio: 1; border-radius: 12px; overflow: hidden; background: var(--surface-2); display: grid; place-items: center; border: 1px solid var(--line); }
.listing-img img { width: 100%; height: 100%; object-fit: cover; display: block; }
.listing-price { font-weight: 800; margin-top: 6px; }
.listing-price.big { font-size: 1.5rem; margin: 0; }
.listing-title { font-size: .9rem; line-height: 1.3; }
.status-badge { position: absolute; top: 8px; left: 8px; padding: 3px 8px; border-radius: 99px; font-size: .72rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; background: #15201c; color: #fff; }
.status-badge.inline { position: static; display: inline-block; margin-bottom: 8px; }
.status-badge.reserved { background: #e0b100; color: #15201c; }
.status-badge.sold { background: var(--danger); color: #fff; }
.carousel { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; margin-top: 10px; border-radius: 14px; scrollbar-width: none; }
.carousel::-webkit-scrollbar { display: none; }
.carousel-item { flex: 0 0 100%; aspect-ratio: 1; scroll-snap-align: center; border: 0; padding: 0; border-radius: 14px; overflow: hidden; background: var(--surface-2); cursor: zoom-in; }
.carousel-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.seller-card { display: flex; gap: 12px; align-items: center; text-decoration: none; }.reported-photo { display: block; max-width: 160px; border-radius: 8px; margin-top: 8px; }
.made-by img { vertical-align: -4px; margin-right: 2px; }

/* listing price: currency + amount side by side */
.price-row{display:flex;gap:10px;align-items:flex-end}
.price-row > div:first-child{flex:0 0 7.5rem}
.price-row .grow{flex:1;min-width:0}


/* chats */
.chat-row { align-items: center; }
.chat-row.unread strong { font-weight: 800; }
.chat-preview { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.chat-row.unread .chat-preview { color: var(--text); font-weight: 600; }
.unread-pill { background: var(--brand-fill); color: var(--on-brand); border-color: transparent; font-weight: 800; flex: none; }
.chat-head { display: flex; align-items: center; gap: 12px; margin-bottom: 8px; }
.chat-head > a:first-child { font-size: 1.3rem; text-decoration: none; padding: 4px 6px; }
.chat-who { gap: 10px; text-decoration: none; justify-content: flex-start; flex-wrap: nowrap; min-width: 0; }
.chat-who strong { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.chat-list { height: calc(100dvh - 300px); min-height: 220px; overflow-y: auto; padding: 8px 2px; border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); overscroll-behavior: contain; }
.chat-empty { text-align: center; margin-top: 30px; }
.chat-day { text-align: center; font-size: .75rem; color: var(--muted); margin: 12px 0 6px; }
.bubble-row { display: flex; margin: 3px 0; }
.bubble-row.mine { justify-content: flex-end; }
.bubble { max-width: 78%; padding: 8px 12px; border-radius: 18px; border: 0; font: inherit; text-align: left; white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; line-height: 1.4; }
.bubble-row.theirs .bubble { background: var(--surface-2); color: var(--text); border-bottom-left-radius: 6px; }
.bubble-row.mine .bubble { background: var(--brand-fill); color: var(--on-brand); border-bottom-right-radius: 6px; }
.chat-meta { font-size: .72rem; color: var(--muted); margin: 2px 4px 6px; }
.chat-meta.mine { text-align: right; }
.chat-compose { display: flex; gap: 8px; align-items: flex-end; margin-top: 10px; }
.chat-compose textarea { flex: 1; resize: none; min-height: 46px; max-height: 140px; margin: 0; border-radius: 22px; padding: 11px 16px; line-height: 1.35; }
.chat-compose .btn { flex: none; min-height: 46px; border-radius: 22px; }
.chat-safety { margin: 6px 4px 0; }
.chat-head .avatar-sm { flex: none; width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .85rem; }
.photo-bubble { padding: 4px; display: flex; flex-direction: column; gap: 4px; }
.photo-bubble img { display: block; max-width: 220px; max-height: 260px; width: auto; border-radius: 14px; object-fit: cover; }
.photo-bubble span { padding: 2px 8px 4px; }
.chat-photo-btn { flex: none; min-height: 46px; width: 46px; padding: 0; border-radius: 50%; font-size: 1.2rem; cursor: pointer; }
.chat-photo-full { display: block; width: 100%; max-height: 70vh; object-fit: contain; border-radius: 12px; margin-top: 6px; }
/* group chat */
.group-chat { height: calc(100dvh - 420px); min-height: 260px; }
.gmsg { display: flex; gap: 8px; align-items: flex-start; margin: 8px 0; }
.avatar-xs { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-size: .7rem; font-weight: 800; flex: none; overflow: hidden; }
.avatar-xs img { width: 100%; height: 100%; object-fit: cover; display: block; }
.gmsg-body { display: block; text-align: left; width: auto; max-width: 100%; margin-top: 2px; padding: 7px 11px; border: 0; border-radius: 14px; border-top-left-radius: 4px; background: var(--surface-2); color: var(--text); font: inherit; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; cursor: pointer; }
.gmsg.mine .gmsg-body { background: color-mix(in srgb, var(--brand-fill) 18%, var(--surface-2)); }
/* language picker */
.lang-row { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 8px; }
.lang-select { width: auto; min-height: 40px; padding: 6px 10px; margin: 0; }
/* right-to-left (Arabic) */
/* People's own words follow their own direction, so English stays left-to-right inside an Arabic page and Arabic stays right-to-left inside an English one. */
.bubble, .gmsg-body, .chat-preview, .post-body, .post-title, .listing-title, .comment-body, .person p, .hero h1, .bubble span { unicode-bidi: plaintext; text-align: start; }
[dir='rtl'] .bubble-row.theirs .bubble { border-bottom-left-radius: 18px; border-bottom-right-radius: 6px; }
[dir='rtl'] .bubble-row.mine .bubble { border-bottom-right-radius: 18px; border-bottom-left-radius: 6px; }
[dir='rtl'] .gmsg-body { border-top-left-radius: 14px; border-top-right-radius: 4px; }
[dir='rtl'] .chat-meta.mine { text-align: left; }
[dir='rtl'] .badge { right: auto; left: -10px; }
[dir='rtl'] .chat-head > a:first-child { transform: scaleX(-1); }
/* profile banner */
.hero.has-banner { padding-top: 0; }
.hero-banner { position: relative; margin: 0 -18px 0; aspect-ratio: 3 / 1; overflow: hidden; background: color-mix(in srgb, var(--accent) 70%, #000); }
.hero-banner img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: block; }
.hero.has-banner > .avatar { position: relative; margin-top: -38px; box-shadow: 0 0 0 4px var(--accent); }
.hero.has-banner::after { display: none; }
.banner-preview { aspect-ratio: 3 / 1; border-radius: 12px; overflow: hidden; display: grid; place-items: center; background: linear-gradient(140deg, var(--accent), color-mix(in srgb, var(--accent) 60%, #000)); }
.banner-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.banner-preview .muted { color: rgba(255,255,255,.85); }
/* settings */
.set-head { font-size: .8rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 20px 4px 6px; font-weight: 700; }
.set-group { padding: 0; overflow: hidden; }
.set-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; min-height: 56px; border-bottom: 1px solid var(--line); text-decoration: none; color: inherit; }
.set-row:last-child { border-bottom: 0; }
a.set-row:hover, .set-btn:hover { background: var(--surface-2); }
.set-label { display: block; font-weight: 600; }
.set-sub { display: block; margin-top: 2px; }
.set-row .lang-select { max-width: 52%; }
.set-btn { width: 100%; background: none; border: 0; border-bottom: 1px solid var(--line); font: inherit; text-align: start; cursor: pointer; }
.set-btn:last-child { border-bottom: 0; }
.danger-text { color: var(--danger); }
.chev { font-size: 1.4rem; color: var(--muted); line-height: 1; }
[dir='rtl'] .chev { transform: scaleX(-1); }
.settings-link { display: flex; align-items: center; gap: 12px; text-decoration: none; color: inherit; }
.settings-ico .ico, .icon-btn .ico { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.icon-btn { padding-left: 12px; padding-right: 12px; }
.set-row .grow { flex: 1; min-width: 0; }
[hidden] { display: none !important; }

/* weekly matches */
.weekly { margin: 0 0 14px; }
.weekly-strip { display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: 4px; -webkit-overflow-scrolling: touch; }
.weekly-card { position: relative; flex: 0 0 132px; scroll-snap-align: start; display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 14px 10px 12px; border-radius: 14px; background: var(--surface); border: 1px solid var(--line); text-decoration: none; color: inherit; text-align: center; }
.weekly-card .avatar-sm { width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; overflow: hidden; }
.weekly-card strong { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.weekly-why { color: var(--brand-text); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.new-badge { position: absolute; top: 8px; inset-inline-end: 8px; font-size: .65rem; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; padding: 2px 6px; border-radius: 99px; background: var(--brand-fill); color: var(--on-brand); }
/* meetups */
.meetup { display: flex; gap: 12px; align-items: flex-start; }
.meetup-date { flex: none; width: 52px; text-align: center; border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--surface); }
.meetup-date span { display: block; background: var(--brand-fill); color: var(--on-brand); font-size: .7rem; font-weight: 800; text-transform: uppercase; padding: 2px 0; }
.meetup-date b { display: block; font-size: 1.35rem; padding: 4px 0 6px; }
.attendees { display: flex; }
.attendees .avatar-xs { width: 26px; height: 26px; margin-inline-start: -6px; border: 2px solid var(--surface); }
.attendees .avatar-xs:first-child { margin-inline-start: 0; }
.tappable { cursor: zoom-in; }
.tappable:focus-visible { outline: 3px solid var(--brand-text); outline-offset: 3px; }

/* first-time setup */
.setup { max-width: 560px; margin: 0 auto; padding-bottom: 20px; }
.setup-dots { display: flex; gap: 6px; margin: 4px 0 16px; }
.setup-dots span { flex: 1; height: 5px; border-radius: 99px; background: var(--line); }
.setup-dots span.on { background: var(--brand-fill); }
.setup-nav { display: flex; align-items: center; gap: 8px; margin-top: 22px; position: sticky; bottom: calc(70px + env(safe-area-inset-bottom)); background: var(--bg); padding: 10px 0; }
.pick-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.pick { border: 1px solid var(--line); border-radius: 99px; padding: 9px 15px; background: var(--surface); color: var(--text); font: inherit; font-size: .95rem; cursor: pointer; min-height: 42px; }
.pick[aria-pressed="true"] { background: var(--brand-fill); color: var(--on-brand); border-color: transparent; font-weight: 600; }
.swatch { width: 40px; height: 40px; border-radius: 50%; border: 3px solid transparent; cursor: pointer; }
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg) inset; }
.btn.ghost-plain { background: transparent; border-color: transparent; color: var(--brand-text); }

/* ---------- Home feed ---------- */
.top-icon { position: relative; display: grid; place-items: center; width: 40px; height: 40px; margin-left: 10px; border-radius: 12px; color: var(--text); text-decoration: none; }
.top-icon .ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.top-icon.active { color: var(--brand-text); background: var(--surface-2); }
.top-icon .badge { top: 2px; right: 0; }
.home-head { align-items: center; margin-bottom: 10px; flex-wrap: nowrap; }
.composer { padding: 12px 14px; }
.composer-top { display: flex; gap: 10px; align-items: center; }
.composer-top .avatar-sm { flex: none; width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; }
.composer-input { flex: 1; text-align: start; border: 1px solid var(--line); background: var(--surface-2); color: var(--muted); border-radius: 99px; padding: 10px 16px; font: inherit; cursor: text; min-height: 44px; }
.composer-actions { display: flex; gap: 6px; margin-top: 8px; padding-inline-start: 50px; }
.btn.ghost { background: transparent; }
.feed-card { padding: 0; overflow: hidden; }
.feed-head { display: flex; align-items: center; gap: 8px; padding: 12px 8px 8px 14px; }
.feed-author { display: flex; align-items: center; gap: 10px; text-decoration: none; flex: 1; min-width: 0; }
.feed-author .avatar-xs { width: 38px; height: 38px; font-size: .85rem; }
.feed-who { display: flex; flex-direction: column; min-width: 0; line-height: 1.25; }
.feed-who strong, .feed-who .small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.icon-plain { border: 0; background: none; color: var(--muted); width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; cursor: pointer; flex: none; }
.icon-plain:hover { background: var(--surface-2); color: var(--text); }
.ico-h { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; display: block; }
.ico-h.dots { fill: currentColor; stroke: none; }
.feed-text { white-space: pre-line; overflow-wrap: anywhere; margin: 0; padding: 0 14px 10px; }
.held-note { margin: 0 14px 10px; padding: 8px 10px; border-radius: 10px; background: color-mix(in srgb, var(--danger) 12%, var(--surface)); color: var(--text); }
.feed-photos { position: relative; display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; background: var(--surface-2); }
.feed-photos::-webkit-scrollbar { display: none; }
.feed-photo { flex: 0 0 100%; scroll-snap-align: center; display: grid; place-items: center; max-height: 70vh; }
.feed-photo img { width: 100%; max-height: 70vh; object-fit: cover; display: block; cursor: zoom-in; user-select: none; -webkit-user-drag: none; }
.feed-photos .burst { position: sticky; left: 50%; }
.feed-dots { display: flex; justify-content: center; gap: 5px; padding: 8px 0 0; }
.feed-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--line); }
.feed-dots span.on { background: var(--brand-fill, var(--brand)); }
.burst { position: absolute; left: 50%; top: 50%; width: 96px; height: 96px; margin: -48px 0 0 -48px; color: #fff; pointer-events: none; opacity: 0; transform: scale(.4); filter: drop-shadow(0 4px 14px rgba(0,0,0,.35)); z-index: 2; }
.burst .ico-h { width: 100%; height: 100%; fill: #ff3b5c; stroke: #ff3b5c; }
.burst.go { animation: burst .8s ease-out; }
@keyframes burst { 0% { opacity: 0; transform: scale(.4); } 25% { opacity: 1; transform: scale(1.1); } 60% { opacity: 1; transform: scale(1); } 100% { opacity: 0; transform: scale(1.15); } }
.feed-reel { position: relative; display: block; background: #000; aspect-ratio: 9 / 12; max-height: 72vh; margin: 0 auto; }
.feed-reel video { width: 100%; height: 100%; object-fit: cover; display: block; }
.reel-play { position: absolute; left: 12px; bottom: 12px; color: #fff; font-size: 1.1rem; text-shadow: 0 1px 6px rgba(0,0,0,.6); }
.reel-len { position: absolute; right: 10px; bottom: 10px; color: #fff; font-size: .75rem; font-weight: 700; background: rgba(0,0,0,.55); padding: 2px 7px; border-radius: 99px; }
.feed-actions { display: flex; gap: 4px; padding: 6px 8px 8px; }
.feed-btn { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; color: var(--text); font: inherit; font-weight: 600; font-size: .9rem; padding: 8px 10px; border-radius: 99px; cursor: pointer; text-decoration: none; min-height: 40px; }
.feed-btn:hover { background: var(--surface-2); }
.feed-btn.liked { color: #e8264a; }
.feed-btn.liked .ico-h { fill: currentColor; }
.feed-btn.pop .ico-h { animation: pop .3s ease-out; }
@keyframes pop { 50% { transform: scale(1.3); } }
.feed-more { min-height: 60px; display: grid; place-items: center; padding: 8px 0 20px; }
.spinner { width: 28px; height: 28px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--brand-fill, var(--brand)); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.menu-list { display: grid; gap: 4px; margin: 4px 0; }
.menu-item { text-align: start; border: 0; background: var(--surface-2); color: var(--text); font: inherit; font-weight: 600; padding: 14px 16px; border-radius: 12px; cursor: pointer; }
.menu-item:hover { filter: brightness(.97); }
.menu-item.danger { color: var(--danger); }
.compact-select { width: auto; min-width: 0; margin: 0; padding: 6px 10px; min-height: 36px; font-size: .9rem; }
.fp-thumbs { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 8px; }
.fp-thumbs:empty { display: none; }
.fp-thumb { position: relative; width: 78px; height: 78px; border-radius: 10px; overflow: hidden; background: var(--surface-2); }
.fp-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.fp-thumb button { position: absolute; top: 3px; right: 3px; width: 26px; height: 26px; border-radius: 50%; border: 0; background: rgba(0,0,0,.6); color: #fff; font-size: 1rem; line-height: 1; cursor: pointer; }
.reel-pick { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 14px; border: 2px dashed var(--line); border-radius: 14px; margin: 6px 0 10px; }
.reel-preview { width: 100%; max-height: 42vh; border-radius: 10px; background: #000; }
.progress { height: 8px; border-radius: 99px; background: var(--surface-2); overflow: hidden; margin-top: 10px; }
.progress > div { height: 100%; width: 0; background: var(--brand-fill, var(--brand)); transition: width .2s; }
.sheet-comments { max-height: 46vh; overflow-y: auto; }
.post-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.post-tile { position: relative; aspect-ratio: 1; border-radius: 8px; overflow: hidden; background: var(--surface-2); display: block; text-decoration: none; }
.post-tile img { width: 100%; height: 100%; object-fit: cover; display: block; }
.post-tile-text { display: block; padding: 8px; font-size: .78rem; line-height: 1.3; overflow: hidden; height: 100%; color: var(--text); overflow-wrap: anywhere; }
.tile-badge { position: absolute; top: 6px; right: 6px; color: #fff; font-size: .8rem; text-shadow: 0 1px 4px rgba(0,0,0,.7); }
.tile-held { position: absolute; left: 6px; bottom: 6px; font-size: .7rem; font-weight: 700; color: #fff; background: var(--danger); padding: 1px 6px; border-radius: 99px; }

/* ---------- Reels (full screen, swipe up for the next one) ---------- */
body.on-reels { overflow: hidden; }
.reels { position: fixed; left: 0; right: 0; top: 56px; bottom: 64px; z-index: 4; background: #000; overflow-y: auto; scroll-snap-type: y mandatory; overscroll-behavior: contain; scrollbar-width: none; }
.reels::-webkit-scrollbar { display: none; }
.reel { position: relative; height: 100%; scroll-snap-align: start; scroll-snap-stop: always; overflow: hidden; color: #fff; display: flex; justify-content: center; }
.reel video { height: 100%; width: 100%; max-width: 560px; object-fit: cover; display: block; background: #000; }
@media (min-width: 640px) { .reel video { object-fit: contain; } }
.reel-tap { position: absolute; inset: 0; z-index: 1; cursor: pointer; }
.reel-side { position: absolute; right: max(8px, calc(50% - 300px)); bottom: 24px; z-index: 2; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.reel-avatar .avatar-sm { width: 46px; height: 46px; border-radius: 50%; border: 2px solid #fff; display: grid; place-items: center; font-weight: 800; }
.reel-btn { display: flex; flex-direction: column; align-items: center; gap: 2px; border: 0; background: none; color: #fff; font: inherit; font-size: .78rem; font-weight: 700; cursor: pointer; text-shadow: 0 1px 4px rgba(0,0,0,.6); min-width: 44px; }
.reel-btn .ico-h { width: 32px; height: 32px; filter: drop-shadow(0 1px 4px rgba(0,0,0,.5)); }
.reel-btn.liked { color: #ff3b5c; }
.reel-btn.liked .ico-h { fill: currentColor; }
.reel-info { position: absolute; left: max(14px, calc(50% - 280px)); right: 80px; bottom: 22px; z-index: 2; text-shadow: 0 1px 4px rgba(0,0,0,.7); pointer-events: none; }
.reel-info a, .reel-info p { pointer-events: auto; }
.reel-name { font-weight: 800; text-decoration: none; color: #fff; }
.reel-name span { font-weight: 500; opacity: .85; font-size: .85rem; }
.reel-caption { margin: 6px 0 0; white-space: pre-line; overflow-wrap: anywhere; max-height: 7.5em; overflow-y: auto; font-size: .92rem; }
.reel-info .held-note { margin: 8px 0 0; color: #fff; background: rgba(200,30,50,.8); }
.reel::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 40%; background: linear-gradient(transparent, rgba(0,0,0,.55)); pointer-events: none; }
.reel-mute { position: absolute; left: 50%; top: 50%; z-index: 2; width: 72px; height: 72px; margin: -36px 0 0 -36px; border-radius: 50%; background: rgba(0,0,0,.5); display: grid; place-items: center; font-size: 2rem; opacity: 0; pointer-events: none; }
.reel-mute.go { animation: fadeOut 1s ease-out; }
@keyframes fadeOut { 0%, 50% { opacity: 1; } 100% { opacity: 0; } }
.reel-msg { align-items: center; text-align: center; padding: 24px; }
.reel-msg::after { display: none; }
.reel-msg h2 { color: #fff; }
.reel-msg p { color: rgba(255,255,255,.8); max-width: 340px; margin: 0 auto 16px; }
.reel-msg .spinner { border-color: rgba(255,255,255,.25); border-top-color: #fff; }
.reel-new { position: fixed; z-index: 6; right: 14px; top: 66px; width: 44px; height: 44px; border-radius: 50%; border: 0; background: rgba(255,255,255,.92); color: #000; font-size: 1.7rem; font-weight: 600; line-height: 1; cursor: pointer; box-shadow: 0 2px 10px rgba(0,0,0,.3); }
body:not(.on-reels) .reel-new { display: none; }
@media (prefers-reduced-motion: reduce) { .burst.go, .reel-mute.go, .feed-btn.pop .ico-h, .spinner { animation-duration: .01s; } }
