/* =========================================================
   BOOK OF SHADOWS
   File: grimoire/grimoire.css
   ========================================================= */

.grimoire-page-shell {
  min-height: 100vh;
  background:
    radial-gradient(circle at 80% 8%, rgba(185, 160, 93, 0.14), transparent 22rem),
    radial-gradient(circle at 12% 70%, rgba(111, 132, 101, 0.18), transparent 26rem),
    linear-gradient(145deg, #070807, #111512 58%, #080706);
}

.grimoire-main {
  width: min(1440px, calc(100% - 2rem));
  margin: 0 auto;
  padding: clamp(2rem, 5vw, 4rem) 0 clamp(4rem, 8vw, 7rem);
}

/* =========================================================
   COVER / INTRO
   ========================================================= */

.grimoire-cover {
  max-width: 840px;
  margin: 0 auto clamp(1.5rem, 4vw, 2.5rem);
  text-align: center;
}

.grimoire-cover h1 {
  max-width: none;
  margin-bottom: 0.75rem;
  font-size: clamp(3.4rem, 8vw, 6.8rem);
}

.grimoire-cover p {
  max-width: 62ch;
  margin-inline: auto;
  color: var(--cream);
  font-size: 1.02rem;
}

/* =========================================================
   AUTH CARD
   ========================================================= */

.grimoire-auth-notice {
  width: min(1180px, 100%);
  margin: 0 auto 2rem;
}

.grimoire-auth-notice.is-signed-in {
  display: none;
}

.grimoire-auth-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 430px);
  gap: clamp(1rem, 3vw, 2rem);
  align-items: center;
  padding: clamp(1.25rem, 4vw, 2.25rem);
  border: 1px solid rgba(185, 160, 93, 0.34);
  border-radius: 1.2rem;
  background:
    radial-gradient(circle at top left, rgba(185, 160, 93, 0.14), transparent 18rem),
    linear-gradient(145deg, rgba(31, 24, 17, 0.94), rgba(8, 7, 5, 0.96));
  box-shadow: var(--shadow);
}

.grimoire-auth-card h2 {
  max-width: none;
  color: var(--cream);
  font-size: clamp(2.5rem, 5vw, 4.6rem);
}

/* =========================================================
   BOOK LAYOUT
   ========================================================= */

.book-of-shadows {
  display: grid;
  grid-template-columns: 280px minmax(0, 920px);
  justify-content: center;
  align-items: start;
  gap: clamp(1.5rem, 4vw, 4rem);
}

.book-toc {
  position: sticky;
  top: 6rem;
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  padding: 1.2rem;
  border: 1px solid rgba(185, 160, 93, 0.26);
  border-radius: 1rem;
  background:
    radial-gradient(circle at top, rgba(185, 160, 93, 0.08), transparent 16rem),
    rgba(16, 33, 24, 0.72);
  box-shadow: 0 22px 60px rgba(0, 0, 0, 0.34);
  scrollbar-width: thin;
  scrollbar-color: rgba(185, 160, 93, 0.45) transparent;
}

.book-toc::-webkit-scrollbar {
  width: 6px;
}

.book-toc::-webkit-scrollbar-track {
  background: transparent;
}

.book-toc::-webkit-scrollbar-thumb {
  background: rgba(185, 160, 93, 0.45);
  border-radius: 999px;
}

.book-toc::-webkit-scrollbar-track,
.book-page::-webkit-scrollbar-track {
  background: transparent;
}

.book-toc::-webkit-scrollbar-thumb,
.book-page::-webkit-scrollbar-thumb {
  background: rgba(185, 160, 93, 0.45);
  border-radius: 999px;
}

