/* ==========================================================================
   两城一家 · 视觉规范
   温暖、干净的家庭相册风格：米白背景、深灰正文、深暖橙主按钮、柔和绿珠珠标记。
   正文默认 17–18px，主要按钮 52px 高、点击区域不小于 48×48（设计报告 09）。
   ========================================================================== */

:root {
  --bg: #fbf7f1;
  --surface: #ffffff;
  --surface-2: #f6f0e6;
  --surface-3: #efe7da;
  --ink: #2e2a26;
  --ink-2: #6b6259;
  --ink-3: #9a9086;
  --line: #ece3d6;
  --brand: #c2591f;
  --brand-press: #a94a17;
  --brand-soft: #fbeade;
  --pet: #557f57;
  --pet-soft: #e7efe5;
  --danger: #a83a2c;
  --danger-soft: #fbeae7;
  --ok: #3f7d4e;
  --gold: #d99b34;
  --radius-lg: 18px;
  --radius: 14px;
  --radius-sm: 10px;
  --pad: 16px;
  --gap: 12px;
  --tap: 48px;
  /* 底部导航的高度（不含安全区）。小狗要贴着它的上沿，所以这里共用一个值 */
  --tabbar-h: 67px;
  /*
   * 中文用宋体：安卓/桌面没有「宋体」这个名字，用思源宋体（Noto Serif CJK）兜底，
   * 再不行交给系统衬线字体。
   * 数字和英文仍然走系统无衬线字体 —— 宋体的西文偏窄偏旧，混在一起会显得脏。
   */
  --font: -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial,
    "Songti SC", "Songti TC", SimSun, "宋体", "Noto Serif CJK SC", "Source Han Serif SC",
    "Noto Serif SC", Georgia, serif;
  --shadow: 0 1px 2px rgba(74, 58, 40, 0.05), 0 8px 24px rgba(74, 58, 40, 0.06);
  --shadow-lift: 0 4px 12px rgba(74, 58, 40, 0.1), 0 16px 40px rgba(74, 58, 40, 0.12);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: rgba(194, 89, 31, 0.12);
}

/* 弹层的 display 会覆盖浏览器默认的 [hidden]，这里显式声明优先 */
[hidden] {
  display: none !important;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 17px/1.6 var(--font);
  overscroll-behavior-y: none;
}

/*
 * 自定义背景照片（可选）。照片固定铺满，上面盖一层米白遮罩保证文字可读。
 * 用 fixed 伪元素而不是 background-attachment: fixed —— iOS Safari 对后者支持不好。
 */
body::before,
body::after {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
}

body::before {
  background-image: var(--app-photo, none);
  background-size: cover;
  background-position: center;
}

body::after {
  background: rgba(251, 247, 241, var(--app-scrim, 0));
}

/* 有背景照片时让 App 容器透出来，并把顶栏调实一点，免得文字压在照片上 */
body.has-photo .app {
  background: transparent;
}

/*
 * 有背景照片时，直接压在照片上的说明文字加一圈米白描边。
 * 卡片里的文字本来就压在白色背景上，这层描边看不见，所以不会影响它们。
 */
body.has-photo .section-title,
body.has-photo .tiny,
body.has-photo .hint,
body.has-photo p.muted,
body.has-photo .empty,
body.has-photo .label,
body.has-photo .topbar-title,
body.has-photo .topbar-sub,
body.has-photo .icon-btn {
  text-shadow:
    0 0 2px rgba(251, 247, 241, 0.95),
    0 0 7px rgba(251, 247, 241, 0.9),
    0 1px 1px rgba(251, 247, 241, 0.9);
}

/* 没有底色挡着，日期这类浅色文字压在照片上会看不清，加深一档 */
body.has-photo .topbar-sub {
  color: var(--ink-2);
}

button,
input,
textarea,
select {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  border: 0;
  background: none;
  padding: 0;
}

a {
  color: var(--brand);
  text-decoration: none;
}

img,
video {
  display: block;
  max-width: 100%;
}

.app {
  max-width: 560px;
  margin: 0 auto;
  min-height: 100dvh;
  position: relative;
  background: var(--bg);
}

/* ------------------------------- 顶部栏 ------------------------------- */

.topbar {
  /* 不再钉在顶上 —— 跟着内容一起滚走，浏览时整屏都是内容 */
  position: relative;
  padding: max(env(safe-area-inset-top), 10px) var(--pad) 10px;
  /*
   * 不自带底色，也不做背景虚化。
   * 以前这里有一层米白半透明底 —— 有背景照片时会盖出一条白带子，
   * 看起来像"顶上多了一条没字的栏"。现在它跟页面背景连成一片。
   */
  background: none;
  border-bottom: none;
}

