/* ==========================================================================
   JEJU MYTHology GOD PERSONALITY TEST - STYLESHEET
   ========================================================================== */

:root {
  /* Color System */
  --bg-main: #0c0e12;
  --bg-container: #faf7f2;
  --bg-card: #ffffff;
  --bg-card-muted: #f4efea;
  
  --primary-emerald: #059669;
  --primary-emerald-dark: #047857;
  --primary-emerald-soft: rgba(5, 150, 105, 0.1);

  --accent-tangerine: #f97316;
  --accent-tangerine-hover: #ea580c;
  --accent-tangerine-soft: rgba(249, 115, 22, 0.12);

  --accent-gold: #d97706;
  --accent-gold-soft: rgba(217, 119, 6, 0.1);

  --text-dark: #1f2937;
  --text-muted: #4b5563;
  --text-light: #9ca3af;
  --text-white: #ffffff;

  --border-color: #e5e0d8;
  --border-highlight: rgba(5, 150, 105, 0.3);

  /* Typography */
  --font-body: 'Noto Sans KR', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-title: 'Gowun Batang', serif;

  /* Shadows & Radius */
  --radius-xl: 24px;
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;

  --shadow-sm: 0 4px 12px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 10px 25px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 20px 45px rgba(0, 0, 0, 0.2);
  --shadow-glow: 0 0 25px rgba(249, 115, 22, 0.4);
}

/* Reset & Global */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  background-color: var(--bg-main);
  background-image: 
    radial-gradient(circle at 15% 20%, rgba(5, 150, 105, 0.15) 0%, transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(249, 115, 22, 0.12) 0%, transparent 40%);
  font-family: var(--font-body);
  color: var(--text-dark);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 0;
}

/* App Container (Responsive Base: Max 850px, Centered) */
.app-container {
  width: 100%;
  max-width: 850px;
  min-height: 100vh;
  background-color: var(--bg-container);
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

@media (min-width: 640px) {
  .app-container {
    min-height: 820px;
    height: auto;
    margin: 30px auto;
    border-radius: var(--radius-xl);
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
}

/* Screen Views Management (Strict Separation) */
.screen {
  display: none !important;
  flex-direction: column;
  flex: 1;
  width: 100%;
  padding: 28px 24px;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.screen.active {
  display: flex !important;
}

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

/* ==========================================================================
   1. START SCREEN (Full-Screen Hero Mythic Background)
   ========================================================================== */
.screen-start {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  width: 100%;
  justify-content: center;
  align-items: center;
  text-align: center;
  padding: 56px 28px;
  /* User-provided main.png full-screen background with dark gradient overlay for maximum legibility */
  background-image: 
    linear-gradient(rgba(0, 0, 0, 0.45), rgba(0, 0, 0, 0.78)),
    url('./images/main.png');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  color: var(--text-white);
  overflow: hidden;
}

.start-bg-overlay {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 50% 50%, transparent 20%, rgba(10, 14, 23, 0.6) 100%);
  pointer-events: none;
  z-index: 1;
}

/* Floating Mystic Ambient Orbs (Softened) */
.mystic-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(50px);
  pointer-events: none;
  z-index: 1;
  opacity: 0.6;
  animation: orbFloat 8s infinite ease-in-out alternate;
}

.orb-1 {
  width: 220px;
  height: 220px;
  background: rgba(13, 148, 136, 0.3);
  top: 10%;
  left: -30px;
}

.orb-2 {
  width: 280px;
  height: 280px;
  background: rgba(245, 158, 11, 0.25);
  bottom: 10%;
  right: -40px;
  animation-delay: -3s;
}

.orb-3 {
  width: 160px;
  height: 160px;
  background: rgba(249, 115, 22, 0.2);
  top: 50%;
  left: 70%;
  animation-delay: -5s;
}

@keyframes orbFloat {
  0% { transform: translate(0, 0) scale(1); }
  50% { transform: translate(20px, -25px) scale(1.08); }
  100% { transform: translate(-15px, 15px) scale(0.95); }
}

.start-content {
  position: relative;
  z-index: 2;
  max-width: 640px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* Badge ("★ 1만 8천 신들의 고향") */
.badge-wrapper {
  margin-bottom: 24px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(13, 148, 136, 0.35);
  color: #fef08a; /* Glowing Soft Gold */
  border: 1px solid rgba(251, 191, 36, 0.8);
  font-size: 0.95rem;
  font-weight: 700;
  padding: 8px 24px;
  border-radius: 999px;
  letter-spacing: 1.5px;
  box-shadow: 
    0 0 20px rgba(245, 158, 11, 0.4),
    inset 0 0 10px rgba(255, 255, 255, 0.2);
  backdrop-filter: blur(10px);
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9);
}

/* Title ("나와 닮은 제주 신화 속 신 찾기") - Unified White Color & High Contrast */
.main-title {
  font-family: var(--font-title);
  font-size: 2.7rem;
  font-weight: 700;
  line-height: 1.35;
  margin-bottom: 22px;
  color: #ffffff !important; /* Unified bright white */
  text-shadow: 
    0 3px 10px rgba(0, 0, 0, 0.95),
    0 6px 24px rgba(0, 0, 0, 0.9),
    0 0 30px rgba(13, 148, 136, 0.5);
  word-break: keep-all;
  letter-spacing: -0.5px;
}

.title-highlight {
  color: #ffffff !important;
  background: none !important;
  -webkit-background-clip: initial !important;
  -webkit-text-fill-color: initial !important;
}

@media (min-width: 640px) {
  .main-title {
    font-size: 3.6rem;
  }
}

.sub-title {
  font-size: 1.08rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 44px;
  word-break: keep-all;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.7);
  max-width: 540px;
}

