/*
 *= require_tree .
 *= require_self
 */

:root {
  --accent-primary: #6E8854;
  --accent-secondary: #3E4D30;
  --surface-primary: #F2F0E8;
  --surface-secondary: #E5E2D8;
  --foreground-primary: #2D3129;
  --foreground-secondary: #575C50;
  --foreground-muted: #888D82;
  --border-subtle: #D4D7CD;
  --white: #FFFFFF;
  --shadow-color: rgba(0, 0, 0, 0.07);
  --font-heading: 'Playfair Display', Georgia, serif;
  --font-body: 'Inter', -apple-system, sans-serif;
}

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

body {
  font-family: var(--font-body);
  color: var(--foreground-primary);
  background-color: var(--surface-primary);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a {
  color: var(--accent-primary);
  text-decoration: none;
}

a:hover {
  color: var(--accent-secondary);
}

/* Navbar */
.navbar {
  background: var(--surface-primary);
  border-bottom: 1px solid var(--border-subtle);
  position: sticky;
  top: 0;
  z-index: 100;
}

.navbar-inner {
  max-width: 1300px;
  margin: 0 auto;
  padding: 20px 48px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.navbar-logo .logo-link {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 700;
  color: var(--accent-secondary);
}

.navbar-logo .logo-link:hover {
  color: var(--accent-secondary);
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 32px;
}

.nav-link {
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground-secondary);
}

.nav-link:hover {
  color: var(--accent-primary);
}

.nav-link-active {
  color: var(--accent-primary);
}

.avatar-circle {
  width: 36px;
  height: 36px;
  border-radius: 9999px;
  background: var(--accent-primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
}

/* Profile Dropdown */
.profile-dropdown {
  position: relative;
}

.profile-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: 200px;
  background: var(--white);
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  z-index: 100;
  flex-direction: column;
}

.profile-dropdown.open .profile-dropdown-menu {
  display: flex;
}

.profile-dropdown-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground-primary);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
}

.profile-dropdown-item svg {
  color: var(--accent-primary);
  flex-shrink: 0;
}

.profile-dropdown-item:hover {
  background: var(--surface-secondary);
}

.profile-dropdown-item--danger {
  color: #D94444;
}

.profile-dropdown-item--danger svg {
  color: #D94444;
}

/* Buttons */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 24px;
  background: var(--accent-primary);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-primary:hover {
  background: var(--accent-secondary);
  color: var(--white);
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 24px;
  background: var(--surface-secondary);
  color: var(--foreground-secondary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-secondary:hover {
  background: var(--border-subtle);
}

/* Flash messages */
.flash {
  max-width: 600px;
  margin: 16px auto;
  padding: 12px 20px;
  border-radius: 8px;
  font-size: 14px;
}

.flash-notice {
  background: #e8f0e0;
  color: var(--accent-secondary);
  border: 1px solid var(--accent-primary);
}

.flash-alert {
  background: #f0e0e0;
  color: #6b2c2c;
  border: 1px solid #c47070;
}

/* Auth pages */
.auth-container {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 48px 24px;
}

.auth-card {
  width: 100%;
  max-width: 440px;
  background: var(--white);
  border-radius: 12px;
  padding: 48px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.03),
    0 12px 32px rgba(0, 0, 0, 0.06);
}

.auth-header {
  text-align: center;
  margin-bottom: 32px;
}

.auth-header h1 {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 700;
  color: var(--foreground-primary);
  margin-bottom: 8px;
}

.auth-header p {
  font-size: 15px;
  color: var(--foreground-secondary);
  line-height: 1.5;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field label {
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground-secondary);
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"] {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--foreground-primary);
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.field input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(110, 136, 84, 0.15);
}

.field input::placeholder {
  color: var(--foreground-muted);
}

.field-checkbox {
  display: flex;
  align-items: center;
  gap: 8px;
}

.field-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-primary);
}

.field-checkbox label {
  font-size: 14px;
  color: var(--foreground-secondary);
}

.auth-submit {
  width: 100%;
  padding: 14px;
  background: var(--accent-primary);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: background 0.2s;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
}

.auth-submit:hover {
  background: var(--accent-secondary);
}

.auth-links {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.auth-links a {
  font-size: 13px;
  color: var(--foreground-muted);
}

.auth-links a:hover {
  color: var(--accent-primary);
}

.auth-errors {
  background: #f0e0e0;
  border: 1px solid #c47070;
  border-radius: 8px;
  padding: 12px 16px;
  margin-bottom: 8px;
}

.auth-errors h3 {
  font-size: 14px;
  font-weight: 600;
  color: #6b2c2c;
  margin-bottom: 4px;
}

.auth-errors ul {
  list-style: none;
  font-size: 13px;
  color: #6b2c2c;
}

/* Minimum password hint */
.field-hint {
  font-size: 12px;
  color: var(--foreground-muted);
}

/* Settings divider */
.settings-divider {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 4px 0;
}

/* Network level selector */
.network-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 4px;
}

.network-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 10px;
  border: 1px solid var(--border-subtle);
  background: var(--white);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.network-option input[type="radio"] {
  display: none;
}

.radio-indicator {
  flex-shrink: 0;
  width: 18px;
  height: 18px;
  border-radius: 9999px;
  border: 2px solid var(--border-subtle);
  transition: border-color 0.2s;
  position: relative;
}

.network-option--selected .radio-indicator {
  border-color: var(--accent-primary);
}

.radio-indicator::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%) scale(0);
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-primary);
  transition: transform 0.15s ease;
}

.network-option--selected .radio-indicator::after {
  transform: translate(-50%, -50%) scale(1);
}

.network-option--selected {
  border: 2px solid var(--accent-primary);
  background: var(--surface-primary);
}

.network-option-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.network-option-text strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground-primary);
}

.network-option-text span {
  font-size: 12px;
  color: var(--foreground-secondary);
  line-height: 1.5;
}

/* Network level warning */
.network-warning {
  background: #FEF3E2;
  border: 1px solid #E8A840;
  border-radius: 8px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
}

.network-warning[hidden] {
  display: none;
}

.network-warning-header {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #C27812;
}

.network-warning-header span {
  font-size: 13px;
  font-weight: 700;
  color: #8B5A0E;
}

