/* ============================================
   BioFate AI — Global Design System
   관상·손금·족금 AI 분석 서비스
   ============================================ */

/* ── Google Fonts ── */
@import url('https://fonts.googleapis.com/css2?family=Space+Grotesk:wght@400;500;600;700&family=Manrope:wght@300;400;500;600;700;800&family=Noto+Sans+KR:wght@300;400;500;600;700;800;900&family=Noto+Serif+KR:wght@400;700;900&display=swap');

/* ── CSS Custom Properties ── */
:root {
  /* Primary Colors — Mystical-Tech Cyan */
  --primary: #00D4FF;
  --primary-light: #5CE1FF;
  --primary-dark: #0099BB;
  --primary-glow: rgba(0, 212, 255, 0.4);

  /* Neon Palette (Single Source of Truth) */
  --neon-cyan: #00E5FF;
  --neon-purple: #7C3AED;
  --neon-pink: #FF0055;
  --neon-gold: #D4AF37;

  /* Secondary / Gold — Alchemical Gold */
  --gold: #D4A017;
  --gold-light: #FBBF24;
  --gold-dark: #92700C;
  --gold-glow: rgba(212, 160, 23, 0.4);

  /* Accent / Purple */
  --accent: #8B5CF6;
  --accent-glow: rgba(139, 92, 246, 0.3);

  /* Background — Midnight Indigo */
  --bg-cosmic: #0A0A14;
  --bg-surface: rgba(255, 255, 255, 0.03);
  --bg-card: rgba(255, 255, 255, 0.04);
  --bg-glass: rgba(255, 255, 255, 0.06);

  /* Feature Colors */
  --color-face: #10B981;
  --color-palm: #F59E0B;
  --color-foot: #F43F5E;
  --color-saju: #3B82F6;

  /* Text */
  --text-primary: #F1F5F9;
  --text-secondary: #94A3B8;
  --text-muted: #64748B;

  /* Borders */
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-glow: rgba(0, 212, 255, 0.2);

  /* Radius */
  --radius-sm: 0.5rem;
  --radius-md: 1rem;
  --radius-lg: 1.5rem;
  --radius-xl: 2rem;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-glow-purple: 0 0 40px rgba(107, 33, 168, 0.3);
  --shadow-glow-gold: 0 0 40px rgba(212, 160, 23, 0.3);
  --shadow-glow-cyan: 0 0 40px rgba(0, 212, 255, 0.3);
  --shadow-card: 0 8px 32px rgba(0, 0, 0, 0.3);

  /* Transitions */
  --transition-fast: 150ms ease;
  --transition-base: 300ms ease;
  --transition-slow: 500ms ease;

  /* Safe Area */
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);

  /* Font — Mystical-Tech Typography */
  --font-display: 'Space Grotesk', 'Noto Sans KR', sans-serif;
  --font-sans: 'Manrope', 'Noto Sans KR', -apple-system, sans-serif;
  --font-serif: 'Noto Serif KR', Georgia, serif;

  /* Mouse tracking variables */
  --mouse-x: 50%;
  --mouse-y: 50%;
}

/* ── Reset & Base ── */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  font-size: 16px;
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-cosmic);
  color: var(--text-primary);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
  
  /* Desktop App Layout */
  @media (min-width: 768px) {
    display: block;
    background: radial-gradient(circle at center, #1A1A2E 0%, #0A0A14 100%);
  }
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

img, video {
  max-width: 100%;
  display: block;
}

input, select, textarea {
  font-family: inherit;
  font-size: inherit;
}

/* ── Layout Utilities ── */
.page-container {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  position: relative;
  width: 100%;
  max-width: 100%;
  margin: 0 auto;
}

.page-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  padding-top: calc(70px + var(--safe-top));
  padding-bottom: calc(80px + var(--safe-bottom));
}

.container {
  width: 100%;
  margin: 0 auto;
  padding: 0 24px;
  max-width: 1200px;
}

/* Desktop overrides */
@media (min-width: 768px) {
  .container {
    padding: 0 40px;
  }
  .page-content {
    padding-bottom: 40px;
  }
}

@media (min-width: 1200px) {
  .container {
    padding: 0 60px;
  }
}

/* ── Hero Center Layout ── */
.hero-main {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 80vh;
  padding: 80px 0;
  text-align: center;
  overflow: visible;
}

