.viewer-actions button,
.viewer-actions a {
  border: 1px solid var(--ink);
  background: var(--paper);
  color: var(--ink);
  padding: 12px 20px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
  letter-spacing: 0.03em;
}
.viewer-actions button:hover,
.viewer-actions a:hover {
  background: var(--ink);
  color: white;
}
.viewer {
  position: fixed;
  inset: 0;
  z-index: 1000;
  width: 100%;
  max-width: 100vw;
  background: #f6f0e4;
  padding: 5vh 5vw 4vh;
  overflow-y: auto;
  overflow-x: hidden;
}
.viewer[hidden] {
  display: none;
}
.viewer-copy {
  text-align: center;
  max-width: 680px;
  margin: 0 auto 20px;
}
.viewer-copy h2 {
  font:
    400 clamp(30px, 4vw, 54px) / 1.15 Georgia,
    'Songti SC',
    serif;
  margin: 8px 0;
}
.viewer-copy p {
  color: #66717d;
  margin: 0;
}
.inspection-stage {
  width: min(780px, 90vw);
  height: min(56vh, 560px);
  margin: auto;
  position: relative;
  display: grid;
  place-items: center;
  perspective: 1400px;
  touch-action: none;
}
.selected-card {
  --mx: 50%;
  --my: 50%;
  position: relative;
  width: min(76vw, 72vh, 700px);
  height: auto;
  aspect-ratio: 3/2;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  transition:
    transform 0.9s cubic-bezier(0.2, 0.8, 0.2, 1),
    filter 0.6s;
}
.selected-card.portrait {
  width: min(42vw, 38vh, 360px);
  aspect-ratio: 2/3;
}
.selected-card.flipped {
  transform: rotateY(180deg);
}
.card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transform-style: preserve-3d;
  -webkit-transform-style: preserve-3d;
  display: block;
  overflow: hidden;
}
.card-front {
  transform: rotateY(0deg) translateZ(0.1px);
  -webkit-transform: rotateY(0deg) translateZ(0.1px);
}
.portal-hotspot {
  --ring: #fff4ad;
  position: absolute;
  left: var(--tap-x);
  top: var(--tap-y);
  z-index: 6;
  width: 46px;
  height: 46px;
  transform: translate(-50%, -50%);
  border: 2px solid var(--ring);
  border-radius: 50%;
  background: rgba(255, 244, 173, 0.18);
  color: white;
  cursor: pointer;
  box-shadow:
    0 0 0 7px rgba(255, 244, 173, 0.16),
    0 0 24px rgba(255, 213, 79, 0.8);
  animation: tapPulse 1.5s ease-in-out infinite alternate;
}
.portal-hotspot span {
  position: absolute;
  left: 50%;
  top: calc(100% + 10px);
  transform: translateX(-50%);
  white-space: nowrap;
  padding: 6px 10px;
  border-radius: 999px;
  background: rgba(20, 36, 59, 0.82);
  color: white;
  font-size: 11px;
  letter-spacing: 0.06em;
}
.card-face > img:not(.hidden-shadow) {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  filter: drop-shadow(0 24px 26px rgba(30, 42, 56, 0.22));
}
.card-back {
  transform: rotateY(180deg) translateZ(0.1px);
  -webkit-transform: rotateY(180deg) translateZ(0.1px);
}
.viewer-actions {
  display: flex;
  justify-content: center;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 15px;
}
.viewer-back-post-office {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  width: max-content;
  margin: 24px auto 0;
  padding: 12px 24px 10px;
  border: 1.5px solid var(--blue);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--blue);
  font:
    600 12px/1.2 Arial,
    sans-serif;
  letter-spacing: 0.12em;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(32, 77, 120, 0.09);
}
.viewer-back-post-office small {
  color: #66717d;
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.08em;
}
.viewer-back-post-office:hover {
  background: var(--blue);
  color: white;
}
.viewer-back-post-office:hover small {
  color: rgba(255, 255, 255, 0.78);
}
/* ---------- 来信查看页模板：价格条 + 来源小镇（各月份共用，数据在 data.js） ---------- */
.letter-shelf {
  width: min(640px, 100%);
  margin: 30px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}
