: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;
  }
}