/* =========================================================
   1. THEME TOKENS
   ========================================================= */

:root {
  --brand-bg: #faf7ed;
  --brand-dark: #596e5e;
  --brand-text: #262b26;
  --brand-muted: #6f746b;
  --brand-accent: #adb58f;
  --brand-surface: #ffffff;
  --divider-subtle: #dde2d5;
  --border-soft: rgba(89,110,94,0.25);
  --shadow-soft: 0 10px 28px rgba(63, 62, 55, 0.08);
}


/* =========================================================
   2. BASE PAGE / APP HEADER
   ========================================================= */

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--brand-bg);
  color: var(--brand-text);
  font-family: "DM Sans", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  font-weight: 300;
}

a {
  color: inherit;
}

.logo-title {
  font-family: "Circular Pro", system-ui, sans-serif;
  font-weight: 700;
  font-size: 34px;
  line-height: 1;
  color: var(--brand-dark);
}

.logo-text-block {
  display: flex;
  flex-direction: column;
}

.book-shell {
  max-width: 90rem;
  margin: 0 auto;
  padding: 24px 24px 56px;
}

@media (max-width: 820px) {
  .app-header-inner {
    flex-direction: column;
    align-items: flex-start;
    padding: 14px 0;
  }

  .app-nav {
    flex-wrap: wrap;
    gap: 14px;
  }

  .logo-title {
    font-size: 28px;
  }
}

@media (max-width: 640px) {
  .book-shell {
    padding: 22px 16px 40px;
  }
}


/* =========================================================
   3. BOOK LIST INTRO / VIDEO LINKS
   ========================================================= */

.book-intro-section {
  margin-bottom: 28px;
}

.book-intro-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 18px;
}

.book-intro-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--brand-dark);
  cursor: pointer;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 0;
}

.book-intro-section.is-collapsed .book-intro-details {
  display: none;
}

.av-intro-flex {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 360px);
  gap: 42px;
  align-items: start;
}

.av-intro-paragraphs {
  max-width: 820px;
}

.av-intro-text {
  margin: 0;
}

.av-inline-link {
  color: var(--brand-dark);
  text-decoration: underline;
  text-underline-offset: 2px;
  font-weight: 500;
}

.affiliate-disclaimer {
  margin: 18px 0 0;
  font-size: 13px;
  line-height: 1.45;
  color: #5f6b7a;
}

.av-intro-side {
  display: flex;
  justify-content: flex-end;
}

.av-video-inline {
  width: 100%;
  border: 1px solid var(--divider-subtle);
  border-radius: 12px;
  padding: 18px 22px;
  background: rgba(255,255,255,0.28);
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.av-video-row {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--brand-text);
  font-size: 16px;
}

.av-video-row--primary {
  font-weight: 600;
}

.av-play-icon {
  width: 28px;
  height: 28px;
  flex: 0 0 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.av-play-icon img {
  width: 100%;
  height: 100%;
  display: block;
}

@media (max-width: 900px) {
  .av-intro-flex {
    grid-template-columns: 1fr;
    gap: 22px;
  }

  .av-intro-side {
    justify-content: flex-start;
    width: 100%;
  }

  .av-video-inline {
    width: 100%;
    max-width: 420px;
    margin-left: 0;
    margin-right: auto;
  }
}


/* =========================================================
   4. FILTER PANEL
   ========================================================= */

.book-working-top-anchor {
  scroll-margin-top: 110px;
}

.book-controls {
  margin: 22px 0 24px;
  border: 1px solid var(--divider-subtle);
  border-radius: 8px;
  background: rgba(255,255,255,0.48);
  overflow: hidden;
}

.book-controls-header {
  min-height: 38px;
  padding: 10px 14px;
  border-bottom: 1px solid var(--divider-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
}

.book-controls-header h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--brand-text);
}

.book-controls-toggle,
.clear-filters-link,
.book-member-mode-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--brand-muted);
  cursor: pointer;
  font: inherit;
  font-size: 13px;
  font-weight: 400;
  padding: 0;
}

.book-controls-toggle {
  pointer-events: none;
}

