@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Inter:wght@400;500;600;700&family=Playfair+Display:wght@500;600;700&display=swap');
@import url('css/tokens.css');

:root {
  /* Layout & motion — colors live in css/tokens.css */
  --shadow-sm: 0 4px 14px rgba(47, 62, 79, 0.05);
  --shadow-md: 0 10px 28px rgba(47, 62, 79, 0.07);
  --shadow-lg: 0 18px 40px rgba(47, 62, 79, 0.09);
  --radius-card: 20px;
  --radius-btn: 14px;
  --transition-fast: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-smooth: 0.35s cubic-bezier(0.4, 0, 0.2, 1);

  /* Legacy aliases still referenced in older rules */
  --primary-soft: var(--beige);
  --primary-softer: var(--bg);
  --sage-light: #eef2ee;
  --blue: #a9c8e8;
  --green: var(--forest);
  --green-soft: var(--success-soft);
  --cream: var(--bg);
  --lilac: var(--lavender);
  --teal: var(--navy);
  --yellow: var(--butter);
  --muskmelon: var(--coral);
  --mandarin: var(--gold);
  --amaranth: var(--navy);
  --pink: var(--coral);
  --orchid: var(--lavender);
  --sienna: var(--gold);
  --dark: var(--navy);
  --soft-card: var(--card);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--body-text);
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  animation: pageFadeIn 0.5s ease;
}

@keyframes pageFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

a {
  text-decoration: none;
  color: inherit;
  transition: color var(--transition-fast);
}

button, .btn {
  border: none;
  cursor: pointer;
  font-weight: 600;
  border-radius: var(--radius-btn);
  padding: 13px 22px;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
  font-family: inherit;
}

.btn-primary {
  background: var(--button-bg);
  color: var(--button-text);
  box-shadow: 0 8px 20px rgba(31, 49, 58, 0.22);
}

.btn-secondary {
  background: var(--white);
  color: var(--navy);
  border: 1.5px solid var(--border-neutral);
}

.btn-primary:hover {
  background: #2a4552;
  box-shadow: 0 12px 26px rgba(31, 49, 58, 0.28);
}

.btn-secondary:hover {
  background: var(--ivory);
  border-color: var(--navy);
  color: var(--navy);
}

.btn:hover {
  transform: translateY(-2px) scale(1.02);
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-sm);
  transition: box-shadow var(--transition-smooth), transform var(--transition-smooth);
  color: var(--body-text);
}

.card:hover {
  box-shadow: var(--shadow-md);
}

/* editorial serif for display headings */
.dashboard h1,
.bd-hero-info h1,
.highlight-card h2,
.journey-insight h2,
.companion-hero h1,
.book-detail-card h1,
.quiz-card h1,
.hero-text h1,
.how-section h2 {
  font-family: "Playfair Display", Georgia, serif;
  letter-spacing: -0.5px;
}
.landing-page {
  --background: #fbf8f3;
  --navy: #102b43;
  --deep-green: #124f42;
  --forest-green: #28614e;
  --sage: #9db2a2;
  --teal: #376f72;
  --gold: #d5a83f;
  --cream: #f2e6d2;
  --white: #ffffff;
  min-height: 100vh;
  padding: 28px;
  background: var(--background);
  color: var(--navy);
}

.top-nav {
  max-width: 1320px;
  margin: 0 auto;
  padding: 22px 26px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  display: flex;
  gap: 14px;
  align-items: center;
  font-size: 28px;
  font-weight: 800;
  color: var(--navy);
}

.landing-page .brand-icon {
  width: 48px;
  height: 48px;
  border-radius: 14px;
  background: var(--deep-green);
  color: #fbf8f3;
  display: grid;
  place-items: center;
}

.landing-page .brand-icon .feature-svg,
.landing-page .brand-icon .brand-icon-svg {
  width: 24px;
  height: 24px;
  color: #fbf8f3 !important;
  stroke: #fbf8f3 !important;
  stroke-width: 2;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 34px;
  font-weight: 600;
  color: var(--navy);
}

.nav-login {
  padding: 12px 22px;
  border: 1.5px solid rgba(16, 43, 67, 0.18);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.55);
  color: var(--navy);
}

.nav-start {
  padding: 13px 24px;
  border-radius: 999px;
  background: var(--deep-green);
  color: var(--white);
}

.hero-section {
  max-width: 1380px;
  margin: 20px auto 0;
  display: grid;
  grid-template-columns: minmax(0, 0.86fr) minmax(0, 1.14fr);
  gap: 24px;
  align-items: center;
}

.hero-text h1 {
  font-size: clamp(46px, 6.4vw, 74px);
  line-height: 1.04;
  margin: 0;
  letter-spacing: -0.03em;
  color: var(--navy);
  font-family: "Playfair Display", "Cormorant Garamond", Georgia, serif;
  font-weight: 600;
}

.hero-text h1 .hero-accent,
.hero-text h1 em.hero-accent {
  color: var(--deep-green);
  font-style: italic;
  font-weight: 600;
  font-family: "Playfair Display", "Cormorant Garamond", Georgia, serif;
}

.hero-text p {
  margin-top: 24px;
  font-size: 17px;
  max-width: 500px;
  line-height: 1.7;
  color: rgba(16, 43, 67, 0.68);
  font-weight: 500;
}

.hero-buttons {
  display: flex;
  gap: 14px;
  margin-top: 28px;
  flex-wrap: wrap;
}

.landing-page .hero-buttons .btn.hero-cta-primary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--deep-green);
  color: var(--white);
  -webkit-text-fill-color: var(--white);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 0.8rem;
  line-height: 1.15;
  font-weight: 600;
  box-shadow: 0 7px 18px rgba(18, 79, 66, 0.18);
}

.landing-page .hero-buttons .btn.hero-cta-primary:hover {
  background: #0e3f35;
  box-shadow: 0 10px 22px rgba(18, 79, 66, 0.24);
}

.landing-page .hero-buttons .btn.hero-cta-secondary {
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 0.8rem;
  line-height: 1.15;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.7);
  border: 1.5px solid rgba(16, 43, 67, 0.16);
  color: var(--navy);
  -webkit-text-fill-color: var(--navy);
}

.landing-page .hero-buttons .btn.hero-cta-secondary:hover {
  background: var(--white);
  border-color: rgba(16, 43, 67, 0.28);
  color: var(--navy);
  -webkit-text-fill-color: var(--navy);
}

.hero-cta-arrow {
  width: 13px;
  height: 13px;
}

.trusted {
  margin-top: 42px;
  display: flex;
  align-items: center;
  gap: 14px;
  color: rgba(16, 43, 67, 0.62);
  font-weight: 600;
}

.avatars {
  display: flex;
}

.avatars .avatar {
  width: 38px;
  height: 38px;
  margin-right: -8px;
  border-radius: 50%;
  border: 2px solid var(--background);
  box-shadow: 0 4px 10px rgba(16, 43, 67, 0.12);
}

.avatar-a { background: linear-gradient(145deg, #d7e3d9, #9db2a2); }
.avatar-b { background: linear-gradient(145deg, #f2e6d2, #d5a83f); }
.avatar-c { background: linear-gradient(145deg, #c9dde0, #376f72); }

.hero-art {
  position: relative;
  min-height: 0;
  display: grid;
  place-items: center;
  overflow: visible;
  align-self: center;
  transform: translateY(-34px);
  justify-self: end;
  width: 100%;
}

.hero-illustration {
  width: min(100%, 576px);
  max-width: 576px;
  height: auto;
  display: block;
  margin-left: auto;
  margin-right: 12px;
  object-fit: contain;
  image-rendering: auto;
}

@media (max-width: 980px) {
  .hero-section {
    grid-template-columns: 1fr;
    gap: 28px;
    text-align: left;
  }

  .hero-art {
    min-height: 0;
    order: -1;
    max-width: 432px;
    margin: 0 auto;
    transform: none;
    justify-self: center;
    align-self: auto;
  }

  .hero-illustration {
    margin-left: auto;
    margin-right: auto;
    width: min(100%, 432px);
    max-width: 432px;
  }

  .hero-text h1 {
    font-size: clamp(40px, 9vw, 58px);
  }

  .nav-links {
    gap: 16px;
    font-size: 0.95rem;
  }

  .nav-links a[href="#features"],
  .nav-links a[href="#how"] {
    display: none;
  }
}

@media (max-width: 640px) {
  .landing-page {
    padding: 16px;
  }

  .top-nav {
    padding: 12px 4px;
  }

  .brand {
    font-size: 22px;
  }

  .brand-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
  }

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

  .landing-page .hero-buttons .btn.hero-cta-primary,
  .landing-page .hero-buttons .btn.hero-cta-secondary {
    justify-content: center;
  }
}

.feature-strip {
  max-width: 1320px;
  margin: 30px auto 0;
  padding: 28px;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  background: rgba(255,255,255,0.72);
  border: 1px solid var(--border);
  border-radius: 30px;
  box-shadow: 0 20px 50px rgba(47, 62, 79,0.08);
}

.feature-item {
  text-align: center;
  padding: 22px 14px;
  border-right: 1px solid rgba(107, 142, 125,0.1);
}

.feature-item:last-child {
  border-right: none;
}

.feature-icon {
  width: 58px;
  height: 58px;
  margin: 0 auto 14px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--sage-light);
  font-size: 26px;
}

.feature-item h3 {
  font-size: 15px;
  margin: 0;
}

.how-section {
  max-width: 1320px;
  margin: 80px auto 0;
}

.how-section h2 {
  font-family: Georgia, serif;
  font-size: 46px;
  margin-bottom: 28px;
}

.how-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
}

.how-card {
  background: rgba(255,255,255,0.7);
  border-radius: 28px;
  padding: 28px;
  border: 1px solid var(--border);
}

.how-card span {
  color: var(--accent);
  font-weight: 900;
}

.palette-section {
  max-width: 1320px;
  margin: 60px auto 20px;
  display: flex;
  align-items: center;
  gap: 20px;
  color: var(--text-secondary);
  font-weight: 700;
}

.palette {
  display: flex;
  gap: 12px;
}

.palette span {
  width: 34px;
  height: 34px;
  border-radius: 50%;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 30px;
}

.auth-card {
  width: min(440px, 100%);
  padding: 42px;
}

.auth-card input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(107, 142, 125, 0.12);
}

.auth-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.auth-link {
  color: var(--primary);
  font-weight: 600;
  font-size: 0.92rem;
  text-decoration: none;
}

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

.auth-success {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #e8f7ef;
  color: #1f6b43;
  font-size: 0.9rem;
  font-weight: 600;
}

.password-field {
  position: relative;
  margin-bottom: 0;
}

.password-field input,
.password-field .settings-input {
  width: 100%;
  padding-right: 52px;
  box-sizing: border-box;
}

.settings-form .password-field {
  margin-bottom: 4px;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 6px;
  display: grid;
  place-items: center;
  margin: 0;
  border-radius: 8px;
  line-height: 0;
  transition: color 0.15s ease, background-color 0.15s ease;
}

.password-toggle:hover {
  color: var(--ink);
}

.password-toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
  color: var(--ink);
}

html.theme-dark .password-toggle:hover,
html.theme-dark .password-toggle:focus-visible {
  color: var(--text);
}

.password-toggle svg {
  width: 20px;
  height: 20px;
}

.password-toggle .icon-eye-closed {
  display: none;
}

.password-toggle.is-visible .icon-eye-open {
  display: none;
}

.password-toggle.is-visible .icon-eye-closed {
  display: block;
}

.oauth-buttons {
  display: grid;
  gap: 12px;
  margin-top: 24px;
}

.btn-oauth {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 600;
}

.btn-oauth svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.btn-oauth:hover {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(107, 142, 125, 0.25);
}

.btn-apple {
  background: #111;
  color: #fff;
  border-color: #111;
}

.btn-apple:hover {
  background: #222;
  border-color: #222;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 22px 0 4px;
  color: var(--muted);
  font-size: 0.85rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.auth-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  padding: 14px 20px;
  border-radius: 14px;
  background: #1f6b43;
  color: #fff;
  font-weight: 600;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease;
  z-index: 9999;
  max-width: min(92vw, 420px);
  text-align: center;
}

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

.auth-toast-error {
  background: #9b1c3a;
}

.btn.is-loading {
  opacity: 0.85;
  cursor: wait;
}

@keyframes auth-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-4px); }
  75% { transform: translateX(4px); }
}

.auth-error.shake {
  animation: auth-shake 0.35s ease;
}

.auth-status-card {
  text-align: center;
}

.auth-status-icon {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 50%;
  background: rgba(107, 142, 125, 0.1);
  display: grid;
  place-items: center;
  color: var(--primary);
}

.auth-status-icon svg {
  width: 28px;
  height: 28px;
}

.auth-status-icon-success {
  background: #e8f7ee;
  color: #1f6b43;
}

.small-muted {
  color: var(--muted);
  font-size: 0.92rem;
}

.auth-notice {
  margin: 18px 0;
  padding: 14px 16px;
  border-radius: 14px;
  font-size: 0.92rem;
  line-height: 1.5;
  text-align: left;
}

.auth-notice-info {
  background: #eef4ff;
  color: #1e4a8a;
  border: 1px solid #c9dcff;
}

.auth-notice-warning {
  background: #fff8e8;
  color: #7a5a12;
  border: 1px solid #f0dfa0;
}

.auth-notice code {
  font-size: 0.85em;
  background: rgba(0, 0, 0, 0.06);
  padding: 1px 5px;
  border-radius: 4px;
}

.auth-dev-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--primary);
  font-weight: 700;
  word-break: break-all;
}

.auth-verify-actions {
  display: grid;
  gap: 12px;
  margin-top: 20px;
}

.auth-status-message {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 12px;
  font-size: 0.92rem;
  font-weight: 600;
}

.auth-success-inline {
  background: #e8f7ef;
  color: #1f6b43;
}

.auth-warn-inline {
  background: #fff4e5;
  color: #8a5a00;
}

.auth-verify-pending .btn-sm {
  margin-top: 10px;
  padding: 10px 16px;
  font-size: 0.88rem;
}

@media (max-width: 520px) {
  .auth-page {
    padding: 16px;
  }

  .auth-card {
    padding: 28px 22px;
  }

  .auth-card h1 {
    font-size: 30px;
  }
}

.auth-card h1 {
  font-family: Georgia, serif;
  font-size: 38px;
  margin-bottom: 10px;
}

.auth-card p {
  color: var(--text-secondary);
}

.auth-card form {
  display: grid;
  gap: 16px;
  margin-top: 28px;
}

.auth-label {
  display: block;
  margin-bottom: -8px;
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-secondary, #5c4a52);
}

.auth-card input {
  padding: 16px 18px;
  border-radius: 16px;
  border: 1px solid var(--border);
  font-size: 15px;
  outline: none;
  background: rgba(255,255,255,0.8);
}

.auth-card button {
  margin-top: 10px;
}

.auth-remember {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
  color: var(--muted);
  cursor: pointer;
}

.auth-remember input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.auth-error {
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--red-soft);
  color: #9b1c3a;
  font-size: 0.9rem;
  font-weight: 600;
}

html.auth-pending body {
  visibility: hidden;
}

.profile-username-line {
  margin: -8px 0 24px;
  color: var(--muted);
}

.profile-username-line strong {
  color: var(--text);
}

.back-link {
  color: var(--primary);
  font-weight: 700;
}

.small-text {
  text-align: center;
  margin-top: 20px;
}

