:root{
  --toc-top: 128px;
}

.googledoc {
  display: flex;
  flex-direction: column;
  gap: 14px;
  font-family: "Roboto", sans-serif;
  padding: 18px;

  box-sizing: border-box;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.separateSpan { display: inline-block; padding: 0; }

.rules-layout{
  display: grid;
  grid-template-columns: 280px minmax(0,1fr);
  gap: 24px;
  font-family: "Roboto", sans-serif;
}

.rules-content {
  padding: 18px;
  padding-top: 0 !important;
  box-sizing: border-box;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.rules-content img, #output img {
  max-width: 100%;
  height: auto;
  display: block;
}

.rules-toc-inner {
  position: sticky;
  top: var(--toc-top);
  max-height: calc(100vh - var(--toc-top) - 20px);
  overflow: auto !important;
  font-size: 14px;
  padding: 8px;

  --toc-track: rgba(255,255,255,.05);
  --toc-thumb: rgba(255,255,255,.25);
  --toc-thumb-hover: rgba(255,255,255,.45);
  scrollbar-width: thin;
  scrollbar-color: var(--toc-thumb) var(--toc-track);
}

.rules-toc-inner::-webkit-scrollbar { width:8px; }
.rules-toc-inner::-webkit-scrollbar-track { background:var(--toc-track); border-radius:8px; }
.rules-toc-inner::-webkit-scrollbar-thumb { background:var(--toc-thumb); border-radius:8px; transition:background .2s; }
.rules-toc-inner::-webkit-scrollbar-thumb:hover { background:var(--toc-thumb-hover); }
.rules-toc-inner a { display:block; padding:6px 8px; color:#ddd; text-decoration:none; border-radius:8px; }
.rules-toc-inner a:hover { background:rgba(255,255,255,.08); }
.rules-toc-inner .lvl-1 { margin-left:0; font-weight:700; }
.rules-toc-inner .lvl-2 { margin-left:12px; }
.rules-toc-inner .lvl-3 { margin-left:24px; }
.rules-toc-inner .lvl-4 { margin-left:36px; }
.rules-toc-inner .lvl-5 { margin-left:48px; }
.rules-toc-inner .lvl-6 { margin-left:60px; }

.googledoc .doc-ol {
  list-style: none;
  counter-reset: item;
  margin: 0 0 8px 0;
  padding-left: 24px;
}

.googledoc .doc-ol.lvl-1 { padding-left: 15px !important; }
.googledoc .doc-ol.lvl-2 { padding-left: 10px !important; }
.googledoc .doc-ol.lvl-3 { padding-left: 10px !important; }

.googledoc .doc-ol > li {
  display:block;
  position:relative;
  padding-left: 2.5em;
}

.googledoc .doc-ol > li::before {
  content: counters(item, ".") ".";
  counter-increment: item;
  position: absolute;
  left: -25px;
  width: 3.5em;
  display: inline-block;
  text-align: right;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  opacity: .9;
}

.googledoc .doc-ol ol { counter-reset: item; margin:0; padding-left:24px; }

.googledoc .doc-ul {
  list-style: disc !important;
  list-style-position: outside;
  margin: 0 0 8px 0;
  padding-left: 24px;
}

.googledoc .doc-ul.lvl-2 { list-style: circle !important; padding-left: 46px !important; }
.googledoc .doc-ul.lvl-3 { list-style: square !important; padding-left: 68px !important; }
.googledoc .doc-ul li::before { content: none !important; }

.rules-content :is(h1,h2,h3,h4,h5,h6) { scroll-margin-top:129px; }
.rules-content, .googledoc { overflow-x: clip; }

#readingToggle, #scrollToTop {
  opacity: 0;
  pointer-events: none;
  transition: opacity .35s ease;
}

body.content-ready #readingToggle,
body.content-ready #scrollToTop {
  opacity: 1;
  pointer-events: auto;
}

