@import url('https://fonts.googleapis.com/css2?family=Cinzel+Decorative:wght@400;700;900&family=Cinzel:wght@400;600;700;800&family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,400&family=Plus+Jakarta+Sans:wght@300;400;500;600&display=swap');

/* ==========================================================================
   CASTALIEN Four Pillars (사주명식) Premium UI Stylesheet (saju.css)
   Aesthetic: Cosmic Obsidian, Imperial Gold, Five Elements Chroma
   ========================================================================== */

:root {
  --bg-dark: #05060b;
  --bg-card: rgba(15, 23, 42, 0.75);
  --bg-card-hover: rgba(30, 41, 59, 0.85);
  --border-gold: rgba(212, 175, 55, 0.25);
  --border-subtle: rgba(255, 255, 255, 0.08);
  --gold-primary: #f3e5ab;
  --gold-light: #fff5d6;
  --cyan-ethereal: #70e4ef;
  --text-main: #e2e8f0;
  --text-muted: #94a3b8;
  --text-gold: #f3e5ab;
  --gold-glow: 0 0 25px rgba(245, 158, 11, 0.25);
  
  /* Five Elements Palette */
  --elem-wood: #10B981;
  --elem-fire: #EF4444;
  --elem-earth: #F59E0B;
  --elem-metal: #E2E8F0;
  --elem-water: #3B82F6;
  
  /* Unified with #1 front/formenu/styles.css */
  --font-display: 'Cinzel Decorative', serif;
  --font-title: 'Cinzel', serif;
  --font-serif: 'Cormorant Garamond', serif;
  --font-sans: 'Plus Jakarta Sans', sans-serif;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  background-color: var(--bg-dark);
  background-image: 
    radial-gradient(ellipse at 50% 0%, rgba(30, 58, 138, 0.2) 0%, transparent 60%),
    radial-gradient(ellipse at 80% 80%, rgba(180, 83, 9, 0.12) 0%, transparent 50%),
    radial-gradient(ellipse at 20% 70%, rgba(16, 185, 129, 0.08) 0%, transparent 50%);
  background-attachment: fixed;
  color: var(--text-main);
  font-family: var(--font-sans);
  min-height: 100vh;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

/* Header & Top Bar (Unified Castalien Navigation) */
.top-bar {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  padding: 16px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background: rgba(5, 6, 11, 0.4);
  border-bottom: 1px solid rgba(212, 175, 55, 0.15);
  box-sizing: border-box;
}

/* Wide screens: align top-bar content with the 1240px content standard (same as K I Ching) */
@media (min-width: 1300px) {
  .top-bar {
    padding-left: calc((100% - 1240px) / 2 + 28px);
    padding-right: calc((100% - 1240px) / 2 + 28px);
  }
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand .symbol {
  font-size: 1.6rem;
  color: var(--gold-primary, #f3e5ab);
  filter: drop-shadow(0 0 8px rgba(254, 240, 138, 0.5));
  animation: brandRotate 12s infinite linear;
  display: inline-block;
  line-height: 1;
}

@keyframes brandRotate {
  from { transform: rotate(0deg); }
  to { transform: rotate(360deg); }
}

.brand a {
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand .title {
  font-family: var(--font-title) !important;
  font-weight: 700 !important;
  letter-spacing: 0.2em;
  font-size: 1.3rem;
  color: var(--gold-primary, #f3e5ab) !important;
  background: none !important;
  -webkit-text-fill-color: var(--gold-primary, #f3e5ab) !important;
}

.saju-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0.28rem 0.7rem;
  border-radius: 8px;
  font-size: 0.76rem;
  font-weight: 600;
  text-decoration: none;
  transition: all 0.2s ease;
}

.saju-nav-link.active {
  color: #fde68a !important;
  background: rgba(245, 158, 11, 0.18) !important;
  border: 1px solid rgba(245, 158, 11, 0.45) !important;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

.saju-nav-link:not(.active) {
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.15);
}

.saju-nav-link:hover {
  filter: brightness(1.15);
  transform: translateY(-1px);
}

.top-bar-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* EON Recharge / Balance Badge (Compact & Rectangular) */
.recharge-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0.22rem 0.55rem;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.78rem;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.16), rgba(5, 150, 105, 0.26));
  border: 1px solid rgba(16, 185, 129, 0.45);
  color: #34d399;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.15);
  transition: all 0.25s ease;
  user-select: none;
  line-height: 1.2;
}

.recharge-btn:hover {
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.28), rgba(5, 150, 105, 0.42));
  border-color: rgba(52, 211, 153, 0.8);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
  transform: translateY(-1px);
}

#headerBalanceVal {
  color: #ffffff !important;
  font-weight: 700;
  font-family: 'Outfit', sans-serif;
  letter-spacing: 0.3px;
  font-size: 0.78rem;
}

/* Nav Dropdown Elements (Unified with #1 front/formenu/styles.css) */
.nav-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
  z-index: 100000;
}

.nav-dropdown-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  height: 36px !important;
  box-sizing: border-box !important;
  gap: 0.45rem !important;
  background: rgba(15, 23, 42, 0.6) !important;
  border: 1px solid rgba(229, 193, 88, 0.4) !important;
  color: #f3e5ab !important;
  padding: 0 0.95rem !important;
  border-radius: 20px !important;
  font-family: var(--font-title, 'Cinzel', sans-serif) !important;
  font-size: 0.82rem !important;
  font-weight: 600 !important;
  letter-spacing: 0.05em !important;
  cursor: pointer !important;
  backdrop-filter: blur(8px) !important;
  -webkit-backdrop-filter: blur(8px) !important;
  transition: all 0.3s ease !important;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2) !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  white-space: nowrap !important;
}

.nav-dropdown-btn:hover,
.nav-dropdown.active .nav-dropdown-btn {
  background: rgba(229, 193, 88, 0.15) !important;
  border-color: #e5c158 !important;
  color: #ffffff !important;
  box-shadow: 0 0 15px rgba(229, 193, 88, 0.35) !important;
}

.nav-dropdown-btn .dropdown-arrow {
  transition: transform 0.3s ease;
  color: #70e4ef !important;
  flex-shrink: 0;
}

.nav-dropdown.active .nav-dropdown-btn .dropdown-arrow {
  transform: rotate(180deg);
}