/* quiz */
.quiz-container{

  max-width:800px;
  
  margin:70px auto;
  
  padding:50px;
  
  }
  
  .question{
  
  margin-top:35px;
  
  display:flex;
  
  flex-direction:column;
  
  gap:12px;
  
  }
  
  .question label{
  
  font-weight:700;
  
  font-size:18px;
  
  }
  
  .question textarea{
  
  height:90px;
  
  padding:18px;
  
  border-radius:18px;
  
  resize:none;
  
  border:1px solid var(--border);
  
  font-size:15px;
  
  }
  
  .question select{
  
  padding:16px;
  
  border-radius:15px;
  
  font-size:16px;
  
  border:1px solid var(--border);
  
  }
  
  .quiz-container button{
  
  margin-top:40px;
  
  width:100%;
  
  }

  .quiz-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 40px;
  }
  
  .quiz-card {
    width: min(760px, 100%);
    padding: 46px;
  }
  
  .quiz-header {
    margin-top: 25px;
  }
  
  .quiz-header p {
    font-weight: 800;
    color: var(--forest);
  }
  
  .progress-bar {
    width: 100%;
    height: 12px;
    background: rgba(47, 74, 58, 0.12);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 10px;
  }
  
  #progressFill {
    height: 100%;
    width: 5%;
    background: linear-gradient(90deg, var(--forest), var(--progress-green));
    border-radius: 999px;
    transition: 0.3s;
  }
  
  #questionTitle {
    font-family: Georgia, serif;
    font-size: 38px;
    line-height: 1.2;
    margin-top: 38px;
  }
  
  .options-container {
    display: grid;
    gap: 14px;
    margin-top: 34px;
  }
  
  .quiz-option {
    padding: 18px 22px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.75);
    color: var(--text);
    font-size: 16px;
    text-align: left;
    font-weight: 700;
  }
  
  .quiz-option.selected {
    background: linear-gradient(135deg, var(--primary), var(--primary-strong));
    color: white;
  }
  
  .quiz-textarea {
    min-height: 150px;
    padding: 20px;
    border-radius: 20px;
    border: 1px solid var(--border);
    resize: none;
    font-size: 16px;
    font-family: inherit;
    outline: none;
    background: rgba(255,255,255,0.8);
  }
  
  .quiz-actions {
    margin-top: 40px;
    display: flex;
    justify-content: space-between;
  }

  /* home */
  .app-layout {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 280px 1fr;
    background: var(--surface);
    gap: 0;
  }
  
  .sidebar {
    padding: 30px;
    background: var(--background);
    border-right: none;
  }
  
  .sidebar h2 {
    margin-bottom: 40px;
  }
  
  .sidebar a {
    display: block;
    padding: 15px 18px;
    margin-bottom: 10px;
    border-radius: 16px;
    font-weight: 700;
  }
  
  .sidebar a:hover {
    background: var(--surface);
  }
  
  .dashboard {
    padding: 48px 52px;
    animation: pageFadeIn 0.6s ease;
  }
  
  .dashboard h1 {
    font-family: "Playfair Display", Georgia, serif;
    font-size: 42px;
    color: var(--navy);
    font-weight: 600;
    letter-spacing: -0.5px;
  }
  
  .reader-profile {
    padding: 30px;
    margin-bottom: 40px;
  }
  
  .recommendation-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 25px;
  }
  
  .book-card-ui {
    padding: 24px;
  }
  
  .book-card-ui img,
  .cover-placeholder {
    width: 100%;
    height: 260px;
    object-fit: cover;
    border-radius: 20px;
    background: linear-gradient(135deg, var(--lilac), var(--orchid));
    display: grid;
    place-items: center;
    font-size: 60px;
  }
  
  .book-card-ui h3 {
    font-size: 22px;
    margin-bottom: 10px;
  }
  .book-cover,
.custom-cover {
  width: 100%;
  height: 270px;
  border-radius: 22px;
  object-fit: cover;
  margin-bottom: 18px;
}

.custom-cover {
  display: grid;
  place-items: center;
  text-align: center;
  color: white;
  padding: 25px;
}

.custom-cover span {
  font-size: 72px;
}

.custom-cover p {
  font-weight: 900;
  letter-spacing: 2px;
  text-transform: uppercase;
}

.mystery-cover {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
}

.romance-cover {
  background: linear-gradient(135deg, var(--primary-light), var(--accent));
}

.fantasy-cover {
  background: linear-gradient(135deg, var(--orchid), var(--teal));
}

.scifi-cover {
  background: linear-gradient(135deg, var(--teal), #063f46);
}

.horror-cover {
  background: linear-gradient(135deg, var(--navy), var(--primary-strong));
}

.book-author {
  color: var(--text-secondary);
  font-weight: 700;
}

.book-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin: 14px 0;
}

.book-meta span {
  background: var(--sage-light);
  color: var(--navy);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.reason {
  line-height: 1.55;
  color: var(--text-secondary);
}

.book-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 18px;
}

.mini-btn {
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--white);
  color: var(--navy);
  border: 1.5px solid var(--border-neutral);
  font-weight: 600;
  font-size: 13px;
  transition: all var(--transition-fast);
}

.mini-btn:hover {
  background: var(--ivory);
  border-color: var(--navy);
  transform: scale(1.03);
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 35px;
}

.dashboard-header p {
  color: var(--readable-secondary, var(--text-secondary));
  font-weight: 700;
}

.page-subtitle {
  color: var(--readable-secondary, var(--text-secondary));
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
  gap: 24px;
  align-items: stretch;
  margin-bottom: 30px;
}

.stats-card {
  padding: 30px;
}

.stats-row {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  margin-top: 24px;
}

.stats-row div {
  flex: 1;
  padding: 22px;
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.55);
  text-align: center;
  transition: transform var(--transition-fast);
}

.stats-row div:hover {
  transform: translateY(-2px);
}

.stats-row strong {
  display: block;
  font-size: 32px;
  color: var(--navy);
  font-family: "Playfair Display", Georgia, serif;
}

.stats-row span {
  font-weight: 800;
  color: var(--text-secondary);
}

.highlight-card:not(.ai-pick-card) {
  padding: 38px 40px;
  margin-bottom: 40px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--lavender);
  border: 1px solid #D8D2E6;
}

.highlight-card .eyebrow {
  color: #6B6280;
}

.journey-insight {
  background: var(--sky);
  border: 1px solid #C5D9EC;
}

.journey-insight .eyebrow {
  color: var(--readable-secondary, #5A7088);
}

.reader-profile {
  background: var(--beige);
  border: 1px solid #E5DFD4;
}

.stats-card {
  background: var(--butter);
  border: 1px solid #EDE4C8;
}

.stats-row div {
  background: rgba(255, 255, 255, 0.55);
}

.stats-row strong {
  color: var(--navy);
}

.eyebrow {
  color: var(--readable-secondary, var(--muted));
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-size: 12px;
  opacity: 1;
}

.highlight-card h2 {
  font-family: Georgia, serif;
  font-size: 34px;
  margin: 8px 0;
  color: var(--readable-heading, var(--ink));
}

.highlight-card p {
  max-width: 720px;
  color: var(--readable-body, var(--text-secondary));
  line-height: 1.6;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}

.section-title a {
  color: var(--navy);
  font-weight: 900;
}

.section-title-actions {
  display: flex;
  align-items: center;
  gap: 14px;
}

.section-refresh-btn {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: var(--navy);
  font-weight: 900;
  cursor: pointer;
}

.section-refresh-btn:hover {
  opacity: 0.75;
}

.section-refresh-btn:disabled {
  opacity: 0.5;
  cursor: default;
}

/*library*/

.library-section {
  margin-bottom: 45px;
}

.library-section h2 {
  font-family: Georgia, serif;
  font-size: 30px;
}

.library-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 22px;
  margin-top: 18px;
}

.small-book-card {
  padding: 20px;
}

.small-cover {
  height: 180px;
  border-radius: 20px;
  background: linear-gradient(135deg, var(--lilac), var(--orchid));
  display: grid;
  place-items: center;
  font-size: 54px;
  margin-bottom: 14px;
}

.small-book-card h3 {
  margin: 0 0 8px;
  font-size: 18px;
}

.small-book-card p {
  color: var(--text-secondary);
  font-weight: 700;
}

.small-book-card span {
  display: inline-block;
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(168, 197, 160,0.25);
  font-weight: 800;
  font-size: 13px;
}

.empty-text {
  color: var(--text-secondary);
  font-weight: 700;
}

/* profile */
.profile-grid {
  display: grid;
  grid-template-columns: 0.7fr 1.3fr;
  gap: 24px;
}

.profile-card {
  padding: 32px;
}

.profile-avatar {
  width: 110px;
  height: 110px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 50px;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  margin-bottom: 20px;
}

.profile-card label {
  display: block;
  margin-top: 18px;
  margin-bottom: 8px;
  font-weight: 900;
  color: var(--primary);
}

.profile-card input[type="text"],
.profile-card textarea {
  width: 100%;
  padding: 15px 16px;
  border-radius: 16px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.82);
  font-family: inherit;
  font-size: 15px;
  outline: none;
}

.profile-card textarea {
  min-height: 120px;
  resize: none;
}

.profile-card input[type="file"] {
  margin: 15px 0;
}

.profile-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

/* book details */
.book-detail-card {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 38px;
  padding: 38px;
  margin-top: 28px;
}

.detail-cover-img,
.detail-cover-placeholder {
  width: 100%;
  height: 500px;
  border-radius: 28px;
}

.detail-cover-img {
  object-fit: cover;
  box-shadow: 0 24px 45px rgba(47, 62, 79, 0.24);
}

.detail-cover-placeholder {
  display: grid;
  place-items: center;
  font-size: 90px;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
}

.book-detail-card h1 {
  font-family: Georgia, serif;
  font-size: 52px;
  margin: 10px 0;
}

.detail-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 30px;
}

.buy-section {
  padding: 34px;
  margin-top: 28px;
}

.buy-links {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/*ai Companion */
.companion-hero {
  padding: 42px;
  margin-bottom: 30px;
}

.companion-hero h1 {
  font-family: Georgia, serif;
  font-size: 48px;
  margin: 10px 0;
}

.companion-hero p {
  color: var(--text-secondary);
  font-weight: 700;
}

.companion-input {
  margin-top: 28px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
}

.companion-input input {
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid var(--border);
  font-size: 16px;
  outline: none;
  background: rgba(255,255,255,0.82);
}

.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.prompt-chips button {
  background: rgba(168, 197, 160,0.22);
  color: var(--primary);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 10px 16px;
  font-weight: 800;
}

.companion-answer {
  padding: 34px;
  line-height: 1.7;
}

.companion-answer h2 {
  font-family: Georgia, serif;
}

.chat-shell {
  padding: 34px;
  height: calc(100vh - 90px);
  display: flex;
  flex-direction: column;
}

.companion-page .chat-shell {
  padding: 0;
  height: auto;
  flex: 1;
  min-height: 0;
}

.companion-page .chat-messages {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  margin: 0 24px;
}

.chat-header h1 {
  font-family: Georgia, serif;
  font-size: 42px;
  margin: 6px 0 20px;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  border-radius: 26px;
  background: rgba(255,255,255,0.45);
  border: 1px solid var(--border);
}

.message {
  max-width: 75%;
  padding: 18px 20px;
  border-radius: 22px;
  margin-bottom: 16px;
  line-height: 1.6;
}

.ai-message {
  background: white;
  color: var(--text);
}

.user-message {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  margin-left: auto;
}

.message strong {
  display: block;
  margin-bottom: 6px;
}

.chat-input {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 14px;
  margin-top: 18px;
}

.chat-input input {
  padding: 18px 20px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.85);
  font-size: 16px;
  outline: none;
}


/* ai companion */
.ai-summary {
  margin-top: 12px;
}

.mood-pill {
  display: inline-block;
  margin: 14px 0;
  padding: 10px 16px;
  border-radius: 999px;
  background: rgba(168, 197, 160,0.25);
  color: var(--primary);
  font-weight: 900;
}

.reasoning-box {
  padding: 18px;
  border-radius: 20px;
  background: rgba(255,255,255,0.7);
  margin: 16px 0 22px;
}

.reasoning-box h4 {
  margin: 0 0 10px;
}

.reasoning-box p {
  margin: 7px 0;
}

.companion-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 18px;
  margin-top: 20px;
  width: 100%;
}

.ai-message.has-book-cards {
  max-width: min(960px, 100%);
}

