/* --- 全域設定 --- */
:root {
  --main-red: #b2292e; /* 修正點 1: 指定紅色 */
  --gold: #c5a065;
  --nav-width-desktop: 80px;
  --nav-height-mobile: 70px; /* 稍微增高以免擠 */
}

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

body {
  font-family: "Noto Sans TC", sans-serif;
  background-color: #fff; /* 修正點 1: Body 改回白色 */
}

/* --- 導覽列 (Navbar) --- */
.navbar {
  background-color: white;
  position: fixed;
  z-index: 1000;
  display: flex;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #b2292e;
  font-size: 15px;
  cursor: pointer;
}

/* 修正點 2: 強制設定 Logo 寬度，避免 SVG 不顯示 */
.nav-logo {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
  margin-bottom: 10px; /* 根據上一動的設定 */
}

/* 讓 picture 標籤也充滿寬度並置中 */
.nav-logo picture {
  display: flex;
  justify-content: center;
  width: 90%;
}

/* 圖片本身的設定 */
.nav-logo img {
  display: block;
  max-width: 100%; /* 確保圖片不會超出容器 */
  height: auto; /* 維持比例 */
}

/* --- 手機版 RWD 調整 (max-width: 768px) --- */
@media (max-width: 768px) {
  /* 1. 容器改為靠左對齊 */
  .nav-logo,
  .nav-logo picture {
    justify-content: flex-start; /* 從置中改為靠左 (Flex Start) */
  }

  .nav-logo img {
    width: 70%;
    max-width: 200px; /* (選用) 建議加個上限，避免在大手機上 50% 還是太大 */
  }

  /* (選用) 如果覺得太貼左邊邊緣，可以加一點點 padding-left */

  .nav-logo {
    margin-top: 10px;
  }
}

.nav-item img {
  width: 45px;
  height: 45px;
  margin-bottom: 4px;
}

/* 修正點 5: CSS 畫漢堡選單 (三條紅線) */
.hamburger-icon {
  width: 40px;
  height: 3px;
  background-color: var(--main-red); /* 中間那條 */
  position: relative;
  margin-bottom: 8px; /* 與文字的距離 */
  margin-top: 8px; /* 預留上方線條空間 */
}

.hamburger-icon::before,
.hamburger-icon::after {
  content: "";
  position: absolute;
  width: 100%;
  height: 3px;
  background-color: var(--main-red);
  left: 0;
}

.hamburger-icon::before {
  top: -9px;
} /* 上面那條 */
.hamburger-icon::after {
  top: 9px;
} /* 下面那條 */

/* --- 回到頂端按鈕樣式 --- */
.top-btn {
  display: flex;
  flex-direction: column; /* 讓箭頭和文字垂直排列 */
  align-items: center; /* 水平置中 */
  justify-content: center;
  text-decoration: none;
  color: #b2292e;

  font-size: 15px; /* TOP 文字大小 */
  font-weight: bold;
  cursor: pointer;
  transition: transform 0.3s ease, opacity 0.3s ease;
}

/* 用 CSS 畫出向上箭頭 */
.top-btn::before {
  content: ""; /* 必須有內容才能顯示 */

  /* 箭頭尺寸 */
  width: 25px;
  height: 25px;

  /* 畫出左邊和上面的線 */
  border-top: 2px solid currentColor; /* 跟隨文字顏色 */
  border-left: 2px solid currentColor;

  /* 旋轉 45 度，變成向上箭頭 */
  transform: rotate(45deg);

  /* 與下方文字的距離 */
  margin-bottom: -5px;
  margin-top: 4px; /* 稍微往下推一點，視覺平衡 */
}

/* Hover 動態：稍微往上浮動 */
.top-btn:hover {
  opacity: 0.8;
  transform: translateY(-5px); /* 整體往上飄 */
}

/* 桌機版 Nav */
@media (min-width: 769px) {
  .navbar {
    top: 0;
    right: 0;
    width: var(--nav-width-desktop);
    height: 100vh;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px 0;
  }
  .nav-group {
    display: flex;
    flex-direction: column;
    gap: 30px;
  }
  .main-content {
    margin-right: var(--nav-width-desktop); /* 讓出右邊 */
  }
}

/* 手機版 Nav */
@media (max-width: 768px) {
  .navbar {
    top: 0;
    left: 0;
    width: 100%;
    height: var(--nav-height-mobile);
    flex-direction: row;
    justify-content: space-between;
    padding: 0 20px;
    align-items: center;
  }
  .nav-group {
    display: flex;
    gap: 20px;
  }
  .nav-item span {
    display: none;
  } /* 手機版隱藏文字 */
  .top-btn {
    display: none;
  }

  .hamburger-icon {
    margin: 0;
  } /* 手機版只要圖示 */

  .main-content {
    margin-top: var(--nav-height-mobile); /* 讓出上方 */
  }

  .nav-item img {
    width: 35px;
    height: 35px;
  }

  .hamburger-icon {
    width: 35px;
  }
}

/* --- 側滑選單 (Drawer) --- */
.side-drawer {
  position: fixed;
  top: 0;
  right: -300px; /* 預設藏在右邊外面 */
  width: 250px;
  height: 100vh;
  background: white;
  z-index: 2000;
  transition: right 0.3s ease; /* 滑動動畫 */
  box-shadow: -2px 0 5px rgba(0, 0, 0, 0.1);
  padding: 20px;
}
.side-drawer.active {
  right: 0; /* 滑出來 */
}
.close-btn {
  font-size: 35px;
  cursor: pointer;
  float: right;
}
.drawer-menu {
  list-style: none;
  margin-top: 50px;
}
.drawer-menu li {
  margin-bottom: 20px;
}
.drawer-menu a {
  text-decoration: none;
  color: #b2292e;
  font-size: 20px;
  font-weight: bold;
}
.overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1500;
  display: none; /* 預設隱藏 */
}
.overlay.active {
  display: block;
}

/* --- Hero Section (大 Banner) --- */
.hero-section {
  display: flex;
  min-height: 100vh; /* 確保佔滿高 */
  background-color: var(--main-red); /* 修正點 1 */
  overflow: visible; /* 關鍵設定 */
  position: relative; /* 作為手機版排版的參考 */
}

.hero-visual {
  flex: 1.2;
  display: flex; /* 讓內部的 Wrapper 可以垂直置中 */
  align-items: center; /* 垂直置中 */
  justify-content: center; /* 水平置中 */
  overflow: hidden; /* 避免動畫飛出去 */
  /* 注意：這裡把 position: relative 拿掉，移給內層 */
}

/* 🔥 新增：圖片專屬容器 */
/* 這層 div 會被裡面的 img 撐開，大小永遠等於圖片大小 */
.visual-wrapper {
  position: relative; /* 關鍵！讓馬根據這個框框定位 */
  width: 100%; /* 寬度跟隨父層 */
  max-width: 100%; /* 確保不爆版 */
  line-height: 0; /* 消除圖片底部的微小縫隙 */
}

/* 底圖樣式 */
.base-bg {
  width: 100%;
  height: auto; /* 高度自動，保持比例 */
  display: block;
}

/* --- A. 共通設定 (負責大小與動畫) --- */

/* 馬的共通設定 */
.floating-obj {
  position: absolute;
  width: 29%; /* 預設大小，個別也可以覆寫 */
  z-index: 2;
  animation: float 4s ease-in-out infinite;
}

/* 花與星星的共通設定 */
.twinkling-obj {
  position: absolute;
  width: 10%; /* 預設大小 */
  z-index: 2;
  animation: twinkle 3s ease-in-out infinite;
}

/* 讓星星閃爍速度稍微不同，更有層次感 (選用) */
.star-1,
.star-2,
.star-3 {
  width: 7%; /* 星星通常比花小一點 */
  animation-duration: 2s; /* 閃快一點 */
}

/* --- B. 個別設定 (負責位置 TOP/LEFT) --- */
/* 請依照你的底圖實際位置，修改這裡的 % 數值 */

/* --- 馬匹位置 --- */
.horse-1 {
  top: 30%;
  left: 0%;
  animation-delay: 0s; /* 第一隻直接動 */
}

.horse-2 {
  top: 30%;
  left: 70%;
  animation-delay: 1s; /* 第二隻慢 1 秒動，錯開動作才自然 */
}

.horse-3 {
  top: 67%;
  left: 39.5%;
  width: 30%;
  animation-delay: 1.5s; /* 第二隻慢 1 秒動，錯開動作才自然 */
}

