.top-theme-banner img {
  object-fit: cover;
  object-position: center center;
  width: 100%;
  aspect-ratio: 5.3/1;
}
.bookshelf-container {
  padding: 90px 30px;
  box-sizing: border-box;
  display: flex;
  max-width: 1620px;
  margin: 0 auto;
}
/* 搜尋列相關 */
.search-panel {
  background-color: #AFD2A5;
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 20px;
  flex-direction: column;
  font-size: 16px;
}
.search-container {
  display: flex;
  max-width: 500px;
  width: 100%;
  align-items: center;
  color: #000;
  background-color: #fff;
  line-height: 2;
  overflow: hidden;
  border-radius: 3px;
}
.search-container label {
  white-space: nowrap;
  margin: 0;
  padding: 0.25em 1em;
  background-color: #F5E6C3;
}
input[type="text"].search-input {
  flex: 1;
  border: none;
  padding: 0.25em 1em;
  font-size: 16px !important;
  outline: none;
}
.trend-keywords {
  display: flex;
  white-space: nowrap;
  align-items: center;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
.trend-keywords ul {
  display: flex;
  list-style: none;
  padding: 0 15px;
  gap: 20px;
  justify-content: space-between;
  margin-bottom: 0;
}
.trend-keywords a {
  color: #000;
  padding-bottom: 1px;
  border-bottom: 1px dashed #333;
  transition: all .2s
}
.trend-keywords a:hover {
  text-decoration: none;
  border-bottom: 1px dashed #f00;
}
/* 主內容區樣式 */
.main-content {
  flex: 1;
}
.book-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 25px;
}
.book-card {
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);
  transition: transform 0.3s ease, box-shadow 0.3s ease;
  display: flex;
  flex-direction: column;
}
.book-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 10px 15px rgba(0, 0, 0, 0.1);
}
/* 封面疊圖設計 */
.book-cover {
  width: 100%;
  aspect-ratio: 3 / 4;
  position: relative;
  background-color: #f5f5f5;
  overflow: hidden;
}
.book-cover img.bg-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 1; /* 底層 */
}
.book-cover img.title-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 2; /* 疊在上方 */
}
/* 書籍資訊 */
.book-inf {
  padding: 15px 15px 5px 15px;
  text-align: center;
  flex-grow: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.book-title {
  margin: 0 0 5px 0;
  font-size: 18px;
  font-weight: 600;
  color: #503C28;
}
.book-author {
  margin: 0 0 10px 0;
  font-size: 0.85rem;
  color: #333;
}
/* 雙按鈕動作區 */
/* 雙按鈕動作區 */
.book-actions {
  display: flex;
  gap: 10px;
  padding: 0 15px 15px 15px;
}
/* 卡片專屬按鈕微調 (覆寫共用 eb-btn) */
.book-actions a.card-btn {
  flex: 1; /* 讓兩個按鈕均分寬度 */
  border: 1px solid transparent; /* 預設留空邊框避免跳動 */
  font-size: 14px; /* 卡片空間較小，字體稍微調小 */
  padding: 4px 10px 4px 4px; /* 稍微縮小內距，但依然保留左側完美同心圓比例 */
  background-color: transparent;
}
.book-actions a.card-btn:hover {
  border-color: #e0e0e0; /* hover 時因為卡片是白底，所以給予灰色邊框作區隔 */
  background-color: #ffffff; /* 浮出白底 */
}
/* 篩選無結果樣式 */
.no-results {
  grid-column: 1 / -1;
  text-align: center;
  padding: 50px;
  color: #999;
}
/* 響應式佈局 */
@media (max-width: 1024px) {
  .book-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}
@media (max-width: 768px) {
  .bookshelf-container {
    flex-direction: column;
    padding: 30px 10px; /* 降低 padding，左右不超過 10px */
  }
  .sidebar {
    flex: none;
    position: relative;
    top: 0;
    margin-bottom: 20px;
  }
  .book-grid {
    grid-template-columns: 1fr; /* 改為單欄以適應水平卡片 */
  }
  
  /* 手機版水平書籍卡片設計 */
  .book-card {
    display: grid;
    grid-template-columns: 40% 1fr; /* 左邊封面至少佔 40%，右邊自適應 */
    grid-template-rows: 1fr auto;
    grid-template-areas: 
      "cover info"
      "cover actions";
  }
  .book-cover {
    grid-area: cover;
    height: 100%;
  }
  .book-inf {
    grid-area: info;
    align-items: flex-start; /* 靠左對齊 */
    text-align: left;
    justify-content: flex-start;
  }
  .book-actions {
    grid-area: actions;
    padding-top: 0;
  }
  .book-actions a.card-btn {
    flex-direction: column;
  }
}
@media (max-width: 480px) {
  .book-card {
    grid-template-columns: 42% 1fr; /* 螢幕更小時封面比例維持 40% 以上 */
  }
}
/* 針對清除按鈕的樣式補充 */
.clear-btn {
  background: none;
  border: none;
  font-size: 1.5rem;
  line-height: 1;
  color: #999;
  cursor: pointer;
  padding: 0 10px;
  display: none; /* 預設隱藏，有文字時才顯示 */
  transition: color 0.2s;
}
.clear-btn:hover {
  color: var(--primary-color, #e67e22);
}
/* 搜尋篩選用：.book-card 是 flex（手機為 grid），
   會壓過 [hidden] 的 UA 預設 display:none，必須明確覆寫 */
.book-card[hidden] { display: none !important; }
/* 推薦搜尋改用 <button>（原版是 <a href="javascript:void(0)"> + onclick），沿用同一組外觀 */
.trend-keywords .trend-kw {
  background: none;
  border: none;
  padding: 0 0 1px;
  color: #000;
  border-bottom: 1px dashed #333;
  transition: all .2s;
  cursor: pointer;
  font-size: inherit;
}
.trend-keywords .trend-kw:hover { border-bottom-color: #f00; }
