/* ============================================
   명운(命韻) - 트렌디한 작명 분석 서비스
   Premium Modern Design System
   ============================================ */

/* === CSS Variables === */
:root {
  --bg-primary: #0a0a0f;
  --bg-secondary: #12121a;
  --bg-card: #1a1a2e;
  --bg-card-hover: #222240;
  --bg-glass: rgba(26, 26, 46, 0.7);
  
  --text-primary: #f0f0f5;
  --text-secondary: #9a9ab0;
  --text-muted: #6a6a80;
  
  --accent-primary: #7c3aed;
  --accent-secondary: #a855f7;
  --accent-glow: rgba(124, 58, 237, 0.3);
  --accent-gradient: linear-gradient(135deg, #7c3aed, #a855f7, #c084fc);
  
  --gold: #f59e0b;
  --gold-light: #fbbf24;
  --gold-gradient: linear-gradient(135deg, #f59e0b, #fbbf24);
  
  --element-wood: #22c55e;
  --element-fire: #ef4444;
  --element-earth: #eab308;
  --element-metal: #a855f7;
  --element-water: #3b82f6;
  
  --grade-s: linear-gradient(135deg, #f59e0b, #f97316);
  --grade-a: linear-gradient(135deg, #a855f7, #7c3aed);
  --grade-b: linear-gradient(135deg, #3b82f6, #2563eb);
  --grade-c: linear-gradient(135deg, #22c55e, #16a34a);
  
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 24px;
  
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.2);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.4);
  --shadow-glow: 0 0 40px var(--accent-glow);
  
  --font-sans: 'Noto Sans KR', -apple-system, sans-serif;
  --font-serif: 'Noto Serif KR', serif;
  
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* === Reset & Base === */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: 16px;
}

body {
  font-family: var(--font-sans);
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.7;
  overflow-x: hidden;
  min-height: 100vh;
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
}

/* === Background Particles === */
.bg-particles {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 3px;
  height: 3px;
  background: var(--accent-secondary);
  border-radius: 50%;
  opacity: 0.15;
  animation: floatParticle 20s infinite;
}

@keyframes floatParticle {
  0%, 100% { transform: translateY(0) translateX(0); opacity: 0; }
  10% { opacity: 0.15; }
  90% { opacity: 0.15; }
  50% { transform: translateY(-400px) translateX(100px); }
}

/* === Navbar === */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  background: rgba(10, 10, 15, 0.8);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(124, 58, 237, 0.1);
  padding: 0 24px;
}

.nav-container {
  max-width: 1100px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 64px;
}

.nav-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  cursor: pointer;
}

.logo-icon {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  font-weight: 900;
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-text {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
}

.nav-links {
  display: flex;
  gap: 8px;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-weight: 500;
  transition: var(--transition);
}

.nav-link:hover, .nav-link.active {
  color: var(--text-primary);
  background: rgba(124, 58, 237, 0.15);
}

/* === Hero Section === */
.hero {
  padding: 120px 24px 60px;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.hero::before {
  content: '';
  position: absolute;
  top: -50%;
  left: 50%;
  transform: translateX(-50%);
  width: 600px;
  height: 600px;
  background: radial-gradient(circle, var(--accent-glow), transparent 70%);
  pointer-events: none;
}

.hero-content {
  position: relative;
  z-index: 1;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 20px;
  background: rgba(124, 58, 237, 0.15);
  border: 1px solid rgba(124, 58, 237, 0.3);
  border-radius: 100px;
  color: var(--accent-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  margin-bottom: 24px;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 900;
  line-height: 1.3;
  margin-bottom: 20px;
  letter-spacing: -0.02em;
}

.title-accent {
  background: var(--accent-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.title-hanja {
  font-family: var(--font-serif);
  color: var(--gold);
  text-shadow: 0 0 30px rgba(245, 158, 11, 0.3);
}

.hero-desc {
  font-size: 1.05rem;
  color: var(--text-secondary);
  line-height: 1.8;
  margin-bottom: 40px;
}

.hero-stats {
  display: flex;
  justify-content: center;
  gap: 48px;
  flex-wrap: wrap;
}

.stat-item {
  text-align: center;
}

.stat-number {
  display: block;
  font-size: 2rem;
  font-weight: 900;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* === Section Headers === */
.section-header {
  text-align: center;
  margin-bottom: 40px;
}

.section-badge {
  display: inline-block;
  padding: 4px 14px;
  background: var(--accent-gradient);
  border-radius: 100px;
  font-size: 0.75rem;
  font-weight: 700;
  color: white;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

.section-header h2 {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
  margin-bottom: 8px;
}

.section-header p {
  color: var(--text-secondary);
  font-size: 0.95rem;
}

/* === Input Section === */
.input-section {
  padding: 40px 0 80px;
  position: relative;
  z-index: 1;
}

.input-card {
  background: var(--bg-card);
  border: 1px solid rgba(124, 58, 237, 0.15);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg);
}

.card-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
  margin-bottom: 24px;
}

.input-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.input-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.input-label i {
  color: var(--accent-secondary);
  font-size: 0.8rem;
}

.input-wrapper {
  position: relative;
}

.input-field {
  width: 100%;
  padding: 14px 18px;
  background: var(--bg-secondary);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 1rem;
  font-family: var(--font-sans);
  transition: var(--transition);
  outline: none;
}

.input-field::placeholder {
  color: var(--text-muted);
}

.input-field:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px var(--accent-glow);
}

.input-hint {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.select-wrapper {
  position: relative;
}

.select-wrapper select {
  appearance: none;
  cursor: pointer;
  padding-right: 40px;
}

.select-icon {
  position: absolute;
  right: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.8rem;
}

/* Gender Select */
.gender-select {
  margin-bottom: 32px;
}

.gender-buttons {
  display: flex;
  gap: 12px;
  margin-top: 8px;
}

.gender-btn {
  flex: 1;
  padding: 14px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius-md);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.95rem;
  font-family: var(--font-sans);
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.gender-btn:hover {
  border-color: var(--accent-primary);
}

.gender-btn.active {
  background: rgba(124, 58, 237, 0.2);
  border-color: var(--accent-primary);
  color: var(--text-primary);
}

.gender-btn.active[data-gender="male"] {
  background: rgba(59, 130, 246, 0.2);
  border-color: #3b82f6;
}

.gender-btn.active[data-gender="female"] {
  background: rgba(236, 72, 153, 0.2);
  border-color: #ec4899;
}

/* Analyze Button */
.analyze-btn {
  width: 100%;
  padding: 18px;
  background: var(--accent-gradient);
  border: none;
  border-radius: var(--radius-md);
  color: white;
  font-size: 1.1rem;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: var(--transition);
  position: relative;
  overflow: hidden;
}

.analyze-btn::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 200%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
  transition: left 0.5s;
}

.analyze-btn:hover::before {
  left: 100%;
}

.analyze-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-glow);
}

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

.input-notice {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 16px;
}

.input-notice i {
  margin-right: 4px;
}

/* === Loading Overlay === */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, 0.95);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}

.loading-content {
  text-align: center;
}

.loading-bagua {
  margin-bottom: 32px;
}

.bagua-spinner {
  font-size: 4rem;
  color: var(--gold);
  animation: spinBagua 3s linear infinite;
  text-shadow: 0 0 30px rgba(245, 158, 11, 0.5);
}

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

.loading-content h3 {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  margin-bottom: 24px;
  color: var(--text-primary);
}

.loading-steps {
  display: flex;
  flex-direction: column;
  gap: 12px;
  text-align: left;
}

.loading-step {
  color: var(--text-secondary);
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  gap: 10px;
  transition: var(--transition);
}

.loading-step.done {
  color: var(--element-wood);
}

.loading-step.done i::before {
  content: "\f00c";
}

/* === Result Section === */
.result-section {
  padding: 100px 0 60px;
  position: relative;
  z-index: 1;
}

.result-block {
  margin-bottom: 60px;
}

/* === Saju Card === */
.saju-card {
  background: var(--bg-card);
  border: 1px solid rgba(124, 58, 237, 0.15);
  border-radius: var(--radius-xl);
  padding: 32px;
  box-shadow: var(--shadow-lg);
}

.saju-pillars {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 32px;
}

.pillar {
  text-align: center;
  padding: 20px 12px;
  background: var(--bg-secondary);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255,255,255,0.05);
}

.pillar-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-bottom: 12px;
  letter-spacing: 0.05em;
}

