/* styles.css - Theme matching https://tlyer.wang/ (NotionNext Hexo Style) */

:root {
  --primary: #928CEE;
  --primary-hover: #7d77e4;
  --primary-light: rgba(146, 140, 238, 0.12);
  --primary-glow: rgba(146, 140, 238, 0.28);
  
  --bg-page: #f8f9fa;
  --bg-card: #ffffff;
  --bg-card-hover: #fafbff;
  --text-main: #1f2937;
  --text-muted: #6b7280;
  --text-subtle: #9ca3af;
  --border-color: #e5e7eb;
  --border-subtle: #f3f4f6;

  --badge-finished-bg: #ecfdf5;
  --badge-finished-text: #059669;
  --badge-reading-bg: #eff6ff;
  --badge-reading-text: #2563eb;
  --badge-listening-bg: #fffbeb;
  --badge-listening-text: #d97706;
  --badge-ready-bg: #f3f4f6;
  --badge-ready-text: #4b5563;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.08), 0 2px 4px -1px rgba(0, 0, 0, 0.04);
  --shadow-lg: 0 10px 25px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.04);
  --shadow-modal: 0 25px 60px -15px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.05);
  --shadow-book: 0 10px 22px -4px rgba(0, 0, 0, 0.16), 0 2px 6px rgba(0, 0, 0, 0.08);

  --font-serif: "Noto Serif SC", Georgia, "Times New Roman", serif;
  --font-sans: "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Dark mode overrides (respecting system & user blog dark preference) */
body.dark {
  --bg-page: #0d0f12;
  --bg-card: #16191f;
  --bg-card-hover: #1e222a;
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-subtle: #6b7280;
  --border-color: #272c35;
  --border-subtle: #1f232b;

  --badge-finished-bg: rgba(5, 150, 105, 0.18);
  --badge-finished-text: #34d399;
  --badge-reading-bg: rgba(37, 99, 235, 0.18);
  --badge-reading-text: #60a5fa;
  --badge-listening-bg: rgba(217, 119, 6, 0.18);
  --badge-listening-text: #fbbf24;
  --badge-ready-bg: rgba(75, 85, 99, 0.25);
  --badge-ready-text: #9ca3af;

  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.5);
  --shadow-md: 0 4px 10px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 12px 25px rgba(0, 0, 0, 0.5);
  --shadow-modal: 0 25px 60px -15px rgba(0, 0, 0, 0.8), 0 0 0 1px rgba(255, 255, 255, 0.08);
  --shadow-book: 0 10px 25px -4px rgba(0, 0, 0, 0.6), 0 4px 10px rgba(0, 0, 0, 0.4);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-page);
  color: var(--text-main);
  line-height: 1.6;
  min-height: 100vh;
  transition: background-color 0.3s ease, color 0.3s ease;
  overflow-x: hidden;
}

body.modal-open {
  overflow: hidden !important;
}

a {
  color: inherit;
  text-decoration: none;
}

/* Container */
.page-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* Header & Hero */
.reading-header {
  margin-bottom: 2.5rem;
}

.header-inner {
  position: relative;
  text-align: center;
  padding: 3rem 1.5rem 2rem;
  background: var(--bg-card);
  border-radius: 1.5rem;
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
  overflow: hidden;
}

.header-inner::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #928CEE, #60a5fa, #928CEE);
}

/* Header Dynamic Quote Carousel (Poetic & Minimalist) */
.header-quote-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 110px;
  max-width: 820px;
  margin: 0.5rem auto 1.5rem;
  padding: 0 1rem;
}

.quote-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  padding: 0.8rem 1.6rem;
  border-radius: 1rem;
  transition: background-color 0.25s ease;
  user-select: none;
}

.quote-card:hover {
  background: var(--primary-light);
}

.hero-quote-text {
  font-family: var(--font-serif);
  font-size: 1.32rem;
  font-weight: 600;
  line-height: 1.65;
  color: var(--text-main);
  letter-spacing: 0.02em;
  margin-bottom: 0.6rem;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.hero-quote-source {
  font-family: var(--font-sans);
  font-size: 0.88rem;
  font-weight: 500;
  color: var(--primary);
  letter-spacing: 0.03em;
  transition: opacity 0.35s ease;
}

.quote-fade-out {
  opacity: 0;
  transform: translateY(-8px);
}

/* Stats Dashboard (5 Cards) */
.stats-dashboard {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 1rem;
  max-width: 980px;
  margin: 0 auto;
}

.stat-icon-reading {
  color: #10b981;
  background: rgba(16, 185, 129, 0.12);
}

.stat-card {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 1rem 1.2rem;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: 1rem;
  transition: var(--transition);
}

.stat-card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
}