.horse-4 {
  top: 0%;
  left: 39.5%;
  width: 30%;
  animation-delay: 2s; /* 第二隻慢 1 秒動，錯開動作才自然 */
}

/* --- 花朵位置 --- */
.flower-1 {
  top: 14%;
  left: 90%;
}
.flower-2 {
  top: 75%;
  left: 73%;
  animation-delay: 1s;
}
.flower-3 {
  top: 34%;
  left: 42.5%;
  animation-delay: 1.5s;
}

.flower-4 {
  top: 26%;
  left: 1%;
  animation-delay: 1.4s;
}

.flower-5 {
  top: 88.5%;
  left: 18%;
  animation-delay: 1.7s;
}

/* --- 星星位置 --- */
.star-1 {
  top: 21%;
  left: 12%;
}
.star-2 {
  top: 35%;
  left: 55.5%;
  width: 8%;
  animation-delay: 1.2s;
}
.star-3 {
  top: 44%;
  left: 36.5%;
  animation-delay: 1.6s;
}

.star-4 {
  top: 58%;
  left: 54%;
  width: 8%;
  animation-delay: 1.2s;
}

.star-5 {
  top: 69%;
  left: 33%;
  width: 4%;
  animation-delay: 1.2s;
}

/* 右側內容 */
.hero-content {
  flex: 1;
  /* 這裡設定為 relative，是為了讓裡面的絕對定位元素參考這個框框 */
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center; /* 讓標題垂直置中 */
  align-items: center;

  /* 給底部留一點防撞空間，避免螢幕太矮時標題撞到按鈕 */
  padding-bottom: 120px;
}

/* --- 1. 標題區塊 (獨立流動) --- */
.title-group {
  /* 標題自然置中，不需要任何特殊定位，由 .hero-content 的 justify-content 控制 */
  width: 100%;
  text-align: center;
  z-index: 10;
  flex-shrink: 0;
}

/* --- 1. 定義進場動畫關鍵影格 (維持不變) --- */
@keyframes mystical-enter {
  0% {
    opacity: 0;
    transform: translateY(-40px); /* 從上方 40px 處開始，距離拉大一點更有氣勢 */
    filter: blur(10px); /* 一開始是模糊的 */
  }
  100% {
    opacity: 1;
    transform: translateY(0); /* 回到原位 */
    filter: blur(0); /* 變清晰 */
  }
}

.title-group img {
  width: 350px;
  max-width: 90%;
  height: auto;
  /* 確保圖片初始狀態 */
  opacity: 0; /* 避免動畫載入前閃爍 */

  /* 執行動畫：1.5秒完成，稍微慢一點比較莊重 */
  animation: mystical-enter 1.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;

  /* (選用) 如果你希望打開網頁後等一下下再出現，可以加 delay */
  animation-delay: 0.2s;
}

.footer-group {
  /* 🔥 核心解法：直接把這整組「釘」在紅色區塊的底線 */
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%; /* 確保水平置中 */

  display: flex;
  justify-content: center;
  align-items: center;

  /* 🔥 跨越特效：往下移動 50% */
  /* 因為 bottom: 0 已經貼齊紅線，往下 50% 就是完美跨越 */
  transform: translateY(50%);

  z-index: 20; /* 最高層級 */
}

/* 塔羅牌圖片 */
.tarot-img {
  position: absolute;
  width: 220px;
  height: auto;

  /* 微調位置：藏在按鈕後面 */
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%);

  z-index: -1; /* 藏在按鈕後面 */
}

/* --- 修改：CTA 按鈕 (需求1, 2, 4) --- */
.cta-btn {
  position: relative;
  z-index: 2; /* 蓋在圖片上面 */

  background: #00458d;
  color: white;
  border: 2px solid #c5a065;
  padding: 10px 30px 10px 10px;
  border-radius: 50px;
  text-decoration: none;
  font-size: 20px;
  font-weight: bold;
  display: inline-flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.cta-btn:hover {
  /* 放大 1.1 倍 */
  transform: scale(1.1);
  /* 加一點按鈕發光，增加點擊慾望 */
  box-shadow: 0 0 15px rgba(212, 175, 55, 0.6);
}

/* 2. 牌卡本身的設定 (預備好 transition) */
.tarot-img {
  transition: filter 0.5s ease, transform 0.5s ease;
}

/* 3. 🔥 關鍵連動：當按鈕被 Hover 時，改變牌卡樣式 */
/* 語法翻譯：當 footer-group 裡面包含了一個 "被 Hover 的 .cta-btn" 時... */
.footer-group:has(.cta-btn:hover) .tarot-img {
  /* 效果 A: 加上神聖白光 (Drop Shadow) */
  /* 參數：X偏移 Y偏移 模糊半徑 顏色 */
  filter: drop-shadow(0 0 20px rgba(212, 175, 55, 0.6));
}

.icon-circle {
  width: 40px;
  height: 40px;
  background-color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* 動畫設定 */
@keyframes float {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-10px);
  }
}

@keyframes twinkle {
  0%,
  100% {
    transform: scale(1.1); /* 原始大小 */
    opacity: 1; /* 確保完全不透明 */
  }
  50% {
    transform: scale(0.8); /* 縮小到 80% (製造呼吸感) */
    opacity: 1; /* 維持完全不透明 (原本是 0.7) */
  }
}

/* --- RWD 手機版調整 --- */
@media (max-width: 768px) {
  @keyframes float {
    0%,
    100% {
      transform: translateY(0);
    }
    50% {
      transform: translateY(-8px);
    }
  }

  .hero-section {
    flex-direction: column;
    min-height: auto; /* 不強制滿屏 */

    /* 這裡控制「整個紅色區塊」與「下方白色區塊」的距離 */
    /* 因為按鈕會跨出去，所以這裡要留白給它，才不會蓋住下面內容 */
    margin-bottom: 100px;
  }

  .hero-visual {
    width: 100%;
    /* 手機版如果希望圖片不要太高，可以限制 wrapper 寬度 */
  }

  .visual-wrapper {
    width: 100%; /* 手機版全寬 */
  }

  .hero-content {
    padding: 40px 20px 240px 20px;

    /* 讓標題在剩餘空間置中 */
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
  }

  .title-group {
    width: 100%;
  }

  .title-group img {
    max-width: 250px;
  }

  .footer-group {
    /* 手機版依然保持絕對定位黏在底部 */
    bottom: 0;
    left: 0;
    width: 100%;

    /* 4. 維持跨越特效：往下移動 50% */
    transform: translateY(50%);

    z-index: 20;
  }

  .tarot-img {
    width: 200px;
    bottom: 35px;
  }

  .cta-btn {
    font-size: 18px;
    padding: 10px 25px 10px 10px;
  }
}

/* --- 全新區塊：解鎖運勢 (Unlock Section) --- */
.unlock-section {
  background-color: white;
  padding: 60px 20px;
  /* 這裡控制「整個大區塊」的內容置中 */
  display: flex;
  justify-content: center;
}

/* 🔥 關鍵修改：標題群組容器 */
.section-header-group {
  display: flex;
  flex-direction: column;

  /* 1. 讓內容向左對齊 (這樣副標題就會對齊主標題的左邊) */
  align-items: flex-start;

  /* 2. 讓容器寬度「緊貼」內容，不要撐滿整個畫面 */
  width: fit-content;

  /* 3. 因為寬度變小了，用 margin: auto 讓整個容器在畫面上置中 */
  margin: 0 auto;
}

/* --- 主標題容器 (Flex 左右排版) --- */
.main-title-container {
  display: flex;
  align-items: flex-end;
  /* 這裡不需要 justify-content: center，因為外層已經縮小了 */
  gap: 15px;
  margin-bottom: 20px;
}

/* --- 左側文字群組 --- */
.text-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  color: #a68050;
  font-weight: bold;
  line-height: 1.2;
  text-align: left; /* 確保文字靠左 */
}

/* 上排文字 */
.line-top {
  font-size: 45px;
  margin: 0;
  white-space: nowrap;
}

/* 中間分隔線 */
.sep-line {
  width: 100%;
  height: 3px;
  background-color: #a68050;
  margin: 5px 0;
}

/* 下排文字 */
.line-bottom {
  font-size: 45px;
  margin: 0;
  white-space: nowrap;
}

/* --- 定義流光動畫：從左到右 --- */
@keyframes shine-loop {
  0% {
    /* 原本是負數，現在改成正數 (從右邊開始推) */
    background-position: 200% 0;
  }
  100% {
    /* 原本是正數，現在改成負數 (往左邊拉過去) */
    /* 由於背景往左移動，視覺上光影就會像是在「往右跑」 */
    background-position: -200% 0;
  }
}

