/* ============================================
   SBTI - 基于 sbti.unun.dev 设计风格
   ============================================ */

:root {
  --bg: #f6faf6;
  --panel: #ffffff;
  --text: #1e2a22;
  --muted: #6a786f;
  --line: #dbe8dd;
  --soft: #edf6ef;
  --accent: #6c8d71;
  --accent-strong: #4d6a53;
  --shadow: 0 16px 40px rgba(47, 73, 55, 0.08);
  --radius: 22px;
}

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

body {
  font-family: 'Noto Sans SC', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.app { min-height: 100vh; }

.page { display: none; min-height: 100vh; }
.page:first-of-type { display: block; }

/* ========== ANIMATIONS ========== */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}
@keyframes orbPulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.1); }
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

.fadeIn { animation: fadeIn 0.4s ease-out; }

/* ========== LANDING ========== */
#landingPage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
  background: var(--bg);
  position: relative;
  overflow: hidden;
}

.landing-bg {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.floating-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  justify-content: center;
  padding: 24px;
  opacity: 0.6;
}

.tag {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 8px 18px;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  animation: float 4s ease-in-out infinite;
  box-shadow: var(--shadow);
}
.tag:nth-child(2n) { animation-delay: -1s; }
.tag:nth-child(3n) { animation-delay: -2s; }

.landing-content {
  max-width: 560px;
  text-align: center;
  position: relative;
  z-index: 1;
  animation: fadeInUp 0.6s ease-out;
}

.landing-pretitle {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 20px;
  letter-spacing: 1px;
}

.landing-title {
  font-size: clamp(32px, 6vw, 52px);
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 16px;
}

.gradient-text {
  background: linear-gradient(135deg, var(--accent), #4d8c60);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.landing-subtitle {
  font-size: 16px;
  color: var(--muted);
  font-family: 'Inter', sans-serif;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.landing-desc {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.7;
  margin-bottom: 28px;
}

.landing-meta {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 36px;
}

.meta-tag {
  background: var(--soft);
  border-radius: 100px;
  padding: 6px 14px;
  font-size: 13px;
  color: var(--accent-strong);
  font-weight: 500;
}

.btn-start {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 100px;
  padding: 16px 40px;
  font-size: 17px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(108, 141, 113, 0.35);
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-start:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 32px rgba(108, 141, 113, 0.45);
}

.disclaimer {
  margin-top: 20px;
  font-size: 12px;
  color: var(--muted);
}

/* ========== QUIZ ========== */
#quizPage {
  max-width: 640px;
  margin: 0 auto;
  padding: 20px 20px 40px;
  background: var(--bg);
}

.quiz-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.quiz-header-top {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  margin-bottom: 10px;
}

.quiz-header-bottom {
  width: 100%;
  height: 8px;
  background: var(--line);
  border-radius: 100px;
  overflow: hidden;
}

.btn-back {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text);
  transition: var(--transition);
  flex-shrink: 0;
}
.btn-back:hover { background: var(--soft); }

.progress-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

#progressText {
  font-size: 15px;
  font-weight: 700;
  font-family: 'Inter', sans-serif;
  color: var(--text);
}

.dim-tag {
  font-size: 12px;
  color: var(--muted);
}

.progress-bar-wrapper {
  height: 100%;
  width: 100%;
  background: var(--line);
  border-radius: 100px;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), #4d8c60);
  border-radius: 100px;
  width: 0%;
  transition: width 0.4s ease-out;
}

/* Question Card */
.question-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 28px 28px 24px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.question-text {
  font-size: 16px;
  line-height: 1.75;
  color: var(--text);
  white-space: pre-wrap;
}

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

.option-btn {
  display: flex;
  align-items: center;
  gap: 14px;
  background: var(--panel);
  border: 2px solid var(--line);
  border-radius: 16px;
  padding: 16px 20px;
  font-size: 15px;
  font-family: inherit;
  color: var(--text);
  cursor: pointer;
  text-align: left;
  transition: border-color 0.2s, transform 0.15s, box-shadow 0.2s;
  line-height: 1.5;
}

.option-btn:hover {
  border-color: var(--accent);
  transform: translateX(4px);
  box-shadow: 0 4px 16px rgba(108, 141, 113, 0.15);
}

.option-btn.selected {
  border-color: var(--accent-strong);
  background: var(--soft);
}

.option-letter {
  width: 32px;
  height: 32px;
  background: var(--soft);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-strong);
  flex-shrink: 0;
}

.option-text { flex: 1; }

/* ========== ANALYSIS ========== */
#analysisPage {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 40px 24px;
  background: var(--bg);
}

.analysis-content { text-align: center; max-width: 400px; }

.loader-orbs {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 48px;
}

.orb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent);
}
.orb-1 { animation: orbPulse 1.2s ease-in-out infinite; }
.orb-2 { animation: orbPulse 1.2s ease-in-out infinite 0.2s; }
.orb-3 { animation: orbPulse 1.2s ease-in-out infinite 0.4s; }

.analysis-steps {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-bottom: 24px;
}

.analysis-step {
  font-size: 18px;
  color: var(--muted);
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 0.4s, transform 0.4s;
}

.analysis-step.visible {
  opacity: 1;
  transform: translateY(0);
  color: var(--accent-strong);
}

