/* 共生空间 v1 桌面端样式 */
* { margin: 0; padding: 0; box-sizing: border-box; }

html, body { height: 100%; }

body {
  background: #1c1a24;
  color: #e8e2d8;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  overflow: hidden;
  user-select: none;
  display: flex;
  flex-direction: column;
  height: 100%;
}

#app {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

/* ---- 站点导航（与 warm chat 侧边栏同源样式，静态复刻）---- */
.site-nav {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 7px 16px;
  background: rgba(250, 250, 252, 0.97);
  border-bottom: 1px solid rgba(84, 84, 88, 0.25);
  overflow-x: auto;
  white-space: nowrap;
  scrollbar-width: thin;
}

.site-nav-brand {
  flex: 0 0 auto;
  font-weight: 800;
  font-size: 13px;
  letter-spacing: 0.04em;
  color: #352b28;
  padding-right: 12px;
  border-right: 1px solid rgba(84, 84, 88, 0.18);
}

.site-nav-brand .b1 { color: #b86f42; }
.site-nav-brand .b2 { color: #8a7f8f; }

.site-nav-items { display: flex; align-items: center; gap: 4px; }

.site-nav .nav-item {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 11px;
  border-radius: 12px;
  color: #6e6e73;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.18s ease, color 0.18s ease;
}

.site-nav a.nav-item { text-decoration: none; }
.site-nav .nav-item:hover { background: rgba(0, 122, 255, 0.07); color: #0a84ff; }
.site-nav .nav-item.active {
  background: rgba(0, 122, 255, 0.11);
  color: #0a84ff;
  font-weight: 600;
  cursor: default;
}
.site-nav .nav-item[aria-disabled="true"] { opacity: 0.45; cursor: not-allowed; }
.site-nav .nav-item:hover[aria-disabled="true"] { background: none; color: #6e6e73; }
.site-nav .nav-item svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex: 0 0 auto;
}

#stage-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

/* 面板展开时为面板让位（布局即时生效，保证地图任何时刻都完整显示；
   动画只保留在面板滑入，避免过渡期间缩放与布局竞争） */
#app.panel-open #stage-wrap {
  padding-right: 262px;
}

/* 固定 1024×640 世界坐标，JS 计算等比缩放，姓名牌跟随缩放 */
#stage {
  position: relative;
  width: 1024px;
  height: 640px;
  transform-origin: center center;
  border-radius: 6px;
  box-shadow: 0 12px 48px rgba(0, 0, 0, 0.55);
  overflow: hidden;
}

#room-canvas {
  position: absolute;
  inset: 0;
  image-rendering: pixelated;
}

/* ---- 姓名牌 ---- */
#nameplate-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.nameplate {
  position: absolute;
  transform: translate(-50%, -100%);
  padding: 2px 8px 3px;
  border-radius: 7px;
  font-size: 14px;
  line-height: 1.15;
  letter-spacing: 0.5px;
  white-space: nowrap;
  max-width: 140px;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #fff;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.45);
  border: 1.5px solid rgba(255, 255, 255, 0.75);
  box-shadow: 0 2px 6px rgba(20, 16, 28, 0.35);
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: none;
}

.nameplate.show { opacity: 1; transition: opacity 0.25s ease; }

.nameplate.rose { background: rgba(226, 116, 138, 0.92); }
.nameplate.sky  { background: rgba(96, 152, 214, 0.92); }

.nameplate.active {
  border-color: #ffe9a8;
  box-shadow: 0 0 0 2px rgba(255, 233, 168, 0.35), 0 2px 8px rgba(20, 16, 28, 0.45);
}

/* ---- 测试面板：默认收起，悬浮按钮展开 ---- */
#panel-toggle {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 11;
  padding: 8px 14px;
  border: 1px solid rgba(255, 233, 168, 0.4);
  border-radius: 999px;
  background: rgba(30, 27, 40, 0.9);
  color: #f5d9a8;
  font-size: 13px;
  letter-spacing: 1px;
  cursor: pointer;
  backdrop-filter: blur(4px);
  transition: opacity 0.28s ease, transform 0.28s ease;
}

#panel-toggle:hover { background: rgba(58, 52, 74, 0.95); }

#app.panel-open #panel-toggle {
  opacity: 0;
  transform: translateY(-8px);
  pointer-events: none;
}

#panel {
  position: fixed;
  top: 14px;
  right: 14px;
  width: 232px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  background: rgba(30, 27, 40, 0.94);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 12px;
  font-size: 13px;
  z-index: 10;
  backdrop-filter: blur(4px);
  transform: translateX(calc(100% + 34px));
  transition: transform 0.28s ease;
}

#app.panel-open #panel { transform: none; }

/* 隐藏标签页中过渡不推进：禁用动画保证布局行为确定 */
body.no-anim #panel,
body.no-anim #panel-toggle,
body.no-anim #stage {
  transition: none !important;
}

#panel h2 {
  font-size: 13px;
  font-weight: 600;
  color: #f5d9a8;
  margin-bottom: 8px;
  letter-spacing: 1px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#panel h2 button {
  width: auto;
  margin: 0;
  padding: 1px 8px;
  font-size: 12px;
  border-radius: 6px;
}

#panel .sec { margin-bottom: 10px; }

#panel .sec h3 {
  font-size: 11px;
  color: #9b93a8;
  font-weight: 500;
  margin-bottom: 5px;
  letter-spacing: 1px;
}

#panel button {
  display: block;
  width: 100%;
  margin: 4px 0;
  padding: 6px 8px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.07);
  color: #efe9de;
  font-size: 12.5px;
  cursor: pointer;
  text-align: left;
}

#panel button .kbd {
  float: right;
  color: #9b93a8;
  font-size: 11px;
}

#panel button:hover:not(:disabled) { background: rgba(255, 255, 255, 0.14); }

#panel button:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

#panel .reason {
  font-size: 11px;
  color: #c9868f;
  min-height: 15px;
  margin: 2px 0 4px;
}

#panel .reason.flash { color: #f2a0b0; }

#panel .status {
  font-size: 11.5px;
  color: #b7afc2;
  line-height: 1.5;
  border-top: 1px dashed rgba(255, 255, 255, 0.14);
  padding-top: 7px;
}

#panel .status b.rose { color: #f2a0b0; }
#panel .status b.sky { color: #9cc4f0; }

#panel label.tog {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: #cfc8da;
  cursor: pointer;
  margin: 3px 0;
}

/* ---- 底部提示 ---- */
#hint {
  text-align: center;
  padding: 8px 0 12px;
  font-size: 12px;
  color: #8d8598;
}

#hint .key {
  display: inline-block;
  padding: 1px 7px;
  margin: 0 3px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.06);
  color: #cfc8da;
  font-size: 11px;
}

#loading {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1c1a24;
  color: #b7afc2;
  font-size: 15px;
  letter-spacing: 2px;
  z-index: 99;
}
#loading.hide { display: none; }
