/* vegbestie — shared design system. Mobile-first; classic 3 columns from 900px up. */
/* Colour roles follow Material 3 (Expressive), generated from the vegbestie green and coral.
   The older names (--card, --line, ...) stay so every module stylesheet keeps working. */
:root {
  --bg: #f7fbf1;            /* surface */
  --bg-grad: none;
  --card: #ecefe6;          /* surface container */
  --card-alt: #e1e5db;      /* surface container high */
  --title-bg: #d5e8cf;      /* secondary container (hover and selected states) */
  --line: #c2c8bd;          /* outline variant */
  --text: #191d17;
  --muted: #424940;
  --link: #2f6a31;
  --primary: #3b6939;
  --primary-ink: #ffffff;
  --pc: #bcf0b4;            /* primary container */
  --on-pc: #002105;
  --sc: #d5e8cf;            /* secondary container */
  --on-sc: #101f0f;
  --pink: #a8432a;          /* tertiary (coral) */
  --pink-soft: #ffdbd0;     /* tertiary container */
  --tc: #ffdbd0;
  --on-tc: #3a0b00;
  --field: #f7fbf1;
  --ok: #1f7a52;
  --danger: #ba1a1a;
  --radius: 28px;
  --radius-sm: 16px;
  --avatar-r: 32%;
  --shadow: 0 1px 3px rgba(0, 0, 0, .12), 0 6px 16px rgba(0, 0, 0, .1);
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, -apple-system, sans-serif;
  --tabbar-h: 72px;
  --rail-w: 88px;
}
/* data-theme is set in the page head: the saved choice, or else the device's own light/dark setting */
:root[data-theme="dark"] {
  --bg: #10140f;
  --card: #1d211b;
  --card-alt: #272b25;
  --title-bg: #3b4b39;
  --line: #424940;
  --text: #e0e4da;
  --muted: #c2c8bd;
  --link: #a1d39a;
  --primary: #a1d39a;
  --primary-ink: #0a390f;
  --pc: #235024;
  --on-pc: #bcf0b4;
  --sc: #3b4b39;
  --on-sc: #d5e8cf;
  --pink: #ffb59f;
  --pink-soft: #723520;
  --tc: #723520;
  --on-tc: #ffdbd0;
  --field: #10140f;
  --ok: #7fd8a8;
  --danger: #ffb4ab;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4), 0 6px 16px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
/* icons: a small subset of Material Symbols Rounded (static/vendor/symbols) */
@font-face {
  font-family: "Material Symbols Rounded"; font-style: normal; font-weight: 400; font-display: block;
  src: url(/static/vendor/symbols/symbols.woff2) format("woff2");
}
.ms, .theme-toggle::before {
  font-family: "Material Symbols Rounded"; font-weight: 400; font-style: normal; font-size: 24px; line-height: 1;
  display: inline-block; white-space: nowrap; letter-spacing: normal; text-transform: none; direction: ltr;
  font-feature-settings: "liga"; -webkit-font-smoothing: antialiased; vertical-align: middle;
  overflow: hidden; max-width: 1.2em;
}
.theme-toggle {
  border: 0; background: transparent; width: 40px; height: 40px; border-radius: 50%;
  cursor: pointer; line-height: 1; padding: 0; color: var(--muted); display: grid; place-items: center;
}
.theme-toggle:hover { background: var(--card-alt); }
/* follows the device, always light, always dark */
.theme-toggle::before { content: "brightness_auto"; font-size: 22px; }
:root[data-pref="light"] .theme-toggle::before { content: "light_mode"; }
:root[data-pref="dark"] .theme-toggle::before { content: "dark_mode"; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.45;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
body.bare { padding-bottom: 0; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; }
h1, h2, h3 { margin: 0 0 .5em; line-height: 1.2; }
h1 { font-size: 1.4rem; }
h2 { font-size: 1.1rem; }
h3 { font-size: 1rem; }
p { margin: 0 0 .7em; }
code { background: var(--card-alt); padding: 1px 5px; border-radius: 5px; font-size: .9em; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }

/* ---------- top bar ---------- */
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--bg);
}
.topbar-inner {
  max-width: 1120px; margin: 0 auto; padding: 10px 12px;
  display: flex; align-items: center; gap: 12px;
}
.logo { display: flex; align-items: center; flex: none; }
.logo img { height: 30px; display: block; }
.mainnav { display: none; gap: 2px; }
.mainnav a {
  padding: 7px 11px; border-radius: 999px; color: var(--text); font-weight: 600; font-size: .92rem;
}
.mainnav a:hover { background: var(--title-bg); text-decoration: none; }
.mainnav a.active { background: var(--primary); color: var(--primary-ink); }
.search { flex: 1; min-width: 0; margin: 0; }
.topbar .search input {
  width: 100%; border-radius: 999px; padding: 10px 18px 10px 46px; background: var(--card-alt); border-color: transparent;
}
.topbar .search > .ms { position: absolute; left: 16px; top: 50%; transform: translateY(-50%); font-size: 20px; color: var(--muted); pointer-events: none; }
.only-wide { display: none !important; }
.whoami { display: flex; align-items: center; gap: 8px; flex: none; }
.whoami { gap: 4px; }
.whoami form { margin: 0; }
.icon-btn {
  border: 0; background: transparent; width: 40px; height: 40px; border-radius: 50%; padding: 0;
  cursor: pointer; color: var(--muted); display: grid; place-items: center;
}
.icon-btn:hover { background: var(--card-alt); }
.icon-btn .ms { font-size: 22px; }
.linklike {
  background: none; border: 0; padding: 0; font: inherit; color: var(--link); cursor: pointer;
  font-size: .85rem;
}
.linklike:hover { text-decoration: underline; }