.clear-filters-link:hover,
.book-member-mode-toggle:hover {
  color: var(--brand-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.book-controls.is-collapsed .book-controls-body,
.book-controls.is-collapsed .book-member-toolbar {
  display: none;
}

.book-controls-body {
  display: grid;
  grid-template-columns:
    minmax(140px, 0.85fr)
    minmax(190px, 1.25fr)
    minmax(190px, 1.25fr)
    minmax(190px, 1.25fr)
    minmax(190px, 1.25fr);
  gap: 18px 20px;
  align-items: end;
  padding: 24px 28px 26px;
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.control-group label {
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 600;
}

.control-view {
  grid-column: 1;
}

.control-search {
  grid-column: 1 / -1;
}


/* =========================================================
   5. FILTER INPUTS / SELECTS / CLEAR BUTTONS
   ========================================================= */

.book-base-toggle {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.book-base-button {
  appearance: none;
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  background: #fff;
  color: var(--brand-dark);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  padding: 9px 13px;
  white-space: nowrap;
}

.book-base-button.is-active {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
  color: #fff;
}

.select-row {
  position: relative;
}

.control-group select,
.control-group input,
.book-mini-select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--divider-subtle);
  border-radius: 8px;
  background: #fff;
  padding: 8px 42px 8px 13px;
  font: inherit;
  font-size: 14px;
  color: var(--brand-text);
}

.control-group select,
.book-mini-select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, #9aa097 50%),
    linear-gradient(135deg, #9aa097 50%, transparent 50%);
  background-position:
    calc(100% - 18px) 17px,
    calc(100% - 12px) 17px;
  background-size: 6px 6px, 6px 6px;
  background-repeat: no-repeat;
}

.clear-select {
  position: absolute;
  right: 29px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--brand-muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  z-index: 2;
  opacity: 0.7;
}

.clear-select:hover {
  color: var(--brand-dark);
  opacity: 1;
}

.book-search-row {
  display: grid;
  grid-template-columns:
    minmax(140px, 0.85fr)
    minmax(190px, 1.25fr)
    minmax(190px, 1.25fr)
    minmax(190px, 1.25fr)
    minmax(190px, 1.25fr);
  gap: 12px 20px;
  align-items: end;
}

.mini-filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}

.mini-filter-group label {
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 600;
}

.mini-filter-search {
  grid-column: 1 / 3;
}

.mini-filter-planning {
  grid-column: 3;
}

.mini-filter-students {
  grid-column: 4;
}

.clear-filters-link {
  grid-column: 5;
  justify-self: end;
  align-self: center;
}

.member-tool-only {
  display: none;
}

body.member-tools-enabled .member-tool-only {
  display: block;
}


/* =========================================================
   6. MEMBER TOOLS TOOLBAR
   ========================================================= */

.book-member-toolbar {
  border-top: 1px solid var(--divider-subtle);
  padding: 10px 28px;
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 22px;
}

.book-member-toolbar-body {
  display: none;
  align-items: center;
  gap: 20px;
  flex: 1;
  flex-wrap: wrap;
}

body.member-tools-enabled .book-member-toolbar-body {
  display: flex;
}

.book-member-toolbar-spacer {
  flex: 1;
}

.book-member-mode-toggle,
.member-mini-toggle {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.member-mini-toggle {
  appearance: none;
  border: 0;
  background: transparent;
  color: #9a9d94;
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  padding: 0;
  cursor: pointer;
}

.book-member-mode-toggle.is-active,
.member-mini-toggle.is-active {
  color: #6f766d;
}

.mini-toggle-switch {
  width: 42px;
  height: 24px;
  border-radius: 999px;
  background: #d8d8d1;
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 0 0 auto;
  transition: background 0.15s ease;
}

.mini-toggle-knob {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #fff;
  position: absolute;
  left: 2px;
  top: 2px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.18);
  transition: transform 0.15s ease;
}

.book-member-mode-toggle.is-active .mini-toggle-switch,
.member-mini-toggle.is-active .mini-toggle-switch {
  background: #adb58f;
}

.book-member-mode-toggle.is-active .mini-toggle-knob,
.member-mini-toggle.is-active .mini-toggle-knob {
  transform: translateX(18px);
}

.member-tool-link {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--brand-text);
  font: inherit;
  font-size: 15px;
  font-weight: 500;
  cursor: pointer;
  padding: 4px 0;
}

