* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
:root {
  --bg: #0B1224;
  --card: #0F1A33;
  --text: #E9ECF5;
  --text-muted: #A8B4CC;
  --gold: #E8D7A4;
  --accent: #7EA7FF;
  --divider: rgba(255,255,255,.08);
  --shadow: 0 10px 30px rgba(0,0,0,.35);
}
body {
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  color: var(--text);
  background: radial-gradient(1200px 800px at 70% -10%, #1A2444 0%, var(--bg) 60%) fixed;
  position: relative;
  overflow-x: hidden;
}
.app::before {
  content:""; position:absolute; inset:0; pointer-events:none;
  background-image: radial-gradient(2px 2px at 20% 30%, rgba(255,255,255,0.15), transparent 40%),
                    radial-gradient(1.5px 1.5px at 70% 10%, rgba(255,255,255,0.12), transparent 40%),
                    radial-gradient(1.5px 1.5px at 40% 80%, rgba(255,255,255,0.10), transparent 40%);
  background-repeat: no-repeat; filter: blur(0.2px);
}
.app { position: relative; margin: 0 auto; max-width: 760px; min-height: 100vh; padding: 20px; }
.heading { font-family: 'Playfair Display', serif; font-weight: 600; margin: 0; font-size: clamp(28px, 4.2vw, 40px); letter-spacing: .2px; line-height: 1.15; }
.subheading { margin-top: 6px; color: var(--gold); font-size: 14px; letter-spacing: .6px; text-transform: uppercase; }
.app-header { display: flex; align-items: center; justify-content: space-between; }
.lang-toggle { display:flex; gap:8px; }
.chip { font: 600 13px/1.2 Inter, sans-serif; letter-spacing: .3px; padding: 10px 14px; border-radius: 999px; border: 1px solid rgba(232,215,164,.28); background: rgba(12,18,36,.5); color: var(--text); transition: transform .15s ease, background .2s ease; text-transform: uppercase; }
.chip:hover { transform: translateY(-1px); background: rgba(12,18,36,.7); }

.intro { text-align: center; margin: 16px 0 8px; }
.intro-text { color: var(--muted); }
.orb { width: 88px; height: 88px; margin: 12px auto; border-radius: 50%; position: relative; background: radial-gradient(circle at 30% 30%, #6C5CE7, #00C2FF); box-shadow: 0 0 40px rgba(108,92,231,0.4); animation: pulse 2.4s ease-in-out infinite; }
.orb.large { width: 144px; height: 144px; }
.orb-glow { position:absolute; inset:-12px; border-radius:50%; background: radial-gradient(circle at 50% 50%, rgba(108,92,231,0.25), transparent 70%); filter: blur(18px) saturate(.85); box-shadow: 0 0 120px rgba(126,167,255,.18), inset 0 0 40px rgba(232,215,164,.15); }
@keyframes pulse { 0%,100%{ transform: scale(0.98); } 50%{ transform: scale(1.04); } }

.form { background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.0)); border: 1px solid rgba(232,215,164,.22); border-radius: 18px; padding: 16px; box-shadow: var(--shadow); backdrop-filter: blur(6px); }
.label { display:block; margin-bottom:6px; color: var(--text); font-weight: 600; }
.input, .select { width: 100%; padding: 10px 12px; border-radius: 16px; border: 1px solid rgba(255,255,255,0.18); background: rgba(255,255,255,0.06); color: var(--text); outline: none; font-size: 16px; }
.input::placeholder{ color: rgba(230,235,255,0.5); }
.input:focus, .select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(0,194,255,0.25); }
.input.error, .select.error { border-color: #ff5b5b; }
.hint { display:block; min-height: 18px; color: #ffb3b3; }
.dob-row { display:flex; gap:8px; margin-top: 8px; }
.dob-col { flex:1; }

.button { appearance: none; border: none; border-radius: 16px; padding: 12px 16px; color: #fff; background: rgba(255,255,255,0.08); cursor: pointer; }
.button.primary { width:100%; margin-top: 10px; background: linear-gradient(90deg, #6C5CE7 0%, #00C2FF 100%); box-shadow: 0 8px 24px rgba(0,194,255,0.25); }
.button[disabled] { opacity: 0.6; cursor: not-allowed; }
.footer-note { text-align: center; color: var(--muted); opacity: 0.6; font-size: 12px; margin-top: 8px; }

/* Loading quote styling: modern with a hint of mystique */
.loading-quote {
  text-align: center;
  color: var(--text);
  opacity: 0.85;
  font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  font-style: normal;
  font-weight: 500;
  letter-spacing: 0.2px;
  line-height: 1.4;
  margin-top: 6px;
}

.loading { display:flex; align-items:center; justify-content:center; min-height: 180px; flex-direction: column; gap: 8px; }
.hidden { display: none; }

.result-view { margin-top: 12px; }
.image-card { background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.0)); border: 1px solid rgba(232,215,164,.22); border-radius: 24px; padding: 8px; overflow:hidden; box-shadow: var(--shadow); }
.image-card img { width: 100%; height: auto; aspect-ratio: 9 / 16; object-fit: cover; border-radius: 16px; display:block; }
.chips-row { display:flex; gap:8px; flex-wrap:wrap; margin:12px 0 8px; }
.chip-btn { padding:8px 12px; border-radius:999px; background:#1b2550; color:#e6ebff; border:1px solid #2a3570; cursor:pointer; }
.detail-panel { position:fixed; inset:0; background:rgba(0,0,0,.5); display:flex; align-items:flex-end; }
.detail-panel.hidden { display:none; }
.detail-card { width:100%; max-height:80vh; overflow:auto; background:#0f1738; color:#e6ebff; border-radius:20px 20px 0 0; padding:16px 20px 28px; border:1px solid #283061; position:relative; box-shadow: 0 -12px 24px rgba(0, 0, 0, 0.4); }
.detail-card .close { position:absolute; top:10px; right:12px; background:transparent; color:#9fb4ff; border:none; font-size:20px; }
.kv { margin:14px 0; }
.k { font-weight:600; color:#a8b6ff; margin-bottom:4px; }
.v { line-height:1.6; }
.info { background: linear-gradient(180deg, rgba(255,255,255,.02), rgba(255,255,255,.0)); border: 1px solid rgba(232,215,164,.22); border-radius: 16px; padding: 20px; box-shadow: var(--shadow); }
.section-title { font-family: 'Playfair Display', serif; font-weight: 600; font-size: clamp(18px, 2.2vw, 22px); margin: 24px 0 8px; letter-spacing: .2px; }
.section-text { font-family: Inter, system-ui, sans-serif; font-size: 16px; line-height: 1.7; color: var(--text); opacity: .92; }
#text-personal-year-advice { white-space: pre-line; }
.section-list li { margin: 8px 0; color: var(--text); opacity: .9; }
.actions { display:flex; flex-direction: column; align-items: center; gap:8px; justify-content:center; margin-top: 10px; }
.try-again { display:block; text-align:center; margin-top: 8px; color: var(--accent); text-decoration: none; }

/* Share modal */
.modal { position: fixed; inset: 0; background: rgba(0,0,0,0.88); display: none; align-items: center; justify-content: center; z-index: 1200; backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }
.modal:not(.hidden) { display:flex; }
.modal-card { background: #0f1738; border: 1px solid rgba(255,255,255,0.18); border-radius: 16px; padding: 12px; width: calc(100% - 32px); max-width: 360px; color: #E6EBFF; }
.modal-title { margin: 4px 0 8px; }
.modal-actions { display:flex; flex-direction: column; gap:8px; }
.hint#auth-switch { color: #ffffff; }
#auth-switch a { color: #ffffff; }
.modal-footer { display:flex; justify-content: flex-end; margin-top: 10px; }

/* Visit count hint spacing and style */
 

/* Increase spacing above Birthday label to avoid crowding with language selector */
#label-birthday.label {
  margin-top: 16px;
  display: block;
}

/* Strengthen overlay to reduce background bleed-through */
.detail-panel {
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  z-index: 999;
}

/* Improve contrast and separation for the bottom sheet card */
.detail-card {
  background: #0f1738; /* keep opaque for readability */
  box-shadow: 0 -12px 24px rgba(0, 0, 0, 0.4);
}

/* Optional: center footer notes in loading */
.loading .footer-note {
  text-align: center;
}

/* Spiritual Chat UI Theme */
.chat-box { background: rgba(14, 11, 31, 0.75); border: 1px solid rgba(198,160,255,0.25); border-radius: 20px; padding: 14px; margin-top: 28px; box-shadow: 0 0 12px rgba(198,160,255,0.4); position: relative; overflow: hidden; }
.chat-box::before,
.chat-box::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.chat-box::before {
  background: radial-gradient(1px 1px at 10% 30%, rgba(255,255,255,0.18), transparent 40%),
              radial-gradient(1px 1px at 80% 20%, rgba(255,255,255,0.14), transparent 40%),
              radial-gradient(1px 1px at 40% 70%, rgba(255,255,255,0.12), transparent 40%);
  filter: blur(0.2px);
}
.chat-box::after {
  background: radial-gradient(16px 16px at 20% 80%, rgba(198,160,255,0.12), transparent 50%),
              radial-gradient(12px 12px at 75% 30%, rgba(255,220,168,0.12), transparent 50%);
  animation: firefly 10s linear infinite;
}
@keyframes firefly {
  0% { transform: translateY(0px); opacity: 0.6; }
  50% { transform: translateY(-6px); opacity: 0.4; }
  100% { transform: translateY(0px); opacity: 0.6; }
}

/* Chat message bubbles per spec */
.chat-hero-title { font-family: 'Playfair Display', serif; font-size: 18px; }
.chat-msg.assistant .bubble { background: linear-gradient(180deg, rgba(232,215,164,.06), rgba(232,215,164,.02)); border: 1px solid rgba(232,215,164,.22); border-radius: 14px; padding: 12px 14px; }
.chat-msg.user .bubble { background: rgba(255,255,255,.03); border: 1px solid var(--divider); border-radius: 14px; padding: 12px 14px; }

/* Golden frame utility */
.golden-frame { border: 1px solid rgba(232,215,164,.28); border-radius: 16px; }

/* Download button refined */
.download-btn { font-weight: 600; letter-spacing: .3px; color: #0B1224; background: linear-gradient(135deg, #E8D7A4 0%, #F3EBDD 100%); border: 0; border-radius: 14px; padding: 12px 18px; box-shadow: 0 10px 20px rgba(232,215,164,.15); }
.download-note { color: var(--text-muted); font-size: 13px; margin-bottom: 8px; }

.chat-hero { display:flex; align-items:center; gap:12px; }
.coach-avatar { width:48px; height:48px; border-radius:50%; position:relative; flex:0 0 auto; }
.galaxy-orb { width:100%; height:100%; border-radius:50%; background: conic-gradient(from 0deg, #C6A0FF, #6C5CE7, #00C2FF, #FFDCA8, #C6A0FF); filter: blur(0.2px); animation: orbspin 12s linear infinite; box-shadow: 0 0 24px rgba(198,160,255,0.35); }
@keyframes orbspin { to { transform: rotate(360deg); } }
.hero-text { display:flex; flex-direction:column; }
.chat-hero-title { font-family: 'Cormorant Garamond', serif; font-weight: 700; margin:0; color:#C6A0FF; letter-spacing: 0.2px; }
.chat-subtitle { margin:2px 0 0; color:#FFDCA8; opacity:0.9; font-size: 13px; }

/* Topic chips */
.chips-row { display:flex; gap:8px; flex-wrap:wrap; margin: 10px 0 8px; }
.topic-chip { padding:8px 12px; border-radius:999px; border:1px solid rgba(198,160,255,0.35); background: rgba(255,255,255,0.06); color:#E6EBFF; cursor:pointer; transition: 200ms ease; box-shadow: 0 0 10px rgba(198,160,255,0.25); }
.topic-chip:hover { filter: drop-shadow(0 0 6px rgba(198,160,255,0.5)); transform: translateY(-1px); }
.topic-chip .icon { margin-right:6px; }
/* Category accents */
.topic-chip.career { border-color: rgba(87, 227, 194, 0.5); background: linear-gradient(90deg, rgba(87,227,194,0.12), rgba(14,11,31,0.15)); }
.topic-chip.thirty { border-color: rgba(102, 220, 140, 0.5); background: linear-gradient(90deg, rgba(102,220,140,0.12), rgba(14,11,31,0.15)); }
.topic-chip.missing { border-color: rgba(198,160,255,0.6); background: linear-gradient(90deg, rgba(198,160,255,0.16), rgba(14,11,31,0.15)); }
.topic-chip.pyear { border-color: rgba(255,220,168,0.6); background: linear-gradient(90deg, rgba(255,220,168,0.16), rgba(14,11,31,0.15)); }
.topic-chip.love { border-color: rgba(255,180,200,0.6); background: linear-gradient(90deg, rgba(255,180,200,0.16), rgba(14,11,31,0.15)); }

/* Chat messages */
.chat-messages { background: rgba(255,255,255,0.05); border: 1px solid rgba(198,160,255,0.25); border-radius: 14px; padding: 10px; min-height: 160px; max-height: 640px; overflow-y: auto; scroll-behavior: smooth; }
.chat-msg { display:flex; margin: 8px 0; }
.chat-msg.user { justify-content: flex-end; }
.chat-msg.assistant { justify-content: flex-start; }
.bubble { max-width: 82%; padding: 10px 12px; border-radius: 14px; position: relative; }
.chat-msg.user .bubble { background: linear-gradient(90deg, #C6A0FF 0%, #00C2FF 100%); color: #fff; box-shadow: 0 6px 16px rgba(0,194,255,0.25); border: 1px solid rgba(255,255,255,0.18); }
.chat-msg.assistant .bubble { background: rgba(255,255,255,0.06); border: 1px solid rgba(198,160,255,0.35); color:#E6EBFF; box-shadow: 0 0 12px rgba(198,160,255,0.25); }
.bubble-icon { position:absolute; left:8px; top:-10px; font-size: 14px; opacity: 0.9; }

/* Input bar */
.chat-input-row { display:flex; gap:8px; align-items:center; margin-top: 10px; background: rgba(255,255,255,0.06); border: 1px solid rgba(198,160,255,0.25); border-radius: 16px; padding: 8px; }
.chat-input-row .input { flex:1; border-radius: 12px; background: rgba(255,255,255,0.08); }
.icon-btn { appearance:none; border:none; background: transparent; color: #FFDCA8; cursor: pointer; font-size: 18px; padding: 8px; }
.button.magic { background: linear-gradient(90deg, #6C5CE7 0%, #C6A0FF 50%, #FFDCA8 100%); box-shadow: 0 0 18px rgba(198,160,255,0.45); }
.button.magic:hover { filter: drop-shadow(0 0 8px rgba(198,160,255,0.6)); }

/* Cosmic Glow Download */
.download-note { text-align: center; color: #9fb4ff; margin-bottom: 8px; font-size: 13px; opacity: 0.85; }
.download-btn { position: relative; display:inline-flex; align-items:center; gap:8px; background: linear-gradient(45deg, #a78bfa, #60a5fa, #fcd34d); color: #fff; font-weight: 600; border-radius: 9999px; padding: 14px 36px; box-shadow: 0 0 20px rgba(167,139,250,0.4); transition: all 0.3s ease; }
.download-btn::before { content:""; position:absolute; inset:-4px; border-radius: inherit; background: radial-gradient(circle at 50% 50%, rgba(255,255,255,0.14), rgba(255,255,255,0) 60%); filter: blur(6px); opacity: 0.6; pointer-events:none; }
.download-btn:hover { box-shadow: 0 0 40px rgba(255,255,255,0.6); transform: scale(1.05); }
.dl-icon { display:inline-block; will-change: transform; }
.download-btn:hover .dl-icon { animation: star-wiggle 0.9s ease-in-out infinite; }
@keyframes star-wiggle { 0% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-1px) rotate(-8deg); } 100% { transform: translateY(0) rotate(0deg); } }

/* Titles use Cormorant */
.section-title, .chat-hero-title { font-family: 'Cormorant Garamond', serif; }
