body, html {
  background-color: #000000;
  color: #333;
}

header {
  text-align: center;
  padding: 2rem 1rem 1rem;
}

header h1 {
  margin: 0;
  font-size: 2.4rem;
  color: #888888;
}

.book-list-container {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}
.book-list-item {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 1rem;
  width: 10rem;
  aspect-ratio: 1/1.4; 
  border: 2px solid #ccc;
  border-radius: 0.5rem;
  background-color: #f8f8f8;
}
.author {
  color: #444;
}
.title {
  font-weight: bold;
  font-size: 1.25rem;
  line-height: 1;
  overflow: scroll;
}
.publisher, .year {
  text-align: right;
  font-size: 0.8rem;
  color: #c88;
}

/* Shelf and spine styles - more realistic bookshelf */
#book-list { display:flex; justify-content:center; padding:3rem 1rem 2rem; background:#000000; }
.shelf { width: fit-content; min-height: 400px; position:relative; padding:30px 20px 40px; background:linear-gradient(to bottom, #4a4a4a 0%, #595959 50%, #313131 100%); border-radius:8px; box-shadow: 0 10px 30px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.1); flex-shrink: 0; }
.spine-row { display:flex; gap:3px; align-items:flex-end; justify-content:center; padding:20px 12px 0; flex-wrap:nowrap; overflow-x:auto; }
.book-item { display:flex; flex-direction:column; align-items:center; flex-shrink:0; }
.book-info { display:none; }
.spine { width:50px; min-width:28px; height:auto; min-height:180px; aspect-ratio: auto; display:flex; align-items:center; justify-content:center; text-decoration:none; color:#000; border-radius:2px; box-shadow: 0 8px 16px rgba(0,0,0,0.8), inset -2px 0 4px rgba(0,0,0,0.3), inset 1px 0 1px rgba(255,255,255,0.15); border-left:1px solid rgba(0,0,0,0.12); border-right:1px solid rgba(0,0,0,0.12); padding:3px; cursor:pointer; transition: all 200ms ease; position:relative; transform:perspective(600px) rotateY(-2deg) rotateX(1deg); flex: 0 0 auto; box-sizing: border-box; }
.spine::before { content:''; position:absolute; inset:0; background:linear-gradient(90deg, transparent, rgba(255,255,255,0.08), transparent); border-radius:2px; }
.spine::after { content:''; position:absolute; top:0; left:0; right:0; bottom:0; background:linear-gradient(to right, rgba(0,0,0,0.08) 0%, transparent 40%); border-radius:2px; }
.spine:hover { transform: perspective(600px) rotateY(-2deg) rotateX(1deg) translateY(-12px); box-shadow: 0 12px 24px rgba(0,0,0,0.9), inset -2px 0 4px rgba(0,0,0,0.3), inset 1px 0 1px rgba(255,255,255,0.15); }
.spine-text { display:flex; flex-direction:column; align-items:center; justify-content:center; width:100%; height:100%; writing-mode: vertical-rl; text-orientation: mixed; position:relative; z-index:2; }
.spine-title { font-weight:700; font-size:13px; line-height:1.2; text-align:center; margin-bottom:4px; word-wrap:break-word; text-shadow: none; color:#000; }
.spine-author { font-size:10px; color:#666; text-align:center; text-shadow: none; }
.shelf-base { position:absolute; bottom:0; left:0; right:0; height:40px; background:linear-gradient(to bottom, #2d1f0f 0%, #1a0f06 50%, #0f0803 100%); border-radius:0 0 8px 8px; box-shadow: inset 0 1px 0 rgba(255,255,255,0.1), 0 2px 4px rgba(0,0,0,0.3); }

@media (max-width:600px) {
  .spine { width:44px; height:160px; }
  .spine-title { font-size:12px; }
}

/* Layout: left preview frame + right shelf */
.bookshelf-layout { display:flex; gap:40px; align-items:center; justify-content:center; }
.frame { width:500px; max-width:50vw; min-width:280px; height:480px; box-shadow: 0 8px 20px rgba(0,0,0,0.12); background:#2a2a2a; border-radius:6px; display:flex; flex-direction:column; }
.frame-inner { position:relative; flex:1; display:flex; align-items:center; justify-content:center; overflow:hidden; background:#1a1a1a; }
.frame-inner img { width:100%; height:100%; object-fit:cover; display:none; }
.frame-empty { position:absolute; inset:0; display:flex; align-items:center; justify-content:center; color:#666; font-size:14px; padding:12px; text-align:center; }
.frame-caption { padding:12px; font-weight:700; text-align:center; background:#2a2a2a; color:#d0a574; }

@media (max-width:1000px) {
  .bookshelf-layout { flex-direction:column-reverse; align-items:center; gap:2rem; }
  .frame { width:min(90%, 400px); height:380px; }
  .spine-row { gap:16px; }
}

@media (max-width:640px) {
  .spine { width:42px; min-height:150px; }
  .book-info { width:75px; font-size:10px; }
  .book-title { font-size:11px; }
  .spine-row { gap:12px; }
}

/* Detail pages */
.book-detail-page {
  min-height: 100vh;
  color: #e8dccf;
}

.book-detail-page header {
  text-align: center;
  padding: 2rem 1rem 1rem;
}

.book-detail-page h1 {
  margin: 0;
  color: #7a7a7a;
  letter-spacing: 0.04em;
}

.book-detail-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1rem 1rem 2rem;
}

.book-detail-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  justify-content: center;
}

.book-detail-layout .frame-inner img {
  display: block;
  width: 100%;
  height: 100%;
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  object-position: center center;
}

.book-detail-layout .frame-inner {
  align-items: stretch;
  justify-content: stretch;
}

.book-essay {
  width: min(680px, 90vw);
  min-height: 480px;
  border-radius: 6px;
  background: linear-gradient(to bottom, #2d1f0f 0%, #1a0f06 100%);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
  padding: 1.25rem 1.5rem;
  box-sizing: border-box;
}

.book-essay h2 {
  margin-top: 0;
  margin-bottom: 0.8rem;
  color: #e2c8a9;
  font-size: 1.2rem;
}

.book-essay p {
  margin: 0 0 0.9rem;
  line-height: 1.8;
  color: #e8dccf;
}

.back-link {
  display: inline-block;
  margin-top: 0.5rem;
  color: #d6b48a;
  text-decoration: none;
}

.back-link:hover {
  text-decoration: underline;
}

@media (max-width: 1000px) {
  .book-detail-layout {
    flex-direction: column;
    align-items: center;
  }

  .book-essay {
    min-height: auto;
  }
}