/* 操作反馈 (feedback.js 配套)。全部是「手工定格」：一步到位或两三个定住的姿势，不用缓动。
   只动 translate / opacity / outline，不触发排版；系统开了「减少动态效果」时只留颜色变化。 */
:root { --fb-frame: var(--frame, 160ms); --fb-gold: var(--p-gold); --fb-wine: var(--p-wine); --fb-pine: var(--p-pine);
  --fb-bark: var(--p-bark); --fb-paper: var(--p-paper); --fb-maple: var(--p-ember); }

/* ---------- 1 按下：纸片被手指按住，立刻下沉一格 ---------- */
a, button, summary, [role="button"], [role="tab"] { -webkit-tap-highlight-color: transparent; touch-action: manipulation; }
[data-fb-press] { translate: 1px 2px; transition: none !important; }
[data-fb-press]:not(.cp-tag, .cp-badge, .wall-sticker, .fb-plain) { box-shadow: inset 0 0 0 999px color-mix(in srgb, var(--fb-bark) 10%, transparent) !important; }
.cp-tag[data-fb-press] { translate: 0 3px; }
.cp-tag[data-fb-press] .cp-card { filter: brightness(.93); }

/* ---------- 2 去往 / 办理中：一圈金色缝线在走针 ---------- */
[data-fb-going], [data-fb-busy] { outline: 2px dashed var(--fb-gold); outline-offset: 3px; animation: fb-stitch calc(var(--fb-frame) * 4) steps(1, end) infinite; }
.cp-tag[data-fb-going] { outline: none; animation: none; }
.cp-tag[data-fb-going] .cp-card { outline: 2px dashed var(--fb-gold); outline-offset: 4px; animation: fb-stitch calc(var(--fb-frame) * 4) steps(1, end) infinite; }
@keyframes fb-stitch { 0% { outline-style: dashed; outline-offset: 3px; } 50% { outline-style: dotted; outline-offset: 4px; } }
button[data-fb-busy]:disabled { opacity: 1; cursor: progress;
  background-image: repeating-linear-gradient(-45deg, transparent 0 7px, color-mix(in srgb, var(--fb-paper) 22%, transparent) 7px 14px); background-size: 40px 40px;
  animation: fb-stitch calc(var(--fb-frame) * 4) steps(1, end) infinite, fb-march calc(var(--fb-frame) * 4) steps(4, end) infinite; }
@keyframes fb-march { to { background-position: 40px 0; } }
/* 换整页（学院 / 校园 / 邮箱）：点下去的那一刻，旧页先暗下来，表示「听到了」 */
html[data-fb-leaving] main, html[data-fb-leaving] .mail-shell, html[data-fb-leaving] #app { opacity: .45; transition: none; pointer-events: none; }

/* ---------- 3 等待：旧页留在原地变淡；超过四分之一秒才出现翻卡片和空白纸卡 ---------- */
[data-fb-waiting] > .motion-overlay[data-snapshot] { opacity: .45 !important; translate: none !important; filter: saturate(.5); transition: opacity 20s steps(1, end) !important; }
[data-fb-waiting] > .motion-overlay[data-snapshot] * { animation: none !important; }
[data-fb-waiting]:not([data-fb-late]) > .fb-loader { visibility: hidden; }
[data-fb-waiting][data-fb-late] > .motion-overlay[data-snapshot] { display: none; }
/* 内容到了：翻卡片直接让位，不叠在新内容上面 */
.motion-overlay[data-snapshot]:has(> .fb-loader) { display: none; }
.fb-loader { display: grid; justify-items: center; gap: 14px; padding: 26px 16px 22px; text-align: center; }
.fb-label { font-family: var(--zh, serif); font-weight: 700; color: var(--fb-bark); letter-spacing: .08em; }
.fb-cards { position: relative; width: 62px; height: 46px; }
.fb-cards i { position: absolute; inset: 6px 8px; border-radius: 2px; background: var(--fb-paper); border: 1.5px solid var(--fb-bark);
  box-shadow: 1px 2px 0 color-mix(in srgb, var(--fb-bark) 30%, transparent); animation: fb-shuffle calc(var(--fb-frame) * 9) steps(1, end) infinite; }
