/**
 * entity.css — СТРАНИЦА СУЩНОСТИ (DETAIL VIEW)
 *
 * Содержит:
 * - detail pane (правая панель)
 * - breadcrumb
 * - tag-row / теги
 * - заголовок сущности
 * - кнопки действий
 * - stats grid (4-up)
 * - секции (.block)
 * - prose (описания)
 * - def-grid (таблица деталей)
 * - pill-list (классы, риси)
 * - source-line
 * - header сущности (sb-header)
 *
 * ⚠️ НЕ содержит:
 * - layout (app.css)
 * - catalog / карточки (catalog.css)
 */

/* ==========================================================================
   DETAIL PANE
   ========================================================================== */
.detail,
.detail-pane {
    flex: 1;
    overflow-y: auto;
    background: var(--bg-body);
    min-width: 0;
}

.detail-inner {
    max-width: 820px;
    margin: 0 auto;
    padding: 32px 40px 80px;
}

/* ==========================================================================
   BREADCRUMB
   ========================================================================== */
.breadcrumb {
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin-bottom: 28px;
}

.breadcrumb a { color: var(--text-muted); }
.breadcrumb a:hover { color: var(--text-main); }
.breadcrumb .sep { opacity: 0.5; }

/* ==========================================================================
   TAG ROW
   ========================================================================== */
.tag-row {
    display: flex;
    gap: 6px;
    margin-bottom: 12px;
    flex-wrap: wrap;
    align-items: anchor-center;
}

.tag {
    font-size: 11px;
    font-weight: 500;
    padding: 3px 10px;
    border-radius: var(--radius-sm);
    background: var(--bg-sunken);
    color: var(--text-soft);
    border: 1px solid var(--line-soft);
}

.tag.accent {
    border-color: transparent;
    background: var(--accent-bg);
    color: var(--accent);
}

.tag.source {
    font-family: var(--font-mono);
    font-size: 10px;
    letter-spacing: 0.04em;
}

.dnd-inline-roll {
    color: var(--school-tran);
    font-weight: 600;
    cursor: pointer;;
}

/* ==========================================================================
   ENTRY TITLE
   ========================================================================== */
h1.entry-title {
    font-family: var(--font-serif);
    font-size: 48px;
    font-weight: 500;
    max-width: 540px;
    line-height: 1.05;
    letter-spacing: -0.02em;
    color: var(--text-main);
    margin: 0 0 6px;
}

.entry-subtitle {
    font-family: var(--font-serif);
    font-style: italic;
    font-size: 18px;
    color: var(--text-muted);
    font-weight: 400;
}


/* ============ PORTAL POPUP (big multi-column) ============ */
.portal-pop {
  position: fixed;
  top: 45px; left: 72px;
  transform: translateX(-12px);
  transform-origin: top left;
  width: min(980px, calc(100vw - 80px));
  max-height: calc(100vh - 28px);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow-pop);
  z-index: 61;
  opacity: 0; pointer-events: none;
  transition: transform .28s cubic-bezier(.2,.9,.25,1), opacity .2s;
  display: flex; flex-direction: column;
  overflow: hidden;
}
.portal-pop.open {
  opacity: 1; pointer-events: auto;
  transform: translateX(0);
}
.pp-head {
  padding: 30px 35px 16px;
  display: flex; align-items: center; gap: 14px;
  border-bottom: 1px solid var(--line-soft);
}
.pp-logo {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--ink); color: var(--bg-panel);
  display: grid; place-items: center;
  font-family: var(--font-mono), serif; font-weight: 600; font-size: 18px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}
