/* MBTI Coffee Test Styles */
/* Primary Color: #6F4E37 (Coffee Brown) */

:root {
  --primary: #A0744A;
  --primary-dark: #6F4E37;
  --primary-light: #C49A6C;
  --primary-glow: rgba(160, 116, 74, 0.3);
  --bg: #0a0a1a;
  --bg-card: rgba(255, 255, 255, 0.05);
  --text: #e8e8f0;
  --text-muted: #8888aa;
  --border: rgba(255, 255, 255, 0.1);
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  --radius: 16px;
  --transition: 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

@media (prefers-color-scheme: light) {
  :root {
    --bg: #f5f0eb;
    --bg-card: rgba(111, 78, 55, 0.05);
    --text: #1a1a2e;
    --text-muted: #666660;
    --border: rgba(0, 0, 0, 0.08);
    --shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    --primary-glow: rgba(160, 116, 74, 0.15);
  }
}

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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
  overflow-x: hidden;
}

/* Skip Link */
.skip-link {
  position: absolute;
  top: -100%;
  left: 50%;
  transform: translateX(-50%);
  background: var(--primary);
  color: #000;
  padding: 8px 16px;
  border-radius: 0 0 8px 8px;
  z-index: 10001;
  text-decoration: none;
  transition: top var(--transition);
}
.skip-link:focus { top: 0; }

/* App Loader */
.app-loader {
  position: fixed;
  inset: 0;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.4s ease;
}
.app-loader.hidden { opacity: 0; pointer-events: none; }
.loader-spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--border);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Background coffee beans pattern */
.bg-pattern {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.bg-bean {
  position: absolute;
  width: 12px;
  height: 18px;
  background: var(--primary-dark);
  border-radius: 50%;
  opacity: 0.06;
}

/* Steam animation */
.steam-container {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 100%;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}
.steam {
  position: absolute;
  bottom: -20px;
  width: 8px;
  height: 40px;
  background: linear-gradient(to top, transparent, var(--primary-glow));
  border-radius: 50%;
  animation: steamRise 4s ease-in infinite;
  opacity: 0;
}
@keyframes steamRise {
  0% { transform: translateY(0) scaleX(1); opacity: 0; }
  20% { opacity: 0.4; }
  60% { opacity: 0.2; transform: translateY(-200px) scaleX(1.5); }
  100% { transform: translateY(-400px) scaleX(2); opacity: 0; }
}

/* Container */
.container {
  position: relative;
  z-index: 1;
  max-width: 600px;
  margin: 0 auto;
  padding: 20px;
}

/* Screen */
.screen { display: none; }
.screen.active { display: block; }

/* Hero */
.hero {
  text-align: center;
  padding: 50px 0 30px;
}
.hero-icon {
  font-size: 64px;
  margin-bottom: 16px;
  display: inline-block;
  animation: cupWobble 3s ease-in-out infinite;
  position: relative;
}
.hero-icon::after {
  content: '';
  position: absolute;
  top: -18px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 30px;
  background: linear-gradient(to top, transparent, var(--primary-glow));
  border-radius: 50%;
  animation: heroSteam 2s ease-in-out infinite;
  opacity: 0;
  pointer-events: none;
}
@keyframes cupWobble {
  0%, 100% { transform: rotate(0deg) scale(1); }
  15% { transform: rotate(-3deg) scale(1.05); }
  30% { transform: rotate(2deg) scale(1.02); }
  45% { transform: rotate(-1deg) scale(1); }
}
@keyframes heroSteam {
  0% { opacity: 0; transform: translateX(-50%) translateY(0) scaleX(1); }
  30% { opacity: 0.5; }
  60% { opacity: 0.3; transform: translateX(-50%) translateY(-15px) scaleX(1.4); }
  100% { opacity: 0; transform: translateX(-50%) translateY(-30px) scaleX(1.8); }
}
.hero h1 {
  font-size: 2rem;
  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: 12px;
}
.subtitle {
  color: var(--text-muted);
  font-size: 1.05rem;
  max-width: 400px;
  margin: 0 auto;
}
.social-proof {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  background: rgba(255,255,255,0.1);
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.time-estimate {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-top: 8px;
}
.result-preview {
  margin-top: 16px;
  padding: 12px 20px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  font-size: 0.9rem;
}
.progress-label {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* Card */
.card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}

/* Progress bar - coffee cup filling */
.progress-container {
  text-align: center;
  margin-bottom: 24px;
}
.coffee-cup-progress {
  position: relative;
  width: 80px;
  height: 100px;
  margin: 0 auto 12px;
}
.coffee-cup-progress svg {
  width: 100%;
  height: 100%;
}
.coffee-fill {
  transition: height 0.5s ease, y 0.5s ease;
}
.progress-text {
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* Question Card */
.question-card {
  animation: fadeInUp 0.4s ease;
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}
.question-number {
  color: var(--primary);
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 12px;
}
.question-text {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
  line-height: 1.5;
}

/* Answer options */
.options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.option-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  min-height: 52px;
  padding: 14px 18px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) / 2);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.95rem;
  cursor: pointer;
  transition: all var(--transition);
  text-align: left;
  line-height: 1.4;
}
.option-btn:hover {
  border-color: var(--primary);
  background: rgba(160, 116, 74, 0.1);
  transform: translateX(4px);
}
.option-btn:active {
  transform: translateX(2px);
}
.option-btn .option-icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}
.option-btn.selected {
  border-color: var(--primary);
  background: rgba(160, 116, 74, 0.15);
  box-shadow: 0 0 15px var(--primary-glow);
}

