#field-guide {
  width: min(71rem, calc(100% - 2rem));
  max-width: none;
  max-height: min(94dvh, 56rem);
  padding: 0;
  border: 1px solid #aa795e;
  border-radius: .8rem;
  box-shadow: 0 1.4rem 5rem #0b0709cc;
  background: #231a19;
  color: var(--paper, #fff2d9);
}

#field-guide[open] {
  display: flex;
  flex-direction: column;
}

#field-guide::backdrop, .guide-art-dialog::backdrop { background: #140c0cce; }

#field-guide > header, #field-guide > .guide-bar {
  flex: none;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: .6rem;
  padding: .55rem clamp(.8rem, 3vw, 1.65rem);
  border-bottom: 1px solid #674636;
  background: #312220;
}

#field-guide > header h2, #field-guide > .guide-bar h2 {
  font-size: clamp(1.1rem, 3vw, 1.55rem);
  margin: 0;
}

#guide-content {
  overflow: auto;
  overscroll-behavior: contain;
  scrollbar-color: #996c54 #231a19;
}

.guide-manual {
  color: var(--paper, #fff2d9);
  font-size: 1rem;
  line-height: 1.5;
}

.guide-nav {
  position: sticky;
  z-index: 1;
  top: 0;
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  padding: .6rem clamp(.8rem, 3vw, 1.65rem);
  background: #231a19;
  border-bottom: 1px solid #563a31;
}

.guide-nav button {
  min-height: 44px;
  padding: .4rem .7rem;
  border: 1px solid #674738;
  border-radius: .4rem;
  background: #322420;
  color: var(--paper, #fff2d9);
  font-size: .88rem;
  font-weight: 700;
  white-space: nowrap;
}

.guide-nav button:hover, .guide-nav button[aria-pressed="true"] {
  color: #261915;
  border-color: var(--gold, #ffc06a);
  background: var(--gold, #ffc06a);
}

.guide-chapter { padding: 1.1rem clamp(.8rem, 3vw, 1.65rem) 1.8rem; }
.guide-chapter h3 {
  margin: 0 0 .3rem;
  font-size: clamp(1.5rem, 4.5vw, 2.5rem);
  line-height: 1.1;
  letter-spacing: -.04em;
}

.guide-chapter p, .guide-chapter h4, .guide-chapter figure { margin: 0; }
.guide-chapter h4 { font-size: 1.08rem; line-height: 1.25; }
.guide-chapter .guide-intro {
  max-width: 64ch;
  margin: 0 0 1.05rem;
  color: var(--muted, #d4bca5);
}

.guide-steps {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  border: 1px solid #68463a;
  border-radius: .55rem;
  background: #68463a;
  list-style-type: none;
  counter-reset: guide-step;
}

.guide-steps li {
  position: relative;
  padding: .95rem .85rem .95rem 3.5rem;
  background: #332622;
  counter-increment: guide-step;
}

.guide-steps li::before {
  position: absolute;
  top: .88rem;
  left: .85rem;
  display: grid;
  place-items: center;
  width: 1.95rem;
  height: 1.95rem;
  border-radius: 50%;
  background: #4c352c;
  color: var(--gold, #ffc06a);
  content: counter(guide-step);
  font-weight: 800;
}

.guide-steps p, .guide-event-grid p {
  margin-top: .3rem;
  color: var(--muted, #d4bca5);
}

.guide-chapter .guide-subhead {
  margin-top: 1.4rem;
  margin-bottom: .65rem;
  font-size: 1.16rem;
}

.guide-event-grid, .guide-level-grid, .guide-crew-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .65rem;
}

.guide-event-grid article, .guide-level-card, .guide-crew-card, .guide-asset {
  border: 1px solid #68463a;
  border-radius: .5rem;
  background: #302422;
}

.guide-event-grid article { padding: .85rem; }
.guide-crew-card {
  display: grid;
  grid-template-columns: minmax(4.5rem, 36%) minmax(0, 1fr);
  gap: .7rem;
  padding: .7rem;
  align-content: start;
}

.guide-crew-card > figure { align-self: start; }
.guide-crew-bio:only-child { grid-column: 1 / -1; }
.guide-crew-card img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: .4rem;
  aspect-ratio: 1;
}

.guide-crew-bio h4, .guide-level-body h4 { font-size: 1.26rem; }
.guide-chapter .guide-role {
  margin: .14rem 0 .38rem;
  color: var(--gold, #ffc06a);
  font-size: .9rem;
  font-weight: 750;
}

.guide-crew-bio > p:not(.guide-role), .guide-level-body > p:not(.guide-role) {
  color: var(--muted, #d4bca5);
}

.guide-crew-bio dl { margin: .58rem 0 0; }
.guide-crew-bio dt { font-size: .9rem; font-weight: 750; }
.guide-crew-bio dd { margin: 0 0 .4rem; color: var(--muted, #d4bca5); }
.guide-crew-bio .guide-character-tip { margin-top: .5rem; }
.guide-downloads { display: flex; flex-wrap: wrap; gap: 0 .72rem; }

.guide-download {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  color: var(--gold, #ffc06a);
  font-size: .88rem;
  font-weight: 650;
  text-underline-offset: .15em;
}

.guide-download:hover { color: #ffe0ac; }
.guide-level-image {
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: .45rem .45rem 0 0;
  overflow: hidden;
  background: #432f27;
  cursor: zoom-in;
}

.guide-level-image:hover { box-shadow: inset 0 0 0 2px #ebad6a; }
.guide-level-image img { display: block; width: 100%; height: auto; aspect-ratio: 3 / 2; }
.guide-venue-map img { aspect-ratio: auto; }
.guide-level-body { padding: .7rem .78rem .45rem; }
.guide-level-body h4 { margin-bottom: .32rem; }
.guide-level-body .guide-note { margin-top: .45rem; }
.guide-targets {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: .25rem .75rem;
  margin: .62rem 0 0;
  padding: 0;
  list-style: none;
  font-size: .86rem;
  font-variant-numeric: tabular-nums;
}

.guide-targets li { display: flex; gap: .22rem; align-items: baseline; }
.guide-targets li span:first-child { color: var(--gold, #ffc06a); letter-spacing: -.04em; }
.guide-catalog {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 11.75rem), 1fr));
  gap: .55rem;
}

.guide-asset {
  display: grid;
  grid-template-rows: max-content 1fr;
  overflow: hidden;
}

.guide-asset img {
  display: block;
  width: 5.5rem;
  height: 5.5rem;
  margin: .38rem auto .1rem;
}

.guide-asset > figcaption {
  display: flex;
  flex-direction: column;
  padding: .15rem .7rem .25rem;
  background: transparent;
}

.guide-asset figcaption p { margin-top: .28rem; color: var(--muted, #d4bca5); }
.guide-asset figcaption .guide-download { align-self: start; margin-top: auto; }
.guide-score-table {
  width: min(100%, 42rem);
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
  background: #302422;
}

.guide-score-table th, .guide-score-table td {
  padding: .48rem .68rem;
  border-bottom: 1px solid #563a31;
  text-align: left;
}

.guide-score-table thead th { color: var(--gold, #ffc06a); background: #482f28; }
.guide-score-table th:last-child, .guide-score-table td:last-child { text-align: right; }
.guide-score-table tbody tr:nth-child(even) { background: #372923; }
.guide-chapter .guide-score-example { max-width: 65ch; margin-top: .6rem; color: var(--muted, #d4bca5); }

.guide-references {
  display: grid;
  gap: .35rem;
  padding-left: 1.3rem;
  margin: 0;
  color: var(--muted, #d4bca5);
}
.guide-references a { color: var(--gold, #ffc06a); text-underline-offset: .15em; }

.guide-art-dialog {
  width: min(46rem, calc(100% - 1.25rem));
  max-height: 94dvh;
  padding: .65rem;
  border: 1px solid #aa795e;
  border-radius: .55rem;
  color: var(--paper, #fff2d9);
  background: #231a19;
  overflow: auto;
  overscroll-behavior: contain;
}

.guide-art-dialog h3 { margin: .4rem 0 .55rem; }
.guide-art-dialog img { display: block; width: 100%; height: auto; border-radius: .32rem; }
.guide-art-close { display: block; margin-left: auto; }

@media (max-width: 48rem) {
  #field-guide { width: min(100% - .8rem, 42rem); }
  .guide-crew-grid { grid-template-columns: minmax(0, 1fr); }
  .guide-crew-card { grid-template-columns: minmax(5.5rem, 7.2rem) minmax(0, 1fr); }
}

@media (max-width: 34rem) {
  #field-guide { max-height: 96dvh; }
  .guide-nav { overflow-x: auto; flex-wrap: nowrap; scrollbar-width: thin; }
  .guide-steps, .guide-event-grid, .guide-level-grid { grid-template-columns: minmax(0, 1fr); }
  .guide-catalog { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 23rem) {
  .guide-crew-card { grid-template-columns: minmax(4.2rem, 24%) minmax(0, 1fr); }
  .guide-crew-bio h4 { font-size: 1.06rem; }
}
