/* ===== 星语心声 · 温暖树洞 ===== */

:root {
  --violet: #8b5cf6;
  --pink: #ec4899;
  --blue: #38bdf8;
  --green: #10b981;
  --ink: #3b3355;
  --muted: #9b93b5;
  --glass: rgba(255, 255, 255, 0.62);
  --glass-border: rgba(255, 255, 255, 0.78);
  --shadow: 0 20px 45px -18px rgba(139, 92, 246, 0.28);
  --radius: 20px;
  --grad: linear-gradient(135deg, #a78bfa 0%, #f472b6 100%);
  --font: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB",
    "Microsoft YaHei", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font);
  color: var(--ink);
  background: linear-gradient(160deg, #fdf8ff 0%, #f5f3ff 42%, #edf7ff 100%);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

[hidden] {
  display: none !important;
}

button {
  font-family: inherit;
  cursor: pointer;
}

button:focus-visible,
a:focus-visible,
textarea:focus-visible,
input:focus-visible {
  outline: 3px solid rgba(139, 92, 246, 0.35);
  outline-offset: 2px;
}

/* ===== 背景装饰 ===== */
.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

.blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  animation: drift 22s ease-in-out infinite alternate;
}

.blob-1 {
  width: 420px;
  height: 420px;
  background: #d8c7ff;
  top: -120px;
  left: -100px;
}

.blob-2 {
  width: 360px;
  height: 360px;
  background: #ffd6ee;
  top: 32%;
  right: -120px;
  animation-delay: -6s;
}

.blob-3 {
  width: 320px;
  height: 320px;
  background: #c9ecff;
  bottom: -110px;
  left: 18%;
  animation-delay: -12s;
}

.blob-4 {
  width: 260px;
  height: 260px;
  background: #d1fae5;
  top: 6%;
  right: 30%;
  opacity: 0.4;
  animation-delay: -18s;
}

@keyframes drift {
  from {
    transform: translate(0, 0) scale(1);
  }
  to {
    transform: translate(40px, 30px) scale(1.12);
  }
}

/* ===== 通用玻璃卡片 ===== */
.glass {
  background: var(--glass);
  border: 1px solid var(--glass-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
}

/* ===== 头部 ===== */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(255, 255, 255, 0.55);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.6);
}

.header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: inherit;
}

.brand-star {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--grad);
  color: #fff;
  font-size: 20px;
  box-shadow: 0 8px 18px -6px rgba(236, 72, 153, 0.55);
}

.brand-text h1 {
  font-size: 19px;
  letter-spacing: 0.5px;
  line-height: 1.2;
  background: linear-gradient(120deg, #7c3aed, #ec4899);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.brand-text p {
  font-size: 12px;
  color: var(--muted);
}

/* ===== 按钮 ===== */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: none;
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  color: #fff;
  background: var(--grad);
  box-shadow: 0 10px 22px -8px rgba(236, 72, 153, 0.55);
  transition: transform 0.2s ease, box-shadow 0.2s ease, filter 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 14px 26px -8px rgba(236, 72, 153, 0.6);
  filter: brightness(1.04);
}

.btn-primary:active {
  transform: scale(0.96);
}

.btn-primary:disabled {
  opacity: 0.7;
  cursor: default;
  transform: none;
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid rgba(139, 92, 246, 0.25);
  border-radius: 999px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.5);
  text-decoration: none;
  transition: transform 0.2s ease, background 0.2s ease;
}

.btn-ghost:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.8);
}

.btn-sm {
  padding: 8px 16px;
  font-size: 14px;
}

.header-post-btn .plus {
  font-size: 16px;
  font-weight: 700;
}

/* ===== 容器 ===== */
.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* ===== Hero ===== */
.hero {
  display: grid;
  grid-template-columns: 1.15fr 0.85fr;
  gap: 22px;
  margin: 28px 0 34px;
}

.hero-main {
  padding: 34px;
  position: relative;
  overflow: hidden;
}

.hero-main::after {
  content: "🌙";
  position: absolute;
  right: 22px;
  bottom: 16px;
  font-size: 64px;
  opacity: 0.18;
  transform: rotate(15deg);
}

.hero-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  color: #7c3aed;
  background: rgba(139, 92, 246, 0.12);
  margin-bottom: 16px;
}

.hero-main h2 {
  font-size: 34px;
  line-height: 1.25;
  letter-spacing: 0.5px;
}

.hero-desc {
  margin: 14px 0 22px;
  color: #6d6488;
  max-width: 460px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.hero-stats {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.stat {
  display: flex;
  flex-direction: column;
}

.stat b {
  font-size: 24px;
  color: #7c3aed;
  line-height: 1.2;
}

.stat span {
  font-size: 13px;
  color: var(--muted);
}

/* ===== 安慰卡 ===== */
.comfort-card {
  padding: 24px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.7), rgba(248, 237, 255, 0.6));
}

.comfort-head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.comfort-avatar {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  font-size: 26px;
  border-radius: 16px;
  background: rgba(139, 92, 246, 0.14);
}