/* Result screen */
.result-container {
  text-align: center;
  animation: fadeInUp 0.6s ease;
}
.result-coffee-icon {
  font-size: 80px;
  margin-bottom: 16px;
  filter: drop-shadow(0 0 20px var(--primary-glow));
}
.result-mbti {
  display: inline-block;
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary);
  background: rgba(160, 116, 74, 0.1);
  border: 1px solid var(--primary);
  border-radius: 8px;
  padding: 6px 16px;
  margin-bottom: 12px;
  letter-spacing: 2px;
}
.result-coffee-name {
  font-size: 1.8rem;
  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: 8px;
}
.result-tagline {
  color: var(--text-muted);
  font-size: 1rem;
  margin-bottom: 24px;
  font-style: italic;
}
.result-description {
  color: var(--text);
  font-size: 0.95rem;
  line-height: 1.7;
  margin-bottom: 24px;
  text-align: left;
}
.result-traits {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
  margin-bottom: 24px;
}
.trait-tag {
  font-size: 0.8rem;
  padding: 6px 14px;
  border-radius: 20px;
  background: rgba(160, 116, 74, 0.1);
  border: 1px solid var(--border);
  color: var(--primary-light);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: 14px 28px;
  border: none;
  border-radius: calc(var(--radius) / 2);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  gap: 8px;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.1); }
.btn:active { transform: translateY(0); }
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  width: 100%;
  margin-top: 16px;
  font-size: 1.1rem;
  box-shadow: 0 4px 20px var(--primary-glow);
  animation: ctaPulse 2s ease-in-out 1s 3;
}
@keyframes ctaPulse {
  0%, 100% { box-shadow: 0 4px 20px var(--primary-glow); }
  50% { box-shadow: 0 0 0 12px transparent, 0 4px 30px var(--primary-glow); }
}
.btn-primary:hover { box-shadow: 0 6px 30px var(--primary-glow); }
.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border: 1px solid var(--border);
  width: 100%;
  margin-top: 12px;
}

