:root {
  --bg: #0a0a0f;
  --bg-secondary: #12121a;
  --fg: #f5f5f7;
  --muted: #6b6b7a;
  --accent: #d4a853;
  --accent-glow: rgba(212, 168, 83, 0.4);
  /* 原站同为 0.03，实拍图偏亮时几乎仅靠 blur 衬字；主内容区用略实底色更易读 */
  --card: rgba(255, 255, 255, 0.03);
  --card-panel: rgba(16, 15, 22, 0.82);
  --card-chrome: rgba(16, 15, 22, 0.58);
  --border: rgba(255, 255, 255, 0.08);
  --glass: rgba(18, 18, 26, 0.85);
  --modal-card: rgba(45, 45, 55, 0.98);
  /* 盖在背景图上的渐变遮罩：比原站略加深，压高光、抬文字对比（原站约 0.4～0.6） */
  --scroll-scrim-a: rgba(10, 10, 15, 0.62);
  --scroll-scrim-b: rgba(10, 10, 15, 0.52);
  --scroll-scrim-c: rgba(10, 10, 15, 0.62);
  --scroll-scrim-d: rgba(10, 10, 15, 0.74);
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Noto Sans SC", sans-serif;
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  overflow-x: hidden;
}

.scroll-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 0;
  overflow: hidden;
}

.scroll-bg::after {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    to bottom,
    var(--scroll-scrim-a) 0%,
    var(--scroll-scrim-b) 30%,
    var(--scroll-scrim-c) 70%,
    var(--scroll-scrim-d) 100%
  );
  z-index: 1;
}

.particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 2;
  pointer-events: none;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: var(--accent);
  border-radius: 50%;
  opacity: 0.3;
  animation: float 15s infinite ease-in-out;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(0) translateX(0);
    opacity: 0.3;
  }
  50% {
    transform: translateY(-100px) translateX(20px);
    opacity: 0.6;
  }
}

.main-container {
  position: relative;
  z-index: 10;
  min-height: 100vh;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.main-container.is-visible {
  display: flex;
}

.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-content {
  background: var(--modal-card);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 48px 40px;
  max-width: 480px;
  width: 90%;
  transform: scale(0.9) translateY(20px);
  transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow:
    0 25px 50px rgba(0, 0, 0, 0.4),
    0 0 80px rgba(212, 168, 83, 0.08);
}

.modal-overlay.active .modal-content {
  transform: scale(1) translateY(0);
}

.step-container {
  position: relative;
  width: 100%;
  max-width: 600px;
}

.step {
  display: none;
  animation: fadeSlideIn 0.5s ease forwards;
}

.step.active {
  display: block;
}

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

.question-card {
  background: var(--card-panel);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 40px 32px;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);
}

.question-card--relative {
  position: relative;
}

.question-number {
  font-family: "Playfair Display", serif;
  font-size: 72px;
  font-weight: 700;
  color: var(--accent);
  opacity: 0.2;
  position: absolute;
  top: -20px;
  right: 20px;
  line-height: 1;
}

.question-text {
  font-size: 22px;
  font-weight: 500;
  line-height: 1.6;
  margin-bottom: 32px;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px 32px;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  outline: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #c49545);
  color: #0a0a0f;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 30px var(--accent-glow);
}

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

.btn.is-pending {
  pointer-events: none;
  cursor: progress;
  opacity: 0.92;
}

.download-label {
  display: inline;
}

.btn-secondary {
  background: transparent;
  color: #9c9cc9;
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  background: var(--card);
  color: var(--fg);
  border-color: var(--muted);
}

.btn-row {
  display: flex;
  gap: 16px;
}

.btn-row .btn {
  flex: 1;
}

.btn-block {
  width: 100%;
}

