/* 实体礼物选配页 · 统一和纸书局美学 */
body.selection-body {
  background: var(--hd-paper);
  color: var(--hd-ink);
}

.selection-page {
  width: var(--hd-container);
  margin-inline: auto;
}

.selection-intro {
  padding-block: clamp(34px, 5vw, 64px) clamp(24px, 3.5vw, 40px);
}

#selection-title {
  margin: 0;
  color: var(--hd-ink);
  font: 400 clamp(32px, 4.2vw, 52px)/1.22 var(--hd-serif);
  letter-spacing: 0.04em;
}

.selection-intro p:not(.hd-chapter) {
  max-width: 38em;
  margin: 14px 0 0;
  color: var(--hd-ink-soft);
  font-size: 14.5px;
  line-height: 1.85;
}

.selection-intro a {
  color: var(--hd-shu-deep);
  text-underline-offset: 4px;
}

.selection-layout {
  display: grid;
  grid-template-columns: minmax(0, 0.92fr) minmax(0, 1.08fr);
  align-items: start;
  gap: clamp(24px, 5vw, 64px);
  padding-bottom: 16px;
}

.selection-main { min-width: 0; }
#selection-status, #selection-feedback { margin: 0 0 14px; color: var(--hd-ink-soft); font-size: 14px; }
#selection-feedback {
  padding: 10px 14px;
  border-inline-start: 2px solid var(--hd-shu);
  background: var(--hd-paper-2);
}

.selection-options {
  padding: clamp(20px, 2.6vw, 28px);
  border: 1px solid var(--hd-line);
  border-radius: var(--hd-radius);
  background: var(--hd-paper-2);
}

.selection-main fieldset { min-inline-size: 0; margin: 0; padding: 0; border: 0; }
.selection-main legend {
  margin: 0 0 10px;
  padding: 0;
  color: var(--hd-ink);
  font: 500 13.5px/1.4 var(--hd-sans);
  letter-spacing: 0.06em;
}

.selection-kinds {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.selection-kind {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 48px;
  padding: 8px 12px;
  border: 1px solid var(--hd-line-strong);
  border-radius: 2px;
  background: var(--hd-paper);
  color: var(--hd-ink);
  font-size: 14px;
  line-height: 1.45;
  cursor: pointer;
  transition: border-color 0.2s var(--hd-ease), background-color 0.2s var(--hd-ease);
}

.selection-kind:hover { border-color: var(--hd-shu); }
.selection-kind:has(:checked) {
  border-color: var(--hd-shu);
  background: var(--hd-shu-wash);
  color: var(--hd-shu-deep);
  font-weight: 500;
}
.selection-kind input {
  display: block;
  flex: none;
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  padding: 0;
  accent-color: var(--hd-shu);
  cursor: pointer;
}

.selection-description {
  margin: 12px 0 22px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--hd-line);
  color: var(--hd-ink-soft);
  font-size: 13.5px;
  line-height: 1.75;
}

.selection-date { display: flex; gap: 10px; }
.selection-date label {
  display: grid;
  flex: 1 1 0;
  gap: 5px;
  min-width: 0;
  color: var(--hd-ink-soft);
  font-size: 12.5px;
  letter-spacing: 0.05em;
}
.selection-date select {
  width: 100%;
  height: 46px;
  padding: 0 10px;
  border: 1px solid var(--hd-line-strong);
  border-radius: 2px;
  color: var(--hd-ink);
  font: 400 15.5px/1.2 var(--hd-sans);
  font-variant-numeric: tabular-nums;
  background-color: #fffdf8;
  cursor: pointer;
}

.selection-preview {
  display: flex;
  align-items: center;
  gap: clamp(16px, 3vw, 32px);
  min-height: 140px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--hd-line-strong);
  border-radius: var(--hd-radius);
  background: var(--hd-paper-2);
  box-shadow: var(--hd-shadow-card);
}
.selection-sample { width: min(44%, 216px); color: var(--hd-ink-faint); font-size: 12px; }
.selection-sample img { display: block; width: 100%; height: auto; margin-bottom: 6px; border: 1px solid var(--hd-line); border-radius: 2px; }
.selection-preview figcaption { display: grid; gap: 4px; min-width: 0; padding-inline: 4px; }
.selection-preview figcaption strong {
  color: var(--hd-shu-deep);
  font: 400 clamp(30px, 3.4vw, 48px)/1.15 var(--hd-num);
  font-variant-numeric: tabular-nums;
}
.selection-preview figcaption span { color: var(--hd-ink-soft); font-size: 13px; }
.selection-note { margin: 12px 0 0; color: var(--hd-ink-faint); font-size: 12.5px; line-height: 1.7; }
.selection-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 20px; margin-top: 20px; }