.topbar.is-stuck {
  border-bottom-color: var(--line);
}

.topbar-row {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 40px;
}

.topbar-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 0.2px;
  word-break: break-word;
}

.topbar-sub {
  font-size: 13px;
  color: var(--ink-3);
  margin-top: 1px;
}

.topbar-actions {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  width: var(--tap);
  height: var(--tap);
  display: grid;
  place-items: center;
  border-radius: 999px;
  color: var(--ink-2);
  position: relative;
}

.icon-btn:active {
  background: var(--surface-2);
}

.icon-btn .badge {
  position: absolute;
  top: 6px;
  right: 6px;
  min-width: 18px;
  height: 18px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  font-weight: 700;
}

/* ------------------------------- 内容区 ------------------------------- */

.content {
  padding: 4px var(--pad) calc(112px + env(safe-area-inset-bottom));
}

.content.flush {
  padding-bottom: calc(96px + env(safe-area-inset-bottom));
}

.stack {
  display: flex;
  flex-direction: column;
  gap: var(--gap);
}

.stack-lg {
  gap: 20px;
}

/* ------------------------------- 卡片 ------------------------------- */

/*
 * iOS 那种"液态玻璃"泡泡。
 *
 * 关键在对比度：以前整张卡都是 50–80% 的白，高光又是 95% 的白，
 * 全是白的，眼睛分不出来 —— 所以看着像磨砂而不是光面。
 * 现在把玻璃主体压到 38–52%，高光拉到纯白并给一个清晰的弧形边界，
 * 上半部那道"光打在球面上"的反光才真正看得出来。
 */
.card {
  position: relative;
  isolation: isolate;
  /*
   * 镜片感：白度从中心往边缘递增 —— 中间最透（薄），靠边越白（厚）。
   * 这就是 iOS 那种"中间薄、边上厚"的关键，光在边缘聚起来。
   */
  background: radial-gradient(
    112% 104% at 50% 50%,
    rgba(255, 255, 255, 0.2) 0%,
    rgba(255, 255, 255, 0.24) 46%,
    rgba(255, 255, 255, 0.72) 85%,
    rgba(255, 255, 255, 0.95) 100%
  );
  /* 虚化半径从 24px 降到 10px：视觉差别不大，但老手机上的开销小很多 */
  -webkit-backdrop-filter: blur(10px) saturate(170%);
  backdrop-filter: blur(10px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.92);
  border-radius: var(--radius-lg);
  padding: 14px;
  box-shadow:
    /* 玻璃边缘那一圈亮线 + 紧贴它的厚度辉光 —— "边上厚"就靠这两层 */
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.95),
    inset 0 0 12px 1px rgba(255, 255, 255, 0.6),
    inset 0 1px 1px rgba(255, 255, 255, 1),
    inset 0 -9px 16px -11px rgba(74, 58, 40, 0.24),
    0 2px 4px rgba(74, 58, 40, 0.06),
    0 18px 34px -12px rgba(74, 58, 40, 0.28);
  transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/*
 * 反光层（放在内容下面，z-index: -1 配合 isolation）。
 *
 * 只用顶部一道细亮边 + 一小段弧形高光。
 * 千万别做成"横贯一半"的亮带 —— 那会把泡泡切成两半，
 * 反而没有一整片镜片的感觉。
 */
.card::before,
.quick::before {
  content: '';
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 1) 0, rgba(255, 255, 255, 0.9) 1.5px, rgba(255, 255, 255, 0) 4px),
    radial-gradient(120% 34% at 50% -6%, rgba(255, 255, 255, 0.95) 0%, rgba(255, 255, 255, 0.5) 40%, rgba(255, 255, 255, 0) 78%);
}

.card.plain {
  border-color: var(--line);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.9),
    0 10px 24px -8px rgba(74, 58, 40, 0.16);
}

.section-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--ink-2);
  margin: 20px 2px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title .muted {
  font-weight: 400;
  color: var(--ink-3);
  font-size: 13px;
}

.muted {
  color: var(--ink-3);
}

.small {
  font-size: 14px;
}

.tiny {
  font-size: 12.5px;
}

/* ------------------------------- 按钮 ------------------------------- */

.btn {
  min-height: 52px;
  padding: 0 20px;
  border-radius: var(--radius);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 17px;
  font-weight: 600;
  background: var(--surface-2);
  color: var(--ink);
  /* 松手时用带过冲的曲线弹回来 */
  transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.15s ease;
  width: 100%;
}

.btn:active {
  transform: scale(0.95);
  transition-duration: 0.09s;
  transition-timing-function: ease-out;
}

