/* ============================================================
   밀림 진단 도구 — style.css
   The Displacement Diagnostic — Styles
   ============================================================ */

/* ---- RESET & VARIABLES (shared with main site) ---- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  --bg-deep: #0a0a0f;
  --bg-card: #12121a;
  --bg-surface: #1a1a26;
  --text-primary: #f0eeeb;
  --text-secondary: #e8e6e3;
  --text-muted: #c5c5c5;
  --accent-gold: #d4b255;
  --accent-gold-dim: #c9a84c;
  --accent-red: #c0392b;
  --accent-blue: #2c5f8a;
  --border: #2a2a36;
  --serif-kr: 'Pretendard Variable', 'Pretendard', sans-serif;
  --serif-en: 'Cormorant Garamond', serif;
  --sans-kr: 'Pretendard Variable', 'Pretendard', sans-serif;
  --sans-en: 'Inter', sans-serif;
}

html { scroll-behavior: smooth; }

body {
  background: var(--bg-deep);
  color: var(--text-primary);
  font-family: var(--sans-kr);
  line-height: 1.85;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
}

/* ---- LANGUAGE TOGGLE ---- */
[data-lang="en"] { display: none; }
body.en [data-lang="ko"] { display: none; }
body.en [data-lang="en"] { display: block; }
body.en span[data-lang="en"],
span[data-lang="ko"] { display: inline; }
body.en span[data-lang="ko"] { display: none; }
span[data-lang="en"] { display: none; }

.lang-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  background: rgba(18, 18, 26, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}

.lang-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-family: var(--sans-en);
  font-weight: 500;
  letter-spacing: 0.5px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.3s;
}

.lang-btn.active {
  background: var(--accent-gold);
  color: #0a0a0f;
}

/* ---- BACK LINK ---- */
.back-link {
  position: fixed;
  top: 20px;
  left: 20px;
  z-index: 1000;
  font-family: var(--sans-en);
  font-size: 13px;
  color: var(--text-muted);
  text-decoration: none;
  padding: 6px 14px;
  background: rgba(18, 18, 26, 0.9);
  backdrop-filter: blur(12px);
  border: 1px solid var(--border);
  border-radius: 8px;
  transition: all 0.3s;
}

.back-link:hover { color: var(--accent-gold); border-color: var(--accent-gold-dim); }

/* ---- PROGRESS BAR ---- */
.progress-container {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 999;
  height: 3px;
  background: var(--bg-card);
  transition: opacity 0.3s;
}

.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-gold), var(--accent-gold-dim));
  width: 0%;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.progress-label {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 1000;
  font-family: var(--sans-en);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 2px;
  opacity: 0.7;
}

/* ---- SECTIONS (show/hide) ---- */
.diag-section {
  display: none;
  min-height: 100vh;
  padding: 80px 24px;
  max-width: 800px;
  margin: 0 auto;
}

.diag-section.active {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  animation: fadeSlideIn 0.6s ease forwards;
}

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

.diag-section.slide-in-right { animation-name: fadeSlideIn; }
.diag-section.slide-in-left { animation-name: fadeSlideInLeft; }

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

/* ============ INTRO ============ */
.intro-content {
  text-align: center;
  max-width: 640px;
}

.intro-hook-number {
  font-family: var(--serif-en);
  font-size: clamp(72px, 15vw, 140px);
  font-weight: 700;
  color: var(--accent-gold);
  line-height: 1;
  margin-bottom: 8px;
  opacity: 0;
  animation: fadeUp 0.8s 0.2s forwards;
}

.intro-hook-unit {
  font-family: var(--sans-en);
  font-size: 14px;
  font-weight: 500;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 40px;
  opacity: 0;
  animation: fadeUp 0.8s 0.4s forwards;
}

.intro-title {
  font-family: var(--serif-kr);
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 20px;
  opacity: 0;
  animation: fadeUp 0.8s 0.6s forwards;
}

.intro-subtitle {
  font-family: var(--serif-kr);
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.9;
  margin-bottom: 48px;
  opacity: 0;
  animation: fadeUp 0.8s 0.8s forwards;
}

.intro-context {
  font-size: 14px;
  color: var(--text-muted);
  line-height: 1.8;
  margin-bottom: 48px;
  padding: 20px 24px;
  border-left: 2px solid var(--accent-gold-dim);
  text-align: left;
  opacity: 0;
  animation: fadeUp 0.8s 0.9s forwards;
}

