/* ============= 中国风样式 ============= */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

:root {
  --primary: #8b0000;          /* 朱红 */
  --primary-light: #a52a2a;
  --primary-dark: #5c0a0a;
  --gold: #d4af37;            /* 鎏金 */
  --gold-light: #e8c878;
  --ink: #2c2416;              /* 墨色 */
  --ink-light: #4a4030;
  --paper: #f5e8d0;            /* 宣纸 */
  --paper-light: #fdf6e8;
  --paper-dark: #e6d5b3;
  --jade: #5d8b70;             /* 青玉 */
  --cinnabar: #e34234;
  --shadow: rgba(74, 40, 16, 0.15);
  --shadow-deep: rgba(74, 40, 16, 0.3);
  --border: rgba(139, 0, 0, 0.2);
}

html, body {
  height: 100%;
  font-family: "KaiTi", "STKaiti", "楷体", "Microsoft YaHei", "PingFang SC", -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  color: var(--ink);
  background: var(--paper);
  background-image:
    radial-gradient(circle at 20% 30%, rgba(212, 175, 55, 0.06) 0%, transparent 50%),
    radial-gradient(circle at 80% 70%, rgba(139, 0, 0, 0.05) 0%, transparent 50%),
    repeating-linear-gradient(45deg, transparent, transparent 35px, rgba(139, 0, 0, 0.015) 35px, rgba(139, 0, 0, 0.015) 36px);
  background-attachment: fixed;
  line-height: 1.6;
  overflow-x: hidden;
}

body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  background-image:
    url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='60' height='60' viewBox='0 0 60 60'><path d='M30 5 L35 25 L55 30 L35 35 L30 55 L25 35 L5 30 L25 25 Z' fill='none' stroke='%238b0000' stroke-width='0.5' opacity='0.05'/></svg>");
  opacity: 0.4;
  z-index: 0;
}

/* ============= 顶部灯笼装饰 ============= */
.top-decoration {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 80px;
  pointer-events: none;
  z-index: 5;
}

.lantern {
  position: absolute;
  top: 8px;
  width: 36px;
  height: 48px;
  background: radial-gradient(ellipse, var(--cinnabar) 30%, var(--primary) 70%, var(--primary-dark));
  border-radius: 50% 50% 45% 45%;
  box-shadow: 0 0 20px rgba(227, 66, 52, 0.6), inset 0 -8px 12px rgba(0, 0, 0, 0.2);
  animation: sway 4s ease-in-out infinite;
}

.lantern::before {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 12px;
  height: 12px;
  background: var(--gold);
  border-radius: 0 0 3px 3px;
}

.lantern.left { left: 12px; animation-delay: 0s; }
.lantern.right { right: 12px; animation-delay: 1.5s; }

@keyframes sway {
  0%, 100% { transform: rotate(-4deg); }
  50% { transform: rotate(4deg); }
}

/* ============= 顶部标题 ============= */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-light) 100%);
  border-bottom: 3px double var(--gold);
  box-shadow: 0 4px 12px var(--shadow-deep);
  padding: 12px 16px;
  padding-top: 20px;
  color: var(--paper-light);
}

.site-header::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  right: 0;
  height: 8px;
  background: linear-gradient(180deg, rgba(139, 0, 0, 0.2), transparent);
}

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

.logo-area {
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo-icon {
  font-size: 32px;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
  animation: glow 2s ease-in-out infinite;
}

@keyframes glow {
  0%, 100% { filter: drop-shadow(0 2px 4px rgba(0,0,0,0.3)); }
  50% { filter: drop-shadow(0 2px 12px rgba(255, 200, 100, 0.6)); }
}

.logo-text {
  display: flex;
  flex-direction: column;
}

.site-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 4px;
  color: var(--gold-light);
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.4);
  font-family: "STKaiti", "KaiTi", serif;
}

.site-subtitle {
  font-size: 11px;
  letter-spacing: 2px;
  opacity: 0.85;
  color: var(--paper);
}

.header-actions {
  display: flex;
  gap: 8px;
}

.action-btn {
  width: 40px;
  height: 40px;
  border: 2px solid var(--gold);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--gold-light);
  cursor: pointer;
  font-size: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(4px);
}

.action-btn:hover, .action-btn:active {
  background: rgba(212, 175, 55, 0.2);
  transform: scale(1.05);
}

.refresh-btn .icon.spinning {
  animation: spin 0.8s linear infinite;
  display: inline-block;
}

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