.btn[disabled] {
  opacity: 0.55;
  cursor: default;
  transform: none;
}

.btn-primary {
  background: var(--brand);
  color: #fff;
}

.btn-primary:active {
  background: var(--brand-press);
}

.btn-soft {
  background: var(--brand-soft);
  color: var(--brand);
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--line);
}

.btn-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.btn-sm {
  min-height: 40px;
  font-size: 15px;
  border-radius: 12px;
  width: auto;
  padding: 0 14px;
}

.btn-row {
  display: flex;
  gap: 10px;
}

.btn-row .btn {
  flex: 1;
}

/* ------------------------------- 表单 ------------------------------- */

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field > label {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
}

.field .hint {
  font-size: 13px;
  color: var(--ink-3);
}

input[type="text"],
input[type="tel"],
input[type="date"],
input[type="time"],
input[type="search"],
textarea,
select {
  width: 100%;
  min-height: var(--tap);
  padding: 12px 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
  font-size: 17px;
}

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.6;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.input-code {
  letter-spacing: 0.5em;
  text-align: center;
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.counter {
  text-align: right;
  font-size: 12.5px;
  color: var(--ink-3);
}

/* ------------------------------- 分段控件 ------------------------------- */

.segmented {
  display: flex;
  gap: 4px;
  padding: 4px;
  background: var(--surface-2);
  border-radius: 14px;
}

.segmented button {
  flex: 1;
  min-height: 40px;
  border-radius: 11px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-2);
}

.segmented button[aria-selected="true"] {
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(74, 58, 40, 0.12);
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  min-height: 40px;
  padding: 0 14px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--line);
  font-size: 15px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--ink-2);
}

.chip[aria-pressed="true"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  font-weight: 600;
}

.chip.pet[aria-pressed="true"] {
  background: var(--pet);
  border-color: var(--pet);
}

/* ------------------------------- 头像 ------------------------------- */

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  background: var(--surface-3);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--ink-2);
  overflow: hidden;
  flex: none;
}

.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar.sm {
  width: 32px;
  height: 32px;
  font-size: 13px;
}

.avatar.lg {
  width: 56px;
  height: 56px;
  font-size: 20px;
}

.avatar.pet {
  background: var(--pet-soft);
  color: var(--pet);
}

.avatar.dashed {
  border: 1.5px dashed var(--line);
  background: transparent;
  color: var(--ink-3);
}

/* ------------------------------- 快捷发布区 ------------------------------- */

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.quick {
  position: relative;
  isolation: isolate;
  min-height: 84px;
  border-radius: var(--radius);
  /* 和卡片一样的镜片感：中间薄、边上厚 */
  background: radial-gradient(
    112% 104% at 50% 50%,
    rgba(255, 255, 255, 0.18) 0%,
    rgba(255, 255, 255, 0.22) 44%,
    rgba(255, 255, 255, 0.74) 84%,
    rgba(255, 255, 255, 0.96) 100%
  );
  -webkit-backdrop-filter: blur(10px) saturate(170%);
  backdrop-filter: blur(10px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.92);
  box-shadow:
    inset 0 0 0 1.5px rgba(255, 255, 255, 0.95),
    inset 0 0 11px 1px rgba(255, 255, 255, 0.65),
    inset 0 1px 1px rgba(255, 255, 255, 1),
    inset 0 -8px 14px -10px rgba(74, 58, 40, 0.22),
    0 2px 4px rgba(74, 58, 40, 0.06),
    0 12px 24px -8px rgba(74, 58, 40, 0.24);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-2);
  padding: 8px 4px;
  /* 按下去像 iOS 的按钮：快速压扁，松手弹回来（回弹用带过冲的曲线） */
  transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.quick:active {
  transform: scale(0.94);
  transition-duration: 0.1s;
  transition-timing-function: ease-out;
}

.quick .emoji {
  font-size: 26px;
  line-height: 1;
}

.quick.pet {
  color: var(--pet);
}

/* ------------------------------- 动态卡片 ------------------------------- */

.post-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.post-who {
  min-width: 0;
  flex: 1;
}

