/* ============================================
   🔮 reading.css — 解讀頁面樣式

   💡 這是整個網站最「功能性」的頁面。
   表單要好填，結果要好讀，
   但視覺上不能跟其他頁面脫節。
   ============================================ */

/* 🎯 【錨點偏移】讓 /#reading 跳轉時不被固定導航列擋住 */
#reading {
  scroll-margin-top: 5rem;
}

/* 📝 【頁面標題區】 */
.reading-header {
  padding: var(--space-xl) 0 var(--space-lg);
  max-width: var(--content-width);
  margin: 0 auto;
}

.reading-header h1 {
  margin-bottom: var(--space-sm);
}

.reading-header p {
  font-family: var(--font-serif);
  font-style: italic;
  font-size: 1rem;
  color: var(--text-secondary);
}

/* 📋 【表單容器】
   💡 表單區塊不加外框或卡片效果，
   直接在頁面上展開，更自然 */
.reading-form {
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-lg) 0 var(--space-2xl);
}

/* 🔧 【表單欄位組】 */
.form-group {
  margin-bottom: var(--space-lg);
}

.form-group--inline {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--space-lg);
}

.form-group label {
  margin-bottom: var(--space-sm);
}

/* 💡 欄位下方的提示文字，幫助用戶理解要填什麼 */
.form-hint {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: var(--space-xs);
  margin-bottom: 0;
  line-height: 1.5;
}

/* 🏙️ 【快速選擇城市】
   💡 提供幾個常見城市作為快捷選項，
   點擊後自動填入城市名 */
.quick-cities {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-sm);
  margin-top: var(--space-sm);
}

.quick-city {
  font-family: var(--font-sans);
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  background: none;
  border: 1px solid rgba(201, 168, 76, 0.1);
  padding: 0.35em 0.8em;
  border-radius: 2px;
  cursor: pointer;
  transition: border-color 0.3s ease, color 0.3s ease;
}

.quick-city:hover {
  border-color: var(--gold-dim);
  color: var(--text-secondary);
}

/* ❓ 【問題輸入】 */
.reading-form textarea {
  min-height: 100px;
  resize: vertical;
  line-height: 1.7;
}

/* 🎯 【提交按鈕】 */
.submit-row {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-md);
  margin-top: var(--space-lg);
}

/* 💡 提交按鈕上方的提示文字 — 用 serif italic 保持和 hero subtitle 同風格 */
.submit-hint {
  font-family: var(--font-serif);
  font-style: italic;
  font-weight: 600;
  font-size: 1.1rem;
  color: var(--text-secondary);
  margin: 0;
}

/* ⏳ 【載入狀態】
   💡 用天體軌道動畫取代簡單脈搏點。
   三條不同速度的軌道 + 行星圓點，像一個微型星盤在自轉。
   配合文字輪播，讓 10-20 秒的等待不那麼難熬。 */
.loading-indicator {
  display: none;
  flex-direction: column;
  align-items: center;
  gap: var(--space-lg);
  margin-top: var(--space-xl);
}

.loading-indicator.active {
  display: flex;
}

/* 🪐 【軌道系統】三層同心軌道 + 中心亮點 */
.orbit-system {
  position: relative;
  width: 100px;
  height: 100px;
}

/* 🔧 軌道共用基底 — 虛線圓環 */
.orbit {
  position: absolute;
  border-radius: 50%;
  border: 1px solid rgba(201, 168, 76, 0.12);
}

/* 🪐 每條軌道的大小和旋轉速度不同，
   模仿行星公轉速度差異 — 內圈快、外圈慢 */
.orbit--1 {
  width: 40px; height: 40px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: spin 4s linear infinite;
}

.orbit--2 {
  width: 68px; height: 68px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: spin 7s linear infinite reverse;
}

.orbit--3 {
  width: 96px; height: 96px;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  animation: spin 11s linear infinite;
}

@keyframes spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 🌟 軌道上的行星小點 */
.orbit-dot {
  position: absolute;
  border-radius: 50%;
}

.orbit-dot--1 {
  width: 5px; height: 5px;
  background: var(--gold);
  box-shadow: 0 0 6px rgba(201, 168, 76, 0.6);
  top: -2.5px; left: 50%;
  transform: translateX(-50%);
}

