.page-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 32px;
  width: 100%;
  margin-top: 26px;
}

.page-notes {
  max-width: 980px;
  color: rgba(42, 60, 52, 0.48);
  font-size: 10px;
  line-height: 1.8;
}

.page-notes p {
  margin: 0;
}

.page-notes p + p {
  margin-top: 2px;
}

.page-share-slot {
  flex: 0 0 auto;
}

.page-footer .share-rail {
  width: auto;
  margin: 0;
  padding: 0;
  border-top: 0;
}

.share-rail {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  width: 100%;
  margin-top: 28px;
  padding-top: 16px;
  border-top: 1px solid rgba(43, 51, 38, 0.14);
}

.share-rail button {
  display: grid;
  width: 34px;
  height: 34px;
  padding: 0;
  place-items: center;
  border: 0;
  border-radius: 50%;
  background: #fff;
  color: #fff;
  cursor: pointer;
  transition: filter 0.2s ease, transform 0.2s ease;
}

.share-rail button[data-share="line"] {
  background: #06c755;
}

.share-rail button[data-share="x"] {
  background: #000;
}

.share-rail button[data-share="instagram"] {
  background: radial-gradient(circle at 30% 107%, #fdf497 0%, #fdf497 5%, #fd5949 45%, #d6249f 60%, #285aeb 90%);
}

.share-rail button[data-share="facebook"] {
  background: #1877f2;
}

.share-rail button:hover,
.share-rail button:focus-visible {
  filter: brightness(1.08);
  transform: translateY(-1px);
}

.share-rail button:focus-visible {
  outline: 1px solid rgba(32, 39, 30, 0.6);
  outline-offset: 2px;
}

.share-rail svg {
  display: block;
  width: 18px;
  height: 18px;
  fill: currentColor;
}

.share-toast {
  position: fixed;
  bottom: 22px;
  left: 50%;
  z-index: 210;
  max-width: calc(100vw - 40px);
  padding: 10px 15px;
  background: #2b3326;
  color: #f7f3e8;
  font-family: "MS UI Gothic", "MS PGothic", "Yu Gothic", "Meiryo", sans-serif;
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
  transform: translateX(-50%);
}

.share-toast[hidden] {
  display: none;
}

@media (max-width: 900px) {
  .page-footer {
    flex-direction: column;
    align-items: flex-start;
    gap: 14px;
  }

  .page-share-slot {
    align-self: flex-end;
  }
}

@media (max-width: 640px) {
  .page-footer {
    margin-top: 22px;
  }

  .page-notes {
    font-size: 9.5px;
    line-height: 1.75;
  }

  .share-rail {
    gap: 7px;
    margin-top: 22px;
    padding-top: 14px;
  }

  .share-rail button {
    width: 32px;
    height: 32px;
  }

  .share-rail svg {
    width: 16px;
    height: 16px;
  }
}

@media print {
  .share-rail,
  .share-toast {
    display: none !important;
  }
}

/* Back to top: above the share icons, no overlap */
.page-share-slot {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 14px;
}

.page-backtop {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 32px;
  padding: 0 12px;
  border: 1px solid rgba(43, 51, 38, 0.26);
  background: transparent;
  color: rgba(43, 51, 38, 0.62);
  font-family: var(--font-ui);
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.08em;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  transition: color 0.2s ease, border-color 0.2s ease, background-color 0.2s ease;
}

.page-backtop:hover,
.page-backtop:focus-visible {
  border-color: var(--accent);
  background: rgba(255, 255, 255, 0.3);
  color: var(--accent);
}

@media print {
  .page-backtop {
    display: none !important;
  }
}

/* Floating back-to-top triangle */
.page-backtop {
  position: fixed;
  right: clamp(14px, 1.2vw, 20px);
  bottom: clamp(140px, 22vh, 220px);
  z-index: 220;
  display: grid;
  width: 44px;
  height: 44px;
  min-height: 44px;
  padding: 0;
  place-items: center;
  border: 1px solid rgba(43, 51, 38, 0.28);
  border-radius: 50%;
  background: rgba(245, 242, 234, 0.94);
  color: #2b3326;
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.page-backtop:hover,
.page-backtop:focus-visible {
  border-color: var(--accent);
  background: #fffdf8;
  color: var(--accent);
}

@media (max-width: 640px) {
  .page-backtop {
    right: 8px;
    bottom: 140px;
  }
}

/* Temporarily align share icons at the lower left */
.page-footer {
  flex-direction: column;
  align-items: flex-start;
  gap: 18px;
}

.page-share-slot {
  align-self: flex-start;
  align-items: flex-start;
}

/* Attachment-style square back-to-top */
.page-backtop {
  width: 46px;
  height: 46px;
  min-height: 46px;
  border: 1px solid #cfccc3;
  border-radius: 0;
  background: #e7e4dc;
  color: #2b3326;
}

.page-backtop:hover,
.page-backtop:focus-visible {
  border-color: #b9b5aa;
  background: #d9d5cb;
  color: #1f261d;
}

.page-backtop svg {
  display: block;
  width: 20px;
  height: 20px;
}

/* Standalone pages: vertical right-side action rail */
.page-share-slot {
  position: fixed;
  right: 20px;
  bottom: 24px;
  z-index: 230;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.page-share-slot .share-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.page-backtop {
  position: static;
  width: 34px;
  height: 34px;
  min-height: 34px;
  border: 1px solid #cfccc3;
  border-radius: 50%;
  background: #e7e4dc;
  color: #2b3326;
}

.page-backtop svg {
  width: 16px;
  height: 16px;
}

.page-backtop:hover,
.page-backtop:focus-visible {
  border-color: #b9b5aa;
  background: #d9d5cb;
  color: #1f261d;
}

@media (max-width: 640px) {
  .page-share-slot {
    right: 10px;
    bottom: 14px;
  }
}

@media print {
  .page-share-slot {
    display: none !important;
  }
}

/* Reverted layout: horizontal share row at lower left */
.page-share-slot {
  position: static;
  right: auto;
  bottom: auto;
  z-index: auto;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 14px;
}

.page-share-slot .share-rail {
  flex-direction: row;
  align-items: center;
  justify-content: flex-start;
  gap: 8px;
  margin: 0;
  padding: 0;
  border: 0;
}

.page-backtop {
  position: fixed;
  right: clamp(14px, 1.2vw, 20px);
  bottom: clamp(140px, 22vh, 220px);
  width: 46px;
  height: 46px;
  min-height: 46px;
  border: 1px solid #cfccc3;
  border-radius: 0;
  background: #e7e4dc;
  color: #2b3326;
}

.page-backtop svg {
  width: 20px;
  height: 20px;
}