.companion-book-card {
  padding: 18px;
  animation: fadeUp 0.45s ease forwards;
  min-width: 0;
  background: var(--card, #fff);
  color: var(--text, #1f2937);
  overflow: visible;
}

.companion-book-card .custom-cover {
  height: 210px;
  margin-bottom: 14px;
}

.companion-book-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 12px;
  margin: 8px 0 10px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--muted, #667085);
}

.companion-empty-recs {
  grid-column: 1 / -1;
  padding: 16px 18px;
  border-radius: 16px;
  background: rgba(16, 43, 67, 0.05);
  border: 1px dashed var(--border, #d8dee6);
}

.companion-empty-recs p {
  margin: 0;
  color: var(--muted, #667085);
}

.match-badge {
  display: inline-block;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(242,106,46,0.15);
  color: var(--mandarin);
  font-weight: 900;
  font-size: 13px;
}

.companion-book-card h3 {
  margin: 12px 0 6px;
  font-size: 20px;
}

.companion-book-card:hover {
  transform: translateY(-6px);
  transition: 0.25s;
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(16px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* mood card*/
.mood-card {
  padding: 30px;
  margin-bottom: 30px;
}

.mood-card h2 {
  font-family: Georgia, serif;
  font-size: 32px;
  margin: 8px 0 20px;
}

.mood-options {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.mood-options button {
  padding: 12px 18px;
  border-radius: 999px;
  border: 1px solid var(--border-neutral);
  background: var(--white);
  color: var(--navy);
  font-weight: 600;
}

.mood-options button:hover,
.active-mood {
  background: var(--lavender) !important;
  color: var(--navy) !important;
  border-color: transparent !important;
}

/* reader journey */
.journey-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-bottom: 30px;
}

.journey-card {
  padding: 30px;
}

.journey-card h2 {
  font-family: Georgia, serif;
  font-size: 30px;
}

.journey-insight {
  padding: 34px;
  margin-bottom: 28px;
}

.journey-insight h2 {
  font-family: Georgia, serif;
  font-size: 32px;
}

.journey-insight p,
.journey-insight #insightList p {
  color: var(--readable-body, var(--text-secondary));
  font-weight: 500;
  line-height: 1.65;
}

.growth-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.growth-tags span,
.growth-tag-btn {
  padding: 12px 18px;
  border-radius: 999px;
  background: rgba(180, 83, 9, 0.08);
  color: var(--readable-link, #B45309);
  font-weight: 600;
  text-decoration: none;
}

.growth-tag-btn {
  border: 1px solid rgba(180, 83, 9, 0.22);
  cursor: pointer;
  font: inherit;
  transition: transform 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.growth-tag-btn:hover:not(:disabled) {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(180, 83, 9, 0.12);
  background: rgba(180, 83, 9, 0.14);
  color: var(--readable-link, #B45309);
}

.growth-hint {
  margin: 0 0 12px;
  color: var(--readable-secondary, var(--muted));
  font-size: 0.92rem;
}

.growth-tag-btn.is-loading {
  opacity: 0.65;
  cursor: wait;
}

.growth-note {
  margin-top: 12px;
  color: var(--readable-link, #B45309);
  font-size: 0.9rem;
  font-weight: 600;
}

.path-card-focus {
  outline: 2px solid var(--primary);
  outline-offset: 4px;
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.08);
}

/* reading paths */
.paths-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
}

.path-card {
  padding: 32px;
}

.path-icon {
  width: 72px;
  height: 72px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 34px;
  background: linear-gradient(135deg, var(--lilac), var(--orchid));
  margin-bottom: 18px;
}

.path-card h2 {
  font-family: Georgia, serif;
  font-size: 30px;
  margin-bottom: 10px;
}

.path-card p {
  color: var(--text-secondary);
  font-weight: 700;
  line-height: 1.6;
}

.path-progress {
  height: 12px;
  background: rgba(107, 142, 125,0.12);
  border-radius: 999px;
  overflow: hidden;
  margin: 20px 0 10px;
}

.path-progress div {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 999px;
}

.path-count {
  font-size: 14px;
  color: var(--primary) !important;
}

.path-card ol {
  margin: 20px 0;
  padding-left: 22px;
  color: var(--text);
  font-weight: 700;
  line-height: 1.8;
}

.paths-message-clean {
  margin: 20px 0 28px;
}

.paths-message-clean h2 {
  font-family: Georgia, serif;
  font-size: 30px;
  color: var(--text);
  margin: 0;
}

.paths-message-clean p {
  color: var(--text-secondary);
  font-weight: 700;
}

.paths-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 26px;
}

.path-card {
  padding: 34px;
}

.path-header {
  display: grid;
  grid-template-columns: 88px 1fr;
  gap: 22px;
  align-items: start;
}

.path-icon {
  width: 76px;
  height: 76px;
  border-radius: 24px;
  display: grid;
  place-items: center;
  font-size: 34px;
  background: linear-gradient(135deg, var(--lilac), var(--orchid));
  box-shadow: 0 16px 35px rgba(90, 31, 70, 0.18);
}

.path-card h2 {
  font-family: Georgia, serif;
  font-size: 34px;
  margin: 4px 0 10px;
}

.path-card p {
  color: var(--text-secondary);
  font-weight: 700;
  line-height: 1.6;
}

.path-progress {
  height: 12px;
  background: rgba(107, 142, 125,0.12);
  border-radius: 999px;
  overflow: hidden;
  margin: 26px 0 10px;
}

.path-progress div {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), var(--primary-light));
  border-radius: 999px;
}

.path-count {
  font-size: 14px;
  color: var(--primary) !important;
}

.path-timeline {
  margin-top: 28px;
  display: grid;
  gap: 18px;
}

.path-book {
  display: grid;
  grid-template-columns: 44px 82px 1fr auto;
  gap: 18px;
  align-items: center;
  padding: 18px;
  border-radius: 24px;
  background: rgba(255,255,255,0.58);
  border: 1px solid var(--border);
}

.path-step {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  font-weight: 900;
}

.path-book-cover {
  width: 72px;
  height: 96px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  font-size: 32px;
  background: linear-gradient(135deg, var(--teal), var(--orchid));
  box-shadow: 0 12px 22px rgba(36,19,49,0.18);
}

.path-book-info span {
  display: inline-block;
  padding: 6px 11px;
  border-radius: 999px;
  background: rgba(168, 197, 160,0.25);
  color: var(--primary);
  font-weight: 900;
  font-size: 12px;
}

.path-book-info h3 {
  margin: 8px 0 4px;
  font-size: 22px;
}

.path-book-info p {
  margin: 0;
}

.path-book-info small {
  display: block;
  margin-top: 8px;
  color: var(--text-secondary);
  line-height: 1.5;
}

.start-path-btn {
  margin-top: 24px;
}

/* home js*/
.recommendation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 22px;
}

.recommendation-card-modern {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 22px;
  padding: 18px;
  align-items: start;
  cursor: pointer;
  min-height: 250px;
}

.recommendation-card-modern:hover {
  transform: translateY(-5px);
  transition: 0.25s ease;
}

.recommendation-cover-wrap {
  width: 150px;
  height: 220px;
  flex-shrink: 0;
}

.recommendation-cover {
  width: 100%;
  height: 100%;
  border-radius: 18px;
  object-fit: cover;
  box-shadow: 0 16px 32px rgba(47, 62, 79, 0.2);
}

/* Centralized book cover system */
.book-cover-wrap,
.book-cover-wrapper {
  position: relative;
  overflow: hidden;
  border-radius: 12px;
  box-shadow: 0 14px 28px rgba(47, 62, 79, 0.16);
  background: var(--beige);
  flex-shrink: 0;
  width: 100%;
  aspect-ratio: 2 / 3;
}

.book-cover-img,
.book-cover-image {
  display: block;
  width: 100%;
  height: 100%;
  opacity: 1;
  visibility: visible;
  object-fit: cover;
  border-radius: inherit;
  background: var(--beige);
}

.book-cover-placeholder {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 8px;
  width: 100%;
  height: 100%;
  padding: 14px 12px;
  border-radius: inherit;
  background: linear-gradient(145deg, #f3efe8 0%, #e8e2d8 100%);
  box-shadow: inset 0 0 0 1px rgba(47, 62, 79, 0.08);
  text-align: left;
  overflow: hidden;
}

.book-cover-placeholder .book-cover-title,
.book-cover-placeholder strong.book-cover-title {
  font-family: Georgia, serif;
  font-size: 0.92rem;
  line-height: 1.25;
  color: var(--ink) !important;
  font-weight: 700;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-cover-placeholder .book-cover-author,
.book-cover-placeholder span.book-cover-author {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted) !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.book-cover-resolving {
  opacity: 0.72;
}

.book-cover-resolving::after {
  content: "Resolving cover…";
  display: block;
  margin-top: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.book-cover-unavailable {
  opacity: 0.85;
}

.book-cover-unavailable::after {
  content: "Cover unavailable";
  display: block;
  margin-top: 6px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.premium-book-placeholder {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: center;
  width: 100%;
  height: 100%;
  min-height: 100%;
  border-radius: inherit;
  overflow: hidden;
  background: linear-gradient(145deg, #f3efe8 0%, #e8e2d8 100%);
  box-shadow: inset 0 0 0 1px rgba(47, 62, 79, 0.08);
}

.premium-book-spine {
  background: linear-gradient(180deg, rgba(47, 74, 58, 0.35), rgba(47, 74, 58, 0.12));
  border-right: 1px solid rgba(47, 62, 79, 0.12);
}

.premium-book-face {
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 8px;
  padding: 18px 14px;
  text-align: left;
}

.premium-book-title {
  font-family: Georgia, serif;
  font-size: 0.92rem;
  line-height: 1.25;
  color: var(--ink);
  font-weight: 700;
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.premium-book-author {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.premium-book-title,
.book-cover-title {
  color: var(--ink) !important;
}

.premium-book-author,
.book-cover-author {
  color: var(--muted) !important;
}

.recommendation-cover-wrap.book-cover-wrap,
.shared-book-cover-wrap.book-cover-wrap {
  width: 150px;
  height: 220px;
  flex-shrink: 0;
}

.discovery-cover-slot.book-cover-wrap,
.discovery-modal-cover-slot.book-cover-wrap {
  width: 100%;
  aspect-ratio: 2 / 3;
}

.bd-cover-wrap.book-cover-wrap {
  width: min(100%, 280px);
  aspect-ratio: 2 / 3;
  margin: 0 auto;
}

.path-cover-wrap.book-cover-wrap {
  width: 72px;
  height: 108px;
}

.companion-cover-wrap.book-cover-wrap {
  width: 100%;
  aspect-ratio: 2 / 3;
  margin-bottom: 14px;
}

.community-card-cover.book-cover-wrap {
  width: 96px;
  height: 144px;
}

.import-result-cover.book-cover-wrap {
  width: 56px;
  height: 84px;
}

.path-book-cover-img,
.companion-cover-img,
.community-cover-img,
.import-cover-img,
.discovery-card-img,
.discovery-detail-img,
.shared-book-cover,
.recommendation-cover,
.bd-cover-img {
  border-radius: inherit;
}

.fallback-cover {
  display: grid;
  place-items: center;
  background: linear-gradient(145deg, var(--sage-light), var(--primary-light));
  color: var(--primary);
}

.fallback-cover::before {
  content: "";
  width: 40px;
  height: 40px;
  background: var(--primary);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5'%3E%3Cpath d='M12 7v14'/%3E%3Cpath d='M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5'%3E%3Cpath d='M12 7v14'/%3E%3Cpath d='M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.recommendation-info h3 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.15;
}

.recommendation-info .reason {
  margin: 14px 0;
  line-height: 1.5;
}

.recommendation-card-modern .book-actions {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.recommendation-card-modern .mini-btn {
  padding: 10px 12px;
}

/* discovery page */
.discovery-search-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.85);
}

.discovery-search-icon {
  width: 20px;
  height: 20px;
  color: var(--muted);
  flex-shrink: 0;
}

.discovery-search-bar input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  font-size: 15px;
  min-width: 0;
}

.discovery-search-clear {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  cursor: pointer;
  line-height: 1;
}

.discovery-search-status {
  margin-top: 14px;
  font-size: 0.92rem;
  font-weight: 600;
}

.discovery-search-status-loading { color: var(--muted); }
.discovery-search-status-error { color: #9b1c3a; }
.discovery-search-status-empty,
.discovery-search-status-hint { color: var(--muted); }
.discovery-search-status-success { color: #1f6b43; }

.discovery-search-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.discovery-filter {
  border: 1px solid rgba(109, 82, 111, 0.18);
  background: var(--surface);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 14px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: 0.2s ease;
}

.discovery-filter:hover {
  border-color: rgba(109, 82, 111, 0.35);
}

.discovery-filter.active {
  background: var(--text);
  color: #fff;
  border-color: var(--text);
}

.discovery-rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-weight: 800;
  color: #8a5a12;
  font-size: 0.92rem;
}

.discovery-card-rating {
  margin-top: 2px;
}

.discovery-state {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  font-weight: 700;
}

.discovery-results {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
  margin-top: 22px;
  align-items: stretch;
}

.discovery-card {
  display: flex;
  gap: 18px;
  padding: 18px;
  align-items: stretch;
  min-height: 176px;
}

.discovery-card-cover {
  flex: 0 0 96px;
  width: 96px;
}

.discovery-cover-slot,
.discovery-modal-cover-slot {
  width: 100%;
  height: 140px;
  border-radius: 14px;
  overflow: hidden;
  box-shadow: 0 10px 24px rgba(47, 62, 79, 0.18);
  background: linear-gradient(145deg, var(--surface) 0%, var(--sage-light) 100%);
}

.discovery-modal-cover-slot {
  height: 260px;
  border-radius: 16px;
  box-shadow: 0 16px 32px rgba(47, 62, 79, 0.2);
}

.discovery-card-img,
.discovery-detail-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  margin-bottom: 0;
  border-radius: 0;
  box-shadow: none;
}

.discovery-cover-slot .discovery-cover-placeholder,
.discovery-modal-cover-slot .discovery-cover-placeholder {
  width: 100%;
  height: 100%;
  margin-bottom: 0;
  padding: 0;
  border-radius: 0;
  display: grid;
  place-items: center;
  color: #fff;
}

.discovery-cover-slot .discovery-cover-placeholder span {
  font-size: 32px;
}

.discovery-modal-cover-slot .discovery-cover-placeholder span {
  font-size: 44px;
}

.discovery-card-body {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.discovery-card-body h3 {
  margin: 0;
  font-size: 18px;
  line-height: 1.25;
}

.discovery-card-author {
  margin: 0;
  color: var(--muted);
  font-weight: 600;
  font-size: 0.92rem;
}

.discovery-card-preview {
  margin: 0;
  flex: 1;
  font-size: 0.92rem;
  line-height: 1.45;
  opacity: 0.85;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.discovery-card-action {
  align-self: flex-start;
  margin-top: 10px;
  flex-shrink: 0;
  padding: 8px 16px;
  font-size: 0.88rem;
}

.discovery-empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  grid-column: 1 / -1;
}

.discovery-modal {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: none;
  place-items: center;
  padding: 24px;
  pointer-events: none;
  visibility: hidden;
}

.discovery-modal.is-open {
  display: grid;
  pointer-events: auto;
  visibility: visible;
}

.discovery-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(24, 16, 32, 0.55);
  backdrop-filter: blur(4px);
  cursor: pointer;
}

.discovery-modal-dialog {
  position: relative;
  width: min(920px, 100%);
  max-height: min(90vh, 820px);
  overflow: auto;
  padding: 28px;
  z-index: 1;
  background: #fff;
}

.discovery-modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  z-index: 2;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.95);
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.discovery-modal-layout {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 28px;
  align-items: start;
}

.discovery-modal-cover {
  width: 180px;
}

.discovery-modal-cover .discovery-modal-cover-slot {
  width: 180px;
}

.discovery-modal-content h2 {
  margin: 0 0 8px;
  padding-right: 36px;
  font-family: Georgia, serif;
  font-size: 32px;
  line-height: 1.15;
}

.discovery-modal-meta {
  margin: 0 0 14px;
  color: var(--muted);
  font-weight: 600;
}

.discovery-modal-rating {
  margin: 4px 0 14px;
}

.discovery-detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
  margin: 0 0 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(243, 237, 247, 0.65);
}

.discovery-detail-item dt {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  font-weight: 800;
  margin-bottom: 4px;
}

.discovery-detail-item dd {
  margin: 0;
  font-weight: 700;
  line-height: 1.45;
}

.discovery-shelf-btn.active-shelf {
  box-shadow: inset 0 0 0 2px var(--text);
}

.discovery-modal-description-wrap {
  margin-bottom: 18px;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(107, 142, 125, 0.06);
  border: 1px solid var(--border);
}

.discovery-modal-description-label {
  margin: 0 0 8px;
  font-size: 0.82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.discovery-modal-description {
  margin: 0;
  line-height: 1.6;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
}

.discovery-modal-hint {
  margin: 0 0 14px;
  padding: 12px 14px;
  border-radius: 12px;
  background: #eef4ff;
  color: #1e4a8a;
  font-size: 0.92rem;
  font-weight: 600;
}

.discovery-modal-actions {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}

body.discovery-modal-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .discovery-results { grid-template-columns: 1fr; }
  .discovery-modal-layout { grid-template-columns: 1fr; justify-items: center; }
  .discovery-modal-actions { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
  .discovery-search-bar { flex-wrap: wrap; }
  .discovery-search-bar .btn { width: 100%; }
  .discovery-detail-grid { grid-template-columns: 1fr; }
}

/* =========================
   THEME & READING FONT
========================= */

html[data-reading-font="small"] { font-size: 14px; }
html[data-reading-font="medium"] { font-size: 16px; }
html[data-reading-font="large"] { font-size: 18px; }
html[data-reading-font="xlarge"] { font-size: 20px; }

html.theme-dark {
  /* Color tokens: css/tokens.css */
  --shadow-sm: 0 4px 16px rgba(0, 0, 0, 0.22);
  --shadow-md: 0 10px 30px rgba(0, 0, 0, 0.28);
  --shadow-lg: 0 18px 44px rgba(0, 0, 0, 0.32);
}

html.theme-dark body {
  background: var(--surface);
  color: var(--text);
}

html.theme-dark .sidebar {
  background: var(--sidebar-bg);
  border-color: var(--border-neutral);
  box-shadow: var(--shadow-sm);
}

html.theme-dark .sidebar a:hover {
  background: #2A323C;
  color: var(--ink);
}

html.theme-dark .sidebar a.active {
  background: #2E353F;
  color: var(--ink);
}

html.theme-dark .btn-secondary {
  background: #2A3139;
  color: var(--ink);
  border-color: var(--border-neutral);
}

html.theme-dark .btn-secondary:hover {
  background: #323B45;
  border-color: #4A5563;
}

html.theme-dark .btn-primary {
  background: var(--forest);
  box-shadow: 0 8px 22px rgba(0, 0, 0, 0.35);
}

html.theme-dark .card {
  background: var(--card);
  border-color: var(--border-neutral);
  box-shadow: var(--shadow-sm);
}

html.theme-dark .settings-input,
html.theme-dark .profile-card input[type="text"],
html.theme-dark .profile-card textarea,
html.theme-dark .bd-input,
html.theme-dark .bd-select,
html.theme-dark .bd-textarea {
  background: #222930;
  color: var(--text);
  border-color: var(--border-neutral);
}

/* =========================
   SETTINGS PAGE
========================= */

.btn-danger {
  background: var(--red);
  color: #fff;
  box-shadow: 0 8px 20px rgba(196, 122, 110, 0.25);
}

.btn-danger:hover {
  background: #b56a5f;
  transform: translateY(-2px) scale(1.02);
}

.settings-page .dashboard-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.settings-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  gap: 22px;
  align-items: start;
}

.settings-nav {
  position: sticky;
  top: 24px;
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.settings-nav-link {
  display: block;
  padding: 11px 14px;
  border-radius: 12px;
  font-weight: 600;
  color: var(--muted);
  transition: background 0.2s ease, color 0.2s ease;
}

.settings-nav-link:hover,
.settings-nav-link.active {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.settings-panels {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.settings-section {
  padding: 26px 28px;
  scroll-margin-top: 24px;
}

.settings-section-head {
  margin-bottom: 20px;
}

#reading .settings-section-head {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-neutral, rgba(0, 0, 0, 0.06));
}

.settings-section-head h2 {
  margin: 0 0 6px;
  font-family: Georgia, serif;
  font-size: 26px;
}

.settings-section-head p {
  margin: 0;
  color: var(--muted);
}

.settings-coming-soon {
  display: inline-flex;
  align-items: center;
  margin-left: 12px;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 0.68rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  vertical-align: middle;
}

/* Reading Preferences — airy vertical rhythm (8px system) */
.settings-form-stack {
  display: flex;
  flex-direction: column;
}

.settings-reading-form {
  max-width: 100%;
}

.settings-reading-form .settings-field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 24px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border-neutral, rgba(0, 0, 0, 0.06));
}

.settings-reading-form .settings-field-group--goal {
  margin-bottom: 0;
  padding-bottom: 0;
  border-bottom: none;
}

.settings-reading-form .settings-field-group--ai {
  margin-top: 32px;
  padding-top: 32px;
  border-top: 1px solid var(--border-neutral, rgba(0, 0, 0, 0.06));
  border-bottom: none;
  margin-bottom: 0;
  padding-bottom: 0;
}

.settings-reading-form .settings-field-label {
  margin: 0;
  font-weight: 600;
  font-size: 0.92rem;
  color: var(--charcoal, var(--ink));
}

.settings-field-label-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0;
}

.settings-field-label-row .settings-coming-soon {
  margin-left: 12px;
}

.settings-reading-form .settings-input,
.settings-reading-form .settings-tag-grid {
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.settings-reading-form .settings-tag-grid {
  margin-top: 0;
}

.settings-form-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border-neutral, var(--border));
}

.settings-form-actions .btn {
  min-width: 160px;
}

.settings-account-row {
  display: flex;
  gap: 20px;
  align-items: center;
  margin-bottom: 22px;
}

.settings-avatar {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary-light), var(--primary));
  overflow: hidden;
  flex-shrink: 0;
}

.settings-avatar svg {
  width: 42px;
  height: 42px;
  color: var(--primary);
}

.settings-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.settings-account-meta {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.settings-meta-line {
  margin: 0;
  color: var(--muted);
}

.settings-meta-line strong {
  color: var(--ink);
}

.settings-meta-label {
  display: inline-block;
  min-width: 88px;
  font-weight: 700;
}

.settings-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.settings-field-label {
  display: block;
  margin: 18px 0 8px;
  font-weight: 700;
  color: var(--ink);
}

.settings-input,
.settings-textarea {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

.settings-textarea {
  resize: vertical;
  min-height: 120px;
}

.settings-tag-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.settings-tag {
  padding: 8px 14px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--muted);
  font-weight: 700;
  font-size: 0.88rem;
  cursor: pointer;
  transition: 0.2s ease;
}

.settings-tag.is-selected {
  background: var(--primary-soft);
  border-color: var(--primary);
  color: var(--primary-strong);
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
}

.settings-row:last-child {
  border-bottom: none;
}

.settings-row-title {
  margin: 0 0 4px;
  font-weight: 700;
}

.settings-row-hint {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.settings-row-action {
  padding-top: 18px;
}

.settings-switch {
  position: relative;
  display: inline-flex;
  width: 52px;
  height: 30px;
  flex-shrink: 0;
}

.settings-switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.settings-switch-slider {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: #d8d0c8;
  transition: 0.2s ease;
  cursor: pointer;
}

.settings-switch-slider::before {
  content: "";
  position: absolute;
  width: 24px;
  height: 24px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  transition: 0.2s ease;
}

.settings-switch input:checked + .settings-switch-slider {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
}

.settings-switch input:checked + .settings-switch-slider::before {
  transform: translateX(22px);
}

.settings-link-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 16px;
}

.settings-link-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--cream);
  color: var(--ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  transition: 0.2s ease;
}

.settings-link-btn:hover {
  border-color: var(--primary);
  background: var(--primary-softer);
}

.settings-danger-text {
  color: #962d22;
  line-height: 1.5;
}

html.theme-dark .settings-danger-text {
  color: #D4A59E;
}

/* ==========================================================================
   Dark mode — relaxing editorial overrides
   ========================================================================== */

html.theme-dark .app-layout {
  background: var(--surface);
}

html.theme-dark .dna-progress-card,
html.theme-dark .reader-profile {
  background: var(--beige);
  border-color: #3D3A35;
}

html.theme-dark .stats-card {
  background: var(--butter);
  border-color: #3A3832;
}

html.theme-dark .highlight-card {
  background: var(--lavender);
  border-color: #3A3848;
}

html.theme-dark .journey-insight {
  background: var(--sky);
  border-color: #33404D;
}

html.theme-dark .mood-card {
  background: var(--card);
  border-color: var(--border-neutral);
}

html.theme-dark .mood-options button:hover,
html.theme-dark .goal-options button:hover,
html.theme-dark .active-mood {
  background: var(--lavender) !important;
  border-color: #3A3848 !important;
  color: var(--ink) !important;
}

html.theme-dark .community-card {
  background: var(--card);
  border-color: #403530;
}

html.theme-dark .community-card-cover {
  background: var(--coral);
}

html.theme-dark .chat-shell {
  background: var(--lavender);
  border-color: #3A3848;
}

html.theme-dark .goal-card,
html.theme-dark .progress-cards .card {
  background: var(--sage-section);
  border-color: #334038;
}

html.theme-dark .library-tabs.card {
  background: var(--sky);
  border-color: #33404D;
}

html.theme-dark .library-summary-grid .stats-card:first-child {
  background: var(--sky);
  border-color: #33404D;
}

html.theme-dark .library-summary-grid .stats-card:nth-child(2) {
  background: var(--lavender);
  border-color: #3A3848;
}

html.theme-dark .library-summary-grid .stats-card:nth-child(3) {
  background: var(--butter);
  border-color: #3A3832;
}

html.theme-dark .library-tab[data-shelf="reading"].active-tab {
  background: #334A5C !important;
  color: var(--ink) !important;
  border-color: #3E5568 !important;
}

html.theme-dark .library-tab.active-tab {
  background: #3A4450 !important;
  color: var(--ink) !important;
}

html.theme-dark .mini-btn {
  background: #2A3139;
  color: var(--ink);
  border-color: var(--border-neutral);
}

html.theme-dark .mini-btn:hover {
  background: #323B45;
}

html.theme-dark .book-meta span {
  background: #2E353F;
  color: var(--text);
}

html.theme-dark .stats-row div {
  background: rgba(0, 0, 0, 0.18);
}

html.theme-dark .fallback-cover,
html.theme-dark .bd-cover-fallback,
html.theme-dark .recommendation-cover.fallback-cover {
  background: linear-gradient(145deg, #2A3139, #232930);
}

html.theme-dark .library-progress-track,
html.theme-dark .bd-progress-track,
html.theme-dark .progress-bar,
html.theme-dark .path-progress,
html.theme-dark .dna-progress-bar,
html.theme-dark .challenge-bar {
  background: rgba(255, 255, 255, 0.06) !important;
}

html.theme-dark .path-book.done {
  background: var(--sky);
}

html.theme-dark .landing-page {
  background:
    radial-gradient(circle at top left, rgba(40, 48, 58, 0.5), transparent 34%),
    radial-gradient(circle at bottom right, rgba(35, 45, 58, 0.45), transparent 38%),
    linear-gradient(160deg, #181C21, #1E2329);
}

html.theme-dark .settings-nav-link:hover,
html.theme-dark .settings-nav-link.active {
  background: #2E353F;
  color: var(--ink);
}

html.theme-dark .settings-modal-backdrop {
  background: rgba(10, 12, 15, 0.72);
}

html.theme-dark input:focus,
html.theme-dark textarea:focus,
html.theme-dark select:focus,
html.theme-dark .bd-select:focus,
html.theme-dark .bd-input:focus {
  border-color: #5A6A7A !important;
  box-shadow: 0 0 0 3px rgba(90, 106, 122, 0.2) !important;
}

/* Dark mode — contrast fixes (readable text on dark surfaces) */
html.theme-dark .book-hub-card-v2,
html.theme-dark .review-card-v2 {
  background: var(--card);
}

html.theme-dark .detail-meta-row span {
  background: rgba(255, 255, 255, 0.08);
  color: #e8c4d4;
}

html.theme-dark .recommendation-reason-box {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--border-neutral);
}

html.theme-dark .recommendation-reason-box p {
  color: var(--text-secondary);
}

html.theme-dark .bd-meta-chip {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
}

html.theme-dark .bd-eyebrow-pill {
  background: rgba(255, 255, 255, 0.1);
  color: #c8e6d4;
  border: 1px solid rgba(255, 255, 255, 0.12);
}

html.theme-dark .status-btn-modern {
  background: var(--card);
  color: var(--text);
  border-color: var(--border-neutral);
}

html.theme-dark .rating-summary-card p {
  color: var(--muted);
}

html.theme-dark .path-complete-btn-disabled:disabled {
  background: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.45);
  border-color: rgba(255, 255, 255, 0.12);
}

html.theme-dark .path-complete-btn-ready,
html.theme-dark .complete-path-button {
  background: #1f313a;
  color: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

html.theme-dark .path-complete-btn-ready:hover,
html.theme-dark .complete-path-button:hover {
  background: #2a4552;
  color: #ffffff;
}

html.theme-dark .journey-continue-btn {
  background: #1f313a;
  color: #ffffff;
  border: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
}

html.theme-dark .journey-continue-btn:hover {
  background: #2a4552;
  color: #ffffff;
}

html.theme-dark .path-unlock-banner {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

html.theme-dark .passport-stamp {
  background: linear-gradient(165deg, rgba(255, 255, 255, 0.04) 0%, var(--card) 100%);
}

html.theme-dark .secret-path-locked h3 {
  color: var(--muted);
}

html.theme-dark .settings-coming-soon {
  background: rgba(255, 255, 255, 0.1);
  color: #c8e6d4;
}

html.theme-dark .auth-notice-warning {
  background: rgba(255, 248, 232, 0.08);
  color: #e8d4a8;
  border-color: rgba(240, 223, 160, 0.25);
}

html.theme-dark .auth-notice-info {
  background: rgba(238, 244, 255, 0.08);
  color: #a8c4e8;
  border-color: rgba(201, 220, 255, 0.2);
}

html.theme-dark .eyebrow {
  color: var(--text-secondary);
  opacity: 1;
}

html.theme-dark .path-books-progress-done strong {
  color: var(--accent);
}

html.theme-dark .path-completed-ribbon {
  color: #2a2520;
}

.settings-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: none;
  place-items: center;
  padding: 24px;
}

.settings-modal.is-open {
  display: grid;
}

.settings-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(23, 19, 28, 0.55);
}

.settings-modal-dialog {
  position: relative;
  width: min(100%, 460px);
  padding: 28px;
  z-index: 1;
}

.settings-modal-dialog h3 {
  margin: 0 0 12px;
  font-family: Georgia, serif;
}

.settings-modal-close {
  position: absolute;
  top: 14px;
  right: 14px;
  border: none;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}

.settings-form label {
  display: block;
  margin: 14px 0 6px;
  font-weight: 700;
}

.settings-form .btn {
  margin-top: 18px;
  width: 100%;
}

.settings-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1400;
  padding: 14px 18px;
  border-radius: 14px;
  background: #1f6b43;
  color: #fff;
  font-weight: 700;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.18);
  opacity: 0;
  transform: translateY(12px);
  transition: 0.25s ease;
  pointer-events: none;
}

