/* 全局样式重置 */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* 根变量定义 */
:root {
  --primary-color: #3b82f6;
  --primary-hover: #2563eb;
  --success-color: #10b981;
  --bg-color: #ffffff;
  --text-primary: #111827;
  --text-secondary: #6b7280;
  --text-muted: #9ca3af;
  --border-color: #e5e7eb;
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --radius: 8px;
  --max-width: 800px;
}

/* 暗色模式支持 */
@media (prefers-color-scheme: dark) {
  :root {
    --bg-color: #f9fafb;
    --text-primary: #111827;
  }
}

/* 基础样式 */
html {
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
    'Microsoft YaHei', sans-serif;
  font-size: 16px;
  line-height: 1.6;
  color: var(--text-primary);
  background-color: var(--bg-color);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 容器 */
.container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
}

/* 导航栏样式 */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color);
  z-index: 1000;
  padding: 0;
}

.nav-container {
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 0 20px;
  display: flex;
  align-items: center;
  height: 64px;
  gap: 40px;
}

.nav-logo {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  text-decoration: none;
  transition: opacity 0.2s;
  margin-right: auto;
}

.nav-logo:hover {
  opacity: 0.8;
}

/* 导航菜单 */
.nav-menu {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-link {
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.2s;
  padding: 4px 0;
  position: relative;
}

.nav-link:hover {
  color: var(--primary-color);
}

.nav-link.active {
  color: var(--primary-color);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--primary-color);
  border-radius: 1px;
}

/* 按钮样式 */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 12px 32px;
  font-size: 16px;
  font-weight: 500;
  border-radius: var(--radius);
  border: none;
  cursor: pointer;
  transition: all 0.2s;
  text-decoration: none;
  min-height: 48px;
}

.btn-primary {
  background: var(--primary-color);
  color: white;
  box-shadow: var(--shadow-md);
}

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

.btn-secondary {
  background: white;
  color: var(--text-primary);
  border: 1px solid var(--border-color);
}

.btn-secondary:hover {
  background: #f9fafb;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* Hero 区域 */
.hero {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 80px 20px 60px;
}

.hero h1 {
  font-size: clamp(32px, 8vw, 56px);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 20px;
  color: var(--text-primary);
}

.hero .subtitle {
  font-size: clamp(18px, 3vw, 24px);
  color: var(--text-secondary);
  margin-bottom: 40px;
  max-width: 700px;
  line-height: 1.5;
  width: 100%;
  margin-left: auto;
  margin-right: auto;
}

/* 测试区域 */
.test-section {
  min-height: 100vh;
  padding: 100px 20px 60px;
  display: none;
}

.test-section.active {
  display: block;
}

/* 进度条 */
.progress-container {
  margin-bottom: 40px;
}

.progress-bar {
  height: 4px;
  background: var(--border-color);
  border-radius: 2px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: var(--primary-color);
  transition: width 0.3s ease;
}

.progress-text {
  font-size: 14px;
  color: var(--text-secondary);
  font-weight: 500;
}

/* 题目卡片 */
.question-card {
  background: white;
  border-radius: 16px;
  padding: 40px;
  box-shadow: var(--shadow-md);
  margin-bottom: 32px;
}

.question-number {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-color);
  margin-bottom: 16px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.question-text {
  font-size: 20px;
  line-height: 1.6;
  margin-bottom: 32px;
  color: var(--text-primary);
  font-weight: 500;
}

/* 选项布局 - 横向排列 */
.options-container {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 16px;
  margin-bottom: 40px;
}

.option-label {
  display: block;
  padding: 16px;
  background: #f9fafb;
  border: 2px solid var(--border-color);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  font-weight: 500;
  font-size: 15px;
  color: var(--text-primary);
}

.option-label:hover {
  border-color: var(--primary-color);
  background: #eff6ff;
}

.option-label.selected {
  border-color: var(--primary-color);
  background: var(--primary-color);
  color: white;
}

.option-label input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

/* 导航按钮 */
.test-nav {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 40px;
}

/* 加载状态 */
.loading {
  text-align: center;
  padding: 40px;
  color: var(--text-secondary);
}

.error {
  text-align: center;
  padding: 40px;
  color: #ef4444;
  background: #fef2f2;
  border-radius: var(--radius);
  margin: 20px 0;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .options-container {
    grid-template-columns: repeat(2, 1fr);
  }

  .question-card {
    padding: 24px;
  }

  .test-nav {
    flex-direction: column;
  }

  .btn {
    width: 100%;
  }

  .nav-container {
    gap: 20px;
  }

  .nav-menu {
    gap: 20px;
  }

  .nav-link {
    font-size: 14px;
  }

  .lang-container .lang-label {
    display: none;
  }
}

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

  .nav-menu {
    gap: 16px;
  }

  .nav-link {
    font-size: 13px;
  }

  .lang-select {
    min-width: 80px;
    font-size: 13px;
  }
}

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

  .nav-menu {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: white;
    flex-direction: column;
    gap: 0;
    padding: 0;
    box-shadow: var(--shadow-lg);
    border-bottom: 1px solid var(--border-color);
  }

  .nav-menu.active {
    display: flex;
  }

  .nav-link {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-color);
    font-size: 15px;
    border-radius: 0;
  }

  .nav-link:hover {
    background: #f9fafb;
  }

  .nav-link.active::after {
    display: none;
  }

  .lang-container {
    margin-left: auto;
  }

  /* 汉堡菜单按钮 */
  .nav-toggle {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 40px;
    height: 40px;
    cursor: pointer;
    margin-left: auto;
    margin-right: 10px;
  }

  .nav-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    margin: 3px 0;
    transition: 0.3s;
    transform-origin: center;
  }

  .nav-toggle.active span:nth-child(1) {
    transform: rotate(45deg) translate(5px, 5px);
  }

  .nav-toggle.active span:nth-child(2) {
    opacity: 0;
  }

  .nav-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -6px);
  }
}

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

.fade-in {
  animation: fadeIn 0.5s ease;
}

/* 焦点样式 */
.btn:focus,
.option-label:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* 语言选择器样式 */
.lang-select {
  padding: 6px 10px;
  border: 1px solid var(--border-color);
  border-radius: var(--radius);
  background: white;
  font-size: 14px;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.2s;
  min-width: 90px;
  height: 36px;
}

.lang-select:hover {
  border-color: var(--primary-color);
}

.lang-select:focus {
  outline: 2px solid var(--primary-color);
  outline-offset: 2px;
}

/* 语言切换器容器 */
.lang-container {
  display: flex;
  align-items: center;
  gap: 8px;
}

.lang-container .lang-label {
  font-size: 13px;
  color: var(--text-secondary);
  font-weight: 500;
}