html, body {
  padding: 0;
  margin: 0;
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #000;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* 游戏横屏偏好：锁住页面，避免地址栏伸缩导致半屏 */
html.pier7-game-landscape,
body.pier7-game-landscape {
  width: 100%;
  height: 100%;
  height: 100dvh;
  overflow: hidden;
  position: fixed;
  inset: 0;
  background: #000;
}

#unity-container {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  background: #000;
  overflow: hidden;
}

#unity-container.pier7-soft-landscape {
  /* 尺寸/位移由 fitViewport 写入；居中旋转后应铺满，勿裁切 */
  overflow: hidden;
  max-width: none !important;
  max-height: none !important;
}

#unity-canvas {
  display: block;
  position: absolute;
  left: 0;
  top: 0;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  margin: 0;
  max-width: none;
  max-height: none;
  background: #000000;
  outline: none;
  object-fit: contain;
  transform: none;
}

/* 软横屏时 canvas 用明确像素尺寸铺满旋转容器（去掉 100%!important，避免盖住 JS 写入的横屏尺寸） */
#unity-container.pier7-soft-landscape #unity-canvas {
  width: auto !important;
  height: auto !important;
  object-fit: fill !important;
  max-width: none !important;
  max-height: none !important;
}

/* iOS / 真横屏进桌：铺满可视区域，消除左右黑边 */
html.pier7-game-landscape #unity-canvas {
  width: 100% !important;
  height: 100% !important;
  object-fit: fill !important;
}

#unity-loading-bar {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: none;
  flex-direction: column;
  align-items: center;
  width: 220px;
  z-index: 10;
}

#unity-logo {
  width: 140px;
  height: 140px;
  margin: 0 auto 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: transparent;
  border-radius: 16px;
  overflow: hidden;
}

#unity-logo img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
  -webkit-user-drag: none;
}

#unity-progress-bar-empty {
  width: 220px;
  height: 18px;
  margin-top: 0;
  background: #333;
  border-radius: 9px;
  overflow: hidden;
}

#unity-progress-bar-full {
  width: 0%;
  height: 18px;
  margin-top: 0;
  background: linear-gradient(90deg, #f0c040, #e0a020);
  border-radius: 9px;
  transition: width 0.2s ease;
}

#unity-progress-text {
  width: 100%;
  margin-top: 10px;
  color: #f0c040;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
  letter-spacing: 1px;
}

#unity-loading-tip {
  width: 100%;
  margin-top: 8px;
  color: #bbb;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  text-align: center;
  animation: pier7TipPulse 1.4s ease-in-out infinite;
}

@keyframes pier7TipPulse {
  0%, 100% { opacity: 0.55; }
  50% { opacity: 1; }
}

#unity-footer { display: none; }

#unity-warning {
  position: absolute;
  left: 50%;
  top: 5%;
  transform: translate(-50%);
  background: white;
  padding: 10px;
  display: none;
  z-index: 20;
}

/* iOS 竖屏进桌：提示旋转（不挡真横屏操作） */
#pier7-rotate-tip {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 10000;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.78);
  pointer-events: auto;
  -webkit-user-select: none;
  user-select: none;
}

#pier7-rotate-tip.pier7-rotate-tip--show {
  display: flex;
}

.pier7-rotate-card {
  text-align: center;
  color: #f0c040;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  padding: 24px 28px;
}

.pier7-rotate-icon {
  font-size: 42px;
  line-height: 1;
  margin-bottom: 12px;
  animation: pier7RotateHint 1.6s ease-in-out infinite;
}

.pier7-rotate-title {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: 1px;
}

.pier7-rotate-sub {
  margin-top: 8px;
  font-size: 14px;
  color: #ccc;
}

@keyframes pier7RotateHint {
  0%, 100% { transform: rotate(0deg); }
  40% { transform: rotate(90deg); }
  60% { transform: rotate(90deg); }
}

/* iOS 横屏：可点的隐藏浏览器栏提示（Safari 对 div 全屏支持有限，主要靠 visualViewport + scroll） */
#pier7-ios-fs-hint {
  display: none;
  position: fixed;
  left: 50%;
  bottom: calc(12px + env(safe-area-inset-bottom));
  transform: translateX(-50%);
  z-index: 10001;
  padding: 10px 18px;
  border-radius: 20px;
  border: 1px solid rgba(240, 192, 64, 0.45);
  background: rgba(0, 0, 0, 0.82);
  color: #f0c040;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  pointer-events: auto;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
  -webkit-user-select: none;
  user-select: none;
  white-space: nowrap;
}

#pier7-ios-fs-hint.pier7-ios-fs-hint--show {
  display: block;
}
