/* ═══════════════════════════════════════
   SBTI 赛博人格测试 — 样式
   ═══════════════════════════════════════ */

:root {
  --bg: #0d0d0f;
  --surface: #16161a;
  --surface-2: #1e1e24;
  --surface-3: #26262e;
  --border: #2a2a35;
  --text: #fffffe;
  --text-2: #d4d4dc;
  --text-3: #94949e;
  --text-4: #5e5e6e;
  --accent: #7f5af0;
  --accent-light: #a78bfa;
  --accent-bg: rgba(127, 90, 240, 0.12);
  --green: #2cb67d;
  --green-text: #2cb67d;
  --amber: #f5a623;
  --amber-text: #f5a623;
  --red: #e53170;
  --red-text: #e53170;
  --bar-track: #1e1e24;
  --font: 'Inter', 'Noto Sans SC', system-ui, -apple-system, sans-serif;
  --radius: 16px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

.page {
  max-width: 420px;
  margin: 0 auto;
  min-height: 100vh;
  position: relative;
}

/* ── Screen Management ── */
.screen {
  display: none;
  min-height: 100vh;
}
.screen.active {
  display: flex;
  flex-direction: column;
}

/* ═══ WELCOME SCREEN ═══ */
.welcome-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
  text-align: center;
}

.welcome-badge {
  font-size: 48px;
  margin-bottom: 8px;
  animation: float 3s ease-in-out infinite;
}

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-10px); }
}

.welcome-title {
  font-size: 36px;
  font-weight: 900;
  letter-spacing: -1px;
  background: linear-gradient(135deg, var(--accent), var(--accent-light), #e0aaff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 4px;
}

.welcome-subtitle {
  font-size: 13px;
  color: var(--text-4);
  font-weight: 500;
  letter-spacing: 2px;
  text-transform: uppercase;
  margin-bottom: 24px;
}

.welcome-desc {
  font-size: 15px;
  color: var(--text-3);
  line-height: 1.8;
  margin-bottom: 32px;
}

.welcome-stats {
  display: flex;
  gap: 24px;
  margin-bottom: 40px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.stat-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent-light);
}

.stat-label {
  font-size: 12px;
  color: var(--text-4);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 48px;
  border: none;
  border-radius: 999px;
  background: linear-gradient(135deg, var(--accent), #9b72f0);
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  font-family: var(--font);
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 4px 24px rgba(127, 90, 240, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 32px rgba(127, 90, 240, 0.5);
}

.btn-primary:active {
  transform: translateY(0);
}

.welcome-credit {
  margin-top: 24px;
  font-size: 12px;
  color: var(--text-4);
}

.welcome-credit a {
  color: var(--text-3);
  text-decoration: none;
}

/* ═══ QUIZ SCREEN ═══ */
#quizScreen {
  padding: 0;
}

.quiz-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: var(--bg);
  padding: 16px 20px 12px;
  border-bottom: 1px solid var(--border);
}

.progress-bar {
  width: 100%;
  height: 4px;
  background: var(--surface-2);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 999px;
  transition: width 0.4s ease;
  width: 0%;
}

.quiz-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quiz-counter {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-2);
}

.quiz-dim-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-light);
  background: var(--accent-bg);
  padding: 3px 12px;
  border-radius: 999px;
}

.quiz-body {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
}

.quiz-card {
  width: 100%;
  animation: fadeSlideIn 0.35s ease;
}

@keyframes fadeSlideIn {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.quiz-text {
  font-size: 17px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.8;
  margin-bottom: 28px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-btn {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text-2);
  font-size: 14px;
  font-family: var(--font);
  line-height: 1.6;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  width: 100%;
}

.option-btn:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--text);
}

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

.option-btn .opt-label {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 8px;
  background: var(--surface-3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-3);
}

.option-btn:hover .opt-label {
  background: var(--accent);
  color: #fff;
}

.option-btn .opt-text {
  flex: 1;
  padding-top: 1px;
}

.quiz-encourage {
  text-align: center;
  padding: 0 20px 20px;
  font-size: 13px;
  color: var(--accent-light);
  min-height: 40px;
}

/* ═══ RESULT SCREEN ═══ */
#resultScreen {
  min-height: auto;
}

#resultScreen.active {
  display: block;
}

/* Avatar Hero */
.avatar-section {
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
  overflow: hidden;
}

.avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.avatar-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.7) 0%, rgba(0,0,0,0.1) 40%, transparent 60%);
}

.avatar-info {
  position: absolute;
  bottom: 16px;
  left: 20px;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.avatar-code {
  font-size: 32px;
  font-weight: 900;
  color: #fff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.5);
  letter-spacing: -0.5px;
}

.avatar-name {
  font-size: 16px;
  font-weight: 600;
  color: rgba(255,255,255,0.85);
  text-shadow: 0 1px 4px rgba(0,0,0,0.4);
}

.match-badge {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: rgba(127, 90, 240, 0.7);
  backdrop-filter: blur(8px);
  border-radius: 20px;
  padding: 5px 14px;
}

/* Content */
.result-content {
  padding: 24px 20px 32px;
}

.result-grade-code {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-4);
  font-family: 'Inter', monospace;
  letter-spacing: 1px;
  margin-bottom: 16px;
}

