/* bootyalbum — photo-feed gallery. Light/dark tokens first, then layout. */

:root {
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --wordmark: "Grand Hotel", "Brush Script MT", cursive;

  --bg: #ffffff;
  --bg-elev: #ffffff;
  --bg-soft: #efeff1;
  --hover: #f4f4f5;
  --text: #0c0c0e;
  --muted: #6b6b73;
  --line: #e2e2e6;
  --link: #3a2fb8;
  --accent: #ff2e74;
  --accent-hover: #e8195f;
  --like: #ff3040;
  --scrim: rgba(0, 0, 0, .72);
  --ring: linear-gradient(45deg, #ffb35c 0%, #ff6a6a 30%, #ff2e74 55%, #a43cff 100%);
  --shadow: 0 10px 40px rgba(0, 0, 0, .18);

  --sidebar: 245px;
  --topbar: 52px;
  --tabbar: 50px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #000000;
    --bg-elev: #121214;
    --bg-soft: #1f1f23;
    --hover: #18181b;
    --text: #f4f4f5;
    --muted: #a1a1aa;
    --line: #27272a;
    --link: #b9b3ff;
    --shadow: 0 10px 40px rgba(0, 0, 0, .6);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #000000;
  --bg-elev: #121214;
  --bg-soft: #1f1f23;
  --hover: #18181b;
  --text: #f4f4f5;
  --muted: #a1a1aa;
  --line: #27272a;
  --link: #b9b3ff;
  --shadow: 0 10px 40px rgba(0, 0, 0, .6);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.42 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body.locked { overflow: hidden; }

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%; }
h1, h2, h3, p { margin: 0; }
ul { margin: 0; padding: 0; list-style: none; }

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.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;
}

.ic { flex: none; display: block; }
.noscript { padding: 40px 16px; text-align: center; }

/* ---------- shell ---------- */

.shell { min-height: 100vh; }

.side {
  position: fixed; inset: 0 auto 0 0; z-index: 30;
  width: var(--sidebar);
  display: flex; flex-direction: column;
  padding: 8px 12px 20px;
  border-right: 1px solid var(--line);
  background: var(--bg);
}

.brand {
  display: block;
  font-family: var(--wordmark);
  font-size: 34px; line-height: 1;
  letter-spacing: .2px;
  padding: 26px 12px 22px;
  white-space: nowrap;
}

.brand-mark {
  display: none;
  width: 32px; height: 32px; margin: 4px 0 0;
  border-radius: 9px;
  background: var(--ring);
  color: #fff;
  font-size: 26px; line-height: 34px; text-align: center;
}

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-foot { margin-top: auto; }

.nav-item {
  display: flex; align-items: center; gap: 16px;
  width: 100%;
  padding: 12px;
  border-radius: 10px;
  font-size: 16px;
  text-align: left;
  transition: background .15s;
}
.nav-item:hover { background: var(--hover); }
.nav-item:hover .ic { transform: scale(1.06); }
.nav-item .ic { transition: transform .15s; }
.nav-item[aria-current="page"] { font-weight: 700; }
.nav-item[aria-current="page"] .ic { stroke-width: 2.6; }

.main { margin-left: var(--sidebar); min-width: 0; min-height: 100vh; }

.topbar, .tabbar { display: none; }

@media (max-width: 1263px) {
  :root { --sidebar: 72px; }
  .side { padding: 8px 12px 20px; align-items: center; }
  .side .brand { padding: 22px 0 18px; }
  .brand-text, .nav-item .label { display: none; }
  .brand-mark { display: block; }
  .nav-item { justify-content: center; width: 48px; }
}

@media (max-width: 767px) {
  .side { display: none; }
  .main {
    margin-left: 0;
    padding-top: var(--topbar);
    padding-bottom: calc(var(--tabbar) + env(safe-area-inset-bottom));
  }
  .topbar {
    position: fixed; inset: 0 0 auto 0; z-index: 30;
    display: flex; align-items: center; justify-content: space-between;
    height: var(--topbar);
    padding: 0 8px 0 16px;
    background: var(--bg);
    border-bottom: 1px solid var(--line);
  }
  .topbar .brand { font-size: 29px; padding: 4px 0 0; }
  .topbar-actions { display: flex; }
  .tabbar {
    position: fixed; inset: auto 0 0 0; z-index: 30;
    display: flex; justify-content: space-around; align-items: center;
    height: calc(var(--tabbar) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--bg);
    border-top: 1px solid var(--line);
  }
  .tabbar .nav-item { width: auto; padding: 10px 14px; }
}

