.th-rulebook {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  background: #111;
  color: #e2e8f0;
  font-family: var(--font-ui, "Causten", sans-serif);
  line-height: 1.6;
}

.th-rulebook[hidden] {
  display: none;
}

body.th-rulebook-open {
  overflow: hidden;
}

.th-rulebook__bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 14px;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(238, 36, 69, 0.35);
  background: #060501;
}

.th-rb-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  border: 1px solid #243533;
  background: #121617;
  color: #fff;
  font: inherit;
  font-size: 10pt;
  font-weight: 700;
  cursor: pointer;
}

.th-rb-btn:hover {
  border-color: #ee2445;
}

.th-rb-btn .material-symbols-outlined {
  font-size: 18px;
}

.th-rulebook__heading {
  display: flex;
  flex-direction: column;
  min-width: 0;
  line-height: 1.25;
}

.th-rulebook__eyebrow {
  color: #ee2445;
  font-size: 9pt;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.th-rulebook__name {
  overflow: hidden;
  color: #fff;
  font-size: 11pt;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.th-rulebook__spacer {
  flex: 1;
}

.th-rulebook__toc-btn {
  display: none;
}

.th-rulebook__search {
  position: relative;
  display: flex;
  align-items: center;
  width: 320px;
}

.th-rulebook__search-icon {
  position: absolute;
  left: 11px;
  font-size: 18px;
  color: rgba(255, 255, 255, 0.45);
  pointer-events: none;
}

.th-rulebook__input {
  width: 100%;
  height: 38px;
  padding: 0 70px 0 36px;
  border-radius: 8px;
  border: 1px solid #243533;
  background: #121617;
  color: #fff;
  font: inherit;
  font-size: 10.5pt;
  outline: none;
}

.th-rulebook__input:focus,
.th-rulebook__input.is-searching {
  border-color: #ee2445;
}

.th-rulebook__input::-webkit-search-cancel-button {
  display: none;
}

.th-rulebook__hits {
  position: absolute;
  right: 34px;
  color: #9ca3af;
  font-size: 9pt;
  font-weight: 800;
}

.th-rulebook__clear {
  position: absolute;
  right: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #9ca3af;
  cursor: pointer;
}

.th-rulebook__clear .material-symbols-outlined {
  font-size: 17px;
}

.th-rulebook__progress {
  height: 3px;
  background: #181f20;
}

.th-rulebook__progress-fill {
  display: block;
  width: 0;
  height: 3px;
  background: #ee2445;
  transition: width 0.15s;
}

.th-rulebook__grid {
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: 300px minmax(0, 1fr);
}

.th-rulebook__toc {
  overflow: auto;
  padding: 18px 12px 28px;
  border-right: 1px solid #243533;
  background: #121617;
}

.th-rulebook__toc-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 8px 10px;
  color: #9ca3af;
  font-size: 9pt;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.th-toc-chapter[hidden],
.th-toc-section[hidden] {
  display: none;
}

.th-toc-chapter__link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 8px;
  color: rgba(255, 255, 255, 0.75);
  font-size: 10.5pt;
  font-weight: 700;
  text-decoration: none;
}

.th-toc-chapter__link:hover {
  color: #fff;
}

.th-toc-chapter.is-active .th-toc-chapter__link {
  background: rgba(238, 36, 69, 0.1);
  color: #fff;
}

.th-toc-chapter__num {
  width: 22px;
  flex: 0 0 22px;
  color: #9ca3af;
  font-size: 10pt;
  font-weight: 800;
}

.th-toc-chapter.is-active .th-toc-chapter__num {
  color: #ee2445;
}

.th-toc-chapter__title {
  flex: 1;
  min-width: 0;
}

.th-toc-sections {
  display: none;
  flex-direction: column;
  gap: 1px;
  margin: 2px 0 8px 18px;
  padding-left: 12px;
  border-left: 1px solid #243533;
}

.th-toc-chapter.is-open .th-toc-sections {
  display: flex;
}

.th-toc-section {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 6px;
  color: #9ca3af;
  font-size: 10pt;
  font-weight: 500;
  text-decoration: none;
}

.th-toc-section:hover {
  color: #fff;
}

.th-toc-section.is-active {
  background: rgba(238, 36, 69, 0.14);
  color: #fff;
  font-weight: 700;
}

.th-toc-section__num {
  flex: 0 0 28px;
  color: #9ca3af;
}

.th-rulebook__scroll {
  position: relative;
  overflow: auto;
}

.th-rulebook__doc {
  max-width: 780px;
  margin: 0 auto;
  padding: 36px 32px 80px;
}

.th-rulebook__intro {
  margin-bottom: 8px;
  padding-bottom: 24px;
  border-bottom: 1px solid #243533;
}

.th-rulebook__title {
  margin: 4px 0 10px;
  color: #fff;
  font-size: 28pt;
  font-weight: 700;
  line-height: 1.15;
}

.th-rulebook__facts {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  color: #9ca3af;
  font-size: 10pt;
}

.th-rulebook__content {
  color: rgba(255, 255, 255, 0.78);
  font-size: 11pt;
  line-height: 1.7;
}

.th-rulebook__content p {
  margin: 0 0 10px;
}

.th-rulebook__content a {
  color: #ee2445;
}

.th-rulebook__content ul,
.th-rulebook__content ol {
  margin: 0 0 10px;
  padding-left: 22px;
}

.th-rulebook__content img {
  max-width: 100%;
  height: auto;
}

.th-rule-chapter {
  padding-top: 28px;
}

.th-rule-chapter[hidden],
.th-rule-sec[hidden],
.th-rule-intro[hidden] {
  display: none;
}

.th-rule-sec {
  position: relative;
  padding: 20px 0 4px;
  scroll-margin-top: 16px;
}

.th-rule-sec--lead {
  padding-top: 0;
}

.th-rule-heading {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 0 0 8px;
  padding-right: 80px;
  color: #fff;
  font-size: 12pt;
  font-weight: 700;
  line-height: 1.35;
}

.th-rule-sec--lead > .th-rule-heading {
  padding-bottom: 10px;
  border-bottom: 1px solid #243533;
  font-size: 16pt;
}

.th-rule-num {
  color: #9ca3af;
  font-weight: 800;
}

.th-rule-sec--lead > .th-rule-heading .th-rule-num {
  color: #ee2445;
}

.th-rule-copy {
  position: absolute;
  top: 20px;
  right: 0;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid #243533;
  background: transparent;
  color: #9ca3af;
  font: inherit;
  font-size: 9pt;
  font-weight: 700;
  cursor: pointer;
}

.th-rule-sec--lead > .th-rule-copy {
  top: 2px;
}

.th-rule-copy:hover {
  border-color: #ee2445;
  color: #fff;
}

.th-rule-copy .material-symbols-outlined {
  font-size: 15px;
}

.th-rulebook mark.th-rule-hit {
  border-radius: 3px;
  background: rgba(238, 36, 69, 0.35);
  color: #fff;
}

.th-rulebook__nohits {
  margin-top: 24px;
  border: 1px dashed #243533;
  border-radius: 12px;
}

.th-rulebook__foot {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 36px;
  padding-top: 18px;
  border-top: 1px solid #243533;
  color: #9ca3af;
  font-size: 10pt;
}

.th-rulebook__top {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
  border: 0;
  background: none;
  color: #ee2445;
  font: inherit;
  font-size: 10pt;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
  cursor: pointer;
}

.th-rulebook__top .material-symbols-outlined {
  font-size: 16px;
}

@media (max-width: 720px) {
  .th-rulebook__bar {
    padding: 12px 14px;
  }

  .th-rulebook__toc-btn {
    display: inline-flex;
  }

  .th-rulebook__search {
    order: 5;
    width: 100%;
  }

  .th-rulebook__grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .th-rulebook__toc {
    display: none;
    border-right: 0;
  }

  .th-rulebook.is-toc-open .th-rulebook__toc {
    display: block;
  }

  .th-rulebook.is-toc-open .th-rulebook__scroll {
    display: none;
  }

  .th-rulebook__doc {
    padding: 24px 16px 64px;
  }

  .th-rule-heading {
    padding-right: 0;
  }

  .th-rule-copy {
    position: static;
    margin-bottom: 6px;
  }

  .th-rulebook__foot {
    flex-direction: column;
  }
}

.th-rulebook__clear[hidden],
.th-rulebook__hits[hidden] {
  display: none;
}

.th-rulebook__content .th-rule-heading {
  margin: 0 0 8px;
  padding-top: 0;
  border: 0;
  background: none;
}

.th-rulebook__content .th-rule-sec--lead > .th-rule-heading {
  padding-bottom: 10px;
  border-bottom: 1px solid #243533;
}

.th-rule-copy {
  top: 18px;
}
