/* HY69 小人的家 —— 可信外层 UI 样式（沙箱 iframe 之外的部分）。
   全屏沙箱在底层，外层只放品牌、立绘与对话气泡，pointer-events 仅交互元素开放，
   不遮挡沙箱里小人的世界。零外部依赖。 */
:root {
  --accent: #8fb7ff;
  --panel: rgba(16, 20, 32, 0.82);
  --panel-border: rgba(143, 183, 255, 0.22);
  --text: #e8edf7;
  --text-dim: #9aa6bd;
}
* { box-sizing: border-box; }
html, body {
  margin: 0; height: 100%; overflow: hidden;
  background: #0a0d16; color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

/* 全屏沙箱：小人的世界 */
.world-sandbox {
  position: fixed; inset: 0; width: 100%; height: 100%;
  border: 0; z-index: 0; display: block; background: #0a0d16;
}

/* 可信外层 */
.world-ui { position: fixed; inset: 0; z-index: 10; pointer-events: none; }

.world-brand {
  position: absolute; top: 18px; left: 22px;
  font-size: 15px; font-weight: 700; letter-spacing: 0.5px;
  color: var(--text); text-shadow: 0 1px 8px rgba(0,0,0,0.6);
  opacity: 0.9;
}
.world-brand span { font-weight: 400; color: var(--text-dim); font-size: 13px; }

/* 立绘 + 对话：右下角 */
.mascot {
  position: absolute; right: 26px; bottom: 22px;
  display: flex; flex-direction: column; align-items: flex-end; gap: 12px;
  pointer-events: none;
}
.mascot-img {
  width: 132px; height: auto; cursor: pointer; pointer-events: auto;
  filter: drop-shadow(0 8px 24px rgba(0,0,0,0.55));
  animation: mascot-float 4.5s ease-in-out infinite;
  transition: transform 0.25s ease;
  user-select: none; -webkit-user-drag: none;
}
.mascot-img:hover { transform: scale(1.05); }
.mascot-img:active { transform: scale(0.97); }
@keyframes mascot-float {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -8px; }
}
@media (prefers-reduced-motion: reduce) {
  .mascot-img { animation: none; }
}

/* 对话面板 */
.mascot-chat {
  pointer-events: auto;
  width: min(340px, calc(100vw - 52px));
  max-height: 0; opacity: 0; overflow: hidden;
  transform: translateY(8px);
  transition: max-height 0.3s ease, opacity 0.25s ease, transform 0.3s ease;
  background: var(--panel);
  border: 1px solid var(--panel-border);
  border-radius: 16px;
  backdrop-filter: blur(12px);
  box-shadow: 0 12px 40px rgba(0,0,0,0.5);
}
.mascot-chat.open {
  max-height: 420px; opacity: 1; transform: translateY(0);
}
.mascot-chat-body {
  height: 300px; overflow-y: auto; padding: 14px;
  display: flex; flex-direction: column; gap: 10px;
  scrollbar-width: thin;
}
.mascot-chat-msg {
  max-width: 86%; padding: 8px 12px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.55; white-space: pre-wrap; word-break: break-word;
}
.mascot-chat-msg.bot {
  align-self: flex-start; background: rgba(143,183,255,0.12);
  border: 1px solid rgba(143,183,255,0.18); color: var(--text);
  border-bottom-left-radius: 4px;
}
.mascot-chat-msg.user {
  align-self: flex-end; background: rgba(143,183,255,0.28);
  color: #fff; border-bottom-right-radius: 4px;
}
.mascot-chat-msg.typing { color: var(--text-dim); font-style: italic; }
.mascot-chat-msg.note {
  align-self: center; background: transparent; border: 0;
  color: var(--accent); font-size: 12px; padding: 2px 6px;
}
.mascot-chat-form {
  display: flex; gap: 8px; padding: 10px; border-top: 1px solid rgba(143,183,255,0.14);
}
.mascot-chat-form input {
  flex: 1; min-width: 0; background: rgba(0,0,0,0.3);
  border: 1px solid rgba(143,183,255,0.2); border-radius: 10px;
  padding: 8px 12px; color: var(--text); font-size: 13.5px; outline: none;
}
.mascot-chat-form input:focus { border-color: var(--accent); }
.mascot-chat-send {
  background: var(--accent); color: #0a0d16; border: 0; border-radius: 10px;
  padding: 8px 16px; font-size: 13.5px; font-weight: 600; cursor: pointer;
  transition: opacity 0.2s ease;
}
.mascot-chat-send:disabled { opacity: 0.5; cursor: default; }

/* 提示与状态 */
.world-hint {
  position: absolute; bottom: 26px; left: 50%; transform: translateX(-50%);
  font-size: 13px; color: var(--text-dim);
  background: rgba(10,13,22,0.55); padding: 6px 16px; border-radius: 20px;
  backdrop-filter: blur(6px); transition: opacity 0.6s ease; white-space: nowrap;
}
.world-hint.hide { opacity: 0; }
.world-status {
  position: absolute; top: 18px; right: 22px;
  font-size: 12px; color: var(--accent);
  background: rgba(10,13,22,0.6); padding: 5px 12px; border-radius: 16px;
  opacity: 0; transition: opacity 0.4s ease; max-width: 60vw;
}
.world-status.show { opacity: 1; }

@media (max-width: 560px) {
  .mascot { right: 14px; bottom: 14px; }
  .mascot-img { width: 96px; }
  .world-brand { top: 12px; left: 14px; font-size: 13px; }
  .world-hint { font-size: 12px; bottom: 16px; }
}