.member-tool-link + .member-tool-link {
  margin-left: 18px;
}

/* =========================================================
   7. FILTER RESPONSIVE BEHAVIOR
   ========================================================= */

/* 3-column: skip the awkward 4-column layout */
@media (max-width: 1220px) {
  .book-controls-body,
  .book-search-row {
    grid-template-columns:
      minmax(160px, 1fr)
      minmax(220px, 1.25fr)
      minmax(220px, 1.25fr);
  }

  .control-view {
    grid-column: 1;
  }

  .control-group:nth-of-type(2) {
    grid-column: 2;
  }

  .control-group:nth-of-type(3) {
    grid-column: 3;
  }

  .control-group:nth-of-type(4) {
    grid-column: 2;
  }

  .control-group:nth-of-type(5) {
    grid-column: 3;
  }

  .control-search {
    grid-column: 1 / -1;
  }

  .mini-filter-search {
    grid-column: 1 / 2;
  }

  .mini-filter-planning {
    grid-column: 2;
  }

  .mini-filter-students {
    grid-column: 3;
  }

  .clear-filters-link {
    grid-column: 3;
    justify-self: end;
  }
}

/* 2-column: member filters stack under search */
@media (max-width: 900px) {
  .book-controls-body,
  .book-search-row {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }

  .control-view {
    grid-column: 1;
    grid-row: 1;
  }

  .control-group:nth-of-type(2) {
    grid-column: 2;
    grid-row: 1;
  }

  .control-group:nth-of-type(3) {
    grid-column: 2;
    grid-row: 2;
  }

  .control-group:nth-of-type(4) {
    grid-column: 1;
    grid-row: 2;
  }

  .control-group:nth-of-type(5) {
    grid-column: 1;
    grid-row: 3;
  }

  .control-search {
    grid-column: 1 / -1;
    grid-row: 4;
  }

  .mini-filter-search {
    grid-column: 1 / -1;
  }

  .mini-filter-planning {
    grid-column: 1;
  }

  .mini-filter-students {
    grid-column: 2;
  }

  .clear-filters-link {
    grid-column: 1 / -1;
    justify-self: start;
  }
}

/* Mobile: one clean label-left layout */
@media (max-width: 820px) {
  .book-controls-body {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 18px 20px 22px;
  }

  .book-controls-body > .control-view,
  .book-controls-body > .control-group,
  .book-controls-body > .control-search {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    min-width: 0;
  }

  .control-view,
  .control-group:not(.control-search) {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    align-items: center;
    gap: 10px;
  }

  .control-search {
    display: block;
  }

  .control-view {
    align-items: start;
  }

  .book-base-toggle {
    flex-wrap: wrap;
    min-width: 0;
  }

  .book-search-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
}

.mini-filter-search,
.mini-filter-planning,
.mini-filter-students {
  grid-column: 1 / -1 !important;
  display: grid !important;
  grid-template-columns: 108px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.mini-filter-group label {
  grid-column: 1;
  margin: 0;
}

.mini-filter-group input,
.mini-filter-group select {
  grid-column: 2;
  min-width: 0;
  width: 100%;
}
   
  .clear-filters-link {
    grid-column: 1 / -1 !important;
    grid-row: auto !important;
    justify-self: start;
    align-self: center;
    padding-top: 2px;
  }

  .book-member-toolbar {
    align-items: flex-start;
    flex-direction: column;
    padding: 12px 20px;
  }

  .book-member-toolbar-body {
    width: 100%;
  }

  .book-member-toolbar-spacer {
    display: none;
  }
}

/* =========================================================
   8. RESULTS / GROUP HEADINGS / AFFILIATE DISCLOSURE
   ========================================================= */

.book-results {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.book-group {
  margin-top: 34px;
}

.book-group:first-child {
  margin-top: 0;
}

.book-group-section {
  margin-top: 42px;
}

.book-group-section:first-of-type {
  margin-top: 0;
}

.book-group-title {
  margin: 0 0 18px;
  font-family: "Plantin MT Pro", Georgia, "Times New Roman", serif;
  font-size: clamp(24px, 2.4vw, 36px);
  line-height: 1.08;
  font-weight: 200;
  color: var(--brand-text);
}

.book-results-heading {
  margin: 0 0 18px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 520px);
  gap: 24px;
  align-items: start;
}