/* --- 標題文字設定--- */
.text-group .line-top,
.text-group .line-bottom,
.draw-text-group .line-big,
.draw-text-group .line-small,
.knowledge-text-group .k-line-top,
.knowledge-text-group .k-line-bottom {
  /* 這裡維持原樣 */
  background: linear-gradient(110deg, #a68050 35%, #eecfa1 50%, #a68050 65%);
  background-size: 200% auto;

  background-clip: text;
  -webkit-background-clip: text;

  color: transparent;
  -webkit-text-fill-color: transparent;

  /* 3秒一循環 */
  animation: shine-loop 5s linear infinite;
}

/* (選用) 分隔線如果要一起閃 */
.text-group .sep-line,
.draw-text-group .sep-line,
.knowledge-text-group .sep-line {
  background: linear-gradient(110deg, #a68050 35%, #eecfa1 50%, #a68050 65%);
  background-size: 200% auto;
  animation: shine-loop 5s linear infinite;
}

/* --- 右側圖片 (鑰匙) --- */
.title-icon {
  height: 130px;
  width: auto;
  object-fit: contain;
  margin-bottom: 6px;
}

/* --- 副標題 (修正重點) --- */
.sub-desc {
  color: #333;
  font-size: 20px;
  line-height: 1.6;
  font-weight: bold;
  margin: 0;
  text-align: left;
}

/* --- RWD 手機版調整 --- */
@media (max-width: 768px) {
  .unlock-section {
    padding: 40px 20px;
  }

  .main-title-container {
    gap: 10px;
  }

  .line-top {
    font-size: 30px;
  }
  .line-bottom {
    font-size: 30px;
  }
  .sep-line {
    height: 2px;
  }
  .title-icon {
    height: 90px;
  }

  .sub-desc {
    font-size: 18px;
    /* 手機版是否要維持靠左？ */
    /* 如果希望手機版改回置中，請在這裡加 text-align: center; */
    /* 若要維持靠左，則不需更動 */
  }
}

/* -Youtube-------------------------------------------------------------- */
.video-wrapper {
  padding: 0px 50px;
  margin-bottom: 60px;
}
.YT {
  text-align: center;
}

.YT iframe {
  width: 1120px;
  height: 630px;
  border: none;
}

@media (max-width: 1300px) {
  .YT iframe {
    width: 100%;
    height: 100%;
    aspect-ratio: 16 / 9;
  }
}
@media (max-width: 768px) {
  .video-wrapper {
    padding: 40px 20px;
  }
}
@media (max-width: 420px) {
  .video-wrapper {
    padding: 30px 10px;
  }
}

/* --------------------------------------- */
/* --- 抽卡牌 (Draw Card Section) --- */
.draw-card-section {
  /* 依照附圖設定淺米色背景 */
  background-color: #f9f6f0;
  padding: 60px 20px;
  display: flex;
  justify-content: center;
  flex-direction: column;
  align-items: center;
  padding-bottom: 120px;
}

/* 沿用或微調共用的 header-group 設定 */
/* 如果上一個區塊的 .section-header-group 樣式會干擾，這裡我們用獨立的 class */
.draw-title-container {
  display: flex;
  /* 讓圖片跟文字「垂直置中」對齊 (因為這次第一行字很大，置中比較好看) */
  align-items: center;
  gap: 20px;
  margin-bottom: 30px;

  /* 確保容器縮小包覆內容 */
  width: fit-content;
  margin-left: auto;
  margin-right: auto;
}

/* --- 文字群組設定 --- */
.draw-text-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* 靠左對齊 */
  color: #a68050; /* 土金色 */
  font-weight: bold;
  line-height: 1.1; /* 行高縮緊一點 */
}

/* 第一行：特大字體 */
.line-big {
  font-size: 66px; /* 比之前的 36px 大很多 */
  margin: 0;
  white-space: nowrap; /* 強制不換行 */
}

/* 中間分隔線 */
.draw-text-group .sep-line {
  width: 100%;
  height: 3px;
  background-color: #a68050;
  margin: 10px 0; /* 加大一點間距 */
}

/* 第二行：較小字體 */
.line-small {
  font-size: 40px;
  margin: 0;
  white-space: nowrap; /* 強制不換行 */
  opacity: 0.9; /* 稍微淡一點點增加層次 (選用) */
}

/* --- 右側圖片 (牌卡) --- */
.draw-icon {
  /* 高度設定：大約等於 (64px + 32px + 間距) */
  height: 140px;
  width: auto;
  object-fit: contain;
}

/* --- 步驟清單 (副標題) --- */
.step-list {
  text-align: left; /* 文字靠左 */
  max-width: 800px; /* 限制最大寬度以免太寬難讀 */
  margin: 0 auto; /* 區塊置中 */
}

.step-list p {
  color: #333; /* 深灰色文字 */
  font-size: 18px;
  line-height: 1; /* 增加行高，讓閱讀更舒適 */
  margin: 0 0 10px 0; /* 每行下面的間距 */
  font-weight: bold;
}

/* --- 卡牌互動區 (Cards Interaction Area) --- */
.cards-interaction-area {
  width: 100%;
  max-width: 1000px; /* 限制最大寬度，避免卡牌在寬螢幕太大 */
  margin-top: 40px; /* 與上方的文字說明拉開距離 */
  display: flex;
  flex-direction: column;
  align-items: center;
}

/* 1. 卡牌網格系統 (Grid System) */
.cards-grid {
  display: grid;
  /* 桌機版：一行 4 張，每張平分空間 */
  grid-template-columns: repeat(4, 1fr);
  gap: 20px; /* 卡牌之間的間距 */
  width: 100%;
  margin-bottom: 40px; /* 卡牌與分享按鈕的距離 */
}

/* 個別卡牌樣式 */
.tarot-card {
  display: block;
  position: relative;
  border-radius: 12px; /* 圓角 */
  overflow: hidden; /* 確保圖片圓角 */

  /* 需求：圖片下方增加陰影 */
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.15);

  opacity: 0;
  transform: translateY(60px) scale(0.9) rotateX(15deg);

  /* 預設的過渡效果 (為了 Hover 平滑) */
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  will-change: transform, opacity;
}

.tarot-card img {
  width: 100%;
  height: auto;
  display: block; /* 消除圖片底部空隙 */
}

/* 2. 定義「發牌」動畫關鍵影格 */
@keyframes card-deal-in {
  0% {
    opacity: 0;
    transform: translateY(60px) scale(0.9) rotateX(15deg);
  }
  100% {
    opacity: 1;
    /* 🔥 重點：動畫結束要「歸零」，這樣 Hover 才能接手 */
    transform: translateY(0) scale(1) rotateX(0);
  }
}

/* 3. 當加上 .show class 時，執行動畫 */
.tarot-card.show {
  /* forwards 代表動畫結束後停在最後的狀態 (也就是顯示) */
  animation: card-deal-in 0.8s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.tarot-card.landed {
  opacity: 1;
  transform: translateY(0) scale(1) rotateX(0);

  /* 這裡不需要 animation，這樣就不會跟 Hover 打架了 */
  animation: none;
}

/* 4. 設定逐一進場的延遲時間 (Staggering) */
/* 這讓卡牌不會同時出現，而是 1->2->3->4 依序出現 */

.tarot-card:nth-child(1).show {
  animation-delay: 0.2s;
}
.tarot-card:nth-child(2).show {
  animation-delay: 0.4s;
}
.tarot-card:nth-child(3).show {
  animation-delay: 0.6s;
}
.tarot-card:nth-child(4).show {
  animation-delay: 0.8s;
}

.tarot-card:hover {
  /* 因為動畫結束後 transform 是 0，這裡改成 -10px 就會有上浮效果 */
  transform: translateY(-10px);

  /* 陰影加深，增加立體感 */
  box-shadow: 0 15px 30px rgba(0, 0, 0, 0.25);
}

/* 2. 社群分享按鈕群組 */
.share-action-group {
  display: flex;
  gap: 20px; /* 按鈕之間的距離 */
  flex-wrap: wrap; /* 如果螢幕太小允許換行 */
  justify-content: center;
}

.share-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px; /* Icon 與文字的距離 */

  /* 依照附圖的顏色 */
  background-color: #a08552; /* 土金色/褐色 */
  color: white;
  text-decoration: none;
  font-weight: bold;
  font-size: 22px;
  padding: 7px 15px;
  border-radius: 18px;
  transition: background-color 0.2s, transform 0.2s;
}