.hero-info-content {
  position: relative;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
  max-width: 800px;
}

/* ── Mystic Compass Background ── */
.mystic-compass-container {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 600px;
  height: 600px;
  z-index: 1;
  pointer-events: none;
  opacity: 0.3;
}

@media (max-width: 768px) {
  .mystic-compass-container {
    width: 320px;
    max-width: 90vw;
    height: 320px;
    max-height: 90vw;
    opacity: 0.2;
  }
}

.mystic-compass {
  position: relative;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.compass-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.ring-outer {
  border: 1px solid rgba(212, 160, 23, 0.2);
  animation: spin-slow 40s linear infinite;
}

.ring-middle {
  inset: 15%;
  border: 1px dashed rgba(139, 92, 246, 0.3);
  animation: spin-reverse-slow 25s linear infinite;
}

.compass-core {
  position: absolute;
  inset: 35%;
  background: rgba(10, 10, 20, 0.8);
  backdrop-filter: blur(10px);
  border: 2px solid rgba(212, 160, 23, 0.4);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 60px rgba(212, 160, 23, 0.2);
  animation: mystic-glow 4s infinite ease-in-out;
}

.yin-yang-wrap {
  width: 80%;
  height: 80%;
  animation: spin-slow 15s linear infinite;
}

.yin-yang {
  width: 100%;
  height: 100%;
  background: linear-gradient(to right, #F1F5F9 50%, #0A0A14 50%);
  border-radius: 50%;
  position: relative;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.yin-dot, .yang-dot {
  position: absolute;
  left: 50%;
  width: 50%;
  height: 50%;
  border-radius: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.yin-dot {
  top: 0;
  background: #F1F5F9;
}
.yin-dot::after {
  content: "";
  width: 25%;
  height: 25%;
  background: #0A0A14;
  border-radius: 50%;
}

.yang-dot {
  bottom: 0;
  background: #0A0A14;
}
.yang-dot::after {
  content: "";
  width: 25%;
  height: 25%;
  background: #F1F5F9;
  border-radius: 50%;
}

.orbit-particle {
  position: absolute;
  border-radius: 50%;
}

.p1 {
  width: 12px;
  height: 12px;
  background: var(--accent);
  box-shadow: 0 0 15px var(--accent);
  animation: orbit 10s linear infinite;
}

.p2 {
  width: 10px;
  height: 10px;
  background: var(--color-foot);
  box-shadow: 0 0 15px var(--color-foot);
  animation: orbit 15s linear infinite reverse;
}

/* ── Typography Additions ── */
.hero-badge {
  font-size: clamp(14px, 2vw, 18px);
  font-weight: 700;
  letter-spacing: 8px;
  margin-bottom: 24px;
}

.hero-subtitle {
  font-size: clamp(1.5rem, 4vw, 2.5rem);
  font-weight: 500;
  margin-bottom: 16px;
  letter-spacing: 2px;
}

.hero-desc {
  font-size: 18px;
  color: var(--text-secondary);
  margin-bottom: 48px;
  font-weight: 300;
}

/* ── Component Fixes ── */
.cta-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  max-width: 440px;
}

.stats-group {
  display: flex;
  align-items: center;
  gap: 32px;
  margin-top: 60px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.stat-value {
  font-size: 32px;
  font-weight: 900;
}

.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
}

.stat-divider {
  width: 1px;
  height: 40px;
  background: rgba(255,255,255,0.1);
}

.logout-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  text-decoration: underline;
  cursor: pointer;
}

.result-tag.face { border-color: rgba(16,185,129,0.3); color: var(--color-face); }
.result-tag.palm { border-color: rgba(245,158,11,0.3); color: var(--color-palm); }
.result-tag.foot { border-color: rgba(244,63,94,0.3); color: var(--color-foot); }
.result-tag.saju { border-color: rgba(59,130,246,0.3); color: var(--color-saju); }

/* ── Nav Bar Additions ── */
.lang-selector {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-full);
  margin-right: 12px;
  cursor: pointer;
  transition: var(--transition-fast);
}

.lang-selector:hover { background: rgba(255, 255, 255, 0.1); border-color: var(--primary-light); }
.lang-text { font-size: 13px; font-weight: 700; color: var(--text-primary); }

@keyframes mystic-glow {
  0%, 100% { box-shadow: 0 0 50px rgba(212,160,23,0.2); }
  50% { box-shadow: 0 0 80px rgba(139,92,246,0.4); }
}

@keyframes spin-slow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes spin-reverse-slow { from { transform: rotate(0deg); } to { transform: rotate(-360deg); } }
@keyframes orbit { from { transform: rotate(0deg) translateX(150px) rotate(0deg); } to { transform: rotate(360deg) translateX(150px) rotate(-360deg); } }


/* ── Responsive Grid Utilities ── */
.grid-dashboard {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

@media (min-width: 768px) {
  .grid-dashboard {
    grid-template-columns: repeat(2, 1fr);
    gap: 24px;
  }
}

@media (min-width: 1200px) {
  .grid-dashboard {
    grid-template-columns: repeat(4, 1fr);
  }
}

.grid-split {
  display: grid;
  grid-template-columns: 1fr;
  gap: 24px;
}

@media (min-width: 1025px) {
  .grid-split {
    grid-template-columns: 400px 1fr;
    align-items: start;
    gap: 40px;
  }
}

@media (min-width: 481px) and (max-width: 1024px) {
  .container {
    max-width: 768px;
    padding: 0 30px;
  }
}

/* ── Cosmic Background ── */
.cosmic-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  background: 
    radial-gradient(ellipse at 20% 20%, rgba(107, 33, 168, 0.15) 0%, transparent 50%),
    radial-gradient(ellipse at 80% 80%, rgba(212, 160, 23, 0.08) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(0, 212, 255, 0.05) 0%, transparent 60%),
    linear-gradient(180deg, #0A0A14 0%, #0F0F23 50%, #0A0A14 100%);
  pointer-events: none;
}

.cosmic-bg::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, transparent 30%, rgba(10, 10, 20, 0.7) 100%);
}