.analysis-hint {
  font-size: 14px;
  color: var(--muted);
  animation: pulse 2s ease-in-out infinite;
}

@keyframes pulse { 0%, 100% { opacity: 0.5; } 50% { opacity: 1; } }

/* ========== RESULT ========== */
#resultPage {
  max-width: 640px;
  margin: 0 auto;
  padding: 32px 20px 120px;
  background: var(--bg);
}

.result-hero {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px 28px;
  text-align: center;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
  animation: fadeInUp 0.5s ease-out;
}

.result-kicker {
  display: inline-block;
  background: var(--soft);
  border: 1px solid var(--line);
  border-radius: 100px;
  padding: 5px 14px;
  font-size: 12px;
  color: var(--accent-strong);
  font-weight: 600;
  margin-bottom: 20px;
  letter-spacing: 1px;
}

.result-type-badge {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
}

.type-emoji {
  font-size: 64px;
  line-height: 1;
}

.type-main { text-align: left; }

.type-code {
  font-size: 42px;
  font-weight: 900;
  font-family: 'Inter', sans-serif;
  color: var(--accent-strong);
  line-height: 1;
}

.type-name {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  margin-top: 4px;
}

.type-intro {
  font-size: 16px;
  color: var(--muted);
  font-style: italic;
  margin-bottom: 16px;
}

.match-badge {
  display: inline-block;
  background: var(--accent);
  color: #fff;
  border-radius: 100px;
  padding: 6px 18px;
  font-size: 14px;
  font-weight: 600;
  margin-bottom: 12px;
}

.result-sub {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.6;
}

/* Result Body */
.result-body {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.result-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

.card-title {
  font-size: 16px;
  font-weight: 700;
  color: var(--accent-strong);
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
}

/* Dimension bars */
.dim-list { display: flex; flex-direction: column; gap: 14px; }

.dim-item {
  display: grid;
  grid-template-columns: 120px 1fr 40px 30px;
  align-items: center;
  gap: 10px;
}

.dim-name { font-size: 13px; color: var(--text); font-weight: 500; }

.dim-bar-bg {
  height: 8px;
  background: var(--soft);
  border-radius: 100px;
  overflow: hidden;
}

.dim-bar-fill {
  height: 100%;
  border-radius: 100px;
  transition: width 1s ease-out;
}

.level-h { background: linear-gradient(90deg, var(--accent), #4d8c60); }
.level-m { background: linear-gradient(90deg, #d4a853, #c4923d); }
.level-l { background: linear-gradient(90deg, #c48d8d, #a07070); }

.dim-score {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  font-family: 'Inter', monospace;
}

.dim-level {
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--soft);
  color: var(--accent-strong);
}

/* Result desc */
.result-desc {
  font-size: 15px;
  line-height: 1.85;
  color: var(--text);
  white-space: pre-wrap;
}

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

.top3-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--soft);
  border-radius: 14px;
  padding: 12px 16px;
}

.top3-rank {
  width: 22px;
  height: 22px;
  background: var(--accent);
  color: #fff;
  border-radius: 50%;
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.top3-emoji { font-size: 24px; flex-shrink: 0; }

.top3-info { flex: 1; }

.top3-name {
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
}

.top3-code {
  font-size: 12px;
  color: var(--muted);
  font-family: 'Inter', monospace;
}

.top3-pct {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-strong);
  font-family: 'Inter', monospace;
}

/* Disclaimer */
.disclaimer-card {
  background: var(--soft);
  border-color: var(--line);
}

.disclaimer-card p {
  font-size: 13px;
  color: var(--muted);
  line-height: 1.7;
  text-align: center;
}

/* ========== RESULT FOOTER ========== */
.result-footer {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  background: var(--panel);
  border-top: 1px solid var(--line);
  padding: 16px 20px;
  display: flex;
  gap: 12px;
  justify-content: center;
  z-index: 100;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.06);
}

.btn-share, .btn-retake {
  display: flex;
  align-items: center;
  gap: 8px;
  border-radius: 100px;
  padding: 12px 24px;
  font-size: 15px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
}

.btn-share {
  background: var(--accent);
  color: #fff;
  border: none;
}

.btn-retake {
  background: var(--panel);
  color: var(--text);
  border: 2px solid var(--line);
}

.btn-share:hover { transform: translateY(-1px); box-shadow: 0 6px 20px rgba(108,141,113,0.3); }
.btn-retake:hover { background: var(--soft); }

/* ========== TOAST ========== */
.toast {
  position: fixed;
  bottom: 90px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: #fff;
  padding: 12px 24px;
  border-radius: 100px;
  font-size: 14px;
  font-weight: 500;
  z-index: 200;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  white-space: nowrap;
}

.toast.show { opacity: 1; }

/* ========== RESPONSIVE ========== */
@media (max-width: 600px) {
  .dim-item {
    grid-template-columns: 90px 1fr 36px 28px;
    gap: 8px;
  }
  .dim-name { font-size: 12px; }
  .result-type-badge { gap: 14px; }
  .type-emoji { font-size: 48px; }
  .type-code { font-size: 32px; }
  .type-name { font-size: 18px; }
  .result-hero { padding: 24px 20px; }
  .result-card { padding: 20px; }
}
