/* ===== MBTI SITE - COMMON STYLES ===== */

*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
  /* Default: Warm Light — professional, friendly, clinic-inspired */
  --bg: #fafaf8;
  --bg2: #f3f1ee;
  --bg3: #e8e5e0;
  --text: #2d2d2d;
  --dim: #5a5a6e;
  --muted: #9898a8;
  --accent: #6c63ff;
  --accent2: #8b7ffc;
  --glow: rgba(108,99,255,0.12);
  --card-bg: #ffffff;
  --card-border: rgba(0,0,0,0.08);
  --card-shadow: 0 2px 12px rgba(0,0,0,0.06);
  --nav-bg: rgba(250,250,248,0.95);

  /* MBTI dimension colors */
  --color-e: #e8920a;
  --color-i: #5b5bd6;
  --color-s: #0d9668;
  --color-n: #7c4dff;
  --color-t: #2e6fd9;
  --color-f: #d94690;
  --color-j: #0f9e94;
  --color-p: #e06510;

  /* Functional */
  --success: #22c55e;
  --warning: #eab308;
  --error: #ef4444;

  /* Typography */
  --font-sans: 'Inter', 'Noto Sans TC', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --font-display: 'Inter', 'Noto Sans TC', system-ui, sans-serif;
}

html.dark {
  --bg: #0b0b1a;
  --bg2: #111128;
  --bg3: #181835;
  --text: #eeedf5;
  --dim: #9898b8;
  --muted: #606080;
  --accent: #7c5cfc;
  --accent2: #a78bfa;
  --glow: rgba(124,92,252,0.25);
  --card-bg: rgba(255,255,255,0.06);
  --card-border: rgba(255,255,255,0.12);
  --card-shadow: 0 2px 12px rgba(0,0,0,0.3);
  --nav-bg: rgba(11,11,26,0.92);
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  padding-bottom: 4rem;
  line-height: 1.6;
}

a { text-decoration: none; color: inherit; }

img { max-width: 100%; height: auto; }

/* ===== CARD ===== */
.glass-card {
  background: var(--card-bg);
  border: 1px solid var(--card-border);
  border-radius: 20px;
  box-shadow: var(--card-shadow);
  padding: 1.5rem;
}

.glass-card-glow {
  background: var(--card-bg);
  border: 1px solid rgba(108,99,255,0.15);
  border-radius: 20px;
  box-shadow: var(--card-shadow), 0 0 30px rgba(108,99,255,0.06);
  padding: 1.5rem;
}
html.dark .glass-card,
html.dark .glass-card-glow {
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}

/* ===== BUTTONS ===== */
.btn-primary,
a.btn-primary,
a.btn-primary:visited,
a.btn-primary:hover {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.9rem 2rem;
  font-family: var(--font-sans);
  font-size: 1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  border: none;
  border-radius: 14px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 20px rgba(124,92,252,0.3);
  min-height: 48px;
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 30px rgba(124,92,252,0.45);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  font-family: var(--font-sans);
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--accent2);
  background: transparent;
  border: 1.5px solid var(--card-border);
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.2s;
  min-height: 44px;
}
.btn-secondary:hover {
  border-color: var(--accent);
  background: var(--glow);
}

.btn-ghost {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.6rem 1.2rem;
  font-family: var(--font-sans);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--dim);
  background: transparent;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
  min-height: 44px;
}
.btn-ghost:hover {
  color: var(--accent2);
  background: var(--card-bg);
}

/* ===== TYPOGRAPHY ===== */
.text-xs { font-size: 0.72rem; }
.text-sm { font-size: 0.85rem; }
.text-base { font-size: 1rem; }
.text-lg { font-size: 1.15rem; }
.text-xl { font-size: 1.4rem; }
.text-2xl { font-size: 1.8rem; }
.text-3xl { font-size: 2.4rem; }

/* ===== SECTIONS ===== */
.sec {
  max-width: 680px;
  margin: 0 auto;
  padding: 0 1.25rem;
}