.pillar-chars {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.pillar-char {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  font-weight: 700;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 2px solid;
}

.pillar-char-name {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.element-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  margin-top: 4px;
}

/* Element colors for pillar chars */
.el-wood { border-color: var(--element-wood); color: var(--element-wood); }
.el-fire { border-color: var(--element-fire); color: var(--element-fire); }
.el-earth { border-color: var(--element-earth); color: var(--element-earth); }
.el-metal { border-color: var(--element-metal); color: var(--element-metal); }
.el-water { border-color: var(--element-water); color: var(--element-water); }

.el-badge-wood { background: rgba(34,197,94,0.15); color: var(--element-wood); }
.el-badge-fire { background: rgba(239,68,68,0.15); color: var(--element-fire); }
.el-badge-earth { background: rgba(234,179,8,0.15); color: var(--element-earth); }
.el-badge-metal { background: rgba(168,85,247,0.15); color: var(--element-metal); }
.el-badge-water { background: rgba(59,130,246,0.15); color: var(--element-water); }

/* Ohaeng Distribution */
.ohaeng-dist {
  margin-top: 24px;
}

.ohaeng-dist h4 {
  font-size: 0.9rem;
  color: var(--text-secondary);
  margin-bottom: 16px;
  font-weight: 600;
}

.ohaeng-bars {
  display: flex;
  gap: 12px;
  align-items: flex-end;
  height: 100px;
  padding: 0 20px;
}

.ohaeng-bar-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}