/* ============= 搜索面板 ============= */
.search-panel {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(245, 232, 208, 0.98);
  backdrop-filter: blur(8px);
  z-index: 200;
  padding: 80px 16px 16px;
  overflow-y: auto;
  transform: translateY(-100%);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.search-panel.show {
  transform: translateY(0);
}

.search-box {
  display: flex;
  max-width: 600px;
  margin: 0 auto 16px;
  gap: 8px;
}

.search-box input {
  flex: 1;
  padding: 12px 16px;
  font-size: 16px;
  border: 2px solid var(--primary);
  border-radius: 24px;
  background: var(--paper-light);
  color: var(--ink);
  font-family: inherit;
  outline: none;
  transition: all 0.3s;
}

.search-box input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 4px rgba(212, 175, 55, 0.15);
}

.search-submit {
  padding: 0 24px;
  background: var(--primary);
  color: var(--gold-light);
  border: 2px solid var(--gold);
  border-radius: 24px;
  font-size: 15px;
  font-family: inherit;
  font-weight: 600;
  cursor: pointer;
  letter-spacing: 4px;
  transition: all 0.3s;
}

.search-submit:hover {
  background: var(--primary-dark);
  transform: scale(1.03);
}

.search-results {
  max-width: 600px;
  margin: 0 auto;
}

.search-result-item {
  padding: 14px 16px;
  margin-bottom: 10px;
  background: var(--paper-light);
  border: 1px solid var(--border);
  border-left: 4px solid var(--primary);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
}

.search-result-item:hover {
  background: var(--paper);
  transform: translateX(4px);
  box-shadow: 0 4px 12px var(--shadow);
}

.search-result-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.search-result-source {
  font-size: 12px;
  color: var(--primary);
  letter-spacing: 1px;
}

/* ============= 平台导航 ============= */
.platform-nav {
  position: sticky;
  top: 76px;
  z-index: 90;
  background: var(--paper-light);
  border-bottom: 2px solid var(--border);
  box-shadow: 0 2px 8px var(--shadow);
}

.nav-scroll {
  display: flex;
  gap: 6px;
  padding: 10px 16px;
  overflow-x: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  scroll-behavior: smooth;
}

.nav-scroll::-webkit-scrollbar { display: none; }

.nav-item {
  flex-shrink: 0;
  padding: 8px 16px;
  background: transparent;
  border: 2px solid var(--border);
  border-radius: 20px;
  color: var(--ink-light);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
  white-space: nowrap;
  letter-spacing: 1px;
}

.nav-item:hover {
  background: rgba(139, 0, 0, 0.05);
  border-color: var(--primary-light);
}

.nav-item.active {
  background: var(--primary);
  color: var(--gold-light);
  border-color: var(--gold);
  box-shadow: 0 2px 8px rgba(139, 0, 0, 0.3);
}

/* ============= 状态栏 ============= */
.status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 16px;
  max-width: 1200px;
  margin: 0 auto;
  font-size: 12px;
  color: var(--ink-light);
  letter-spacing: 1px;
}

.status-text {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-text::before {
  content: '◆';
  color: var(--gold);
}

.update-time {
  color: var(--primary);
  font-weight: 500;
}

/* ============= 主内容 ============= */
.main-content {
  max-width: 1200px;
  margin: 0 auto;
  padding: 8px 16px 100px;
  position: relative;
  z-index: 1;
}

/* ============= 加载动画 ============= */
.loading {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 60px 16px;
  color: var(--primary);
}

.loading.show { display: flex; }

.spinner-circle {
  width: 56px;
  height: 56px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-right-color: var(--gold);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.spinner-text {
  margin-top: 16px;
  font-size: 14px;
  letter-spacing: 4px;
  color: var(--ink-light);
}

/* ============= 新闻列表 ============= */
.news-container {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

.news-section {
  margin-bottom: 24px;
}

.section-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 12px;
  padding: 6px 12px;
  border-left: 4px solid var(--primary);
  background: linear-gradient(90deg, rgba(139, 0, 0, 0.08), transparent);
  letter-spacing: 2px;
}

.section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, var(--border), transparent);
}

.news-card {
  position: relative;
  padding: 14px 16px;
  background: var(--paper-light);
  border: 1px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  overflow: hidden;
}

.news-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 4px;
  height: 100%;
  background: linear-gradient(180deg, var(--primary), var(--gold));
  transform: scaleY(0);
  transform-origin: top;
  transition: transform 0.3s ease;
}

.news-card:hover, .news-card:active {
  background: var(--paper);
  transform: translateY(-2px);
  box-shadow: 0 8px 20px var(--shadow-deep);
  border-color: var(--primary-light);
}

.news-card:hover::before { transform: scaleY(1); }

.news-rank {
  display: inline-block;
  width: 24px;
  height: 24px;
  line-height: 24px;
  text-align: center;
  background: var(--paper-dark);
  color: var(--primary);
  font-weight: 700;
  font-size: 13px;
  border-radius: 4px;
  margin-right: 10px;
  flex-shrink: 0;
}

