/* ===== style.css — 감성 일러스트풍 (보라+크림+로즈골드) ===== */

/* ──────────────────────────────────────
   CSS Custom Properties
   ────────────────────────────────────── */
:root {
  --violet-400: #a855f7;
  --violet-500: #9333ea;
  --violet-600: #7c3aed;
  --warm-gold: #d4a574;
  --rose-gold: #e8b4b8;
  --cream-50: #fefcf9;
  --cream-100: #f8f4ef;
  --charcoal: #2d2d3f;
  --charcoal-light: #6b6b80;

  /* 오행 */
  --el-wood: #6db584;
  --el-fire: #e87f7f;
  --el-earth: #d4b56a;
  --el-metal: #b0b0c0;
  --el-water: #7ba4e0;
}

/* ──────────────────────────────────────
   배경
   ────────────────────────────────────── */
.app-bg {
  background-color: var(--cream-50);
  background-image:
    radial-gradient(ellipse at 10% 20%, rgba(168, 85, 247, 0.06) 0%, transparent 55%),
    radial-gradient(ellipse at 90% 70%, rgba(232, 180, 184, 0.07) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(212, 165, 116, 0.03) 0%, transparent 60%);
  min-height: 100vh;
}

/* 레거시 이름 호환 */
.hanji-bg {
  background-color: var(--cream-50);
  background-image:
    radial-gradient(ellipse at 10% 20%, rgba(168, 85, 247, 0.06) 0%, transparent 55%),
    radial-gradient(ellipse at 90% 70%, rgba(232, 180, 184, 0.07) 0%, transparent 50%),
    radial-gradient(ellipse at 50% 50%, rgba(212, 165, 116, 0.03) 0%, transparent 60%);
  min-height: 100vh;
}

.hero-bg {
  background: linear-gradient(135deg,
    #7c3aed 0%,
    #6d28d9 35%,
    #4f46e5 70%,
    #4338ca 100%
  );
}

/* 레거시 이름 호환 */
.hero-gradient {
  background: linear-gradient(135deg,
    #7c3aed 0%,
    #6d28d9 35%,
    #4f46e5 70%,
    #4338ca 100%
  );
}

/* ──────────────────────────────────────
   Glass Card
   ────────────────────────────────────── */
.glass-card {
  background: rgba(255, 255, 255, 0.70);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(168, 85, 247, 0.15);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 16px rgba(168, 85, 247, 0.06);
  transition: box-shadow 0.25s ease;
}

.glass-card:hover {
  box-shadow: 0 4px 24px rgba(168, 85, 247, 0.10);
}

.glass-card h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(168, 85, 247, 0.15);
}

/* 레거시: result-card -> glass-card 호환 */
.result-card {
  background: rgba(255, 255, 255, 0.70);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(168, 85, 247, 0.15);
  border-radius: 1rem;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: 0 2px 16px rgba(168, 85, 247, 0.06);
}

.result-card h3 {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--charcoal);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(168, 85, 247, 0.15);
}

/* ──────────────────────────────────────
   Tab Navigation
   ────────────────────────────────────── */
.tab-bar {
  display: flex;
  border-bottom: 1px solid rgba(168, 85, 247, 0.15);
  gap: 0;
}

.tab-btn {
  flex: 1;
  padding: 0.75rem 1rem;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 500;
  color: rgba(45, 45, 63, 0.50);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.2s, border-color 0.2s;
}

.tab-btn:hover {
  color: var(--violet-400);
}

.tab-btn.active {
  color: var(--violet-500);
  font-weight: 600;
  border-bottom-color: var(--violet-500);
}

/* ──────────────────────────────────────
   Buttons
   ────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  color: #fff;
  font-weight: 600;
  padding: 0.875rem 2rem;
  border-radius: 0.75rem;
  border: none;
  cursor: pointer;
  font-size: 1.05rem;
  transition: all 0.2s ease;
  box-shadow: 0 2px 12px rgba(168, 85, 247, 0.30);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(168, 85, 247, 0.40);
  background: linear-gradient(135deg, #9333ea, #6d28d9);
}

.btn-primary:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(168, 85, 247, 0.25);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

.btn-secondary {
  background: transparent;
  color: var(--violet-500);
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 0.75rem;
  border: 1.5px solid var(--violet-400);
  cursor: pointer;
  font-size: 0.95rem;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(168, 85, 247, 0.06);
  border-color: var(--violet-500);
}

/* ──────────────────────────────────────
   Form Elements
   ────────────────────────────────────── */
.form-select,
.form-input {
  background: rgba(255, 255, 255, 0.85);
  border: 1px solid rgba(168, 85, 247, 0.20);
  border-radius: 0.5rem;
  padding: 0.625rem 0.75rem;
  font-size: 0.95rem;
  color: var(--charcoal);
  width: 100%;
  transition: border-color 0.2s, box-shadow 0.2s;
  -webkit-appearance: none;
  appearance: none;
}

