/* ================================================================
   style.css — 避凶指南 디자인 시스템
   ================================================================ */

:root {
  --clr-bg:        #F8F6F2;
  --clr-surface:   #FFFFFF;
  --clr-ink:       #1E1E2A;
  --clr-ink-muted: #6B6B7A;
  --clr-accent:    #C0392B;
  --clr-accent-lt: #FDE8E6;
  --clr-safe:      #27AE60;
  --clr-line:      #06C755;
  --clr-border:    #E8E4DC;
  --radius-card:   0px;
  --radius-btn:    12px;
  --shadow-sm:  0 2px 8px rgba(0,0,0,.04);
  --shadow-md:  0 8px 28px rgba(0,0,0,.08);
  --shadow-lg:  0 20px 40px rgba(0,0,0,.12);
  --shadow-hover: 0 25px 50px rgba(192,57,43,.15);
  --font-main: 'Noto Sans TC', 'PingFang TC', 'Microsoft JhengHei', sans-serif;
  --transition: 0.25s ease;
}

*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-main);
  background: var(--clr-bg);
  color: var(--clr-ink);
  line-height: 1.6;
  min-height: 100vh;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
}

img {
  max-width: 100%;
  display: block;
}

.hidden {
  display: none !important;
}

/* 헤더 */
.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(248, 246, 242, 0.92);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--clr-border);
}

.header-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 0 20px;
  height: 58px;
  display: flex;
  align-items: center;
  gap: 24px;
}

.logo {
  font-size: 18px;
  font-weight: 900;
  color: var(--clr-accent);
  letter-spacing: -0.3px;
  white-space: nowrap;
}

.site-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.nav-link {
  padding: 6px 14px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 500;
  color: var(--clr-ink-muted);
  transition: background var(--transition), color var(--transition);
  white-space: nowrap;
}

.nav-link:hover,
.nav-link.active {
  background: var(--clr-accent-lt);
  color: var(--clr-accent);
}

.nav-toggle {
  display: none;
  margin-left: auto;
  font-size: 22px;
  color: var(--clr-ink);
  padding: 4px 8px;
}

.main-wrap {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 20px 60px;
}

/* Hero */
.hero {
  text-align: center;
  padding: 56px 0 40px;
}

.hero-eyebrow {
  display: inline-block;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--clr-accent);
  background: var(--clr-accent-lt);
  padding: 5px 14px;
  border-radius: 99px;
  margin-bottom: 18px;
}

.hero-title {
  font-size: clamp(34px, 8vw, 52px);
  font-weight: 900;
  line-height: 1.15;
  letter-spacing: -0.5px;
  color: var(--clr-ink);
  margin-bottom: 16px;
}

.hero-title em {
  font-style: normal;
  color: var(--clr-accent);
  text-decoration: underline;
  text-decoration-color: #F5C6C2;
  text-decoration-thickness: 3px;
  text-underline-offset: 5px;
}

.hero-sub {
  font-size: 15px;
  color: var(--clr-ink-muted);
  max-width: 340px;
  margin: 0 auto;
}

/* 카드 선택 */
.card-section {
  margin-bottom: 48px;
}

.card-hint {
  text-align: center;
  font-size: 13px;
  color: var(--clr-ink-muted);
  margin-bottom: 24px;
  letter-spacing: 0.04em;
}

.card-grid {
  display: flex;
  gap: 20px;
  justify-content: center;
}

.tarot-card {
  flex: 1;
  max-width: 170px;
  aspect-ratio: 2 / 3;
  background: #1E1E2F;
  border: 1px solid rgba(192, 57, 43, 0.3);
  box-shadow: var(--shadow-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition);
  position: relative;
  overflow: hidden;
  cursor: pointer;
}

.tarot-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 0%, rgba(255,255,255,0.05) 30%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.03) 70%, transparent 100%);
  pointer-events: none;
}

.tarot-card::before {
  content: '';
  position: absolute;
  inset: 8px;
  border: 1px solid rgba(192, 57, 43, 0.2);
  pointer-events: none;
  transition: border-color var(--transition);
}

.tarot-card:hover {
  transform: translateY(-12px) scale(1.02);
  box-shadow: var(--shadow-hover);
  border-color: rgba(192, 57, 43, 0.7);
}

.tarot-card:hover::before {
  border-color: rgba(192, 57, 43, 0.5);
}

.tarot-card.card-picked {
  transform: scale(0.94);
  opacity: 0.7;
  pointer-events: none;
}