.start-btn {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-family: var(--sans-kr);
  font-size: 18px;
  font-weight: 600;
  color: var(--bg-deep);
  background: var(--accent-gold);
  border: none;
  padding: 18px 56px;
  border-radius: 4px;
  cursor: pointer;
  letter-spacing: 1px;
  transition: all 0.3s;
  opacity: 0;
  animation: fadeUp 0.8s 1s forwards;
}

.start-btn:hover {
  background: var(--accent-gold-dim);
  transform: translateY(-2px);
  box-shadow: 0 8px 32px rgba(212, 178, 85, 0.2);
}

.start-btn .arrow {
  font-size: 20px;
  transition: transform 0.3s;
}

.start-btn:hover .arrow { transform: translateX(4px); }

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

/* ============ STEP COMMON ============ */
.step-content {
  width: 100%;
  max-width: 720px;
}

.step-label {
  font-family: var(--sans-en);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 4px;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 20px;
  text-align: center;
}

.step-question {
  font-family: var(--serif-kr);
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 700;
  line-height: 1.4;
  text-align: center;
  margin-bottom: 8px;
}

.step-subtitle {
  font-size: 16px;
  color: var(--text-secondary);
  text-align: center;
  margin-bottom: 48px;
  font-style: italic;
}

/* ============ INDUSTRY GRID ============ */
.industry-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

@media (max-width: 600px) { .industry-grid { grid-template-columns: repeat(2, 1fr); } }

.industry-card {
  padding: 20px 16px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
}

.industry-card:hover {
  border-color: var(--accent-gold-dim);
  background: var(--bg-surface);
  transform: translateY(-2px);
}

.industry-card.selected {
  border-color: var(--accent-gold);
  background: rgba(212, 178, 85, 0.08);
  box-shadow: 0 0 0 1px var(--accent-gold);
}

.industry-icon {
  font-size: 28px;
  margin-bottom: 8px;
  display: block;
}

.industry-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  line-height: 1.4;
}

/* ============ OPTION CARDS ============ */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: 100%;
}

.option-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
  text-align: left;
}

.option-card:hover {
  border-color: var(--accent-gold-dim);
  background: var(--bg-surface);
  transform: translateX(4px);
}

.option-card.selected {
  border-color: var(--accent-gold);
  background: rgba(212, 178, 85, 0.06);
}

.option-letter {
  font-family: var(--serif-en);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-gold);
  min-width: 32px;
  line-height: 1;
  padding-top: 2px;
}

.option-text {
  font-family: var(--serif-kr);
  font-size: 17px;
  color: var(--text-secondary);
  line-height: 1.7;
  flex: 1;
}

.option-card:hover .option-text { color: var(--text-primary); }
.option-card.selected .option-text { color: var(--text-primary); }

.option-tag {
  font-family: var(--sans-en);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 3px 8px;
  border: 1px solid var(--border);
  border-radius: 3px;
  white-space: nowrap;
  align-self: center;
}

.option-card.selected .option-tag {
  border-color: var(--accent-gold-dim);
  color: var(--accent-gold);
}

/* ============ FACT OVERLAY ============ */
.fact-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  background: rgba(10, 10, 15, 0.97);
  backdrop-filter: blur(20px);
  padding: 24px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.4s, visibility 0.4s;
}

.fact-overlay.active {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.fact-number {
  font-family: var(--serif-en);
  font-size: clamp(64px, 12vw, 120px);
  font-weight: 700;
  color: var(--accent-gold);
  line-height: 1;
  margin-bottom: 24px;
  animation: factPulse 2.2s ease;
}

@keyframes factPulse {
  0% { opacity: 0; transform: scale(0.8); }
  20% { opacity: 1; transform: scale(1.02); }
  30% { transform: scale(1); }
  80% { opacity: 1; }
  100% { opacity: 0.7; }
}

.fact-text {
  font-family: var(--serif-kr);
  font-size: clamp(16px, 3vw, 22px);
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 480px;
  white-space: pre-line;
}

/* ============ RESULT BACKGROUND ============ */
.result-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  opacity: 0;
  pointer-events: none;
  transition: opacity 1.5s ease;
  background-size: cover;
  background-position: center 30%;
  background-repeat: no-repeat;
}

.result-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(10, 10, 15, 0.7) 0%,
    rgba(10, 10, 15, 0.82) 30%,
    rgba(10, 10, 15, 0.92) 60%,
    rgba(10, 10, 15, 0.97) 100%
  );
}