.network-warning-list {
  margin: 0;
  padding-left: 30px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.network-warning-list li {
  font-size: 12px;
  color: #7A510D;
  line-height: 1.5;
}

.network-warning-list li::marker {
  font-weight: 600;
  color: #8B5A0E;
}

.network-warning-confirm {
  padding-top: 4px;
  transition: background 0.3s;
  border-radius: 4px;
}

.network-warning-confirm label {
  font-size: 12px !important;
  font-weight: 500 !important;
  color: #8B5A0E !important;
  line-height: 1.5;
}

.network-warning-confirm input[type="checkbox"] {
  accent-color: #C27812;
}

.network-warning-confirm-highlight {
  background: rgba(194, 120, 18, 0.12);
  padding: 6px;
}

.network-warning-shake {
  animation: shake 0.4s ease-in-out;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-4px); }
  40% { transform: translateX(4px); }
  60% { transform: translateX(-3px); }
  80% { transform: translateX(3px); }
}

/* Network info note */
.network-info-note {
  display: flex;
  gap: 10px;
  padding: 12px 14px;
  background: var(--surface-secondary);
  border-radius: 8px;
  margin-top: 6px;
}

.network-info-note svg {
  flex-shrink: 0;
  color: var(--foreground-muted);
  margin-top: 1px;
}

.network-info-note span {
  font-size: 12px;
  color: var(--foreground-secondary);
  line-height: 1.5;
}

/* Page layout */
.page-header {
  padding: 40px 48px 0 48px;
  max-width: 1300px;
  margin: 0 auto;
}

.page-header h1 {
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 700;
  color: var(--foreground-primary);
}

.page-header p {
  font-size: 16px;
  color: var(--foreground-secondary);
  margin-top: 4px;
}

/* Page header row (side-by-side title + action) */
.page-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
}

.page-header-left { flex: 1; }
.page-header-right { flex-shrink: 0; padding-top: 4px; }
.page-header-actions { display: flex; align-items: center; gap: 16px; }

/* Filter bar (legacy — used by connections page) */
.filter-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 48px;
  max-width: 1300px;
  margin: 0 auto;
}

.filter-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
}

.filter-center {
  display: flex;
  align-items: center;
  justify-content: center;
}

.filter-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  flex: 1;
}

/* Filter bar (new) */
.filter-bar-wrapper {
  padding: 16px 48px;
  max-width: 1300px;
  margin: 0 auto;
}

.filter-bar-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.filter-dropdowns {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  flex: 1;
}

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

.filter-dropdown {
  position: relative;
}

.filter-select {
  appearance: none;
  padding: 7px 34px 7px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground-secondary);
  background: var(--white);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  outline: none;
  cursor: pointer;
  transition: all 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg width='10' height='6' viewBox='0 0 10 6' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1L5 5L9 1' stroke='%23888D82' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  white-space: nowrap;
}

.filter-select:hover {
  border-color: var(--accent-primary);
  color: var(--foreground-primary);
}

.filter-select:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(110, 136, 84, 0.12);
}

/* Multiselect dropdown */
.filter-multiselect {
  position: relative;
}

.filter-multiselect .filter-select {
  width: auto;
  text-align: left;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.filter-multiselect .filter-select.has-selection {
  color: var(--foreground-primary);
  border-color: var(--accent-primary);
}

.filter-multiselect-menu {
  display: none;
  position: absolute;
  top: calc(100% + 4px);
  left: 0;
  z-index: 100;
  min-width: 200px;
  max-height: 280px;
  overflow-y: auto;
  background: var(--white);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: 0 4px 16px var(--shadow-color);
  padding: 6px 0;
}

.filter-multiselect-menu.open {
  display: block;
}

.filter-multiselect-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--foreground-secondary);
  cursor: pointer;
  transition: background 0.15s;
}

.filter-multiselect-option:hover {
  background: var(--surface-secondary);
}

.filter-multiselect-option input[type="checkbox"] {
  width: 15px;
  height: 15px;
  accent-color: var(--accent-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.filter-clear {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 7px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground-muted);
  background: none;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.filter-clear:hover {
  color: var(--foreground-primary);
  background: var(--surface-secondary);
  border-color: var(--border-subtle);
}

.filter-bar-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.filter-count {
  font-size: 13px;
  color: var(--foreground-muted);
  white-space: nowrap;
}

/* Books grid */
.books-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 28px;
  padding: 0 48px 48px 48px;
  max-width: 1300px;
  width: fit-content;
  margin: 0 auto;
}

/* Book card (matches Pencil Component/MyBookCard: 300px wide) */
.book-card {
  width: 280px;
  background: var(--white);
  border-radius: 12px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.03),
    0 12px 32px rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
}

.book-card-cover {
  width: 100%;
  height: 320px;
  background-color: var(--surface-secondary);
  border-radius: 12px 12px 0 0;
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.book-card-cover-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.25));
}

.book-card-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.book-card-cover-placeholder span {
  font-family: var(--font-heading);
  font-size: 48px;
  font-weight: 700;
  color: var(--foreground-muted);
  opacity: 0.3;
}

.book-card-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.book-card-title-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.book-card-title-col {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.book-card-title {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--foreground-primary);
  line-height: 1.3;
}

.book-card-author {
  font-size: 13px;
  color: var(--foreground-muted);
}

.book-card-cover-wrap {
  position: relative;
}

.book-card-attribution-avatar {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
}

.book-card-attribution-avatar .avatar-circle {
  width: 32px;
  height: 32px;
  font-size: 13px;
  border: 2px solid var(--white);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.book-card-review {
  font-size: 13px;
  color: var(--foreground-secondary);
  line-height: 1.5;
}

.book-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.book-card-footer-end {
  justify-content: flex-end;
}

.book-card-genre {
  font-family: var(--font-body);
  font-size: 11px;
  font-weight: 500;
  color: var(--foreground-muted);
  background: var(--surface-secondary);
  padding: 3px 10px;
  border-radius: 9999px;
}

.book-card-action-btn {
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  border: none;
  background: var(--surface-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--foreground-muted);
  transition: background 0.2s;
}

.book-card-action-btn:hover {
  background: var(--border-subtle);
}

/* Discover card extras */
.book-card-match {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--accent-primary);
  font-size: 13px;
  font-weight: 600;
  flex-shrink: 0;
}

.avatar-stack {
  display: inline-flex;
  align-items: center;
  flex: 1;
}

.avatar-stack-avatar {
  width: 32px;
  height: 32px;
  font-size: 12px;
  border: 2px solid var(--white);
  box-sizing: border-box;
}

