/* ============================================
   JBTI — 剧本杀人格测试
   暗夜悬疑 · 深邃神秘 · 暖光点缀
   ============================================ */

:root {
  --bg: #18181f;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-solid: #1f1f28;
  --mystery-soft: rgba(255, 255, 255, 0.06);
  --accent: #c9a96e;
  --accent-glow: rgba(201, 169, 110, 0.2);
  --accent-deep: #a07d45;
  --red: #c0392b;
  --text-1: #e8e4dd;
  --text-2: #b0a898;
  --text-3: #706860;
  --card-shadow: 0 2px 16px rgba(0, 0, 0, 0.3);
  --border: rgba(255, 255, 255, 0.06);
  --r: 16px;
  --r-sm: 11px;
  --ease: cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }
html { height: 100%; overflow: hidden; }

body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Hiragino Sans GB', 'Microsoft YaHei', sans-serif;
  background: var(--bg);
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}

#particle-canvas {
  position: fixed; inset: 0;
  width: 100%; height: 100%;
  z-index: 0; pointer-events: none;
}

.screen {
  position: fixed; inset: 0; z-index: 1;
  opacity: 0; visibility: hidden;
  transition: opacity 0.5s ease, visibility 0.5s ease;
  overflow-y: auto; overflow-x: hidden;
  -webkit-overflow-scrolling: touch;
}

.screen.active { opacity: 1; visibility: visible; }

/* ============ Landing ============ */
#screen-landing { display: flex; align-items: center; justify-content: center; }

.landing-content {
  text-align: center;
  padding: 32px 24px 60px;
  max-width: 420px;
  animation: fadeInUp 0.8s ease;
}

.logo-area { margin-bottom: 20px; }

.hero-image {
  width: 80px; height: 80px;
  margin: 0 auto 16px;
  border-radius: 50%;
  overflow: hidden;
  box-shadow: 0 0 30px var(--accent-glow), 0 0 0 2px rgba(201, 169, 110, 0.15);
  animation: float 5s ease-in-out infinite;
  position: relative;
}

.hero-image::after {
  content: ''; position: absolute; inset: 0;
  border-radius: 50%;
  box-shadow: inset 0 0 20px rgba(0,0,0,0.5);
  pointer-events: none;
}

.hero-image img { width: 100%; height: 100%; object-fit: cover; display: block; }

.title-main {
  display: block; font-size: 48px; font-weight: 800;
  letter-spacing: 8px;
  background: linear-gradient(135deg, var(--accent) 0%, #e8d5a8 50%, var(--accent-deep) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent; background-clip: text;
  line-height: 1.1;
}

.title-sub {
  display: block; font-size: 9px; letter-spacing: 2px;
  color: var(--text-3); margin-top: 6px;
  text-transform: uppercase; font-weight: 500;
}

.tagline { font-size: 16px; color: var(--text-1); margin-bottom: 6px; font-weight: 500; }
.desc { font-size: 13px; color: var(--text-3); margin-bottom: 28px; letter-spacing: 0.3px; }

.btn-primary {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 14px 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: var(--bg); border: none; border-radius: 60px;
  font-size: 16px; font-weight: 700;
  cursor: pointer; transition: all 0.35s var(--ease);
  box-shadow: 0 4px 20px var(--accent-glow);
  position: relative; overflow: hidden;
}

.btn-primary::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.12), transparent);
  transform: translateX(-100%); transition: transform 0.6s;
}

.btn-primary:hover::after { transform: translateX(100%); }
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 6px 28px var(--accent-glow); }
.btn-primary:active { transform: translateY(0); }

.disclaimer { font-size: 11px; color: var(--text-3); margin-top: 18px; }

.ad-line {
  font-size: 12px; color: var(--text-2);
  margin-top: 10px; font-weight: 500; letter-spacing: 1px;
}

/* ============ Quiz ============ */
#screen-quiz { display: flex; flex-direction: column; }

.quiz-header {
  flex-shrink: 0; padding: 16px 20px 10px;
  background: linear-gradient(180deg, var(--bg) 70%, transparent);
  z-index: 5;
}