.book-return-link {
  display: inline-block;
  margin-bottom: 1.5rem;
  color: rgba(244, 236, 216, 0.62);
  text-decoration: none;
  font-size: 0.74rem;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.book-return-link:hover,
.book-return-link:focus-visible {
  color: var(--gold);
}

.book-toc-heading {
  margin-bottom: 1rem;
  text-align: center;
}

.book-toc-heading h2 {
  max-width: none;
  margin-bottom: 0;
  color: var(--gold);
  font-size: 2.2rem;
}

.book-actions {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1.5rem;
}

.book-toc-list {
  display: grid;
  gap: 1.25rem;
}

.book-note {
  margin: 0;
  padding: 1rem;
  border: 1px solid rgba(185, 160, 93, 0.22);
  border-radius: 0.75rem;
  color: var(--muted);
  background: rgba(8, 10, 8, 0.32);
  text-align: center;
  font-size: 0.9rem;
  font-style: italic;
}

.book-section-list {
  display: grid;
  gap: 1.4rem;
}

.book-toc-section {
  display: grid;
  gap: 0.5rem;
}

.book-section-title {
  width: 100%;
  border: 0;
  padding: 0;
  color: var(--gold);
  background: transparent;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: 1.6rem;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.book-section-title span {
  display: inline-block;
}

.book-section-title:hover,
.book-section-title:focus-visible,
.book-section-title.is-active {
  color: var(--cream);
}

.book-section-pages {
  display: grid;
  gap: 0.25rem;
  padding-left: 1rem;
}

.book-section-pages[hidden] {
  display: none;
}

.book-section-empty {
  margin: 0;
  color: rgba(244, 236, 216, 0.48);
  font-size: 0.86rem;
  font-style: italic;
}

.book-page-link {
  width: 100%;
  border: 0;
  padding: 0.18rem 0;
  color: var(--muted);
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.book-page-link:hover,
.book-page-link:focus-visible,
.book-page-link.is-active {
  color: var(--cream);
}

/* =========================================================
   BOOK PAGE
   ========================================================= */

.book-page {
  position: relative;
  min-height: 680px;
  max-height: none;
  overflow: visible;
  padding: clamp(1rem, 4vw, 3rem) 0;
  border: none;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
}

.book-page::before {
  display: none;
}

.book-page-toolbar {
  position: relative;
  z-index: 2;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.book-search {
  max-width: 260px;
  color: rgba(244, 236, 216, 0.62);
  font-size: 0.82rem;
}

.book-search span {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
}

.book-search input {
  min-height: 2.35rem;
  padding: 0.55rem 0.7rem;
  border-radius: 999px;
  background: rgba(244, 236, 216, 0.06);
}

.book-edit-button {
  min-height: 2.35rem;
  border: 1px solid rgba(185, 160, 93, 0.28);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  color: var(--gold);
  background: rgba(185, 160, 93, 0.07);
  font: inherit;
  cursor: pointer;
}

.book-edit-button:hover,
.book-edit-button:focus-visible {
  border-color: var(--gold);
  color: var(--cream);
}

.book-page-empty,
.book-page-content,
.book-status {
  position: relative;
  z-index: 2;
}

.book-page-empty {
  max-width: 720px;
  margin: 3rem auto 0;
  text-align: center;
}

.book-page-empty[hidden] {
  display: none;
}

.book-page-empty h2 {
  max-width: none;
  color: var(--cream);
  font-size: clamp(2.8rem, 7vw, 5rem);
}

.book-page-empty p {
  max-width: 62ch;
  margin-inline: auto;
}

/* =========================================================
   READER MODE
   ========================================================= */

.book-reader-page {
  max-width: 760px;
  margin: 0 auto;
  padding-bottom: 2rem;
}

.book-reader-header {
  margin-bottom: clamp(2.5rem, 6vw, 4rem);
  text-align: center;
}

.book-reader-header h1 {
  max-width: none;
  margin-bottom: 0.5rem;
  color: var(--cream);
  font-size: clamp(2.8rem, 6vw, 5.4rem);
  line-height: 0.95;
}

.book-reader-date {
  margin-bottom: 1rem;
  color: var(--muted);
  font-style: italic;
}

.book-divider,
.book-reader-divider {
  margin: 1.4rem auto;
  color: var(--gold);
  letter-spacing: 0.45rem;
  text-align: center;
  opacity: 0.82;
}

.book-reader-body p {
  max-width: 74ch;
  color: var(--muted);
  font-size: 1.08rem;
  line-height: 1.95;
}

.book-reader-body h2 {
  max-width: none;
  margin-top: 3.4rem;
  color: var(--cream);
  font-size: clamp(2rem, 4vw, 3.4rem);
}

.book-reader-body ul,
.book-reader-body ol {
  color: var(--muted);
  line-height: 1.9;
  padding-left: 1.4rem;
}

.book-reader-body li {
  margin-bottom: 0.35rem;
}

.book-reader-body blockquote {
  max-width: 64ch;
  margin: 2.5rem 0;
  padding: 1.6rem;
  border: 1px solid rgba(185, 160, 93, 0.28);
  border-left: 3px solid var(--gold);
  border-radius: 0.85rem;
  background: rgba(185, 160, 93, 0.07);
  font-style: italic;
}

.book-reader-body blockquote p {
  margin: 0;
  color: var(--cream);
}

.book-placeholder {
  text-align: center;
  font-style: italic;
}

/* =========================================================
   SPECIAL READER ELEMENTS
   ========================================================= */

.book-callout,
.book-correspondence,
.book-ingredient-list,
.book-linked-pages,
.book-image {
  margin: 2rem 0;
  border: 1px solid rgba(185, 160, 93, 0.3);
  border-radius: 0.95rem;
  background:
    radial-gradient(circle at top left, rgba(185, 160, 93, 0.11), transparent 14rem),
    rgba(8, 10, 8, 0.32);
}

.book-callout {
  padding: 1.35rem 1.5rem;
  border-left: 3px solid var(--gold);
}

.book-callout p {
  margin: 0;
  color: var(--cream);
  font-style: italic;
}

.book-correspondence {
  padding: 1.25rem 1.4rem;
  color: var(--cream);
  line-height: 1.85;
  white-space: pre-line;
}

.book-ingredient-list {
  padding: 1.25rem 1.4rem;
}

.book-ingredient-list h3 {
  margin-bottom: 0.75rem;
  color: var(--gold);
  font-size: 1.6rem;
}

.book-checklist {
  list-style: none;
  padding-left: 0;
}

.book-checklist li {
  position: relative;
  padding-left: 1.7rem;
}

.book-checklist li::before {
  content: "☐";
  position: absolute;
  left: 0;
  color: var(--gold);
}

.book-image {
  overflow: hidden;
}

.book-image img {
  width: 100%;
  display: block;
}

.book-image figcaption {
  padding: 0.75rem 1rem 1rem;
  color: var(--muted);
  font-size: 0.92rem;
  font-style: italic;
  text-align: center;
}

.book-inline-link button,
.book-linked-pages button {
  border: 1px solid rgba(185, 160, 93, 0.28);
  border-radius: 999px;
  padding: 0.5rem 0.85rem;
  color: var(--gold);
  background: rgba(185, 160, 93, 0.08);
  font: inherit;
  cursor: pointer;
}

.book-inline-link button:hover,
.book-inline-link button:focus-visible,
.book-linked-pages button:hover,
.book-linked-pages button:focus-visible {
  border-color: var(--gold);
  color: var(--cream);
}

.book-linked-pages {
  padding: 1.25rem 1.4rem;
}

.book-linked-pages h2 {
  margin-top: 0;
  font-size: 2rem;
}

.book-linked-pages div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

/* =========================================================
   EDIT MODE
   ========================================================= */

.book-editor-page {
  max-width: 820px;
  margin: 0 auto;
}

.book-editor-header {
  display: grid;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.book-editor-header label {
  color: var(--silver);
}

.book-editor-header input {
  border: 0;
  border-bottom: 1px solid rgba(185, 160, 93, 0.36);
  border-radius: 0;
  padding: 0.4rem 0;
  color: var(--cream);
  background: transparent;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(2.2rem, 5vw, 4.2rem);
  font-weight: 700;
}

.book-editor-actions {
  display: flex;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.book-editor-elements {
  display: grid;
  gap: 1rem;
}

.book-edit-element {
  position: relative;
  display: grid;
  gap: 0.75rem;
  padding: 1rem;
  border: 1px solid rgba(185, 160, 93, 0.22);
  border-radius: 0.85rem;
  background:
    radial-gradient(circle at top left, rgba(185, 160, 93, 0.07), transparent 12rem),
    rgba(8, 10, 8, 0.34);
}

.book-edit-element:focus-within {
  border-color: rgba(185, 160, 93, 0.5);
  box-shadow: 0 0 0 2px rgba(185, 160, 93, 0.08);
}

.book-edit-element label {
  color: var(--silver);
}

.book-edit-element input,
.book-edit-element textarea {
  background: rgba(244, 236, 216, 0.07);
}

.book-edit-element button {
  border: 1px solid rgba(244, 236, 216, 0.18);
  border-radius: 999px;
  padding: 0.35rem 0.65rem;
  color: rgba(244, 236, 216, 0.72);
  background: transparent;
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.book-edit-element button:hover,
.book-edit-element button:focus-visible {
  border-color: var(--gold);
  color: var(--cream);
}

.book-edit-element button:disabled {
  cursor: not-allowed;
  opacity: 0.35;
}

.book-edit-element--divider {
  text-align: center;
}

.book-element-controls {
  display: flex;
  justify-content: flex-end;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.book-element-controls button {
  min-width: 2rem;
}

/* =========================================================
   RICH TEXT EDITOR
   ========================================================= */

.book-rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  padding: 0.55rem;
  border: 1px solid rgba(185, 160, 93, 0.22);
  border-radius: 999px;
  background: rgba(8, 10, 8, 0.32);
  width: fit-content;
}

.book-rich-toolbar button {
  display: inline-grid;
  place-items: center;
  min-width: 2rem;
  min-height: 2rem;
  border: 1px solid rgba(244, 236, 216, 0.18);
  border-radius: 999px;
  color: var(--cream);
  background: rgba(244, 236, 216, 0.06);
  font: inherit;
  font-size: 0.85rem;
  cursor: pointer;
}

.book-rich-toolbar button:hover,
.book-rich-toolbar button:focus-visible {
  border-color: var(--gold);
  color: var(--gold);
}

.book-rich-input {
  min-height: 7rem;
  width: 100%;
  padding: 0.9rem;
  border: 1px solid rgba(194, 200, 196, 0.24);
  border-radius: 0.45rem;
  color: var(--cream);
  background: rgba(244, 236, 216, 0.07);
  line-height: 1.8;
  outline: none;
}

.book-rich-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(185, 160, 93, 0.08);
}

.book-rich-heading {
  min-height: 4rem;
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(2rem, 4vw, 3.4rem);
  font-weight: 700;
  line-height: 1.1;
}

.book-rich-callout {
  min-height: 5rem;
  border-left: 3px solid var(--gold);
  font-style: italic;
}

/* =========================================================
   ADD ELEMENTS
   ========================================================= */

.book-add-elements {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
  padding-top: 1.5rem;
  border-top: 1px solid rgba(185, 160, 93, 0.18);
}

.book-element-group {
  display: grid;
  gap: 0.5rem;
}

.book-element-group p {
  margin: 0;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.16em;
}

.book-element-group div {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.book-add-elements button,
.book-element-group button {
  border: 1px solid rgba(185, 160, 93, 0.32);
  border-radius: 999px;
  padding: 0.55rem 0.85rem;
  color: var(--gold);
  background: rgba(185, 160, 93, 0.08);
  font: inherit;
  cursor: pointer;
}

.book-add-elements button:hover,
.book-add-elements button:focus-visible,
.book-element-group button:hover,
.book-element-group button:focus-visible {
  border-color: var(--gold);
  color: var(--cream);
}

/* =========================================================
   SEARCH RESULTS
   ========================================================= */

.book-search-results {
  max-width: 760px;
  margin: 0 auto;
}

.book-search-results h2 {
  max-width: none;
  color: var(--cream);
  text-align: center;
}

.book-search-results button {
  display: block;
  width: 100%;
  border: 1px solid rgba(185, 160, 93, 0.22);
  border-radius: 0.75rem;
  margin-bottom: 0.6rem;
  padding: 0.8rem 1rem;
  color: var(--cream);
  background: rgba(8, 10, 8, 0.32);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.book-search-results button:hover,
.book-search-results button:focus-visible {
  border-color: var(--gold);
}

/* =========================================================
   MODALS
   ========================================================= */

.book-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(5, 5, 4, 0.72);
  backdrop-filter: blur(8px);
}

.book-modal {
  width: min(640px, 100%);
  max-height: min(720px, calc(100vh - 2rem));
  overflow-y: auto;
  border: 1px solid rgba(185, 160, 93, 0.38);
  border-radius: 1.1rem;
  background:
    radial-gradient(circle at top, rgba(185, 160, 93, 0.12), transparent 18rem),
    linear-gradient(145deg, rgba(31, 24, 17, 0.98), rgba(8, 7, 5, 0.98));
  box-shadow: 0 30px 100px rgba(0, 0, 0, 0.7);
}

.book-modal header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid rgba(185, 160, 93, 0.2);
}

.book-modal h2 {
  max-width: none;
  margin: 0;
  color: var(--cream);
  font-size: 2.3rem;
}

.book-modal header button {
  display: grid;
  place-items: center;
  width: 2rem;
  aspect-ratio: 1;
  border: 1px solid rgba(244, 236, 216, 0.18);
  border-radius: 999px;
  color: var(--cream);
  background: rgba(244, 236, 216, 0.06);
  font: inherit;
  cursor: pointer;
}

.book-modal-body {
  padding: 1.25rem;
}

.book-template-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
}

.book-template-grid button {
  min-height: 4rem;
  border: 1px solid rgba(185, 160, 93, 0.26);
  border-radius: 0.85rem;
  padding: 0.85rem;
  color: var(--cream);
  background:
    radial-gradient(circle at top left, rgba(185, 160, 93, 0.12), transparent 10rem),
    rgba(8, 10, 8, 0.38);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.book-template-grid button:hover,
.book-template-grid button:focus-visible {
  border-color: var(--gold);
  color: var(--gold);
}

/* =========================================================
   STATUS
   ========================================================= */

.book-status {
  min-height: 1.2rem;
  margin: 1rem auto 0;
  max-width: 760px;
  color: var(--gold);
  font-size: 0.86rem;
  font-style: italic;
  text-align: center;
}

/* =========================================================
   RESPONSIVE
   ========================================================= */

@media (max-width: 980px) {
  .grimoire-auth-card,
  .book-of-shadows {
    grid-template-columns: 1fr;
  }

  .book-toc {
    position: static;
    max-height: none;
  }

  .book-page {
    max-height: none;
  }
}

@media (max-width: 700px) {
  .grimoire-main {
    width: min(100% - 1rem, 1440px);
    padding-top: 1.5rem;
  }

  .grimoire-cover h1 {
    font-size: clamp(3rem, 15vw, 5rem);
  }

  .book-page {
    padding: 1rem;
    border-radius: 1rem;
  }

  .book-page::before {
    inset: 0.65rem;
  }

  .book-page-toolbar {
    display: grid;
    justify-content: stretch;
  }

  .book-search {
    max-width: none;
  }

  .book-reader-header h1 {
    font-size: clamp(2.6rem, 15vw, 4.2rem);
  }

  .book-reader-body p {
    font-size: 1rem;
    line-height: 1.8;
  }

  .book-editor-actions,
  .book-element-group div {
    display: grid;
  }

  .book-rich-toolbar {
    border-radius: 0.9rem;
    width: 100%;
  }

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

.book-add-drawer {
  width: 100%;
}

.book-add-drawer summary {
  display: inline-flex;
  justify-content: center;
  align-items: center;
  min-height: 2.75rem;
  width: fit-content;
  margin: 0 auto;
  border: 1px solid rgba(185, 160, 93, 0.34);
  border-radius: 999px;
  padding: 0.65rem 1rem;
  color: var(--gold);
  background: rgba(185, 160, 93, 0.08);
  font: inherit;
  cursor: pointer;
  list-style: none;
}

.book-add-drawer summary::-webkit-details-marker {
  display: none;
}

.book-add-drawer summary:hover,
.book-add-drawer summary:focus-visible {
  border-color: var(--gold);
  color: var(--cream);
}

.book-add-drawer-panel {
  display: grid;
  gap: 1rem;
  margin-top: 1rem;
  padding: 1rem;
  border: 1px solid rgba(185, 160, 93, 0.22);
  border-radius: 1rem;
  background:
    radial-gradient(circle at top, rgba(185, 160, 93, 0.1), transparent 16rem),
    rgba(8, 10, 8, 0.3);
}

.book-section-row,
.book-page-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.45rem;
  align-items: center;
}

.book-toc-move-controls {
  display: inline-flex;
  gap: 0.25rem;
}

.book-toc-move-controls button {
  display: grid;
  place-items: center;
  width: 1.65rem;
  aspect-ratio: 1;
  border: 1px solid rgba(244, 236, 216, 0.16);
  border-radius: 999px;
  color: rgba(244, 236, 216, 0.58);
  background: rgba(244, 236, 216, 0.04);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.book-toc-move-controls button:hover,
.book-toc-move-controls button:focus-visible {
  border-color: var(--gold);
  color: var(--gold);
}

.book-toc-move-controls button:disabled {
  cursor: not-allowed;
  opacity: 0.25;
}

.book-page-row .book-page-link {
  min-width: 0;
}

.book-mundane-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.35rem;
  border: 1px solid rgba(185, 160, 93, 0.24);
  border-radius: 999px;
  padding: 0.4rem 0.7rem;
  color: rgba(244, 236, 216, 0.68);
  background: rgba(244, 236, 216, 0.04);
  font-size: 0.82rem;
  cursor: pointer;
}

.book-mundane-toggle input {
  width: auto;
  accent-color: var(--gold);
}

body.is-mundane-mode .book-toc {
  display: none;
}

body.is-mundane-mode .book-of-shadows {
  grid-template-columns: minmax(0, 920px);
}

body.is-mundane-mode .book-reader-divider,
body.is-mundane-mode .book-divider {
  opacity: 0.25;
}

body.is-mundane-mode .book-linked-pages,
body.is-mundane-mode .book-correspondence,
body.is-mundane-mode .book-ingredient-list {
  display: none;
}

body.is-mundane-mode .book-reader-header h1 {
  font-size: clamp(2.2rem, 5vw, 4rem);
}

body.is-mundane-mode .book-reader-date {
  display: none;
}

body.is-mundane-mode .book-page {
  background:
    radial-gradient(circle at 82% 10%, rgba(244, 236, 216, 0.08), transparent 14rem),
    linear-gradient(145deg, rgba(24, 23, 20, 0.96), rgba(12, 13, 12, 0.98));
}

body.is-mundane-mode .book-reader-body h2,
body.is-mundane-mode .book-reader-divider {
  display: none;
}

body.is-mundane-mode .book-reader-header h1 {
  font-size: clamp(2.2rem, 5vw, 4rem);
}

body.is-mundane-mode .book-reader-header h1::before {
  content: "Journal Entry";
  display: block;
  margin-bottom: 0.35rem;
  color: var(--gold);
  font-size: 0.8rem;
  font-family: inherit;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

body.is-mundane-mode .book-reader-date {
  display: block;
}

body.is-mundane-mode .book-reader-body {
  margin-top: 2rem;
}

/* Altar/apothecary imported pages should feel less gigantic */
.book-reader-page[data-page-source="altar-import"] h2,
.book-reader-page[data-page-source="apothecary-import"] h2 {
  font-size: clamp(1.75rem, 4vw, 3rem);
  margin-top: 1.75rem;
}

/* =========================================================
   GRIMOIRE JOURNAL TYPOGRAPHY + FONT CHOICES
   ========================================================= */

.book-reader-header h1 {
  font-size: clamp(2.8rem, 6vw, 5rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.book-reader-body h2 {
  margin-top: 2rem;
  margin-bottom: 0.55rem;
  font-size: clamp(1.65rem, 3.2vw, 2.7rem);
  line-height: 1;
}

.book-ingredient-list h3 {
  font-size: clamp(1.15rem, 2vw, 1.55rem);
  letter-spacing: 0.04em;
}

.book-callout {
  margin: 1.25rem auto 2rem;
  padding: 0.8rem 1rem;
  border-color: rgba(185, 160, 93, 0.28);
  background: rgba(244, 236, 216, 0.035);
}

.book-callout p {
  margin: 0;
  color: var(--gold);
  font-size: 0.95rem;
  font-style: italic;
  text-align: center;
}

.grimoire-section-title,
.grimoire-toc h3,
.book-shelf-section-title {
  font-size: clamp(1.25rem, 2vw, 1.75rem) !important;
  line-height: 1.05;
}

.book-reader-page,
.book-editor-page {
  font-family: var(--grimoire-page-font, Georgia, serif);
}

body.grimoire-font-classic-serif {
  --grimoire-page-font: Georgia, "Times New Roman", serif;
}

body.grimoire-font-dark-academia {
  --grimoire-page-font: Garamond, Georgia, serif;
}

body.grimoire-font-soft-journal {
  --grimoire-page-font: Palatino, "Book Antiqua", Georgia, serif;
}

body.grimoire-font-handwritten {
  --grimoire-page-font: "Segoe Print", "Bradley Hand", "Comic Sans MS", cursive;
}

/* =========================================================
   APOTHECARY GRIMOIRE PAGE LAYOUT
   ========================================================= */

.book-apothecary-page {
  display: grid;
  gap: 1.6rem;
  margin-top: 1.5rem;
}

.book-apothecary-meta {
  width: fit-content;
  margin: 0 auto 1.25rem;
  border: 1px solid rgba(185, 160, 93, 0.28);
  border-radius: 999px;
  padding: 0.55rem 0.9rem;
  color: var(--gold);
  background: rgba(244, 236, 216, 0.035);
  font-size: 0.95rem;
  font-style: italic;
  text-align: center;
}

.book-apothecary-meta span {
  margin: 0 0.45rem;
  opacity: 0.75;
}


.book-apothecary-section h2 {
  margin: 0 0 0.6rem;
  color: var(--gold);
  font-size: clamp(1.35rem, 2.4vw, 2rem);
  line-height: 1.05;
}

.book-apothecary-section p {
  margin: 0;
  max-width: 68ch;
}

.book-apothecary-ingredients {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding-left: 1.35rem;
}

.book-apothecary-ingredients li {
  padding-left: 0.2rem;
}

/* Smaller Table of Contents section headers */
.grimoire-shelf h3,
.grimoire-toc h3,
.book-shelf h3,
.book-shelf-section h3,
.book-shelf-section-title,
.grimoire-section-title {
  font-size: clamp(1.15rem, 1.8vw, 1.55rem) !important;
  line-height: 1.1 !important;
}

/* So imported apothecary pages no longer shout */
.book-reader-page[data-page-source="apothecary-import"] .book-reader-body > h2 {
  font-size: clamp(1.35rem, 2.4vw, 2rem);
}

/* =========================================================
   GRIMOIRE PAGE CLEANUP
   Remove boxed page feeling + fix import layout
   ========================================================= */

.book-reader-page,
.book-editor-page {
  max-height: none !important;
  overflow: visible !important;
  border: none !important;
  box-shadow: none !important;
}

.book-reader-body {
  overflow: visible !important;
}

.book-apothecary-page {
  border: none !important;
  box-shadow: none !important;
}

.book-apothecary-section h2 {
  color: var(--gold);
  font-size: clamp(1.35rem, 2.4vw, 2rem) !important;
}

.book-reader-page[data-page-source="apothecary-import"] .book-reader-header {
  margin-bottom: 1.25rem;
}

.book-reader-page[data-page-source="apothecary-import"] .book-reader-header h1 {
  font-size: clamp(2.7rem, 5vw, 4.6rem) !important;
}

.book-reader-page[data-page-source="apothecary-import"] .book-reader-date {
  display: none !important;
}

/* =========================================================
   GRIMOIRE PAGE FLATTENING
   Removes nested reader boxes and stray crossing lines
   ========================================================= */

.book-reader-page,
.book-editor-page {
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  padding-inline: clamp(1rem, 5vw, 4rem) !important;
}

.book-reader-body,
.book-editor-elements {
  border: none !important;
  background: transparent !important;
  box-shadow: none !important;
  overflow: visible !important;
}

.book-apothecary-page {
  border: none !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

.book-apothecary-section {
  border-top: none !important;
  padding-top: 0 !important;
  margin-top: 2.25rem;
}

.book-apothecary-section h2 {
  margin-bottom: 0.65rem;
}

.book-apothecary-section + .book-apothecary-section {
  padding-top: 1.75rem !important;
  border-top: 1px solid rgba(185, 160, 93, 0.14) !important;
}

.book-apothecary-section p,
.book-apothecary-ingredients {
  max-width: 72ch;
}

.book-reader-page[data-page-source="apothecary-import"] {
  max-width: none !important;
}

/* =========================================================
   GRIMOIRE PAGE OUTLINE
   Border wraps toolbar + page content without trapping scroll
   ========================================================= */

.book-page {
  border: 1px solid rgba(185, 160, 93, 0.28) !important;
  border-radius: 1.15rem !important;
  padding: clamp(1.25rem, 4vw, 3rem) !important;
  background:
    radial-gradient(circle at 82% 8%, rgba(185, 160, 93, 0.08), transparent 18rem),
    radial-gradient(circle at 14% 92%, rgba(111, 132, 101, 0.1), transparent 20rem),
    rgba(8, 10, 8, 0.18) !important;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.28) !important;
}

.book-page::before {
  display: none !important;
}

.book-page-content {
  border: none !important;
  border-radius: 0 !important;
  padding: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
}

/* =========================================================
   LIVING LIBRARY BROWSER
   Virtual Traditional Information section
   ========================================================= */

.traditional-library-shelf {
  margin-top: 1.4rem;
  padding-top: 1.1rem;
  border-top: 1px solid rgba(185, 160, 93, 0.18);
}

.traditional-library-group {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.85rem;
}

.traditional-library-group p {
  margin: 0.4rem 0 0.15rem;
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.book-library-entity-page {
  max-width: none;
}

.book-library-layer {
  margin-top: 2.25rem;
}

.book-library-layer h2 {
  margin-bottom: 1rem;
  color: var(--gold);
  font-size: clamp(1.4rem, 2.5vw, 2.1rem);
}

.book-library-field {
  margin-bottom: 1.25rem;
}

.book-library-field h3 {
  margin: 0 0 0.25rem;
  color: var(--cream);
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.book-library-field p {
  margin: 0;
}

/* =========================================================
   LIVING LIBRARY BROWSER POLISH
   Collapsible Traditional Information + entity pages
   ========================================================= */

.traditional-library-shelf {
  margin-top: 1.4rem;
  padding-top: 1.15rem;
  border-top: 1px solid rgba(185, 160, 93, 0.18);
}

.traditional-library-title {
  color: var(--cream);
  font-size: clamp(1.3rem, 2vw, 1.75rem) !important;
  line-height: 1.05 !important;
}

.traditional-library-root {
  padding-left: 0;
}

.traditional-library-group {
  display: grid;
  gap: 0.25rem;
  margin-top: 0.75rem;
}

.traditional-library-group-title {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  width: 100%;
  border: 0;
  padding: 0.25rem 0;
  color: var(--gold);
  background: transparent;
  font: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-align: left;
  text-transform: uppercase;
  cursor: pointer;
}

.traditional-library-group-title:hover,
.traditional-library-group-title:focus-visible {
  color: var(--cream);
}

.traditional-library-entity-list {
  display: grid;
  gap: 0.18rem;
  padding-left: 1.15rem;
}

.traditional-library-entity-list[hidden] {
  display: none;
}

.traditional-library-entity-link {
  font-size: 0.95rem;
}

.traditional-library-entity-link.is-active {
  color: var(--cream);
}

.book-library-entity-page {
  max-width: none;
}

.book-library-header {
  max-width: 780px;
  margin-inline: auto;
}

.book-library-intro {
  max-width: 58ch;
  margin: 1rem auto 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.8;
  text-align: center;
}

.book-library-tags {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.45rem;
  margin-top: 1.2rem;
}

.book-library-tags span,
.book-library-chips span {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  border: 1px solid rgba(185, 160, 93, 0.26);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  color: var(--gold);
  background: rgba(185, 160, 93, 0.06);
  font-size: 0.88rem;
  line-height: 1.2;
}

.book-library-body {
  max-width: 780px;
  margin: 0 auto;
}

.book-library-layer {
  margin-top: 2.4rem;
}

.book-library-layer h2 {
  margin-bottom: 1rem;
  color: var(--gold);
  font-size: clamp(1.45rem, 2.4vw, 2.15rem);
  line-height: 1.1;
}

.book-library-layer--traditional > h2 {
  margin-bottom: 1.35rem;
}

.book-library-fields {
  display: grid;
  gap: 1rem;
}

.book-library-field {
  display: grid;
  gap: 0.3rem;
  padding-bottom: 0.95rem;
  border-bottom: 1px solid rgba(185, 160, 93, 0.13);
}

.book-library-field:last-child {
  border-bottom: 0;
}

.book-library-field h3 {
  margin: 0;
  color: var(--cream);
  font-size: 0.86rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.book-library-field p {
  margin: 0;
  max-width: 72ch;
  color: var(--muted);
  line-height: 1.8;
}

.book-library-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.book-library-layer--my-practice,
.book-library-layer--community {
  border-top: 1px solid rgba(185, 160, 93, 0.18);
  padding-top: 1.6rem;
}

.book-library-body > .book-library-layer:first-child {
  margin-top: 1.5rem;
}

.book-library-layer h2 {
  font-size: clamp(1.55rem, 2.2vw, 2.35rem) !important;
}

.book-library-field h3 {
  font-size: 0.78rem;
}

.book-library-field {
  padding-bottom: 0.75rem;
}

/* =========================================================
   MY PRACTICE LIVING LIBRARY
   ========================================================= */

.my-practice-shelf {
  margin-top: 1rem;
  padding-bottom: 1.1rem;
  border-bottom: 1px solid rgba(185, 160, 93, 0.18);
}

.my-practice-new-entry-button {
  width: 100%;
  margin: 0.65rem 0 1rem;
  min-height: 2.45rem;
}

.book-library-entry-step {
  min-width: 0;
  margin: 0;
  padding: 0.9rem;
  border: 1px solid rgba(190, 155, 90, 0.28);
  border-radius: 0.65rem;
}

.book-library-entry-step legend {
  padding: 0 0.35rem;
  color: var(--gold, #c9a86a);
  font-weight: 700;
}

.book-library-entry-results {
  display: grid;
  gap: 0.45rem;
  margin-top: 0.65rem;
}

.book-library-entry-results .button {
  width: 100%;
  max-width: 100%;
  justify-content: flex-start;
  text-align: left;
}

.book-library-entry-selection {
  margin: 0.65rem 0 0;
}

.book-library-journey {
  border-top: 1px solid rgba(185, 160, 93, 0.24);
}

.book-living-journey-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  gap: 0.65rem;
  margin: 0;
}

.book-living-journey-summary > div,
.book-living-journey-group {
  min-width: 0;
  padding: 0.8rem;
  border: 1px solid rgba(185, 160, 93, 0.2);
  border-radius: 0.75rem;
  background: rgba(244, 236, 216, 0.025);
}

.book-living-journey-summary dt,
.book-living-journey-group h4 {
  color: var(--gold);
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

.book-living-journey-summary dd {
  margin: 0.3rem 0 0;
  overflow-wrap: anywhere;
}

.book-living-journey-group {
  margin-top: 0.8rem;
}

.book-living-journey-group h3 {
  margin-bottom: 0.65rem;
}

.book-living-pairings,
.book-living-reference-groups,
.book-living-record-list {
  display: grid;
  gap: 0.5rem;
}

.book-living-reference-groups {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 13rem), 1fr));
}

.book-living-connection-link,
.book-living-connection-record {
  display: grid;
  min-width: 0;
  width: 100%;
  gap: 0.15rem;
  padding: 0.55rem 0.65rem;
  border: 1px solid rgba(185, 160, 93, 0.18);
  border-radius: 0.6rem;
  color: var(--cream);
  background: rgba(255, 255, 255, 0.025);
  font: inherit;
  text-align: left;
  text-decoration: none;
  overflow-wrap: anywhere;
}

button.book-living-connection-link {
  cursor: pointer;
}

.book-living-connection-link:hover,
.book-living-connection-link:focus-visible {
  border-color: rgba(185, 160, 93, 0.55);
}

.book-living-connection-link small,
.book-living-connection-record small {
  color: rgba(244, 236, 216, 0.7);
}

.book-living-timeline {
  display: grid;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
}

.book-living-timeline-event {
  display: grid;
  grid-template-columns: minmax(7rem, auto) minmax(0, 1fr);
  gap: 0.2rem 0.75rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid rgba(185, 160, 93, 0.14);
}

.book-living-timeline-event time {
  color: rgba(244, 236, 216, 0.68);
}

.book-living-timeline-event p {
  grid-column: 2;
  margin: 0;
}

.book-living-full-timeline,
.book-living-reference-groups details {
  margin-top: 0.55rem;
}

.book-living-full-timeline summary,
.book-living-reference-groups summary {
  color: var(--gold);
  cursor: pointer;
}

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

  .book-living-timeline-event p {
    grid-column: 1;
  }
}

.library-sidebar-search {
  display: block;
  margin: 0.6rem 0 0.85rem;
}

.library-sidebar-search input {
  width: 100%;
  min-height: 2.3rem;
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  background: rgba(244, 236, 216, 0.06);
  font-size: 0.88rem;
}

.book-library-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-top: 1.2rem;
}

.book-library-related-list {
  display: grid;
  gap: 0.55rem;
}

.book-library-related-link {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  border: 1px solid rgba(185, 160, 93, 0.22);
  border-radius: 999px;
  padding: 0.65rem 0.9rem;
  color: var(--cream);
  background: rgba(185, 160, 93, 0.06);
  font: inherit;
  text-align: left;
  cursor: pointer;
}

.book-library-related-link:hover,
.book-library-related-link:focus-visible {
  border-color: var(--gold);
  color: var(--gold);
}

.book-library-related-link small {
  color: var(--muted);
  font-size: 0.75rem;
}

.book-library-related-group {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1.2rem;
}

.book-library-related-group h3 {
  margin: 0;
  color: var(--cream);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.book-library-chip-button {
  display: inline-flex;
  align-items: center;
  min-height: 2rem;
  border: 1px solid rgba(185, 160, 93, 0.26);
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  color: var(--gold);
  background: rgba(185, 160, 93, 0.06);
  font: inherit;
  font-size: 0.88rem;
  line-height: 1.2;
  cursor: pointer;
}

.book-library-chip-button:hover,
.book-library-chip-button:focus-visible {
  border-color: var(--gold);
  color: var(--cream);
}

.library-settings-columns {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

.library-settings-columns > div {
  border: 1px solid rgba(185, 160, 93, 0.22);
  border-radius: 0.9rem;
  padding: 0.9rem;
  background: rgba(8, 10, 8, 0.22);
}

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

/* =========================================================
   MY SANCTUARY SETTINGS CLEANUP
   Living Library settings layout
   ========================================================= */

.library-settings-columns {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.library-settings-columns > div {
  border: 1px solid rgba(185, 160, 93, 0.24);
  border-radius: 1rem;
  padding: 1rem;
  background: rgba(8, 10, 8, 0.28);
}

.library-settings-columns .eyebrow {
  margin-bottom: 0.75rem;
  color: var(--gold);
  font-size: 0.78rem;
  letter-spacing: 0.16em;
}

.library-settings-columns .my-sanctuary-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  margin: 0.45rem 0;
  line-height: 1.35;
}

.library-settings-columns .my-sanctuary-check input {
  flex: 0 0 auto;
  margin-top: 0.2rem;
}

@media (min-width: 900px) {
  .library-settings-columns {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

.book-library-edit-fields {
  display: grid;
  gap: 1.25rem;
}

.book-library-edit-field {
  display: grid;
  gap: 0.45rem;
}

.book-library-edit-field h3 {
  margin: 0;
  color: var(--gold);
  font-size: 1rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.book-library-rich-input {
  min-height: 7rem;
  border: 1px solid rgba(185, 160, 93, 0.24);
  border-radius: 1rem;
  padding: 1rem;
  color: var(--cream);
  background: rgba(8, 10, 8, 0.26);
  line-height: 1.7;
}

.book-library-rich-input:focus {
  outline: 2px solid rgba(185, 160, 93, 0.35);
  outline-offset: 3px;
}

.book-library-edit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.2rem;
}

.book-rich-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.book-rich-toolbar button {
  border: 1px solid rgba(185, 160, 93, 0.24);
  border-radius: 999px;
  padding: 0.3rem 0.65rem;
  color: var(--gold);
  background: rgba(185, 160, 93, 0.06);
  font: inherit;
  font-size: 0.82rem;
  cursor: pointer;
}

.book-rich-toolbar button:hover,
.book-rich-toolbar button:focus-visible {
  border-color: var(--gold);
  color: var(--cream);
}

.book-library-layer {
  border-top: 1px solid rgba(185, 160, 93, 0.22);
  padding-top: 2.2rem;
}

.book-library-fields {
  display: grid;
  gap: 1.4rem;
}

.book-library-field {
  padding-bottom: 0;
  border-bottom: 0 !important;
}

.book-library-field h3 {
  margin: 0 0 0.35rem;
  color: var(--gold);
  font-size: 0.82rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.book-library-field p,
.book-library-field ul,
.book-library-field ol,
.book-library-field blockquote {
  margin-top: 0;
}

.book-library-field blockquote {
  max-width: 38rem;
  border-left: 3px solid var(--gold);
  border-radius: 0.65rem;
  padding: 0.85rem 1rem;
  background: rgba(185, 160, 93, 0.07);
  font-style: italic;
}

.book-library-body .book-library-layer h2 {
  margin-bottom: 1.35rem;
}

.book-library-subsection {
  margin-top: 1.6rem;
}

.book-library-subsection h3 {
  margin: 0 0 0.85rem;
  color: var(--gold);
  font-size: clamp(1.25rem, 2vw, 1.75rem);
  line-height: 1.1;
}

.book-library-subsection .book-library-fields {
  gap: 1rem;
}

.book-library-subsection {
  margin-top: 0;
}

.book-library-subsection h3 {
  font-size: inherit;
}

.book-library-layer .book-library-field h3,
.book-library-layer--traditional .book-library-field h3,
.book-library-layer--my-practice .book-library-field h3,
.book-library-layer--community .book-library-field h3 {
  margin: 0 0 0.35rem;
  color: var(--gold);
  font-size: 0.82rem;
  line-height: 1.2;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.book-library-layer--traditional .book-library-fields,
.book-library-layer--my-practice .book-library-fields,
.book-library-layer--community .book-library-fields {
  display: grid;
  gap: 1.4rem;
}

.book-library-layer--traditional .book-library-field,
.book-library-layer--my-practice .book-library-field,
.book-library-layer--community .book-library-field {
  border-bottom: 0 !important;
  padding-bottom: 0;
}

.book-library-related-group h3 {
  margin: 0 0 0.35rem;
  color: var(--gold);
  font-size: 0.82rem;
  line-height: 1.2;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.book-library-related-group {
  display: grid;
  gap: 0.55rem;
  margin-bottom: 1.4rem;
}

.book-library-sticky-tools {
  position: sticky;
  top: 0.75rem;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 1.2rem auto 0;
  padding: 0.65rem;
  border: 1px solid rgba(185, 160, 93, 0.22);
  border-radius: 999px;
  background: rgba(12, 14, 10, 0.88);
  backdrop-filter: blur(12px);
}

.book-library-sticky-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.book-library-sticky-search input {
  min-height: 2.35rem;
  border-radius: 999px;
  padding: 0.45rem 0.8rem;
  background: rgba(244, 236, 216, 0.06);
}

.book-library-mundane-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  white-space: nowrap;
  border: 1px solid rgba(185, 160, 93, 0.25);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
}

@media (max-width: 700px) {
  .book-library-sticky-tools {
    align-items: stretch;
    border-radius: 1rem;
    flex-direction: column;
  }

  .book-library-sticky-left {
    flex-direction: column;
    align-items: stretch;
  }

  .book-library-sticky-search input,
  .book-library-sticky-left .button,
  .book-library-mundane-toggle {
    width: 100%;
  }
}
.book-library-entity-page > .book-page-tools,
.book-library-entity-page .book-reader-tools,
.book-library-entity-page .book-reader-search,
.book-library-entity-page [data-entry-search],
.book-library-entity-page [data-mundane-toggle]:not(.book-library-mundane-toggle input) {
  display: none;
}

.book-library-sticky-tools {
  margin: 0 0 2.25rem;
  top: 0.75rem;
}

.book-library-sticky-left {
  flex: 1;
}

.book-library-mundane-toggle {
  margin-left: auto;
}

.book-library-sticky-tools {
  position: sticky;
  top: 0.75rem;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0 0 2.25rem;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  backdrop-filter: none;
}

.book-library-sticky-left {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.55rem;
}

.book-library-mundane-toggle {
  margin-left: auto;
}

.book-page-toolbar {
  display: none;
}

.library-field-move {
  border: 1px solid rgba(185, 160, 93, 0.25);
  border-radius: 999px;
  margin-right: 0.25rem;
  padding: 0.1rem 0.35rem;
  color: var(--gold);
  background: rgba(185, 160, 93, 0.06);
  font: inherit;
  font-size: 0.72rem;
  cursor: pointer;
}

.library-field-hide {
  display: inline-flex;
  align-items: center;
  margin-right: 0.35rem;
}

.library-field-hide input {
  width: auto;
  accent-color: var(--gold);
}

.book-library-custom-field-row {
  margin-top: 1rem;
}

.book-library-edit-field h3 {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.library-field-hide {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  color: var(--muted);
  font-size: 0.72rem;
  letter-spacing: 0;
  text-transform: none;
}

.library-field-hide input {
  width: auto;
  accent-color: var(--gold);
}

.library-section-heading-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.library-section-controls {
  display: inline-flex;
  gap: 0.3rem;
}

.library-section-controls button {
  border: 1px solid rgba(185, 160, 93, 0.25);
  border-radius: 999px;
  padding: 0.15rem 0.45rem;
  color: var(--gold);
  background: rgba(185, 160, 93, 0.06);
  font: inherit;
  cursor: pointer;
}

.library-search-hidden {
  display: none !important;
}

.library-search-match {
  border-radius: 0.75rem;
  background: rgba(185, 160, 93, 0.08);
}

.book-library-hero-image {
  width: min(360px, 80%);
  margin: 0 auto 1.5rem;
  border: 1px solid rgba(185, 160, 93, 0.28);
  border-radius: 1.2rem;
  overflow: hidden;
  background: rgba(8, 10, 8, 0.34);
}

.book-library-hero-image img {
  display: block;
  width: 100%;
  height: auto;
}

.book-library-image-upload {
  cursor: pointer;
}

/* Hide only the old user-created page shelf, keep Living Library shelves */
#bookTocList,
.book-actions,
.book-note {
  display: none !important;
}

.book-library-sticky-tools {
  display: grid !important;
  grid-template-columns: minmax(120px, 1fr) auto auto auto auto;
  align-items: center;
  gap: 0.45rem;
}

.book-library-sticky-left {
  display: contents !important;
}

.book-library-sticky-search input {
  min-height: 2rem;
  padding: 0.3rem 0.65rem;
  font-size: 0.82rem;
}

.book-library-sticky-tools .button,
.book-library-mundane-toggle {
  min-height: 2rem;
  padding: 0.3rem 0.6rem;
  font-size: 0.78rem;
  white-space: nowrap;
}

.book-library-image-upload {
  white-space: nowrap;
}

.book-library-mundane-toggle {
  margin-left: 0;
}

.global-library-search-results {
  display: grid;
  gap: 0.45rem;
  margin: 0.75rem 0 1.5rem;
  padding: 0.75rem;
  border: 1px solid rgba(185, 160, 93, 0.2);
  border-radius: 1rem;
  background: rgba(8, 10, 8, 0.38);
}

.global-library-search-results button {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  border: 1px solid rgba(185, 160, 93, 0.18);
  border-radius: 999px;
  padding: 0.45rem 0.75rem;
  color: var(--cream);
  background: rgba(185, 160, 93, 0.06);
  font: inherit;
  cursor: pointer;
}

.global-library-search-results small {
  color: var(--gold);
}

/* ==========================================================
   MOBILE GRIMOIRE (PHASE 1)
   ========================================================== */

@media (max-width: 900px) {

  /* ---------- Overall Layout ---------- */

  .grimoire-layout,
  .book-layout {
    display: block;
  }

  .book-reader {
    width: 100%;
    min-width: 0;
  }

  .book-reader-page {
    padding: 1rem;
  }

  /* ---------- Sidebar ---------- */

  .book-sidebar,
  .book-toc,
  .grimoire-sidebar {
    width: 100%;
    max-width: none;
    margin-bottom: 1rem;
    max-height: 40vh;
    overflow-y: auto;
    border-radius: 18px;
  }

  /* ---------- Search ---------- */

  .library-sidebar-search input,
  .book-library-sticky-search input {
    width: 100%;
    min-height: 44px;
    font-size: 16px;
  }

  /* ---------- Sticky Toolbar ---------- */

  .book-library-sticky-tools {
    display: flex;
    flex-wrap: wrap;
    gap: .5rem;
    align-items: center;
  }

  .book-library-sticky-tools .button,
  .book-library-sticky-tools button,
  .book-library-mundane-toggle {

    min-height: 44px;
    font-size: .85rem;
    white-space: nowrap;
  }

  .book-library-sticky-search {
    flex: 1 1 100%;
  }

  /* ---------- Images ---------- */

  .book-library-hero-image img,
  .book-library-field img,
  .book-reader img {

    max-width: 100%;
    height: auto;
    display: block;
  }

  /* ---------- Rich Text ---------- */

  .book-rich-toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
  }

  .book-rich-toolbar button {
    min-width: 44px;
    min-height: 44px;
    font-size: .9rem;
  }

  /* ---------- Inputs ---------- */

  textarea,
  input,
  select {

    width: 100%;
    font-size: 16px;
  }

  textarea {
    min-height: 120px;
  }

  /* ---------- Custom Fields ---------- */

  .book-library-edit-field h3 {

    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    align-items: center;
  }

  .library-field-move {

    min-width: 40px;
    min-height: 40px;
  }

  /* ---------- Chips ---------- */

  .book-library-chips {

    display: flex;
    flex-wrap: wrap;
    gap: .45rem;
  }

  .book-library-chip-button {

    max-width: 100%;
    white-space: normal;
  }

  /* ---------- Tables ---------- */

  table {

    display: block;
    overflow-x: auto;
    width: 100%;
  }

  /* ---------- Modals ---------- */

  .book-modal {

    width: 95vw;
    max-width: 650px;
    max-height: 90vh;
    overflow-y: auto;
  }

  /* ---------- Search Results ---------- */

  .global-library-search-results button {

    display: flex;
    flex-direction: column;
    align-items: flex-start;
  }

}


/* ==========================================================
   PORTRAIT PHONES
   ========================================================== */

@media (max-width: 600px) {

  .book-reader-page {
    padding: .8rem;
  }

  .book-library-header h1 {
    font-size: 1.8rem;
    text-align: center;
  }

  .book-library-intro {
    text-align: center;
  }

  .book-library-sticky-tools {

    position: sticky;
    top: 0;
    z-index: 50;

    padding: .75rem;

    background: rgba(15,15,15,.95);
    backdrop-filter: blur(12px);

    border-radius: 14px;

    margin-bottom: 1rem;
  }

  .book-library-layer {

    padding: 1rem;
  }

}

/* ==========================================================
   MOBILE SIDEBAR DRAWER
   ========================================================== */

.grimoire-menu-button{
    display:none;
}

.grimoire-sidebar-overlay{
    display:none;
}

@media (max-width:900px){

    .grimoire-menu-button{
        display:flex;
        align-items:center;
        justify-content:center;

        width:44px;
        height:44px;

        font-size:1.4rem;

        border:none;
        border-radius:12px;

        cursor:pointer;
    }

   .book-sidebar,
.book-toc,
.grimoire-sidebar {
  position: fixed;

  top: 0;
  left: 0;

  width: min(340px, 85vw);
  height: 100vh;

  max-height: none;
  margin: 0;

  z-index: 300;

  transform: translateX(-105%);
  transition: .28s ease;

  overflow-y: auto;

  background:
    radial-gradient(circle at top, rgba(185, 160, 93, 0.12), transparent 18rem),
    linear-gradient(145deg, rgba(9, 16, 11, 0.98), rgba(3, 5, 4, 0.99));

  box-shadow: 18px 0 80px rgba(0, 0, 0, 0.72);
}

.book-sidebar.mobile-open,
.book-toc.mobile-open,
.grimoire-sidebar.mobile-open {
  transform: translateX(0);
}

/* =========================================================
   MOBILE GRIMOIRE EDITING POLISH
   ========================================================= */

@media (max-width: 700px) {
  .grimoire-main {
    width: 100%;
    padding: 1rem 0 5rem;
  }

  .grimoire-cover {
    padding: 0 1rem;
    margin-bottom: 1rem;
  }

  .grimoire-cover h1 {
    max-width: none;
    font-size: clamp(3.1rem, 16vw, 4.6rem);
  }

  .book-of-shadows {
    display: block;
  }

  .book-page {
    width: 100%;
    min-height: auto;
    border-left: 0 !important;
    border-right: 0 !important;
    border-radius: 0 !important;
    padding: 1rem !important;
  }

  .book-page-toolbar,
  .book-library-sticky-tools {
    position: sticky;
    top: 0.65rem;
    z-index: 50;
    display: flex;
    flex-wrap: nowrap;
    align-items: center;
    gap: 0.45rem;
    margin-bottom: 1rem;
    padding: 0.45rem;
    border: 1px solid rgba(185, 160, 93, 0.28);
    border-radius: 999px;
    background: rgba(8, 10, 8, 0.88);
    backdrop-filter: blur(12px);
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: none;
  }

  .book-page-toolbar::-webkit-scrollbar,
  .book-library-sticky-tools::-webkit-scrollbar {
    display: none;
  }

  .book-page-toolbar > *,
  .book-library-sticky-tools > * {
    flex: 0 0 auto;
  }

  .book-search,
  .book-library-sticky-search {
    width: min(13rem, 52vw);
  }

  .book-search span {
    display: none;
  }

  .book-search input,
  .book-library-sticky-search input {
    min-height: 2.35rem;
    padding: 0.45rem 0.75rem;
    font-size: 0.85rem;
  }

  .book-edit-button,
  .book-page-toolbar .button,
  .book-library-sticky-tools .button,
  .book-mundane-toggle,
  .book-library-mundane-toggle,
  .grimoire-menu-button {
    min-height: 2.35rem;
    border-radius: 999px;
    padding: 0.45rem 0.7rem;
    white-space: nowrap;
    font-size: 0.82rem;
  }

  .book-reader-page,
  .book-editor-page {
    padding-inline: 0 !important;
  }

  .book-editor-header {
    gap: 0.8rem;
  }

  .book-editor-header input {
    font-size: clamp(2.1rem, 13vw, 3.4rem);
  }

  .book-editor-actions {
    position: sticky;
    top: 4.2rem;
    z-index: 45;
    display: flex;
    flex-wrap: nowrap;
    gap: 0.45rem;
    margin: 0 -0.25rem 1rem;
    padding: 0.45rem;
    border: 1px solid rgba(185, 160, 93, 0.25);
    border-radius: 999px;
    background: rgba(8, 10, 8, 0.88);
    backdrop-filter: blur(12px);
    overflow-x: auto;
    scrollbar-width: none;
  }

  .book-editor-actions::-webkit-scrollbar {
    display: none;
  }

  .book-editor-actions button,
  .book-editor-actions .button {
    flex: 0 0 auto;
    min-height: 2.3rem;
    padding: 0.42rem 0.7rem;
    font-size: 0.8rem;
    white-space: nowrap;
  }

  .book-editor-elements {
    gap: 0.85rem;
  }

  .book-edit-element {
    padding: 0.85rem;
    border-radius: 1rem;
  }

  .book-element-controls {
    justify-content: flex-start;
    gap: 0.35rem;
    overflow-x: auto;
    flex-wrap: nowrap;
    scrollbar-width: none;
  }

  .book-element-controls::-webkit-scrollbar {
    display: none;
  }

  .book-element-controls button {
    flex: 0 0 auto;
    min-width: 2.15rem;
    min-height: 2.15rem;
  }

  .book-rich-toolbar {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    border-radius: 1rem;
    padding: 0.45rem;
  }

  .book-rich-toolbar button {
    min-height: 2rem;
    padding: 0.3rem 0.55rem;
    font-size: 0.76rem;
  }

  .book-rich-input,
  .book-library-rich-input {
    min-height: 9rem;
    border-radius: 1rem;
    font-size: 1rem;
  }

  .book-rich-heading {
    min-height: 4rem;
    font-size: clamp(1.8rem, 10vw, 2.8rem);
  }

  .book-add-elements {
    gap: 0.85rem;
    margin-top: 1rem;
    padding-top: 1rem;
  }

  .book-element-group div {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
  }

  .book-add-elements button,
  .book-element-group button {
    min-height: 2.25rem;
    padding: 0.45rem 0.7rem;
    font-size: 0.8rem;
  }

  .book-library-edit-fields {
    gap: 1rem;
  }

  .book-library-edit-field {
    padding: 0.85rem;
    border: 1px solid rgba(185, 160, 93, 0.2);
    border-radius: 1rem;
    background: rgba(244, 236, 216, 0.035);
  }

  .book-library-edit-field h3 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.8rem;
  }

  .library-field-move {
    min-width: 2rem;
    min-height: 2rem;
  }

  .library-field-hide {
    display: inline-flex;
    align-items: center;
    width: auto;
    gap: 0.3rem;
    font-size: 0.78rem;
  }

  .library-field-hide input {
    width: auto;
  }

  .book-library-edit-actions {
    position: sticky;
    bottom: 0.75rem;
    z-index: 45;
    display: flex;
    flex-wrap: nowrap;
    gap: 0.45rem;
    padding: 0.45rem;
    border: 1px solid rgba(185, 160, 93, 0.25);
    border-radius: 999px;
    background: rgba(8, 10, 8, 0.88);
    backdrop-filter: blur(12px);
    overflow-x: auto;
  }

  .book-library-edit-actions button {
    flex: 0 0 auto;
  }

  .book-modal {
    max-height: 88vh;
    border-radius: 1rem;
  }

  .book-modal h2 {
    font-size: clamp(2.2rem, 12vw, 3.3rem);
  }
}

/* =========================================================
   MOBILE GRIMOIRE TOP TOOLBAR FIX
   ========================================================= */

@media (max-width: 700px) {
  .book-page-toolbar {
    justify-content: flex-start;
    border-radius: 1rem;
    padding: 0.45rem;
  }

  .grimoire-menu-button {
    display: inline-grid;
    place-items: center;
    flex: 0 0 auto;
    width: 2.35rem;
    height: 2.35rem;
    min-height: 2.35rem;
    border: 1px solid rgba(185, 160, 93, 0.34);
    border-radius: 999px;
    padding: 0;
    color: var(--gold);
    background: rgba(185, 160, 93, 0.08);
    font: inherit;
    font-size: 0.9rem;
  }

  .book-page-toolbar .book-search {
    flex: 1 1 auto;
    min-width: 9rem;
    width: auto;
  }

  .book-page-toolbar .book-search input {
    width: 100%;
  }

  .book-page-toolbar .book-mundane-toggle {
    flex: 0 0 auto;
    padding: 0.45rem 0.65rem;
  }

  .book-page-toolbar .book-edit-button {
    flex: 0 0 auto;
  }
}

@media (max-width: 430px) {
  .book-page-toolbar .book-mundane-toggle span {
    display: none;
  }

  .book-page-toolbar .book-mundane-toggle {
    width: 2.35rem;
    justify-content: center;
    padding: 0;
  }
}

.grimoire-sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 998;

   background:
    radial-gradient(circle at center,
        rgba(30, 24, 14, 0.35),
        rgba(0, 0, 0, 0.88));

  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);

  opacity: 0;
  visibility: hidden;
  transition: opacity .25s ease, visibility .25s ease;
}

.grimoire-sidebar-overlay.show {
  opacity: 1;
  visibility: visible;
}

/* =========================================================
   MOBILE LIBRARY TOOLBAR FINAL CLEANUP
   Row 1: Menu / Search / Mundane checkbox
   Row 2: Edit / Delete / Upload Image
   ========================================================= */

@media (max-width: 700px) {
  .book-library-sticky-tools {
    display: grid !important;
    grid-template-columns: 2.35rem minmax(0, 1fr) 2.35rem;
    gap: 0.5rem;
    align-items: center;
    padding: 0.6rem;
    border-radius: 1rem;
    overflow: visible;
  }

  .book-library-sticky-left {
    display: contents !important;
  }

  .book-library-sticky-left .grimoire-menu-button {
    grid-column: 1;
    grid-row: 1;
    width: 2.35rem;
    height: 2.35rem;
    min-height: 2.35rem;
    padding: 0;
  }

  .book-library-sticky-search {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
    width: 100%;
  }

  .book-library-sticky-search input {
    width: 100%;
    min-height: 2.35rem;
  }

  .book-library-mundane-toggle {
    grid-column: 3;
    grid-row: 1;
    display: grid !important;
    place-items: center;
    width: 2.35rem;
    min-width: 2.35rem;
    height: 2.35rem;
    min-height: 2.35rem;
    padding: 0 !important;
    border-radius: 999px;
    font-size: 0;
  }

  .book-library-mundane-toggle input {
    width: auto;
    margin: 0;
    font-size: initial;
  }

  .book-library-edit-actions {
    grid-column: 1 / -1;
    grid-row: 2;
    position: static !important;
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0.5rem;
    width: 100%;
    padding: 0;
    border: 0;
    background: transparent;
    backdrop-filter: none;
    overflow: visible;
  }

  .book-library-edit-actions .button,
  .book-library-edit-actions .book-library-image-upload {
    width: 100%;
    min-height: 2.35rem;
    padding: 0.45rem 0.5rem;
    justify-content: center;
    text-align: center;
    white-space: nowrap;
    font-size: 0.78rem;
  }
}

/* =========================================================
   MOBILE GRIMOIRE SIDEBAR
   ========================================================= */

@media (max-width: 700px) {

  .book-toc.mobile-open,
  .book-sidebar.mobile-open,
  .grimoire-sidebar.mobile-open {
    z-index: 1001 !important;

    background:
      radial-gradient(
        circle at top,
        rgba(185, 160, 93, 0.12),
        transparent 18rem
      ),
      linear-gradient(
        145deg,
        rgba(9, 16, 11, 0.98),
        rgba(3, 5, 4, 0.99)
      ) !important;

    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);

    box-shadow: 18px 0 80px rgba(0, 0, 0, 0.72);
  }

  .grimoire-sidebar-overlay,
  #grimoireSidebarOverlay {
    position: fixed;
    inset: 0;

    z-index: 1000 !important;

    background: rgba(0, 0, 0, 0.78) !important;

    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);

    opacity: 0;
    visibility: hidden;
    pointer-events: none;
  }

  .grimoire-sidebar-overlay.show,
  #grimoireSidebarOverlay.show {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto;
  }
}

/* =========================================================
   FINAL MOBILE TOC DRAWER BACKGROUND FIX
   Must stay at the very bottom of grimoire.css
   ========================================================= */

@media (max-width: 900px) {
  .book-of-shadows .book-toc.mobile-open,
  body .book-toc.mobile-open,
  body .book-sidebar.mobile-open,
  body .grimoire-sidebar.mobile-open {
    background:
      radial-gradient(circle at top, rgba(185, 160, 93, 0.16), transparent 18rem),
      linear-gradient(145deg, #09100b 0%, #050806 58%, #020302 100%) !important;

    background-color: #050806 !important;
    opacity: 1 !important;

    border-right: 1px solid rgba(185, 160, 93, 0.38) !important;
    box-shadow: 18px 0 90px rgba(0, 0, 0, 0.85) !important;

    backdrop-filter: none !important;
    -webkit-backdrop-filter: none !important;
  }

  .book-of-shadows .book-toc.mobile-open *,
  body .book-toc.mobile-open *,
  body .book-sidebar.mobile-open *,
  body .grimoire-sidebar.mobile-open * {
    opacity: 1 !important;
  }

  #grimoireSidebarOverlay.show,
  .grimoire-sidebar-overlay.show {
    background: rgba(0, 0, 0, 0.82) !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }
}
}
/* Hide regular Book sections while viewing Living Library pages */

body.library-page-open .book-toc [data-grimoire-section],
body.library-page-open .book-toc .book-section:not(.my-practice-shelf):not(.traditional-library-shelf),
body.library-page-open .book-toc .book-toc-section:not(.my-practice-shelf):not(.traditional-library-shelf):not([data-my-practice-shelf]):not([data-traditional-library-shelf]) {
  display: none !important;
}

.library-image-manager {
  display: grid;
  gap: 1rem;
}

.library-image-manager .book-library-hero-image {
  max-width: 14rem;
  margin: 0 auto;
}

.library-image-manager label {
  display: grid;
  gap: 0.45rem;
}

/* =========================================================
   COMMUNITY GRIMOIRE PAGE
   ========================================================= */

.community-grimoire-page {
  display: grid;
  gap: 2rem;
}

.community-grimoire-intro {
  max-width: 900px;
  margin: 0 auto;
  text-align: center;
}

.community-grimoire-intro h1 {
  max-width: none;
  margin-inline: auto;
  font-size: clamp(3.5rem, 9vw, 7rem);
}

.community-grimoire-intro p {
  max-width: 760px;
  margin-inline: auto;
}

.community-grimoire-card {
  width: min(1100px, 100%);
  margin-inline: auto;
  padding: clamp(1.5rem, 4vw, 2.5rem);
  border: 1px solid var(--line);
  border-radius: 1rem;
  background: linear-gradient(145deg, rgba(38, 61, 46, 0.82), rgba(17, 21, 18, 0.9));
  box-shadow: var(--shadow);
}

.community-grimoire-tools {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 1rem;
  margin: 0 0 1.5rem;
}

.community-grimoire-tools input,
.community-grimoire-tools select {
  min-height: 3rem;
  border-radius: 999px;
  background: rgba(18, 13, 10, 0.72);
}

.community-grimoire-status {
  margin: 1rem 0 0;
  color: var(--muted);
  font-style: italic;
  text-align: center;
}

.community-grimoire-list {
  display: grid;
  gap: 1rem;
  margin-top: 1.5rem;
}

.community-grimoire-offer {
  text-align: center;
}

.community-grimoire-offer h2 {
  max-width: none;
  margin-inline: auto;
}

.community-grimoire-offer p {
  max-width: 720px;
  margin-inline: auto;
}

.community-grimoire-offer .button {
  margin-top: 1rem;
}

@media (max-width: 720px) {
  .community-grimoire-tools {
    grid-template-columns: 1fr;
  }
}

.ritual-record { display: grid; gap: 1rem; max-width: 52rem; margin-inline: auto; }
.ritual-record-facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr)); gap: .7rem; margin: 0; }
.ritual-record-facts div, .ritual-record-section { padding: 1rem; border: 1px solid rgba(196, 165, 96, .3); border-radius: .75rem; background: rgba(18, 13, 10, .62); }
.ritual-record-facts dt { color: var(--gold); font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; }
.ritual-record-facts dd { margin: .3rem 0 0; }
.ritual-record-section h2 { margin: 0 0 .6rem; color: var(--gold); font-size: 1.25rem; }
.ritual-record-section p { margin: 0; white-space: pre-wrap; line-height: 1.65; }
.ritual-record-chips { display: flex; flex-wrap: wrap; gap: .45rem; }
.ritual-record-chips span { padding: .35rem .65rem; border: 1px solid rgba(196, 165, 96, .35); border-radius: 999px; }
.ritual-record-details { overflow-wrap: anywhere; color: var(--muted); }