.nav-dropdown-menu {
  display: none !important;
  position: absolute;
  top: calc(100% + 0.6rem);
  right: 0;
  width: 260px;
  max-width: 88vw;
  background: rgba(8, 11, 22, 0.98) !important;
  backdrop-filter: blur(20px) !important;
  -webkit-backdrop-filter: blur(20px) !important;
  border: 1px solid rgba(229, 193, 88, 0.4) !important;
  border-radius: 12px !important;
  padding: 0.5rem 0 !important;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.85), 0 0 20px rgba(112, 228, 239, 0.2) !important;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateY(-8px) scale(0.96);
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 999999;
}

.nav-dropdown.active .nav-dropdown-menu {
  display: flex !important;
  opacity: 1 !important;
  visibility: visible !important;
  pointer-events: auto !important;
  transform: translateY(0) scale(1) !important;
}

.dropdown-item {
  display: flex;
  flex-direction: column;
  padding: 0.65rem 1.1rem;
  text-decoration: none;
  border-left: 2px solid transparent;
  transition: all 0.2s ease;
  cursor: pointer;
}

.dropdown-item:hover {
  background: rgba(112, 228, 239, 0.08);
  border-left-color: #70e4ef;
  padding-left: 1.3rem;
}

.dropdown-item.dropdown-sub-item:hover {
  padding-left: 1.8rem !important;
}

.dropdown-item .item-title,
.dropdown-section-header,
.dropdown-section-header .item-title {
  color: #ffffff;
  font-family: var(--font-title, 'Cinzel', serif) !important;
  font-size: 0.88rem;
  font-weight: 500;
  letter-spacing: 0.02em;
}

.dropdown-item:hover .item-title {
  color: #70e4ef !important;
}

.dropdown-item .item-url {
  color: rgba(255, 255, 255, 0.45);
  font-family: var(--font-serif, serif);
  font-size: 0.73rem;
  margin-top: 0.15rem;
}

/* ==========================================================================
   Member navigation menu (.nm-*), built by navbar.js (NAVIMENU_PLAN.txt)
   ========================================================================== */