.progress-bar { height: 3px; background: var(--mystery-soft); border-radius: 2px; overflow: hidden; }

.progress-fill {
  height: 100%; width: 0%;
  background: linear-gradient(90deg, var(--accent), var(--red));
  border-radius: 2px;
  transition: width 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.progress-text {
  display: flex; justify-content: space-between; align-items: center;
  margin-top: 6px; font-size: 13px; color: var(--text-3);
}

.depth-indicator {
  font-size: 11px; padding: 2px 10px;
  background: var(--bg-card); border-radius: 20px;
  border: 1px solid var(--border);
}

.quiz-body {
  flex: 1; overflow-y: auto;
  padding: 4px 20px 24px;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  min-height: 0;
}

.question-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px 18px; margin-bottom: 12px;
  box-shadow: var(--card-shadow);
  width: 100%; max-width: 500px;
  backdrop-filter: blur(10px);
}

.question-text { font-size: 16px; line-height: 1.65; font-weight: 500; color: var(--text-1); }

.options-container { display: flex; flex-direction: column; gap: 9px; width: 100%; max-width: 500px; }

.option-btn {
  display: block; width: 100%;
  padding: 13px 16px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--r-sm);
  color: var(--text-2); font-size: 14px; line-height: 1.45;
  text-align: left; cursor: pointer;
  transition: all 0.2s ease;
  backdrop-filter: blur(5px);
}

.option-btn:hover {
  background: rgba(201, 169, 110, 0.08);
  border-color: rgba(201, 169, 110, 0.2);
  color: var(--text-1);
}

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

.option-btn.selected {
  background: rgba(201, 169, 110, 0.1);
  border-color: var(--accent);
  color: var(--text-1);
}

.question-card.slide-out { animation: slideOut 0.25s ease forwards; }
.question-card.slide-in { animation: slideIn 0.25s ease forwards; }
.options-container.fade-out { animation: fadeOut 0.15s ease forwards; }

/* ============ Calculating ============ */
#screen-calculating { display: flex; align-items: center; justify-content: center; }

.calc-content { text-align: center; padding: 40px 24px; }
.calc-anim { margin-bottom: 28px; }

.calc-circle {
  width: 100px; height: 100px; margin: 0 auto;
  position: relative; display: flex; align-items: center; justify-content: center;
}

.calc-ring {
  position: absolute; inset: 0;
  border: 2px solid var(--mystery-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 1.2s linear infinite;
}

.calc-emoji { font-size: 40px; animation: float 2s ease-in-out infinite; }
.calc-text { font-size: 15px; color: var(--text-2); margin-bottom: 12px; }
.calc-depth { font-size: 42px; font-weight: 800; color: var(--accent); font-variant-numeric: tabular-nums; }
.depth-unit { font-size: 24px; font-weight: 600; opacity: 0.6; }

/* ============ Result ============ */
#screen-result { display: block; }

.result-content { max-width: 500px; margin: 0 auto; padding: 28px 20px 60px; }

.result-header {
  text-align: center; margin-bottom: 24px;
  animation: fadeInUp 0.6s ease;
}

.result-type-badge {
  display: inline-block; padding: 4px 14px;
  background: var(--bg-card); border-radius: 20px;
  font-size: 11px; color: var(--text-3);
  letter-spacing: 2px; margin-bottom: 14px; font-weight: 500;
  border: 1px solid var(--border);
}

.result-emoji { font-size: 52px; display: block; margin-bottom: 10px; animation: float 3.5s ease-in-out infinite; }
.result-code { font-size: 44px; font-weight: 800; letter-spacing: 5px; margin-bottom: 4px; line-height: 1.1; }
.result-name { font-size: 20px; font-weight: 600; margin-bottom: 4px; color: var(--text-1); }
.result-archetype { font-size: 13px; color: var(--accent); margin-bottom: 8px; font-weight: 500; }
.result-tagline { font-size: 14px; color: var(--text-3); font-style: italic; }

.result-dimensions {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 8px; margin-bottom: 18px;
  animation: fadeInUp 0.6s ease 0.15s both;
}

.dim-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r-sm); padding: 12px; text-align: center;
}

