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

:root {
  --black: #1a1a1a;
  --white: #ffffff;
  --gray-light: #f5f5f5;
  --gray-mid: #999999;
  --gray-dark: #666666;
  --accent: #1a1a1a;
  --font-main: -apple-system, BlinkMacSystemFont, "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-mono: "SF Mono", "Fira Code", "Courier New", monospace;
}

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

body {
  font-family: var(--font-main);
  background: var(--white);
  color: var(--black);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ===== Page System ===== */
.page {
  display: none;
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0 24px;
}

.page.active {
  display: flex;
  flex-direction: column;
  animation: fadeIn 0.4s ease;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ===== Start Page ===== */
#page-start {
  justify-content: center;
  align-items: center;
  text-align: center;
  padding-bottom: 80px;
}

.start-content {
  width: 100%;
  max-width: 360px;
}

.start-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 4px;
  color: var(--gray-mid);
  margin-bottom: 32px;
  text-transform: uppercase;
}

.start-title {
  font-size: 42px;
  font-weight: 800;
  line-height: 1.3;
  letter-spacing: -1px;
  margin-bottom: 16px;
}

.start-subtitle {
  font-size: 15px;
  color: var(--gray-dark);
  line-height: 1.8;
  margin-bottom: 48px;
}

.start-divider {
  width: 40px;
  height: 2px;
  background: var(--black);
  margin: 0 auto 48px;
}

.start-hint {
  margin-top: 24px;
  font-size: 12px;
  color: var(--gray-mid);
  letter-spacing: 1px;
}

/* ===== Buttons ===== */
.btn-primary {
  width: 100%;
  max-width: 360px;
  padding: 16px 32px;
  font-size: 16px;
  font-weight: 600;
  font-family: var(--font-main);
  color: var(--white);
  background: var(--black);
  border: none;
  border-radius: 0;
  cursor: pointer;
  transition: opacity 0.2s;
  letter-spacing: 2px;
}

.btn-primary:active {
  opacity: 0.7;
}

/* ===== Quiz Page ===== */
#page-quiz {
  padding-top: 0;
}

.quiz-header {
  position: sticky;
  top: 0;
  background: var(--white);
  padding: 20px 0 16px;
  z-index: 10;
}

.progress-bar {
  width: 100%;
  height: 3px;
  background: var(--gray-light);
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: var(--black);
  width: 5%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-text {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--gray-mid);
  letter-spacing: 2px;
}

.quiz-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-bottom: 80px;
  animation: slideUp 0.3s ease;
}

.question-text {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 40px;
  letter-spacing: -0.5px;
}

.options-container {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.option-btn {
  width: 100%;
  padding: 18px 20px;
  font-size: 15px;
  font-weight: 500;
  font-family: var(--font-main);
  color: var(--black);
  background: var(--white);
  border: 1.5px solid #e0e0e0;
  border-radius: 0;
  cursor: pointer;
  text-align: left;
  line-height: 1.5;
  transition: all 0.15s ease;
  position: relative;
}

.option-btn:active {
  background: var(--black);
  color: var(--white);
  border-color: var(--black);
}

.option-btn .option-label {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-mid);
  margin-right: 10px;
  letter-spacing: 1px;
}

.option-btn:active .option-label {
  color: var(--white);
  opacity: 0.6;
}

/* ===== Result Page ===== */
#page-result {
  justify-content: flex-start;
  align-items: center;
  padding-top: 40px;
  padding-bottom: 40px;
  background: var(--gray-light);
}

.result-card {
  width: 100%;
  max-width: 420px;
  background: var(--white);
  padding: 0;
  animation: slideUp 0.5s ease;
  position: relative;
}

.result-top-bar {
  height: 4px;
  background: var(--black);
}

.result-body {
  padding: 40px 32px 36px;
  text-align: center;
}

.result-label {
  font-size: 12px;
  color: var(--gray-mid);
  letter-spacing: 4px;
  margin-bottom: 28px;
  text-transform: uppercase;
  font-family: var(--font-mono);
}

.result-split {
  display: flex;
  align-items: flex-start;
  gap: 20px;
  text-align: left;
}

.result-emoji-wrap {
  flex-shrink: 0;
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gray-light);
  border: 1.5px solid #e0e0e0;
}

.result-emoji {
  font-size: 44px;
  line-height: 1;
  display: block;
}

.result-img {
  width: 80px;
  height: 80px;
  object-fit: cover;
  display: none;
}

.result-info {
  flex: 1;
  min-width: 0;
}

.result-name {
  font-size: 28px;
  font-weight: 800;
  line-height: 1.2;
  margin-bottom: 6px;
  letter-spacing: 1px;
}

.result-tag {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--gray-mid);
  letter-spacing: 2px;
  margin-bottom: 16px;
}

.result-divider {
  width: 28px;
  height: 2px;
  background: var(--black);
  margin: 0 0 16px;
}

.result-desc {
  font-size: 14px;
  color: var(--gray-dark);
  line-height: 1.8;
  font-weight: 400;
}

.result-watermark {
  position: absolute;
  bottom: 12px;
  right: 16px;
  font-size: 10px;
  color: #d0d0d0;
  letter-spacing: 1px;
  font-family: var(--font-mono);
}

/* ===== Result Actions ===== */
.result-actions {
  width: 100%;
  max-width: 360px;
  margin-top: 24px;
  text-align: center;
  animation: slideUp 0.6s ease;
}

.result-hint {
  font-size: 13px;
  color: var(--gray-mid);
  margin-bottom: 20px;
  line-height: 1.6;
}

.result-ad-placeholder {
  width: 100%;
  height: 100px;
  background: #eaeaea;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.ad-placeholder-text {
  font-size: 12px;
  color: var(--gray-mid);
  letter-spacing: 2px;
}

/* ===== Animations ===== */
.quiz-body.slide-out {
  animation: slideOut 0.2s ease forwards;
}

@keyframes slideOut {
  from {
    opacity: 1;
    transform: translateY(0);
  }
  to {
    opacity: 0;
    transform: translateY(-20px);
  }
}

/* ===== Responsive ===== */
@media (min-width: 420px) {
  .start-title {
    font-size: 52px;
  }

  .question-text {
    font-size: 24px;
  }

  .result-name {
    font-size: 42px;
  }
}

/* ===== Safe Area (iPhone X+) ===== */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  .result-actions {
    padding-bottom: env(safe-area-inset-bottom);
  }

  #page-start {
    padding-bottom: calc(80px + env(safe-area-inset-bottom));
  }
}

/* ===== Selection disabled for screenshot ===== */
.result-card {
  -webkit-user-select: none;
  user-select: none;
}

/* ===== WeChat In-App Browser Fix ===== */
body {
  -webkit-overflow-scrolling: touch;
}
