.guide-screen {
  overflow: visible;
}

.guide-wrap {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: var(--space);
  display: flex;
  flex-direction: column;
  gap: var(--space-sm);
}

.guide-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.guide-tab {
  background: var(--panel-soft);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 18px;
  cursor: pointer;
  font: inherit;
  font-weight: 700;
}

.guide-tab.active {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: var(--accent);
}

.guide-toc {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
  font-size: var(--text-sm);
}

.guide-toc a {
  color: var(--muted);
  text-decoration: none;
}

.guide-toc a:hover {
  color: var(--accent);
  text-decoration: underline;
}

.guide-lead {
  margin: var(--space-sm) 0 0;
  padding: var(--space-sm) var(--space);
  background: var(--panel);
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  line-height: 1.5;
}

.guide-step {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: var(--space);
  margin-top: var(--space-sm);
  scroll-margin-top: var(--space);
}

.guide-step h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0;
}

.guide-step > p {
  margin: 6px 0 var(--space-sm);
  line-height: 1.45;
}

.guide-notes {
  margin: 0 0 var(--space-sm);
  padding-left: 1.25em;
  line-height: 1.5;
}

.guide-notes li + li {
  margin-top: 6px;
}

.guide-step-n {
  display: inline-grid;
  place-items: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 15px;
  flex: 0 0 auto;
}

.guide-step-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(240px, 320px);
  gap: var(--space);
  align-items: start;
}

.guide-fig-scroll {
  min-width: 0;
  overflow-x: auto;
  padding: 14px 6px 6px;
}

.guide-fig {
  position: relative;
  margin: 0;
  border-radius: 10px;
  box-shadow: 0 0 0 1px var(--line), 0 6px 18px rgba(0, 0, 0, 0.15);
}

.guide-fig.narrow {
  max-width: 420px;
  margin: 0 auto;
}

.guide-fig img {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 10px;
}

.guide-mark {
  position: absolute;
  border: 2px solid #f43f5e;
  border-radius: 6px;
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.7);
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s;
}

.guide-mark.on,
.guide-mark.pinned {
  background: rgba(244, 63, 94, 0.2);
  border-color: #facc15;
  box-shadow: 0 0 0 3px rgba(250, 204, 21, 0.55);
  z-index: 2;
}

.guide-pin {
  position: absolute;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #f43f5e;
  color: #fff;
  font-size: 13px;
  font-weight: 800;
  line-height: 1;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
  z-index: 1;
}

.guide-pin::after {
  content: "";
  position: absolute;
  border: 6px solid transparent;
}

.guide-pin.pin-t { left: 0; bottom: calc(100% + 8px); }
.guide-pin.pin-t::after { top: 100%; left: 6px; border-top-color: #f43f5e; }

.guide-pin.pin-b { left: 0; top: calc(100% + 8px); }
.guide-pin.pin-b::after { bottom: 100%; left: 6px; border-bottom-color: #f43f5e; }

.guide-pin.pin-l { right: calc(100% + 8px); top: 50%; margin-top: -12px; }
.guide-pin.pin-l::after { left: 100%; top: 6px; border-left-color: #f43f5e; }

.guide-pin.pin-r { left: calc(100% + 8px); top: 50%; margin-top: -12px; }
.guide-pin.pin-r::after { right: 100%; top: 6px; border-right-color: #f43f5e; }

.guide-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: var(--text-sm);
  line-height: 1.4;
}

.guide-legend li {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  padding: 6px 8px;
  border-radius: 8px;
  cursor: pointer;
  outline: none;
}

.guide-legend li.on,
.guide-legend li.pinned {
  background: rgba(244, 63, 94, 0.12);
}

.guide-num {
  display: inline-grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #f43f5e;
  color: #fff;
  font-weight: 800;
  font-size: 12px;
  flex: 0 0 auto;
}

@media (max-width: 900px) {
  .guide-step-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 640px) {
  .guide-wrap {
    padding: var(--space-sm);
  }

  .guide-step {
    padding: var(--space-sm);
  }

  .guide-fig:not(.narrow) {
    width: 640px;
  }

  .guide-pin {
    width: 20px;
    height: 20px;
    font-size: 11px;
  }

  .guide-pin.pin-l,
  .guide-pin.pin-r {
    margin-top: -10px;
  }

  .guide-pin::after {
    border-width: 5px;
  }

  .guide-pin.pin-t::after,
  .guide-pin.pin-b::after { left: 5px; }

  .guide-pin.pin-l::after,
  .guide-pin.pin-r::after { top: 5px; }
}