.dim-label { font-size: 10px; color: var(--text-3); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; font-weight: 500; }
.dim-value { font-size: 15px; font-weight: 700; }
.dim-bar { height: 3px; background: var(--mystery-soft); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.dim-bar-fill { height: 100%; border-radius: 2px; transition: width 0.8s ease 0.4s; }

.result-description { animation: fadeInUp 0.6s ease 0.25s both; }

.result-desc-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--r); padding: 20px; margin-bottom: 14px;
  box-shadow: var(--card-shadow);
}

.result-desc-card p { font-size: 14px; line-height: 1.85; color: var(--text-2); }
.result-desc-card p + p { margin-top: 12px; }

.result-actions {
  display: flex; flex-direction: column; gap: 9px; margin-top: 20px;
  animation: fadeInUp 0.6s ease 0.35s both;
}

.btn-share {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 13px 24px;
  background: linear-gradient(135deg, var(--accent), var(--accent-deep));
  color: var(--bg); border: none; border-radius: var(--r-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: all 0.3s var(--ease);
  box-shadow: 0 3px 12px var(--accent-glow);
}

.btn-share:hover { transform: translateY(-1px); box-shadow: 0 5px 18px var(--accent-glow); }

.btn-secondary {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 24px;
  background: var(--bg-card); color: var(--text-2);
  border: 1.5px solid var(--border); border-radius: var(--r-sm);
  font-size: 14px; cursor: pointer; transition: all 0.3s var(--ease);
}

.btn-secondary:hover { background: rgba(201, 169, 110, 0.06); color: var(--text-1); }

.result-footer { text-align: center; margin-top: 28px; padding-top: 16px; border-top: 1px solid var(--border); }
.result-footer p { font-size: 11px; color: var(--text-3); }
.result-footer p + p { margin-top: 3px; }

/* Toast */
.toast {
  position: fixed; bottom: 36px; left: 50%;
  transform: translateX(-50%) translateY(16px);
  padding: 11px 22px; background: var(--accent); color: var(--bg);
  border-radius: 10px; font-size: 13px; font-weight: 600;
  opacity: 0; transition: all 0.3s ease; z-index: 100;
  box-shadow: 0 4px 16px var(--accent-glow);
}

.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ============ Animations ============ */
@keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } }
@keyframes slideOut { to { opacity: 0; transform: translateX(-24px); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(24px); } to { opacity: 1; transform: translateX(0); } }
@keyframes float { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
@keyframes spin { to { transform: rotate(360deg); } }

/* ============ Responsive ============ */
@media (max-width: 600px) {
  .quiz-header { padding: 12px 16px 8px; }
  .quiz-body { padding: 2px 16px 16px; justify-content: flex-start; }
  .question-card { padding: 16px 16px; margin-bottom: 10px; border-radius: 14px; }
  .question-text { font-size: 15px; line-height: 1.6; }
  .options-container { gap: 7px; }
  .option-btn { padding: 11px 14px; font-size: 13.5px; line-height: 1.4; border-radius: 10px; }
  .landing-content { padding: 24px 20px 50px; }
  .hero-image { width: 70px; height: 70px; }
  .title-main { font-size: 40px; letter-spacing: 5px; }
  .tagline { font-size: 15px; }
  .desc { font-size: 12px; margin-bottom: 22px; }
  .btn-primary { padding: 12px 34px; font-size: 15px; }
}

@media (max-width: 380px) {
  .title-main { font-size: 34px; }
  .question-text { font-size: 14px; }
  .option-btn { font-size: 12.5px; padding: 10px 12px; }
}

@media (max-height: 700px) and (max-width: 600px) {
  .question-card { padding: 14px 14px; margin-bottom: 8px; }
  .option-btn { padding: 9px 12px; font-size: 12.5px; }
  .options-container { gap: 5px; }
}

@media (min-width: 768px) {
  .title-main { font-size: 60px; }
  .tagline { font-size: 18px; }
  .hero-image { width: 100px; height: 100px; }
}

::-webkit-scrollbar { width: 3px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.06); border-radius: 2px; }

::selection { background: var(--accent-glow); }