.form-select:focus,
.form-input:focus {
  outline: none;
  border-color: var(--violet-400);
  box-shadow: 0 0 0 3px rgba(168, 85, 247, 0.12);
}

.form-select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath d='M6 8L1 3h10z' fill='%239333ea'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  padding-right: 2rem;
}

/* 성별 토글 */
.gender-radio {
  display: flex;
  gap: 0;
  border: 1px solid rgba(168, 85, 247, 0.20);
  border-radius: 0.5rem;
  overflow: hidden;
}

.gender-radio label {
  flex: 1;
  padding: 0.625rem 1rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.85);
}

.gender-radio label:first-child {
  border-right: 1px solid rgba(168, 85, 247, 0.20);
}

.gender-radio input[type="radio"] {
  display: none;
}

.gender-radio input[type="radio"]:checked + label,
.gender-radio label:has(input:checked) {
  background: rgba(168, 85, 247, 0.15);
  color: var(--charcoal);
  font-weight: 600;
}

.gender-option {
  flex: 1;
  text-align: center;
  padding: 0.625rem 1rem;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 0.95rem;
  background: rgba(255, 255, 255, 0.85);
  border-radius: 0.375rem;
}

.gender-option.active {
  background: rgba(168, 85, 247, 0.18);
  color: var(--violet-600);
  font-weight: 600;
}

/* ──────────────────────────────────────
   Pillar Cards (사주 4주)
   ────────────────────────────────────── */
.pillar-card {
  background: rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(168, 85, 247, 0.15);
  border-radius: 0.75rem;
  padding: 1rem 0.5rem;
  text-align: center;
  transition: transform 0.2s, box-shadow 0.2s;
}

.pillar-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 18px rgba(168, 85, 247, 0.12);
}

.pillar-card .stem-char,
.pillar-card .branch-char {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.3;
}

.pillar-card .hanja-char {
  font-size: 0.85rem;
  opacity: 0.5;
}

.pillar-card .divider {
  width: 60%;
  margin: 0.5rem auto;
  border-top: 1px solid rgba(168, 85, 247, 0.20);
}

.pillar-card .label {
  font-size: 0.75rem;
  color: var(--charcoal-light);
}

/* ──────────────────────────────────────
   Element Bars (오행 바)
   ────────────────────────────────────── */
.element-bar {
  height: 1.5rem;
  border-radius: 0.25rem;
  transition: width 0.8s ease-out;
  min-width: 0;
}

/* ──────────────────────────────────────
   Daeun Timeline (대운)
   ────────────────────────────────────── */
.daeun-scroll {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.daeun-scroll::-webkit-scrollbar {
  height: 4px;
}

.daeun-scroll::-webkit-scrollbar-track {
  background: rgba(168, 85, 247, 0.08);
  border-radius: 2px;
}

.daeun-scroll::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.25);
  border-radius: 2px;
}

.daeun-item {
  flex-shrink: 0;
  width: 5.5rem;
  text-align: center;
  border: 1px solid rgba(168, 85, 247, 0.18);
  border-radius: 0.5rem;
  padding: 0.75rem 0.25rem;
  background: rgba(255, 255, 255, 0.55);
  transition: all 0.2s;
}

.daeun-item:hover {
  border-color: var(--violet-400);
}

.daeun-item.current {
  background: rgba(168, 85, 247, 0.12);
  border-color: var(--violet-500);
  box-shadow: 0 0 0 2px rgba(168, 85, 247, 0.15);
}

/* ──────────────────────────────────────
   Sinsal / Ten-God Badges
   ────────────────────────────────────── */
.sinsal-badge {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  background: rgba(168, 85, 247, 0.10);
  border: 1px solid rgba(168, 85, 247, 0.20);
  color: var(--charcoal);
}

.ten-god-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
}

/* ──────────────────────────────────────
   Ziwei Mingpan Grid (자미두수 명반)
   ────────────────────────────────────── */
.mingpan-container {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.mingpan-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  grid-template-rows: repeat(4, auto);
  gap: 0;
  min-width: 640px;
  border: 1.5px solid rgba(168, 85, 247, 0.25);
  border-radius: 0.75rem;
  overflow: hidden;
}

.palace-cell {
  border: 1px solid rgba(168, 85, 247, 0.15);
  padding: 0.75rem 0.5rem;
  min-height: 120px;
  background: rgba(255, 255, 255, 0.55);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  font-size: 0.85rem;
  transition: background 0.2s;
}

.palace-cell:hover {
  background: rgba(255, 255, 255, 0.80);
}

.palace-cell.ming-palace {
  background: rgba(168, 85, 247, 0.08);
  border-color: rgba(168, 85, 247, 0.30);
}

.palace-cell.shen-palace {
  background: rgba(232, 180, 184, 0.12);
  border-color: rgba(232, 180, 184, 0.35);
}

