/* How-to-play guide. Scoped under .guide; every colour and font is a token
   from style.css (:root), nothing is declared on :root here. */

.guide {
  max-width: var(--maxw);
  margin: 0 auto;
  padding: 32px 16px 64px;
  color: var(--ink);
  font-family: var(--font);
  line-height: 1.55;
  counter-reset: sec -1 fig 0;
}
.guide > header {
  border-bottom: 1px solid var(--line);
  padding-bottom: 16px;
  margin-bottom: 24px;
}
.guide h1 {
  font-size: 1.75rem;
  line-height: 1.2;
  margin: 0 0 6px;
}
.guide .kicker {
  font-family: var(--mono);
  font-size: 0.75rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.guide p { margin: 0 0 12px; }
.guide a { color: var(--accent); }
.guide code {
  font-family: var(--mono);
  font-size: 0.9em;
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 3px;
}
.guide .note {
  border-left: 3px solid var(--accent);
  background: var(--code-bg);
  padding: 10px 14px;
  margin: 0 0 16px;
}

/* Table of contents */
.guide .toc {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 14px 18px;
  margin: 0 0 32px;
}
.guide .toc ol {
  columns: 2;
  column-gap: 32px;
  margin: 0;
  padding-left: 0;
  list-style: none;
  counter-reset: toc -1;
}
.guide .toc li {
  counter-increment: toc;
  break-inside: avoid;
  padding: 3px 0;
  font-size: 0.95rem;
}
.guide .toc li::before {
  content: counter(toc) ".";
  display: inline-block;
  min-width: 2em;
  font-family: var(--mono);
  color: var(--muted);
}
.guide .toc a { text-decoration: none; }
.guide .toc a:hover { text-decoration: underline; }

/* Numbered sections */
.guide section {
  counter-increment: sec;
  margin: 0 0 44px;
  scroll-margin-top: 16px;
}
.guide section > h2 {
  font-size: 1.35rem;
  line-height: 1.25;
  margin: 0 0 14px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}
.guide section > h2::before {
  content: counter(sec);
  display: inline-block;
  min-width: 2.2em;
  font-family: var(--mono);
  font-weight: normal;
  color: var(--accent);
}
.guide h3 {
  font-family: var(--mono);
  font-size: 0.8rem;
  font-weight: normal;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 22px 0 8px;
}
.guide ul { margin: 0 0 12px; padding-left: 22px; }
.guide li { margin: 0 0 4px; }

/* Definition lists: term in the left column, meaning in the right */
.guide dl {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 16px;
  margin: 0 0 16px;
}
.guide dt {
  font-weight: 600;
  white-space: nowrap;
}
.guide dt kbd { margin-right: 2px; }
.guide dd { margin: 0; }

/* Tables */
.guide table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 16px;
  font-size: 0.95rem;
  background: var(--panel);
}
.guide th, .guide td {
  text-align: left;
  vertical-align: top;
  padding: 7px 10px;
  border-bottom: 1px solid var(--line);
}
.guide th {
  font-family: var(--mono);
  font-size: 0.75rem;
  font-weight: normal;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom-width: 2px;
}
.guide td.k { white-space: nowrap; width: 1%; }
.guide .key-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 24px;
  align-items: start;
}

/* Rarity swatches */
.guide .swatch {
  display: inline-block;
  width: 0.9em;
  height: 0.9em;
  vertical-align: -0.1em;
  margin-right: 6px;
  border-radius: 2px;
  border: 1px solid var(--line);
}

/* The WASD diagram: an inverted T of keycaps */
.guide .keys-wasd {
  display: grid;
  grid-template-columns: repeat(3, 44px);
  grid-template-rows: repeat(2, 44px);
  gap: 6px;
  margin: 8px 0 16px;
}
.guide .keys-wasd kbd {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  font-size: 1rem;
  box-sizing: border-box;
}
.guide .keys-wasd .w { grid-column: 2; grid-row: 1; }
.guide .keys-wasd .a { grid-column: 1; grid-row: 2; }
.guide .keys-wasd .s { grid-column: 2; grid-row: 2; }
.guide .keys-wasd .d { grid-column: 3; grid-row: 2; }
.guide .keys-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 24px;
  align-items: flex-start;
  margin: 0 0 16px;
}

/* Figures, numbered by a counter */
.guide figure {
  margin: 18px 0 22px;
  counter-increment: fig;
}
.guide figure img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #000;
  image-rendering: auto;
}
.guide figcaption {
  font-family: var(--mono);
  font-size: 0.8rem;
  color: var(--muted);
  margin-top: 6px;
}
.guide figcaption::before {
  content: "Fig. " counter(fig) " \2014  ";
  color: var(--ink);
}
.guide .fig-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 20px;
}

@media (max-width: 700px) {
  .guide { padding: 24px 16px 48px; }
  .guide .toc ol { columns: 1; }
  .guide dl { grid-template-columns: 1fr; gap: 2px 0; }
  .guide dd { margin: 0 0 10px; }
  .guide .key-tables { grid-template-columns: 1fr; }
  .guide .fig-pair { grid-template-columns: 1fr; }
  .guide table { font-size: 0.9rem; }
  .guide th, .guide td { padding: 6px 6px; }
}
