/* 浏览器只承载游戏。加载页视觉沿用 TideKingBak 的 TidePortrait 模板，画布铺满视口、比例由 Unity 按屏幕自适应。 */
/* 修改本文件或字体后同步递增 index.html 的 sea.css?v= 与下方 woff2?v=，避免旧缓存继续生效。 */
@font-face {
  font-family: "Aidian FengYaHei";
  src: url("TideUi.woff2?v=20260926-layout2") format("woff2");
  font-display: block;
}
:root {
  --ink: #193335;
  --primary: #E7B75E;
  --text: #FFF1CD;
  --muted: #D5E6D9;
  --page-height: 100vh;
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --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);
}
/* 游戏区铺满整个视口（含刘海/圆角区），任何屏幕比例都不留边；画布分辨率与画面比例由 Unity 按视口尺寸自适应。 */
#game { position: fixed; inset: 0; }
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;
  top: calc(12px + env(safe-area-inset-top));
  right: calc(12px + env(safe-area-inset-right));
  z-index: 100;
  display: flex;
  align-items: flex-end;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}
/* 手机竖屏时整页被横屏提示覆盖，右上角按钮组同步隐藏。 */
body.mobile-portrait #display-controls { display: none; }
#fullscreen-button,
#rotate-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,
#rotate-fullscreen-button:hover { border-color: var(--primary); color: var(--primary); }
#fullscreen-button:active,
#rotate-fullscreen-button:active { background: var(--text); color: var(--ink); }
#fullscreen-button:focus-visible,
#rotate-fullscreen-button:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }
#fullscreen-button:disabled,
#rotate-fullscreen-button:disabled { opacity: 0.6; cursor: not-allowed; }
/* 航行页只显示四角全屏图标，44px 点击区不绘制底框。 */
#fullscreen-button {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  padding: 10px;
  border: 0;
  border-radius: 0;
  background: transparent;
}
#fullscreen-button svg { filter: drop-shadow(0 1px 2px #001820); }
#fullscreen-button:active { background: transparent; color: var(--primary); }
#fullscreen-status {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  width: max-content;
  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;
}
/* 手机竖屏遮罩：盖住游戏与加载页，只留旋转手机指引。 */
#rotate-prompt {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(24px + env(safe-area-inset-top)) 24px calc(24px + env(safe-area-inset-bottom));
  background: var(--ink);
}
.rotate-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  text-align: center;
}
.rotate-icon {
  width: 64px;
  height: 108px;
  border: 4px solid var(--primary);
  border-radius: 12px;
  animation: rotate-to-landscape 1.8s ease-in-out infinite;
}
.rotate-title { margin: 0; font-size: 20px; line-height: 1.5; color: var(--text); }
.rotate-tip { margin: 0; max-width: 300px; font-size: 14px; line-height: 1.6; color: var(--muted); }
#rotate-status {
  margin: 0;
  max-width: 300px;
  padding: 10px 14px;
  border: 1px solid var(--muted);
  border-radius: 12px;
  background: var(--ink);
  color: var(--text);
  font-size: 14px;
  line-height: 1.6;
}
@keyframes rotate-to-landscape {
  0%, 20% { transform: rotate(0deg); }
  55%, 75% { transform: rotate(-90deg); }
  100% { transform: rotate(0deg); }
}
@media (prefers-reduced-motion: reduce) {
  .rotate-icon { animation: none; transform: rotate(-90deg); }
}
#loading, #failure {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  /* 画布已延伸到刘海下，加载/失败文字避开安全区。 */
  padding: calc(24px + env(safe-area-inset-top)) calc(24px + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(24px + env(safe-area-inset-left));
  background: var(--ink);
  line-height: 1.6;
}
#loading {
  justify-content: flex-end;
  padding-bottom: calc(clamp(64px, 12vh, 120px) + env(safe-area-inset-bottom));
}
[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; }
#enter-button {
  align-self: center;
  width: min(280px, 100%);
  min-height: 56px;
  padding: 12px 24px;
  border: 1px solid var(--primary);
  border-radius: 28px;
  background: var(--primary);
  color: var(--ink);
  font: 20px/1.4 "Aidian FengYaHei", sans-serif;
  cursor: pointer;
  touch-action: manipulation;
}
#enter-button:hover { background: var(--text); border-color: var(--text); }
#enter-button:active { background: var(--muted); border-color: var(--muted); }
#enter-button:focus-visible { outline: 2px solid var(--text); outline-offset: 4px; }
::-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; }
}