#network-dropdown-menu.nm-menu { padding: 0.5rem 0; }
.nm-item {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.62rem 1.15rem;
  color: #E5E7EB;
  text-decoration: none;
  font-size: 0.92rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  border-left: 2px solid transparent;
  transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.nm-item:hover { background: rgba(16, 185, 129, 0.1); color: #6EE7B7; border-left-color: #10B981; }
.nm-item.is-current { color: #34D399; background: rgba(16, 185, 129, 0.08); border-left-color: #10B981; }
.nm-dot { flex: none; width: 6px; height: 6px; border-radius: 50%; background: rgba(255, 255, 255, 0.22); }
.nm-item.is-current .nm-dot { background: #10B981; box-shadow: 0 0 8px rgba(16, 185, 129, 0.85); }
.nm-group { margin: 0.3rem 0; padding: 0.4rem 0; border-top: 1px solid rgba(255, 255, 255, 0.08); border-bottom: 1px solid rgba(255, 255, 255, 0.08); }
.nm-group-label { display: block; padding: 0.25rem 1.15rem 0.15rem; font-size: 0.68rem; letter-spacing: 0.2em; text-transform: uppercase; color: #D9B36A; font-weight: 700; }
.nm-sub { padding-left: 1.9rem; font-weight: 500; font-size: 0.88rem; }
/* third level: link + arrow toggle, collapsible children */
.nm-branch-row { display: flex; align-items: stretch; }
.nm-branch-link { flex: 1; min-width: 0; }
.nm-toggle { flex: none; width: 44px; display: flex; align-items: center; justify-content: center; background: transparent; border: 0; border-left: 1px solid rgba(255, 255, 255, 0.06); color: #9CA3AF; cursor: pointer; transition: background 0.2s ease, color 0.2s ease; }
.nm-toggle:hover, .nm-toggle:focus-visible { background: rgba(16, 185, 129, 0.12); color: #6EE7B7; outline: none; }
.nm-arrow { width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(-45deg); transition: transform 0.2s ease; }
.nm-branch.is-open .nm-arrow { transform: rotate(45deg); }
.nm-children { display: none; background: rgba(0, 0, 0, 0.14); }
.nm-branch.is-open .nm-children { display: block; }
.nm-sub2 { padding-left: 2.9rem; font-weight: 500; font-size: 0.84rem; }
.nm-branch.has-current .nm-branch-link .nm-dot { background: rgba(16, 185, 129, 0.55); }

/* User Auth Dropdown */
.user-auth-btn {
  width: 36px !important;
  height: 36px !important;
  padding: 0 !important;
  border-radius: 50% !important;
  background: rgba(15, 23, 42, 0.6) !important;
  border: 1px solid rgba(229, 193, 88, 0.4) !important;
  color: #f3e5ab !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 1.05rem !important;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2) !important;
  box-sizing: border-box !important;
}

.user-auth-btn:hover,
.nav-dropdown.active .user-auth-btn {
  background: rgba(229, 193, 88, 0.18) !important;
  border-color: #e5c158 !important;
  color: #ffffff !important;
  box-shadow: 0 0 15px rgba(229, 193, 88, 0.35) !important;
}

.user-avatar-icon {
  font-size: 1.05rem;
  line-height: 1;
}

.user-auth-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: #f3e5ab;
}

/* Auth Dropdown State Isolation (Unbreakable Rules) */
.logged-in .guest-only-item,
body.logged-in .guest-only-item,
html.logged-in .guest-only-item {
  display: none !important;
}

.logged-in .auth-only-item,
body.logged-in .auth-only-item,
html.logged-in .auth-only-item {
  display: flex !important;
}

html:not(.logged-in) body:not(.logged-in) .guest-only-item,
body:not(.logged-in) .guest-only-item {
  display: flex !important;
}

html:not(.logged-in) body:not(.logged-in) .auth-only-item,
body:not(.logged-in) .auth-only-item {
  display: none !important;
}

/* Language Selector Pill Dropdown */
.lang-select {
  height: 36px !important;
  box-sizing: border-box !important;
  background: rgba(15, 23, 42, 0.6) !important;
  border: 1px solid rgba(229, 193, 88, 0.4) !important;
  color: #f3e5ab !important;
  padding: 0 1.9rem 0 0.8rem !important;
  border-radius: 20px !important;
  font-size: 0.8rem !important;
  font-weight: 600 !important;
  font-family: var(--font-title, 'Cinzel', serif) !important;
  letter-spacing: 0.05em !important;
  cursor: pointer !important;
  outline: none !important;
  transition: all 0.3s ease !important;
  appearance: none !important;
  -webkit-appearance: none !important;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23f3e5ab' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E") !important;
  background-repeat: no-repeat !important;
  background-position: right 0.6rem center !important;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2) !important;
}

.lang-select:hover, .lang-select:focus {
  background-color: rgba(229, 193, 88, 0.15) !important;
  box-shadow: 0 0 15px rgba(229, 193, 88, 0.35) !important;
  border-color: #e5c158 !important;
  color: #ffffff !important;
}

.lang-select option {
  background: #0b0f19;
  color: #f3e5ab;
  padding: 0.5rem;
}

/* Header overflow guard */
.brand { min-width: 0; flex: 0 1 auto; }
.brand .title { white-space: nowrap; }
.top-bar-right { flex-shrink: 0; }

@media (max-width: 992px) {
  .top-bar {
    padding: 0.9rem 1.2rem !important;
  }
  .brand .title {
    font-size: 1rem !important;
    letter-spacing: 0.08em !important;
  }
  .top-bar-right {
    gap: 0.45rem !important;
  }
}

@media (max-width: 768px) {
  .top-bar {
    padding: 0.75rem 0.85rem !important;
  }
  .brand .title {
    font-size: 0.88rem !important;
    letter-spacing: 0.05em !important;
  }
  .saju-nav-link {
    font-size: 0.72rem;
    padding: 0.2rem 0.5rem;
  }
  .top-bar-right {
    gap: 0.38rem !important;
  }
  .lang-select {
    height: 34px !important;
    padding: 0 1.5rem 0 0.6rem !important;
    font-size: 0.76rem !important;
    background-position: right 0.45rem center !important;
  }
  .user-auth-btn {
    width: 34px !important;
    height: 34px !important;
    font-size: 0.98rem !important;
  }
  #network-dropdown-btn {
    width: 34px !important;
    height: 34px !important;
    padding: 0 !important;
    justify-content: center !important;
    gap: 0 !important;
  }
  .nav-btn-text,
  .nav-dropdown-btn .dropdown-arrow {
    display: none !important;
  }
  .nav-dropdown-menu {
    right: 0;
    width: 260px;
    max-width: 88vw;
  }
}

@media (max-width: 480px) {
  .top-bar {
    padding: 0.65rem 0.55rem !important;
  }
  .top-bar-right {
    gap: 0.28rem !important;
  }
  .brand {
    gap: 0.28rem !important;
  }
  .brand a {
    gap: 0.28rem !important;
  }
  .brand .symbol {
    font-size: 1.15rem !important;
  }
  .brand .title {
    font-size: 0.75rem !important;
    letter-spacing: 0.02em !important;
  }
  .saju-nav-link span:last-child {
    display: none;
  }
  .user-auth-label {
    display: none;
  }
  .lang-select {
    height: 32px !important;
    padding: 0 1.25rem 0 0.45rem !important;
    font-size: 0.72rem !important;
    background-position: right 0.35rem center !important;
  }
  .user-auth-btn {
    width: 32px !important;
    height: 32px !important;
    font-size: 0.92rem !important;
  }
  #network-dropdown-btn {
    width: 32px !important;
    height: 32px !important;
    padding: 0 !important;
    justify-content: center !important;
    gap: 0 !important;
  }
  .nav-dropdown-btn .nav-btn-icon {
    width: 16px !important;
    height: 16px !important;
  }
  .nav-dropdown-btn .dropdown-arrow,
  .nav-btn-text {
    display: none !important;
  }
  .nav-dropdown-menu {
    width: 245px !important;
    right: 0 !important;
  }
}

/* Container (Wide layout for Destiny Matrix & 4 Pillars) */
.saju-container {
  max-width: 1100px;
  width: 100%;
  margin: 2rem auto;
  padding: 0 1.5rem 4rem 1.5rem;
}

/* Hero Section */
.hero-banner {
  text-align: center;
  margin-bottom: 2.5rem;
  padding: 1.5rem;
}

.hero-subtitle {
  font-family: var(--font-display);
  font-size: 0.88rem;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: #f59e0b;
  margin-bottom: 0.5rem;
}

.hero-title {
  font-family: var(--font-serif);
  font-size: 2.2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #ffffff 40%, #fde68a 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.75rem;
}

.hero-desc {
  color: var(--text-muted);
  max-width: 650px;
  margin: 0 auto;
  font-size: 0.95rem;
}

/* Form Card */
.form-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 16px;
  padding: 2.2rem 2.5rem;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(12px);
  margin-bottom: 2.5rem;
}

.form-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.form-title {
  font-family: var(--font-serif);
  font-size: 1.25rem;
  color: var(--text-gold);
  display: flex;
  align-items: center;
  gap: 8px;
}

.autofill-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.3);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.autofill-btn:hover {
  background: rgba(56, 189, 248, 0.2);
  border-color: rgba(56, 189, 248, 0.5);
}

.profile-btn-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.saveprofile-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.4rem 0.85rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #34d399;
  background: rgba(16, 185, 129, 0.12);
  border: 1px solid rgba(16, 185, 129, 0.35);
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.saveprofile-btn:hover {
  background: rgba(16, 185, 129, 0.22);
  border-color: rgba(16, 185, 129, 0.6);
  color: #6ee7b7;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.25);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1.25rem;
  margin-bottom: 1.75rem;
}

.form-top-grid {
  grid-template-columns: 0.88fr 1.88fr 0.76fr;
  gap: 1.25rem;
  align-items: start;
  margin-bottom: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.form-group-major label {
  font-size: 0.88rem;
  font-weight: 600;
  color: #f3e5ab;
}

.form-group label {
  font-size: 0.82rem;
  font-weight: 500;
  color: #cbd5e1;
}

.form-control {
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 0.65rem 0.9rem;
  color: #fff;
  font-size: 0.92rem;
  font-family: inherit;
  outline: none;
  transition: border-color 0.2s;
}

.form-control-lg {
  padding: 0.78rem 1rem;
  font-size: 0.98rem;
  font-weight: 600;
  min-height: 46px;
}

.form-side-stack {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.55rem;
  align-self: center;
}

.form-side-stack .form-control {
  width: 100%;
  padding: 0.58rem 0.85rem;
  font-size: 0.88rem;
  text-align: center;
  cursor: pointer;
}

.form-section-divider {
  border: 0;
  border-top: 1px solid rgba(229, 193, 88, 0.28);
  margin: 1.35rem 0;
}

.form-bottom-rows {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.6rem;
}

.form-full-row {
  width: 100%;
}

.form-full-row > .form-control {
  width: 100%;
}

.concern-inline-row {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0.55rem;
}

.concern-inline-row #userConcern {
  width: 100%;
}

.concern-inline-row .concern-preset-bar {
  margin-bottom: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

@media (max-width: 860px) {
  .form-top-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

.form-control:focus {
  border-color: #f59e0b;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.2);
}

/* Ergonomic Time Picker & Date Field Styling */
input[type="date"]::-webkit-datetime-edit-year-field {
  max-width: 4.5ch;
}

.time-select-row {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.shijin-select {
  flex: 1.2;
  min-width: 140px;
}

.time-hm-container {
  display: flex;
  align-items: center;
  gap: 4px;
}

.hm-select {
  padding: 0.65rem 0.4rem;
  min-width: 68px;
  text-align: center;
}

.hm-colon {
  font-weight: 700;
  color: var(--text-gold);
  font-size: 1.1rem;
}

.checkbox-group {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 0.25rem;
}

.checkbox-group input {
  accent-color: #f59e0b;
}

.checkbox-group span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

/* Button Group */
.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: flex-end;
  align-items: center;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.btn-preview {
  background: linear-gradient(135deg, #d97706, #b45309);
  border: 1px solid #f59e0b;
  color: #ffffff;
  padding: 0.8rem 1.85rem;
  border-radius: 10px;
  font-size: 0.96rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: var(--gold-glow);
  transition: all 0.25s ease;
}

.btn-preview:hover {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #fbbf24;
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.45);
}

.btn-premium {
  background: linear-gradient(135deg, #d97706, #b45309);
  border: 1px solid #f59e0b;
  color: #fff;
  padding: 0.75rem 1.6rem;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: var(--gold-glow);
  transition: all 0.25s ease;
}

.btn-premium:hover {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  transform: translateY(-1px);
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.4);
}

/* Saju Matrix (Four Pillars) Cards */
.matrix-section {
  margin-bottom: 2.5rem;
  display: none; /* Shown after calculation */
}

.section-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--text-gold);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.pillars-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1.25rem;
  margin-bottom: 2rem;
}

@media (max-width: 768px) {
  .pillars-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  .btn-charge {
    margin-left: 0;
    width: 100%;
  }
  .mobile-hide-text {
    display: none !important;
  }
  .autofill-btn,
  .saveprofile-btn,
  .btn-report-tool {
    padding: 0.42rem 0.65rem;
    gap: 0;
    font-size: 1rem;
  }
  .preset-chip {
    padding: 0.35rem 0.65rem;
    font-size: 0.95rem;
  }
  .form-btn-group {
    width: 100%;
    justify-content: flex-end;
  }
}

.pillar-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.25rem 0.75rem;
  text-align: center;
  position: relative;
  transition: all 0.25s ease;
}

.pillar-card.day-master-card {
  border-color: rgba(245, 158, 11, 0.6);
  background: linear-gradient(180deg, rgba(30, 41, 59, 0.8), rgba(15, 23, 42, 0.9));
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.15);
}