.pp-titles { flex: 1; min-width: 0; }
.pp-title {
  font-size: 20px; font-weight: 500;
  letter-spacing: -0.01em; color: var(--ink);
  line-height: 1.1;
}
.pp-meta {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px; color: var(--ink-mute);
  letter-spacing: 0.04em; text-transform: uppercase;
  margin-top: 4px;
}
.pp-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 28px;
  padding: 24px 35px 28px;
  flex: 1;
  position: relative;
  z-index: 2;
  overflow: hidden;
}
.pp-col { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pp-coltitle {
  font-family: 'Geist Mono', monospace;
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--ink-mute);
  padding-bottom: 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--line-soft);
}
.pp-link {
  font-family: var(--font-main);
  font-size: 13px; color: var(--ink);
  padding: 6px 0;
  text-decoration: none;
  transition: color .14s, padding-left .14s;
  border-bottom: 1px dashed transparent;
}
.pp-link:hover { color: var(--accent); padding-left: 6px; }
.pp-link.current { color: var(--accent); font-weight: 500; }
.pp-mascot {
    position: absolute;
    right: -22px;
    bottom: 0;
    width: 175px;
    opacity: 0.7;
    pointer-events: none;
    z-index: -1;
}
.pp-foot {
  padding: 20px 35px;
  border-top: 1px solid var(--line-soft);
  background: var(--bg-sunken);
  display: flex; align-items: center; gap: 18px;
  flex-wrap: wrap;
  position: relative; z-index: 3;
}
.pp-fgroup {
  display: flex; align-items: center; gap: 10px;
}
.pp-flabel {
  font-family: 'Geist Mono', monospace;
  font-size: 10px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--ink-mute);
  display: flex; align-items: center; gap: 5px;
}
.pp-flink {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12.5px; color: var(--ink-soft);
  text-decoration: none;
  padding: 4px 8px; border-radius: 5px;
  border: 1px solid var(--line);
  background: var(--bg-panel);
  transition: color .14s, border-color .14s;
}
.pp-flink:hover { color: var(--accent); border-color: var(--accent-soft); }
.pp-fspacer { flex: 1; }


body.menu-open::before {
  content: '';
  position: fixed;
  inset: 0;
  background: var(--scrim);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 60;
}

body.filter-open::before {
  opacity: 1;
  pointer-events: auto;
}
/* ==========================================================================
   ACTION BUTTONS
   ========================================================================== */
.actions-row {
    display: flex;
    flex-wrap: wrap;
    flex-direction: row;
    gap: 8px;
    margin-top: 24px;
    margin-bottom: 40px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 12px;
    border: 1px solid var(--bd-border);
    border-radius: 7px;
    background: var(--bg-sidebar);
    color: var(--text-soft);
    font-size: 13px;
    transition: all var(--transition-fast);
    cursor: pointer;
}

.btn:hover {
    background: var(--bg-sunken);
    color: var(--text-main);
    border-color: var(--text-muted);
}

.btn.primary {
    background: var(--text-main);
    color: var(--bg-sidebar);
    border-color: var(--text-main);
}

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

/* ==========================================================================
   STATS GRID (4-up)
   ========================================================================== */
.stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    background: var(--bg-sidebar);
    border: 1px solid var(--bd-border);
    border-radius: var(--radius-lg);
    overflow-y: hidden;
    margin: 40px 0;
}

.dnd-table-wrap {
    background: var(--bg-panel);
}

.stat {
    padding: 18px 20px;
    border-right: 1px solid var(--line-soft);
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.stat:last-child { border-right: 0; }

.stat-label {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    display: flex;
    align-items: center;
    gap: 6px;
}

.stat-value {
    font-family: var(--font-main);
    font-size: 22px;
    font-weight: 500;
    color: var(--text-main);
    letter-spacing: -0.01em;
}

.stat-hint {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 2px;
}

/* ==========================================================================
   CONTENT SECTIONS
   ========================================================================== */
section.block { margin-top: 30px; }

.block-label {
    font-family: var(--font-mono);
    font-size: 16px;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
    margin-bottom: 10px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--line-soft);
}

/* ==========================================================================
   PROSE
   ========================================================================== */
.prose, .dnd-entry-list  {
    font-family: var(--font-main);
    font-size: 16px;
    line-height: 1.60;
    color: var(--text-main);
}

.prose p { margin: 0 0 1em; }
.prose em { color: var(--text-soft); }
.prose strong { font-weight: 600; color: var(--text-main); }

.prose ul, .prose ol, .dnd-entry-list  {
    padding-left: 1.4em;
    margin: 0 0 1em;
}

.prose li, .dnd-entry-list li {
    list-style-type: disc; margin-bottom: 0.3em; }

.prose table, .dnd-entry-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
    margin: 0 0 1em;
}