.orbit-dot--2 {
  width: 4px; height: 4px;
  background: var(--text-secondary);
  box-shadow: 0 0 4px rgba(158, 154, 143, 0.4);
  top: -2px; left: 50%;
  transform: translateX(-50%);
}

.orbit-dot--3 {
  width: 3px; height: 3px;
  background: var(--gold-dim);
  box-shadow: 0 0 5px rgba(160, 134, 54, 0.5);
  top: -1.5px; left: 50%;
  transform: translateX(-50%);
}

/* ✨ 中心亮點 — 太陽，帶呼吸脈動 */
.orbit-center {
  position: absolute;
  width: 6px; height: 6px;
  background: var(--gold);
  border-radius: 50%;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 10px rgba(201, 168, 76, 0.5);
  animation: pulse-center 3s ease-in-out infinite;
}

@keyframes pulse-center {
  0%, 100% { box-shadow: 0 0 6px rgba(201, 168, 76, 0.3); }
  50% { box-shadow: 0 0 14px rgba(201, 168, 76, 0.7); }
}

/* 📝 文字輪播區 */
.loading-message {
  text-align: center;
}

.loading-text {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-style: italic;
  transition: opacity 0.3s ease;
}

/* 🛡️ 【錯誤提示】 */
.form-error {
  display: none;
  color: var(--error);
  font-size: 0.85rem;
  margin-top: var(--space-md);
  padding: var(--space-md);
  border: 1px solid rgba(212, 101, 74, 0.2);
  border-radius: 2px;
  background: rgba(212, 101, 74, 0.05);
}

.form-error.visible {
  display: block;
}

/* ============================================
   📊 結果區域
   ============================================ */

.reading-result {
  display: none;
  max-width: var(--content-width);
  margin: 0 auto;
  padding: var(--space-xl) 0 var(--space-2xl);
}

.reading-result.visible {
  display: block;
}

/* 📝 【用戶問題回顯】 */
.result-question {
  font-family: var(--font-serif);
  font-size: 1.2rem;
  font-style: italic;
  color: var(--text-secondary);
  margin-bottom: var(--space-xl);
  padding-bottom: var(--space-lg);
  border-bottom: 1px solid rgba(201, 168, 76, 0.08);
}

.result-question::before {
  content: '"';
  color: var(--gold-dim);
  opacity: 0.5;
}

.result-question::after {
  content: '"';
  color: var(--gold-dim);
  opacity: 0.5;
}

/* 🪐 【Dasha 信息卡】
   💡 用左邊線 + 微微亮的背景來區分，
   不用卡片陰影（那太 Material Design） */
.dasha-card {
  border-left: 2px solid var(--gold-dim);
  background: rgba(201, 168, 76, 0.03);
  padding: var(--space-lg);
  margin-bottom: var(--space-xl);
}

.dasha-card__title {
  font-size: 0.75rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gold-dim);
  margin-bottom: var(--space-md);
}

.dasha-item {
  margin-bottom: var(--space-md);
}

.dasha-item:last-child {
  margin-bottom: 0;
}

.dasha-item__label {
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: var(--space-xs);
}

.dasha-item__lord {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text-primary);
}

.dasha-item__period {
  font-size: 0.82rem;
  color: var(--text-secondary);
}

/* 📖 【解讀正文】 */
.result-reading {
  line-height: 1.9;
  font-size: 0.95rem;
}

/* 🔒 gate 啟動時，文字底部 200px 漸隱到透明
   💡 mask 只影響視覺渲染，不改高度、不改 overflow、不影響佈局
      搭配 gate card 的透明背景，body::before 的漸層自然穿透，零色差 */
.result-reading.gated {
  -webkit-mask-image: linear-gradient(to bottom, black calc(100% - 200px), transparent 100%);
  mask-image: linear-gradient(to bottom, black calc(100% - 200px), transparent 100%);
}

.result-reading p {
  margin-bottom: var(--space-md);
}

.result-reading h1,
.result-reading h2,
.result-reading h3 {
  margin-top: var(--space-xl);
  margin-bottom: var(--space-md);
}

.result-reading ul,
.result-reading ol {
  padding-left: var(--space-lg);
  margin-bottom: var(--space-md);
}

.result-reading li {
  margin-bottom: var(--space-sm);
  color: var(--text-secondary);
}