.post-name {
  font-weight: 650;
  font-size: 16px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.post-meta {
  font-size: 13px;
  color: var(--ink-3);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 22px;
  padding: 0 8px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 12.5px;
  font-weight: 600;
}

.tag.pet {
  background: var(--pet-soft);
  color: var(--pet);
}

.tag.brand {
  background: var(--brand-soft);
  color: var(--brand);
}

.dot-new {
  width: 8px;
  height: 8px;
  border-radius: 4px;
  background: var(--brand);
  flex: none;
}

.post-body {
  font-size: 17px;
  white-space: pre-wrap;
  word-break: break-word;
  margin: 4px 0 0;
}

.post-body.clamp {
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.media-grid {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  border-radius: var(--radius);
  overflow: hidden;
}

.media-grid[data-count="1"] {
  grid-template-columns: 1fr;
}

.media-grid[data-count="2"] {
  grid-template-columns: 1fr 1fr;
}

.media-grid[data-count="3"],
.media-grid[data-count="4"] {
  grid-template-columns: 1fr 1fr;
}

.media-grid[data-count="5"],
.media-grid[data-count="6"],
.media-grid[data-count="7"],
.media-grid[data-count="8"],
.media-grid[data-count="9"] {
  grid-template-columns: repeat(3, 1fr);
}

.media-cell {
  position: relative;
  background: var(--surface-2);
  aspect-ratio: 1;
  overflow: hidden;
}

.media-grid[data-count="1"] .media-cell {
  aspect-ratio: auto;
  max-height: 460px;
}

.media-cell img,
.media-cell video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-grid[data-count="1"] .media-cell img,
.media-grid[data-count="1"] .media-cell video {
  height: auto;
  max-height: 460px;
  object-fit: contain;
  background: #efe9df;
}

.media-cell .play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  background: linear-gradient(180deg, rgba(0, 0, 0, 0) 40%, rgba(0, 0, 0, 0.28));
}

.media-cell .play span {
  width: 54px;
  height: 54px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.92);
  display: grid;
  place-items: center;
  color: var(--ink);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.media-cell .duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(30, 26, 22, 0.72);
  color: #fff;
  font-size: 12px;
  padding: 2px 7px;
  border-radius: 8px;
  font-variant-numeric: tabular-nums;
}

.media-cell .state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 13px;
  text-align: center;
  padding: 8px;
}

.post-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 44px;
  padding: 0 12px;
  border-radius: 12px;
  color: var(--ink-2);
  font-size: 14.5px;
  transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.action:active {
  transform: scale(0.9);
  transition-duration: 0.09s;
  transition-timing-function: ease-out;
}

.action:active {
  background: var(--surface-2);
}

.action[aria-pressed="true"] {
  color: var(--brand);
  font-weight: 600;
}

.action.pet[aria-pressed="true"] {
  color: var(--pet);
}

.action.mine {
  color: var(--brand);
}

.reaction-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin-top: 8px;
}

.reaction-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  height: 30px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-2);
  font-size: 13.5px;
  color: var(--ink-2);
}

.reaction-pill.mine {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 600;
}

.comment-preview {
  margin-top: 8px;
  background: var(--surface-2);
  border-radius: 12px;
  padding: 8px 12px;
  font-size: 15px;
  color: var(--ink-2);
}

/* ------------------------------- 人物条 ------------------------------- */

.people {
  display: flex;
  gap: 10px;
}

