:root {
  color-scheme: dark;
  --boot-gold: #e7b957;
  --boot-gold-light: #ffe2a0;
  --boot-ink: #091113;
  --boot-panel: rgba(10, 20, 22, 0.88);
}

html {
  -ms-touch-action: none;
  touch-action: none;
  background: var(--boot-ink);
}

body,
canvas,
div,
section,
aside,
h1,
h2,
p,
span,
i,
b {
  box-sizing: border-box;
  outline: none;
  -webkit-tap-highlight-color: rgba(0, 0, 0, 0);
  user-select: none;
  -webkit-user-select: none;
}

body {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  margin: 0;
  overflow: hidden;
  color: #f1ead3;
  background: #091113;
  text-align: center;
  font-family: "Noto Serif SC", "Songti SC", "Microsoft YaHei", serif;
}

canvas {
  display: block;
  background-color: rgba(0, 0, 0, 0);
}

#GameDiv,
#Cocos3dGameContainer,
#GameCanvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#decurion-boot-screen {
  position: fixed;
  z-index: 99999;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100dvh;
  padding: max(14px, env(safe-area-inset-top))
    max(18px, env(safe-area-inset-right)) max(14px, env(safe-area-inset-bottom))
    max(18px, env(safe-area-inset-left));
  background:
    radial-gradient(
      circle at 50% 34%,
      rgba(159, 108, 43, 0.2),
      transparent 30%
    ),
    linear-gradient(180deg, rgba(6, 11, 12, 0.16), rgba(8, 17, 18, 0.56)),
    repeating-linear-gradient(
      118deg,
      rgba(23, 36, 35, 0.18) 0,
      rgba(23, 36, 35, 0.18) 2px,
      rgba(16, 27, 28, 0.12) 2px,
      rgba(16, 27, 28, 0.12) 7px
    ),
    url("boot-background.jpg") center / cover no-repeat;
  opacity: 1;
  transition:
    opacity 0.25s ease,
    visibility 0.25s ease;
}

#decurion-boot-screen::before,
#decurion-boot-screen::after {
  content: "";
  position: absolute;
  width: min(44vw, 560px);
  height: min(44vw, 560px);
  border: 1px solid rgba(231, 185, 87, 0.14);
  transform: rotate(45deg);
}

#decurion-boot-screen::before {
  left: -26vw;
  top: -26vw;
}
#decurion-boot-screen::after {
  right: -26vw;
  bottom: -26vw;
}

.boot-screen-exit {
  opacity: 0 !important;
  visibility: hidden;
  pointer-events: none;
}

.boot-content {
  position: relative;
  z-index: 2;
  width: min(760px, 88vw);
  height: auto;
  min-height: 0;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: flex-end;
  padding-bottom: clamp(4px, 1.2vh, 12px);
}

.boot-seal {
  display: none;
  width: clamp(52px, 8vh, 78px);
  height: clamp(52px, 8vh, 78px);
  margin: 0 auto clamp(4px, 1vh, 10px);
  place-items: center;
  border: 2px solid #efbf60;
  box-shadow:
    inset 0 0 0 4px rgba(111, 33, 28, 0.9),
    0 0 26px rgba(238, 179, 67, 0.16);
  color: #ffe7a6;
  background: #7c2f29;
  font-size: clamp(26px, 4.6vh, 42px);
  font-weight: 700;
  transform: rotate(-3deg);
}

.boot-content h1 {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.boot-subtitle {
  margin: 0 0 clamp(8px, 1.5vh, 14px);
  color: #d8c9a8;
  font-size: clamp(14px, 2.4vh, 21px);
  letter-spacing: 0;
}

.boot-progress-block {
  width: min(620px, 82vw);
  margin: 0 auto;
}

.boot-progress-copy {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-width: 0;
  margin-bottom: 7px;
  color: #d9d1bb;
  font:
    500 clamp(13px, 2vh, 17px)/1.2 "Microsoft YaHei",
    sans-serif;
}

.boot-progress-track {
  position: relative;
  height: clamp(10px, 1.8vh, 16px);
  overflow: hidden;
  border: 1px solid rgba(235, 189, 91, 0.68);
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.52);
  box-shadow:
    inset 0 1px 5px rgba(0, 0, 0, 0.9),
    0 0 18px rgba(227, 170, 59, 0.08);
}