/* ── Particle Stars ── */
.stars {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

.star {
  position: absolute;
  width: 2px;
  height: 2px;
  background: white;
  border-radius: 50%;
  animation: twinkle var(--duration, 3s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
  opacity: 0;
}

@keyframes twinkle {
  0%, 100% { opacity: 0; transform: scale(0.5); }
  50% { opacity: var(--max-opacity, 0.6); transform: scale(1); }
}

/* ── Navigation ── */
.nav-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  padding-top: calc(12px + var(--safe-top));
  background: rgba(10, 10, 20, 0.7);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-subtle);
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-logo-icon {
  width: 32px;
  height: 32px;
  background: linear-gradient(135deg, var(--primary), var(--gold));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
}

.nav-logo-text {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: -0.5px;
  background: linear-gradient(135deg, var(--text-primary), var(--primary-light));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.nav-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-full);
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  font-size: 20px;
  transition: all var(--transition-fast);
}

.nav-btn:hover {
  background: var(--bg-surface);
  color: var(--text-primary);
}

/* ── Bottom Tab Bar (Mobile) ── */
.tab-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 8px 0;
  padding-bottom: calc(8px + var(--safe-bottom));
  background: rgba(10, 10, 20, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-top: 1px solid var(--border-subtle);
}

@media (min-width: 768px) {
  .tab-bar {
    display: none;
  }
}

.tab-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 4px 16px;
  border-radius: var(--radius-md);
  transition: all var(--transition-fast);
  position: relative;
}

.tab-item.active {
  color: var(--primary-light);
}

.tab-item.active::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 20px;
  height: 3px;
  background: var(--primary-light);
  border-radius: var(--radius-full);
}

.tab-icon {
  font-size: 22px;
  line-height: 1;
}

.tab-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.5px;
}

/* ── Glass Card ── */
.glass-card {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: all var(--transition-base);
}

.glass-card:hover {
  border-color: var(--border-glow);
  box-shadow: var(--shadow-glow-purple);
}

.glass-card-sm {
  padding: 16px;
  border-radius: var(--radius-md);
}

/* ── Glow Card (Feature Cards) ── */
.glow-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 28px;
  overflow: hidden;
  transition: all var(--transition-base);
  cursor: pointer;
}

.glow-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--glow-color, var(--primary));
  opacity: 0;
  transition: opacity var(--transition-base);
}

.glow-card:hover::before {
  opacity: 1;
}

.glow-card:hover {
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--glow-color, var(--primary)) 30%, transparent);
  box-shadow: 0 8px 40px color-mix(in srgb, var(--glow-color, var(--primary)) 15%, transparent);
}