.card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.card-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  inset: 0;
  display: block;
  opacity: 0.88;
  transition: opacity var(--transition);
}

.tarot-card:hover .card-img {
  opacity: 1;
}

.card-label {
  display: none;
}

/* 로딩 */
.loading-section {
  text-align: center;
  padding: 48px 24px;
}

.loading-orb {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  margin: 0 auto 24px;
  background: conic-gradient(var(--clr-accent) 0%, var(--clr-accent-lt) 50%, var(--clr-accent) 100%);
  animation: orb-spin 1.4s linear infinite;
  box-shadow: 0 0 24px rgba(192, 57, 43, 0.3);
}

@keyframes orb-spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-size: 17px;
  font-weight: 700;
  color: var(--clr-ink);
  margin-bottom: 8px;
}

.loading-sub {
  font-size: 13px;
  color: var(--clr-ink-muted);
  margin-bottom: 28px;
}

/* 결과 */
.result-section {
  margin-bottom: 48px;
  animation: result-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes result-in {
  from { opacity: 0; transform: translateY(18px); }
  to { opacity: 1; transform: translateY(0); }
}

.result-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  box-shadow: var(--shadow-md);
  padding: 32px 28px;
}

.result-header {
  text-align: center;
  margin-bottom: 28px;
}

.result-date {
  font-size: 12px;
  color: var(--clr-ink-muted);
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

.result-title {
  font-size: 22px;
  font-weight: 900;
  color: var(--clr-accent);
}

/* 경고 영역 */
.warning-zone {
  margin-bottom: 24px;
  position: relative;
}

.warning-block {
  border: 1px solid #FFD6D6;
  background: #FFF8F8;
  overflow: hidden;
  border-radius: 12px;
}

/* 平安日 - 기본 */
.warning-clear {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  background: linear-gradient(135deg, #E8F8EF 0%, #D5F0E4 100%);
  border: 1.5px solid #27AE60;
  padding: 20px 18px;
  overflow: hidden;
  border-radius: 12px;
}

.warning-clear-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 20% 50%, rgba(39, 174, 96, 0.18) 0%, transparent 70%);
  pointer-events: none;
}

.warning-clear-icon {
  font-size: 32px;
  flex-shrink: 0;
  margin-top: 1px;
  filter: drop-shadow(0 0 6px rgba(39, 174, 96, 0.6));
  animation: star-pulse 2.4s ease-in-out infinite;
}

@keyframes star-pulse {
  0%, 100% { transform: scale(1); filter: drop-shadow(0 0 6px rgba(39, 174, 96, 0.6)); }
  50% { transform: scale(1.12); filter: drop-shadow(0 0 12px rgba(39, 174, 96, 0.9)); }
}

.warning-clear-text strong {
  display: block;
  font-size: 18px;
  font-weight: 900;
  color: #1E6F3F;
  margin-bottom: 6px;
}

.warning-clear-text p {
  font-size: 13px;
  color: #2E7D54;
  line-height: 1.65;
}

/* 평안일 확률 뱃지 */
.lucky-percent-badge {
  display: inline-block;
  background: linear-gradient(135deg, #FFD700, #FFA500);
  padding: 8px 20px;
  border-radius: 40px;
  font-size: 18px;
  font-weight: 900;
  color: white;
  margin: 12px 0;
  text-shadow: 0 1px 2px rgba(0,0,0,0.2);
  animation: shimmer 2s ease-in-out infinite;
}

@keyframes shimmer {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.85; transform: scale(1.02); }
}

