/* ===== 首页专用样式 ===== */
/* 复用详情页变量体系，确保视觉一致 */

:root {
  --sprout: #7CB342;
  --sprout-dark: #558B2F;
  --sprout-deep: #33691E;
  --sprout-light: #AED581;
  --sprout-pale: #DCEDC8;
  --leaf-yellow: #CDDC39;
  --bg: #F5F9EF;
  --bg-warm: #FAFDF7;
  --card: #FFFFFF;
  --text: #2E3B24;
  --text-secondary: #6B7A5C;
  --text-muted: #9AAA8B;
  --border: #DCE8C8;
  --border-light: #E8F0DC;
  --shadow-sm: 0 2px 8px rgba(85, 139, 47, 0.08);
  --shadow-md: 0 4px 20px rgba(85, 139, 47, 0.12);
  --shadow-lg: 0 8px 40px rgba(85, 139, 47, 0.16);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --nav-h: 54px;
  --content-w: 680px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; overflow-x: hidden; }
body { font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif; background: #fff; color: var(--text); line-height: 1.7; overflow-x: hidden; }

h1, h2, h3, h4 { font-family: 'Noto Serif SC', serif; font-weight: 700; line-height: 1.35; }
a { text-decoration: none; color: inherit; }
img { max-width: 100%; display: block; }
button { cursor: pointer; border: none; background: none; font-family: inherit; }

/* ===== 顶部导航 ===== */
.quiz-topnav {
  position: sticky; top: 0; z-index: 100;
  background: rgba(85, 139, 47, 0.92);
  backdrop-filter: blur(10px); -webkit-backdrop-filter: blur(10px);
  height: var(--nav-h); display: flex; align-items: center;
  padding: 0 16px; color: #fff;
  max-width: var(--content-w); margin: 0 auto;
}
.quiz-topnav-brand {
  display: flex; align-items: center; gap: 8px;
  font-size: 16px; font-weight: 700; color: #fff;
  letter-spacing: 1px;
}
.quiz-topnav-brand .quiz-topnav-title {
  font-family: 'Noto Sans SC', sans-serif;
  font-size: 20px;
  font-weight: 700;
  color: #fff;
  letter-spacing: 1px;
  margin: 0;
}
.quiz-topnav-logo { width: 28px; height: 28px; }
.quiz-topnav-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.quiz-topnav-search {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.15); transition: background 0.2s;
}
.quiz-topnav-search:hover { background: rgba(255,255,255,0.28); }
.quiz-topnav-search svg { width: 18px; height: 18px; color: #fff; }
.quiz-topnav-menu {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: rgba(255,255,255,0.15); transition: background 0.2s;
}
.quiz-topnav-menu:hover { background: rgba(255,255,255,0.28); }
.quiz-topnav-menu svg { width: 20px; height: 20px; color: #fff; }

/* ===== 搜索弹窗 ===== */
.quiz-search-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.5);
  backdrop-filter: blur(4px);
}
.quiz-search-overlay.quiz-active {
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 120px;
}
.quiz-search-modal {
  background: #fff;
  border-radius: var(--radius-md);
  padding: 24px;
  width: 90%; max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.quiz-search-modal form { display: flex; gap: 8px; }
.quiz-search-input {
  flex: 1;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-family: 'Noto Sans SC', sans-serif;
  outline: none;
  transition: border-color 0.2s;
}
.quiz-search-input:focus { border-color: var(--sprout); }
.quiz-search-btn {
  padding: 12px 20px;
  background: linear-gradient(135deg, var(--sprout), var(--sprout-dark));
  color: #fff; font-size: 14px; font-weight: 600;
  border-radius: var(--radius-sm);
  white-space: nowrap;
  cursor: pointer; border: none;
}

/* ===== 汉堡菜单 ===== */
.quiz-nav-overlay {
  display: none;
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.4);
}
.quiz-nav-overlay.quiz-active { display: block; }
.quiz-nav-panel {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 260px; max-width: 80vw;
  background: #fff;
  box-shadow: -4px 0 20px rgba(0,0,0,0.15);
  padding: 20px;
  transform: translateX(100%);
  transition: transform 0.3s ease;
}
.quiz-nav-overlay.quiz-active .quiz-nav-panel { transform: translateX(0); }
.quiz-nav-header {
  display: flex; align-items: center; justify-content: space-between;
  padding-bottom: 16px; margin-bottom: 12px;
  border-bottom: 1px solid var(--border-light);
}
.quiz-nav-header span { font-size: 18px; font-weight: 700; color: var(--sprout-deep); font-family: 'Noto Serif SC', serif; }
.quiz-nav-close { width: 32px; height: 32px; display: flex; align-items: center; justify-content: center; border-radius: 50%; background: var(--bg); }
.quiz-nav-close svg { width: 18px; height: 18px; color: var(--text-secondary); }
.quiz-nav-links { display: flex; flex-direction: column; gap: 4px; }
.quiz-nav-links a {
  display: block;
  padding: 12px 8px;
  font-size: 15px; color: var(--text);
  border-radius: var(--radius-sm);
  transition: background 0.2s;
}
.quiz-nav-links a:hover { background: var(--bg); color: var(--sprout-dark); }

