:root {
  --black: #07101d;
  --white: #f7faf8;
  --ink: #0a1110;
  --muted: #68766f;
  --emerald: #2ee39b;
  --emerald-deep: #0d9b6c;
  --line: #dbe5df;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html, body { min-height: 100%; }
body { margin: 0; color: var(--ink); background: var(--white); font-family: var(--sans); }
a { color: inherit; text-decoration: none; }

/* Base shared by every guide page. */
body.guide-page {
  width: min(100% - 16px, 1000px);
  margin: 0 auto;
}

body.guide-page img {
  max-width: 100%;
  height: auto;
}

.control-input,
.control-combo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 28px;
  white-space: nowrap;
}

.controls-table td:first-child,
.controls-table th:first-child {
  text-align: center;
}

.controls-table .control-input,
.controls-table .control-combo {
  width: 100%;
}

.controls-table {
  color: var(--ink);
  background: var(--white);
}

.controls-table th,
.controls-table td {
  color: var(--ink);
}

.control-sprite {
  display: inline-block;
  width: auto;
  max-width: none !important;
  height: 24px;
  object-fit: contain;
  vertical-align: middle;
}

body.guide-page img.control-sprite { height: 24px; }
body.guide-page img.control-sprite--dpad { height: 28px; }
body.guide-page img.control-sprite--shoulder { height: 18px; }
.control-plus { color: var(--emerald-deep); font-weight: 700; }
.control-text-button {
  display: inline-block;
  padding: 3px 7px;
  border: 2px solid var(--black);
  border-radius: 999px;
  color: var(--white);
  background: var(--black);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: uppercase;
}

.guide-home-button {
  position: fixed;
  z-index: 1000;
  top: 5px;
  left: 5px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: #06151a;
  background: var(--emerald);
  border: 0;
  border-radius: 7px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 22px;
  font-style: italic;
  font-weight: 700;
  line-height: 1;
}

