/* Sacralib V2.22 — responsive long-form content polish.
   Only the owner's V2 preview. Existing data, maps and game controls are untouched.
   Loaded after V2.21; no global zoom or fixed-width card assumptions. */

/* Full-length, soft lower-edge transition. In V2.21 the 480px mask hid most
   of the 160x2048/152x2048 artwork after it had been proportionally sized. */
body.sv218-page-theme.sv217-page-theme.sv216-page-theme.codex-site-v2-current:not(.codex-site-v2-home)
:is(#articleView,#libraryView,#guidesView,#experienceView,#mapsView,#ratingView,#onlineView,#chatView,#armoryView,#marketView,#game-marketView,#set-compareView,#bugsView,#patch-notesView).active::before,
body.sv218-page-theme.sv217-page-theme.sv216-page-theme.codex-site-v2-current:not(.codex-site-v2-home)
:is(#articleView,#libraryView,#guidesView,#experienceView,#mapsView,#ratingView,#onlineView,#chatView,#armoryView,#marketView,#game-marketView,#set-compareView,#bugsView,#patch-notesView).active::after {
  -webkit-mask-image:linear-gradient(to bottom,#000 0%,#000 73%,rgba(0,0,0,.95) 79%,rgba(0,0,0,.72) 88%,rgba(0,0,0,.34) 96%,transparent 100%)!important;
  mask-image:linear-gradient(to bottom,#000 0%,#000 73%,rgba(0,0,0,.95) 79%,rgba(0,0,0,.72) 88%,rgba(0,0,0,.34) 96%,transparent 100%)!important;
}

/* All article content stays inside its main column, even when an old block
   declares an explicit number of content columns. Never break the article TOC. */
body.sv218-page-theme.codex-article-v2-active .cv2-layout .cv2-main,
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body,
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body > * {
  min-width:0;
  max-width:100%;
}

/* Dungeon floor maps and illustrated galleries: give the original drawing the
   available width; wider interactive contents remain scrollable, not clipped.
   We do NOT alter the map coordinate system, click targets or global page zoom. */
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.content-columns:has(.content-image),
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.content-columns:has(.content-world-map) {
  grid-template-columns:repeat(auto-fit,minmax(min(100%,590px),1fr))!important;
  align-items:start!important;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
:is(.content-image,.content-world-map,.content-map,.map-grid,.dungeon-map) {
  box-sizing:border-box;min-width:0;max-width:100%;
  overflow-x:auto;overscroll-behavior-x:contain;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.content-image img {
  display:block!important;width:auto!important;max-width:100%!important;
  height:auto!important;max-height:none!important;object-fit:contain!important;
  margin-inline:auto;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.content-column > :is(.content-image,.content-world-map) {
  height:auto!important;align-self:start!important;
}

/* Database cards in old manually authored columns must never become five
   letter-width columns in the new three-rail article layout. */
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.content-columns:has(.database-card),
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.bestiary-masonry,
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.bestiary-filter-results,
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.chaos-article-masonry {
  display:grid!important;
  grid-template-columns:repeat(auto-fit,minmax(min(100%,410px),1fr))!important;
  gap:12px!important;align-items:start!important;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
:is(.content-column,.bestiary-masonry-item,.bestiary-filter-result,.database-card) {
  min-width:0!important;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.content-column > .database-card {height:auto!important;align-self:start!important;}

/* Item, appearance and Chaos/bestiary cards — protect text area from narrow
   nested CSS grids. Long descriptions use a whole row, not one-character cells. */
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
:is(.database-card-type-items,.database-card-appearance,.database-card-monster,.database-card-type-monsters) {
  box-sizing:border-box;min-width:0!important;max-width:100%!important;
  height:auto!important;overflow-wrap:normal!important;word-break:normal!important;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
:is(.database-card-monster,.database-card-type-monsters) {
  grid-template-columns:minmax(110px,155px) minmax(0,1fr)!important;
  align-items:start!important;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
:is(.database-card-monster,.database-card-type-monsters) :is(.database-card-main,.database-card-content,.database-card-lines) {
  min-width:0!important;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
:is(.database-card-monster,.database-card-type-monsters) .database-card-lines {
  display:grid!important;grid-template-columns:minmax(0,1fr)!important;
  gap:5px!important;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.database-card-lines > div {
  min-width:0!important;max-width:100%!important;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.database-card-lines :is(b,span) {
  min-width:0!important;overflow-wrap:break-word!important;word-break:normal!important;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.database-card-type-items .database-card-lines > div,
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.database-card-appearance .database-card-lines > div {
  grid-template-columns:minmax(0,1fr)!important;
  gap:3px!important;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
:is(.database-card-monster,.database-card-type-monsters) .database-card-image {
  box-sizing:border-box;max-width:100%!important;object-fit:contain!important;
}

/* Compact combo cards: eliminate excessive full-height equalization and
   reduce unused spacing. Text/sequence wrap by words or whole zone tokens. */
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.database-card-type-combo {
  height:auto!important;align-self:start!important;min-width:0!important;
  grid-template-columns:62px minmax(0,1fr)!important;
  gap:8px!important;padding:10px!important;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.database-card-type-combo .database-card-image {
  width:56px!important;max-width:56px!important;height:auto!important;
  max-height:65px!important;object-fit:contain!important;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.database-card-type-combo .database-card-lines {
  grid-column:1/-1!important;min-width:0!important;
  gap:4px!important;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.database-card-type-combo .database-card-lines > div {
  grid-template-columns:minmax(0,1fr)!important;gap:4px!important;
  padding-block:4px!important;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
:is(.combo-sequence,.combo-finisher) {
  display:flex!important;flex-wrap:wrap!important;align-items:center!important;
  gap:4px!important;min-width:0!important;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.combo-zone {max-width:100%;min-width:0;padding:3px 6px!important;font-size:clamp(12px,.9vw,15px)!important;}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.combo-steps {margin:5px 0 0!important;padding-left:20px!important;font-size:clamp(13px,1vw,16px)!important;line-height:1.43!important;}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.combo-steps li {margin-bottom:3px!important;}

/* Quest article: one complete dossier per line at every desktop width.
   Do not alter separate quest editor preview or saved quest records. */
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.quest-block.quest-v2-block > .quest-grid {
  display:grid!important;grid-template-columns:minmax(0,1fr)!important;
  gap:14px!important;align-items:start!important;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.quest-card.quest-v2-card {
  min-width:0!important;max-width:100%!important;height:auto!important;
  border-radius:5px!important;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.quest-v2-card-head {grid-template-columns:auto minmax(0,1fr) auto!important;min-width:0!important;}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.quest-v2-card-head.quest-v2-no-avatar {grid-template-columns:minmax(0,1fr) auto!important;}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.quest-v2-title-wrap {min-width:0!important;overflow-wrap:normal!important;word-break:normal!important;}

/* FAQ: stretch heading containers across article width to avoid artificial
   short lines; keep questions compact. On tiny phones allow natural wrapping. */
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.faq-list {width:100%!important;max-width:100%!important;min-width:0!important;}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.faq-item summary {
  width:100%!important;box-sizing:border-box!important;min-width:0!important;
  font-size:clamp(14px,1.15vw,18px)!important;line-height:1.27!important;
  white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
.faq-item summary::before {flex:0 0 20px!important;}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
:is(.faq-list,.faq-section,.faq-category) > :is(h2,h3,h4) {
  display:block!important;width:100%!important;max-width:100%!important;
  box-sizing:border-box!important;min-width:0!important;
  font-size:clamp(16px,1.25vw,21px)!important;
  white-space:normal!important;overflow-wrap:normal!important;word-break:normal!important;
}

/* FAQ section headers previously inherited small fit-content callout widths,
   making e.g. "Предметы, сундуки и лут" break into two lines despite free space. */
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body:has(.faq-list)
> :is(h2,h3,h4,.content-callout) {
  box-sizing:border-box!important;width:100%!important;max-width:100%!important;
  min-width:0!important;
}
body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body:has(.faq-list)
> :is(h2,h3,h4) {
  font-size:clamp(17px,1.3vw,22px)!important;
  white-space:nowrap!important;overflow:hidden!important;text-overflow:ellipsis!important;
}

/* Patch notes need the same parchment panels/bronze borders as the rest of V2,
   including entries with double-digit numbered bullet points (11,12,...). */
body.sv218-page-theme #patch-notesView.active .patch-notes-page {
  width:min(100%,1520px)!important;max-width:100%!important;
  margin-inline:auto!important;color:#38291f!important;
  font-family:Georgia,serif!important;
}
body.sv218-page-theme #patch-notesView.active :is(.patch-notes-hero,.patch-notes-controls,.patch-note-card) {
  box-sizing:border-box!important;border:1px solid #d6bea0!important;
  border-radius:4px!important;box-shadow:0 2px 9px rgba(60,40,20,.08)!important;
  background:linear-gradient(160deg,#fffaf1,#f4ebdc)!important;
  color:#35271d!important;
}
body.sv218-page-theme #patch-notesView.active .patch-notes-hero {padding:22px!important;}
body.sv218-page-theme #patch-notesView.active .patch-notes-hero h2 {
  font:600 clamp(25px,2.25vw,37px)/1.15 Georgia,serif!important;
  color:#30231b!important;
}
body.sv218-page-theme #patch-notesView.active .patch-notes-feed {
  display:grid!important;grid-template-columns:minmax(0,1fr)!important;gap:12px!important;
}
body.sv218-page-theme #patch-notesView.active .patch-note-card {min-width:0!important;padding:17px 19px!important;}
body.sv218-page-theme #patch-notesView.active .patch-note-card h3 {
  color:#3c2a20!important;font:600 clamp(19px,1.5vw,24px)/1.25 Georgia,serif!important;
}
body.sv218-page-theme #patch-notesView.active .patch-note-text {min-width:0!important;overflow-wrap:break-word!important;word-break:normal!important;}
body.sv218-page-theme #patch-notesView.active .patch-note-point {
  display:grid!important;grid-template-columns:29px minmax(0,1fr)!important;
  align-items:start!important;gap:9px!important;min-width:0!important;
  margin:0!important;padding:7px 0!important;border-bottom:1px solid #e3d3bb!important;
}
body.sv218-page-theme #patch-notesView.active .patch-note-point-number {
  display:grid!important;place-items:center!important;
  width:27px!important;height:27px!important;min-width:27px!important;
  border:1px solid #c9a886!important;border-radius:4px!important;
  background:#f5ecdf!important;color:#763c30!important;
  font:600 12px/1 Georgia,serif!important;
}
body.sv218-page-theme #patch-notesView.active .patch-note-point-text {
  min-width:0!important;max-width:100%!important;white-space:normal!important;
  overflow-wrap:break-word!important;word-break:normal!important;
  font:400 15px/1.55 Georgia,serif!important;
}
@media(max-width:820px){
 body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
 :is(.content-columns,.bestiary-masonry,.bestiary-filter-results,.chaos-article-masonry) {
   grid-template-columns:minmax(0,1fr)!important;
 }
 body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
 :is(.database-card-monster,.database-card-type-monsters) {
   grid-template-columns:minmax(100px,140px) minmax(0,1fr)!important;
 }
 body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
 .faq-item summary{font-size:14px!important;white-space:normal!important;}
 body.sv218-page-theme #patch-notesView.active .patch-notes-hero {padding:14px!important;}
 body.sv218-page-theme #patch-notesView.active .patch-note-card {padding:13px!important;}
}
@media(max-width:460px){
 body.sv218-page-theme.codex-article-v2-active .cv2-layout .article-body
 :is(.database-card-monster,.database-card-type-monsters){grid-template-columns:minmax(0,1fr)!important;}
}