.stat-icon {
  font-size: 1.4rem;
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 0.75rem;
  background: var(--primary-light);
}

.stat-meta {
  text-align: left;
  display: flex;
  flex-direction: column;
}

.stat-num {
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.header-actions {
  position: absolute;
  top: 1.5rem;
  right: 1.5rem;
}

.btn-icon {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
}

.btn-icon:hover {
  color: var(--primary);
  border-color: var(--primary);
  transform: rotate(15deg);
}

/* Toolbar: Filters & Search */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 1rem;
  margin-bottom: 1.2rem;
}

.filter-tabs {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  overflow-x: auto;
  padding-bottom: 4px;
}

.filter-tab {
  padding: 0.45rem 0.9rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 500;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  transition: var(--transition);
  white-space: nowrap;
}

.filter-tab:hover {
  border-color: var(--primary);
  color: var(--text-main);
}

.filter-tab.active {
  background: var(--primary);
  color: #ffffff;
  border-color: var(--primary);
}

.filter-tab .badge {
  font-size: 0.75rem;
  padding: 0.1rem 0.45rem;
  border-radius: 9999px;
  background: rgba(0, 0, 0, 0.08);
}

.filter-tab.active .badge {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

.toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-grow: 1;
  justify-content: flex-end;
}

.search-box {
  position: relative;
  min-width: 240px;
  max-width: 320px;
  width: 100%;
}

.search-icon {
  position: absolute;
  left: 0.9rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  font-size: 0.85rem;
}

.search-box input {
  width: 100%;
  padding: 0.5rem 2.2rem 0.5rem 2.3rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  transition: var(--transition);
}

.search-box input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-light);
}

.clear-btn {
  position: absolute;
  right: 0.8rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  padding: 0.2rem;
}

.sort-box select {
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: var(--bg-card);
  color: var(--text-main);
  font-size: 0.85rem;
  outline: none;
  cursor: pointer;
  transition: var(--transition);
}

.sort-box select:focus {
  border-color: var(--primary);
}

.results-meta {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 1.2rem;
}

/* Books Grid */
.books-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 1.75rem;
}

/* Book Card */
.book-card {
  background: var(--bg-card);
  border-radius: 1.2rem;
  border: 1px solid var(--border-color);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}

.book-card:hover {
  transform: translateY(-6px);
  box-shadow: var(--shadow-book);
  border-color: rgba(146, 140, 238, 0.4);
}

.book-cover-container {
  position: relative;
  width: 100%;
  padding-top: 135%; /* 3:4 aspect ratio for book covers */
  background: var(--border-subtle);
  overflow: hidden;
}

.book-cover-img {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.4s ease;
}

.book-card:hover .book-cover-img {
  transform: scale(1.05);
}

/* Book Spine Simulation */
.book-spine-overlay {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 8px;
  background: linear-gradient(90deg, rgba(0,0,0,0.3) 0%, rgba(255,255,255,0.15) 50%, rgba(0,0,0,0.1) 100%);
  pointer-events: none;
}

.book-status-pill {
  position: absolute;
  top: 0.6rem;
  right: 0.6rem;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.2rem 0.55rem;
  border-radius: 9999px;
  backdrop-filter: blur(8px);
  box-shadow: var(--shadow-sm);
}

.status-finished { background: var(--badge-finished-bg); color: var(--badge-finished-text); }
.status-reading { background: var(--badge-reading-bg); color: var(--badge-reading-text); }
.status-listening { background: var(--badge-listening-bg); color: var(--badge-listening-text); }
.status-ready { background: var(--badge-ready-bg); color: var(--badge-ready-text); }

.book-info {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  flex-grow: 1;
}

.book-title {
  font-family: var(--font-serif);
  font-size: 0.98rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.4;
  margin-bottom: 0.35rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-author {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.6rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-card-bottom {
  margin-top: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--text-subtle);
  border-top: 1px solid var(--border-subtle);
  padding-top: 0.6rem;
}

.book-stars {
  color: #f59e0b;
  letter-spacing: -2px;
}

.book-date {
  font-size: 0.72rem;
}

/* Loading & Empty States */
.loading-state, .empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 4rem 1rem;
  color: var(--text-muted);
}

.spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 1rem;
  border: 3px solid var(--border-color);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ========================================================
   Expansive Book Detail Modal (Wider & Full Utilization)
   ======================================================== */