.book-results-heading .book-group-title {
  margin-bottom: 0;
}

.book-affiliate-disclosure {
  margin: 6px 0 0;
  color: #5f6b7a;
  font-size: 13px;
  line-height: 1.45;
  text-align: right;
}

.book-group .book-course,
.book-group-section .book-course {
  margin-top: 26px;
}

.book-group .book-course:first-of-type,
.book-group-section .book-course:first-of-type {
  margin-top: 0;
}

.empty-state {
  border: 1px dashed var(--divider-subtle);
  border-radius: 4px;
  padding: 16px;
  background: rgba(255,255,255,0.55);
  color: var(--brand-muted);
  font-size: 14px;
}

@media (max-width: 820px) {
  .book-results-heading {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .book-affiliate-disclosure {
    text-align: left;
  }
}


/* =========================================================
   9. COURSE / TOPIC SECTIONS
   ========================================================= */

/* =========================================================
   Course / Topic header tools
   Mirrors live book page layout
   ========================================================= */

.book-course-head-main,
.book-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.book-course-head-left,
.book-section-head-left {
  min-width: 0;
  flex: 1;
}

.book-title-with-students {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  min-width: 0;
}

.book-title-with-students h2,
.book-title-with-students h3 {
  margin-bottom: 0;
}

.header-student-chip-list {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex-wrap: wrap;
}

.header-student-chip {
  display: inline-flex;
  align-items: center;
  min-height: 20px;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(89,110,94,0.1);
  color: var(--brand-dark);
  border: 1px solid rgba(89,110,94,0.18);
  font-size: 11px;
  line-height: 1.1;
  font-weight: 600;
  white-space: nowrap;
}

.card-header-tools {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
  flex: 0 0 auto;
  max-width: 48%;
}

.card-header-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.bookmark-region--readonly {
  opacity: 1;
}

.bookmark-region--readonly .header-bookmark-btn {
  cursor: default;
}

.header-bookmark-btn {
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-radius: 4px;
  border: 1px solid var(--divider-subtle);
  background: #ffffff;
  color: var(--brand-muted);
  padding: 3px 9px 3px 4px;
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1;
  white-space: nowrap;
}

.header-bookmark-btn--solid {
  border-color: var(--subject-color, var(--brand-dark));
  background: var(--subject-color, var(--brand-dark));
  color: #ffffff;
}

.header-bookmark-btn--empty {
  border-color: var(--divider-subtle);
  background: #ffffff;
  color: var(--brand-muted);
}

.header-bookmark-icon {
  width: 24px;
  height: 24px;
  display: block;
}

.note-btn {
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: 1px solid var(--divider-subtle);
  background: #fff;
  color: var(--brand-dark);
  cursor: pointer;
  font-size: 14px;
}

.planner-tag-list {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.planner-tag-chip {
  display: inline-flex;
  align-items: center;
  min-height: 22px;
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(0,0,0,0.06);
  color: var(--brand-muted);
  font-size: 11px;
  line-height: 1;
  font-weight: 600;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .book-course-head-main,
  .book-section-head {
    flex-direction: column;
    align-items: stretch;
  }

  .card-header-tools {
    align-items: flex-start;
    max-width: none;
  }

  .card-header-actions,
  .planner-tag-list {
    justify-content: flex-start;
  }
}

.book-course {
  border: 1px solid var(--subject-color, var(--divider-subtle));
  border-radius: 4px;
  background: var(--brand-surface);
  overflow: hidden;
}

.book-course-head {
  padding: 16px 18px;
  border-bottom: 1px solid var(--divider-subtle);
  background: rgba(255,255,255,0.68);
}

.book-course-head h2 {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
}

.book-course-head .book-section-meta {
  margin-top: 5px;
  font-size: 13px;
  color: var(--brand-muted);
}

.book-section {
  padding: 16px;
  border-top: 1px solid var(--divider-subtle);
}

.book-section:first-of-type {
  border-top: 0;
}

.book-section h3 {
  margin: 0 0 12px;
  font-family: "Circular Pro", "DM Sans", system-ui, sans-serif;
  font-size: 18px;
  line-height: 1.35;
  font-weight: 500;
  color: var(--brand-text);
}

.book-section-meta {
  margin: 6px 0 12px;
  display: flex;
  align-items: stretch;
  font-size: 12px;
  line-height: 1.5;
  font-weight: 200;
  color: var(--brand-muted);
}

.book-meta-schedule {
  white-space: pre-line;
  padding-right: 20px;
}

.book-meta-schedule + .book-meta-grade {
  margin-left: 0;
  padding-left: 20px;
  border-left: 1px solid #e5e8e5;
  display: flex;
  align-items: center;
}

.book-meta-grade {
  white-space: normal;
}


/* =========================================================
   10. BOOK CARDS
   ========================================================= */

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

.book-section .book-card-list {
  padding: 0;
}

.book-card {
  border: 1px solid #e5e8e5;
  border-radius: 12px;
  padding: 10px 12px;
  background: #fbfbf9;
  display: grid;
  grid-template-columns: 64px 1fr;
  grid-template-rows: auto auto;
  gap: 12px;
  align-items: start;
  position: relative;
}

.book-card-badges {
  grid-column: 1 / -1;
  grid-row: 1;
  display: inline-flex;
  gap: 6px;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: -4px;
}

.book-cover-wrap {
  grid-row: 2;
  width: 64px;
  height: 84px;
  border-radius: 10px;
  overflow: hidden;
  background: #e5e8e5;
}

.book-cover {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: top;
  display: block;
}

.book-card-body {
  grid-row: 2;
  min-width: 0;
}

.book-main-row {
  display: grid;
  grid-template-columns: 1.5fr 1px 1fr;
  gap: 15px;
  align-items: start;
}

.book-main-left,
.book-main-right,
.book-scope-column,
.book-actions-column {
  min-width: 0;
}

.book-main-divider {
  width: 1px;
  align-self: stretch;
  background: transparent;
}

.book-main-right {
  padding-top: 2px;
  display: grid;
  grid-template-columns: 0.8fr 1.2fr;
  column-gap: 15px;
  row-gap: 0;
  align-items: start;
}

.book-scope-column {
  grid-column: 1;
}

.book-actions-column {
  grid-column: 2;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.book-card-title {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.book-subline {
  margin-top: 4px;
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  align-items: baseline;
  font-size: 0.9rem;
  opacity: 0.85;
  line-height: 1.35;
}

.book-rationale {
  margin: 6px 0 0;
  font-size: 0.9rem;
  line-height: 1.4;
  color: #262b26;
}

.book-rationale-label {
  font-weight: 600;
  margin-right: 4px;
  white-space: nowrap;
}

/* =========================================================
   My Books button on book cards
   ========================================================= */

.book-card-bookmark-corner {
  position: absolute;
  top: 14px;
  right: 14px;
  z-index: 4;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.book-save-region {
  display: inline-flex;
  align-items: center;
}

.book-save-btn {
  position: relative;
}

.bookmark-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 4px;
  border: 1px solid var(--divider-subtle);
  background-color: #ffffff;
  padding: 0;
  cursor: pointer;
  transition: border-color 0.15s ease, opacity 0.15s ease, background-color 0.15s ease;
}

.bookmark-btn--empty {
  color: var(--brand-muted);
  border-color: var(--divider-subtle);
  background-color: #ffffff;
}

.bookmark-btn--empty:hover {
  border-color: var(--subject-color, var(--brand-dark));
}

.bookmark-btn--solid {
  border-color: transparent;
  color: #ffffff;
  background-color: var(--subject-color, var(--brand-dark));
}

.bookmark-btn--ghost {
  border-color: transparent;
  color: #ffffff;
  background-color: var(--subject-color, var(--brand-dark));
  opacity: 0.42;
}

.bookmark-btn--ghost:hover {
  opacity: 0.7;
}

.bookmark-icon {
  width: 26px;
  height: 26px;
}

.bookmark-apply {
  position: absolute;
  top: -4px;
  right: -4px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background-color: #ffffff;
  font-size: 11px;
  line-height: 16px;
  text-align: center;
  color: var(--subject-color, var(--brand-dark));
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.06);
}

/* =========================================================
   11. BADGES / PURCHASE LINKS / FORMAT PILLS
   ========================================================= */

.book-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 999px;
  background: #adb58f;
  color: #ffffff;
  border: 1px solid #ffffff;
  text-transform: uppercase;
  white-space: nowrap;
}

.book-badge--optional {
  background: #adb58f;
}

.book-badge--choose-one {
  background: #596e5e;
}

.book-badge--grade {
  background: #262b26;
  text-transform: none;
  letter-spacing: 0;
}

.book-badge--format {
  background: #262b26;
  text-transform: none;
  letter-spacing: 0;
}

.book-purchase-block {
  margin-top: 0;
}

.book-link-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.book-link-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 6px;
  background: #bdc5bf;
  color: #262b26;
  border: 1px solid rgba(0,0,0,0.06);
  font-size: 10.5px;
  font-weight: 400;
  letter-spacing: 0.01em;
  text-decoration: none;
  white-space: nowrap;
  text-decoration: none;
}

.book-link-pill:hover {
  background: var(--brand-dark));
  color: #ffffff;
}