.person {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 10px 12px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.person .who {
  min-width: 0;
}

.person .name {
  font-weight: 650;
  font-size: 15px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.person .where {
  font-size: 12.5px;
  color: var(--ink-3);
}

/* ------------------------------- 今日概览 ------------------------------- */

.overview {
  display: flex;
  gap: 10px;
  font-size: 15px;
  color: var(--ink-2);
  align-items: center;
  flex-wrap: wrap;
}

.overview b {
  color: var(--ink);
}

/* ------------------------------- 底部导航 ------------------------------- */

.tabbar {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 30;
  max-width: 560px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2px;
  padding: 6px 8px calc(6px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  border-top: 1px solid var(--line);
  /* 往下看内容时滑走，手指往回划时滑回来 */
  transition: transform 0.3s cubic-bezier(0.32, 0.72, 0, 1);
}

body.is-browsing .tabbar {
  transform: translateY(105%);
}

.tab {
  min-height: 54px;
  border-radius: 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 12px;
  color: var(--ink-3);
  position: relative;
}

.tab[aria-current="page"] {
  color: var(--brand);
  font-weight: 700;
}

.tab .badge {
  position: absolute;
  top: 4px;
  left: 50%;
  margin-left: 6px;
  min-width: 17px;
  height: 17px;
  padding: 0 4px;
  border-radius: 9px;
  background: var(--brand);
  color: #fff;
  font-size: 11px;
  line-height: 17px;
  font-weight: 700;
}

.fab {
  position: fixed;
  right: max(var(--pad), calc(50vw - 280px + var(--pad)));
  bottom: calc(78px + env(safe-area-inset-bottom));
  z-index: 31;
  height: 56px;
  padding: 0 20px 0 16px;
  border-radius: 999px;
  background: var(--brand);
  color: #fff;
  font-size: 16px;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--shadow-lift);
  transition:
    transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1),
    bottom 0.3s cubic-bezier(0.32, 0.72, 0, 1),
    background 0.15s ease;
}

/* 底部导航收起后，发布按钮跟着往下挪，不留空档 */
body.is-browsing .fab {
  bottom: calc(18px + env(safe-area-inset-bottom));
}

.fab:active {
  background: var(--brand-press);
  transform: scale(0.94);
  transition-duration: 0.09s;
  transition-timing-function: ease-out;
}

.fab.pet {
  background: var(--pet);
}

/*
 * 分享按钮：一枚立体的大蝴蝶结，底下不放圆盘。
 * 用两层 drop-shadow 造出厚度和落影 —— 看起来是浮在屏幕上的一枚蝴蝶结。
 * 蝴蝶结上方挂一个"上传/分享"的小标，让人知道它是干嘛的。
 */
.fab.bow {
  position: fixed;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0;
  width: auto;
  height: auto;
  padding: 4px 8px;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.fab.bow:active {
  background: none;
  transform: scale(0.9);
}

.fab .fab-bow {
  display: block;
  font-size: 46px;
  line-height: 1;
  /* 两层投影：贴身的硬边 + 往下散开的软影，立体感就出来了 */
  filter:
    drop-shadow(0 1px 0.5px rgba(150, 30, 80, 0.35))
    drop-shadow(0 8px 10px rgba(150, 30, 80, 0.38));
}

/*
 * "上传/分享"的小箭头不是单独挂一块，而是印在蝴蝶结中间的结上 ——
 * 整个按钮只有一个主体：蝴蝶结本身。
 */
.fab .fab-share {
  position: absolute;
  left: 50%;
  top: 45%;
  transform: translate(-50%, -50%);
  display: block;
  color: #fff;
  pointer-events: none;
  /* 白箭头压在粉色结上，加一点描边一样的外发光，边界更清楚 */
  filter: drop-shadow(0 0 1px rgba(150, 30, 80, 0.75)) drop-shadow(0 1px 1px rgba(150, 30, 80, 0.4));
}

/* ------------------------------- 空状态 ------------------------------- */

.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-3);
}

.empty .emoji {
  font-size: 42px;
  margin-bottom: 8px;
}

.empty h3 {
  font-size: 17px;
  color: var(--ink-2);
  margin: 0 0 6px;
  font-weight: 650;
}

.empty p {
  margin: 0 0 16px;
  font-size: 15px;
}

/* ------------------------------- 日历 ------------------------------- */

.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}

.month-nav .label {
  font-size: 18px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.calendar {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.calendar .wd {
  text-align: center;
  font-size: 12px;
  color: var(--ink-3);
  padding: 4px 0;
}

.day {
  aspect-ratio: 1;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  font-size: 15px;
  color: var(--ink-2);
  position: relative;
  font-variant-numeric: tabular-nums;
}

.day.blank {
  visibility: hidden;
}

.day.has-record {
  background: var(--brand-soft);
  color: var(--brand);
  font-weight: 650;
}

.day.has-record.pet-only {
  background: var(--pet-soft);
  color: var(--pet);
}

.day.today {
  outline: 2px solid var(--brand);
  outline-offset: -2px;
}

.day[aria-pressed="true"] {
  background: var(--brand);
  color: #fff;
}

.day .mark {
  width: 5px;
  height: 5px;
  border-radius: 3px;
  background: currentColor;
  opacity: 0.7;
}

.day .mark.pet {
  background: var(--pet);
}

.calendar-legend {
  display: flex;
  gap: 14px;
  font-size: 12.5px;
  color: var(--ink-3);
  margin-top: 10px;
  flex-wrap: wrap;
}

.calendar-legend i {
  width: 8px;
  height: 8px;
  border-radius: 3px;
  display: inline-block;
  margin-right: 5px;
}

/* ------------------------------- 珠珠页 ------------------------------- */

.pet-hero {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(160deg, var(--pet-soft), var(--surface));
  border-radius: var(--radius-lg);
  padding: 16px;
  box-shadow: var(--shadow);
}

.pet-hero h2 {
  margin: 0;
  font-size: 22px;
}

.pet-hero p {
  margin: 2px 0 0;
  font-size: 14px;
  color: var(--ink-2);
}

.hint-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--brand-soft);
  color: var(--brand);
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 15px;
  font-weight: 600;
  text-align: left;
  width: 100%;
}

.hint-banner.pet {
  background: var(--pet-soft);
  color: var(--pet);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
}

.photo-grid button {
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-2);
  position: relative;
}

.photo-grid img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.photo-grid .play {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: rgba(0, 0, 0, 0.18);
}

