:root {
  --ink: #111111;
  --muted: #8a8a8a;
  --line: #ececec;
  --bg: #ffffff;
  --accent: #111111;
  --cta: #111111;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --cta-h: 72px;
  --font: "PingFang SC", "Hiragino Sans GB", "Noto Sans SC", "Helvetica Neue", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  -webkit-tap-highlight-color: transparent;
}

body {
  padding-bottom: calc(var(--cta-h) + var(--safe-bottom) + 12px);
}

.page {
  min-height: 100vh;
  background: var(--bg);
}

.brand {
  padding: 18px 16px 8px;
}

.logo {
  color: var(--ink);
  text-decoration: none;
  font-weight: 700;
  font-size: 1.55rem;
  letter-spacing: -0.03em;
  line-height: 1;
}

.shell {
  width: 100%;
}

.state {
  padding: 16px;
}

.hint {
  margin: 16px 0 0;
  color: var(--muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.home-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 600;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.9em;
  background: #f4f4f4;
  padding: 0.1em 0.35em;
  border-radius: 6px;
}

.skeleton {
  background: linear-gradient(90deg, #f2f2f2, #e8e8e8, #f2f2f2);
  background-size: 200% 100%;
  animation: shimmer 1.3s ease-in-out infinite;
  border-radius: 10px;
}

.skeleton.head {
  height: 48px;
  margin-bottom: 16px;
}

.skeleton.media {
  width: 100vw;
  margin-left: -16px;
  aspect-ratio: 1;
  border-radius: 0;
}

.skeleton.stats {
  width: 40%;
  height: 22px;
  margin-top: 16px;
}

@keyframes shimmer {
  0% { background-position: 100% 0; }
  100% { background-position: -100% 0; }
}

.post {
  background: var(--bg);
}

.post-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 16px 14px;
}

.post-author {
  display: flex;
  align-items: center; /* 无地址：头像与用户名垂直居中对齐 */
  gap: 10px;
  min-width: 0;
  flex: 1;
}

.post-author.has-location {
  align-items: flex-start; /* 有地址：名称在上头像顶对齐，地址在名称下 */
}

.avatar,
.avatar-fallback {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  flex: 0 0 auto;
  background: #f0f0f0;
}

.avatar-fallback {
  display: grid;
  place-items: center;
  color: #666;
  font-weight: 600;
}

.author-meta {
  min-width: 0;
  padding-top: 0;
}

.post-author.has-location .author-meta {
  padding-top: 1px;
}

.author-name {
  font-weight: 600;
  font-size: 1rem;
  line-height: 1.25;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.author-location {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.post-time {
  flex: 0 0 auto;
  align-self: flex-start;
  display: flex;
  align-items: center; /* 与头像垂直居中对齐，不跟用户名行对齐 */
  min-height: 42px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.3;
  white-space: nowrap;
}

.media-carousel {
  position: relative;
  width: 100vw;
  margin-left: calc(50% - 50vw);
  margin-right: calc(50% - 50vw);
  background: #f7f7f7;
}

.media-track {
  display: flex;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.media-track::-webkit-scrollbar {
  display: none;
}

.media-slide {
  flex: 0 0 100%;
  width: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  background: #f7f7f7;
}

.media-slide img,
.media-slide video {
  display: block;
  width: 100%;
  height: auto;
  min-height: 100vw;
  max-height: 100vh;
  object-fit: cover;
  background: #f7f7f7;
}

.media-empty {
  width: 100%;
  min-height: 56vw;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-size: 0.92rem;
  background: #f7f7f7;
}

.media-dots {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 12px;
  display: flex;
  justify-content: center;
  gap: 6px;
  pointer-events: none;
}

.media-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.media-dots span.active {
  background: #fff;
}

.media-nav {
  display: none;
}

.post-stats {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 14px 16px 8px;
}

.stat {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--ink);
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1;
}

.stat svg {
  display: block;
  flex: 0 0 auto;
}

.error-box {
  padding: 28px 16px;
}

.error-title {
  margin: 0 0 8px;
  font-size: 1.35rem;
  font-weight: 600;
}

.cta-bar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: var(--cta-h);
  padding: 12px 16px calc(12px + var(--safe-bottom));
  background: #fff;
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 24px rgba(0, 0, 0, 0.04);
}

.cta-bar[hidden] {
  display: none !important;
}

.cta-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.app-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background:
    linear-gradient(145deg, #f2f2f2, #e4e4e4);
  border: 1px solid #e8e8e8;
  flex: 0 0 auto;
  position: relative;
  overflow: hidden;
}

.app-icon::after {
  content: "App";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #999;
  font-size: 0.72rem;
  font-weight: 600;
}

.cta-copy {
  min-width: 0;
}

.cta-copy strong {
  display: block;
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cta-btn {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 16px;
  border-radius: 999px;
  background: var(--cta);
  color: #fff;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  white-space: nowrap;
}

@media (min-width: 720px) {
  .brand,
  .post-head,
  .post-stats,
  .state,
  .error-box {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
  }

  .media-carousel {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
    width: 100%;
  }

  .media-slide img,
  .media-slide video {
    min-height: 720px;
  }

  .media-nav {
    position: absolute;
    top: 50%;
    z-index: 2;
    width: 44px;
    height: 44px;
    padding: 0;
    transform: translateY(-50%);
    border: 0;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background: rgba(17, 17, 17, 0.68);
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
    transition: background-color 160ms ease, transform 160ms ease;
  }

  .media-nav svg {
    display: block;
    width: 10px;
    height: 18px;
  }

  .media-nav-previous svg {
    transform: translateX(-1px);
  }

  .media-nav-next svg {
    transform: translateX(1px);
  }

  .media-nav:hover {
    background: rgba(17, 17, 17, 0.86);
  }

  .media-nav:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
  }

  .media-nav:active {
    transform: translateY(-50%) scale(0.96);
  }

  .media-nav[hidden] {
    display: none;
  }

  .media-nav-previous {
    left: 16px;
  }

  .media-nav-next {
    right: 16px;
  }

  .cta-bar {
    left: 50%;
    right: auto;
    width: 720px;
    transform: translateX(-50%);
    border-radius: 16px 16px 0 0;
  }
}