/* ===== BOTTOM TAB BAR ===== */
.bottom-tab-bar {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 200;
  display: flex; justify-content: space-around; align-items: center;
  background: var(--nav-bg); backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  border-top: 1px solid var(--card-border);
  padding: 0.5rem 0 calc(0.5rem + env(safe-area-inset-bottom));
}
.bottom-tab-bar a {
  display: flex; flex-direction: column; align-items: center;
  font-size: 0.72rem; font-weight: 700; color: var(--dim);
  text-decoration: none; gap: 2px;
  transition: color 0.2s;
  min-width: 44px; min-height: 44px; justify-content: flex-end;
  padding: 6px 4px 2px;
}
.bottom-tab-bar a svg {
  width: 24px; height: 24px; stroke: currentColor; fill: none;
  stroke-width: 2; stroke-linecap: round; stroke-linejoin: round;
}
.bottom-tab-bar a.active { color: var(--accent2); }

/* ===== NAV ===== */
nav {
  position: sticky; top: 0; z-index: 100;
  padding: 0.75rem 1.25rem;
  display: flex; justify-content: space-between; align-items: center;
  background: var(--nav-bg);
  backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--card-border);
}
.nav-logo {
  display: flex; align-items: center; gap: 0.45rem;
  text-decoration: none; color: var(--text);
}
.nav-logo-img {
  width: 28px; height: 28px;
  object-fit: contain;
}
html.dark .nav-logo-img { filter: brightness(1.6); }
.nav-logo-text {
  font-weight: 800; font-size: 0.92rem;
  color: var(--text);
  letter-spacing: -0.02em;
  white-space: nowrap;
}
@media (max-width: 480px) {
  .nav-logo-img { width: 22px; height: 22px; }
  .nav-logo-text { font-size: 0.72rem; }
  .nav-logo { gap: 0.3rem; }
}
.nav-tools { display: flex; gap: 0.4rem; align-items: center; }

/* Language toggle */
.lang-btn {
  background: rgba(0,0,0,0.04);
  border: 1.5px solid var(--card-border);
  color: var(--dim);
  width: 38px; height: 38px; min-width: 38px; min-height: 38px;
  border-radius: 8px; cursor: pointer;
  font-size: 0.75rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
html.dark .lang-btn { background: rgba(255,255,255,0.08); }
.lang-btn:hover { border-color: var(--accent); color: var(--accent2); }

/* Theme toggle */
.theme-btn {
  background: rgba(0,0,0,0.04);
  border: 1.5px solid var(--card-border);
  color: var(--dim);
  width: 38px; height: 38px; min-width: 38px; min-height: 38px;
  border-radius: 8px; cursor: pointer;
  font-size: 1.1rem;
  display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
html.dark .theme-btn { background: rgba(255,255,255,0.08); }
.theme-btn:hover { border-color: var(--accent); color: var(--accent2); }

/* Hamburger */
.hamburger-btn {
  background: none; border: none; cursor: pointer; padding: 0.5rem;
  display: flex; flex-direction: column; gap: 6px;
}
.hamburger-btn span {
  display: block; width: 26px; height: 2.5px; background: var(--text);
  border-radius: 2px; transition: all 0.3s;
}
.hamburger-btn:hover span { background: var(--accent2); }
.hamburger-btn.open span:nth-child(1) { transform: translateY(8.5px) rotate(45deg); }
.hamburger-btn.open span:nth-child(2) { opacity: 0; }
.hamburger-btn.open span:nth-child(3) { transform: translateY(-8.5px) rotate(-45deg); }

/* Nav menu */
.nav-menu {
  position: fixed; top: 0; right: -280px; width: 280px; height: 100dvh;
  background: var(--bg2); z-index: 300;
  transition: right 0.3s ease;
  padding: 5rem 1.5rem 2rem;
  overflow-y: auto;
  border-left: 1px solid var(--card-border);
}
.nav-menu.open { right: 0; }
.nav-menu-overlay {
  position: fixed; top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5); z-index: 250;
  opacity: 0; pointer-events: none; transition: opacity 0.3s;
}
.nav-menu-overlay.open { opacity: 1; pointer-events: auto; }
.nav-menu a {
  display: block; padding: 0.9rem 0; font-size: 1rem; font-weight: 700;
  color: var(--text); border-bottom: 1px solid var(--card-border);
  transition: color 0.2s;
}
.nav-menu a:hover { color: var(--accent2); }

/* Desktop nav */
.nav-desktop-links { display: none; }
@media (min-width: 768px) {
  .hamburger-btn { display: none !important; }
  .nav-desktop-links {
    display: flex; align-items: center; gap: 0.25rem;
    flex: 1; justify-content: flex-end; margin-right: 0.5rem;
  }
  .nav-desktop-links a {
    font-size: 0.82rem; font-weight: 700; color: var(--dim);
    padding: 0.35rem 0.55rem; border-radius: 6px;
    white-space: nowrap; transition: color 0.2s, background 0.2s;
  }
  .nav-desktop-links a:hover {
    color: var(--accent2); background: var(--card-bg);
  }
  .bottom-tab-bar {
    max-width: 500px;
    left: 50%; right: auto;
    transform: translateX(-50%);
    border-radius: 1rem 1rem 0 0;
  }
  .sec { max-width: 780px; }
}

/* ===== AD SLOTS ===== */
.ad-slot { display: none !important; }
.ad-slot.ad-loaded {
  display: block !important;
  max-width: 600px; margin: 1.5rem auto; padding: 0;
  text-align: center;
}

/* ===== PROGRESS BAR ===== */
.progress-bar {
  position: fixed; top: 0; left: 0; right: 0; z-index: 150;
  height: 3px; background: var(--bg3);
}
.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent2));
  transition: width 0.4s ease;
  border-radius: 0 2px 2px 0;
}