.settings-toast.show {
  opacity: 1;
  transform: translateY(0);
}

.settings-toast-info { background: #1e4a8a; }
.settings-toast-error { background: #962d22; }

body.settings-modal-open {
  overflow: hidden;
}

@media (max-width: 900px) {
  .settings-layout {
    grid-template-columns: 1fr;
  }

  .settings-nav {
    position: static;
    flex-direction: row;
    overflow-x: auto;
    white-space: nowrap;
  }

  .settings-nav-link {
    flex: 0 0 auto;
  }
}

@media (max-width: 620px) {
  .settings-section {
    padding: 20px 18px;
  }

  .settings-account-row {
    flex-direction: column;
    align-items: flex-start;
  }

  .settings-actions-row .btn {
    width: 100%;
  }
}

/* =========================
   PREMIUM SIDEBAR REDESIGN
========================= */

.sidebar {
  background: var(--sidebar-bg);
  color: var(--ink);
  padding: 28px 18px;
  border-right: none;
  margin: 16px 0 16px 16px;
  border-radius: 20px;
  box-shadow: var(--shadow-sm);
  align-self: start;
  border: 1px solid var(--border-neutral);
}

.sidebar h2 {
  font-size: 20px;
  margin-bottom: 32px;
  color: var(--navy);
  letter-spacing: -0.3px;
  padding: 0 10px;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 600;
}

.sidebar h2 .icon {
  color: var(--navy);
}

.sidebar a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  margin-bottom: 4px;
  border-radius: 12px;
  color: var(--muted);
  font-weight: 500;
  font-size: 14px;
  text-decoration: none;
  transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
}

.sidebar a:hover {
  background: var(--ivory);
  color: var(--navy);
  transform: translateX(2px);
}

.sidebar a.active {
  background: var(--beige);
  color: var(--navy);
  font-weight: 600;
}

/* =========================
   ICON SYSTEM (Lucide, outline)
========================= */

.icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  stroke-width: 1.5;
  vertical-align: middle;
}

.sidebar h2 {
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar h2 .icon {
  width: 22px;
  height: 22px;
  color: var(--primary);
}

/* keep nav glyphs aligned and inheriting the link color */
.sidebar a .icon {
  color: currentColor;
}

/* icon + label buttons */
.status-btn-modern,
.library-tab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.find-link-card .icon {
  width: 22px;
  height: 22px;
  color: var(--primary);
}

.book-tip-card {
  display: flex;
  align-items: center;
  gap: 12px;
}

.book-tip-card .icon {
  width: 20px;
  height: 20px;
  color: var(--primary);
}

.mood-options button,
.goal-options button {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* inline icons that sit next to text (badges, pills, small buttons) */
.icon-inline {
  width: 15px;
  height: 15px;
  vertical-align: middle;
}

.mini-btn,
.match-badge,
.mood-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.mood-pill .icon {
  width: 16px;
  height: 16px;
}

.reasoning-box p {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.custom-cover .cover-glyph {
  width: 46px;
  height: 46px;
  color: #fff;
  stroke-width: 1.75;
}

.feature-svg {
  width: 30px;
  height: 30px;
  color: var(--primary);
}

.brand-icon .feature-svg {
  width: 26px;
  height: 26px;
}


/* =========================
   CLEAN READING MODE CARD
========================= */

.mood-card {
  padding: 30px 34px;
  margin-bottom: 30px;
}

.mood-card .eyebrow {
  margin-bottom: 8px;
}

.mood-card h2 {
  font-size: 24px;
  margin: 0 0 18px;
}

.mood-options,
.goal-options {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
}

.goal-options {
  grid-template-columns: repeat(6, 1fr);
}

.mood-options button,
.goal-options button {
  min-height: 48px;
  border-radius: 16px;
  border: 1px solid rgba(107, 142, 125,0.14);
  background: rgba(255,255,255,0.78);
  color: var(--text);
  font-weight: 900;
  box-shadow: 0 8px 18px rgba(36,19,49,0.04);
}

.mood-options button:hover,
.goal-options button:hover,
.active-mood {
  background: var(--lavender) !important;
  border-color: #D8D2E6 !important;
  color: var(--readable-heading, var(--navy)) !important;
  transform: translateY(-2px);
}

.goal-title {
  margin-top: 28px !important;
  padding-top: 24px;
  border-top: 1px solid rgba(107, 142, 125,0.12);
}


/* responsive */
@media (max-width: 1200px) {
  .mood-options,
  .goal-options {
    grid-template-columns: repeat(3, 1fr);
  }
}
/* FIXED AI PICK + MISSION DESIGN */

.highlight-card:not(.ai-pick-card) {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  gap: 24px;
  padding: 28px 34px;
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(248,233,255,0.8));
}

.highlight-card:not(.ai-pick-card) > div {
  padding: 0;
}

.highlight-card:not(.ai-pick-card) h2 {
  font-family: Georgia, serif;
  font-size: 30px;
  margin: 6px 0 8px;
  color: var(--readable-heading, var(--ink));
}

.highlight-card:not(.ai-pick-card) p {
  max-width: 760px;
  line-height: 1.5;
}

#topPickBtn {
  margin: 0;
}

.journey-insight {
  padding: 28px 34px;
  display: block;
  background: linear-gradient(135deg, rgba(255,255,255,0.92), rgba(245,231,255,0.72));
}

.journey-insight::before {
  display: none;
}

.journey-insight h2 {
  font-family: Georgia, serif;
  font-size: 30px;
  line-height: 1.3;
  margin: 8px 0 0;
  max-width: 900px;
  color: var(--readable-heading, var(--navy));
}

.journey-insight .eyebrow {
  margin: 0;
}

/*static side bar*/
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  align-self: flex-start;
}

/*book card design*/
.shared-book-card {
  display: grid;
  grid-template-columns: 150px 1fr;
  gap: 24px;
  padding: 24px;
  align-items: start;
  transition: transform var(--transition-smooth), box-shadow var(--transition-smooth);
}

.shared-book-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--shadow-lg);
}

.shared-book-cover {
  width: 150px;
  height: 220px;
  border-radius: 16px;
  object-fit: cover;
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-smooth);
}

.shared-book-card:hover .shared-book-cover {
  transform: scale(1.02);
}

.shared-book-info h3 {
  margin: 0 0 10px;
  font-size: 22px;
  line-height: 1.2;
  font-family: "Playfair Display", Georgia, serif;
  font-weight: 600;
  color: var(--navy);
}