.comfort-titles {
  flex: 1;
}

.comfort-title {
  font-weight: 700;
  font-size: 17px;
}

.comfort-sub {
  font-size: 12px;
  color: var(--muted);
}

.comfort-count {
  min-width: 30px;
  height: 30px;
  padding: 0 8px;
  display: grid;
  place-items: center;
  border-radius: 999px;
  background: var(--grad);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
}

.comfort-body {
  margin-top: 18px;
}

.comfort-text {
  min-height: 74px;
  padding: 16px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px dashed rgba(139, 92, 246, 0.3);
  font-size: 15px;
  color: #4c4466;
  display: flex;
  align-items: center;
  margin-bottom: 16px;
}

.comfort-btn {
  width: 100%;
}

.comfort-anim {
  animation: fadeUp 0.6s ease both;
}

/* ===== 布局 ===== */
.layout {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  align-items: start;
}

.section-head,
.side-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.section-head h3,
.side-head h3,
.side-card h3 {
  font-size: 19px;
}

.muted {
  color: var(--muted);
  font-size: 13px;
}

/* ===== 分类标签 ===== */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.chip {
  border: 1px solid rgba(139, 92, 246, 0.18);
  background: rgba(255, 255, 255, 0.55);
  color: #5d5478;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  transition: all 0.2s ease;
}

.chip:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.85);
}

.chip.active {
  background: var(--grad);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 8px 16px -6px rgba(236, 72, 153, 0.45);
}

/* ===== 帖子列表 ===== */
.post-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.post-card {
  padding: 20px 22px;
  transition: transform 0.25s ease, box-shadow 0.25s ease;
  animation: fadeUp 0.5s ease both;
}

.post-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 24px 50px -18px rgba(139, 92, 246, 0.32);
}

.post-card.flash {
  animation: flashBg 1.5s ease-out;
}

@keyframes flashBg {
  0% {
    box-shadow: 0 0 0 0 rgba(236, 72, 153, 0.5);
  }
  100% {
    box-shadow: 0 0 0 18px rgba(236, 72, 153, 0);
  }
}

.post-top {
  display: flex;
  align-items: center;
  gap: 10px;
}

.avatar {
  width: 40px;
  height: 40px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  font-size: 20px;
  border-radius: 50%;
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.25), rgba(244, 114, 182, 0.25));
}

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

.anon-name {
  font-weight: 700;
  font-size: 14px;
}

.post-time {
  font-size: 12px;
  color: var(--muted);
}

.category-tag {
  flex-shrink: 0;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.category-tag[data-cat="追星日常"] {
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
}

.category-tag[data-cat="心情低落"] {
  background: rgba(56, 189, 248, 0.14);
  color: #0369a1;
}

.category-tag[data-cat="同好互助"] {
  background: rgba(16, 185, 129, 0.14);
  color: #047857;
}

.category-tag[data-cat="温暖瞬间"] {
  background: rgba(244, 114, 182, 0.14);
  color: #be185d;
}

.post-content {
  margin: 14px 0 16px;
  line-height: 1.75;
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 15px;
}

.post-actions {
  display: flex;
  gap: 10px;
}

.hug-btn,
.reply-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: none;
  border-radius: 999px;
  padding: 8px 16px;
  font-size: 14px;
  color: var(--ink);
  background: rgba(139, 92, 246, 0.08);
  transition: all 0.2s ease;
}

.hug-btn b,
.reply-btn b {
  font-weight: 700;
}

.hug-btn:hover {
  background: rgba(236, 72, 153, 0.14);
}

.reply-btn:hover {
  background: rgba(56, 189, 248, 0.16);
}

.hug-btn:active,
.reply-btn:active {
  transform: scale(0.94);
}

.hug-btn.pulse {
  animation: pulse 0.35s ease;
}

@keyframes pulse {
  0% {
    transform: scale(1);
  }
  50% {
    transform: scale(1.22);
  }
  100% {
    transform: scale(1);
  }
}

/* 抱抱粒子 */
.heart-burst {
  position: fixed;
  pointer-events: none;
  z-index: 300;
}

.heart-burst span {
  position: absolute;
  bottom: 0;
  animation: floatUp 0.9s ease-out forwards;
}

@keyframes floatUp {
  0% {
    transform: translateY(0) scale(0.6) rotate(0deg);
    opacity: 0;
  }
  20% {
    opacity: 1;
  }
  100% {
    transform: translateY(-80px) scale(1.2) rotate(14deg);
    opacity: 0;
  }
}

/* ===== 回复区 ===== */
.reply-area {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px dashed rgba(139, 92, 246, 0.25);
  animation: fadeUp 0.3s ease both;
}

.reply-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.reply-item {
  display: flex;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  font-size: 14px;
}

.reply-avatar {
  font-size: 16px;
  flex-shrink: 0;
}

.reply-body {
  min-width: 0;
}

.reply-body p {
  word-break: break-word;
}

.reply-time {
  font-size: 12px;
  color: var(--muted);
}

