/* ============ VIEWS ============ */
.view { display: none; flex-direction: column; flex: 1; overflow: hidden; }
.view.active { display: flex; }

/* ============ SHELF HEADER ============ */
.shelf-header { padding: 14px 28px 0; flex-shrink: 0; }
.shelf-header-top { display: flex; justify-content: space-between; align-items: flex-start; }
.shelf-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 28px; font-weight: 300;
  color: var(--ink); letter-spacing: 1px; line-height: 1;
}
.shelf-subtitle {
  font-size: 11px; color: var(--ink-faint);
  font-weight: 300; letter-spacing: 3px; margin-top: 4px;
}
.shelf-add {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; border: 0.8px solid rgba(168,154,142,0.15);
  background: var(--cream);
  font-size: 16px; color: var(--ink-light); font-weight: 300;
}

/* ============ SHELF STATS ============ */
.shelf-stats {
  display: flex; gap: 20px; margin: 16px 28px 0; padding-bottom: 14px;
  border-bottom: 0.5px solid rgba(168,154,142,0.08);
}
.shelf-stat-num {
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px; font-weight: 300;
  color: var(--ink); line-height: 1;
}
.shelf-stat-label {
  font-family: 'EB Garamond', serif;
  font-size: 8.5px; color: var(--ink-faint);
  letter-spacing: 1.5px; text-transform: uppercase; margin-top: 3px;
}

/* ============ SHELF CONTENT ============ */
.shelf-content {
  flex: 1; overflow-y: auto;
  padding: 18px 28px 12px;
  -webkit-overflow-scrolling: touch;
}

.shelf-section-title {
  font-family: 'EB Garamond', serif;
  font-size: 9.5px; letter-spacing: 2.5px;
  text-transform: uppercase; color: var(--ink-faint);
  margin-bottom: 14px;
}

/* ============ BOOK GRID ============ */
.book-grid { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 24px; }

.book-card {
  width: calc(33.33% - 10px); cursor: pointer;
  transition: transform 0.2s;
}
.book-card:active { transform: scale(0.96); }

.book-cover {
  width: 100%; aspect-ratio: 2/3; border-radius: 3px 10px 10px 3px;
  position: relative; overflow: hidden;
  box-shadow: 3px 4px 14px rgba(58,51,48,0.1);
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 12px 10px;
}
/* spine */
.book-cover::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
  background: rgba(0,0,0,0.15);
}
.book-cover::after {
  content: ''; position: absolute; left: 5px; top: 12%; bottom: 12%; width: 0.5px;
  background: repeating-linear-gradient(to bottom, rgba(255,255,255,0.1) 0, rgba(255,255,255,0.1) 3px, transparent 3px, transparent 7px);
}

/* Book cover inner frame */
.bc-frame {
  position: absolute; inset: 7px 6px 7px 9px;
  border: 0.5px solid rgba(255,255,255,0.12);
  pointer-events: none;
}
.book-name {
  font-size: 12px; color: rgba(255,255,255,0.9); text-align: center;
  line-height: 1.5; font-weight: 400;
  text-shadow: 0 1px 3px rgba(0,0,0,0.2);
  position: relative; z-index: 1;
}
.bc-divider {
  width: 18px; height: 0.5px; margin: 5px 0;
  background: rgba(255,255,255,0.2);
}
.book-author {
  font-family: 'EB Garamond', serif;
  font-size: 7.5px; color: rgba(255,255,255,0.5);
  letter-spacing: 1.5px; text-transform: uppercase;
  position: relative; z-index: 1;
}

/* ============ BOOK COVER THEMES ============ */