.mingpan-center {
  grid-row: 2 / 4;
  grid-column: 2 / 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  background: rgba(254, 252, 249, 0.90);
  border: 1px solid rgba(168, 85, 247, 0.12);
  padding: 1rem;
  font-size: 0.9rem;
}

/* 주성 */
.star-main {
  font-weight: 700;
  color: var(--charcoal);
  font-size: 0.85rem;
}

/* 보좌성 */
.star-aux {
  font-size: 0.75rem;
  color: var(--charcoal-light);
}

/* 살성 */
.star-malefic {
  font-size: 0.75rem;
  color: var(--el-fire);
  font-weight: 600;
}

/* 사화 배지 */
.sihua-lok {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border-radius: 0.2rem;
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(109, 181, 132, 0.18);
  color: var(--el-wood);
  border: 1px solid rgba(109, 181, 132, 0.30);
}

.sihua-kwon {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border-radius: 0.2rem;
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(212, 181, 106, 0.20);
  color: #a89040;
  border: 1px solid rgba(212, 181, 106, 0.35);
}

.sihua-gwa {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border-radius: 0.2rem;
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(123, 164, 224, 0.18);
  color: var(--el-water);
  border: 1px solid rgba(123, 164, 224, 0.30);
}

.sihua-gi {
  display: inline-block;
  padding: 0.1rem 0.35rem;
  border-radius: 0.2rem;
  font-size: 0.65rem;
  font-weight: 700;
  background: rgba(232, 127, 127, 0.18);
  color: var(--el-fire);
  border: 1px solid rgba(232, 127, 127, 0.30);
}

/* ──────────────────────────────────────
   Loading Spinner
   ────────────────────────────────────── */
.spinner {
  width: 48px;
  height: 48px;
  border: 3px solid rgba(168, 85, 247, 0.15);
  border-top-color: var(--violet-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ──────────────────────────────────────
   Animations
   ────────────────────────────────────── */
.animate-fade-in-down {
  animation: fade-in-down 0.3s ease-out;
}

@keyframes fade-in-down {
  from {
    opacity: 0;
    transform: translate(-50%, -1rem);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.animate-fade-in-up {
  animation: fade-in-up 0.6s ease-out forwards;
}

.animate-on-scroll {
  opacity: 0;
  transform: translateY(1.5rem);
}

@keyframes fade-in-up {
  from {
    opacity: 0;
    transform: translateY(1.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ──────────────────────────────────────
   Coming Soon Badge
   ────────────────────────────────────── */
.coming-soon-badge {
  display: inline-block;
  padding: 0.35rem 0.85rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(168, 85, 247, 0.12);
  color: var(--violet-500);
  border: 1px solid rgba(168, 85, 247, 0.20);
  letter-spacing: 0.03em;
}

/* ──────────────────────────────────────
   Decoration Elements
   ────────────────────────────────────── */
.deco-star {
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--violet-400);
  opacity: 0.15;
  pointer-events: none;
  animation: twinkle 3s ease-in-out infinite alternate;
}

.deco-star::before {
  content: "";
  position: absolute;
  inset: -2px;
  border-radius: 50%;
  background: inherit;
  opacity: 0.4;
  filter: blur(2px);
}

@keyframes twinkle {
  0%   { opacity: 0.10; transform: scale(0.8); }
  100% { opacity: 0.25; transform: scale(1.2); }
}

.deco-circle {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  filter: blur(60px);
  opacity: 0.12;
}

/* ──────────────────────────────────────
   AI Interpretation
   ────────────────────────────────────── */
.interpretation-text {
  line-height: 1.8;
  white-space: pre-line;
  font-size: 0.95rem;
  color: var(--charcoal);
}

/* ──────────────────────────────────────
   Global Scrollbar (WebKit)
   ────────────────────────────────────── */
::-webkit-scrollbar {
  width: 6px;
}

::-webkit-scrollbar-track {
  background: rgba(168, 85, 247, 0.04);
}

::-webkit-scrollbar-thumb {
  background: rgba(168, 85, 247, 0.18);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(168, 85, 247, 0.30);
}

/* ──────────────────────────────────────
   Responsive (640px)
   ────────────────────────────────────── */
@media (max-width: 640px) {
  .pillar-card .stem-char,
  .pillar-card .branch-char {
    font-size: 1.35rem;
  }

  .pillar-card {
    padding: 0.75rem 0.35rem;
  }

  .glass-card,
  .result-card {
    padding: 1rem;
    border-radius: 0.75rem;
  }

  .daeun-item {
    width: 4.5rem;
    padding: 0.5rem 0.15rem;
    font-size: 0.85rem;
  }

  .palace-cell {
    min-height: 90px;
    padding: 0.5rem 0.35rem;
    font-size: 0.78rem;
  }

  .btn-primary {
    padding: 0.75rem 1.5rem;
    font-size: 0.95rem;
  }

  .tab-btn {
    font-size: 0.85rem;
    padding: 0.625rem 0.5rem;
  }
}