.book-link-pill--disabled {
  opacity: 0.65;
  cursor: default;
}

.book-link-pill--disabled:hover {
  background: #bdc5bf;
  color: #262b26;
}

.book-shared-block {
  padding-top: 2px;
}

.book-format-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.book-format-list {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
}

.book-format-pill {
  box-sizing: border-box;
  min-height: 24px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: 1px solid #596e5e;
  color: #596e5e;
  font-weight: 600;
  font-size: 12px;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.book-format-icon {
  font-size: 10px;
  line-height: 1;
}

.book-format-pill::before {
  content: "";
  width: 12px;
  height: 12px;
  display: inline-block;
  flex: 0 0 12px;
  background: currentColor;

  -webkit-mask-repeat: no-repeat;
  -webkit-mask-position: center;
  -webkit-mask-size: contain;
          mask-repeat: no-repeat;
          mask-position: center;
          mask-size: contain;
}

.book-format-pill--ebook::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 4h11a2 2 0 0 1 2 2v14a1 1 0 0 1-1 1H7a3 3 0 0 1-3-3V6a2 2 0 0 1 2-2zm0 14a1 1 0 0 0 1 1h10V6H6v12zm1-9h8v2H7V9zm0 4h8v2H7v-2z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M6 4h11a2 2 0 0 1 2 2v14a1 1 0 0 1-1 1H7a3 3 0 0 1-3-3V6a2 2 0 0 1 2-2zm0 14a1 1 0 0 0 1 1h10V6H6v12zm1-9h8v2H7V9zm0 4h8v2H7v-2z'/%3E%3C/svg%3E");
}