.pillar-card.day-master-card::before {
  content: '★ 本元 / Day Master';
  position: absolute;
  top: -10px;
  left: 50%;
  transform: translateX(-50%);
  background: #f59e0b;
  color: #000;
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 10px;
  border-radius: 20px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.pillar-header {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-bottom: 0.75rem;
}

.pillar-slot {
  background: rgba(0, 0, 0, 0.35);
  border-radius: 10px;
  padding: 0.85rem 0.5rem;
  margin-bottom: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.ten-god-tag {
  font-size: 0.72rem;
  color: #94a3b8;
  margin-bottom: 0.25rem;
}

.char-hanja {
  font-family: var(--font-serif);
  font-size: 2.4rem;
  font-weight: 900;
  line-height: 1.1;
  margin-bottom: 0.2rem;
}

.char-ko {
  font-size: 0.85rem;
  color: #e2e8f0;
  font-weight: 600;
}

.element-pill {
  display: inline-block;
  font-size: 0.7rem;
  padding: 2px 8px;
  border-radius: 12px;
  font-weight: 700;
  margin-top: 4px;
}

/* Five Elements Section */
.elements-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 1.5rem;
  margin-bottom: 2.5rem;
}

.elements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 1rem;
  margin-top: 1rem;
}

.element-item {
  background: rgba(0, 0, 0, 0.25);
  border-radius: 10px;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.element-item-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.82rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.element-bar-bg {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 0.4rem;
}

.element-bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.element-stat {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.elements-summary-badges {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.summary-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.4rem 0.9rem;
  border-radius: 8px;
  font-size: 0.82rem;
  font-weight: 600;
}

.badge-dominant {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.4);
  color: #f87171;
}

.badge-deficient {
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
}

/* Premium Report Viewer */
.report-section {
  display: none; /* Shown after report generation */
  background: var(--bg-card);
  border: 1px solid var(--border-gold);
  border-radius: 16px;
  padding: 2.5rem;
  box-shadow: 0 0 50px rgba(0, 0, 0, 0.6);
  position: relative;
}

.report-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border-subtle);
}

.report-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0.35rem 0.8rem;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.4);
  border-radius: 6px;
  color: #fde68a;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.report-actions {
  display: flex;
  gap: 8px;
}

.btn-report-tool {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border-subtle);
  color: #e2e8f0;
  padding: 0.4rem 0.85rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.2s ease;
}

.btn-report-tool:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  border-color: var(--border-gold);
}

/* Markdown Content Styling */
.markdown-body {
  font-family: var(--font-serif);
  font-size: 1.02rem;
  color: #e2e8f0;
  line-height: 1.85;
}

.markdown-body h1 {
  font-size: 1.8rem;
  color: var(--text-gold);
  border-bottom: 1px solid var(--border-subtle);
  padding-bottom: 0.75rem;
  margin: 1.5rem 0 1.25rem 0;
}

.markdown-body h2 {
  font-size: 1.4rem;
  color: #ffffff;
  margin: 1.75rem 0 1rem 0;
}

.markdown-body h3 {
  font-size: 1.2rem;
  color: #fde68a;
  margin: 1.75rem 0 0.75rem 0;
  padding-left: 0.5rem;
  border-left: 3px solid #f59e0b;
}