.avatar-stack > .avatar-stack-avatar + .avatar-stack-avatar {
  margin-left: -8px;
}

.avatar-stack-more {
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 9999px;
  background: var(--surface-secondary);
  color: var(--foreground-secondary);
  font-weight: 700;
  font-size: 10px;
}

.book-card-added-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin-left: auto;
  width: 32px;
  height: 32px;
  border-radius: 9999px;
  background: var(--surface-secondary);
  color: var(--foreground-muted);
  flex-shrink: 0;
}

/* Book card popup menu (matches Pencil FAB Menu: W2lI8) */
.book-card-menu-wrap {
  position: relative;
  margin-left: auto;
}

.book-card-menu {
  display: none;
  position: absolute;
  bottom: 40px;
  right: 0;
  width: 200px;
  background: var(--white);
  border-radius: 16px;
  padding: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  z-index: 10;
  flex-direction: column;
}

.book-card-menu-wrap.open .book-card-menu {
  display: flex;
}

.book-card-menu-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 10px;
  border: none;
  background: none;
  width: 100%;
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground-primary);
  cursor: pointer;
  transition: background 0.15s;
}

.book-card-menu-item:hover {
  background: var(--surface-secondary);
}

.book-card-menu-item svg {
  color: var(--accent-primary);
  flex-shrink: 0;
}

.book-card-menu-item-danger {
  color: #8b3a3a;
}

.book-card-menu-item-danger svg {
  color: #8b3a3a;
}

.book-card-menu-item-danger:hover {
  background: #f5e8e8;
}

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 24px;
  padding: 80px 48px;
  text-align: center;
}

.empty-state-icon {
  color: var(--border-subtle);
}

.empty-state h2 {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  color: var(--foreground-primary);
}

.empty-state p {
  font-size: 15px;
  color: var(--foreground-secondary);
  line-height: 1.6;
}

/* Pagination */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 0 48px 48px 48px;
}

.pagination-info {
  font-size: 14px;
  color: var(--foreground-muted);
}

/* Book detail page (matches Pencil DnBF6) */
.book-detail-hero {
  display: flex;
  gap: 48px;
  padding: 48px 56px;
  max-width: 1300px;
  margin: 0 auto;
}

.book-detail-cover {
  width: 340px;
  height: 500px;
  border-radius: 12px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-secondary);
  box-shadow:
    inset 0 3px 8px rgba(0, 0, 0, 0.15),
    inset 0 1px 3px rgba(0, 0, 0, 0.1);
}

.book-detail-cover-img {
  max-width: 87%;
  max-height: 87%;
  object-fit: contain;
  border-radius: 4px;
  filter: drop-shadow(0 12px 28px rgba(0, 0, 0, 0.3));
}

.book-detail-info {
  display: flex;
  flex-direction: column;
  gap: 20px;
  flex: 1;
}

.book-detail-title {
  font-family: var(--font-heading);
  font-size: 42px;
  font-weight: 700;
  color: var(--foreground-primary);
  line-height: 1.15;
}

.book-detail-author {
  font-size: 18px;
  color: var(--foreground-secondary);
}

.book-detail-ratio {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ratio-icon {
  color: var(--accent-primary);
}

.ratio-pct {
  font-family: var(--font-body);
  font-size: 24px;
  font-weight: 700;
  color: var(--accent-primary);
}

.ratio-divider {
  width: 1px;
  height: 20px;
  background: var(--border-subtle);
}

.ratio-info {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.ratio-text {
  font-size: 13px;
  color: var(--foreground-secondary);
}

.ratio-bar {
  width: 140px;
  height: 5px;
  background: var(--surface-secondary);
  border-radius: 3px;
}

.ratio-bar-fill {
  height: 100%;
  background: var(--accent-primary);
  border-radius: 3px;
}

.book-detail-tags {
  display: flex;
  gap: 10px;
}

.book-detail-tag {
  padding: 6px 14px;
  background: var(--surface-secondary);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground-secondary);
}

.book-detail-desc {
  font-size: 15px;
  color: var(--foreground-secondary);
  line-height: 1.6;
}

.book-detail-meta {
  font-size: 14px;
  color: var(--foreground-muted);
}

.book-detail-actions {
  display: flex;
  gap: 14px;
  align-items: stretch;
}

.book-detail-actions form {
  display: flex;
}

.btn-detail {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 24px;
  border-radius: 8px;
  font-family: var(--font-body);
  font-size: 15px;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: background 0.2s;
}

.btn-detail-primary {
  background: var(--accent-primary);
  color: var(--white);
  border: 1.5px solid var(--accent-primary);
}

.btn-detail-primary:hover {
  background: var(--accent-secondary);
}

.btn-detail-secondary {
  background: none;
  color: var(--foreground-muted);
  border: 1.5px solid var(--foreground-muted);
}

.btn-detail-secondary:hover {
  background: var(--surface-secondary);
}

/* Book detail body (reviews) */
.book-detail-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 48px;
  padding: 48px 120px;
  max-width: 1300px;
  margin: 0 auto;
}

.book-detail-section {
  width: 100%;
  max-width: 960px;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.book-detail-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.book-detail-section-header h2 {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  color: var(--foreground-primary);
}

.section-subtitle {
  font-size: 13px;
  color: var(--foreground-muted);
  margin-top: 4px;
  display: block;
}

/* Review cards */
.review-card {
  background: var(--white);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.03),
    0 8px 24px rgba(0, 0, 0, 0.05);
}

.review-card-reviewer {
  display: flex;
  align-items: center;
  gap: 12px;
}

.avatar-small {
  width: 36px;
  height: 36px;
  font-size: 14px;
}

.avatar-tiny {
  width: 32px;
  height: 32px;
  font-size: 11px;
}

.reviewer-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1;
}

.reviewer-name {
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground-primary);
}

.reviewer-date {
  font-size: 12px;
  color: var(--foreground-muted);
}

.reviewer-rating {
  font-size: 13px;
  font-weight: 500;
  padding: 4px 12px;
  border-radius: 9999px;
}

.reviewer-rating-like {
  color: var(--accent-primary);
  background: rgba(110, 136, 84, 0.1);
}

.reviewer-rating-dislike {
  color: var(--foreground-muted);
  background: var(--surface-secondary);
}

