/* 糖心情感电台与树洞社区 - 深夜星空治愈风格 */
:root {
  --primary: #1A237E;
  --secondary: #5C6BC0;
  --bg: #0D1B2A;
  --card: #1B2838;
  --accent: #FFD54F;
  --text: #E0E0E0;
  --text-muted: #9E9E9E;
  --radius: 24px;
  --shadow: 0 8px 32px rgba(26, 35, 126, 0.4);
  --font-title: 'Noto Serif SC', serif;
  --font-body: 'Noto Serif SC', serif;
  --font-handwrite: 'ZCOOL XiaoWei', serif;
}

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

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-body);
  background-color: var(--bg);
  color: var(--text);
  line-height: 1.8;
  min-height: 100vh;
  overflow-x: hidden;
}

/* 星空粒子背景 */
#starfield {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: #ffffff;
  border-radius: 50%;
  animation: twinkle var(--duration, 3s) ease-in-out infinite;
  opacity: 0;
}

@keyframes twinkle {
  0%, 100% { opacity: 0.2; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.5); }
}

/* 导航栏 */
.nav-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(13, 27, 42, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid rgba(92, 107, 192, 0.2);
  padding: 0.8rem 2rem;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-brand svg {
  width: 28px;
  height: 28px;
}

.nav-links {
  display: flex;
  list-style: none;
  gap: 1.5rem;
  align-items: center;
}

.nav-links a {
  color: var(--text);
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.3s;
  position: relative;
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--accent);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: -4px;
  left: 0;
  width: 0;
  height: 2px;
  background: var(--accent);
  transition: width 0.3s;
}

.nav-links a:hover::after {
  width: 100%;
}

.nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
}

/* 首屏英雄区 */
.hero-section {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 6rem 2rem 4rem;
  position: relative;
}

.hero-title {
  font-family: var(--font-title);
  font-size: 3.2rem;
  font-weight: 300;
  color: #ffffff;
  margin-bottom: 1rem;
  letter-spacing: 0.1em;
  text-shadow: 0 0 40px rgba(255, 213, 79, 0.3);
}

.hero-subtitle {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 600px;
  margin-bottom: 2rem;
  line-height: 2;
}

.hero-cta {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 2rem;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  color: #ffffff;
  border: none;
  border-radius: 50px;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: transform 0.3s, box-shadow 0.3s;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(92, 107, 192, 0.5);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.9rem 2rem;
  background: transparent;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 50px;
  font-size: 1rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.3s, color 0.3s;
}

.btn-secondary:hover {
  background: var(--accent);
  color: var(--bg);
}

/* 通用容器 */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
}

/* 区块标题 */
.section {
  padding: 4rem 0;
}

.section-header {
  text-align: center;
  margin-bottom: 3rem;
}

.section-title {
  font-family: var(--font-title);
  font-size: 2rem;
  font-weight: 400;
  color: #ffffff;
  margin-bottom: 0.8rem;
}

.section-desc {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 500px;
  margin: 0 auto;
}

/* 卡片网格 */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 1.5rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.8rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(92, 107, 192, 0.15);
  transition: transform 0.3s, box-shadow 0.3s;
}

.card:hover {
  transform: translateY(-4px);
  box-shadow: 0 12px 40px rgba(26, 35, 126, 0.6);
}

.card-image {
  width: 100%;
  height: 180px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 8px);
  margin-bottom: 1rem;
}

.card-tag {
  display: inline-block;
  padding: 0.2rem 0.8rem;
  background: rgba(92, 107, 192, 0.2);
  color: var(--secondary);
  border-radius: 20px;
  font-size: 0.8rem;
  margin-bottom: 0.8rem;
}

.card-title {
  font-family: var(--font-title);
  font-size: 1.2rem;
  color: #ffffff;
  margin-bottom: 0.5rem;
}

.card-text {
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.7;
}