.prose td, .prose th, .dnd-entry-table td, .dnd-entry-table th {
    padding: 8px 12px;
    border: 1px solid var(--bd-border);
    text-align: left;
}

.prose th, .dnd-entry-table th {
    background: var(--bg-sunken);
    font-family: var(--font-mono);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}



/* ==========================================================================
   DEF GRID (таблица деталей)
   ========================================================================== */
.def-grid {
    display: grid;
    gap: 1px;
    margin: 0 auto 0 auto;
    background: var(--line-soft);
    border: 1px solid var(--line-soft);
    border-radius: var(--radius-lg);
    overflow: hidden;
}

.def-grid.col-2 { grid-template-columns: 1fr 1fr; }
.def-grid.col-3 { grid-template-columns: 1fr 1fr 1fr; }

.def-grid {
    display: grid;
    grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr));
    gap: 1px;
}

.def-grid .def-cell:last-child:nth-child(odd) {
    grid-column: 1 / -1;
}

.def-cell {
    padding: 14px 18px;
    background: var(--bg-sidebar);
}

.def-cell .k {
    font-family: var(--font-mono);
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 4px;
}

.def-cell .v {
    font-size: 14px;
    color: var(--text-main);
}

/* ==========================================================================
   PILL LIST
   ========================================================================== */
.pill-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px 5px 8px;
    background: var(--bg-sidebar);
    border: 1px solid var(--bd-border);
    border-radius: var(--radius-md);
    font-size: 12.5px;
    color: var(--text-main);
    transition: border-color var(--transition-fast);
    cursor: pointer;
}

.pill:hover { border-color: var(--accent-soft); }

.pill .src {
    font-family: var(--font-mono);
    font-size: 9.5px;
    color: var(--text-muted);
    padding: 1px 5px;
    background: var(--bg-sunken);
    border-radius: 3px;
}

.pill.sub { background: transparent; }

/* ==========================================================================
   SOURCE LINE
   ========================================================================== */
.source-line {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    padding-top: 18px;
    border-top: 1px solid var(--line-soft);
    display: flex;
    flex-wrap: wrap;
    gap: 18px;
    margin-top: 40px;
}

.source-line .l {
    color: var(--text-main);
    font-weight: 500;
}

.dnd-footer-credit {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
}

/* ==========================================================================
   ENTITY HEADER (sb-header)
   ========================================================================== */
.sb-header {
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--bd-border);
}

.sb-header-top {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.sb-title-group h1 {
    font-family: var(--font-serif);
    font-size: 28px;
    font-weight: 400;
    letter-spacing: -0.01em;
    line-height: 1.15;
    color: var(--text-main);
    margin: 0;
}

.sb-subtitle {
    font-size: 13px;
    color: var(--text-muted);
}

.sb-header-bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.sb-meta-top {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    color: var(--text-muted);
}

.sb-badges { display: flex; gap: 6px; }

.sb-badge {
    font-family: var(--font-mono);
    font-size: 10px;
    font-weight: 500;
    padding: 2px 8px;
    border-radius: var(--radius-sm);
    background: var(--bg-sunken);
    color: var(--text-muted);
    border: 1px solid var(--line-soft);
    letter-spacing: 0.04em;
}

.sb-badge.highlight {
    background: var(--accent-bg);
    color: var(--accent);
    border-color: transparent;
}

/* doc-actions (кнопки шапки) */
.doc-actions {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.btn-icon {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-md);
    display: grid;
    place-items: center;
    color: var(--text-muted);
    transition: background var(--transition-fast), color var(--transition-fast);
    cursor: pointer;
    text-decoration: none;
}

.btn-icon:hover {
    background: var(--bg-hover);
    color: var(--text-main);
}

.btn-icon-close:hover { color: #e03e3e; }


.detail {
    position: relative;
    overflow-x: hidden;
}

.detail-art {
    position: fixed;
    width: 48%;
    height: 50%;
    right: 2%;
    bottom: 5%;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: right bottom;
    pointer-events: none;
    z-index: -1;
    opacity: 0.3;
}

.btn.close_header {
    margin-left: auto;
    padding: 7px 10px;
}

/* ==========================================================================
   MONSTER TITLE ROW
   ========================================================================== */
.monster-title-row {
    display: flex;
    align-items: center;
    flex-wrap: wrap-reverse;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 8px;
}

.monster-token {
    width: 96px;
    height: 96px;
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--bg);
    flex-shrink: 0;
    border: 2px solid var(--bd-border);
}

.monster-token {
    position: relative;
    width: 140px;
    height: 140px;
    flex-shrink: 0;
}

.token-photo {
    position: absolute;
    inset: 19%;
    width: 60%;
    height: 60%;
    object-fit: scale-down;
    border-radius: 50%;
    cursor: pointer;
}

.token-mask {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
    z-index: 2;
}

.detail-inner {
    position: relative;
    z-index: 1;
}

.dnd-entry-title {
    margin: 15px 0;
}

/* ==========================================================================
   LIGHTBOX
   ========================================================================== */

.img-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.img-lightbox.is-open {
    display: flex;
}

.img-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, .82);
    cursor: zoom-out;
}