.share-btn img {
  width: 24px; /* 設定 icon 寬度 */
  height: 24px; /* 設定 icon 高度 */
  display: block; /* 消除圖片底部空隙 */
}

.share-btn:hover {
  background-color: #8a7040; /* Hover 變深一點 */
  transform: scale(1.05); /* 微微放大 */
}

/* --- RWD 手機版調整 --- */
@media (max-width: 768px) {
  .draw-card-section {
    padding: 40px 20px;
    padding-bottom: 100px;
  }

  /* 1. 標題容器：改成垂直排列，並且反向 */
  .draw-title-container {
    display: flex; /* 確保 Flex 屬性生效 */

    /* 🔥 關鍵：垂直排列，且「反向」 (讓原本在右邊的圖片跑到上面) */
    flex-direction: column-reverse;

    /* 讓圖片與文字群組水平置中對齊 */
    align-items: center;

    gap: 15px;
  }

  /* 2. 文字群組：改成置中排列 */
  .draw-text-group {
    /* 讓內部的 h2 和分隔線水平置中 */
    align-items: center;

    /* 確保文字置中 (雙重保險) */
    text-align: center;
  }

  /* 以下維持原本的字體大小調整，不需更動 */
  .line-big {
    font-size: 45px;
  }
  .line-small {
    font-size: 26px;
  }
  .draw-icon {
    height: 100px;
  }
  .step-list p {
    font-size: 16px;
  }

  /* 修改為 2 欄排版 */
  .cards-grid {
    /* 手機版：一行 2 張 */
    grid-template-columns: repeat(2, 1fr);
    gap: 15px; /* 手機版間距稍微縮小 */
  }

  .share-action-group {
    gap: 10px;
    width: 100%; /* 確保按鈕群組寬度足夠 */
  }

  .share-btn {
    flex: 1; /* 手機版讓兩個按鈕平分寬度，比較好按 */
    font-size: 16px;
    padding: 5px 10px;
    min-width: 140px; /* 避免太窄 */
  }
  .share-btn img {
    width: 20px;
    height: 20px;
  }
}

/* 超小螢幕微調 */
@media (max-width: 350px) {
  .line-big {
    font-size: 38px;
  }
  .line-small {
    font-size: 24px;
  }
}

/* --- 流年運勢推廣區塊 (Promo Section) --- */
.promo-section {
  background-color: #b2292e;
  position: relative;
  overflow: visible;
  padding: 40px 0 80px 0; /* 上方不需要太多留白了，因為馬已經往上跑 */
  display: flex;
  justify-content: center;
  align-items: center;

  /* 🔥 關鍵修改 2：消除與上一區塊的距離 (原本是 margin-top: 60px) */
  /* 設為 0，讓紅色區塊直接緊貼上面的米色區塊，消除白底 */
  margin-top: 0;
}

.promo-container {
  display: flex;
  align-items: center; /* 垂直置中 */
  justify-content: center;
  width: 100%;
  max-width: 900px;
  gap: 40px; /* 馬跟文字的距離 */
}

/* --- 定義馬匹律動動畫 --- */
@keyframes mystic-gallop {
  0% {
    /* 起始點：稍微低一點，角度回正 */
    transform: translateY(2px) rotate(0deg);
  }
  50% {
    /* 最高點：往上浮動，並輕微向後仰 (準備往下衝的感覺) */
    transform: translateY(-8px) rotate(1.5deg);
  }
  100% {
    /* 回到起始點：形成循環 */
    transform: translateY(2px) rotate(0deg);
  }
}

/* --- 左側：往上凸出的馬 --- */
.horse-wrapper {
  position: relative;
}

.promo-horse {
  width: 420px;
  height: auto;

  /* 🔥 關鍵修改 3：負邊距調整 */
  /* 因為兩個區塊緊貼了，馬需要往上跑更多才能凸出去 */
  /* 數值越大，馬往上跑越高 */
  margin-top: -80px;

  position: relative;
  z-index: 10;
  transition: transform 0.3s;

  /* 🔥 新增：加入持續的律動動畫 */
  /* infinite 代表無限循環 */
  animation: mystic-gallop 3.5s ease-in-out infinite;

  /* 加入 hover 的過渡效果 */
  transition: transform 0.3s ease, filter 0.3s ease;
  /* 為了讓動畫更順暢，開啟硬體加速 */
  will-change: transform;
}

/* --- 新增：Hover 互動效果 --- */
/* 當滑鼠移到 horse-wrapper 整個區域時觸發 */
.horse-wrapper:hover .promo-horse {
  /* 2. 圖片稍微放大並往上提，產生「浮起來」的感覺 */
  /* 注意：這裡的 translateY 要稍微計算一下動畫暫停時的大概位置，避免跳動 */
  transform: scale(1.05) translateY(-10px) rotate(0deg);

  /* 3. (選用) 稍微增加亮度，增加神聖感 */
  filter: brightness(1.15);
}

/* --- 右側：文字與圓圈 --- */
.promo-info {
  display: flex;
  align-items: center;
  gap: 20px;
  color: white;
}

.text-content {
  text-align: left;
}

.text-content a {
  color: white;
  text-decoration: none;
  transition: background-color 0.2s, transform 0.2s;
}

.text-content a:hover {
  color: #a68050;
}

/* 2026 特大字體 */
.year-big {
  font-size: 80px;
  line-height: 1;
  margin: 0;
  font-weight: bold;
}

/* 老師名稱 */
.teacher-name {
  font-size: 28px;
  line-height: 1.4;
  margin: 10px 0 0 0;
  font-weight: bold;
}

/* Here 圓圈 */
.circle-here {
  display: flex; /* 保持原本的 flex 置中設定 */
  justify-content: center;
  align-items: center;
  text-decoration: none; /* 🔥 關鍵：移除連結下底線 */
  cursor: pointer;

  width: 80px;
  height: 80px;
  background-color: white;
  border-radius: 50%;

  /* 這裡不用設定 color 了，由下面個別控制 */

  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;

  /* 文字樣式 */
  font-weight: bold;
  font-size: 20px;
  line-height: 1.2;
  color: #a68050; /* 土金色文字 */

  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);
  transition: all 0.3s;
}

/* 設定 SVG 箭頭預設顏色 (土金色) */
.circle-here .arrow-svg {
  stroke: #a68050;
  transition: stroke 0.3s;
  margin-top: 2px; /* 稍微跟文字拉開距離 */
}

.circle-here span {
  font-size: 24px; /* 箭頭大一點 */
}

.circle-here:hover {
  transform: scale(1.1);
}

/* --- 底部：跨越兩區的按鈕 --- */
.promo-btn {
  position: absolute;
  bottom: 0; /* 釘在紅色區塊底部 */
  left: 50%;
  transform: translate(-50%, 50%); /* 水平置中 + 往下移動 50% (跨越) */

  background-color: white;
  color: #b2292e; /* 紅色文字 */
  border: 2px solid #b2292e; /* 加個細邊框更有質感 */

  padding: 10px 40px;
  border-radius: 50px;
  font-size: 24px;
  font-weight: bold;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  box-shadow: 0 5px 20px rgba(0, 0, 0, 0.2);
  z-index: 20;
  white-space: nowrap; /* 不換行 */
}

/* 按鈕內的圓形箭頭 icon */
.btn-icon-down {
  background-color: #8d282c; /* 深紅底 */
  color: white;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
}

.promo-btn:hover {
  background-color: #f8f8f8;
  transform: translate(-50%, 45%); /* Hover 時稍微浮起來 */
}

/* --- RWD 手機版調整 --- */
@media (max-width: 768px) {
  .promo-section {
    flex-direction: column;
    padding-bottom: 80px; /* 底部留空間給跨越的按鈕 */
    margin-top: 0px;
  }

  .promo-container {
    flex-direction: column; /* 改為垂直排列 */
    gap: 20px;
  }

  /* 手機版馬的大小與位置 */
  .promo-horse {
    width: 300px;
    margin-top: -65px; /* 手機版往上跑的距離微調 */
  }

  .promo-info {
    display: flex;
    flex-direction: row; /* 維持左右並排 */

    /* 🔥 關鍵修改：從 center 改為 flex-end */
    /* 這會讓右邊的圓圈「沉到底部」，對齊左邊文字的下緣 */
    align-items: flex-end;

    gap: 15px;
  }

  .year-big {
    font-size: 60px;
  }
  .teacher-name {
    font-size: 24px;
  }

  .circle-here {
    width: 40px; /* 手機版圓圈縮小 */
    height: 40px;
    /* Flex 設定維持置中 */
  }
  /* 1. 隱藏 "here" 文字 */
  .circle-here .desktop-text {
    display: none;
  }

  /* 2. 改變箭頭顏色為紅色，並放大一點 */
  .circle-here .arrow-svg {
    stroke: #b2292e; /* 改成紅色箭頭 */
    width: 24px; /* 稍微放大箭頭 */
    height: 24px;
    margin-top: 0; /* 不需要 margin 了，因為只有它自己 */
  }

  .promo-btn {
    font-size: 18px;
    padding: 8px 18px;
    width: 90%; /* 手機版按鈕寬一點 */
    justify-content: center;
  }
}

