/* ============================================================
   数学智能助教 V3 - 共享样式
   主色调: #38B2AC
   ============================================================ */

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

:root {
  --primary: #38B2AC;
  --primary-light: #4FD1C5;
  --primary-dark: #2C9E98;
  --bg: #F5F7FA;
  --white: #ffffff;
  --text: #333333;
  --text-secondary: #718096;
  --border: #E2E8F0;
  --success: #48BB78;
  --warning: #ED8936;
  --danger: #F56565;
  --blue: #4A90E2;
  --shadow: 0 2px 12px rgba(0,0,0,0.08);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --radius: 16px;
  --radius-sm: 10px;
}

html, body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'PingFang SC', sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  max-width: 430px;
  margin: 0 auto;
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

.card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}
.card-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.page {
  display: none;
  padding: 20px;
  min-height: 100vh;
  padding-bottom: 90px;
}
.page.show { display: block; }

.page-header {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  padding: 20px;
  border-radius: 0 0 24px 24px;
  margin: -20px -20px 20px -20px;
  position: relative;
}
.page-header h1 { font-size: 22px; font-weight: 700; }
.page-header p { font-size: 13px; opacity: 0.85; margin-top: 4px; }
.back-btn {
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255,255,255,0.25);
  border: none;
  color: white;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-light));
  color: white;
  border: none;
  padding: 14px 24px;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
  touch-action: manipulation;
  transition: opacity 0.2s;
}
.btn-primary:active { opacity: 0.85; }

.btn-outline {
  background: white;
  color: var(--primary);
  border: 2px solid var(--primary);
  padding: 12px 24px;
  border-radius: var(--radius-sm);
  font-size: 15px;
  font-weight: 600;
  width: 100%;
  cursor: pointer;
  margin-top: 10px;
}

.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  max-width: 430px;
  margin: 0 auto;
  background: white;
  display: flex;
  border-top: 1px solid var(--border);
  padding: 8px 0;
  padding-bottom: env(safe-area-inset-bottom, 8px);
  z-index: 100;
}
.nav-item {
  flex: 1;
  text-align: center;
  padding: 6px 4px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  transition: color 0.2s;
}
.nav-icon { font-size: 22px; line-height: 1; }
.nav-text { font-size: 10px; color: var(--text-secondary); }
.nav-item.active .nav-icon,
.nav-item.active .nav-text { color: var(--primary); }

.tag { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 12px; font-weight: 500; }
.tag-green { background: #F0FFF4; color: #48BB78; }
.tag-orange { background: #FFFAF0; color: #ED8936; }
.tag-blue { background: #EBF8FF; color: #4A90E2; }

.loading-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(255,255,255,0.95);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 999;
}
.loading-spinner {
  width: 48px;
  height: 48px;
  border: 4px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-bottom: 16px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text { font-size: 15px; color: var(--text-secondary); }
.loading-sub { font-size: 12px; color: #A0AEC0; margin-top: 4px; }

.toast {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(-60px);
  background: rgba(0,0,0,0.8);
  color: white;
  padding: 10px 20px;
  border-radius: 24px;
  font-size: 14px;
  z-index: 9999;
  transition: transform 0.3s ease;
  pointer-events: none;
  white-space: nowrap;
}
.toast.show { transform: translateX(-50%) translateY(0); }

.divider { height: 1px; background: var(--border); margin: 12px 0; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--text-secondary); }
.empty-icon { font-size: 56px; margin-bottom: 12px; }
.empty-text { font-size: 14px; }

.gradient-bar {
  height: 4px;
  background: linear-gradient(90deg, var(--primary), var(--primary-light), #6B8AFF, #FF6B6B);
  border-radius: 2px;
  margin-bottom: 16px;
}

/* ===== V3.4: 年级确认弹窗 ===== */
#grade-confirm-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
#grade-confirm-overlay.show { display: flex; }
.gcc-card {
  background: white;
  border-radius: 20px;
  padding: 28px 24px;
  max-width: 340px;
  width: 100%;
  text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.gcc-icon { font-size: 48px; margin-bottom: 16px; }
.gcc-title { font-size: 18px; font-weight: 700; color: #2D3748; margin-bottom: 8px; }
.gcc-desc { font-size: 14px; color: #718096; line-height: 1.6; margin-bottom: 20px; }
.gcc-grade-box {
  background: #FFF5F5;
  border: 2px solid #FEB2B2;
  border-radius: 12px;
  padding: 12px;
  margin-bottom: 8px;
  font-size: 15px;
  color: #E53E3E;
}
.gcc-grade-box span { font-weight: 700; }
.gcc-vs { font-size: 12px; color: #A0AEC0; margin: 4px 0; }
.gcc-same-grade {
  background: #F0FFF4;
  border-color: #9AE6B4;
  color: #276749;
}
.gcc-btns { display: flex; gap: 10px; margin-top: 20px; }
.gcc-btn {
  flex: 1;
  padding: 13px;
  border-radius: 12px;
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.2s;
}
.gcc-btn-cancel { background: #F7FAFC; color: #718096; border: 2px solid #E2E8F0; }
.gcc-btn-cancel:active { background: #EDF2F7; }
.gcc-btn-confirm { background: linear-gradient(135deg, #38B2AC, #4FD1C5); color: white; }
.gcc-btn-confirm:active { opacity: 0.85; }
.gcc-note { font-size: 12px; color: #A0AEC0; margin-top: 12px; }
