/* Overthinker Test - Dark mode first, Glassmorphism 2.0 */
:root {
  --primary: #7c3aed;
  --primary-light: #a78bfa;
  --primary-dark: #5b21b6;
  --primary-glow: rgba(124, 58, 237, 0.3);
  --bg: #0a0a1a;
  --bg-card: rgba(255, 255, 255, 0.05);
  --bg-card-hover: rgba(255, 255, 255, 0.08);
  --text: #e8e8f0;
  --text-secondary: #a0a0b8;
  --text-tertiary: #6a6a80;
  --border: rgba(255, 255, 255, 0.1);
  --border-hover: rgba(124, 58, 237, 0.4);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  --radius: 16px;
  --radius-sm: 10px;
  --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

[data-theme="light"] {
  --bg: #f5f3ff;
  --bg-card: rgba(124, 58, 237, 0.06);
  --bg-card-hover: rgba(124, 58, 237, 0.1);
  --text: #1a1a2e;
  --text-secondary: #5a5a70;
  --text-tertiary: #8a8a9a;
  --border: rgba(124, 58, 237, 0.15);
  --shadow: 0 8px 32px rgba(124, 58, 237, 0.1);
}

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

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

/* App Loader */
.app-loader {
  position: fixed; inset: 0; z-index: 10000;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg);
  transition: opacity 0.3s;
}
.app-loader.hidden { opacity: 0; pointer-events: none; }
.loader-content { text-align: center; }
.loader-emoji { font-size: 48px; animation: float 2s ease-in-out infinite; }
.loader-spinner {
  width: 40px; height: 40px; margin: 16px auto;
  border: 3px solid var(--border); border-top-color: var(--primary);
  border-radius: 50%; animation: spin 0.8s linear infinite;
}
.loader-text { color: var(--text-secondary); font-size: 14px; }

@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-8px)} }
@keyframes spin { to{transform:rotate(360deg)} }

/* Container */
.container {
  max-width: 520px; margin: 0 auto; padding: 16px;
  position: relative; min-height: 100vh;
}

/* Theme Toggle & Language */
.theme-toggle {
  position: fixed; top: 12px; right: 60px; z-index: 100;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 50%; width: 40px; height: 40px;
  font-size: 18px; cursor: pointer; backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
  transition: all 0.3s;
}
.theme-toggle:hover { border-color: var(--border-hover); }

.language-selector { position: fixed; top: 12px; right: 12px; z-index: 100; }
.lang-btn {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 50%; width: 40px; height: 40px;
  font-size: 18px; cursor: pointer; backdrop-filter: blur(10px);
  display: flex; align-items: center; justify-content: center;
}
.lang-menu {
  position: absolute; top: 48px; right: 0; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 4px; box-shadow: var(--shadow); backdrop-filter: blur(20px);
  min-width: 160px;
}
.lang-menu.hidden { display: none; }
.lang-option {
  display: block; width: 100%; padding: 8px 12px; border: none;
  background: transparent; color: var(--text); text-align: left;
  cursor: pointer; border-radius: 6px; font-size: 13px;
}
.lang-option:hover { background: var(--bg-card-hover); }

/* Ad */
.ad-banner { margin: 12px 0; min-height: 50px; text-align: center; }

/* Screens */
.screen { display: none; }
.screen.active { display: block; animation: fadeIn 0.4s ease; }
@keyframes fadeIn { from{opacity:0;transform:translateY(12px)} to{opacity:1;transform:translateY(0)} }

/* Hero */
.hero-section { text-align: center; padding: 40px 0 16px; }
.hero-icon { margin-bottom: 16px; }
.brain-svg { filter: drop-shadow(0 0 20px var(--primary-glow)); }
.thought-dot { animation: pulse-dot 3s ease-in-out infinite; }
.dot-1 { animation-delay: 0s; }
.dot-2 { animation-delay: 0.5s; }
.dot-3 { animation-delay: 1s; }
.dot-4 { animation-delay: 1.5s; }
.dot-5 { animation-delay: 2s; }
@keyframes pulse-dot {
  0%,100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.5); }
}

h1 {
  font-size: 1.75rem; font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--primary), #c084fc);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; line-height: 1.3; margin-bottom: 8px;
}
.hook-question {
  font-size: 1.05rem; font-weight: 600; color: var(--primary-light);
  margin-bottom: 8px; line-height: 1.5;
}
.subtitle { color: var(--text-secondary); font-size: 0.95rem; margin-bottom: 12px; }
.social-proof {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 14px; font-size: 13px;
  color: var(--text-secondary);
}
.social-proof strong { color: var(--primary-light); }