.img-lightbox-content {
    position: relative;
    z-index: 1;
    max-width: min(90vw, 860px);
    max-height: 90vh;
    display: flex;
    align-items: center;
    justify-content: center;
}

.img-lightbox-content img {
    max-width: 100%;
    max-height: 90vh;
    object-fit: contain;
    border-radius: var(--radius);
    display: block;
}

.img-lightbox-close {
    position: fixed;
    top: 18px;
    right: 22px;
    z-index: 2;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: none;
    background: rgba(255, 255, 255, .12);
    color: #fff;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background .15s;
    line-height: 1;
}

.img-lightbox-close:hover {
    background: rgba(255, 255, 255, .24);
}

/* ============ FILTER PANEL (правый drawer) ============ */
.filter-panel {
  position: fixed;
  top: 0; right: 0; bottom: 0;
  width: 480px;
  max-width: 92vw;
  background: var(--bg-panel);
  border-left: 1px solid var(--line);
  z-index: 61;
  display: flex; flex-direction: column;
  transform: translateX(110%);
  transition: transform .28s cubic-bezier(.2,.9,.25,1);
  box-shadow: var(--shadow-pop);
}
.filter-panel.open { transform: translateX(0); }

.fp-head {
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--line-soft);
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px;
}
.fp-head .t {
  font-family: 'Source Serif 4', serif;
  font-size: 22px; font-weight: 500;
  letter-spacing: -0.01em; color: var(--ink);
}
.fp-close {
  width: 32px; height: 32px; border-radius: 8px;
  display: grid; place-items: center;
  color: var(--ink-mute);
  transition: background .15s, color .15s;
}
.fp-close:hover { background: var(--bg-hover); color: var(--ink); }

.fp-body {
  flex: 1; overflow-y: auto;
  padding: 8px 26px 26px;
}
.fp-body::-webkit-scrollbar { width: 10px; }
.fp-body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 3px solid var(--bg-panel); }

.fp-section { padding: 18px 0; border-bottom: 1px solid var(--line-soft); }
.fp-section:last-child { border-bottom: 0; }
.fp-section > .head {
  display: flex; align-items: baseline; justify-content: space-between;
  margin-bottom: 12px;
}
.fp-section > .head .k {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px; text-transform: uppercase;
  letter-spacing: 0.1em; color: var(--ink-mute);
}
.fp-section > .head .r {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px; color: var(--ink);
}

.fp-chips { display: flex; flex-wrap: wrap; gap: 6px; }

.fp-foot {
  padding: 16px 26px;
  border-top: 1px solid var(--line);
  background: var(--bg-panel);
  display: flex; gap: 10px; align-items: center;
}
.fp-foot .spacer { flex: 1; }
.fp-foot .count {
  font-family: 'Geist Mono', monospace;
  font-size: 10.5px; color: var(--ink-mute);
  letter-spacing: 0.06em; text-transform: uppercase;
}

/* кнопки в футере */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--bg-panel);
  color: var(--ink-soft);
  font-size: 13px;
  transition: all .15s;
  cursor: pointer;
}
.btn:hover { background: var(--bg-sunken); color: var(--ink); border-color: var(--ink-mute); }
.btn.primary { background: var(--ink); color: var(--bg-panel); border-color: var(--ink); }
.btn.primary:hover { background: var(--accent); border-color: var(--accent); }


