:root {
  --safe-top: env(safe-area-inset-top);
  --safe-right: env(safe-area-inset-right);
  --safe-bottom: env(safe-area-inset-bottom);
  --safe-left: env(safe-area-inset-left);
}

html {
  -ms-touch-action: none;
  touch-action: none;
  overscroll-behavior: none;
  background-color: #20262e;
}

html, body {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  border: 0;
  overflow: hidden;
  overscroll-behavior: none;
  background-color: #20262e;
  touch-action: none;
}

body, canvas, div {
  display: block;
  outline: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  -webkit-touch-callout: none;
  user-select: none;
  -moz-user-select: none;
  -webkit-user-select: none;
  -ms-user-select: none;
  -khtml-user-select: none;
}

body {
  cursor: default;
  color: #d2dee7;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "PingFang SC", "Helvetica Neue", "Microsoft YaHei", sans-serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

canvas {
  background-color: rgba(0, 0, 0, 0);
  touch-action: none;
}

#GameDiv {
  position: relative;
  width: 100%;
  height: 100%;
  background-color: #20262e;
}

#Cocos3dGameContainer, #GameCanvas {
  width: 100%;
  height: 100%;
}

/* Desktop / landscape tablet framing: keep portrait 9:16 proportion cleanly centered */
@media (min-aspect-ratio: 3/4) {
  body {
    background: radial-gradient(circle at 50% 35%, #2a3340 0%, #151a21 100%);
  }
  #GameDiv {
    width: min(100vw, calc(100vh * 9 / 16));
    width: min(100vw, calc(100dvh * 9 / 16));
    height: 100%;
    margin: 0 auto;
    box-shadow: 0 0 48px rgba(0, 0, 0, 0.55);
  }
}

#boot-splash {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  background-color: #20262e;
  color: #d2dee7;
  transition: opacity 0.25s ease;
  padding: env(safe-area-inset-top) 24px env(safe-area-inset-bottom);
  box-sizing: border-box;
}

#boot-splash.hidden {
  opacity: 0;
  pointer-events: none;
}

.boot-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 1px;
  color: #f4f7fa;
}

.boot-spinner {
  width: 34px;
  height: 34px;
  border: 3px solid rgba(210, 222, 231, 0.22);
  border-top-color: #ffd65c;
  border-radius: 50%;
  animation: boot-spin 0.85s linear infinite;
}

.boot-status {
  font-size: 14px;
  color: #aab8c4;
}

.boot-retry {
  margin-top: 6px;
  padding: 10px 26px;
  font-size: 15px;
  font-weight: 600;
  color: #20262e;
  background-color: #ffd65c;
  border: none;
  border-radius: 8px;
  cursor: pointer;
}

@keyframes boot-spin {
  to { transform: rotate(360deg); }
}