.quote {
  font-size: 16px;
  font-style: italic;
  color: var(--accent-light);
  margin-bottom: 16px;
  line-height: 1.7;
  padding-left: 12px;
  border-left: 3px solid var(--accent);
}

.description {
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.9;
  margin-bottom: 24px;
}

/* Radar Section */
.radar-section {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}

.section-title {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 14px;
}

.radar-container {
  display: flex;
  justify-content: center;
  margin: 8px 0 12px;
}

#radarChart {
  width: 280px;
  height: 260px;
}

.rarity-row {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-top: 12px;
}

.rarity-badge {
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.rarity-badge.ssr {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #78350f;
}
.rarity-badge.sr {
  background: linear-gradient(135deg, #c084fc, #a855f7);
  color: #fff;
}
.rarity-badge.r {
  background: linear-gradient(135deg, #60a5fa, #3b82f6);
  color: #fff;
}
.rarity-badge.n {
  background: var(--surface-3);
  color: var(--text-3);
}

.rarity-info {
  font-size: 12px;
  color: var(--text-3);
}

/* Summary Strip */
.summary-strip {
  display: flex;
  gap: 16px;
  align-items: flex-end;
  padding: 16px 0;
  margin-bottom: 20px;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
}

.summary-group {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.summary-bars {
  display: flex;
  gap: 1px;
  align-items: flex-end;
}

.summary-bar {
  width: 10px;
  border-radius: 2px;
}

.summary-bar.h { height: 14px; background: var(--green); }
.summary-bar.m { height: 9px; background: var(--amber); }
.summary-bar.l { height: 4px; background: var(--red); }

.summary-label {
  font-size: 10px;
  color: var(--text-4);
}

/* Dimension Rows */
.model-group {
  margin-bottom: 16px;
}

.model-title {
  font-size: 11px;
  font-weight: 700;
  color: var(--text-3);
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.dim-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 0;
}

.dim-label {
  font-size: 12px;
  color: var(--text-3);
  width: 72px;
  flex-shrink: 0;
}

.dim-track {
  flex: 1;
  height: 8px;
  background: var(--bar-track);
  border-radius: 999px;
  overflow: hidden;
}

.dim-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.8s ease;
  width: 0;
}

.dim-fill.h { background: var(--green); }
.dim-fill.m { background: var(--amber); }
.dim-fill.l { background: var(--red); }

.dim-fill.h.animated { width: 100%; }
.dim-fill.m.animated { width: 60%; }
.dim-fill.l.animated { width: 25%; }

.dim-level {
  font-size: 11px;
  font-weight: 600;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
}

.dim-level.h { color: var(--green-text); }
.dim-level.m { color: var(--amber-text); }
.dim-level.l { color: var(--red-text); }

/* TOP 3 */
.top-section {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.top-list {
  list-style: none;
}

.top-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 12px;
  margin-bottom: 6px;
}

.top-item.current {
  background: var(--accent-bg);
  border: 1px solid rgba(127, 90, 240, 0.2);
}

.top-rank {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 800;
  flex-shrink: 0;
}

.top-rank.r1 { background: var(--accent); color: #fff; }
.top-rank.r2 { background: var(--surface-3); color: var(--text-3); }
.top-rank.r3 { background: var(--surface-3); color: var(--text-3); }

.top-info {
  flex: 1;
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.top-code {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

.top-name {
  font-size: 12px;
  color: var(--text-3);
}

.top-pct {
  font-size: 14px;
  font-weight: 700;
  color: var(--accent-light);
}

/* DRUNK easter egg */
.drunk-banner {
  background: linear-gradient(135deg, #fbbf24, #f59e0b);
  color: #78350f;
  text-align: center;
  padding: 12px;
  font-size: 13px;
  font-weight: 700;
}

.drunk-note {
  margin-top: 20px;
  padding: 16px;
  background: var(--surface-2);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  font-size: 13px;
  color: var(--text-3);
  line-height: 1.7;
}

/* Share & CTA */
.cta {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--border);
}

.share-row {
  display: flex;
  gap: 8px;
  justify-content: center;
}

.share-btn {
  padding: 10px 20px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-2);
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  transition: all 0.2s;
}

.share-btn:hover {
  border-color: var(--accent);
  background: var(--accent-bg);
  color: var(--accent-light);
}

.btn-restart {
  display: block;
  width: 100%;
  margin-top: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-3);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  font-family: var(--font);
  transition: all 0.2s;
}

.btn-restart:hover {
  border-color: var(--text-4);
  color: var(--text-2);
}

/* Footer */
.result-footer {
  text-align: center;
  padding: 24px 20px;
  font-size: 12px;
  color: var(--text-4);
  border-top: 1px solid var(--border);
  margin-top: 32px;
}

.result-footer a {
  color: var(--text-3);
  text-decoration: none;
}

/* ═══ RESPONSIVE ═══ */
@media (max-width: 420px) {
  .page { max-width: 100%; }
  .avatar-code { font-size: 26px; }
  .dim-label { width: 64px; font-size: 11px; }
  .welcome-title { font-size: 30px; }
}
