/* ===================== 基本設定 ===================== */
body {
  margin: 0;
  font-family: "Noto Sans TC", sans-serif;
  background-color: #2a1c15;
  color: #fff;
  text-align: center;
}

header { background: #5c3d2e; padding: 1.5rem; font-size: 1.5rem; }
main   { margin-top: 0; padding-bottom: 48px; }

/* ===================== 16:9 等比例舞台 ===================== */
.altar-stage{
  position:relative;
  width:min(95vw,1800px);
  aspect-ratio:16/9;
  margin:0 auto;
  overflow:hidden;
  background:#000;
}
.altar-bg{
  position:absolute; inset:0;
  width:100%; height:100%;
  object-fit:contain; object-position:center; z-index:0;
}

/* ===================== 香爐 ===================== */
.censer-area{
  position:absolute; left:52%; bottom:0%;
  transform:translateX(-50%); z-index:2;
}
.censer{ width:90%; height:auto; display:block; }

/* ===================== 插香容器（Bounding Box） ===================== */
/* 只要改呢三個就得：左右範圍 / 香大小 / 香灰面高度 */
:root{
  --incense-width: 40%;   /* ← 左右範圍（對齊香爐內槽）*/
  --incense-height: 28%;  /* ← 香嘅“高度”＝香大小 */
  --incense-bottom: 15%;  /* ← 香灰面高度（整體上落微調）*/
}

#incenseContainer{
  position:absolute;
  left:50%; transform:translateX(-50%);
  bottom:var(--incense-bottom);
  width:var(--incense-width);
  height:var(--incense-height);
  pointer-events:none; z-index:3;



  /* 重要：唔用 flex，畀 JS 用 left 隨機排位，先唔會出界 */
  display:block;
}

/* 單支香：保持原圖比例，由 JS 設寬度，不會出框 */
#incenseContainer .stick{
  position:absolute;
  bottom:-0%;            /* 少少插入灰面更自然（要貼面就用 0%）*/
  height:auto;
  transform-origin:bottom center;
  image-rendering:auto;
}

/* ===================== 計數器 / 按鈕 ===================== */
.counter { font-size:1.5rem; margin-top:1rem; }
.offer-btn{
  margin-top:.8rem; padding:1rem 2.2rem; font-size:1.5rem;
  background:#c77d44; color:#fff; border:none; border-radius:10px;
  cursor:pointer; transition:.25s;
}
.offer-btn:hover{ background:#a35d2f; transform:scale(1.05); }
footer{ background:#5c3d2e; padding:1rem; font-size:.9rem; }



/* --- 香枝外層（承載火焰） --- */
#incenseContainer .stickWrap{
  position:absolute; bottom:0; /* 其他屬性由 JS 內聯設定 */
  transform-origin: bottom center;
  z-index: 3;                 /* 在煙之下（煙是 z=4） */
}

/* --- 火焰（用元素，不再用 ::after） --- */
#incenseContainer .flame{
  position:absolute;
  left:50%;
  bottom: calc(71% - 4px);
  transform: translateX(-50%);
  width:10px; height:14px;
  background: radial-gradient(closest-side, rgba(255,190,60,.95),
                               rgba(255,120,0,.55) 60%,
                               rgba(255,120,0,0) 70%);
  filter: blur(.6px);
  opacity:.95;
  pointer-events:none;
  z-index:5;
  animation: flameFlicker .8s ease-in-out infinite alternate;
}

/* （你原本已經有） */
@keyframes flameFlicker{
  0%   { transform: translateX(-50%) translateY(0)    scale(.95); opacity:.85; }
  100% { transform: translateX(-50%) translateY(-1px) scale(1.05); opacity:1; }
}

/* --- 加強煙霧存在感（保留你定位與動畫） --- */
#incenseContainer .smoke span{
  width: 18px;           /* 由 14 提到 18，少少大啲易見 */
  height: 18px;
  filter: blur(3px);     /* 多少少柔化 */
  opacity: .50;          /* 稍為濃啲（如嫌濃可改回 .35~.4） */
}
/* ====== 上香模式表單 ====== */
.offer-form {
  margin: 15px auto;
  display: flex;
  justify-content: center;
  gap: 10px;
  font-size: 1.1rem;
  align-items: center;
}
.offer-form input[type="text"] {
  padding: 6px 10px;
  border: 1px solid #ccc;
  border-radius: 6px;
  min-width: 180px;
}

