@media (min-width: 861px) {
  .page {
    width: min(100%, 1320px);
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
    column-gap: 32px;
  }

  .hero {
    grid-column: 1 / -1;
  }

  .toc {
    grid-column: 1;
    grid-row: 2;
    position: sticky;
    top: 18px;
    align-self: start;
    display: flex;
    flex-direction: column;
    flex-wrap: nowrap;
    max-height: calc(100dvh - 36px);
    padding: 10px;
    overflow-y: auto;
    background: var(--card, var(--surface, #fff));
    border: 1px solid var(--line);
    border-radius: 20px;
    box-shadow: 0 14px 38px rgba(20, 30, 52, .07);
    backdrop-filter: none;
  }

  .toc a {
    width: 100%;
    border-color: transparent;
    border-radius: 12px;
  }

  .toc a:hover,
  .toc a.is-active {
    color: var(--blue);
    background: var(--soft, var(--surface-2, #eef2ff));
    border-color: var(--line);
  }

  article {
    grid-column: 2;
    grid-row: 2;
    min-width: 0;
  }

  article .chapter {
    margin-top: 0;
  }

  footer {
    grid-column: 2;
  }
}

.chapter[hidden] {
  display: none !important;
}

.shot img:not([src]),
.shot img.is-loading {
  background: linear-gradient(110deg, var(--page) 28%, var(--soft, var(--surface-2, #eef2ff)) 42%, var(--page) 56%);
  background-size: 220% 100%;
  animation: guide-image-loading 1.4s ease-in-out infinite;
}

.shot img.is-error {
  background: var(--soft, var(--surface-2, #eef2ff));
  outline: 1px dashed var(--line);
}

@keyframes guide-image-loading {
  to {
    background-position-x: -220%;
  }
}

.back-to-top {
  position: fixed;
  right: max(18px, env(safe-area-inset-right));
  bottom: max(18px, env(safe-area-inset-bottom));
  z-index: 20;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 10px 14px;
  color: var(--text);
  background: color-mix(in srgb, var(--card, var(--surface, #fff)) 92%, transparent);
  border: 1px solid var(--line);
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, .18);
  font: inherit;
  font-size: .88rem;
  font-weight: 750;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transform: translateY(10px);
  transition: opacity .2s ease, transform .2s ease, background-color .2s ease;
}

.back-to-top:hover {
  background: var(--soft, var(--surface-2, #eef2ff));
}

.back-to-top.is-visible {
  opacity: 1;
  pointer-events: auto;
  transform: translateY(0);
}

@media (max-width: 860px) {
  .back-to-top span:last-child {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
  }

  .back-to-top {
    width: 44px;
    height: 44px;
    justify-content: center;
    padding: 0;
    font-size: 1.15rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  .shot img:not([src]),
  .shot img.is-loading {
    animation: none;
  }

  .back-to-top {
    transition: none;
  }
}