/* ===== DIMENSION BAR ===== */
.dimension-bar {
  display: flex; align-items: center; gap: 0.75rem;
  margin: 0.6rem 0;
}
.dimension-bar-label {
  font-size: 0.85rem; font-weight: 700;
  min-width: 28px; text-align: center;
}
.dimension-bar-track {
  flex: 1; height: 8px; border-radius: 4px;
  background: var(--bg3); overflow: hidden;
  position: relative;
}
.dimension-bar-fill {
  height: 100%; border-radius: 4px;
  transition: width 1s ease;
}
.dimension-bar-pct {
  font-size: 0.78rem; font-weight: 600; color: var(--dim);
  min-width: 36px; text-align: right;
}

/* ===== TYPE BADGE ===== */
.type-badge {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0.25rem 0.75rem;
  font-size: 0.78rem; font-weight: 800;
  letter-spacing: 0.1em;
  border-radius: 8px;
  background: var(--glow);
  color: var(--accent2);
  border: 1px solid rgba(124,92,252,0.3);
}

/* ===== SOUL MESSAGE CARD (BUY system) ===== */
.soul-card {
  background: linear-gradient(135deg, rgba(108,99,255,0.06), rgba(139,127,252,0.03));
  border: 1px solid rgba(108,99,255,0.12);
  border-radius: 20px;
  box-shadow: 0 2px 16px rgba(108,99,255,0.06);
  padding: 1.5rem;
  position: relative;
  overflow: hidden;
}
html.dark .soul-card {
  background: linear-gradient(135deg, rgba(124,92,252,0.08), rgba(167,139,250,0.04));
  border-color: rgba(124,92,252,0.15);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
}
.soul-card::before {
  content: '';
  position: absolute; top: -50%; left: -50%;
  width: 200%; height: 200%;
  background: radial-gradient(circle at 30% 30%, rgba(108,99,255,0.04) 0%, transparent 60%);
  pointer-events: none;
}
.soul-card-label {
  font-size: 0.72rem; font-weight: 700;
  color: var(--accent2); letter-spacing: 0.15em;
  margin-bottom: 0.75rem;
  text-transform: uppercase;
}
.soul-card-text {
  font-size: 1rem; line-height: 1.75;
  color: var(--text); position: relative;
}
.soul-card-tip {
  margin-top: 1rem; padding-top: 1rem;
  border-top: 1px solid rgba(124,92,252,0.1);
  font-size: 0.9rem; color: var(--dim); line-height: 1.7;
}