/* --- 新區塊：知識新啟程 (Knowledge Section) --- */
.knowledge-section {
  background-color: white;
  padding: 80px 20px 0 20px; /* 底部 padding 歸零，因為下方 grid container 有 padding */

  display: flex;
  /* 修正點 1: 改為垂直排列，讓標題在上，卡片區塊在下 */
  flex-direction: column;
  align-items: center; /* 水平置中 */
}

.knowledge-title-container {
  display: flex;
  align-items: center; /* 垂直置中 (讓右邊的鳥跟左邊文字群組對齊) */
  gap: 20px;
  width: fit-content;
  margin: 0 auto;
}

/* --- 文字群組 --- */
.knowledge-text-group {
  display: flex;
  flex-direction: column;
  align-items: flex-start; /* 靠左對齊 */
  color: #a68050; /* 土金色 */
  font-weight: bold;
  line-height: 1; /* 縮緊行高，避免數字太高產生過多空白 */
}

/* 第一行：2026 + 文字 */
.k-line-top {
  display: flex;
  align-items: baseline; /* 🔥 關鍵：讓 2026 的底部跟文字底部對齊 */
  gap: 10px; /* 數字跟文字的距離 */
  margin: 0;
  white-space: nowrap; /* 不換行 */
}

/* 2026 特大字體設定 */
.year-highlight {
  font-size: 64px; /* 特大 */
  font-family: sans-serif; /* 數字建議用無襯線體比較俐落 */
}

/* "知識新啟程" 字體設定 */
.k-line-top {
  font-size: 40px; /* 正常大標題尺寸 */
}

/* 分隔線 */
.knowledge-text-group .sep-line {
  width: 100%;
  height: 3px;
  background-color: #a68050;
  margin: 10px 0;
}

/* 第二行：八大主題馬上學 */
.k-line-bottom {
  font-size: 40px; /* 比第一行中文稍大，強調主題 */
  margin: 0;
  white-space: nowrap;
}

/* --- 右側圖片 (鳥) --- */
.knowledge-icon {
  height: 150px; /* 高度約等於兩行文字加起來 */
  width: auto;
  object-fit: contain;
}

/* --- RWD 手機版調整 --- */
@media (max-width: 768px) {
  .knowledge-section {
    padding: 60px 20px;
  }

  .knowledge-title-container {
    /* 手機版：圖片在文字上面 */
    flex-direction: column-reverse;
    gap: 15px;
  }

  .knowledge-text-group {
    align-items: center; /* 文字置中 */
  }

  /* 手機版字體縮小 */
  .year-highlight {
    font-size: 48px;
  }
  .k-line-top {
    font-size: 30px;
  } /* 這是設定"知識新啟程"的大小 */
  .k-line-bottom {
    font-size: 30px;
  }

  .knowledge-icon {
    height: 110px;
  }
}

/* --- 知識主題卡片區塊 --- */

/* 定義顏色變數，方便統一管理和手機版切換 */
/* 定義顏色變數 */
:root {
  --card-red-bg: #b2292e;
  --card-blue-bg: #00458d;

  /* 修正點 4: 金色統一改為 #A68050 */
  --card-text-gold: #a68050;
}

.knowledge-grid-container {
  background-color: white;
  width: 100%; /* 確保佔滿寬度 */
  padding: 40px 20px 40px 20px;
  display: flex;
  justify-content: center;
}

/* Grid 網格設定 (電腦版) */
.knowledge-grid {
  display: grid;
  /* 電腦版：4欄，每欄等寬 */
  grid-template-columns: repeat(4, 1fr);
  gap: 30px; /* 卡片間距 */
  width: 100%;
  max-width: 1200px; /* 限制最大寬度 */
}

/* --- 個別卡片樣式 --- */
.knowledge-card {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-decoration: none;

  width: 100%;

  /* 修正點 1: 調整比例讓它變矮胖 */
  /* 原本是 3 / 5 (瘦長)，改為 3 / 4.2 (矮胖) */
  aspect-ratio: 3 / 4.2;

  border-radius: 200px;
  overflow: hidden;
  border: 3px solid var(--card-text-gold);

  /* 因為卡片變矮了，上下 padding 稍微縮小一點，留空間給馬 */
  padding: 30px 15px;

  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.15);
  background-clip: padding-box;

  opacity: 0;
  transform: translateY(40px); /* 從下方 40px 開始 */

  /* 預設的過渡效果 (給 Hover 使用) */
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
    box-shadow 0.3s ease;
  will-change: transform, opacity;
}

/* 2. 定義「Q彈上浮」動畫 */
@keyframes pill-pop-up {
  0% {
    opacity: 0;
    transform: translateY(40px) scale(0.9);
  }
  60% {
    opacity: 1;
    transform: translateY(-5px) scale(1.02); /* 衝過頭一點點，製造彈性 */
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1); /* 回到定位 */
  }
}

/* 3. 進場狀態 (.show) - 執行動畫 */
.knowledge-card.show {
  animation: pill-pop-up 0.6s ease-out forwards;
}

/* 4. 落地狀態 (.landed) - 動畫結束後切換成這個 */
/* 這是為了釋放 transform 控制權，讓 Hover 能正常運作 */
.knowledge-card.landed {
  opacity: 1;
  transform: translateY(0) scale(1);
  animation: none; /* 移除動畫鎖定 */
}

/* 5. 設定 8 張卡片的逐一延遲 (Staggering) */
/* 讓它們依序出現，間隔 0.1 秒 */
.knowledge-card:nth-child(1).show {
  animation-delay: 0.2s;
}
.knowledge-card:nth-child(2).show {
  animation-delay: 0.4s;
}
.knowledge-card:nth-child(3).show {
  animation-delay: 0.6s;
}
.knowledge-card:nth-child(4).show {
  animation-delay: 0.8s;
}
.knowledge-card:nth-child(5).show {
  animation-delay: 1s;
}
.knowledge-card:nth-child(6).show {
  animation-delay: 1.2s;
}
.knowledge-card:nth-child(7).show {
  animation-delay: 1.4s;
}
.knowledge-card:nth-child(8).show {
  animation-delay: 1.6s;
}

/* 卡片顏色分類 (使用變數) */
.card-red {
  background-color: var(--card-red-bg);
}
.card-blue {
  background-color: var(--card-blue-bg);
}

/* 背景紋路層 (SVG) */
.card-bg-pattern {
  position: absolute;

  /* 修正點 5: 位置往下移，只佔據 2/3 (約 65%) */
  top: auto; /* 取消置頂 */
  bottom: 0; /* 固定在底部 */
  height: 65%; /* 高度佔 65% */
  width: 120%;

  background-image: url("../images/wave-pattern.svg");
  background-size: cover;
  background-position: center top; /* 讓波浪從上方開始切齊 */
  z-index: 1;
}

/* 內容層文字設定 */
.card-content {
  position: relative;
  z-index: 10; /* 確保文字在最上層 */
  text-align: center;
  margin-bottom: auto; /* 把空間留給下面的馬 */
}

.idiom-text {
  color: var(--card-text-gold);
  font-size: 18px;
  font-weight: bold;
  display: inline-block; /* 讓 border 緊貼文字寬度 */
  margin-bottom: 5px;
  letter-spacing: 2px;

  /* 修正點 2: 上下增加金色細線 */
  border-top: 1px solid var(--card-text-gold);
  border-bottom: 1px solid var(--card-text-gold);
  padding: 4px 0; /* 增加線條與文字的距離 */
}

.main-title {
  color: var(--card-text-gold);
  font-size: 36px;
  font-weight: bold;
  line-height: 1.3;
  margin: 0;
}