/* Base Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 36px;
  font-size: 1.1rem;
  font-weight: 700;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  transition: all 0.25s ease;
  font-family: var(--font-body);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent-tangerine), var(--accent-tangerine-hover));
  color: var(--text-white);
  box-shadow: 0 8px 20px rgba(249, 115, 22, 0.35);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(249, 115, 22, 0.5);
}

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

/* 3D Glow CTA Button ('신화 속으로 들어가기 ->') */
.cta-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 18px 44px;
  font-size: 1.15rem;
  font-weight: 800;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  font-family: var(--font-body);
  background: linear-gradient(135deg, #f97316 0%, #ea580c 50%, #d97706 100%);
  color: #ffffff;
  box-shadow: 
    0 10px 28px rgba(249, 115, 22, 0.45),
    inset 0 1px 1px rgba(255, 255, 255, 0.4);
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
  position: relative;
  overflow: hidden;
}

.cta-button:hover {
  transform: translateY(-4px) scale(1.03);
  box-shadow: 
    0 16px 36px rgba(249, 115, 22, 0.7),
    0 0 45px rgba(245, 158, 11, 0.6);
  border-color: rgba(255, 255, 255, 0.6);
}

.cta-button:active {
  transform: translateY(-1px) scale(1);
}

.cta-button .arrow-icon {
  transition: transform 0.3s ease;
}

.cta-button:hover .arrow-icon {
  transform: translateX(6px);
}

.btn-glow {
  animation: mythicPulse 2.4s infinite ease-in-out alternate;
}

@keyframes mythicPulse {
  0% {
    box-shadow: 0 8px 24px rgba(249, 115, 22, 0.4), 0 0 15px rgba(13, 148, 136, 0.2);
  }
  100% {
    box-shadow: 0 14px 38px rgba(249, 115, 22, 0.75), 0 0 35px rgba(245, 158, 11, 0.5);
  }
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text-dark);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
}