.btn-stack {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tab-switcher {
  display: flex;
  background: var(--card-chrome);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 6px;
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 20px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 500;
  color: #0a0a0f;
  background: var(--accent);
  border: none;
  cursor: default;
  box-shadow: 0 4px 15px var(--accent-glow);
}

.tab-btn svg {
  width: 20px;
  height: 20px;
}

.step-indicator {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin-bottom: 24px;
}

.step-dot {
  width: 24px;
  height: 8px;
  border-radius: 4px;
  background: var(--accent);
  transition: all 0.3s ease;
}

.selection-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (max-width: 480px) {
  .selection-grid {
    gap: 12px;
  }
}

.selection-item {
  position: relative;
  background: var(--card-chrome);
  border: 2px solid var(--border);
  border-radius: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.selection-item:hover {
  border-color: rgba(212, 168, 83, 0.5);
  transform: translateY(-4px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.3);
}

.selection-item.selected {
  border-color: var(--accent);
  box-shadow: 0 0 30px rgba(212, 168, 83, 0.2);
}

.selection-item.selected::after {
  content: "";
  position: absolute;
  top: 8px;
  right: 8px;
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 50%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%230a0a0f' stroke-width='3'%3E%3Cpath d='M20 6L9 17l-5-5'/%3E%3C/svg%3E");
  background-size: 16px;
  background-position: center;
  background-repeat: no-repeat;
  z-index: 10;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.item-image {
  width: 100%;
  aspect-ratio: 4/3;
  overflow: hidden;
  position: relative;
}

.item-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.selection-item:hover .item-image img {
  transform: scale(1.08);
}

.item-info {
  padding: 12px 14px 14px;
  text-align: center;
  background: linear-gradient(to top, rgba(10, 10, 15, 0.92) 0%, rgba(10, 10, 15, 0.45) 55%, transparent 100%);
}

.item-name {
  font-size: 15px;
  font-weight: 600;
  margin-bottom: 2px;
  color: var(--fg);
}

.progress-container {
  margin-bottom: 40px;
}

.progress-text {
  display: flex;
  justify-content: space-between;
  margin-bottom: 16px;
  font-size: 14px;
  color: var(--muted);
}

.progress-bar {
  height: 6px;
  background: var(--card);
  border-radius: 3px;
  overflow: hidden;
  border: 1px solid var(--border);
}

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

.success-card {
  text-align: center;
  padding: 30px 40px;
}

.success-icon {
  width: 60px;
  height: 60px;
  margin: 0 auto 10px;
  background: linear-gradient(135deg, rgba(212, 168, 83, 0.2), rgba(212, 168, 83, 0.05));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    box-shadow: 0 0 0 0 var(--accent-glow);
  }
  50% {
    box-shadow: 0 0 0 20px transparent;
  }
}

.success-icon svg {
  width: 56px;
  height: 56px;
  color: var(--accent);
}

.success-title {
  font-family: "Playfair Display", serif;
  font-size: 36px;
  font-weight: 700;
  margin-bottom: 16px;
  background: linear-gradient(135deg, var(--fg), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.success-desc {
  font-size: 16px;
  color: #dca16e;
  margin-bottom: 40px;
  line-height: 1.6;
  text-align: left;
}

.match-name {
  font-size: 20px;
  font-weight: 600;
  margin-bottom: 8px;
}

.match-info {
  font-size: 14px;
  color: #6fc0b4;
  margin-bottom: 32px;
  text-align: left;
}

.welcome-title {
  font-family: "Playfair Display", serif;
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 16px;
  text-align: center;
}

.welcome-desc {
  font-size: 15px;
  color: #ccccd7;
  text-align: center;
  line-height: 1.7;
  margin-bottom: 32px;
}

.welcome-buttons {
  display: flex;
  gap: 16px;
}

@media (max-width: 400px) {
  .welcome-buttons {
    flex-direction: column;
  }
}

.confetti {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 200;
}

.confetti-piece {
  position: absolute;
  width: 10px;
  height: 10px;
  background: var(--accent);
  animation: confettiFall 3s forwards;
}

@keyframes confettiFall {
  0% {
    transform: translateY(-100%) rotate(0deg);
    opacity: 1;
  }
  100% {
    transform: translateY(100vh) rotate(720deg);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }

}

.btn:focus-visible,
.tab-btn:focus-visible,
.selection-item:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 24px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.matching-title {
  font-size: 24px;
  font-weight: 600;
  margin-bottom: 8px;
  text-align: center;
}

.matching-subtitle {
  font-size: 14px;
  color: #6f6fc0;
  text-align: center;
  margin-bottom: 40px;
}

.matching-status {
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}

.lock-icon {
  display: none;
}

/* 全屏背景三阶段：由 JS 设置 #scrollBg[data-bg-stage="1|2|3"]；无过渡，避免叠化时重绘抖动 */
.bg-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  pointer-events: none;
}

.scroll-bg[data-bg-stage="1"] .bg-slide:nth-child(1),
.scroll-bg[data-bg-stage="2"] .bg-slide:nth-child(2),
.scroll-bg[data-bg-stage="3"] .bg-slide:nth-child(3) {
  opacity: 1;
}
