/* =========================================================
   萌宠社群 PetCommunity · 设计系统（Soft Spatial 粉嫩版）
   ========================================================= */
:root {
  --bg: #FBF0F4;          /* 页面底 */
  --panel: #FCEEF1;       /* 浅粉面板 */
  --panel-2: #F6E6EC;     /* 更浅粉 */
  --border: #F2DBE6;      /* 粉色描边 */
  --accent: #E0709A;      /* 深玫粉（实心按钮/激活态） */
  --accent-soft: #E89BB0; /* 玫粉强调 */
  --accent-ink: #C98AA6;  /* 次强调 */
  --ink: #2A1F14;         /* 正文暖棕 */
  --ink-2: #6B5E54;       /* 次级文字 */
  --ink-3: #8A7B6E;       /* 辅助文字 */
  --muted: #B0A0A8;       /* 占位/弱化 */
  --white: #FFFFFF;
  --radius-lg: 20px;
  --radius-md: 16px;
  --radius-sm: 12px;
  --shadow: 0 8px 24px rgba(224, 112, 154, 0.10);
  --shadow-soft: 0 4px 14px rgba(42, 31, 20, 0.06);
  --sidebar-w: 240px;
  --font-sans: "Noto Sans SC", system-ui, -apple-system, "PingFang SC", sans-serif;
  --font-serif: "Noto Serif SC", serif;
  --font-en: "Outfit", sans-serif;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: var(--font-sans);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
  line-height: 1.5;
}

a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }
img { display: block; max-width: 100%; }

/* ---------------- 布局 ---------------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
  width: var(--sidebar-w);
  flex: 0 0 var(--sidebar-w);
  background: var(--white);
  border-right: 1px solid var(--border);
  padding: 28px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand { padding: 4px 12px 18px; }
.brand-name { font-size: 20px; font-weight: 600; color: var(--accent); }
.brand-sub { font-family: var(--font-en); font-size: 12px; color: var(--muted); letter-spacing: .5px; }

.nav { display: flex; flex-direction: column; gap: 4px; }
.nav-item {
  display: flex; align-items: center; gap: 14px;
  padding: 11px 14px; border-radius: 10px;
  color: var(--ink-2); font-size: 15px;
  transition: background .18s, color .18s;
}
.nav-item .dot { width: 10px; height: 10px; border-radius: 50%; background: #C9B6BF; flex: 0 0 10px; transition: background .18s; }
.nav-item:hover { background: var(--panel); }
.nav-item.active { background: var(--panel); color: var(--accent); font-weight: 500; }
.nav-item.active .dot { background: var(--accent); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar { padding: 34px 52px 6px; }
.topbar h1 { font-size: 28px; font-weight: 600; color: var(--ink); }
.topbar p { font-size: 14px; color: var(--ink-3); margin-top: 6px; }

.view { padding: 18px 52px 60px; }

/* ---------------- 通用卡片/按钮/标签 ---------------- */
.card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 500;
  border-radius: 19px; padding: 0 22px; height: 38px;
  transition: filter .15s, transform .1s;
}
.btn:hover { filter: brightness(1.04); }
.btn:active { transform: translateY(1px); }
.btn-ghost {
  background: #fff; color: var(--ink-2);
  border: 1px solid var(--border);
}
.chip {
  display: inline-flex; align-items: center; justify-content: center;
  height: 30px; padding: 0 14px; border-radius: 15px;
  font-size: 13px; background: var(--panel); color: var(--ink-2);
}
.chip-accent { background: var(--panel); color: var(--accent); font-weight: 500; }
.tag {
  display: inline-flex; align-items: center; justify-content: center;
  height: 28px; padding: 0 14px; border-radius: 14px;
  font-size: 13px; background: var(--panel); color: var(--accent);
}
.link { color: var(--accent); font-weight: 500; }

