/* 小狗、像素特效（官网用；照界面设计师第四轮效果图）。 */
:root {
  --b-line: #4b2e21; /* 和小狗描边同色 */
  --b-bg: #fff4e0;
  --b-fg: #3b2418;
  --b-btn: #f7d9a8;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; }
img.px, .spr { image-rendering: pixelated; image-rendering: crisp-edges; }

/* ---------- 小狗 ---------- */
#dog {
  /* 小狗挂在"落脚点"里（position:absolute），跟着那一段一起滚，不会一帧一帧追着滚动抖；收起时改成 fixed 贴在屏幕右下角 */
  position: absolute; left: 0; top: 0; z-index: 6;
  width: calc(48px * var(--u)); height: calc(48px * var(--u));
  pointer-events: auto; cursor: pointer;
}
#dog .spr { display: block; width: 100%; height: 100%; }
#dog.flip .spr { transform: scaleX(-1); }
#dog.hop .spr { animation: hop 0.34s steps(6) 1; }
@keyframes hop { 0%,100% { transform: translateY(0); } 40% { transform: translateY(calc(-3px * var(--u))); } }
.dog-hidden #dog .spr { transform: none; }

/* 特效挂在头上：头顶在 (24, 9)，右耳边在 x≈40 */
#dog .fx { position: absolute; inset: 0; pointer-events: none; }
.fx-ring { position: absolute; left: calc(20px * var(--u)); top: calc(-1px * var(--u)); }
.fx-waves { position: absolute; left: calc(42px * var(--u)); top: calc(12px * var(--u)); display: flex; align-items: center; gap: calc(1px * var(--u)); }
.fx-waves .w { animation: wave 0.9s steps(1) infinite; opacity: 0.15; }
.fx-waves .w2 { animation-delay: 0.15s; } .fx-waves .w3 { animation-delay: 0.3s; }
@keyframes wave { 0% { opacity: 1; } 50% { opacity: 0.25; } }
.fx-stars .s { position: absolute; animation: twinkle 0.9s steps(3) both; }
.fx-stars .s1 { left: calc(-4px * var(--u)); top: calc(4px * var(--u)); }
.fx-stars .s2 { left: calc(41px * var(--u)); top: calc(0px * var(--u)); animation-delay: 0.1s; }
.fx-stars .s3 { left: calc(44px * var(--u)); top: calc(18px * var(--u)); animation-delay: 0.22s; }
@keyframes twinkle { 0% { transform: scale(0.3); opacity: 0; } 30% { transform: scale(1.15); opacity: 1; } 100% { transform: scale(1); opacity: 1; } }
.fx-drop { position: absolute; left: calc(37px * var(--u)); top: calc(9px * var(--u)); animation: drip 1.6s steps(4) infinite; }
@keyframes drip { 0% { transform: translateY(0); opacity: 1; } 80% { transform: translateY(calc(4px * var(--u))); opacity: 1; } 100% { opacity: 0; } }
.fx-q { position: absolute; left: calc(36px * var(--u)); top: calc(-2px * var(--u)); animation: bob 1s steps(2) infinite; }
.fx-z { position: absolute; left: calc(34px * var(--u)); top: calc(12px * var(--u)); }
.fx-z .z { position: absolute; animation: zz 2.4s steps(6) infinite; opacity: 0; }
.fx-z .z2 { animation-delay: 1.2s; }
@keyframes zz { 0% { transform: translate(0,0); opacity: 0; } 20% { opacity: 1; } 100% { transform: translate(calc(5px * var(--u)), calc(-10px * var(--u))); opacity: 0; } }
@keyframes bob { 50% { transform: translateY(calc(-1px * var(--u))); } }

/* ---------- 像素气泡（照软件里的样子，D-84） ---------- */
#dog .bub {
  --shift: 0px;
  position: absolute; left: 50%; bottom: calc(100% - 7px * var(--u));
  transform: translateX(calc(-50% + var(--shift)));
  display: none; pointer-events: auto;
}
#dog .bub.on { display: block; animation: pop 0.11s ease-out; }
@keyframes pop { from { transform: translateX(calc(-50% + var(--shift))) scale(0.6); transform-origin: 50% 100%; } }
/* 两层：外层是描边色、内层奶油色，各自切出像素台阶圆角（和软件里 bar.css 的 #bbox / #bin 同一个做法） */
.bub-box {
  width: max-content; max-width: 268px; background: var(--b-line); padding: 3px;
  clip-path: polygon(0 6px, 3px 6px, 3px 3px, 6px 3px, 6px 0, calc(100% - 6px) 0, calc(100% - 6px) 3px, calc(100% - 3px) 3px, calc(100% - 3px) 6px, 100% 6px, 100% calc(100% - 6px), calc(100% - 3px) calc(100% - 6px), calc(100% - 3px) calc(100% - 3px), calc(100% - 6px) calc(100% - 3px), calc(100% - 6px) 100%, 6px 100%, 6px calc(100% - 3px), 3px calc(100% - 3px), 3px calc(100% - 6px), 0 calc(100% - 6px));
}
.bub-in {
  background: var(--b-bg); color: var(--b-fg);
  font: 500 14px/1.5 var(--bub-font, -apple-system, BlinkMacSystemFont, "PingFang SC", "Segoe UI", "Microsoft YaHei UI", sans-serif);
  padding: 8px 12px;
  clip-path: polygon(0 3px, 3px 3px, 3px 0, calc(100% - 3px) 0, calc(100% - 3px) 3px, 100% 3px, 100% calc(100% - 3px), calc(100% - 3px) calc(100% - 3px), calc(100% - 3px) 100%, 3px 100%, 3px calc(100% - 3px), 0 calc(100% - 3px));
}
.bub-tail { display: flex; justify-content: center; margin-top: -3px; transform: translateX(calc(-1 * var(--shift))); }
.bub-acts { display: flex; gap: 6px; justify-content: flex-end; margin-top: 8px; }
.bub-btn { font: inherit; font-size: 13px; color: var(--b-fg); background: var(--b-btn); border: 0; padding: 3px 10px; cursor: pointer; box-shadow: 0 0 0 2px var(--b-line); }
.bub-btn:hover { background: #f2c98a; }
.bub-btn:active { transform: translateY(1px); }
.bub-btn.ghost { background: transparent; box-shadow: none; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- 演示：原话里删掉的、改掉的 ---------- */
.seg.f, .seg.x { transition: color 0.2s, opacity 0.2s; }
#raw.done .seg.f { text-decoration: line-through; text-decoration-thickness: 2px; opacity: 0.5; }
#raw.done .seg.x { text-decoration: line-through; text-decoration-thickness: 2px; opacity: 0.5; }
.caret { display: inline-block; width: 2px; height: 1.15em; vertical-align: -0.2em; background: currentColor; margin-left: 1px; animation: caret 1.05s steps(1) infinite; }
@keyframes caret { 50% { opacity: 0; } }
.drop { display: inline; animation: drop 0.4s cubic-bezier(0.22, 1, 0.36, 1); }
@keyframes drop { from { opacity: 0; transform: translateY(-6px); } }

.reduce *, .reduce *::before, .reduce *::after { animation-duration: 1ms !important; animation-iteration-count: 1 !important; transition: none !important; }

@media (prefers-reduced-motion: reduce) {
  #dog .spr, .fx * { animation: none !important; }
}

.still *, .still *::before, .still *::after { animation: none !important; transition: none !important; }
[data-only-hide] { display: none !important; }