.review-card-body {
  font-size: 16px;
  color: var(--foreground-secondary);
  line-height: 1.6;
}

.review-card-body + .review-card-body {
  margin-top: 1em;
}

.review-card-actions {
  display: flex;
  align-items: center;
  gap: 20px;
}

.review-action {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--foreground-muted);
  cursor: pointer;
}

.review-action:hover {
  color: var(--foreground-secondary);
}

.review-action-button {
  background: none;
  border: none;
  padding: 0;
  font-family: inherit;
}

.review-action-liked {
  color: var(--foreground-primary);
}

/* Review comments thread */
.review-comments-thread {
  padding-top: 16px;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
}

.review-comment {
  display: flex;
  gap: 10px;
  padding: 12px 0;
}

.review-comment + .review-comment {
  border-top: 1px solid var(--border-subtle);
}

.review-comment-body {
  display: flex;
  flex-direction: column;
  gap: 4px;
  flex: 1;
}

.review-comment-header {
  display: flex;
  align-items: center;
  gap: 8px;
}

.review-comment-text {
  font-size: 15px;
  color: var(--foreground-secondary);
  line-height: 1.5;
}

.review-comment-text + .review-comment-text {
  margin-top: 0.75em;
}

/* Comment input */
.review-comment-input {
  display: flex;
  align-items: center;
  gap: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.review-comment-form {
  flex: 1;
}

.review-comment-field {
  width: 100%;
  height: 36px;
  border: none;
  outline: none;
  background: var(--surface-primary);
  border-radius: 9999px;
  padding: 0 14px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--foreground-primary);
}

.review-comment-field::placeholder {
  color: var(--foreground-muted);
}

/* Review form (new review) */
.review-form {
  background: var(--white);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.03),
    0 8px 24px rgba(0, 0, 0, 0.05);
}

.review-form-input-wrap {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  width: 100%;
}

.review-form-textarea {
  flex: 1;
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--foreground-primary);
  background: var(--surface-primary);
  resize: vertical;
  outline: none;
}

.review-form-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(110, 136, 84, 0.15);
}

.review-form-textarea::placeholder {
  color: var(--foreground-muted);
}

.book-card-cover-link {
  text-decoration: none;
  display: block;
}

/* Connections / My Circle */
/* Circle filter pills */
.circle-filter-bar {
  display: flex;
  gap: 8px;
  padding: 16px 48px;
  max-width: 1300px;
  margin: 0 auto;
}

.circle-filter-btn {
  padding: 8px 16px;
  border-radius: 9999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--foreground-primary);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.15s;
}

.circle-filter-btn:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.circle-filter-btn--active {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--white);
}

.circle-filter-btn--active:hover {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
  color: var(--white);
}

/* Circle content area */
.circle-content {
  padding: 24px 48px 40px 48px;
  max-width: 1300px;
  margin: 0 auto;
}

/* Connections grid */
.connections-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

/* Connection card — horizontal layout */
.connection-card {
  display: flex;
  align-items: center;
  gap: 16px;
  background: var(--white);
  border-radius: 12px;
  padding: 16px 20px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.03),
    0 12px 32px rgba(0, 0, 0, 0.06);
}

.connection-card[data-pending] {
  opacity: 0.7;
}

.connection-card-avatar {
  position: relative;
  width: 56px;
  height: 56px;
  flex-shrink: 0;
}

.connection-card-avatar .avatar-circle {
  width: 48px;
  height: 48px;
  font-size: 18px;
}

.avatar-degree-badge {
  position: absolute;
  bottom: 7px;
  right: 7px;
  width: 20px;
  height: 20px;
  border-radius: 9999px;
  background: var(--white);
  border: 2px solid var(--foreground-primary);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--foreground-primary);
}

.avatar-pending {
  background: var(--surface-secondary) !important;
  color: var(--foreground-muted);
}

.connection-card-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}

.connection-card-name {
  font-size: 16px;
  font-weight: 700;
  color: var(--foreground-primary);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.connection-card-name:hover {
  color: var(--accent-primary);
}

.connection-card-meta-row {
  display: flex;
  align-items: center;
  gap: 0;
}

.connection-card-meta {
  font-size: 13px;
  color: var(--foreground-muted);
}

.connection-card-meta-row form {
  display: inline;
}

.connection-card-separator {
  font-size: 13px;
  color: var(--foreground-muted);
  padding: 0 4px;
}

.connection-card-disconnect {
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: #C0392B;
  cursor: pointer;
  transition: opacity 0.15s;
}

.connection-card-disconnect:hover {
  opacity: 0.7;
}

/* Circle footer */
.circle-footer {
  margin-top: 24px;
}

.circle-separator {
  border: none;
  border-top: 1px solid var(--border);
  margin: 0 0 16px 0;
}

.circle-info {
  display: block;
  font-size: 13px;
  color: var(--foreground-muted);
  margin-bottom: 12px;
}

/* Pagination */
.circle-pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding-top: 8px;
}

.pagination-btn {
  height: 36px;
  min-width: 36px;
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: transparent;
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground-secondary);
  cursor: pointer;
  transition: all 0.15s;
}

.pagination-btn:hover:not(:disabled) {
  background: var(--surface-secondary);
}

.pagination-btn--active {
  background: var(--accent-primary);
  color: var(--white);
  font-weight: 600;
}

.pagination-btn--active:hover {
  background: var(--accent-primary);
  color: var(--white);
}

.pagination-btn--disabled {
  color: var(--foreground-muted);
  cursor: default;
  opacity: 0.5;
}

/* Slot dots */
.slot-dots {
  display: flex;
  gap: 6px;
  align-items: center;
  margin-top: 6px;
}

.slot-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border-subtle);
}

.slot-dot-filled {
  background: var(--accent-primary);
}

/* Edit book page */
.edit-book-container {
  max-width: 900px;
  margin: 0 auto;
  padding: 40px 48px 48px 48px;
}

.edit-book-form {
  margin-top: 24px;
}

.edit-book-columns {
  display: flex;
  gap: 48px;
}

.edit-book-cover-col {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.edit-book-cover-preview {
  width: 240px;
  height: 320px;
  background: var(--surface-secondary);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.edit-book-cover-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 4px;
  filter: drop-shadow(0 4px 12px rgba(0, 0, 0, 0.2));
}

.edit-book-fields-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 32px;
}

.edit-book-section h3 {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  color: var(--foreground-primary);
  margin-bottom: 16px;
}

