:root {
  --site-page-width: min(1240px, calc(100% - 64px));
  --site-title-size: clamp(42px, 4.7vw, 74px);
  --site-display-size: clamp(30px, 3vw, 48px);
  --site-copy-size: 16px;
  --site-nav-size: 12px;
  --site-header-height: 76px;
  --site-header-gutter: clamp(24px, 3.2vw, 58px);
  --site-header-grid: 220px minmax(0, 1fr) 220px;
}

*, *::before, *::after { box-sizing: border-box; }
html, body { max-width: 100%; overflow-x: clip; }
body { font-size: var(--site-copy-size); }

.header-inner, .site-header .header-inner, .page-shell, .main-shell, .library-shell,
.about-shell, .account-shell, .daily-shell, .face-shell, .tools-shell {
  width: var(--site-page-width);
  max-width: 1240px;
}

  .hero-title, .page-title, .library-title, .about-title, .account-title,
  .daily-title, .face-title, .tools-title {
  font-size: var(--site-title-size) !important;
  line-height: 0.98 !important;
  letter-spacing: 0 !important;
}

.primary-nav a, .nav a, .account-link, .language-switcher button {
  font-size: var(--site-nav-size) !important;
}

/* Shared navigation shell. These overrides intentionally supersede each
   legacy page's local header CSS so every page uses the same geometry. */
.site-header, .topbar {
  position: fixed !important;
  inset: 0 0 auto !important;
  z-index: 100 !important;
  width: 100% !important;
  height: var(--site-header-height) !important;
  min-height: var(--site-header-height) !important;
  display: grid !important;
  grid-template-columns: var(--site-header-grid) !important;
  align-items: center !important;
  gap: 24px !important;
  margin: 0 !important;
  padding: 0 var(--site-header-gutter) !important;
  border-bottom: 1px solid rgba(200, 166, 75, 0.12) !important;
  background: linear-gradient(180deg, rgba(3, 5, 4, 0.9), rgba(3, 5, 4, 0.7)) !important;
  backdrop-filter: blur(12px) !important;
}

.site-header > .header-inner { display: contents !important; }

.site-header .brand, .site-header .brand-mark, .topbar .brand, .topbar .brand-mark {
  justify-self: start !important;
  display: inline-flex !important;
  align-items: center !important;
  gap: 11px !important;
  min-width: 0 !important;
  color: #c8a64b !important;
  text-decoration: none !important;
}

.site-header .brand-seal, .topbar .brand-seal {
  width: 36px !important;
  height: 36px !important;
  flex: 0 0 36px !important;
}

.site-header .brand-title, .topbar .brand-title {
  display: block !important;
  font-family: "Cinzel", "KaiTi", "STKaiti", serif !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.08 !important;
  letter-spacing: 1.6px !important;
  white-space: nowrap !important;
}