/* ===== Banner 轮播 ===== */
.quiz-banner {
  position: relative;
  width: 100%; max-width: var(--content-w);
  margin: 0 auto;
  overflow: hidden;
  background: var(--bg);
}
.quiz-banner-container {
  display: flex;
  transition: transform 0.5s ease;
}
.quiz-banner-slide {
  flex: 0 0 100%;
  position: relative;
  display: block;
  overflow: hidden;
}
.quiz-banner-slide:first-child {
  opacity: 1; visibility: visible;
}
.quiz-banner-slide img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  display: block;
}
.quiz-banner-info {
  position: absolute; bottom: 0; left: 0; right: 0;
  padding: 40px 16px 16px;
  background: linear-gradient(transparent, rgba(46, 59, 36, 0.75));
  color: #fff;
}
.quiz-banner-info h2 {
  font-size: 18px; font-weight: 700;
  margin-bottom: 4px; text-shadow: 0 1px 3px rgba(0,0,0,0.3);
}
.quiz-banner-info p {
  font-size: 13px; opacity: 0.9;
  line-height: 1.5;
}
.quiz-banner-dots {
  position: absolute;
  bottom: 8px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: center;
  gap: 8px;
  z-index: 10;
  padding: 0;
  background: none;
}
.quiz-banner-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.55);
  border: 1px solid rgba(255,255,255,0.25);
  transition: background 0.3s, transform 0.3s;
  cursor: pointer;
  padding: 0;
}
.quiz-banner-dot.quiz-active {
  background: rgba(255,255,255,0.95);
  transform: scale(1.3);
  border-color: rgba(255,255,255,0.5);
}

/* ===== Tab 切换 ===== */
.quiz-tab-section {
  max-width: var(--content-w); margin: 0 auto;
  background: var(--bg);
}
.quiz-tab-bar {
  display: flex;
  justify-content: center;
  gap: 8px;
  border-bottom: 2px solid var(--border-light);
  background: #fff;
  position: sticky; top: var(--nav-h); z-index: 50;
  padding: 0 16px;
}
.quiz-tab-btn {
  padding: 14px 20px;
  font-size: 15px; font-weight: 600;
  color: var(--text-muted);
  text-align: center;
  position: relative;
  transition: color 0.3s;
  cursor: pointer; border: none; background: none;
  white-space: nowrap;
  display: flex; align-items: center; gap: 4px;
}
.quiz-tab-btn:empty { display: none; }
.quiz-tab-btn .quiz-tab-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  line-height: 1;
  pointer-events: none;
}
.quiz-tab-badge-featured { filter: drop-shadow(0 0 1px rgba(255,160,0,0.3)); }
.quiz-tab-badge-hot { filter: drop-shadow(0 0 1px rgba(229,57,53,0.3)); }

.quiz-tab-btn.quiz-active {
  color: var(--sprout-dark);
}
.quiz-tab-btn.quiz-active::after {
  content: '';
  position: absolute; bottom: -2px; left: 10%; right: 10%;
  height: 3px;
  background: linear-gradient(90deg, var(--sprout), var(--sprout-dark));
  border-radius: 2px;
}

/* ===== Tab 面板 ===== */
.quiz-tab-panel {
  display: none;
  padding: 20px 16px 16px;
}
.quiz-tab-panel.quiz-active { display: block; }