.edit-book-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.edit-book-section .field {
  gap: 6px;
}

.edit-book-status-row {
  display: flex;
  gap: 16px;
}

.edit-book-status-row .field {
  flex: 1;
}

.edit-book-row {
  display: flex;
  gap: 16px;
}

.edit-book-row .field {
  flex: 1;
}

.edit-book-actions {
  display: flex;
  gap: 12px;
  padding-top: 8px;
}

.field-input,
.field-select,
.field-textarea {
  width: 100%;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--foreground-primary);
  background: var(--surface-primary);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.field-input:focus,
.field-select:focus,
.field-textarea:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(110, 136, 84, 0.15);
}

.field-textarea {
  resize: vertical;
  line-height: 1.5;
}

.field-select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23888D82' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 16px center;
  padding-right: 40px;
}

/* Search page */
.search-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 48px 48px 48px;
}

.search-form {
  margin-top: 24px;
}

.search-input-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--white);
  border: 1px solid var(--border-subtle);
  border-radius: 9999px;
  padding: 6px 6px 6px 18px;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.03);
  transition: border-color 0.2s;
}

.search-input-wrap:focus-within {
  border-color: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(110, 136, 84, 0.15);
}

.search-icon {
  color: var(--foreground-muted);
  flex-shrink: 0;
}

.search-input {
  flex: 1;
  border: none;
  outline: none;
  font-family: var(--font-body);
  font-size: 15px;
  color: var(--foreground-primary);
  background: transparent;
}

.search-input::placeholder {
  color: var(--foreground-muted);
}

/* Search loading */
.search-loading {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 48px 0;
  font-size: 15px;
  color: var(--foreground-muted);
}

.search-loading.visible {
  display: flex;
}

.search-spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border-subtle);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}

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

/* Search results */
.search-results {
  margin-top: 32px;
}

.search-results-count {
  font-size: 13px;
  color: var(--foreground-muted);
  margin-bottom: 16px;
}

.search-result-card {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 16px 20px;
  background: var(--white);
  border-radius: 12px;
  margin-bottom: 12px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.03),
    0 12px 32px rgba(0, 0, 0, 0.06);
}

.search-result-cover {
  width: 64px;
  height: 96px;
  border-radius: 6px;
  background-size: cover;
  background-position: center;
  background-color: var(--surface-secondary);
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.search-result-cover-text {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--foreground-muted);
  opacity: 0.3;
}

.search-result-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.search-result-title {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 700;
  color: var(--foreground-primary);
}

.search-result-author {
  font-size: 13px;
  color: var(--foreground-muted);
}

.search-result-genre {
  font-size: 12px;
  color: var(--foreground-muted);
  margin-top: 4px;
}

.search-result-meta {
  font-size: 12px;
  color: var(--foreground-muted);
}

.search-result-actions {
  flex-shrink: 0;
}

.search-result-form {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 20px;
}

.search-result-checks {
  display: flex;
  gap: 16px;
}

.search-result-check {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  color: var(--foreground-secondary);
  cursor: pointer;
  user-select: none;
}

.search-result-check input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--foreground-muted);
  border-radius: 5px;
  background: var(--background-primary, #fff);
  cursor: pointer;
  position: relative;
  transition: background 0.15s ease, border-color 0.15s ease;
  margin: 0;
  flex-shrink: 0;
}

.search-result-check input[type="checkbox"]:hover {
  border-color: var(--accent-primary);
}

.search-result-check input[type="checkbox"]:checked {
  background: var(--accent-primary);
  border-color: var(--accent-primary);
}

.search-result-check input[type="checkbox"]:checked::after {
  content: "";
  position: absolute;
  left: 5px;
  top: 1px;
  width: 6px;
  height: 11px;
  border: solid #fff;
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}

.search-result-added {
  font-size: 13px;
  font-weight: 500;
  color: var(--accent-primary);
}

.btn-small {
  padding: 8px 20px;
  font-size: 13px;
}

/* Manual add form */
.search-no-results {
  margin-top: 32px;
}

.search-no-results p {
  font-size: 14px;
  color: var(--foreground-secondary);
  margin-bottom: 20px;
}

.manual-add-section {
  max-width: 800px;
  margin: 32px auto 0;
}

.manual-add-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 auto;
  padding: 12px 24px;
  background: none;
  border: 2px solid var(--border-subtle);
  border-radius: 9999px;
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 500;
  color: var(--foreground-secondary);
  cursor: pointer;
  transition: border-color 0.2s, color 0.2s;
}

.manual-add-toggle:hover {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.manual-add-toggle svg {
  flex-shrink: 0;
}

.manual-add-content {
  display: none;
  margin-top: 20px;
}

.manual-add-section.open .manual-add-content {
  display: block;
}

.manual-add-section.open .manual-add-toggle {
  border-color: var(--accent-primary);
  color: var(--accent-primary);
}

.manual-add-form {
  background: var(--white);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.03),
    0 12px 32px rgba(0, 0, 0, 0.06);
}

.manual-add-row {
  display: flex;
  gap: 16px;
}

.manual-add-row .field {
  flex: 1;
}

/* Profile Page */
.profile-header {
  display: flex;
  align-items: center;
  gap: 32px;
  padding: 48px 48px;
  max-width: 1300px;
  margin: 0 auto;
}

.profile-avatar-large {
  width: 96px;
  height: 96px;
  min-width: 96px;
  border-radius: 9999px;
  background: var(--accent-primary);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: 'Playfair Display', serif;
  font-size: 40px;
  font-weight: 700;
}

.profile-info {
  display: flex;
  flex-direction: column;
  gap: 8px;
  flex: 1;
}

.profile-name {
  font-family: 'Playfair Display', serif;
  font-size: 28px;
  font-weight: 700;
  color: var(--foreground-primary);
  margin: 0;
}

.profile-stats {
  display: flex;
  gap: 24px;
}

.profile-stat {
  font-family: 'Inter', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground-muted);
}

.profile-connected-badge {
  font-family: 'Inter', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--accent-primary);
  padding: 12px 28px;
  border: 2px solid var(--accent-primary);
  border-radius: 9999px;
  white-space: nowrap;
}

.profile-connect-btn {
  border-radius: 9999px;
  padding: 12px 28px;
  white-space: nowrap;
}

