/* ========== 基础变量与重置 ========== */
:root {
  --bg-beige: #f5f0e6;
  --bg-paper: #faf8f3;
  --text-dark: #3d3a33;
  --text-muted: #6b6560;
  --accent-brown: #8b7355;
  --accent-green: #7a9e7e;
  --accent-warm: #a08060;
  --shadow-soft: rgba(139, 115, 85, 0.15);
  --shadow-medium: rgba(139, 115, 85, 0.25);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
}

body {
  font-family: inherit;
  background: var(--bg-beige);
  color: var(--text-dark);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* 纸张纹理背景 */
body::before {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 400 400' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noiseFilter'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noiseFilter)'/%3E%3C/svg%3E");
  opacity: 0.03;
  pointer-events: none;
  z-index: 0;
}

#app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
}

/* ========== 页面通用 ========== */
.page {
  display: none;
  min-height: 100vh;
  padding: 2rem;
  justify-content: center;
  align-items: center;
}

.page.active {
  display: flex;
  flex-direction: column;
}

/* ========== 复古标题字体 ========== */
.retro-title {
  font-family: inherit;
  font-weight: 400;
  letter-spacing: 0.05em;
}

/* ========== 首页 ========== */
#home {
  text-align: center;
}

.home-content {
  max-width: 480px;
}

.home-content .retro-title {
  font-size: clamp(2rem, 6vw, 3.5rem);
  margin-bottom: 0.5rem;
  color: var(--text-dark);
}

.subtitle {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 2.5rem;
}

/* ========== 按钮样式 ========== */
.btn {
  font-family: inherit;
  font-size: 1rem;
  padding: 0.85rem 2rem;
  border: none;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px var(--shadow-soft);
}

.btn-start {
  background: var(--accent-green);
  color: #fff;
  font-size: 1.1rem;
  padding: 1rem 2.5rem;
}

.btn-start:hover {
  background: #6a8e6e;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--shadow-medium);
}

/* ========== 测试页 ========== */
#test {
  padding-top: 1.5rem;
  padding-bottom: 2rem;
}

.test-container {
  width: 100%;
  max-width: 560px;
}

.progress-bar {
  height: 6px;
  background: rgba(139, 115, 85, 0.2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.progress-fill {
  height: 100%;
  background: var(--accent-brown);
  border-radius: 3px;
  transition: width 0.4s ease;
  width: 10%;
}

.progress-text {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
}

/* 题目卡片 */
.question-card {
  display: none;
  background: var(--bg-paper);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 20px var(--shadow-soft);
  border: 1px solid rgba(139, 115, 85, 0.1);
  margin-bottom: 1.5rem;
}

.question-card.active {
  display: block;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.question-card h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin-bottom: 1.25rem;
  text-align: center;
  color: var(--text-dark);
}

.options-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: center;
}

.option-btn {
  font-family: inherit;
  padding: 0.7rem 1.5rem;
  border: 2px solid var(--accent-brown);
  background: transparent;
  color: var(--text-dark);
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.25s ease;
}

.option-btn:hover {
  background: rgba(139, 115, 85, 0.1);
}

.option-btn.selected {
  background: var(--accent-brown);
  color: #fff;
}

/* 四选一特殊布局 */
.options-group.four-options {
  flex-direction: column;
  align-items: stretch;
}

.options-group.four-options .option-btn {
  text-align: center;
}

.nav-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 1rem;
}

.btn-primary {
  background: var(--accent-brown);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: #7a6248;
  transform: translateY(-1px);
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: var(--accent-brown);
  border: 2px solid var(--accent-brown);
}

.btn-secondary:hover {
  background: rgba(139, 115, 85, 0.1);
}

/* ========== 完成页 ========== */
#complete {
  text-align: center;
}

.complete-title {
  font-size: clamp(1.8rem, 5vw, 2.8rem);
  margin-bottom: 0.75rem;
}

.complete-subtitle {
  color: var(--text-muted);
  margin-bottom: 2rem;
}

.btn-result {
  background: var(--accent-green);
  color: #fff;
  padding: 1rem 2.5rem;
}

.btn-result:hover {
  background: #6a8e6e;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--shadow-medium);
}

/* ========== 结果页 ========== */
#result {
  padding: 2rem 1.5rem;
}

.result-container {
  max-width: 640px;
  width: 100%;
}

.result-title {
  font-size: clamp(1.5rem, 4vw, 2rem);
  margin-bottom: 1.5rem;
  text-align: center;
}

.result-content {
  background: var(--bg-paper);
  border-radius: 16px;
  padding: 2rem;
  box-shadow: 0 4px 20px var(--shadow-soft);
  border: 1px solid rgba(139, 115, 85, 0.1);
  margin-bottom: 2rem;
  font-size: 1.05rem;
  line-height: 1.8;
}

.result-content .final-tag {
  font-family: inherit;
  font-size: 1.4rem;
  color: var(--accent-brown);
  margin-top: 1rem;
}

.result-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.btn-support {
  background: var(--accent-green);
  color: #fff;
}

.btn-support:hover {
  background: #6a8e6e;
}

.btn-punch {
  background: #c45c5c;
  color: #fff;
  position: relative;
}

.btn-punch:hover {
  background: #b04a4a;
  animation: shake 0.5s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-3px); }
  40% { transform: translateX(3px); }
  60% { transform: translateX(-2px); }
  80% { transform: translateX(2px); }
}

/* ========== 弹窗 ========== */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.4);
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal.active {
  display: flex;
}

.modal-content {
  background: var(--bg-paper);
  padding: 2rem;
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 10px 40px var(--shadow-medium);
  max-width: 90%;
}

.modal-content p {
  margin-bottom: 1.25rem;
  font-size: 1.2rem;
}

.btn-close {
  background: var(--accent-brown);
  color: #fff;
}

/* ========== 响应式 ========== */
@media (max-width: 600px) {
  .page {
    padding: 1.25rem;
  }

  .question-card {
    padding: 1.5rem;
  }

  .question-card h3 {
    font-size: 1rem;
  }

  .option-btn {
    padding: 0.6rem 1.2rem;
    font-size: 0.95rem;
  }

  .btn {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
  }

  .result-content {
    padding: 1.5rem;
    font-size: 1rem;
  }
}