.glow-card--face { --glow-color: var(--color-face); }
.glow-card--palm { --glow-color: var(--color-palm); }
.glow-card--foot { --glow-color: var(--color-foot); }
.glow-card--saju { --glow-color: var(--color-saju); }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 28px;
  font-weight: 700;
  font-size: 15px;
  border-radius: var(--radius-md);
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
}

.btn::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(rgba(255,255,255,0.1), transparent);
  opacity: 0;
  transition: opacity var(--transition-fast);
}

.btn:hover::after {
  opacity: 1;
}

.btn:active {
  transform: scale(0.97);
}

.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: white;
  box-shadow: 0 0 30px var(--primary-glow);
}

.btn-primary:hover {
  box-shadow: 0 0 50px var(--primary-glow);
}

.btn-gold {
  background: linear-gradient(135deg, var(--gold), var(--gold-dark));
  color: #1a1a2e;
  box-shadow: 0 0 30px var(--gold-glow);
}

.btn-ghost {
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.btn-ghost:hover {
  border-color: var(--border-glow);
}

.btn-full {
  width: 100%;
}

.btn-lg {
  padding: 18px 36px;
  font-size: 16px;
  border-radius: var(--radius-lg);
}

/* ── Form Inputs ── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-secondary);
  letter-spacing: 0.5px;
}

.form-input {
  width: 100%;
  padding: 14px 16px;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 16px;
  transition: all var(--transition-fast);
  outline: none;
}

.form-input:focus {
  border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
}

.form-input::placeholder {
  color: var(--text-muted);
}

/* Select styling */
.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%2394A3B8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 18px;
  padding-right: 40px;
}

/* ── Grid for time select ── */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.form-row-3 {
  grid-template-columns: 1fr 1fr 1fr;
}

