/* ========================================
   27山东理工机械刷题网 - 样式表
   ======================================== */

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

:root {
  --primary: #1e88e5;
  --primary-dark: #1565c0;
  --primary-light: #42a5f5;
  --bg-gradient-start: #0d47a1;
  --bg-gradient-end: #1976d2;
  --card-bg: rgba(255, 255, 255, 0.95);
  --text-dark: #1a237e;
  --text-gray: #666;
  --text-light: #999;
  --success: #43a047;
  --error: #e53935;
  --warning: #fb8c00;
}

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ========================================
   动态齿轮背景
   ======================================== */
.gear-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.gear {
  position: absolute;
  opacity: 0.08;
  fill: #fff;
}

.gear-1 {
  width: 300px;
  top: -80px;
  left: -80px;
  animation: spin 20s linear infinite;
}

.gear-2 {
  width: 200px;
  top: 20%;
  right: -50px;
  animation: spin-reverse 15s linear infinite;
}

.gear-3 {
  width: 400px;
  bottom: -120px;
  left: 10%;
  animation: spin 30s linear infinite;
}

.gear-4 {
  width: 150px;
  bottom: 10%;
  right: 15%;
  animation: spin-reverse 12s linear infinite;
}

.gear-5 {
  width: 100px;
  top: 40%;
  left: 5%;
  animation: spin 18s linear infinite;
}

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

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

/* ========================================
   激活页面
   ======================================== */
.activation-page {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
  background: linear-gradient(135deg, var(--bg-gradient-start) 0%, var(--bg-gradient-end) 100%);
}

.activation-page.hidden {
  display: none;
}

.activation-card {
  background: var(--card-bg);
  border-radius: 20px;
  padding: 40px 36px;
  width: 90%;
  max-width: 400px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  text-align: center;
  position: relative;
  z-index: 1;
}

.activation-icon {
  width: 72px;
  height: 72px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 0 auto 20px;
  animation: pulse 2s ease-in-out infinite;
}

.activation-icon svg {
  width: 40px;
  height: 40px;
  fill: #fff;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.activation-title {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 8px;
}

.activation-subtitle {
  font-size: 14px;
  color: var(--text-gray);
  margin-bottom: 28px;
}

.activation-input-wrap {
  margin-bottom: 20px;
  text-align: left;
}

.activation-label {
  font-size: 13px;
  color: var(--text-gray);
  margin-bottom: 8px;
  display: block;
}

.activation-input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.3s;
  font-family: inherit;
}

.activation-input:focus {
  border-color: var(--primary);
}

.activation-btn {
  width: 100%;
  padding: 14px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  font-family: inherit;
}

.activation-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(30, 136, 229, 0.4);
}

.activation-footer {
  margin-top: 24px;
  font-size: 13px;
  color: var(--text-light);
}

.activation-error {
  color: var(--error);
  font-size: 13px;
  margin-bottom: 12px;
  min-height: 18px;
}

/* ========================================
   主应用布局
   ======================================== */
.app-container {
  position: relative;
  z-index: 1;
  max-width: 800px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 80px;
}

/* 顶部标题栏 */
.app-header {
  padding: 20px 20px 16px;
  color: #fff;
}

.app-header h1 {
  font-size: 22px;
  font-weight: 700;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
}

.app-header p {
  font-size: 13px;
  opacity: 0.85;
  margin-top: 4px;
}

/* ========================================
   底部导航栏
   ======================================== */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: #fff;
  display: flex;
  justify-content: space-around;
  padding: 10px 0;
  padding-bottom: calc(10px + env(safe-area-inset-bottom));
  box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.1);
  z-index: 999;
}

.nav-item {
  flex: 1;
  text-align: center;
  cursor: pointer;
  padding: 6px 0;
  color: var(--text-light);
  transition: color 0.3s;
  user-select: none;
}

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