.card-meta {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* 电台播放器 */
.radio-player {
  background: var(--card);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(255, 213, 79, 0.2);
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.radio-cover {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  border: 3px solid var(--accent);
  animation: rotate 20s linear infinite;
}

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

.radio-info {
  flex: 1;
}

.radio-title {
  font-size: 1.1rem;
  color: #ffffff;
  margin-bottom: 0.3rem;
}

.radio-host {
  font-size: 0.85rem;
  color: var(--accent);
}

.radio-listeners {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 0.3rem;
}

.radio-waveform {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 40px;
}

.wave-bar {
  width: 4px;
  background: var(--accent);
  border-radius: 2px;
  animation: wave 1.2s ease-in-out infinite;
}

.wave-bar:nth-child(1) { height: 20px; animation-delay: 0s; }
.wave-bar:nth-child(2) { height: 30px; animation-delay: 0.1s; }
.wave-bar:nth-child(3) { height: 15px; animation-delay: 0.2s; }
.wave-bar:nth-child(4) { height: 35px; animation-delay: 0.3s; }
.wave-bar:nth-child(5) { height: 25px; animation-delay: 0.4s; }
.wave-bar:nth-child(6) { height: 18px; animation-delay: 0.5s; }

@keyframes wave {
  0%, 100% { transform: scaleY(1); }
  50% { transform: scaleY(0.4); }
}

/* 树洞投稿框 */
.treehouse-form {
  background: var(--card);
  border-radius: var(--radius);
  padding: 2rem;
  box-shadow: var(--shadow);
  border: 1px solid rgba(92, 107, 192, 0.2);
}

.treehouse-form textarea {
  width: 100%;
  min-height: 120px;
  background: rgba(13, 27, 42, 0.6);
  border: 1px solid rgba(92, 107, 192, 0.3);
  border-radius: 16px;
  padding: 1.2rem;
  color: var(--text);
  font-family: var(--font-handwrite);
  font-size: 1rem;
  resize: vertical;
  outline: none;
  transition: border-color 0.3s;
}

.treehouse-form textarea:focus {
  border-color: var(--accent);
}

.treehouse-form textarea::placeholder {
  color: var(--text-muted);
}

.tag-selector {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin: 1rem 0;
}

.tag-btn {
  padding: 0.4rem 1rem;
  border-radius: 20px;
  border: 1px solid rgba(92, 107, 192, 0.3);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all 0.3s;
}

.tag-btn:hover,
.tag-btn.active {
  background: var(--secondary);
  color: #ffffff;
  border-color: var(--secondary);
}

.form-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 1rem;
}

.char-count {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* 暖心语录 */
.quote-block {
  background: linear-gradient(135deg, rgba(26, 35, 126, 0.4), rgba(92, 107, 192, 0.2));
  border-radius: var(--radius);
  padding: 3rem;
  text-align: center;
  border: 1px solid rgba(255, 213, 79, 0.15);
  margin: 2rem 0;
}

.quote-text {
  font-family: var(--font-title);
  font-size: 1.5rem;
  color: #ffffff;
  font-weight: 300;
  line-height: 2;
  margin-bottom: 1rem;
}

.quote-source {
  color: var(--accent);
  font-size: 0.9rem;
}

/* 暖心回复墙 */
.reply-wall {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}

.reply-card {
  background: rgba(27, 40, 56, 0.8);
  border-radius: 16px;
  padding: 1.2rem;
  border: 1px solid rgba(92, 107, 192, 0.1);
}

.reply-text {
  font-family: var(--font-handwrite);
  color: var(--text);
  font-size: 0.95rem;
  margin-bottom: 0.8rem;
  line-height: 1.8;
}

.reply-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.warmth-index {
  color: var(--accent);
}

/* 面包屑 */
.breadcrumb {
  padding: 1rem 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.breadcrumb a {
  color: var(--secondary);
  text-decoration: none;
}

.breadcrumb a:hover {
  color: var(--accent);
}

.breadcrumb span {
  margin: 0 0.5rem;
}

/* 页脚 */
.site-footer {
  background: rgba(13, 27, 42, 0.95);
  border-top: 1px solid rgba(92, 107, 192, 0.2);
  padding: 3rem 0 1.5rem;
  margin-top: 4rem;
}

.footer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 2rem;
  margin-bottom: 2rem;
}

.footer-col h4 {
  color: var(--accent);
  font-size: 1rem;
  margin-bottom: 1rem;
  font-weight: 400;
}

.footer-col a {
  display: block;
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  transition: color 0.3s;
}

.footer-col a:hover {
  color: var(--accent);
}

.footer-bottom {
  text-align: center;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(92, 107, 192, 0.15);
  color: var(--text-muted);
  font-size: 0.8rem;
}

.footer-bottom a {
  color: var(--secondary);
  text-decoration: none;
}

/* 页面内容区 */
.page-content {
  padding-top: 5rem;
  min-height: 80vh;
}

.page-hero {
  text-align: center;
  padding: 3rem 0;
}

.page-hero h1 {
  font-family: var(--font-title);
  font-size: 2.4rem;
  font-weight: 300;
  color: #ffffff;
  margin-bottom: 1rem;
}

.page-hero p {
  color: var(--text-muted);
  max-width: 600px;
  margin: 0 auto;
}

/* FAQ区块 */
.faq-list {
  max-width: 800px;
  margin: 0 auto;
}

.faq-item {
  background: var(--card);
  border-radius: 16px;
  margin-bottom: 1rem;
  overflow: hidden;
  border: 1px solid rgba(92, 107, 192, 0.15);
}

.faq-question {
  padding: 1.2rem 1.5rem;
  cursor: pointer;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #ffffff;
  font-size: 1rem;
}

.faq-question::after {
  content: '▼';
  font-size: 0.7rem;
  transition: transform 0.3s;
  color: var(--accent);
}

.faq-item.open .faq-question::after {
  transform: rotate(180deg);
}

.faq-answer {
  padding: 0 1.5rem 1.2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.8;
  display: none;
}

.faq-item.open .faq-answer {
  display: block;
}

/* 搜索页 */
.search-box {
  max-width: 600px;
  margin: 2rem auto;
  position: relative;
}

.search-box input {
  width: 100%;
  padding: 1rem 1.5rem;
  padding-right: 3rem;
  background: var(--card);
  border: 1px solid rgba(92, 107, 192, 0.3);
  border-radius: 50px;
  color: var(--text);
  font-size: 1rem;
  outline: none;
  transition: border-color 0.3s;
}

.search-box input:focus {
  border-color: var(--accent);
}

.search-box button {
  position: absolute;
  right: 1rem;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--accent);
  font-size: 1.2rem;
  cursor: pointer;
}

.search-results {
  max-width: 800px;
  margin: 2rem auto;
}

.search-result-item {
  padding: 1.2rem 0;
  border-bottom: 1px solid rgba(92, 107, 192, 0.1);
}

.search-result-item h3 a {
  color: var(--secondary);
  text-decoration: none;
  font-size: 1.1rem;
}

.search-result-item p {
  color: var(--text-muted);
  font-size: 0.9rem;
  margin-top: 0.3rem;
}

/* 404页面 */
.error-page {
  min-height: 80vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 2rem;
}

.error-code {
  font-size: 8rem;
  font-weight: 300;
  color: var(--secondary);
  opacity: 0.5;
  line-height: 1;
}

.error-message {
  font-size: 1.5rem;
  color: #ffffff;
  margin: 1rem 0;
}

/* 咨询师列表 */
.counselor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1.5rem;
}