.site-header .brand-subtitle, .topbar .brand-subtitle {
  display: block !important;
  margin-top: 3px !important;
  color: rgba(200, 166, 75, 0.66) !important;
  font-family: "Cinzel", Georgia, serif !important;
  font-size: 8px !important;
  letter-spacing: 1.25px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

/* legal.html uses bare spans rather than the standard brand-title classes. */
.topbar .brand > span:first-child,
.site-header .brand > span:first-child:not(:has(span)) {
  color: #c8a64b !important;
  font-family: "Cinzel", "KaiTi", "STKaiti", serif !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  line-height: 1.08 !important;
  letter-spacing: 1.6px !important;
  white-space: nowrap !important;
}

.topbar .brand > span:last-child,
.site-header .brand > span:last-child:not(:has(span)) {
  color: rgba(200, 166, 75, 0.66) !important;
  font-family: "Cinzel", Georgia, serif !important;
  font-size: 8px !important;
  letter-spacing: 1.25px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

.primary-nav, .nav {
  justify-self: center !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: clamp(16px, 2.1vw, 36px) !important;
  margin: 0 !important;
  padding: 0 !important;
  white-space: nowrap !important;
}

.primary-nav a, .nav a {
  position: relative !important;
  display: inline-flex !important;
  align-items: center !important;
  min-height: var(--site-header-height) !important;
  margin: 0 !important;
  padding: 0 !important;
  color: rgba(238, 226, 190, 0.66) !important;
  font-family: "Cinzel", "KaiTi", "STKaiti", serif !important;
  font-size: var(--site-nav-size) !important;
  font-weight: 500 !important;
  letter-spacing: 1.25px !important;
  line-height: 1 !important;
  text-decoration: none !important;
}

.primary-nav a.active, .primary-nav a:hover, .nav a.active, .nav a:hover { color: #c8a64b !important; }

.primary-nav a.active::after, .nav a.active::after {
  left: 50% !important;
  right: auto !important;
  bottom: 9px !important;
  width: 22px !important;
  height: 2px !important;
  transform: translateX(-50%) !important;
}

.site-header .account-links, .topbar .account-links, .site-header .account-shell, .site-header .account-chip {
  justify-self: end !important;
  box-sizing: border-box !important;
  min-width: 0 !important;
}

.site-header .account-links, .topbar .account-links {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  width: 220px !important;
  gap: 0 !important;
}

.site-header .account-login, .topbar .account-login, .site-header .account-chip {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  width: 122px !important;
  min-width: 122px !important;
  min-height: 32px !important;
  padding: 8px 12px !important;
  font-family: "Cinzel", "KaiTi", "STKaiti", serif !important;
  font-size: 11px !important;
  letter-spacing: 1px !important;
  line-height: 1 !important;
  white-space: nowrap !important;
}

.site-header .account-icon, .topbar .account-icon {
  display: none !important;
}

/*
 * Every page reserves the same right-hand header slot.  The index and tools
 * pages used to expose their full account dashboard in the header, which
 * shifted the entry as authentication state changed.  The header now exposes
 * exactly one fixed-width route into the account center; account actions stay
 * on account.html.
 */
.site-header .account-shell {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  width: 220px !important;
  max-width: 220px !important;
  min-height: var(--site-header-height) !important;
}

.site-header .account-shell .account-row,
.site-header .account-shell .account-actions {
  display: flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  width: 100% !important;
  gap: 0 !important;
}

.site-header .account-shell .account-status,
.site-header .account-shell .account-form,
.site-header .account-shell .account-message,
.site-header .account-shell .report-history,
.site-header .account-shell #showRegister,
.site-header .account-shell #showHistory,
.site-header .account-shell #logoutButton,
.site-header .account-shell #deleteAccountButton {
  display: none !important;
}

.site-header .account-shell .account-button {
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  width: 122px !important;
  min-width: 122px !important;
  min-height: 32px !important;
  padding: 8px 12px !important;
  font-size: 11px !important;
  line-height: 1 !important;
  letter-spacing: 1px !important;
  white-space: nowrap !important;
}

.site-header .account-shell:not(.logged-in) #showLogin,
.site-header .account-shell.logged-in #accountCenter {
  display: inline-flex !important;
}

@media (max-width: 1080px) {
  :root { --site-header-grid: 170px minmax(0, 1fr) 170px; }
  .primary-nav, .nav { gap: 16px !important; }
  .primary-nav a, .nav a { letter-spacing: 0.85px !important; }
  .site-header .account-links, .topbar .account-links,
  .site-header .account-shell { width: 170px !important; max-width: 170px !important; }
}

@media (max-width: 760px) {
  :root {
    --site-page-width: min(100% - 32px, 640px);
    --site-title-size: clamp(38px, 13vw, 56px);
    --site-display-size: 30px;
    --site-copy-size: 15px;
    --site-nav-size: 11px;
    --site-header-height: 64px;
    --site-header-gutter: 16px;
    --site-header-grid: auto minmax(0, 1fr) auto;
  }

  .hero > div > h1, .page-hero h1, .library-hero h1 {
    font-size: clamp(38px, 11vw, 48px) !important;
    overflow-wrap: anywhere;
    word-break: normal;
  }

  .header-inner, .site-header .header-inner {
    width: var(--site-page-width) !important;
    min-width: 0 !important;
  }

  .primary-nav, .nav {
    min-width: 0 !important;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .primary-nav::-webkit-scrollbar, .nav::-webkit-scrollbar { display: none; }

  .site-header, .topbar { gap: 12px !important; }
  .site-header .brand-seal, .topbar .brand-seal { width: 29px !important; height: 29px !important; flex-basis: 29px !important; }
  .site-header .brand-title, .topbar .brand-title { font-size: 10px !important; }
  .site-header .brand-subtitle, .topbar .brand-subtitle { display: none !important; }
  .primary-nav, .nav { justify-content: flex-start !important; gap: 18px !important; overflow-x: auto !important; }
  .primary-nav a, .nav a { min-height: var(--site-header-height) !important; font-size: 10px !important; letter-spacing: 0.7px !important; }
  .site-header .account-login, .topbar .account-login, .site-header .account-chip, .site-header .account-shell { display: none !important; }
  .dashboard, .auth-layout, .library-grid, .daily-grid, .face-grid,
  .book-grid, .hero-layout, .about-grid, .account-shell {
    min-width: 0 !important;
    width: 100% !important;
  }

input, select, textarea, button { max-width: 100%; }
}

:focus-visible {
  outline: 2px solid #d4af37 !important;
  outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }

  video {
    display: none !important;
  }
}

/* Runtime-mounted header: one geometry, one language slot, one account slot. */
.site-header, .topbar {
  display: block !important;
  padding: 0 !important;
}

.site-header > .oracle-header-inner,
.topbar > .oracle-header-inner {
  display: grid !important;
  /* Equal outer tracks make the central navigation and the account slot invariant. */
  grid-template-columns: 220px minmax(0, 1fr) 220px !important;
  align-items: center !important;
  width: var(--site-page-width) !important;
  max-width: 1240px !important;
  height: var(--site-header-height) !important;
  min-height: var(--site-header-height) !important;
  margin: 0 auto !important;
  gap: 24px !important;
}

.site-header .oracle-header-inner .brand-mark,
.topbar .oracle-header-inner .brand-mark {
  justify-self: start !important;
  min-width: 0 !important;
}

.site-header .oracle-header-inner .primary-nav,
.topbar .oracle-header-inner .primary-nav {
  justify-self: center !important;
  min-width: 0 !important;
}

.site-header .oracle-header-inner .header-actions,
.topbar .oracle-header-inner .header-actions {
  justify-self: end !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: flex-end !important;
  width: 220px !important;
  min-width: 220px !important;
  gap: 12px !important;
}

.site-header .oracle-header-inner .language-switcher,
.topbar .oracle-header-inner .language-switcher {
  position: static !important;
  transform: none !important;
  width: 72px !important;
  min-width: 72px !important;
  height: 30px !important;
  margin: 0 !important;
  flex: 0 0 72px !important;
}

.site-header .oracle-header-inner .account-login,
.topbar .oracle-header-inner .account-login {
  width: 122px !important;
  min-width: 122px !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  border: 1px solid rgba(200, 166, 75, 0.36) !important;
  color: rgba(238, 220, 181, 0.92) !important;
  background: rgba(0, 0, 0, 0.2) !important;
  text-decoration: none !important;
  transition: border-color 180ms ease, box-shadow 180ms ease, color 180ms ease !important;
}

.site-header .oracle-header-inner .account-login:hover,
.topbar .oracle-header-inner .account-login:hover {
  border-color: rgba(200, 166, 75, 0.8) !important;
  color: #d4af37 !important;
  box-shadow: 0 0 20px rgba(200, 166, 75, 0.14) !important;
}

.site-header .oracle-header-inner .account-icon,
.topbar .oracle-header-inner .account-icon {
  display: none !important;
  text-decoration: none !important;
}

.site-header .legacy-account-shell,
.topbar .legacy-account-shell {
  display: none !important;
}

@media (max-width: 1080px) {
  .site-header > .oracle-header-inner,
  .topbar > .oracle-header-inner {
    grid-template-columns: 180px minmax(0, 1fr) 180px !important;
    gap: 16px !important;
  }

  .site-header .oracle-header-inner .header-actions,
  .topbar .oracle-header-inner .header-actions {
    width: 180px !important;
    min-width: 180px !important;
    gap: 8px !important;
  }
}

@media (max-width: 760px) {
  .site-header > .oracle-header-inner,
  .topbar > .oracle-header-inner {
    grid-template-columns: auto minmax(0, 1fr) auto !important;
    width: var(--site-page-width) !important;
    gap: 10px !important;
  }

  .site-header .oracle-header-inner .brand-mark,
  .topbar .oracle-header-inner .brand-mark {
    min-width: 34px !important;
  }

  .site-header .oracle-header-inner .brand-title,
  .topbar .oracle-header-inner .brand-title,
  .site-header .oracle-header-inner .brand-subtitle,
  .topbar .oracle-header-inner .brand-subtitle {
    display: none !important;
  }

  .site-header .oracle-header-inner .primary-nav,
  .topbar .oracle-header-inner .primary-nav {
    width: 100% !important;
    min-width: 0 !important;
    padding-right: 0 !important;
  }

  .site-header .oracle-header-inner .header-actions,
  .topbar .oracle-header-inner .header-actions {
    min-width: auto !important;
    gap: 6px !important;
  }

  .site-header .oracle-header-inner .language-switcher,
  .topbar .oracle-header-inner .language-switcher {
    width: 64px !important;
    min-width: 64px !important;
    flex-basis: 64px !important;
  }

  .site-header .oracle-header-inner .language-switcher button,
  .topbar .oracle-header-inner .language-switcher button {
    min-width: 28px !important;
    width: 28px !important;
  }

  .site-header .oracle-header-inner .account-login,
  .topbar .oracle-header-inner .account-login {
    display: none !important;
  }

  .site-header .oracle-header-inner .account-icon,
  .topbar .oracle-header-inner .account-icon {
    display: inline-grid !important;
    place-items: center !important;
    position: relative !important;
    width: 28px !important;
    height: 28px !important;
    border: 1px solid rgba(200, 166, 75, 0.48) !important;
    border-radius: 50% !important;
  }

  .site-header .oracle-header-inner .account-icon::before,
  .site-header .oracle-header-inner .account-icon::after,
  .topbar .oracle-header-inner .account-icon::before,
  .topbar .oracle-header-inner .account-icon::after {
    content: "" !important;
    position: absolute !important;
    border: 1px solid rgba(200, 166, 75, 0.7) !important;
    border-radius: 50% !important;
  }

  .site-header .oracle-header-inner .account-icon::before,
  .topbar .oracle-header-inner .account-icon::before {
    width: 7px !important;
    height: 7px !important;
    top: 6px !important;
  }

  .site-header .oracle-header-inner .account-icon::after,
  .topbar .oracle-header-inner .account-icon::after {
    width: 12px !important;
    height: 6px !important;
    bottom: 5px !important;
  }
}

/* Shared product footer: concise, real links only, and no payment placeholder. */
footer.site-footer[data-oracle-footer] {
  position: relative !important;
  z-index: 2 !important;
  display: block !important;
  width: var(--site-page-width) !important;
  max-width: 1240px !important;
  min-width: 0 !important;
  margin: clamp(48px, 6vw, 78px) auto 28px !important;
  padding: 30px 0 0 !important;
  border: 0 !important;
  border-top: 1px solid rgba(200, 166, 75, 0.22) !important;
  background: transparent !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
}

footer.site-footer[data-oracle-footer] .oracle-footer-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(150px, 0.74fr) minmax(190px, 0.96fr);
  align-items: start;
  gap: clamp(28px, 5vw, 80px);
}

