* { margin: 0; padding: 0; box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; background: #e9edf0;
  font-family: "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif; }
#view { display: block; width: 100vw; height: 100vh; }

/* 准星 */
#crosshair { position: fixed; left: 50%; top: 50%; transform: translate(-50%, -55%);
  color: rgba(20, 30, 40, .75); font-size: 18px; z-index: 10; display: none; pointer-events: none; }
body.locked #crosshair { display: block; }

/* 漫游缩略地图：仅第一人称时出现 */
#minimap { display: none; position: fixed; right: 16px; top: 14px; z-index: 12; width: 184px;
  background: rgba(252,252,250,.92); border: 1px solid #b8c2cc; border-radius: 6px;
  padding: 7px 8px 6px; box-shadow: 0 3px 12px rgba(0,0,0,.14);
  pointer-events: none; }
body.walking #minimap { display: block; }
#mapcv { display: block; width: 168px; height: 168px; margin: 0 auto; }
#maproom { margin-top: 3px; font-size: 12.5px; font-weight: 600; color: #22303c; text-align: center;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* 极简帮助：左上「？」按钮＋弹出卡片，取代旧左下大文本框 */
#helpbtn { position: fixed; left: 14px; top: 12px; z-index: 15; width: 26px; height: 26px;
  border-radius: 50%; border: 1px solid #b8c2cc; background: rgba(252,252,250,.92);
  color: #46545f; font-size: 14px; font-family: inherit; cursor: pointer; line-height: 24px;
  text-align: center; padding: 0; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
#helpbtn:hover { background: #e8edf1; }
#helpcard { display: none; position: fixed; left: 14px; top: 46px; z-index: 15;
  background: rgba(252,252,250,.97); border: 1px solid #b8c2cc; border-radius: 6px;
  padding: 10px 14px; font-size: 12.5px; line-height: 2; color: #33404b;
  box-shadow: 0 4px 18px rgba(0,0,0,.16); white-space: nowrap; }
#helpcard.on { display: block; }
#helpcard b { color: #7a4b2e; }
#helpcard hr { border: 0; border-top: 1px solid #d5dadd; margin: 7px 0; }
#helpcard small { display: block; font-size: 11px; line-height: 1.7; }
#helpcard a { color: #5a4835; }
/* 画境资产署名：仅全景/漫游（古画可见时）出现，左下角极小字 */
#painting-credit { display: none; position: fixed; left: 14px; bottom: 58px; z-index: 12;
  font-size: 11px; letter-spacing: .02em; color: rgba(74,60,38,.72);
  text-shadow: 0 1px 3px rgba(244,236,214,.9); pointer-events: none; }
body.painting #painting-credit { display: block; }
body.shot #painting-credit { display: none !important; }

/* 短暂提示条：进漫游/切视图时浮在顶部正中，自动淡出 */
#toast { position: fixed; left: 50%; top: 16px; transform: translateX(-50%); z-index: 15;
  background: rgba(34,48,60,.85); color: #fff; font-size: 13px; border-radius: 16px;
  padding: 7px 20px; opacity: 0; transition: opacity .35s; pointer-events: none;
  max-width: 86vw; white-space: nowrap; }
#toast.on { opacity: 1; }
#loading { position: fixed; left: 50%; top: 50%; transform: translate(-50%,-50%);
  font-size: 15px; color: #33404b; z-index: 5; }

/* 底部视图工具条：常驻，漫游中松开拖动即可直接点选 */
#viewbar { display: flex; position: fixed; left: 50%; bottom: 18px; transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 20px);
  z-index: 14; background: rgba(252,252,250,.94); border: 1px solid #b8c2cc; border-radius: 7px;
  padding: 5px; gap: 4px; box-shadow: 0 4px 18px rgba(0,0,0,.18); }
#viewbar button { border: 1px solid #c0c8d0; background: #f4f6f8; color: #33404b;
  font-size: 13.5px; font-family: inherit; padding: 9px 18px; border-radius: 4px; cursor: pointer;
  letter-spacing: .5px; white-space: nowrap; flex-shrink: 0; }
#viewbar button:hover { background: #e8edf1; }
#viewbar button.active { background: #7a4b2e; border-color: #7a4b2e; color: #fff; }
#viewbar button.walk { margin-left: 8px; background: #33506b; border-color: #33506b; color: #fff; }
#viewbar button.walk:hover { background: #3e5f7e; }
#viewbar button.walk.active { background: #7a4b2e; border-color: #7a4b2e; }
#viewbar #music-toggle { min-width: 84px; letter-spacing: 0; }
#viewbar button:focus-visible, #touch-walk button:focus-visible { outline: 2px solid #31546b; outline-offset: 2px; }
#touch-walk { display: none; position: fixed; left: 14px; bottom: 126px; z-index: 14; gap: 6px; }
#touch-walk button { border: 1px solid #b8c2cc; border-radius: 5px; padding: 12px 16px;
  color: #33404b; background: rgba(252,252,250,.92); font: inherit; font-size: 13px;
  touch-action: none; user-select: none; -webkit-user-select: none; }