.guide-home-button:hover { background: #58efb2; }

.guide-settings-button {
  position: fixed;
  z-index: 1000;
  top: 5px;
  right: 5px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  color: var(--emerald);
  background: var(--black);
  border: 0;
  border-radius: 7px;
  -webkit-appearance: none;
  appearance: none;
  font-family: "Segoe UI Symbol", sans-serif;
  font-variant-emoji: text;
  font-size: 21px;
  line-height: 1;
  cursor: pointer;
}

.guide-settings-button:hover { color: #58efb2; background: #0b1627; }

.guide-settings-panel {
  position: fixed;
  z-index: 999;
  top: 44px;
  right: 5px;
  display: grid;
  gap: 6px;
  padding: 8px;
  border: 1px solid var(--line);
  background: #f7faf8;
  box-shadow: 0 5px 18px rgba(7, 16, 29, .12);
}

.guide-settings-option {
  min-width: 48px;
  padding: 7px 9px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: #fff;
  font-family: var(--sans);
  font-size: 12px;
  white-space: nowrap;
  cursor: pointer;
}

.guide-settings-option:hover,
.guide-settings-option.is-active {
  color: #06151a;
  border-color: var(--emerald-deep);
  background: var(--emerald);
}

.guide-settings-panel[hidden] { display: none; }

body.guide-controls-dim .guide-home-button,
body.guide-controls-dim .guide-settings-button {
  opacity: .1;
}

body.guide-scale-2x { font-size: 200%; }
body.guide-scale-2x img { max-width: 100%; }
body.guide-scale-2x .chapter-next-link { font-size: 26px; }

body.guide-two-up .guide-image-group {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  align-items: start;
}

body.guide-two-up .guide-image-group > img {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: auto;
}

.chapter-heading {
  width: calc(100% - 78px);
  box-sizing: border-box;
  margin: 16px auto 30px;
  padding: 0 46px;
  text-align: center;
}

.chapter-heading-title {
  margin: 0;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(25px, 4vw, 40px);
  font-weight: 400;
  letter-spacing: -.04em;
  line-height: 1;
}

.chapter-heading-name {
  display: block;
  margin: 6px 0 0;
  color: var(--muted);
  font-family: var(--sans);
  font-size: 12px;
}

.chapter-next {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  clear: both;
  padding: 30px 12px 44px;
}

.chapter-next-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: #fff;
  font-family: var(--sans);
  font-size: 13px;
  text-decoration: none;
}

.chapter-next-link:hover {
  color: #06151a;
  border-color: var(--emerald-deep);
  background: var(--emerald);
}

/* Shared guide menu. */
.guide-menu-page { width: 100%; }
.guide-banner { width: 100%; margin: 0; }
.guide-banner img { width: 100%; height: auto; display: block; }
.menu-main { width: calc(100% - 4px); margin: 0 auto; padding: 24px 2px 80px; }
.guide-type-menu,
.speedrun-category-menu {
  width: min(760px, 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 auto;
}
.guide-type-menu { margin-bottom: 9px; }
.speedrun-category-menu { margin-bottom: 20px; }
.guide-type-button,
.speedrun-category-button {
  padding: 7px 12px;
  color: var(--ink);
  border: 1px solid var(--line);
  background: transparent;
  font-family: inherit;
  font-size: 12px;
  text-decoration: none;
  cursor: pointer;
}
.guide-type-button:hover,
.guide-type-button.is-active,
.speedrun-category-button:hover,
.speedrun-category-button.is-active {
  color: #06151a;
  border-color: var(--emerald-deep);
  background: var(--emerald);
}
.speedrun-category-button { padding: 5px 9px; font-size: 10px; }
.guide-type-button:focus-visible,
.speedrun-category-button:focus-visible {
  outline: 2px solid var(--emerald-deep);
  outline-offset: 2px;
}
.guide-menu-page [hidden] { display: none !important; }
.guide-menu-page h1 {
  margin: 0 0 34px;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(30px, 5vw, 46px);
  font-weight: 400;
  letter-spacing: -.05em;
  line-height: 1;
  text-align: center;
}
.guide-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 5px;
  width: min(760px, 100%);
  margin: -20px auto 22px;
}
.guide-tags .tag-chip {
  display: inline-block;
  padding: 3px 6px;
  color: var(--emerald-deep);
  border: 1px solid var(--line);
  font-size: 10px;
  line-height: 1.1;
}
.guide-tags .tag-chip:hover {
  color: var(--ink);
  border-color: var(--emerald-deep);
  background: rgba(46, 227, 155, .12);
}
.chapter-list { width: min(760px, 100%); margin: 0 auto; border-top: 1px solid var(--line); }
.chapter-link {
  --chapter-progress: 0%;
  min-height: 60px;
  display: grid;
  grid-template-columns: 52px 1fr 24px;
  align-items: center;
  gap: 14px;
  border-bottom: 1px solid var(--line);
  background: linear-gradient(90deg, rgba(46, 227, 155, .25) 0 var(--chapter-progress), transparent var(--chapter-progress) 100%);
  font-size: 14px;
}
.chapter-link:hover { color: var(--emerald-deep); }
.chapter-number { color: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chapter-arrow { color: var(--emerald-deep); font-size: 18px; text-align: right; }

@media (max-width: 600px) {
  .topbar { padding: 0 5px; }
  .menu-main { width: min(100% - 28px, 520px); padding-top: 24px; }
  .chapter-link { grid-template-columns: 40px 1fr 20px; gap: 8px; }

  .guide-home-button,
  .guide-settings-button {
    width: 44px;
    height: 44px;
  }

  .guide-home-button { font-size: 28px; }
  .guide-settings-button { font-size: 27px; }
  .guide-settings-panel { top: 54px; }
  body.guide-page img.control-sprite { height: 24px; }
  body.guide-page img.control-sprite--dpad { height: 28px; }
  body.guide-page img.control-sprite--shoulder { height: 18px; }
}
