body {
  font-family: Arial, sans-serif;
  margin: 1rem;
  line-height: 1.6;
}
a.marker {
  color: #0077cc;
  text-decoration: underline;
  cursor: pointer;
  scroll-margin-top: 5.5rem;
}
.marker-text {
  color: #0077cc;
  font-weight: 600;
}
.reasoning-trigger {
  display: inline;
  padding: 0;
  border: none;
  background: transparent;
  color: #0077cc;
  cursor: pointer;
  font-size: 0.8rem;
  line-height: 1.2;
  vertical-align: baseline;
  text-decoration: underline;
}
.interlaced-reasoning-trigger-row {
  margin-top: -0.2rem;
  margin-left: 3.55rem;
}
.interlaced-reasoning-trigger-row .reasoning-trigger {
  font-size: 0.9rem;
}
.chunk-anchor {
  display: block;
  height: 0;
  overflow: hidden;
  scroll-margin-top: 5.5rem;
}
.chunk-layout {
  display: grid;
  grid-template-columns: minmax(2.8rem, max-content) minmax(0, 1fr);
  column-gap: 0.75rem;
  align-items: center;
}
.chunk-marker-column {
  line-height: 1.6;
  text-align: right;
  white-space: nowrap;
  align-self: center;
}
.chunk-text-column {
  min-width: 0;
}
.chunk-text-column > :first-child {
  margin-top: 0;
}
.chunk-text-column > :last-child {
  margin-bottom: 0;
}
.marker-trailing {
  margin-left: 0.3rem;
  white-space: nowrap;
}
.chunk-marker-column .marker-trailing {
  margin-left: 0;
  color: #9aa3af;
  font-size: 0.82rem;
  font-weight: 500;
  text-decoration: none;
}
.chunk-marker-column .marker-trailing:hover {
  color: #6b7280;
  text-decoration: underline;
}
.reasoning-trigger:hover {
  color: #005c99;
}
.reasoning-trigger:focus-visible,
.term-match:focus-visible,
.reasoning-term-item:focus-visible,
.view-toggle-button:focus-visible,
.reasoning-preview-more:focus-visible,
.return-link:focus-visible {
  outline: 2px solid #0077cc;
  outline-offset: 2px;
}
.section {
  margin-bottom: 2rem;
}
.section h3 {
  margin-top: 0;
  border-bottom: 1px solid #ccc;
  padding-bottom: 0.25rem;
}
.doc-header {
  font-style: italic;
  color: #444;
  margin: 0.75rem 0 1.25rem;
}
.page-toolbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: flex-start;
  gap: 1rem;
  justify-content: space-between;
  margin: 0 0 1.5rem;
  padding: 0.85rem 0;
  background: #fff;
  border-bottom: 1px solid #dbe1ec;
}
.doc-search {
  position: relative;
  flex: 1 1 420px;
  max-width: 520px;
}
.doc-search-input {
  width: 100%;
  padding: 0.55rem 0.75rem;
  font-size: 1rem;
  border-radius: 4px;
  border: 1px solid #b7c0d0;
  box-sizing: border-box;
}
.doc-search-results {
  position: absolute;
  top: calc(100% + 0.45rem);
  left: 0;
  right: 0;
  display: none;
  border: 1px solid #dbe1ec;
  border-radius: 8px;
  padding: 0.25rem 1rem 1rem;
  background: #fff;
  box-shadow: 0 16px 36px rgba(15, 23, 42, 0.12);
  max-height: min(60vh, 32rem);
  overflow-y: auto;
}
.doc-search-results-list {
  list-style: none;
  padding-left: 0;
  margin: 0;
}
.doc-search-count {
  margin: 0.5rem 0 0.4rem;
  font-size: 0.85rem;
  color: #5e6673;
}
.doc-search-results.has-results .doc-search-results-list {
  display: block;
}
.doc-search-results.has-results {
  display: block;
}
.doc-search-result {
  border-top: 1px solid #dfe3eb;
  padding: 0.85rem 0;
}
.doc-search-result:first-child {
  border-top: none;
}
.doc-search-result a {
  color: #005c99;
  font-weight: 600;
  text-decoration: none;
}
.doc-search-result a:hover {
  text-decoration: underline;
}
.doc-search-snippet {
  margin: 0.35rem 0 0;
  font-size: 0.95rem;
  color: #353c48;
}
.doc-search-meta {
  margin: 0.2rem 0 0;
  font-size: 0.85rem;
  color: #5e6673;
}
.doc-search-more-button {
  margin-top: 0.75rem;
  padding: 0.45rem 0.9rem;
  border-radius: 4px;
  border: 1px solid #0077cc;
  background: #fff;
  color: #0077cc;
  cursor: pointer;
  font-size: 0.95rem;
  display: none;
}
.doc-search-more-button.visible {
  display: inline-block;
}
.return-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.9rem;
  border: 1px solid #0077cc;
  background: #fff;
  color: #0077cc;
  border-radius: 4px;
  font-size: 0.95rem;
  transition: all 0.15s ease-in-out;
}
.return-link:hover {
  background: rgba(0, 119, 204, 0.08);
}
.return-link {
  text-decoration: none;
  font-weight: 600;
  flex: 0 0 auto;
}
.page-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex: 0 0 auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.page-actions > * {
  min-width: 7.5rem;
  box-sizing: border-box;
}
.view-toggle-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.4rem 0.9rem;
  border: 1px solid #0077cc;
  background: #fff;
  color: #0077cc;
  border-radius: 4px;
  font-size: 0.95rem;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}
