/* ==========================================================================
   Free Four Pillars (BaZi) & Daily Horoscope — shared styles
   Concept: night-sky constellations + hanji paper texture + red seal stamp
   + brush-stroke display typography
   ========================================================================== */

@import url('https://fonts.googleapis.com/css2?family=Song+Myung&family=Noto+Serif+KR:wght@400;500;700&family=Noto+Sans+KR:wght@300;400;500;700&display=swap');

:root{
  /* --- Color tokens --- */
  --ink-black:   #1b1b2f;   /* night sky background */
  --midnight:    #232042;   /* secondary gradient tone */
  --midnight-2:  #2c2853;
  --hanji:       #f4ecd9;   /* hanji paper card background */
  --hanji-dark:  #e9dcc0;   /* hanji shadow tone */
  --gold:        #c9a768;   /* gilt / starlight */
  --gold-bright: #e8cd8a;
  --seal-red:    #b8322c;   /* seal-stamp red */
  --seal-red-dark:#8f251f;
  --jade:        #4c7a6f;   /* auspicious accent */
  --ink-text:    #2a2620;   /* body text on hanji paper */
  --star-white:  #f5f0e6;

  --font-display: 'Song Myung', serif;
  --font-hanja:   'Noto Serif KR', serif;
  --font-body:    'Noto Sans KR', sans-serif;

  --radius: 6px;
  --shadow-card: 0 10px 30px rgba(0,0,0,0.35);
}

*{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }

body{
  margin:0;
  min-height:100vh;
  font-family:var(--font-body);
  color:var(--star-white);
  background:
    radial-gradient(ellipse at 20% -10%, rgba(201,167,104,0.10), transparent 55%),
    radial-gradient(ellipse at 90% 0%, rgba(76,122,111,0.10), transparent 45%),
    linear-gradient(180deg, var(--ink-black) 0%, var(--midnight) 55%, var(--midnight-2) 100%);
  background-attachment:fixed;
  position:relative;
  overflow-x:hidden;
}

/* --- soft starfield background --- */
.stars, .stars2{
  position:fixed; inset:0; z-index:0; pointer-events:none;
  background-repeat:repeat;
  opacity:0.55;
}
.stars{
  background-image:
    radial-gradient(1.5px 1.5px at 20px 30px, var(--star-white), transparent),
    radial-gradient(1px 1px at 90px 70px, var(--gold), transparent),
    radial-gradient(1.2px 1.2px at 150px 20px, var(--star-white), transparent),
    radial-gradient(1px 1px at 200px 120px, var(--star-white), transparent),
    radial-gradient(1.5px 1.5px at 260px 60px, var(--gold), transparent);
  background-size:300px 200px;
  animation:twinkle 6s ease-in-out infinite;
}
.stars2{
  background-image:
    radial-gradient(1px 1px at 60px 160px, var(--star-white), transparent),
    radial-gradient(1.5px 1.5px at 130px 40px, var(--gold), transparent),
    radial-gradient(1px 1px at 220px 100px, var(--star-white), transparent);
  background-size:260px 260px;
  animation:twinkle 8s ease-in-out infinite reverse;
}
@keyframes twinkle{
  0%,100%{ opacity:.35; }
  50%{ opacity:.75; }
}

a{ color:inherit; text-decoration:none; }
img{ max-width:100%; display:block; }

/* --- layout frame: header / side rail / main / footer --- */
.site-header{
  position:relative; z-index:5;
  display:flex; align-items:center; justify-content:space-between;
  padding:18px clamp(16px,4vw,48px);
  border-bottom:1px solid rgba(201,167,104,0.25);
  backdrop-filter:blur(4px);
}
.logo{
  font-family:var(--font-display);
  font-size:1.5rem;
  color:var(--gold-bright);
  letter-spacing:1px;
  display:flex; align-items:center; gap:10px;
}
.logo .logo-seal{
  width:30px; height:30px; border-radius:4px;
  background:var(--seal-red);
  color:var(--hanji);
  font-family:var(--font-hanja);
  display:flex; align-items:center; justify-content:center;
  font-size:1rem;
  box-shadow:0 2px 6px rgba(0,0,0,.4);
  transform:rotate(-3deg);
}
nav.main-nav{ display:flex; gap:clamp(10px,2vw,28px); font-size:.95rem; }
nav.main-nav a{
  padding:6px 4px; border-bottom:2px solid transparent; transition:.2s;
  color:var(--star-white); opacity:.85;
}
nav.main-nav a:hover, nav.main-nav a.active{
  opacity:1; border-color:var(--gold);
}