.block-label {
  cursor: pointer;
  user-select: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.block-label::before {
  content: '';
  display: inline-block;
  width: 14px; height: 14px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-size: contain;
  background-repeat: no-repeat;
  transition: transform .2s ease;
  flex-shrink: 0;
}
.block.is-collapsed .block-label::before {
  transform: rotate(-90deg);
}
.block-body {
  overflow: hidden;
  transition: height .25s cubic-bezier(.2,.9,.25,1);
}



/* ============ MOBILE ADAPTATION ============ */
@media (max-width: 1100px) {.detail-art {display: none;}}
@media (max-width: 768px) {

    .filter-panel {
        width: 100%;
        max-width: 100vw;
    }

    .stat{min-width: 200px;}

   /* ============ MOBILE ADAPTATION: PORTAL POPUP ============ */
  .portal-pop {
    top: 50%; 
    left: 50%;
    transform-origin: center center;
    transform: translate(-50%, -48%) scale(0.96); 
    width: calc(100vw - 32px); 
    max-height: calc(100dvh - 100px); 
    
    /* Добавляем прокрутку всему попапу */
    overflow-y: auto; 
    /* Меняем flex на block, чтобы контент выстраивался друг за другом и скроллился как единая страница */
    display: block; 
  }

  .portal-pop.open {
    transform: translate(-50%, -50%) scale(1);
  }

  .pp-head {
    padding: 16px;
    align-items: flex-start; 
  }
  
  .pp-title { 
    font-size: 18px; 
  }

  .pp-grid {
    grid-template-columns: 1fr 1fr; 
    gap: 24px 16px;
    padding: 16px;
    
    /* Убираем внутренний скролл, позволяем сетке растянуться на всю высоту */
    overflow-y: visible; 
  }

  .pp-mascot {
    opacity: 0.08; 
    right: -20px;
    bottom: 0;
    width: 180px;
  }

  .pp-foot {
    padding: 16px;
    flex-direction: column; 
    align-items: flex-start;
    gap: 12px;
  }

  .pp-fgroup {
    width: 100%;
    flex-wrap: wrap; 
  }


}


@keyframes detail-slide-in {
    from {
        opacity: 0;
        transform: translateX(24px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.detail.detail-animate {
    animation: detail-slide-in 0.22s ease-out forwards;
}





/* ==========================================================================
   ДРУК (PRINT / EXPORT TO PDF)
   ========================================================================== */
@media print {
    /* 1. Ховаємо все зайве: меню, ліві колонки, списки, кнопки 
       (Прибрали .dnd-footer-credit звідси, щоб підпис залишався) */
    .rail, 
    .sidebar, 
    .list-pane, 
    .list-col, 
    #app-sidebar, 
    #catalog-pane,
    .actions-row, 
    .btn.close_header,
    .detail-art,
    .modal-overlay,
    .filter-panel {
        display: none !important;
    }

    /* 2. Скидаємо жорсткі розміри та скроли */
    body, 
    html, 
    .app-container, 
    .main-content, 
    .detail, 
    .detail-pane,
    .detail-inner {
        display: block !important;
        width: 100% !important;
        height: auto !important;
        overflow: visible !important;
        background: white !important; /* Білий фон */
        margin: 0 !important;
        padding: 0 !important;
    }

    /* 3. ПРИМУСОВО ЧОРНИЙ ТЕКСТ ТА СКИДАННЯ ТЕМНИХ ФОНІВ */
    * {
        color: black !important; /* Весь текст гарантовано чорний */
    }
    
    /* Робимо плашки, таблиці та рамки видимими на білому тлі без заливки */
    .pill, .stat, .def-grid, .def-cell, .tag, .sb-badge {
        background: transparent !important;
        border-color: #888 !important; /* Сірі рамки для контрасту */
    }

    /* Повертаємо червоний колір сердечку ❤️ */
    .dnd-footer-credit span {
        color: #e11d48 !important;
    }

    /* 4. Прибираємо відступи контейнера */
    .detail-inner {
        max-width: 100% !important;
        padding: 0 !important;
    }

    /* 5. Захист від розриву блоків на дві сторінки */
    .stats, 
    section.block, 
    .source-line {
        page-break-inside: avoid;
        break-inside: avoid;
    }
}