/* ---------- shared bits ---------- */

.icon-btn {
  display: inline-grid; place-items: center;
  width: 40px; height: 40px;
  border-radius: 50%;
  transition: opacity .15s, transform .15s;
}
.icon-btn:hover { opacity: .6; }
.icon-btn:active { transform: scale(.88); }
.icon-btn.on.like .ic { fill: var(--like); stroke: var(--like); animation: pop .35s ease; }
.icon-btn.on.save .ic { fill: currentColor; }

@keyframes pop { 40% { transform: scale(1.25); } 100% { transform: scale(1); } }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 32px; padding: 0 16px;
  border-radius: 8px;
  background: var(--accent); color: #fff;
  font-weight: 600; white-space: nowrap;
  transition: background .15s;
}
.btn:hover { background: var(--accent-hover); }
.btn.quiet { background: var(--bg-soft); color: var(--text); }
.btn.quiet:hover { background: var(--line); }
.btn.big { height: 44px; padding: 0 28px; font-size: 15px; border-radius: 12px; }

.text-btn { color: var(--accent); font-weight: 600; font-size: 13px; }
.text-btn:hover { color: var(--text); }
.text-btn.following { color: var(--muted); }

.h { font-weight: 600; }
.h:hover { opacity: .7; }
.muted { color: var(--muted); }
.dot { color: var(--muted); padding: 0 4px; }
.sp { flex: 1; }

.av { border-radius: 50%; object-fit: cover; background: var(--bg-soft); flex: none; }

.ring {
  display: inline-grid; place-items: center;
  padding: 2.5px;
  border-radius: 50%;
  background: var(--ring);
  flex: none;
}
.ring.seen { background: var(--line); }
.ring .av { border: 3px solid var(--bg); }

.tags { color: var(--link); }
.tags a:hover { text-decoration: underline; }

.chips {
  display: flex; gap: 8px;
  overflow-x: auto;
  padding: 2px 0 18px;
  scrollbar-width: none;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none;
  padding: 7px 14px;
  border-radius: 999px;
  background: var(--bg-soft);
  font-weight: 600; white-space: nowrap;
  transition: background .15s, color .15s;
}
.chip:hover { background: var(--line); }
.chip[aria-current="true"] { background: var(--text); color: var(--bg); }

.page { max-width: 975px; margin: 0 auto; padding: 28px 20px 56px; }
.page-title { font-size: 24px; font-weight: 700; margin-bottom: 16px; letter-spacing: -.2px; }
.section-title { font-size: 16px; font-weight: 700; margin: 36px 0 14px; }

.empty {
  display: grid; justify-items: center; gap: 12px;
  padding: 64px 16px;
  text-align: center;
}
.empty .ic { width: 62px; height: 62px; padding: 14px; border: 2px solid var(--text); border-radius: 50%; }
.empty h2 { font-size: 22px; font-weight: 800; }
.empty p { color: var(--muted); max-width: 360px; }
.empty code { background: var(--bg-soft); padding: 2px 6px; border-radius: 6px; }

.foot { color: var(--muted); font-size: 12px; line-height: 1.7; }
.foot a:hover { text-decoration: underline; }
.page-foot { padding: 36px 16px 8px; text-align: center; }

/* images fade in over their average-color placeholder */
.ph { background: var(--ph, var(--bg-soft)); }
.ph img { opacity: 0; transition: opacity .35s ease; }
.ph img.in { opacity: 1; }

/* ---------- home ---------- */

.home {
  display: flex; justify-content: center; gap: 64px;
  padding: 22px 16px 48px;
}
.feed-col { width: 100%; max-width: 470px; min-width: 0; }