#decurion-boot-progress {
  position: absolute;
  inset: 1px auto 1px 1px;
  width: 5%;
  border-radius: 999px;
  background: linear-gradient(90deg, #8e3c29 0%, #d6963d 50%, #ffd878 100%);
  transition: width 0.1s linear;
}

.boot-progress-glint {
  position: absolute;
  top: -50%;
  width: 22%;
  height: 200%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.38),
    transparent
  );
  animation: boot-glint 1.7s ease-in-out infinite;
}

.healthy-game-notice {
  flex: 0 0 auto;
  width: min(720px, 86vw);
  margin: clamp(12px, 2.4vh, 24px) auto 0;
  padding: clamp(9px, 1.5vh, 14px) 18px;
  border-top: 1px solid rgba(231, 185, 87, 0.45);
  border-bottom: 1px solid rgba(231, 185, 87, 0.22);
  color: #cfc8b6;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(4, 11, 12, 0.62) 16%,
    rgba(4, 11, 12, 0.62) 84%,
    transparent
  );
}

.healthy-game-notice h2 {
  margin: 0 0 clamp(5px, 1vh, 9px);
  color: var(--boot-gold);
  font-size: clamp(15px, 2.5vh, 21px);
  font-weight: 600;
  letter-spacing: 0;
}

.healthy-game-notice p {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: clamp(3px, 0.8vh, 7px) 22px;
  margin: 0;
  font:
    400 clamp(12px, 2vh, 16px)/1.45 "Microsoft YaHei",
    sans-serif;
}

.healthy-game-notice p span {
  display: block;
  white-space: normal;
  overflow-wrap: anywhere;
  min-width: 0;
}

.boot-screen-error .boot-progress-track {
  border-color: #d46d5e;
}
.boot-screen-error #decurion-boot-status {
  color: #ff9b8c;
}

@keyframes boot-glint {
  from {
    left: -28%;
  }
  to {
    left: 108%;
  }
}

@media (max-aspect-ratio: 1/1) {
  #decurion-boot-screen {
    background-color: var(--boot-ink);
    background-size: auto, auto, auto, contain;
    background-position: center, center, center, center 18%;
  }
  .boot-content {
    width: min(620px, 90vw);
  }
  .healthy-game-notice p {
    grid-template-columns: 1fr;
  }
}

@media (max-height: 430px) {
  .boot-content {
    transform: none;
  }
  .boot-seal {
    display: none;
  }
  .boot-content h1 {
    font-size: 38px;
  }
  .boot-subtitle {
    margin-bottom: 5px;
    font-size: clamp(11px, 3.3vh, 14px);
  }
  .boot-progress-copy {
    margin-bottom: 4px;
    font-size: clamp(10px, 3.2vh, 13px);
  }
  .boot-progress-track {
    height: clamp(7px, 2.4vh, 10px);
  }
  .healthy-game-notice {
    margin-top: 6px;
    padding: 4px 12px;
  }
  .healthy-game-notice h2 {
    margin-bottom: 2px;
    font-size: clamp(12px, 3.6vh, 15px);
  }
  .healthy-game-notice p {
    gap: 1px 14px;
    font-size: clamp(10px, 3vh, 12px);
    line-height: 1.25;
  }
}

@media (max-width: 390px) {
  .healthy-game-notice {
    width: min(100%, 350px);
    padding-right: 8px;
    padding-left: 8px;
  }
  .healthy-game-notice p {
    font-size: 12px;
  }
}

/* 狭窄或横屏窗口中允许文案换行，进度数值保持独立空间。 */
#decurion-boot-status {
  flex: 1;
  min-width: 0;
  text-align: left;
  overflow-wrap: anywhere;
  line-height: 1.5;
}

#decurion-boot-percent {
  flex: 0 0 auto;
  min-width: 48px;
}

#decurion-boot-screen[hidden] {
  display: none !important;
}

.boot-content {
  margin-top: auto;
}

.is-indeterminate #decurion-boot-progress {
  width: 30%;
  animation: boot-glint 1.7s ease-in-out infinite;
}

.boot-retry {
  position: absolute;
  left: 50%;
  top: 24px;
  transform: translateX(-50%);
  padding: 10px 24px;
  border: 1px solid var(--boot-gold);
  border-radius: 4px;
  background: var(--boot-ink);
  color: var(--boot-gold-light);
}