.markdown-body p {
  margin-bottom: 1.25rem;
}

.markdown-body blockquote {
  background: rgba(245, 158, 11, 0.08);
  border-left: 4px solid #f59e0b;
  padding: 1rem 1.25rem;
  border-radius: 0 8px 8px 0;
  margin: 1.5rem 0;
  color: #fde68a;
  font-style: italic;
}

.markdown-body ul, .markdown-body ol {
  margin: 1rem 0 1.5rem 1.5rem;
}

.markdown-body li {
  margin-bottom: 0.5rem;
}

.markdown-body code {
  background: rgba(255, 255, 255, 0.1);
  padding: 2px 6px;
  border-radius: 4px;
  color: #38bdf8;
  font-family: monospace;
  font-size: 0.9em;
}

.markdown-body hr {
  border: 0;
  height: 1px;
  background: var(--border-subtle);
  margin: 2rem 0;
}

/* Confirmation Modal */
.modal-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 999;
  justify-content: center;
  align-items: center;
}

.modal-content {
  background: #0f172a;
  border: 1px solid var(--border-gold);
  border-radius: 16px;
  padding: 2rem;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8), var(--gold-glow);
  text-align: center;
}

.modal-icon {
  font-size: 2.5rem;
  margin-bottom: 1rem;
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.35rem;
  color: var(--text-gold);
  margin-bottom: 0.75rem;
}

.modal-body {
  font-size: 0.92rem;
  color: #cbd5e1;
  margin-bottom: 1.5rem;
  line-height: 1.6;
}

.modal-balance-box {
  background: rgba(0, 0, 0, 0.35);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 0.85rem;
  margin: 1rem 0;
  text-align: left;
  font-size: 0.85rem;
}

.balance-row {
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}

.balance-row:last-child {
  margin-bottom: 0;
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.btn-modal-cancel {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid var(--border-subtle);
  color: #cbd5e1;
  padding: 0.65rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
}

.btn-modal-confirm {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border: 1px solid #f59e0b;
  color: #000;
  padding: 0.65rem 1.4rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 700;
}

/* Spinner / Loading */
.loading-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.85);
  backdrop-filter: blur(10px);
  z-index: 1000;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  gap: 1.5rem;
}

.cosmic-spinner {
  width: 60px;
  height: 60px;
  border: 3px solid rgba(245, 158, 11, 0.2);
  border-top-color: #f59e0b;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  color: var(--text-gold);
}

.loading-subtext {
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* EON Status & Enhanced Action Toolbars */
.eon-status-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(0, 0, 0, 0.4);
  padding: 0.45rem 1rem;
  border-radius: 8px;
  border: 1px solid var(--border-gold);
  font-size: 0.85rem;
}

.eon-status-label {
  color: var(--text-muted);
  font-size: 0.8rem;
}

.eon-status-val {
  color: #fde68a;
  font-family: 'Outfit', sans-serif;
  font-size: 1rem;
}

.eon-charge-link {
  color: #38bdf8;
  font-weight: 700;
  text-decoration: none;
  font-size: 0.8rem;
  margin-left: 4px;
  padding: 3px 8px;
  border-radius: 4px;
  background: rgba(56, 189, 248, 0.15);
  border: 1px solid rgba(56, 189, 248, 0.3);
  transition: all 0.2s;
}

.eon-charge-link:hover {
  background: rgba(56, 189, 248, 0.25);
  color: #7dd3fc;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.3);
}

.form-btn-group {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.btn-charge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0.85rem 1.4rem;
  border-radius: 8px;
  font-size: 0.95rem;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(14, 165, 233, 0.25));
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: #38bdf8;
  box-shadow: 0 0 15px rgba(56, 189, 248, 0.15);
  transition: all 0.25s ease;
}

.btn-charge:hover {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.3), rgba(14, 165, 233, 0.5));
  border-color: #38bdf8;
  color: #ffffff;
  box-shadow: 0 0 25px rgba(56, 189, 248, 0.4);
  transform: translateY(-2px);
}

.btn-gold-tool {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.2), rgba(217, 119, 6, 0.3)) !important;
  border-color: rgba(245, 158, 11, 0.6) !important;
  color: #fde68a !important;
  font-weight: 700 !important;
  box-shadow: 0 0 15px rgba(245, 158, 11, 0.2) !important;
}

.btn-gold-tool:hover {
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.35), rgba(217, 119, 6, 0.5)) !important;
  border-color: #f59e0b !important;
  color: #ffffff !important;
  box-shadow: 0 0 25px rgba(245, 158, 11, 0.4) !important;
  transform: translateY(-1px);
}

.matrix-action-bar {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 1.5rem;
  padding-top: 0.5rem;
}

.matrix-action-left {
  display: flex;
  align-items: center;
}

.matrix-action-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

@media (max-width: 640px) {
  .matrix-action-bar {
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 12px;
  }
  .matrix-action-left, .matrix-action-right {
    width: 100%;
    justify-content: center;
  }
  .matrix-action-left .btn-report-tool,
  .matrix-action-right .btn-premium {
    width: 100%;
    justify-content: center;
  }
}

.btn-scroll-circle {
  width: 48px;
  height: 48px;
  min-width: 48px;
  min-height: 48px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  background: linear-gradient(135deg, rgba(245, 158, 11, 0.25), rgba(217, 119, 6, 0.45));
  border: 2px solid var(--border-gold);
  color: #fde68a;
  box-shadow: 0 0 20px rgba(245, 158, 11, 0.35);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
}

.btn-scroll-circle:hover {
  background: linear-gradient(135deg, #f59e0b, #d97706);
  border-color: #fbbf24;
  color: #ffffff;
  transform: translateY(-3px) scale(1.12);
  box-shadow: 0 0 30px rgba(245, 158, 11, 0.7);
}

.btn-scroll-circle:active {
  transform: translateY(0) scale(0.95);
}

.btn-scroll-circle .circle-arrow {
  font-size: 1.35rem;
  line-height: 1;
  display: block;
  transform: translateY(-1px);
}

.report-footer-card {
  margin-top: 3rem;
  padding: 2.5rem 1.5rem;
  background: rgba(15, 23, 42, 0.9);
  border: 1px solid var(--border-gold);
  border-radius: 16px;
  text-align: center;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6), var(--gold-glow);
}

.report-footer-card h4 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--text-gold);
  margin-bottom: 0.5rem;
  letter-spacing: 1px;
}