.result-bg.active {
  opacity: 1;
}

/* ============ RESULT ============ */
#result {
  padding-top: 60px;
  padding-bottom: 120px;
  position: relative;
  z-index: 1;
}

#result.active {
  justify-content: flex-start;
  align-items: stretch;
}

.result-content {
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

/* Score Gauge */
.score-section {
  text-align: center;
  margin-bottom: 56px;
  padding-top: 40px;
}

.score-gauge {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 24px;
}

.score-gauge svg {
  width: 200px;
  height: 200px;
  transform: rotate(-90deg);
}

.gauge-bg {
  fill: none;
  stroke: var(--border);
  stroke-width: 6;
}

.gauge-fill {
  fill: none;
  stroke: var(--score-color, var(--accent-gold));
  stroke-width: 6;
  stroke-linecap: round;
  stroke-dasharray: 565;
  stroke-dashoffset: 565;
  transition: stroke-dashoffset 1.5s cubic-bezier(0.4, 0, 0.2, 1) 0.3s;
}

.score-gauge.animated .gauge-fill {
  stroke-dashoffset: calc(565 - (565 * var(--score-pct, 0) / 100));
}

.score-number-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.score-number {
  font-family: var(--serif-en);
  font-size: 56px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
}

.score-label {
  font-family: var(--sans-en);
  font-size: 14px;
  color: var(--text-muted);
  margin-top: 4px;
}

/* Archetype Card */
.archetype-card {
  text-align: center;
  padding: 48px 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 48px;
  opacity: 0;
  animation: fadeUp 0.8s 0.8s forwards;
}

.archetype-type {
  font-family: var(--sans-en);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.archetype-name {
  font-family: var(--serif-kr);
  font-size: clamp(32px, 6vw, 48px);
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 24px;
}

body.en .archetype-name {
  font-family: var(--serif-en);
  font-style: italic;
}

.archetype-quote {
  font-family: var(--serif-kr);
  font-size: 18px;
  font-style: italic;
  color: var(--text-secondary);
  line-height: 1.8;
  max-width: 520px;
  margin: 0 auto 28px;
  position: relative;
  padding: 0 24px;
}

.archetype-quote::before {
  content: '\201C';
  font-family: var(--serif-en);
  font-size: 72px;
  color: var(--accent-gold-dim);
  position: absolute;
  top: -32px;
  left: -8px;
  opacity: 0.3;
}

.archetype-desc {
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 2;
  text-align: left;
  padding: 0 8px;
}

/* Answer Tags */
.answer-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 48px;
  opacity: 0;
  animation: fadeUp 0.6s 1s forwards;
}

.answer-tag {
  font-family: var(--sans-en);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.5px;
  color: var(--text-muted);
  padding: 4px 12px;
  border: 1px solid var(--border);
  border-radius: 20px;
}

/* Time Travel */
.time-travel {
  padding: 32px;
  background: rgba(255, 255, 255, 0.015);
  border-left: 2px solid var(--accent-gold-dim);
  margin-bottom: 48px;
  opacity: 0;
  animation: fadeUp 0.6s 1.2s forwards;
}

.time-travel-label {
  font-family: var(--sans-en);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 12px;
}

.time-travel-text {
  font-family: var(--serif-kr);
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 2;
}

/* Strategies */
.strategies-section {
  margin-bottom: 48px;
}

.strategies-label {
  font-family: var(--sans-en);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 20px;
  text-align: center;
  opacity: 0;
  animation: fadeUp 0.6s 1.6s forwards;
}

.strategies-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.strategy-card {
  display: flex;
  gap: 20px;
  padding: 24px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  opacity: 0;
  animation: fadeUp 0.6s forwards;
}

.strategy-num {
  font-family: var(--serif-en);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-gold);
  min-width: 28px;
}

.strategy-title {
  font-size: 16px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 8px;
}

.strategy-detail {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.8;
}

/* Book Recommendation */
.book-rec-section {
  padding: 32px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 4px;
  margin-bottom: 48px;
  opacity: 0;
  animation: fadeUp 0.6s 2.4s forwards;
}

.book-rec-label {
  font-family: var(--sans-en);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 12px;
}

.book-rec-text {
  font-family: var(--serif-kr);
  font-size: 16px;
  color: var(--text-secondary);
  line-height: 2;
  margin-bottom: 16px;
}