.btn-secondary:hover {
  background: var(--bg-card-muted);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* ==========================================================================
   2. QUESTION SCREEN
   ========================================================================== */
.screen-question {
  justify-content: space-between;
  background-color: var(--bg-container);
  padding: 32px 24px;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 32px;
}

.progress-bar-container {
  flex: 1;
  height: 12px;
  background-color: #e2ded7;
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  width: 8.33%; /* 1/12 */
  background: linear-gradient(90deg, var(--primary-emerald), var(--accent-tangerine));
  border-radius: 999px;
  transition: width 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.question-counter {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary-emerald-dark);
  background: var(--primary-emerald-soft);
  padding: 6px 14px;
  border-radius: 999px;
  white-space: nowrap;
}

.question-card-wrapper {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  max-width: 680px;
  margin: 0 auto;
  width: 100%;
}

.question-card {
  background: var(--bg-card);
  padding: 36px 28px;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  margin-bottom: 28px;
  text-align: center;
}

.step-badge {
  display: inline-block;
  color: var(--accent-tangerine);
  font-weight: 800;
  font-size: 0.85rem;
  letter-spacing: 1.5px;
  margin-bottom: 12px;
}

.question-title {
  font-family: var(--font-title);
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.55;
  color: var(--text-dark);
  word-break: keep-all;
}

@media (min-width: 640px) {
  .question-title {
    font-size: 1.55rem;
  }
}

.options-container {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.btn-option {
  display: flex;
  align-items: center;
  padding: 20px 24px;
  background: var(--bg-card);
  border: 2px solid var(--border-color);
  border-radius: var(--radius-md);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 500;
  color: var(--text-dark);
  line-height: 1.5;
  box-shadow: var(--shadow-sm);
}

.btn-option:hover {
  border-color: var(--primary-emerald);
  background: var(--primary-emerald-soft);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

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

.option-prefix {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  background: var(--bg-card-muted);
  color: var(--primary-emerald-dark);
  font-weight: 800;
  font-size: 0.95rem;
  border-radius: 50%;
  margin-right: 16px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.btn-option:hover .option-prefix {
  background: var(--primary-emerald);
  color: var(--text-white);
}

.option-text {
  flex: 1;
  word-break: keep-all;
}

/* ==========================================================================
   3. LOADING SCREEN (Max 1 Second Transition)
   ========================================================================== */
.screen-loading {
  justify-content: center;
  align-items: center;
  text-align: center;
  background-color: var(--bg-container);
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: 400px;
}

.mystic-spinner {
  position: relative;
  width: 80px;
  height: 80px;
  margin-bottom: 28px;
}

.spinner-ring {
  position: absolute;
  inset: 0;
  border: 4px solid var(--primary-emerald-soft);
  border-top-color: var(--accent-tangerine);
  border-right-color: var(--primary-emerald);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

.spinner-core {
  position: absolute;
  inset: 16px;
  background: linear-gradient(135deg, var(--accent-tangerine), var(--primary-emerald));
  border-radius: 50%;
  opacity: 0.7;
  animation: pulseCore 1s ease-in-out infinite alternate;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

@keyframes pulseCore {
  0% { transform: scale(0.8); opacity: 0.5; }
  100% { transform: scale(1.1); opacity: 0.9; }
}

.loading-title {
  font-family: var(--font-title);
  font-size: 1.4rem;
  color: var(--text-dark);
  margin-bottom: 12px;
}

.loading-desc {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==========================================================================
   4. RESULT SCREEN
   ========================================================================== */
.screen-result {
  overflow-y: auto;
  padding: 32px 20px;
}

.result-card {
  background: var(--bg-card);
  max-width: 720px;
  margin: 0 auto;
  width: 100%;
  border-radius: var(--radius-xl);
  padding: 32px 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--border-color);
  text-align: center;
}

@media (min-width: 640px) {
  .result-card {
    padding: 44px 36px;
  }
}

.result-badge {
  display: inline-block;
  background: var(--primary-emerald-soft);
  color: var(--primary-emerald-dark);
  font-weight: 700;
  font-size: 0.85rem;
  padding: 6px 16px;
  border-radius: 999px;
  margin-bottom: 20px;
  letter-spacing: 1px;
}

/* 3:4 Vertical Image Aspect Ratio strictly formatted */
.result-image-wrapper {
  width: 100%;
  max-width: 320px;
  aspect-ratio: 3 / 4;
  margin: 0 auto 24px auto;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 3px solid var(--bg-container);
  background: var(--bg-card-muted);
}

.result-god-img {
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 16px;
  display: block;
  transition: transform 0.4s ease;
}

.result-god-img:hover {
  transform: scale(1.03);
}

.result-header {
  margin-bottom: 28px;
}

.result-subtitle {
  font-size: 1rem;
  font-weight: 600;
  color: var(--accent-tangerine);
  display: block;
  margin-bottom: 8px;
}

.result-god-name {
  font-family: var(--font-title);
  font-size: 2.2rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 14px;
}

.hashtags-wrapper {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin-bottom: 12px;
}

.hashtag {
  background: var(--bg-card-muted);
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 4px 12px;
  border-radius: 999px;
}

.result-details {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
  margin-bottom: 36px;
}

.detail-box {
  background: var(--bg-container);
  padding: 20px 22px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
}

.detail-box h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-dark);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.detail-box p {
  font-size: 0.95rem;
  color: var(--text-muted);
  line-height: 1.6;
  word-break: keep-all;
}

.compatibility-box {
  background: var(--accent-tangerine-soft);
  border-color: rgba(249, 115, 22, 0.3);
}

.compatibility-box h3 {
  color: var(--accent-tangerine-hover);
}

.compat-name {
  display: inline-block;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text-dark);
  margin-bottom: 4px;
}

.result-actions {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}

@media (min-width: 640px) {
  .result-actions {
    grid-template-columns: 1fr 1fr;
  }
}

/* ==========================================================================
   5. ENCYCLOPEDIA MODAL & GOD CARDS GRID
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(12, 14, 18, 0.82);
  backdrop-filter: blur(8px);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fadeIn 0.25s ease forwards;
}

.modal-overlay.active {
  display: flex;
}

.modal-content {
  background: var(--bg-container);
  border-radius: var(--radius-xl);
  width: 100%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.modal-lg {
  max-width: 900px;
}

.modal-md {
  max-width: 640px;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
}

.modal-header h2 {
  font-family: var(--font-title);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-dark);
}

.modal-close-btn {
  background: var(--bg-card-muted);
  border: none;
  font-size: 1.8rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  transition: all 0.2s ease;
  line-height: 1;
}

.modal-close-btn:hover {
  background: #e2ded7;
  color: var(--text-dark);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-intro {
  font-size: 0.92rem;
  color: var(--text-muted);
  margin-bottom: 20px;
  text-align: center;
}

/* 16 Gods Vertical Grid: PC 4 Columns / Mobile 2 Columns */
.gods-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
}

@media (min-width: 640px) {
  .gods-grid {
    grid-template-columns: repeat(4, 1fr);
    gap: 20px;
  }
}

.god-card-thumb {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.god-card-thumb:hover {
  transform: translateY(-5px);
  box-shadow: var(--shadow-md);
  border-color: var(--primary-emerald);
}

.god-thumb-img-wrapper {
  width: 100%;
  aspect-ratio: 3 / 4;
  overflow: hidden;
  background: var(--bg-card-muted);
}

.god-thumb-img-wrapper img {
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 16px;
  transition: transform 0.3s ease;
}

.god-card-thumb:hover .god-thumb-img-wrapper img {
  transform: scale(1.05);
}

.god-thumb-info {
  padding: 12px;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.god-thumb-name {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text-dark);
}

.god-thumb-sub {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   6. GOD DETAIL MODAL
   ========================================================================== */
.detail-modal-body {
  padding: 32px 24px;
  overflow-y: auto;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

@media (min-width: 640px) {
  .detail-modal-body {
    flex-direction: row;
    align-items: flex-start;
  }
}

.detail-img-container {
  width: 100%;
  max-width: 240px;
  aspect-ratio: 3 / 4;
  margin: 0 auto;
  flex-shrink: 0;
  border-radius: 16px;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 2px solid var(--border-color);
  background: var(--bg-card-muted);
}

.detail-god-img {
  width: 100%;
  height: 100%;
  aspect-ratio: 3 / 4;
  object-fit: cover;
  border-radius: 16px;
}

.detail-info-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.detail-subtitle {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--accent-tangerine);
}

.detail-title {
  font-family: var(--font-title);
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-dark);
}

.detail-oneline {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--primary-emerald-dark);
  background: var(--primary-emerald-soft);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  margin-top: 4px;
}

.detail-story-box {
  background: var(--bg-card);
  padding: 16px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border-color);
  margin-top: 8px;
}

.detail-story-box h4 {
  font-size: 0.95rem;
  margin-bottom: 8px;
  color: var(--text-dark);
}

.detail-story-box p {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.6;
  word-break: keep-all;
}

/* Scrollbar Customization */
::-webkit-scrollbar {
  width: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-container);
}

::-webkit-scrollbar-thumb {
  background: #d1c9bf;
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: #b5ac9f;
}