.page-shell{
  position:relative; z-index:2;
  display:grid;
  grid-template-columns:1fr minmax(0,860px) 1fr;
  gap:24px;
  padding:0 clamp(12px,3vw,32px) 40px;
}
.page-main{ grid-column:2; min-width:0; }
.rail{ grid-column:1; }
.rail.rail-right{ grid-column:3; }
@media (max-width:1100px){
  .page-shell{ grid-template-columns:1fr; }
  .page-main{ grid-column:1; }
  .rail{ display:none; }
}

/* --- ad slot (swap in a real ad unit, e.g. Google AdSense) --- */
.ad-slot{
  border:1px dashed rgba(201,167,104,0.4);
  border-radius:var(--radius);
  background:rgba(255,255,255,0.03);
  color:rgba(245,240,230,0.45);
  display:flex; align-items:center; justify-content:center;
  font-size:.78rem; letter-spacing:.5px;
  text-align:center; line-height:1.5;
}
.ad-slot span{ padding:6px 10px; }
.ad-slot-top{ width:100%; min-height:90px; margin:16px auto 0; max-width:1100px; }
.ad-slot-rail{ position:sticky; top:100px; width:100%; min-height:600px; }
.ad-slot-inline{ width:100%; min-height:120px; margin:28px 0; }
.ad-slot-footer{ width:100%; min-height:100px; }

/* --- shared hero/section --- */
.hero{
  padding:clamp(28px,6vw,64px) 0 clamp(20px,4vw,40px);
  text-align:center;
}
.eyebrow{
  font-size:.8rem; letter-spacing:3px; color:var(--gold);
  text-transform:uppercase; margin-bottom:10px;
}
.hero h1{
  font-family:var(--font-display);
  font-size:clamp(2rem,5vw,3.2rem);
  line-height:1.25; margin:0 0 14px;
  color:var(--star-white);
}
.hero h1 em{ color:var(--gold-bright); font-style:normal; }
.hero p.lead{
  max-width:640px; margin:0 auto; color:rgba(245,240,230,.8);
  font-size:1.02rem; line-height:1.8;
}