.counselor-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.5rem;
  text-align: center;
  border: 1px solid rgba(92, 107, 192, 0.15);
}

.counselor-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
  margin-bottom: 1rem;
  border: 2px solid var(--secondary);
}

.counselor-name {
  color: #ffffff;
  font-size: 1.1rem;
  margin-bottom: 0.3rem;
}

.counselor-field {
  color: var(--accent);
  font-size: 0.85rem;
  margin-bottom: 0.8rem;
}

/* 测试卡片 */
.test-card {
  background: var(--card);
  border-radius: var(--radius);
  padding: 1.8rem;
  border: 1px solid rgba(92, 107, 192, 0.15);
  text-align: center;
}

.test-participants {
  color: var(--accent);
  font-size: 0.85rem;
  margin: 0.5rem 0 1rem;
}

/* 打字机效果 */
.typewriter {
  overflow: hidden;
  border-right: 2px solid var(--accent);
  white-space: nowrap;
  animation: typing 3.5s steps(40, end), blink-caret 0.75s step-end infinite;
}

@keyframes typing {
  from { width: 0; }
  to { width: 100%; }
}

@keyframes blink-caret {
  from, to { border-color: transparent; }
  50% { border-color: var(--accent); }
}

/* 社区公约 */
.community-rules {
  background: linear-gradient(135deg, rgba(26, 35, 126, 0.3), rgba(13, 27, 42, 0.8));
  border-radius: var(--radius);
  padding: 2.5rem;
  border: 1px solid rgba(255, 213, 79, 0.1);
}