.shared-book-info .reason {
  margin: 12px 0;
  line-height: 1.5;
}

.shared-book-card .book-actions {
  margin-top: 14px;
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}

.shared-book-card .mini-btn {
  padding: 10px 12px;
}

.library-tabs {
  padding: 16px;
  display: flex;
  gap: 12px;
  margin-bottom: 26px;
}

.library-tab {
  flex: 1;
  padding: 14px 18px;
  border-radius: 16px;
  border: 1.5px solid var(--border-neutral);
  background: var(--white);
  color: var(--navy);
  font-weight: 600;
  transition: all var(--transition-fast);
}

.library-tab:hover {
  background: var(--ivory);
  border-color: var(--border-neutral);
  transform: translateY(-1px);
}

.library-tab.active-tab {
  background: var(--navy) !important;
  color: #fff !important;
  border-color: var(--navy) !important;
}

.library-tab[data-shelf="reading"].active-tab {
  background: var(--sky) !important;
  color: var(--navy) !important;
  border-color: #C5D9EC !important;
}

.library-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-bottom: 34px;
}

.library-summary-grid .stats-card {
  padding: 28px;
  text-align: center;
}

.library-summary-grid .stats-card h2 {
  font-family: Georgia, serif;
  font-size: 44px;
  margin: 0;
  color: var(--primary);
}

.library-summary-grid .stats-card p {
  color: var(--text-secondary);
  font-weight: 900;
}

.library-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}

.empty-library {
  padding: 36px;
  text-align: center;
}

.empty-library h2 {
  font-family: Georgia, serif;
}

.empty-library .btn {
  margin-top: 18px;
}

/*quiz updates*/
.quiz-hint {
  color: var(--text-secondary);
  font-weight: 700;
  margin-top: -12px;
}

.dna-ready {
  text-align: center;
  padding: 40px 20px;
}

.dna-icon {
  font-size: 74px;
  margin-bottom: 18px;
}

.dna-ready h1 {
  font-family: Georgia, serif;
  font-size: 46px;
}

.dna-ready p {
  color: var(--text-secondary);
  font-weight: 800;
  margin-bottom: 28px;
}

/* Reader DNA quiz — custom inputs + profile card */
.quiz-custom-field,
.quiz-custom-genre {
  margin-top: 24px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
}

.quiz-custom-label {
  display: block;
  margin-bottom: 10px;
  font-weight: 700;
  color: var(--muted);
  font-size: 0.92rem;
}

.quiz-custom-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
}

.quiz-custom-input {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

.quiz-custom-add {
  white-space: nowrap;
}

.quiz-custom-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.quiz-custom-tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--beige);
  color: var(--ink);
  font-weight: 700;
  cursor: pointer;
}

.quiz-toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(12px);
  opacity: 0;
  pointer-events: none;
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  z-index: 2000;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

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

.dna-profile-card {
  padding: 8px 0 12px;
  animation: dnaFadeIn 0.5s ease;
}

.dna-profile-loading {
  text-align: center;
  padding: 48px 20px;
}

.dna-profile-spinner {
  width: 48px;
  height: 48px;
  margin: 0 auto 20px;
  border: 3px solid rgba(47, 74, 58, 0.15);
  border-top-color: var(--forest);
  border-radius: 50%;
  animation: dnaSpin 0.8s linear infinite;
}

.dna-profile-header {
  text-align: center;
  margin-bottom: 32px;
  padding-bottom: 28px;
  border-bottom: 1px solid var(--border);
}

.dna-profile-header h1 {
  font-family: Georgia, serif;
  font-size: clamp(2rem, 4vw, 2.6rem);
  line-height: 1.15;
  margin: 8px 0;
  color: var(--ink);
}

.dna-profile-subtitle {
  color: var(--muted);
  font-weight: 700;
  margin: 0;
}

.dna-profile-body {
  display: grid;
  gap: 22px;
  margin-bottom: 28px;
}

.dna-profile-stat {
  animation: dnaSlideUp 0.45s ease both;
}

.dna-profile-stat:nth-child(1) { animation-delay: 0.05s; }
.dna-profile-stat:nth-child(2) { animation-delay: 0.1s; }
.dna-profile-stat:nth-child(3) { animation-delay: 0.15s; }

.dna-profile-stat-label {
  display: block;
  margin-bottom: 8px;
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
}

.dna-profile-stat-value {
  margin: 0;
  font-family: Georgia, serif;
  font-size: 1.15rem;
  line-height: 1.4;
  color: var(--ink);
}

.dna-profile-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.dna-profile-tag {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(47, 74, 58, 0.08);
  color: var(--forest);
  font-weight: 700;
  border: 1px solid rgba(47, 74, 58, 0.12);
}

.dna-profile-next {
  padding: 20px 22px;
  border-radius: 16px;
  background: var(--beige);
  border: 1px solid #E5DFD4;
  animation: dnaSlideUp 0.45s ease 0.2s both;
}

.dna-profile-next-text {
  margin: 0;
  font-weight: 700;
  line-height: 1.55;
  color: var(--ink);
}

.dna-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  animation: dnaSlideUp 0.45s ease 0.25s both;
}

.dna-profile-actions .btn {
  flex: 1 1 160px;
}

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
}

.btn-ghost:hover {
  color: var(--ink);
  border-color: var(--ink);
}

@keyframes dnaFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes dnaSlideUp {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

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

html.theme-dark .quiz-custom-input {
  background: var(--surface-elevated);
}

html.theme-dark .dna-profile-next,
html.theme-dark .quiz-custom-tag {
  background: var(--surface);
}

@media (max-width: 640px) {
  .dna-profile-actions {
    flex-direction: column;
  }

  .dna-profile-actions .btn {
    width: 100%;
  }
}

.library-summary-grid-4 {
  grid-template-columns: repeat(4, 1fr);
}

/*home updates*/
.dna-progress-card {
  padding: 36px 40px;
  margin-bottom: 32px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 28px;
  align-items: center;
  background: var(--beige);
  border: 1px solid #E5DFD4;
}

.dna-progress-card[hidden] {
  display: none !important;
}

html.reader-dna-complete #dnaProgressCard,
html.reader-dna-complete #continueDiscoveryTop,
html.reader-dna-complete #continueDiscoveryMain {
  display: none !important;
}

.dna-progress-card .eyebrow {
  color: #7A6F5E;
}

.dna-progress-bar {
  height: 8px;
  border-radius: 999px;
  background: rgba(47, 62, 79, 0.08);
  overflow: hidden;
  margin-top: 20px;
}

#dnaProgressFill {
  height: 100%;
  width: 25%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--forest), var(--progress-green));
  transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ==========================================================================
   Book Details page — clean / premium (inspired layout)
   ========================================================================== */

.book-details-page {
  max-width: 1120px;
  margin: 0 auto;
}

/* top bar */
.bd-topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 26px;
}

.book-details-page .back-link {
  font-weight: 700;
  color: var(--muted);
  transition: 0.2s;
}

.book-details-page .back-link:hover {
  color: var(--primary-strong);
  transform: translateX(-3px);
}

.bd-add-select {
  appearance: none;
  -webkit-appearance: none;
  padding: 12px 40px 12px 18px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%236B8E7D' d='M6 8 0 0h12z'/%3E%3C/svg%3E") no-repeat right 16px center;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  box-shadow: 0 6px 16px rgba(35,25,60,0.06);
}

/* --- Hero (styled like a Recommended For You card) --- */
.bd-hero {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 26px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 10px 28px rgba(47, 62, 79, 0.05);
  padding: 22px;
  margin-bottom: 22px;
  align-items: start;
}

.bd-cover-col {
  display: flex;
  flex-direction: column;
  gap: 14px;
  width: 170px;
}

.bd-cover-img,
.bd-cover-fallback {
  width: 170px;
  height: 250px;
  border-radius: 18px;
  box-shadow: 0 16px 32px rgba(47, 62, 79, 0.2);
}

.bd-cover-img {
  object-fit: cover;
}

.bd-cover-fallback {
  display: grid;
  place-items: center;
  font-size: 56px;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
}

.bd-rating-block {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
}

.bd-rating-stars {
  font-size: 22px;
  color: #d8d3e6;
  letter-spacing: 2px;
}

.bd-rating-stars.rated {
  color: var(--gold);
}

.bd-rating-meta {
  display: flex;
  flex-direction: column;
  line-height: 1.1;
}

.bd-rating-meta strong {
  font-size: 20px;
  color: var(--ink);
}

.bd-rating-meta span {
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.bd-hero-info h1 {
  font-size: 28px;
  line-height: 1.15;
  margin: 10px 0 6px;
  color: var(--ink);
}

.bd-eyebrow-pill {
  display: inline-block;
  background: var(--primary-soft);
  color: var(--primary-strong);
  padding: 6px 14px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.bd-author {
  color: var(--muted);
  font-weight: 600;
  margin: 0 0 14px;
}

.bd-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.bd-meta-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #f4f3f9;
  color: #5c5872;
  padding: 7px 13px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 700;
}

.bd-meta-chip svg {
  width: 15px;
  height: 15px;
  color: #8a86a0;
}

.bd-why {
  background: var(--primary-soft);
  border: 1px solid #e6ddf8;
  border-radius: 16px;
  padding: 20px 22px;
  margin-bottom: 24px;
}

.bd-why h3 {
  margin: 0 0 8px;
  font-size: 16px;
  color: var(--primary-strong);
}

.bd-why p {
  margin: 0;
  line-height: 1.55;
  color: #5c5872;
}

.bd-shelf-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.bd-shelf-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border-radius: 12px;
  background: #fff;
  color: var(--ink);
  border: 1.5px solid var(--border);
  font-weight: 700;
  transition: 0.2s;
}

.bd-shelf-btn:hover {
  border-color: var(--primary);
  color: var(--primary-strong);
}

.bd-shelf-btn.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(124, 92, 214, 0.3);
}

.bd-shelf-btn.danger.active {
  background: linear-gradient(135deg, #d1524f, #b23c3a);
  box-shadow: 0 10px 24px rgba(209, 82, 79, 0.3);
}

/* --- rows / cards --- */
.bd-row-3 {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px;
  margin-bottom: 22px;
}

.bd-card {
  padding: 24px;
  margin-bottom: 22px;
  border-radius: 16px;
}

.bd-row-3 .bd-card {
  margin-bottom: 0;
}

.bd-card > h2 {
  font-size: 18px;
  margin: 4px 0 16px;
  color: var(--ink);
}

.bd-full-btn {
  width: 100%;
  margin-top: 14px;
  text-align: center;
}

/* motivation card */
.bd-motivation {
  position: relative;
  display: block;
  overflow: hidden;
  background: linear-gradient(135deg, var(--surface), var(--sage-light));
  border-color: #e6ddf8;
}

.bd-motivation-text h2 {
  margin: 0 0 8px;
  font-size: 19px;
  color: var(--primary-strong);
}

.bd-motivation-text p {
  margin: 0;
  max-width: 78%;
  color: #5c5872;
  line-height: 1.5;
  font-weight: 500;
}

.bd-motivation-art {
  position: absolute;
  right: 18px;
  bottom: 14px;
  font-size: 52px;
  line-height: 1;
}

/* progress */
.bd-progress-ring-row {
  display: flex;
  align-items: center;
  gap: 14px;
  margin: 18px 0;
}

.bd-progress-track {
  flex: 1;
  height: 12px;
  border-radius: 999px;
  background: var(--sage-light);
  overflow: hidden;
}

.bd-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-strong));
  transition: width 0.4s ease;
}

.bd-progress-label {
  font-weight: 800;
  font-size: 15px;
  color: var(--muted);
  min-width: 42px;
  text-align: right;
}

.bd-progress-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.bd-progress-inputs label,
.bd-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-weight: 700;
  font-size: 13px;
  color: var(--muted);
}

/* shared inputs */
.bd-select,
.bd-input,
.bd-textarea,
.bd-progress-inputs input {
  width: 100%;
  padding: 12px 15px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  color: var(--ink);
  transition: 0.2s;
}

.bd-select:focus,
.bd-input:focus,
.bd-textarea:focus,
.bd-progress-inputs input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(107, 142, 125, 0.16);
}

.bd-textarea {
  min-height: 100px;
  resize: vertical;
}

/* source / open */
.bd-open-area {
  margin-top: 6px;
}

.bd-file-open {
  display: block;
  margin-top: 12px;
  padding: 13px;
  text-align: center;
  border: 1.5px dashed var(--primary);
  border-radius: 12px;
  font-weight: 700;
  color: var(--primary-strong);
  cursor: pointer;
  transition: 0.2s;
}

.bd-file-open:hover {
  background: var(--primary-softer);
}

/* review */
.bd-review-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
  margin-bottom: 22px;
}

.bd-review-grid h2 {
  font-size: 15px;
  margin: 0 0 12px;
  color: var(--ink);
}

.bd-star-rating {
  display: flex;
  gap: 6px;
}

.bd-star-rating button {
  background: none;
  border: none;
  padding: 0;
  font-size: 30px;
  line-height: 1;
  color: var(--star-empty);
  cursor: pointer;
  transition: transform 0.15s, color 0.15s;
}

.bd-star-rating button:hover {
  transform: scale(1.12);
  color: var(--star-hover);
}

.bd-star-rating button.on {
  color: var(--star-active);
}