.profile-divider {
  height: 1px;
  background: var(--border-subtle);
  max-width: 1300px;
  margin: 0 auto;
}

.profile-shelf {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 32px 48px;
  max-width: 1300px;
  margin: 0 auto;
}

.profile-shelf .filter-bar-wrapper {
  padding: 0;
  max-width: none;
  margin: 0;
}

.profile-shelf-title {
  font-family: 'Playfair Display', serif;
  font-size: 24px;
  font-weight: 700;
  color: var(--foreground-primary);
  margin: 0;
}

.profile-books-grid {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  gap: 28px;
}

/* Clickable avatar links */
a.avatar-link {
  text-decoration: none;
}

a.avatar-link .avatar-circle:hover {
  opacity: 0.85;
}

/* =========================================================================
   Landing page (home#index)
   ========================================================================= */

.landing-hero {
  background: var(--surface-primary);
  padding: 80px 48px;
}

.landing-hero-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 60px;
}

.landing-hero-copy {
  flex: 1 1 520px;
  max-width: 580px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.landing-hero-copy h1 {
  font-family: var(--font-heading);
  font-size: 48px;
  font-weight: 700;
  line-height: 1.15;
  color: var(--foreground-primary);
}

.landing-hero-copy p {
  font-size: 17px;
  line-height: 1.6;
  color: var(--foreground-secondary);
  max-width: 520px;
}

.landing-hero-cta {
  align-self: flex-start;
  padding: 16px 36px;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
}

.landing-book-grid {
  /*
   * Sizing knobs. One loop = 3 covers + 3 gaps (each column renders
   * its slice twice), so --landing-loop must equal 3*(cover-h + v-gap).
   */
  --landing-cover-w: 128px;
  --landing-cover-h: 176px;
  --landing-col-gap: 14px;
  --landing-row-gap: 14px;
  --landing-loop: 570px; /* 3 * (176 + 14) */

  position: relative;
  flex: 0 0 auto;
  width: calc(var(--landing-cover-w) * 4 + var(--landing-col-gap) * 3);
  height: 400px;
  border-radius: 12px;
  overflow: hidden;
  -webkit-mask-image: linear-gradient(180deg, transparent 0%, #000 22%, #000 78%, transparent 100%);
          mask-image: linear-gradient(180deg, transparent 0%, #000 22%, #000 78%, transparent 100%);
}

.landing-book-col {
  position: absolute;
  top: 0;
  width: var(--landing-cover-w);
  display: flex;
  flex-direction: column;
  gap: var(--landing-row-gap);
  will-change: transform;
  transform: translate3d(0, 0, 0);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.landing-book-col:nth-child(1) { left: 0; }
.landing-book-col:nth-child(2) { left: calc((var(--landing-cover-w) + var(--landing-col-gap)) * 1); }
.landing-book-col:nth-child(3) { left: calc((var(--landing-cover-w) + var(--landing-col-gap)) * 2); }
.landing-book-col:nth-child(4) { left: calc((var(--landing-cover-w) + var(--landing-col-gap)) * 3); }

.landing-book-cover {
  width: var(--landing-cover-w);
  height: var(--landing-cover-h);
  object-fit: cover;
  border-radius: 8px;
  display: block;
  background: var(--surface-secondary);
  transform: translateZ(0);
}

@keyframes landing-scroll-down {
  from { transform: translate3d(0, calc(-1 * var(--landing-loop)), 0); }
  to   { transform: translate3d(0, 0, 0); }
}

@keyframes landing-scroll-up {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(0, calc(-1 * var(--landing-loop)), 0); }
}

.landing-book-col--down {
  animation: landing-scroll-down 40s linear infinite;
}

.landing-book-col--up {
  animation: landing-scroll-up 40s linear infinite;
}

.landing-book-col--delayed {
  animation-delay: -14s;
}

@media (prefers-reduced-motion: reduce) {
  .landing-book-col {
    animation: none !important;
    transform: translate3d(0, calc(-0.5 * var(--landing-loop)), 0);
  }
}

/* Features */

.landing-features {
  background: var(--surface-secondary);
  padding: 96px 48px;
}

.landing-features-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 20px;
}

.landing-features h2 {
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 700;
  color: var(--foreground-primary);
  text-align: center;
}

.landing-features-sub {
  font-size: 16px;
  line-height: 1.6;
  color: var(--foreground-secondary);
  max-width: 620px;
  text-align: center;
  margin-bottom: 28px;
}

.landing-feature-cards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 28px;
  width: 100%;
}

.landing-feature-card {
  flex: 0 1 380px;
  background: var(--white);
  border-radius: 12px;
  padding: 32px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow:
    0 2px 4px rgba(0, 0, 0, 0.03),
    0 12px 32px rgba(0, 0, 0, 0.06);
}

.landing-feature-icon {
  width: 52px;
  height: 52px;
  border-radius: 12px;
  background: var(--surface-secondary);
  color: var(--accent-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
}

.landing-feature-card h3 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  color: var(--foreground-primary);
}

.landing-feature-card p {
  font-size: 15px;
  line-height: 1.6;
  color: var(--foreground-secondary);
}

/* CTA section */

.landing-cta-section {
  background: var(--surface-primary);
  padding: 96px 48px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 24px;
  text-align: center;
}

.landing-cta-section h2 {
  font-family: var(--font-heading);
  font-size: 40px;
  font-weight: 700;
  color: var(--foreground-primary);
  max-width: 640px;
  line-height: 1.2;
}

.landing-cta-section p {
  font-size: 17px;
  color: var(--foreground-secondary);
  line-height: 1.6;
}

.landing-cta-btn {
  margin-top: 8px;
  padding: 16px 40px;
  font-size: 16px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.07);
}

/* Footer */

.landing-footer {
  background: var(--surface-primary);
  padding: 40px 48px;
  border-top: 1px solid var(--border-subtle);
}

