.guide-section,
.guide-toc {
  scroll-margin-top: 1rem;
}

.guide-section {
  overflow-wrap: anywhere;
}

.guide-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: .75rem;
  margin-bottom: .9rem;
}

.guide-toc ul {
  display: flex;
  flex-wrap: wrap;
  gap: .5rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.guide-toc a,
.guide-toc-back {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding-inline: .75rem;
  color: var(--accent);
}

.guide-toc a {
  border: 1px solid var(--brand-light);
  border-radius: .5rem;
}

.guide-section-heading {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  column-gap: .5rem;
  margin-block-end: .65rem;
}

.guide-section-heading h2 {
  flex: 1 1 12rem;
  margin-block-end: 0;
}

.guide-toc-back { margin-inline-start: auto; }
.guide-related a { color: var(--accent); }

.guide-controls > .character-filter-control {
  flex: 1 1 12rem;
  min-width: 0;
}

.guide-controls .guide-search {
  flex-basis: 20rem;
}

.guide-controls label > span {
  color: var(--accent);
}

.guide-search > label,
.guide-mobile-heading {
  color: var(--accent);
  font-size: .78rem;
  font-weight: 900;
  line-height: 1.2;
}

.guide-mobile-heading {
  align-self: center;
  text-align: center;
}

.guide-controls :is(input, select, button),
.guide-table :is(button, .character-name-button),
.guide-section .character-mobile-sort-button,
.guide-section .character-name-button {
  min-height: 44px;
}

.guide-table th:first-child { width: 35%; }
.guide-table th:nth-child(2) { width: 19%; }
.guide-table th:not([aria-sort]) { padding: .7rem; }
.guide-table tbody td { font-weight: 500; }
.guide-table .character-name-button { font-weight: 800; }

.guide-section .character-card-summary,
.guide-section .character-mobile-list-head {
  grid-template-columns: minmax(0, 1fr) minmax(5.5rem, 34%);
}

.guide-section .character-mobile-list-head { padding-inline: 0; }

.guide-section .character-name-button {
  justify-content: space-between;
  width: 100%;
}

.guide-card-info {
  margin: 0;
  padding: 0 .65rem .6rem;
  line-height: 1.45;
}

.guide-details {
  display: grid;
  gap: .55rem;
  padding: .65rem;
  font-weight: 400;
}

.guide-field {
  padding: .55rem .7rem;
  border: 1px solid var(--brand-light);
  border-radius: .5rem;
  background: var(--paper-color);
}

.guide-field h3 { margin: 0 0 .25rem; color: var(--accent); font-size: 1rem; }
.guide-field p, .guide-steps p { margin: 0; }
.guide-field ol, .guide-steps { margin-block: .35rem; padding-inline-start: 1.5rem; }
.guide-field li + li, .guide-steps li + li { margin-top: .45rem; }

body[data-page="home"] .home-card-title { text-wrap: balance; }

@media (max-width: 850px) {
  .guide-section-heading h2 {
    flex: 1 0 max-content;
    max-inline-size: 100%;
  }
  .guide-toc-back { margin-inline-end: 3rem; }
}

@media (min-width: 851px) {
  body[data-page="home"] .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  /* Keep sidebar controls clear of the shared fixed TOP button. */
  body.arc-guide .layout-shell { padding-inline-end: 64px; }
}