.bd-hint {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.bd-recommend {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.bd-rec-btn {
  padding: 12px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: #fff;
  font-weight: 700;
  font-size: 14px;
  transition: 0.2s;
}

.bd-rec-btn.yes.active {
  background: var(--green-soft);
  border-color: var(--green);
  color: var(--green);
}

.bd-rec-btn.no.active {
  background: var(--red-soft);
  border-color: var(--red);
  color: var(--red);
}

.bd-review-body {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 20px;
  align-items: start;
}

.bd-counter {
  align-self: flex-end;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.bd-review-save {
  display: block;
  margin: 22px auto 0;
  padding-left: 40px;
  padding-right: 40px;
}

.bd-saved-review {
  margin-top: 22px;
  padding: 20px;
  border-radius: 16px;
  background: var(--primary-softer);
  border: 1px solid var(--border);
}

.bd-saved-review-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.bd-saved-stars {
  color: var(--gold);
  font-size: 18px;
  letter-spacing: 2px;
}

.bd-saved-date {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.bd-saved-review h3 {
  margin: 10px 0 6px;
  font-size: 17px;
  color: var(--ink);
}

.bd-saved-review p {
  margin: 0;
  line-height: 1.55;
  color: #5c5872;
}

.bd-saved-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.bd-saved-tags span {
  background: #fff;
  border: 1px solid var(--border);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  color: var(--primary-strong);
}

/* find */
.bd-find-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}

.bd-find-option {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: #fff;
  transition: 0.2s;
}

.bd-find-option:hover {
  border-color: var(--primary);
  box-shadow: 0 10px 24px rgba(124, 92, 214, 0.12);
  transform: translateY(-2px);
}

.bd-find-icon {
  font-size: 26px;
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  background: var(--primary-softer);
  border-radius: 12px;
  flex-shrink: 0;
}

.bd-find-text {
  display: flex;
  flex-direction: column;
  flex: 1;
}

.bd-find-text strong {
  color: var(--ink);
  font-size: 15px;
}

.bd-find-text small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.bd-find-arrow {
  color: var(--muted);
  font-weight: 800;
}

/* tip banner */
.bd-tip {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 24px;
  border-radius: 16px;
  background: var(--primary-soft);
  border: 1px solid #e6ddf8;
}

.bd-tip p {
  margin: 0;
  color: #4d4766;
  font-weight: 500;
}

.bd-tip .btn {
  flex-shrink: 0;
  padding: 11px 20px;
}

/* toast */
.bd-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--ink);
  color: white;
  padding: 14px 24px;
  border-radius: 14px;
  font-weight: 700;
  box-shadow: 0 18px 40px rgba(47, 62, 79, 0.3);
  opacity: 0;
  transition: 0.25s ease;
  z-index: 999;
}

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

.bd-toast.error {
  background: linear-gradient(135deg, #d1524f, #b23c3a);
}

/* responsive */
@media (max-width: 860px) {
  .bd-row-3,
  .bd-review-grid {
    grid-template-columns: 1fr;
  }
  .bd-row-3 .bd-card {
    aspect-ratio: auto;
  }
  .bd-review-body {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .bd-hero {
    grid-template-columns: 1fr;
  }
  .bd-cover-img,
  .bd-cover-fallback {
    height: 320px;
    max-width: 240px;
    margin: 0 auto;
  }
  .bd-cover-col {
    align-items: center;
  }
}

/* ==========================================================================
   Global responsive layout (sidebar collapses on small screens)
   ========================================================================== */
@media (max-width: 860px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px;
    padding: 14px 16px;
  }

  .sidebar h2 {
    width: 100%;
    margin: 0 0 8px;
  }

  .sidebar a {
    margin-bottom: 0;
    padding: 9px 13px;
    font-size: 14px;
  }

  .dashboard {
    padding: 24px 18px;
  }

  .bd-topbar {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .bd-hero {
    padding: 24px;
  }

  .bd-hero-info h1 {
    font-size: 32px;
  }

  .bd-tip {
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================================================
   Book Details — reference-exact sidebar, rating, icons
   ========================================================================== */

.bd-sidebar {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 22px 14px;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 19px;
  font-weight: 800;
  color: var(--ink);
  padding: 4px 8px 18px;
}

.sidebar-logo {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
}

.sidebar-logo svg { width: 20px; height: 20px; }

.sidebar a svg {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
}

.sidebar-back {
  font-size: 13px !important;
  color: var(--muted) !important;
  margin-bottom: 8px !important;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
}

.sidebar-bottom {
  margin-top: auto;
  padding-top: 14px;
  display: flex;
  flex-direction: column;
}

.sidebar-logout {
  color: #d1524f !important;
}

.sidebar-dna {
  margin-top: 16px;
  padding: 16px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--surface), var(--sage-light));
  border: 1px solid #e6ddf8;
}

.sidebar-dna-label {
  margin: 0;
  font-size: 12px;
  font-weight: 700;
  color: #6b6482;
}

.sidebar-dna h3 {
  margin: 6px 0 0;
  font-size: 30px;
  color: var(--primary-strong);
}

.sidebar-dna-sub {
  margin: 0 0 12px;
  font-size: 12px;
  color: var(--muted);
  font-weight: 600;
}

.sidebar-dna-bar {
  height: 7px;
  border-radius: 999px;
  background: #e0d6f2;
  overflow: hidden;
}

.sidebar-dna-bar > div {
  height: 100%;
  width: 25%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-strong));
}

.sidebar-dna-hint {
  margin: 10px 0 0;
  font-size: 11px;
  color: var(--muted);
  font-weight: 600;
}

/* rating block under cover */
.bd-rating-block {
  display: block;
  text-align: center;
}

.bd-rating-top {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.bd-stars {
  position: relative;
  display: inline-block;
  font-size: 18px;
  letter-spacing: 2px;
  color: #dcd7e6;
}

.bd-stars-fill {
  position: absolute;
  top: 0;
  left: 0;
  overflow: hidden;
  white-space: nowrap;
  color: var(--gold);
}

.bd-rating-top strong {
  font-size: 18px;
  color: var(--ink);
}

.bd-rating-count {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

/* author + why + shelf + eyebrow icons */
.bd-author {
  display: flex;
  align-items: center;
  gap: 7px;
}

.bd-author svg {
  width: 16px;
  height: 16px;
  color: var(--muted);
}

.bd-why h3 {
  display: flex;
  align-items: center;
  gap: 8px;
}

.bd-why h3 svg {
  width: 16px;
  height: 16px;
  color: var(--primary);
}

.bd-shelf-btn svg {
  width: 16px;
  height: 16px;
}

.eyebrow svg {
  width: 14px;
  height: 14px;
}

.bd-review-card .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

@media (max-width: 860px) {
  .bd-sidebar {
    min-height: auto;
  }
  .sidebar-bottom {
    margin-top: 0;
  }
  .sidebar-dna {
    display: none;
  }
}

/* ===============================
   BOOK DETAILS 2.0 DESIGN
================================ */

.book-details-dashboard {
  max-width: 960px;
  margin: 0 auto;
}

.book-details-hero {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 28px;
  padding: 28px;
  margin-bottom: 36px;
  background: #ffffff;
  border-radius: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  align-items: start;
}

.book-details-left {
  display: grid;
  gap: 16px;
  width: 180px;
}

.large-book-cover,
.detail-cover-area img,
.bd-cover-img {
  width: 180px;
  height: 265px;
  object-fit: cover;
  border-radius: 18px;
  box-shadow: 0 16px 32px rgba(36,19,49,0.2);
}

.fallback-large-cover,
.bd-cover-fallback {
  width: 180px;
  height: 265px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  font-size: 56px;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
}

.rating-summary-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: white;
  border: 1px solid var(--border);
}

.rating-stars {
  color: var(--gold);
  font-size: 16px;
  letter-spacing: 1px;
}

.rating-summary-card strong {
  font-size: 18px;
  color: var(--text);
}

.rating-summary-card p {
  margin: 0;
  font-size: 12px;
  color: #8e7b74;
  font-weight: 800;
}

.book-hub-pill,
.lexo-badge {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #f8d9e8, #f3c7dc);
  color: #a03b73;
  border: 1px solid rgba(160, 59, 115, 0.18);
  font-weight: 700;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.book-details-right h1 {
  font-family: Georgia, serif;
  font-size: 30px;
  line-height: 1.15;
  margin: 12px 0 6px;
  color: var(--text);
}

.detail-meta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 16px 0;
}

.detail-meta-row span {
  padding: 7px 13px;
  border-radius: 999px;
  background: rgba(193,84,125,0.12);
  color: #7a4a5e;
  font-weight: 800;
  font-size: 13px;
}

.recommendation-reason-box {
  padding: 18px 20px;
  border-radius: 16px;
  background: linear-gradient(135deg, rgba(248,231,236,0.9), rgba(255,255,255,0.9));
  border: 1px solid var(--border);
  margin: 18px 0;
}

.recommendation-reason-box h2 {
  margin: 0 0 8px;
  font-size: 16px;
}

.recommendation-reason-box p {
  margin: 0;
  color: #7a4a5e;
  font-weight: 600;
  font-size: 14px;
  line-height: 1.55;
}

.detail-status-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.status-btn-modern {
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: white;
  color: var(--text);
  font-weight: 800;
  font-size: 13px;
  box-shadow: 0 8px 20px rgba(36,19,49,0.06);
}

.status-btn-modern:hover,
.primary-status {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
}

.book-hub-grid-v2 {
  display: flex;
  flex-direction: column;
  gap: 36px;
  margin-bottom: 36px;
}

.book-hub-card-v2 {
  padding: 32px;
  border-radius: 24px;
  background: #ffffff;
  border: 1px solid var(--border);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.book-hub-card-v2 .eyebrow {
  margin-bottom: 6px;
}

.book-hub-card-v2 h2,
.review-card-v2 h2 {
  font-size: 22px;
  margin: 6px 0 24px;
}

/* keep form controls at a comfortable width instead of spanning the whole card */
.book-hub-card-v2 select,
.book-hub-card-v2 .progress-inputs {
  max-width: 520px;
}

.book-hub-card-v2 .btn {
  margin-top: 24px;
  min-width: 200px;
}

.book-hub-card-v2 select,
.book-hub-card-v2 input,
.review-card-v2 select,
.review-card-v2 input,
.review-card-v2 textarea {
  width: 100%;
  padding: 15px 16px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,0.9);
  color: var(--text);
  font-weight: 700;
}

.progress-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

#progressText {
  color: var(--primary);
  font-weight: 900;
}

.find-links-v2 {
  display: grid;
  gap: 14px;
}

.dna-progress-bar {
  margin-top: 22px;
}

#progressText {
  margin: 14px 0 0;
}

.find-link-card {
  display: grid;
  grid-template-columns: 44px 1fr auto;
  gap: 14px;
  align-items: center;
  padding: 18px;
  border-radius: 16px;
  background: white;
  border: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.find-link-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 24px rgba(47, 62, 79, 0.1);
}

.find-link-card span {
  font-size: 28px;
}

.find-link-card p {
  margin: 3px 0 0;
  color: #8e7b74;
  font-weight: 700;
  font-size: 13px;
}

.review-card-v2 {
  padding: 32px;
  margin-bottom: 36px;
  border-radius: 24px;
  background: #ffffff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.review-card-v2.is-locked .review-top-grid,
.review-card-v2.is-locked .review-write-grid,
.review-card-v2.is-locked .review-visibility,
.review-card-v2.is-locked .review-actions {
  opacity: 0.55;
  pointer-events: none;
}

.review-locked-message {
  margin: 0 0 18px;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 193, 7, 0.12);
  color: var(--text, #3d342c);
  font-size: 14px;
  font-weight: 600;
}

.review-top-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 28px;
  padding-bottom: 26px;
  border-bottom: 1px solid var(--border);
}

.star-rating-v2 {
  display: flex;
  gap: 8px;
}

.star-rating-v2 button {
  border: none;
  background: transparent;
  font-size: 30px;
  color: var(--star-empty);
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
}

.star-rating-v2 button:hover {
  color: var(--star-hover);
  transform: scale(1.12);
}

.small-muted {
  color: #8e7b74;
  font-weight: 700;
}

.review-write-grid {
  display: grid;
  grid-template-columns: 0.9fr 1.8fr;
  gap: 22px;
  margin-top: 24px;
}

.review-write-grid textarea {
  min-height: 120px;
  resize: vertical;
}

.review-save-btn {
  display: block;
  margin: 28px auto 0;
  min-width: 240px;
}

.book-tip-card {
  padding: 22px 30px;
  margin-bottom: 40px;
  background: linear-gradient(135deg, rgba(248,231,236,0.9), rgba(255,255,255,0.9));
  border-radius: 24px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
  font-weight: 900;
  color: var(--text);
}

@media (max-width: 1200px) {
  .book-details-hero,
  .book-hub-grid-v2,
  .review-top-grid,
  .review-write-grid {
    grid-template-columns: 1fr;
  }

  .detail-status-row {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* --- BOOK IMPORT (Add Book modal) --- */
#openImportBtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.import-overlay[hidden] {
  display: none;
}

.import-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 48px 20px;
  overflow-y: auto;
  background: rgba(55, 46, 41, 0.42);
  backdrop-filter: blur(4px);
}

body.import-open {
  overflow: hidden;
}

.import-modal {
  width: 100%;
  max-width: 640px;
  padding: 0;
  border-radius: 24px;
  background: var(--card);
  box-shadow: 0 24px 60px rgba(55, 46, 41, 0.28);
  overflow: hidden;
}

.import-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 28px 30px 20px;
}

.import-head h2 {
  font-size: 24px;
  color: var(--text);
}

.import-subtitle {
  margin-top: 6px;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}

.import-close {
  background: var(--primary-softer);
  color: var(--primary-strong);
  border-radius: 12px;
  padding: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.import-close:hover {
  background: var(--primary-soft);
}

.import-tabs {
  display: flex;
  gap: 8px;
  padding: 0 30px;
  border-bottom: 1px solid var(--border);
}

.import-tab {
  background: none;
  border: none;
  border-radius: 0;
  padding: 12px 4px;
  margin-right: 18px;
  color: var(--muted);
  font-weight: 700;
  border-bottom: 2px solid transparent;
}

.import-tab.active {
  color: var(--primary-strong);
  border-bottom-color: var(--primary);
}

.import-body {
  padding: 24px 30px;
  min-height: 200px;
}

.import-search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 18px;
}

.import-search-row input {
  flex: 1;
}

.import-results {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 320px;
  overflow-y: auto;
}

.import-hint {
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
  padding: 10px 2px;
}

.import-result {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  text-align: left;
  padding: 10px 12px;
  border-radius: 16px;
  background: var(--primary-softer);
  border: 1.5px solid transparent;
  transition: 0.15s ease;
}

.import-result:hover {
  background: var(--primary-soft);
}

.import-result.selected {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.import-result-cover {
  width: 44px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 6px 14px rgba(55, 46, 41, 0.18);
}

.import-result-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.import-result-fallback {
  width: 100%;
  height: 100%;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: #fff;
}

.import-result-info {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}

.import-result-title {
  font-weight: 700;
  color: var(--text);
}

.import-result-meta {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
}

.import-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.import-field label {
  font-weight: 700;
  font-size: 13px;
  color: var(--text);
}

.import-field input,
.import-field select {
  width: 100%;
}

.import-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 30px 20px;
  border: 2px dashed var(--border);
  border-radius: 18px;
  background: var(--primary-softer);
  cursor: pointer;
  text-align: center;
  transition: 0.15s ease;
}

.import-dropzone:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
}

.import-dropzone-title {
  font-weight: 700;
  color: var(--text);
}

#importUploadFields {
  margin-top: 20px;
}

.import-footer {
  padding: 20px 30px 26px;
  border-top: 1px solid var(--border);
  background: var(--cream);
}

.import-footer-fields {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 14px;
  margin-bottom: 18px;
}

.import-footer-fields .import-field {
  margin-bottom: 0;
}

.import-footer-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.import-message {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}

.import-message.error {
  color: var(--red);
}

.import-footer-actions .btn {
  flex-shrink: 0;
}

.library-toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: #fff;
  padding: 14px 22px;
  border-radius: 14px;
  font-weight: 700;
  box-shadow: 0 16px 34px rgba(55, 46, 41, 0.32);
  opacity: 0;
  transition: 0.25s ease;
  z-index: 1100;
}

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

.library-toast.error {
  background: var(--red);
}

.library-state {
  padding: 36px;
  text-align: center;
}

.library-state-message {
  color: var(--text-secondary);
  font-weight: 700;
}

.library-state-error h2 {
  font-family: Georgia, serif;
  margin-bottom: 10px;
}

.library-state-error .btn {
  margin-top: 18px;
}

.book-progress-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  font-weight: 700;
  margin-top: 6px;
}

.library-book-card .shared-book-info {
  flex: 1;
  min-width: 0;
}

.library-progress-section {
  margin: 12px 0 10px;
  padding: 12px 14px;
  border-radius: 14px;
  background: rgba(243, 237, 247, 0.55);
  border: 1px solid var(--border);
}

.library-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.library-progress-caption {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--text-secondary);
}

.library-progress-pct {
  font-size: 0.86rem;
  font-weight: 800;
  color: var(--text);
}

.library-progress-track {
  height: 10px;
  border-radius: 999px;
  background: var(--sage-light);
  overflow: hidden;
  margin-bottom: 10px;
}

.library-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-strong));
  transition: width 0.35s ease;
}

.library-progress-form {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  gap: 8px;
  align-items: end;
}

.library-progress-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.library-progress-field input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font: inherit;
}

.library-progress-save {
  align-self: end;
  white-space: nowrap;
}

.library-progress-error {
  grid-column: 1 / -1;
  margin: 0;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--red);
}

@media (max-width: 720px) {
  .library-progress-form {
    grid-template-columns: 1fr 1fr;
  }

  .library-progress-save {
    grid-column: 1 / -1;
    width: 100%;
  }
}

.discovery-toast.error {
  background: var(--red);
}

@media (max-width: 620px) {
  .import-footer-fields {
    grid-template-columns: 1fr;
  }

  .import-search-row {
    flex-direction: column;
  }
}

/* ---------------------------------------------------------- reviews + community */

.review-visibility {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 18px 0 4px;
  font-size: 0.95rem;
  color: var(--muted);
  cursor: pointer;
}

.review-visibility input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
  cursor: pointer;
}

.review-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  margin-top: 18px;
}

.community-book-reviews {
  max-width: 1000px;
  margin: 0 auto;
}

.community-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 8px;
}

.community-review {
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  background: var(--primary-softer);
}

.community-review-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.community-review-head strong {
  color: var(--text);
}

.community-stars {
  color: var(--primary);
  letter-spacing: 2px;
  white-space: nowrap;
}

.community-review-title {
  font-weight: 600;
  color: var(--text);
  margin: 4px 0;
}

.community-review-text {
  color: var(--text);
  margin: 4px 0;
  line-height: 1.55;
}

.community-review-date {
  display: block;
  margin-top: 8px;
  font-size: 0.82rem;
  color: var(--muted);
}

/* community feed page */

.community-feed {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 20px;
  margin-top: 8px;
}

.community-loading {
  color: var(--muted);
}

.community-card {
  display: flex;
  gap: 16px;
  padding: 18px;
  cursor: pointer;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.community-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.1);
}

.community-card-cover {
  flex: 0 0 64px;
  width: 64px;
  height: 92px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--primary-soft);
}

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

.community-card-fallback {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  color: var(--primary);
}

.community-card-body {
  flex: 1;
  min-width: 0;
}

.community-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.community-card-head h3 {
  margin: 0;
  font-size: 1.05rem;
  color: var(--text);
}