#readingToggle {
  position: fixed;
  left: 45%;
  bottom: 28px;
  z-index: 1000;
  border: 1px solid rgba(255,255,255,.2);
  background: #fff;
  color: #000;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
  padding: 10px 14px;
  border-radius: 10px;
  font-weight: 800;
  font-size: 16px;
  cursor: pointer;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  backdrop-filter: blur(6px);
  transition: background .3s ease, color .3s ease, box-shadow .3s ease;
}
#readingToggle:hover {
  background: #000;
  color: #fff;
  box-shadow: 0 6px 18px rgba(0,0,0,.35);
}
.reading-light .rules-content, .reading-light #output {
  background: #fff;
  color: #000;
  border-radius: 12px;
  padding: 18px;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
}
.reading-light .rules-content :is(h1,h2,h3,h4,h5,h6),
.reading-light #output :is(h1,h2,h3,h4,h5,h6) { color:#000; }
.reading-light .googledoc,
.reading-light .googledoc span { color:#000; }
.reading-light .googledoc .doc-ol > li::before { color:#000; }
.reading-light .rules-content a,
.reading-light #output a { color:#0b63ff; text-decoration: underline; }
.reading-light .rules-content a:hover,
.reading-light #output a:hover { text-decoration: none; }
.reading-light .rules-toc-inner {
  background:#fff;
  color:#000;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 8px;

  --toc-track: rgba(0,0,0,.06);
  --toc-thumb: rgba(0,0,0,.35);
  --toc-thumb-hover: rgba(0,0,0,.50);
}
.reading-light .rules-toc-inner a { color:#000; }
.reading-light .rules-toc-inner a:hover { background: rgba(0,0,0,.06); }
.reading-light .googledoc .doc-ul { list-style-position: outside; }
.reading-light .googledoc .doc-ol, .reading-light .googledoc .doc-ul { padding-left: 24px; }
.reading-light .rules-content img, .reading-light #output img { filter: none !important; }
.reading-light #readingToggle {
  background: #000;
  color:#fff;
  border: 1px solid rgba(255,255,255,.2);
}

.reading-light #readingToggle:hover {
  background: #fff;
  color: #000;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
}


#rulesLayout { position: relative; }

.rules-loader{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
  background: #030305;
  backdrop-filter: blur(2px);
}

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

.loader-logo {
  width: 80px;
  height: auto;
  animation: loader-pulse 1.6s ease-in-out infinite;
}

@keyframes loader-pulse {
  0%, 100% { transform: scale(1); opacity: 0.8; }
  50% { transform: scale(1.1); opacity: 1; }
}

#rulesLayout.is-loaded #rulesLoader { display: none; }

@media (max-width:1024px){
  .rules-content { padding-top: 18px !important; }
}

@media (max-width:600px){
  .rules-layout{ grid-template-columns:1fr; padding: 7px; }
  .rules-toc{ display:none; }
  .rules-content{ width:100%; padding:12px; }
  #readingToggle{ left:12px; bottom:28px; }
  #readingToggle:hover {
    background: #fff;
    color: #000;
    box-shadow: 0 6px 18px rgba(0,0,0,.35);
  }
  .reading-light #readingToggle:hover {
    background: #000;
    color:#fff;
    border: 1px solid rgba(255,255,255,.2);
  }
  #scrollToTop:hover {
    background-color: #ee364c;
    color: white;
  }
}
/* Стили для аккордеона в стиле Сталкера */
.stalker-accordion {
    border: 1px solid #2a3a2a;
    background: rgba(15, 20, 15, 0.8);
    margin: 20px 0;
}

.accordion-item {
    border-bottom: 1px solid #1a2a1a;
    position: relative;
    transition: all 0.3s ease;
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-item:hover {
    border-left: 2px solid #42a33e;
    background: rgba(25, 35, 25, 0.6);
}

.accordion-header {
    padding: 18px 20px;
    background: rgba(25, 35, 25, 0.6);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    transition: all 0.3s ease;
    user-select: none;
    font-family: 'Tektur', 'Courier New', monospace;
}

.accordion-header:hover {
    background: rgba(40, 60, 40, 0.4);
}

.accordion-header.active {
    background: rgba(30, 50, 30, 0.8);
    border-left: 3px solid #42a33e;
}

.header-title {
    display: flex;
    align-items: center;
    gap: 12px;
    color: #c8d8c8;
    font-size: 16px;
    font-weight: 500;
}

.header-icon {
    color: #42a33e;
    font-size: 18px;
    width: 24px;
    text-align: center;
}

.header-indicator {
    color: #42a33e;
    transition: transform 0.3s ease;
    font-size: 14px;
    width: 20px;
    text-align: center;
}

.accordion-header.active .header-indicator {
    transform: rotate(180deg);
}

.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    background: rgba(10, 15, 10, 0.5);
}