.report-footer-card p {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 1.5rem;
}

.report-footer-actions {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.guest-auth-group, .user-auth-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-gold {
  border-color: rgba(245, 158, 11, 0.5) !important;
  color: #fde68a !important;
  background: rgba(245, 158, 11, 0.12) !important;
}

.btn-gold:hover {
  background: rgba(245, 158, 11, 0.25) !important;
  border-color: #f59e0b !important;
}

.user-badge {
  font-size: 0.82rem;
  font-weight: 700;
  color: #cbd5e1;
  padding: 0.35rem 0.65rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 6px;
  border: 1px solid var(--border-subtle);
}


/* =========================================================================
   V2.0 MASTERPIECE UI: CONCERN PRESETS, GYEOKGUK, TEN-GOD BARS, DAEWOON & TOC
   ========================================================================= */

.concern-preset-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.55rem;
}

.preset-bar-label {
  font-size: 0.76rem;
  font-weight: 700;
  color: #E5C158;
  margin-right: 0.25rem;
}

.preset-chip {
  background: rgba(229, 193, 88, 0.08);
  border: 1px solid rgba(229, 193, 88, 0.28);
  color: #e2e8f0;
  border-radius: 999px;
  padding: 0.28rem 0.7rem;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}

.preset-chip:hover,
.preset-chip.active {
  background: rgba(229, 193, 88, 0.22);
  border-color: #E5C158;
  color: #fff;
  transform: translateY(-1px);
}

.pillar-meta-footer {
  margin-top: 0.65rem;
  padding-top: 0.55rem;
  border-top: 1px dashed rgba(255, 255, 255, 0.12);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.76rem;
}

.pillar-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
}

.pillar-meta-row .meta-label {
  color: #94a3b8;
  font-weight: 600;
  white-space: nowrap;
}

.pillar-meta-row .meta-val {
  color: #e2e8f0;
  font-weight: 500;
  text-align: right;
  font-size: 0.74rem;
}

.pillar-meta-row .stage-highlight {
  color: #E5C158;
  font-weight: 700;
}

.meta-grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(215px, 1fr));
  gap: 0.9rem;
}

.meta-card {
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(229, 193, 88, 0.22);
  border-radius: 12px;
  padding: 1rem 1.15rem;
}

.meta-card.meta-card-gold {
  background: linear-gradient(135deg, rgba(229, 193, 88, 0.13), rgba(15, 23, 42, 0.8));
  border-color: rgba(229, 193, 88, 0.45);
}

.meta-card-label {
  font-size: 0.78rem;
  color: #94a3b8;
  font-weight: 600;
  margin-bottom: 0.35rem;
}

.meta-card-value {
  font-size: 1.08rem;
  font-weight: 800;
  margin-bottom: 0.3rem;
}

.meta-card-sub {
  font-size: 0.78rem;
  color: #cbd5e1;
  line-height: 1.45;
}

/* Ten-God 5-Domain Matrix Bars (V2.0) */
.tengod-domain-box {
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 10px;
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
}

.tengod-domain-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.82rem;
  font-weight: 700;
  color: #E5C158;
  margin-bottom: 0.65rem;
}

.tengod-flow-tag {
  font-size: 0.75rem;
  font-weight: 600;
  color: #38bdf8;
  background: rgba(56, 189, 248, 0.1);
  border: 1px solid rgba(56, 189, 248, 0.25);
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
}

.tengod-domain-bars {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(145px, 1fr));
  gap: 0.65rem;
}

.tengod-bar-item {
  background: rgba(255, 255, 255, 0.03);
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
}

.tengod-bar-top {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  margin-bottom: 0.3rem;
}

.tengod-bar-track {
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.tengod-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease;
}

.meta-tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
}

.meta-tag-pill {
  font-size: 0.82rem;
  color: #e2e8f0;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.1);
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  line-height: 1.5;
}

.meta-tag-pill strong {
  color: #E5C158;
}

/* 10-Year Daewoon Horizontal Scroll */
.daewoon-scroll-wrap {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(98px, 1fr));
  gap: 0.6rem;
}

.daewoon-card {
  position: relative;
  background: rgba(15, 23, 42, 0.65);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  padding: 0.75rem 0.5rem;
  text-align: center;
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.daewoon-card.daewoon-current {
  background: linear-gradient(180deg, rgba(229, 193, 88, 0.16) 0%, rgba(15, 23, 42, 0.85) 100%);
  border: 1.5px solid #E5C158;
  box-shadow: 0 0 18px rgba(229, 193, 88, 0.2);
}

.daewoon-now-badge {
  font-size: 0.62rem;
  font-weight: 800;
  color: #090d16;
  background: #E5C158;
  border-radius: 4px;
  padding: 2px 5px;
  margin-bottom: 0.35rem;
  display: inline-block;
}

.daewoon-age {
  font-size: 0.75rem;
  color: #94a3b8;
  font-weight: 600;
}

.daewoon-ganzhi {
  font-size: 1.25rem;
  font-weight: 800;
  color: #f8fafc;
  margin: 0.2rem 0 0.1rem;
  font-family: 'Noto Serif KR', serif;
}

.daewoon-ko {
  font-size: 0.75rem;
  color: #cbd5e1;
  margin-bottom: 0.25rem;
}

.daewoon-gods {
  font-size: 0.7rem;
  color: #E5C158;
  font-weight: 600;
}

.daewoon-stage {
  font-size: 0.68rem;
  color: #38bdf8;
  margin-top: 0.15rem;
}

/* Report Typography, TOC & Tables */
.report-toc-box {
  background: rgba(15, 23, 42, 0.75);
  border: 1px solid rgba(229, 193, 88, 0.3);
  border-radius: 12px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 2rem;
}

.report-toc-title {
  font-size: 0.9rem;
  font-weight: 800;
  color: #E5C158;
  letter-spacing: 0.04em;
  margin-bottom: 0.85rem;
}

.report-toc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 0.5rem 1rem;
}

.report-toc-link {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.85rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.03);
  transition: all 0.2s ease;
}

.report-toc-link:hover {
  color: #E5C158;
  background: rgba(229, 193, 88, 0.1);
}

.report-h1 {
  color: #F59E0B;
  margin: 24px 0 16px 0;
  font-size: 1.7rem;
  border-bottom: 1px solid rgba(245, 158, 11, 0.25);
  padding-bottom: 10px;
}