/* ── Section Headers ── */
.section-title {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.section-subtitle {
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

/* ── Score/Progress Ring ── */
.score-ring {
  position: relative;
  width: 120px;
  height: 120px;
}

.score-ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-ring-bg {
  fill: none;
  stroke: var(--bg-surface);
  stroke-width: 8;
}

.score-ring-fill {
  fill: none;
  stroke: var(--primary-light);
  stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 314;
  stroke-dashoffset: 314;
  transition: stroke-dashoffset 1.5s ease;
}

.score-ring-text {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.score-value {
  font-size: 32px;
  font-weight: 900;
  line-height: 1;
}

.score-label {
  font-size: 11px;
  color: var(--text-muted);
  font-weight: 600;
  letter-spacing: 1px;
  text-transform: uppercase;
  margin-top: 4px;
}

/* ── Camera View ── */
.camera-container {
  position: relative;
  width: 100%;
  aspect-ratio: 3 / 4;
  border-radius: var(--radius-xl);
  overflow: hidden;
  background: var(--bg-surface);
  border: 2px solid var(--border-subtle);
}

@media (min-width: 1025px) {
  .camera-container {
    aspect-ratio: 16 / 9;
  }
}

.camera-video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transform: scaleX(-1);
}

.camera-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.camera-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  transform: scaleX(-1);
}

.camera-guide {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-guide-ring {
  width: 200px;
  height: 260px;
  border: 2px dashed rgba(139, 92, 246, 0.4);
  border-radius: 50%;
  animation: pulse-ring 2s ease-in-out infinite;
}

@keyframes pulse-ring {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50% { opacity: 0.8; transform: scale(1.02); }
}

.camera-actions {
  position: absolute;
  bottom: 20px;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
}

.camera-btn-capture {
  width: 70px;
  height: 70px;
  border-radius: 50%;
  background: white;
  border: 4px solid var(--primary-light);
  box-shadow: 0 0 30px var(--primary-glow);
  transition: all var(--transition-fast);
  display: flex;
  align-items: center;
  justify-content: center;
}

.camera-btn-capture:hover {
  transform: scale(1.05);
  box-shadow: 0 0 50px var(--primary-glow);
}

.camera-btn-capture:active {
  transform: scale(0.95);
}

.camera-btn-capture-inner {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
}

/* ── Loading Animation ── */
.mystic-loader {
  position: relative;
  width: 120px;
  height: 120px;
}

.mystic-loader .ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid transparent;
}

.mystic-loader .ring:nth-child(1) {
  border-top-color: var(--primary-light);
  animation: spin 1.5s linear infinite;
}

.mystic-loader .ring:nth-child(2) {
  inset: 10px;
  border-right-color: var(--gold);
  animation: spin-reverse 2s linear infinite;
}

.mystic-loader .ring:nth-child(3) {
  inset: 20px;
  border-bottom-color: var(--accent);
  animation: spin 2.5s linear infinite;
}

.mystic-loader .core {
  position: absolute;
  inset: 30px;
  border-radius: 50%;
  background: radial-gradient(circle, var(--primary-light), var(--primary-dark));
  box-shadow: 0 0 30px var(--primary-glow);
  animation: pulse-core 1.5s ease-in-out infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes spin-reverse {
  to { transform: rotate(-360deg); }
}

@keyframes pulse-core {
  0%, 100% { transform: scale(1); opacity: 0.7; }
  50% { transform: scale(1.1); opacity: 1; }
}

/* ── Floating Orb ── */
.orb {
  border-radius: 50%;
  position: absolute;
  filter: blur(1px);
  animation: float-orb var(--duration, 6s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}

.orb-purple {
  background: radial-gradient(circle at 30% 30%, var(--primary-light), var(--primary-dark));
  box-shadow: 0 0 60px var(--primary-glow);
}

.orb-gold {
  background: radial-gradient(circle at 30% 30%, var(--gold-light), var(--gold-dark));
  box-shadow: 0 0 60px var(--gold-glow);
}

@keyframes float-orb {
  0%, 100% { transform: translateY(0) rotate(0deg); }
  50% { transform: translateY(-20px) rotate(5deg); }
}

/* ── Fade In Animation ── */
.fade-in {
  animation: fadeIn 0.6s ease forwards;
}

.fade-in-up {
  animation: fadeInUp 0.6s ease forwards;
}

.fade-in-left {
  animation: fadeInLeft 0.6s ease forwards;
}

.fade-in-right {
  animation: fadeInRight 0.6s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInRight {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}

.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }

/* ── Utility ── */
.text-center { text-align: center; }
.text-gradient-purple {
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-gold {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-cosmic);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-surface);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

/* ── Result Tag ── */
.result-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ── Progress Bar ── */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 1s ease;
}

/* ── Desktop Layout ── */
@media (min-width: 1025px) {
  .desktop-grid {
    display: grid;
    grid-template-columns: 240px 1fr 360px;
    gap: 24px;
    min-height: calc(100vh - 80px);
  }

  .desktop-sidebar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px 0;
  }

  .desktop-main {
    padding: 20px 0;
  }

  .desktop-panel {
    padding: 20px 0;
  }

  .mobile-only {
    display: none !important;
  }
}

@media (max-width: 1024px) {
  .desktop-only {
    display: none !important;
  }

  .desktop-grid {
    display: flex;
    flex-direction: column;
  }
}

/* ── Landing Hero specific ── */
.hero-title {
  font-size: clamp(3rem, 12vw, 7rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -3px;
}

@media (min-width: 1025px) {
  .hero-title {
    font-size: clamp(5rem, 8vw, 10rem);
  }
}

/* ── Upload Zone ── */
.upload-zone {
  width: 100%;
  min-height: 200px;
  border: 2px dashed var(--border-glow);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  cursor: pointer;
  transition: all var(--transition-base);
  background: var(--bg-glass);
}

.upload-zone:hover {
  border-color: var(--primary-light);
  background: rgba(139, 92, 246, 0.05);
}

.upload-zone.dragover {
  border-color: var(--primary-light);
  background: rgba(139, 92, 246, 0.1);
  box-shadow: 0 0 40px var(--primary-glow);
}

/* ── Material Symbols config ── */
.material-symbols-outlined {
  font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 24;
  user-select: none;
}

/* ── Custom Scrollbar for Drawer ── */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeInLeft {
  from { opacity: 0; transform: translateX(-20px); }
  to { opacity: 1; transform: translateX(0); }
}

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

.delay-100 { animation-delay: 100ms; }
.delay-200 { animation-delay: 200ms; }
.delay-300 { animation-delay: 300ms; }
.delay-400 { animation-delay: 400ms; }
.delay-500 { animation-delay: 500ms; }

/* ── Utility ── */
.text-center { text-align: center; }
.text-gradient-purple {
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.text-gradient-gold {
  background: linear-gradient(135deg, var(--gold-light), var(--gold));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ── Scrollbar ── */
::-webkit-scrollbar {
  width: 6px;
}

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

::-webkit-scrollbar-thumb {
  background: var(--bg-surface);
  border-radius: var(--radius-full);
}

::-webkit-scrollbar-thumb:hover {
  background: var(--primary-dark);
}

/* ── Result Tag ── */
.result-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  background: var(--bg-glass);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-full);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

/* ── Progress Bar ── */
.progress-bar {
  width: 100%;
  height: 6px;
  background: var(--bg-surface);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  transition: width 1s ease;
}

/* ── Desktop Layout ── */
@media (min-width: 1025px) {
  .desktop-grid {
    display: grid;
    grid-template-columns: 240px 1fr 360px;
    gap: 24px;
    min-height: calc(100vh - 80px);
  }

  .desktop-sidebar {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 20px 0;
  }

  .desktop-main {
    padding: 20px 0;
  }

  .desktop-panel {
    padding: 20px 0;
  }

  .mobile-only {
    display: none !important;
  }
}

@media (max-width: 1024px) {
  .desktop-only {
    display: none !important;
  }

  .desktop-grid {
    display: flex;
    flex-direction: column;
  }
}

/* ── Landing Hero specific ── */
.hero-title {
  font-size: clamp(3rem, 12vw, 7rem);
  font-weight: 900;
  line-height: 0.9;
  letter-spacing: -3px;
}

@media (min-width: 1025px) {
  .hero-title {
    font-size: clamp(5rem, 8vw, 10rem);
  }
}

/* ── Upload Zone ── */
.upload-zone {
  width: 100%;
  min-height: 200px;
  border: 2px dashed var(--border-glow);
  border-radius: var(--radius-lg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  cursor: pointer;
  transition: all var(--transition-base);
  background: var(--bg-glass);
}

.upload-zone:hover {
  border-color: var(--primary-light);
  background: rgba(139, 92, 246, 0.05);
}

.upload-zone.dragover {
  border-color: var(--primary-light);
  background: rgba(139, 92, 246, 0.1);
  box-shadow: 0 0 40px var(--primary-glow);
}

/* ── Material Symbols config ── */
.material-symbols-outlined {
  font-variation-settings:
    'FILL' 0,
    'wght' 400,
    'GRAD' 0,
    'opsz' 24;
  user-select: none;
}

/* ── Custom Scrollbar for Drawer ── */
.custom-scrollbar::-webkit-scrollbar {
  width: 6px;
}
.custom-scrollbar::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.02);
  border-radius: 10px;
}
.custom-scrollbar::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 10px;
}
.custom-scrollbar::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

.gnb-icon-emoji {
  width: 12px !important;
  height: 12px !important;
  display: inline-block !important;
  vertical-align: middle !important;
  margin-right: 6px !important;
  fill: currentColor !important;
  color: inherit !important;
  /* active 상태 시 네온 시안 글로우 효과 */
  filter: drop-shadow(0 0 4px rgba(0, 240, 255, 0.8)) !important;
  transition: all 0.2s ease !important;
}

/* ── 전역 텍스트 가독성 긴급 보정 ── */

/* 1. Font Smoothing 적용 (전체 요소 강제화) */
*, *::before, *::after {
  -webkit-font-smoothing: antialiased !important;
  -moz-osx-font-smoothing: grayscale !important;
}

/* 2. 일반 본문 / 디스크립션 폰트 두께 상향 (400 -> 500) */
body, p, span, li, a, td, th, .insight-sub-text, .font-body-md {
  font-weight: 500;
}

/* 3. GNB / View Switcher / 주요 라벨 폰트 두께 상향 (500 -> 600 또는 700) */
h1, h2, h3, h4, h5, h6, 
.gnb-mode-btn, 
[data-sub-mode-btn],
.font-label-mono, 
.font-label-bold-mono,
.grid-label,
.font-headline-sm,
.font-headline-lg,
.font-headline-lg-mobile,
[data-topbar-title],
[data-dropdown-action],
#merged-mode-trigger {
  font-weight: 600 !important;
}

