/**
 * dsh-yyrsp 桌宠样式（全部选择器都带 .dsh-yyrsp 前缀，不影响宿主页面）
 *
 * 与 dsh-pet 桌面运行时配套：sprite.js 只负责生成 DOM 与内联坐标，形状/层级/穿透由这里定。
 * 层级：页面浮层 2147482000；右键菜单由 shared-core 的 MENU_CSS 给到 2147483000（同一层叠上下文内）。
 */

.dsh-yyrsp {
  position: fixed;
  left: 0;
  top: 0;
  right: 0;
  bottom: 0;
  overflow: visible;
  pointer-events: none; /* 整层穿透：只有宠物身体命中区接管鼠标 */
  z-index: 2147482000;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  line-height: normal;
  font-size: 16px;
}

.dsh-yyrsp *,
.dsh-yyrsp *::before,
.dsh-yyrsp *::after {
  box-sizing: border-box;
}

/* 坐标舞台：与视口同尺寸，adapter 写入的 left/top 就是视口坐标 */
.dsh-yyrsp-stage {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* 单只宠物容器：宽 = --pet-size，高按 16:9 视频画布留白 */
.dsh-yyrsp .pet-sprite {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: none;
}

.dsh-yyrsp .pet-stage {
  position: relative;
  width: var(--pet-size, 462px);
  height: calc(var(--pet-size, 462px) * 9 / 16);
  pointer-events: none;
}

/* 双缓冲：两段视频叠放，前台那段 opacity:1，切源时交叉淡入 */
.dsh-yyrsp video.pet-video {
  position: absolute;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.18s ease;
}

.dsh-yyrsp video.pet-video.is-front {
  opacity: 1;
}

/* 身体命中区：整层唯一接收鼠标的地方 */
.dsh-yyrsp .pet-hit {
  position: absolute;
  pointer-events: auto;
  cursor: grab;
  z-index: 1;
  touch-action: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

.dsh-yyrsp .pet-hit.dragging {
  cursor: grabbing;
}

/* 配置加载失败时的红条（配置错才出现，正常看不见） */
.dsh-yyrsp .pet-error {
  position: fixed;
  left: 50%;
  top: 24px;
  transform: translateX(-50%);
  max-width: 80vw;
  background: rgba(217, 79, 61, 0.95);
  color: #fff;
  border-radius: 12px;
  padding: 10px 16px;
  font-size: 13px;
  line-height: 1.5;
  display: none;
  z-index: 3;
  pointer-events: none;
  word-break: break-all;
}

.dsh-yyrsp .pet-error.visible {
  display: block;
}

/* 自定义光标：路径相对本 CSS 文件（本地目录与 OSS 同一份布局都能用） */
.dsh-yyrsp .pet-hit {
  cursor: url('./pic/cursor-grab.png') 16 16, grab;
}

.dsh-yyrsp .pet-hit.dragging {
  cursor: url('./pic/cursor-grabbing.png') 16 16, grabbing;
}

@media (prefers-reduced-motion: reduce) {
  .dsh-yyrsp video.pet-video {
    transition: none;
  }
}

/* ---- 以下由构建脚本从 shared-core 的 MENU_CSS / TOOLTIP_CSS 抽出，统一加 .dsh-yyrsp 前缀 ---- */
.dsh-yyrsp .dsh-pet-menu{position:fixed;left:0;top:0;z-index:2147483000;color:#2b2b2b;font-size:13px;line-height:1.5;font-family:'Microsoft YaHei UI','Segoe UI','PingFang SC',sans-serif;user-select:none;pointer-events:auto}.dsh-yyrsp .dsh-pet-menu,.dsh-yyrsp .dsh-pet-menu *{box-sizing:border-box}.dsh-yyrsp .dsh-pet-menu-column{position:absolute;min-width:150px;max-width:300px;padding:4px;background:rgba(255,255,255,.98);border:1px solid rgba(0,0,0,.12);border-radius:8px;box-shadow:0 8px 28px rgba(0,0,0,.2);max-height:min(62vh,460px);overflow-y:auto;scrollbar-width:thin;scrollbar-color:rgba(0,0,0,.22) transparent}.dsh-yyrsp .dsh-pet-menu-column::-webkit-scrollbar{width:8px;height:8px}.dsh-yyrsp .dsh-pet-menu-column::-webkit-scrollbar-track{background:transparent}.dsh-yyrsp .dsh-pet-menu-column::-webkit-scrollbar-thumb{background:rgba(0,0,0,.16);border-radius:4px;border:2px solid transparent;background-clip:content-box}.dsh-yyrsp .dsh-pet-menu-column::-webkit-scrollbar-thumb:hover{background:rgba(43,99,255,.4);border:2px solid transparent;background-clip:content-box}.dsh-yyrsp .dsh-pet-menu-column::-webkit-scrollbar-corner{background:transparent}.dsh-yyrsp .dsh-pet-menu-item{position:relative;display:flex;align-items:center;justify-content:space-between;gap:14px;padding:5px 12px;border-radius:6px;white-space:nowrap;cursor:default}.dsh-yyrsp .dsh-pet-menu-item:hover{background:rgba(43,99,255,.14)}.dsh-yyrsp .dsh-pet-menu-item>span:first-child{min-width:0;overflow:hidden;text-overflow:ellipsis}.dsh-yyrsp .dsh-pet-menu-hint{color:#9aa0a6;font-size:12px;flex:none;white-space:nowrap}.dsh-yyrsp .dsh-pet-menu-arrow{color:#9aa0a6;font-size:12px;flex:none}
.dsh-yyrsp .pet-tooltip{position:fixed;left:0;top:0;max-width:calc(var(--dsh-pet-size,var(--pet-size,462px))*0.8);padding:calc(var(--dsh-pet-size,var(--pet-size,462px))*0.010) calc(var(--dsh-pet-size,var(--pet-size,462px))*0.021);border-radius:calc(var(--dsh-pet-size,var(--pet-size,462px))*0.016);background:rgba(255,255,255,.96);color:#1f1f1f;border:1px solid rgba(0,0,0,.12);font-family:var(--dsh-pet-font-family,"ShangshouSoftCandy","Yuanti SC","YouYuan","幼圆","Comic Sans MS","PingFang SC","Microsoft YaHei",sans-serif);font-size:var(--dsh-pet-font-tip,calc(var(--dsh-pet-size,var(--pet-size,462px))*0.026));line-height:1.4;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;box-shadow:0 calc(var(--dsh-pet-size,var(--pet-size,462px))*0.004) calc(var(--dsh-pet-size,var(--pet-size,462px))*0.013) rgba(0,0,0,.18);opacity:0;transition:opacity .12s ease;pointer-events:none;z-index:2}.dsh-yyrsp .pet-tooltip.is-on{opacity:1}