.view-toggle-button:hover {
  background: rgba(0, 119, 204, 0.08);
}
.view-toggle-button[aria-pressed="true"] {
  background: #0077cc;
  color: #fff;
}
.view-toggle-button[aria-pressed="true"]:hover {
  background: #005c99;
}
.interlaced-container {
  display: flex;
  flex-direction: column;
  gap: 0.95rem;
  overflow-anchor: none;
}
.interlaced-group {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.interlaced-block {
  margin: 0;
}
.interlaced-reasoning-panel[hidden] {
  display: none;
}
.interlaced-reasoning-panel {
  position: relative;
  left: 50%;
  width: 100vw;
  margin-left: -50vw;
  margin-right: -50vw;
  background: #f8fafc;
}
.interlaced-reasoning-card {
  border: none;
  border-radius: 0;
  padding: 1rem;
  background: transparent;
  box-sizing: border-box;
}
.interlaced-reasoning-preview[hidden],
.interlaced-reasoning-full[hidden] {
  display: none;
}
.interlaced-reasoning-title {
  margin: 0 0 0.55rem;
  font-weight: 600;
  color: #334155;
}
.interlaced-reasoning-preview-content {
  margin-bottom: 0.75rem;
}
.interlaced-label {
  font-weight: 600;
  margin-bottom: 0.3rem;
}
.marker-code {
  font-weight: 400;
  color: #666;
  margin-left: 0.35rem;
}
.term-match {
  border-radius: 0.2rem;
  cursor: pointer;
  transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}
.interlaced-group .term-match {
  background: rgba(148, 163, 184, 0.35);
}
.interlaced-group .term-match:hover {
  background: rgba(148, 163, 184, 0.55);
}
.term-match.is-active {
  background: rgba(59, 130, 246, 0.35) !important;
  color: #1d4ed8;
}
.search-hit {
  background: #fff176;
  color: inherit;
  border-radius: 0.15rem;
  padding: 0 0.08rem;
  box-shadow: 0 0 0 1px rgba(202, 138, 4, 0.18);
}
.search-hit.is-current {
  background: #ffd54f;
  box-shadow: 0 0 0 2px rgba(202, 138, 4, 0.32);
}
.search-focused-block {
  scroll-margin-top: 5.5rem;
}
.reasoning-term-item[data-term-key] {
  border-radius: 0.35rem;
  cursor: pointer;
  padding: 0.1rem 0.25rem;
  transition: background-color 0.15s ease-in-out, color 0.15s ease-in-out;
}
.reasoning-section + .reasoning-section,
.reasoning-preview-section + .reasoning-preview-section {
  margin-top: 0.85rem;
}
.reasoning-section-title,
.reasoning-preview-category {
  margin: 0 0 0.35rem;
}
.reasoning-preview-category {
  color: #334155;
  font-weight: 600;
}
.reasoning-section-list,
.reasoning-preview-list {
  margin: 0;
  padding-left: 1.25rem;
}
.reasoning-preview-item {
  padding: 0.1rem 0;
}
.reasoning-preview-more {
  padding: 0;
  border: none;
  background: transparent;
  color: #0077cc;
  cursor: pointer;
  font-size: 0.92rem;
  text-decoration: underline;
}
.reasoning-preview-more:hover {
  color: #005c99;
}
.reasoning-term-item.is-active,
.reasoning-preview-item.is-active {
  background: rgba(59, 130, 246, 0.14);
  color: #1d4ed8;
}
.interlaced-content {
  margin: 0;
}
.interlaced-empty {
  color: #666;
  font-style: italic;
  margin: 0.5rem 0;
}
body.hide-english .interlaced-block.translation {
  display: none !important;
}
body.hide-chinese .interlaced-block.original,
body.hide-chinese .interlaced-reasoning-trigger-row {
  display: none !important;
}
@media (max-width: 700px) {
  h1 {
    font-size: 1.45rem;
    line-height: 1.2;
    overflow-wrap: anywhere;
  }
  .doc-header {
    overflow-wrap: anywhere;
  }
  .page-toolbar {
    position: static;
    flex-direction: column-reverse;
    align-items: stretch;
    gap: 0.75rem;
    padding: 0.75rem 0;
  }
  .page-actions {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.5rem;
    width: 100%;
  }
  .page-actions > * {
    min-width: 0;
    width: 100%;
  }
  .view-toggle-button,
  .return-link {
    min-height: 44px;
    width: 100%;
    box-sizing: border-box;
    padding: 0.55rem 0.75rem;
    text-align: center;
  }
  .doc-search {
    flex-basis: auto;
    max-width: none;
    width: 100%;
  }
  .doc-search-input {
    min-height: 44px;
  }
  .doc-search-results {
    position: static;
    box-sizing: border-box;
    margin-top: 0.5rem;
    max-height: 65vh;
    box-shadow: none;
  }
  .doc-search-more-button {
    min-height: 44px;
    width: 100%;
    box-sizing: border-box;
  }
  .chunk-layout {
    grid-template-columns: minmax(2rem, max-content) minmax(0, 1fr);
    column-gap: 0.5rem;
    align-items: start;
  }
  .chunk-marker-column {
    padding-top: 0.1rem;
  }
  .chunk-text-column,
  .interlaced-content,
  .reasoning-section-list,
  .reasoning-preview-list {
    overflow-wrap: anywhere;
    word-break: break-word;
  }
  .chunk-text-column p {
    margin: 0.45rem 0;
  }
  .chunk-text-column pre,
  .interlaced-content pre {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
  }
  .chunk-text-column code,
  .interlaced-content code {
    overflow-wrap: anywhere;
    white-space: pre-wrap;
  }
  .interlaced-reasoning-trigger-row {
    margin-left: 2.5rem;
  }
  .interlaced-reasoning-trigger-row .reasoning-trigger {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
  }
  .interlaced-reasoning-panel {
    left: auto;
    width: auto;
    margin-left: -1rem;
    margin-right: -1rem;
  }
  .interlaced-reasoning-card {
    padding: 0.85rem 1rem;
  }
}
@media (max-width: 420px) {
  .chunk-layout {
    grid-template-columns: minmax(1.65rem, max-content) minmax(0, 1fr);
    column-gap: 0.4rem;
  }
  .chunk-marker-column .marker-trailing {
    font-size: 0.78rem;
  }
  .interlaced-reasoning-trigger-row {
    margin-left: 2.05rem;
  }
}

/* ---------- Passage pages ---------- */
.pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}
.pager-bottom {
  margin: 2rem 0 1rem;
  padding-top: 1rem;
  border-top: 1px solid #dbe1ec;
}
.pager-status {
  color: #5e6673;
}
.pager-links {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  list-style: none;
  margin: 0;
  padding: 0;
}
.pager-links a,
.pager-links span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.2rem;
  min-height: 2.2rem;
  padding: 0 0.55rem;
  box-sizing: border-box;
  border-radius: 4px;
}
.pager-links a {
  border: 1px solid #b7c0d0;
  color: #005c99;
  text-decoration: none;
  background: #fff;
}
.pager-links a:hover {
  border-color: #0077cc;
  background: #eaf2fa;
}
.pager-links a:focus-visible {
  outline: 3px solid #075b9a;
  outline-offset: 2px;
}
.pager-links [aria-current="page"] {
  border: 1px solid #075b9a;
  background: #075b9a;
  color: #fff;
  font-weight: 700;
}
.pager-links .pager-gap {
  min-width: 1rem;
  padding: 0;
  color: #5e6673;
}
.pager-links .pager-disabled {
  border: 1px solid #e3e7ee;
  color: #a0a8b5;
}
.pager-jump {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.4rem;
}
.pager-jump input {
  width: 6rem;
  padding: 0.35rem 0.5rem;
  font-size: 0.95rem;
  border: 1px solid #b7c0d0;
  border-radius: 4px;
}
.pager-jump button {
  padding: 0.35rem 0.75rem;
  border: 1px solid #0077cc;
  border-radius: 4px;
  background: #fff;
  color: #0077cc;
  cursor: pointer;
  font-size: 0.95rem;
}
.pager-jump-message {
  color: #a1260d;
  font-size: 0.85rem;
}