.ohaeng-bar {
  width: 100%;
  max-width: 60px;
  border-radius: 6px 6px 0 0;
  transition: height 1s ease;
  min-height: 8px;
  position: relative;
}

.ohaeng-bar-count {
  position: absolute;
  top: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--text-primary);
}

.ohaeng-bar-label {
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}

.ohaeng-bar-label span:first-child {
  font-size: 1.1rem;
}

.yongshin-box {
  margin-top: 24px;
  padding: 20px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: var(--radius-md);
}

.yongshin-box h4 {
  color: var(--gold);
  font-size: 0.95rem;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.yongshin-box p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  line-height: 1.7;
}

/* === Top Name Card === */
.top-name-card {
  background: var(--bg-card);
  border: 1px solid rgba(245, 158, 11, 0.3);
  border-radius: var(--radius-xl);
  padding: 40px;
  box-shadow: var(--shadow-lg), 0 0 60px rgba(245, 158, 11, 0.1);
  position: relative;
  overflow: hidden;
}

.top-name-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--gold-gradient);
}

.top-name-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  flex-wrap: wrap;
  gap: 16px;
}

.top-name-title {
  display: flex;
  align-items: baseline;
  gap: 16px;
}

.top-name-hangul {
  font-family: var(--font-serif);
  font-size: 2.8rem;
  font-weight: 900;
}

.top-name-hanja {
  font-family: var(--font-serif);
  font-size: 1.8rem;
  color: var(--gold);
  font-weight: 700;
}

