/* src/style.css — 世界层堆栈 + 克制 UI。 */

:root {
  --ui-fg: rgba(255, 255, 255, 0.86);
  --ui-fg-dim: rgba(255, 255, 255, 0.55);
  --ui-shadow: 0 1px 10px rgba(0, 0, 0, 0.38);
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Noto Sans SC",
    "Helvetica Neue", "Segoe UI", sans-serif;
}

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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0a1018;
}

#world {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  overflow: hidden;
}

/* ---- 世界层堆栈（自下而上：天空画布 → 染色(暗/亮) → 天体画布 → 地形画布(2.5D) → 侧光 → 雾 → 雪） ---- */
#world > * {
  position: absolute;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  max-width: none;
}

#sky, #celestial, #terrain, #snow { display: block; }

#tint-dark { mix-blend-mode: multiply; }
#tint-light { mix-blend-mode: screen; }

#t-light { mix-blend-mode: normal; }

#fog-veil { mix-blend-mode: normal; }

#fog-noise-1, #fog-noise-2 {
  background-repeat: repeat;
  background-size: 900px 900px;
  opacity: 0;
  /* 可见度蒙版由 world.json 集中配置。 */
}
#fog-noise-2 { background-size: 1400px 1200px; }

/* ---- 克制 UI（悬浮于世界之上） ---- */
#ui {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  pointer-events: none;
  color: var(--ui-fg);
  font-size: 13px;
  letter-spacing: 0.06em;
  z-index: 10;
}

#ui.ui-off { display: none; }

/* 财富位置：演示占位（无真实数据源） */
.ui-wealth {
  position: absolute;
  left: var(--safe-left);
  bottom: var(--safe-bottom);
  display: flex;
  align-items: baseline;
  gap: 12px;
  text-shadow: var(--ui-shadow);
}
.ui-wealth-label {
  font-size: 12px;
  color: var(--ui-fg-dim);
  letter-spacing: 0.24em;
}
.ui-wealth-value {
  font-size: 21px;
  font-weight: 200;
  color: var(--ui-fg-dim);
}
.ui-wealth-note {
  font-size: 10px;
  color: var(--ui-fg-dim);
  opacity: 0.7;
  letter-spacing: 0.1em;
}

/* 小按钮 */
.ui-btn {
  pointer-events: auto;
  position: absolute;
  right: var(--safe-right);
  top: var(--safe-top);
  background: none;
  border: none;
  color: var(--ui-fg-dim);
  font-size: 12px;
  letter-spacing: 0.22em;
  padding: 8px 4px;
  cursor: pointer;
  font-family: inherit;
  text-shadow: var(--ui-shadow);
  transition: color 0.3s;
}
.ui-btn:hover { color: var(--ui-fg); }

/* 状态切换（低调文字行；默认隐藏，点“状态”展开，Escape/点击外部关闭） */
.ui-states {
  pointer-events: auto;
  position: absolute;
  top: calc(var(--safe-top) + 34px);
  right: var(--safe-right);
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.ui-states[hidden] { display: none; }
.ui-state {
  background: none;
  border: none;
  color: var(--ui-fg-dim);
  font-size: 12px;
  letter-spacing: 0.18em;
  padding: 5px 4px;
  cursor: pointer;
  font-family: inherit;
  text-shadow: var(--ui-shadow);
  transition: color 0.3s;
}
.ui-state:hover { color: var(--ui-fg); }
.ui-state.active { color: var(--ui-fg); }
.ui-state.active::before { content: "· "; color: var(--ui-fg-dim); }

.boot-error {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #e8d9c8;
  font-size: 14px;
  letter-spacing: 0.08em;
  padding: 0 24px;
  text-align: center;
}

/* 移动端：状态选择改为底部横排 */
@media (max-width: 899px) {
  .ui-states {
    top: auto;
    bottom: calc(var(--safe-bottom) - 8px);
    right: var(--safe-right);
    flex-direction: row;
    flex-wrap: wrap;
    justify-content: flex-end;
    gap: 4px 12px;
    max-width: 200px;
  }
  #ui-btn-states { top: auto; bottom: var(--safe-bottom); right: auto; left: var(--safe-left); }
  .ui-wealth { bottom: calc(var(--safe-bottom) + 40px); }
  .ui-wealth-value { font-size: 19px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