/* ---------- Search hit bar ---------- */
.search-hit-bar {
  position: fixed;
  left: 50%;
  bottom: 1rem;
  transform: translateX(-50%);
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  max-width: calc(100vw - 2rem);
  box-sizing: border-box;
  padding: 0.5rem 0.6rem 0.5rem 0.9rem;
  border: 1px solid #e0b84a;
  border-radius: 8px;
  background: #fffbea;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.18);
  font-size: 0.92rem;
}
.search-hit-bar[hidden] {
  display: none;
}
.search-hit-label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.search-hit-bar button {
  flex: 0 0 auto;
  min-width: 2.2rem;
  min-height: 2.2rem;
  border: 1px solid #c9a227;
  border-radius: 4px;
  background: #fff;
  color: #5b4500;
  cursor: pointer;
  font-size: 0.95rem;
}
.search-hit-bar button:disabled {
  opacity: 0.45;
  cursor: default;
}
.search-focused-block {
  outline: 2px solid rgba(202, 138, 4, 0.35);
  outline-offset: 4px;
  border-radius: 4px;
}
@media (max-width: 700px) {
  .pager {
    gap: 0.5rem;
  }
  .pager-links a,
  .pager-links span,
  .search-hit-bar button {
    min-width: 44px;
    min-height: 44px;
  }
  .search-hit-bar {
    left: 0.75rem;
    right: 0.75rem;
    transform: none;
    max-width: none;
  }
  .search-hit-label {
    flex: 1 1 auto;
    white-space: normal;
  }
}

/* ---------- In-document search result pages ---------- */
.doc-search-pager {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.6rem;
}
.doc-search-pager[hidden] {
  display: none;
}
.doc-search-pager button {
  min-width: 2.2rem;
  min-height: 2.2rem;
  padding: 0 0.55rem;
  border: 1px solid #b7c0d0;
  border-radius: 4px;
  background: #fff;
  color: #005c99;
  cursor: pointer;
  font-size: 0.9rem;
}
.doc-search-pager button:disabled {
  color: #a0a8b5;
  border-color: #e3e7ee;
  cursor: default;
}
.doc-search-pager button[aria-current="page"] {
  background: #075b9a;
  border-color: #075b9a;
  color: #fff;
  font-weight: 700;
}
.doc-search-pager-gap {
  color: #5e6673;
}
@media (max-width: 700px) {
  .doc-search-pager button {
    min-width: 44px;
    min-height: 44px;
  }
}