.book-rec-link {
  display: inline-block;
  font-family: var(--sans-kr);
  font-size: 14px;
  font-weight: 500;
  color: var(--accent-gold);
  text-decoration: none;
  padding: 8px 20px;
  border: 1px solid var(--accent-gold-dim);
  border-radius: 4px;
  transition: all 0.3s;
}

.book-rec-link:hover {
  background: var(--accent-gold);
  color: var(--bg-deep);
}

/* Share Card Preview */
.share-preview {
  text-align: center;
  margin-bottom: 48px;
  opacity: 0;
  animation: fadeUp 0.6s 2.7s forwards;
}

.share-preview-img {
  max-width: 360px;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.4);
  transition: transform 0.3s;
}

.share-preview-img:hover {
  transform: scale(1.02);
}

/* Uncomfortable Section */
.uncomfortable {
  text-align: center;
  padding: 40px 24px;
  margin-bottom: 48px;
  opacity: 0;
  animation: fadeUp 0.6s 2.6s forwards;
}

.uncomfortable-text {
  font-family: var(--serif-kr);
  font-size: 15px;
  color: var(--text-muted);
  line-height: 1.9;
  font-style: italic;
}

/* Share Section */
.share-section {
  text-align: center;
  padding: 48px 0;
  border-top: 1px solid var(--border);
  opacity: 0;
  animation: fadeUp 0.6s 2.8s forwards;
}

.share-label {
  font-family: var(--sans-en);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 3px;
  text-transform: uppercase;
  color: var(--accent-gold);
  margin-bottom: 8px;
}

.share-prompt {
  font-size: 15px;
  color: var(--text-secondary);
  margin-bottom: 24px;
}

.share-buttons {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.share-btn {
  font-family: var(--sans-en);
  font-size: 13px;
  font-weight: 500;
  padding: 10px 24px;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: var(--bg-card);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.3s;
  letter-spacing: 0.5px;
}

.share-btn:hover {
  border-color: var(--accent-gold-dim);
  color: var(--text-primary);
  background: var(--bg-surface);
}

.share-btn.primary {
  background: var(--accent-gold);
  color: var(--bg-deep);
  border-color: var(--accent-gold);
}

.share-btn.primary:hover {
  background: var(--accent-gold-dim);
}

/* Restart */
.restart-section {
  text-align: center;
  padding: 32px 0;
}

.restart-btn {
  font-family: var(--sans-kr);
  font-size: 14px;
  color: var(--text-muted);
  background: none;
  border: 1px solid var(--border);
  padding: 10px 28px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.3s;
}

.restart-btn:hover {
  color: var(--text-primary);
  border-color: var(--text-muted);
}

/* ---- FOOTER ---- */
.diag-footer {
  text-align: center;
  padding: 32px 24px;
  font-size: 12px;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  max-width: 800px;
  margin: 0 auto;
}

.diag-footer a {
  color: var(--accent-gold);
  text-decoration: none;
}

.diag-footer a:hover { color: var(--accent-gold-dim); }

/* ============ TOAST ============ */
.share-toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  z-index: 3000;
  font-family: var(--sans-kr);
  font-size: 14px;
  font-weight: 500;
  color: var(--bg-deep);
  background: var(--accent-gold);
  padding: 14px 28px;
  border-radius: 8px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
  max-width: 90vw;
  text-align: center;
}

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

/* ============ RESPONSIVE ============ */
@media (max-width: 600px) {
  .diag-section { padding: 60px 16px; }
  .option-card { padding: 18px 16px; gap: 12px; }
  .option-letter { font-size: 20px; min-width: 24px; }
  .option-text { font-size: 15px; }
  .archetype-card { padding: 32px 20px; }
  .strategy-card { padding: 20px 16px; gap: 14px; }
  .score-gauge { width: 160px; height: 160px; }
  .score-gauge svg { width: 160px; height: 160px; }
  .score-number { font-size: 44px; }
  .share-buttons { flex-direction: column; align-items: center; }
  .share-btn { width: 100%; max-width: 280px; }
}

/* ============ REDUCED MOTION ============ */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .diag-section.active,
  .intro-hook-number,
  .intro-hook-unit,
  .intro-title,
  .intro-subtitle,
  .intro-context,
  .start-btn,
  .archetype-card,
  .answer-tags,
  .time-travel,
  .strategies-label,
  .strategy-card,
  .book-rec-section,
  .uncomfortable,
  .share-section {
    opacity: 1 !important;
    transform: none !important;
  }
}