.stories {
  display: flex; gap: 14px;
  overflow-x: auto;
  padding: 6px 2px 14px;
  margin-bottom: 8px;
  scrollbar-width: none;
}
.stories::-webkit-scrollbar { display: none; }
.story-btn {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  width: 68px; flex: none;
  font-size: 12px;
}
.story-btn .av { width: 60px; height: 60px; }
.story-btn span { max-width: 68px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.feed-tabs {
  display: flex; gap: 22px;
  padding: 2px 4px 12px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  font-weight: 600; font-size: 15px;
}
.feed-tabs button { color: var(--muted); padding: 4px 0; }
.feed-tabs button[aria-pressed="true"] { color: var(--text); }

.post { padding-bottom: 18px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.ad-slot { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 4px 0 18px; margin-bottom: 14px; border-bottom: 1px solid var(--line); }
.ad-label { font-size: 11px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.ad-slot iframe { display: block; border: 0; max-width: 100%; }
.ad-strip { padding-bottom: 12px; }
.post-head { display: flex; align-items: center; gap: 10px; padding: 0 4px 10px; }
.post-head .ring { padding: 2px; }
.post-head .ring .av { width: 34px; height: 34px; border-width: 2px; }
.ph-text { flex: 1; min-width: 0; line-height: 1.25; }
.ph-top { display: flex; align-items: center; white-space: nowrap; }
.ph-top time { color: var(--muted); }
.loc { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.loc:hover { color: var(--text); }

.media {
  position: relative;
  overflow: hidden;
  border-radius: 6px;
  aspect-ratio: var(--ar, 1);
  user-select: none; -webkit-user-select: none;
  touch-action: manipulation;
  border: 1px solid var(--line);
}
.media img { width: 100%; height: 100%; object-fit: cover; -webkit-user-drag: none; }

.burst {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  pointer-events: none;
}
.burst .ic {
  width: 96px; height: 96px;
  fill: #fff; stroke: none;
  filter: drop-shadow(0 4px 18px rgba(0, 0, 0, .35));
  animation: burst .9s ease forwards;
}
@keyframes burst {
  0% { transform: scale(.2); opacity: 0; }
  15% { transform: scale(1.15); opacity: 1; }
  30% { transform: scale(.95); }
  45%, 75% { transform: scale(1); opacity: 1; }
  100% { transform: scale(.4) translateY(-30px); opacity: 0; }
}

.actions { display: flex; align-items: center; margin: 4px -8px 2px; }
.like-wrap { display: inline-flex; align-items: center; }
.like-count { font-size: 14px; font-weight: 600; color: var(--text); margin-right: 10px; }
.caption { padding: 0 4px; overflow-wrap: anywhere; }
.caption .tags { margin-left: 2px; }
.view-link { display: inline-block; margin: 6px 4px 0; color: var(--muted); }
.view-link:hover { color: var(--text); }
.views {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(0, 0, 0, .45); color: #fff;
  font-size: 12px; font-weight: 600; letter-spacing: .2px;
  pointer-events: none;
}
.views.off { display: none; }

.suggest {
  width: 320px; flex: none;
  position: sticky; top: 0; align-self: flex-start;
  padding-top: 30px;
}
.me {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 22px;
}
.me .brand-mark { display: block; width: 44px; height: 44px; line-height: 46px; font-size: 32px; border-radius: 50%; margin: 0; }
.suggest-head { display: flex; justify-content: space-between; margin-bottom: 10px; font-weight: 600; color: var(--muted); }
.suggest-head a { color: var(--text); font-size: 12px; }
.suggest-row { display: flex; align-items: center; gap: 12px; padding: 7px 0; }
.suggest-row .av { width: 44px; height: 44px; }
.suggest-row .who { flex: 1; min-width: 0; line-height: 1.3; }
.suggest-row .who span { display: block; font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.suggest .foot { margin-top: 26px; }

@media (max-width: 1159px) { .suggest { display: none; } }

@media (max-width: 767px) {
  .home { padding: 0 0 24px; }
  .stories { padding: 12px 12px 12px; margin: 0; border-bottom: 1px solid var(--line); }
  .feed-tabs { padding: 12px 14px 10px; }
  .media { border-radius: 0; border-left: 0; border-right: 0; }
  .post-head, .caption { padding-left: 12px; padding-right: 12px; }
  .actions { margin: 4px 4px 2px; }
  .view-link { margin-left: 12px; }
}

/* ---------- grids ---------- */

.grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.grid.dense { grid-auto-flow: dense; }

.tile {
  position: relative;
  display: block;
  aspect-ratio: 1;
  overflow: hidden;
}
.tile.big { grid-column: span 2; grid-row: span 2; }
.tile img { width: 100%; height: 100%; object-fit: cover; transition: transform .5s ease, opacity .35s ease; }
.tile::after {
  content: "";
  position: absolute; inset: 0;
  background: rgba(0, 0, 0, .28);
  opacity: 0; transition: opacity .2s;
}
.tile-label {
  position: absolute; left: 10px; bottom: 9px; right: 10px; z-index: 1;
  color: #fff; font-weight: 600; font-size: 13px;
  text-shadow: 0 1px 6px rgba(0, 0, 0, .6);
  opacity: 0; transform: translateY(4px);
  transition: opacity .2s, transform .2s;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.tile-flag {
  position: absolute; top: 8px; right: 8px; z-index: 1;
  color: #fff;
  filter: drop-shadow(0 1px 4px rgba(0, 0, 0, .5));
}
.tile-flag .ic { fill: #fff; stroke: #fff; }
@media (hover: hover) {
  .tile:hover::after, .tile:hover .tile-label { opacity: 1; }
  .tile:hover .tile-label { transform: none; }
  .tile:hover img { transform: scale(1.03); }
}

@media (max-width: 735px) { .grid { gap: 2px; } }

/* ---------- profile ---------- */

.profile { max-width: 935px; margin: 0 auto; padding: 30px 20px 56px; }
.p-head {
  display: grid; grid-template-columns: 290px 1fr; align-items: center;
  margin-bottom: 40px;
}
.p-av { justify-self: center; border-radius: 50%; }
.p-av .av { width: 150px; height: 150px; border-width: 4px; }
.p-av .ring { padding: 3px; }
.p-row { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.p-handle { font-size: 20px; font-weight: 400; margin-right: 8px; }
.p-stats { display: flex; gap: 36px; margin: 20px 0 16px; font-size: 16px; }
.p-stats b { font-weight: 600; }
.p-name { font-weight: 600; }
.p-bio p { white-space: pre-line; }
.p-tags { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; }

.highlights {
  display: flex; gap: 26px;
  overflow-x: auto;
  padding: 0 0 34px 34px;
  scrollbar-width: none;
}
.highlights::-webkit-scrollbar { display: none; }
.hl { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 86px; flex: none; font-size: 12px; font-weight: 600; }
.hl-cover { width: 80px; height: 80px; padding: 3px; border-radius: 50%; border: 1px solid var(--line); background: var(--bg); }
.hl-cover img { width: 100%; height: 100%; border-radius: 50%; object-fit: cover; }
.hl:hover .hl-cover { border-color: var(--muted); }

.p-tabs {
  display: flex; justify-content: center; gap: 60px;
  border-top: 1px solid var(--line);
  margin-bottom: 4px;
}
.p-tab {
  display: flex; align-items: center; gap: 6px;
  height: 52px; margin-top: -1px;
  border-top: 1px solid transparent;
  color: var(--muted);
  font-size: 12px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase;
}
.p-tab[aria-current="page"] { color: var(--text); border-top-color: var(--text); }

@media (max-width: 735px) {
  .profile { padding: 18px 0 40px; }
  .p-head { grid-template-columns: 96px 1fr; gap: 0 24px; padding: 0 16px; margin-bottom: 24px; align-items: start; }
  .p-av .av { width: 86px; height: 86px; border-width: 3px; }
  .p-handle { font-size: 19px; width: 100%; }
  .p-stats { gap: 22px; margin: 12px 0; font-size: 14px; }
  .p-bio { grid-column: 1 / -1; margin-top: 14px; }
  .highlights { padding: 0 16px 22px; gap: 16px; }
  .hl { width: 66px; }
  .hl-cover { width: 64px; height: 64px; }
  .profile .section-title, .profile .mgrid { padding: 0 12px; }
}

/* ---------- models directory ---------- */

.mgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 16px; }
.mcard {
  position: relative;
  display: flex; flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 16px;
  overflow: hidden;
  background: var(--bg-elev);
  transition: transform .2s ease, box-shadow .2s ease;
}
@media (hover: hover) { .mcard:hover { transform: translateY(-3px); box-shadow: var(--shadow); } }
.mcard-cover { position: relative; display: block; aspect-ratio: 4 / 5; overflow: hidden; }
.mcard-cover img { width: 100%; height: 100%; object-fit: cover; }
.mcard-count {
  position: absolute; top: 10px; right: 10px;
  padding: 3px 8px; border-radius: 999px;
  background: rgba(0, 0, 0, .55); color: #fff;
  font-size: 11px; font-weight: 600;
  backdrop-filter: blur(6px);
}
.mcard-body { display: flex; align-items: center; gap: 10px; padding: 0 12px 14px; margin-top: -26px; position: relative; }
.mcard-body .ring { padding: 2px; }
.mcard-body .av { width: 52px; height: 52px; border-width: 3px; border-color: var(--bg-elev); }
.mcard-who { flex: 1; min-width: 0; padding-top: 26px; line-height: 1.3; }
.mcard-who b, .mcard-who span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mcard-who span { color: var(--muted); font-size: 12px; }
.mcard .text-btn { padding-top: 26px; }
.mcard-tags { padding: 0 12px 14px; font-size: 12px; margin-top: -4px; }
.mgrid.rail { grid-auto-flow: column; grid-auto-columns: 180px; grid-template-columns: none; overflow-x: auto; scrollbar-width: none; padding-bottom: 6px; }

@media (max-width: 767px) {
  .page { padding: 16px 12px 40px; }
  .mgrid { grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
  .mgrid.rail { grid-auto-columns: 150px; }
}

/* ---------- search ---------- */

.search-box {
  display: flex; align-items: center; gap: 10px;
  height: 44px; padding: 0 14px;
  border-radius: 12px;
  background: var(--bg-soft);
  color: var(--muted);
  margin-bottom: 18px;
}
.search-box input {
  flex: 1; min-width: 0;
  border: 0; outline: 0; background: none;
  color: var(--text); font: inherit; font-size: 16px;
}
.search-box:focus-within { box-shadow: 0 0 0 2px var(--accent); }
.result-row { display: flex; align-items: center; gap: 12px; padding: 8px 6px; border-radius: 10px; }
.result-row:hover { background: var(--hover); }
.result-row .av { width: 44px; height: 44px; }
.result-row .who { flex: 1; min-width: 0; line-height: 1.3; }
.result-row .sub { display: block; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- post modal ---------- */

.modal {
  position: fixed; inset: 0; z-index: 100;
  display: grid; place-items: center;
  padding: 28px 72px;
  background: var(--scrim);
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } }

.m-close, .m-nav { position: fixed; z-index: 2; color: #fff; }
.m-close { top: 10px; right: 12px; padding: 8px; }
.m-nav {
  top: 50%; translate: 0 -50%;
  display: grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .92); color: #111;
  box-shadow: 0 2px 10px rgba(0, 0, 0, .3);
}
.m-nav.prev { left: 20px; }
.m-nav.next { right: 20px; }
.m-nav:hover { background: #fff; }

.pm {
  display: flex;
  width: min(1180px, 100%);
  max-height: calc(100vh - 56px);
  background: var(--bg-elev);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: var(--shadow);
  animation: rise .2s ease;
}
@keyframes rise { from { transform: scale(.98); opacity: 0; } }

.pm-media {
  position: relative;
  flex: 1 1 auto; min-width: 0;
  background: #000;
  display: grid; place-items: center;
  user-select: none; -webkit-user-select: none;
  touch-action: pan-y;
}
.pm-media img { width: 100%; height: 100%; max-height: calc(100vh - 56px); aspect-ratio: var(--ar, 1); object-fit: contain; }

.pm-side {
  width: 400px; flex: none;
  display: flex; flex-direction: column;
  border-left: 1px solid var(--line);
  min-height: 0;
}
.pm-head { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.pm-head .av { width: 34px; height: 34px; }
.pm-head .who { flex: 1; min-width: 0; line-height: 1.25; }
.pm-body { flex: 1; overflow-y: auto; padding: 16px; min-height: 0; }
.pm-cap { display: flex; gap: 12px; }
.pm-cap .av { width: 34px; height: 34px; }
.pm-cap time { display: block; margin-top: 8px; color: var(--muted); font-size: 12px; }
.pm-more { margin-top: 26px; }
.pm-more-title { color: var(--muted); font-weight: 600; font-size: 13px; margin-bottom: 10px; }
.pm-more-title a { color: var(--text); }
.pm-more .grid { gap: 3px; border-radius: 6px; overflow: hidden; }
.pm-actions { display: flex; align-items: center; padding: 4px 8px 0; border-top: 1px solid var(--line); }
.pm-date { padding: 2px 16px 14px; color: var(--muted); font-size: 11px; letter-spacing: .3px; text-transform: uppercase; }
.pm-views { display: inline-flex; align-items: center; gap: 4px; margin-left: 10px; }

@media (max-width: 900px) {
  .modal { padding: 0; background: var(--bg); place-items: stretch; }
  .pm {
    flex-direction: column;
    width: 100%; max-height: none; height: 100%;
    border-radius: 0; box-shadow: none;
    overflow-y: auto; background: var(--bg);
    animation: none;
  }
  .pm-side { display: contents; }
  .pm-head { order: 0; position: sticky; top: 0; z-index: 1; background: var(--bg); padding-right: 56px; }
  .pm-media { order: 1; flex: none; }
  .pm-media img { max-height: none; height: auto; }
  .pm-actions { order: 2; border-top: 0; }
  .pm-body { order: 3; flex: none; overflow: visible; padding-top: 4px; }
  .pm-date { order: 4; padding-bottom: 32px; }
  .m-close { color: var(--text); top: 6px; right: 6px; z-index: 3; }
  .m-nav { display: none; }
}

/* ---------- comments ---------- */

.cm-list { display: grid; gap: 16px; margin-top: 20px; }
.cm-empty { color: var(--muted); font-size: 13px; }
.cm { display: flex; align-items: flex-start; gap: 12px; }
.cm-av {
  flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: hsl(var(--hue, 330) 52% 50%);
  color: #fff;
  font-size: 13px; font-weight: 700;
}
.cm-replies .cm-av { font-size: 11px; }
.cm-main { flex: 1; min-width: 0; }
.cm-text { overflow-wrap: anywhere; }
.cm-at { color: var(--link); }
a.cm-at:hover { text-decoration: underline; }
.cm-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 2px 14px;
  margin-top: 4px;
  color: var(--muted); font-size: 12px;
}
.cm-meta button { color: var(--muted); font-size: 12px; font-weight: 600; }
.cm-meta button:hover { color: var(--text); }
.cm-by { position: relative; display: inline-flex; padding-right: 4px; }
.cm-by .av { width: 16px; height: 16px; }
.cm-by .ic { position: absolute; right: -2px; bottom: -3px; fill: var(--like); stroke: var(--bg-elev); stroke-width: 3; paint-order: stroke; }
.cm-like { flex: none; padding: 4px 0 0; color: var(--muted); transition: transform .15s; }
.cm-like:hover { color: var(--text); }
.cm-like:active { transform: scale(.85); }
.cm-like.on .ic { fill: var(--like); stroke: var(--like); animation: pop .35s ease; }
.cm-replies { display: grid; gap: 14px; margin: -4px 0 0 44px; }

.cm-form { padding: 4px 16px 8px; border-top: 1px solid var(--line); background: var(--bg-elev); }
.cm-to { display: flex; align-items: center; justify-content: space-between; padding-top: 6px; color: var(--muted); font-size: 12px; }
.cm-to[hidden] { display: none; }
.cm-to button { color: var(--muted); padding: 2px; }
.cm-row { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.cm-me { flex: none; display: grid; place-items: center; width: 28px; height: 28px; color: var(--muted); }
.cm-row input {
  flex: 1; min-width: 0;
  padding: 8px 0;
  border: 0; outline: 0; background: none;
  color: var(--text); font: inherit;
}
.cm-row input::placeholder { color: var(--muted); }
.cm-row .cm-name { flex: 0 1 112px; padding-right: 10px; border-right: 1px solid var(--line); }
.cm-row .cm-name[hidden] { display: none; }
.cm-row .text-btn:disabled { opacity: .4; cursor: default; }

@media (max-width: 900px) {
  .cm-form {
    order: 5;
    position: sticky; bottom: 0; z-index: 1;
    background: var(--bg);
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
  }
  .cm-row input { font-size: 16px; } /* below 16px iOS zooms the page on focus */
}

/* ---------- story viewer ---------- */

.story {
  position: fixed; inset: 0; z-index: 120;
  display: grid; place-items: center;
  background: #0d0d0f;
  animation: fade .2s ease;
}
.s-wordmark { position: fixed; top: 18px; left: 22px; font-family: var(--wordmark); font-size: 30px; color: #fff; }
.s-x { position: fixed; top: 14px; right: 16px; color: #fff; padding: 6px; z-index: 3; }
.s-frame {
  position: relative;
  height: min(calc(100vh - 40px), 880px);
  aspect-ratio: 9 / 16;
  max-width: 100vw;
  border-radius: 12px;
  overflow: hidden;
  background: #000;
  user-select: none; -webkit-user-select: none;
}
.s-bg { position: absolute; inset: -40px; background-size: cover; background-position: center; filter: blur(30px) brightness(.55); }
.s-img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; }
.s-shade { position: absolute; inset: 0 0 auto 0; height: 110px; background: linear-gradient(rgba(0, 0, 0, .55), transparent); }
.bars { position: absolute; top: 10px; left: 10px; right: 10px; z-index: 2; display: flex; gap: 3px; }
.bar { flex: 1; height: 2.5px; border-radius: 2px; background: rgba(255, 255, 255, .35); overflow: hidden; }
.bar i { display: block; height: 100%; width: 0; background: #fff; }
.s-head {
  position: absolute; top: 22px; left: 12px; right: 12px; z-index: 2;
  display: flex; align-items: center; gap: 8px;
  color: #fff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, .4);
}
.s-head .av { width: 32px; height: 32px; }
.s-head time { opacity: .75; }
.s-head button { color: #fff; padding: 4px; }
.tap { position: absolute; top: 70px; bottom: 80px; z-index: 1; width: 40%; }
.tap.l { left: 0; }
.tap.r { right: 0; }
.s-cta {
  position: absolute; left: 50%; bottom: 22px; z-index: 2;
  translate: -50% 0;
  display: inline-flex; align-items: center; gap: 6px;
  padding: 9px 18px;
  border-radius: 999px;
  background: rgba(255, 255, 255, .94); color: #111;
  font-weight: 600;
}
.s-arrow {
  position: fixed; top: 50%; translate: 0 -50%; z-index: 3;
  display: grid; place-items: center;
  width: 34px; height: 34px; border-radius: 50%;
  background: rgba(255, 255, 255, .85); color: #111;
}
.s-arrow.l { left: calc(50% - min(calc(100vh - 40px), 880px) * 9 / 32 - 56px); }
.s-arrow.r { right: calc(50% - min(calc(100vh - 40px), 880px) * 9 / 32 - 56px); }

@media (max-width: 767px) {
  .s-frame { height: 100%; width: 100%; aspect-ratio: auto; border-radius: 0; }
  .s-wordmark, .s-arrow, .s-x { display: none; }
}

/* ---------- age gate & toast ---------- */

.gate {
  position: fixed; inset: 0; z-index: 200;
  display: grid; place-items: center;
  padding: 24px 16px;
  background:
    radial-gradient(60% 50% at 20% 10%, rgba(255, 46, 116, .22), transparent 70%),
    radial-gradient(50% 50% at 90% 90%, rgba(164, 60, 255, .2), transparent 70%),
    var(--bg);
  overflow-y: auto;
}
.gate-card { width: 100%; max-width: 420px; text-align: center; }
.gate .brand { font-size: 56px; padding: 0 0 18px; }
.gate-badge {
  display: inline-grid; place-items: center;
  width: 64px; height: 64px; margin-bottom: 18px;
  border-radius: 50%;
  border: 2px solid var(--text);
  font-size: 20px; font-weight: 800;
}
.gate h1 { font-size: 22px; font-weight: 800; margin-bottom: 10px; }
.gate p { color: var(--muted); margin-bottom: 10px; }
.gate-actions { display: grid; gap: 10px; margin: 26px 0 18px; }
.gate .foot { max-width: 340px; margin: 0 auto; }

.toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 300;
  translate: -50% 20px;
  padding: 10px 18px;
  border-radius: 10px;
  background: var(--text); color: var(--bg);
  font-weight: 600;
  opacity: 0; pointer-events: none;
  transition: opacity .2s, translate .2s;
}
.toast.show { opacity: 1; translate: -50% 0; }
@media (max-width: 767px) { .toast { bottom: calc(var(--tabbar) + 18px + env(safe-area-inset-bottom)); } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