.book-modal {
  margin: auto;
  border: none;
  border-radius: 1.5rem;
  background: var(--bg-card);
  color: var(--text-main);
  padding: 0;
  width: 92vw;
  max-width: 1060px; /* Much wider: expands to 1060px on desktop! */
  height: 86vh;
  max-height: 88vh;  /* Comfortably contained in screen */
  box-shadow: var(--shadow-modal);
  outline: none;
  overflow: hidden;
  overscroll-behavior: contain;
}

.book-modal::backdrop {
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(10px);
}

.modal-wrapper {
  position: relative;
  padding: 2.2rem 2.5rem;
  height: 100%;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-sizing: border-box;
}

.modal-close-btn {
  position: absolute;
  top: 1.2rem;
  right: 1.2rem;
  width: 2.2rem;
  height: 2.2rem;
  border-radius: 50%;
  border: none;
  background: var(--bg-page);
  color: var(--text-muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: var(--transition);
  z-index: 10;
}

.modal-close-btn:hover {
  background: var(--primary-light);
  color: var(--primary);
  transform: rotate(90deg);
}

.modal-body {
  display: flex;
  gap: 2.5rem;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

/* Left Column: Book Profile & Quick Info */
.modal-cover-col {
  width: 230px;
  flex-shrink: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  padding-right: 0.5rem;
}

.modal-book-3d {
  position: relative;
  border-radius: 0.85rem;
  overflow: hidden;
  box-shadow: var(--shadow-book);
  width: 100%;
  aspect-ratio: 3/4;
}

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

.modal-meta-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  background: var(--bg-page);
  padding: 0.9rem 1rem;
  border-radius: 0.85rem;
  border: 1px solid var(--border-color);
}

.meta-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
}

.meta-label {
  color: var(--text-subtle);
  font-weight: 500;
}

.meta-val {
  font-weight: 600;
  color: var(--text-main);
  max-width: 130px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: right;
}

.modal-actions {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: auto;
}

