* { margin: 0; padding: 0; box-sizing: border-box; }

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 28%, #1f3168 0%, #0c1336 55%, #050713 100%);
  font-family: "Microsoft YaHei", "PingFang SC", system-ui, sans-serif;
  color: #fff;
  user-select: none;
}

#scene {
  position: fixed;
  inset: 0;
  cursor: grab;
}
#scene.dragging { cursor: grabbing; }

.cursor-fx {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 20;
}

/* 顶部标题 */
.title {
  position: fixed;
  top: 16px;
  left: 0;
  right: 0;
  text-align: center;
  pointer-events: none;
  z-index: 5;
}
.title h1 {
  font-size: clamp(28px, 4.8vw, 54px);
  letter-spacing: 2px;
  background: linear-gradient(90deg, #ffe066, #ff8a65, #a5f075, #ffe066);
  background-size: 300% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shine 6s linear infinite;
  filter: drop-shadow(0 2px 12px rgba(255, 215, 90, 0.45));
}
.title p {
  margin-top: 4px;
  font-size: clamp(13px, 1.6vw, 17px);
  color: rgba(255, 250, 230, 0.9);
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.6);
}
@keyframes shine { to { background-position: 300% 0; } }

/* 右上角按钮 */
.actions {
  position: fixed;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 10px;
  z-index: 10;
}
.btn-primary, .btn-icon {
  border: 1px solid rgba(255, 224, 102, 0.55);
  border-radius: 999px;
  background: rgba(15, 25, 58, 0.78);
  backdrop-filter: blur(8px);
  color: #ffe885;
  font-weight: 700;
  font-size: 14px;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
  transition: transform 0.15s ease, background 0.15s ease, box-shadow 0.15s ease;
}
.btn-primary {
  padding: 9px 16px;
}
.btn-icon {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  font-size: 18px;
}
.btn-primary:hover, .btn-icon:hover {
  transform: translateY(-2px) scale(1.03);
  background: rgba(30, 48, 102, 0.92);
  box-shadow: 0 6px 20px rgba(255, 212, 77, 0.3);
}
.btn-primary:active, .btn-icon:active {
  transform: scale(0.97);
}

/* 底部家族图鉴 + 提示 */
.bottom-ui {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  z-index: 10;
  pointer-events: none;
}
.hint {
  padding: 5px 15px;
  border-radius: 999px;
  background: rgba(10, 20, 48, 0.72);
  backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  font-size: 12.5px;
  color: #eef4ff;
}
.family-bar {
  pointer-events: auto;
  max-width: min(96vw, 1120px);
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 7px 10px;
  border-radius: 18px;
  background: rgba(10, 18, 44, 0.78);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 224, 102, 0.28);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 224, 102, 0.45) transparent;
}
.family-bar::-webkit-scrollbar { height: 5px; }
.family-bar::-webkit-scrollbar-thumb {
  background: rgba(255, 224, 102, 0.45);
  border-radius: 999px;
}
.chip {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  width: 49px;
  padding: 4px 3px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.07);
  color: #fff8dc;
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
}
.chip:hover {
  transform: translateY(-3px) scale(1.06);
  background: rgba(255, 224, 102, 0.22);
  border-color: rgba(255, 224, 102, 0.75);
}
.chip img {
  width: 32px;
  height: 32px;
  object-fit: contain;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}
.chip span {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 52px;
}

/* 对话气泡 */
.bubble {
  position: fixed;
  left: 0;
  top: 0;
  padding: 8px 14px;
  border-radius: 14px;
  background: #fffbe6;
  color: #5c3b00;
  border: 2px solid #ffd34d;
  font-weight: 800;
  font-size: 15px;
  white-space: nowrap;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
  transform: translate(-50%, -100%) scale(0);
  transform-origin: 50% 100%;
  transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.18s ease;
  opacity: 0;
  pointer-events: none;
  z-index: 8;
}
.bubble::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -9px;
  transform: translateX(-50%);
  border: 8px solid transparent;
  border-bottom: 0;
  border-top-color: #fffbe6;
}
.bubble.show {
  opacity: 1;
  transform: translate(-50%, -100%) scale(1);
}

/* 捧腹大笑飘字层 */
.haha-layer {
  position: fixed;
  inset: 0;
  pointer-events: none;
  overflow: hidden;
  z-index: 7;
}
.haha {
  position: absolute;
  font-weight: 900;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.65), 0 0 2px #000;
  transform: translate(-50%, -50%);
  animation: hahaFloat 1.9s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  opacity: 0;
}
@keyframes hahaFloat {
  0% {
    opacity: 0;
    transform: translate(-50%, -50%) scale(0.4) rotate(0deg);
  }
  18% {
    opacity: 1;
    transform: translate(calc(-50% + var(--dx) * 0.25), -85%) scale(1.25) rotate(var(--rot));
  }
  100% {
    opacity: 0;
    transform: translate(calc(-50% + var(--dx)), -240%) scale(0.9) rotate(var(--rot));
  }
}

@media (max-width: 640px) {
  .actions { top: auto; bottom: 118px; right: 12px; }
  .hint { display: none; }
}