.community-card-head .book-author {
  margin: 2px 0 0;
  font-size: 0.88rem;
  color: var(--muted);
}

.community-card-foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 12px;
  font-size: 0.82rem;
  color: var(--muted);
}

/* ---------------------------------------------------------- challenges */

.progress-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.progress-card {
  padding: 24px;
  text-align: left;
}

.progress-card-icon {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  margin-bottom: 14px;
}

.progress-card-icon .icon {
  width: 22px;
  height: 22px;
}

.progress-card-value {
  font-size: 2rem;
  line-height: 1;
  color: var(--text);
}

.progress-card-label {
  margin: 6px 0 12px;
  font-weight: 600;
  color: var(--text);
}

.challenge-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  overflow: hidden;
}

.challenge-bar > div {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-strong));
  transition: width 0.4s ease;
}

.challenge-goal {
  margin-top: 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.goal-card {
  max-width: 1000px;
  margin: 0 auto 28px;
}

.goal-inputs {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 16px;
  margin-top: 8px;
}

.goal-inputs label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.goal-inputs input {
  width: 160px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  color: var(--text);
}

.achievements-section {
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
}

.achievements-grid,
.badge-grid-v2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 24px;
}

.achievement-card {
  min-height: 220px;
  padding: 24px;
  border-radius: 20px;
  overflow: visible;
}

.achievement-title,
.achievement-description {
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

.achievement-title {
  color: #1f2937;
  font-weight: 700;
}

.achievement-description {
  color: #4b5563;
}

.achievement-progress,
.badge-progress-label {
  color: #374151;
}

.achievement-card.locked,
.badge-v2.locked {
  opacity: 0.75;
}

.achievement-filter,
.badge-filters select.achievement-filter {
  appearance: none;
  -webkit-appearance: none;
  background: #ffffff;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  padding: 10px 14px;
  color: #1f2937;
  font-size: 0.88rem;
  font-weight: 500;
}

.badge-filters select {
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 12px;
  font-size: 0.88rem;
  color: #1f2937;
  background: #ffffff;
}

.achievements-title {
  margin-bottom: 8px;
}

.badge-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.badge {
  display: flex;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: var(--card);
}

.badge.locked {
  opacity: 0.75;
}

.badge-icon {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: var(--border);
  color: var(--muted);
}

.badge.earned .badge-icon {
  background: var(--primary-soft);
  color: var(--primary);
}

.badge-body strong {
  color: var(--text);
}

.badge-body p {
  margin: 4px 0 8px;
  font-size: 0.85rem;
  color: var(--muted);
}

.badge-status {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.badge.earned .badge-status {
  color: var(--primary);
}

.badge-status .icon-inline {
  width: 15px;
  height: 15px;
}

/* Badge system v2 — metadata-driven catalog + filters */
.badge-stats-bar {
  max-width: 1000px;
  margin: 0 auto 24px;
  padding: 20px 24px;
}

.badge-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  align-items: end;
}

.badge-stat strong {
  display: block;
  font-size: 1.75rem;
  line-height: 1;
  color: var(--text);
}

.badge-stat span {
  font-size: 0.85rem;
  color: var(--muted);
}

.badge-stat-wide {
  grid-column: span 1;
}

.badge-overall-bar {
  height: 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  overflow: hidden;
  margin-bottom: 6px;
}

.badge-overall-bar > div {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), var(--primary-strong));
  transition: width 0.5s ease;
}

.badge-rarity-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 16px;
}

.badge-stat-pill {
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
}

.rarity-common { --badge-accent: #6b7280; }
.rarity-rare { --badge-accent: #3b82f6; }
.rarity-epic { --badge-accent: #8b5cf6; }
.rarity-legendary { --badge-accent: #f59e0b; }

.badge-stat-pill.rarity-common { color: #6b7280; background: rgba(107, 114, 128, 0.1); }
.badge-stat-pill.rarity-rare { color: #2563eb; background: rgba(59, 130, 246, 0.12); }
.badge-stat-pill.rarity-epic { color: #7c3aed; background: rgba(139, 92, 246, 0.12); }
.badge-stat-pill.rarity-legendary { color: #d97706; background: rgba(245, 158, 11, 0.14); }

.newest-badges {
  max-width: 1000px;
  margin: 0 auto 24px;
  padding: 20px 24px;
}

.newest-badges-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.achievements-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.badge-completion {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--primary);
}

.badge-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
}

.badge-tabs {
  display: inline-flex;
  gap: 6px;
  padding: 4px;
  border-radius: 12px;
  background: var(--primary-soft);
}

.badge-tab {
  border: none;
  background: transparent;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.badge-tab.active {
  background: var(--card);
  color: var(--text);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

.badge-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.badge-filters select:not(.achievement-filter) {
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 0.88rem;
  color: var(--text);
  background: var(--card);
}

.badge-v2 {
  display: flex;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: var(--card);
  position: relative;
  overflow: visible;
  min-height: 220px;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.badge-body {
  flex: 1;
  min-width: 0;
}

.badge-body strong {
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

.badge-body > p {
  white-space: normal;
  word-break: normal;
  overflow-wrap: break-word;
}

.badge-v2::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--badge-accent, var(--border));
  opacity: 0.85;
}

.badge-v2.locked {
  opacity: 0.75;
}

.badge-v2.earned {
  opacity: 1;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.06);
}

.badge-v2.badge-pop {
  animation: badgeEarn 0.9s ease;
}

@keyframes badgeEarn {
  0% { transform: scale(0.96); box-shadow: 0 0 0 0 rgba(99, 102, 241, 0.4); }
  40% { transform: scale(1.02); box-shadow: 0 0 0 8px rgba(99, 102, 241, 0); }
  100% { transform: scale(1); }
}

.badge-v2-compact {
  padding: 14px;
}

.badge-icon-v2 {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: var(--border);
  color: var(--muted);
}

.badge-v2.earned .badge-icon-v2 {
  background: color-mix(in srgb, var(--badge-accent, var(--primary)) 18%, transparent);
  color: var(--badge-accent, var(--primary));
}

.badge-icon-v2 .icon {
  width: 24px;
  height: 24px;
}

.badge-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 4px;
}

.badge-rarity {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--badge-accent, var(--muted));
}

.badge-category {
  font-size: 0.85rem;
}

.badge-progress {
  height: 6px;
  border-radius: 999px;
  background: var(--primary-soft);
  overflow: hidden;
  margin: 8px 0 4px;
}

.badge-progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--badge-accent, var(--primary)), var(--primary-strong));
  transition: width 0.4s ease;
}

.badge-progress-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
}

.badge-unlock {
  display: inline-block;
  margin-top: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--badge-accent, var(--primary));
}

.badge-empty {
  text-align: center;
  color: var(--muted);
  padding: 24px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}

@media (max-width: 900px) {
  .achievements-grid,
  .badge-grid-v2 {
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  }
}

@media (max-width: 720px) {
  .badge-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .badge-stat-wide {
    grid-column: span 2;
  }
}

/* ---------------------------------------------------- reading paths (v5) */

.path-icon {
  color: #fff;
}

.path-icon-emoji {
  color: var(--readable-heading, var(--navy)) !important;
}

.path-icon .icon {
  width: 32px;
  height: 32px;
}

.path-book-cover {
  color: #fff;
}

.path-book-cover .icon {
  width: 30px;
  height: 30px;
}

.path-step .icon-inline {
  width: 18px;
  height: 18px;
}

.path-milestones {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 20px;
}

.milestone {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  border-radius: 999px;
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid var(--border);
}

.milestone.reached {
  color: #fff;
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  border-color: transparent;
}

.milestone .icon-inline {
  width: 15px;
  height: 15px;
}

.path-book.done {
  background: var(--primary-soft, rgba(183, 154, 200, 0.22));
  border-color: transparent;
}

.path-book.done .path-step {
  background: linear-gradient(135deg, #3f9b7a, #2f8b6a);
}

.path-book.done .path-book-info h3 {
  text-decoration: line-through;
  text-decoration-color: rgba(109, 82, 111, 0.5);
}

.path-book-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 8px;
}

.btn-sm {
  padding: 8px 14px;
  font-size: 0.85rem;
}

.path-book-remove {
  border: none;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: 4px;
  border-radius: 8px;
  display: inline-grid;
  place-items: center;
}

.path-book-remove:hover {
  color: var(--primary);
  background: rgba(0, 0, 0, 0.04);
}

.path-book-remove .icon-inline {
  width: 16px;
  height: 16px;
}

.path-add {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin: 22px 0 16px;
}

.path-add input {
  flex: 1;
  min-width: 160px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 0.95rem;
  color: var(--text);
  background: #fff;
}

.path-add .btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}

.path-add .icon-inline {
  width: 16px;
  height: 16px;
}

.complete-next-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 6px;
}

.complete-next-btn:disabled {
  opacity: 0.7;
  cursor: default;
}

/* Reading Path completion */
.path-stats-bar {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 28px;
}

.path-stat {
  padding: 18px 16px;
  border-radius: 16px;
  background: var(--white);
  border: 1px solid var(--border-neutral, var(--border));
  text-align: center;
}

.path-stat strong {
  display: block;
  font-size: 1.35rem;
  color: var(--navy);
  margin-bottom: 4px;
}

.path-stat span {
  font-size: 0.82rem;
  color: var(--muted);
}

.paths-section {
  margin-bottom: 36px;
}

.paths-section-title {
  font-size: 1.25rem;
  margin: 0 0 18px;
  color: var(--navy);
}

.path-unlock-banner {
  margin-bottom: 24px;
  padding: 16px 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.15), rgba(183, 154, 200, 0.12));
  border: 1px solid rgba(212, 175, 55, 0.35);
  color: var(--charcoal);
}

.path-complete-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  margin-top: 18px;
  padding: 16px 24px;
  font-size: 1.05rem;
  font-weight: 700;
  border: none;
  border-radius: 12px;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
}

.path-complete-btn-ready,
.complete-path-button {
  background: #1f313a;
  color: #ffffff;
  border: none;
  box-shadow: 0 8px 24px rgba(31, 49, 58, 0.28);
  -webkit-text-fill-color: #ffffff;
}

.path-complete-btn-ready:hover,
.complete-path-button:hover {
  background: #2a4552;
  color: #ffffff;
  -webkit-text-fill-color: #ffffff;
}

.path-complete-btn-ready svg,
.path-complete-btn-ready .icon,
.complete-path-button svg,
.complete-path-button .icon {
  color: #ffffff;
  stroke: #ffffff;
}

.path-complete-btn-disabled:disabled {
  background: rgba(47, 62, 79, 0.08);
  color: var(--muted);
  border: 1px solid var(--border-neutral, var(--border));
  opacity: 1;
  cursor: not-allowed;
  box-shadow: none;
  -webkit-text-fill-color: currentColor;
}

.path-complete-hint {
  margin: 14px 0 0;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

.path-icon-emoji {
  font-size: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--off-white) !important;
}

.path-completed-ribbon {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  margin-bottom: 16px;
  border-radius: 999px;
  background: linear-gradient(135deg, #c9a227, #e8c547);
  color: #2a2520;
  font-weight: 700;
  font-size: 0.9rem;
}

.path-card-completed {
  position: relative;
  border: 1px solid rgba(212, 175, 55, 0.35);
  background: linear-gradient(180deg, rgba(212, 175, 55, 0.06) 0%, var(--white) 120px);
}

.path-icon-completed {
  background: linear-gradient(135deg, #c9a227, #e8c547) !important;
  color: #2a2520 !important;
}

.path-completed-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
  gap: 12px;
  margin: 20px 0;
}

.path-completed-stat {
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--off-white, rgba(0, 0, 0, 0.03));
  border: 1px solid var(--border-neutral, var(--border));
}

.path-completed-stat span {
  display: block;
  font-size: 0.75rem;
  color: var(--muted);
  margin-bottom: 4px;
}

.path-completed-stat strong {
  font-size: 0.95rem;
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.path-completed-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 8px;
}

.path-card-highlight {
  box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.45);
}

.path-review-panel {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-neutral, var(--border));
}

.path-review-title {
  font-size: 1rem;
  margin: 0 0 12px;
  color: var(--navy);
}

.path-timeline-readonly .path-book {
  grid-template-columns: 44px 1fr;
}

.path-card-completed.path-review-expanded .path-review-panel {
  display: block;
}

.path-completion-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 24px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.path-completion-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.path-completion-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(20, 18, 16, 0.55);
}

.path-completion-dialog {
  position: relative;
  z-index: 1;
  width: min(520px, 100%);
  max-height: 90vh;
  overflow-y: auto;
  padding: 32px 28px;
  border-radius: 20px;
  background: var(--white);
  text-align: center;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.2);
  animation: pathCompletionPop 0.45s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes pathCompletionPop {
  from {
    transform: scale(0.88) translateY(12px);
    opacity: 0;
  }
  to {
    transform: scale(1) translateY(0);
    opacity: 1;
  }
}

.path-completion-icon {
  font-size: 3rem;
  margin-bottom: 8px;
  animation: pathCompletionBounce 0.6s ease 0.15s both;
}

@keyframes pathCompletionBounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-10px); }
  70% { transform: translateY(4px); }
}

.path-completion-sub {
  color: var(--muted);
  margin: 0 0 8px;
}

.path-completion-path-name {
  font-weight: 600;
  color: var(--navy);
  margin-bottom: 20px;
}

.path-completion-rewards {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-bottom: 20px;
}

.path-reward-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: var(--off-white, rgba(0, 0, 0, 0.04));
  font-size: 0.88rem;
  font-weight: 600;
}

.path-completion-share {
  text-align: left;
  padding: 18px;
  margin-bottom: 20px;
  border: 1px solid rgba(212, 175, 55, 0.35);
  background: linear-gradient(135deg, rgba(212, 175, 55, 0.08), transparent);
}

.path-completion-share-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
  padding: 10px 14px;
  border-radius: 12px;
  background: linear-gradient(135deg, #c9a227, #e8c547);
  color: #2a2520;
  font-weight: 700;
}

.path-completion-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
}

/* ── Reading Journey — passport, secrets, celebration ── */
.paths-section-sub {
  color: var(--muted);
  margin: -8px 0 20px;
  font-size: 0.95rem;
}

.path-books-progress {
  text-align: center;
  margin: 16px 0 8px;
  font-size: 1.05rem;
  color: var(--muted);
}

.path-books-progress strong {
  color: var(--navy);
  font-size: 1.2rem;
}

.path-books-progress-done strong {
  color: #9a7b1a;
}

.path-journey-footer {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--border-neutral, var(--border));
}

.passport-stats-bar {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 28px;
}

.passport-stat {
  padding: 16px 12px;
  border-radius: 14px;
  background: var(--white);
  border: 1px solid var(--border-neutral, var(--border));
  text-align: center;
}

.passport-stat span {
  display: block;
  font-size: 1.25rem;
  margin-bottom: 4px;
}

.passport-stat strong {
  display: block;
  font-size: 1.35rem;
  color: var(--navy);
}

.passport-stat small {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 4px;
}

.passport-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 20px;
}

.passport-stamp {
  position: relative;
  padding: 24px 20px 20px;
  border: 2px dashed rgba(201, 162, 39, 0.45);
  background: linear-gradient(165deg, rgba(255, 252, 240, 0.95) 0%, var(--white) 100%);
  text-align: center;
  transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.passport-stamp:hover {
  transform: translateY(-4px);
  box-shadow: 0 16px 40px rgba(201, 162, 39, 0.15);
}

.passport-stamp-perforation {
  position: absolute;
  top: 10px;
  left: 12px;
  right: 12px;
  height: 6px;
  background: radial-gradient(circle, var(--border) 2px, transparent 2px) repeat-x;
  background-size: 10px 6px;
  opacity: 0.5;
}

.passport-stamp-icon {
  font-size: 2.5rem;
  margin: 12px 0 8px;
}

.passport-stamp h3 {
  margin: 0 0 6px;
  font-size: 1.1rem;
  color: var(--navy);
}

.passport-stamp-status {
  font-size: 0.82rem;
  color: var(--muted);
  margin: 0 0 14px;
}

.passport-stamp-meta {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--charcoal);
  margin-bottom: 14px;
}

.passport-stamp-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 999px;
  background: linear-gradient(135deg, #c9a227, #e8c547);
  color: #2a2520;
  font-weight: 700;
  font-size: 0.85rem;
  margin-bottom: 12px;
}

.passport-stamp-review {
  font-size: 0.85rem;
  color: var(--muted);
  margin: 0 0 12px;
}