.fb-cards i::before { content: ""; position: absolute; left: 6px; right: 14px; top: 7px; height: 2px; background: var(--fb-wine); box-shadow: 0 6px 0 color-mix(in srgb, var(--fb-bark) 35%, transparent), 0 12px 0 color-mix(in srgb, var(--fb-bark) 35%, transparent); }
.fb-cards i:nth-child(1) { animation-delay: calc(var(--fb-frame) * -6); background: var(--p-frost); }
.fb-cards i:nth-child(2) { animation-delay: calc(var(--fb-frame) * -3); }
/* 三张卡轮流：顶上 → 抽出 → 垫到最底。每个姿势定住三格。 */
@keyframes fb-shuffle {
  0% { translate: 0 0; rotate: -2deg; z-index: 3; }
  11.1% { translate: 22px -9px; rotate: 9deg; z-index: 3; }
  22.2% { translate: 26px 2px; rotate: 14deg; z-index: 0; }
  33.3% { translate: 3px 4px; rotate: 5deg; z-index: 1; }
  66.6% { translate: -3px 2px; rotate: -6deg; z-index: 2; }
}
.fb-slow { font-size: 12.5px; color: color-mix(in srgb, var(--fb-bark) 70%, transparent); min-height: 1.4em; }
.fb-skel { display: grid; gap: 12px; width: 100%; margin-top: 4px; }
.fb-skel[data-shape="wall"] { grid-template-columns: 1fr 1fr; }
.fb-skel b { display: block; height: 64px; border-radius: 3px; background:
  linear-gradient(color-mix(in srgb, var(--fb-bark) 16%, transparent) 0 0) 14px 16px / 46% 9px no-repeat,
  linear-gradient(color-mix(in srgb, var(--fb-bark) 10%, transparent) 0 0) 14px 36px / 72% 7px no-repeat,
  var(--d-paper-white-80); border: 1px dashed color-mix(in srgb, var(--fb-bark) 28%, transparent);
  animation: fb-boil calc(var(--fb-frame) * 9) steps(1, end) infinite; }
.fb-skel b:nth-child(2) { animation-delay: calc(var(--fb-frame) * -3); } .fb-skel b:nth-child(3) { animation-delay: calc(var(--fb-frame) * -6); }
.fb-skel[data-shape="wall"] b { height: auto; aspect-ratio: 4 / 5; background:
  linear-gradient(color-mix(in srgb, var(--fb-bark) 9%, transparent) 0 0) 8px 8px / calc(100% - 16px) 72% no-repeat,
  linear-gradient(color-mix(in srgb, var(--fb-bark) 16%, transparent) 0 0) 8px 88% / 55% 8px no-repeat, var(--d-paper-white-80); }
@keyframes fb-boil { 0% { rotate: -.5deg; translate: 0 0; } 33.3% { rotate: .4deg; translate: 1px 0; } 66.6% { rotate: -.1deg; translate: 0 1px; } }
/* 邮箱里的「正在取信 / 拆信」 */
.loading.fb-loader { padding: 34px 16px; }

/* ---------- 4 结果：成功盖章，失败摇头 ---------- */
.college-toast, .toast { font-size: 15px; padding: 12px 20px 12px 18px; }
.college-toast::before, .toast::before { content: ""; position: absolute; left: 50%; top: -9px; width: 54px; height: 16px; translate: -50% 0; rotate: -3deg;
  background: color-mix(in srgb, var(--p-frost) 80%, transparent); box-shadow: 0 1px 0 color-mix(in srgb, var(--fb-bark) 20%, transparent); }
.college-toast[data-fb-in], .toast[data-fb-in] { animation: fb-slap calc(var(--fb-frame) * 2) steps(1, end) 1; }
@keyframes fb-slap { 0% { translate: 0 16px; scale: 1.08; } 50% { translate: 0 -3px; scale: .98; } 100% { translate: 0 0; scale: 1; } }
[data-fb-nope] { animation: fb-nope calc(var(--fb-frame) * 3) steps(1, end) 1 !important; outline: 2px solid var(--fb-wine) !important; outline-offset: 3px; }
@keyframes fb-nope { 0% { translate: -5px 0; } 33.3% { translate: 5px 0; } 66.6% { translate: -2px 0; } }
.fb-stamp { position: fixed; z-index: 70; width: 58px; height: 58px; margin: -29px 0 0 -29px; display: grid; place-items: center; pointer-events: none; border-radius: 50%;
  border: 3px double var(--fb-wine); color: var(--fb-wine); background: color-mix(in srgb, var(--fb-paper) 88%, transparent); font-family: var(--zh, serif); font-weight: 900; font-size: 15px; letter-spacing: .04em;
  rotate: -12deg; animation: fb-stamp calc(var(--fb-frame) * 8) steps(1, end) 1 both; }
@keyframes fb-stamp { 0% { scale: 1.7; opacity: .5; } 12.5% { scale: .92; opacity: 1; } 25% { scale: 1; } 87.5% { scale: 1; opacity: 1; } 100% { scale: 1; opacity: 0; } }

/* ---------- 5 图片：还没到的图先是一张打了斜纹的空相纸 ---------- */
img[loading="lazy"]:not([data-fb-seen]) { background: repeating-linear-gradient(-45deg, var(--d-paper-white-80) 0 8px, color-mix(in srgb, var(--fb-bark) 8%, var(--fb-paper)) 8px 16px); }

/* ---------- 减少动态效果：只留「变色、变暗、出现」，没有位移和循环 ---------- */
@media (prefers-reduced-motion: reduce) {
  [data-fb-press] { translate: none; }
  [data-fb-going], [data-fb-busy], .cp-tag[data-fb-going] .cp-card, .fb-cards i, .fb-skel b, [data-fb-nope], .college-toast[data-fb-in], .toast[data-fb-in], button[data-fb-busy]:disabled { animation: none !important; }
  .fb-cards i:nth-child(1) { rotate: -7deg; } .fb-cards i:nth-child(3) { rotate: 6deg; }
  .fb-stamp { animation: fb-stamp-still 1.4s steps(1, end) 1 both; }
}
@keyframes fb-stamp-still { 0% { opacity: 1; } 100% { opacity: 0; } }
