/* 读者回执：桌面是一张双格纸，窄屏则由胶纸签抽成悬浮小卡。 */
.post-receipt {
  --receipt-green: oklch(0.54 0.105 156);
  position: relative;
  margin: 30px 0 20px;
  border: 1px solid color-mix(in oklch, var(--line-strong) 74%, var(--paper));
  border-radius: 6px 18px 10px 14px / 10px 8px 16px 9px;
  background:
    var(--paper-fiber),
    linear-gradient(104deg, color-mix(in oklch, var(--butter) 16%, var(--cream-1)) 0%, var(--cream-1) 46%, color-mix(in oklch, var(--coral) 4%, var(--cream-1)) 100%);
  box-shadow:
    2px 3px 0 -1px var(--cream-0),
    2px 3px 0 0 color-mix(in oklch, var(--line-strong) 48%, transparent),
    0 18px 28px -28px color-mix(in oklch, var(--ink) 42%, transparent);
  isolation: isolate;
}

.post-receipt::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  pointer-events: none;
  background: var(--paper-fiber);
  opacity: 0.52;
  mix-blend-mode: multiply;
}

.post-receipt-panel {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(244px, 0.78fr);
  align-items: stretch;
}

.post-receipt-feedback {
  min-width: 0;
  padding: 18px 22px 16px 24px;
}

.post-receipt-share {
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 16px 20px 14px 22px;
  border-left: 1px dashed color-mix(in oklch, var(--line-strong) 58%, var(--paper));
}

.post-receipt-tape {
  position: absolute;
  z-index: 2;
  top: -10px;
  left: 27px;
  width: 82px;
  height: 18px;
  transform: rotate(-3.5deg);
  background:
    repeating-linear-gradient(90deg, oklch(1 0 0 / 0.18) 0 3px, transparent 3px 7px),
    color-mix(in oklch, var(--butter) 82%, var(--paper));
  opacity: 0.86;
  box-shadow: 0 1px 1px oklch(0.45 0.02 75 / 0.10);
  clip-path: polygon(2% 8%, 7% 0, 93% 0, 100% 9%, 98% 92%, 92% 100%, 8% 100%, 0 90%);
  pointer-events: none;
}

.post-receipt-stamp {
  position: absolute;
  z-index: 2;
  top: -13px;
  right: 30px;
  padding: 3px 7px 2px;
  border: 1px dashed color-mix(in oklch, var(--coral) 40%, var(--line-strong));
  background: color-mix(in oklch, var(--paper) 88%, var(--cream-1));
  color: var(--coral);
  font: 700 8px/1.2 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  letter-spacing: 0.12em;
  opacity: 0.7;
  transform: rotate(2.5deg);
  pointer-events: none;
}

/* 把内部原有的分享/回声卡片收进同一张纸。 */
.post-receipt .post-reactions {
  display: block;
  margin: 0;
  padding: 0;
  border: 0;
}

.post-receipt .reaction-tape { display: none; }
.post-receipt .reaction-head .eyebrow { font-size: 9px; }
.post-receipt .reaction-head h2 {
  margin: 5px 0 3px;
  font-size: 18px;
}
.post-receipt .reaction-title-short { display: none; }
.post-receipt .reaction-head p { font-size: 11px; }
.post-receipt .reaction-controls { margin-top: 11px; }

.post-receipt .post-share {
  position: static;
  display: block;
  width: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
}

.post-receipt .post-share::before { display: none; }
.post-receipt .post-share-kicker { margin-bottom: 5px; }
.post-receipt .post-share h2 {
  margin: 0 0 4px;
  font-size: 17px;
}
.post-receipt .post-share-copy p { display: none; }
.post-receipt .post-share-stamp { display: none; }
.post-receipt .post-share-tools { min-width: 0; margin-top: 8px; }
.post-receipt .post-share-actions { justify-content: flex-start; }
.post-receipt .post-share-button { min-height: 32px; }
.post-receipt .post-share-button.is-copied,
.post-receipt .post-share-button.is-copied:hover {
  border-color: color-mix(in oklch, var(--receipt-green) 60%, var(--ink));
  background: var(--receipt-green);
  color: var(--paper);
  box-shadow:
    2px 2px 0 -1px var(--cream-1),
    2px 2px 0 0 color-mix(in oklch, var(--receipt-green) 58%, var(--ink));
}
.post-receipt .post-share-status {
  min-height: 0;
  margin-top: 5px;
  font-size: 10px;
  text-align: left;
}
.post-receipt .post-share-status:empty { display: none; }
.post-receipt .reaction-status:empty { display: none; }

