/* Glossy early-2010s iPhone world */
/* TeX Gyre Heros: free Helvetica-metric face (GUST Font License, from CTAN),
   so Android and Windows visitors get the iOS-style lettering too */
@font-face { font-family: "TeX Gyre Heros"; src: url("assets/fonts/texgyreheros-regular.otf") format("opentype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "TeX Gyre Heros"; src: url("assets/fonts/texgyreheros-bold.otf") format("opentype"); font-weight: 700; font-display: swap; }

:root {
  --linen: #dfe2e6;
  --linen-dark: #cfd3d9;
  --ink: #2f3238;
  --ink-soft: #6b717b;
  --card: #ffffff;
  --card-edge: #c3c8cf;
  --rule: #e3e6ea;
  --bar-top: #6b93bf;
  --bar-mid: #4a74a3;
  --bar-bottom: #2f5683;
  --bar-edge: #213f63;
  --blue-ink: #34689e;
  --sel: #4a74a3;
  --radius: 10px;
  --font: "Helvetica Neue", "TeX Gyre Heros", Helvetica, Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  color: var(--ink);
  background-color: var(--linen);
  /* woven linen: fine noise over a faint cross-hatch */
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 .35 0 0 0 0 .37 0 0 0 0 .4 0 0 0 .09 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
    repeating-linear-gradient(0deg, rgba(255,255,255,.18) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(0,0,0,.025) 0 1px, transparent 1px 3px);
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(74,116,163,.3); color: inherit; }
html { scrollbar-color: #a9b0ba var(--linen); }
:focus-visible { outline: 3px solid rgba(74,116,163,.55); outline-offset: 2px; border-radius: 8px; }
.bar-button:focus-visible,
.segmented button[aria-pressed="true"]:focus-visible { outline-color: #fff; outline-offset: -5px; }

.ico { width: 24px; height: 24px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.chev { width: 18px; height: 18px; fill: none; stroke: #9aa1ab; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; flex: none; }

/* ---------- Nav bar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; justify-content: center;
  height: calc(52px + env(safe-area-inset-top));
  padding: env(safe-area-inset-top) 92px 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 .24 0'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)'/%3E%3C/svg%3E"),
    linear-gradient(rgba(255,255,255,.22), rgba(255,255,255,.06) 50%, rgba(0,0,0,0) 51%, rgba(0,0,0,.08)),
    linear-gradient(var(--bar-top), var(--bar-mid) 55%, var(--bar-bottom));
  border-bottom: 1px solid var(--bar-edge);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.35), 0 2px 6px rgba(0,0,0,.28);
}
.navbar-title {
  margin: 0;
  font-size: 20px; font-weight: 700;
  color: #fff;
  text-shadow: 0 -1px 0 rgba(0,0,0,.45);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bar-button {
  position: absolute; bottom: 8px;
  height: 34px; min-width: 38px; padding: 0 10px;
  display: grid; place-items: center;
  font: 700 13px var(--font); text-decoration: none; white-space: nowrap;
  text-shadow: 0 -1px 0 rgba(0,0,0,.4);
  border: 1px solid #23456d; border-radius: 6px;
  color: #fff;
  background: linear-gradient(#4b76a7, #3f6a9b 50%, #345d8d 51%, #3a6697);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 1px 0 rgba(255,255,255,.18);
  cursor: pointer;
  filter: drop-shadow(0 -1px 0 rgba(0,0,0,.3));
}
.bar-button .ico { width: 20px; height: 20px; stroke-width: 2.4; }
.bar-icon { right: 10px; width: 38px; padding: 0; }
.bar-left { left: 10px; }
.bar-right { right: 10px; }
.bar-button[hidden] { display: none; }
/* "Done"/"Save": the brighter blue iOS used for the confirming action */
.bar-done {
  border-color: #1d4a8c;
  background: linear-gradient(#3d72c0, #2f66b6 50%, #2459a8 51%, #2a5fae);
}
.bar-done:disabled { opacity: .55; cursor: default; }
/* "Back": the arrow-shaped button */
.bar-back {
  left: 16px; padding-left: 8px;
  border-left: 0; border-top-left-radius: 0; border-bottom-left-radius: 0;
}
.bar-back::before {
  content: ""; position: absolute; left: -9px; top: 4px;
  width: 24px; height: 24px;
  transform: rotate(45deg) skew(8deg, 8deg);
  border: 1px solid #23456d; border-top: 0; border-right: 0;
  border-radius: 0 0 0 5px;
  background: linear-gradient(135deg, #6b93bf, #42709f);
  box-shadow: inset 1px 0 0 rgba(255,255,255,.25);
  z-index: -1;
}
.bar-button:active { background: linear-gradient(#3a6290, #335a86); box-shadow: inset 0 2px 4px rgba(0,0,0,.4); }

/* ---------- Page ---------- */
.page {
  max-width: 560px;
  margin: 0 auto;
  padding: 12px 10px calc(28px + env(safe-area-inset-bottom));
}

.card {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255,255,255,.8), 0 1px 3px rgba(0,0,0,.12);
}

/* ---------- Profile ---------- */
.profile { display: flex; }
.avatar-frame {
  flex: none;
  padding: 10px;
  border-right: 1px solid var(--rule);
}
.avatar {
  display: block;
  width: 104px; height: 104px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #8a9099;
  box-shadow: 0 1px 2px rgba(0,0,0,.35), inset 0 0 0 1px rgba(255,255,255,.4);
  background: #c9ced6;
}
.profile-side { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.stats {
  margin: 0;
  flex: 1;
  display: grid; grid-template-columns: repeat(3, 1fr);
  border-bottom: 1px solid var(--rule);
}
.stat {
  display: flex; flex-direction: column-reverse; align-items: center; justify-content: center;
  padding: 10px 6px;
}
.stat + .stat { border-left: 1px solid var(--rule); }
.stat .stat-num { margin: 0; font-size: 26px; font-weight: 700; color: #3a3d42; font-variant-numeric: tabular-nums; line-height: 1.05; }
.stat .stat-label { font-size: 14px; color: #6a707a; margin-top: 2px; }
.profile-row {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  padding: 0 8px 0 12px; min-height: 52px;
  color: var(--ink); text-decoration: none;
  font-size: clamp(14px, 4vw, 17px); font-weight: 700;
  border-bottom-right-radius: var(--radius);
}
.profile-row span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-row:active { background: linear-gradient(#5a8bd6, #2d64c4); color: #fff; }
.profile-row:active .chev { stroke: #fff; }

.bio {
  margin: 10px 0 0;
  padding: 12px 14px;
  font-size: 16px; line-height: 1.4;
  color: #4a4f57;
}

/* ---------- Segmented control ---------- */
.segmented {
  display: grid; grid-template-columns: 1fr 1fr;
  margin: 12px 0 0;
  border: 1px solid #9ea6b1;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 0 rgba(255,255,255,.8);
}
.segmented button {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 42px;
  border: 0; margin: 0;
  font: 700 15px var(--font);
  color: #575d66;
  text-shadow: 0 1px 0 #fff;
  background: linear-gradient(#fdfdfe, #eceef1 50%, #e2e5e9 51%, #e9ebee);
  cursor: pointer;
}
.segmented button + button { border-left: 1px solid #9ea6b1; }
.segmented button .ico { width: 20px; height: 20px; }
.segmented button:active { background: linear-gradient(#d9dde2, #cfd3d9); box-shadow: inset 0 2px 4px rgba(0,0,0,.18); }
.segmented button[aria-pressed="true"] {
  color: #fff;
  text-shadow: 0 -1px 0 rgba(0,0,0,.35);
  background: linear-gradient(#4a77ab, #3a679b 50%, #2f5a8d 51%, #366395);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.35);
}

/* ---------- Links: grid view ---------- */
.links {
  list-style: none;
  margin: 14px 0 0; padding: 0;
  transition: opacity .18s cubic-bezier(.16,1,.3,1);
}
.links.swapping { opacity: 0; }

.links[data-view="grid"] {
  display: grid; grid-template-columns: repeat(3, 1fr);
  gap: 18px 10px;
  padding: 16px 6px 18px;
  background: rgba(255,255,255,.35);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: var(--radius);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.08), 0 1px 0 rgba(255,255,255,.7);
}
.tile { color: var(--ink); text-decoration: none; -webkit-tap-highlight-color: transparent; }
.links[data-view="grid"] .tile {
  display: flex; flex-direction: column; align-items: center; gap: 7px;
}
.links[data-view="grid"] .note,
.links[data-view="grid"] .chev { display: none; }
.links[data-view="grid"] .label {
  font-size: 14px; font-weight: 700; color: #3b3f46;
  text-shadow: 0 1px 0 rgba(255,255,255,.9);
}

/* The glossy 3D icon */
.gloss {
  --c1: hsl(var(--hue) 72% 64%);
  --c2: hsl(var(--hue) 70% 42%);
  --c3: hsl(var(--hue) 72% 30%);
  position: relative;
  display: grid; place-items: center;
  width: min(100%, 88px); aspect-ratio: 1;
  border-radius: 22%;
  color: #fff;
  background:
    radial-gradient(120% 70% at 50% 110%, rgba(255,255,255,.28), transparent 60%),
    linear-gradient(var(--c1), var(--c2) 60%, var(--c3));
  border: 1px solid var(--c3);
  box-shadow:
    inset 0 1px 0 rgba(255,255,255,.55),
    inset 0 -3px 6px rgba(0,0,0,.18),
    0 2px 4px rgba(0,0,0,.35),
    0 6px 12px -4px rgba(0,0,0,.3);
  overflow: hidden;
  transition: filter .12s, box-shadow .12s;
}
.gloss::after {
  /* curved specular highlight across the top half */
  content: ""; position: absolute; left: -6%; right: -6%; top: -2%; height: 54%;
  border-radius: 0 0 50% 50% / 0 0 26% 26%;
  background: linear-gradient(rgba(255,255,255,.75), rgba(255,255,255,.18));
  pointer-events: none;
  transition: opacity .12s;
}
.gloss .ico {
  position: relative; z-index: 1;
  width: 46%; height: 46%; stroke-width: 2.1;
  filter: drop-shadow(0 -1px 0 rgba(0,0,0,.35)) drop-shadow(0 1px 1px rgba(0,0,0,.25));
}
/* pressed: gradient darkens, highlight dims, inner shadow from the top */
.tile:active .gloss {
  filter: brightness(.82);
  box-shadow: inset 0 3px 6px rgba(0,0,0,.45), inset 0 -1px 0 rgba(255,255,255,.2), 0 1px 2px rgba(0,0,0,.3);
}
.tile:active .gloss::after { opacity: .35; }

/* ---------- Links: list view (grouped table) ---------- */
.links[data-view="list"] {
  background: var(--card);
  border: 1px solid var(--card-edge);
  border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255,255,255,.8), 0 1px 3px rgba(0,0,0,.12);
  overflow: hidden;
}
.links[data-view="list"] li + li { border-top: 1px solid var(--rule); }
.links[data-view="list"] .tile {
  display: grid; grid-template-columns: auto 1fr auto; grid-template-rows: auto auto;
  column-gap: 12px; align-items: center;
  padding: 9px 10px 9px 10px; min-height: 60px;
}
.links[data-view="list"] .gloss { grid-row: 1 / 3; width: 42px; border-radius: 9px; }
.links[data-view="list"] .label { font-size: 17px; font-weight: 700; align-self: end; }
.links[data-view="list"] .note { font-size: 14px; color: var(--ink-soft); grid-column: 2; align-self: start; }
.links[data-view="list"] .chev { grid-column: 3; grid-row: 1 / 3; }
.links[data-view="list"] .tile:active { background: linear-gradient(#5a8bd6, #2d64c4); color: #fff; }
.links[data-view="list"] .tile:active .note { color: #e4ecfa; }
.links[data-view="list"] .tile:active .chev { stroke: #fff; }

/* ---------- Footer + toast ---------- */
.foot {
  margin-top: 22px; text-align: center;
  font-size: 13px; font-weight: 700; color: #5c626b;
  text-shadow: 0 1px 0 rgba(255,255,255,.85);
}
.toast {
  position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom));
  transform: translate(-50%, 12px);
  padding: 10px 16px;
  font-size: 15px; font-weight: 700; color: #fff;
  background: rgba(20,24,30,.82);
  border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,.3);
  opacity: 0; pointer-events: none;
  transition: opacity .2s, transform .3s cubic-bezier(.16,1,.3,1);
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

@media (min-width: 520px) {
  .page { padding-top: 20px; }
  .avatar { width: 120px; height: 120px; }
}
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}

/* ======================================================
   Accounts & editing (login.html, edit.html)
   ====================================================== */
.demo-banner {
  margin: 0 0 10px; padding: 8px 12px;
  font-size: 13px; font-weight: 700; text-align: center; color: #6b4e00;
  background: linear-gradient(#fff6cf, #fbe79a);
  border: 1px solid #d9bd5a; border-radius: 8px;
  text-shadow: 0 1px 0 rgba(255,255,255,.6);
}
.sample-note { margin: 14px 0 0; text-align: center; font-size: 13px; color: #5c626b; text-shadow: 0 1px 0 rgba(255,255,255,.85); }
.foot a { color: var(--blue-ink); text-decoration: none; }
.foot a:hover { text-decoration: underline; text-underline-offset: 3px; }

.empty { display: block; margin: 14px 0 0; padding: 18px 16px; text-align: center; font-size: 15px; color: #4a4f57; text-decoration: none; }
a.empty { color: var(--blue-ink); font-weight: 700; }

/* Message card (not found / not set up) */
.message { margin-top: 8px; padding: 28px 20px 22px; text-align: center; }
.message h2 { margin: 12px 0 6px; font-size: 20px; }
.message p { margin: 0 0 18px; font-size: 15px; line-height: 1.4; color: #4a4f57; }
.message-icon {
  width: 64px; height: 64px; margin: 0 auto; display: grid; place-items: center;
  border-radius: 50%; color: #8a919b;
  background: linear-gradient(#f4f5f7, #dfe2e6);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.2), 0 1px 0 #fff;
}
.message-icon .ico { width: 34px; height: 34px; }

/* Big glossy action button */
.big-button {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%; min-height: 46px; padding: 0 16px;
  font: 700 17px var(--font); color: #fff; text-decoration: none;
  text-shadow: 0 -1px 0 rgba(0,0,0,.35);
  border: 1px solid #1d4a8c; border-radius: 10px;
  background: linear-gradient(#3d72c0, #2f66b6 50%, #2459a8 51%, #2a5fae);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 1px 2px rgba(0,0,0,.25);
  cursor: pointer;
}
.big-button:active { background: linear-gradient(#2c62b4, #2a5ea9); box-shadow: inset 0 2px 5px rgba(0,0,0,.4); }
.big-button:disabled { opacity: .55; cursor: default; }
.big-button.is-red { border-color: #8c1d1d; background: linear-gradient(#ec7a7a, #d63f3f 50%, #c62c2c 51%, #cc3434); }
.big-button.is-plain {
  color: #3b3f46; text-shadow: 0 1px 0 #fff; border-color: #a8afb9;
  background: linear-gradient(#fdfdfe, #eceef1 50%, #e2e5e9 51%, #e9ebee);
}

/* Section headers on linen, iOS settings style */
.group-title {
  margin: 22px 10px 7px; font-size: 15px; font-weight: 700; color: #4d5560;
  text-shadow: 0 1px 0 rgba(255,255,255,.9);
}
.group-hint { margin: 7px 10px 0; font-size: 13px; line-height: 1.35; color: #5c626b; text-shadow: 0 1px 0 rgba(255,255,255,.85); }

/* Grouped table of fields */
.group { padding: 0; overflow: hidden; }
.field {
  display: grid; grid-template-columns: 96px 1fr; align-items: center; gap: 8px;
  min-height: 46px; padding: 0 12px;
}
.group > * + * { border-top: 1px solid var(--rule); }
.field > label { font-size: 15px; font-weight: 700; color: #3b3f46; }
.field input, .field textarea {
  width: 100%; min-width: 0; border: 0; padding: 12px 0; margin: 0;
  font: 16px var(--font); color: #34689e; background: transparent; outline: none;
}
.field textarea { resize: vertical; min-height: 88px; line-height: 1.4; }
.field.stack { grid-template-columns: 1fr; gap: 0; padding-top: 10px; }
.field.stack > label { font-size: 13px; color: #5c626b; }
.field.stack textarea { padding-top: 4px; }
.field input::placeholder, .field textarea::placeholder { color: #6a707a; }
.field:focus-within { background: #f3f7fd; }
.field .count { grid-column: 1 / -1; justify-self: end; font-size: 12px; color: #6a707a; padding-bottom: 6px; font-variant-numeric: tabular-nums; }
.field-error { margin: 7px 10px 0; font-size: 13px; font-weight: 700; color: #b3261e; }
.field-error:empty { display: none; }

/* Avatar editor */
.avatar-edit { display: flex; align-items: center; gap: 14px; padding: 12px; }
.avatar-edit .avatar { width: 84px; height: 84px; flex: none; }
.avatar-edit .buttons { display: grid; gap: 8px; flex: 1; }
.avatar-edit .big-button { min-height: 38px; font-size: 15px; }

/* Stats editor: three label/number pairs */
.stats-edit { display: grid; grid-template-columns: repeat(3, 1fr); }
.stats-edit .stat-edit { padding: 8px 8px 10px; display: grid; gap: 2px; }
.stats-edit .stat-edit + .stat-edit { border-left: 1px solid var(--rule); }
.stats-edit input {
  width: 100%; border: 0; background: transparent; text-align: center; outline: none;
  font: 16px var(--font); color: #34689e; padding: 6px 0;
}
.stats-edit input.num { font-size: 22px; font-weight: 700; font-variant-numeric: tabular-nums; }
.stats-edit .stat-edit:focus-within { background: #f3f7fd; }

/* Link editor rows */
.link-edit { padding: 10px 10px 12px; display: grid; gap: 8px; }
.link-head { display: flex; align-items: center; gap: 10px; }
.link-head .gloss { width: 42px; border-radius: 9px; flex: none; }
.link-head .title { flex: 1; min-width: 0; font-size: 16px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.round-btn {
  width: 30px; height: 30px; flex: none; display: grid; place-items: center; padding: 0;
  border-radius: 50%; border: 1px solid #9ea6b1; color: #4d5560; cursor: pointer;
  background: linear-gradient(#fdfdfe, #e4e7eb);
  box-shadow: inset 0 1px 0 #fff, 0 1px 1px rgba(0,0,0,.15);
}
.round-btn .ico { width: 18px; height: 18px; stroke-width: 2.6; }
.round-btn:active { background: linear-gradient(#d9dde2, #cfd3d9); box-shadow: inset 0 2px 3px rgba(0,0,0,.2); }
.round-btn:disabled { opacity: .4; cursor: default; }
.round-btn.is-delete { color: #fff; border-color: #9a1f1f; background: linear-gradient(#f07c7c, #d23a3a 55%, #b92828); box-shadow: inset 0 1px 0 rgba(255,255,255,.45), 0 1px 1px rgba(0,0,0,.2); }
.link-edit .mini { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.link-edit input {
  width: 100%; min-width: 0; padding: 9px 10px; margin: 0;
  font: 16px var(--font); color: var(--ink);
  border: 1px solid #b9c0c9; border-radius: 7px; background: #fff;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.12);
}
.link-edit input:focus { border-color: #4a74a3; outline: none; box-shadow: inset 0 1px 2px rgba(0,0,0,.12), 0 0 0 3px rgba(74,116,163,.25); }
.link-edit input[aria-invalid="true"] { border-color: #b3261e; }
.picker { display: flex; flex-wrap: wrap; gap: 6px; }
.picker button {
  width: 34px; height: 34px; padding: 0; display: grid; place-items: center; cursor: pointer;
  border: 1px solid #b9c0c9; border-radius: 8px; color: #4d5560;
  background: linear-gradient(#fdfdfe, #e9ebee);
}
.picker button .ico { width: 18px; height: 18px; }
.picker button[aria-pressed="true"] { color: #fff; border-color: #23456d; background: linear-gradient(#5f8cc0, #335f93); box-shadow: inset 0 1px 3px rgba(0,0,0,.35); }
.picker .swatch, .picker .swatch[aria-pressed="true"] { background: linear-gradient(hsl(var(--hue) 72% 64%), hsl(var(--hue) 70% 42%)); border-color: hsl(var(--hue) 72% 30%); }
.picker .swatch[aria-pressed="true"] { border-color: #fff; box-shadow: 0 0 0 2px #34689e; }
.add-row {
  display: flex; align-items: center; gap: 10px; width: 100%;
  min-height: 48px; padding: 0 12px; border: 0; cursor: pointer;
  font: 700 16px var(--font); color: #34689e; background: transparent; text-align: left;
}
.add-row .round-btn { color: #fff; border-color: #1f6b2c; background: linear-gradient(#7fd88c, #38a94b 55%, #2a8b3b); pointer-events: none; }
.add-row:active { background: #eef3fa; }
.add-row:disabled { color: #8d939c; cursor: default; }

.stack-gap { display: grid; gap: 10px; margin-top: 22px; }

/* Login screen */
.login-hero { text-align: center; margin: 18px 0 4px; }
.login-hero .gloss { width: 76px; margin: 0 auto; --hue: 214; }
.login-hero h2 { margin: 12px 0 2px; font-size: 22px; text-shadow: 0 1px 0 rgba(255,255,255,.9); }
.login-hero p { margin: 0; font-size: 15px; color: #4d5560; text-shadow: 0 1px 0 rgba(255,255,255,.85); }

/* ======================================================
   Move and Scale (photo crop sheet)
   ====================================================== */
body.no-scroll { overflow: hidden; }
.crop-sheet {
  position: fixed; inset: 0; z-index: 100;
  display: grid; grid-template-rows: auto 1fr auto;
  background: #000; color: #fff;
  opacity: 0; transition: opacity .2s cubic-bezier(.16,1,.3,1);
}
.crop-sheet.open { opacity: 1; }
.crop-top {
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px; text-align: center;
  background: linear-gradient(rgba(40,40,44,.95), rgba(10,10,12,.95));
  border-bottom: 1px solid #000; box-shadow: inset 0 -1px 0 rgba(255,255,255,.08);
}
.crop-top h2 { margin: 0; font-size: 18px; font-weight: 700; text-shadow: 0 -1px 0 #000; }
.crop-stage {
  position: relative; overflow: hidden; touch-action: none; cursor: grab; outline: none;
}
.crop-stage.dragging { cursor: grabbing; }
.crop-stage:focus-visible .crop-frame { border-color: #8db8ff; }
.crop-photo {
  position: absolute; left: 0; top: 0; max-width: none; user-select: none; -webkit-user-drag: none;
  transform-origin: 0 0; pointer-events: none;
}
.crop-frame {
  position: absolute; pointer-events: none;
  border: 1px solid rgba(255,255,255,.85);
  box-shadow: 0 0 0 9999px rgba(0,0,0,.62);
}
.crop-bottom {
  padding: 12px 14px calc(14px + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(40,40,44,.95), rgba(10,10,12,.98));
  border-top: 1px solid #000; box-shadow: inset 0 1px 0 rgba(255,255,255,.1);
  display: grid; gap: 12px;
}
.crop-zoom-row { display: flex; align-items: center; gap: 10px; max-width: 420px; width: 100%; margin: 0 auto; }
.crop-zoom-icon { width: 18px; height: 18px; border: 2px solid #c9ccd2; border-radius: 4px; flex: none; }
.crop-zoom-icon.small { width: 11px; height: 11px; border-width: 1.5px; border-radius: 2px; }
/* glossy iOS slider */
.crop-zoom { flex: 1; -webkit-appearance: none; appearance: none; height: 28px; background: transparent; margin: 0; }
.crop-zoom::-webkit-slider-runnable-track {
  height: 9px; border-radius: 5px; border: 1px solid #000;
  background: linear-gradient(#2a5fae, #6c9ee6); box-shadow: inset 0 1px 2px rgba(0,0,0,.5), 0 1px 0 rgba(255,255,255,.12);
}
.crop-zoom::-moz-range-track { height: 9px; border-radius: 5px; border: 1px solid #000; background: linear-gradient(#e9ebee, #fff); }
.crop-zoom::-moz-range-progress { height: 9px; border-radius: 5px; background: linear-gradient(#2a5fae, #6c9ee6); }
.crop-zoom::-webkit-slider-thumb {
  -webkit-appearance: none; width: 26px; height: 26px; margin-top: -10px; border-radius: 50%;
  border: 1px solid #6b7079; background: linear-gradient(#ffffff, #d5d8dd);
  box-shadow: 0 1px 3px rgba(0,0,0,.6), inset 0 1px 0 #fff;
}
.crop-zoom::-moz-range-thumb {
  width: 24px; height: 24px; border-radius: 50%;
  border: 1px solid #6b7079; background: linear-gradient(#ffffff, #d5d8dd);
  box-shadow: 0 1px 3px rgba(0,0,0,.6);
}
.crop-zoom:focus-visible { outline: 2px solid #8db8ff; outline-offset: 2px; border-radius: 8px; }
.crop-actions { display: flex; justify-content: space-between; gap: 12px; max-width: 420px; width: 100%; margin: 0 auto; }
.crop-btn {
  min-width: 96px; height: 38px; padding: 0 18px; cursor: pointer;
  font: 700 15px var(--font); color: #fff; text-shadow: 0 -1px 0 #000;
  border: 1px solid #000; border-radius: 7px;
  background: linear-gradient(#5b5e65, #33363b 50%, #24262a 51%, #2b2d31);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.25), 0 1px 0 rgba(255,255,255,.1);
}
.crop-btn:active { background: linear-gradient(#1d1f22, #2a2c30); box-shadow: inset 0 2px 4px rgba(0,0,0,.6); }
.crop-btn.is-choose { border-color: #0f2f63; background: linear-gradient(#3d72c0, #2f66b6 50%, #2459a8 51%, #2a5fae); }
.crop-btn.is-choose:active { background: linear-gradient(#21508f, #285a9e); }
.crop-btn:focus-visible { outline: 2px solid #8db8ff; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .crop-sheet { transition: none; } }

/* ======================================================
   Search + bottom tab bar
   ====================================================== */
/* iOS search bar: grey-blue strip with a rounded white field */
.searchbar {
  position: sticky; top: calc(52px + env(safe-area-inset-top)); z-index: 9;
  padding: 7px 10px;
  background: linear-gradient(#cdd5df, #a9b6c4);
  border-bottom: 1px solid #7d8a99;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
}
.search-field {
  display: flex; align-items: center; gap: 6px;
  max-width: 560px; margin: 0 auto; height: 34px; padding: 0 6px 0 10px;
  background: #fff; border: 1px solid #8a96a5; border-radius: 17px;
  box-shadow: inset 0 1px 3px rgba(0,0,0,.25), 0 1px 0 rgba(255,255,255,.5);
  color: #6a707a; cursor: text;
}
.search-field > .ico { width: 18px; height: 18px; stroke-width: 2.4; flex: none; }
.search-field input {
  flex: 1; min-width: 0; height: 100%; border: 0; padding: 0; outline: none; background: transparent;
  font: 16px var(--font); color: var(--ink);
}
.search-field input::placeholder { color: #6a707a; }
.search-field input::-webkit-search-cancel-button { display: none; }
.search-field:focus-within { border-color: #4a74a3; box-shadow: inset 0 1px 3px rgba(0,0,0,.25), 0 0 0 3px rgba(74,116,163,.3); }
.search-clear {
  width: 22px; height: 22px; padding: 0; border: 0; border-radius: 50%; flex: none; cursor: pointer;
  display: grid; place-items: center; color: #fff; background: #9aa1ab;
}
.search-clear .ico { width: 14px; height: 14px; stroke-width: 3; }

.people { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.people li + li { border-top: 1px solid var(--rule); }
.person {
  display: flex; align-items: center; gap: 12px; min-height: 62px; padding: 8px 10px;
  color: var(--ink); text-decoration: none;
}
.person-pic {
  width: 44px; height: 44px; flex: none; object-fit: cover; border-radius: 4px;
  border: 1px solid #8a9099; background: #c9ced6; box-shadow: 0 1px 2px rgba(0,0,0,.3);
}
.person-text { flex: 1; min-width: 0; display: grid; }
.person-user, .person-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.person-user { font-size: 17px; font-weight: 700; }
.person-name { font-size: 14px; color: var(--ink-soft); }
.person:active { background: linear-gradient(#5a8bd6, #2d64c4); color: #fff; }
.person:active .person-name { color: #e4ecfa; }
.person:active .chev { stroke: #fff; }
.search-page .group-title:first-child { margin-top: 8px; }

/* Glossy black tab bar */
body.has-tabbar .page { padding-bottom: calc(84px + env(safe-area-inset-bottom)); }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  display: grid; grid-template-columns: repeat(3, 1fr);
  padding: 4px 6px env(safe-area-inset-bottom);
  background:
    linear-gradient(rgba(255,255,255,.14), rgba(255,255,255,.04) 50%, rgba(0,0,0,0) 51%),
    linear-gradient(#3b3d42, #161719);
  border-top: 1px solid #000;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.12), 0 -1px 4px rgba(0,0,0,.25);
}
.tab {
  display: grid; justify-items: center; gap: 2px; padding: 5px 0 4px; margin: 0 4px;
  border-radius: 5px; color: #9ba0a8; text-decoration: none;
  -webkit-tap-highlight-color: transparent;
}
.tab-icon .ico { width: 26px; height: 26px; stroke-width: 2.2; filter: drop-shadow(0 -1px 0 #000); }
.tab-label { font-size: 11px; font-weight: 700; text-shadow: 0 -1px 0 #000; }
.tab[aria-current="page"] {
  color: #fff;
  background: rgba(255,255,255,.1);
  box-shadow: inset 0 1px 3px rgba(0,0,0,.6), 0 1px 0 rgba(255,255,255,.08);
}
.tab[aria-current="page"] .tab-icon .ico { color: #7cc0ff; filter: drop-shadow(0 0 4px rgba(90,170,255,.8)); }
.tab:active { background: rgba(255,255,255,.06); }
.tab:focus-visible { outline: 2px solid #8db8ff; outline-offset: -2px; }
body.has-tabbar .toast { bottom: calc(84px + env(safe-area-inset-bottom)); }

/* ======================================================
   Followers
   ====================================================== */
a.stat { color: inherit; text-decoration: none; }
a.stat:active { background: linear-gradient(#5a8bd6, #2d64c4); }
a.stat:active .stat-num, a.stat:active .stat-label { color: #fff; }
.stat .stat-num, .stat .stat-label { display: block; text-align: center; }
.bio-name { display: block; font-size: 16px; color: var(--ink); margin-bottom: 2px; }
.follow-row { padding: 7px 10px; }
.follow-btn {
  display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; min-height: 38px;
  font: 700 16px var(--font); color: #fff; text-decoration: none; cursor: pointer;
  text-shadow: 0 -1px 0 rgba(0,0,0,.35);
  border: 1px solid #1d4a8c; border-radius: 6px;
  background: linear-gradient(#3d72c0, #2f66b6 50%, #2459a8 51%, #2a5fae);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 1px 1px rgba(0,0,0,.2);
}
.follow-btn .ico { width: 18px; height: 18px; stroke-width: 3; }
.follow-btn:active { background: linear-gradient(#21508f, #285a9e); box-shadow: inset 0 2px 4px rgba(0,0,0,.4); }
/* Following: the green "checked" state */
.follow-btn[aria-pressed="true"] {
  border-color: #2b6a1f;
  background: linear-gradient(#5aa84a, #3f8f30 50%, #347f26 51%, #3a872c);
}
.follow-btn[aria-pressed="true"]:active { background: linear-gradient(#2c6b21, #347a28); }
.follow-btn:disabled { opacity: .7; cursor: default; }
.people-empty { margin-top: 8px; }
.stats-edit .is-auto { align-content: center; justify-items: center; background: #f6f7f9; }
.stats-edit .auto-num { font-size: 15px; font-weight: 700; color: #6a707a; padding: 9px 0 6px; }
.stats-edit .auto-label { font-size: 16px; color: #6a707a; padding: 6px 0; }

/* ======================================================
   Photo posts
   ====================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Profile: photos grid */
.photos { margin-top: 6px; }
.photos-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.photos-head .group-title { margin-right: auto; }
.small-button {
  display: inline-flex; align-items: center; gap: 5px; height: 30px; padding: 0 12px; margin: 14px 2px 0 0;
  font: 700 14px var(--font); color: #fff; text-decoration: none; white-space: nowrap;
  text-shadow: 0 -1px 0 rgba(0,0,0,.35);
  border: 1px solid #1d4a8c; border-radius: 6px;
  background: linear-gradient(#3d72c0, #2f66b6 50%, #2459a8 51%, #2a5fae);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.4), 0 1px 1px rgba(0,0,0,.2);
}
.small-button .ico { width: 15px; height: 15px; stroke-width: 3; }
.small-button:active { background: linear-gradient(#21508f, #285a9e); }
.photo-grid {
  list-style: none; margin: 0; padding: 3px;
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 3px;
  background: #fff; border: 1px solid var(--card-edge); border-radius: var(--radius);
  box-shadow: 0 1px 0 rgba(255,255,255,.8), 0 1px 3px rgba(0,0,0,.12);
}
.photo-cell { display: block; aspect-ratio: 1; overflow: hidden; background: #d9dde3; }
.photo-grid li:first-child .photo-cell { border-top-left-radius: 7px; }
.photo-grid li:nth-child(3) .photo-cell { border-top-right-radius: 7px; }
.photo-cell img { display: block; width: 100%; height: 100%; object-fit: cover; transition: filter .12s; }
.photo-cell:active img { filter: brightness(.8); }

/* New Post */
.post-pick {
  position: relative; display: grid; place-items: center; aspect-ratio: 1; overflow: hidden; cursor: pointer;
  background: repeating-linear-gradient(45deg, #f4f5f7 0 10px, #eceef1 10px 20px);
}
.post-pick-empty { display: grid; justify-items: center; gap: 10px; }
.post-pick-empty .gloss { width: 76px; }
.post-pick-text { font-size: 17px; font-weight: 700; color: #34689e; }
.post-preview { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }

/* Post card */
.post { padding: 0; overflow: hidden; }
.post-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; }
.post-author { display: flex; align-items: center; gap: 9px; min-width: 0; color: #2d5d93; font-weight: 700; font-size: 16px; text-decoration: none; }
.post-author span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.post-avatar { width: 34px; height: 34px; flex: none; object-fit: cover; border-radius: 4px; border: 1px solid #8a9099; background: #c9ced6; }
.post-time { flex: none; font-size: 13px; color: #6a707a; }
.post-photo { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; background: #d9dde3; border-block: 1px solid var(--rule); }

.post-actions {
  display: flex; align-items: center; gap: 6px; padding: 8px 10px;
  background: linear-gradient(#fafbfc, #eef0f3); border-bottom: 1px solid var(--rule);
}
.act {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-width: 44px; height: 34px; padding: 0 10px; cursor: pointer;
  font: 700 14px var(--font); color: #4d5560; font-variant-numeric: tabular-nums;
  border: 1px solid #b4bbc5; border-radius: 6px;
  background: linear-gradient(#fdfdfe, #eceef1 50%, #e2e5e9 51%, #e9ebee);
  box-shadow: inset 0 1px 0 #fff, 0 1px 1px rgba(0,0,0,.1);
  text-shadow: 0 1px 0 #fff;
}
.act .ico { width: 19px; height: 19px; }
.act:active { background: linear-gradient(#d9dde2, #cfd3d9); box-shadow: inset 0 2px 3px rgba(0,0,0,.2); }
.act-end { margin-left: auto; }
.act-like[aria-pressed="true"] {
  color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,.3); border-color: #1d4a8c;
  background: linear-gradient(#3d72c0, #2f66b6 50%, #2459a8 51%, #2a5fae);
}
.act-dislike[aria-pressed="true"] {
  color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,.3); border-color: #8c1d1d;
  background: linear-gradient(#e06b6b, #c94040 50%, #b83232 51%, #be3838);
}
.act-like[aria-pressed="true"] .ico, .act-dislike[aria-pressed="true"] .ico { filter: drop-shadow(0 -1px 0 rgba(0,0,0,.3)); }

.post-caption { margin: 0; padding: 10px 12px 4px; font-size: 15px; line-height: 1.4; color: var(--ink); overflow-wrap: anywhere; }
.post-caption a, .comment-user { color: #2d5d93; font-weight: 700; text-decoration: none; }

.comments { list-style: none; margin: 0; padding: 4px 0; }
.comment { display: flex; align-items: flex-start; gap: 9px; padding: 7px 6px 7px 12px; }
.comment .post-avatar { width: 28px; height: 28px; }
.comment-body { flex: 1; min-width: 0; margin: 3px 0 0; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.comment-time { display: block; margin-top: 2px; font-size: 12px; color: #6a707a; }
.comment-more {
  width: 32px; height: 28px; flex: none; padding: 0; border: 0; border-radius: 6px; background: transparent; cursor: pointer;
  color: #8a919b; display: grid; place-items: center;
}
.comment-more .ico { width: 20px; height: 20px; stroke-width: 2.6; }
.comment-more:active { background: #e8ebef; }
.comment-form { display: flex; gap: 8px; padding: 8px 10px 10px; border-top: 1px solid var(--rule); background: #f6f7f9; }
.comment-input {
  flex: 1; min-width: 0; height: 36px; padding: 0 12px;
  font: 16px var(--font); color: var(--ink);
  border: 1px solid #b9c0c9; border-radius: 18px; background: #fff;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.12);
}
.comment-input:focus { outline: none; border-color: #4a74a3; box-shadow: inset 0 1px 2px rgba(0,0,0,.12), 0 0 0 3px rgba(74,116,163,.25); }
.comment-input::placeholder { color: #6a707a; }
.comment-send {
  height: 36px; padding: 0 14px; cursor: pointer;
  font: 700 15px var(--font); color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,.35);
  border: 1px solid #1d4a8c; border-radius: 7px;
  background: linear-gradient(#3d72c0, #2f66b6 50%, #2459a8 51%, #2a5fae);
}
.comment-send:disabled { opacity: .5; cursor: default; }
.comment-login { margin: 0; padding: 12px; text-align: center; font-size: 14px; color: #4a4f57; border-top: 1px solid var(--rule); }
.comment-login a { color: #2d5d93; font-weight: 700; }

/* iOS action sheet */
.action-sheet { position: fixed; inset: 0; z-index: 120; }
.sheet-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,.45); opacity: 0; transition: opacity .2s; }
.sheet-panel {
  position: absolute; left: 0; right: 0; bottom: 0;
  display: grid; gap: 9px; padding: 14px 18px calc(18px + env(safe-area-inset-bottom));
  background: linear-gradient(rgba(70,74,82,.96), rgba(30,32,36,.97));
  border-top: 1px solid #000; box-shadow: inset 0 1px 0 rgba(255,255,255,.18);
  transform: translateY(100%); transition: transform .28s cubic-bezier(.16,1,.3,1);
}
.action-sheet.open .sheet-backdrop { opacity: 1; }
.action-sheet.open .sheet-panel { transform: none; }
.sheet-title { margin: 0 0 4px; text-align: center; font-size: 14px; line-height: 1.35; color: #e3e6ea; text-shadow: 0 -1px 0 #000; }
.sheet-btn {
  height: 46px; width: 100%; max-width: 480px; justify-self: center; cursor: pointer;
  font: 700 18px var(--font); color: #1b1d21; text-shadow: 0 1px 0 #fff;
  border: 1px solid #111; border-radius: 9px;
  background: linear-gradient(#ffffff, #e6e8ec 50%, #d9dce1 51%, #e1e4e8);
  box-shadow: inset 0 1px 0 #fff, 0 1px 0 rgba(255,255,255,.12);
}
.sheet-btn:active { background: linear-gradient(#cfd3d9, #c3c8cf); }
.sheet-btn.is-red { color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,.4); background: linear-gradient(#ec7a7a, #d63f3f 50%, #c62c2c 51%, #cc3434); }
.sheet-btn.is-cancel { margin-top: 6px; color: #fff; text-shadow: 0 -1px 0 #000; background: linear-gradient(#5b5e65, #33363b 50%, #24262a 51%, #2b2d31); }
.sheet-btn:focus-visible { outline: 2px solid #8db8ff; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .sheet-panel, .sheet-backdrop { transition: none; } }

/* ======================================================
   Comment replies
   ====================================================== */
:root { --ease-out-strong: cubic-bezier(0.23, 1, 0.32, 1); }

.comment-main { flex: 1; min-width: 0; }
.comment-main .comment-body { margin: 3px 0 0; }
.comment-meta { display: flex; align-items: center; gap: 12px; margin-top: 3px; }
.comment-meta .comment-time { display: inline; margin: 0; }
.comment-reply {
  padding: 2px 0; border: 0; background: none; cursor: pointer;
  font: 700 12px var(--font); color: #5c626b;
  transition: transform 140ms var(--ease-out-strong);
}
.comment-reply:active { transform: scale(0.95); color: #2d5d93; }

/* "—— View 2 replies ⌄" */
.replies-toggle {
  display: flex; align-items: center; gap: 8px;
  margin: 0 0 4px 49px; padding: 4px 8px 4px 0; border: 0; background: none; cursor: pointer;
  font: 700 12px var(--font); color: #5c626b;
  transition: transform 140ms var(--ease-out-strong);
}
.replies-toggle:active { transform: scale(0.97); }
.replies-line { width: 24px; height: 1px; background: #b4bbc5; }
.replies-chev { width: 14px; height: 14px; stroke-width: 2.6; transition: transform 200ms var(--ease-out-strong); }
.replies-toggle[aria-expanded="true"] .replies-chev { transform: rotate(180deg); }
.replies-toggle:focus-visible { outline: 2px solid rgba(74,116,163,.55); outline-offset: 2px; border-radius: 6px; }

/* The drop-down: grid rows 0fr → 1fr opens to the content's real height */
.replies-panel {
  display: grid; grid-template-rows: 0fr; opacity: 0;
  transition: grid-template-rows 150ms var(--ease-out-strong), opacity 120ms ease;
}
.replies-panel[data-open="true"] {
  grid-template-rows: 1fr; opacity: 1;
  transition: grid-template-rows 200ms var(--ease-out-strong), opacity 200ms ease;
}
.replies-clip { overflow: hidden; min-height: 0; }
.replies {
  list-style: none; margin: 0 0 4px 37px; padding: 0 0 0 12px;
  border-left: 2px solid #e3e6ea;
  transform: translateY(-4px);
  transition: transform 200ms var(--ease-out-strong);
}
.replies-panel[data-open="true"] .replies { transform: none; }
.replies .comment { padding-left: 0; }
.replies .post-avatar { width: 24px; height: 24px; }

/* Compose box + "Replying to @user ×" chip */
.comment-compose { border-top: 1px solid var(--rule); background: #f6f7f9; }
.comment-compose .comment-form { border-top: 0; background: none; }
.reply-chip {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin: 8px 10px 0; padding: 5px 6px 5px 12px;
  font-size: 13px; color: #34689e;
  background: linear-gradient(#eef4fc, #dfe9f7);
  border: 1px solid #b7c9e2; border-radius: 15px;
  box-shadow: inset 0 1px 0 #fff;
  opacity: 1; transform: none;
  transition: opacity 180ms ease, transform 180ms var(--ease-out-strong);
}
@starting-style { .reply-chip { opacity: 0; transform: translateY(4px); } }
.reply-chip strong { color: #2d5d93; }
.reply-chip-x {
  width: 22px; height: 22px; padding: 0; flex: none; cursor: pointer;
  display: grid; place-items: center; border: 0; border-radius: 50%;
  color: #fff; background: #8a9fbd;
  transition: transform 140ms var(--ease-out-strong);
}
.reply-chip-x .ico { width: 13px; height: 13px; stroke-width: 3; }
.reply-chip-x:active { transform: scale(0.9); }

@media (prefers-reduced-motion: reduce) {
  .replies-panel, .replies-panel[data-open="true"] { transition: opacity 150ms ease; }
  .replies, .replies-chev, .reply-chip { transition: none; transform: none; }
}

/* ======================================================
   Notifications
   ====================================================== */
:root { --ease-drawer: cubic-bezier(0.32, 0.72, 0, 1); }

.tabbar { grid-template-columns: repeat(4, 1fr); }
.tab-icon { position: relative; display: inline-grid; }

/* Red glossy iOS badge */
.tab-badge {
  position: absolute; top: -5px; left: 15px; min-width: 19px; height: 19px; padding: 0 5px;
  display: grid; place-items: center;
  font: 700 11px/1 var(--font); color: #fff; font-variant-numeric: tabular-nums;
  text-shadow: 0 -1px 0 rgba(0,0,0,.35);
  background: linear-gradient(#ff7b7b, #e12c2c 50%, #cc1d1d 51%, #d42323);
  border: 2px solid #fff; border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,0,0,.6);
}

/* Pop-up banner: drops in under the nav bar */
.note-banner {
  position: fixed; left: 8px; right: 8px; top: calc(58px + env(safe-area-inset-top)); z-index: 90;
  max-width: 540px; margin: 0 auto;
  display: flex; align-items: center; gap: 10px; padding: 9px 10px;
  color: #fff; text-decoration: none;
  background: linear-gradient(rgba(58,60,66,.97), rgba(18,19,22,.97));
  border: 1px solid #000; border-radius: 10px;
  box-shadow: inset 0 1px 0 rgba(255,255,255,.18), 0 6px 18px rgba(0,0,0,.4);
  transform: translateY(calc(-100% - 70px)); opacity: 0;
  transition: transform 200ms var(--ease-out-strong), opacity 160ms ease;
  touch-action: pan-x;
}
.note-banner.show {
  transform: none; opacity: 1;
  transition: transform 400ms var(--ease-drawer), opacity 200ms ease;
}
.note-banner:active { filter: brightness(1.15); }
.note-banner-pic, .note-banner-thumb { width: 36px; height: 36px; flex: none; object-fit: cover; border-radius: 5px; border: 1px solid #000; background: #555; }
.note-banner-text { flex: 1; min-width: 0; font-size: 14px; line-height: 1.3; text-shadow: 0 -1px 0 #000;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-banner-text strong { font-weight: 700; }

/* Activity list */
.notes { list-style: none; margin: 0; padding: 0; overflow: hidden; }
.notes li + li { border-top: 1px solid var(--rule); }
.note { display: flex; align-items: center; gap: 11px; padding: 9px 10px; color: var(--ink); text-decoration: none; }
.note.is-unread { background: #eaf2fc; }
.note-pic { width: 40px; height: 40px; flex: none; object-fit: cover; border-radius: 4px; border: 1px solid #8a9099; background: #c9ced6; }
.note-text { flex: 1; min-width: 0; display: grid; gap: 2px; font-size: 15px; line-height: 1.35; overflow-wrap: anywhere; }
.note-text strong { color: #2d5d93; }
.note-time { font-size: 12px; color: #6a707a; }
.note-thumb { width: 44px; height: 44px; flex: none; object-fit: cover; border-radius: 3px; border: 1px solid #c3c8cf; }
.note:active { background: linear-gradient(#5a8bd6, #2d64c4); color: #fff; }
.note:active .note-text strong, .note:active .note-time { color: #fff; }

/* Post: "Liked by ..." + Likes sheet */
.liked-by {
  display: flex; align-items: center; gap: 7px; width: 100%; padding: 9px 12px 0; border: 0; background: none; cursor: pointer;
  font: 14px var(--font); color: var(--ink); text-align: left;
}
.liked-by .ico { width: 16px; height: 16px; color: #2f66b6; flex: none; }
.liked-by strong { color: #2d5d93; }
.likes-panel {
  position: absolute; left: 0; right: 0; bottom: 0; max-height: 70vh; display: grid; grid-template-rows: auto 1fr;
  max-width: 560px; margin: 0 auto;
  background: var(--linen); border-radius: 12px 12px 0 0; overflow: hidden;
  box-shadow: 0 -4px 20px rgba(0,0,0,.35);
  transform: translateY(100%); transition: transform 300ms var(--ease-drawer);
}
.likes-sheet.open .likes-panel { transform: none; }
.likes-head {
  display: flex; align-items: center; justify-content: center; position: relative; height: 48px;
  background: linear-gradient(var(--bar-top), var(--bar-mid) 55%, var(--bar-bottom));
  border-bottom: 1px solid var(--bar-edge);
}
.likes-head h2 { margin: 0; font-size: 18px; color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,.45); }
.likes-done {
  position: absolute; right: 10px; height: 32px; padding: 0 12px; cursor: pointer;
  font: 700 13px var(--font); color: #fff; text-shadow: 0 -1px 0 rgba(0,0,0,.4);
  border: 1px solid #1d4a8c; border-radius: 6px;
  background: linear-gradient(#3d72c0, #2f66b6 50%, #2459a8 51%, #2a5fae);
}
.likes-list { margin: 10px; padding-bottom: env(safe-area-inset-bottom); overflow-y: auto; background: #fff; border: 1px solid var(--card-edge); border-radius: var(--radius); }
.likes-empty { padding: 18px; text-align: center; color: #4a4f57; }

/* A comment you arrived at from a notification */
.comment { transition: background-color 900ms ease; border-radius: 8px; }
.comment.is-highlight { background-color: #fff3bf; transition: background-color 150ms ease; }

@media (prefers-reduced-motion: reduce) {
  .note-banner, .note-banner.show { transition: opacity 150ms ease; transform: none; }
  .likes-panel { transition: none; }
}

/* ======================================================
   Video posts + upload progress
   ====================================================== */
.post-pick-sub { font-size: 13px; color: #5c626b; }
.post-preview.is-video, .post-photo.is-video { object-fit: contain; background: #000; }
.post-photo.is-video { display: block; width: 100%; aspect-ratio: 1; }
.video-note { margin: 8px 10px 0; font-size: 13px; font-weight: 700; color: #4d5560; text-shadow: 0 1px 0 rgba(255,255,255,.85); }

/* iOS 6 style progress bar: dark inset track, glossy blue fill */
.progress { margin: 12px 0 0; padding: 12px 12px 14px; background: #fff; border: 1px solid var(--card-edge); border-radius: var(--radius); box-shadow: 0 1px 3px rgba(0,0,0,.12); }
.progress-text { margin: 0 0 8px; font-size: 14px; font-weight: 700; color: #3b3f46; font-variant-numeric: tabular-nums; }
.progress-track {
  height: 11px; border-radius: 6px; overflow: hidden;
  background: linear-gradient(#c9ced6, #e9ecef);
  border: 1px solid #8e96a1; box-shadow: inset 0 1px 2px rgba(0,0,0,.35);
}
.progress-bar {
  display: block; height: 100%; width: 100%;
  transform-origin: left center; transform: scaleX(0.02);
  background: linear-gradient(#8cbcf2, #3f7fd6 50%, #2c6cc6 51%, #3a7bd2);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.5);
  transition: transform 250ms var(--ease-out-strong);
}
.progress-cancel {
  margin-top: 10px; height: 30px; padding: 0 14px; cursor: pointer;
  font: 700 13px var(--font); color: #3b3f46; text-shadow: 0 1px 0 #fff;
  border: 1px solid #a8afb9; border-radius: 6px;
  background: linear-gradient(#fdfdfe, #eceef1 50%, #e2e5e9 51%, #e9ebee);
}

/* Play badge on video thumbnails in the grid */
.photo-cell { position: relative; }
.play-badge {
  position: absolute; top: 6px; right: 6px; width: 24px; height: 24px;
  display: grid; place-items: center; border-radius: 50%;
  color: #fff; background: rgba(0,0,0,.45); border: 1px solid rgba(255,255,255,.7);
  box-shadow: 0 1px 3px rgba(0,0,0,.4);
}
.play-badge .ico { width: 13px; height: 13px; margin-left: 2px; stroke: none; }
@media (prefers-reduced-motion: reduce) { .progress-bar { transition: none; } }

/* ======================================================
   Home feed
   ====================================================== */
.feed { display: grid; gap: 14px; }
.feed-card { margin: 0; }
.feed-media { display: block; }
.feed-who { display: grid; min-width: 0; line-height: 1.15; }
.feed-who > span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-why { font-size: 12px; font-weight: 400; color: #6a707a; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feed-stats {
  display: flex; align-items: center; gap: 14px; padding: 9px 12px;
  font-size: 14px; font-weight: 700; color: #4d5560; text-decoration: none;
  background: linear-gradient(#fafbfc, #eef0f3); border-bottom: 1px solid var(--rule);
}
.feed-stats > span { display: inline-flex; align-items: center; gap: 5px; }
.feed-stats .ico { width: 16px; height: 16px; }
.feed-open { margin-left: auto; color: #34689e; }
.feed-open .chev { width: 15px; height: 15px; stroke: #34689e; }
.feed-stats:active { background: linear-gradient(#5a8bd6, #2d64c4); color: #fff; }
.feed-stats:active .feed-open, .feed-stats:active .chev { color: #fff; stroke: #fff; }
.feed-tip { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 12px; }
.feed-tip p { flex: 1; margin: 0; font-size: 14px; line-height: 1.35; color: #4a4f57; }
.feed-tip .small-button { margin: 0; flex: none; }
#more { margin-top: 14px; }

/* ======================================================
   Multi-photo posts: carousel + New Post strip
   ====================================================== */
.carousel { position: relative; border-block: 1px solid var(--rule); background: #d9dde3; }
.carousel-track {
  display: flex; overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory; scrollbar-width: none; outline: none;
}
.carousel-track::-webkit-scrollbar { display: none; }
.carousel-track:focus-visible { box-shadow: inset 0 0 0 3px rgba(74,116,163,.6); }
.carousel-slide { flex: 0 0 100%; scroll-snap-align: start; scroll-snap-stop: always; display: block; }
.carousel-img { display: block; width: 100%; height: auto; aspect-ratio: 1; object-fit: cover; user-select: none; -webkit-user-drag: none; }
.carousel .post-photo { border: 0; }

/* "2/3" pill, top right */
.carousel-count {
  position: absolute; top: 10px; right: 10px; padding: 3px 9px;
  font: 700 12px var(--font); color: #fff; font-variant-numeric: tabular-nums;
  background: rgba(0,0,0,.55); border-radius: 11px; text-shadow: 0 -1px 0 #000;
}
/* iOS page dots, bottom centre */
.carousel-dots {
  position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%);
  display: flex; gap: 7px; padding: 5px 8px; border-radius: 10px; background: rgba(0,0,0,.28);
}
.carousel-dots .dot { width: 7px; height: 7px; border-radius: 50%; background: rgba(255,255,255,.5); transition: background-color 160ms ease; }
.carousel-dots .dot.on { background: #fff; box-shadow: 0 0 3px rgba(255,255,255,.7); }
/* Arrows: only on computers (phones swipe) */
.carousel-arrow {
  position: absolute; top: 50%; width: 34px; height: 34px; margin-top: -17px; padding: 0; cursor: pointer;
  display: none; place-items: center; border-radius: 50%;
  color: #3b3f46; border: 1px solid rgba(0,0,0,.25);
  background: linear-gradient(rgba(255,255,255,.95), rgba(228,231,235,.95));
  box-shadow: 0 1px 4px rgba(0,0,0,.35);
  transition: transform 140ms var(--ease-out-strong);
}
.carousel-arrow .chev { width: 18px; height: 18px; stroke: #3b3f46; }
.carousel-arrow.is-prev { left: 10px; }
.carousel-arrow.is-prev .chev { transform: scaleX(-1); }
.carousel-arrow.is-next { right: 10px; }
.carousel-arrow:active { transform: scale(0.94); }
.carousel-arrow[hidden] { display: none !important; }
@media (hover: hover) and (pointer: fine) {
  .carousel.is-multi .carousel-arrow { display: grid; }
}

/* Stack badge on multi-photo posts in the grid */
.play-badge.is-stack .ico { width: 14px; height: 14px; margin: 0; stroke: #fff; stroke-width: 2.4; fill: none; }

/* New Post: thumbnail strip */
.strip { display: flex; gap: 10px; margin-top: 10px; overflow-x: auto; padding-bottom: 2px; }
.strip-item { display: grid; gap: 5px; flex: none; }
.strip-thumb {
  position: relative; width: 84px; height: 84px; padding: 0; cursor: pointer; overflow: hidden;
  border: 2px solid transparent; border-radius: 8px; background: #d9dde3;
  box-shadow: 0 1px 3px rgba(0,0,0,.25);
}
.strip-thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.strip-thumb[aria-pressed="true"] { border-color: #2f66b6; box-shadow: 0 0 0 2px rgba(47,102,182,.3); }
.strip-cover {
  position: absolute; left: 4px; bottom: 4px; padding: 1px 6px;
  font: 700 10px var(--font); color: #fff; background: rgba(0,0,0,.6); border-radius: 6px;
}
.strip-tools { display: flex; justify-content: space-between; }
.strip-mini {
  width: 26px; height: 26px; padding: 0; display: grid; place-items: center; cursor: pointer;
  border-radius: 50%; border: 1px solid #9ea6b1; color: #4d5560;
  background: linear-gradient(#fdfdfe, #e4e7eb);
}
.strip-mini .ico { width: 15px; height: 15px; stroke-width: 2.8; }
.strip-mini .strip-left { transform: rotate(-90deg); }
.strip-mini:disabled { opacity: .35; cursor: default; }
.strip-mini.is-delete { color: #fff; border-color: #9a1f1f; background: linear-gradient(#f07c7c, #d23a3a 55%, #b92828); }
.strip-add {
  flex: none; width: 84px; height: 84px; cursor: pointer;
  display: grid; place-content: center; justify-items: center; gap: 4px;
  font: 700 12px var(--font); color: #34689e;
  border: 2px dashed #a9b6c4; border-radius: 8px; background: rgba(255,255,255,.6);
}
.strip-add .ico { width: 22px; height: 22px; stroke-width: 2.6; }
.strip-add:active { background: #eef3fa; }