.rule-item {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.rule-icon {
  color: var(--accent);
  font-size: 1.2rem;
  flex-shrink: 0;
  margin-top: 0.2rem;
}

.rule-text {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.7;
}

/* APP下载区 */
.app-showcase {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 3rem;
  align-items: center;
}

.app-features {
  list-style: none;
}

.app-features li {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  margin-bottom: 1rem;
  color: var(--text);
}

.app-features li::before {
  content: '✦';
  color: var(--accent);
}

/* 响应式 */
@media (max-width: 768px) {
  .nav-links {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: rgba(13, 27, 42, 0.98);
    flex-direction: column;
    padding: 1rem 2rem;
    gap: 1rem;
  }

  .nav-links.show {
    display: flex;
  }

  .nav-toggle {
    display: block;
  }

  .hero-title {
    font-size: 2rem;
  }

  .hero-subtitle {
    font-size: 1rem;
  }

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

  .radio-player {
    flex-direction: column;
    text-align: center;
  }

  .app-showcase {
    grid-template-columns: 1fr;
  }

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

  .section-title {
    font-size: 1.6rem;
  }

  .quote-text {
    font-size: 1.2rem;
  }
}

@media (max-width: 480px) {
  .footer-grid {
    grid-template-columns: 1fr;
  }

  .hero-cta {
    flex-direction: column;
  }

  .reply-wall {
    grid-template-columns: 1fr;
  }
}

/* 页面过渡动画 */
.fade-in {
  opacity: 0;
  transform: translateY(20px);
  transition: opacity 0.6s ease, transform 0.6s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

/* 内页通用 */
.inner-page {
  padding-top: 5rem;
}

.content-block {
  margin-bottom: 3rem;
}

.content-block h2 {
  font-family: var(--font-title);
  font-size: 1.6rem;
  color: #ffffff;
  margin-bottom: 1rem;
  font-weight: 400;
}

.content-block p {
  color: var(--text);
  line-height: 1.9;
  margin-bottom: 1rem;
}

/* 标签云 */
.tag-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.tag-cloud a {
  padding: 0.3rem 1rem;
  background: rgba(92, 107, 192, 0.15);
  color: var(--secondary);
  border-radius: 20px;
  text-decoration: none;
  font-size: 0.85rem;
  transition: all 0.3s;
}

.tag-cloud a:hover {
  background: var(--secondary);
  color: #ffffff;
}

/* 专题页横幅 */
.topic-banner {
  background: linear-gradient(135deg, var(--primary), var(--secondary));
  border-radius: var(--radius);
  padding: 3rem;
  text-align: center;
  margin-bottom: 2rem;
}

.topic-banner h1 {
  font-family: var(--font-title);
  font-size: 2.2rem;
  color: #ffffff;
  font-weight: 300;
  margin-bottom: 1rem;
}

.topic-banner p {
  color: rgba(255, 255, 255, 0.8);
  max-width: 600px;
  margin: 0 auto;
}