/* Share Section */
.share-section {
  text-align: center;
  margin-top: 24px;
}
.share-section h3 {
  font-size: 1rem;
  color: var(--text-muted);
  margin-bottom: 12px;
}
.share-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
  flex-wrap: wrap;
}
.share-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: calc(var(--radius) / 2);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.85rem;
  cursor: pointer;
  transition: all var(--transition);
  min-height: 44px;
}
.share-btn:hover {
  border-color: var(--primary);
  background: rgba(160, 116, 74, 0.1);
}
.share-btn.kakao:hover { border-color: #FEE500; background: rgba(254, 229, 0, 0.1); }
.share-btn.twitter:hover { border-color: #1DA1F2; background: rgba(29, 161, 242, 0.1); }
.share-btn.facebook:hover { border-color: #1877F2; background: rgba(24, 119, 242, 0.1); }

/* Language selector */
.lang-selector {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 100;
}
.lang-selector select {
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text);
  font-size: 0.8rem;
  cursor: pointer;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  min-height: 44px;
}

/* Responsive */
@media (min-width: 640px) {
  .hero h1 { font-size: 2.5rem; }
  .result-coffee-name { font-size: 2.2rem; }
  .question-text { font-size: 1.3rem; }
}

@media (max-width: 640px) {
  .steam:nth-child(n+4) { display: none; }
  .hero { padding: 16px 0 8px; }
  .hero-icon { font-size: 40px; margin-bottom: 6px; }
  .hero h1 { font-size: 1.5rem; margin-bottom: 6px; }
  .subtitle { font-size: 0.9rem; }
  .social-proof-badge { padding: 4px 12px; margin-bottom: 8px; }
  .social-proof-count { font-size: 0.9rem; }
  .sample-question-preview { display: none; }
  .result-carousel { margin-top: 8px; }
}

@media (max-width: 360px) {
  .share-btn span { display: none; }
  .share-btn { padding: 10px; }
  .hero h1 { font-size: 1.6rem; }
}

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

/* Related Tests */
.related-tests { margin-top: 24px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.1); }
.related-tests h3 { font-size: 16px; color: var(--text-muted, #94a3b8); margin-bottom: 12px; text-align: center; }
.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: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.08); border-radius: 12px;
  text-decoration: none; color: var(--text, #fff);
  transition: transform 0.2s, border-color 0.2s;
}
.related-card:hover { transform: translateY(-2px); border-color: var(--card-color, #3498db); }
.related-emoji { font-size: 28px; }
.related-name { font-size: 12px; font-weight: 600; text-align: center; color: var(--text-muted, #94a3b8); }
[data-theme="light"] .related-card { background: rgba(0,0,0,0.04); border-color: rgba(0,0,0,0.1); }
[data-theme="light"] .related-card:hover { background: rgba(0,0,0,0.06); }

/* Participant stat */
.participant-stat { text-align: center; margin: 12px 0; font-size: 13px; color: var(--text-muted, #94a3b8); }
.participant-stat strong { color: var(--primary, #8B4513); font-size: 15px; }

/* Enhanced social proof badge */
.social-proof-badge {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  border-radius: 24px;
  background: linear-gradient(135deg, rgba(160,116,74,0.15), rgba(160,116,74,0.05));
  border: 1px solid rgba(160,116,74,0.2);
  margin-bottom: 16px;
}
.social-proof-count {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--primary-light);
}
.social-proof-label {
  font-size: 0.8rem;
  color: var(--text-muted);
}
.social-proof-stars {
  display: flex;
  gap: 2px;
  font-size: 0.75rem;
  color: #f5a623;
}

/* Result carousel */
.result-carousel {
  margin-top: 16px;
  padding: 14px 20px;
  border-radius: 12px;
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  min-height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  position: relative;
}
.carousel-item {
  font-size: 0.95rem;
  font-weight: 600;
  animation: carouselFade 0.5s ease;
}
@keyframes carouselFade {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Sample question preview */
.sample-question-preview {
  margin-top: 16px;
  padding: 16px;
  border-radius: 12px;
  background: rgba(255,255,255,0.03);
  border: 1px solid rgba(255,255,255,0.08);
  text-align: left;
}
.sample-q-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 6px;
}
.sample-q-text {
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text);
}
.sample-q-options {
  display: flex;
  flex-direction: column;
  gap: 6px;
  pointer-events: none;
  user-select: none;
}
.sample-q-option {
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Mid-quiz encouragement */
.mid-quiz-msg {
  text-align: center;
  padding: 32px 16px;
  animation: fadeInUp 0.4s ease;
}

/* About / Collapsible Section */
.about-section {
  max-width: 480px;
  margin: 24px auto;
  padding: 0 16px;
}
.about-section details {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 12px;
  overflow: hidden;
}
.about-section summary {
  padding: 14px 18px;
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.about-section summary::after {
  content: "+";
  font-size: 18px;
  color: var(--primary-light);
  transition: transform 0.2s;
}
.about-section details[open] summary::after {
  content: "\2212";
}
.about-section summary::-webkit-details-marker { display: none; }
.about-content {
  padding: 0 18px 18px;
}
.about-content h2 {
  font-size: 16px;
  color: var(--primary-light);
  margin: 16px 0 8px;
}
.about-content p {
  font-size: 14px;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 0 12px;
}
