*{box-sizing:border-box;}

:root{
  --green-1:#0c5a27;
  --green-2:#1f7a32;
  --text:#163219;
  --muted:#5f6f5b;
  --line:#d9e7c6;
  --shadow:0 12px 30px rgba(15,60,21,.12);
}

html,body{
  margin:0;
  padding:0;
  background:linear-gradient(180deg,#f5fbe9 0%,#e6f4dc 100%);
  color:var(--text);
  font-family:"Microsoft JhengHei",Arial,sans-serif;
}

a{
  text-decoration:none;
  color:inherit;
}

img{
  max-width:100%;
  display:block;
}

.wrap{
  width:min(1200px,calc(100% - 32px));
  margin:0 auto;
}

/* Header */
.site-header{
  position:sticky;
  top:0;
  z-index:40;
  background:rgba(255,255,255,.92);
  backdrop-filter:blur(12px);
  border-bottom:1px solid rgba(31,122,50,.12);
}

.top-nav{
  display:flex;
  align-items:center;
  justify-content:space-between;
  gap:18px;
  padding:12px 0;
}

.brand{
  display:flex;
  align-items:center;
  gap:14px;
}

.brand img{
  width:62px;
  height:62px;
  border-radius:50%;
  box-shadow:var(--shadow);
}

.brand-text strong{
  display:block;
  font-size:24px;
  color:var(--green-1);
}

.brand-text small{
  display:block;
  color:#4e7a44;
  font-weight:700;
}

.menu{
  display:flex;
  flex-wrap:wrap;
  gap:14px;
}

.menu a{
  padding:10px 14px;
  border-radius:999px;
  font-weight:800;
  color:#356131;
}

.menu a:hover{
  background:#edf7d7;
  color:var(--green-1);
}

/* 漂浮廣告 */
.floating-ads{
  display:block;
}

.float-ad{
  position:fixed;
  bottom:12px;
  z-index:9999;
  background:#fff;
  border:1px solid var(--line);
  border-radius:14px;
  box-shadow:var(--shadow);
  overflow:visible;
}

.float-ad-left{
  left:8px;
}

.float-ad-right{
  right:8px;
  top:190px;
  bottom:auto;
}

.float-ad iframe{
  display:block;
  width:auto;
  height:auto;
  border:0;
  background:#fff;
  overflow:hidden;
}

.float-ad-close{
  position:absolute;
  top:-10px;
  right:-10px;
  width:26px;
  height:26px;
  border:none;
  border-radius:999px;
  background:rgba(0,0,0,.75);
  color:#fff;
  cursor:pointer;
  font-size:16px;
  line-height:26px;
  text-align:center;
  z-index:3;
}

/* 封面 */
.cover-banner{
  padding:18px 0 8px;
}

.cover-banner img{
  width:100%;
  max-height:420px;
  object-fit:cover;
  border-radius:28px;
  box-shadow:var(--shadow);
}

/* Hero */
.hero-card{
  margin:16px 0 10px;
}

.welcome-grid{
  display:grid;
  grid-template-columns:1.1fr .9fr;
  gap:24px;
  align-items:center;
  background:linear-gradient(135deg,rgba(234,252,197,.95),rgba(255,255,255,.92));
  border:1px solid rgba(12,90,39,.12);
  border-radius:28px;
  padding:26px;
  box-shadow:var(--shadow);
}

.pill{
  display:inline-flex;
  padding:9px 14px;
  border-radius:999px;
  background:linear-gradient(90deg,var(--green-2),var(--green-1));
  color:#fff;
  font-size:13px;
  font-weight:800;
}

.welcome-text h1{
  margin:16px 0 12px;
  font-size:54px;
  line-height:1.08;
  color:var(--green-1);
}

.welcome-text p{
  margin:0;
  color:#385437;
  font-size:18px;
  line-height:1.9;
  font-weight:700;
}

.hero-actions{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
  margin-top:22px;
}

.feature-points{
  display:grid;
  grid-template-columns:repeat(2,1fr);
  gap:10px;
  margin-top:20px;
}

.feature-points span{
  background:#fff;
  border:1px solid var(--line);
  border-radius:16px;
  padding:12px 14px;
  font-weight:800;
  color:#2e5f2d;
}

.welcome-visual img{
  width:100%;
  border-radius:26px;
  box-shadow:var(--shadow);
}

/* 搜尋 */
.search-bar{
  display:flex;
  gap:10px;
  flex-wrap:wrap;
  margin-top:18px;
}

.search-bar input{
  flex:1;
  min-width:240px;
  padding:13px 14px;
  border:1px solid var(--line);
  border-radius:14px;
  font:inherit;
  background:#fff;
}

/* 統計 */
.stats-bar{
  display:grid;
  grid-template-columns:repeat(4,1fr);
  gap:16px;
  margin:18px auto 6px;
}

.stat-box{
  background:#fff;
  border:1px solid var(--line);
  border-radius:22px;
  padding:18px;
  box-shadow:var(--shadow);
}

.stat-box strong{
  display:block;
  font-size:28px;
  color:var(--green-1);
}

.stat-box span{
  display:block;
  margin-top:8px;
  color:#56704c;
  font-weight:700;
}

/* 區塊 */
.section{
  padding:26px 0 34px;
}

.section-head{
  display:flex;
  justify-content:space-between;
  align-items:end;
  gap:16px;
  margin-bottom:18px;
}

.section-head h1,
.section-head h2{
  margin:0;
  font-size:38px;
  color:var(--green-1);
}

.section-head p{
  margin:6px 0 0;
  color:#56704c;
  font-weight:700;
}

/* 熱門排行 */
.top-ranking{
  display:grid;
  gap:12px;
}

.rank-item{
  display:flex;
  align-items:center;
  gap:14px;
  padding:14px 16px;
  background:#fff;
  border:1px solid var(--line);
  border-radius:18px;
  box-shadow:var(--shadow);
}

.rank-no{
  width:62px;
  height:62px;
  border-radius:16px;
  background:linear-gradient(180deg,#fff4a8,#ffe25b);
  display:flex;
  align-items:center;
  justify-content:center;
  font-weight:900;
  color:var(--green-1);
  font-size:20px;
  flex-shrink:0;
}

.rank-body strong{
  display:block;
  font-size:20px;
  color:var(--green-1);
}

.rank-body small{
  display:block;
  margin-top:4px;
  color:#56704c;
  font-weight:700;
}

/* 優惠卡片 */
.cards{
  display:grid;
  grid-template-columns:repeat(auto-fill, minmax(260px,1fr));
  gap:24px;
  align-items:stretch;
}

.offer-card,
.empty-box,
.detail-box,
.panel,
.login-box{
  background:#fff;
  border:1px solid var(--line);
  border-radius:24px;
  box-shadow:var(--shadow);
}

.offer-card{
  padding:22px;
  display:flex;
  flex-direction:column;
  gap:4px;
  min-height:300px;
  border-radius:24px;
  transition:transform .18s ease, box-shadow .18s ease;
}

.offer-card:hover{
  transform:translateY(-3px);
  box-shadow:0 18px 36px rgba(15,60,21,.14);
}

.offer-card h3{
  margin:0;
  font-size:20px;
  line-height:1.35;
  color:var(--green-1);

}

.offer-card .desc{
  margin:0;
  color:#4b6548;
  line-height:1.75;
  font-weight:700;
  font-size:15px;
  display:-webkit-box;
  -webkit-line-clamp:2;
  -webkit-box-orient:vertical;
  overflow:hidden;
  min-height:52px;
}

.offer-logo-box{
  margin-top:4px;
  display:flex;
  align-items:center;
  justify-content:center;
}

.offer-logo-link{
  display:flex;
  align-items:center;
  justify-content:center;
  width:100%;
  height:170px;
  padding:0;
  background:transparent;
  border:none;
}

.offer-logo-link:hover{
  transform:translateY(-2px);
  border-color:#a8c98d;
  box-shadow:0 10px 20px rgba(15,60,21,.08);
}


.offer-logo{
  width:auto;
  height:140px;
  max-width:100%;
  object-fit:contain;
}

.offer-logo-fallback{
  display:flex;
  align-items:center;
  justify-content:center;
  width:360px;
  height:240px;
  padding:10px 14px;
  border:1px solid var(--line);
  border-radius:14px;
  background:#fff;
  color:var(--green-1);
  font-weight:900;
  text-align:center;
  font-size:20px;
}

/* 按鈕 */
.btn{
  display:inline-flex;
  align-items:center;
  justify-content:center;
  border:none;
  border-radius:14px;
  padding:13px 18px;
  font-weight:900;
  cursor:pointer;
}

.btn.sm{
  padding:10px 14px;
}

.btn-primary{
  background:linear-gradient(180deg,#2ea339,#146326);
  color:#fff;
}

/* 後台 / 表單 */
.detail-box,
.panel,
.login-box{
  padding:24px;
}

.login-box{
  max-width:560px;
  margin:0 auto;
}

.form{
  display:grid;
  gap:14px;
}

.form label{
  display:grid;
  gap:8px;
  font-weight:800;
  color:var(--green-1);
}

.form input,
.form select,
.form textarea{
  width:100%;
  padding:13px 14px;
  border:1px solid var(--line);
  border-radius:14px;
  font:inherit;
  background:#fff;
}

.form textarea{
  min-height:120px;
  resize:vertical;
}

.alert{
  padding:12px 14px;
  border-radius:14px;
  background:#fee2e2;
  color:#991b1b;
  margin-bottom:14px;
}

.admin-grid{
  display:grid;
  grid-template-columns:1fr 1fr;
  gap:18px;
}

.admin-list{
  display:grid;
  gap:12px;
}

.admin-item{
  display:flex;
  justify-content:space-between;
  gap:16px;
  align-items:center;
  padding:14px;
  border:1px solid var(--line);
  border-radius:16px;
  background:#fff;
}

.admin-item p{
  margin:6px 0 0;
  color:#56704c;
}

.admin-actions{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}

/* Footer */
.site-footer{
  margin-top:26px;
  background:linear-gradient(180deg,#145624,#0b451c);
  color:#f4ffe7;
  padding:34px 0;
}

.footer-grid{
  display:grid;
  grid-template-columns:1.2fr .8fr 1fr;
  gap:24px;
}

.footer-brand{
  display:flex;
  gap:14px;
  align-items:flex-start;
}

.footer-brand img{
  width:72px;
  height:72px;
  border-radius:50%;
}

.site-footer h3,
.site-footer h4{
  margin-top:0;
}

.site-footer p,
.site-footer li,
.site-footer a{
  color:#e7ffd5;
}

.site-footer ul{
  padding-left:18px;
}

.empty-box{
  padding:24px;
  text-align:center;
  color:#56704c;
}

/* RWD */
@media (max-width:1600px){
  .float-ad-left{left:4px;}
  .float-ad-right{right:4px;}
}

@media (max-width:1100px){
  .welcome-grid,
  .cards,
  .footer-grid,
  .stats-bar,
  .feature-points,
  .admin-grid{
    grid-template-columns:1fr 1fr;
  }
}

@media (max-width:760px){
  .top-nav{
    flex-direction:column;
    align-items:flex-start;
  }

  .welcome-grid,
  .cards,
  .footer-grid,
  .stats-bar,
  .feature-points,
  .admin-grid{
    grid-template-columns:1fr;
  }

  .welcome-text h1{
    font-size:38px;
  }

  .section-head h1,
  .section-head h2{
    font-size:30px;
  }

  .menu{
    gap:8px;
  }
}
/* 首頁左半邊往上 */
.welcome-grid{
  align-items:start;
}

.welcome-text-top{
  padding-top:4px;
}

/* 左下輪播廣告 */
.hero-slider{
  position:relative;
  margin-top:16px;
  width:100%;
  height:570px;          /* 固定框高度 */
  border-radius:22px;
  overflow:hidden;       /* 超出直接裁掉 */
  background:#fff;
  border:1px solid var(--line);
  box-shadow:var(--shadow);
}

.hero-slider-link{
  position:absolute;
  inset:0;               /* top/right/bottom/left 全 0 */
  display:none;
  width:100%;
  height:100%;
  align-items:center;
  justify-content:center;
  background:#fff;
}

.hero-slider-link.active{
  display:flex;
}

.hero-slider-link img{
  width:100%;
  height:100%;
  object-fit:contain;     /* 填滿框，不變形 */
  display:block;
}

.hero-slider-dots{
  position:absolute;
  left:50%;
  bottom:12px;
  transform:translateX(-50%);
  display:flex;
  gap:8px;
  z-index:3;
}

.hero-dot{
  width:10px;
  height:10px;
  border:none;
  border-radius:999px;
  background:rgba(255,255,255,.75);
  cursor:pointer;
  padding:0;
}

.hero-dot.active{
  background:#0c5a27;
}

@media (max-width:760px){
  .hero-slider{
    height:220px;
  }
}