/* 手机端：先保留一张紧凑内嵌纸，脚本接管后再变成右侧悬浮回执。 */
@media (max-width: 700px) {
  .post-receipt {
    margin: 24px 0 16px;
    border-radius: 5px 15px 9px 12px / 9px 7px 14px 8px;
  }
  .post-receipt-panel { display: block; }
  .post-receipt-feedback {
    padding: 8px 12px 6px;
    border-bottom: 1px dashed color-mix(in oklch, var(--line-strong) 56%, var(--paper));
  }
  .post-receipt-share {
    display: block;
    padding: 6px 12px 8px;
    border-left: 0;
  }
  .post-receipt .post-reactions {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  .post-receipt .reaction-head {
    flex: 1 1 auto;
    min-width: 0;
  }
  .post-receipt .reaction-head .eyebrow,
  .post-receipt .reaction-head p { display: none; }
  .post-receipt .reaction-title-long { display: none; }
  .post-receipt .reaction-title-short { display: inline; }
  .post-receipt .reaction-head h2 {
    margin: 0;
    font-size: 14px;
    line-height: 1.3;
    white-space: nowrap;
  }
  .post-receipt .reaction-controls {
    flex: 0 0 auto;
    width: auto;
    margin: 0;
    gap: 6px;
  }
  .post-receipt .reaction-form { flex: 0 0 auto; }
  .post-receipt .reaction-button {
    min-width: 64px;
    min-height: 36px;
    padding: 4px 6px 4px 4px;
    gap: 4px;
  }
  .post-receipt .reaction-mark { width: 23px; height: 23px; }
  .post-receipt .reaction-label { font-size: 10.5px; }
  .post-receipt .reaction-count { font-size: 10px; }
  .post-receipt .post-share { display: block; }
  .post-receipt .post-share h2 {
    margin: 0;
    font-size: 14px;
    line-height: 1.3;
    white-space: nowrap;
  }
  .post-receipt .post-share-kicker { display: none; }
  .post-receipt .post-share-tools {
    min-width: 0;
    margin: 6px 0 0;
  }
  .post-receipt .post-share-actions { justify-content: flex-end; }
  .post-receipt .post-share-button { min-height: 36px; padding: 4px 9px; }
  .post-receipt .post-share-fallback { text-align: left; }
  html.receipt-script .post-receipt .post-share {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  html.receipt-script .post-receipt .post-share-tools { margin: 0 0 0 auto; }
  .post-receipt .post-share-status {
    margin: 3px 0 0;
    font-size: 9px;
    line-height: 1.2;
    text-align: right;
  }
  .post-receipt .reaction-status {
    position: absolute;
    left: 14px;
    bottom: 1px;
    margin: 0;
    font-size: 9px;
    line-height: 1.25;
  }
  .post-receipt-feedback,
  .post-receipt-share { position: relative; }
  .post-receipt-tape,
  .post-receipt-stamp { display: none; }
}

@media (max-width: 360px) {
  .post-receipt .reaction-head h2 { font-size: 12.5px; }
  .post-receipt .reaction-label { display: none; }
  .post-receipt .reaction-button { min-width: 56px; }
  .post-receipt .post-share h2 { font-size: 13px; }
  .post-receipt .post-share-button { padding-inline: 8px; font-size: 10.5px; }
}

/* 悬浮形态：文档流里不再占高度，胶纸签只沿右侧上下移动。 */
.post-receipt-tab[hidden] { display: none; }
.post-receipt-tab {
  display: none;
  position: fixed;
  right: 3px;
  top: var(--receipt-y, 62vh);
  z-index: 36;
  width: 36px;
  height: 88px;
  padding: 0;
  border: 0;
  background:
    repeating-linear-gradient(90deg, oklch(1 0 0 / 0.16) 0 3px, transparent 3px 7px),
    linear-gradient(180deg, color-mix(in oklch, var(--butter) 62%, var(--cream-1)), color-mix(in oklch, var(--butter) 34%, var(--cream-1)));
  color: var(--ink-soft);
  clip-path: polygon(10% 0, 100% 2%, 96% 12%, 100% 88%, 90% 100%, 0 98%, 4% 86%, 0 14%);
  filter: drop-shadow(2px 3px 0 color-mix(in oklch, var(--line-strong) 42%, transparent));
  transform: translateY(-50%) rotate(-1.4deg);
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: transform 180ms ease, filter 180ms ease;
}
.post-receipt[data-receipt-floating="true"] .post-receipt-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  pointer-events: auto;
}
.post-receipt-tab:hover { filter: drop-shadow(3px 4px 0 color-mix(in oklch, var(--line-strong) 48%, transparent)); }
.post-receipt-tab:active { cursor: grabbing; }
.post-receipt-tab:focus-visible { outline: 2px solid var(--coral); outline-offset: 3px; }
.post-receipt-tab-mark {
  display: grid;
  place-items: center;
  width: 21px;
  height: 21px;
  border: 1px solid color-mix(in oklch, var(--coral) 55%, transparent);
  border-radius: 50%;
  color: var(--coral);
  font: 700 11px/1 "Noto Serif CJK SC", "Songti SC", serif;
  letter-spacing: 0;
}
.post-receipt-tab-label {
  color: var(--ink);
  font: 700 10px/1 "Noto Serif CJK SC", "Songti SC", serif;
  letter-spacing: 0.16em;
  writing-mode: vertical-rl;
  text-orientation: upright;
}
.post-receipt-tab-arrow {
  display: grid;
  place-items: center;
  color: var(--coral);
}
.post-receipt-tab-arrow .icon { width: 12px; height: 12px; }
.post-receipt[data-receipt-open="true"] .post-receipt-tab {
  transform: translateY(-50%) rotate(0.8deg);
  filter: drop-shadow(4px 5px 0 color-mix(in oklch, var(--coral) 26%, transparent));
}
.post-receipt[data-receipt-open="true"] .post-receipt-tab-arrow { transform: rotate(180deg); }

.post-receipt[data-receipt-floating="true"] {
  position: fixed;
  inset: 0;
  z-index: 35;
  margin: 0;
  border: 0;
  border-radius: 0;
  background: none;
  box-shadow: none;
  pointer-events: none;
}
.post-receipt[data-receipt-floating="true"]::before { display: none; }
.post-receipt[data-receipt-floating="true"] .post-receipt-panel {
  position: fixed;
  top: var(--receipt-y, 62vh);
  right: 46px;
  display: block;
  width: min(252px, calc(100vw - 54px));
  max-height: calc(100dvh - 32px);
  overflow: visible;
  padding: 0;
  border: 1px solid color-mix(in oklch, var(--line-strong) 76%, var(--paper));
  border-radius: 5px 15px 9px 12px / 9px 7px 14px 8px;
  background:
    var(--paper-fiber),
    linear-gradient(102deg, color-mix(in oklch, var(--butter) 22%, var(--cream-1)) 0%, var(--cream-1) 58%, color-mix(in oklch, var(--coral) 4%, var(--cream-1)) 100%);
  box-shadow:
    3px 5px 0 -1px var(--cream-0),
    3px 5px 0 0 color-mix(in oklch, var(--line-strong) 54%, transparent),
    0 20px 32px -24px color-mix(in oklch, var(--ink) 48%, transparent);
  opacity: 0;
  transform: translate(calc(100% + 48px), -50%);
  pointer-events: none;
  transition:
    transform 260ms cubic-bezier(0.22, 0.8, 0.2, 1),
    opacity 160ms ease;
  will-change: transform, opacity;
  z-index: 35;
}
.post-receipt[data-receipt-floating="true"] .post-receipt-feedback {
  padding: 8px 12px 6px;
  border-bottom: 1px dashed color-mix(in oklch, var(--line-strong) 56%, var(--paper));
}
.post-receipt[data-receipt-floating="true"] .post-receipt-share {
  display: block;
  padding: 6px 12px 8px;
  border-left: 0;
}
.post-receipt[data-receipt-floating="true"][data-receipt-open="true"] .post-receipt-panel {
  opacity: 1;
  transform: translate(0, -50%);
  pointer-events: auto;
}

@media (prefers-reduced-motion: reduce) {
  .post-receipt-panel,
  .post-receipt-tab,
  .post-receipt-tab-arrow { transition: none; }
}