.price-strip[hidden],
.letter-from[hidden] {
  display: none;
}
.letter-prices {
  width: 100%;
}
.letter-prices:empty,
.frame-shop:empty {
  display: none;
}
/* 价格条：一张纸条，手绘蓝边 + 档案标签（标签文字 = data-label） */
.price-strip {
  position: relative;
  width: 100%;
  margin: 0;
  padding: 18px 20px 8px;
  list-style: none;
  background: var(--paper);
  box-shadow: 0 3px 10px rgba(40, 30, 20, 0.1);
}
.price-strip::before {
  content: attr(data-label);
  position: absolute;
  z-index: 1;
  left: 16px;
  top: -10px;
  padding: 2px 9px 1px;
  background: var(--cream);
  border: 1px solid rgba(71, 111, 150, 0.45);
  color: var(--blue-dark);
  font:
    600 10px/1.4 'Avenir Next',
    sans-serif;
  letter-spacing: 0.18em;
  transform: rotate(-1.5deg);
}
.price-strip::after {
  content: '';
  position: absolute;
  inset: 1px;
  border: 1.3px solid rgba(71, 111, 150, 0.55);
  filter: url(#hand-drawn);
  pointer-events: none;
}
.price-strip li {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 16px;
  padding: 11px 0;
  border-bottom: 1px dashed rgba(71, 111, 150, 0.3);
}
.price-strip li:last-child {
  border-bottom: 0;
}
.price-name {
  font:
    400 17px/1.35 Georgia,
    'Songti SC',
    serif;
}
.price-amount {
  font:
    600 15px/1 'Avenir Next',
    'Helvetica Neue',
    sans-serif;
  letter-spacing: 0.03em;
  font-variant-numeric: tabular-nums;
}
/* 「在 Etsy 购买」做成邮戳 */
.etsy-stamp {
  padding: 7px 12px 6px;
  border: 1.5px solid var(--blue-dark);
  border-radius: 2px;
  box-shadow:
    inset 0 0 0 2px var(--paper),
    inset 0 0 0 3px rgba(71, 111, 150, 0.45);
  color: var(--blue-dark);
  font:
    600 12px/1.2 'Avenir Next',
    'PingFang SC',
    sans-serif;
  letter-spacing: 0.08em;
  text-decoration: none;
  white-space: nowrap;
  transform: rotate(-1.5deg);
  transition:
    background 0.2s,
    color 0.2s,
    transform 0.2s;
}
.price-strip li:nth-child(even) .etsy-stamp {
  transform: rotate(1deg);
}
.price-strip li .etsy-stamp:hover,
.price-strip li .etsy-stamp:focus-visible {
  background: var(--blue-dark);
  color: #fff;
  box-shadow:
    inset 0 0 0 2px var(--blue-dark),
    inset 0 0 0 3px rgba(255, 255, 255, 0.55);
  transform: rotate(0deg);
}
/* 已绝版：不放链接 */
.price-strip li .etsy-stamp.sold-out,
.price-strip li .etsy-stamp.sold-out:hover {
  border: 1.5px dashed #8a939c;
  box-shadow: none;
  background: none;
  color: #8a939c;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  transform: rotate(-1.5deg);
  cursor: default;
}
/* 小镇页、商店、Portal 页、订阅页里的价格条 */
.frame-shop {
  display: grid;
  gap: 34px;
  margin: 18px 0 34px;
}
.frame-shop-note {
  margin: -20px 0 0;
  color: #5d6a78;
  font-size: 13px;
}
/* 套组里有什么：实物照片 +「What's inside」 */
.price-includes {
  grid-column: 1 / -1;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 2px;
}
.price-photos {
  display: flex;
  flex: none;
  gap: 6px;
}
.price-photos button {
  padding: 0;
  border: 0;
  background: none;
  cursor: zoom-in;
}
.price-photos img {
  display: block;
  height: 96px;
  width: auto;
  background: var(--cream);
  box-shadow: 0 2px 6px rgba(40, 30, 20, 0.16);
  transition: transform 0.2s;
}
.price-photos button:hover img {
  transform: rotate(-1.5deg) scale(1.04);
}
.price-list {
  margin: 0;
  color: #5d6a78;
  font-size: 13px;
  line-height: 1.65;
}
.price-list b {
  display: block;
  color: var(--blue-dark);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.12em;
}
/* 点照片看大图 */
.photo-zoom {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 4vh 4vw;
  background: rgba(246, 240, 228, 0.94);
  cursor: zoom-out;
}
.photo-zoom[hidden] {
  display: none;
}
.photo-zoom img {
  max-width: 100%;
  max-height: calc(100% - 30px);
  object-fit: contain;
  box-shadow: 0 10px 30px rgba(30, 42, 56, 0.2);
}
.photo-zoom small {
  color: #66717d;
  font-size: 12px;
  letter-spacing: 0.08em;
}
/* 来源小镇：邮戳式，点了进小镇页 */
.letter-from {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 8px 14px;
  border: 1.5px solid rgba(71, 111, 150, 0.55);
  border-radius: 3px;
  box-shadow:
    inset 0 0 0 2px #f6f0e4,
    inset 0 0 0 3px rgba(71, 111, 150, 0.3);
  color: var(--blue-dark);
  font:
    600 13px/1.3 'Avenir Next',
    'PingFang SC',
    sans-serif;
  letter-spacing: 0.06em;
  text-decoration: none;
  transform: rotate(-1.2deg);
}
.letter-from small {
  padding-right: 10px;
  border-right: 1px solid rgba(71, 111, 150, 0.35);
  font-size: 10px;
  letter-spacing: 0.18em;
}
.letter-from b {
  color: var(--ink);
  font-weight: 600;
}
.letter-from i {
  font-style: normal;
  opacity: 0.6;
}
.letter-from:hover {
  background: rgba(170, 197, 220, 0.22);
}
@media (max-width: 700px) {
  .letter-shelf {
    margin-top: 24px;
    gap: 18px;
  }
  .price-strip {
    padding: 16px 14px 6px;
  }
  .price-name {
    font-size: 15px;
  }
}
@media (max-width: 420px) {
  .price-strip li {
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
  }
  .price-includes {
    flex-direction: column;
    gap: 8px;
  }
  .price-photos img {
    height: 84px;
  }
  .price-strip .etsy-stamp {
    grid-column: 1 / -1;
    justify-self: end;
  }
}
@keyframes tapPulse {
  from {
    transform: translate(-50%, -50%) scale(0.94);
    box-shadow:
      0 0 0 5px rgba(255, 244, 173, 0.12),
      0 0 18px rgba(255, 213, 79, 0.58);
  }
  to {
    transform: translate(-50%, -50%) scale(1.05);
    box-shadow:
      0 0 0 10px rgba(255, 244, 173, 0.2),
      0 0 30px rgba(255, 213, 79, 0.92);
  }
}
@media (max-width: 700px) {
  .viewer {
    padding: 50px 14px 32px;
  }
  .viewer-copy {
    margin-bottom: 8px;
  }
  .viewer-copy h2 {
    font-size: 32px;
  }
  .viewer-copy p {
    font-size: 13px;
    line-height: 1.45;
    padding: 0 16px;
  }
  .inspection-stage {
    display: block;
    width: 100%;
    height: auto;
    min-height: 0;
    max-height: none;
    margin: 28px auto 0;
  }
  .selected-card {
    width: min(88vw, 560px);
    height: auto;
    aspect-ratio: 3/2;
    margin: 0 auto;
  }
  .selected-card.portrait {
    width: min(50vw, 220px);
    height: auto;
    aspect-ratio: 2/3;
    transform: none;
  }
  .selected-card.portrait.flipped {
    transform: rotateY(180deg);
  }
  .viewer-back-post-office {
    margin-top: 20px;
    padding: 11px 18px;
  }
  .viewer-actions {
    margin: 18px auto 0;
    max-width: 360px;
    gap: 9px;
  }
  .viewer-actions button,
  .viewer-actions a {
    padding: 11px 16px;
    font-size: 14px;
  }
  .portal-hotspot {
    width: 38px;
    height: 38px;
  }
}
@media (max-width: 420px) {
  .viewer-actions a {
    flex-basis: auto;
  }
}