.book-format-pill--audiobook::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3a9 9 0 0 0-9 9v6a3 3 0 0 0 3 3h1v-8H6a2 2 0 0 0-2 2v-3a8 8 0 0 1 16 0v3a2 2 0 0 0-2-2h-1v8h1a3 3 0 0 0 3-3v-6a9 9 0 0 0-9-9zm-6 12h1v5H6a2 2 0 0 1-2-2v-1a2 2 0 0 1 2-2zm12 0h-1v5h1a2 2 0 0 0 2-2v-1a2 2 0 0 0-2-2z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 3a9 9 0 0 0-9 9v6a3 3 0 0 0 3 3h1v-8H6a2 2 0 0 0-2 2v-3a8 8 0 0 1 16 0v3a2 2 0 0 0-2-2h-1v8h1a3 3 0 0 0 3-3v-6a9 9 0 0 0-9-9zm-6 12h1v5H6a2 2 0 0 1-2-2v-1a2 2 0 0 1 2-2zm12 0h-1v5h1a2 2 0 0 0 2-2v-1a2 2 0 0 0-2-2z'/%3E%3C/svg%3E");
}

.book-format-pill--video::before {
  -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 6.8v10.4L18 12 7 6.8z'/%3E%3C/svg%3E");
          mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M7 6.8v10.4L18 12 7 6.8z'/%3E%3C/svg%3E");
}