/* ====== 上香名單 ====== */
.offer-log {
  width: min(95vw, 600px);
  margin: 30px auto;
  padding: 15px;
  background: rgba(255,255,255,0.08);
  border-radius: 12px;
  text-align: left;
}
.offer-log h3 {
  margin-top: 0;
  font-size: 1.3rem;
}
#offerList {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 250px;
  overflow-y: auto;
}
#offerList li {
  display: flex;
  justify-content: space-between;
  padding: 6px 0;
  border-bottom: 1px dashed rgba(255,255,255,0.2);
}
#offerList li:last-child {
  border-bottom: none;
}
.podcast-players {
  margin-top: 40px;
  text-align: center;
}

.podcast-players h2 {
  font-size: 1.8rem;
  color: #f7d774;
  margin-bottom: 20px;
}

.player-row {
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  justify-content: center;
}

.player-row iframe {
  flex: 1 1 30%;
  min-width: 320px;
  max-width: 420px;
  height: 450px;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.ad-section {
  width: min(95vw, 800px);
  margin: 40px auto;
  padding: 10px;
  background: rgba(255,255,255,0.05);
  border-radius: 12px;
  text-align: center;
}
/* --- Navbar --- */
.site-nav{
  position: sticky; top: 0; z-index: 100;
  display: flex; gap: 14px; justify-content: center; align-items: center;
  padding: 10px 12px; background: rgba(0,0,0,.5); backdrop-filter: blur(6px);
}
.site-nav a{ color:#fff; text-decoration:none; padding:6px 10px; border-radius:8px; }
.site-nav a:hover{ background: rgba(255,255,255,.08); }

/* --- 信任頁面總覽（三欄，手機自動折行） --- */
.trust-blocks {
  width: min(95vw, 1000px);
  margin: 28px auto;
  padding: 24px 16px 20px;
  background: rgba(255,255,255,.06);
  border-radius: 12px;
  text-align: left;
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(3, 1fr);
  align-items: stretch;
  overflow: hidden;
  box-sizing: border-box;
  max-width: 1000px;      /* ✅ 加這行 */
}


@media (max-width: 980px){ .trust-blocks{ grid-template-columns: 1fr 1fr; } }
@media (max-width: 640px){ .trust-blocks{ grid-template-columns: 1fr; } }

.trust-blocks article{
  background: rgba(255,255,255,.06);
  border-radius: 12px;
  padding: 16px;
  text-align: left;
  min-height: 240px;         /* ← 新增：統一高度 */
}

.trust-blocks h3{ margin: 0 0 8px; }
.trust-blocks p{
  margin: 0 0 12px;
  color: #eee;
  display: -webkit-box;          /* ← 新增 */
  -webkit-line-clamp: 3;         /* ← 新增：最多 3 行 */
  -webkit-box-orient: vertical;  /* ← 新增 */
  overflow: hidden;              /* ← 新增 */
  word-break: break-word;        /* ← 新增：長字/URL 斷行 */
}

.trust-blocks .btn{
  display: inline-block; padding: 8px 12px; border-radius: 10px;
  background: #c77d44; color:#fff; text-decoration:none; font-weight:600;
}
.trust-blocks .btn:hover{ background:#a35d2f; }

/* 卡片容器（信任區塊） */
.trust-blocks article {
  display: flex;
  flex-direction: column;
  justify-content: space-between; /* 讓按鈕自動貼到底 */
  height: 100%; /* 每個卡片同高度 */

  margin-top: 4px;   /* 令內卡片同外框有少少錯位感，不會「貼齊」 */

}

/* 卡片內段落 */
.trust-blocks article p {
  flex: 1; /* 自動填充空間 */
}

/* 統一按鈕樣式 */
.trust-blocks .btn {
  display: inline-block;
  width: fit-content;
  margin-top: auto; /* 永遠貼到底 */
  padding: 8px 16px;
  background: #c77d44;
  color: #fff;
  text-decoration: none;
  border-radius: 8px;
  font-weight: 600;
  text-align: center;
}

.trust-blocks .btn:hover {
  background: #a35d2f;
}




/* === 足福幣列 === */
.coins-bar{
  width: min(95vw, 1000px);
  margin: 16px auto;
  padding: 10px 14px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.coins-bar .coins-left{ font-size: 1.2rem; }
.btn-coin{
  padding: 8px 14px; border: none; border-radius: 10px;
  background: #f1c40f; color: #2a1c15; font-weight: 700; cursor: pointer;
}
.btn-coin:hover{ filter: brightness(.95); }




/* === 善心動物（GIF） === */
.pets-section{
  width: min(95vw, 1000px);
  margin: 28px auto;
  padding: 16px;
  background: rgba(255,255,255,.06);
  border-radius: 12px;
  text-align: left;
}
.pets-section h3{ margin: 0 0 12px; }

.pet-shop{ display: flex; flex-wrap: wrap; gap: 10px; margin-bottom: 14px; }
.pet-btn{
  padding: 10px 14px; border: none; border-radius: 10px;
  background: #c77d44; color:#fff; font-weight:700; cursor:pointer;
}
.pet-btn:hover{ background:#a35d2f; }

.pet-kennel{
  display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
}
.pet-card{
  position: relative;
  background: rgba(0,0,0,.35);
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;
  padding: 12px;
  overflow: hidden;

  min-height: 320px;            /* 比農場地塊更高，避免貓頭被裁 */
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}



.pet-kennel{
  display: grid;
  grid-template-columns: repeat(3, 1fr);  /* ← 固定三欄 */
  gap: 12px;
}

.pet-card {
  min-height: 240px; /* ✅ 保證高度和農場 plot 一樣 */
}


/* === 寵物坐墊（無需改 HTML）=== */
/* === 寵物坐墊（::before）— 用比例寬度 + 固定高度，確保夠大又居中 === */
/* 坐墊：大／居中，尺寸近似農場土地 */
/* 坐墊接近地塊大小（70~90% 視覺最自然） */
.pet-card::before{
  content:"";
  position:absolute;
  left:50%;
  bottom: -40px;                       /* 墊與按鈕留距離 */
  width: min(90%, 520px);             /* ← 關鍵：放大 */
  aspect-ratio: 1 / 1;                /* 你的素材是圓形，就用 1:1 */
  transform: translateX(-50%);
  background:url("./assets/pets/cushion.png") center/contain no-repeat;
  z-index: 0;
  pointer-events: none;
}



/* === 貓固定喺坐墊上（停用飄行）=== */
/* 貓固定坐在墊上（停用飄動畫） */
/* 改用 PNG：固定喺坐墊上 */
.pet-img{
  position: absolute;
  left: 50%;
  bottom: 80px;              /* 要貼近坐墊就再細少少，如 70px */
  transform: translateX(-50%);
  width: 56%;
  max-width: 260px;
  object-fit: contain;
  z-index: 2;
}








/* 名字固定在改名鍵上方，置中 */
/* 名字放左上角，旁邊一支筆；點名字可改名 */
.pet-name{
  position: absolute;
  left: 12px;
  top: 10px;
  font-size: 16px;
  font-weight: 700;
  color: #fff;
  z-index: 3;
  cursor: pointer;
}
.pet-name::after{ content:" ✎"; opacity:.9; }
.pet-card.empty .pet-name{ opacity:.6; cursor: default; }


.pet-tip{ margin-top: 10px; opacity: .85; }



.rename-btn {
  margin-top: auto;            /* ← 就放喺同一個區塊 */
  padding: 6px 10px;
  font-size: 0.9rem;
  background: #f1c40f;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  color: #2a1c15;
  font-weight: bold;
}
.rename-btn:hover { background: #d4ac0d; }





/* === 善心農場（Beta） === */
.farm-section{
  width: min(95vw, 1000px);
  margin: 28px auto;
  padding: 16px;
  background: rgba(255,255,255,.06);
  border-radius: 12px;
  text-align: left;
}
.farm-section h3{ margin: 0 0 12px; }

.farm-tip{ opacity: .9; margin-bottom: 10px; }
.farm-toolbar{ display: flex; gap: 10px; align-items: center; margin-bottom: 12px; }

.farm-grid{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
@media (max-width: 720px){ .farm-grid{ grid-template-columns: 1fr; } }

/* === 農場：統一土地樣式 === */
.farm-section .plot{
  position: relative;
  min-height: 240px;
  border: 1px solid rgba(255,255,255,.12);
  border-radius: 12px;

  /* 荒地底圖（未播種時都會顯示） */
  background-color: rgba(0,0,0,.25);
  background-image: url("./assets/farm/plot_empty.png") !important;
  background-position: center;
  background-repeat: no-repeat;
  background-size: 75%;
}

/* 置中顯示作物階段圖 */
.farm-section .plot .crop-img{
  position: absolute;
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
  width: min(75%, 260px);
  height: auto;
  display: none;         /* 未播種時隱藏 */
  z-index: 2;
}
/* 收割時金幣彈出動畫 */
.coin-pop{
  position: absolute;
  left: 50%; top: 40%;
  transform: translate(-50%, -50%);
  width: 120px;          /* 放大金幣 */
  height: auto;
  z-index: 3;            /* 確保蓋在作物圖上層 */
  pointer-events: none;
  animation: coinFloat 1.6s ease-out forwards;
}
@keyframes coinFloat{
  0%   { opacity: 0; transform: translate(-50%, -20%) scale(.9); }
  15%  { opacity: 1; transform: translate(-50%, -40%) scale(1.0); }
  100% { opacity: 0; transform: translate(-50%, -120%) scale(1.1); }
}



.adopt-slot{
  position: absolute;
  left: 12px;
  bottom: 12px;
  right: 12px;
  display: flex;
  gap: 8px;
  z-index: 2;
}
.adopt-select{
  flex: 1 1 auto;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,.15);
  background: #241a15;
  color: #fff;
}
.adopt-confirm{
  flex: 0 0 80px;
  border: none;
  border-radius: 8px;
  background: #f1c40f;
  color: #2a1c15;
  font-weight: 700;
  cursor: pointer;
}
.adopt-confirm:hover{ background:#d4ac0d; }




/* —— 善心動物 —— */
.adopt-bar{
  display:flex; align-items:center; gap:10px; flex-wrap:wrap;
  background:#3a2a22; padding:12px; border-radius:12px; border:1px solid #52382b;
  margin:16px 0;
}
.cost-note{ color:#ffd9a8; }
#adoptBtn.disabled{ opacity:.6; cursor:not-allowed; }

.pet-list{
  display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:14px;
}
.pet-card, .slot-card{
  background:#3a2a22; border:1px solid #52382b; border-radius:16px; overflow:hidden;
  display:flex; flex-direction:column;
}
.display{ position:relative; aspect-ratio:4/3; display:grid; place-items:center; padding:10px; }
.display img{ user-select:none; pointer-events:none; }
.display img.cushion{
  position:absolute; bottom:8px; left:50%; transform:translateX(-50%);
  width:72%; filter:drop-shadow(0 4px 10px rgba(0,0,0,.35));
}
.pet-card img.pet{
  position:absolute; bottom:42%; left:50%; transform:translate(-50%,0);
  width:62%;
}
.meta{
  display:flex; align-items:center; justify-content:space-between; gap:8px;
  padding:10px 12px; border-top:1px solid #52382b;
}
.name-line{ display:flex; align-items:center; gap:6px; min-width:0; }
.pet-name{ font-weight:700; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.icon-btn{
  display:inline-flex; align-items:center; justify-content:center;
  width:28px; height:28px; border-radius:8px; background:#2d1f18; border:1px solid #52382b;
  cursor:pointer; color:#ffe6c9;
}
.icon-btn svg{ display:block; fill:#ffe6c9; }
.slot-meta{ display:flex; align-items:center; justify-content:center; padding:10px 12px; border-top:1px solid #52382b; min-height:46px; }
.slot-tip{ color:#ffd9a8; font-size:14px; }


/* --- 修正善心動物卡片的標題/按鈕排列 --- */
.pets-grid .pet-card .card-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-bottom:6px;
}
.pets-grid .pet-card .pet-name{
  max-width: 65%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
}
.pets-grid .pet-card .rename-btn{
  min-width: 28px;
  height: 28px;
  display: inline-flex;
  align-items:center;
  justify-content:center;
  border-radius: 8px;
}
.pets-grid .pet-card .actions{
  display:flex;
  justify-content:flex-end;
  margin-top:8px;           /* 把棄養掣推落一點，避免同上行重疊 */
}

/* --- 善心動物卡片排版修正 --- */
.pets-grid .pet-card .card-head{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:8px;
  margin-bottom:6px;
}
.pets-grid .pet-card .pet-name{
  max-width: 65%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 700;
}
.pets-grid .pet-card .actions{
  display:flex;
  justify-content:flex-end;
  margin-top:8px;
}


/* --- 善心動物卡片（套用在 .pet-kennel 版本） --- */

/* 卡片：加頂部內距，預留「名字」位置 */
.pet-kennel .pet-card{
  padding-top: 42px;   /* 預留頂部空間，避免上方重疊 */
}

/* 名字列（沿用你 .pet-name 的絕對定位即可） */

/* 已領養時的「棄養」按鈕：固定在右下角 */
.pet-kennel .pet-card .pet-actions{
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  gap: 8px;
  z-index: 3;
}

/* 空位卡片：只顯示「領養區」在底部，沒有棄養 */
.pet-kennel .pet-card.empty .pet-actions{
  display: none !important;
}

/* 空位的領養區：你現有的 adopt-slot 已經絕對定位在底部 */

/* ===== PET SIZE OVERRIDE（可調整）===== */
/* 調大/細整體寵物尺寸：改這兩個數值即可 */
:root {
  --pet-width: 220px;      /* 🡐 主要控制：動物寬度（例：180px / 220px / 260px） */
  --cushion-width: 260px;  /* 🡐 墊子寬度（比動物稍大一點會好看） */
}
:root{
  --pet-bottom: -45px;     /* 寵物距離卡片底部的距離（向下移就加大）*/
  --pet-percent: 92%;     /* 寵物以卡片寬度的比例（放大縮細）*/
}


/* === 寵物圖片（統一版）：同時兼容 .pet 及 .pet-img === */
.pet-card { position: relative; } /* 保險：確保絕對定位以卡片為參考 */

.pet-card img.pet,
#pets .pet-img {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  bottom: var(--pet-bottom);   /* ← 向下移就改呢度，例如 70px / 100px */
  width: var(--pet-percent);   /* ← 放大縮細（以卡片寬度%計），例如 60%/70% */
  max-width: none;             /* 解除舊限制 */
  height: auto;
  object-fit: contain;
  z-index: 2;
}
.pets-section, .coins-bar, .offer-log { position: relative; z-index: 5; }

/* === Layout bottom spacing tweaks (requested) === */
.trust-blocks{ margin-bottom: 48px; padding-bottom: 24px; }
.coins-bar, .offer-log, .pets-section, .farm-section, .ad-section{ margin-bottom: 36px; }
footer{ margin-top: 28px; }

/* === 頁首右上角：用戶登入 + 足福幣（共用） === */
.site-nav{ position: sticky; top:0; z-index:100; }
.nav-user-area{
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.nav-user-area .coin-pill{
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(241,196,15,.2);
  border: 1px solid rgba(241,196,15,.55);
  color: #ffe08a;
  font-weight: 800;
  font-size: .95rem;
  white-space: nowrap;
}
.nav-user-area .acct-input{ 
  width: 140px; max-width: 32vw;
  padding: 6px 8px; border-radius: 8px; border: 1px solid rgba(255,255,255,.2);
  background: #241a15; color: #fff; height: 32px; line-height: 20px;
}
.nav-user-area .acct-btn{
  padding: 6px 10px; border-radius: 8px; border: none; cursor: pointer;
  background: #f1c40f; color: #2a1c15; font-weight: 800;
}
.nav-user-area .acct-btn:hover{ filter: brightness(.95); }
.nav-user-area .acct-hint{ color: #ffd9a8; font-size: .9rem; }
@media (max-width: 880px){
  .nav-user-area .acct-input{ width: 110px; }
  .nav-user-area .acct-hint{ display:none; }
}
/* === Ads placement — 兩側縱向 + 底部橫幅 === */
.ad-left, .ad-right {
  position: fixed;
  top: 100px;              /* 讓出導覽列空間 */
  width: 160px;
  height: 600px;
  z-index: 9999;
}
.ad-left  { left: 10px; }
.ad-right { right: 10px; }

/* 底部橫幅容器本身你已有 .ad-section，這裡只做通用間距保險 */
.ad-section { margin: 40px auto; }

/* 📱 手機／窄螢幕自動隱藏左右縱向（只留底部橫幅） */
@media (max-width: 1024px){
  .ad-left, .ad-right { display: none; }
}
