/* ── Autofill override ── */
input:-webkit-autofill,
input:-webkit-autofill:hover,
input:-webkit-autofill:focus,
input:-webkit-autofill:active {
  -webkit-box-shadow: 0 0 0 30px #262e54 inset !important;
  -webkit-text-fill-color: #f4efe2 !important;
  caret-color: #f4efe2;
  transition: background-color 5000s ease-in-out 0s;
}

/* ── Nudge arrow animation ── */
@keyframes nudge-arrow {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(4px); }
}
.nudge-arrow-circle {
  animation: nudge-arrow 1.5s ease-in-out infinite;
}

/* ── Base ── */
body {
  font-family: 'Work Sans', 'Noto Serif KR', system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  background: #1a2140;
  color: #f4efe2;
  position: relative;
}
html[lang="ko"] body {
  font-family: 'Pretendard', 'Work Sans', system-ui, sans-serif;
}
html[lang="ko"] h1, html[lang="ko"] h2, html[lang="ko"] h3,
html[lang="ko"] h4, html[lang="ko"] h5, html[lang="ko"] h6,
html[lang="ko"] [style*="Noto Serif KR"] {
  font-family: 'Pretendard', system-ui, sans-serif !important;
}
body::after {
  content: '';
  position: fixed; inset: 0; z-index: 0; pointer-events: none;
  background: url('/static/hanji.png') repeat;
  opacity: 0.06;
  mix-blend-mode: soft-light;
}

/* ── Skeleton pulse ── */
@keyframes skeleton-pulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 0.12; }
}
.skel {
  background: rgba(42,37,32,0.12);
  border-radius: 8px;
  animation: skeleton-pulse 1.5s ease-in-out infinite;
}

