/* ============================================================
   只是苜蓿 · 小院 — 样式
   ============================================================ */
:root { color-scheme: light; }

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

html, body {
  width: 100%; height: 100%; overflow: hidden;
  background: #eeeadf;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", system-ui, sans-serif;
}

/* 视觉隐藏、读屏与检索可读：画布页没有可抓取的正文，靠它承载标题与说明 */
.sr-only {
  position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* 画布容器：接管指针手势，禁止选中与拖动 */
#app { position: fixed; inset: 0; }
#app canvas {
  display: block;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}

/* 交互提示 */
#hint {
  position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%);
  font-size: 12px; letter-spacing: .22em; color: #8d8778;
  opacity: 0; transition: opacity 1s ease;
  pointer-events: none; user-select: none;
}
#hint.show { opacity: .8; }

/* 天气切换 */
#weather {
  position: fixed; left: 50%; top: 20px; transform: translateX(-50%);
  display: flex; gap: 2px; padding: 3px; border-radius: 999px;
  background: rgba(255, 255, 255, .6);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  box-shadow: 0 2px 12px rgba(72, 62, 46, .12);
  user-select: none;
}
#weather button {
  appearance: none; border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 12px; letter-spacing: .14em; color: #7c766a;
  padding: 6px 12px; border-radius: 999px;
  transition: background-color .28s ease, color .28s ease, box-shadow .28s ease;
}
#weather button:hover { color: #3a362d; }
#weather button.on {
  background: #f97316; color: #fff;
  box-shadow: 0 1px 7px rgba(249, 115, 22, .38);
}

/* 环境音开关：默认关闭，首次点击后才加载音频 */
#sound {
  position: fixed; right: 20px; top: 20px;
  width: 36px; height: 36px; padding: 0;
  appearance: none; border: 0; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  border-radius: 999px; color: #7c766a;
  background: rgba(255, 255, 255, .6);
  backdrop-filter: blur(12px) saturate(1.3);
  -webkit-backdrop-filter: blur(12px) saturate(1.3);
  box-shadow: 0 2px 12px rgba(72, 62, 46, .12);
  transition: background-color .28s ease, color .28s ease, box-shadow .28s ease;
  user-select: none;
}
#sound svg { fill: currentColor; display: block; }
#sound:hover { color: #3a362d; }
#sound.on {
  background: #f97316; color: #fff;
  box-shadow: 0 1px 7px rgba(249, 115, 22, .38);
}
#sound.loading { animation: soundPulse 1.1s ease-in-out infinite; }
@keyframes soundPulse { 0%, 100% { opacity: .5; } 50% { opacity: 1; } }

/* 窄屏：天气胶囊下移一行，给右上角的音符按钮让位 */
@media (max-width: 430px) {
  #weather { top: 66px; }
}

/* 载入遮罩：品牌 + 真实进度条 + 阶段文案，避免长时间无反馈被误认为卡死 */
#loading {
  position: fixed; inset: 0; z-index: 10;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 18px; background: #eeeadf; color: #9a9486;
  transition: opacity .8s ease;
}
#loading.hide {
  opacity: 0; pointer-events: none; visibility: hidden;
  transition: opacity .8s ease, visibility 0s .8s;
}
#loading .ld-title { font-size: 13px; letter-spacing: .52em; text-indent: .52em; }
#loading .ld-bar {
  width: 168px; height: 2px; border-radius: 2px;
  background: rgba(154, 148, 134, .22); overflow: hidden;
}
#loading .ld-fill {
  display: block; width: 0; height: 100%; border-radius: 2px;
  background: #f97316;
  transition: width .34s cubic-bezier(.22, .61, .36, 1);
}
/* 流光：明确“仍在生成”，长耗时阶段也不会显得停住 */
#loading .ld-fill::after {
  content: ''; display: block; width: 100%; height: 100%;
  background: linear-gradient(90deg,
    rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, .6) 50%, rgba(255, 255, 255, 0) 100%);
  animation: ldSheen 1.15s linear infinite;
}
#loading.hide .ld-fill::after { animation: none; }
@keyframes ldSheen {
  from { transform: translateX(-100%); }
  to { transform: translateX(100%); }
}
#loading .ld-tip { font-size: 11px; letter-spacing: .2em; text-indent: .2em; color: #a8a294; }

/* 画面暗角：纯合成层，不占 GPU 渲染开销，用于收束视觉重心 */
#vignette {
  position: fixed; inset: 0; pointer-events: none;
  background:
    radial-gradient(118% 88% at 50% 44%,
      rgba(0, 0, 0, 0) 42%,
      rgba(38, 32, 24, .10) 74%,
      rgba(26, 21, 15, .26) 100%);
}
