/* base.css —— 重置 / 画布叠层 / 排版 / 焦点 / 全局状态 */

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

html, body { height: 100%; }

body {
  background: var(--ink);
  color: var(--paper);
  font-family: var(--font-sans);
  font-size: var(--fs-body);
  line-height: var(--lh-body);
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

::selection { background: rgba(255, 184, 104, 0.32); }

/* 焦点环（可访问性：永远可见） */
:focus { outline: none; }
:focus-visible {
  outline: 1px solid var(--cyan);
  outline-offset: 4px;
}

button {
  font: inherit;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
}

/* —— 画布叠层：天空 / 城市 / 特效 —— */
#stage { position: fixed; inset: 0; }
#stage canvas { position: absolute; inset: 0; display: block; }
#sky { z-index: 0; }
#city { z-index: 1; }
#fx { z-index: 2; pointer-events: none; }

/* 暗角：黑是墨，收拢视线 */
#vignette {
  position: fixed; inset: 0; z-index: 3;
  pointer-events: none;
  background: radial-gradient(ellipse 130% 100% at 50% 42%, transparent 58%, rgba(2, 4, 9, 0.55) 100%);
}

/* 建筑标记层 */
#pins { position: fixed; inset: 0; z-index: 6; pointer-events: none; }

/* —— 降落动画：城市从云里浮起 —— */
#stage { transition: transform 1200ms var(--ease), opacity 1100ms var(--ease); transform: scale(1.045); opacity: 0.35; }
body.roaming #stage { transform: scale(1); opacity: 1; }

/* 黑场（重建城市） */
#blackout {
  position: fixed; inset: 0; z-index: 40;
  background: var(--ink);
  opacity: 0;
  pointer-events: none;
  transition: opacity 400ms var(--ease);
}
#blackout.on { opacity: 1; }

/* —— 静态降级（无 Canvas 的极老浏览器） —— */
#fallback {
  position: fixed; inset: 0; z-index: 60;
  display: grid; place-items: center;
  background: var(--ink);
  text-align: center;
  padding: var(--s5);
}
#fallback[hidden] { display: none; }
#fallback p { max-width: 28em; color: var(--dim); }
#fallback .t { font-family: var(--font-serif); font-size: var(--fs-title); color: var(--paper); margin-bottom: var(--s3); }

/* 滚动条（面板内） */
* { scrollbar-width: thin; scrollbar-color: var(--line) transparent; }
*::-webkit-scrollbar { width: 6px; height: 6px; }
*::-webkit-scrollbar-thumb { background: var(--line); }
*::-webkit-scrollbar-track { background: transparent; }

/* 减少动态：一切转场直切 */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