/* Postcard 3D Stack Deck */
.postcard-deck {
  --deck-ease: cubic-bezier(0.2, 0.75, 0.25, 1);
  min-width: 0;
  border: 1px solid var(--hd-line-strong);
  border-radius: var(--hd-radius);
  background: var(--hd-paper-2);
  box-shadow: var(--hd-shadow-soft);
  overflow: hidden;
}
.postcard-deck-header, .postcard-deck-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 54px;
  padding: 10px 16px;
}
.postcard-deck-header h2 {
  margin: 0;
  color: var(--hd-ink);
  font: 500 clamp(18px, 2vw, 22px)/1.3 var(--hd-serif);
  letter-spacing: 0.04em;
}
#selection-deck-count, #selection-deck-caption {
  margin: 0;
  color: var(--hd-ink-soft);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.postcard-view {
  display: grid;
  grid-template-columns: clamp(78px, 20%, 116px) minmax(0, 1fr);
  align-items: center;
  border-block: 1px solid var(--hd-line);
  background: var(--hd-paper-tint);
}
.postcard-upload {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 112px;
  padding: 10px;
  border-inline-end: 1px solid var(--hd-line);
  color: var(--hd-ink-soft);
  text-align: center;
  font-size: 11.5px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}
.postcard-upload time { display: grid; gap: 4px; }
.postcard-upload strong {
  color: var(--hd-shu-deep);
  font: 400 clamp(25px, 3vw, 40px)/1 var(--hd-num);
}
.postcard-stage {
  position: relative;
  height: clamp(252px, 33vw, 376px);
  overflow: hidden;
  isolation: isolate;
  touch-action: pan-y pinch-zoom;
  cursor: grab;
}
.postcard-stage:active { cursor: grabbing; }
.postcard-stage:focus-visible { outline: 2px solid var(--hd-shu); outline-offset: -2px; }
.postcard-stack { position: absolute; inset: 0; perspective: 780px; }
.postcard-sheet {
  --shift: 0%;
  --depth: 0px;
  --tilt: 0deg;
  position: absolute;
  top: 50%;
  left: 50%;
  display: grid;
  grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  place-items: center;
  width: min(calc(100% - 32px), 380px, 45vh);
  aspect-ratio: 1.44;
  padding: 7px;
  border: 1px solid #d1bfa7;
  background: #fbf5e8;
  box-shadow: 0 12px 24px -10px rgba(45, 32, 20, 0.28);
  z-index: var(--layer);
  transform: translate3d(-50%, calc(-50% + var(--shift)), var(--depth)) rotateX(var(--tilt));
  transition: transform 440ms var(--deck-ease), opacity 340ms var(--deck-ease);
  pointer-events: none;
}
.postcard-sheet img { display: block; width: 100%; height: 100%; min-height: 0; object-fit: contain; user-select: none; }
.postcard-sheet[data-offset="-2"] { --shift: -113%; --depth: -144px; --tilt: 69deg; opacity: 0.56; }
.postcard-sheet[data-offset="-1"] { --shift: -75%; --depth: -72px; --tilt: 55deg; opacity: 0.86; }
.postcard-sheet[data-offset="1"] { --shift: 75%; --depth: -72px; --tilt: -55deg; opacity: 0.86; }
.postcard-sheet[data-offset="2"] { --shift: 113%; --depth: -144px; --tilt: -69deg; opacity: 0.56; }
.postcard-image-error img { font-size: 13px; color: var(--hd-ink-soft); }
.postcard-turns { display: flex; gap: 6px; margin-inline-start: auto; }
.postcard-turns button, .postcard-pick {
  min-width: 42px;
  min-height: 42px;
  border: 1px solid var(--hd-line-strong);
  border-radius: 2px;
  background: var(--hd-paper);
  color: var(--hd-ink);
  font: inherit;
  cursor: pointer;
}
.postcard-turns button { font-size: 16px; }
.postcard-turns button[aria-disabled="true"] { color: var(--hd-ink-faint); cursor: default; opacity: 0.5; }
.postcard-turns button:not([aria-disabled="true"]):hover,
.postcard-pick:hover {
  border-color: var(--hd-shu);
  color: var(--hd-shu-deep);
}
.postcard-pick { padding: 0 12px; font-size: 13px; white-space: nowrap; }
.postcard-pick[aria-pressed="true"] {
  background: var(--hd-shu);
  border-color: var(--hd-shu);
  color: #fdf8ef;
}
.postcard-deck-single .postcard-stage { height: clamp(192px, 24vw, 280px); cursor: default; }
.postcard-sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

@media (max-width: 820px) {
  .selection-layout { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .selection-preview { min-height: 96px; }
  .selection-sample { width: min(36%, 140px); }
  .selection-preview figcaption strong { font-size: 34px; }
}
@media (max-width: 620px) {
  .postcard-sheet { width: min(calc(100% - 16px), 320px, 45vh); padding: 5px; }
  .postcard-deck-header, .postcard-deck-footer { padding-inline: 10px; }
  .postcard-deck-footer { flex-wrap: wrap; }
  .selection-actions .hd-btn { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .postcard-sheet { transition: none; }
}

[hidden] { display: none !important; }
textarea[readonly] { box-sizing: border-box; max-width: 100%; width: 100%; font: inherit; }