/* ===== COOKIE CONSENT ===== */
.cookie-banner {
  position: fixed; bottom: 5rem; left: 1rem; right: 1rem;
  max-width: 480px; margin: 0 auto; z-index: 300;
  background: var(--bg2); border: 1px solid var(--card-border);
  border-radius: 16px; padding: 1.25rem;
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
  display: none;
  box-shadow: 0 8px 40px rgba(0,0,0,0.12);
}
.cookie-banner.show { display: block; }
.cookie-banner p {
  font-size: 0.82rem; color: var(--dim); line-height: 1.6;
  margin-bottom: 1rem;
}
.cookie-banner a { color: var(--accent2); text-decoration: underline; }
.cookie-actions { display: flex; gap: 0.5rem; }
.cookie-actions button { flex: 1; }

/* ===== DISCLAIMER ===== */
.disclaimer {
  max-width: 680px; margin: 3rem auto 1rem;
  padding: 0 1.25rem;
  font-size: 0.72rem; color: var(--muted);
  line-height: 1.6; text-align: center;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(15px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeInUp {
  from { opacity: 0; transform: translateY(30px); }
  to { opacity: 1; transform: translateY(0); }
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}
@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.8); }
  to { opacity: 1; transform: scale(1); }
}
.anim-fade { animation: fadeIn 0.5s ease both; }
.anim-fade-up { animation: fadeInUp 0.6s ease both; }
.anim-scale { animation: scaleIn 0.4s ease both; }

/* Stagger delays */
.delay-1 { animation-delay: 0.1s; }
.delay-2 { animation-delay: 0.2s; }
.delay-3 { animation-delay: 0.3s; }
.delay-4 { animation-delay: 0.4s; }
.delay-5 { animation-delay: 0.5s; }

/* ===== FOOTER ===== */
.site-footer {
  max-width: 960px; margin: 3rem auto 0;
  padding: 2.5rem 1.25rem 1.5rem;
  border-top: 1px solid var(--card-border);
}
.site-footer-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 2rem;
  margin-bottom: 2rem;
  text-align: left;
}
@media (max-width: 600px) {
  .site-footer-grid { grid-template-columns: repeat(2, 1fr); gap: 1.5rem; }
}
.site-footer-grid h4 {
  font-size: 0.85rem; font-weight: 700;
  color: var(--text-primary, #1a1a2e);
  margin: 0 0 0.75rem; letter-spacing: 0.02em;
}
[data-theme="dark"] .site-footer-grid h4 { color: var(--text-primary, #e0e0e0); }
.site-footer-grid a {
  display: block;
  font-size: 0.8rem; color: var(--dim);
  padding: 0.2rem 0; transition: color 0.2s;
  text-decoration: none;
}
.site-footer-grid a:hover { color: var(--accent2); }
.site-footer-bottom {
  border-top: 1px solid var(--card-border);
  padding-top: 1.25rem;
  display: flex; flex-wrap: wrap; justify-content: space-between;
  align-items: center; gap: 1rem;
}
@media (max-width: 600px) {
  .site-footer-bottom { flex-direction: column; text-align: center; }
}
.site-footer-copy {
  font-size: 0.72rem; color: var(--muted); line-height: 1.6;
}
.site-footer-social {
  display: flex; gap: 0.75rem;
}
.site-footer-social a {
  display: flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--card-border); color: var(--dim);
  transition: background 0.2s, color 0.2s; text-decoration: none;
}
.site-footer-social a:hover {
  background: var(--accent2); color: #fff;
}
.site-footer-social svg { width: 16px; height: 16px; }
/* Legacy simple footer (for non-index pages) */
.site-footer-links {
  display: flex; flex-wrap: wrap; justify-content: center;
  gap: 0.5rem 1.5rem; margin-bottom: 1rem;
}
.site-footer-links a {
  font-size: 0.82rem; color: var(--dim); font-weight: 600;
  transition: color 0.2s;
}
.site-footer-links a:hover { color: var(--accent2); }

/* ===== RESPONSIVE ===== */
@media (max-width: 374px) {
  .text-3xl { font-size: 1.8rem; }
  .text-2xl { font-size: 1.4rem; }
}