/* ------------------------------- 全屏查看 ------------------------------- */

.viewer {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: #17140f;
  display: flex;
  flex-direction: column;
  animation: fade-in 0.18s ease;
}

.viewer-top {
  padding: max(env(safe-area-inset-top), 12px) 12px 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #f2ece2;
}

.viewer-top .close {
  width: var(--tap);
  height: var(--tap);
  display: grid;
  place-items: center;
  color: #f2ece2;
}

.viewer-stage {
  flex: 1;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
}

.viewer-stage > * {
  flex: 0 0 100%;
  scroll-snap-align: center;
  display: grid;
  place-items: center;
  padding: 0 8px;
}

.viewer-stage img,
.viewer-stage video {
  max-height: 100%;
  max-width: 100%;
  object-fit: contain;
  border-radius: 8px;
}

.viewer-bottom {
  padding: 10px 16px calc(16px + env(safe-area-inset-bottom));
  color: #ded6c9;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
}

.viewer-bottom .spacer {
  flex: 1;
}

.viewer-btn {
  min-height: 44px;
  padding: 0 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.12);
  color: #f2ece2;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 14px;
}

/* ------------------------------- 发布页 ------------------------------- */

.picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.picker-tile {
  aspect-ratio: 1;
  border-radius: var(--radius);
  border: 1.5px dashed var(--line);
  background: var(--surface);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  color: var(--ink-2);
  font-size: 13px;
  font-weight: 600;
  padding: 6px;
  text-align: center;
}

.picker-tile .emoji {
  font-size: 24px;
}

.thumb {
  position: relative;
  aspect-ratio: 1;
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface-2);
}

.thumb img,
.thumb video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb .remove {
  position: absolute;
  top: 5px;
  right: 5px;
  width: 30px;
  height: 30px;
  border-radius: 999px;
  background: rgba(24, 20, 16, 0.62);
  color: #fff;
  display: grid;
  place-items: center;
}

.thumb .status {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 5px 7px;
  font-size: 12px;
  color: #fff;
  background: rgba(24, 20, 16, 0.66);
  text-align: center;
}

.thumb .status.ok {
  background: rgba(63, 125, 78, 0.9);
}

.thumb .status.fail {
  background: rgba(168, 58, 44, 0.92);
}

.thumb .bar {
  position: absolute;
  left: 0;
  bottom: 0;
  height: 3px;
  background: var(--brand);
  transition: width 0.2s ease;
}

.thumb .state {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--surface-2);
  color: var(--ink-3);
  font-size: 12.5px;
  text-align: center;
  padding: 6px;
}

.thumb .duration {
  position: absolute;
  left: 6px;
  bottom: 6px;
  background: rgba(30, 26, 22, 0.72);
  color: #fff;
  font-size: 11.5px;
  padding: 1px 6px;
  border-radius: 7px;
  font-variant-numeric: tabular-nums;
}

.sticky-actions {
  position: sticky;
  bottom: 0;
  padding: 12px var(--pad) calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(180deg, rgba(251, 247, 241, 0), var(--bg) 32%);
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 0 calc(var(--pad) * -1);
}

/* ------------------------------- 详情页评论 ------------------------------- */

.comment {
  display: flex;
  gap: 10px;
  padding: 8px 0;
}

/* 回复缩进一层，左侧一条细线表示从属关系 */
.comment.is-reply {
  margin-left: 22px;
  padding-left: 10px;
  border-left: 2px solid var(--line);
}

.comment.is-reply .bubble {
  background: var(--surface-2);
}

.reply-to {
  margin-left: 6px;
  color: var(--ink-3);
  font-size: 12.5px;
}

/* "回复"按钮平时很淡，不抢留言本身的注意力 */
.reply-btn {
  align-self: flex-start;
  min-height: 32px;
  padding: 0 8px;
  margin-top: 4px;
  border-radius: 8px;
  color: var(--ink-3);
  font-size: 13px;
  flex: 0 0 auto;
  transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.reply-btn:active {
  color: var(--brand);
  transform: scale(0.9);
  transition-duration: 0.09s;
  transition-timing-function: ease-out;
}

/* 正在回复谁 —— 输入框上方的提示条 */
.reply-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  background: var(--brand-soft);
  color: var(--brand-press);
  font-size: 14px;
}

/* ---------------------------- 一键关心 ---------------------------- */

/* ---------------------------- 底部的小狗 ---------------------------- */

/*
 * 趴在底部的小狗，轻轻摆头。
 * 把旋转轴放在下巴附近（85%），摆起来才像"抬头低头"，而不是整块图片在转。
 */
