:root {
  color-scheme: dark;
  background: #160d09;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  padding-bottom: calc(180px + env(safe-area-inset-bottom));
}

.gallery {
  width: 100%;
  margin-inline: auto;
}

.gallery img {
  display: block;
  width: 100%;
  height: auto;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

.back-to-top {
  position: fixed;
  right: max(20px, env(safe-area-inset-right));
  bottom: max(20px, env(safe-area-inset-bottom));
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border: 1px solid #d9ad65;
  border-radius: 50%;
  background: #21130feb;
  color: #f7d99a;
  cursor: pointer;
}

.back-to-top[hidden] {
  display: none;
}

.back-to-top:hover {
  background: #49301c;
}

.back-to-top:focus-visible {
  outline: 2px solid #fff0c9;
  outline-offset: 4px;
}

@media (max-width: 600px) {
  .back-to-top {
    right: max(12px, env(safe-area-inset-right));
    bottom: calc(156px + env(safe-area-inset-bottom));
  }
}

.download-panel {
  position: fixed;
  z-index: 10;
  bottom: max(10px, env(safe-area-inset-bottom));
  left: 50%;
  transform: translateX(-50%);
  width: min(560px, calc(100% - 24px));
  margin: 0;
  padding: 8px;
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr) 100px;
  gap: 10px;
  border: 2px solid #b3a77b;
  border-radius: 10px;
  background: linear-gradient(135deg, #6a6756, #bab18b 48%, #635e4a);
  box-shadow: inset 0 0 0 4px #ffffff15, 0 6px 20px #0006;
  font-family: "Microsoft YaHei", sans-serif;
}
.wechat { min-width: 0; text-align: center; }
.qr-slides { position: relative; background: white; aspect-ratio: 1; overflow: hidden; }
.qr-slide { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; transition: opacity 450ms ease-in-out; pointer-events: none; }
.qr-slide.is-active { opacity: 1; }
.wechat-label { margin: 3px 0 0; color: #fff6d5; font-size: 11px; }
.qr-controls { display: flex; justify-content: center; align-items: center; gap: 2px; }
.qr-dot { width: 26px; height: 26px; padding: 8px; border: 0; background: transparent; cursor: pointer; }
.qr-dot::after { content: ''; display: block; width: 10px; height: 10px; border-radius: 50%; background: #332719; }
.qr-dot[aria-pressed="true"]::after { background: #ffe8a2; box-shadow: 0 0 0 1px #523f1c; }
.download-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: 1fr 1fr; gap: 8px; }
.download-button { display: flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 8px 4px; border: 2px solid #ece0a7; color: #39230e; background: linear-gradient(110deg, #d0b760, #f5e6a0 48%, #d2bc6f); box-shadow: inset 0 0 0 2px #94792c45, 0 3px 5px #0004; text-decoration: none; font-size: 19px; font-weight: 600; transition: filter .15s, transform .15s; }
.download-mobile { grid-column: 1 / -1; }
.download-actions .download-mobile { grid-column: 1 / -1; }
.download-pc { display: flex; flex-direction: column; align-self: stretch; gap: 10px; background: linear-gradient(145deg, #3ae1d4, #00b9ad); border-color: #8af4e8; color: #11332e; font-size: 17px; text-align: center; }
.download-button svg { width: 23px; height: 26px; flex-shrink: 0; }
.download-pc svg { width: 34px; height: 34px; }
.download-button:hover { filter: brightness(1.1); }
.download-button:active { transform: translateY(1px); }
.download-panel :focus-visible { outline: 3px solid white; outline-offset: 2px; }
@media (max-width: 600px) {
  .download-panel { width: min(400px, calc(100% - 16px)); padding: 6px; gap: 6px; grid-template-columns: 112px minmax(0, 1fr) 72px; border-radius: 6px; }
  .download-actions { gap: 5px; }
  .download-button { font-size: clamp(10px, 2.5vw, 14px); gap: 2px; min-height: 36px; padding: 4px 1px; white-space: nowrap; }
  .download-button svg { width: 15px; height: 18px; }
  .download-actions .download-button:not(.download-mobile) svg { display: none; }
  .wechat-label { font-size: 10px; margin: 3px 0 0; white-space: nowrap; }
  .qr-dot { height: 20px; padding-block: 5px; }
  .download-pc { min-height: 34px; flex-direction: column; gap: 4px; font-size: 11px; }
  .download-pc svg { width: 22px; height: 22px; }
}
@media (max-width: 359px) {
  .download-panel { grid-template-columns: 112px minmax(0, 1fr) 62px; gap: 4px; padding: 5px; }
  .download-actions { gap: 3px; }
  .download-button { font-size: 9px; }
  .download-pc { font-size: 10px; }
  .qr-dot { width: 23px; padding-inline: 6px; }
}
@media (prefers-reduced-motion: reduce) {
  .download-button, .qr-slide { transition: none; }
}
.qr-dot { flex-shrink: 0; width: 18px; padding-inline: 4px; }


@media (max-width: 600px) {
  body { padding-bottom: calc(150px + env(safe-area-inset-bottom)); }
}
@media (min-width: 601px) and (max-width: 700px) {
  .back-to-top { bottom: calc(195px + env(safe-area-inset-bottom)); }
}