/* ---------- navigation: bottom bar on phones, side rail from 900px ---------- */
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: flex; justify-content: space-around; align-items: center;
  background: var(--card);
  padding-bottom: env(safe-area-inset-bottom);
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
}
.tabbar a {
  flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 4px; color: var(--muted); font-size: .72rem; font-weight: 600; min-width: 0;
}
.tabbar a:hover { text-decoration: none; }
.tabbar .tab-icon { width: 60px; max-width: none; padding: 4px 0; border-radius: 16px; text-align: center; transition: background .15s; }
.tabbar a:hover .tab-icon { background: var(--card-alt); }
.tabbar a.active { color: var(--text); font-weight: 700; }
.tabbar a.active .tab-icon { background: var(--sc); color: var(--on-sc); font-variation-settings: "FILL" 1; }
.tab-label { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* the round "create" button: floats above the bar on the phone home page, heads the rail on desktop */
.fab { position: fixed; z-index: 21; right: 16px; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 16px); display: none; }
.has-fab .fab { display: block; }
.fab > summary {
  list-style: none; cursor: pointer; width: 64px; height: 64px; border-radius: 22px; display: grid; place-items: center;
  background: var(--tc); color: var(--on-tc); box-shadow: var(--shadow); transition: border-radius .2s, transform .1s;
}
.fab > summary::-webkit-details-marker { display: none; }
.fab > summary:active { transform: scale(.95); }
.fab[open] > summary { border-radius: 50%; }
.fab-menu {
  position: absolute; right: 0; bottom: calc(100% + 10px); width: max-content; max-width: 80vw; padding: 8px;
  background: var(--card-alt); border-radius: 24px; box-shadow: var(--shadow); display: grid; gap: 2px;
}
.fab-menu a { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 12px; padding: 10px 16px 10px 12px; border-radius: 16px; color: var(--text); font-size: .92rem; font-weight: 600; }
.fab-menu a:hover { background: var(--sc); text-decoration: none; }
.fab-menu .ms { color: var(--primary); }