#touch-walk button:active { background: #33506b; color: #fff; }
@media (pointer: coarse) {
  body.walking #touch-walk { display: flex; }
}

/* 漫游中底栏常驻；旧左下 HUD 已由左上「？」帮助卡取代 */

/* 模式子选项浮条 */
#subopts { display: none; position: fixed; left: 50%; bottom: 78px; transform: translateX(-50%);
  width: max-content; max-width: calc(100vw - 20px);
  z-index: 14; background: rgba(252,252,250,.94); border: 1px solid #b8c2cc; border-radius: 7px;
  padding: 10px 16px; box-shadow: 0 4px 18px rgba(0,0,0,.16); }
#subopts.on { display: block; }
#subopts .subopt { display: none; align-items: center; gap: 12px; font-size: 12.5px; color: #46545f; }
#subopts .subopt.on { display: flex; }
#subopts button.mini { border: 1px solid #c0c8d0; background: #f4f6f8; color: #33404b;
  font-family: inherit; font-size: 12.5px; padding: 6px 14px; border-radius: 4px; cursor: pointer;
  white-space: nowrap; flex-shrink: 0; }
#subopts button.mini:hover { background: #e8edf1; }
#subopts button.mini.active { background: #7a4b2e; border-color: #7a4b2e; color: #fff; }
#subopts .hint { color: #7a848f; }
#subopts .chip { border: 1px solid #b8c2cc; border-radius: 10px; padding: 2px 10px;
  color: #5a6671; background: #f4f6f8; font-size: 11.5px; white-space: nowrap; flex-shrink: 0; }
#subopts .chip.off { border-style: dashed; color: #98a0a8; }
.slider-label { white-space: nowrap; color: #33404b; }
.slider-label input { vertical-align: middle; width: 190px; margin-left: 4px; }
#subopts .section-position-control { display: grid; grid-template-columns: auto minmax(0, 1fr) 88px;
  align-items: center; gap: 8px; width: 330px; color: #33404b; white-space: nowrap; }
#section-slider { width: 100%; min-width: 0; margin: 0; accent-color: #7a4b2e; cursor: ew-resize; }
#section-position { text-align: right; font-size: 12px; font-variant-numeric: tabular-nums; }

/* 自动截图时隐藏工具条/地图（漫游中底栏保留） */
body.shot #viewbar, body.shot #subopts, body.shot #minimap,
body.shot #helpbtn, body.shot #helpcard, body.shot #toast, body.shot #touch-walk { display: none !important; }

/* 第一人称拖动环顾，触屏不滚动页面 */
body.draglook #view { cursor: grab; touch-action: none; }
body.grabbing #view { cursor: grabbing; }

@media (max-width: 720px) {
  #viewbar { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr));
    width: calc(100vw - 20px); max-width: 490px; bottom: max(10px, env(safe-area-inset-bottom)); }
  #viewbar button { padding: 10px 5px; min-height: 42px; font-size: 12.5px; white-space: nowrap; }
  #viewbar button.walk { margin-left: 0; }
  #viewbar #music-toggle { min-width: 0; }
  #painting-credit { left: 12px; right: 12px; bottom: calc(112px + env(safe-area-inset-bottom)); font-size: 9px; }
  body.walking #painting-credit { display: none; }
  #subopts { bottom: calc(113px + env(safe-area-inset-bottom)); width: calc(100vw - 20px); padding: 8px 10px; }
  #subopts .subopt.on { flex-wrap: wrap; gap: 7px; }
  #subopts .section-position-control { width: 100%; flex-basis: 100%; }
  #subopts .hint { font-size: 11px; }
  .slider-label input { width: 140px; }
  #touch-walk { bottom: calc(116px + env(safe-area-inset-bottom)); }
  #minimap { width: 130px; right: 10px; top: 10px; padding: 5px; }
  #mapcv { width: 118px; height: 118px; }
  #maproom { font-size: 11px; }
  #helpcard { max-width: calc(100vw - 28px); white-space: normal; line-height: 1.8; }
  #toast { font-size: 11px; padding: 7px 12px; white-space: normal; text-align: center; }
}

@media (min-width: 721px) and (max-height: 500px) {
  #viewbar { bottom: max(8px, env(safe-area-inset-bottom)); padding: 4px; }
  #viewbar button { padding: 6px 14px; font-size: 12.5px; line-height: 18px; }
  #subopts { bottom: calc(58px + env(safe-area-inset-bottom)); padding: 6px 12px; }
  #subopts button.mini { padding: 5px 12px; line-height: 18px; }
  #subopts .chip { padding: 2px 8px; line-height: 16px; }
}