/* ===== 测试列表 ===== */
.quiz-test-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.quiz-test-card {
  display: block;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.25s, box-shadow 0.25s;
  overflow: hidden;
}
.quiz-test-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.quiz-test-thumb {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 16 / 9;
  overflow: hidden;
}
.quiz-test-thumb img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.quiz-test-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 2px 8px;
  background: var(--sprout);
  color: #fff;
  font-size: 11px;
  font-weight: 600;
  border-radius: 4px;
  line-height: 1.4;
}
.quiz-test-badge:empty { display: none; }
.quiz-test-body {
  padding: 10px 12px 12px;
}
.quiz-test-name {
  font-size: 16px; font-weight: 600;
  color: var(--text); line-height: 1.5;
  margin-bottom: 12px;
  text-align: center;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.quiz-test-btn {
  display: block;
  text-align: center;
  padding: 6px 0;
  margin: 0 auto 10px;
  width: 60%;
  background: linear-gradient(135deg, var(--sprout), var(--sprout-dark));
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  user-select: none;
  border: none;
  font-family: inherit;
}
.quiz-test-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
}
.quiz-test-meta .quiz-meta-count {
  color: var(--text-muted);
}
.quiz-test-meta .quiz-meta-people {
  color: var(--text-secondary);
}

/* ===== 查看更多按钮 ===== */
.quiz-view-more {
  text-align: center;
  padding: 24px 16px 24px;
}
.quiz-btn-more {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 28px;
  border: 1px solid var(--sprout);
  color: var(--sprout-dark);
  font-size: 15px;
  font-weight: 400;
  border-radius: var(--radius-md);
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.quiz-btn-more::after {
  content: '';
  display: inline-block;
  width: 6px;
  height: 6px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(-45deg);
  transition: transform 0.2s;
}
.quiz-btn-more:hover {
  border-color: var(--sprout-dark);
  color: var(--sprout-deep);
  background: rgba(124,179,66,0.06);
}
.quiz-btn-more:hover::after {
  transform: rotate(-45deg) translateX(2px);
}

/* ===== Footer ===== */
.quiz-footer {
  background: #4A6B2E;
  color: rgba(255, 255, 255, 0.85);
  padding: 24px 16px calc(14px + env(safe-area-inset-bottom));
  margin-top: 0;
  max-width: var(--content-w); margin-left: auto; margin-right: auto;
}
.quiz-footer-inner { max-width: 100%; }
.quiz-footer-brand {
  display: flex; align-items: center; gap: 8px; margin-bottom: 12px;
}
.quiz-footer-brand svg { width: 28px; height: 28px; }
.quiz-footer-brand span { font-family: 'Noto Serif SC', serif; font-size: 18px; font-weight: 700; color: #fff; }
.quiz-footer-desc { font-size: 13px; line-height: 1.8; color: rgba(255,255,255,0.6); margin-bottom: 14px; }
.quiz-footer-bottom { font-size: 12px; color: rgba(255,255,255,0.45); text-align: center; }
.quiz-footer-icp { margin-top: 4px; font-size: 11px; color: rgba(255,255,255,0.35); }

/* ===== 平板适配 ===== */
@media (min-width: 768px) {
  :root { --content-w: 760px; }
  .quiz-banner-slide img { aspect-ratio: 16 / 9; }
  .quiz-banner-info h2 { font-size: 22px; }
  .quiz-banner-info p { font-size: 14px; }
  .quiz-tab-bar { gap: 12px; }
  .quiz-tab-btn { font-size: 16px; padding: 16px 24px; }
  .quiz-tab-btn .quiz-tab-badge { font-size: 14px; }
  .quiz-test-list { grid-template-columns: repeat(2, 1fr); gap: 16px; }
  .quiz-test-body { padding: 12px 14px 14px; }
  .quiz-test-name { font-size: 15px; text-align: center; }
  .quiz-test-btn { font-size: 14px; padding: 7px 0; margin: 0 auto 6px; width: 80%; }
  .quiz-test-meta { font-size: 13px; }
  .quiz-footer { padding: 28px 24px 16px; }
}

/* ===== 桌面适配 ===== */
@media (min-width: 1024px) {
  :root { --content-w: 820px; }
  .quiz-banner-slide img { aspect-ratio: 16 / 9; }
  .quiz-banner-info { padding: 50px 24px 20px; }
  .quiz-banner-info h2 { font-size: 24px; }
  .quiz-tab-bar { gap: 16px; }
  .quiz-tab-btn { font-size: 17px; padding: 18px 28px; }
  .quiz-test-list { grid-template-columns: repeat(2, 1fr); gap: 20px; }
  .quiz-test-body { padding: 14px 16px 16px; }
  .quiz-test-name { font-size: 15px; text-align: center; }
  .quiz-test-btn { font-size: 16px; padding: 8px 0; margin: 0 auto 6px; width: 60%; }
}