.landing-footer-inner {
  max-width: 1300px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.landing-footer-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.landing-footer-logo {
  font-family: var(--font-heading);
  font-size: 20px;
  font-weight: 700;
  color: var(--accent-secondary);
}

.landing-footer-links {
  display: flex;
  gap: 28px;
  flex-wrap: wrap;
}

.landing-footer-links a {
  font-size: 13px;
  color: var(--foreground-muted);
}

.landing-footer-links a:hover {
  color: var(--accent-primary);
}

.landing-footer-divider {
  height: 1px;
  background: var(--border-subtle);
}

.landing-footer-copy {
  font-size: 12px;
  color: var(--foreground-muted);
}

/* Landing responsive */

@media (max-width: 960px) {
  .landing-hero-inner {
    flex-direction: column;
    gap: 48px;
  }

  .landing-hero-copy {
    max-width: 100%;
  }

  .landing-hero-copy h1 {
    font-size: 38px;
  }

  .landing-book-grid {
    flex: 0 0 auto;
  }
}

@media (max-width: 640px) {
  .landing-hero,
  .landing-features,
  .landing-cta-section {
    padding-left: 24px;
    padding-right: 24px;
  }

  .landing-hero {
    padding-top: 56px;
    padding-bottom: 56px;
  }

  .landing-features,
  .landing-cta-section {
    padding-top: 72px;
    padding-bottom: 72px;
  }

  .landing-hero-copy h1 {
    font-size: 32px;
  }

  .landing-book-grid {
    --landing-cover-w: 88px;
    --landing-cover-h: 120px;
    --landing-col-gap: 10px;
    --landing-row-gap: 10px;
    --landing-loop: 390px; /* 3 * (120 + 10) */
    height: 360px;
  }

  .landing-cta-section h2 {
    font-size: 30px;
  }
}

/* Internal Dashboard */
.dashboard {
  max-width: 1300px;
  margin: 0 auto;
  padding: 48px 24px 64px;
}

.dashboard-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
  padding-bottom: 24px;
  margin-bottom: 32px;
  border-bottom: 1px solid var(--border-subtle);
}

.dashboard-header-text h1 {
  font-family: var(--font-heading);
  font-size: 36px;
  font-weight: 600;
  color: var(--foreground-primary);
  letter-spacing: -0.01em;
  margin-bottom: 6px;
}

.dashboard-header-text p {
  color: var(--foreground-muted);
  font-size: 15px;
}

.dashboard-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: var(--surface-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: var(--foreground-secondary);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.dashboard-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent-primary);
  box-shadow: 0 0 0 3px rgba(110, 136, 84, 0.2);
}

.dashboard-section-title {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--foreground-muted);
  margin-bottom: 16px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.stat-card {
  position: relative;
  background: var(--white);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  padding: 24px 24px 22px;
  box-shadow: 0 1px 2px var(--shadow-color);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  overflow: hidden;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 3px;
  background: var(--accent-primary);
  opacity: 0;
  transition: opacity 0.15s ease;
}

.stat-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px var(--shadow-color);
  border-color: var(--accent-primary);
}

.stat-card:hover::before {
  opacity: 1;
}

.stat-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.stat-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--foreground-muted);
}

.stat-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: var(--surface-secondary);
  color: var(--accent-secondary);
  font-size: 16px;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 40px;
  font-weight: 600;
  color: var(--foreground-primary);
  line-height: 1.1;
  letter-spacing: -0.02em;
}

.stat-meta {
  margin-top: 8px;
  font-size: 13px;
  color: var(--foreground-secondary);
}

.dashboard-section-title + .dashboard-table-wrap {
  margin-top: 0;
}

.dashboard .dashboard-section-title:not(:first-of-type) {
  margin-top: 8px;
}

.dashboard-table-wrap {
  background: var(--white);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: 0 1px 2px var(--shadow-color);
  overflow: hidden;
}

.dashboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.dashboard-table thead th {
  text-align: left;
  padding: 14px 20px;
  background: var(--surface-secondary);
  border-bottom: 1px solid var(--border-subtle);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--foreground-muted);
}

.dashboard-table tbody td {
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-subtle);
  color: var(--foreground-primary);
}

.dashboard-table tbody tr:last-child td {
  border-bottom: 0;
}

.dashboard-table tbody tr {
  transition: background-color 0.15s ease;
}

.dashboard-table tbody tr:hover {
  background: var(--surface-secondary);
}

.dashboard-table tbody td:first-child {
  font-weight: 500;
}

.dashboard-table tbody td:nth-child(2) {
  color: var(--foreground-secondary);
  font-family: var(--font-mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  font-size: 13px;
}

.dashboard-table tbody td:last-child {
  color: var(--foreground-muted);
  font-size: 13px;
  white-space: nowrap;
}

@media (max-width: 640px) {
  .dashboard {
    padding: 32px 16px 48px;
  }

  .dashboard-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .dashboard-header-text h1 {
    font-size: 28px;
  }

  .stat-value {
    font-size: 32px;
  }

  .dashboard-table thead th,
  .dashboard-table tbody td {
    padding: 12px 14px;
  }
}

/* Navbar search pill */
.navbar-search {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  width: 320px;
  padding: 0 14px;
  border-radius: 9999px;
  background: var(--surface-secondary);
  transition: background 120ms ease, box-shadow 120ms ease;
}

.navbar-search:focus-within {
  background: var(--white);
  box-shadow: 0 0 0 2px var(--accent-primary);
}

.navbar-search-icon {
  color: var(--foreground-muted);
  flex-shrink: 0;
}

.navbar-search-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--foreground-primary);
  outline: none;
  min-width: 0;
}

.navbar-search-input::placeholder {
  color: var(--foreground-muted);
}

/* Single-reviewer attribution used on search cards */
.book-card-attribution {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

.book-card-attribution .avatar-circle {
  width: 28px;
  height: 28px;
  font-size: 12px;
}

.book-card-attribution-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.book-card-attribution-name {
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.book-card-attribution-meta {
  font-size: 12px;
  color: var(--foreground-muted);
}

/* Search page header */
.search-header-sub {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-top: 8px;
  font-size: 16px;
  color: var(--foreground-secondary);
}

.search-query-text {
  font-weight: 600;
  color: var(--foreground-primary);
}

.search-query-count {
  font-size: 14px;
  color: var(--foreground-muted);
}

/* Search empty state */
.search-empty-state {
  padding: 64px 48px;
}

.search-empty-tips {
  list-style: none;
  padding: 0;
  margin: 0;
  max-width: 520px;
  font-size: 14px;
  color: var(--foreground-secondary);
  text-align: left;
  line-height: 1.7;
}

.search-empty-tips li {
  padding-left: 20px;
  position: relative;
}

.search-empty-tips li::before {
  content: "•";
  position: absolute;
  left: 4px;
  color: var(--accent-primary);
}

@media (max-width: 900px) {
  .navbar-search {
    width: 220px;
  }
}

@media (max-width: 640px) {
  .navbar-search {
    display: none;
  }
}

/* ===== Latest Reviews (Discover hero) ===== */

.latest-reviews-section {
  display: flex;
  flex-direction: column;
  gap: 20px;
  padding: 32px 48px;
  max-width: 1300px;
  margin: 0 auto;
  width: 100%;
}

.latest-reviews-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.latest-reviews-title {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 600;
  color: var(--foreground-primary);
  line-height: 1.2;
  margin: 0;
}

.latest-reviews-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}

.latest-reviews-nav-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 9999px;
  color: var(--foreground-primary);
  background: var(--surface-secondary);
  text-decoration: none;
  transition: background 0.15s ease, color 0.15s ease, opacity 0.15s ease;
  border: none;
}