/* 4. 버튼 내 텍스트: font-weight: 700 (Bold) 고정 */
button, 
.action-btn, 
[data-portal-btn], 
.gnb-mode-btn, 
.remove-photo-btn {
  font-weight: 700 !important;
}

/* 5. Inactive (비활성) 텍스트 명도(Contrast) 보정 */
.text-white\/30, .text-white\/40, .text-white\/50, .text-white\/60,
.text-on-surface-variant\/40, .text-on-surface-variant\/30, .text-on-surface-variant\/50 {
  color: #8A99AD !important;
  opacity: 0.8 !important;
}

.opacity-30, .opacity-40, .opacity-50 {
  opacity: 0.75 !important;
}

/* ── GNB 및 스위처 텍스트 가독성 즉시 강제 보정 ── */

/* 1. 상단 모든 텍스트 font-weight 800 고정 */
.gnb-mode-btn, 
[data-sub-mode-btn],
#merged-mode-trigger,
#topbar-unscrolled-menu button,
#topbar-scrolled-menu button {
  font-weight: 800 !important;
  letter-spacing: 0.05em !important;
}

/* 2. 비활성화 텍스트 색상 (CLASSIC / MATRIX HUD 등) 라이트그레이로 고정 */
[data-sub-mode-btn]:not([class*="bg-"]),
.gnb-mode-btn:not([class*="bg-"]):not([class*="text-white"]) {
  color: #D1D5DB !important;
  opacity: 1 !important; /* 투명도 줄이지 않고 글자 색상 자체를 밝게 */
}

