/* 浏览器仅承载游戏。语义色沿用 DESIGN.md，游戏内字体/窗口仍归 TMP + UIModule。 */
@font-face {
  font-family: "Aidian FengYaHei";
  src: url("TideUi.woff2") format("woff2");
  font-display: block;
}
:root {
  --ink: #193335;
  --primary: #E7B75E;
  --text: #FFF1CD;
  --muted: #D5E6D9;
  --page-height: 100vh;
  --available-height: calc(var(--page-height) - env(safe-area-inset-top) - env(safe-area-inset-bottom));
  --available-width: calc(100vw - env(safe-area-inset-left) - env(safe-area-inset-right));
  color: var(--text);
  background: var(--ink);
  font-family: "Aidian FengYaHei", sans-serif;
  scrollbar-color: var(--muted) var(--ink);
  scrollbar-width: thin;
}
@supports (height: 100dvh) { :root { --page-height: 100dvh; } }
* { box-sizing: border-box; }
body {
  margin: 0;
  min-height: var(--page-height);
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  display: grid;
  place-items: center;
}
#game {
  position: relative;
  width: min(var(--available-width), calc(var(--available-height) * 9 / 16));
  /* 长屏使用完整可用高度，交由 Unity 按实际画布尺寸适配，避免上下留边。 */
  height: var(--available-height);
}
canvas { display: block; width: 100%; height: 100%; touch-action: none; }
canvas:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
#display-controls {
  position: fixed;
  right: calc(12px + env(safe-area-inset-right));
  bottom: calc(12px + env(safe-area-inset-bottom));
  z-index: 100;
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
#fullscreen-button {
  width: 88px;
  min-height: 44px;
  padding: 8px;
  border: 1px solid var(--muted);
  border-radius: 22px;
  background: var(--ink);
  color: var(--text);
  font: 14px/1.4 "Aidian FengYaHei", sans-serif;
  cursor: pointer;
  pointer-events: auto;
  touch-action: manipulation;
}
#fullscreen-button:hover { border-color: var(--primary); color: var(--primary); }
#fullscreen-button:active { background: var(--text); color: var(--ink); }
#fullscreen-button:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
#fullscreen-button:disabled { opacity: 0.6; cursor: not-allowed; }
#fullscreen-status {
  margin: 0;
  max-width: min(300px, calc(var(--available-width) - 24px));
  padding: 10px 14px;
  border: 1px solid var(--muted);
  border-radius: 12px;
  background: var(--ink);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
#loading, #failure {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  background: var(--ink);
  line-height: 1.6;
}
[hidden] { display: none !important; /* hidden 状态必须覆盖容器 flex 布局。 */ }
#failure { overflow: auto; }
#detail { color: var(--muted); font-size: 14px; overflow-wrap: anywhere; }
progress { width: 100%; accent-color: var(--primary); height: 12px; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: var(--ink); }
::-webkit-scrollbar-thumb { background: var(--muted); }
::-webkit-scrollbar-thumb:hover { background: var(--primary); }
::-webkit-scrollbar-thumb:active { background: var(--text); }
@media (forced-colors: active) {
  :root { scrollbar-color: auto; }
  canvas:focus-visible { outline-color: Highlight; }
}