/* 小王子 — indigo night + gold */
.bc-1 {
  background: linear-gradient(160deg, #1e2245 0%, #282850 40%, #1c1f3d 100%);
}
.bc-1 .bc-frame { border-color: rgba(215,190,130,0.22); }
.bc-1 .book-name { color: rgba(218,195,135,0.92); }
.bc-1 .book-author { color: rgba(218,195,135,0.45); }
.bc-1 .bc-divider { background: rgba(218,195,135,0.3); }

/* 月亮与六便士 — midnight teal + silver */
.bc-2 {
  background: linear-gradient(155deg, #0f1c2b 0%, #1a2d3d 40%, #0e1a28 100%);
}
.bc-2 .bc-frame { border-color: rgba(190,210,225,0.16); }
.bc-2 .book-name { color: rgba(200,218,232,0.9); }
.bc-2 .book-author { color: rgba(190,210,225,0.45); }
.bc-2 .bc-divider { background: rgba(190,210,225,0.25); }

/* 情人 — deep burgundy + rose */
.bc-3 {
  background: linear-gradient(150deg, #3c1c2a 0%, #4a2435 40%, #351828 100%);
}
.bc-3 .bc-frame { border-color: rgba(225,180,170,0.18); }
.bc-3 .book-name { color: rgba(232,195,188,0.92); }
.bc-3 .book-author { color: rgba(225,180,170,0.45); }
.bc-3 .bc-divider { background: rgba(225,180,170,0.3); }

/* 人间失格 — graphite + white */
.bc-4 {
  background: linear-gradient(160deg, #1c1c1e 0%, #282828 40%, #1a1a1c 100%);
}
.bc-4 .bc-frame { border-color: rgba(255,255,255,0.08); }
.bc-4 .book-name { color: rgba(255,255,255,0.82); }
.bc-4 .book-author { color: rgba(255,255,255,0.35); }
.bc-4 .bc-divider { background: rgba(255,255,255,0.12); }

/* 海边的卡夫卡 — deep ocean + aqua */
.bc-5 {
  background: linear-gradient(155deg, #1a2e3a 0%, #253c4a 40%, #192c38 100%);
}
.bc-5 .bc-frame { border-color: rgba(145,200,215,0.18); }
.bc-5 .book-name { color: rgba(175,218,228,0.9); }
.bc-5 .book-author { color: rgba(145,200,215,0.45); }
.bc-5 .bc-divider { background: rgba(145,200,215,0.25); }

/* ============ BOOK PROGRESS ============ */
.book-progress-wrap {
  margin-top: 6px; display: flex; align-items: center; gap: 6px;
}
.book-progress-bar {
  flex: 1; height: 2px;
  background: rgba(168,154,142,0.15); border-radius: 1px; overflow: hidden;
}
.book-progress-fill { height: 100%; background: var(--accent); border-radius: 1px; }
.book-progress-text {
  font-family: 'EB Garamond', serif;
  font-size: 8px; color: var(--ink-faint); letter-spacing: 0.5px;
}

/* ============ CURRENTLY READING ============ */
.reading-now {
  background: var(--cream); border-radius: 14px; padding: 16px;
  display: flex; gap: 14px; margin-bottom: 24px; cursor: pointer;
  transition: transform 0.2s;
}
.reading-now:active { transform: scale(0.98); }

.reading-now-cover {
  width: 60px; height: 90px; border-radius: 3px 8px 8px 3px;
  flex-shrink: 0; position: relative; overflow: hidden;
  box-shadow: 2px 3px 10px rgba(58,51,48,0.1);
  display: flex; align-items: center; justify-content: center;
}
.reading-now-cover::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: rgba(0,0,0,0.15);
}
.reading-now-cover .bc-frame { inset: 5px 4px 5px 6px; }
.reading-now-cover .book-name { font-size: 10px; }

.reading-now-info { flex: 1; display: flex; flex-direction: column; justify-content: center; }
.reading-now-label {
  font-family: 'EB Garamond', serif;
  font-size: 8.5px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--dusty-rose); margin-bottom: 5px;
}
.reading-now-title { font-size: 14px; color: var(--ink); font-weight: 400; margin-bottom: 2px; }
.reading-now-author {
  font-family: 'EB Garamond', serif;
  font-size: 10px; color: var(--ink-faint);
  letter-spacing: 1px; font-style: italic; margin-bottom: 8px;
}
.reading-now-progress { display: flex; align-items: center; gap: 8px; }
.reading-now-bar {
  flex: 1; height: 3px;
  background: rgba(168,154,142,0.12); border-radius: 2px; overflow: hidden;
}
.reading-now-fill { height: 100%; background: var(--accent); border-radius: 2px; }
.reading-now-pct {
  font-family: 'EB Garamond', serif;
  font-size: 10px; color: var(--ink-faint);
}
.reading-now-chapter {
  font-size: 10px; color: var(--ink-faint);
  font-weight: 300; margin-top: 5px;
}

/* ============ DUAL PROGRESS ============ */
.reading-now-dual { display: flex; gap: 14px; margin-top: 8px; }
.reading-now-who { display: flex; align-items: center; gap: 5px; }
.rn-avatar {
  width: 16px; height: 16px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.rn-avatar.rn-claude {
  background: var(--cream);
  border: 0.5px solid rgba(168,154,142,0.15);
}
.rn-avatar.rn-claude svg { width: 8px; height: 8px; fill: var(--ink); }
.rn-avatar.rn-nai { background: var(--blush); color: var(--ink); font-size: 6px; }
.rn-chap {
  font-family: 'EB Garamond', serif;
  font-size: 9px; color: var(--ink-faint); letter-spacing: 0.5px;
}

/* ============ READER VIEW ============ */
.reader-header {
  padding: 14px 20px; display: flex; align-items: center; gap: 10px;
  flex-shrink: 0; border-bottom: 0.5px solid rgba(168,154,142,0.08);
}
.reader-back {
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.reader-back svg {
  width: 18px; height: 18px; fill: none;
  stroke: var(--ink-light); stroke-width: 1.5;
  stroke-linecap: round; stroke-linejoin: round;
}
.reader-title-area { flex: 1; text-align: center; min-width: 0; }
.reader-title-book {
  font-size: 12px; color: var(--ink); font-weight: 400;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.reader-title-chapter {
  font-family: 'EB Garamond', serif;
  font-size: 9px; color: var(--ink-faint);
  letter-spacing: 1px; margin-top: 1px;
}
.reader-toc-btn {
  cursor: pointer; display: flex; align-items: center; justify-content: center;
}
.reader-toc-btn svg {
  width: 18px; height: 18px; fill: none;
  stroke: var(--ink-light); stroke-width: 1.5; stroke-linecap: round;
}

.reader-content {
  flex: 1; overflow-y: auto; -webkit-overflow-scrolling: touch;
  display: flex; justify-content: center;
  background: linear-gradient(to right, rgba(168,154,142,0.03) 0%, transparent 3%, transparent 97%, rgba(168,154,142,0.03) 100%);
}
.reader-inner { max-width: 620px; width: 100%; padding: 28px 22px 20px; }

.chapter-title {
  font-size: 18px; text-align: center; color: var(--ink); font-weight: 400;
  letter-spacing: 2px; margin-bottom: 6px; line-height: 1.6;
}
.chapter-ornament {
  text-align: center; margin-bottom: 24px;
  font-family: 'Cormorant Garamond', serif; font-size: 11px;
  color: var(--accent); opacity: 0.35; letter-spacing: 6px;
}

/* ============ PARAGRAPHS ============ */
.paragraph {
  font-size: 14.5px; line-height: 2.1; text-indent: 2em;
  padding: 6px 10px; margin: 0 0 2px;
  cursor: pointer; border-radius: 6px;
  border-left: 3px solid transparent;
  position: relative; transition: background 0.15s;
}
.paragraph:active { background: rgba(196,168,130,0.06); }
.paragraph.has-comment {
  background: linear-gradient(to right, rgba(196,168,130,0.04), rgba(249,245,239,0.5));
  border-left-color: var(--accent);
}
.paragraph .comment-count {
  position: absolute; right: 6px; top: 6px;
  font-family: 'EB Garamond', serif; font-size: 8.5px; color: var(--accent);
  background: rgba(196,168,130,0.1); padding: 1px 7px; border-radius: 8px;
}

/* ============ ANNOTATION SECTION (reader-specific) ============ */
.anno-section { padding: 8px 6px 8px 10px; }

/* Override common anno-bubble for reader view — full width */
.anno-section .anno-bubble {
  max-width: 100%; padding: 12px 14px;
  font-size: 13px; line-height: 1.8;
}

.anno-header { display: flex; align-items: center; gap: 6px; margin-bottom: 6px; }
.anno-avatar {
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.anno-avatar.av-nai { background: rgba(201,169,160,0.15); font-size: 7px; color: var(--ink); }
.anno-avatar.av-claude { background: rgba(91,127,165,0.1); }
.anno-avatar.av-claude svg { width: 9px; height: 9px; fill: var(--ink-light); }
.anno-name.name-nai { color: #a0775a; }
.anno-name.name-claude { color: #5b7fa5; }
.anno-time {
  font-family: 'EB Garamond', serif;
  font-size: 9px; color: var(--ink-faint); margin-left: auto;
}
.anno-highlight {
  font-size: 11px; color: var(--ink-faint); font-style: italic;
  padding: 4px 10px; margin: 0 0 6px; border-radius: 4px; line-height: 1.6;
}
.anno-highlight.hl-nai { border-left: 2px solid #a0775a; background: rgba(160,119,90,0.04); }
.anno-highlight.hl-claude { border-left: 2px solid #5b7fa5; background: rgba(91,127,165,0.04); }
.anno-text { font-size: 13px; line-height: 1.8; font-weight: 300; }

/* ============ ANNOTATION INPUT ============ */
.anno-input-wrap {
  display: none; margin-top: 6px; gap: 8px; align-items: flex-end;
}
.anno-input-wrap.show { display: flex; }
.anno-input {
  flex: 1; border: 0.5px solid rgba(168,154,142,0.15);
  background: var(--warm-white);
  border-radius: 10px; padding: 8px 12px; font-size: 12px;
  font-family: 'Noto Serif SC', serif; color: var(--ink); outline: none;
  resize: none; height: 40px; font-weight: 300;
}
.anno-input:focus { border-color: var(--accent); }
.anno-send {
  font-family: 'Caveat', cursive; font-size: 12px; color: var(--warm-white);
  background: var(--ink); padding: 8px 14px; border-radius: 10px;
  cursor: pointer; white-space: nowrap; height: 40px;
  display: flex; align-items: center;
}

/* ============ READER NAVIGATION ============ */
.reader-nav {
  display: flex; justify-content: space-between; align-items: center;
  padding: 24px 0 50px; margin-top: 28px; position: relative;
}
.reader-nav::before {
  content: ''; position: absolute; top: -4px; left: 50%; transform: translateX(-50%);
  width: 40px; height: 0.5px; background: var(--accent-soft);
}
.reader-nav-btn {
  font-family: 'EB Garamond', serif; font-size: 10px; color: var(--ink-faint);
  letter-spacing: 1px; cursor: pointer; padding: 6px 14px;
  border: 0.5px solid rgba(168,154,142,0.12); border-radius: 20px;
  background: var(--warm-white); transition: all 0.2s;
}
.reader-nav-btn:active { background: var(--cream); }
.reader-nav-page {
  font-family: 'EB Garamond', serif;
  font-size: 10px; color: var(--ink-faint); letter-spacing: 1px;
}

/* ============ READER PROGRESS BAR ============ */
.reader-progress {
  position: absolute; bottom: calc(64px + var(--safe-bottom)); left: 0; right: 0;
  height: 2px; z-index: 15;
  background: rgba(168,154,142,0.08);
}
.reader-progress-fill {
  height: 100%; background: var(--accent);
  border-radius: 0 1px 1px 0; transition: width 0.3s;
}

/* ============ TOC SIDEBAR ============ */
.toc-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,0.2); z-index: 49;
  display: none; backdrop-filter: blur(2px);
}
.toc-overlay.show { display: block; }
.toc-panel {
  position: fixed; top: 0; left: 0; bottom: 0; width: 240px;
  background: var(--warm-white); z-index: 50;
  padding: 50px 20px 20px;
  overflow-y: auto;
  box-shadow: 6px 0 20px rgba(58,51,48,0.06);
  display: none;
}
.toc-panel.show { display: block; }
.toc-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 18px; font-weight: 300;
  color: var(--ink); margin-bottom: 16px; letter-spacing: 1px;
}
.toc-item {
  padding: 8px 10px; border-radius: 8px;
  font-size: 12px; color: var(--ink-light);
  cursor: pointer; margin-bottom: 2px; font-weight: 300;
  transition: background 0.15s;
  display: flex; align-items: center; gap: 8px;
}
.toc-item:active { background: rgba(196,168,130,0.08); }
.toc-item.current {
  background: rgba(196,168,130,0.1);
  color: var(--ink); font-weight: 400;
}
.toc-roman {
  font-family: 'Cormorant Garamond', serif;
  font-size: 10px; color: var(--ink-faint);
  width: 24px; flex-shrink: 0; letter-spacing: 1px;
}

/* ============ HIGHLIGHTS ============ */
.highlights-card {
  background: var(--cream); border-radius: 14px; padding: 16px 18px;
  margin-bottom: 24px; cursor: pointer; transition: transform 0.2s;
}
.highlights-card:active { transform: scale(0.98); }
.hl-quote {
  font-size: 13px; color: var(--ink); font-weight: 300; line-height: 1.8;
  font-style: italic; padding-left: 14px;
  border-left: 2px solid var(--accent-soft);
}
.hl-from {
  font-family: 'EB Garamond', serif;
  font-size: 9px; color: var(--ink-faint);
  letter-spacing: 1px; margin-top: 10px; padding-left: 14px;
}
.hl-who { display: flex; gap: 6px; margin-top: 8px; }
.hl-badge {
  font-family: 'Caveat', cursive; font-size: 10px;
  padding: 2px 8px; border-radius: 8px;
}
.hl-badge.hl-claude { background: rgba(91,127,165,0.08); color: #5b7fa5; }
.hl-badge.hl-nai { background: rgba(201,169,160,0.1); color: #a0775a; }
.hl-count {
  font-family: 'EB Garamond', serif;
  font-size: 9px; color: var(--ink-faint);
  letter-spacing: 1px; margin-top: 10px; font-style: italic;
}

/* ============ READING LOG ============ */
.reading-log { margin-bottom: 24px; }
.log-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 0; border-bottom: 0.5px solid rgba(168,154,142,0.06);
}
.log-avatar {
  width: 18px; height: 18px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.log-avatar.la-claude {
  background: var(--cream);
  border: 0.5px solid rgba(168,154,142,0.15);
}
.log-avatar.la-claude svg { width: 9px; height: 9px; fill: var(--ink); }
.log-avatar.la-nai { background: var(--blush); font-size: 7px; color: var(--ink); }
.log-avatar.la-both {
  background: linear-gradient(135deg, var(--cream) 50%, var(--blush) 50%);
  border: 0.5px solid rgba(168,154,142,0.15);
  font-size: 5px; color: var(--ink-faint);
}
.log-info { flex: 1; min-width: 0; }
.log-detail { font-size: 11px; color: var(--ink-light); font-weight: 300; }
.log-time {
  font-family: 'EB Garamond', serif;
  font-size: 8.5px; color: var(--ink-faint);
  letter-spacing: 0.5px; margin-top: 1px;
}

/* ============ CHAPTER DISCUSSION ============ */
.chapter-discuss {
  margin-top: 36px; padding-top: 24px;
  border-top: 0.5px solid rgba(168,154,142,0.1);
}
.cd-header { text-align: center; margin-bottom: 20px; }
.cd-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 16px; font-weight: 300;
  color: var(--ink); letter-spacing: 2px;
}
.cd-subtitle {
  font-size: 11px; color: var(--ink-faint);
  font-weight: 300; margin-top: 4px;
}
.cd-ornament {
  text-align: center; margin: 14px 0;
  font-family: 'Cormorant Garamond', serif; font-size: 10px;
  color: var(--accent); opacity: 0.3; letter-spacing: 4px;
}

/* Question card */
.cd-question {
  background: var(--cream); border-radius: 12px;
  padding: 16px; margin-bottom: 18px;
}
.cd-q-label {
  font-family: 'EB Garamond', serif;
  font-size: 8.5px; letter-spacing: 2px;
  text-transform: uppercase; color: var(--dusty-rose); margin-bottom: 8px;
}
.cd-q-text {
  font-size: 14px; color: var(--ink); font-weight: 400;
  line-height: 1.8; margin-bottom: 14px;
}
.cd-answers { display: flex; flex-direction: column; gap: 10px; }
.cd-answer-locked {
  font-size: 11px; color: var(--ink-faint); font-weight: 300;
  text-align: center; padding: 10px 0; font-style: italic;
  background: rgba(168,154,142,0.04); border-radius: 10px;
  border: 0.5px dashed rgba(168,154,142,0.15);
}
.cd-thread { display: flex; flex-direction: column; gap: 10px; margin-bottom: 8px; }
.cd-input-wrap {
  display: flex; gap: 8px; align-items: flex-end; margin-top: 12px;
}
.cd-input {
  flex: 1; border: 0.5px solid rgba(168,154,142,0.15);
  background: var(--warm-white);
  border-radius: 10px; padding: 8px 12px; font-size: 12px;
  font-family: 'Noto Serif SC', serif; color: var(--ink); outline: none;
  resize: none; height: 40px; font-weight: 300;
}
.cd-input:focus { border-color: var(--accent); }
.cd-send {
  font-family: 'Caveat', cursive; font-size: 12px; color: var(--warm-white);
  background: var(--ink); padding: 8px 14px; border-radius: 10px;
  cursor: pointer; white-space: nowrap; height: 40px;
  display: flex; align-items: center;
}

/* ============ SKELETON LOADING ============ */
.sk-block {
  background: linear-gradient(90deg, var(--cream) 25%, var(--accent-soft) 50%, var(--cream) 75%);
  background-size: 200% 100%;
  animation: skShimmer 1.5s ease-in-out infinite;
}
.sk-line {
  height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--cream) 25%, var(--accent-soft) 50%, var(--cream) 75%);
  background-size: 200% 100%;
  animation: skShimmer 1.5s ease-in-out infinite;
}
@keyframes skShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