/* Right Column: Title, Author, Highlights & Thoughts */
.modal-info-col {
  flex: 1;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-header-top {
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.modal-header-badges {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
}

.badge-status, .badge-type {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.65rem;
  border-radius: 9999px;
}

.badge-type {
  background: var(--primary-light);
  color: var(--primary);
}

.modal-title {
  font-family: var(--font-serif);
  font-size: 1.7rem;
  font-weight: 700;
  line-height: 1.35;
  color: var(--text-main);
  margin-bottom: 0.35rem;
  word-break: break-word;
}

.modal-author-row {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.95rem;
}

.modal-author {
  font-weight: 500;
}

.modal-rating {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  color: #f59e0b;
}

/* Notes & Highlights Section (Generous Reading Area) */
.modal-notes-section {
  flex: 1;
  min-height: 0;
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  border-radius: 1.1rem;
  padding: 1.2rem;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.modal-tabs {
  display: flex;
  gap: 0.6rem;
  border-bottom: 1px solid var(--border-color);
  padding-bottom: 0.75rem;
  margin-bottom: 1rem;
  flex-shrink: 0;
}

.modal-tab {
  padding: 0.45rem 1.1rem;
  border-radius: 0.6rem;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: var(--transition);
}

.modal-tab:hover {
  background: var(--primary-light);
  color: var(--primary);
}

.modal-tab.active {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 4px 10px var(--primary-glow);
}

.modal-tab-content {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.tab-pane {
  display: none;
}

.tab-pane.active {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.notes-scroll-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-y;
  padding-right: 0.6rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

/* Custom Scrollbar for Notes */
.notes-scroll-list::-webkit-scrollbar,
.modal-cover-col::-webkit-scrollbar {
  width: 6px;
}
.notes-scroll-list::-webkit-scrollbar-thumb,
.modal-cover-col::-webkit-scrollbar-thumb {
  background-color: var(--border-color);
  border-radius: 9999px;
}
.notes-scroll-list::-webkit-scrollbar-thumb:hover,
.modal-cover-col::-webkit-scrollbar-thumb:hover {
  background-color: var(--primary);
}

/* Highlight Card (金句) */
.highlight-item {
  position: relative;
  background: var(--bg-card);
  border-left: 4px solid var(--primary);
  border-radius: 0 0.8rem 0.8rem 0;
  padding: 1.1rem 1.3rem;
  box-shadow: var(--shadow-sm);
  transition: var(--transition);
}

.highlight-item:hover {
  box-shadow: var(--shadow-md);
  border-left-color: var(--primary-hover);
  transform: translateX(2px);
}

.highlight-text {
  font-family: var(--font-serif);
  font-size: 0.98rem;
  line-height: 1.75;
  color: var(--text-main);
  margin-bottom: 0.6rem;
  letter-spacing: 0.01em;
}

.highlight-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.78rem;
  color: var(--text-subtle);
  border-top: 1px dashed var(--border-subtle);
  padding-top: 0.5rem;
}

.btn-copy-quote {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  cursor: pointer;
  padding: 0.25rem 0.6rem;
  border-radius: 0.4rem;
  font-size: 0.78rem;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: var(--transition);
}

.btn-copy-quote:hover {
  background: var(--primary-light);
  color: var(--primary);
  border-color: var(--primary);
}

/* Thought Card (我的想法) */
.thought-item {
  background: var(--bg-card);
  border-radius: 0.8rem;
  border: 1px solid var(--border-color);
  padding: 1.1rem 1.3rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.7rem;
}

.thought-abstract {
  font-family: var(--font-serif);
  font-size: 0.88rem;
  color: var(--text-muted);
  border-left: 3px solid var(--border-color);
  padding-left: 0.8rem;
  font-style: italic;
  line-height: 1.55;
}

.thought-content {
  font-size: 0.96rem;
  line-height: 1.65;
  color: var(--text-main);
  font-weight: 500;
}

.thought-footer {
  font-size: 0.76rem;
  color: var(--text-subtle);
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.notes-empty-state {
  text-align: center;
  padding: 3.5rem 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  margin: auto;
}

.notes-empty-state i {
  font-size: 2.2rem;
  color: var(--text-subtle);
  margin-bottom: 0.8rem;
  display: block;
}

/* Toast Notification */
.toast-notice {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: var(--text-main);
  color: var(--bg-page);
  padding: 0.65rem 1.4rem;
  border-radius: 9999px;
  font-size: 0.88rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  z-index: 99999;
}

.toast-notice.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}

/* Buttons */
.btn {
  padding: 0.65rem 1.1rem;
  border-radius: 0.75rem;
  font-size: 0.85rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  transition: var(--transition);
  cursor: pointer;
  text-align: center;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
}

.btn-primary:hover {
  background: var(--primary-hover);
  box-shadow: 0 4px 12px var(--primary-glow);
}

.btn-secondary {
  background: var(--bg-page);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

/* Footer */
.reading-footer {
  margin-top: 4rem;
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-subtle);
}

.reading-footer a {
  color: var(--text-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.reading-footer a:hover {
  color: var(--primary);
}

.reading-footer .sep {
  margin: 0 0.5rem;
}

/* Responsive Breakpoints */
@media (max-width: 900px) {
  .book-modal {
    width: 95vw;
    height: 90vh;
    max-height: 92vh;
  }
  .modal-wrapper {
    padding: 1.5rem;
    height: 100%;
  }
  .modal-body {
    flex-direction: column;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    gap: 1.5rem;
    height: 100%;
    flex: 1;
  }
  .modal-cover-col {
    width: 100%;
    flex-direction: row;
    align-items: flex-start;
    gap: 1.2rem;
    overflow-y: visible;
    flex-shrink: 0;
  }
  .modal-book-3d {
    width: 120px;
    flex-shrink: 0;
  }
  .modal-meta-grid {
    flex: 1;
  }
  .modal-actions {
    flex-direction: row;
  }
  .modal-info-col {
    overflow: visible;
    height: auto;
    flex: none;
  }
  .modal-title {
    font-size: 1.4rem;
  }
  .notes-scroll-list {
    max-height: 380px;
  }
  .stats-dashboard {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .page-container {
    padding: 1rem 1rem 3rem;
  }

  .hero-quote-text {
    font-size: 1.12rem;
  }

  .stats-dashboard {
    grid-template-columns: repeat(2, 1fr);
  }

  .toolbar {
    flex-direction: column;
    align-items: stretch;
  }

  .toolbar-right {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box {
    max-width: 100%;
  }

  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(145px, 1fr));
    gap: 1rem;
  }

  .book-modal {
    width: 96vw;
    height: 92vh;
    max-height: 94vh;
  }

  .modal-cover-col {
    flex-direction: column;
    align-items: center;
  }

  .modal-book-3d {
    width: 130px;
  }

  .modal-meta-grid {
    width: 100%;
  }

  .modal-actions {
    width: 100%;
  }
}