/* 등급별 뱃지 색상 */
.lucky-percent-badge.legend {
  background: linear-gradient(135deg, #FFD700, #FF8C00);
  box-shadow: 0 0 15px rgba(255, 215, 0, 0.6);
}

.lucky-percent-badge.rare {
  background: linear-gradient(135deg, #E0E0E0, #A0A0A0);
}

.lucky-percent-badge.special {
  background: linear-gradient(135deg, #FFD700, #FFC107);
}

.lucky-percent-badge.normal {
  background: linear-gradient(135deg, #87CEEB, #5F9EA0);
}

.lucky-message {
  font-size: 14px;
  font-weight: 700;
  color: #1E6F3F;
  margin: 8px 0;
}

.lucky-sub {
  font-size: 12px;
  color: #2E7D54;
  margin-top: 8px;
  line-height: 1.6;
}

/* 폭죽 애니메이션 (3% 전용) */
.firework {
  position: absolute;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  pointer-events: none;
  overflow: hidden;
  border-radius: 20px;
}

.firework-particle {
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: radial-gradient(circle, #FFD700, #FF8C00);
  animation: explode 1s ease-out forwards;
}

@keyframes explode {
  0% { opacity: 1; transform: scale(0) translate(0, 0); }
  50% { opacity: 0.8; }
  100% { opacity: 0; transform: scale(1) translate(var(--x), var(--y)); }
}

/* ================================================================
   평안일 등급별 효과
   ================================================================ */

.lucky-day-card {
  position: relative;
  background: linear-gradient(135deg, #E8F8EF 0%, #D5F0E4 100%);
  border-radius: 20px;
  padding: 24px;
  text-align: center;
  overflow: hidden;
}

.lucky-day-image {
  margin-bottom: 16px;
}

.lucky-day-image img {
  width: 120px;
  height: 120px;
  object-fit: contain;
  margin: 0 auto;
  border-radius: 60px;
  background: white;
  box-shadow: 0 8px 20px rgba(0,0,0,0.1);
}

/* legend 등급 (상위 1~2%) */
.legend-effect {
  background: linear-gradient(135deg, #FFF8E7, #FFE4B5);
  border: 2px solid #FFD700;
  box-shadow: 0 0 30px rgba(255, 215, 0, 0.5);
}

.legend-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(255,215,0,0.3) 0%, transparent 70%);
  pointer-events: none;
  animation: legend-pulse 1.5s ease-in-out infinite;
}

@keyframes legend-pulse {
  0%, 100% { opacity: 0.5; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.05); }
}

/* rare 등급 (상위 3~5%) */
.rare-effect {
  background: linear-gradient(135deg, #F0F0FF, #E0E0FF);
  border: 2px solid #C0C0C0;
}

.rare-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at center, rgba(192,192,192,0.2) 0%, transparent 70%);
  pointer-events: none;
  animation: rare-shine 2s ease-in-out infinite;
}

@keyframes rare-shine {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

/* special 등급 (상위 6~10%) */
.special-effect {
  border: 1px solid #FFD700;
}

.special-gleam {
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent, rgba(255,215,0,0.15), transparent);
  animation: gleam 3s ease-in-out infinite;
}

@keyframes gleam {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(200%); }
}

/* 금기 있는 날 */
.warning-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px 10px;
  background: #FFF0F0;
  border-bottom: 1px solid #FFD6D6;
}

.warning-header-icon {
  font-size: 16px;
}

.warning-header strong {
  font-size: 13px;
  font-weight: 700;
  color: #C0392B;
  letter-spacing: 0.04em;
}

.warning-list {
  display: flex;
  flex-direction: column;
}

.warning-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 13px 16px;
  border-bottom: 1px solid #FFE8E8;
}

.warning-item:last-child {
  border-bottom: none;
}

.warning-item-icon {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 1px;
}

.warning-item-body strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #1A1A2E;
  margin-bottom: 3px;
}

.warning-item-body p {
  font-size: 13px;
  color: #888;
  line-height: 1.6;
}

.result-items {
  display: flex;
  flex-direction: column;
  margin-bottom: 20px;
  border: 1px solid var(--clr-border);
  border-radius: 14px;
  overflow: hidden;
}

.result-row {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--clr-border);
  transition: background var(--transition);
}

.result-row:last-child {
  border-bottom: none;
}

.result-row:hover {
  background: var(--clr-bg);
}

.result-icon {
  font-size: 22px;
  flex-shrink: 0;
  margin-top: 1px;
}

