/* ===== Base ===== */
*, *::before, *::after { box-sizing: border-box; }

body {
  font-family: 'Noto Sans JP', sans-serif;
  background: #f5f2ee;
  color: #2c2c2c;
  line-height: 1.7;
}

/* ===== Navbar ===== */
.bs-navbar {
  background: linear-gradient(135deg, #2d4a3e 0%, #1a3328 100%);
}
.bs-navbar .nav-link { color: rgba(255,255,255,.85) !important; }
.bs-navbar .nav-link:hover,
.bs-navbar .nav-link.active { color: #fff !important; }
.bs-navbar .navbar-brand { color: #a8d5b5 !important; letter-spacing: .02em; }

/* ===== Book Cards ===== */
.book-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1.2rem;
}
.book-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.08);
  overflow: hidden;
  transition: transform .18s ease, box-shadow .18s ease;
  cursor: pointer;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
}
.book-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 6px 18px rgba(0,0,0,.14);
  color: inherit;
  text-decoration: none;
}
.book-cover-wrap {
  width: 100%;
  aspect-ratio: 2/3;
  background: #e8e4de;
  overflow: hidden;
  position: relative;
}
.book-cover-wrap img {
  width: 100%; height: 100%;
  object-fit: cover;
}
.book-cover-placeholder {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.5rem;
  color: #b0a898;
}
.book-card-body {
  padding: .65rem .75rem .75rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .25rem;
}
.book-card-title {
  font-size: .82rem;
  font-weight: 700;
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.book-card-author {
  font-size: .72rem;
  color: #777;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.book-card-footer {
  margin-top: auto;
  padding-top: .3rem;
  display: flex;
  align-items: center;
  gap: .3rem;
}

/* Status ribbon */
.status-ribbon {
  position: absolute;
  top: 8px; right: -22px;
  background: #e67e22;
  color: #fff;
  font-size: .62rem;
  font-weight: 700;
  padding: 2px 28px;
  transform: rotate(35deg);
  letter-spacing: .05em;
}
.status-ribbon.reading { background: #2980b9; }
.status-ribbon.want    { background: #8e44ad; }

/* ===== Stars ===== */
.stars { font-size: 1rem; line-height: 1; }
.s-on  { color: #f0b429; }
.s-off { color: #ddd; }

/* Star rating input */
.star-input { display: inline-flex; flex-direction: row-reverse; gap: 2px; }
.star-input input[type=radio] { display: none; }
.star-input label {
  font-size: 1.6rem;
  color: #ddd;
  cursor: pointer;
  transition: color .1s;
}
.star-input input:checked ~ label,
.star-input label:hover,
.star-input label:hover ~ label { color: #f0b429; }

/* ===== Tags ===== */
.tag-chip {
  display: inline-block;
  background: #e8f4ec;
  color: #2d6a4f;
  border: 1px solid #b7dfc8;
  border-radius: 20px;
  font-size: .72rem;
  padding: 2px 10px;
  text-decoration: none;
  transition: background .15s;
}
.tag-chip:hover {
  background: #cceadb;
  color: #1a4a37;
  text-decoration: none;
}

/* Tag suggestions dropdown */
.tag-suggestions {
  position: absolute;
  z-index: 100;
  background: #fff;
  border: 1px solid #ddd;
  border-radius: 6px;
  box-shadow: 0 4px 12px rgba(0,0,0,.1);
  max-height: 200px;
  overflow-y: auto;
  width: 100%;
}
.tag-suggestion-item {
  padding: 6px 12px;
  cursor: pointer;
  font-size: .85rem;
}
.tag-suggestion-item:hover { background: #f0f7f4; }

/* ===== Book Detail ===== */
.cover-large {
  max-width: 200px;
  border-radius: 8px;
  box-shadow: 4px 6px 20px rgba(0,0,0,.2);
}
.detail-meta dt { font-weight: 600; color: #555; font-size: .85rem; }
.detail-meta dd { font-size: .95rem; }
.impressions-box {
  background: #fafaf8;
  border-left: 4px solid #2d6a4f;
  padding: 1rem 1.2rem;
  border-radius: 0 8px 8px 0;
  font-size: .95rem;
  white-space: pre-wrap;
  line-height: 1.8;
}

/* ===== Screenshots ===== */
.screenshot-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: .8rem;
}
.screenshot-item {
  position: relative;
  border-radius: 8px;
  overflow: hidden;
  background: #eee;
  aspect-ratio: 4/3;
}
.screenshot-item img {
  width: 100%; height: 100%;
  object-fit: cover;
  cursor: pointer;
  transition: opacity .15s;
}
.screenshot-item img:hover { opacity: .85; }
.screenshot-del {
  position: absolute;
  top: 4px; right: 4px;
  background: rgba(0,0,0,.55);
  color: #fff;
  border: none;
  border-radius: 50%;
  width: 22px; height: 22px;
  font-size: .65rem;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  opacity: 0;
  transition: opacity .15s;
}
.screenshot-item:hover .screenshot-del { opacity: 1; }

/* ===== Filters Sidebar ===== */
.filter-card {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  padding: 1.25rem;
  font-size: .88rem;
}
.filter-card h6 {
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: #888;
  margin-bottom: .5rem;
}

/* ===== ISBN Lookup ===== */
.isbn-result-card {
  background: #f0f7f4;
  border: 1px solid #b7dfc8;
  border-radius: 8px;
  padding: 1rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.isbn-result-card img { width: 60px; border-radius: 4px; }

/* ===== Search Results (title search) ===== */
.search-result-item {
  display: flex;
  gap: .8rem;
  padding: .6rem .8rem;
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s;
  align-items: flex-start;
}
.search-result-item:hover { background: #f0f7f4; }
.search-result-item img { width: 38px; border-radius: 3px; flex-shrink: 0; }
.search-result-title { font-size: .85rem; font-weight: 600; }
.search-result-sub   { font-size: .75rem; color: #777; }

/* ===== Page header ===== */
.page-heading {
  font-size: 1.4rem;
  font-weight: 700;
  color: #1a3328;
  border-bottom: 3px solid #2d6a4f;
  padding-bottom: .4rem;
  margin-bottom: 1.5rem;
}

/* ===== Utility ===== */
.btn-bookgreen {
  background: #2d6a4f;
  border-color: #2d6a4f;
  color: #fff;
}
.btn-bookgreen:hover {
  background: #1a4a37;
  border-color: #1a4a37;
  color: #fff;
}

/* ===== Responsive ===== */
@media (max-width: 576px) {
  .book-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
}

/* ===== Lightbox ===== */
#lightbox-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.85);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
}
#lightbox-overlay img {
  max-width: 90vw;
  max-height: 90vh;
  border-radius: 6px;
  box-shadow: 0 0 40px rgba(0,0,0,.5);
}
#lightbox-overlay.hidden { display: none; }
