:root {
  --bg: #0f1419;
  --surface: #1a2332;
  --surface-2: #243044;
  --border: #2d3a4f;
  --text: #e8edf4;
  --text-muted: #8b9cb3;
  --accent: #3b82f6;
  --accent-soft: rgba(59, 130, 246, 0.15);
  --accent-hover: #2563eb;
  --success: #22c55e;
  --success-soft: rgba(34, 197, 94, 0.12);
  --warning: #f59e0b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
  --font: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
  --max-width: 480px;
}

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

html, body {
  height: 100%;
}

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  max-width: var(--max-width);
  margin: 0 auto;
  position: relative;
}

/* Screens */
.screen {
  display: none;
  flex: 1;
  flex-direction: column;
  padding: 24px 20px 32px;
  animation: fadeIn 0.35s ease;
}

.screen.active {
  display: flex;
}

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

/* Landing */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 20px;
  width: fit-content;
}

.hero-title {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 12px;
  letter-spacing: -0.02em;
}

.hero-desc {
  color: var(--text-muted);
  font-size: 15px;
  margin-bottom: 32px;
}

.feature-list {
  list-style: none;
  margin-bottom: 40px;
}

.feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}

.feature-list li:last-child {
  border-bottom: none;
}

.feature-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}

.meta-row {
  display: flex;
  gap: 16px;
  margin-bottom: 32px;
}

.meta-item {
  flex: 1;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px;
  text-align: center;
}

.meta-value {
  font-size: 20px;
  font-weight: 700;
  color: var(--accent);
}

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

/* Buttons */
.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px 24px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 16px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: var(--accent-hover);
}

.btn-primary:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  margin-top: 12px;
}

.btn-ghost:hover {
  color: var(--text);
}

.spacer {
  flex: 1;
}

/* Quiz header */
.quiz-header {
  margin-bottom: 28px;
}

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

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

.quiz-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 13px;
  color: var(--text-muted);
}

.pack-tag {
  padding: 4px 10px;
  background: var(--surface-2);
  border-radius: 999px;
  font-size: 12px;
}

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

.question-number {
  font-size: 12px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.question-stem {
  font-size: 17px;
  font-weight: 500;
  line-height: 1.55;
}

.question-context {
  margin-top: 12px;
  padding: 12px 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-muted);
  border-left: 3px solid var(--accent);
}

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

.option {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  background: var(--surface);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  font-size: 15px;
  line-height: 1.45;
}

.option:hover {
  border-color: #3d4f6a;
  background: var(--surface-2);
}

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

.option.correct {
  border-color: var(--success);
  background: var(--success-soft);
}

.option.wrong {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.1);
}

.option-key {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
}

.option.selected .option-key {
  background: var(--accent);
  color: #fff;
}

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

/* Feedback */
.feedback-box {
  display: none;
  padding: 16px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 20px;
  font-size: 14px;
  line-height: 1.55;
  animation: fadeIn 0.3s ease;
}

.feedback-box.show {
  display: block;
}

.feedback-box.info {
  background: var(--accent-soft);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #93c5fd;
}

.feedback-box.success {
  background: var(--success-soft);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #86efac;
}

.feedback-label {
  font-weight: 600;
  margin-bottom: 6px;
  font-size: 13px;
}

/* Result */
.result-hero {
  text-align: center;
  margin-bottom: 32px;
}

.result-icon {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--accent), #8b5cf6);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  margin: 0 auto 20px;
}

.result-title {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 8px;
}

.result-subtitle {
  color: var(--text-muted);
  font-size: 14px;
}

.result-cards {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 28px;
}

.result-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px;
}

.result-card-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 6px;
}

.result-card-value {
  font-size: 18px;
  font-weight: 600;
}

.result-card-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 6px;
}

.recommend-list {
  list-style: none;
  margin-bottom: 28px;
}

.recommend-list li {
  display: flex;
  gap: 10px;
  padding: 10px 0;
  font-size: 14px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}

.recommend-list li::before {
  content: "→";
  color: var(--accent);
  font-weight: 700;
}

/* Platform toggle */
.platform-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(15, 20, 25, 0.92);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  display: flex;
  justify-content: center;
  gap: 8px;
}

.platform-bar + .app {
  padding-top: 52px;
}

.platform-btn {
  padding: 6px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

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

/* WeChat shell */
body.wechat-mode {
  background: #ededed;
}

body.wechat-mode .app {
  background: #ededed;
  max-width: 100%;
}

body.wechat-mode .screen {
  background: #ededed;
  color: #111;
}

body.wechat-mode .question-card,
body.wechat-mode .result-card,
body.wechat-mode .meta-item {
  background: #fff;
  border-color: #e5e5e5;
  color: #111;
  box-shadow: none;
}

body.wechat-mode .option {
  background: #fff;
  border-color: #e5e5e5;
  color: #111;
}

body.wechat-mode .option:hover {
  background: #f7f7f7;
}

body.wechat-mode .option.selected {
  border-color: #07c160;
  background: rgba(7, 193, 96, 0.08);
}

body.wechat-mode .option.selected .option-key {
  background: #07c160;
}

body.wechat-mode .btn-primary {
  background: #07c160;
}

body.wechat-mode .btn-primary:hover {
  background: #06ad56;
}

body.wechat-mode .progress-fill {
  background: #07c160;
}

body.wechat-mode .badge {
  background: rgba(7, 193, 96, 0.12);
  color: #07c160;
}

body.wechat-mode .hero-desc,
body.wechat-mode .quiz-meta,
body.wechat-mode .result-subtitle,
body.wechat-mode .result-card-desc,
body.wechat-mode .recommend-list li {
  color: #888;
}

body.wechat-mode .wechat-nav {
  display: flex;
}

.wechat-nav {
  display: none;
  align-items: center;
  justify-content: center;
  height: 44px;
  background: #fff;
  border-bottom: 1px solid #e5e5e5;
  font-size: 17px;
  font-weight: 600;
  color: #111;
  position: sticky;
  top: 52px;
  z-index: 10;
}

@media (min-width: 520px) {
  body:not(.wechat-mode) .app {
    padding: 24px 0;
  }

  body:not(.wechat-mode) .screen {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 24px;
    margin: 0 16px;
    min-height: calc(100vh - 100px);
  }
}