.nav-icon {
  width: 26px;
  height: 26px;
  margin-bottom: 4px;
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.nav-label {
  font-size: 12px;
}

/* ========================================
   页面容器
   ======================================== */
.page {
  display: none;
  padding: 0 16px;
  animation: fadeIn 0.3s ease;
}

.page.active {
  display: block;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ========================================
   倒计时卡片 (首页)
   ======================================== */
.countdown-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 16px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
  text-align: center;
}

.countdown-label {
  font-size: 14px;
  color: var(--text-gray);
  margin-bottom: 12px;
}

.countdown-timer {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-bottom: 8px;
}

.countdown-unit {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  padding: 12px 14px;
  border-radius: 10px;
  min-width: 70px;
}

.countdown-num {
  font-size: 26px;
  font-weight: 700;
  display: block;
  line-height: 1;
}

.countdown-text {
  font-size: 11px;
  opacity: 0.9;
  margin-top: 4px;
}

.countdown-target {
  font-size: 12px;
  color: var(--text-light);
  margin-top: 8px;
}

/* ========================================
   卡片通用样式
   ======================================== */
.section-title {
  font-size: 16px;
  font-weight: 600;
  color: #fff;
  margin: 20px 4px 12px;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 8px;
}

.section-title::before {
  content: '';
  width: 4px;
  height: 16px;
  background: #fff;
  border-radius: 2px;
}

/* 模考卡片 */
.mock-card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 18px;
  margin-bottom: 12px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  transition: transform 0.2s;
}

.mock-card:active {
  transform: scale(0.98);
}

.mock-info h3 {
  font-size: 16px;
  color: var(--text-dark);
  margin-bottom: 6px;
}

.mock-meta {
  font-size: 12px;
  color: var(--text-gray);
}

.mock-meta span {
  margin-right: 12px;
}

.mock-status {
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 12px;
  margin-right: 8px;
}

.status-not-started { background: #e3f2fd; color: var(--primary); }
.status-in-progress { background: #fff3e0; color: var(--warning); }
.status-completed { background: #e8f5e9; color: var(--success); }

.mock-btns {
  display: flex;
  align-items: center;
}

.btn-start {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  border: none;
  padding: 10px 18px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-start:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(30, 136, 229, 0.3);
}

/* ========================================
   刷题模块 - 章节卡片
   ======================================== */
.chapter-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.chapter-card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 20px 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  min-height: 110px;
}

.chapter-card:active {
  transform: scale(0.97);
}

.chapter-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 12px;
}

.chapter-icon svg {
  width: 26px;
  height: 26px;
}

.chapter-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 6px;
  line-height: 1.3;
}

.chapter-desc {
  font-size: 12px;
  color: var(--text-gray);
}