.top-score-badge {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 16px 24px;
  background: rgba(245, 158, 11, 0.1);
  border-radius: var(--radius-lg);
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.top-score-number {
  font-size: 2.5rem;
  font-weight: 900;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.top-score-label {
  font-size: 0.75rem;
  color: var(--gold);
  font-weight: 600;
}

.top-name-meaning {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.meaning-item {
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  text-align: center;
}

.meaning-char {
  font-family: var(--font-serif);
  font-size: 2rem;
  margin-bottom: 4px;
}

.meaning-text {
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.meaning-detail {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.top-name-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  margin-top: 24px;
}

/* === Detail Grid === */
.detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 20px;
}

.detail-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-lg);
  padding: 24px;
  transition: var(--transition);
}

.detail-card:hover {
  border-color: rgba(124, 58, 237, 0.3);
  transform: translateY(-2px);
}

.detail-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.detail-card-title {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.detail-card-title i {
  color: var(--accent-secondary);
}

.detail-score {
  font-size: 1.4rem;
  font-weight: 900;
}

.detail-score.score-high { color: var(--element-wood); }
.detail-score.score-mid { color: var(--gold); }
.detail-score.score-low { color: var(--element-fire); }

.detail-card-body {
  font-size: 0.85rem;
  color: var(--text-secondary);
  line-height: 1.8;
}

.detail-tag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 100px;
  font-size: 0.7rem;
  font-weight: 600;
  margin: 2px;
}

.tag-good { background: rgba(34,197,94,0.15); color: var(--element-wood); }
.tag-normal { background: rgba(234,179,8,0.15); color: var(--element-earth); }
.tag-bad { background: rgba(239,68,68,0.15); color: var(--element-fire); }

/* Samwon mini table */
.samwon-table {
  width: 100%;
  margin-top: 12px;
  border-collapse: collapse;
}

.samwon-table th, .samwon-table td {
  padding: 8px 10px;
  text-align: center;
  font-size: 0.8rem;
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.samwon-table th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.7rem;
}

/* === Name List === */
.list-controls {
  margin-bottom: 20px;
}

.filter-group {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-btn {
  padding: 8px 20px;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 100px;
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: var(--transition);
}

.filter-btn:hover {
  border-color: var(--accent-primary);
}

.filter-btn.active {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
}

.name-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.name-list-item {
  display: grid;
  grid-template-columns: 50px 1fr 140px 140px 80px;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
}

.name-list-item:hover {
  border-color: rgba(124, 58, 237, 0.3);
  background: var(--bg-card-hover);
  transform: translateX(4px);
}

.list-rank {
  font-size: 1.1rem;
  font-weight: 900;
  color: var(--text-muted);
  text-align: center;
}

.list-rank.rank-1 { color: var(--gold); }
.list-rank.rank-2 { color: #c0c0c0; }
.list-rank.rank-3 { color: #cd7f32; }

.list-name-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.list-name {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  font-weight: 700;
}

.list-hanja-meaning {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.list-elements {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.list-scores {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.list-total-score {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.list-grade-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  font-size: 1rem;
  font-weight: 900;
  color: white;
}

.grade-S { background: var(--grade-s); }
.grade-A { background: var(--grade-a); }
.grade-B { background: var(--grade-b); }
.grade-C { background: var(--grade-c); }
.grade-D { background: rgba(100,100,100,0.5); }
.grade-F { background: rgba(239,68,68,0.5); }

/* === Action Buttons === */
.result-actions {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-top: 40px;
  flex-wrap: wrap;
}

.action-btn {
  padding: 14px 32px;
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  transition: var(--transition);
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
}

.action-btn.primary {
  background: var(--accent-gradient);
  color: white;
}

.action-btn.secondary {
  background: var(--bg-card);
  color: var(--text-primary);
  border: 1px solid rgba(255,255,255,0.1);
}

.action-btn.gold {
  background: var(--gold-gradient);
  color: #1a1a2e;
}

.action-btn.small {
  padding: 10px 20px;
  font-size: 0.85rem;
}

.action-btn:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

/* === Modal === */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 10, 15, 0.9);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  overflow-y: auto;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid rgba(124, 58, 237, 0.2);
  border-radius: var(--radius-xl);
  max-width: 600px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  animation: modalIn 0.3s ease;
}

.modal-large {
  max-width: 800px;
}

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

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 24px 28px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.modal-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.2rem;
  cursor: pointer;
  padding: 4px;
  transition: var(--transition);
}

.modal-close:hover {
  color: var(--text-primary);
}

.modal-body {
  padding: 24px 28px 28px;
}

/* Modal Detail Content */
.modal-name-header {
  text-align: center;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.modal-name-big {
  font-family: var(--font-serif);
  font-size: 2.5rem;
  font-weight: 900;
  margin-bottom: 4px;
}

.modal-hanja-big {
  font-family: var(--font-serif);
  font-size: 1.5rem;
  color: var(--gold);
}

.modal-score-circle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 80px;
  height: 80px;
  border-radius: 50%;
  border: 3px solid var(--gold);
  margin-top: 16px;
}

.modal-score-num {
  font-size: 2rem;
  font-weight: 900;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.modal-analysis-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.modal-analysis-item {
  padding: 16px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
}

.modal-analysis-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.modal-analysis-title {
  font-size: 0.9rem;
  font-weight: 700;
}

.modal-analysis-score {
  font-size: 1rem;
  font-weight: 800;
}

.modal-analysis-desc {
  font-size: 0.8rem;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* Saved names */
.saved-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  margin-bottom: 10px;
}

.saved-item-name {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  font-weight: 700;
}

.saved-item-score {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--gold);
}

.saved-item-remove {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 0.9rem;
  padding: 4px 8px;
  transition: var(--transition);
}

.saved-item-remove:hover {
  color: var(--element-fire);
}

.empty-state {
  text-align: center;
  padding: 40px;
  color: var(--text-muted);
}

.empty-state i {
  font-size: 2rem;
  margin-bottom: 12px;
  display: block;
}

/* === Progress Bar === */
.score-bar-wrapper {
  margin-top: 8px;
}

.score-bar-bg {
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}

.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease;
}

.score-bar-fill.bar-high { background: var(--element-wood); }
.score-bar-fill.bar-mid { background: var(--gold); }
.score-bar-fill.bar-low { background: var(--element-fire); }

/* === Footer === */
.footer {
  padding: 40px 0;
  border-top: 1px solid rgba(255,255,255,0.05);
  position: relative;
  z-index: 1;
}

.footer-content {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 24px;
}

.footer-brand p {
  color: var(--text-muted);
  font-size: 0.8rem;
  margin-top: 8px;
}

.footer-info {
  text-align: right;
}

.footer-info p {
  color: var(--text-muted);
  font-size: 0.8rem;
  line-height: 1.8;
}

.footer-info i {
  color: var(--gold);
  margin-right: 4px;
}

/* === Score Colors === */
.score-color-high { color: var(--element-wood); }
.score-color-mid { color: var(--gold); }
.score-color-low { color: var(--element-fire); }

/* === Responsive === */
@media (max-width: 768px) {
  .card-grid {
    grid-template-columns: 1fr;
  }
  
  .input-card {
    padding: 24px;
  }
  
  .saju-pillars {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .hero-stats {
    gap: 24px;
  }
  
  .top-name-header {
    flex-direction: column;
    text-align: center;
  }
  
  .name-list-item {
    grid-template-columns: 40px 1fr auto;
    gap: 12px;
    padding: 14px 16px;
  }
  
  .list-elements, .list-scores {
    display: none;
  }
  
  .detail-grid {
    grid-template-columns: 1fr;
  }
  
  .ohaeng-bars {
    padding: 0;
  }
  
  .footer-content {
    flex-direction: column;
    text-align: center;
  }
  
  .footer-info {
    text-align: center;
  }
  
  .modal-content {
    max-height: 90vh;
    border-radius: var(--radius-lg);
  }
}

@media (max-width: 480px) {
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-desc {
    font-size: 0.9rem;
  }
  
  .hero-desc br {
    display: none;
  }
  
  .saju-pillars {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .pillar-char {
    font-size: 1.4rem;
    width: 44px;
    height: 44px;
  }
  
  .top-name-hangul {
    font-size: 2rem;
  }
  
  .top-name-hanja {
    font-size: 1.3rem;
  }
}

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

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

::-webkit-scrollbar-thumb {
  background: rgba(124, 58, 237, 0.3);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(124, 58, 237, 0.5);
}

/* === Animation utilities === */
.fade-in {
  animation: fadeIn 0.6s ease;
}

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

.slide-in {
  animation: slideIn 0.5s ease;
}

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

/* =============================================
   자동추천 탭 & 탭 시스템 스타일
   ============================================= */

/* Hero Tab Cards */
.hero-tab-cards {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 640px;
  margin: 40px auto 0;
}

.hero-tab-card {
  padding: 24px 20px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-lg);
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  gap: 16px;
  align-items: flex-start;
  text-align: left;
}

.hero-tab-card:hover {
  border-color: rgba(124, 58, 237, 0.3);
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.hero-tab-card.active {
  border-color: var(--accent-primary);
  background: rgba(124, 58, 237, 0.1);
  box-shadow: 0 0 24px var(--accent-glow);
}

.htc-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent-gradient);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  color: white;
  flex-shrink: 0;
}

.hero-tab-card:nth-child(2) .htc-icon {
  background: linear-gradient(135deg, #f59e0b, #f97316);
}

.htc-content h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 4px;
}

.htc-content p {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Nav link text */
.nav-link-text {
  display: inline;
}

@media (max-width: 520px) {
  .nav-link-text { display: none; }
  .nav-link { padding: 8px 12px; }
  .hero-tab-cards { grid-template-columns: 1fr; max-width: 360px; }
}

/* Auto Badge */
.auto-badge {
  background: linear-gradient(135deg, #f59e0b, #f97316) !important;
}

/* Auto Card Styling */
.auto-card {
  border-color: rgba(245, 158, 11, 0.2);
}

.auto-card:hover {
  border-color: rgba(245, 158, 11, 0.4);
}

/* Auto Feature Banner */
.auto-feature-banner {
  display: flex;
  gap: 12px;
  margin-bottom: 28px;
  flex-wrap: wrap;
}

.afb-item {
  flex: 1;
  min-width: 140px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.15);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  color: var(--gold-light);
  font-weight: 500;
}

.afb-item i {
  font-size: 1rem;
  color: var(--gold);
}

/* Auto Button */
.auto-btn {
  background: linear-gradient(135deg, #f59e0b, #f97316) !important;
}

.auto-btn:hover {
  box-shadow: 0 0 40px rgba(245, 158, 11, 0.3) !important;
}

/* ===== Auto TOP 3 ===== */
.auto-top3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

@media (max-width: 768px) {
  .auto-top3 { grid-template-columns: 1fr; }
}

.auto-top3-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.06);
  border-radius: var(--radius-lg);
  padding: 28px 20px;
  text-align: center;
  position: relative;
  overflow: hidden;
  transition: var(--transition);
  cursor: pointer;
}

.auto-top3-card:hover {
  transform: translateY(-4px);
  border-color: rgba(245, 158, 11, 0.4);
  box-shadow: 0 8px 32px rgba(245, 158, 11, 0.1);
}

.auto-top3-card:first-child {
  border-color: rgba(245, 158, 11, 0.4);
}

.auto-top3-card:first-child::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--gold-gradient);
}

.top3-rank {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.75rem;
  font-weight: 900;
  color: white;
}

.top3-rank.rank-1 { background: var(--gold-gradient); }
.top3-rank.rank-2 { background: linear-gradient(135deg, #9ca3af, #6b7280); }
.top3-rank.rank-3 { background: linear-gradient(135deg, #d97706, #92400e); }

.top3-eng-star {
  position: absolute;
  top: 12px;
  right: 12px;
  color: var(--gold);
  font-size: 1rem;
}

.top3-name {
  font-family: var(--font-serif);
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 4px;
  margin-top: 8px;
}

.top3-hanja {
  font-family: var(--font-serif);
  font-size: 1.1rem;
  color: var(--gold);
  margin-bottom: 8px;
}

.top3-meaning {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-bottom: 12px;
  line-height: 1.5;
}

.top3-score {
  font-size: 2rem;
  font-weight: 900;
  background: var(--gold-gradient);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  line-height: 1;
}

.top3-grade {
  font-size: 0.75rem;
  color: var(--gold);
  font-weight: 600;
  margin-top: 4px;
}

.top3-tags {
  display: flex;
  gap: 6px;
  justify-content: center;
  margin-top: 12px;
  flex-wrap: wrap;
}

/* ===== English Name Star ===== */
.eng-star {
  color: var(--gold);
  font-size: 0.85rem;
  cursor: help;
}

.eng-star-tooltip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.eng-info {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  border-radius: 100px;
  font-size: 0.65rem;
  color: var(--gold-light);
  font-weight: 500;
  white-space: nowrap;
}

.eng-info i { font-size: 0.6rem; }

/* Trend Badge */
.trend-badge {
  display: inline-block;
  padding: 2px 8px;
  background: rgba(236, 72, 153, 0.15);
  border: 1px solid rgba(236, 72, 153, 0.3);
  border-radius: 100px;
  font-size: 0.6rem;
  font-weight: 700;
  color: #ec4899;
  letter-spacing: 0.05em;
}

/* Legend */
.auto-legend {
  display: flex;
  gap: 24px;
  justify-content: center;
  padding: 16px;
  margin-bottom: 40px;
  flex-wrap: wrap;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* Auto name list item with eng star */
.name-list-item .list-eng-star {
  color: var(--gold);
  font-size: 0.9rem;
  margin-left: 6px;
}

/* Eng filter button */
.eng-filter {
  border-color: rgba(245, 158, 11, 0.3) !important;
  color: var(--gold-light) !important;
}

.eng-filter.active {
  background: var(--gold-gradient) !important;
  color: #1a1a2e !important;
}

/* Auto name list - wider to fit star */
.auto-name-list-item {
  display: grid;
  grid-template-columns: 50px 1fr auto 140px 80px;
  align-items: center;
  gap: 16px;
  padding: 18px 24px;
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: var(--radius-md);
  transition: var(--transition);
  cursor: pointer;
}

.auto-name-list-item:hover {
  border-color: rgba(124, 58, 237, 0.3);
  background: var(--bg-card-hover);
  transform: translateX(4px);
}

@media (max-width: 768px) {
  .auto-name-list-item {
    grid-template-columns: 40px 1fr auto auto;
    gap: 10px;
    padding: 14px 16px;
  }
  .auto-name-list-item .list-scores { display: none; }
}

@media (max-width: 480px) {
  .auto-feature-banner { flex-direction: column; }
  .afb-item { min-width: auto; }
}