/* CTA Button */
.btn-cta {
  display: block; width: 100%; padding: 16px 24px; margin: 20px 0 8px;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border: none; border-radius: var(--radius);
  font-size: 1.05rem; font-weight: 700; cursor: pointer;
  box-shadow: 0 4px 20px var(--primary-glow);
  transition: all 0.3s; min-height: 52px;
}
.btn-cta:hover { transform: translateY(-2px); box-shadow: 0 6px 28px var(--primary-glow); }
.btn-cta:active { transform: translateY(0); }

.time-estimate { text-align: center; color: var(--text-tertiary); font-size: 13px; margin-bottom: 20px; }

/* Result Carousel */
.result-carousel {
  display: flex; justify-content: center; gap: 8px;
  margin: 16px 0; overflow: hidden; height: 36px;
}
.carousel-item {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; padding: 6px 14px; font-size: 13px;
  white-space: nowrap; color: var(--text-secondary);
  animation: carousel-fade 12s ease-in-out infinite;
  opacity: 0; position: absolute;
}
.carousel-item.active { opacity: 1; position: relative; }

/* Features */
.features-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px;
  margin: 16px 0;
}
.feature-card {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  padding: 12px 4px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); text-align: center;
}
.feature-icon { font-size: 20px; }
.feature-text { font-size: 11px; color: var(--text-secondary); }

/* Progress */
.progress-wrap { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.progress-bar { flex: 1; height: 6px; background: var(--bg-card); border-radius: 3px; overflow: hidden; }
.progress-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light)); border-radius: 3px; transition: width 0.5s ease; width: 0; }
.progress-text { font-size: 13px; color: var(--text-tertiary); white-space: nowrap; min-width: 36px; }

/* Question Card */
.question-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 28px 20px;
  backdrop-filter: blur(10px); text-align: center;
}
.question-icon { font-size: 36px; margin-bottom: 12px; }
.question-text { font-size: 1.1rem; font-weight: 600; margin-bottom: 20px; line-height: 1.4; }

.options { display: flex; flex-direction: column; gap: 10px; }
.option-btn {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; text-align: left;
  font-size: 0.95rem; color: var(--text); transition: all 0.3s;
  min-height: 48px;
}
.option-btn:hover { background: var(--bg-card-hover); border-color: var(--border-hover); transform: translateX(4px); }
.option-btn.selected {
  background: rgba(124, 58, 237, 0.15); border-color: var(--primary);
  box-shadow: 0 0 12px var(--primary-glow);
}
.option-label {
  display: flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; background: var(--primary-glow);
  border-radius: 50%; font-weight: 700; font-size: 12px; color: var(--primary-light);
  flex-shrink: 0;
}

/* Mid-quiz message */
.mid-quiz-msg {
  text-align: center; padding: 12px; margin-top: 16px;
  color: var(--primary-light); font-size: 14px;
  animation: fadeIn 0.5s ease;
}
.mid-quiz-msg.hidden { display: none; }

/* Analyzing */
.analyzing-content { text-align: center; padding: 60px 20px; }
.analyzing-icon { font-size: 64px; animation: float 2s ease-in-out infinite; }
.analyzing-pulse {
  width: 80px; height: 80px; margin: -70px auto 20px;
  border-radius: 50%; background: var(--primary-glow);
  animation: pulse-ring 1.5s ease-in-out infinite;
}
@keyframes pulse-ring { 0%{transform:scale(0.8);opacity:0.5} 50%{transform:scale(1.4);opacity:0} 100%{transform:scale(0.8);opacity:0.5} }
.analyzing-content h2 { font-size: 1.2rem; margin-bottom: 24px; color: var(--text); }
.analyzing-bar { height: 6px; background: var(--bg-card); border-radius: 3px; overflow: hidden; margin-bottom: 16px; }
.analyzing-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light)); border-radius: 3px; transition: width 0.4s ease; width: 0; }
.analyzing-status { color: var(--text-secondary); font-size: 14px; }

/* Result Screen */
.result-badge { font-size: 64px; text-align: center; margin: 20px 0 8px; }
.result-type {
  text-align: center; font-size: 1.6rem; font-weight: 800;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
  background-clip: text; margin-bottom: 4px;
}
.result-tagline { text-align: center; color: var(--text-secondary); font-size: 0.9rem; font-style: italic; margin-bottom: 16px; }
.result-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px;
  backdrop-filter: blur(10px); margin-bottom: 16px;
}
.result-desc { color: var(--text); font-size: 0.95rem; line-height: 1.7; }