/* ---------- layout ---------- */
.wrap { max-width: 1120px; margin: 0 auto; padding: 12px; }
.cols { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.col-left, .col-main, .col-right { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
/* two-column variant: main + right sidebar */
.cols.cols-2 { grid-template-columns: minmax(0, 1fr); }

.footer { text-align: center; color: var(--muted); font-size: .8rem; padding: 18px 12px 24px; }

/* ---------- cards ---------- */
.box {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
}
.box-title {
  margin: 0; padding: 16px 20px 6px; font-size: 1.02rem; font-weight: 700; color: var(--text);
  display: block; overflow: hidden; /* a block, not a flex row, so the first letter can be capitalised */
}
.box-title::first-letter, .box-link::first-letter, .chip::first-letter, .cap::first-letter { text-transform: uppercase; }
.box-title > .box-link, .box-title > .box-links, .box-title > .chip, .box-title > form { float: right; margin-left: 10px; }
.box-link { font-size: .82rem; font-weight: 700; display: inline-block; line-height: 1.6; }
.cap { display: inline-block; }
.box-body { padding: 14px 20px 18px; }
.box-title + .box-body { padding-top: 8px; }
.box-body > :last-child { margin-bottom: 0; }
.box > form, .box > p, .box > h2:not(.box-title) { margin-left: 20px; margin-right: 20px; }

/* ---------- profile card (left column) ---------- */
.profile-card { padding: 18px; display: grid; gap: 10px; grid-template-columns: 76px minmax(0, 1fr); align-items: center; }
.profile-card > .btn, .profile-card > .profile-actions { grid-column: 1 / -1; }
.profile-photo { display: block; }
.profile-name { font-size: 1.15rem; margin: 0 0 2px; overflow-wrap: anywhere; }
.profile-status { margin: 0 0 2px; color: var(--pink); font-style: italic; font-size: .9rem; overflow-wrap: anywhere; }
.profile-card-info p:last-child { margin-bottom: 0; }
.profile-actions { display: grid; gap: 6px; }
.profile-actions form { margin: 0; }
/* the menu beside a profile or community: a row of chips on phones, a card of rows on wide screens */
.side-card { background: transparent; border-radius: 0; overflow: visible; }
.side-menu { display: flex; gap: 8px; overflow-x: auto; scrollbar-width: none; }
.side-menu::-webkit-scrollbar { display: none; }
.side-menu a {
  flex: none; display: inline-flex; align-items: center; gap: 8px; padding: 8px 14px 8px 10px; border-radius: 12px;
  border: 1px solid var(--line); color: var(--muted); font-size: .88rem; font-weight: 600; white-space: nowrap;
}
.side-menu a:hover { text-decoration: none; background: var(--card); }
.side-menu a.active { background: var(--sc); border-color: transparent; color: var(--on-sc); }
.side-menu a.active .menu-icon { font-variation-settings: "FILL" 1; }
.menu-icon { font-size: 20px; }
.menu-label { display: inline-block; }
.menu-label::first-letter { text-transform: uppercase; }
.menu-count { font-size: .8rem; opacity: .8; }
.btn .ms { font-size: 18px; }

/* ---------- avatars ---------- */
.avatar { border-radius: var(--avatar-r); object-fit: cover; background: var(--card-alt); display: block; flex: none; }
.avatar-xs { width: 28px; height: 28px; }
.avatar-sm { width: 44px; height: 44px; }
.avatar-md { width: 64px; height: 64px; }
.avatar-lg { width: 76px; height: 76px; border-radius: 24px; }
.avatar-square { border-radius: 18px; }

/* ---------- 3x3 grids of faces ---------- */
.grid9 { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 10px 6px; }
.grid-item {
  display: flex; flex-direction: column; align-items: center; gap: 4px; min-width: 0;
  font-size: .78rem; font-weight: 600; text-align: center; color: var(--text);
}
.grid-item span { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.grid-item:hover { text-decoration: none; color: var(--primary); }
.grid-item:hover .avatar { outline: 3px solid var(--primary); outline-offset: 1px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 8px 18px; border-radius: 999px; border: 1px solid transparent;
  background: var(--sc); color: var(--on-sc); font: inherit; font-weight: 700; font-size: .9rem;
  cursor: pointer; text-align: center; transition: transform .08s, filter .15s;
}
.btn:hover { text-decoration: none; filter: brightness(.97); }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-pink { background: var(--tc); border-color: var(--tc); color: var(--on-tc); }
.btn-danger { background: transparent; border-color: var(--danger); color: var(--danger); }
.btn-small { min-height: 32px; padding: 4px 14px; font-size: .82rem; }
.btn-block { display: flex; width: 100%; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.btn-row form { margin: 0; }
.inline-form { display: inline; margin: 0; }

/* ---------- forms ---------- */
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date],
input[type=datetime-local], input[type=url], input[type=number], select, textarea {
  width: 100%; padding: 10px 14px; border-radius: 14px; border: 1px solid var(--line);
  background: var(--field); color: var(--text); font: inherit; font-size: 16px; /* 16px stops iOS zoom */
}
textarea { min-height: 96px; resize: vertical; }
input:focus, select:focus, textarea:focus, .btn:focus-visible, a:focus-visible {
  outline: 2px solid var(--primary); outline-offset: 1px;
}
label { display: block; font-weight: 600; font-size: .85rem; color: var(--muted); }
label > input, label > select, label > textarea { margin-top: 4px; font-weight: 400; color: var(--text); }
.stack { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.row2 { display: grid; gap: 12px; grid-template-columns: minmax(0, 1fr); }
.form-actions { display: flex; gap: 8px; justify-content: flex-end; flex-wrap: wrap; }
fieldset { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px; margin: 0; }
legend { font-weight: 700; padding: 0 6px; }

/* ---------- flash messages ---------- */
.flash { padding: 9px 13px; border-radius: var(--radius-sm); background: var(--title-bg); font-weight: 600; }
.flash-ok { background: color-mix(in srgb, var(--ok) 16%, var(--card)); color: var(--ok); }
.flash-error { background: color-mix(in srgb, var(--danger) 14%, var(--card)); color: var(--danger); }
/* something to know, not something that went wrong */
.flash-warn { background: color-mix(in srgb, var(--danger) 8%, var(--card)); border-left: 3px solid var(--danger); }

/* ---------- lists (scraps, topics, messages, people) ---------- */
.list { display: flex; flex-direction: column; }
.list-item { display: flex; gap: 14px; padding: 12px 20px; border-top: 1px solid var(--card-alt); align-items: flex-start; }
.list-item:first-child { border-top: 0; }
.list-item.unread { background: var(--pink-soft); }
.item-main { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.item-head { display: flex; flex-wrap: wrap; gap: 4px 8px; align-items: baseline; margin-bottom: 2px; }
.item-head .user-link, .user-link { font-weight: 700; }
.item-time { color: var(--muted); font-size: .78rem; }
.item-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; align-items: center; }
.item-actions form { margin: 0; }
.item-side { flex: none; text-align: right; }
.box-body.flush, .flush { padding: 0; }

/* ---------- tabs ---------- */
.tabs { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  flex: none; padding: 7px 16px; border-radius: 12px; background: transparent; border: 1px solid var(--line);
  color: var(--muted); font-weight: 700; font-size: .87rem; white-space: nowrap;
}
.tab:hover { text-decoration: none; background: var(--card-alt); }
.tab.active { background: var(--sc); border-color: var(--sc); color: var(--on-sc); }

/* ---------- label / value tables (profile details) ---------- */
.fields { display: grid; grid-template-columns: minmax(0, 1fr); }
.field { display: grid; grid-template-columns: 38% minmax(0, 1fr); gap: 10px; padding: 8px 20px; }
.field:nth-child(odd) { background: color-mix(in srgb, var(--card-alt) 60%, transparent); }
.field dt, .field-label { color: var(--muted); font-weight: 600; font-size: .86rem; margin: 0; }
.field dd, .field-value { margin: 0; overflow-wrap: anywhere; }
dl.fields { margin: 0; }

/* ---------- stats, karma, badges ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(78px, 1fr)); gap: 8px; }
.stat { background: var(--card-alt); border-radius: var(--radius-sm); padding: 8px 6px; text-align: center; color: var(--text); }
a.stat:hover { text-decoration: none; background: var(--title-bg); }
.stat b { display: block; font-size: 1.15rem; }
.stat span { font-size: .72rem; color: var(--muted); font-weight: 600; }
.karma { display: inline-flex; gap: 1px; font-size: 1.05rem; white-space: nowrap; }
.karma .off { opacity: .22; filter: grayscale(1); }
.karma-pick { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.karma-pick input { position: absolute; opacity: 0; pointer-events: none; }
.karma-pick label { cursor: pointer; font-size: 1.35rem; opacity: .25; filter: grayscale(1); color: inherit; }
.karma-pick input:checked ~ label, .karma-pick label:hover, .karma-pick label:hover ~ label { opacity: 1; filter: none; }
.badge {
  display: inline-block; min-width: 20px; padding: 1px 7px; border-radius: 999px;
  background: var(--pink); color: var(--bg); font-size: .72rem; font-weight: 700; text-align: center;
}
.chip {
  display: inline-block; padding: 3px 10px; border-radius: 8px; background: transparent;
  border: 1px solid var(--line); font-size: .78rem; font-weight: 600; color: var(--muted);
}
.fortune {
  background: linear-gradient(135deg, var(--pink-soft), var(--title-bg)); border-radius: var(--radius-sm);
  padding: 12px 14px;
}

/* ---------- photos & videos ---------- */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 8px; }
.thumb {
  display: block; aspect-ratio: 1; border-radius: var(--radius-sm); overflow: hidden; background: var(--card-alt);
  position: relative;
}
.thumb img { width: 100%; height: 100%; object-fit: cover; display: block; transition: transform .2s; }
.thumb:hover img { transform: scale(1.05); }
.album-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px; }
.album-card { color: var(--text); display: block; }
.album-card:hover { text-decoration: none; }
.album-card .thumb { box-shadow: 4px 4px 0 var(--title-bg), 8px 8px 0 var(--line); margin: 0 8px 12px 0; }
.album-card b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.photo-full { display: block; margin: 0 auto; max-height: 72vh; border-radius: var(--radius-sm); }
.video-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.video-frame { aspect-ratio: 16 / 9; width: 100%; border: 0; border-radius: var(--radius-sm); background: #000; display: block; }

/* ---------- polls ---------- */
.poll-bar { height: 10px; border-radius: 999px; background: var(--card-alt); overflow: hidden; margin: 3px 0 9px; }
.poll-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--primary), var(--pink)); border-radius: 999px; }

