/* styles.css - The Grand Library Bookshelf Showcase */

:root {
  /* Default Theme: Warm Walnut Library */
  --bg-wall: #16110d;
  --bg-wall-pattern: radial-gradient(circle at 50% 0%, #2a1f18 0%, #140f0b 75%);
  --bg-panel: rgba(32, 23, 17, 0.92);
  --bg-panel-solid: #211812;
  --bg-input: #140e0a;
  --border-subtle: rgba(212, 168, 106, 0.22);
  --border-strong: rgba(212, 168, 106, 0.48);

  --text-primary: #f5ead8;
  --text-secondary: #c9b59a;
  --text-muted: #8f7b63;
  --accent-gold: #e0b165;
  --accent-gold-bright: #f7cf86;
  --accent-amber: #c87d32;

  /* Wood Bookcase Colors */
  --case-frame: #2b180e;
  --case-back: linear-gradient(180deg, #1b100a 0%, #24160e 82%, #140b06 100%);
  --shelf-top: linear-gradient(180deg, #54321d 0%, #6e4328 100%);
  --shelf-front: linear-gradient(180deg, #7c4b2b 0%, #5c351d 45%, #422412 100%);
  --shelf-lip: #935c37;
  --shelf-shadow: rgba(0, 0, 0, 0.78);

  /* Book sizing */
  --book-width: 148px;
  --book-height: 214px;
  --shelf-gap: 26px;
}

body[data-theme="mahogany"] {
  --bg-wall: #190d0e;
  --bg-wall-pattern: radial-gradient(circle at 50% 0%, #331618 0%, #160a0b 75%);
  --bg-panel: rgba(38, 17, 19, 0.92);
  --bg-panel-solid: #271214;
  --bg-input: #16090a;
  --case-frame: #361315;
  --case-back: linear-gradient(180deg, #210b0d 0%, #2d1114 82%, #170708 100%);
  --shelf-top: linear-gradient(180deg, #632326 0%, #7d2f33 100%);
  --shelf-front: linear-gradient(180deg, #8a3539 0%, #632225 45%, #451518 100%);
  --shelf-lip: #a44549;
}

body[data-theme="oak"] {
  --bg-wall: #efe6d5;
  --bg-wall-pattern: radial-gradient(circle at 50% 0%, #faf5eb 0%, #e5d8c1 80%);
  --bg-panel: rgba(249, 243, 232, 0.94);
  --bg-panel-solid: #f5ede0;
  --bg-input: #ffffff;
  --border-subtle: rgba(138, 96, 48, 0.25);
  --border-strong: rgba(138, 96, 48, 0.55);
  --text-primary: #2c1e12;
  --text-secondary: #5c442c;
  --text-muted: #876b4f;
  --accent-gold: #9e651e;
  --accent-gold-bright: #7d4c0e;
  --case-frame: #8f6339;
  --case-back: linear-gradient(180deg, #d7be9b 0%, #DFC8A8 82%, #bfa27c 100%);
  --shelf-top: linear-gradient(180deg, #b58350 0%, #cc9862 100%);
  --shelf-front: linear-gradient(180deg, #d49f68 0%, #b68049 50%, #966534 100%);
  --shelf-lip: #e3b27e;
  --shelf-shadow: rgba(56, 33, 12, 0.38);
}

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

body {
  background: var(--bg-wall);
  background-image: var(--bg-wall-pattern);
  background-attachment: fixed;
  color: var(--text-primary);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  overflow-x: hidden;
}

/* Header & Library Controls */
.library-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-panel);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--border-subtle);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

.header-top {
  max-width: 1640px;
  margin: 0 auto;
  padding: 14px 24px 10px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.brand-group {
  display: flex;
  align-items: center;
  gap: 14px;
}

.brand-emblem {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: linear-gradient(135deg, #8b5a2b 0%, #4a2c11 100%);
  border: 1px solid var(--accent-gold);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  box-shadow: inset 0 1px 2px rgba(255, 255, 255, 0.25), 0 4px 12px rgba(0, 0, 0, 0.4);
}

.brand-title {
  font-family: 'Playfair Display', Georgia, Cambria, "Times New Roman", serif;
  font-size: 1.45rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--text-primary);
}

.brand-subtitle {
  font-size: 0.78rem;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.stat-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.stat-pill {
  background: rgba(224, 177, 101, 0.1);
  border: 1px solid var(--border-subtle);
  color: var(--text-secondary);
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
  transition: all 0.18s ease;
}

.stat-pill:hover,
.stat-pill.active {
  background: rgba(224, 177, 101, 0.24);
  border-color: var(--accent-gold);
  color: var(--text-primary);
}

.stat-pill strong {
  color: var(--accent-gold-bright);
  font-weight: 700;
}

.dot-indicator {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.dot-local { background: #34d399; box-shadow: 0 0 6px #34d399; }
.dot-web { background: #60a5fa; box-shadow: 0 0 6px #60a5fa; }
.dot-generic { background: #f59e0b; box-shadow: 0 0 6px #f59e0b; }

/* Controls Bar */
.controls-bar {
  max-width: 1640px;
  margin: 0 auto;
  padding: 8px 24px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.search-box {
  position: relative;
  flex: 1 1 260px;
  min-width: 220px;
}

.search-box input {
  width: 100%;
  padding: 9px 34px 9px 36px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.88rem;
  outline: none;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.search-box input:focus {
  border-color: var(--accent-gold);
  box-shadow: 0 0 0 2px rgba(224, 177, 101, 0.2);
}

.search-icon {
  position: absolute;
  left: 11px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 0.9rem;
  pointer-events: none;
}

.search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 2px 6px;
  display: none;
}

.control-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.control-label {
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

select.library-select,
button.library-btn {
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid var(--border-subtle);
  background: var(--bg-input);
  color: var(--text-primary);
  font-size: 0.83rem;
  cursor: pointer;
  outline: none;
  transition: all 0.18s ease;
}

select.library-select:hover,
button.library-btn:hover {
  border-color: var(--accent-gold);
}

button.library-btn.active {
  background: rgba(224, 177, 101, 0.22);
  border-color: var(--accent-gold);
  color: var(--accent-gold-bright);
}

.segmented-control {
  display: inline-flex;
  background: var(--bg-input);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  overflow: hidden;
}

.segmented-control button {
  background: transparent;
  border: none;
  color: var(--text-secondary);
  padding: 7px 11px;
  font-size: 0.79rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s ease;
  white-space: nowrap;
}

.segmented-control button + button {
  border-left: 1px solid var(--border-subtle);
}

.segmented-control button.active {
  background: rgba(224, 177, 101, 0.24);
  color: var(--accent-gold-bright);
  font-weight: 600;
}

/* Main Bookcase Area */
.bookcase-wrapper {
  max-width: 1640px;
  margin: 24px auto 64px;
  padding: 0 20px;
}

.bookcase-frame {
  background: var(--case-frame);
  border-radius: 14px;
  padding: 18px 18px 26px;
  box-shadow:
    0 24px 60px rgba(0, 0, 0, 0.75),
    inset 0 2px 3px rgba(255, 255, 255, 0.12),
    inset 0 0 0 2px rgba(0, 0, 0, 0.35);
  border: 2px solid rgba(120, 74, 38, 0.45);
}

/* Shelf Section (when grouped or continuous) */
.shelf-row {
  position: relative;
  background: var(--case-back);
  border-radius: 6px 6px 0 0;
  padding: 28px 26px 0;
  box-shadow:
    inset 0 18px 34px rgba(0, 0, 0, 0.65),
    inset 12px 0 22px rgba(0, 0, 0, 0.45),
    inset -12px 0 22px rgba(0, 0, 0, 0.45);
}

.shelf-row + .shelf-row {
  margin-top: 8px;
}

/* Brass Plaque Label for Shelf Groups */
.shelf-plaque-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 6px;
  border-bottom: 1px dashed rgba(224, 177, 101, 0.2);
}

.brass-plaque {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, #d7a95c 0%, #9f6f28 50%, #7d5318 100%);
  color: #1c1004;
  padding: 4px 14px;
  border-radius: 4px;
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 0.9rem;
  letter-spacing: 0.03em;
  box-shadow:
    0 3px 8px rgba(0, 0, 0, 0.55),
    inset 0 1px 0 rgba(255, 242, 210, 0.65);
  border: 1px solid #f3cd82;
}

.brass-plaque::before,
.brass-plaque::after {
  content: "•";
  color: #3b2307;
  font-size: 0.75rem;
}

.shelf-count-badge {
  font-size: 0.76rem;
  color: var(--text-secondary);
  background: rgba(0, 0, 0, 0.35);
  padding: 3px 10px;
  border-radius: 99px;
  border: 1px solid var(--border-subtle);
}

/* Books Lineup on the Wooden Plank */
.shelf-books {
  display: flex;
  flex-wrap: nowrap;
  align-items: flex-end;
  gap: var(--shelf-gap);
  min-height: calc(var(--book-height) + 12px);
  padding: 6px 8px 0;
  position: relative;
  z-index: 2;
}

/* 3D Wooden Shelf Ledge */
.shelf-wood-ledge {
  position: relative;
  z-index: 3;
  margin: 0 -26px;
}

.shelf-plank-top {
  height: 14px;
  background: var(--shelf-top);
  border-top: 1px solid var(--shelf-lip);
  box-shadow: inset 0 3px 8px rgba(0, 0, 0, 0.45);
}

.shelf-plank-front {
  height: 22px;
  background: var(--shelf-front);
  border-top: 1px solid var(--shelf-lip);
  border-bottom: 2px solid #241208;
  box-shadow:
    0 12px 24px var(--shelf-shadow),
    inset 0 1px 1px rgba(255, 255, 255, 0.18);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

/* Subtle woodgrain lines on shelf front */
.shelf-plank-front::after {
  content: "";
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent 0px,
    rgba(0, 0, 0, 0.06) 45px,
    transparent 90px
  );
  pointer-events: none;
}

/* Book Item Standing on Shelf */
.book-item {
  width: var(--book-width);
  flex: 0 0 var(--book-width);
  position: relative;
  cursor: pointer;
  perspective: 900px;
  user-select: none;
  transition: transform 0.26s cubic-bezier(0.2, 0.8, 0.2, 1), z-index 0s;
}

.book-item:hover {
  transform: translateY(-14px) scale(1.05);
  z-index: 20;
}

/* 3D Book Box */
.book-3d {
  width: var(--book-width);
  height: var(--book-height);
  position: relative;
  border-radius: 3px 6px 5px 3px;
  transform-style: preserve-3d;
  transform: rotateY(-8deg);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1), box-shadow 0.28s ease;
  box-shadow:
    -6px 6px 14px rgba(0, 0, 0, 0.65),
    4px 8px 18px rgba(0, 0, 0, 0.55);
  background: #231a14;
}

.book-item:hover .book-3d {
  transform: rotateY(0deg);
  box-shadow:
    0 18px 32px rgba(0, 0, 0, 0.8),
    0 0 20px rgba(224, 177, 101, 0.28);
}

/* Page edges on the right side of the 3D book */
.book-3d::after {
  content: "";
  position: absolute;
  top: 3px;
  bottom: 3px;
  right: -6px;
  width: 6px;
  background: repeating-linear-gradient(
    90deg,
    #e6dec8 0px,
    #cfc4a9 1px,
    #f2ead7 2px
  );
  border-radius: 0 2px 2px 0;
  transform: skewY(2deg);
  box-shadow: inset -1px 0 2px rgba(0, 0, 0, 0.35);
}

/* Spine hinge crease on the left side of the front cover */
.book-spine-crease {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 0;
  width: 11px;
  z-index: 4;
  background: linear-gradient(
    90deg,
    rgba(0, 0, 0, 0.52) 0%,
    rgba(255, 255, 255, 0.18) 38%,
    rgba(0, 0, 0, 0.32) 72%,
    transparent 100%
  );
  border-radius: 3px 0 0 3px;
  pointer-events: none;
}

/* Front Cover Image */
.book-cover-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 3px 5px 5px 3px;
  display: block;
  background: #1c140f;
}

/* Glossy lighting sheen over the book cover */
.book-sheen {
  position: absolute;
  inset: 0;
  border-radius: 3px 5px 5px 3px;
  background: linear-gradient(
    130deg,
    rgba(255, 255, 255, 0.16) 0%,
    rgba(255, 255, 255, 0.03) 38%,
    rgba(0, 0, 0, 0.18) 100%
  );
  pointer-events: none;
  z-index: 3;
}

/* Rich Generic Hardcover Fallback */
.generic-cover {
  width: 100%;
  height: 100%;
  border-radius: 3px 5px 5px 3px;
  padding: 10px 10px 10px 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
  color: #f8ecd5;
  text-align: center;
  box-shadow: inset 0 0 18px rgba(0, 0, 0, 0.55);
}

/* Leather/Cloth Texture overlay */
.generic-cover::before {
  content: "";
  position: absolute;
  inset: 6px 6px 6px 11px;
  border: 1px solid rgba(235, 195, 115, 0.48);
  border-radius: 2px;
  pointer-events: none;
}

.generic-cover::after {
  content: "";
  position: absolute;
  inset: 9px 9px 9px 14px;
  border: 1px solid rgba(235, 195, 115, 0.2);
  pointer-events: none;
}

.generic-genre-tag {
  font-size: 0.58rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(247, 214, 148, 0.85);
  margin-top: 4px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  padding: 0 4px;
}

.generic-ornament {
  font-size: 0.95rem;
  color: rgba(247, 214, 148, 0.75);
  line-height: 1;
}

.generic-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-weight: 700;
  font-size: 0.86rem;
  line-height: 1.22;
  color: #fff6e5;
  text-shadow: 0 1px 3px rgba(0, 0, 0, 0.7);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
  padding: 0 4px;
}

.generic-series {
  font-size: 0.64rem;
  color: #f0c97d;
  font-style: italic;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.generic-author {
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: rgba(245, 232, 208, 0.88);
  border-top: 1px solid rgba(235, 195, 115, 0.28);
  padding-top: 4px;
  margin-bottom: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Badges on Book Cover */
.book-badge-source {
  position: absolute;
  top: 6px;
  right: 6px;
  z-index: 5;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.62rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  backdrop-filter: blur(6px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.55);
  opacity: 0.88;
  transition: opacity 0.2s;
}

.badge-local {
  background: rgba(6, 78, 59, 0.88);
  color: #6ee7b7;
  border: 1px solid rgba(52, 211, 153, 0.45);
}

.badge-web {
  background: rgba(30, 58, 138, 0.88);
  color: #93c5fd;
  border: 1px solid rgba(96, 165, 250, 0.45);
}

.badge-generic {
  background: rgba(120, 53, 15, 0.88);
  color: #fcd34d;
  border: 1px solid rgba(245, 158, 11, 0.45);
}

.book-badge-series {
  position: absolute;
  bottom: 6px;
  left: 12px;
  z-index: 5;
  background: rgba(20, 14, 10, 0.86);
  color: var(--accent-gold-bright);
  border: 1px solid rgba(224, 177, 101, 0.45);
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 0.64rem;
  font-weight: 700;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.6);
}

/* Hover Tooltip Plate Under Book */
.book-caption {
  position: absolute;
  left: 50%;
  bottom: 8px;
  transform: translateX(-50%) translateY(6px);
  width: 172px;
  background: rgba(18, 12, 8, 0.95);
  border: 1px solid var(--accent-gold);
  border-radius: 6px;
  padding: 6px 8px;
  z-index: 30;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.18s ease, transform 0.18s ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.75);
  text-align: center;
}

.book-item:hover .book-caption {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.book-caption-title {
  font-size: 0.74rem;
  font-weight: 600;
  color: #fff5e4;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-caption-author {
  font-size: 0.66rem;
  color: #d6b485;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}

/* Compact Shelf Size */
body[data-shelf-size="compact"] {
  --book-width: 112px;
  --book-height: 164px;
  --shelf-gap: 18px;
}

body[data-shelf-size="compact"] .generic-title {
  font-size: 0.72rem;
  -webkit-line-clamp: 3;
}

body[data-shelf-size="large"] {
  --book-width: 178px;
  --book-height: 256px;
  --shelf-gap: 32px;
}

/* Spine View Mode */
body[data-shelf-size="spines"] .shelf-books {
  gap: 5px;
  min-height: 232px;
}

body[data-shelf-size="spines"] .book-item {
  width: 38px;
  flex: 0 0 38px;
  height: 224px;
}

body[data-shelf-size="spines"] .book-3d {
  display: none;
}

.book-spine-only {
  display: none;
}

body[data-shelf-size="spines"] .book-spine-only {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  width: 38px;
  height: 224px;
  border-radius: 3px 3px 1px 1px;
  padding: 10px 4px;
  box-shadow:
    inset 4px 0 6px rgba(255, 255, 255, 0.16),
    inset -4px 0 8px rgba(0, 0, 0, 0.55),
    2px 4px 8px rgba(0, 0, 0, 0.55);
  border-left: 1px solid rgba(255, 255, 255, 0.12);
  border-right: 1px solid rgba(0, 0, 0, 0.5);
  color: #f8ecd5;
  position: relative;
}

.spine-vertical-text {
  writing-mode: vertical-rl;
  text-orientation: mixed;
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 0.74rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  max-height: 155px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.spine-num {
  font-size: 0.62rem;
  color: #f3cd82;
  font-weight: 700;
}

/* Hide source badges when toggled off */
body.hide-badges .book-badge-source {
  display: none;
}

/* Load More / Pagination Footer */
.load-more-container {
  text-align: center;
  padding: 28px 0 10px;
}

.btn-gold {
  background: linear-gradient(180deg, #e0b165 0%, #b57e30 100%);
  color: #1c1005;
  font-weight: 700;
  border: 1px solid #f7cf86;
  padding: 11px 28px;
  border-radius: 8px;
  font-size: 0.92rem;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.45);
  transition: transform 0.15s ease, filter 0.15s ease;
}

.btn-gold:hover {
  transform: translateY(-2px);
  filter: brightness(1.08);
}

/* Empty State */
.empty-shelf-state {
  text-align: center;
  padding: 64px 24px;
  color: var(--text-secondary);
}

/* Book Detail Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(8, 5, 3, 0.82);
  backdrop-filter: blur(8px);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal-backdrop.open {
  display: flex;
}

.modal-card {
  background: var(--bg-panel-solid);
  border: 1px solid var(--border-strong);
  border-radius: 16px;
  max-width: 920px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.85);
  position: relative;
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 28px;
  padding: 28px;
}

@media (max-width: 740px) {
  .modal-card {
    grid-template-columns: 1fr;
  }
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid var(--border-subtle);
  background: rgba(0, 0, 0, 0.35);
  color: var(--text-primary);
  font-size: 1.2rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal-cover-col {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
}

.modal-cover-frame {
  width: 230px;
  height: 330px;
  border-radius: 6px 10px 10px 6px;
  overflow: hidden;
  position: relative;
  box-shadow: -10px 12px 28px rgba(0, 0, 0, 0.7);
  background: #18110c;
}

.modal-cover-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-source-box {
  width: 100%;
  background: rgba(0, 0, 0, 0.25);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 0.76rem;
  color: var(--text-secondary);
}

.cover-source-box code {
  display: block;
  margin-top: 4px;
  font-size: 0.7rem;
  color: var(--accent-gold-bright);
  word-break: break-all;
}

.modal-info-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-series-line {
  font-size: 0.84rem;
  color: var(--accent-gold);
  font-weight: 600;
  letter-spacing: 0.03em;
}

.modal-title {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 1.65rem;
  line-height: 1.2;
  color: var(--text-primary);
}

.modal-subtitle {
  font-size: 1rem;
  color: var(--text-secondary);
  margin-top: -6px;
}

.modal-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
  background: rgba(0, 0, 0, 0.22);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 14px;
}

.meta-item-label {
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
}

.meta-item-value {
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 2px;
}

.modal-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.category-chip {
  background: rgba(224, 177, 101, 0.14);
  border: 1px solid var(--border-subtle);
  color: var(--accent-gold-bright);
  font-size: 0.74rem;
  padding: 3px 10px;
  border-radius: 99px;
  cursor: pointer;
}

.category-chip:hover {
  border-color: var(--accent-gold);
  background: rgba(224, 177, 101, 0.26);
}

.modal-description {
  font-size: 0.9rem;
  line-height: 1.62;
  color: var(--text-secondary);
  max-height: 220px;
  overflow-y: auto;
  padding-right: 6px;
}

.modal-description p + p {
  margin-top: 10px;
}

.web-cover-results {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(76px, 1fr));
  gap: 8px;
  margin-top: 8px;
}

.web-cover-thumb {
  width: 100%;
  aspect-ratio: 2 / 3;
  object-fit: cover;
  border-radius: 4px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: transform 0.15s, border-color 0.15s;
}

.web-cover-thumb:hover {
  transform: scale(1.06);
  border-color: var(--accent-gold-bright);
}
