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

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: linear-gradient(rgba(250,247,243,.30), rgba(250,247,243,.30)),
              url("assets/background.jpg") center center / cover fixed no-repeat;
  color: #37352f;
  display: grid;
  grid-template-columns: auto 1fr;   /* 側欄 | 右側 */
  grid-template-rows: auto 1fr;      /* header | 內容 */
  height: 100vh;
  overflow: hidden;
}
.sidebar    { grid-column: 1; grid-row: 1 / 3; }  /* 側欄跨兩列 = 全高 */
.app-header { grid-column: 2; grid-row: 1; }
.app-body   { grid-column: 2; grid-row: 2; min-width: 0; min-height: 0; }

/* ── 頂部 Header(橫跨全寬)── */
.app-header {
  position: relative;
  display: flex;
  align-items: center;
  gap: 16px;
  height: 84px;
  padding: 0 20px 0 24px;
  background: transparent;     /* 共用背景,不另加底色 */
  flex-shrink: 0;
  z-index: 20;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 21px;
  font-weight: 800;
  color: #37352f;
  white-space: nowrap;
  padding: 0 4px;
}
.sidebar-brand span { letter-spacing: -.015em; }

.hdr-search {
  position: absolute;       /* 絕對置中於頁面上方 */
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: 460px;
  max-width: 38vw;
}
.hdr-search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 14px;
  opacity: .45;
  pointer-events: none;
}
.search-input {
  width: 100%;
  padding: 10px 16px 10px 36px;
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 24px;
  font-size: 15px;
  background: rgba(255,255,255,.55);
  outline: none;
  transition: border-color .15s, background .15s, box-shadow .15s;
}
.search-input:focus { border-color: rgba(124,92,255,.5); background: rgba(255,255,255,.85); box-shadow: 0 0 0 3px rgba(124,92,255,.12); }