/* 3. DUAL 버튼 내 SVG 아이콘 색상을 Neon Cyan(#00F0FF)으로 일치 */
[data-gnb-mode="dual"] svg.gnb-icon-emoji,
#merged-mode-trigger svg.gnb-icon-emoji {
  fill: #00F0FF !important;
  color: #00F0FF !important;
  filter: drop-shadow(0 0 6px rgba(0, 240, 255, 0.9)) !important;
}

/* 4. SOLO 버튼 내 SVG 아이콘 색상 (비활성 시에도 #D1D5DB로 쨍하게) */
[data-gnb-mode="solo"] svg.gnb-icon-emoji {
  fill: currentColor !important;
  color: inherit !important;
}

/* 5. SOLO (1P SCAN) 래퍼 투명화 (JS에서 색상 직접 제어) */
.gnb-solo-wrapper, 
[data-gnb-mode="solo-container"] {
  background: transparent !important;
  box-shadow: none !important;
}

/* ========================================================
   GNB Mode & Submode Button State Styles (CSS-only)
   ======================================================== */
.gnb-mode-btn {
  width: 7rem !important; /* w-28 */
  padding-top: 0.375rem !important; /* py-1.5 */
  padding-bottom: 0.375rem !important;
  border-radius: 9999px !important;
  font-size: 10px !important;
  font-weight: 800 !important;
  text-transform: uppercase !important;
  transition: all 300ms ease !important;
}

@media (min-width: 640px) {
  .gnb-mode-btn {
    width: 8rem !important; /* sm:w-32 */
    padding-top: 0.5rem !important; /* sm:py-2 */
    padding-bottom: 0.5rem !important;
    font-size: 11px !important;
  }
}

.gnb-mode-btn--active-dual {
  background-color: #00838F !important;
  color: #FFFFFF !important;
  box-shadow: 0 0 15px rgba(0, 131, 143, 0.6) !important;
  border: none !important;
}

.gnb-mode-btn--inactive-dual {
  background-color: rgba(8, 145, 178, 0.3) !important;
  color: #CFFAFE !important;
  border: 1px solid #0891b2 !important;
  cursor: pointer !important;
}
.gnb-mode-btn--inactive-dual:hover {
  background-color: rgba(8, 145, 178, 0.5) !important;
  color: #FFFFFF !important;
}

.gnb-mode-btn--active-solo {
  background-color: var(--neon-purple) !important;
  color: #FFFFFF !important;
  box-shadow: 0 0 18px rgba(124, 58, 237, 0.8) !important;
  border: none !important;
}

.gnb-mode-btn--inactive-solo {
  background-color: rgba(124, 58, 237, 0.25) !important;
  color: #E9D5FF !important;
  border: 1px solid var(--neon-purple) !important;
  cursor: pointer !important;
}
.gnb-mode-btn--inactive-solo:hover {
  background-color: rgba(124, 58, 237, 0.40) !important;
  color: #FFFFFF !important;
}