.dog-mascot {
  position: fixed;
  left: 8px;
  /* 下巴紧贴底部导航的上沿 */
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  z-index: 25;
  pointer-events: none;
  font-size: 68px;
  line-height: 1;
  transition: opacity 0.3s ease;
}

.dog-head {
  display: block;
  transform-origin: 50% 85%;
  animation: dog-sway 3.6s ease-in-out infinite;
  /* 一圈浅色外发光：压在照片或文字上时边界也清楚 */
  filter: drop-shadow(0 0 2px rgba(255, 255, 255, 0.95)) drop-shadow(0 2px 3px rgba(74, 58, 40, 0.3));
}

@keyframes dog-sway {
  0%,
  100% {
    transform: rotate(-7deg) translateY(0);
  }
  50% {
    transform: rotate(7deg) translateY(-2px);
  }
}

/* 沉浸浏览时跟着底部导航一起淡出，免得孤零零挂在半空 */
body.is-browsing .dog-mascot {
  opacity: 0;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: var(--tap);
  padding: 0 14px;
  border-radius: 999px;
  background:
    radial-gradient(120% 90% at 50% -30%, rgba(255, 255, 255, 1), rgba(255, 255, 255, 0) 70%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.66), rgba(255, 255, 255, 0.44));
  -webkit-backdrop-filter: blur(10px) saturate(170%);
  backdrop-filter: blur(10px) saturate(170%);
  border: 1px solid rgba(255, 255, 255, 0.9);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.95),
    0 2px 6px rgba(74, 58, 40, 0.08);
  color: var(--ink);
  font-size: 14.5px;
  font-weight: 600;
  transition: transform 0.42s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.chip .emoji {
  font-size: 17px;
  line-height: 1;
}

.chip:active {
  transform: scale(0.94);
  transition-duration: 0.09s;
  transition-timing-function: ease-out;
}

.chip.is-cooling,
.chip[disabled] {
  opacity: 0.5;
  font-weight: 500;
}

.comment .bubble {
  background: var(--surface);
  border-radius: 14px;
  padding: 8px 12px;
  flex: 1;
  min-width: 0;
}

.comment .who {
  font-size: 13px;
  color: var(--ink-3);
  margin-bottom: 2px;
}

.comment .text {
  font-size: 16px;
  white-space: pre-wrap;
  word-break: break-word;
}

.comment-bar {
  position: sticky;
  bottom: 0;
  display: flex;
  gap: 8px;
  align-items: flex-end;
  padding: 10px var(--pad) calc(10px + env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--bg) 92%, transparent);
  backdrop-filter: blur(12px);
  border-top: 1px solid var(--line);
  margin: 0 calc(var(--pad) * -1);
}

.comment-bar textarea {
  min-height: 48px;
  max-height: 140px;
  border-radius: 24px;
  padding: 12px 16px;
}

.comment-bar .btn {
  width: auto;
  min-width: 84px;
}

/* ------------------------------- 列表行 ------------------------------- */

.rows {
  background: var(--surface);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  min-height: 56px;
  width: 100%;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.row:last-child {
  border-bottom: 0;
}

.row .grow {
  flex: 1;
  min-width: 0;
}

.row .title {
  font-weight: 600;
  font-size: 16px;
}

.row .sub {
  font-size: 13.5px;
  color: var(--ink-3);
  margin-top: 2px;
  word-break: break-word;
}

.row .chev {
  color: var(--ink-3);
  flex: none;
}

/* ------------------------------- 开关 ------------------------------- */

.switch {
  width: 52px;
  height: 32px;
  border-radius: 999px;
  background: var(--surface-3);
  position: relative;
  flex: none;
  transition: background 0.18s ease;
}

.switch::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 26px;
  height: 26px;
  border-radius: 999px;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: transform 0.18s ease;
}

.switch[aria-checked="true"] {
  background: var(--brand);
}

.switch[aria-checked="true"]::after {
  transform: translateX(20px);
}

/* ------------------------------- 弹层 ------------------------------- */

.toast-host {
  position: fixed;
  left: 0;
  right: 0;
  bottom: calc(96px + env(safe-area-inset-bottom));
  z-index: 80;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  pointer-events: none;
  padding: 0 20px;
}

.toast {
  background: rgba(38, 32, 26, 0.94);
  color: #fdf9f3;
  padding: 12px 18px;
  border-radius: 14px;
  font-size: 15px;
  max-width: 420px;
  box-shadow: var(--shadow-lift);
  animation: toast-in 0.2s ease;
  text-align: center;
}

.toast.ok {
  background: rgba(63, 125, 78, 0.95);
}

.toast.fail {
  background: rgba(168, 58, 44, 0.95);
}

