/* ================================================================
   global.css — 全局共享样式
   变量、重置、排版、导航、按钮、通用组件、测验、总结、页脚、动画、响应式
   ================================================================ */

/* ===== 1. CSS 变量 ===== */
:root {
  --primary: #1e40af;
  --primary-light: #3b82f6;
  --cyan: #0891b2;
  --green: #22c55e;
  --green-dark: #166534;
  --orange: #f97316;
  --orange-dark: #92400e;
  --red: #ef4444;
  --gray: #64748b;
  --gray-light: #94a3b8;
  --gray-lighter: #e2e8f0;
  --bg: #f8fafc;
  --bg-alt: #f1f5f9;
  --text: #1e293b;
  --text-light: #475569;
  --radius: 8px;
  --shadow: 0 1px 3px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.06);
  --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.1), 0 4px 6px -4px rgba(0,0,0,0.1);
  --transition: 0.3s ease;
}

/* ===== 2. 重置与排版 ===== */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 60px;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.7;
  font-size: 16px;
}

/* ===== 3. 导航栏 ===== */
#navbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 100;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--gray-lighter);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2rem;
  height: 52px;
}

.nav-brand {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--primary);
}

.nav-brand a {
  text-decoration: none;
  color: inherit;
}

.nav-links {
  display: flex;
  gap: 0.3rem;
}

.nav-links a {
  text-decoration: none;
  color: var(--text-light);
  font-size: 0.85rem;
  padding: 0.35rem 0.7rem;
  border-radius: var(--radius);
  transition: var(--transition);
}

.nav-links a:hover {
  background: var(--gray-lighter);
  color: var(--primary);
}

/* ===== 4. 通用区块 ===== */
.section {
  padding: 4rem 1.5rem;
  min-height: 60vh;
}

.section-alt {
  background: var(--bg-alt);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
}

h2 {
  font-size: 1.75rem;
  color: var(--primary);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 3px solid var(--cyan);
  display: inline-block;
}

.key-point {
  background: #eff6ff;
  border-left: 4px solid var(--primary-light);
  padding: 0.75rem 1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
  color: var(--primary);
  font-weight: 500;
}

/* ===== 5. 两栏布局 ===== */
.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 2.5rem;
  align-items: start;
  margin-top: 1.5rem;
}

.col-text p { margin-bottom: 0.8rem; }
.col-text ul { margin: 0.5rem 0 1rem 1.2rem; }
.col-text li { margin-bottom: 0.4rem; }

.col-visual {
  position: sticky;
  top: 70px;
}

/* ===== 6. Hero 区 ===== */
.hero {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #0f172a 100%);
  color: white;
  text-align: center;
  padding-top: 52px;
}

.hero-content { max-width: 600px; }

.hero h1 {
  font-size: 2.5rem;
  margin-bottom: 1rem;
  line-height: 1.3;
}

.hero-sub {
  font-size: 1.15rem;
  opacity: 0.85;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.hero-objectives {
  text-align: left;
  background: rgba(255,255,255,0.1);
  border-radius: var(--radius);
  padding: 1.2rem 1.5rem;
  margin-bottom: 2rem;
}

.hero-objectives p {
  margin-bottom: 0.5rem;
  font-weight: 600;
  opacity: 0.9;
}

.hero-objectives ul { list-style: none; padding: 0; }

.hero-objectives li {
  padding: 0.25rem 0;
  opacity: 0.85;
}

.hero-objectives li::before {
  content: "\2713 ";
  color: var(--green);
  font-weight: bold;
}

/* ===== 7. 按钮 ===== */
.btn-primary {
  background: var(--primary-light);
  color: white;
  border: none;
  padding: 0.75rem 2rem;
  font-size: 1rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

.btn-primary:hover {
  background: var(--primary);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lg);
}

.btn-secondary {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary-light);
  padding: 0.5rem 1.5rem;
  font-size: 0.9rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 600;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--primary-light);
  color: white;
}

/* ===== 8. 信息卡片 ===== */
.info-card {
  background: white;
  border: 1px solid var(--gray-lighter);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  margin: 1rem 0;
  box-shadow: var(--shadow);
}

.info-card h3 {
  font-size: 0.95rem;
  color: var(--primary);
  margin-bottom: 0.5rem;
}

.info-card ul { margin: 0.3rem 0 0 1rem; }

/* ===== 9. 测验 ===== */
.quiz-item {
  background: white;
  border: 1px solid var(--gray-lighter);
  border-radius: var(--radius);
  padding: 1.2rem;
  margin-bottom: 1rem;
  box-shadow: var(--shadow);
}

.quiz-item p {
  font-weight: 600;
  margin-bottom: 0.6rem;
  font-size: 0.95rem;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.quiz-opt {
  background: var(--bg-alt);
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 0.55rem 1rem;
  cursor: pointer;
  font-size: 0.9rem;
  transition: var(--transition);
  text-align: left;
  width: 100%;
}

.quiz-opt:hover:not(.disabled) {
  border-color: var(--primary-light);
  background: #eff6ff;
}

.quiz-opt.correct {
  background: #dcfce7;
  border-color: var(--green);
  color: var(--green-dark);
}

.quiz-opt.wrong {
  background: #fef2f2;
  border-color: var(--red);
  color: #991b1b;
}

.quiz-opt.disabled { cursor: default; opacity: 0.7; }

.quiz-explain {
  margin-top: 0.5rem;
  padding: 0.5rem 0.8rem;
  background: #eff6ff;
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--text-light);
  display: none;
}

.quiz-explain.show { display: block; }

.quiz-result {
  text-align: center;
  margin-top: 1.5rem;
}

.quiz-result p {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
}

/* ===== 10. 总结 ===== */
.summary-box {
  background: white;
  border: 2px solid var(--cyan);
  border-radius: var(--radius);
  padding: 1.5rem 2rem;
  box-shadow: var(--shadow);
}

.summary-box ul { list-style: none; padding: 0; }

.summary-box li {
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--gray-lighter);
  font-size: 0.95rem;
  line-height: 1.6;
}

.summary-box li:last-child { border-bottom: none; }

.summary-box li::before {
  content: "\25B8 ";
  color: var(--cyan);
  font-weight: bold;
}

/* ===== 11. 页脚 ===== */
footer {
  text-align: center;
  padding: 2rem;
  font-size: 0.82rem;
  color: var(--gray);
  border-top: 1px solid var(--gray-lighter);
}

/* ===== 12. SVG 动画辅助 ===== */
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.pulse-anim {
  animation: pulse 1s ease-in-out infinite;
}

/* ===== 13. 响应式 ===== */
@media (max-width: 768px) {
  .two-col {
    grid-template-columns: 1fr;
    gap: 1.5rem;
  }
  .col-visual { position: static; }
  .hero h1 { font-size: 1.8rem; }
  .nav-links { display: none; }
  #navbar { justify-content: center; }
  .section { padding: 3rem 1rem; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 1.5rem; }
}