/* ---------------- 广场 ---------------- */
.square-layout { display: grid; grid-template-columns: 1fr 320px; gap: 24px; align-items: start; }
.feed { display: flex; flex-direction: column; gap: 18px; }
.post {
  background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 18px 20px; box-shadow: var(--shadow-soft);
}
.post-head { display: flex; align-items: center; gap: 12px; }
.avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--panel); object-fit: cover; flex: 0 0 44px;
}
.avatar.pink { display: flex; align-items: center; justify-content: center; font-size: 20px; }
/* 插画头像：不使用真实照片，纯 SVG 猫脸 + 粉色渐变底 */
.cat-avatar {
  display: flex; align-items: center; justify-content: center;
  background: radial-gradient(circle at 30% 25%, #FCEEF1, #F2DBE6);
  overflow: hidden;
}
.cat-svg { width: 92%; height: 92%; display: block; }
.post-name { font-weight: 500; font-size: 15px; }
.post-meta { font-size: 12px; color: var(--ink-3); }
.post-body { margin: 12px 0; font-size: 14px; color: var(--ink); line-height: 1.7; }
.post-tags { display: flex; gap: 8px; margin-bottom: 12px; }
.post-imgs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.post-imgs .ph { aspect-ratio: 1/1; border-radius: 12px; background: var(--panel); }
.post-foot { display: flex; gap: 18px; color: var(--ink-3); font-size: 13px; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.post-foot span { display: inline-flex; align-items: center; gap: 6px; }

.aside-panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px; box-shadow: var(--shadow-soft); }
.aside-title { font-size: 16px; font-weight: 600; margin-bottom: 14px; }
.breed-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.breed-row:first-of-type { border-top: none; }
.breed-row .avatar { width: 36px; height: 36px; flex: 0 0 36px; }
.breed-info { flex: 1; min-width: 0; }
.breed-info .n { font-weight: 500; font-size: 14px; }
.breed-info .m { font-size: 12px; color: var(--ink-3); }

/* ---------------- 附近配种 ---------------- */
.filters { display: flex; gap: 10px; margin: 14px 0 22px; flex-wrap: wrap; }
.filters .chip { cursor: pointer; user-select: none; }
.filters .chip.on { background: var(--accent); color: #fff; }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 18px; }
.pet-card { display: flex; align-items: center; gap: 16px; padding: 18px; }
.pet-card .avatar { width: 64px; height: 64px; flex: 0 0 64px; }
.pet-card .pc-name { font-size: 16px; font-weight: 500; }
.pet-card .pc-meta { font-size: 13px; color: var(--ink-3); margin: 2px 0 8px; }
.dist { display: inline-flex; align-items: center; justify-content: center; height: 28px; padding: 0 12px; border-radius: 14px; background: var(--panel); color: var(--accent); font-size: 13px; }
.pet-card .spacer { flex: 1; }

/* ---------------- 我的毛孩子 ---------------- */
.hero-row { display: flex; gap: 18px; align-items: stretch; }
.hero {
  flex: 1; display: flex; align-items: center; gap: 28px;
  padding: 26px; background: var(--white); border: 1px solid var(--border);
  border-radius: var(--radius-md); box-shadow: var(--shadow-soft);
}
.hero .avatar-lg { width: 140px; height: 140px; border-radius: 50%; object-fit: cover; flex: 0 0 140px; background: var(--panel); }
.hero .h-name { font-size: 26px; font-weight: 600; }
.hero .h-breed { font-size: 15px; color: var(--ink-3); margin: 4px 0 14px; }
.hero .h-chips { display: flex; gap: 10px; flex-wrap: wrap; }
.add-card {
  width: 300px; flex: 0 0 300px; border: 1.5px dashed var(--accent);
  border-radius: var(--radius-md); display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 8px; color: var(--accent);
  background: var(--white);
}
.add-card .plus { font-size: 30px; }
.add-card .sub { font-size: 13px; color: var(--ink-3); }

.sec-title { font-size: 18px; font-weight: 600; margin: 30px 0 12px; }
.stat-row { display: grid; grid-template-columns: 420px 1fr; gap: 18px; }
.stat-card { background: var(--panel); border-radius: var(--radius-md); padding: 20px; }
.stat-card .st-t { font-size: 14px; color: var(--ink-2); }
.stat-card .st-v { font-size: 20px; font-weight: 500; margin: 4px 0 14px; }
.stat-card .st-v.warn { color: var(--accent); }
.bar { height: 8px; background: #fff; border-radius: 4px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--accent); border-radius: 4px; }

.record { display: flex; align-items: center; gap: 16px; padding: 16px 18px; margin-bottom: 12px; background: var(--white); border: 1px solid var(--border); border-radius: 12px; }
.record .r-text { flex: 1; font-size: 14px; }

/* ---------------- 发布动态 ---------------- */
.post-layout { display: grid; grid-template-columns: 1fr 280px; gap: 24px; align-items: start; }
.compose { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 24px; }
.compose .area { background: var(--panel); border-radius: 12px; padding: 14px 16px; min-height: 110px; color: var(--muted); font-size: 14px; }
.slots { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin: 18px 0 10px; }
.slot { aspect-ratio: 200/110; border: 1px solid var(--border); border-radius: 12px; background: var(--panel); display: flex; align-items: center; justify-content: center; color: var(--accent); font-size: 14px; cursor: pointer; }
.note { color: var(--accent); font-size: 13px; margin: 4px 0 16px; }
.topic-title { font-size: 14px; font-weight: 500; color: var(--ink-2); margin-bottom: 10px; }
.topics { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 22px; }
.topics .chip { cursor: pointer; }
.topics .chip.on { background: var(--accent); color: #fff; }
.compose .btn { float: right; }
.tips { background: var(--panel); border-radius: var(--radius-md); padding: 22px; }
.tips h3 { color: var(--accent); font-size: 16px; margin-bottom: 14px; }
.tips li { list-style: none; font-size: 13px; color: var(--ink-2); margin-bottom: 16px; line-height: 1.6; }
.tips li b { color: var(--ink); }

/* ---------------- 消息 ---------------- */
.msg-layout { display: grid; grid-template-columns: 380px 1fr; gap: 0; height: calc(100vh - 140px); }
.msg-list { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md) 0 0 var(--radius-md); padding: 18px; overflow: auto; }
.msg-list h3 { font-size: 16px; margin-bottom: 12px; }
.conv { display: flex; align-items: center; gap: 12px; padding: 12px; border-radius: 12px; cursor: pointer; }
.conv:hover { background: var(--panel); }
.conv.on { background: var(--panel); }
.conv .avatar { width: 32px; height: 32px; flex: 0 0 32px; }
.conv .c-name { font-size: 14px; font-weight: 500; }
.conv .c-msg { font-size: 12px; color: var(--ink-3); }
.conv .c-time { font-size: 11px; color: var(--muted); margin-left: auto; }
.conv .badge { background: var(--accent); color: #fff; font-size: 12px; border-radius: 11px; min-width: 22px; height: 22px; display: inline-flex; align-items: center; justify-content: center; padding: 0 6px; }
.chat { background: var(--white); border: 1px solid var(--border); border-left: none; border-radius: 0 var(--radius-md) var(--radius-md) 0; display: flex; flex-direction: column; }
.chat-head { padding: 18px 24px; border-bottom: 1px solid var(--border); }
.chat-head .ch-title { font-size: 16px; font-weight: 500; }
.chat-head .ch-sub { font-size: 12px; color: var(--ink-3); }
.chat-body { flex: 1; overflow: auto; padding: 24px; display: flex; flex-direction: column; gap: 18px; }
.bubble { max-width: 70%; padding: 14px 18px; border-radius: 14px; font-size: 14px; line-height: 1.5; }
.bubble.in { background: var(--panel); color: var(--ink); align-self: flex-start; }
.bubble.me { background: var(--accent); color: #fff; align-self: flex-end; }
.chat-input { display: flex; gap: 12px; padding: 16px 24px; border-top: 1px solid var(--border); }
.chat-input input { flex: 1; height: 48px; border-radius: 24px; border: none; background: var(--panel); padding: 0 18px; font-size: 14px; color: var(--ink); outline: none; }

/* ---------------- 设置 ---------------- */
.set-group { font-size: 13px; font-weight: 500; color: var(--ink-3); margin: 22px 0 8px; }
.set-row { display: flex; align-items: center; gap: 16px; padding: 16px 18px; margin-bottom: 12px; background: var(--white); border: 1px solid var(--border); border-radius: 12px; }
.set-row .r-text { flex: 1; font-size: 15px; }
.arrow { color: var(--muted); font-size: 18px; }
.toggle { width: 46px; height: 26px; border-radius: 13px; background: var(--accent); position: relative; flex: 0 0 46px; }
.toggle i { position: absolute; top: 3px; right: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; }
.set-row.danger .r-text { color: var(--accent); font-weight: 500; }

/* ---------------- 宠物商城 ---------------- */
.banner { background: var(--panel); border-radius: var(--radius-md); padding: 28px 32px; display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; }
.banner h2 { font-size: 18px; font-weight: 600; }
.banner p { font-size: 13px; color: var(--ink-3); margin-top: 4px; }
.cats { display: flex; gap: 10px; margin-bottom: 22px; flex-wrap: wrap; }
.cats .chip { cursor: pointer; }
.cats .chip.on { background: var(--accent); color: #fff; }
.product-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; }
.product { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 16px; box-shadow: var(--shadow-soft); }
.product .ph { aspect-ratio: 288/140; border-radius: 12px; background: var(--panel); margin-bottom: 14px; display:flex; align-items:center; justify-content:center; font-size: 30px; }
.product .p-name { font-size: 15px; font-weight: 500; }
.product .p-foot { display: flex; align-items: center; margin-top: 10px; }
.product .price { color: var(--accent); font-size: 18px; font-weight: 500; }
.product .seller { font-size: 12px; color: var(--ink-3); margin-left: 10px; }
.product .btn { height: 36px; padding: 0 14px; font-size: 12px; margin-left: auto; }

/* ---------------- 附近探索 ---------------- */
.explore-layout { display: grid; grid-template-columns: 1fr 340px; gap: 24px; align-items: start; }
.locbar { display: inline-flex; align-items: center; gap: 8px; background: var(--white); border: 1px solid var(--border); border-radius: 19px; padding: 8px 16px; font-size: 14px; margin-bottom: 16px; color: var(--ink-2); }
.merchant { display: flex; gap: 16px; padding: 16px; margin-bottom: 12px; }
.merchant .m-logo { width: 64px; height: 64px; border-radius: 14px; background: var(--panel); flex: 0 0 64px; display:flex; align-items:center; justify-content:center; font-size: 26px; }
.merchant .m-body { flex: 1; min-width: 0; }
.merchant .m-name { font-size: 16px; font-weight: 500; }
.merchant .m-meta { font-size: 13px; color: var(--ink-3); margin: 4px 0; display: flex; gap: 14px; flex-wrap: wrap; }
.merchant .m-meta .star { color: var(--accent); }
.merchant .m-actions { display: flex; flex-direction: column; gap: 8px; justify-content: center; }
.rank-panel { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 18px; }
.rank-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--border); }
.rank-item:first-of-type { border-top: none; }
.rank-item .rk { width: 22px; height: 22px; border-radius: 50%; background: var(--panel); color: var(--accent); font-size: 12px; font-weight: 600; display: flex; align-items: center; justify-content: center; flex: 0 0 22px; }
.rank-item .rn { font-size: 14px; flex: 1; }
.rank-item .rv { font-size: 13px; color: var(--ink-3); }

/* ---------------- 萌宠游戏 ---------------- */
.games-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.game-card { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-soft); transition: transform .15s, box-shadow .15s; }
.game-card:hover { transform: translateY(-3px); box-shadow: var(--shadow); }
.game-banner { height: 150px; display: flex; align-items: center; justify-content: center; font-size: 54px; }
.game-body { padding: 18px 20px 22px; }
.game-body .g-name { font-size: 18px; font-weight: 600; }
.game-body .g-desc { font-size: 13px; color: var(--ink-3); margin: 6px 0 12px; line-height: 1.6; }
.game-body .g-tags { display: flex; gap: 8px; margin-bottom: 16px; }
.game-body .btn { width: 100%; }

/* ---------------- 桌面宠物页 ---------------- */
.dp-layout { display: grid; grid-template-columns: 560px 1fr; gap: 24px; align-items: start; }
.dp-widget { background: var(--white); border: 1px solid var(--border); border-radius: 20px; padding: 26px; box-shadow: var(--shadow-soft); }
.dp-widget .dp-title { font-size: 18px; font-weight: 500; display: flex; align-items: center; gap: 12px; }
.dp-avatar-wrap { display: flex; justify-content: center; margin: 26px 0; }
.dp-avatar { width: 180px; height: 180px; border-radius: 50%; object-fit: cover; background: var(--panel); box-shadow: 0 10px 30px rgba(224,112,154,.18); }
.dp-chips { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; margin-bottom: 22px; }
.dp-actions { display: flex; gap: 14px; justify-content: center; }
.dp-actions .pet-btn { flex: 1; max-width: 130px; }
.dp-footer { text-align: center; font-size: 13px; color: var(--ink-3); margin-top: 26px; }
.dp-feat { background: var(--panel); border-radius: var(--radius-md); padding: 22px; margin-bottom: 20px; }
.dp-feat h3, .dp-steps h3 { color: var(--accent); font-size: 16px; margin-bottom: 14px; }
.dp-feat li, .dp-steps li { list-style: none; font-size: 14px; color: var(--ink); margin-bottom: 12px; }
.dp-steps { background: var(--white); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 22px; }
.dp-steps .btn { margin-top: 16px; }

/* =========================================================
   桌面宠物 FAB + 挂件（全局浮层）
   ========================================================= */
.fab-pet {
  position: fixed; right: 28px; bottom: 28px; z-index: 60;
  display: inline-flex; align-items: center; gap: 8px;
  height: 44px; padding: 0 18px; border-radius: 22px;
  background: var(--accent); color: #fff; font-size: 14px; font-weight: 500;
  box-shadow: 0 10px 26px rgba(224,112,154,.4);
  transition: transform .15s, filter .15s;
}
.fab-pet:hover { transform: translateY(-2px); filter: brightness(1.05); }
.fab-emoji { font-size: 18px; }

.pet-widget {
  position: fixed; right: 28px; bottom: 84px; z-index: 70;
  width: 300px; opacity: 0; transform: translateY(16px) scale(.96);
  pointer-events: none; transition: opacity .2s, transform .2s;
}
.pet-widget.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.pet-widget-card {
  background: var(--white); border: 1px solid var(--border); border-radius: 24px;
  box-shadow: 0 20px 50px rgba(224,112,154,.28); padding: 20px;
  transform-style: preserve-3d; transition: transform .1s ease-out;
}
.pet-widget-head { display: flex; align-items: center; gap: 10px; }
.pet-widget-title { font-size: 16px; font-weight: 500; flex: 1; }
.pet-badge { background: var(--panel); color: var(--accent); font-size: 12px; font-weight: 500; padding: 2px 10px; border-radius: 11px; }
.pet-close { font-size: 22px; color: var(--muted); line-height: 1; width: 26px; height: 26px; }
.pet-avatar-wrap { display: flex; flex-direction: column; align-items: center; margin: 18px 0 14px; position: relative; }
.pet-avatar { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; background: var(--panel); box-shadow: 0 8px 20px rgba(224,112,154,.22); cursor: grab; }
.pet-avatar:active { cursor: grabbing; }
.pet-avatar.blink { animation: petBlink .5s ease; }
@keyframes petBlink { 0%,100%{ transform: rotate(0); } 25%{ transform: rotate(-6deg) scale(1.04); } 75%{ transform: rotate(6deg) scale(1.04); } }
.pet-speech {
  margin-top: 12px; background: var(--panel); color: var(--ink);
  font-size: 13px; padding: 8px 14px; border-radius: 14px; max-width: 220px; text-align: center;
  opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s;
}
.pet-speech.show { opacity: 1; transform: translateY(0); }
.pet-chips { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.pet-actions { display: flex; gap: 10px; margin: 16px 0 12px; }
.pet-btn {
  flex: 1; height: 32px; border-radius: 16px; background: var(--accent); color: #fff;
  font-size: 12px; font-weight: 500; transition: filter .15s;
}
.pet-btn:hover { filter: brightness(1.05); }
.pet-footer { font-size: 12px; color: var(--ink-3); text-align: center; line-height: 1.5; }

/* ---------------- 响应式 ---------------- */
@media (max-width: 1100px) {
  .square-layout, .post-layout, .explore-layout, .dp-layout { grid-template-columns: 1fr; }
  .msg-layout { grid-template-columns: 1fr; }
  .stat-row { grid-template-columns: 1fr; }
  .product-grid, .games-grid, .grid-2 { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .sidebar { position: fixed; z-index: 50; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); }
  .topbar, .view { padding-left: 20px; padding-right: 20px; }
  .product-grid, .games-grid, .grid-2 { grid-template-columns: 1fr; }
}
