.mg-visual-guide {
  --mg-guide-top: 112px;
  padding-block: clamp(30px, 5vw, 62px);
  scroll-margin-top: var(--mg-guide-top);
}
.mg-guide-hero { max-width: 48rem; margin-bottom: clamp(24px, 4vw, 40px); }
.mg-guide-hero h1 { margin-bottom: 12px; }
.mg-guide-hero p { max-width: 59ch; margin: 0; }
.mg-guide-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: clamp(16px, 3vw, 34px); align-items: start; }
.mg-guide-sidebar {
  position: sticky;
  top: var(--mg-guide-top);
  max-height: calc(100dvh - var(--mg-guide-top) - 16px);
  overflow: auto;
  padding: 16px 12px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--surface);
}
.mg-guide-sidebar h2 { margin: 0 8px 10px; font-size: 1rem; font-weight: 650; }
.mg-guide-sidebar nav, .mg-guide-mobile nav { display: grid; gap: 4px; }
.mg-nav-link {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 40px;
  padding: 7px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: var(--muted);
  font-size: .86rem;
  line-height: 1.35;
  text-decoration: none;
}
.mg-nav-link:hover, .mg-nav-link[aria-current="location"] { color: var(--teal); background: var(--tint); }
.mg-nav-link[aria-current="location"] { border-color: var(--line); font-weight: 700; }
.mg-guide-mobile { display: none; }
.mg-guide-content { display: grid; gap: clamp(14px, 2.5vw, 25px); min-width: 0; }
.mg-guide-section {
  min-width: 0;
  padding: clamp(18px, 3vw, 30px);
  scroll-margin-top: var(--mg-guide-top);
}
.mg-guide-section:target { border-color: var(--teal); }
.mg-guide-section h2 { font-size: clamp(21px, 2.5vw, 28px); margin: 0 0 16px; }
.mg-section-grid { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); align-items: start; gap: clamp(16px, 2.5vw, 28px); }
.mg-guide-instruction ol { list-style: none; counter-reset: guide-step; padding: 0; margin: 0 0 16px; }
.mg-guide-instruction li[data-en] {
  position: relative;
  counter-increment: guide-step;
  min-height: 26px;
  padding-inline-start: 37px;
  margin-bottom: 12px;
  color: var(--ink);
  line-height: 1.6;
}
.mg-guide-instruction li[data-en]::before {
  content: counter(guide-step);
  position: absolute;
  inset-inline-start: 0;
  top: 1px;
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  background: var(--tint);
  color: var(--teal);
  font-weight: 700;
  font-size: .78rem;
}
.mg-examples { margin-top: 18px; }
.mg-examples h3 { font-size: .85rem; margin: 0 0 6px; }
.mg-examples a { color: var(--teal); text-decoration: underline; text-underline-offset: .2em; }
.mg-guide-section .mg-tool-link,
.mg-section-pagination .button {
  display: inline-flex;
  gap: 12px;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 8px 13px;
  border-radius: 10px;
  font-size: .86rem;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.mg-tool-link { margin: 0 6px 7px 0; }
.mg-section-pagination {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 13px;
  margin-top: 18px;
  border-top: 1px solid var(--line);
}
.mg-section-pagination .mg-pager-next, .mg-section-pagination .mg-pager-top { margin-inline-start: auto; }
.mg-chevron::after {
  content: '';
  flex: 0 0 auto;
  width: 7px;
  height: 7px;
  border: solid currentColor;
  border-width: 2px 2px 0 0;
  transform: rotate(45deg);
}
.mg-pager-back::after { order: -1; transform: rotate(-135deg); }
.mg-pager-top::after { transform: rotate(-45deg); }
.mg-visual-guide a:focus-visible, .mg-guide-mobile summary:focus-visible {
  outline: 2px solid var(--teal);
  outline-offset: 2px;
}
.mg-figure { margin: 0; min-width: 0; }
.mg-figure figcaption { color: var(--muted); font-size: .78rem; line-height: 1.45; margin-top: 8px; }
.mg-demo { background: var(--tint); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.mg-demo-top { padding: 10px 13px; background: var(--surface); border-bottom: 1px solid var(--line); color: var(--teal); font-size: .8rem; font-weight: 700; }
.mg-demo-body { display: grid; gap: 8px; padding: 12px; font-size: .79rem; line-height: 1.4; }
.mg-demo-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.mg-demo-chip { padding: 4px 7px; background: var(--surface); border: 1px solid var(--line); border-radius: 7px; color: var(--muted); }
.mg-demo-chip.is-selected { color: var(--teal); border-color: var(--teal); font-weight: 650; }
.mg-demo-search, .mg-demo-row, .mg-demo-paper {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  overflow-wrap: anywhere;
}
.mg-demo-row small, .mg-demo-paper small { display: block; color: var(--muted); margin-top: 2px; }
.mg-demo-row .mg-demo-chips { margin-top: 5px; }
.mg-demo-glyph { color: var(--teal); font-weight: 700; }
.mg-search-icon { position: relative; width: 11px; height: 11px; flex: 0 0 auto; border: 2px solid var(--teal); border-radius: 50%; margin-inline-end: 3px; }
.mg-search-icon::after { content: ''; position: absolute; width: 6px; height: 2px; top: 7px; left: 6px; border-radius: 2px; background: var(--teal); transform: rotate(45deg); }
.mg-demo-button { display: inline-flex; align-items: center; gap: 7px; justify-self: start; padding: 5px 8px; border-radius: 7px; color: var(--teal); background: var(--surface); border: 1px solid var(--line); font-weight: 700; }
.mg-demo-paper { display: block; }
.mg-demo-line { height: 2px; width: 62%; background: var(--line); margin-block: 6px; }

@media (min-width: 961px) and (max-width: 1190px) {
  .mg-visual-guide { --mg-guide-top: 145px; }
}
@media (max-width: 1120px) {
  .mg-section-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 780px) {
  .mg-visual-guide { --mg-guide-top: 92px; }
  .mg-guide-layout { display: block; }
  .mg-guide-sidebar { display: none; }
  .mg-guide-section { scroll-margin-top: calc(var(--mg-guide-top) + 62px); }
  .mg-guide-mobile { display: block; position: sticky; top: var(--mg-guide-top); z-index: 4; margin-bottom: 14px; }
  .mg-guide-mobile summary {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    min-height: 44px;
    padding: 8px 14px;
    list-style: none;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    color: var(--teal);
    cursor: pointer;
    font-weight: 650;
  }
  .mg-guide-mobile summary::-webkit-details-marker { display: none; }
  .mg-guide-mobile summary::after { transform: rotate(135deg); }
  .mg-guide-mobile[open] summary::after { transform: rotate(-45deg); }
  .mg-guide-mobile nav {
    position: absolute;
    inset: calc(100% + 5px) 0 auto;
    max-height: calc(100dvh - var(--mg-guide-top) - 62px);
    overflow: auto;
    padding: 7px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
  }
}
.mg-guide-mobile:not([open]) > nav { display: none; }