/* 章节图标颜色 */
.icon-color-1 { background: #e3f2fd; }
.icon-color-1 svg { fill: #1e88e5; }
.icon-color-2 { background: #f3e5f5; }
.icon-color-2 svg { fill: #8e24aa; }
.icon-color-3 { background: #fff3e0; }
.icon-color-3 svg { fill: #f57c00; }
.icon-color-4 { background: #e8f5e9; }
.icon-color-4 svg { fill: #43a047; }
.icon-color-5 { background: #ffebee; }
.icon-color-5 svg { fill: #e53935; }
.icon-color-6 { background: #e0f7fa; }
.icon-color-6 svg { fill: #00838f; }
.icon-color-7 { background: #fce4ec; }
.icon-color-7 svg { fill: #c2185b; }
.icon-color-8 { background: #ede7f6; }
.icon-color-8 svg { fill: #5e35b1; }
.icon-color-9 { background: #fff8e1; }
.icon-color-9 svg { fill: #f9a825; }
.icon-color-10 { background: #e0f2f1; }
.icon-color-10 svg { fill: #00695c; }
.icon-color-11 { background: #f1f8e9; }
.icon-color-11 svg { fill: #558b2f; }

/* ========================================
   答题页面
   ======================================== */
.question-header {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 16px 20px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.question-header-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
}

.question-progress {
  font-size: 13px;
  color: var(--text-gray);
}

.question-card {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 24px 20px;
  margin-bottom: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.question-type {
  display: inline-block;
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 10px;
  margin-bottom: 14px;
  background: #e3f2fd;
  color: var(--primary);
}

.question-text {
  font-size: 15px;
  color: #333;
  line-height: 1.8;
  margin-bottom: 20px;
  font-weight: 500;
}

/* 填空输入框 */
.answer-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 15px;
  outline: none;
  transition: border-color 0.3s;
  font-family: inherit;
  resize: vertical;
  min-height: 48px;
}

.answer-input:focus {
  border-color: var(--primary);
}

.answer-input.correct {
  border-color: var(--success);
  background: #e8f5e9;
}

.answer-input.wrong {
  border-color: var(--error);
  background: #ffebee;
}

/* 答案解析 */
.answer-result {
  margin-top: 16px;
  padding: 14px;
  border-radius: 10px;
  display: none;
}

.answer-result.show {
  display: block;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-correct {
  background: #e8f5e9;
  border: 1px solid #a5d6a7;
}

.result-wrong {
  background: #ffebee;
  border: 1px solid #ef9a9a;
}

.result-title {
  font-weight: 600;
  font-size: 14px;
  margin-bottom: 8px;
}

.result-correct .result-title { color: var(--success); }
.result-wrong .result-title { color: var(--error); }

.standard-answer {
  font-size: 14px;
  color: #333;
  margin-bottom: 8px;
}

.explanation {
  font-size: 13px;
  color: var(--text-gray);
  line-height: 1.7;
  background: rgba(255, 255, 255, 0.7);
  padding: 10px;
  border-radius: 8px;
  margin-top: 8px;
}

/* 操作按钮 */
.action-buttons {
  display: flex;
  gap: 10px;
  margin-top: 16px;
}

.btn {
  flex: 1;
  padding: 12px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  font-family: inherit;
  transition: transform 0.15s;
}

.btn:active { transform: scale(0.97); }

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
}

.btn-secondary {
  background: #f5f5f5;
  color: var(--text-dark);
}

.btn-outline {
  background: transparent;
  border: 1.5px solid var(--primary);
  color: var(--primary);
}

/* ========================================
   错题本
   ======================================== */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: rgba(255, 255, 255, 0.9);
}

.empty-state-icon {
  width: 80px;
  height: 80px;
  opacity: 0.6;
  margin-bottom: 16px;
}

.empty-state p {
  font-size: 15px;
}

.wrong-list {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.wrong-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.wrong-count {
  font-size: 13px;
  color: var(--text-gray);
}

.btn-text {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

/* 顶部返回按钮 */
.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(255, 255, 255, 0.2);
  border: none;
  color: #fff;
  padding: 8px 14px;
  border-radius: 20px;
  font-size: 14px;
  cursor: pointer;
  margin-bottom: 16px;
  font-family: inherit;
  transition: background 0.2s;
}

.back-btn:hover {
  background: rgba(255, 255, 255, 0.3);
}

.back-btn svg {
  width: 18px;
  height: 18px;
  fill: #fff;
}

/* 进度条 */
.progress-bar {
  width: 100%;
  height: 6px;
  background: #eee;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 16px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-dark));
  border-radius: 3px;
  transition: width 0.3s ease;
}

/* ========================================
   模拟考试模式
   ======================================== */
.mock-timer {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #e3f2fd;
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-dark);
}

.mock-timer svg {
  width: 16px;
  height: 16px;
  fill: var(--primary-dark);
}

.mock-timer.warning {
  background: #fff3e0;
  color: #e65100;
}

.mock-timer.warning svg {
  fill: #e65100;
}

/* 模考答题卡 */
.answer-sheet {
  background: var(--card-bg);
  border-radius: 14px;
  padding: 20px;
  margin-top: 14px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.answer-sheet-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dark);
  margin-bottom: 14px;
}

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

.answer-grid button {
  aspect-ratio: 1;
  border-radius: 8px;
  border: 1px solid #ddd;
  background: #fafafa;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.15s;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 2px 0;
  line-height: 1.1;
}

.answer-grid button.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
}

.answer-grid button.answered {
  background: #e8f5e9;
  color: var(--success);
  border-color: #a5d6a7;
}

/* 成绩结果页 */
.score-card {
  background: var(--card-bg);
  border-radius: 16px;
  padding: 32px 24px;
  text-align: center;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
  margin-bottom: 16px;
}

.score-number {
  font-size: 64px;
  font-weight: 700;
  color: var(--primary);
  margin-bottom: 8px;
  line-height: 1;
}

.score-label {
  font-size: 14px;
  color: var(--text-gray);
  margin-bottom: 16px;
}

.score-stats {
  display: flex;
  justify-content: space-around;
  border-top: 1px solid #eee;
  padding-top: 16px;
}

.score-stat-item {
  text-align: center;
}

.score-stat-num {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-dark);
}

.score-stat-label {
  font-size: 12px;
  color: var(--text-gray);
  margin-top: 2px;
}

/* 底部提示条 */
.tip-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background: rgba(0, 0, 0, 0.85);
  color: #fff;
  text-align: center;
  padding: 8px;
  font-size: 12px;
  z-index: 100;
}

/* ========================================
   响应式
   ======================================== */
@media (max-width: 400px) {
  .chapter-grid {
    grid-template-columns: 1fr;
  }
  
  .countdown-unit {
    min-width: 56px;
    padding: 10px 8px;
  }
  
  .countdown-num {
    font-size: 20px;
  }
}

/* 隐藏/显示 */
.hidden { display: none !important; }