.reply-empty {
  font-size: 13px;
  color: var(--muted);
  text-align: center;
  padding: 8px 0;
}

.reply-input {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}

.reply-input input {
  flex: 1;
  min-width: 0;
  border: 1px solid rgba(139, 92, 246, 0.2);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: inherit;
  color: var(--ink);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.reply-input input:focus {
  outline: none;
  border-color: rgba(139, 92, 246, 0.55);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12);
}

/* ===== 空状态 ===== */
.empty {
  text-align: center;
  padding: 50px 20px;
  color: var(--muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

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

/* ===== 侧边栏 ===== */
.side {
  position: sticky;
  top: 92px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.side-card {
  padding: 22px;
}

.side-card h3 {
  margin-bottom: 14px;
}

.rank-list {
  list-style: none;
  counter-reset: rank;
}

.rank-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.55);
  margin-bottom: 8px;
  cursor: pointer;
  transition: transform 0.2s ease, background 0.2s ease;
}

.rank-item:hover {
  transform: translateY(-2px);
  background: rgba(255, 255, 255, 0.9);
}

.rank-medal {
  font-size: 20px;
  flex-shrink: 0;
}

.rank-content {
  flex: 1;
  min-width: 0;
}

.rank-text {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rank-meta {
  font-size: 12px;
  color: var(--muted);
}

.rank-hugs {
  flex-shrink: 0;
  font-size: 13px;
  font-weight: 700;
  color: #be185d;
  background: rgba(244, 114, 182, 0.12);
  padding: 4px 10px;
  border-radius: 999px;
}

.tip-card p {
  font-size: 14px;
  color: #5d5478;
}

.tip-note {
  margin-top: 10px;
  font-size: 12px !important;
  color: var(--muted) !important;
}

/* ===== 弹窗 ===== */
.modal-mask {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(40, 30, 70, 0.35);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  animation: fadeIn 0.25s ease both;
}

.modal {
  width: min(560px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 26px;
  animation: pop 0.3s ease both;
}

.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}

.modal-head h3 {
  font-size: 20px;
}

.icon-btn {
  width: 34px;
  height: 34px;
  border: none;
  border-radius: 50%;
  background: rgba(139, 92, 246, 0.1);
  color: var(--ink);
  font-size: 14px;
  transition: all 0.2s ease;
}

.icon-btn:hover {
  background: rgba(139, 92, 246, 0.2);
  transform: rotate(90deg);
}

.modal-hint {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
}

.modal textarea {
  width: 100%;
  min-height: 130px;
  resize: vertical;
  border: 1px solid rgba(139, 92, 246, 0.2);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  padding: 14px;
  font-size: 15px;
  font-family: inherit;
  color: var(--ink);
  line-height: 1.7;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.modal textarea:focus {
  outline: none;
  border-color: rgba(139, 92, 246, 0.55);
  box-shadow: 0 0 0 4px rgba(139, 92, 246, 0.12);
}

.modal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 14px;
}

.char-count {
  font-size: 12px;
  color: var(--muted);
}

/* ===== Toast ===== */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 300;
  background: rgba(59, 51, 85, 0.92);
  color: #fff;
  padding: 12px 24px;
  border-radius: 999px;
  font-size: 14px;
  box-shadow: 0 14px 30px -8px rgba(59, 51, 85, 0.5);
  white-space: nowrap;
}

.toast.show {
  animation: slideUp 0.3s ease both;
}

@keyframes slideUp {
  from {
    transform: translate(-50%, 16px);
    opacity: 0;
  }
  to {
    transform: translate(-50%, 0);
    opacity: 1;
  }
}

/* ===== 页脚 ===== */
.site-footer {
  text-align: center;
  padding: 34px 0 10px;
  color: #7a7194;
  font-size: 14px;
}

.site-footer .muted {
  margin-top: 6px;
}

/* ===== 动画 ===== */
@keyframes fadeUp {
  from {
    transform: translateY(14px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes pop {
  from {
    transform: scale(0.92) translateY(10px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

/* ===== 滚动条 ===== */
::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: rgba(139, 92, 246, 0.28);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(139, 92, 246, 0.42);
}

/* ===== 响应式 ===== */
@media (max-width: 920px) {
  .hero {
    grid-template-columns: 1fr;
  }

  .layout {
    grid-template-columns: 1fr;
  }

  .side {
    position: static;
  }
}

@media (max-width: 640px) {
  .container {
    padding: 0 14px 40px;
  }

  .header-inner {
    padding: 10px 14px;
  }

  .brand-text p {
    display: none;
  }

  .brand-star {
    width: 36px;
    height: 36px;
    font-size: 17px;
    border-radius: 12px;
  }

  .hero-main {
    padding: 24px;
  }

  .hero-main h2 {
    font-size: 26px;
  }

  .hero-desc {
    font-size: 14px;
  }

  .br-mobile {
    display: none;
  }

  .hero-stats {
    gap: 18px;
  }

  .post-card {
    padding: 16px;
  }

  .comfort-text {
    font-size: 14px;
  }

  .modal {
    padding: 20px;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