.sheet-host,
.overlay-host {
  position: fixed;
  inset: 0;
  z-index: 70;
  background: rgba(30, 24, 18, 0.42);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: fade-in 0.15s ease;
}

.sheet {
  width: 100%;
  max-width: 560px;
  background: var(--bg);
  border-radius: 22px 22px 0 0;
  padding: 8px 16px calc(20px + env(safe-area-inset-bottom));
  max-height: 86dvh;
  overflow-y: auto;
  animation: sheet-in 0.22s cubic-bezier(0.2, 0.9, 0.3, 1);
}

.sheet-grip {
  width: 40px;
  height: 5px;
  border-radius: 3px;
  background: var(--surface-3);
  margin: 6px auto 12px;
}

.sheet h3 {
  margin: 4px 0 12px;
  font-size: 18px;
}

.sheet-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.overlay-host {
  align-items: center;
  padding: 24px;
}

.dialog {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border-radius: 20px;
  padding: 20px;
  box-shadow: var(--shadow-lift);
  animation: dialog-in 0.18s ease;
}

.dialog h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.dialog p {
  margin: 0 0 16px;
  color: var(--ink-2);
  font-size: 15px;
}

.dialog .preview {
  display: flex;
  gap: 8px;
  margin-bottom: 14px;
  overflow: hidden;
}

.dialog .preview img {
  width: 72px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
}

/* ------------------------------- 引导页 ------------------------------- */

.welcome {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 40px 24px calc(32px + env(safe-area-inset-bottom));
  text-align: center;
  gap: 18px;
}

.welcome .cities {
  font-size: 15px;
  color: var(--ink-3);
  letter-spacing: 0.32em;
}

.welcome h1 {
  font-size: 34px;
  margin: 0;
  letter-spacing: 4px;
}

.welcome p {
  margin: 0;
  color: var(--ink-2);
}

.welcome .cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
  margin-top: 8px;
}

.welcome .feature {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.welcome .feature .emoji {
  font-size: 22px;
}

.welcome .feature b {
  display: block;
  font-size: 15.5px;
}

.welcome .feature span {
  font-size: 13.5px;
  color: var(--ink-3);
}

.brand-mark {
  width: 88px;
  height: 88px;
  margin: 0 auto;
  border-radius: 26px;
  background: linear-gradient(150deg, var(--brand-soft), var(--pet-soft));
  display: grid;
  place-items: center;
  font-size: 40px;
  box-shadow: var(--shadow);
}

/* ------------------------------- 提示条 ------------------------------- */

.notice {
  border-radius: var(--radius);
  padding: 12px 14px;
  font-size: 14.5px;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  line-height: 1.5;
}

.notice.warn {
  background: #fdf3e0;
  color: #8a6216;
}

.notice.info {
  background: var(--brand-soft);
  color: var(--brand);
}

.notice.ok {
  background: #e9f3ea;
  color: var(--ok);
}

.notice.danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.notice.plain {
  background: var(--surface-2);
  color: var(--ink-2);
}

/* ------------------------------- 其他 ------------------------------- */

.skeleton {
  background: linear-gradient(90deg, var(--surface-2) 25%, var(--surface-3) 50%, var(--surface-2) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.4s infinite;
  border-radius: var(--radius);
  height: 96px;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2.5px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 999px;
  animation: spin 0.7s linear infinite;
}

.spinner.dark {
  border-color: var(--line);
  border-top-color: var(--brand);
}

.center {
  display: grid;
  place-items: center;
  padding: 36px;
}

.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;
}

.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}

.stat .n {
  font-size: 24px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.stat .k {
  font-size: 13px;
  color: var(--ink-3);
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

@keyframes fade-in {
  from {
    opacity: 0;
  }
}

@keyframes sheet-in {
  from {
    transform: translateY(24px);
    opacity: 0.6;
  }
}

@keyframes dialog-in {
  from {
    transform: scale(0.96);
    opacity: 0.6;
  }
}

@keyframes toast-in {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
}

@media (min-width: 620px) {
  .app {
    box-shadow: 0 0 0 1px var(--line);
  }
}

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

/* ------------------------ 背景与配色（个性设置） ------------------------ */

.swatches {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.swatch {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: var(--tap);
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.swatch.is-active {
  border-color: var(--brand);
  box-shadow: inset 0 0 0 1px var(--brand);
}

.swatch-dot {
  display: block;
  width: 20px;
  height: 20px;
  border-radius: 50%;
}

.swatch-name {
  font-size: 15px;
}

.preview {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 150px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background-color: var(--bg);
  background-size: cover;
  background-position: center;
}

.field input[type='range'] {
  width: 100%;
  height: 40px;
}