.report-h2 {
  color: #E5C158;
  margin: 34px 0 14px 0;
  font-size: 1.38rem;
  border-left: 4px solid #E5C158;
  padding-left: 12px;
  scroll-margin-top: 80px;
}

.report-h3 {
  color: #f8fafc;
  margin: 22px 0 10px 0;
  font-size: 1.15rem;
}

.report-h4 {
  color: #38bdf8;
  margin: 16px 0 8px 0;
  font-size: 1.02rem;
}

.report-p {
  margin-bottom: 13px;
  line-height: 1.88;
  color: #cbd5e1;
}

.report-ul, .report-ol {
  margin: 10px 0 16px 22px;
  line-height: 1.8;
  color: #cbd5e1;
}

.report-quote {
  margin: 16px 0;
  padding: 14px 20px;
  background: rgba(229, 193, 88, 0.07);
  border-left: 4px solid #E5C158;
  border-radius: 6px;
  font-style: italic;
  color: #f1f5f9;
}

.report-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 16px 0 22px 0;
}

.report-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: rgba(15, 23, 42, 0.55);
  border: 1px solid rgba(229, 193, 88, 0.25);
  border-radius: 8px;
  overflow: hidden;
}

.report-table th {
  background: rgba(229, 193, 88, 0.15);
  color: #E5C158;
  font-weight: 700;
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid rgba(229, 193, 88, 0.3);
}

.report-table td {
  padding: 0.65rem 0.9rem;
  color: #e2e8f0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  line-height: 1.55;
}

.report-table tr:nth-child(even) td {
  background: rgba(255, 255, 255, 0.02);
}

/* Report Closing Epilogue */
.report-closing-epilogue {
  margin-top: 2.5rem;
  padding-top: 1.4rem;
  border-top: 1px dashed rgba(229, 193, 88, 0.35);
  text-align: center;
}

.report-closing-epilogue .epilogue-text {
  font-family: var(--font-serif);
  font-size: 1rem;
  line-height: 1.7;
  color: #e2e8f0;
  margin: 0 auto 0.45rem auto;
  word-break: keep-all;
}

.report-closing-epilogue .epilogue-org {
  font-family: var(--font-display);
  font-size: 0.92rem;
  font-weight: 700;
  color: #E5C158;
  letter-spacing: 0.6px;
}

/* Mobile Optimization for Saju Containers & Report Body (Eliminate excessive side margins & overflow) */
@media (max-width: 768px) {
  .saju-container {
    margin: 1rem auto;
    padding: 0 0.65rem 3rem 0.65rem;
  }
  .hero-banner {
    padding: 0.75rem 0.4rem;
    margin-bottom: 1.25rem;
  }
  .hero-title {
    font-size: 1.5rem;
  }
  .form-card {
    padding: 1.25rem 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
  }
  .elements-panel {
    padding: 1.15rem 0.95rem;
    border-radius: 12px;
    margin-bottom: 1.25rem;
  }
  .report-section {
    padding: 1.25rem 0.95rem;
    border-radius: 12px;
    overflow-x: hidden;
  }
  .report-toolbar {
    margin-bottom: 1.15rem;
    padding-bottom: 0.75rem;
  }
  .report-badge {
    padding: 0.42rem 0.65rem;
    font-size: 1rem;
    gap: 0;
  }
  .report-toc-box {
    padding: 0.95rem 0.85rem;
    margin-bottom: 1.35rem;
  }
  .report-toc-title {
    font-size: 0.84rem;
    margin-bottom: 0.65rem;
  }
  .report-toc-grid {
    grid-template-columns: 1fr;
    gap: 0.4rem;
  }
  .report-toc-link {
    font-size: 0.82rem;
    padding: 0.38rem 0.55rem;
    word-break: keep-all;
    overflow-wrap: break-word;
  }
  .markdown-body {
    font-size: 0.95rem;
    line-height: 1.76;
    word-break: keep-all;
    overflow-wrap: break-word;
  }
  .report-h1,
  .markdown-body h1 {
    font-size: 1.32rem;
    margin: 16px 0 12px 0;
    padding-bottom: 8px;
    line-height: 1.38;
  }
  .report-h2,
  .markdown-body h2 {
    font-size: 1.14rem;
    margin: 24px 0 10px 0;
    padding-left: 9px;
    border-left-width: 3px;
    line-height: 1.4;
  }
  .report-h3,
  .markdown-body h3 {
    font-size: 1.02rem;
    margin: 16px 0 8px 0;
    line-height: 1.42;
  }
  .report-h4,
  .markdown-body h4 {
    font-size: 0.95rem;
    margin: 12px 0 6px 0;
  }
  .report-p,
  .markdown-body p {
    font-size: 0.95rem;
    line-height: 1.76;
    margin-bottom: 11px;
  }
  .report-ul,
  .report-ol,
  .markdown-body ul,
  .markdown-body ol {
    margin: 8px 0 12px 1.15rem;
    padding-left: 0;
    line-height: 1.72;
  }
  .report-quote,
  .markdown-body blockquote {
    padding: 10px 12px;
    margin: 12px 0;
    font-size: 0.92rem;
    line-height: 1.65;
  }
  .report-table-wrap {
    margin: 12px 0 16px 0;
    -webkit-overflow-scrolling: touch;
  }
  .report-table {
    font-size: 0.8rem;
  }
  .report-table th,
  .report-table td {
    padding: 0.5rem 0.55rem;
    word-break: keep-all;
  }
  .report-closing-epilogue {
    margin-top: 1.75rem;
    padding-top: 1.1rem;
  }
  .report-closing-epilogue .epilogue-text {
    font-size: 0.92rem;
  }
  .report-footer-card {
    margin-top: 1.75rem;
    padding: 1.4rem 0.95rem;
  }
  .report-footer-card h4 {
    font-size: 1.02rem;
  }
  .report-footer-card p {
    font-size: 0.88rem;
    line-height: 1.65;
    margin-bottom: 1.15rem;
    word-break: keep-all;
  }
}

@media (max-width: 480px) {
  .saju-container {
    margin: 0.65rem auto;
    padding: 0 0.4rem 2.5rem 0.4rem;
  }
  .form-card,
  .elements-panel,
  .report-section {
    padding: 1rem 0.7rem;
    border-radius: 10px;
  }
  .report-toc-box {
    padding: 0.8rem 0.65rem;
  }
  .report-ul,
  .report-ol,
  .markdown-body ul,
  .markdown-body ol {
    margin-left: 1rem;
  }
}

