/* 燕云社区 · production light UI */
:root {
  --bg: #f5f5f5;
  --card: #ffffff;
  --text: #111111;
  --muted: #8a8a8a;
  --line: #efefef;
  --red: #ff2442;
  --orange: #f07828;
  --gold: #e8b03a;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --shell-max: 960px;
  --tabbar-h: 56px;
  --top-h: 48px;
  --radius: 12px;
  --sans: "Noto Sans SC", -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", sans-serif;
  --pink: var(--red);
  --lilac: var(--text);
  --danger: #e34545;
  --ok: #2f9b63;
  --shadow: 0 1px 3px rgba(0,0,0,0.04);
}

* { box-sizing: border-box; }
html {
  margin: 0;
  min-height: 100%;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
body { margin: 0; min-height: 100%; }
img, video, canvas, svg { max-width: 100%; height: auto; }
.card-media img, .mini-av-img, .user-avatar, .preview-box img, .avatar-preview { max-width: none; height: 100%; }
body.app-shell {
  font-family: var(--sans);
  color: var(--text);
  background: #e8e8e8;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
  width: 100%;
}
.blob { display: none !important; }

/* Responsive app shell: full-bleed on phone, wider centered column on pad/desktop */
.phone-frame {
  width: 100%;
  max-width: var(--shell-max);
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg);
  position: relative;
  display: flex;
  flex-direction: column;
  box-shadow: none;
  padding-left: var(--safe-left);
  padding-right: var(--safe-right);
}
@media (min-width: 640px) {
  body.app-shell { background: #e8e8e8; }
  .phone-frame {
    box-shadow: 0 0 0 1px rgba(0,0,0,0.04), 0 12px 40px rgba(0,0,0,0.08);
  }
}
@media (min-width: 900px) {
  .phone-frame { max-width: 960px; }
}
@media (min-width: 640px) and (max-width: 899px) {
  .phone-frame { max-width: 720px; }
}

/* Top bar */
.app-top {
  position: sticky; top: 0; z-index: 40;
  display: flex; align-items: center; gap: 0.3rem;
  min-height: calc(var(--top-h) + var(--safe-top));
  height: auto;
  padding: var(--safe-top) 0.55rem 0 0.4rem;
  background: #fff; border-bottom: 1px solid var(--line);
  flex: 0 0 auto;
}
.app-top > * { margin-top: 0; }
.app-top .top-tabs,
.app-top .icon-btn,
.app-top .user-slot {
  height: var(--top-h);
  display: flex;
  align-items: center;
}
.app-top .icon-btn,
.icon-btn {
  width: 2rem; height: 2rem; border: none; background: transparent;
  cursor: pointer; display: grid; place-items: center; flex: 0 0 auto;
  padding: 0; border-radius: 8px; color: #222;
}
.icon-btn:active { background: #f3f3f3; }
.ico-search, .ico-plus {
  display: block; width: 18px; height: 18px; position: relative;
}
.ico-search {
  border: 1.6px solid #222; border-radius: 50%; width: 14px; height: 14px;
}
.ico-search::after {
  content: ""; position: absolute; width: 6px; height: 1.6px; background: #222;
  right: -3px; bottom: -1px; transform: rotate(45deg); border-radius: 1px;
}
.ico-plus::before, .ico-plus::after {
  content: ""; position: absolute; background: #222; border-radius: 1px;
  left: 50%; top: 50%; transform: translate(-50%, -50%);
}
.ico-plus::before { width: 14px; height: 1.8px; }
.ico-plus::after { width: 1.8px; height: 14px; }


.top-tabs {
  flex: 1; min-width: 0; display: flex; align-items: flex-end; justify-content: center;
  gap: 0.75rem; padding: 0 0.15rem; height: 100%;
}
.top-tab {
  text-decoration: none; color: #666; font-size: 0.95rem; font-weight: 600;
  padding: 0.7rem 0.05rem 0.45rem; border-bottom: 3px solid transparent;
  white-space: nowrap; line-height: 1;
}
.top-tab.is-active {
  color: #111; font-weight: 900; border-bottom-color: #111;
}
.top-brand {
  text-decoration: none; color: #1a1a1a; font-weight: 900; font-size: 0.88rem;
  white-space: nowrap; padding: 0.55rem 0 0.5rem;
  letter-spacing: 0.02em;
  font-family: "STKaiti", "KaiTi", "Noto Serif SC", serif;
}
.user-slot {
  display: flex; align-items: center; gap: 0.3rem; margin-left: 0.1rem; max-width: 5.5rem;
}
.user-name {
  font-size: 0.7rem; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.user-avatar { width: 1.4rem; height: 1.4rem; border-radius: 50%; object-fit: cover; }
a.btn-register, .ghost, .primary {
  font-family: inherit; cursor: pointer; text-decoration: none;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.35rem 0.65rem; border-radius: 999px; font-weight: 800; font-size: 0.72rem;
  border: 1px solid transparent; min-height: 1.7rem;
}
.primary { background: #111; color: #fff; }
.ghost { background: #fff; color: #666; border-color: #e5e5e5; }
a.btn-register { background: #fff; color: #111; border-color: #e5e5e5; padding: 0.3rem 0.55rem; }

.app-main {
  flex: 1 1 auto;
  width: 100%;
  max-width: 100%;
  padding: 0.55rem clamp(0.45rem, 1.6vw, 1rem) calc(var(--tabbar-h) + var(--safe-bottom) + 0.85rem);
  overflow-x: hidden;
}

/* Promo strip — three equal cards fill shell width */
.promo-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.5rem;
  width: 100%;
  max-width: 100%;
  padding: 0.1rem 0 0.65rem;
  box-sizing: border-box;
}
.promo-card {
  min-width: 0; width: 100%; max-width: none; min-height: 78px;
  border-radius: var(--radius); padding: 0.65rem 0.7rem; color: #fff;
  text-decoration: none; display: flex; flex-direction: column; justify-content: space-between;
  position: relative; overflow: hidden; box-sizing: border-box;
}
.promo-kicker { font-size: 0.66rem; opacity: 0.92; font-weight: 600; }
.promo-card strong {
  font-size: 0.98rem; font-weight: 900; line-height: 1.25; margin: 0.12rem 0 0.35rem;
}
.promo-go {
  align-self: flex-start; font-size: 0.64rem; font-weight: 700;
  padding: 0.18rem 0.55rem; border-radius: 999px;
  background: rgba(255,255,255,0.22); border: 1px solid rgba(255,255,255,0.28);
}
.promo-gold { background: linear-gradient(145deg, #f3c85a, #d99a2a 55%, #c47f18); }
.promo-orange { background: linear-gradient(145deg, #ff9f55, #f07828 52%, #e45a1c); }
.promo-brown { background: linear-gradient(145deg, #9a8f86, #6f6762 55%, #4a4542); }

/* Sub tabs */
.sub-tabs {
  display: flex; gap: 0.05rem; overflow-x: auto; padding: 0.05rem 0.05rem 0.5rem;
  margin-bottom: 0.25rem;
}
.sub-tabs::-webkit-scrollbar { display: none; }
.sub-tab {
  flex: 0 0 auto; border: none; background: transparent; cursor: pointer;
  text-decoration: none; color: #888; font-weight: 600; font-size: 0.92rem;
  padding: 0.3rem 0.65rem; font-family: inherit;
}
.sub-tab.is-on { color: #111; font-weight: 900; }

/* Feed sequential grid — cols set by breakpoints below */
.feed-grid, .bento, .event-grid, .share-bento {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.5rem;
  width: 100%;
  max-width: 100%;
  align-items: start;
}
.card {
  background: var(--card); border-radius: var(--radius); overflow: hidden;
  display: flex; flex-direction: column; min-width: 0; border: none;
}
.card-media {
  position: relative; aspect-ratio: 3 / 4; background: #ebebeb; overflow: hidden;
}
.card-media img { width: 100%; height: 100%; object-fit: cover; display: block; }
.badge {
  position: absolute; top: 0.4rem; right: 0.4rem;
  width: 1.35rem; height: 1.35rem; border-radius: 50%;
  display: grid; place-items: center; padding: 0;
  background: rgba(0,0,0,0.4); color: #fff; font-size: 0.55rem; font-weight: 700;
  border: none;
}
.card-body { padding: 0.45rem 0.5rem 0.55rem; display: flex; flex-direction: column; gap: 0.35rem; }
.card-title {
  margin: 0; font-size: 0.84rem; font-weight: 800; line-height: 1.35; color: #111;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.card-foot { display: flex; align-items: center; justify-content: space-between; gap: 0.25rem; }
.card-author { display: inline-flex; align-items: center; gap: 0.28rem; min-width: 0; }
.mini-av-img {
  width: 1.05rem; height: 1.05rem; border-radius: 50%; object-fit: cover; flex: 0 0 auto;
}
.mini-av {
  width: 1.05rem; height: 1.05rem; border-radius: 50%; flex: 0 0 auto;
  background: linear-gradient(135deg, #ddd, #bbb); color: #fff;
  font-size: 0.55rem; font-weight: 800; display: grid; place-items: center;
}
.card-author-name {
  color: var(--muted); font-size: 0.66rem; font-weight: 600;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 5rem;
}
.card-like { color: var(--muted); font-size: 0.66rem; font-weight: 700; flex: 0 0 auto; }
.feed-grid .body-text,
.feed-grid .meta,
.feed-grid .music-bar,
.feed-grid .comments { display: none; }
.card.is-wall-target { outline: 2px solid var(--red); }

.view { display: none; }
.view.is-on { display: block; }

/* Bottom tabbar — touch targets, safe-area, sticks to shell bottom */
.app-tabbar {
  position: sticky;
  left: 0; right: 0; bottom: 0; z-index: 50;
  flex: 0 0 auto;
  width: 100%;
  min-height: calc(var(--tabbar-h) + var(--safe-bottom));
  height: calc(var(--tabbar-h) + var(--safe-bottom));
  padding: 0.15rem 0.15rem var(--safe-bottom);
  display: grid; grid-template-columns: repeat(5, minmax(0, 1fr));
  background: #fff; border-top: 1px solid var(--line);
  box-shadow: 0 -4px 16px rgba(0,0,0,0.04);
}
@media (max-width: 639px) {
  .app-tabbar {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    width: 100%;
    max-width: none;
  }
  .phone-frame { padding-bottom: 0; }
}
@media (min-width: 640px) {
  .app-tabbar {
    position: sticky;
    max-width: var(--shell-max);
    margin: 0 auto;
  }
}
.tabbar-item {
  position: relative; border: none; background: transparent; cursor: pointer;
  text-decoration: none; color: #999; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.08rem; font-family: inherit;
  min-height: 48px; min-width: 0; padding: 0.2rem 0.1rem;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}
.tabbar-item.is-active { color: #111; }
.tabbar-ico { font-size: 0.95rem; line-height: 1; font-weight: 700; }
.tabbar-logo {
  width: 1.55rem; height: 1.55rem; border-radius: 50%;
  border: 2px solid var(--red);
  background: radial-gradient(circle at 35% 30%, #2a2a2a, #111 70%);
  color: #f0c14b; font-size: 0.62rem; font-weight: 900;
  display: grid; place-items: center;
}
.tabbar-txt { font-size: 0.6rem; font-weight: 700; }
.tabbar-badge {
  position: absolute; top: 0.15rem; left: 54%;
  background: var(--red); color: #fff; font-size: 0.5rem; font-weight: 800;
  padding: 0.05rem 0.22rem; border-radius: 6px; line-height: 1.2; white-space: nowrap;
}

/* Guest gate */
.guest-gate {
  position: fixed; inset: 0; z-index: 200;
  display: none; align-items: flex-end; justify-content: center;
}
.guest-gate[hidden] { display: none !important; }
.guest-gate.is-open { display: flex !important; }
.guest-gate-backdrop { position: absolute; inset: 0; background: rgba(0,0,0,0.38); }
.guest-gate-sheet {
  position: relative; z-index: 1; width: min(560px, 100%);
  background: #fff; border-radius: 16px 16px 0 0;
  padding: 0.5rem 1.1rem calc(1.1rem + var(--safe-bottom));
  box-shadow: 0 -10px 30px rgba(0,0,0,0.12);
  animation: sheetUp 0.22s ease-out;
}
@keyframes sheetUp {
  from { transform: translateY(20px); opacity: 0.7; }
  to { transform: translateY(0); opacity: 1; }
}
.guest-gate-handle {
  width: 36px; height: 4px; border-radius: 99px; background: #e5e5e5; margin: 0.1rem auto 0.8rem;
}
.guest-gate-illu {
  width: 3rem; height: 3rem; border-radius: 50%; margin: 0 auto 0.65rem;
  display: grid; place-items: center; font-weight: 900; color: #fff;
  background: linear-gradient(135deg, #f2c34d, #e07828);
  box-shadow: 0 8px 16px rgba(224,120,40,0.25);
}
.guest-gate-sheet h3 {
  margin: 0 0 0.35rem; text-align: center; font-size: 1.1rem; font-weight: 900;
}
.guest-gate-desc {
  margin: 0 0 0.95rem; text-align: center; color: var(--muted);
  font-size: 0.86rem; line-height: 1.55;
}
.guest-gate-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; margin-bottom: 0.45rem; }
.guest-gate-actions .primary, .guest-gate-actions .ghost {
  min-height: 2.55rem; width: 100%; font-size: 0.9rem;
}
.guest-gate-dismiss {
  display: block; width: 100%; border: none; background: transparent;
  color: var(--muted); font-weight: 700; font-size: 0.85rem; padding: 0.5rem;
  cursor: pointer; font-family: inherit;
}
body.guest-gate-open { overflow: hidden; }

/* Secondary panels */
.section-head { margin: 0.25rem 0 0.7rem; }
.section-head h3 { margin: 0; font-size: 1.02rem; font-weight: 900; }
.section-head p { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.78rem; }
.panel, .tips-card, .register-form, .event-card, .share-card {
  background: #fff; border-radius: var(--radius); border: 1px solid var(--line); padding: 0.95rem;
}
.page-hero {
  border: none; color: #fff; margin-bottom: 0.8rem; border-radius: var(--radius); padding: 1rem;
  background: linear-gradient(135deg, #f0c14b, #e07828);
}
.page-hero h2 { margin: 0 0 0.3rem; font-size: 1.35rem; font-weight: 900; color: #fff; }
.page-hero .lead, .page-hero .eyebrow { color: rgba(255,255,255,0.9); margin: 0 0 0.3rem; }
.page-hero-share { background: linear-gradient(135deg, #8d857c, #4e4a47); }
.page-hero-tags { display: flex; flex-wrap: wrap; gap: 0.3rem; margin-top: 0.5rem; }
.upload-layout {
  display: grid;
  gap: 0.7rem;
  width: 100%;
  max-width: 100%;
}
.form-panel { width: 100%; }
.cat-field { display: grid; gap: 0.4rem; }
.cat-label { color: var(--muted); font-size: 0.82rem; font-weight: 700; }
.cat-pills {
  display: flex; flex-wrap: wrap; gap: 0.4rem;
}
.cat-pill {
  flex: 0 0 auto;
  border: 1px solid #e5e5e5;
  background: #fff;
  color: #666;
  font-weight: 700;
  font-size: 0.82rem;
  padding: 0.38rem 0.85rem;
  border-radius: 999px;
  cursor: pointer;
  font-family: inherit;
}
.cat-pill.is-on {
  color: #fff;
  background: #111;
  border-color: #111;
  font-weight: 900;
}
.stack { display: grid; gap: 0.7rem; }
label { display: grid; gap: 0.28rem; color: var(--muted); font-size: 0.82rem; font-weight: 700; }
input, textarea {
  width: 100%; padding: 0.6rem 0.7rem; border-radius: 10px;
  border: 1px solid #e5e5e5; background: #fff; font: inherit; color: var(--text); outline: none;
}
input:focus, textarea:focus { border-color: #bbb; }
.preview-box {
  min-height: 130px; border-radius: 12px; border: 1px dashed #ccc;
  display: grid; place-items: center; color: var(--muted); overflow: hidden; background: #fafafa;
}
.preview-box img { width: 100%; max-height: 240px; object-fit: cover; }
.chip {
  padding: 0.35rem 0.7rem; border-radius: 999px; background: #f3f3f3; color: #444;
  font-weight: 700; font-size: 0.78rem; border: none; text-decoration: none; display: inline-flex;
}
.hint, .form-msg { margin: 0; font-size: 0.78rem; color: var(--muted); }
.form-msg.is-err { color: var(--danger); }
.form-msg.is-ok { color: var(--ok); }
.tips-card h4 { margin: 0 0 0.4rem; font-weight: 900; }
.tip-bubble {
  margin-top: 0.65rem; padding: 0.6rem; border-radius: 10px;
  background: #fff4f6; color: #a01f3a; font-weight: 700; font-size: 0.82rem;
}
.row-actions { display: flex; gap: 0.45rem; flex-wrap: wrap; }
.foot { text-align: center; color: var(--muted); font-size: 0.7rem; padding: 0.5rem 1rem 1rem; }
.fab { display: none !important; }

.auth-dialog { border: none; padding: 0; background: transparent; max-width: 400px; width: calc(100% - 2rem); }
.auth-dialog::backdrop { background: rgba(0,0,0,0.35); }
.auth-dialog .tab[href] { text-decoration: none; display: flex; align-items: center; justify-content: center; }
.tabs { display: flex; gap: 0.35rem; }
.tab {
  flex: 1; padding: 0.5rem; border-radius: 10px; color: #666; background: #fff;
  border: 1px solid #e5e5e5; font-weight: 700; cursor: pointer; font-family: inherit;
}
.tab.is-on { color: #fff; background: #111; border-color: #111; }

.bento .body-text, .bento .meta, .bento .comments { display: block; }
.bento .music-bar { display: flex; align-items: center; gap: 0.4rem; padding: 0.35rem 0.5rem; border-radius: 999px; border: 1px solid var(--line); background: #fafafa; }
.bento .card-media { aspect-ratio: 4 / 3; }
.bento .card-body { padding: 0.55rem 0.6rem 0.7rem; }
.comment { margin: 0 0 0.25rem; font-size: 0.78rem; color: #555; }
.comment b { color: #111; }
.comment-form { display: flex; gap: 0.4rem; margin-top: 0.4rem; }
.comment-form input { flex: 1; min-height: 2.3rem; }
.music-bar button {
  width: 1.6rem; height: 1.6rem; border-radius: 50%; border: none; background: #111; color: #fff; cursor: pointer;
}
.music-bar span { font-size: 0.72rem; color: var(--muted); font-weight: 700; }
.comments { border-top: 1px solid var(--line); padding-top: 0.45rem; margin-top: 0.25rem; }
.comments h4 { margin: 0 0 0.3rem; font-size: 0.8rem; font-weight: 800; }

.event-grid, .share-bento { margin-top: 0.3rem; }
.event-card h3, .share-card h3 { margin: 0 0 0.3rem; font-size: 1rem; font-weight: 900; }
.event-meta, .share-tags { color: var(--muted); font-size: 0.74rem; display: flex; flex-wrap: wrap; gap: 0.35rem; font-weight: 700; }
.event-desc, .share-card p { color: #555; line-height: 1.55; font-size: 0.86rem; margin: 0.3rem 0 0.65rem; }
.event-badge, .share-ribbon {
  display: inline-block; padding: 0.12rem 0.45rem; border-radius: 6px;
  background: linear-gradient(135deg, #ff9a4a, #e07828); color: #fff; font-size: 0.66rem; font-weight: 800;
}
.event-foot { display: flex; justify-content: space-between; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.event-count { color: #e07828; font-weight: 800; font-size: 0.76rem; }
.event-join.is-joined { background: #fff; color: #111; border: 1px solid #e5e5e5; }
.share-card { display: flex; flex-direction: column; gap: 0.4rem; }
.share-card .chip, .share-card .primary { align-self: flex-start; }

.page-main, .register-main {
  width: min(var(--shell-max), 100%); margin: 0 auto; padding: 0.65rem clamp(0.45rem, 1.6vw, 1rem) 5rem;
  background: var(--bg); min-height: 100vh;
}
.register-grid { display: grid; gap: 0.9rem; }
.avatar-preview-wrap {
  width: 108px; height: 108px; border-radius: 50%; border: 1px dashed #ccc; background: #f5f5f5;
  display: grid; place-items: center; overflow: hidden; margin: 0.45rem 0;
}
.avatar-preview { width: 100%; height: 100%; object-fit: cover; display: none; border-radius: 50%; }
.avatar-preview.is-on { display: block; }
.avatar-placeholder { color: var(--muted); font-size: 0.72rem; font-weight: 700; }
.file-pill {
  display: inline-flex; padding: 0.4rem 0.85rem; border-radius: 999px; border: 1px solid #e5e5e5;
  background: #fff; font-weight: 800; cursor: pointer;
}
.file-pill input { display: none; }
.crop-box { margin-top: 0.65rem; padding: 0.65rem; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
.crop-stage { position: relative; width: min(280px,100%); margin: 0 auto 0.5rem; overflow: hidden; border-radius: 10px; background: #f0f0f0; }
#crop-canvas { width: 100%; height: auto; display: block; touch-action: none; cursor: grab; }
.crop-frame {
  pointer-events: none; position: absolute; inset: 8%;
  border: 1px dashed rgba(0,0,0,0.35); border-radius: 50%;
  box-shadow: 0 0 0 999px rgba(255,255,255,0.35);
}
.crop-zoom { display: grid; gap: 0.28rem; margin-bottom: 0.35rem; }
.crop-zoom input[type=range] { width: 100%; accent-color: var(--red); }
.pill-row { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.pill {
  display: inline-flex; gap: 0.28rem; align-items: center; justify-content: center;
  padding: 0.35rem 0.7rem; border-radius: 999px; border: 1px solid #e5e5e5;
  background: #fff; cursor: pointer; font-weight: 700; white-space: nowrap; box-sizing: border-box;
}
.pill input[type="radio"] {
  margin: 0; flex: 0 0 auto; width: 0.95rem; height: 0.95rem; align-self: center;
}
.pill:has(input:checked) { background: #111; color: #fff; border-color: #111; }
.gender-field { border: 1px dashed #ddd; border-radius: 12px; padding: 0.65rem 0.7rem; margin: 0; }
.gender-field legend { padding: 0 0.15rem; font-weight: 800; }
.gender-field .pill-row {
  display: grid;
  grid-template-columns: repeat(3, minmax(4.6rem, 1fr));
  gap: 0.45rem;
  width: 100%;
  align-items: stretch;
}
.gender-field .pill {
  width: 100%;
  min-height: 2.35rem;
  padding: 0.42rem 0.55rem;
  gap: 0.4rem;
  border-radius: 999px;
  line-height: 1.15;
  white-space: nowrap;
  overflow: visible;
}
.tag-chips { display: flex; flex-wrap: wrap; gap: 0.3rem; }
.topbar { display: none !important; }

/* Persistent top header on secondary pages (activities / share / register) */
body:not(.app-shell) > .app-top {
  position: sticky;
  top: 0;
  z-index: 40;
  width: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  box-sizing: border-box;
}
body:not(.app-shell) > .app-top + .page-main,
body:not(.app-shell) > .app-top + .register-main,
body:not(.app-shell) .page-main,
body:not(.app-shell) .register-main {
  /* keep existing bottom pad; ensure room under sticky top is natural */
}
.nav-btn { color: inherit; text-decoration: none; }
.meta { color: var(--muted); font-size: 0.7rem; }
.body-text { margin: 0; color: #555; font-size: 0.8rem; line-height: 1.5; }
.slot-login,.slot-logout{font-size:0.68rem;padding:0.15rem 0.35rem;border-radius:999px;}


/* Secondary pages (activities / share / register) without .phone-frame */
body:not(.app-shell) {
  font-family: var(--sans);
  color: var(--text);
  background: var(--bg);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body:not(.app-shell) .app-tabbar {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  bottom: 0;
  width: 100%;
  max-width: var(--shell-max);
}
body:not(.app-shell) .page-main,
body:not(.app-shell) .register-main {
  padding-bottom: calc(var(--tabbar-h) + var(--safe-bottom) + 1rem);
}
/* === RESPONSIVE BREAKPOINTS === */
/* Very narrow phones: single-column feed, compact chrome */
@media (max-width: 379px) {
  .promo-strip { gap: 0.35rem; }
  .promo-card { min-height: 70px; padding: 0.5rem 0.45rem; }
  .promo-kicker { font-size: 0.58rem; }
  .promo-card strong { font-size: 0.82rem; }
  .promo-go { font-size: 0.58rem; padding: 0.14rem 0.42rem; }
  .feed-grid, .bento, .event-grid, .share-bento {
    grid-template-columns: 1fr;
    gap: 0.55rem;
  }
  .top-brand { display: none; }
  .top-tab { font-size: 0.88rem; }
  .app-top { gap: 0.15rem; padding-left: 0.25rem; padding-right: 0.3rem; }
  .user-slot { max-width: 4.2rem; }
  .card-title { font-size: 0.8rem; }
}

/* Phone default already 2-col via base rule */

/* Pad / large phone landscape */
@media (min-width: 600px) {
  .promo-card { min-height: 88px; }
  .promo-card strong { font-size: 1.05rem; }
  .sub-tab { font-size: 0.98rem; padding: 0.35rem 0.8rem; }
  .feed-grid, .bento, .event-grid, .share-bento { gap: 0.65rem; }
  .card-title { font-size: 0.9rem; }
  /* upload stays single-column */
}

/* Desktop / large pad: optional 3-col feed */
@media (min-width: 900px) {
  .feed-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.75rem;
  }
  .bento, .event-grid, .share-bento {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .app-main { padding-left: 1rem; padding-right: 1rem; }
  .promo-strip { gap: 0.65rem; }
  .promo-card { min-height: 92px; }
  .top-tab { font-size: 1rem; gap: 1rem; }
  .top-tabs { gap: 1.1rem; }
  .tabbar-txt { font-size: 0.68rem; }
}

/* Extra-wide desktop still capped by --shell-max */
@media (min-width: 1200px) {
  :root { --shell-max: 960px; }
  .card-media { aspect-ratio: 3 / 4; }
}

/* Prefer reduced overflow on any short landscape phone */
@media (max-height: 500px) and (orientation: landscape) {
  .promo-strip { padding-bottom: 0.35rem; }
  .promo-card { min-height: 64px; }
  .app-main { padding-top: 0.35rem; }
}

/* Prevent stubborn horizontal scroll from long words / grids */
.app-main,
.feed-grid,
.card,
.promo-strip,
.sub-tabs {
  max-width: 100%;
}
.phone-frame {
  /* keep shell max-width from earlier rules; only clamp to viewport */
  width: min(100%, var(--shell-max));
}
.card-title, .promo-card strong {
  overflow-wrap: anywhere;
  word-break: break-word;
}

/* ===== Post detail (fullscreen image + right rail + comment sheet) ===== */
body.post-page {
  margin: 0;
  min-height: 100%;
  background: #0a0a0a;
  color: #fff;
  font-family: var(--sans);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}
body.post-page.cmt-open {
  overflow: hidden;
  height: 100%;
}
.post-stage {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  max-width: 100vw;
  overflow: hidden;
  background: #0a0a0a;
  display: flex;
  flex-direction: column;
}
body.post-page { max-width: 100vw; overflow-x: hidden; }
.post-chrome {
  position: absolute;
  top: 0; left: 0; right: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 0.55rem;
  padding: calc(0.55rem + var(--safe-top)) 0.7rem 0.55rem;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(0,0,0,0.55) 0%, rgba(0,0,0,0) 100%);
}
.post-chrome > * { pointer-events: auto; }
.post-back {
  width: 44px; height: 44px; min-width: 44px; min-height: 44px;
  border: none; border-radius: 50%;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(6px);
  cursor: pointer;
  display: grid; place-items: center;
  padding: 0;
}
.post-back-ico {
  display: block; width: 12px; height: 12px;
  border-left: 2.2px solid #fff; border-bottom: 2.2px solid #fff;
  transform: rotate(45deg); margin-left: 3px;
}
.post-author-chip {
  display: inline-flex; align-items: center; gap: 0.4rem;
  background: rgba(0,0,0,0.35); backdrop-filter: blur(6px);
  border-radius: 999px; padding: 0.25rem 0.65rem 0.25rem 0.25rem;
  max-width: min(60vw, 220px);
}
.post-author-av {
  width: 28px; height: 28px; border-radius: 50%; object-fit: cover;
  max-width: none;
}
.post-author-name {
  font-size: 0.82rem; font-weight: 700; color: #fff;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.post-media {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: block;
  min-height: 100%;
  padding: 0;
  box-sizing: border-box;
  overflow: hidden;
  background: #0a0a0a;
}
.post-media img#post-image {
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
  object-fit: cover;
  object-position: center;
  border-radius: 0;
}
.post-missing {
  color: rgba(255,255,255,0.7); font-size: 0.95rem; text-align: center;
}

.post-rail {
  position: absolute;
  right: calc(0.55rem + var(--safe-right));
  bottom: calc(7.5rem + var(--safe-bottom));
  top: auto;
  z-index: 30;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.15rem;
  pointer-events: none;
}
.post-rail > * { pointer-events: auto; }
.rail-av {
  width: 46px; height: 46px; border-radius: 50%;
  border: 2px solid #fff; padding: 0; overflow: hidden;
  background: #333; cursor: pointer;
}
.rail-av img {
  width: 100%; height: 100%; object-fit: cover; display: block; max-width: none;
}
.rail-btn {
  display: flex; flex-direction: column; align-items: center; gap: 0.18rem;
  background: transparent; border: none; color: #fff; cursor: pointer;
  min-width: 44px; min-height: 44px; padding: 0.15rem;
  text-shadow: 0 1px 3px rgba(0,0,0,0.45);
}
.rail-ico {
  width: 28px; height: 28px; display: block; position: relative;
}
.rail-heart::before {
  content: "";
  display: block;
  width: 22px; height: 20px; margin: 4px auto 0;
  background: #fff;
  clip-path: path("M12 21.35l-1.45-1.32C5.4 15.36 2 12.28 2 8.5 2 5.42 4.42 3 7.5 3c1.74 0 3.41.81 4.5 2.09C13.09 3.81 14.76 3 16.5 3 19.58 3 22 5.42 22 8.5c0 3.78-3.4 6.86-8.55 11.54L12 21.35z");
  transform: scale(0.95);
}
.rail-btn.is-liked .rail-heart::before { background: #ff2442; }
.rail-cmt::before {
  content: "";
  display: block;
  width: 22px; height: 20px; margin: 4px auto 0;
  border: 2px solid #fff; border-radius: 11px 11px 11px 3px;
  box-sizing: border-box;
}.rail-count {
  font-size: 0.82rem; font-weight: 800; line-height: 1; color: #fff;
}
.rail-label {
  font-size: 0.68rem; font-weight: 700; opacity: 1; color: #fff;
}

.post-caption {
  position: absolute;
  left: 0.85rem; right: 4.5rem;
  bottom: calc(1.1rem + var(--safe-bottom));
  z-index: 16;
  pointer-events: none;
  text-shadow: 0 1px 4px rgba(0,0,0,0.55);
}
.post-title {
  margin: 0 0 0.25rem; font-size: 0.98rem; font-weight: 800; line-height: 1.35;
}
.post-body {
  margin: 0; font-size: 0.82rem; font-weight: 500; opacity: 0.92; line-height: 1.45;
}

/* Comment bottom sheet */
.cmt-scrim {
  position: fixed; inset: 0; z-index: 80;
  background: rgba(0,0,0,0.45);
}
.cmt-sheet {
  position: fixed; left: 0; right: 0; z-index: 90;
  width: 100%;
  max-width: none;
  margin: 0;
  /* --cmt-kb: keyboard overlap from visualViewport (0 when closed) */
  bottom: var(--cmt-kb, 0px);
  height: min(72dvh, 680px);
  max-height: calc(100dvh - 6vh - var(--cmt-kb, 0px));
  background: #fff;
  color: #111;
  border-radius: 16px 16px 0 0;
  display: flex; flex-direction: column;
  box-shadow: 0 -8px 32px rgba(0,0,0,0.22);
  padding-bottom: var(--safe-bottom);
  box-sizing: border-box;
  animation: cmt-up 0.28s ease-out;
}
@keyframes cmt-up {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}
.cmt-head {
  position: relative;
  flex: 0 0 auto;
  display: flex; align-items: center; justify-content: center;
  min-height: 48px;
  padding: 0.55rem 3rem 0.35rem;
  border-bottom: 1px solid #f0f0f0;
}
.cmt-title {
  margin: 0; font-size: 0.92rem; font-weight: 800; color: #222;
}
.cmt-close {
  position: absolute; right: 0.55rem; top: 50%; transform: translateY(-50%);
  width: 36px; height: 36px; border: none; border-radius: 50%;
  background: #f0f0f0; color: #222; font-size: 1.35rem; line-height: 1;
  cursor: pointer; display: grid; place-items: center; padding: 0;
  font-weight: 500; z-index: 2;
}
.cmt-list {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 0.45rem 0.85rem 0.55rem;
}
.cmt-empty {
  text-align: center; color: #999; font-size: 0.85rem; padding: 2rem 0;
}
.cmt-item {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) 36px;
  gap: 0.55rem;
  padding: 0.55rem 0;
  align-items: start;
}
.cmt-item.is-reply {
  padding-left: 2.4rem;
  grid-template-columns: 28px minmax(0, 1fr) 32px;
}
.cmt-av {
  width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
  max-width: none; display: block;
}
.cmt-item.is-reply .cmt-av { width: 28px; height: 28px; }
.cmt-av-fallback {
  display: grid; place-items: center;
  background: #f0e6da; color: #8a5a2b; font-weight: 800; font-size: 0.75rem;
}
.cmt-main { min-width: 0; }
.cmt-user-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.28rem;
  margin-bottom: 0.15rem;
}
.cmt-user {
  font-size: 0.78rem; font-weight: 700; color: #666;
}
.cmt-badge {
  display: inline-flex; align-items: center;
  font-size: 0.58rem; font-weight: 800; color: #fff;
  background: linear-gradient(90deg, #4f8cff, #6aa8ff);
  border-radius: 4px; padding: 0.08rem 0.28rem; line-height: 1.2;
}
.cmt-text {
  margin: 0 0 0.28rem; font-size: 0.9rem; color: #222; line-height: 1.45;
  word-break: break-word;
}
.cmt-thumb-wrap {
  margin: 0.2rem 0 0.35rem;
}
.cmt-thumb {
  width: 96px; height: 96px; object-fit: cover; border-radius: 8px;
  max-width: none; display: block; background: #f3f3f3;
}
.cmt-meta {
  display: flex; align-items: center; gap: 0.65rem;
  font-size: 0.7rem; color: #999;
}
.cmt-reply-btn {
  border: none; background: transparent; color: #999;
  font-size: 0.7rem; font-weight: 700; cursor: pointer; padding: 0;
  font-family: inherit;
}
.cmt-heart {
  border: none; background: transparent; cursor: pointer;
  display: flex; flex-direction: column; align-items: center;
  gap: 0.05rem; padding: 0.15rem; color: #bbb; min-width: 32px;
}
.cmt-heart-ico::before {
  content: "♡"; font-size: 0.95rem; line-height: 1; color: #c8c8c8;
}
.cmt-heart-n { font-size: 0.62rem; color: #aaa; font-weight: 600; }

.cmt-foot {
  flex: 0 0 auto;
  display: flex; align-items: center; gap: 0.45rem;
  padding: 0.5rem 0.75rem calc(0.55rem + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid #f0f0f0;
  background: #fff;
  position: relative;
  z-index: 2;
  /* focus ring on pill must not clip */
  overflow: visible;
}
.cmt-input-pill {
  flex: 1 1 auto; min-width: 0;
  display: flex; align-items: center; gap: 0.25rem;
  background: #f5f5f5;
  border-radius: 999px;
  padding: 0.28rem 0.55rem 0.28rem 0.85rem;
  min-height: 44px;
  border: 1.5px solid transparent;
  box-sizing: border-box;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.cmt-input-pill:focus-within {
  background: #fff;
  border-color: #c8c8c8;
  box-shadow: 0 0 0 3px rgba(0, 0, 0, 0.06);
}
.cmt-input-pill input,
.cmt-input-pill input:focus,
.cmt-input-pill input:focus-visible {
  /* override global input { width:100%; padding; border } that blows the pill layout */
  flex: 1 1 auto;
  width: auto;
  min-width: 0;
  max-width: 100%;
  height: auto;
  min-height: 0;
  margin: 0;
  border: none !important;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  /* >=16px prevents iOS Safari auto-zoom on focus */
  font-size: 16px;
  line-height: 1.35;
  font-family: inherit;
  color: #222;
  padding: 0.35rem 0;
  outline: none !important;
  -webkit-appearance: none;
  appearance: none;
  -webkit-tap-highlight-color: transparent;
  caret-color: #111;
}
.cmt-input-pill input::placeholder {
  color: #999;
  opacity: 1;
}
.cmt-tools { display: flex; align-items: center; gap: 0.05rem; flex: 0 0 auto; }
.cmt-tool {
  width: 32px; height: 32px; border: none; background: transparent;
  cursor: pointer; font-size: 0.95rem; border-radius: 50%;
  display: grid; place-items: center; color: #666; padding: 0;
}
.cmt-send {
  flex: 0 0 auto;
  border: none; background: #111; color: #fff;
  border-radius: 999px; padding: 0.45rem 0.85rem;
  font-size: 0.8rem; font-weight: 800; cursor: pointer;
  font-family: inherit; min-height: 36px;
}

@media (min-width: 640px) {
  .cmt-sheet {
    height: min(68dvh, 720px);
    border-radius: 18px 18px 0 0;
  }
}
@media (min-width: 900px) {
  .post-stage { max-width: 960px; margin: 0 auto; }
  /* Align sheet with centered post shell — full shell width, no floating card gutters */
  .cmt-sheet {
    left: max(0px, calc(50vw - 480px));
    right: max(0px, calc(50vw - 480px));
    width: auto;
    max-width: none;
    margin: 0;
  }
  .cmt-scrim {
    left: max(0px, calc(50vw - 480px));
    right: max(0px, calc(50vw - 480px));
    width: auto;
  }
}

.cmt-sheet[hidden],
.cmt-scrim[hidden] {
  display: none !important;
}
.rail-ico.rail-heart,
.rail-ico.rail-cmt {
  font-size: 1.55rem;
  line-height: 1;
  text-align: center;
  width: auto; height: auto;
}
.rail-ico.rail-heart::before,
.rail-ico.rail-cmt::before { content: none !important; display: none !important; }
.rail-btn.is-liked .rail-heart { color: #ff2442; }
/* —— 我的：资料卡 + 编辑 + 作品瀑布流 —— */
.mine-layout {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  padding: 0.15rem 0 1.2rem;
}
.mine-profile-card { padding: 0.9rem 0.95rem 1rem; }
.mine-hero {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}
.mine-avatar-wrap {
  position: relative;
  width: 4.6rem;
  height: 4.6rem;
  flex: 0 0 auto;
  border-radius: 50%;
  overflow: hidden;
  background: linear-gradient(145deg, #f7ebe0, #efe0d2);
  border: 2px solid #fff;
  box-shadow: 0 6px 18px rgba(80, 48, 20, 0.12);
}
.mine-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.mine-avatar-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 900;
  font-size: 1.35rem;
  color: #7a5a3a;
}
.mine-hero-meta { min-width: 0; flex: 1; }
.mine-nick {
  margin: 0;
  font-size: 1.12rem;
  font-weight: 900;
  letter-spacing: 0.01em;
}
.mine-line {
  margin: 0.2rem 0 0;
  color: var(--muted);
  font-size: 0.78rem;
}
.mine-bio {
  margin: 0.45rem 0 0;
  font-size: 0.82rem;
  line-height: 1.45;
  color: #4a3a2c;
}
.mine-tags { margin-top: 0.45rem; }
.mine-actions {
  margin-top: 0.85rem;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}
.mine-actions[hidden] { display: none !important; }
.mine-logout[hidden] { display: none !important; }
.mine-actions .primary { min-width: 7.5rem; }
.mine-actions .mine-logout { min-width: 7.5rem; color: #8a4a3a; border-color: #ecd5cc; }
.mine-edit-card { padding: 0.9rem 0.95rem 1rem; }
.mine-edit-form .mine-edit-avatar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 0.2rem;
}
.mine-edit-av-wrap {
  width: 4.2rem !important;
  height: 4.2rem !important;
}
.mine-pass-block {
  margin-top: 0.35rem;
  padding: 0.7rem 0.75rem;
  border-radius: 12px;
  border: 1px dashed #e2d3c3;
  background: #fffaf5;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.mine-pass-title {
  margin: 0;
  font-size: 0.92rem;
  font-weight: 800;
}
.mine-works-card { padding: 0.85rem 0.75rem 1rem; }
.mine-works-card .section-head { padding: 0 0.2rem; }
.mine-works-card .feed-grid { margin-top: 0.25rem; }
@media (max-width: 420px) {
  .mine-hero { align-items: flex-start; }
  .mine-avatar-wrap { width: 4.1rem; height: 4.1rem; }
}
/* Curated promo feeds (本周热帖 / 同人精选 / 活动预告) */
.curated-head {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  padding: 0.65rem 0.35rem 0.35rem;
}
.curated-head h3 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 900;
}
.curated-head p {
  margin: 0.15rem 0 0;
  color: var(--muted);
  font-size: 0.72rem;
}
.curated-back {
  flex: 0 0 auto;
  width: 2rem;
  height: 2rem;
  border: none;
  border-radius: 8px;
  background: #f3f3f3;
  font-size: 1.35rem;
  line-height: 1;
  cursor: pointer;
  color: #222;
}
.curated-back:active { background: #e8e8e8; }


/* ---- edit post ---- */
.card-edit-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  margin-top: 0.2rem;
  padding: 0.22rem 0.55rem;
  border-radius: 999px;
  border: 1px solid #ecd5cc;
  background: #fff8f4;
  color: #8a4a3a;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}
.card-edit-btn:hover { background: #ffe8dc; }
.upload-actions { display: flex; gap: 0.55rem; flex-wrap: wrap; align-items: center; }
.upload-actions .primary, .upload-actions .ghost { min-width: 7rem; }
#post-image-hint:not([hidden]) { display: block; margin: -0.15rem 0 0.1rem; color: var(--muted); }
.post-edit-btn {
  margin-left: auto;
  border: 1px solid rgba(255,255,255,0.35);
  background: rgba(0,0,0,0.35);
  color: #fff;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
.post-chrome { display: flex; align-items: center; gap: 0.5rem; }