.hdr-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  flex-shrink: 0;
}
.icon-btn {
  background: none;
  border: 1px solid transparent;
  border-radius: 9px;
  width: 38px; height: 38px;
  font-size: 19px;
  cursor: pointer;
  color: #6b6b68;
  display: flex; align-items: center; justify-content: center;
  transition: background .12s, color .12s;
  flex-shrink: 0;
}
.icon-btn:hover { background: rgba(255,255,255,.6); color: #37352f; }

.book-count { font-size: 14.5px; color: #7a7873; white-space: nowrap; }

/* 排序 / 版本浮層 */
.sort-pop-wrap { position: relative; display: flex; }
.sort-popover {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 234px;
  background: rgba(255,255,255,.97);
  backdrop-filter: blur(24px) saturate(150%);
  -webkit-backdrop-filter: blur(24px) saturate(150%);
  border: 1px solid rgba(0,0,0,.08);
  border-radius: 16px;
  box-shadow: 0 16px 44px rgba(120,100,90,.24);
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  z-index: 60;
}
.sort-row { display: flex; flex-direction: column; gap: 5px; }
.sort-row label {
  font-size: 10.5px; font-weight: 600; color: #8a8784;
  text-transform: uppercase; letter-spacing: .05em;
}
.sort-row select {
  width: 100%; padding: 8px 10px; border-radius: 10px;
  border: 1px solid rgba(0,0,0,.14); background: #fff;
  font-size: 13.5px; color: #37352f; cursor: pointer; outline: none;
}
.sort-row label { color: #6b6b68; }
.sort-row select:focus { border-color: rgba(124,92,255,.5); }

/* 右下角書卡縮放 dock */
.zoom-dock {
  position: fixed;
  right: 24px;
  bottom: 7px;               /* 與底部分頁列同一水平線 */
  z-index: 80;
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  background: rgba(255,255,255,.6);
  backdrop-filter: blur(18px) saturate(150%);
  -webkit-backdrop-filter: blur(18px) saturate(150%);
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 14px;
  box-shadow: 0 6px 22px rgba(120,100,90,.20);
}
.zoom-dock-btn {
  background: none; border: none; cursor: pointer;
  width: 22px; height: 26px; font-size: 18px; font-weight: 700;
  color: #6b6b68; display: flex; align-items: center; justify-content: center;
  border-radius: 7px; transition: background .12s, color .12s;
}
.zoom-dock-btn:hover { background: rgba(0,0,0,.06); color: #37352f; }

/* 三角形音量條 */
.zoom-wedge { position: relative; width: 92px; height: 22px; display: flex; align-items: center; }
.zoom-wedge::before {
  content: ""; position: absolute; left: 2px; right: 2px; top: 50%; transform: translateY(-50%);
  height: 15px;
  background: linear-gradient(90deg, rgba(124,92,255,.30), rgba(91,141,239,.65));
  clip-path: polygon(0 50%, 100% 0, 100% 100%);   /* 左尖右粗 */
  border-radius: 2px;
  pointer-events: none;
}
.zoom-wedge input[type=range] {
  position: relative; width: 100%; margin: 0; height: 22px; cursor: pointer;
  background: transparent; -webkit-appearance: none; appearance: none;
}
.zoom-wedge input[type=range]::-webkit-slider-runnable-track { background: transparent; height: 22px; }
.zoom-wedge input[type=range]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 2px solid #7c5cff;
  box-shadow: 0 1px 4px rgba(0,0,0,.3); margin-top: 4px;
}
.zoom-wedge input[type=range]::-moz-range-track { background: transparent; height: 22px; }
.zoom-wedge input[type=range]::-moz-range-thumb {
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff; border: 2px solid #7c5cff; box-shadow: 0 1px 4px rgba(0,0,0,.3);
}

/* ── Body row(側欄 + 內容)── */
.app-body {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: 210px;
  min-width: 210px;
  margin: 14px 0 14px 14px;
  background: rgba(255,253,250,.55);
  backdrop-filter: blur(18px) saturate(140%);
  -webkit-backdrop-filter: blur(18px) saturate(140%);
  border: 1px solid rgba(255,255,255,.65);
  border-radius: 20px;
  box-shadow: 0 8px 32px rgba(120,100,90,.12);
  display: flex;
  flex-direction: column;
  padding: 13px 14px 18px;   /* 上 13 讓品牌中心對齊 header 的 nav/搜尋 */
  overflow-y: auto;
  gap: 20px;
}

.sidebar-section { display: flex; flex-direction: column; gap: 3px; }

.sidebar-label {
  font-size: 10.5px;
  font-weight: 600;
  color: #a3a29e;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 0 8px;
  margin-bottom: 4px;
}

.filter-list { list-style: none; display: flex; flex-direction: column; gap: 1px; }

.filter-list li {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 10px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13.5px;
  color: #4a4945;
  transition: background .12s, color .12s;
}
.status-icon {
  width: 22px;
  height: 22px;
  object-fit: contain;
  flex-shrink: 0;
  filter: drop-shadow(0 1px 1px rgba(0,0,0,.06));
}
.filter-list li:hover { background: #efefed; }
.filter-list li.active {
  background: #eef1f6;
  color: #2c5aa0;
  font-weight: 600;
}
.filter-list li.active::before {
  content: "";
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 16px;
  border-radius: 2px;
  background: #2c5aa0;
}

/* 篩選下拉(年份 / 類型)*/
.filter-select {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid rgba(255,255,255,.7);
  border-radius: 11px;
  font-size: 13px;
  color: #37352f;
  background: rgba(255,255,255,.6);
  cursor: pointer;
  outline: none;
  transition: border-color .15s, background .15s;
}
.filter-select:hover { background: rgba(255,255,255,.78); }
.filter-select:focus { border-color: rgba(124,92,255,.5); }

.add-btn {
  margin-top: auto;
  background: linear-gradient(135deg, #8b5cf6 0%, #5b8def 100%);
  color: #fff;
  border: none;
  border-radius: 13px;
  padding: 11px 12px;
  font-size: 13.5px;
  cursor: pointer;
  font-weight: 700;
  box-shadow: 0 6px 18px rgba(124,92,255,.32);
  transition: filter .15s, transform .12s, box-shadow .15s;
}
.add-btn:hover { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 10px 24px rgba(124,92,255,.40); }

/* ── Main ── */
.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* 三個視圖各自填滿 main、內部自行捲動(grid/feed 捲、篩選列與分頁固定)*/
#shelfView, #exploreView, #feedView {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.filter-bar { flex-shrink: 0; }
.pagination { flex-shrink: 0; }

.refresh-btn { transition: background .12s, color .12s, transform .3s; }
.refresh-btn.spinning { animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.book-grid {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 18px 24px 28px;
  display: grid;
  grid-template-columns: repeat(auto-fill, var(--card-w, 160px));
  grid-auto-rows: max-content;   /* 列高=卡片內容高,避免被容器壓縮裁切 */
  gap: 20px;
  align-content: start;
  justify-content: start;
}

.loading { color: #9b9a97; font-size: 14px; grid-column: 1/-1; text-align: center; padding: 40px; }
.empty-state { color: #9b9a97; font-size: 14px; grid-column: 1/-1; text-align: center; padding: 60px 20px; }

/* ── Book Card ── */
.book-card {
  background: rgba(255,255,255,.52);
  backdrop-filter: blur(10px) saturate(135%);
  -webkit-backdrop-filter: blur(10px) saturate(135%);
  border-radius: 16px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid rgba(255,255,255,.6);
  box-shadow: 0 6px 20px rgba(120,100,90,.12);
  transition: box-shadow .15s, transform .15s;
  display: flex;
  flex-direction: column;
}
.book-card:hover { box-shadow: 0 12px 32px rgba(120,100,90,.20); transform: translateY(-3px); }

.book-cover {
  width: 100%;
  height: calc(var(--card-w, 160px) * 1.5);   /* 跟著縮放,維持 2:3 */
  overflow: hidden;
  background: #e8e8e6;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.book-cover img { width: 100%; height: 100%; object-fit: cover; display: block; }
.no-cover {
  width: 100%;
  height: calc(var(--card-w, 160px) * 1.5);
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  flex-shrink: 0;
}
.no-cover .no-cover-icon { font-size: 36px; color: rgba(255,255,255,.85); }
.no-cover .no-cover-title {
  font-size: 11px;
  color: rgba(255,255,255,.8);
  text-align: center;
  padding: 0 8px;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-info { padding: 10px 10px 12px; display: flex; flex-direction: column; gap: 3px; }

.book-title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.3;
  height: 2.6em;            /* 固定 2 行,書名長短不影響下方對齊 */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-author {
  font-size: 11.5px;
  color: #6b6b68;
  line-height: 1.35;
  height: 1.35em;          /* 固定 1 行 */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
.book-genre {
  font-size: 11px;
  color: #9b9a97;
  line-height: 1.4;
  height: 1.4em;           /* 永遠保留 1 行,即使無類型 */
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.progress-wrap { height: 21px; margin-top: 5px; }   /* 固定高度,無進度也保留位置 */
.progress-bar {
  height: 4px;
  background: #e8e8e6;
  border-radius: 2px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  background: #2383e2;
  border-radius: 2px;
  transition: width .3s;
}
.progress-pct { font-size: 11px; color: #9b9a97; margin-top: 3px; }

.status-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 4px;
  font-size: 11px;
  font-weight: 500;
  margin-top: 4px;
  width: fit-content;
}
.status-Now\ Reading  { background: #d3e5ff; color: #1e6cc5; }
.status-TBR           { background: #fdefd3; color: #b85c00; }
.status-Want\ to\ Read{ background: #e8e4f3; color: #6441a5; }
.status-Finished      { background: #d4edda; color: #1a6632; }
.status-DNF           { background: #fde8e8; color: #c0392b; }

/* ── Modal ── */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.35);
  z-index: 100;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.modal-overlay.open { display: flex; }

.modal {
  background: #fff;
  border-radius: 10px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: 0 12px 48px rgba(0,0,0,.18);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px 24px 12px;
  border-bottom: 1px solid #e8e8e6;
}
.modal-header h2 { font-size: 17px; font-weight: 700; }

.modal-close {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #9b9a97;
  padding: 2px 6px;
  border-radius: 4px;
}
.modal-close:hover { background: #ebebea; }

.search-book-row {
  display: flex;
  gap: 8px;
  padding: 14px 24px 0;
}
.search-book-row input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid #e0e0de;
  border-radius: 6px;
  font-size: 13.5px;
  outline: none;
}
.search-book-row input:focus { border-color: #a8a8a6; }
.search-book-row button {
  padding: 8px 16px;
  background: #37352f;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13.5px;
  white-space: nowrap;
}
.search-book-row button:hover { background: #555; }

.fetch-status {
  padding: 4px 24px 0;
  font-size: 12px;
  min-height: 20px;
  color: #6b6b68;
}

/* 書籍搜尋結果清單(點選正確那本,不再盲填第一筆) */
.book-search-results { padding: 0 24px; display: flex; flex-direction: column; gap: 6px; max-height: 260px; overflow-y: auto; }
.book-search-results:not(:empty) { margin-top: 6px; }
.bsr-item {
  display: flex; gap: 10px; align-items: center; padding: 6px 8px;
  border: 1px solid #ececea; border-radius: 8px; cursor: pointer; background: #fff;
}
.bsr-item:hover { background: #f3f1ee; border-color: #d8d8d6; }
.bsr-cover { width: 34px; height: 50px; object-fit: cover; border-radius: 4px; flex-shrink: 0; background: #f0eee9; }
.bsr-nocover { display: flex; align-items: center; justify-content: center; font-size: 18px; }
.bsr-meta { min-width: 0; }
.bsr-title { font-size: 13px; font-weight: 600; color: #37352f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bsr-sub { font-size: 11px; color: #9b9a97; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.modal-form { padding: 14px 24px; display: flex; flex-direction: column; gap: 12px; }

.form-row { display: flex; flex-direction: column; gap: 12px; }
.form-row.two-col { flex-direction: row; gap: 12px; }
.form-row.two-col .form-group { flex: 1; }

.form-group { display: flex; flex-direction: column; gap: 4px; }
.form-group label { font-size: 12px; font-weight: 600; color: #6b6b68; }
.form-group input,
.form-group select,
.form-group textarea {
  padding: 7px 10px;
  border: 1px solid #e0e0de;
  border-radius: 6px;
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
  background: #fff;
  color: #37352f;
  transition: border-color .15s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus { border-color: #a8a8a6; }

/* ── Cover Picker ── */
.cover-picker-group { gap: 8px; }
.cover-picker-wrap { display: flex; align-items: flex-start; gap: 10px; flex-wrap: wrap; }

.btn-change-cover {
  padding: 6px 12px;
  background: #37352f;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
}
.btn-change-cover:hover { background: #555; }

.btn-refetch {
  padding: 6px 10px;
  background: #f7f7f5;
  border: 1px solid #e0e0de;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  white-space: nowrap;
  transition: background .12s;
}
.btn-refetch:hover { background: #ebebea; }
.btn-refetch.loading { animation: spin .7s linear infinite; display: inline-block; }

/* Picker Panel */
.cover-picker-panel {
  border: 1px solid #e0e0de;
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
  margin-top: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,.08);
}
.picker-tabs {
  display: flex;
  border-bottom: 1px solid #e0e0de;
  background: #f7f7f5;
}
.picker-tab {
  flex: 1;
  padding: 8px 4px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 12.5px;
  color: #6b6b68;
  border-bottom: 2px solid transparent;
  transition: color .12s;
  white-space: nowrap;
}
.picker-tab:hover { color: #37352f; background: #ebebea; }
.picker-tab.active { color: #37352f; font-weight: 600; border-bottom-color: #37352f; background: #fff; }

.picker-pane { padding: 14px; min-height: 120px; }

/* Gallery */
.gallery-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 6px;
}
.gallery-swatch {
  width: 100%;
  aspect-ratio: 2/3;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: transform .12s, border-color .12s;
}
.gallery-swatch:hover { transform: scale(1.06); border-color: #37352f; }

/* Upload pane */
.upload-drop-zone {
  border: 2px dashed #d0d0ce;
  border-radius: 6px;
  padding: 24px 16px;
  text-align: center;
  font-size: 13.5px;
  color: #6b6b68;
  cursor: pointer;
  background: #fafaf9;
  transition: border-color .15s, background .15s;
  line-height: 1.6;
}
.upload-drop-zone:hover,
.upload-drop-zone.drag-over { border-color: #2383e2; background: #f0f6ff; }

/* Link pane */
.link-pane { display: flex; gap: 8px; }
.link-pane input {
  flex: 1;
  padding: 7px 10px;
  border: 1px solid #e0e0de;
  border-radius: 6px;
  font-size: 13.5px;
  outline: none;
}
.link-pane input:focus { border-color: #a8a8a6; }
.link-pane button {
  padding: 7px 16px;
  background: #2383e2;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
}
.link-pane button:hover { background: #1a6cc5; }

/* Screenshot pane */
.screenshot-pane { display: flex; flex-direction: column; align-items: center; gap: 10px; text-align: center; }
.screenshot-desc { font-size: 13px; color: #6b6b68; }
.screenshot-pane button {
  padding: 9px 20px;
  background: #37352f;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
.screenshot-pane button:hover { background: #555; }
.screenshot-note { font-size: 12px; color: #9b9a97; line-height: 1.5; }

/* Picker footer */
.picker-footer {
  display: flex;
  justify-content: space-between;
  padding: 8px 14px;
  border-top: 1px solid #e8e8e6;
  background: #fafaf9;
}
.picker-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12.5px;
  color: #c0392b;
  padding: 4px 6px;
  border-radius: 4px;
}
.picker-remove-btn:hover { background: #fde8e8; }
.picker-close-btn {
  background: none;
  border: 1px solid #e0e0de;
  border-radius: 5px;
  cursor: pointer;
  font-size: 12.5px;
  color: #6b6b68;
  padding: 4px 10px;
}
.picker-close-btn:hover { background: #ebebea; }

/* Screenshot Overlay */
.screenshot-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(0,0,0,.85);
  display: flex;
  flex-direction: column;
  user-select: none;
}
.screenshot-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 14px;
  font-weight: 600;
  flex-shrink: 0;
}
.screenshot-toolbar button {
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.3);
  color: #fff;
  padding: 5px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.screenshot-toolbar button:hover { background: rgba(255,255,255,.25); }
#screenshotCanvas {
  flex: 1;
  cursor: crosshair;
  display: block;
  width: 100%;
  object-fit: contain;
}
.screenshot-selection {
  position: absolute;
  border: 2px solid #2383e2;
  background: rgba(35,131,226,.15);
  pointer-events: none;
}
.screenshot-confirm {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 10px;
}
.screenshot-confirm button {
  padding: 10px 24px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
}
#screenshotUse { background: #2383e2; color: #fff; }
#screenshotUse:hover { background: #1a6cc5; }
#screenshotRetry { background: #fff; color: #37352f; }

.cover-preview {
  width: 80px;
  height: 120px;
  border: 1px solid #e0e0de;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  font-size: 11px;
  color: #9b9a97;
  background: #f7f7f5;
}
.cover-preview img { width: 100%; height: 100%; object-fit: cover; }

.modal-footer {
  padding: 12px 24px 20px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  border-top: 1px solid #e8e8e6;
}
.btn-cancel {
  padding: 8px 16px;
  background: #f7f7f5;
  border: 1px solid #e0e0de;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13.5px;
}
.btn-cancel:hover { background: #ebebea; }
.btn-save {
  padding: 8px 20px;
  background: #37352f;
  color: #fff;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13.5px;
  font-weight: 600;
}
.btn-save:hover { background: #555; }

/* ── Detail Modal ── */
.modal-detail { max-width: 760px; max-height: 90vh; overflow-y: auto; }

.detail-body {
  display: flex;
  gap: 24px;
  padding: 20px 24px;
}

.detail-cover-col { flex-shrink: 0; }
.detail-cover-col img {
  width: 140px;
  height: 210px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #e8e8e6;
  background: #e8e8e6;
}

.detail-info-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.detail-author { font-size: 14px; color: #6b6b68; }
.detail-genre { font-size: 13px; color: #9b9a97; }
.detail-status-badge .status-badge { font-size: 12px; padding: 3px 9px; }

.detail-progress-section { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.detail-progress-section label { font-size: 12px; font-weight: 600; color: #6b6b68; }
.progress-bar-wrap {
  height: 6px;
  background: #e8e8e6;
  border-radius: 3px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  background: #2383e2;
  border-radius: 3px;
  transition: width .3s;
}
.progress-text { font-size: 12px; color: #6b6b68; }

.detail-page-edit { display: flex; flex-direction: column; gap: 4px; }
.detail-page-edit label { font-size: 12px; font-weight: 600; color: #6b6b68; }
.page-edit-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.page-edit-row input {
  width: 80px;
  padding: 5px 8px;
  border: 1px solid #e0e0de;
  border-radius: 5px;
  font-size: 13px;
  outline: none;
}
.page-edit-row input:focus { border-color: #a8a8a6; }
.page-edit-row span { font-size: 13px; color: #9b9a97; }
.page-edit-row button {
  padding: 5px 12px;
  background: #2383e2;
  color: #fff;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  font-size: 13px;
}
.page-edit-row button:hover { background: #1a6cc5; }
.page-edit-row #markDoneBtn { background: #16a34a; }
.page-edit-row #markDoneBtn:hover { background: #128a3e; }

/* 三評分並列:他的自評 / 我的 / 平均 */
.triple-rating { display: flex; gap: 8px; margin: 4px 0 2px; }
.triple-rating .tr-cell {
  flex: 1; text-align: center; padding: 7px 4px;
  background: rgba(255,255,255,.55); border: 1px solid #ececea; border-radius: 10px;
}
.triple-rating .tr-label { font-size: 11px; color: #9b9a97; margin-bottom: 2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.triple-rating .tr-val { font-size: 14px; font-weight: 700; color: #d99a1c; }
.triple-rating .tr-val .tr-count { font-size: 11px; font-weight: 400; color: #b0afab; }
.triple-rating .tr-owner .tr-val { color: #7c3aed; }
.triple-rating .tr-me .tr-val { color: #2383e2; }
.page-edit-row #progressMode {
  padding: 5px 6px; border: 1px solid #e0e0de; border-radius: 5px;
  font-size: 13px; background: #fff; cursor: pointer; color: #37352f;
}

.detail-dates { font-size: 12.5px; color: #6b6b68; margin-top: 4px; }
.detail-notes {
  font-size: 13px;
  color: #37352f;
  background: #f7f7f5;
  border-radius: 6px;
  padding: 8px 10px;
  white-space: pre-wrap;
  max-height: 80px;
  overflow-y: auto;
}
.detail-notes:empty { display: none; }

.detail-actions {
  display: flex;
  gap: 8px;
  margin-top: auto;
  padding-top: 8px;
}
.btn-edit {
  padding: 7px 16px;
  background: #f7f7f5;
  border: 1px solid #e0e0de;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.btn-edit:hover { background: #ebebea; }
.btn-delete {
  padding: 7px 16px;
  background: #fde8e8;
  color: #c0392b;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}
.btn-delete:hover { background: #f5c6c6; }

/* ── Filter Bar ── */
.filter-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 24px;
  border-bottom: 1px solid rgba(255,255,255,.5);
  background: rgba(255,255,255,.30);
  backdrop-filter: blur(14px) saturate(140%);
  -webkit-backdrop-filter: blur(14px) saturate(140%);
  flex-wrap: wrap;
}
.filter-group { display: flex; align-items: center; gap: 6px; }
.filter-group label { font-size: 12px; color: #9b9a97; white-space: nowrap; }
.filter-group select {
  padding: 5px 8px;
  border: 1px solid #e0e0de;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
  color: #37352f;
  cursor: pointer;
  outline: none;
}
.filter-group select:focus { border-color: #a8a8a6; }
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; }
.filter-chip {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 8px;
  background: #e8e4f3;
  color: #6441a5;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 500;
}
.filter-clear-btn {
  background: none; border: none; cursor: pointer;
  font-size: 12px; color: #c0392b; padding: 4px 8px;
  border-radius: 5px;
}
.filter-clear-btn:hover { background: #fde8e8; }

/* ── Star Rating (card) ── */
.book-rating { display: flex; align-items: center; gap: 3px; margin-top: 2px; }
.book-rating .stars { color: #f0a500; font-size: 11px; }
.book-rating .rating-count { font-size: 10px; color: #9b9a97; }

/* ── Reviews Section ── */
.reviews-section {
  border-top: 2px solid #e8e8e6;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  background: #fafaf9;
}

.reviews-header {
  display: flex;
  gap: 24px;
  align-items: center;
  background: #fff;
  border: 1px solid #e8e8e6;
  border-radius: 12px;
  padding: 20px;
}
.reviews-aggregate {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 90px;
  padding-right: 20px;
  border-right: 1px solid #e8e8e6;
}
.agg-score { font-size: 48px; font-weight: 800; color: #37352f; line-height: 1; }
.agg-stars { font-size: 20px; color: #f0a500; letter-spacing: 3px; }
.agg-count { font-size: 12px; color: #9b9a97; margin-top: 2px; }

.rating-bars { flex: 1; display: flex; flex-direction: column; gap: 5px; }
.rating-bar-row { display: flex; align-items: center; gap: 8px; font-size: 12px; }
.rating-bar-row .bar-label { width: 24px; text-align: right; color: #6b6b68; flex-shrink: 0; }
.rating-bar-row .bar-track {
  flex: 1; height: 7px;
  background: #e8e8e6; border-radius: 4px; overflow: hidden;
}
.rating-bar-row .bar-fill { height: 100%; background: #f0a500; border-radius: 4px; transition: width .5s; }
.rating-bar-row .bar-count { width: 18px; color: #9b9a97; flex-shrink: 0; }

/* Reviews list */
.reviews-list { display: flex; flex-direction: column; gap: 12px; }
.review-card {
  background: #fff;
  border: 1px solid #e8e8e6;
  border-radius: 10px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: box-shadow .15s;
}
.review-card:hover { box-shadow: 0 2px 10px rgba(0,0,0,.06); }
.review-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.reviewer-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 12px; font-weight: 700;
  flex-shrink: 0;
}
.reviewer-name { font-weight: 700; font-size: 14px; color: #37352f; }
.review-stars { display: flex; align-items: center; gap: 1px; font-size: 14px; }
.review-score { font-size: 12px; color: #6b6b68; margin-left: 4px; font-weight: 600; }
.review-read-badge {
  margin-left: auto;
  font-size: 11.5px;
  background: #eef2ff;
  color: #4338ca;
  padding: 3px 9px;
  border-radius: 20px;
  font-weight: 500;
  white-space: nowrap;
}
.review-text { font-size: 13.5px; color: #37352f; line-height: 1.6; }
.review-date { font-size: 11px; color: #b0b0ae; }

.reviews-empty {
  text-align: center;
  padding: 28px 0;
  color: #9b9a97;
  font-size: 14px;
}

/* Write a review */
.write-review {
  background: #fff;
  border: 1px solid #e8e8e6;
  border-radius: 12px;
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.write-review-title { font-weight: 700; font-size: 15px; color: #37352f; }
.review-form { display: flex; flex-direction: column; gap: 10px; }
.review-form input[type="text"],
.review-form textarea {
  padding: 9px 12px;
  border: 1px solid #e0e0de;
  border-radius: 8px;
  font-size: 13.5px;
  font-family: inherit;
  outline: none;
  resize: vertical;
  transition: border-color .15s;
  background: #fafaf9;
}
.review-form input:focus, .review-form textarea:focus { border-color: #2383e2; background: #fff; }

/* Quarter-star picker */
.star-picker-wrap { display: flex; align-items: center; gap: 10px; }
.star-picker-quarter {
  display: flex;
  align-items: center;
  gap: 3px;
  cursor: pointer;
  user-select: none;
  padding: 4px 2px;
}
.star-unit {
  position: relative;
  display: inline-block;
  font-size: 34px;
  line-height: 1;
  width: 1em;
  transition: transform .1s;
}
.star-unit:hover { transform: scale(1.1); }
.star-unit .star-bg { color: #e0e0de; display: block; }
.star-unit .star-fg {
  position: absolute;
  top: 0; left: 0;
  overflow: hidden;
  width: 0%;
  color: #f0a500;
  white-space: nowrap;
  transition: width .06s;
  pointer-events: none;
}
.star-pick-label {
  font-size: 13.5px;
  color: #6b6b68;
  font-weight: 600;
  min-width: 110px;
}

.review-read-info {
  font-size: 12.5px;
  color: #6b6b68;
  background: #eef2ff;
  border-radius: 8px;
  padding: 8px 12px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.btn-submit-review {
  padding: 10px;
  background: #37352f;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 600;
  transition: background .15s;
  letter-spacing: .3px;
}
.btn-submit-review:hover { background: #555; }
.btn-submit-review:disabled { background: #ccc; cursor: not-allowed; }

/* ── Import Button ── */
.import-btn {
  background: linear-gradient(135deg, #14b8a6 0%, #06b6d4 100%);   /* 青綠→天藍,跟新增鈕的紫做區隔 */
  border: none;
  border-radius: 13px;
  padding: 11px 12px;
  font-size: 13.5px;
  font-weight: 700;
  cursor: pointer;
  color: #fff;
  text-align: center;
  box-shadow: 0 6px 18px rgba(13,148,164,.30);
  transition: filter .15s, transform .12s, box-shadow .15s;
}
.import-btn:hover { filter: brightness(1.07); transform: translateY(-1px); box-shadow: 0 10px 24px rgba(13,148,164,.40); }

/* ── Import Modal ── */
.modal-import { max-width: 600px; }

.import-body { padding: 16px 24px; display: flex; flex-direction: column; gap: 16px; }

.import-instructions {
  background: #f7f7f5;
  border-radius: 8px;
  padding: 14px 16px;
  font-size: 13.5px;
  line-height: 1.6;
}
.instruction-title { font-weight: 700; margin-bottom: 8px; font-size: 14px; }
.import-instructions ol { padding-left: 18px; margin: 0 0 10px; }
.import-instructions li { margin-bottom: 4px; }
.import-instructions code {
  background: #e8e8e6;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 12px;
}
.instruction-note {
  background: #fdefd3;
  border-radius: 6px;
  padding: 8px 10px;
  font-size: 12.5px;
  line-height: 1.6;
  color: #7a4a00;
}

.import-upload-area {
  border: 2px dashed #d0d0ce;
  border-radius: 8px;
  padding: 28px 20px;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s, background .15s;
  background: #fafaf9;
}
.import-upload-area:hover,
.import-upload-area.drag-over { border-color: #2383e2; background: #f0f6ff; }
.upload-icon { font-size: 32px; margin-bottom: 8px; }
.upload-text { font-size: 14px; color: #6b6b68; line-height: 1.5; }
.upload-text span { font-size: 12.5px; color: #2383e2; text-decoration: underline; }
.upload-filename { font-size: 13px; color: #1a6632; font-weight: 600; margin-top: 6px; }

.import-preview { display: flex; flex-direction: column; gap: 8px; }
.preview-summary { font-size: 13.5px; font-weight: 600; color: #1a6632; }
.preview-table-wrap { max-height: 180px; overflow-y: auto; border: 1px solid #e8e8e6; border-radius: 6px; }
.preview-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.preview-table th { background: #f7f7f5; padding: 6px 10px; text-align: left; border-bottom: 1px solid #e8e8e6; font-weight: 600; white-space: nowrap; }
.preview-table td { padding: 5px 10px; border-bottom: 1px solid #f0f0ee; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.preview-table tr:last-child td { border-bottom: none; }

.import-progress { display: flex; flex-direction: column; gap: 8px; }
.progress-label { font-size: 13.5px; font-weight: 600; }
.import-log { max-height: 120px; overflow-y: auto; font-size: 11.5px; font-family: monospace; background: #f7f7f5; border-radius: 6px; padding: 8px 10px; }

/* ── Pagination ── */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 14px 24px;
  background: transparent;     /* 共用背景,不另加底色 */
  position: sticky;
  bottom: 0;
}
.page-btn {
  padding: 5px 10px;
  border: 1px solid #e0e0de;
  border-radius: 5px;
  background: #fff;
  cursor: pointer;
  font-size: 13px;
  min-width: 32px;
  text-align: center;
  transition: background .12s;
}
.page-btn:hover { background: #ebebea; }
.page-btn.active { background: #37352f; color: #fff; border-color: #37352f; font-weight: 600; }
.page-btn:disabled { opacity: .4; cursor: default; }
.page-info { font-size: 12px; color: #9b9a97; padding: 0 8px; }

/* ── Cover Fetch Progress ── */
.cover-fetch-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #fff;
  border: 1px solid #e0e0de;
  border-radius: 10px;
  padding: 12px 16px;
  box-shadow: 0 4px 20px rgba(0,0,0,.12);
  font-size: 13px;
  width: 260px;
  z-index: 200;
  display: none;
  flex-direction: column;
  gap: 6px;
}
.cover-fetch-toast.visible { display: flex; }
.toast-header { display: flex; align-items: center; justify-content: space-between; }
.toast-title { font-weight: 600; font-size: 13px; }
.toast-close { background: none; border: none; cursor: pointer; color: #9b9a97; font-size: 16px; padding: 0 2px; line-height: 1; }
.toast-progress-bar { height: 5px; background: #e8e8e6; border-radius: 3px; overflow: hidden; }
.toast-progress-fill { height: 100%; background: #2383e2; border-radius: 3px; transition: width .3s; }
.toast-label { font-size: 11.5px; color: #6b6b68; }

/* ── User Info (top bar) ── */
.user-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-left: 4px;
}
.user-avatar-sm {
  width: 33px;
  height: 33px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea, #764ba2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  overflow: hidden;
  flex-shrink: 0;
}
.user-avatar-sm img { width: 100%; height: 100%; object-fit: cover; }
.user-display-name {
  font-size: 14.5px;
  color: #37352f;
  font-weight: 500;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-signout {
  padding: 7px 13px;
  background: none;
  border: 1px solid #e0e0de;
  border-radius: 8px;
  cursor: pointer;
  font-size: 13.5px;
  color: #6b6b68;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.btn-signout:hover { background: #fde8e8; color: #c0392b; border-color: #f5c6c6; }

/* ── Auth Modal ── */
.modal-auth {
  max-width: 420px;
  padding: 36px 32px 28px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  overflow: visible;
  max-height: none;
}

.auth-brand {
  text-align: center;
  margin-bottom: 4px;
}
.auth-brand-icon { font-size: 40px; margin-bottom: 8px; line-height: 1; }
.auth-brand-name { font-size: 22px; font-weight: 800; color: #37352f; }
.auth-brand-sub  { font-size: 13.5px; color: #9b9a97; margin-top: 4px; }

.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 11px 16px;
  border: 1px solid #e0e0de;
  border-radius: 8px;
  background: #fff;
  font-size: 14px;
  font-weight: 600;
  color: #37352f;
  cursor: pointer;
  transition: background .12s, box-shadow .12s;
  width: 100%;
}
.btn-google:hover { background: #f7f7f5; box-shadow: 0 2px 8px rgba(0,0,0,.08); }

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: #9b9a97;
  font-size: 12px;
}
.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e8e8e6;
}

.auth-tabs {
  display: flex;
  border: 1px solid #e0e0de;
  border-radius: 8px;
  overflow: hidden;
  background: #f7f7f5;
  padding: 3px;
  gap: 3px;
}
.auth-tab {
  flex: 1;
  padding: 7px;
  border: none;
  background: none;
  cursor: pointer;
  font-size: 13.5px;
  color: #6b6b68;
  font-weight: 500;
  border-radius: 6px;
  transition: background .12s, color .12s;
}
.auth-tab:hover { color: #37352f; }
.auth-tab.active {
  background: #fff;
  color: #37352f;
  font-weight: 700;
  box-shadow: 0 1px 4px rgba(0,0,0,.1);
}

.auth-form-area {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.auth-form-area input {
  padding: 10px 14px;
  border: 1px solid #e0e0de;
  border-radius: 8px;
  font-size: 14px;
  outline: none;
  transition: border-color .15s;
  font-family: inherit;
  width: 100%;
  background: #fafaf9;
  color: #37352f;
}
.auth-form-area input:focus { border-color: #2383e2; background: #fff; }

.auth-error {
  border-radius: 7px;
  padding: 9px 12px;
  font-size: 13px;
  line-height: 1.4;
}

.btn-auth-submit {
  padding: 11px;
  background: #37352f;
  color: #fff;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 700;
  transition: background .15s;
  letter-spacing: .3px;
  width: 100%;
}
.btn-auth-submit:hover { background: #555; }
.btn-auth-submit:disabled { background: #b0b0ae; cursor: not-allowed; }

.auth-reset-wrap { text-align: center; }
.btn-auth-link {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 12.5px;
  color: #9b9a97;
  text-decoration: underline;
  padding: 0;
  font-family: inherit;
}
.btn-auth-link:hover { color: #37352f; }

/* Delete review button */
.btn-delete-review {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 2px 4px;
  border-radius: 4px;
  opacity: .5;
  transition: opacity .12s, background .12s;
  margin-left: auto;
}
.btn-delete-review:hover { opacity: 1; background: #fde8e8; }

/* ── Responsive ── */
@media (max-width: 600px) {
  body { display: flex; flex-direction: column; }   /* 手機改回直向堆疊,取消桌機 grid */
  .sidebar, .app-header, .app-body { grid-column: auto; grid-row: auto; }
  .app-body { flex-direction: column; overflow: auto; }
  .app-header { flex-wrap: wrap; height: auto; padding: 8px 12px; gap: 8px; }
  .hdr-search { position: static; transform: none; width: 100%; max-width: none; order: 3; }
  .sidebar-brand { font-size: 16px; }
  .nav-tabs { flex: 1; }
  .sidebar {
    width: 100%;
    min-width: unset;
    flex-direction: row;
    flex-wrap: wrap;
    height: auto;
    gap: 8px;
    padding: 12px;
    overflow-x: auto;
  }
  .sidebar-section { flex-direction: row; flex-wrap: wrap; gap: 4px; align-items: center; }
  .sidebar-label { display: none; }
  .filter-list { flex-direction: row; flex-wrap: wrap; }
  .add-btn { margin-top: 0; }
  .main { overflow: auto; }
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .detail-body { flex-direction: column; }
  .detail-cover-col img { width: 100px; height: 150px; }
  .form-row.two-col { flex-direction: column; }
}

/* 動態牆 */
.feed-subtabs { display: flex; gap: 4px; }
.feed-subtab {
  background: transparent; border: 1px solid #e8e8e6; border-radius: 6px;
  padding: 5px 14px; font-size: 13px; font-weight: 600; color: #6b6b68; cursor: pointer;
}
.feed-subtab.active { background: #37352f; color: #fff; border-color: #37352f; }
.feed-list { flex: 1; min-height: 0; overflow-y: auto; padding: 12px 24px 24px; display: flex; flex-direction: column; gap: 8px; max-width: 700px; }
.feed-item {
  display: flex; gap: 12px; align-items: flex-start;
  background: #fff; border: 1px solid #e8e8e6; border-radius: 10px; padding: 12px 14px;
}
.feed-avatar {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: #6b5ce7; color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; overflow: hidden; cursor: pointer;
}
.feed-avatar img { width: 100%; height: 100%; object-fit: cover; }
.feed-body { flex: 1; min-width: 0; }
.feed-text { font-size: 13.5px; color: #37352f; line-height: 1.45; }
.feed-text .feed-name { font-weight: 600; cursor: pointer; }
.feed-text .feed-book { color: #2c5aa0; cursor: pointer; }
.feed-meta { font-size: 11.5px; color: #9b9a97; margin-top: 2px; }
.feed-review-text { font-size: 12.5px; color: #6b6b68; margin-top: 5px; line-height: 1.4; }
.feed-cover { width: 38px; height: 54px; border-radius: 4px; object-fit: cover; flex-shrink: 0; background: #e8e8e6; cursor: pointer; }
.feed-empty { padding: 40px; text-align: center; color: #9b9a97; }

/* 評論回覆 */
.review-replies { margin-top: 8px; padding-left: 8px; border-left: 2px solid #eee; }
.review-reply-toggle {
  background: transparent; border: none; color: #2c5aa0; cursor: pointer;
  font-size: 12px; font-weight: 600; padding: 2px 0;
}
.replies-list { display: flex; flex-direction: column; gap: 6px; margin: 6px 0; }
.replies-empty { font-size: 12px; color: #b0afab; padding: 2px 0; }
.reply-item { font-size: 12.5px; color: #37352f; display: flex; gap: 6px; align-items: baseline; flex-wrap: wrap; }
.reply-name { font-weight: 600; }
.reply-name.clickable { cursor: pointer; }
.reply-name.clickable:hover { color: #2c5aa0; }
.reply-text { color: #4a4a47; }
.reply-date { font-size: 11px; color: #b0afab; }
.reply-del { background: transparent; border: none; cursor: pointer; opacity: .5; font-size: 11px; }
.reply-del:hover { opacity: 1; }
.reply-input-row { display: flex; gap: 6px; margin-top: 4px; }
.reply-input {
  flex: 1; border: 1px solid #e8e8e6; border-radius: 6px; padding: 5px 10px; font-size: 12.5px;
}
.reply-send {
  background: #2c5aa0; color: #fff; border: none; border-radius: 6px;
  padding: 5px 14px; font-size: 12.5px; font-weight: 600; cursor: pointer;
}

/* 讀書會討論 */
.discussion-section { padding: 16px 24px 24px; border-top: 1px solid #eee; margin-top: 8px; }
.discussion-title { font-size: 14px; font-weight: 700; color: #37352f; margin-bottom: 12px; }
.discussion-list { display: flex; flex-direction: column; gap: 12px; margin-bottom: 12px; }
.discussion-empty { font-size: 13px; color: #9b9a97; padding: 8px 0; }
.disc-item { display: flex; gap: 10px; align-items: flex-start; }
.disc-avatar {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0; cursor: pointer;
  background: #6b5ce7; color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; overflow: hidden;
}
.disc-avatar img { width: 100%; height: 100%; object-fit: cover; }
.disc-body { flex: 1; min-width: 0; }
.disc-head { display: flex; gap: 8px; align-items: baseline; }
.disc-name { font-size: 13px; font-weight: 600; color: #37352f; }
.disc-name.clickable { cursor: pointer; }
.disc-name.clickable:hover { color: #2c5aa0; }
.disc-date { font-size: 11px; color: #b0afab; }
.disc-del { background: transparent; border: none; cursor: pointer; opacity: .5; font-size: 11px; margin-left: auto; }
.disc-del:hover { opacity: 1; }
.disc-text { font-size: 13px; color: #4a4a47; line-height: 1.45; margin-top: 2px; }
.discussion-input-row { display: flex; gap: 8px; }
.discussion-input-row input {
  flex: 1; border: 1px solid #e8e8e6; border-radius: 8px; padding: 8px 12px; font-size: 13px;
}
.discussion-input-row button {
  background: #37352f; color: #fff; border: none; border-radius: 8px;
  padding: 8px 18px; font-size: 13px; font-weight: 600; cursor: pointer;
}
.disc-section-input { flex: 0 0 130px !important; }

/* 讀書會:分章節 + 防雷摺疊 */
.disc-progress-row { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.disc-progress-label { font-size: 12px; color: #6b6b68; }
.disc-progress-row select {
  border: 1px solid #e8e8e6; border-radius: 8px; padding: 5px 10px; font-size: 12px;
  background: #fff; color: #37352f; cursor: pointer;
}
.disc-group { border: 1px solid #eee; border-radius: 10px; margin-bottom: 8px; overflow: hidden; }
.disc-group-head {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  padding: 9px 12px; background: #faf9f7; user-select: none;
}
.disc-group-head:hover { background: #f3f1ee; }
.disc-group-toggle { font-size: 11px; color: #9b9a97; width: 12px; }
.disc-group-label { font-size: 13px; font-weight: 600; color: #37352f; }
.disc-spoiler-warn { font-size: 11px; color: #c2884a; margin-left: auto; }
.disc-group-body { display: none; flex-direction: column; gap: 12px; padding: 12px; }
.disc-group.open .disc-group-body { display: flex; }

/* 語言切換鈕 */
.lang-toggle {
  background: rgba(255,255,255,.4);
  border: 1px solid rgba(255,255,255,.6);
  border-radius: 11px;
  padding: 8px 13px;
  font-size: 14.5px;
  font-weight: 700;
  color: #37352f;
  cursor: pointer;
  white-space: nowrap;
  transition: background .15s;
}
.lang-toggle:hover { background: rgba(255,255,255,.7); }

/* ════════════════ Phase B-3：探索 / 隱私設定 ════════════════ */

/* 主導覽分頁(header 內,分段式 pill)*/
.nav-tabs {
  display: flex;
  gap: 2px;
  background: rgba(255,255,255,.32);
  border: 1px solid rgba(255,255,255,.5);
  border-radius: 12px;
  padding: 3px;
  flex-shrink: 0;
}
.nav-tab {
  background: transparent;
  border: none;
  border-radius: 8px;
  padding: 8px 17px;
  font-size: 14.5px;
  font-weight: 600;
  color: #6b6b68;
  cursor: pointer;
  white-space: nowrap;
  transition: background .12s, color .12s;
}
.nav-tab:hover { color: #37352f; }
.nav-tab.active {
  background: rgba(255,255,255,.92);
  color: #6a4ad8;
  box-shadow: 0 1px 4px rgba(120,100,90,.16);
}

/* 隱私設定按鈕 */
.settings-btn {
  background: transparent;
  color: #6b6b68;
  border: 1px solid #e8e8e6;
  border-radius: 6px;
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
  font-weight: 600;
  transition: background .15s;
}
.settings-btn:hover { background: #ebebea; }

/* 探索書卡上的評分徽章 */
.card-rating {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  color: #37352f;
  margin-top: 4px;
}
.card-rating .cr-star { color: #f0a500; }
.card-rating .cr-count { color: #9b9a97; font-size: 11px; }
.card-rating.cr-empty { color: #c4c3c0; }

/* 加入我的書架按鈕 */
.btn-add-shelf {
  background: #1a6632;
  color: #fff;
  border: none;
  border-radius: 6px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s;
}
.btn-add-shelf:hover { background: #14512a; }
.btn-add-shelf:disabled { background: #9b9a97; cursor: default; }

/* 探索模式提示橫幅(看別人的公開書架時) */
.public-banner {
  display: none;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  margin: 0 24px 8px;
  background: #f0f6ff;
  border: 1px solid #d0e0f5;
  border-radius: 8px;
  font-size: 13px;
  color: #2c5aa0;
}
.public-banner .pb-follow {
  margin-left: auto;
  background: #2c5aa0;
  color: #fff;
  border: 1px solid #2c5aa0;
  border-radius: 5px;
  padding: 4px 16px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
}
.public-banner .pb-follow.following { background: transparent; color: #2c5aa0; }
.public-banner .pb-back {
  margin-left: 8px;
  background: transparent;
  border: 1px solid #c0d0e8;
  border-radius: 5px;
  padding: 4px 10px;
  cursor: pointer;
  color: #2c5aa0;
  font-size: 12px;
}

/* 評論者名稱可點(連到公開書架) */
.reviewer-name.clickable { cursor: pointer; text-decoration: underline dotted; }
.reviewer-name.clickable:hover { color: #2c5aa0; }

/* 隱私設定 Modal */
.modal-privacy { max-width: 480px; }
.privacy-body { padding: 8px 20px 4px; display: flex; flex-direction: column; gap: 4px; }
.privacy-intro { font-size: 13px; color: #6b6b68; margin: 0 0 8px; }
.privacy-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-top: 1px solid #f0f0ee;
  cursor: pointer;
}
.privacy-text { flex: 1; }
.privacy-name { font-size: 14px; font-weight: 600; color: #37352f; }
.privacy-desc { font-size: 12px; color: #9b9a97; margin-top: 2px; line-height: 1.4; }
.privacy-switch { width: 18px; height: 18px; cursor: pointer; flex-shrink: 0; }
.privacy-note {
  font-size: 12px;
  color: #6b6b68;
  background: #faf8f0;
  border: 1px solid #f0e8d0;
  border-radius: 6px;
  padding: 10px 12px;
  margin-top: 12px;
  line-height: 1.5;
}

/* ── 閱讀相容度面板 ── */
.compat-panel {
  margin: 0 24px 14px;
  padding: 14px 18px;
  background: rgba(255, 255, 255, .62);
  backdrop-filter: blur(14px) saturate(1.1);
  -webkit-backdrop-filter: blur(14px) saturate(1.1);
  border: 1px solid rgba(255, 255, 255, .5);
  border-radius: 16px;
  box-shadow: 0 6px 20px rgba(120, 110, 150, .12);
}
.cp-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 9px; gap: 10px; }
.cp-title { font-size: 15px; font-weight: 700; color: #4a4458; }
.cp-pct {
  font-size: 25px; font-weight: 800; line-height: 1;
  background: linear-gradient(135deg, #8b5cf6, #5b8def);
  -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent;
}
.cp-bar { height: 10px; border-radius: 6px; background: rgba(120, 110, 150, .15); overflow: hidden; }
.cp-fill { height: 100%; border-radius: 6px; background: linear-gradient(90deg, #8b5cf6, #5b8def); transition: width .6s ease; }
.cp-conf { font-size: 12.5px; color: #7a7488; margin: 8px 0 2px; }
.cp-row { font-size: 13px; color: #5a5468; margin-top: 5px; line-height: 1.5; }
.cp-row b { color: #6a4ad8; font-weight: 700; }
.cp-dim { color: #9b96a8; }
.cp-clash { color: #b07219; }

/* ── 書評人探索(找人 + 搜尋) ── */
.people-search-wrap { position: relative; margin: 6px 24px 14px; }
.people-search-wrap .ps-icon { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); font-size: 14px; opacity: .6; pointer-events: none; }
.people-search {
  width: 100%; box-sizing: border-box;
  padding: 11px 16px 11px 38px; font-size: 15px;
  border: 1px solid rgba(0, 0, 0, .08); border-radius: 24px;
  background: rgba(255, 255, 255, .6); backdrop-filter: blur(10px);
  outline: none; color: #37352f;
}
.people-search:focus { border-color: #b9a8f0; background: rgba(255, 255, 255, .8); }
.people-grid { display: flex; flex-direction: column; gap: 10px; padding: 0 24px 28px; }
.pcard {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; cursor: pointer;
  background: rgba(255, 255, 255, .58); backdrop-filter: blur(12px) saturate(1.1);
  border: 1px solid rgba(255, 255, 255, .5); border-radius: 14px;
  box-shadow: 0 4px 14px rgba(120, 110, 150, .10);
  transition: transform .15s ease, box-shadow .15s ease;
}
.pcard:hover { transform: translateY(-2px); box-shadow: 0 8px 22px rgba(120, 110, 150, .18); }
.pcard-av { width: 46px; height: 46px; border-radius: 50%; object-fit: cover; flex-shrink: 0; }
.pcard-av-ph {
  display: flex; align-items: center; justify-content: center;
  font-size: 20px; font-weight: 800; color: #fff;
  background: linear-gradient(135deg, #8b5cf6, #5b8def);
}
.pcard-body { flex: 1; min-width: 0; }
.pcard-name { font-size: 15.5px; font-weight: 700; color: #37352f; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pcard-stats { font-size: 13px; color: #7a7488; margin-top: 2px; }
.pcard-go { font-size: 22px; color: #b9b4c4; flex-shrink: 0; }
.people-more { display: block; margin: 2px 24px 28px; padding: 11px 0; width: calc(100% - 48px);
  border: 1px solid rgba(139,92,246,.35); border-radius: 12px; background: rgba(255,255,255,.55);
  color: #6d28d9; font-size: 14px; font-weight: 600; cursor: pointer; backdrop-filter: blur(6px);
  transition: background .15s, border-color .15s; }
.people-more:hover { background: rgba(139,92,246,.12); border-color: rgba(139,92,246,.6); }