/* ---------- misc ---------- */
.empty { text-align: center; color: var(--muted); padding: 22px 12px; }
.empty img { opacity: .9; }
.pager { display: flex; justify-content: space-between; gap: 8px; padding: 10px 20px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; }
.page-head h1 { margin: 0; }
.breadcrumb { font-size: .85rem; color: var(--muted); }
.error-page { text-align: center; padding: 48px 16px; }

/* ---------- welcome (login / register) ---------- */
.welcome { display: grid; gap: 16px; max-width: 900px; margin: 4vh auto 0; align-items: center; }
.welcome-hero { text-align: center; }
.welcome-logo { height: 56px; }
.welcome-owl { display: block; width: 130px; margin: 6px auto; }
.welcome-points { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; color: var(--muted); }
.welcome-points b { color: var(--pink); }
.welcome-form { padding: 20px 6px; }
.welcome-form h2 { margin: 0 14px 12px; }

/* ---------- tablet and up ---------- */
@media (min-width: 620px) {
  .row2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .welcome { grid-template-columns: 1fr 1fr; margin-top: 10vh; }
  .photo-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ---------- desktop: classic three columns ---------- */
@media (min-width: 900px) {
  body { padding-bottom: 0; padding-left: var(--rail-w); font-size: 14.5px; }
  .tabbar {
    top: 0; right: auto; width: var(--rail-w); height: auto; flex-direction: column; justify-content: flex-start;
    gap: 14px; padding: 14px 0; background: var(--bg);
  }
  .tabbar a { flex: none; width: 100%; }
  .fab, .has-fab .fab { display: block; position: relative; right: auto; bottom: auto; margin-bottom: 6px; }
  .fab > summary { width: 56px; height: 56px; border-radius: 18px; box-shadow: none; }
  .fab-menu { right: auto; left: calc(100% + 12px); bottom: auto; top: 0; }
  .search { max-width: 420px; margin-left: auto; }
  .wrap { padding: 16px; }
  .cols { grid-template-columns: 210px minmax(0, 1fr) 270px; gap: 16px; align-items: start; }
  .cols.cols-2 { grid-template-columns: minmax(0, 1fr) 270px; }
  .col-left, .col-main, .col-right { gap: 16px; }
  .col-left { position: sticky; top: 64px; }
  .profile-card { grid-template-columns: 1fr; text-align: center; }
  .profile-photo { justify-self: center; }
  .avatar-lg { width: 150px; height: 150px; border-radius: 28px; }
  .side-card { background: var(--card); border-radius: var(--radius); padding: 8px; }
  .side-menu { flex-direction: column; overflow: visible; gap: 2px; text-align: left; }
  .side-menu a { display: flex; gap: 14px; border: 0; border-radius: 999px; white-space: normal; padding: 10px 16px; font-size: .92rem; }
  .side-menu a:hover { background: var(--card-alt); }
  .side-menu a.active:hover { background: var(--sc); }
  .menu-icon { font-size: 22px; }
  .menu-count, .side-menu .badge { margin-left: auto; }
  .grid9 { grid-template-columns: repeat(3, 1fr); }
  .col-right .avatar-md { width: 60px; height: 60px; }
}
@media (max-width: 899px) {
  .whoami .linklike { font-size: .78rem; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
.theme-toggle-float { position: fixed; top: 12px; right: 12px; z-index: 5; background: var(--card); }
@media (max-width: 420px) {
  .tabbar a { font-size: .66rem; }
  .logo img { height: 26px; }
}
.report-link { text-align: center; font-size: .8rem; margin: -14px 0 22px; }
.report-link a { color: var(--muted); }
.narrow { max-width: 720px; margin: 0 auto; display: flex; flex-direction: column; gap: 12px; }
.report-item { font-size: .8rem; opacity: .45; margin-left: auto; text-decoration: none; }
.report-item:hover { opacity: 1; text-decoration: none; }
ol.rules { padding-left: 20px; display: grid; gap: 6px; }
blockquote.reported { margin: 6px 0; padding: 8px 12px; border-left: 3px solid var(--pink); background: var(--card-alt); border-radius: var(--radius-sm); overflow-wrap: anywhere; }

/* ---------- cropper (Cropper.js, see static/vendor/cropperjs) ---------- */
.crop-ui { display: grid; gap: 8px; width: 100%; flex-basis: 100%; }
.crop-ui[hidden] { display: none; }
.crop-layout { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-end; }
.crop-stage {
  width: min(100%, 420px); height: 340px; overflow: hidden;
  background: var(--card-alt); border-radius: var(--radius-sm);
}
.crop-source { display: block; max-width: 100%; }
.cropper-view-box { outline: 2px solid var(--primary); outline-color: var(--primary); }
.cropper-line, .cropper-point { background-color: var(--primary); }
.cropper-point { width: 14px; height: 14px; opacity: 1; border-radius: 50%; border: 2px solid #fff; }
.cropper-point.point-n, .cropper-point.point-s { margin-left: -7px; }
.cropper-point.point-e, .cropper-point.point-w { margin-top: -7px; }
.cropper-point.point-n, .cropper-point.point-ne, .cropper-point.point-nw { top: -7px; }
.cropper-point.point-s, .cropper-point.point-se, .cropper-point.point-sw { bottom: -7px; }
.cropper-point.point-e, .cropper-point.point-ne, .cropper-point.point-se { right: -7px; }
.cropper-point.point-w, .cropper-point.point-nw, .cropper-point.point-sw { left: -7px; }
.cropper-point.point-se { width: 14px; height: 14px; }
.cropper-point.point-se::before { display: none; }
/* profile pictures are shown as rounded squares and circles */
.crop-rounded .cropper-view-box, .crop-rounded .cropper-face { border-radius: 19%; }
.crop-previews { display: flex; gap: 14px; align-items: flex-end; text-align: center; }
.crop-previews span { display: block; }
.crop-preview { overflow: hidden; background: var(--card-alt); margin: 0 auto 4px; }
.crop-preview-lg { width: 120px; height: 120px; border-radius: 23px; }
.crop-preview-sm { width: 44px; height: 44px; border-radius: var(--avatar-r); }

/* ---------- rich posts ---------- */
.rich-text { overflow-wrap: anywhere; }
.post-image { display: block; margin-top: 8px; }
.post-image img, .post-gif { display: block; max-width: min(100%, 420px); max-height: 420px; border-radius: var(--radius-sm); }
.post-gif { margin-top: 8px; }
.yt-card {
  margin-top: 8px; max-width: 420px; aspect-ratio: 16 / 9; border-radius: var(--radius-sm); cursor: pointer;
  background: linear-gradient(135deg, #2b2d42, #4a3a66); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px;
}
.yt-card .muted { color: #d9d9ee; }
.yt-play {
  width: 64px; height: 44px; border: 0; border-radius: 12px; background: #e62117; color: #fff;
  font-size: 1.2rem; cursor: pointer;
}
.yt-card + .video-frame, .rich-text ~ .video-frame, .video-frame { max-width: 100%; }
.item-main > .video-frame, .post-body > .video-frame { max-width: 420px; margin-top: 8px; }
.file-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.crop-ui, .crop-layout { min-width: 0; }
@media (max-width: 560px) {
  /* give the crop area the full width on phones */
  .avatar-edit { flex-direction: column; align-items: stretch; }
  .avatar-edit > img { align-self: center; }
}
.lang-switch { margin: 8px 0 0; }
.welcome-tagline { font-size: 1.1rem; margin: 6px 0 4px; }
.welcome-statement { color: var(--muted); margin: 0 auto 12px; max-width: 34ch; }
.welcome-points b { color: var(--primary); }
.env-banner {
  background: repeating-linear-gradient(135deg, #ffe08a, #ffe08a 12px, #ffd45c 12px, #ffd45c 24px);
  color: #4a3800; font-weight: 700; font-size: .82rem; text-align: center; padding: 5px 12px;
}
.invite-link { font-family: ui-monospace, monospace; font-size: .8rem; margin: 4px 0; }

/* "Install app" steps on iPhone and iPad */
.install-sheet {
  border: 0; border-radius: 28px; padding: 22px 24px;
  width: min(92vw, 420px); background: var(--card-alt); color: var(--text); text-align: left;
}
.install-sheet::backdrop { background: rgba(0, 0, 0, .45); }
.install-sheet h3 { margin: 0 0 10px; }
.install-sheet ol { margin: 0 0 14px; padding-left: 22px; display: grid; gap: 8px; }
.install-sheet form { margin: 0; text-align: right; }

/* title-bar links: an action ("+ new topic") next to "view all" */
.box-links { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: 6px 10px; }
.box-action {
  padding: 3px 10px; border-radius: 999px; background: var(--primary); color: var(--primary-ink); white-space: nowrap;
}
.box-action:hover { text-decoration: none; filter: brightness(1.08); }

/* ---------- Explore menu (top bar) and More sheet (phones) ---------- */
.explore { position: relative; }
.explore > summary {
  list-style: none; cursor: pointer; padding: 7px 11px; border-radius: 999px;
  color: var(--text); font-weight: 600; font-size: .92rem; white-space: nowrap; user-select: none;
}
.explore > summary::-webkit-details-marker { display: none; }
.explore > summary:hover, .explore[open] > summary { background: var(--title-bg); }
.explore > summary.active { background: var(--primary); color: var(--primary-ink); }
.explore-menu {
  position: absolute; z-index: 40; top: calc(100% + 8px); left: 0; width: 290px; padding: 6px;
  background: var(--card-alt); border-radius: 24px; box-shadow: var(--shadow);
}
.explore-list { display: grid; gap: 2px; }
.explore-row {
  display: flex; align-items: center; gap: 14px; padding: 10px 12px; border-radius: 18px; color: var(--text);
}
.explore-row:hover { background: var(--title-bg); text-decoration: none; }
.explore-icon {
  flex: none; width: 42px; height: 42px; max-width: none; display: grid; place-items: center;
  background: var(--pc); color: var(--on-pc); border-radius: 14px;
}
.explore-text { display: grid; min-width: 0; }
.explore-text b { font-size: .95rem; }
.explore-text span { font-size: .8rem; color: var(--muted); }
.more-sheet {
  position: fixed; inset: auto 0 0 0; margin: 0; width: 100%; max-width: none; max-height: 85vh; overflow-y: auto;
  border: 0; border-radius: 28px 28px 0 0;
  padding: 8px 10px calc(14px + env(safe-area-inset-bottom));
  background: var(--card-alt); color: var(--text);
}
.more-sheet::backdrop { background: rgba(0, 0, 0, .45); }
.more-grip { width: 40px; height: 4px; border-radius: 999px; background: var(--line); margin: 4px auto 8px; }
.tabbar a.active, .tabbar a[data-more].active { color: var(--primary); }

/* green "online" dot on a friend's picture */
.avatar-wrap { position: relative; display: inline-flex; }
.online-dot {
  position: absolute; right: 1px; bottom: 1px; width: 13px; height: 13px; border-radius: 50%;
  background: #2ecc71; border: 2px solid var(--card); box-sizing: border-box;
}
.grid-item span.avatar-wrap { overflow: visible; max-width: none; }

/* ---------- live search suggestions under the top search box ---------- */
.search { position: relative; }
.suggest-list {
  position: absolute; z-index: 45; top: calc(100% + 8px); right: 0; width: max(100%, min(360px, 92vw));
  max-height: 70vh; overflow-y: auto; padding: 8px;
  background: var(--card-alt); border-radius: 24px; box-shadow: var(--shadow);
}
.suggest-title { padding: 6px 8px 2px; font-size: .72rem; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.suggest-list a { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 10px; color: var(--text); }
.suggest-list a:hover, .suggest-list a.is-active { background: var(--title-bg); text-decoration: none; }
.suggest-list img, .suggest-blank { flex: none; width: 36px; height: 36px; border-radius: 12px; object-fit: cover; background: var(--card-alt); }
.suggest-list a > span:last-child { display: grid; min-width: 0; }
.suggest-list b { font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-list small { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest-all { justify-content: center; font-weight: 700; color: var(--link) !important; border-top: 1px solid var(--line); border-radius: 0 0 10px 10px !important; margin-top: 4px; }
/* on phones the search box is narrow: the suggestions span the screen under the top bar */
@media (max-width: 899px) {
  .suggest-list { position: fixed; left: 8px; right: 8px; top: 116px; width: auto; max-height: 60vh; }
}

/* wide screens: "More" opens as a panel beside the rail instead of a bottom sheet */
@media (min-width: 900px) {
  .more-sheet { inset: 16px auto auto calc(var(--rail-w) + 4px); width: 340px; border-radius: 28px; padding: 10px; box-shadow: var(--shadow); }
  .more-sheet::backdrop { background: rgba(0, 0, 0, .2); }
  .more-grip { display: none; }
}
/* the tester feedback bubble moves up when the floating create button is there (phone home page) */
@media (max-width: 899px) {
  .has-fab .fb { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 92px); }
}
/* phone home page: the welcome box leads; the profile card lives under More and behind the picture */
@media (max-width: 899px) {
  .has-fab .col-left { display: none; }
}
@media (min-width: 900px) {
  .only-wide { display: revert !important; }
  .tabbar .tab-icon.only-wide { display: inline-block !important; }
  .only-narrow { display: none !important; }
}
/* log out lives in the More sheet on phones, in the top bar on wide screens */
.more-logout { margin: 2px 0 0; }
.more-logout .explore-row { width: 100%; border: 0; background: none; font: inherit; text-align: left; cursor: pointer; }
.more-logout .explore-icon { background: var(--card); color: var(--muted); }
@media (max-width: 899px) { .whoami form { display: none; } }
@media (min-width: 900px) { .more-logout { display: none; } }
/* phones: the search box gets its own full-width row under the logo and the buttons */
@media (max-width: 899px) {
  .topbar-inner { flex-wrap: wrap; row-gap: 8px; }
  .topbar .whoami { margin-left: auto; }
  .topbar .search { order: 3; flex: 1 0 100%; }
}
/* icons inside text: chips, small print, tabs, links and titles take the size of their text */
.chip .ms, .item-time .ms, .small .ms, .muted .ms, .tab .ms, .box-link .ms, .topic-title .ms, .topic-heading .ms,
.footer .ms, .report-item .ms, .home-mini .ms { font-size: 1.25em; vertical-align: -.24em; }
.event-fact-icon.ms { font-size: 20px; color: var(--muted); }
.home-act-icon.ms { font-size: 18px; color: var(--muted); }
.comm-emoji.ms { max-width: none; color: var(--on-sc); }
.album-placeholder.ms { max-width: none; font-size: 48px; }
h1::first-letter { text-transform: uppercase; }
/* legal pages: comfortable reading width and spacing */
.legal-text { max-width: 68ch; }
.legal-text h1 { margin-bottom: 4px; }
.legal-text h2 { margin: 1.5em 0 .4em; font-size: 1.1rem; }
.legal-text ul, .legal-text ol { padding-left: 22px; display: grid; gap: 6px; margin: 0 0 .8em; }
.legal-text p { line-height: 1.6; }
.legal .tabs { flex-wrap: wrap; }
.tab::first-letter { text-transform: uppercase; }
/* your own status on the profile card: click to edit in place */
.status-edit > summary { list-style: none; cursor: pointer; border-radius: 12px; padding: 2px 6px; margin: 0 -6px 2px; }
.status-edit > summary::-webkit-details-marker { display: none; }
.status-edit > summary:hover { background: var(--card-alt); }
.status-edit[open] > summary { display: none; }
.status-form { display: grid; gap: 6px; margin: 4px 0 6px; }
.status-form input[type=text] { font-size: .9rem; padding: 8px 12px; }
.status-form .btn { justify-self: end; }
/* text for screen readers only */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
/* camera button of a post form: the file field sits invisibly on top of it */
.photo-pick { position: relative; flex: none; background: var(--card-alt); cursor: pointer; overflow: hidden; }
.photo-pick input[type=file] { position: absolute; inset: 0; opacity: 0; cursor: pointer; width: 100%; height: 100%; }
.photo-pick.has-file { background: var(--primary) !important; color: var(--primary-ink) !important; }
.photo-name { font-size: .8rem; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.heart-btn[aria-pressed="true"] { background: var(--pc); color: var(--on-pc); }
.tab-count { font-size: .78em; opacity: .75; }
.error-actions { justify-content: center; }
/* phones: a smaller create button, and the tester feedback bubble moves to the left corner so the
   two never stack over the page's right edge */
@media (max-width: 899px) {
  .fab > summary { width: 56px; height: 56px; border-radius: 18px; }
  .has-fab .fb { right: auto; left: calc(12px + env(safe-area-inset-left)); bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); }
  .has-fab .fb .fb-bubble { margin-left: 0; margin-right: auto; }
}
/* date and time fields have a wide natural size: let them shrink with their column */
input[type=datetime-local], input[type=date] { min-width: 0; }
/* username under the name on the profile card, and its field in Edit profile */
.profile-handle { margin: -2px 0 2px; }
.username-field { display: flex; align-items: center; gap: 6px; margin-top: 4px; }
.username-field input { flex: 1; min-width: 0; }

/* Settings: push notifications */
.push-device { display: grid; gap: 10px; margin-bottom: 14px; padding: 14px; border-radius: 18px; background: var(--card-alt); }
.push-device p { margin: 0; }
.push-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.push-actions:not(:has(button:not([hidden]))) { display: none; }
.push-result:empty { display: none; }

/* ---------- rich text: what the light marks turn into ---------- */
.rich-text ul, .rich-text ol { margin: 6px 0; padding-left: 1.4em; }
.rich-text li { margin: 2px 0; }
.rich-text blockquote {
  margin: 6px 0; padding: 4px 0 4px 12px; border-left: 3px solid var(--pc); color: var(--muted, inherit); font-style: normal;
}
.rich-text > :first-child { margin-top: 0; }
.rich-text > :last-child { margin-bottom: 0; }
.rich-text s { opacity: .7; }

/* the pill that floats over selected text */
.fmt-bar {
  position: fixed; z-index: 60; display: flex; gap: 2px; padding: 4px; border-radius: 999px;
  background: var(--card); border: 1px solid var(--line, rgba(0, 0, 0, .12)); box-shadow: 0 6px 20px rgba(0, 0, 0, .18);
}
.fmt-bar[hidden] { display: none; }
.fmt-bar button {
  width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 50%;
  background: transparent; color: inherit; cursor: pointer; padding: 0;
}
.fmt-bar button[hidden] { display: none; }
.fmt-bar button:hover, .fmt-bar button:focus-visible { background: var(--card-alt); }
.fmt-bar .ms { font-size: 20px; }

/* tall videos (Instagram, TikTok) */
.yt-card.embed-tall { max-width: 320px; aspect-ratio: 9 / 14; }
.yt-card.embed-instagram { background: linear-gradient(135deg, #833ab4, #fd1d1d 60%, #fcb045); }
.yt-card.embed-tiktok { background: linear-gradient(135deg, #111, #25303a); }
.video-frame.video-frame-tall { width: 100%; max-width: 340px; height: 620px; background: transparent; aspect-ratio: auto; border: 0; border-radius: var(--radius-sm); margin-top: 8px; display: block; }

/* players for links pasted into a text box, shown before posting */
.embed-preview { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; align-items: flex-start; }
.yt-card .muted.small { color: #f1f1f8 !important; }
.embed-preview .yt-card { flex: 0 1 260px; margin-top: 0; }
.embed-preview .yt-card.embed-tall { flex-basis: 180px; }
.embed-preview .video-frame { flex: 1 1 100%; max-width: 420px; margin-top: 0; }
.embed-preview .video-frame.video-frame-tall { max-width: 340px; }

/* two-step sign-in: the QR code stays black on white in dark mode too, so phones can read it */
.totp-qr { display: inline-block; padding: 12px; background: #fff; border-radius: 8px; margin: 4px 0 8px; }
.totp-qr svg { display: block; width: 220px; height: 220px; max-width: 100%; }
.totp-secret { font-size: 1.05em; letter-spacing: .04em; word-break: break-all; user-select: all; }
.recovery-codes { list-style: none; padding: 0; margin: 8px 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 6px 16px; }
.recovery-codes code { font-size: 1.05em; user-select: all; }
