/* jaybot.fyi — public profile. Tokens documented in DESIGN.md. */

:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #efefef;
  --surface-hover: #dbdbdb;
  --text: #0c1014;
  --muted: #6b6f75;
  --border: #dbdbdb;
  --accent: #3346f0;
  --accent-text: #ffffff;
  --ring-a: #3346f0;
  --ring-b: #b13bf5;
  --like: #ff3040;
  --scrim: rgb(0 0 0 / 0.65);
  --elev: 0 8px 32px rgb(12 16 20 / 0.18), 0 2px 6px rgb(12 16 20 / 0.08);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --rail: 0px;
  --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #000000;
    --surface: #25292e;
    --surface-hover: #363a3f;
    --text: #f5f5f5;
    --muted: #a8a8a8;
    --border: #262626;
    --accent: #8b97ff;
    --accent-text: #0a0d2e;
    --elev: 0 8px 32px rgb(0 0 0 / 0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #000000;
  --surface: #25292e;
  --surface-hover: #363a3f;
  --text: #f5f5f5;
  --muted: #a8a8a8;
  --border: #262626;
  --accent: #8b97ff;
  --accent-text: #0a0d2e;
  --elev: 0 8px 32px rgb(0 0 0 / 0.6);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.4 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}
::selection { background: color-mix(in srgb, var(--accent) 28%, transparent); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
img { display: block; max-width: 100%; }
ul { list-style: none; margin: 0; padding: 0; }
p { margin: 0; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.i { width: 24px; height: 24px; flex: none; fill: none; stroke: currentColor; }
.skip { position: absolute; left: -999px; top: 8px; z-index: 100; background: var(--text); color: var(--bg); padding: 8px 12px; border-radius: 8px; }
.skip:focus { left: 8px; }

/* ---------- navigation ---------- */

.rail { display: none; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  height: 44px; padding: 0 16px; padding-top: env(safe-area-inset-top);
  box-sizing: content-box;
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--border);
}
.topbar-title { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; }
.topbar-actions { display: flex; gap: 4px; margin-right: -8px; }
.icon-btn { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; }
.icon-btn:active { opacity: 0.5; }

.bottombar {
  position: fixed; inset: auto 0 0 0; z-index: 20;
  display: flex; justify-content: space-around; align-items: center;
  height: 50px; padding-bottom: env(safe-area-inset-bottom); box-sizing: content-box;
  background: var(--bg);
  border-top: 1px solid var(--border);
}
.bottombar > * { display: grid; place-items: center; flex: 1; height: 100%; }
.bottombar > *:active { opacity: 0.5; }
.bottombar [aria-current="page"] .i { stroke-width: 2.6; }
.mini-avatar { width: 26px; height: 26px; border-radius: 50%; background: var(--surface) center/cover; border: 1px solid var(--border); }

@media (min-width: 768px) {
  :root { --rail: 72px; }
  .topbar, .bottombar { display: none; }
  .rail {
    position: fixed; inset: 0 auto 0 0; z-index: 20;
    display: flex; flex-direction: column;
    width: var(--rail); padding: 8px 12px 20px;
    border-right: 1px solid var(--border);
    background: var(--bg);
  }
  .rail-logo { display: grid; place-items: center; height: 92px; }
  .rail-logo .wordmark { display: none; }
  .rail-items { display: flex; flex-direction: column; gap: 4px; }
  .rail-bottom { margin-top: auto; }
  .rail-item {
    display: flex; align-items: center; gap: 16px;
    width: 100%; height: 48px; padding: 12px; border-radius: 8px;
    transition: background-color 150ms;
  }
  .rail-item span { display: none; font-size: 16px; }
  .rail-item:hover { background: color-mix(in srgb, var(--text) 6%, transparent); }
  .rail-item:hover .i { transform: scale(1.06); }
  .rail-item .i { transition: transform 200ms var(--ease); }
  .rail-item[aria-current="page"] { font-weight: 700; }
  .rail-item[aria-current="page"] .i { stroke-width: 2.6; }
}
@media (min-width: 1264px) {
  :root { --rail: 244px; }
  .rail-logo { place-items: center start; padding-left: 12px; height: 92px; }
  .rail-logo .wordmark { display: block; font-size: 24px; font-weight: 700; letter-spacing: -0.03em; }
  .rail-logo .rail-mark { display: none; }
  .rail-item span { display: inline; }
}

/* ---------- page ---------- */

.page {
  padding-bottom: calc(64px + env(safe-area-inset-bottom));
}
@media (min-width: 768px) {
  .page { margin-left: var(--rail); padding: 30px 20px 0; }
}

.profile {
  display: grid;
  grid-template-columns: 86px minmax(0, 1fr);
  grid-template-areas: "avatar title" "avatar stats" "bio bio";
  column-gap: 20px;
  align-items: center;
  max-width: 935px; margin: 0 auto;
  padding: 16px 16px 0;
}
.avatar { grid-area: avatar; width: 86px; height: 86px; border-radius: 50%; align-self: center; }
.avatar:disabled { cursor: default; }
.avatar-ring {
  display: block; width: 100%; height: 100%; border-radius: 50%;
  padding: 3px; background: transparent;
}
.avatar.has-story .avatar-ring { background: linear-gradient(45deg, var(--ring-a), var(--ring-b)); }
.avatar.seen .avatar-ring { background: var(--border); }
.avatar-img {
  display: block; width: 100%; height: 100%; border-radius: 50%;
  background: var(--surface) center/cover no-repeat;
  border: 3px solid var(--bg);
  font-size: 32px; font-weight: 600; color: var(--muted);
  display: grid; place-items: center;
}
.avatar:not(.has-story) .avatar-ring { padding: 0; }
.avatar:not(.has-story) .avatar-img { border: 1px solid var(--border); }

.title { grid-area: title; align-self: end; min-width: 0; }
.username { margin: 0; display: flex; align-items: center; gap: 6px; font-size: 20px; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; }
.username .verified { width: 20px; height: 20px; color: var(--accent); }
.display-name { font-size: 15px; font-weight: 600; }
@media (max-width: 767px) {
  /* Phones: the username lives in the top bar, like Instagram. */
  .username { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.stats { grid-area: stats; align-self: start; display: flex; gap: 24px; margin-top: 8px; }
.stats li { display: flex; flex-direction: column; line-height: 1.25; }
.stats b { font-weight: 600; font-variant-numeric: tabular-nums; font-size: 16px; }
.stats span { color: var(--muted); }
.bio-block { grid-area: bio; margin-top: 14px; }
.bio { white-space: pre-line; }
.bio-links { margin-top: 4px; display: flex; flex-direction: column; gap: 2px; }
.bio-links a { display: inline-flex; align-items: center; gap: 4px; color: var(--accent); font-weight: 600; }
.bio-links .i { width: 14px; height: 14px; stroke-width: 2.4; }
.bio-links a:hover { text-decoration: underline; text-underline-offset: 2px; }

@media (min-width: 768px) {
  .profile {
    grid-template-columns: minmax(150px, 290px) minmax(0, 1fr);
    grid-template-areas: "avatar title" "avatar stats" "avatar bio";
    column-gap: 28px; padding: 0;
  }
  .avatar { width: 168px; height: 168px; justify-self: center; grid-row: 1 / 4; }
  .avatar-img { font-size: 56px; }
  .avatar.has-story .avatar-ring { padding: 4px; }
  .title { align-self: end; display: flex; flex-direction: column; gap: 8px; }
  .display-name { margin: 0; font-weight: 400; font-size: 14px; }
  .stats { gap: 40px; margin: 20px 0 0; }
  .stats li { flex-direction: row; gap: 5px; align-items: baseline; }
  .stats b { font-size: 16px; }
  .stats span { color: var(--text); font-size: 16px; }
  .bio-block { align-self: start; margin-top: 20px; }
}

.actions {
  display: flex; gap: 8px;
  max-width: 935px; margin: 16px auto 0; padding: 0 16px;
}
.btn {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 16px; border-radius: 8px;
  background: var(--surface); font-weight: 600;
  transition: background-color 150ms;
}
.btn:hover { background: var(--surface-hover); }
.btn:active { opacity: 0.7; }
.btn.primary { background: var(--accent); color: var(--accent-text); }
.btn.primary:hover { background: color-mix(in srgb, var(--accent) 88%, var(--text)); }
.btn .i { width: 16px; height: 16px; stroke-width: 2.2; }
@media (min-width: 768px) {
  .actions { padding: 0; margin-top: 28px; max-width: 706px; }
  .btn { height: 44px; font-size: 15px; border-radius: 10px; }
}

/* featured cards (Pokit, POSTR) */
.featured {
  display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr);
  gap: 10px; overflow-x: auto; scrollbar-width: none;
  max-width: 935px; margin: 16px auto 0; padding: 0 16px;
}
.featured::-webkit-scrollbar { display: none; }
@media (min-width: 768px) { .featured { padding: 0; max-width: 706px; } }

.feature-card {
  position: relative; display: flex; align-items: center; gap: 12px;
  padding: 12px; border-radius: 14px;
  border: 1px solid var(--border);
  transition: background-color 150ms, transform 200ms var(--ease);
}
.feature-card:hover { background: color-mix(in srgb, var(--text) 4%, transparent); }
.feature-card:active { transform: scale(0.985); }
.feature-thumb {
  width: 52px; height: 52px; flex: none; border-radius: 12px;
  background: linear-gradient(135deg, var(--ring-a), var(--ring-b)) center/cover;
  display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 20px;
}
.feature-text { min-width: 0; flex: 1; }
.feature-text strong { display: block; font-size: 15px; }
.feature-text span { display: block; color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.feature-card .i { width: 18px; height: 18px; color: var(--muted); }

/* highlights */
.highlights { max-width: 935px; margin: 16px auto 0; }
.highlights-row {
  display: flex; gap: 16px; overflow-x: auto; scrollbar-width: none;
  padding: 4px 16px 8px; scroll-snap-type: x proximity; scroll-padding-inline: 16px;
}
.highlights-row::-webkit-scrollbar { display: none; }
.highlights-row:empty { display: none; }
.hl { flex: none; width: 66px; scroll-snap-align: start; }
.hl button, .hl a { display: flex; flex-direction: column; align-items: center; gap: 6px; width: 100%; }
.hl-ring {
  width: 66px; height: 66px; border-radius: 50%;
  padding: 2px; border: 1px solid var(--border); background: var(--bg);
  transition: transform 200ms var(--ease);
}
.hl button:active .hl-ring { transform: scale(0.94); }
.hl-img { width: 100%; height: 100%; border-radius: 50%; background: var(--surface) center/cover; display: grid; place-items: center; color: var(--muted); }
.hl-label { max-width: 100%; font-size: 12px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (min-width: 768px) {
  .highlights { margin-top: 44px; }
  .highlights-row { gap: 30px; padding: 4px 0 8px; justify-content: safe center; }
  .hl { width: 87px; }
  .hl-ring { width: 87px; height: 87px; padding: 4px; }
}

/* tabs */
.tabs {
  display: flex; justify-content: center;
  max-width: 935px; margin: 12px auto 0;
  border-top: 1px solid var(--border);
}
.tab {
  flex: 1; display: flex; align-items: center; justify-content: center; gap: 6px;
  height: 46px; color: var(--muted);
  border-top: 1px solid transparent; margin-top: -1px;
  font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
}
.tab span { display: none; }
.tab[aria-selected="true"] { color: var(--text); border-top-color: var(--text); }
.tab .i { width: 22px; height: 22px; }
@media (min-width: 768px) {
  .tabs { margin-top: 44px; gap: 60px; max-width: 1380px; }
  .tab { flex: none; height: 52px; }
  .tab span { display: inline; }
  .tab .i { width: 14px; height: 14px; stroke-width: 2.4; }
}

/* ---------- grid ---------- */

.panel { max-width: 1380px; margin: 0 auto; }
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 2px; }
@media (min-width: 900px) { .grid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
@media (min-width: 1280px) { .grid { grid-template-columns: repeat(5, minmax(0, 1fr)); } }
.tile { position: relative; display: block; aspect-ratio: 3 / 4; overflow: hidden; background: var(--surface); }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: opacity 300ms; }
.tile img[data-loading] { opacity: 0; }
.tile-badge {
  position: absolute; top: 8px; right: 8px; color: #fff;
  filter: drop-shadow(0 1px 2px rgb(0 0 0 / 0.5));
}
.tile-badge .i { width: 20px; height: 20px; }
.tile-badge .i.fill { fill: #fff; stroke: #fff; }
.tile-hover {
  position: absolute; inset: 0;
  display: flex; align-items: center; justify-content: center; gap: 24px;
  background: rgb(0 0 0 / 0.32); color: #fff; font-weight: 700; font-size: 16px;
  opacity: 0; transition: opacity 150ms;
}
.tile-hover span { display: inline-flex; align-items: center; gap: 6px; }
.tile-hover .i { width: 20px; height: 20px; fill: #fff; stroke: #fff; }
@media (hover: hover) {
  .tile:hover .tile-hover, .tile:focus-visible .tile-hover { opacity: 1; }
}
.tile:focus-visible { outline-offset: -3px; border-radius: 0; }

.empty {
  display: flex; flex-direction: column; align-items: center; gap: 12px;
  padding: 64px 24px; text-align: center;
}
.empty-icon { width: 64px; height: 64px; border-radius: 50%; border: 2px solid var(--text); display: grid; place-items: center; }
.empty-icon .i { width: 30px; height: 30px; stroke-width: 1.6; }
.empty h2 { margin: 8px 0 0; font-size: 26px; font-weight: 800; letter-spacing: -0.02em; }
.empty p { color: var(--muted); max-width: 36ch; }
.empty .btn { flex: none; margin-top: 8px; }
.sentinel { height: 1px; }

.grid .skel-tile { aspect-ratio: 3 / 4; background: var(--surface); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: 0.55; } }
.skel { color: transparent; background: var(--surface); border-radius: 4px; }

/* ---------- links tab ---------- */

.links { display: flex; flex-direction: column; gap: 10px; max-width: 580px; margin: 0 auto; padding: 20px 16px 32px; }
.links .feature-card { padding: 14px; }
.links .feature-thumb { width: 64px; height: 64px; border-radius: 14px; }
.link-btn {
  display: flex; align-items: center; justify-content: center; position: relative;
  min-height: 56px; padding: 12px 48px; border-radius: 14px;
  background: var(--surface); font-weight: 600; font-size: 15px; text-align: center;
  transition: background-color 150ms, transform 200ms var(--ease);
}
.link-btn:hover { background: var(--surface-hover); }
.link-btn:active { transform: scale(0.985); }
.link-btn .i { position: absolute; right: 18px; width: 18px; height: 18px; color: var(--muted); }
.links-label { margin: 14px 2px 0; color: var(--muted); font-size: 13px; font-weight: 600; }

.foot { display: flex; justify-content: center; padding: 32px 16px 24px; color: var(--muted); font-size: 12px; }

/* ---------- post dialog ---------- */

.post-dialog {
  --dh: min(92vh, 92dvh, 880px);
  padding: 0; border: 0; margin: 0;
  width: 100%; height: 100%; max-width: none; max-height: none;
  background: var(--bg); color: var(--text);
  overflow: hidden;
}
.post-dialog::backdrop { background: var(--scrim); }
.post-dialog[open] { animation: rise 280ms var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(16px); } }
.post-dialog::backdrop { animation: fade 200ms ease-out; }
@keyframes fade { from { opacity: 0; } }

.dialog-close {
  position: absolute; z-index: 5; top: calc(6px + env(safe-area-inset-top)); left: 6px;
  display: grid; place-items: center; width: 44px; height: 44px; border-radius: 50%;
}
.post-nav { display: none; }

.post {
  height: 100%; overflow-y: auto; overscroll-behavior: contain;
  display: grid; grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "head" "media" "actions" "thread" "form";
  grid-template-rows: auto auto auto auto auto;
  align-content: start;
  padding-top: env(safe-area-inset-top);
}
.post-head {
  grid-area: head; display: flex; align-items: center; gap: 10px;
  height: 56px; padding: 0 16px 0 56px;
  border-bottom: 1px solid var(--border);
}
.post-head .mini-avatar { width: 32px; height: 32px; }
.post-head strong { font-weight: 600; }
.post-head .pin-note { margin-left: auto; color: var(--muted); font-size: 12px; display: inline-flex; align-items: center; gap: 4px; }
.post-head .pin-note .i { width: 14px; height: 14px; }

.post-media { grid-area: media; position: relative; background: #000; }
.carousel {
  display: flex; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none;
  aspect-ratio: var(--ar, 0.75);
  max-height: 85vh;
}
.carousel::-webkit-scrollbar { display: none; }
.carousel img { flex: none; width: 100%; height: 100%; object-fit: contain; scroll-snap-align: center; user-select: none; -webkit-user-drag: none; }
.car-btn {
  position: absolute; top: 50%; translate: 0 -50%;
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%;
  background: rgb(255 255 255 / 0.85); color: #000;
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.25);
}
.car-btn .i { width: 18px; height: 18px; stroke-width: 2.6; }
.car-btn.prev { left: 10px; }
.car-btn.next { right: 10px; }
.car-btn:disabled { opacity: 0; pointer-events: none; }
.dots { position: absolute; bottom: 12px; left: 0; right: 0; display: flex; justify-content: center; gap: 4px; pointer-events: none; }
.dots span { width: 6px; height: 6px; border-radius: 50%; background: rgb(255 255 255 / 0.45); transition: background-color 200ms; }
.dots span.on { background: #fff; }
.burst {
  position: absolute; left: 50%; top: 50%; width: 96px; height: 96px; translate: -50% -50%;
  color: #fff; fill: #fff; stroke: none; pointer-events: none;
  filter: drop-shadow(0 4px 16px rgb(0 0 0 / 0.35));
  animation: burst 900ms var(--ease) forwards;
}
@keyframes burst {
  0% { opacity: 0; scale: 0.2; }
  15% { opacity: 1; scale: 1.15; }
  30% { scale: 0.95; }
  45%, 70% { opacity: 1; scale: 1; }
  100% { opacity: 0; scale: 0.6; translate: -50% -80%; }
}

.post-actions { grid-area: actions; padding: 6px 12px 10px; }
.post-actions .row { display: flex; align-items: center; gap: 4px; margin-left: -4px; }
.post-actions .row .share { margin-left: auto; }
.act { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 50%; }
.act:hover { color: var(--muted); }
.act .i { width: 26px; height: 26px; }
.act.liked .i { fill: var(--like); stroke: var(--like); animation: pop 400ms var(--ease); }
@keyframes pop { 40% { scale: 1.25; } }
.likes { font-weight: 600; padding: 0 4px; font-variant-numeric: tabular-nums; }
.when { color: var(--muted); font-size: 12px; padding: 4px 4px 0; }

.post-thread { grid-area: thread; padding: 4px 16px 12px; display: flex; flex-direction: column; gap: 14px; }
.cmt { display: flex; gap: 12px; }
.cmt .mini-avatar { width: 32px; height: 32px; flex: none; display: grid; place-items: center; font-size: 13px; font-weight: 600; color: var(--muted); }
.cmt-body { min-width: 0; overflow-wrap: anywhere; }
.cmt-body strong { font-weight: 600; margin-right: 6px; }
.cmt-body p { display: inline; white-space: pre-line; }
.cmt-meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.no-comments { color: var(--muted); text-align: center; padding: 16px 0; }

.comment-form {
  grid-area: form;
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px; align-items: end;
  padding: 10px 16px calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  background: var(--bg);
  position: sticky; bottom: 0;
}
.comment-form .fields { display: flex; flex-direction: column; gap: 6px; }
.comment-form input, .comment-form textarea {
  width: 100%; border: 0; background: transparent; color: var(--text);
  font: inherit; font-size: 16px; padding: 6px 0; resize: none; outline: none;
}
.comment-form input { font-weight: 600; font-size: 14px; border-bottom: 1px solid var(--border); }
.comment-form textarea { min-height: 24px; max-height: 120px; }
.comment-form input::placeholder, .comment-form textarea::placeholder { color: var(--muted); font-weight: 400; }
.comment-form button { color: var(--accent); font-weight: 600; padding: 8px 2px; }
.comment-form button:disabled { opacity: 0.4; cursor: default; }
.comment-form .err { grid-column: 1 / -1; color: var(--like); font-size: 12px; }
.comment-form .closed { grid-column: 1 / -1; color: var(--muted); text-align: center; padding: 6px 0; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }

@media (min-width: 768px) {
  .post-dialog {
    width: fit-content; height: auto; max-width: calc(100vw - 160px); max-height: var(--dh);
    margin: auto; border-radius: 4px; overflow: visible;
    box-shadow: var(--elev);
  }
  .post-dialog[open] { display: block; }
  .dialog-close { position: fixed; top: 10px; right: 10px; left: auto; color: #fff; }
  .post-nav {
    position: fixed; top: 50%; translate: 0 -50%;
    display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
    background: rgb(255 255 255 / 0.9); color: #000;
  }
  .post-nav.prev { left: 24px; }
  .post-nav.next { right: 24px; }
  .post-nav:disabled { display: none; }
  .post {
    height: var(--dh); overflow: hidden;
    grid-template-columns: min(calc(var(--dh) * var(--ar, 0.75)), calc(100vw - 160px - 380px)) 380px;
    grid-template-rows: auto minmax(0, 1fr) auto auto;
    grid-template-areas: "media head" "media thread" "media actions" "media form";
    padding: 0;
  }
  .post-media { height: var(--dh); border-radius: 4px 0 0 4px; overflow: hidden; }
  .carousel { height: 100%; aspect-ratio: auto; max-height: none; }
  .post-head { padding: 0 16px; height: 60px; }
  .post-thread { overflow-y: auto; padding: 16px; border-bottom: 1px solid var(--border); }
  .post-actions { padding: 6px 12px 12px; }
  .comment-form { position: static; padding-bottom: 12px; }
}

/* ---------- story viewer ---------- */

.story {
  position: fixed; inset: 0; z-index: 50;
  background: #111; color: #fff;
  display: grid; place-items: center;
  animation: fade 200ms ease-out;
  touch-action: none;
}
.story-frame {
  position: relative; width: 100%; height: 100%;
  background: #000; overflow: hidden;
}
@media (min-width: 768px) {
  .story-frame { width: auto; height: min(92vh, 900px); aspect-ratio: 9 / 16; border-radius: 10px; }
}
.story-frame img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.story-frame img.cover { object-fit: cover; }
.story-top {
  position: absolute; inset: 0 0 auto 0; z-index: 2;
  padding: calc(8px + env(safe-area-inset-top)) 10px 28px;
  background: linear-gradient(rgb(0 0 0 / 0.45), transparent);
}
.bars { display: flex; gap: 3px; }
.bars span { flex: 1; height: 2px; border-radius: 2px; background: rgb(255 255 255 / 0.35); overflow: hidden; }
.bars i { display: block; height: 100%; width: 0; background: #fff; }
.story-who { display: flex; align-items: center; gap: 8px; margin-top: 10px; font-weight: 600; }
.story-who .mini-avatar { width: 32px; height: 32px; border: 0; }
.story-who time { color: rgb(255 255 255 / 0.7); font-weight: 400; }
.story-who .story-close { margin-left: auto; display: grid; place-items: center; width: 40px; height: 40px; color: #fff; }
.story-caption {
  position: absolute; inset: auto 0 0 0; z-index: 2;
  padding: 40px 16px calc(24px + env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgb(0 0 0 / 0.55));
  font-size: 15px; text-align: center; white-space: pre-line;
}
.story-tap { position: absolute; inset: 0; z-index: 1; display: grid; grid-template-columns: 1fr 2fr; }
.story-tap button { height: 100%; }
.story-side {
  display: none;
}
@media (min-width: 768px) {
  .story-side {
    position: absolute; top: 50%; translate: 0 -50%; z-index: 3;
    display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
    background: rgb(255 255 255 / 0.85); color: #000;
  }
  .story-side.prev { left: -48px; }
  .story-side.next { right: -48px; }
  .story-frame { overflow: visible; }
  .story-frame img { border-radius: 10px; }
}

/* ---------- toast ---------- */

.toast {
  position: fixed; left: 50%; bottom: calc(76px + env(safe-area-inset-bottom)); z-index: 60;
  translate: -50% 12px; opacity: 0; pointer-events: none;
  padding: 10px 16px; border-radius: 10px;
  background: var(--text); color: var(--bg); font-weight: 600;
  box-shadow: var(--elev);
  transition: opacity 200ms, translate 300ms var(--ease);
}
.toast.show { opacity: 1; translate: -50% 0; }
@media (min-width: 768px) { .toast { bottom: 32px; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; transition-duration: 1ms !important; }
}