/* Metrics */
.metrics-card {
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 20px; margin-bottom: 16px;
}
.metrics-card h3 { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 16px; text-align: center; }
.metric-row { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.metric-label { font-size: 13px; color: var(--text-secondary); min-width: 100px; }
.metric-bar { flex: 1; height: 8px; background: var(--bg-card-hover); border-radius: 4px; overflow: hidden; }
.metric-fill { height: 100%; background: linear-gradient(90deg, var(--primary), var(--primary-light)); border-radius: 4px; transition: width 1s ease; width: 0; }
.metric-value { font-size: 12px; color: var(--primary-light); min-width: 32px; text-align: right; font-weight: 600; }

/* Percentile */
.percentile-card {
  display: flex; align-items: center; justify-content: center; gap: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 20px; padding: 10px 18px; margin: 0 auto 16px;
  width: fit-content; font-size: 14px; color: var(--text-secondary);
}

/* Traits */
.traits-wrap { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-bottom: 20px; }
.trait-tag {
  background: var(--primary-glow); border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 20px; padding: 6px 14px; font-size: 13px;
  color: var(--primary-light);
}

/* Share */
.share-section { text-align: center; margin-bottom: 20px; }
.share-section h3 { font-size: 0.9rem; color: var(--text-secondary); margin-bottom: 12px; }
.share-buttons { display: flex; justify-content: center; gap: 10px; }
.share-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 16px; border: 1px solid var(--border);
  border-radius: var(--radius-sm); background: var(--bg-card);
  color: var(--text); cursor: pointer; font-size: 14px;
  transition: all 0.3s; min-height: 44px;
}
.share-btn:hover { background: var(--bg-card-hover); border-color: var(--border-hover); }
.share-btn.kakao { border-color: rgba(254, 229, 0, 0.3); }
.share-btn.twitter { border-color: rgba(29, 161, 242, 0.3); }
.share-btn.facebook { border-color: rgba(24, 119, 242, 0.3); }
.share-icon { font-size: 18px; font-weight: 700; }

/* Related tests */
.related-tests { margin-bottom: 20px; }
.related-tests h3 { font-size: 0.9rem; color: var(--text-secondary); text-align: center; margin-bottom: 12px; }
.related-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.related-card {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 14px 8px; background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); text-decoration: none; color: var(--text);
  transition: all 0.3s;
}
.related-card:hover { background: var(--bg-card-hover); border-color: var(--card-color, var(--border-hover)); transform: translateY(-2px); }
.related-emoji { font-size: 28px; }
.related-card span:last-child { font-size: 12px; font-weight: 600; color: var(--text-secondary); }

/* Buttons */
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff; border: none; border-radius: var(--radius-sm);
  padding: 12px 20px; font-size: 1rem; font-weight: 600;
  cursor: pointer; transition: all 0.3s; min-height: 44px;
}
.btn-secondary {
  display: block; width: 100%; padding: 14px; margin-top: 8px;
  background: var(--bg-card); border: 1px solid var(--border);
  border-radius: var(--radius-sm); color: var(--text);
  font-size: 0.95rem; cursor: pointer; transition: all 0.3s;
  min-height: 44px;
}
.btn-secondary:hover { background: var(--bg-card-hover); }

/* Footer */
.app-footer { text-align: center; padding: 20px 0; }
.back-link {
  display: inline-flex; align-items: center; gap: 6px;
  color: var(--text-tertiary); text-decoration: none; font-size: 14px;
}
.back-link:hover { color: var(--primary-light); }

/* Confetti */
.confetti {
  position: fixed; width: 8px; height: 8px; z-index: 9999;
  animation: confetti-fall 2.5s ease-in forwards; pointer-events: none;
}
@keyframes confetti-fall {
  0% { transform: translateY(-10vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(110vh) rotate(720deg); opacity: 0; }
}

/* Responsive */
@media (max-width: 640px) {
  .container { padding: 12px; }
  h1 { font-size: 1.5rem; }
  .hero-section { padding: 24px 0 12px; }
  .brain-svg { width: 80px; height: 80px; }
  .share-label { display: none; }
  .share-btn { padding: 10px 12px; }
  .features-grid { gap: 6px; }
  .feature-text { font-size: 10px; }
}

@media (max-width: 360px) {
  h1 { font-size: 1.3rem; }
  .question-text { font-size: 1rem; }
}

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