.content-wrapper {
    padding: 0 20px;
}

.content-inner {
    padding: 25px 0;
    border-top: 1px solid #1a2a1a;
    color: #a8b8a8;
    font-family: 'Roboto', sans-serif;
    font-size: 15px;
    line-height: 1.6;
}

/* Стили для содержимого аккордеона */
.stalker-list {
    list-style: none;
    padding-left: 20px;
    margin: 15px 0;
}

.stalker-list li {
    margin-bottom: 10px;
    padding-left: 15px;
    position: relative;
    color: #b8c8b8;
}

.stalker-list li:before {
    content: "▶";
    color: #42a33e;
    position: absolute;
    left: 0;
    font-size: 10px;
    top: 2px;
}

.stalker-warning {
    padding: 12px 15px;
    background: rgba(163, 66, 62, 0.1);
    border-left: 3px solid #a33e3e;
    margin: 15px 0;
    color: #d8a8a8;
    border-radius: 2px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.stalker-warning:before {
    content: "⚠";
    color: #a33e3e;
    font-size: 18px;
}

.stalker-tip {
    padding: 12px 15px;
    background: rgba(66, 163, 62, 0.1);
    border-left: 3px solid #42a33e;
    margin: 15px 0;
    color: #a8d8a8;
    border-radius: 2px;
}

.artifact-card {
    padding: 15px;
    background: rgba(30, 40, 30, 0.6);
    border: 1px solid #3a5a3a;
    border-left: 3px solid #42a33e;
    margin: 15px 0;
    transition: all 0.3s ease;
}

.artifact-card:hover {
    background: rgba(35, 50, 35, 0.7);
    border-color: #4a6a4a;
}

.artifact-name {
    color: #42a33e;
    font-weight: 600;
    font-size: 16px;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-family: 'Tektur', monospace;
}

.artifact-desc {
    color: #a8b8a8;
    font-size: 14px;
    line-height: 1.5;
}

/* Адаптация для мобильных */
@media (max-width: 768px) {
    .accordion-header {
        padding: 15px;
    }
    
    .header-title {
        font-size: 14px;
        gap: 8px;
    }
    
    .header-icon {
        font-size: 16px;
    }
    
    .content-inner {
        padding: 20px 0;
    }
}

/* Анимация появления */
@keyframes stalkerFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.accordion-content.open {
    animation: stalkerFadeIn 0.3s ease;
}
.stalker-section-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center !important; /* Переопределяем text-align: left */
    margin-bottom: 30px;
    padding: 25px 20px;
    background: rgba(20, 20, 20, 0.8);
    border: 1px solid #4a9c3a;
    border-radius: 6px;
}

/* Это гарантирует, что все текстовые элементы внутри будут центрированы */
.stalker-section-header * {
    text-align: center !important;
}
/* Центрирование заголовков аккордеона */
.accordion-header {
    text-align: center !important;
    justify-content: center !important;
}

.header-title {
    display: flex;
    justify-content: center !important;
    align-items: center;
    text-align: center !important;
    width: 100%;
}

.header-title span:not(.header-icon) {
    text-align: center !important;
    margin: 0 auto;
}

/* Если заголовок сделан через flex */
.accordion-header {
    display: flex;
    justify-content: center !important;
    align-items: center;
    text-align: center !important;
}

/* Для иконки и текста внутри заголовка */
.header-title {
    display: flex;
    justify-content: center !important;
    align-items: center;
    gap: 10px;
    text-align: center !important;
    width: auto;
    margin: 0 auto;
}