/* Submode buttons styles */
.sub-mode-btn--active-classic {
  color: #FFC107 !important;
  background-color: rgba(255, 193, 7, 0.1) !important;
  border: 1px solid rgba(255, 193, 7, 0.5) !important;
  box-shadow: 0 0 10px rgba(255, 193, 7, 0.4) !important;
}

.sub-mode-btn--active-matrix {
  color: var(--neon-pink) !important;
  background-color: rgba(255, 0, 85, 0.1) !important;
  border: 1px solid rgba(255, 0, 85, 0.5) !important;
  box-shadow: 0 0 10px rgba(255, 0, 85, 0.4) !important;
}

.sub-mode-btn--inactive {
  color: #D1D5DB !important;
  border: 1px solid transparent !important;
  cursor: pointer !important;
}
.sub-mode-btn--inactive:hover {
  color: #FFFFFF !important;
}

/* Toast Animations */
@keyframes nemFadeIn {
  from { opacity: 0; transform: translate(-50%, -10px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

@keyframes nemFadeOut {
  from { opacity: 1; transform: translate(-50%, 0); }
  to { opacity: 0; transform: translate(-50%, -10px); }
}

/* ==========================================
   GNB 메인 탭 버튼 (DUAL / SOLO) 복원 스타일
   ========================================== */

/* 1. 메인 탭 공통 알약 스타일 */
.gnb-tab-btn,
button[class*="po"] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 50px; /* 완벽한 알약 형태 */
  font-weight: 700;
  font-size: 15px;
  transition: all 0.25s ease;
  cursor: pointer;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #a0aec0;
}

/* 2. DUAL (2P) 탭 - 활성화 (청록 네온 글로우) */
.gnb-tab-btn.dual.active,
.po1.active {
  background-color: #008ba3 !important;
  color: #ffffff !important;
  border-color: #00bcd4 !important;
  box-shadow: 0 0 15px rgba(0, 188, 212, 0.6) !important;
}

/* DUAL (2P) 탭 - 비활성화 (은은한 청록 아웃라인) */
.gnb-tab-btn.dual:not(.active),
.po1:not(.active) {
  border: 1px solid #005f73;
  color: #80e2ec;
  background: rgba(0, 95, 115, 0.15);
}

/* 3. SOLO (1P SCAN) 탭 - 활성화 (보라 네온 글로우) */
.gnb-tab-btn.solo.active,
.po2.active {
  background-color: #7c3aed !important;
  color: #ffffff !important;
  border-color: #a78bfa !important;
  box-shadow: 0 0 18px rgba(124, 58, 237, 0.7) !important;
}

/* SOLO (1P SCAN) 탭 - 비활성화 */
.gnb-tab-btn.solo:not(.active),
.po2:not(.active) {
  border: 1px solid #4c1d95;
  color: #c4b5fd;
  background: rgba(76, 29, 149, 0.15);
}


/* ==========================================
   하단 서브 토글 (CLASSIC (BASIC) | MATRIX (HUD))
   ========================================== */

/* 서브 토글 전체 감싸는 블랙 캡슐 바 */
.gnb-sub-toggle,
.po-sub-wrapper {
  display: inline-flex;
  align-items: center;
  background: #090d12;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 50px;
  padding: 4px 12px;
  gap: 8px;
}

/* 서브 버튼 공통 (CLASSIC / MATRIX) */
.gnb-sub-toggle button,
.po3, .po4, .po5 {
  padding: 6px 14px;
  border-radius: 30px;
  color: #8b949e;
  font-size: 13px;
  font-weight: 600;
  background: transparent;
  border: none;
  transition: all 0.2s ease;
}

/* 서브 버튼 구분선 (|) */
.gnb-sub-toggle .divider,
.po-divider {
  color: rgba(255, 255, 255, 0.2);
  font-size: 12px;
  user-select: none;
}

/* CLASSIC (BASIC) 선택 활성화 */
.gnb-sub-toggle .classic.active,
.po3.active, .po4.active {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.1) !important;
}

/* MATRIX (HUD) 선택 활성화 (핫핑크 글로우) */
.gnb-sub-toggle .matrix.active,
.po5.active {
  color: #ff2a85 !important;
  border: 1px solid #ff2a85 !important;
  background: rgba(255, 42, 133, 0.2) !important;
  box-shadow: 0 0 12px rgba(255, 42, 133, 0.5) !important;
}

