/* 三维流程图（js/plant3d.js）与智能体宠物（js/pet.js）的样式 */

/* ---------------------------------------------------------------- 三维流程图 */
.p3d { position: absolute; inset: 0; overflow: hidden; user-select: none; }
.p3d.m-work { background: radial-gradient(120% 90% at 50% 8%, #ffffff 0%, #f3f6fa 55%, #e8edf3 100%); }
.p3d-cv { position: absolute; inset: 0; }
.p3d-gl { display: block; position: absolute; left: 0; top: 0; outline: none; touch-action: none; }
.p3d-labels { position: absolute; inset: 0; pointer-events: none; }

.p3l {
  position: absolute; left: 0; top: 0; white-space: nowrap; will-change: transform;
  font: 12px/1.35 var(--font, system-ui, sans-serif); color: #1a1a1b;
  background: rgba(255, 255, 255, 0.92); border: 1px solid #d5dbe3; border-radius: 6px;
  padding: 3px 8px 4px; box-shadow: 0 2px 8px rgba(20, 40, 80, 0.10);
}
.p3l b { color: #0014dc; font-weight: 600; margin-right: 5px; }
.p3l small { display: block; color: #5d6470; font-size: 11px; }
.p3l small:empty { display: none; }
.p3l::after {
  content: ''; position: absolute; left: 50%; bottom: -5px; width: 8px; height: 8px; margin-left: -4px;
  background: inherit; border-right: 1px solid #d5dbe3; border-bottom: 1px solid #d5dbe3; transform: rotate(45deg);
}
.p3l.st-running { border-color: #35a8e6; }
.p3l.st-running b { color: #0b74b8; }
.p3l.st-failed { border-color: #e7a2a2; }
.p3l.st-failed b { color: #c62828; }
.p3l.feed b, .p3l.product b { color: #2b3440; }
.p3l.product { border-color: #b9dcc2; }
.p3l.dec b { color: #7a4d00; }

/* 首页三维装置上的说明标签（基础样式；浅色首页在 stage.css 里改成白底细边卡） */
.p3l.tag {
  background: rgba(255, 255, 255, 0.72); border: 1px solid rgba(63, 124, 255, 0.35); border-left: 3px solid #3f7cff;
  border-radius: 4px; padding: 4px 9px 5px; box-shadow: 0 6px 18px rgba(30, 70, 160, 0.12); backdrop-filter: blur(2px);
  font-size: 12px; color: #1d2b4f;
}
.p3l.tag::after { display: none; }
.p3l.tag b { color: #1a4fd6; }
.p3l.tag small { color: #4b5a7a; }
.p3l.tag.amber { border-left-color: #f0a030; }
.p3l.tag.amber b { color: #a15c00; }
.p3l.tag.violet { border-left-color: #8b6fd4; }
.p3l.tag.violet b { color: #6243b8; }

.p3d-tools { position: absolute; right: 10px; top: 10px; display: flex; gap: 6px; }
.p3d-tools button {
  height: 26px; padding: 0 10px; border: 1px solid #d0d6de; border-radius: 4px; background: rgba(255, 255, 255, 0.9);
  font: inherit; font-size: 12px; color: #2b3440; cursor: pointer;
}
.p3d-tools button:hover { border-color: #368ccb; color: #0b5ea8; }

.p3d-legend {
  position: absolute; left: 10px; bottom: 10px; display: flex; flex-direction: column; gap: 5px;
  padding: 7px 10px; background: rgba(255, 255, 255, 0.88); border: 1px solid #dde2e8; border-radius: 6px;
  font-size: 11.5px; color: #3a414b; pointer-events: none;
}
.p3d-lg-t { display: flex; align-items: center; gap: 6px; }
.p3d-lg-t i { display: inline-block; width: 120px; height: 8px; border-radius: 4px; }
.p3d-lg-t b { font-weight: 600; font-variant-numeric: tabular-nums; }
.p3d-lg-c { display: flex; flex-wrap: wrap; gap: 4px 12px; }
.p3d-lg-c span { display: inline-flex; align-items: center; gap: 4px; }
.p3d-lg-c i { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.p3d-lg-c i.ll { border-radius: 2px; background: transparent; border: 2px solid #f08a24; width: 10px; height: 6px; }
.p3d-help { position: absolute; right: 12px; bottom: 10px; font-size: 11px; color: #8a919b; pointer-events: none; }

.vb-legend.lam { display: inline-flex; align-items: center; gap: 6px; color: #6243b8; font-variant-numeric: tabular-nums; }
.vb-legend.lam .lam-bar { display: inline-block; width: 80px; height: 6px; border-radius: 3px; background: #e6e0f6; overflow: hidden; }
.vb-legend.lam .lam-bar b { display: block; height: 100%; background: #8b6fd4; transition: width 0.3s; }

/* ---------------------------------------------------------------- 智能体宠物“小塔” */
.pet { display: block; flex: none; overflow: visible; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.pet:focus { outline: none; }
.pet .pet-shadow { fill: rgba(10, 20, 60, 0.16); transform-origin: 60px 143px; animation: petShadow 3.2s ease-in-out infinite; }
.pet .pet-float { transform-origin: 60px 90px; animation: petFloat 3.2s ease-in-out infinite; }
.pet .pet-drop { transform-origin: 60px 17px; animation: petDrop 2.8s ease-in-out infinite; }
.pet .pet-ant { transform-origin: 60px 31px; }
.pet .pet-arm.l { transform-origin: 21px 81px; animation: petArmL 3.2s ease-in-out infinite; }
.pet .pet-arm.r { transform-origin: 99px 81px; animation: petArmR 3.2s ease-in-out infinite; }
.pet .pet-eyes rect { transform-box: fill-box; transform-origin: center; transition: transform 0.07s; }
.pet.blink .pet-eyes rect { transform: scaleY(0.12); }
.pet .pet-rim { animation: petRim 2.8s ease-in-out infinite; }
.pet .pet-bub circle { opacity: 0; animation: petBub 2.6s linear infinite; }
.pet .pet-bub circle:nth-child(2) { animation-delay: 0.9s; }
.pet .pet-bub circle:nth-child(3) { animation-delay: 1.7s; }
.pet .pet-mouth.talk { transform-box: fill-box; transform-origin: center; animation: petTalk 0.26s ease-in-out infinite alternate; }
/* 在算：塔板闪、汽泡快、右手敲 */
.pet.ps-work .pet-bub circle { animation-duration: 1.1s; }
.pet.ps-work .pet-trays line { animation: petTray 0.8s ease-in-out infinite alternate; }
.pet.ps-work .pet-trays line:nth-child(2) { animation-delay: 0.25s; }
.pet.ps-work .pet-trays line:nth-child(3) { animation-delay: 0.5s; }
.pet.ps-work .pet-arm.r { animation: petType 0.45s ease-in-out infinite alternate; }
/* 在听：天线晃 */
.pet.ps-listen .pet-ant { animation: petAnt 1.6s ease-in-out infinite; }
/* 在想 */
.pet.ps-think .pet-dots circle { animation: petDot 1.3s ease-in-out infinite; }
.pet.ps-think .pet-dots circle:nth-child(2) { animation-delay: 0.2s; }
.pet.ps-think .pet-dots circle:nth-child(3) { animation-delay: 0.4s; }
/* 等你确认 */
.pet.ps-wait .pet-alert { transform-origin: 99px 22px; animation: petAlert 1.1s ease-in-out infinite; }
.pet.ps-wait .pet-arm.r { animation: petWave 0.8s ease-in-out infinite alternate; }
/* 完成 */
.pet.ps-happy .pet-float { animation: petJump 1s ease-in-out infinite; }
.pet.ps-happy .pet-arm.l { animation: petCheerL 1s ease-in-out infinite; }
.pet.ps-happy .pet-arm.r { animation: petCheerR 1s ease-in-out infinite; }
.pet.ps-happy .pet-spark path { transform-box: fill-box; transform-origin: center; animation: petSpark 1.2s ease-in-out infinite; }
.pet.ps-happy .pet-spark path:nth-child(2) { animation-delay: 0.3s; }
.pet.ps-happy .pet-spark path:nth-child(3) { animation-delay: 0.6s; }
/* 失败、休息 */
.pet.ps-sad .pet-float { animation: petSad 4.2s ease-in-out infinite; }
.pet.ps-sad .pet-arm.l, .pet.ps-sad .pet-arm.r { animation: none; }
.pet.ps-sleep .pet-float { animation: petBreath 4.6s ease-in-out infinite; }
.pet.ps-sleep .pet-arm.l, .pet.ps-sleep .pet-arm.r, .pet.ps-sleep .pet-drop { animation: none; }
.pet.ps-sleep .pet-z text { animation: petZ 2.6s ease-in-out infinite; }
.pet.ps-sleep .pet-z text:nth-child(2) { animation-delay: 0.8s; }
/* 被点一下 */
.pet.poked .pet-float { animation: petPoke 0.6s ease-out; }

@keyframes petFloat { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-4px); } }
@keyframes petShadow { 0%, 100% { transform: scaleX(1); opacity: 1; } 50% { transform: scaleX(0.86); opacity: 0.7; } }
@keyframes petDrop { 0%, 100% { transform: translateY(0) scale(1); } 50% { transform: translateY(1.5px) scale(1.06, 0.94); } }
@keyframes petArmL { 0%, 100% { transform: rotate(4deg); } 50% { transform: rotate(-3deg); } }
@keyframes petArmR { 0%, 100% { transform: rotate(-4deg); } 50% { transform: rotate(3deg); } }
@keyframes petRim { 0%, 100% { stroke-opacity: 0.55; } 50% { stroke-opacity: 1; } }
@keyframes petBub { 0% { opacity: 0; transform: translateY(0); } 15% { opacity: 0.9; } 100% { opacity: 0; transform: translateY(-34px); } }
@keyframes petTalk { from { transform: scaleY(0.35); } to { transform: scaleY(1.1); } }@keyframes petTray { from { stroke-opacity: 0.25; } to { stroke-opacity: 0.85; } }
@keyframes petType { from { transform: rotate(-10deg); } to { transform: rotate(6deg); } }
@keyframes petAnt { 0%, 100% { transform: rotate(0); } 30% { transform: rotate(-9deg); } 70% { transform: rotate(8deg); } }
@keyframes petDot { 0%, 100% { opacity: 0.25; } 50% { opacity: 1; } }
@keyframes petAlert { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.14); } }
@keyframes petWave { from { transform: rotate(-30deg); } to { transform: rotate(-70deg); } }
@keyframes petJump { 0%, 100% { transform: translateY(0); } 40% { transform: translateY(-9px); } 60% { transform: translateY(-9px); } }
@keyframes petCheerL { 0%, 100% { transform: rotate(10deg); } 50% { transform: rotate(60deg); } }
@keyframes petCheerR { 0%, 100% { transform: rotate(-10deg); } 50% { transform: rotate(-60deg); } }
@keyframes petSpark { 0%, 100% { transform: scale(0.6); opacity: 0.4; } 50% { transform: scale(1.15); opacity: 1; } }
@keyframes petSad { 0%, 100% { transform: translateY(3px); } 50% { transform: translateY(5px); } }
@keyframes petBreath { 0%, 100% { transform: translateY(4px) scale(1, 1); } 50% { transform: translateY(4px) scale(1.015, 0.985); } }
@keyframes petZ { 0% { opacity: 0; transform: translate(0, 4px); } 30% { opacity: 1; } 100% { opacity: 0; transform: translate(6px, -8px); } }
@keyframes petPoke { 0% { transform: translateY(0) scale(1); } 30% { transform: translateY(-10px) scale(0.95, 1.06); } 60% { transform: translateY(0) scale(1.06, 0.94); } 100% { transform: translateY(0) scale(1); } }

@media (prefers-reduced-motion: reduce) {
  .p3l { transition: none; }
  .pet *, .pet.poked .pet-float { animation: none !important; }
}