.result-reading strong {
  color: var(--text-primary);
  font-weight: 400;
}

/* ============================================
   🔒 【截斷遮罩】未登入用戶報告截斷 + 登入引導
   💡 JS 把 result-reading clip 到 1200px（overflow: hidden），
   遮罩緊跟其後，用 margin-top 負值往上疊 120px 漸變區域，
   讓文字「消失在漸變裡」。不用 absolute，不用 z-index。
   ============================================ */

.result-reading-wrap {
  position: relative;
}

/* 🔒 遮罩整體 — 預設隱藏 */
.reading-gate {
  display: none;
  margin-top: -200px;
  position: relative;
}

.reading-gate.active {
  display: block;
  animation: gate-slide-in 1.2s ease-out both;
}

@keyframes gate-slide-in {
  0% {
    opacity: 0;
    transform: translateY(40px);
  }
  40% {
    opacity: 1;
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 🎨 漸變區域 — 純間距，不再畫背景
   💡 文字漸隱改由 #resultReading.gated 的 mask-image 處理，
      這裡只保留 200px 高度作為 margin-top: -200px 的對應間距 */
.reading-gate__fade {
  height: 200px;
}

/* 🃏 登入卡片 — 半透明毛玻璃容器，在深色背景上浮起
   💡 用 border + backdrop-filter 營造容器感，背景仍保持半透明避免色差 */
.reading-gate__card {
  background: rgba(14, 14, 36, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(201, 168, 76, 0.12);
  border-radius: 8px;
  padding: 2.5rem 2.5rem 2rem;
  text-align: center;
  max-width: 500px;
  margin: 0 auto;
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.3);
}

/* ✨ 卡片頂部裝飾線 — 金色漸變，點睛之筆 */
.reading-gate__card::before {
  content: '';
  display: block;
  width: 48px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
  margin: 0 auto 1.75rem;
}

.reading-gate__title {
  font-family: var(--font-serif);
  font-size: 1.4rem;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
  line-height: 1.3;
}

.reading-gate__subtitle {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-bottom: 1.5rem;
  letter-spacing: 0.03em;
}

/* 📋 價值點列表 — 左對齊，長文字不適合居中排列
   💡 用 inline-block + text-align:left 讓列表塊整體居中但文字左對齊 */
.reading-gate__points {
  list-style: none;
  padding: 0;
  margin: 0 0 1.75rem;
  display: inline-block;
  text-align: left;
}

.reading-gate__points li {
  font-size: 0.82rem;
  color: var(--text-secondary);
  padding: 0.35rem 0;
  letter-spacing: 0.01em;
  line-height: 1.5;
}

.reading-gate__points li::before {
  content: '✦ ';
  color: var(--gold-dim);
}

.reading-gate__btn {
  max-width: 280px;
  margin: 0 auto;
  display: block;
}

.reading-gate__free {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0;
  letter-spacing: 0.03em;
}

/* ⚠️ 可重試錯誤 banner — LLM 繁忙 / 連線中斷時出現
   💡 視覺上和 gate card 同一個家族（毛玻璃 + 圓角），但用琥珀色調
      傳達「暫時問題，可重試」而不是紅色的「你搞砸了」 */
.stream-error {
  display: none;
  max-width: 500px;
  margin: var(--space-xl) auto;
  padding: 2rem 2rem 1.75rem;
  text-align: center;
  background: rgba(14, 14, 36, 0.55);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(212, 149, 90, 0.18);
  border-radius: 8px;
  box-shadow: 0 4px 40px rgba(0, 0, 0, 0.3);
}

.stream-error.visible {
  display: block;
  animation: gate-slide-in 0.6s ease-out both;
}

.stream-error__icon {
  display: block;
  color: #d4955a;
  font-size: 1.1rem;
  margin-bottom: var(--space-sm);
}

.stream-error__title {
  font-family: var(--font-serif);
  font-size: 1.15rem;
  color: var(--text-primary);
  margin-bottom: 0.4rem;
  letter-spacing: 0.02em;
}

.stream-error__msg {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 1.5rem;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

.stream-error__btn {
  max-width: 200px;
  margin: 0 auto;
  display: block;
}

/* 📋 Copy 按鈕的登入提示 — 點 Copy 後滑出 */
.copy-signin-hint {
  font-size: 0.82rem;
  color: var(--gold-dim);
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s ease, opacity 0.3s ease;
  display: block;
  width: 100%;
}

.copy-signin-hint.visible {
  max-height: 2em;
  opacity: 1;
}

/* 📋 Copy 按鈕 — SSE 跑完前隱藏 */
.btn--hidden {
  display: none !important;
}

/* 🔄 【操作按鈕區】 */
.result-actions {
  margin-top: var(--space-2xl);
  padding-top: var(--space-xl);
  border-top: 1px solid rgba(201, 168, 76, 0.08);
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
}

/* ============================================
   🔲 【彈窗】登入提示 / 付費提示
   💡 半透明遮罩 + 居中卡片，和深色主題一致
   ============================================ */

.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(0, 0, 0, 0.7);
  justify-content: center;
  align-items: center;
}

.modal-overlay.visible {
  display: flex;
}

.modal-card {
  background: var(--bg-surface);
  border: 1px solid rgba(201, 168, 76, 0.15);
  border-radius: 8px;
  padding: 2.5rem 2rem 1.5rem;
  max-width: 420px;
  width: 90%;
  text-align: center;
}

/* 💰 付費彈窗 — 兩區結構：pitch（說服）→ action（行動+信任）
   💡 豪華感來自留白和層次，不是塞滿東西 */
.modal-card--payment {
  max-width: 500px;
  padding: 0;
  background: rgba(14, 14, 36, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid rgba(201, 168, 76, 0.1);
  box-shadow:
    0 8px 60px rgba(0, 0, 0, 0.5),
    0 0 0 1px rgba(201, 168, 76, 0.06);
  overflow: hidden;
  position: relative;
}

/* 🏷️ 首購折扣角標 — 右上角微傾斜，像臨時貼上的精緻標籤 */
.modal-card__ribbon {
  display: none;
  position: absolute;
  top: 18px;
  right: 12px;
  background: linear-gradient(135deg, var(--gold), var(--gold-dim));
  color: #1a1a2e;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  padding: 0.3em 1em 0.3em 0.8em;
  transform: rotate(12deg);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 1;
  border-radius: 2px;
}

.modal-card__ribbon.visible {
  display: block;
}

/* 💰 劃線原價 — 比現價淡，劃掉表示已失效 */
.modal-card__price-old {
  text-decoration: line-through;
  opacity: 0.5;
  margin-right: 0.3em;
  font-size: 0.9em;
}

/* 🎯 Pitch 區 — 標題+長文案，頂部金色裝飾線開場 */
.modal-card__pitch {
  padding: 2.5rem 2.5rem 2rem;
}

.modal-card__pitch::before {
  content: '';
  display: block;
  width: 40px;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--gold-dim), transparent);
  margin: 0 auto 1.75rem;
}

/* 📐 Action 區 — 按鈕+信任信息，金色細線分隔 pitch 和 action */
.modal-card__action {
  padding: 1.75rem 2.5rem 2rem;
  border-top: 1px solid rgba(201, 168, 76, 0.08);
}

.modal-card__title {
  font-family: var(--font-serif);
  font-size: 1.6rem;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  line-height: 1.35;
  letter-spacing: 0.01em;
}

.modal-card__desc {
  font-size: 0.9rem;
  color: var(--text-secondary);
  line-height: 1.85;
  margin: 0;
}

.modal-card__desc strong {
  color: var(--gold);
  font-weight: 400;
}

.modal-card__btn {
  display: block;
  width: 100%;
  margin-bottom: 1.25rem;
}

/* 💸 信任信息 — 退款+付款方式，一行搞定 */
.modal-card__refund {
  font-size: 0.78rem;
  color: var(--text-secondary);
  margin-bottom: 0.3rem;
  line-height: 1.5;
  letter-spacing: 0.01em;
}

/* 🔒 支付背書 — 最低視覺層級 */
.modal-card__meta {
  font-size: 0.7rem;
  color: var(--text-muted);
  letter-spacing: 0.03em;
  margin: 0;
  line-height: 1.5;
}

/* 📱 手機版 */
@media (max-width: 768px) {
  .reading-header {
    padding-top: var(--space-lg);
  }

  .form-group--inline {
    grid-template-columns: 1fr;
  }

  .submit-row {
    align-items: center;
  }
}