footer.site-footer[data-oracle-footer] .oracle-footer-kicker,
footer.site-footer[data-oracle-footer] .oracle-footer-title {
  margin: 0 0 12px;
  color: #c8a64b;
  font-family: "Cinzel", "KaiTi", "STKaiti", serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.9px;
  line-height: 1.25;
  text-transform: uppercase;
}

footer.site-footer[data-oracle-footer] .oracle-footer-copy {
  max-width: 440px;
  margin: 0;
  color: rgba(238, 226, 190, 0.64);
  font-family: "Cormorant Garamond", "KaiTi", "STKaiti", serif;
  font-size: 15px;
  line-height: 1.68;
}

footer.site-footer[data-oracle-footer] .oracle-footer-about,
footer.site-footer[data-oracle-footer] .oracle-footer-links a {
  color: rgba(238, 226, 190, 0.66);
  font-family: "Cormorant Garamond", "KaiTi", "STKaiti", serif;
  font-size: 15px;
  line-height: 1.45;
  text-decoration: none;
  transition: color 160ms ease;
}

footer.site-footer[data-oracle-footer] .oracle-footer-about {
  display: inline-flex;
  margin-top: 16px;
  color: #c8a64b;
}

footer.site-footer[data-oracle-footer] .oracle-footer-links {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

footer.site-footer[data-oracle-footer] .oracle-footer-links li {
  position: relative;
  padding-left: 12px;
}

footer.site-footer[data-oracle-footer] .oracle-footer-links li::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0.63em;
  width: 4px;
  height: 4px;
  border: 1px solid rgba(200, 166, 75, 0.58);
  border-radius: 50%;
}