/* 馬匹插圖設定 */
.card-horse {
  position: relative;
  z-index: 10;

  /* 修正點 6-1: 大小要佔滿左右寬度 (扣除 padding 後的 100%) */
  width: 110%;
  height: auto;
  margin-top: 20px;

  transition: transform 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

/* --- 互動動畫設定 --- */

/* 卡片 Hover: 浮起來 */
.knowledge-card:hover {
  transform: translateY(-15px);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
}

/* 卡片 Hover 時，裡面的馬: 往左上方跳 */
.knowledge-card:hover .card-horse {
  /* 修正點 6-2: 往「左」上方跳躍 (X軸負值, Y軸負值) */
  /* rotate(-8deg) 讓馬頭稍微抬起，更有躍動感 */
  transform: translate(-15px, -15px) rotate(-8deg);
}

/* --- RWD 精細調整 --- */

/* 1. 平板/小筆電區間 (670px ~ 1024px) */
/* 1. 平板/小筆電區間 (670px ~ 1024px) */
@media (max-width: 1024px) and (min-width: 670px) {
  /* 🔥 改善方法 1: 加大容器左右 Padding */
  /* 這會把兩欄往中間擠，讓卡片自然變窄、變小，兩側留白增加質感 */
  .knowledge-grid-container {
    padding-left: 80px;
    padding-right: 80px;
  }

  .knowledge-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 30px; /* 間距稍微加大，讓畫面不擁擠 */
  }

  .knowledge-card {
    /* 🔥 改善方法 2: 限制卡片最大寬度 */
    /* 從 320px 下修到 280px，強制藥丸變「小顆」一點 */
    max-width: 280px;

    margin: 0 auto; /* 置中 */
    aspect-ratio: 3 / 5; /* 維持完美的藥丸比例 */
    padding: 30px 20px;

    /* 確保內容垂直分佈均勻 */
    justify-content: space-between;
  }

  /* 🔥 改善方法 3: 放大字體填補空間 */
  .idiom-text {
    font-size: 20px; /* 成語變大 */
    margin-bottom: 5px;
  }

  .main-title {
    font-size: 36px; /* 標題變大 */
  }

  /* 馬的大小與位置調整 */
  .card-horse {
    width: 110%;
    /* 因為用了 justify-content: space-between，馬會自動沉到底部 */
    /* 這裡只要確保它不要太小即可 */
    margin-top: auto;
    margin-bottom: 10px; /* 稍微離底部一點距離 */
  }

  /* 顏色互換邏輯 (維持不變) */
  .knowledge-grid .card-red:nth-child(3),
  .knowledge-grid .card-red:nth-child(6) {
    background-color: var(--card-blue-bg) !important;
  }
  .knowledge-grid .card-blue:nth-child(4),
  .knowledge-grid .card-blue:nth-child(5) {
    background-color: var(--card-red-bg) !important;
  }
}

/* 2. 一般手機區間 (440px ~ 669px) */
@media (max-width: 669px) {
  .knowledge-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
  }

  .knowledge-card {
    padding: 20px 10px;
    /* 手機版維持稍微瘦長的比例，但不用太誇張 */
    aspect-ratio: 3 / 4.5;
  }

  .idiom-text {
    font-size: 15px;
    margin-bottom: 5px;
  }
  .main-title {
    font-size: 24px;
  }

  .card-horse {
    width: 95%; /* 讓馬佔滿一點 */
    margin-top: 10px;
  }

  /* 顏色互換邏輯 (維持不變) */
  .knowledge-grid .card-red:nth-child(3),
  .knowledge-grid .card-red:nth-child(6) {
    background-color: var(--card-blue-bg) !important;
  }
  .knowledge-grid .card-blue:nth-child(4),
  .knowledge-grid .card-blue:nth-child(5) {
    background-color: var(--card-red-bg) !important;
  }
}

/* 3. 超小螢幕區間 (< 440px) */
/* 針對這區間的問題：空間不足導致馬不見 */
@media (max-width: 440px) {
  .card-content {
    margin-top: 15px;
  }

  .knowledge-grid {
    grid-template-columns: repeat(2, 1fr); /* 堅持 2 欄 */
    gap: 10px; /* 間距縮到最小 */
  }

  .knowledge-card {
    /* 🔥 關鍵修正 2：縮小 Padding 騰出空間 */
    padding: 15px 5px;

    /* 🔥 關鍵修正 3：拉長比例 或 設定最小高度 */
    /* 這裡強制設定 min-height，確保不管寬度多窄，高度至少有 220px 讓馬住 */
    aspect-ratio: unset; /* 取消比例限制 */
    min-height: 220px;
  }

  /* 字體再縮小一點，避免換行太擁擠 */
  .idiom-text {
    font-size: 13px;
    border-width: 1px; /* 線條細一點 */
    margin-bottom: 5px;
  }

  .main-title {
    font-size: 20px; /* 縮小標題 */
    line-height: 1.2;
  }

  .card-horse {
    width: 100%; /* 馬全寬 */
    margin-top: auto; /* 用 Flex 屬性把馬推到最底端，避免跟文字打架 */
    margin-bottom: -5px; /* 稍微往下拉一點點 */
  }

  /* 顏色互換邏輯 (維持不變) */
  .knowledge-grid .card-red:nth-child(3),
  .knowledge-grid .card-red:nth-child(6) {
    background-color: var(--card-blue-bg) !important;
  }
  .knowledge-grid .card-blue:nth-child(4),
  .knowledge-grid .card-blue:nth-child(5) {
    background-color: var(--card-red-bg) !important;
  }
}

/* --- 超小螢幕極限調整 (< 350px) --- */
@media (max-width: 350px) {
  /* 1. 容器調整：減少兩側留白，但不要完全為 0 (留 5px 呼吸) */
  .knowledge-grid-container {
    padding-left: 5px;
    padding-right: 5px;
  }

  /* 2. Grid 調整：間距縮到最小 */
  .knowledge-grid {
    /* 維持 2 欄 */
    grid-template-columns: repeat(2, 1fr);
    gap: 8px; /* 間距縮小到 8px */
  }

  /* 3. 卡片調整：釋放空間 */
  .knowledge-card {
    /* 縮小內部內距，把空間留給內容 */
    padding: 20px 5px 0 5px;

    /* 🔥 關鍵：取消原本的比例，改用最小高度控制 */
    /* 避免卡片因為太窄而變得像「筷子」一樣過高 */
    aspect-ratio: unset;
    min-height: 200px; /* 確保有基本高度 */

    /* 邊框改細一點點，視覺比較輕盈 */
    border-width: 1.5px;
  }

  /* 4. 文字調整：極限縮小 */
  .idiom-text {
    font-size: 13px;
    margin-bottom: 5px;
    border-width: 1px; /* 裝飾線變細 */
    letter-spacing: 0; /* 取消字距，避免換行 */
  }

  .main-title {
    font-size: 20px;
    line-height: 1.2;
  }

  /* 🔥 5. 馬的調整：放大術 (負邊距技巧) */
  .card-horse {
    /* 讓馬的寬度大於卡片本身 (130%) */
    width: 120%;

    /* 確保馬在底部 */
    margin-top: auto;
    margin-bottom: -5px; /* 稍微往下沉一點 */
  }
}

/* --- Footer --- */

/* 1. 外部容器的基本設定 */
footer {
  background-color: #fff;
  padding: 30px 0;
  margin-top: 80px;
}

/* 2. 電腦版樣式 (預設) */
.footer-container {
  display: flex;
  justify-content: center; /* 將左右兩個項目推到兩邊 */
  align-items: center; /* 垂直置中 */
  flex-wrap: wrap; /* 在極端情況下換行 */
  gap: 20px; /* 彈性間距 */
}

.social-icons {
  display: flex;
  align-items: center;
  gap: 15px; /* 圖示之間的間距 */
}

.social-icons img {
  width: 50px;
  height: 50px;
  transition: opacity 0.3s ease;
}
.social-icons a:hover img {
  opacity: 0.7;
}

.footer-text {
  margin: 0; /* 移除 p 標籤的預設邊距 */
  font-size: 14px;
  color: #000;
  /* 關鍵：用 border-left 製作分隔線 */
  border-left: 1px solid #000;
  padding-left: 30px; /* 分隔線與文字的間距 */
  margin-left: 30px; /* 分隔線與左邊圖示的間距 */
}

.footer-text a {
  color: #000;
  text-decoration: none;
}

/* 3. 手機版樣式 (當螢幕寬度 <= 768px) */
@media (max-width: 768px) {
  .footer-container {
    flex-direction: column; /* 改為垂直堆疊 */
    justify-content: center; /* 水平置中 */
    gap: 25px; /* 上下間距 */
  }

  .footer-text {
    border-left: none; /* << 關鍵：隱藏分隔線 */
    margin-left: 0; /* 移除因分隔線產生的空間 */
    padding-left: 0; /* 移除因分隔線產生的空間 */
    text-align: center; /* 文字置中 */
  }
}