.news-card.top-1 .news-rank { background: linear-gradient(135deg, #d4af37, #b8941f); color: white; }
.news-card.top-2 .news-rank { background: linear-gradient(135deg, #c0c0c0, #909090); color: white; }
.news-card.top-3 .news-rank { background: linear-gradient(135deg, #cd7f32, #a05c20); color: white; }

.news-title {
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  line-height: 1.5;
  flex: 1;
  display: flex;
  align-items: flex-start;
}

.news-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 12px;
  color: var(--ink-light);
}

.news-source {
  padding: 2px 8px;
  background: rgba(139, 0, 0, 0.08);
  color: var(--primary);
  border-radius: 10px;
  letter-spacing: 1px;
}

.news-hot {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--cinnabar);
  font-weight: 600;
}

.news-hot::before { content: '🔥'; }

.news-label {
  display: inline-block;
  margin-left: 6px;
  padding: 1px 6px;
  font-size: 10px;
  border-radius: 3px;
  background: var(--cinnabar);
  color: white;
  letter-spacing: 1px;
  vertical-align: middle;
}

/* ============= 底部 ============= */
.site-footer {
  position: relative;
  margin-top: 40px;
  padding: 32px 16px;
  text-align: center;
  background: linear-gradient(180deg, transparent, rgba(139, 0, 0, 0.05));
  border-top: 2px double var(--border);
}

.footer-pattern {
  position: absolute;
  top: -1px;
  left: 0;
  right: 0;
  height: 8px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='40' height='8'><path d='M0 4 Q10 0 20 4 T40 4' stroke='%238b0000' stroke-width='1' fill='none' opacity='0.4'/></svg>");
  background-repeat: repeat-x;
}

.footer-text {
  font-size: 14px;
  color: var(--primary);
  letter-spacing: 3px;
  margin-bottom: 6px;
  font-weight: 600;
}

.footer-copyright {
  font-size: 11px;
  color: var(--ink-light);
  opacity: 0.7;
  letter-spacing: 1px;
}

/* ============= 返回顶部 ============= */
.back-to-top {
  position: fixed;
  right: 16px;
  bottom: 80px;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--gold-light);
  border: 2px solid var(--gold);
  font-size: 18px;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s;
  box-shadow: 0 4px 12px var(--shadow-deep);
  z-index: 50;
}

.back-to-top.show {
  opacity: 1;
  pointer-events: auto;
}

.back-to-top:hover {
  background: var(--primary-dark);
  transform: translateY(-3px);
}

/* ============= Toast ============= */
.toast {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0.8);
  padding: 12px 24px;
  background: rgba(44, 36, 22, 0.92);
  color: var(--gold-light);
  border: 2px solid var(--gold);
  border-radius: 8px;
  font-size: 14px;
  letter-spacing: 2px;
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s ease;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
}

/* ============= 响应式 ============= */
@media (min-width: 768px) {
  .news-container {
    grid-template-columns: repeat(2, 1fr);
    gap: 14px;
  }
  .site-title { font-size: 26px; }
  body { font-size: 16px; }
}

@media (min-width: 1024px) {
  .news-container {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* 减少动画偏好 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}


/* ============= 文章阅读器模态框 ============= */
.reader-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 999;
  display: none;
  align-items: center;
  justify-content: center;
}

.reader-modal.show {
  display: flex;
}

.reader-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(20, 10, 5, 0.7);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.reader-container {
  position: relative;
  width: 92%;
  max-width: 720px;
  max-height: 90vh;
  background: var(--paper);
  border: 2px solid var(--gold);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: reader-zoom 0.3s ease;
}

@keyframes reader-zoom {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.reader-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: var(--primary);
  color: var(--gold-light);
  border-bottom: 2px solid var(--gold);
  flex-shrink: 0;
}

.reader-close,
.reader-action {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  color: var(--gold-light);
  font-size: 18px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.2s;
  padding: 0;
  line-height: 1;
}

.reader-action.reader-original {
  width: auto;
  padding: 0 14px;
  border-radius: 18px;
  font-size: 14px;
}

.reader-close:hover,
.reader-action:hover {
  background: rgba(255, 255, 255, 0.3);
  transform: rotate(8deg) scale(1.05);
}

.reader-actions {
  display: flex;
  gap: 10px;
  align-items: center;
}

.reader-body {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px 32px;
  background: linear-gradient(180deg, var(--paper) 0%, var(--paper-warm) 100%);
  line-height: 1.85;
  color: var(--text-dark);
  font-size: 16px;
}

.reader-loading {
  text-align: center;
  padding: 60px 20px;
  color: var(--primary);
}

.reader-loading p {
  margin-top: 16px;
  font-size: 14px;
  letter-spacing: 1px;
}

.reader-article-head {
  border-bottom: 2px dashed var(--gold);
  padding-bottom: 16px;
  margin-bottom: 24px;
}

.reader-title {
  font-family: 'STKaiti', 'KaiTi', '楷体', serif;
  font-size: 24px;
  font-weight: bold;
  color: var(--primary);
  margin: 0 0 12px;
  letter-spacing: 1px;
  line-height: 1.4;
}

.reader-meta-item {
  display: inline-block;
  margin-right: 16px;
  font-size: 13px;
  color: var(--text-medium);
  letter-spacing: 0.5px;
}

.reader-image {
  margin: 0 -24px 20px;
  text-align: center;
  background: #000;
}

.reader-image img {
  max-width: 100%;
  height: auto;
  display: block;
  margin: 0 auto;
}

.reader-content {
  font-size: 16px;
  line-height: 2;
  text-align: justify;
  color: var(--text-dark);
}

.reader-content p {
  margin: 0 0 18px;
  text-indent: 2em;
  font-family: 'STKaiti', 'KaiTi', '楷体', serif;
  letter-spacing: 0.5px;
}

.reader-content p:first-child::first-letter {
  font-size: 1.4em;
  color: var(--primary);
  font-weight: bold;
}

.reader-footer {
  margin-top: 32px;
  padding-top: 20px;
  border-top: 1px dashed var(--gold);
  text-align: center;
}

.reader-btn {
  display: inline-block;
  padding: 10px 24px;
  background: var(--primary);
  color: var(--gold-light);
  text-decoration: none;
  border-radius: 20px;
  font-size: 14px;
  letter-spacing: 2px;
  transition: all 0.2s;
}

.reader-btn:hover {
  background: var(--primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.reader-error {
  text-align: center;
  padding: 40px 20px;
  color: var(--text-medium);
}

.reader-error h2 {
  color: var(--primary);
  margin: 0 0 16px;
  font-size: 20px;
}

.reader-error p {
  margin: 0 0 24px;
  font-size: 14px;
}

/* ============= 搜索结果样式 ============= */
.search-summary {
  font-size: 13px;
  color: var(--primary);
  padding: 8px 0;
  border-bottom: 1px dashed var(--gold);
  margin-bottom: 12px;
  letter-spacing: 1px;
}

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

.search-item {
  background: var(--paper-warm);
  border: 1px solid var(--gold-light);
  border-left: 3px solid var(--primary);
  border-radius: 6px;
  padding: 12px 14px;
  cursor: pointer;
  transition: all 0.2s;
}

.search-item:hover {
  background: var(--paper);
  border-left-width: 5px;
  transform: translateX(2px);
  box-shadow: 0 4px 12px rgba(139, 0, 0, 0.1);
}

.search-item-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-dark);
  line-height: 1.6;
  margin-bottom: 6px;
}

.search-highlight {
  background: linear-gradient(transparent 60%, #ffe066 60%);
  color: var(--primary);
  font-weight: bold;
  padding: 0 2px;
}

.search-item-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--text-medium);
}

.search-item-source {
  background: var(--primary);
  color: var(--gold-light);
  padding: 2px 8px;
  border-radius: 10px;
  letter-spacing: 1px;
  font-size: 11px;
}

.search-item-action {
  color: var(--primary);
  letter-spacing: 0.5px;
}

.search-external {
  margin-top: 16px;
  padding-top: 16px;
  border-top: 2px dashed var(--gold);
}

.search-external-title {
  font-size: 13px;
  color: var(--primary);
  margin-bottom: 10px;
  letter-spacing: 1px;
  font-weight: bold;
}

.search-external-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.external-link-item {
  display: block;
  padding: 10px 12px;
  background: var(--paper-warm);
  border: 1px solid var(--gold);
  border-radius: 6px;
  color: var(--text-dark);
  text-decoration: none;
  font-size: 13px;
  text-align: center;
  transition: all 0.2s;
}

.external-link-item:hover {
  background: var(--primary);
  color: var(--gold-light);
  border-color: var(--primary-dark);
}

/* ============= 新闻卡片: 阅读提示 ============= */
.news-action {
  color: var(--primary);
  font-size: 11px;
  background: rgba(212, 175, 55, 0.15);
  padding: 2px 8px;
  border-radius: 10px;
  border: 1px solid var(--gold);
  letter-spacing: 0.5px;
}

.news-meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

/* 响应式:小屏阅读器全屏 */
@media (max-width: 600px) {
  .reader-container {
    width: 100%;
    max-width: 100%;
    height: 100vh;
    max-height: 100vh;
    border-radius: 0;
    border: none;
  }
  .reader-body {
    padding: 16px 18px 32px;
    font-size: 15px;
  }
  .reader-title { font-size: 20px; }
  .search-external-grid {
    grid-template-columns: 1fr;
  }
}

/* 桌面端优化 */
@media (min-width: 768px) {
  .search-external-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