/* Print Styles (Book-Grade PDF Export) */
@media print {
  @page {
    size: A4;
    margin: 14mm 14mm;
  }
  body {
    background: #fff !important;
    color: #111 !important;
  }
  #mobile-bottom-nav, .mobile-bottom-nav, .top-bar, header, footer, .footer, .saju-header, .form-card, .form-bottom-rows, .matrix-action-bar, .report-toolbar, .report-footer-card, .modal-overlay, .loading-overlay, .profile-btn-group, .autofill-btn, .saveprofile-btn, .report-toc-box, #sanctumGateOverlay, .hero-desc {
    display: none !important;
  }
  .saju-container {
    margin: 0 !important;
    padding: 0 !important;
    max-width: 100% !important;
    width: 100% !important;
  }
  .hero-banner {
    text-align: center !important;
    padding: 8px 0 12px 0 !important;
    margin-bottom: 18px !important;
    border-bottom: 2px solid #b45309 !important;
  }
  .hero-subtitle {
    font-size: 13pt !important;
    font-weight: 800 !important;
    letter-spacing: 1.5px !important;
    color: #0f172a !important;
    margin-bottom: 6px !important;
  }
  .hero-title {
    visibility: hidden !important;
    height: 22pt !important;
    margin: 0 !important;
    padding: 0 !important;
  }
  .matrix-section {
    display: block !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    page-break-after: always !important;
    break-after: page !important;
    margin-bottom: 0 !important;
  }
  .section-title {
    color: #0f172a !important;
    font-size: 14pt !important;
    margin-bottom: 14px !important;
  }
  .pillars-grid {
    display: grid !important;
    grid-template-columns: repeat(4, 1fr) !important;
    gap: 14px !important;
    margin-bottom: 22px !important;
  }
  .pillar-card, .meta-card, .daewoon-card, .tengod-domain-box, .tengod-bar-item {
    background: #ffffff !important;
    border: 1px solid #94a3b8 !important;
    color: #000 !important;
    box-shadow: none !important;
    break-inside: avoid;
  }
  .pillar-card {
    padding: 20px 10px !important;
    border-radius: 12px !important;
  }
  .pillar-header {
    font-size: 10pt !important;
    color: #1e293b !important;
    font-weight: 700 !important;
    margin-bottom: 12px !important;
  }
  .pillar-card.day-master-card, .daewoon-card.daewoon-current {
    border: 2px solid #b45309 !important;
  }
  .pillar-slot {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    padding: 18px 8px !important;
    margin-bottom: 12px !important;
  }
  .char-hanja {
    font-size: 32pt !important;
    line-height: 1.15 !important;
    margin-bottom: 4px !important;
    color: #0f172a !important;
  }
  .daewoon-ganzhi, .meta-card-value {
    color: #0f172a !important;
  }
  .char-ko, .meta-card-sub, .pillar-meta-row .meta-val, .meta-tag-pill {
    color: #334155 !important;
  }
  .pillar-meta-footer {
    margin-top: 10px !important;
    padding-top: 10px !important;
    border-top: 1px dashed #cbd5e1 !important;
    gap: 6px !important;
  }
  .elements-panel {
    background: #ffffff !important;
    border: 1px solid #94a3b8 !important;
    padding: 22px 18px !important;
    margin-bottom: 0 !important;
    break-inside: avoid;
  }
  .elements-grid {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 10px !important;
    margin-top: 12px !important;
  }
  .element-item {
    background: #f8fafc !important;
    border: 1px solid #cbd5e1 !important;
    padding: 14px 10px !important;
  }
  .element-item-header span {
    color: #0f172a !important;
  }
  .element-bar-bg {
    background: #e2e8f0 !important;
    height: 9px !important;
  }
  .elements-summary-badges {
    margin-top: 16px !important;
    padding-top: 14px !important;
    border-top: 1px solid #cbd5e1 !important;
  }
  .badge-dominant {
    color: #b91c1c !important;
    border-color: #fca5a5 !important;
    background: #fef2f2 !important;
  }
  .badge-deficient {
    color: #1d4ed8 !important;
    border-color: #93c5fd !important;
    background: #eff6ff !important;
  }
  .report-section {
    display: block !important;
    background: #fff !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    color: #000 !important;
  }
  .markdown-body, .report-p, .report-ul, .report-ol {
    color: #111 !important;
    font-size: 10.5pt !important;
    line-height: 1.65 !important;
  }
  .report-h1, .report-h2, .report-h3, .report-h4 {
    color: #111 !important;
    page-break-after: avoid;
    break-after: avoid;
  }
  .report-h2 {
    break-before: auto !important;
    page-break-before: auto !important;
    border-left: 4px solid #b45309 !important;
    margin-top: 2.2em !important;
    padding-top: 4px !important;
    margin-bottom: 12px !important;
  }
  .report-quote {
    background: #f8fafc !important;
    color: #1e293b !important;
    border-left: 4px solid #b45309 !important;
    break-inside: avoid;
  }
  .report-table {
    background: #fff !important;
    border: 1px solid #94a3b8 !important;
    break-inside: auto;
  }
  .report-table th {
    background: #f1f5f9 !important;
    color: #0f172a !important;
    border-bottom: 1px solid #94a3b8 !important;
  }
  .report-table td {
    color: #1e293b !important;
    border-bottom: 1px solid #cbd5e1 !important;
  }
  .report-closing-epilogue {
    display: block !important;
    page-break-inside: avoid !important;
    break-inside: avoid !important;
    margin-top: 2.2rem !important;
    padding-top: 1.2rem !important;
    border-top: 1px solid #cbd5e1 !important;
    text-align: center !important;
  }
  .report-closing-epilogue .epilogue-text {
    color: #1e293b !important;
    font-size: 10.5pt !important;
    line-height: 1.7 !important;
    margin: 0 auto 6px auto !important;
  }
  .report-closing-epilogue .epilogue-org {
    color: #0f172a !important;
    font-size: 10pt !important;
    font-weight: 800 !important;
    letter-spacing: 0.6px !important;
  }
}

/* Hide EON balance badge and legacy mobile bottom nav */
#mobile-bottom-nav,
.mobile-bottom-nav,
#rechargeBtn,
.recharge-btn,
#headerBalanceBadge,
.header-balance-badge {
  display: none !important;
}