/* --- 手機版回到頂端按鈕 --- */
.mobile-top-btn {
  position: fixed;
  bottom: 20px;
  right: 20px;
  width: 50px;
  height: 50px;
  background-color: white; /* 白底 */
  border-radius: 50%; /* 圓形 */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2); /* 陰影讓它浮起來 */

  z-index: 9999; /* 確保在最上層 */
  cursor: pointer;

  /* 彈性佈局讓箭頭置中 */
  display: flex;
  justify-content: center;
  align-items: center;

  /* 初始狀態：隱藏 (透過 JS 控制顯示) */
  opacity: 0;
  pointer-events: none; /* 看不到時不能點 */
  transform: translateY(20px); /* 稍微往下沉 */
  transition: all 0.3s ease;
}

/* 狀態：顯示 */
.mobile-top-btn.show {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

/* 畫出紅色箭頭 (跟桌機版類似) */
.mobile-top-btn::before {
  content: "";
  width: 14px;
  height: 14px;

  /* 紅色線條 */
  border-top: 3px solid #b2292e;
  border-left: 3px solid #b2292e;

  /* 旋轉 45 度變成向上箭頭 */
  transform: rotate(45deg);
  margin-top: 4px; /* 視覺微調置中 */
}

/* --- 電腦版隱藏 --- */
/* 當螢幕大於 768px 時，不顯示這個按鈕 */
@media (min-width: 769px) {
  .mobile-top-btn {
    display: none;
  }
}

/* --- 左下角懸浮 Icon --- */
.float-left-icon {
  position: fixed;
  left: 20px; /* 距離左邊 20px */
  bottom: 50px; /* 距離底部 20px */

  width: 120px; /* 設定圖片容器寬度 (可依圖片大小調整) */
  height: auto;

  z-index: 9998; /* 確保在最上層 (稍微比回到頂端按鈕低一點點沒關係) */

  /* 讓圖片轉換更滑順 */
  transition: transform 0.3s ease, opacity 0.3s ease;

  /* 移除連結預設的底線或外框 */
  display: block;
  text-decoration: none;
  border: none;
  outline: none;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

/* 確保圖片充滿容器 */
.float-left-icon img {
  width: 100%;
  height: auto;
  display: block; /* 消除圖片下方的微小空隙 */
}

/* Hover 互動效果：滑鼠移上去稍微放大 */
.float-left-icon:hover {
  transform: scale(1.1); /* 放大 1.1 倍 */
  opacity: 0.9; /* 稍微變透明一點點 */
}

/* --- RWD 手機版調整 (選用) --- */
@media (max-width: 768px) {
  .float-left-icon {
    width: 80px; /* 手機版可以稍微縮小一點 */
    left: 15px;
    bottom: 40px;
  }
}

/* === 新頁面：塔羅結果頁 Header 樣式 === */

/* 定義紫色背景變數 (根據圖片吸取) */
:root {
  --result-purple-bg: #66479f;
}

/* Header 區塊基底設定 */
.result-header-section {
  background-color: var(--result-purple-bg); /* 紫色背景 */
  padding: 60px 20px; /* 上下留白，兩側保持安全距離 */
  color: #ffffff; /* 整體文字為白色 */
  width: 100%;
}

.wealth-bg {
  background-color: #3ca979;
}

.love-bg {
  background-color: #d651a7;
}

.health-bg {
  background-color: #2696a8;
}

/* 內容限制容器 (讓內容不要無限寬) */
.result-header-container {
  width: 100%;
  max-width: 1100px; /* 可依需求調整最大寬度 */
  margin: 0 auto; /* 水平置中 */
}

/* --- 桌機版 Flex 排版 (預設) --- */
/* 參考圖 1：左圖右文 */
.result-header-wrapper {
  display: flex;
  align-items: center; /* 垂直置中對齊 */
  justify-content: center; /* 水平置中 (內容較少時比較好看) */
  gap: 50px; /* 圖與文之間的間距 */
}

/* 圖片區塊設定 */
.result-img-box {
  flex-shrink: 0; /* 防止空間不足時圖片被壓縮 */
}

.result-bird-img {
  width: 200px; /* 設定一個適當的基礎寬度 */
  height: auto;
  display: block;
}

.result-wealth-img {
  width: 250px;
  height: auto;
  display: block;
}

/* 文字區塊設定 */
.result-text-group {
  max-width: 600px; /* 限制文字區塊最大寬度，提升閱讀性 */
}

/* 主標題樣式 */
.result-main-title {
  font-size: 48px; /* 大標題尺寸 */
  font-weight: bold;
  margin-bottom: 20px; /* 與下方內文的距離 */
  line-height: 1.2;
}

/* 描述內文樣式 */
.result-desc {
  font-size: 18px; /* 內文尺寸 */
  line-height: 1.6; /* 舒適的行高 */
  opacity: 0.95; /* 稍微降低一點點透明度，讓視覺比較柔和 */
  text-align: justify; /* (選用) 兩端對齊讓區塊更整齊，不喜歡可拿掉 */
}

/* --- RWD 手機版調整 (max-width: 768px) --- */
/* 參考圖 2：圖上文下，垂直置中 */
@media (max-width: 768px) {
  .result-header-section {
    padding: 40px 20px; /* 手機版上下 padding 稍微縮小 */
  }

  .result-header-wrapper {
    flex-direction: column; /* 🔥 關鍵：改為垂直排列 */
    text-align: center; /* 讓文字內容水平置中 */
    gap: 25px; /* 調整圖文間的垂直距離 */
  }

  /* 手機版圖片稍微縮小 */
  .result-bird-img {
    width: 160px;
    /* 由於外層是 flex column 且 align-items: center (預設繼承或 browser default)，圖片會自動置中 */
  }

  .result-wealth-img {
    width: 200px;
  }

  /* 手機版文字大小調整 */
  .result-main-title {
    font-size: 36px; /* 標題縮小 */
    margin-bottom: 15px;
  }

  .result-desc {
    font-size: 16px; /* 內文縮小 */
    text-align: center; /* 手機版強制置中對齊，取消 justify */
  }
}

/* === 結果頁：卡牌互動區塊 === */

.result-interaction-section {
  background-color: white;
  padding: 60px 20px;
}

.result-container {
  max-width: 1000px; /* 限制內容寬度 */
  margin: 0 auto;
}

/* --- A. 卡牌網格 --- */
.cards-select-grid {
  display: grid;
  /* 桌機版：4 張一列 */
  grid-template-columns: repeat(4, 1fr);
  gap: 20px;
  margin-bottom: 40px; /* 與下方解說框的距離 */
}

/* 卡牌選項樣式 */
.card-option {
  cursor: pointer;
  border-radius: 8px;
  overflow: hidden;

  /* 預設邊框 (透明) */
  border: 3px solid transparent;

  /* 參數：X偏移 Y偏移 模糊半徑 顏色(黑色20%透明度) */
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2);

  /* 過渡效果：讓陰影變化也很滑順 */
  transition: transform 0.3s, box-shadow 0.3s, border-color 0.3s;
}

.card-option img {
  width: 100%;
  height: auto;
  display: block;
}

/* Hover 效果：卡牌浮起 + 陰影加深 */
.card-option:hover {
  transform: translateY(-10px); /* 稍微往上浮多一點點 */
  box-shadow: 0 20px 30px 10px rgba(166, 128, 80, 0.5);
}

/* Active (被選中) 狀態 */
.card-option.active {
  border-color: #a68050;
  /* 選中時也可以維持一個比較明顯的陰影 */
  box-shadow: 0 0 20px rgba(166, 128, 80, 0.5);
}

/* --- B. 解說對話框 --- */
.explanation-box {
  position: relative; /* 為了定位箭頭 */
  border: 2px solid #a68050; /* 金色邊框 */
  border-radius: 20px;
  background-color: white;
  padding: 40px;
  margin-top: 20px;
  scroll-margin-top: 60px;
}

/* --- 動態箭頭 (Triangle) --- */
.box-arrow {
  position: absolute;
  top: -16px; /* 移到框框上方，蓋住邊框 */

  /* 透過 CSS 變數控制位置，預設在第 1 張牌的位置 (12.5%) */
  left: var(--arrow-pos, 12.5%);

  width: 30px;
  height: 16px;

  /* 置中修正 */
  transform: translateX(-50%);

  /* 畫出三角形 */
  width: 0;
  height: 0;
  border-left: 15px solid transparent;
  border-right: 15px solid transparent;
  border-bottom: 15px solid #a68050; /* 底色同邊框色 */
}

/* 箭頭內部的白色遮罩 (為了做出空心感/蓋住線條) 
   如果你想要實心箭頭，可以省略這個 pseudo-element，
   但參考圖看起來箭頭是實心的金褐色，那就只要上面的 border-bottom 即可。
   
   修正：參考圖的箭頭是實心的「土金色」，連接在白底框上。
   為了視覺好看，我們保持上面的實心三角形即可。
*/

/* --- 解說內容排版 --- */
.exp-layout {
  display: flex;
  gap: 30px;
  align-items: flex-start;
}

/* 數字圓圈 */
.exp-number {
  flex-shrink: 0;
  width: 60px;
  height: 60px;
  background-color: #a68050; /* 土金色底 */
  color: white;
  font-size: 32px;
  font-weight: bold;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-family: sans-serif;
}

/* 文字群組 */
.exp-text-group {
  flex-grow: 1;
}

.exp-desc {
  font-size: 18px;
  line-height: 1.8;
  color: #333;
  margin-bottom: 30px;
  text-align: justify;
}

/* 推薦課程區塊 */
.recommend-title {
  font-size: 20px;
  color: #a68050;
  margin-bottom: 15px;
  font-weight: bold;
}

.recommend-links {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recommend-links a {
  color: #66479f; /* 紫色連結 */
  text-decoration: none;
  font-size: 18px;
  border-bottom: 1px solid #66479f; /* 底線 */
  width: fit-content;
  transition: opacity 0.3s;
}

.recommend-links a:hover {
  opacity: 0.7;
}

/* --- RWD 手機版調整 --- */
@media (max-width: 768px) {
  .cards-select-grid {
    /* 手機版：2 張一列 */
    grid-template-columns: repeat(2, 1fr);
  }

  .explanation-box {
    padding: 25px 20px;
  }

  .exp-layout {
    flex-direction: column; /* 數字在文字上方 */
    gap: 15px;
    align-items: flex-start; /* 置中對齊 */
  }

  .exp-number {
    width: 45px;
    height: 45px;
    font-size: 26px;
  }

  .exp-desc {
    font-size: 16px;
  }

  /* 手機版箭頭位置修正 */
  /* 由於變成了兩列，如果不寫 JS 判斷列數，箭頭指的位置可能會怪怪的。
       簡單做法：手機版時，我們將箭頭固定在中央，或者隱藏箭頭。
       參考圖是桌機版，手機版通常建議將箭頭隱藏，因為卡牌分兩行，對話框卻只有一個在最下面。 */

  .box-arrow {
    /* 方案 A: 隱藏箭頭 (最安全) */
    /* display: none; */

    /* 方案 B: 讓箭頭跟隨點擊 (稍後在 JS 處理) */
  }
}

/* --- 結果頁：底部常駐按鈕區 --- */
.result-action-group {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  margin-bottom: 80px;
  flex-wrap: wrap;
}

/* 按鈕共用樣式 */
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px; /* 增加一點圖示與文字的距離 */
  padding: 12px 24px;
  border-radius: 20px;
  text-decoration: none;
  font-size: 18px;
  font-weight: bold;
  letter-spacing: 0.5px;
  transition: transform 0.2s, opacity 0.2s;

  /* 預設邊框 (給空心按鈕用) */
  border: 2px solid transparent;
}

.action-btn:hover {
  transform: translateY(-3px);
  opacity: 0.95;
}

/* 確保按鈕內的圖片大小適中 */
.action-btn img {
  width: 30px;
  height: 30px;
  display: block; /* 避免圖片下方多餘空隙 */
}

/* --- 1. FB 按鈕樣式 (新色碼 #00458D) --- */
.btn-fb {
  background-color: #00458d; /* 更新顏色 */
  color: white;
}

/* --- 2. LINE 按鈕樣式 (新色碼 #1E7952) --- */
.btn-line {
  background-color: #1e7952; /* 更新顏色 */
  color: white;
}

/* --- 3. 再抽一個類別 (紅框 + 純 CSS 圓底箭頭) --- */
.btn-redraw {
  background-color: white;
  color: #b2292e; /* 文字維持深紅 */
  border-color: #b2292e; /* 邊框深紅 */
}

/* 🔥 純 CSS 繪製：紅色圓形底 */
.arrow-circle {
  display: flex;
  justify-content: center;
  align-items: center;

  width: 30px; /* 圓圈大小 */
  height: 30px;
  background-color: #b2292e; /* 圓圈背景色 */
  border-radius: 50%; /* 變成圓形 */
}

/* 🔥 純 CSS 繪製：白色向下箭頭 */
/* 利用偽元素 ::before 在紅圈圈裡面畫線 */
.arrow-circle::before {
  content: "";
  width: 6px; /* 箭頭寬度 */
  height: 6px; /* 箭頭高度 */

  /* 畫出兩條邊線 */
  border-right: 2px solid white;
  border-bottom: 2px solid white;

  /* 旋轉 45 度變成 "V" 型 (向下箭頭) */
  transform: rotate(45deg);

  /* 微調位置，讓視覺置中 */
  margin-bottom: 3px;
}

/* --- RWD 手機版調整 (維持不變) --- */
@media (max-width: 768px) {
  .result-action-group {
    flex-direction: column;
    gap: 12px;
    width: 100%;
    padding-left: 15px;
    padding-right: 15px;
  }

  .action-btn {
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    font-size: 16px;
  }

  .action-btn img {
    width: 25px;
    height: 25px;
  }

  .arrow-circle {
    width: 25px;
    height: 25px;
  }
}

/* === 結果頁專用：回到頂端按鈕  === */
.result-top-btn {
  position: fixed;
  bottom: 30px;
  right: 30px;

  /* 改回圓形與白色背景 */
  width: 50px;
  height: 50px;
  background-color: white;
  border-radius: 50%; /* 圓形 */

  /* 陰影讓它在頁面上更明顯 */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);

  display: flex;
  justify-content: center;
  align-items: center;

  cursor: pointer;
  z-index: 9999;

  /* 初始狀態：隱藏 */
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

/* 顯示狀態 */
.result-top-btn.show {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

/* Hover 效果 */
.result-top-btn:hover {
  background-color: #f5f5f5; /* 微微變灰，增加互動感 */
  transform: translateY(-5px);
}

/* 繪製內部箭頭 (改回紅色 #B2292E) */
.arrow-up-icon {
  width: 14px;
  height: 14px;

  /* 🔥 關鍵：改成紅色線條 */
  border-top: 3px solid #b2292e;
  border-left: 3px solid #b2292e;

  /* 旋轉 45 度變成向上箭頭 */
  transform: rotate(45deg);
  margin-top: 4px; /* 視覺微調 */
}

/* RWD 手機版微調 */
@media (max-width: 768px) {
  .result-top-btn {
    right: 20px;
    bottom: 20px;
  }
}

/* --- 1. 卡牌依序進場動畫 (Card Entrance) --- */
/* 定義動畫：從下方浮上來並顯現 */
@keyframes card-enter {
  0% {
    opacity: 0;
    transform: translateY(30px);
  }
  100% {
    opacity: 1;
    transform: translateY(0);
  }
}

/* 應用到卡牌上 */
.cards-select-grid .card-option {
  opacity: 1;

  /* 2. 將 forwards 改為 backwards */
  /* backwards 的意思是：在 animation-delay 等待期間，先套用 0% 的樣式 (也就是 opacity: 0) */
  animation: card-enter 0.8s cubic-bezier(0.2, 0.8, 0.2, 1) backwards;
}

/* 設定延遲時間，製造「依序發牌」的效果 */
.cards-select-grid .card-option:nth-child(1) {
  animation-delay: 0.1s;
}
.cards-select-grid .card-option:nth-child(2) {
  animation-delay: 0.2s;
}
.cards-select-grid .card-option:nth-child(3) {
  animation-delay: 0.3s;
}
.cards-select-grid .card-option:nth-child(4) {
  animation-delay: 0.4s;
}

/* --- 2. 解說框魔法展開動畫 (Box Reveal) --- */
/* 定義動畫：稍微縮小＋淡入＋上浮 */
@keyframes box-reveal {
  0% {
    opacity: 0;
    transform: translateY(20px) scale(0.98);
  }
  100% {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* 這是 JS 點擊後會動態加上的 class */
.explanation-box.reveal-animate {
  animation: box-reveal 0.5s ease-out forwards;
}