/* ── Element pillar borders ── */
.el-wood  { border-top: 4px solid #4A90D9; }
.el-fire  { border-top: 4px solid #D9534F; }
.el-earth { border-top: 4px solid #E8C840; }
.el-metal { border-top: 4px solid #E8E4DE; }
.el-water { border-top: 4px solid #2C2C2C; }

/* ── Element badge colors ── */
.badge-Wood  { background: #4A90D9; }
.badge-Fire  { background: #D9534F; }
.badge-Earth { background: #E8C840; color: #1a2140; }
.badge-Metal { background: #E8E4DE; color: #1a2140; }
.badge-Water { background: #2C2C2C; }

/* ── Shared drawer / picker ── */
.drawer-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: rgba(0,0,0,0.55);
  display: flex; align-items: flex-end; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 0.25s ease;
}
.drawer-overlay.open { opacity: 1; pointer-events: auto; }
.drawer-sheet {
  background: #262e54; border-radius: 16px 16px 0 0;
  width: 100%; max-width: 480px;
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.22,1,0.36,1);
  padding-bottom: env(safe-area-inset-bottom, 0);
  color: #f4efe2;
}
.drawer-overlay.open .drawer-sheet { transform: translateY(0); }
.drawer-header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px; border-bottom: 1px solid color-mix(in srgb, #f4efe2 22%, transparent);
}

/* ── Scroll picker columns (date) ── */
.picker-columns {
  display: flex; height: 220px; position: relative; overflow: hidden;
}
.picker-col {
  flex: 1; overflow-y: scroll; scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch; scrollbar-width: none;
}
.picker-col::-webkit-scrollbar { display: none; }
.picker-col-inner { padding: 88px 0; }
.picker-item {
  height: 44px; display: flex; align-items: center; justify-content: center;
  scroll-snap-align: center;
  font-size: 18px; color: rgba(244,239,226,0.35);
  transition: color 0.15s, font-weight 0.15s;
}
.picker-item.selected { color: #f4efe2; font-weight: 700; }
.picker-highlight {
  position: absolute; top: 50%; left: 8px; right: 8px;
  height: 44px; transform: translateY(-50%);
  border-top: 1.5px solid #c8932e; border-bottom: 1.5px solid #c8932e;
  pointer-events: none;
}
.picker-col-label {
  font-size: 11px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: #c8932e; text-align: center;
  padding: 4px 0;
}

/* ── List drawer (calendar, birthtime, timezone) ── */
.drawer-list {
  max-height: 360px; overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.drawer-list::-webkit-scrollbar { display: none; }
.drawer-list-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; cursor: pointer;
  transition: background 0.15s;
  font-size: 16px; color: #f4efe2;
}
.drawer-list-item:hover { background: #1e2648; }
.drawer-list-item.active { color: #e8c97b; font-weight: 700; }
.drawer-list-item .check-mark { display: none; color: #c8932e; font-size: 18px; }
.drawer-list-item.active .check-mark { display: block; }

/* ── Timezone search ── */
.tz-search {
  border: none; border-bottom: 1px solid color-mix(in srgb, #f4efe2 22%, transparent);
  padding: 12px 20px; width: 100%; font-size: 15px;
  outline: none; background: transparent !important;
  color: #f4efe2 !important;
  -webkit-appearance: none;
  border-radius: 0;
}
.tz-search::placeholder { color: rgba(244,239,226,0.4); }
.tz-search:focus { border-color: #c8932e; }

/* ── Card hover effects ── */
#basics-scroll a {
  transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
  border-radius: 8px;
  padding-left: 8px;
  padding-right: 8px;
}
#basics-scroll a:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0,0,0,0.08);
  background: rgba(255,255,255,0.6);
}
#celeb-saju-grid a {
  transition: transform 0.2s ease;
}
#celeb-saju-grid a:hover {
  transform: translateY(-4px);
}
#celeb-saju-grid a:hover div:first-child {
  box-shadow: 0 6px 16px rgba(0,0,0,0.18);
}

/* ── Animations ── */
@keyframes spin { to { transform: rotate(360deg); } }
.animate-spin { animation: spin 1s linear infinite; }
@keyframes orbit { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.hero-orbit { animation: orbit 90s linear infinite; }

/* ── Bottom nav ── */
.bottom-nav {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
  display: flex;
  border-top: 1px solid rgba(42,37,32,0.1);
  background: rgba(255,255,255,0.55);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  padding-bottom: env(safe-area-inset-bottom, 0);
}
.bottom-nav a {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px;
  padding: 8px 2px; text-decoration: none;
  color: #5c5548;
  border-top: 2px solid transparent; margin-top: -2px;
  transition: color 0.15s;
}
.bottom-nav a.active {
  color: #2a2520;
  border-top-color: #c8932e;
}
.bottom-nav a.active svg {
  fill: currentColor;
}
.bottom-nav a:hover:not(.active) {
  color: #2a2520;
}
.bottom-nav span {
  font-family: 'Work Sans', system-ui, sans-serif;
  font-weight: 800; font-size: 9.5px;
  letter-spacing: 0.03em; text-transform: uppercase;
}
body { padding-bottom: 60px; }
@media (min-width: 768px) {
  .bottom-nav {
    position: fixed;
    top: 0; bottom: auto; left: 0; right: 0;
    border-top: none;
    border-bottom: 1px solid rgba(42,37,32,0.08);
    background: rgba(255,255,255,0.55) !important;
    backdrop-filter: blur(24px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
    justify-content: center;
    gap: 8px;
    padding-bottom: 0;
    box-shadow: 0 1px 8px rgba(0,0,0,0.04);
  }
  .bottom-nav .nav-logo {
    display: block !important;
    position: absolute;
    left: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-family: 'Noto Serif KR', serif;
    font-weight: 800;
    font-size: 17px;
    color: #2a2520;
    text-decoration: none;
    letter-spacing: 0.02em;
  }
  .bottom-nav .nav-logo:hover {
    color: #c8932e;
  }
  .bottom-nav a {
    flex: 0 0 auto;
    flex-direction: row;
    gap: 6px;
    padding: 14px 20px;
    color: #5c5548;
    border-top: none;
    border-bottom: none;
    margin-top: 0;
    margin-bottom: 0;
  }
  .bottom-nav a.active {
    color: #2a2520;
    border-top-color: transparent;
    border-bottom-color: transparent;
  }
  .bottom-nav a:hover:not(.active) {
    color: #2a2520;
  }
  .bottom-nav span {
    font-size: 12px;
    letter-spacing: 0.05em;
  }
  body { padding-bottom: 0; padding-top: 52px; }
  body.hero-under-nav { padding-top: 0; }
  body.hero-under-nav .bottom-nav {
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    box-shadow: none !important;
    border-bottom: none !important;
    transition: background 0.3s ease, backdrop-filter 0.3s ease, box-shadow 0.3s ease, transform 0.3s ease;
    position: fixed;
  }
  body.hero-under-nav.nav-hidden .bottom-nav {
    transform: translateY(-100%) !important;
  }
  body.hero-under-nav .bottom-nav .nav-logo {
    color: #2a2520 !important;
    transition: color 0.3s ease;
  }
  body.hero-under-nav .bottom-nav a {
    color: #2a2520 !important;
    transition: color 0.3s ease;
  }
  body.hero-under-nav .bottom-nav a.active {
    color: #8a6a1e !important;
  }
  /* Dark hero pages — light text at top */
  body.hero-under-nav.hero-dark .bottom-nav .nav-logo {
    color: #f4efe2 !important;
  }
  body.hero-under-nav.hero-dark .bottom-nav a {
    color: rgba(244,239,226,0.6) !important;
  }
  body.hero-under-nav.hero-dark .bottom-nav a.active {
    color: #e8c97b !important;
  }
  /* Scrolled state — light bg, dark text */
  body.hero-under-nav.nav-scrolled .bottom-nav {
    background: rgba(245,241,232,0.92) !important;
    backdrop-filter: blur(24px) saturate(180%) !important;
    -webkit-backdrop-filter: blur(24px) saturate(180%) !important;
    box-shadow: 0 1px 8px rgba(0,0,0,0.06) !important;
    border-bottom: 1px solid rgba(42,37,32,0.1) !important;
  }
  body.hero-under-nav.nav-scrolled .bottom-nav .nav-logo {
    color: #2a2520 !important;
  }
  body.hero-under-nav.nav-scrolled .bottom-nav .nav-logo:hover {
    color: #c8932e !important;
  }
  body.hero-under-nav.nav-scrolled .bottom-nav a {
    color: #2a2520 !important;
  }
  body.hero-under-nav.nav-scrolled .bottom-nav a.active {
    color: #8a6a1e !important;
  }
}

/* ── Desktop: unstick CTA bars and put inside card ── */
/* Desktop celeb circles */
@media (min-width: 768px) {
  .celeb-circle { width: 120px !important; height: 120px !important; }
}

/* Desktop banner sizing — shared across all pages */
@media (min-width: 768px) {
  #cta-banner, #content-cta-banner {
    padding: 22px 32px !important;
    gap: 24px !important;
  }
  #cta-banner [data-i18n="banner_text"],
  #content-cta-banner [data-i18n="banner_text"] {
    font-size: 18px !important;
  }
}

@media (min-width: 768px) {
  #fortune-cta-bar,
  #compat-submit-bar {
    position: static !important;
    padding: 0 !important;
    padding-bottom: 16px !important;
    background: transparent !important;
    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
    border-top: none !important;
  }
}

/* ── Desktop: pull inner card up more ── */
@media (min-width: 768px) {
  main[style*="margin-top:-30px"] { margin-top: -60px !important; }
  main[style*="margin-top:-40px"] { margin-top: -70px !important; }
}

/* ── Desktop responsive ── */
@media (min-width: 768px) {
  .drawer-sheet { max-width: 540px; }
}
@media (min-width: 1024px) {
  .drawer-sheet { max-width: 600px; border-radius: 16px; margin-bottom: 40px; }
  .drawer-overlay { align-items: center; }
}

/* ── Nudge drawer → centered popup on desktop ── */
@media (min-width: 768px) {
  #nudge-overlay { align-items: center; }
  #nudge-overlay .drawer-sheet {
    border-radius: 16px; margin-bottom: 0;
    transform: translateY(20px) !important; opacity: 0 !important;
    transition: transform 0.3s cubic-bezier(0.22,1,0.36,1), opacity 0.25s ease;
  }
  #nudge-overlay.open .drawer-sheet {
    transform: translateY(0) !important; opacity: 1 !important;
  }
}

/* ── Beige 한지 UI cards on navy background ── */
.card-hanji {
  background: linear-gradient(165deg, #f5f0e3 0%, #ede8d6 50%, #e8e1ce 100%);
  border: 1px solid rgba(255,255,255,0.35);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  color: #2a2520;
  position: relative;
  overflow: hidden;
}
.card-hanji::before {
  content: '';
  position: absolute; inset: 0; pointer-events: none;
  background: url('/static/hanji.png') repeat;
  opacity: 0.08;
  mix-blend-mode: multiply;
  z-index: 0;
}
.card-hanji, .card-hanji * {
  --tw-text-opacity: 1;
}
.card-hanji label,
.card-hanji p,
.card-hanji h2,
.card-hanji h3,
.card-hanji h4,
.card-hanji span,
.card-hanji div,
.card-hanji button,
.card-hanji a,
.card-hanji b,
.card-hanji strong,
.card-hanji em {
  color: #2a2520 !important;
}
.card-hanji .text-secondary,
.card-hanji .text-secondary-fixed-dim,
.card-hanji [class*="text-secondary"] {
  color: #7a5a10 !important;
}
.card-hanji .text-error,
.card-hanji [class*="text-error"] {
  color: #c0392b !important;
}
.card-hanji select,
.card-hanji input[type="text"],
.card-hanji input[type="time"] {
  color: #2a2520 !important;
}
.card-hanji input::placeholder { color: #7a7368 !important; }
.card-hanji input[type="text"] { color: #1a2140 !important; font-weight: 600 !important; }
.card-hanji .input-filled { color: #1a2140 !important; font-weight: 600 !important; }
.card-hanji .text-label-caps { font-weight: 500 !important; }
.card-hanji .sex-active { background: #1a2140 !important; color: #e8c97b !important; border-color: transparent !important; font-weight: 600 !important; }
.card-hanji input:-webkit-autofill {
  -webkit-box-shadow: 0 0 0 30px #e8e0cc inset !important;
  -webkit-text-fill-color: #2a2520 !important;
}
.card-hanji .border-outline,
.card-hanji .border-outline-variant {
  border-color: rgba(42,37,32,0.2) !important;
}
.card-hanji .pillar-panel {
  position: relative;
  z-index: 2;
  isolation: isolate;
}
/* Prevent hanji texture overlay from affecting pillar cards */
.card-hanji:has(.pillar-panel)::before {
  display: none;
}
.card-hanji .pillar-panel .text-body-sm {
  color: #9c9488 !important;
}
.card-hanji .pillar-panel span {
  color: #1a1a1a !important;
}
.card-hanji .pillar-panel .opacity-70 {
  opacity: 0.7 !important;
}
.card-hanji .pillar-panel .opacity-60 {
  opacity: 0.6 !important;
}

@keyframes pillar-hint {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}


/* ── Custom select dropdowns (birth time) ── */
.custom-select {
  position: relative;
}
.custom-select-trigger {
  width: 100%;
  background: #262e54;
  border: 1px solid rgba(244,239,226,0.22);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 16px;
  line-height: 26px;
  color: #f4efe2;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s;
}
.custom-select-trigger:hover {
  border-color: #c8932e;
}
.custom-select-panel {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 4px;
  background: #262e54;
  border: 1px solid rgba(244,239,226,0.22);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 60;
  scrollbar-width: none;
  display: none;
}
.custom-select-panel::-webkit-scrollbar { display: none; }
.custom-select-panel.open {
  display: block;
}
.custom-select-option {
  padding: 10px 14px;
  font-size: 15px;
  color: #f4efe2;
  cursor: pointer;
  text-align: center;
  transition: background 0.12s;
}
.custom-select-option:hover {
  background: #1e2648;
}
.custom-select-option.active {
  color: #e8c97b;
  font-weight: 700;
}

/* ── Radial glow ── */
.hero-glow {
  position: absolute; inset: 0; pointer-events: none;
  background: radial-gradient(circle at 28% 0%, color-mix(in srgb, #c8932e 32%, transparent) 0%, transparent 62%);
  filter: blur(46px);
}