/* =========================================================
   12. NOTE / TIP BOXES / META TEXT
   ========================================================= */

.book-tipbox {
  margin-top: 10px;
  padding: 10px 12px;
  background: #f3f4f1;
  border: 1px solid #e5e8e5;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.45;
  color: #5f675f;
  font-weight: 300;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.book-tipbox-label {
  font-weight: 300;
  margin-right: 2px;
  color: #5f675f;
  opacity: 1;
}

.book-note-row,
.book-may-sub-row,
.book-discount-row {
  display: inline;
  white-space: normal;
}

.book-meta-block {
  min-width: 0;
}

.book-meta-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: #666d66;
  margin-bottom: 4px;
}

.book-meta-text {
  font-size: 13px;
  line-height: 1.35;
  color: #666d66;
  white-space: pre-line;
}


/* =========================================================
   13. BOOK CARD RESPONSIVE BEHAVIOR
   ========================================================= */

@media (max-width: 760px) {
  .book-main-row {
    grid-template-columns: 1fr;
  }

  .book-main-divider {
    display: none;
  }

  .book-main-right {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 640px) {
  .book-card {
    grid-template-columns: 1fr;
  }

  .book-cover-wrap {
    width: 64px;
    justify-content: flex-start;
  }

  .book-main-right {
    grid-template-columns: 1fr;
  }
}


/* =========================================================
   14. BACK TO TOP
   ========================================================= */

.back-to-top {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 1000;

  display: inline-flex;
  align-items: center;
  gap: 6px;

  padding: 10px 14px;

  border: 1px solid rgba(89,110,94,0.25);
  border-radius: 999px;

  background: rgba(255,255,255,0.92);
  backdrop-filter: blur(8px);

  color: #596e5e;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;

  cursor: pointer;

  box-shadow: 0 10px 28px rgba(63, 62, 55, 0.08);

  opacity: 0;
  visibility: hidden;
  transform: translateY(10px);

  transition:
    opacity 0.2s ease,
    transform 0.2s ease,
    visibility 0.2s ease,
    background 0.2s ease;
}

.back-to-top.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.back-to-top:hover {
  background: #ffffff;
}

@media (max-width: 640px) {
  .back-to-top {
    right: 16px;
    bottom: 16px;
  }
}

/* =========================================================
   TEMPORARILY HIDE MEMBER / NAV TOOLS
   Keep code in place for later member-tool rebuild.
   ========================================================= */

/* Keep Alveary logo visible */
.app-header {
  display: block;
}

/* Hide navigation links/menu only */
.app-nav,
#app-step-nav {
  display: none !important;
}

/* Hide member tools toggle and member toolbar in filter box */
.book-member-toolbar,
.book-member-mode-toggle,
#member-tools-toggle {
  display: none !important;
}

/* Hide member-only filter controls */
.member-tool-only,
body.member-tools-enabled .member-tool-only {
  display: none !important;
}

/* Hide course/topic header member buttons for now */
.card-header-tools,
.card-header-actions,
.header-student-chip-list,
.planner-tag-list {
  display: none !important;
}

/* Hide book-card My Books buttons for now */
.book-card-bookmark-corner,
.book-save-region {
  display: none !important;
}

.book-link-pill.is-checking-auth {
  pointer-events: none;
}

.book-auth-status-overlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(38, 43, 38, 0.36);
  backdrop-filter: blur(1px);
}

.book-auth-status-overlay.is-visible {
  display: flex;
}

.book-auth-status-card {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  max-width: min(420px, calc(100vw - 40px));
  padding: 1rem 1.25rem;
  border: 1px solid rgba(89, 110, 94, 0.25);
  border-radius: 18px;
  background: #fffdf6;
  color: #262b26;
  box-shadow: 0 18px 50px rgba(38, 43, 38, 0.18);
  font-weight: 650;
}

.book-auth-status-spinner {
  width: 1.1rem;
  height: 1.1rem;
  flex: 0 0 auto;
  border: 2px solid #adb58f;
  border-right-color: transparent;
  border-radius: 999px;
  animation: book-auth-spin 0.75s linear infinite;
}

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