footer.site-footer[data-oracle-footer] .oracle-footer-about:hover,
footer.site-footer[data-oracle-footer] .oracle-footer-about:focus-visible,
footer.site-footer[data-oracle-footer] .oracle-footer-links a:hover,
footer.site-footer[data-oracle-footer] .oracle-footer-links a:focus-visible {
  color: #d4af37;
}

footer.site-footer[data-oracle-footer] .oracle-footer-bottom {
  margin: 28px 0 0;
  padding: 16px 0 0;
  border-top: 1px solid rgba(200, 166, 75, 0.1);
  color: rgba(238, 226, 190, 0.38);
  font-family: "Cinzel", "KaiTi", "STKaiti", serif;
  font-size: 10px;
  letter-spacing: 1px;
  line-height: 1.55;
}

@media (max-width: 760px) {
  footer.site-footer[data-oracle-footer] {
    width: var(--site-page-width) !important;
    margin-top: 48px !important;
    padding-top: 24px !important;
  }

  footer.site-footer[data-oracle-footer] .oracle-footer-grid {
    grid-template-columns: 1fr;
    gap: 28px;
  }

  footer.site-footer[data-oracle-footer] .oracle-footer-copy,
  footer.site-footer[data-oracle-footer] .oracle-footer-about,
  footer.site-footer[data-oracle-footer] .oracle-footer-links a {
    font-size: 15px;
  }
}