.result-content {
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.result-key {
  font-size: 11px;
  font-weight: 700;
  color: var(--clr-ink-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.result-val {
  font-size: 17px;
  font-weight: 700;
  color: var(--clr-ink);
  line-height: 1.4;
}

.quote-zone {
  margin: 20px 0;
  padding: 16px 18px;
  background: var(--clr-bg);
  border-radius: 12px;
  text-align: center;
  font-size: 14px;
  font-style: italic;
  color: var(--clr-accent);
  border-left: 3px solid var(--clr-accent);
}

.share-prompt {
  text-align: center;
  font-size: 13px;
  color: var(--clr-ink-muted);
  margin-bottom: 16px;
}

/* 버튼 */
.btn-group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.btn {
  width: 100%;
  padding: 15px 20px;
  border-radius: var(--radius-btn);
  font-size: 15px;
  font-weight: 700;
  letter-spacing: 0.02em;
  transition: transform var(--transition), box-shadow var(--transition), background var(--transition);
}

.btn:active {
  transform: scale(0.97);
}

.btn-line {
  background: var(--clr-line);
  color: #fff;
  box-shadow: 0 4px 14px rgba(6, 199, 85, 0.25);
}

.btn-line:hover {
  background: #05b04b;
  box-shadow: 0 6px 20px rgba(6, 199, 85, 0.35);
}

.btn-copy {
  background: var(--clr-accent-lt);
  color: var(--clr-accent);
}

.btn-copy:hover {
  background: #FDE8E6;
}

.btn-retry {
  background: var(--clr-bg);
  color: var(--clr-ink-muted);
  border: 1px solid var(--clr-border);
}

.btn-retry:hover {
  background: #eceae4;
}

/* 광고 */
.ad-zone {
  background: var(--clr-bg);
  border: 1px dashed var(--clr-border);
  border-radius: 10px;
  padding: 20px;
  text-align: center;
  margin-top: 24px;
  min-height: 90px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.ad-label {
  font-size: 11px;
  color: #aaa;
  position: absolute;
  top: 6px;
  left: 10px;
  letter-spacing: 0.05em;
}

/* 푸터 */
.site-footer {
  border-top: 1px solid var(--clr-border);
  background: var(--clr-surface);
}

.footer-inner {
  max-width: 900px;
  margin: 0 auto;
  padding: 32px 20px;
  text-align: center;
}

.footer-logo {
  font-size: 20px;
  font-weight: 900;
  color: var(--clr-accent);
  margin-bottom: 16px;
}

.footer-nav {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.footer-nav a {
  font-size: 13px;
  color: var(--clr-ink-muted);
  transition: color var(--transition);
}

.footer-nav a:hover {
  color: var(--clr-accent);
}

.footer-copy {
  font-size: 12px;
  color: #bbb;
}

/* ================================================================
   보조 페이지 공통 스타일
   ================================================================ */

.page-hero {
  padding: 52px 0 36px;
  text-align: center;
}

.page-hero h1 {
  font-size: clamp(26px, 6vw, 40px);
  font-weight: 900;
  margin-bottom: 12px;
}

.page-hero p {
  font-size: 15px;
  color: var(--clr-ink-muted);
  max-width: 400px;
  margin: 0 auto;
}

.content-section {
  margin: 32px 0 56px;
}

.content-card {
  background: var(--clr-surface);
  border: 1px solid var(--clr-border);
  border-radius: 20px;
  padding: 28px 24px;
  margin-bottom: 16px;
  box-shadow: var(--shadow-sm);
}

.content-card h2 {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--clr-accent);
}

.content-card p,
.content-card li {
  font-size: 15px;
  color: var(--clr-ink-muted);
  line-height: 1.8;
}

.content-card ul {
  padding-left: 18px;
  margin-top: 8px;
}

.content-card li {
  margin-bottom: 6px;
}

.content-card ol {
  padding-left: 18px;
  margin-top: 8px;
}

.content-card ol li {
  margin-bottom: 6px;
}

.ad-zone--wide {
  margin: 32px 0;
  min-height: 100px;
}

/* 반응형 */
@media (max-width: 600px) {
  .site-nav { display: none; }
  .site-nav.nav-open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: 58px;
    left: 0;
    right: 0;
    background: var(--clr-surface);
    border-bottom: 1px solid var(--clr-border);
    padding: 12px 20px 20px;
    box-shadow: var(--shadow-md);
    z-index: 99;
  }
  .nav-toggle { display: block; }
  .hero { padding: 40px 0 32px; }
  .hero-title { font-size: 34px; }
  .card-grid { gap: 12px; }
  .tarot-card { max-width: 110px; }
  .result-card { padding: 22px 16px; }
  .result-val { font-size: 15px; }
  .page-hero { padding: 36px 0 24px; }
  .content-card { padding: 20px 16px; }
  .content-card h2 { font-size: 16px; }
  .content-card p, .content-card li { font-size: 14px; }
}

@media (max-width: 400px) {
  .card-grid { gap: 8px; }
  .tarot-card { max-width: 100px; }
}

.tarot-card:focus-visible {
  outline: 3px solid var(--clr-accent);
  outline-offset: 3px;
}

.btn:focus-visible {
  outline: 3px solid var(--clr-accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .loading-orb { animation: none; }
  .result-section { animation: none; }
  * { transition: none !important; }
}