.secret-paths-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
}

.secret-path-card {
  padding: 20px;
  text-align: center;
  min-height: 220px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.secret-path-unlocked {
  border: 1px solid rgba(201, 162, 39, 0.35);
  background: linear-gradient(180deg, rgba(201, 162, 39, 0.08), var(--white));
}

.secret-path-locked {
  opacity: 0.72;
  background: var(--off-white, #f8f6f3);
  filter: grayscale(0.4);
}

.secret-path-icon {
  font-size: 2rem;
}

.secret-path-icon-muted {
  opacity: 0.35;
}

.secret-path-lock {
  color: var(--muted);
  margin-bottom: 4px;
}

.secret-path-tier {
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #9a7b1a;
}

.secret-unlock-hint {
  font-size: 0.82rem;
  color: var(--muted);
}

.rated-paths-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
}

.rated-path-card {
  padding: 20px;
}

.rated-path-score {
  color: #9a7b1a;
  font-weight: 600;
  margin: 8px 0;
}

.rated-path-quote {
  font-style: italic;
  color: var(--muted);
  font-size: 0.9rem;
}

.rated-path-tag {
  display: inline-block;
  margin-top: 8px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--off-white);
  font-size: 0.75rem;
  font-weight: 600;
}

/* Fullscreen journey celebration */
body.journey-modal-open {
  overflow: hidden;
}

.journey-modal {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(160deg, #1a1814 0%, #2a2520 40%, #1f1c18 100%);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.5s ease;
  overflow-y: auto;
  padding: 32px 20px;
}

.journey-modal.is-open {
  opacity: 1;
  pointer-events: auto;
}

.journey-confetti-canvas {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 2001;
}

.journey-modal-inner {
  position: relative;
  z-index: 2002;
  width: min(560px, 100%);
  text-align: center;
  color: #fff;
  animation: journeyReveal 0.7s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes journeyReveal {
  from { opacity: 0; transform: translateY(24px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.journey-modal-hero {
  margin-bottom: 28px;
}

.journey-modal-trophy {
  font-size: 3.5rem;
  margin-bottom: 12px;
  animation: journeyTrophyGlow 2s ease-in-out infinite alternate;
  filter: drop-shadow(0 0 20px rgba(232, 197, 71, 0.6));
}

@keyframes journeyTrophyGlow {
  from { transform: scale(1); filter: drop-shadow(0 0 16px rgba(232, 197, 71, 0.4)); }
  to { transform: scale(1.06); filter: drop-shadow(0 0 28px rgba(232, 197, 71, 0.75)); }
}

.journey-modal-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.55);
  margin: 0 0 8px;
}

.journey-modal-title {
  font-size: clamp(1.75rem, 5vw, 2.25rem);
  margin: 0 0 8px;
  color: #fff;
  font-weight: 700;
}

.journey-modal-congrats {
  color: rgba(255, 255, 255, 0.7);
  margin: 0;
}

.journey-modal-stats {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
  margin-bottom: 28px;
  padding: 20px 0;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.journey-stat {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.journey-stat span {
  font-size: 1.25rem;
}

.journey-stat strong {
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.9);
}

.journey-modal-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.5);
  margin: 0 0 10px;
}

.journey-modal-badge-wrap {
  margin-bottom: 20px;
}

.journey-modal-badge {
  display: inline-block;
  padding: 14px 28px;
  border-radius: 16px;
  background: linear-gradient(135deg, #c9a227, #f0d060);
  color: #2a2520;
  font-weight: 800;
  font-size: 1.05rem;
  box-shadow: 0 0 40px rgba(201, 162, 39, 0.45), 0 8px 24px rgba(0, 0, 0, 0.3);
  animation: badgePulse 2.5s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 30px rgba(201, 162, 39, 0.35), 0 8px 24px rgba(0, 0, 0, 0.3); }
  50% { box-shadow: 0 0 50px rgba(232, 197, 71, 0.55), 0 8px 32px rgba(0, 0, 0, 0.35); }
}

.journey-modal-rewards {
  display: flex;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.journey-reward {
  padding: 8px 14px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 0.88rem;
  font-weight: 600;
}

.journey-modal-reflection {
  text-align: left;
  margin-bottom: 20px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  color: rgba(255, 255, 255, 0.88);
}

/* Review form — light premium card inside celebration modal */
.journey-review.card {
  text-align: left;
  margin-bottom: 20px;
  padding: 24px;
  background: #ffffff;
  border: 1px solid #e5e7eb;
  border-top: 3px solid #f9a8d4;
  border-radius: 16px;
  box-shadow: 0 8px 32px rgba(15, 23, 42, 0.08);
  color: #374151;
}

.journey-review-heading {
  margin: 0 0 16px;
  font-size: 1.05rem;
  font-weight: 700;
  color: #1f2937;
  letter-spacing: -0.01em;
  text-transform: none;
  background: none;
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.journey-star-rating {
  display: flex;
  gap: 8px;
  margin-bottom: 20px;
}

.journey-star-rating button {
  border: none;
  background: none;
  font-size: 30px;
  line-height: 1;
  color: #cbd5e1;
  cursor: pointer;
  transition: color 0.2s ease, transform 0.2s ease;
  padding: 2px;
}

.journey-star-rating button:hover,
.journey-star-rating button.hover-preview {
  color: #fbbf24;
  transform: scale(1.12);
}

.journey-star-rating button.active {
  color: #f59e0b;
  transform: scale(1.05);
}

.journey-star-rating button.active:hover {
  color: #f59e0b;
}

.journey-review-label {
  display: block;
  font-size: 0.9375rem;
  font-weight: 700;
  margin: 0 0 8px;
  color: #1f2937;
}

.journey-review-checkbox {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 16px 0 20px;
  font-size: 0.9375rem;
  font-weight: 600;
  color: #374151;
  cursor: pointer;
}

.journey-review-checkbox input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: #e879b9;
  cursor: pointer;
}

.journey-review-input,
.journey-review textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #1f2937;
  font-family: inherit;
  font-size: 0.9375rem;
  line-height: 1.55;
  resize: vertical;
  min-height: 88px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  box-sizing: border-box;
}

.journey-review-input::placeholder,
.journey-review textarea::placeholder {
  color: #6b7280;
  opacity: 1;
}

.journey-review-input:focus,
.journey-review textarea:focus {
  outline: none;
  border-color: #e879b9;
  box-shadow: 0 0 0 3px rgba(232, 121, 185, 0.28);
}

.journey-review-submit {
  width: 100%;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 1rem;
  font-weight: 700;
  background: var(--forest);
  color: #ffffff;
  border: none;
  box-shadow: 0 6px 20px rgba(47, 74, 58, 0.22);
  transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.journey-review-submit:hover {
  background: var(--forest-hover);
  color: #ffffff;
  transform: translateY(-1px);
  box-shadow: 0 8px 24px rgba(47, 74, 58, 0.3);
}

html.theme-dark .journey-review.card {
  background: #ffffff;
  color: #374151;
  border-color: #e5e7eb;
}

html.theme-dark .journey-review-heading,
html.theme-dark .journey-review-label {
  color: #1f2937;
}

html.theme-dark .journey-review-checkbox {
  color: #374151;
}

html.theme-dark .journey-review-input,
html.theme-dark .journey-review textarea {
  background: #ffffff;
  color: #1f2937;
  border-color: #d1d5db;
}

html.theme-dark .journey-review-submit {
  background: var(--forest);
  color: #ffffff;
}


.journey-reflection-text p {
  margin: 0 0 12px;
  line-height: 1.65;
  font-size: 0.95rem;
}

.journey-reflection-loading {
  color: rgba(255, 255, 255, 0.5);
  font-style: italic;
}

.journey-next-suggestion {
  margin: 12px 0 0;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.9rem;
  color: #e8c547;
}

.journey-continue-btn {
  width: 100%;
  padding: 16px 24px;
  font-size: 1.05rem;
  font-weight: 700;
  margin-top: 8px;
  background: #1f313a;
  color: #ffffff;
  border: none;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(31, 49, 58, 0.28);
  -webkit-text-fill-color: #ffffff;
}

.journey-continue-btn:hover {
  background: #2a4552;
  color: #ffffff;
}

/* Profile journey collection */
.journey-collection {
  margin-top: 28px;
  padding: 28px;
}

.journey-collection-sub {
  color: var(--muted);
  margin: -8px 0 20px;
}

.journey-collection-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.journey-stat-pill {
  padding: 12px 18px;
  border-radius: 12px;
  background: var(--off-white);
  border: 1px solid var(--border-neutral, var(--border));
  font-size: 0.9rem;
}

.journey-stat-pill strong {
  color: var(--navy);
  font-size: 1.15rem;
  margin-right: 4px;
}

.journey-collection-highlight {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.journey-highlight-card {
  padding: 18px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(201, 162, 39, 0.08), transparent);
  border: 1px solid rgba(201, 162, 39, 0.25);
}

.journey-highlight-card h3 {
  margin: 6px 0 0;
  font-size: 1.1rem;
}

.journey-stamp-preview h3 {
  font-size: 1.25rem;
}

@media (max-width: 900px) {
  .passport-stats-bar {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
  .journey-collection-highlight {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .path-book {
    grid-template-columns: 44px 1fr;
  }

  .path-book-cover {
    display: none;
  }

  .path-book-actions {
    grid-column: 1 / -1;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

/* ==========================================================================
   Editorial accent system — green is accent-only
   ========================================================================== */

.app-layout {
  background: var(--ivory);
}

.eyebrow {
  color: var(--readable-secondary, var(--muted));
  font-weight: 600;
  letter-spacing: 0.1em;
  opacity: 1;
}

.section-title a {
  color: var(--navy);
  font-weight: 600;
}

.section-title a:hover {
  opacity: 0.75;
}

.mood-card {
  background: var(--white);
  border: 1px solid var(--border-neutral);
}

.mood-options button,
.goal-options button {
  border: 1.5px solid var(--border-neutral);
  background: var(--white);
  color: var(--charcoal);
  border-radius: 14px;
  padding: 14px 16px;
  font-weight: 500;
  transition: all var(--transition-fast);
}

.mood-options button:hover,
.goal-options button:hover,
.active-mood {
  background: var(--lavender) !important;
  border-color: #D8D2E6 !important;
  color: var(--navy) !important;
  transform: translateY(-2px);
}

/* Progress bars — green accent only */
.library-progress-fill,
.bd-progress-fill,
#progressFill,
.path-progress div,
#dnaProgressFill,
.challenge-bar > div {
  background: linear-gradient(90deg, var(--forest), var(--progress-green)) !important;
  border-radius: 999px;
  transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.library-progress-track,
.bd-progress-track,
.progress-bar,
.path-progress,
.dna-progress-bar,
.challenge-bar {
  background: rgba(47, 62, 79, 0.08) !important;
  border-radius: 999px;
}

/* Community — soft coral */
.dashboard:has(.community-feed) .dashboard-header {
  margin-bottom: 28px;
}

.community-card {
  background: var(--white);
  border: 1px solid #EDD5CC;
}

.community-card-cover {
  background: var(--coral);
}

.community-card .eyebrow,
.community-stars {
  color: #9A6B5E;
}

/* AI Companion — muted lavender */
.chat-shell {
  background: var(--lavender);
  border: 1px solid #D8D2E6;
}

.companion-hero,
.companion-book-card,
.companion-answer {
  background: var(--white);
  border: 1px solid #D8D2E6;
}

.dashboard:has(.chat-shell) .prompt-chips button:hover {
  background: var(--lavender);
  border-color: #D8D2E6;
}

/* Challenges — soft sage */
.goal-card,
.progress-cards .card,
.achievements-section .badge-grid .card {
  background: var(--sage-section);
  border: 1px solid #D5E0D6;
}

.challenge-goal {
  background: var(--white);
}

/* Library — continue reading sky blue */
.library-tabs.card {
  background: var(--sky);
  border: 1px solid #C5D9EC;
}

.library-summary-grid .stats-card:first-child {
  background: var(--sky);
  border: 1px solid #C5D9EC;
}

.library-summary-grid .stats-card:nth-child(2) {
  background: var(--lavender);
  border: 1px solid #D8D2E6;
}

.library-summary-grid .stats-card:nth-child(3) {
  background: var(--butter);
  border: 1px solid #EDE4C8;
}

.library-summary-grid .stats-card:nth-child(4) {
  background: var(--ivory);
  border: 1px solid var(--border-neutral);
}

/* Neutral UI chrome */
.mini-btn {
  background: var(--white);
  color: var(--navy);
  border: 1.5px solid var(--border-neutral);
}

.mini-btn:hover {
  background: var(--ivory);
  border-color: var(--navy);
}

.book-meta span {
  background: var(--ivory);
  color: var(--navy);
}

.milestone.reached {
  color: #fff;
  background: var(--navy);
  border-color: transparent;
}

.path-book.done {
  background: var(--sky);
}

.path-book.done .path-step {
  background: var(--forest);
}

.fallback-cover,
.bd-cover-fallback,
.recommendation-cover.fallback-cover {
  background: linear-gradient(145deg, var(--ivory), var(--beige));
  color: var(--navy);
}

.fallback-cover::before,
.recommendation-cover.fallback-cover::before,
.bd-cover-fallback::before {
  content: "";
  width: 40px;
  height: 40px;
  background: var(--navy);
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5'%3E%3Cpath d='M12 7v14'/%3E%3Cpath d='M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='1.5'%3E%3Cpath d='M12 7v14'/%3E%3Cpath d='M3 18a1 1 0 0 1-1-1V4a1 1 0 0 1 1-1h5a4 4 0 0 1 4 4 4 4 0 0 1 4-4h5a1 1 0 0 1 1 1v13a1 1 0 0 1-1 1h-6a3 3 0 0 0-3 3 3 3 0 0 0-3-3z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.bd-cover-fallback::before {
  width: 48px;
  height: 48px;
}

@keyframes cardFadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.recommendation-grid {
  gap: 28px;
}

.book-card-ui,
.recommendation-grid .card {
  animation: cardFadeUp 0.5s ease backwards;
}

.mystery-cover { background: linear-gradient(135deg, var(--navy), #3D4F63); }
.romance-cover { background: linear-gradient(135deg, var(--coral), #E8C4B8); }
.fantasy-cover { background: linear-gradient(135deg, var(--lavender), var(--sky)); }
.scifi-cover { background: linear-gradient(135deg, var(--navy), #4A6278); }
.horror-cover { background: linear-gradient(135deg, #1E2830, var(--navy)); }

.profile-avatar,
.settings-avatar {
  background: linear-gradient(135deg, var(--beige), var(--butter));
}

.community-card:hover,
.path-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
}

.discovery-shelf-btn.active-shelf,
.bd-shelf-btn.active {
  background: var(--forest);
  color: #fff;
  border-color: var(--forest);
}

.star-rating-v2 button.active,
.bd-star.active {
  color: var(--star-active);
}

input:focus,
textarea:focus,
select:focus,
.bd-select:focus,
.bd-input:focus {
  border-color: var(--accent) !important;
  box-shadow: 0 0 0 3px var(--focus-ring) !important;
}

.discovery-search-status-success { color: var(--success); }
.discovery-search-status-error { color: var(--red); }

.library-toast,
#pathsToast {
  background: var(--navy);
  color: #fff;
  border-radius: 12px;
}

.library-toast.error,
#pathsToast.error {
  background: var(--red);
}

.settings-nav-link:hover,
.settings-nav-link.active {
  background: var(--beige);
  color: var(--navy);
}

@media (max-width: 900px) {
  .app-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    margin: 0;
    border-radius: 0;
    height: auto;
    position: relative;
    box-shadow: none;
    border-bottom: 1px solid var(--border-neutral);
  }

  .dashboard {
    padding: 28px 20px;
  }

  .shared-book-card {
    grid-template-columns: 1fr;
  }

  .shared-book-cover {
    width: 100%;
    max-width: 180px;
    height: 260px;
    margin: 0 auto;
  }
}

/* Loading skeletons */
@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, #ece5dc 25%, #f7f2ea 50%, #ece5dc 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: 10px;
}

.skeleton-card {
  pointer-events: none;
}

.skeleton-cover {
  width: 100%;
  aspect-ratio: 2 / 3;
  min-height: 160px;
  border-radius: 12px;
}

.skeleton-line {
  height: 14px;
  margin-bottom: 10px;
}

.skeleton-line-lg {
  height: 20px;
  width: 75%;
}

.skeleton-line-sm {
  width: 45%;
}

.community-skeleton-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.library-skeleton-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}
