/* ===================================================
   style.css - 大学专业兴趣天赋测评
   蓝白渐变主题，移动优先，圆角 16px
   =================================================== */

/* --- Reset & Base --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --primary: #4A90D9;
  --primary-dark: #2C6DB5;
  --primary-light: #E8F0FE;
  --gradient-start: #4A90D9;
  --gradient-end: #7BB3E8;
  --gradient-bg: linear-gradient(135deg, #E8F0FE 0%, #F5F9FF 100%);
  --white: #FFFFFF;
  --text-primary: #1A2A3A;
  --text-secondary: #5A6A7A;
  --text-muted: #8A9AAA;
  --card-shadow: 0 4px 20px rgba(74, 144, 217, 0.12);
  --card-radius: 16px;
  --border-color: #E0EAF5;
  --success: #34C759;
  --warning: #FF9500;
  --danger: #FF3B30;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "PingFang SC", "Microsoft YaHei", sans-serif;
  background: var(--gradient-bg);
  color: var(--text-primary);
  min-height: 100vh;
  line-height: 1.6;
}

/* --- Page Container --- */
.page {
  display: none;
  min-height: 100vh;
  padding: 20px 16px 80px;
  max-width: 480px;
  margin: 0 auto;
  flex-direction: column;
  align-items: center;
}

.page.active {
  display: flex;
}

/* --- Welcome Page --- */
#welcome-page {
  justify-content: center;
  text-align: center;
  padding-top: 40px;
}

.logo-icon {
  width: 80px;
  height: 80px;
  background: var(--gradient-start);
  border-radius: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
  box-shadow: 0 8px 24px rgba(74, 144, 217, 0.3);
}

.logo-icon svg {
  width: 44px;
  height: 44px;
  fill: white;
}

.welcome-title {
  font-size: 26px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 12px;
  line-height: 1.3;
}

.welcome-subtitle {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 32px;
  line-height: 1.5;
}

.feature-list {
  list-style: none;
  text-align: left;
  width: 100%;
  max-width: 320px;
  margin-bottom: 32px;
}

.feature-list li {
  padding: 10px 0;
  font-size: 14px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 10px;
}

.feature-list li::before {
  content: '';
  width: 8px;
  height: 8px;
  min-width: 8px;
  background: var(--primary);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

.price-badge {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: white;
  padding: 6px 20px;
  border-radius: 20px;
  font-size: 20px;
  font-weight: 700;
  display: inline-block;
  margin-bottom: 24px;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  max-width: 320px;
  padding: 14px 24px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  text-decoration: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  color: white;
  box-shadow: 0 4px 16px rgba(74, 144, 217, 0.3);
}

.btn-primary:active {
  transform: scale(0.97);
  box-shadow: 0 2px 8px rgba(74, 144, 217, 0.2);
}

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

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

.btn-outline:active {
  background: var(--primary-light);
}

.btn-success {
  background: linear-gradient(135deg, #34C759, #28A745);
  color: white;
  box-shadow: 0 4px 16px rgba(52, 199, 89, 0.3);
}

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

/* --- Quiz Page --- */
.quiz-header {
  width: 100%;
  margin-bottom: 24px;
}

.progress-container {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 8px;
}

.progress-bar-bg {
  flex: 1;
  height: 8px;
  background: var(--border-color);
  border-radius: 4px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gradient-start), var(--gradient-end));
  border-radius: 4px;
  transition: width 0.4s ease;
}

.progress-text {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
  white-space: nowrap;
}

.dimension-tag {
  display: inline-block;
  font-size: 12px;
  color: var(--primary);
  background: var(--primary-light);
  padding: 3px 12px;
  border-radius: 12px;
  font-weight: 500;
}

/* --- Question Card --- */
.question-card {
  width: 100%;
  background: var(--white);
  border-radius: var(--card-radius);
  padding: 28px 20px;
  box-shadow: var(--card-shadow);
  margin-bottom: 20px;
}

.question-number {
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
  font-weight: 500;
}

.question-text {
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
  margin-bottom: 24px;
}

/* --- Options --- */
.options-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-item {
  width: 100%;
  padding: 14px 16px;
  border: 2px solid var(--border-color);
  border-radius: 12px;
  background: var(--white);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 15px;
  color: var(--text-primary);
  text-align: left;
  line-height: 1.4;
}

.option-item:active {
  transform: scale(0.98);
}

.option-item.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--primary-dark);
  font-weight: 500;
}

/* --- Preview / Result Pages --- */
.result-code-display {
  width: 100%;
  text-align: center;
  margin-bottom: 24px;
}

.result-code {
  font-size: 48px;
  font-weight: 800;
  background: linear-gradient(135deg, var(--gradient-start), var(--gradient-end));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  letter-spacing: 8px;
}

.result-label {
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* --- Major Cards --- */
.major-card {
  width: 100%;
  background: var(--white);
  border-radius: var(--card-radius);
  padding: 20px;
  box-shadow: var(--card-shadow);
  margin-bottom: 12px;
}

#preview-major-container,
#result-majors-container {
  width: 100%;
  padding: 0 20px;
  box-sizing: border-box;
}

.major-card.locked {
  position: relative;
  overflow: hidden;
}

.major-card.locked::after {
  content: '🔒';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 20px;
  opacity: 0.5;
}

.major-card.locked .major-reason {
  filter: blur(4px);
  user-select: none;
}

.major-name {
  font-size: 17px;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.major-category {
  font-size: 13px;
  color: var(--primary);
  background: var(--primary-light);
  display: inline-block;
  padding: 2px 10px;
  border-radius: 8px;
  margin-bottom: 8px;
}

.major-reason {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.5;
}

/* --- Pay Wall --- */
.pay-wall {
  width: 100%;
  background: var(--white);
  border-radius: var(--card-radius);
  padding: 32px 20px;
  box-shadow: var(--card-shadow);
  text-align: center;
  margin: 20px 0;
}

.pay-wall-icon {
  font-size: 40px;
  margin-bottom: 12px;
}

.pay-wall-title {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 8px;
}

.pay-wall-desc {
  font-size: 14px;
  color: var(--text-secondary);
  margin-bottom: 20px;
  line-height: 1.5;
}

/* --- Loading / Toast --- */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(255,255,255,0.85);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 12px;
}

.loading-overlay.active {
  display: flex;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid var(--border-color);
  border-top: 4px solid var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

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

.toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 14px;
  z-index: 1100;
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
  max-width: 320px;
  text-align: center;
}

.toast.show {
  opacity: 1;
}

/* --- Footer --- */
.footer-note {
  width: 100%;
  text-align: center;
  font-size: 12px;
  color: var(--text-muted);
  padding: 16px 0;
  margin-top: auto;
}

/* --- Utility --- */
.mt-16 { margin-top: 16px; }
.mt-24 { margin-top: 24px; }
.mb-16 { margin-bottom: 16px; }
.w-full { width: 100%; }
.text-center { text-align: center; }
.gap-12 { gap: 12px; }
.flex-col { display: flex; flex-direction: column; align-items: center; }

/* --- Manual refresh button --- */
.btn-small {
  padding: 8px 16px;
  font-size: 13px;
  border-radius: 8px;
  max-width: 200px;
}

/* --- Responsive --- */
@media (min-width: 768px) {
  .page {
    max-width: 560px;
  }
}