/* --- card (hanji paper texture) --- */
.paper-card{
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(255,255,255,0.25), transparent 40%),
    var(--hanji);
  color:var(--ink-text);
  border-radius:8px;
  box-shadow:var(--shadow-card);
  padding:clamp(20px,4vw,36px);
  position:relative;
}
.paper-card::before{
  content:'';
  position:absolute; inset:0;
  border-radius:8px;
  box-shadow:inset 0 0 0 1px rgba(0,0,0,0.06);
  pointer-events:none;
}
.paper-card h2, .paper-card h3{ font-family:var(--font-display); color:#2a2620; }

/* --- seal-stamp button --- */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  border:none; cursor:pointer;
  font-family:var(--font-body); font-weight:700; font-size:.98rem;
  padding:14px 26px; border-radius:999px;
  transition:transform .15s ease, box-shadow .15s ease, filter .15s ease;
}
.btn:active{ transform:translateY(1px) scale(.99); }
.btn-free{
  background:var(--jade); color:var(--star-white);
  box-shadow:0 6px 18px rgba(76,122,111,.35);
}
.btn-free:hover{ filter:brightness(1.08); }
.btn-premium{
  background:radial-gradient(circle at 30% 30%, var(--seal-red) 0%, var(--seal-red-dark) 100%);
  color:var(--hanji);
  box-shadow:0 6px 20px rgba(184,50,44,.45);
  position:relative;
}
.btn-premium::after{
  content:'印';
  font-family:var(--font-hanja);
  font-size:.75rem;
  opacity:.55;
}
.btn-premium:hover{ filter:brightness(1.1); }
.btn-outline{
  background:linear-gradient(135deg, #3b6fd6 0%, #2a52a8 100%);
  border:none;
  color:#ffffff;
  box-shadow:0 6px 18px rgba(42,82,168,.4);
}
.btn-outline:hover{ filter:brightness(1.08); }

/* --- Four Pillars chart grid (signature element) --- */
.myeongsik{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:1px;
  background:rgba(42,38,32,.18);
  border:1px solid rgba(42,38,32,.25);
  border-radius:6px;
  overflow:hidden;
  margin:20px 0;
}
.myeongsik .col{
  background:var(--hanji);
  padding:14px 6px 18px;
  text-align:center;
}
.myeongsik .col .label{
  font-size:.72rem; letter-spacing:1px; color:#7a6d55; margin-bottom:10px;
}
.myeongsik .col .gan, .myeongsik .col .ji{
  font-family:var(--font-hanja);
  font-size:clamp(1.4rem,4vw,2rem);
  line-height:1.3;
  color:#2a2620;
}
.myeongsik .col .gan{ border-bottom:1px solid rgba(42,38,32,.18); padding-bottom:8px; margin-bottom:6px; }
.myeongsik .col .romani{ font-size:.68rem; color:#8a7c60; margin-top:2px; }

/* --- form elements --- */
.form-grid{ display:grid; gap:16px; grid-template-columns:1fr 1fr; }
.form-grid .full{ grid-column:1/-1; }
@media (max-width:520px){ .form-grid{ grid-template-columns:1fr; } }
label{ font-size:.85rem; color:#5c5240; display:block; margin-bottom:6px; font-weight:500; }
input[type="date"], input[type="time"], input[type="text"], select{
  width:100%; padding:12px 14px; border-radius:6px;
  border:1px solid rgba(42,38,32,.25);
  background:rgba(255,255,255,.55);
  font-family:var(--font-body); font-size:.95rem; color:var(--ink-text);
}
.radio-row{ display:flex; gap:18px; align-items:center; }
.radio-row label{ display:flex; align-items:center; gap:6px; font-weight:400; margin:0; }

/* --- result section --- */
.result-section{ margin-top:28px; }
.result-section h3{ margin-bottom:8px; }
.result-section p{ line-height:1.85; color:#3a3428; }
.badge{
  display:inline-block; font-size:.72rem; padding:3px 10px; border-radius:999px;
  background:var(--jade); color:#fff; letter-spacing:.5px; margin-bottom:8px;
}
.badge.locked{ background:var(--seal-red); }
.blurred{
  filter:blur(6px); user-select:none; pointer-events:none;
}
.locked-overlay{
  position:relative;
}
.locked-overlay .unlock-cta{
  position:absolute; inset:0; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:12px; text-align:center;
  background:rgba(244,236,217,.55);
  border-radius:8px;
}

/* --- rewarded-ad modal --- */
.modal-backdrop{
  position:fixed; inset:0; z-index:100;
  background:rgba(10,8,20,.75);
  display:none; align-items:center; justify-content:center;
  padding:20px;
}
.modal-backdrop.active{ display:flex; }
.ad-modal{
  width:min(420px,92vw);
  background:var(--ink-black);
  border:1px solid rgba(201,167,104,.35);
  border-radius:10px;
  padding:26px 22px;
  text-align:center;
  color:var(--star-white);
}
.ad-modal .ad-visual{
  height:160px; border-radius:8px; margin-bottom:16px;
  background:linear-gradient(120deg, rgba(201,167,104,.25), rgba(76,122,111,.25));
  display:flex; align-items:center; justify-content:center;
  font-size:.85rem; color:rgba(245,240,230,.65);
  border:1px dashed rgba(201,167,104,.4);
}
.progress-track{
  width:100%; height:8px; border-radius:99px;
  background:rgba(255,255,255,.12); overflow:hidden; margin:14px 0 6px;
}
.progress-fill{
  height:100%; width:0%; background:var(--gold);
  transition:width .2s linear;
}
.ad-modal .timer-text{ font-size:.85rem; color:rgba(245,240,230,.7); }

/* --- footer --- */
.site-footer{
  position:relative; z-index:2;
  padding:30px clamp(16px,4vw,48px) 20px;
  border-top:1px solid rgba(201,167,104,.2);
  color:rgba(245,240,230,.55);
  font-size:.82rem;
  text-align:center;
}
.site-footer .seo-links{
  display:flex; flex-wrap:wrap; gap:10px 18px;
  justify-content:center; margin:14px 0; opacity:.7;
}
.site-footer .seo-links a:hover{ color:var(--gold); }

/* --- utilities --- */
.center{ text-align:center; }
.mt-lg{ margin-top:40px; }
.small{ font-size:.8rem; opacity:.7; }
.grid-3{ display:grid; gap:18px; grid-template-columns:repeat(3,1fr); }
@media (max-width:800px){ .grid-3{ grid-template-columns:1fr; } }
.grid-2{ display:grid; gap:18px; grid-template-columns:repeat(2,1fr); }
@media (max-width:700px){ .grid-2{ grid-template-columns:1fr; } }

/* --- accessibility: keyboard focus --- */
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible{
  outline:2px solid var(--gold-bright); outline-offset:2px;
}

/* --- respect users who prefer reduced motion --- */
@media (prefers-reduced-motion: reduce){
  *{ animation-duration:.001ms !important; animation-iteration-count:1 !important; transition-duration:.001ms !important; }
}

/* --- daily horoscope specific elements --- */
.score-rows{ display:flex; flex-direction:column; gap:14px; }
.score-row-label{
  display:flex; justify-content:space-between; font-size:.85rem;
  font-weight:600; margin-bottom:6px; color:#3a3428;
}
.lucky-row{ display:flex; gap:32px; flex-wrap:wrap; }
.lucky-item{ min-width:140px; }
.lucky-swatch{
  width:26px; height:26px; border-radius:50%;
  display:inline-block; border:1px solid rgba(0,0,0,.15);
}

/* --- confetti canvas --- */
#confetti-canvas{
  position:fixed; inset:0; z-index:200; pointer-events:none;
}