.latest-reviews-nav-btn-next {
  background: var(--accent-primary);
  color: var(--white);
}

.latest-reviews-nav-btn:hover:not(.is-disabled) {
  filter: brightness(0.95);
}

.latest-reviews-nav-btn.is-disabled {
  background: var(--border-subtle);
  color: var(--foreground-muted);
  cursor: not-allowed;
  opacity: 0.6;
}

.latest-reviews-counter {
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground-secondary);
  min-width: 54px;
  text-align: center;
}

.latest-reviews-row {
  display: flex;
  gap: 40px;
  align-items: flex-start;
}

.latest-reviews-book-panel {
  flex: 0 0 270px;
  width: 270px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.latest-reviews-book-cover-link {
  display: block;
  text-decoration: none;
}

.latest-reviews-book-cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
  overflow: hidden;
  background: var(--surface-secondary);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08), 0 20px 40px -8px rgba(0, 0, 0, 0.12);
}

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

.latest-reviews-book-cover-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 48px;
  color: var(--foreground-muted);
  background: var(--surface-secondary);
}

.latest-reviews-book-meta {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.latest-reviews-book-title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 600;
  line-height: 1.2;
  color: var(--foreground-primary);
  margin: 0;
}

.latest-reviews-book-author {
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--foreground-secondary);
  margin: 0;
}

.latest-reviews-book-facts {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--font-body);
  font-size: 13px;
}

.latest-reviews-match {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--foreground-primary);
  font-weight: 500;
}

.latest-reviews-match svg {
  color: var(--accent-primary);
}

.latest-reviews-bullet,
.latest-reviews-genre {
  color: var(--foreground-muted);
}

.latest-reviews-cta {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  border-radius: 9999px;
  background: var(--accent-primary);
  color: var(--white);
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 500;
  text-decoration: none;
  transition: filter 0.15s ease;
}

.latest-reviews-cta:hover {
  filter: brightness(0.95);
}

.latest-reviews-panel {
  flex: 1 1 auto;
  min-width: 0;
  padding-left: 75px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  position: relative;
}

.latest-reviews-quote-mark {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 96px;
  line-height: 0.8;
  color: var(--accent-secondary);
  height: 50px;
  display: block;
}

.latest-reviews-quote-body {
  font-family: var(--font-body);
  font-style: normal;
  font-size: 17px;
  line-height: 1.6;
  color: var(--foreground-primary);
  margin: 0;
  padding: 0;
  border: none;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 8;
  overflow: hidden;
  white-space: pre-wrap;
}

.latest-reviews-reviewer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.latest-reviews-reviewer-info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 auto;
  min-width: 0;
}

.latest-reviews-reviewer-name {
  font-family: var(--font-body);
  font-size: 14px;
  font-weight: 600;
  color: var(--foreground-primary);
  text-decoration: none;
}

.latest-reviews-reviewer-name:hover {
  text-decoration: underline;
}

.latest-reviews-reviewer-date {
  font-family: var(--font-body);
  font-size: 12px;
  color: var(--foreground-muted);
}

.latest-reviews-rating-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 9999px;
  background: var(--surface-secondary);
  font-family: var(--font-body);
  font-size: 13px;
  font-weight: 500;
  color: var(--foreground-primary);
}

.latest-reviews-rating-badge-like svg {
  color: var(--accent-primary);
}

.latest-reviews-rating-badge-dislike svg {
  color: var(--foreground-muted);
}

.latest-reviews-empty {
  padding: 32px;
  border-radius: 12px;
  background: var(--surface-secondary);
  color: var(--foreground-secondary);
  font-family: var(--font-body);
  font-size: 14px;
  text-align: center;
}

/* Skeleton placeholders */

@keyframes skeleton-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.45; }
}

.skeleton-shape {
  display: block;
  background: var(--border-subtle);
  border-radius: 6px;
  animation: skeleton-pulse 1.6s ease-in-out infinite;
}

.latest-reviews-skeleton-title {
  width: 200px;
  height: 32px;
}

.latest-reviews-skeleton-nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 9999px;
}

.latest-reviews-skeleton-counter {
  width: 54px;
  height: 16px;
}

.latest-reviews-skeleton-cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  border-radius: 10px;
}

.latest-reviews-skeleton-line {
  width: 100%;
  height: 16px;
  border-radius: 4px;
}

.latest-reviews-skeleton-line-lg {
  height: 28px;
  width: 85%;
}

.latest-reviews-skeleton-line-sm {
  height: 14px;
  width: 60%;
}

.latest-reviews-skeleton-line-xs {
  height: 14px;
  width: 40%;
}

.latest-reviews-skeleton-line-short {
  width: 70%;
}

.latest-reviews-skeleton-cta {
  width: 100%;
  height: 46px;
  border-radius: 9999px;
}

.latest-reviews-skeleton-quote {
  width: 60px;
  height: 50px;
}

.latest-reviews-skeleton-reviewer {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-top: 20px;
  margin-top: 12px;
  border-top: 1px solid var(--border-subtle);
}

.latest-reviews-skeleton-avatar {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  flex: 0 0 48px;
}

@media (max-width: 900px) {
  .latest-reviews-section {
    padding: 24px 16px;
  }

  .latest-reviews-row {
    flex-direction: column;
    gap: 24px;
  }

  .latest-reviews-book-panel {
    flex: 1 1 auto;
    width: 100%;
    max-width: 270px;
    margin: 0 auto;
  }

  .latest-reviews-panel {
    padding-left: 0;
    width: 100%;
  }

  .latest-reviews-quote-body {
    font-size: 16px;
  }
}

