:root {
  color-scheme: dark;
  --kg-progress: 6%;
}

html {
  width: 100%;
  height: 100%;
  -ms-touch-action: none;
  background: #080315;
}

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

input::-webkit-outer-spin-button,
input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

body {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  padding: 0;
  border: 0;
  margin: 0;
  overflow: hidden;
  cursor: default;
  color: #f7f0df;
  background: #080315;
  text-align: center;
  font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC",
    Helvetica, Arial, sans-serif;
}

#Cocos2dGameContainer {
  position: absolute;
  top: 0;
  left: 0;
  margin: 0;
  display: -webkit-box;
  -webkit-box-orient: horizontal;
  -webkit-box-align: center;
  -webkit-box-pack: center;
}

canvas {
  background: #080315;
}

#splash {
  position: fixed;
  z-index: 2147483000;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block !important;
  overflow: hidden;
  opacity: 1;
  background-color: #080315;
  isolation: isolate;
  transition: opacity 300ms cubic-bezier(0.22, 1, 0.36, 1);
}

.kg-startup-backdrop,
.kg-startup-backdrop img {
  position: absolute;
  z-index: 0;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
}

.kg-startup-backdrop img {
  object-fit: cover;
}

#splash::before {
  position: absolute;
  z-index: 1;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  content: "";
  pointer-events: none;
  background:
    radial-gradient(circle at 50% 31%, rgba(178, 79, 221, 0.10), transparent 30%),
    radial-gradient(circle at 50% 66%, rgba(74, 25, 118, 0.16), transparent 40%),
    linear-gradient(180deg, rgba(7, 2, 22, 0.84) 0%, rgba(10, 3, 30, 0.87) 48%, rgba(5, 1, 18, 0.95) 100%);
}

#splash.kg-splash--exiting {
  opacity: 0;
  pointer-events: none;
}

#splash.kg-splash--hidden {
  display: none !important;
}

.kg-stage {
  position: absolute;
  z-index: 2;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  inset: 0;
  opacity: 1;
  pointer-events: none;
}

.kg-stage--health {
  opacity: 1;
}

.kg-health-card {
  position: absolute;
  top: 14.2vh;
  top: clamp(108px, 14.2vh, 134px);
  left: 50%;
  box-sizing: border-box;
  width: 88vw;
  max-width: 560px;
  width: min(88vw, 560px);
  transform: translateX(-50%);
}

.kg-health-icon {
  display: block;
  width: 31vw;
  min-width: 116px;
  max-width: 136px;
  width: clamp(116px, 31vw, 136px);
  height: auto;
  margin: 0 auto 2.5vh;
  margin: 0 auto clamp(20px, 2.5vh, 24px);
  filter: drop-shadow(0 0 18px rgba(236, 194, 87, 0.18));
}

.kg-health-icon img {
  display: block;
  width: 100%;
  height: auto;
}

.kg-health-title {
  margin: 0;
  color: #f1ce75;
  font-family: "STSong", "Songti SC", "SimSun", serif;
  font-size: 7.6vw;
  font-size: clamp(28px, 7.6vw, 34px);
  font-weight: 700;
  line-height: 1.18;
  letter-spacing: 0.08em;
  text-shadow:
    0 1px 0 rgba(255, 248, 205, 0.42),
    0 4px 16px rgba(218, 159, 54, 0.24);
}

.kg-health-rule {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 72vw;
  max-width: 420px;
  width: min(72vw, 420px);
  margin: 1.5vh auto 2.4vh;
  margin: clamp(11px, 1.5vh, 15px) auto clamp(17px, 2.4vh, 22px);
  color: rgba(232, 190, 92, 0.72);
  font-size: 8px;
  gap: 9px;
}

.kg-health-rule::before,
.kg-health-rule::after {
  width: 20vw;
  max-width: 104px;
  width: min(20vw, 104px);
  height: 1px;
  content: "";
  background: linear-gradient(90deg, transparent, rgba(232, 190, 92, 0.78));
}

.kg-health-rule::after {
  transform: scaleX(-1);
}

.kg-copy-block {
  width: 100%;
  margin: 0 auto;
}

.kg-copy-line {
  margin: 0;
  color: #f8f2e8;
  font-size: 4.6vw;
  font-size: clamp(17px, 4.6vw, 20px);
  font-weight: 500;
  line-height: 1.58;
  letter-spacing: 0.045em;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.42);
  text-wrap: pretty;
}

html[lang^="fr"] .kg-health-title {
  font-family: Georgia, "Times New Roman", serif;
  font-size: 6.2vw;
  font-size: clamp(24px, 6.2vw, 31px);
  letter-spacing: 0.025em;
}

html[lang^="fr"] .kg-health-card {
  width: 92vw;
  max-width: 590px;
  width: min(92vw, 590px);
}

html[lang^="fr"] .kg-copy-line {
  font-size: 3.65vw;
  font-size: clamp(14px, 3.65vw, 18px);
  line-height: 1.42;
  letter-spacing: 0.005em;
}

html[lang^="fr"] .kg-progress-label {
  font-size: 3.1vw;
  font-size: clamp(12px, 3.1vw, 15px);
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.kg-progress-shell {
  position: absolute;
  z-index: 4;
  top: 75.5%;
  left: 50%;
  box-sizing: border-box;
  width: 66vw;
  max-width: 430px;
  width: min(66vw, 430px);
  transform: translateX(-50%);
}

.progress-bar {
  position: relative;
  box-sizing: border-box;
  width: 100%;
  height: 9px;
  padding: 1px;
  overflow: hidden;
  border: 1px solid rgba(197, 139, 228, 0.48);
  border-radius: 999px;
  background: rgba(19, 7, 39, 0.70);
  box-shadow:
    inset 0 1px 5px rgba(0, 0, 0, 0.72),
    0 0 10px rgba(132, 57, 180, 0.12);
}

.progress-bar span {
  position: relative;
  display: block;
  width: var(--kg-progress) !important;
  min-width: 7px;
  height: 100%;
  overflow: hidden;
  border-radius: inherit;
  background: linear-gradient(90deg, #d89c17 0%, #f5c343 55%, #ffe27b 100%);
  box-shadow:
    0 0 8px rgba(247, 193, 57, 0.64),
    0 0 16px rgba(247, 193, 57, 0.28);
  transition: width 260ms ease-out;
}

.progress-bar span::after {
  position: absolute;
  top: -3px;
  right: -4px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  content: "";
  background: #ffe99c;
  box-shadow: 0 0 12px 3px rgba(255, 218, 98, 0.60);
}

.progress-bar::after {
  position: absolute;
  top: -4px;
  bottom: -4px;
  left: -30%;
  width: 24%;
  content: "";
  opacity: 0.32;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.52), transparent);
  animation: kg-progress-shimmer 1.8s ease-in-out infinite;
}

.kg-progress-label {
  margin: 17px 0 0;
  color: rgba(230, 211, 236, 0.72);
  font-size: 3.4vw;
  font-size: clamp(12px, 3.4vw, 17px);
  font-weight: 400;
  line-height: 1.4;
  letter-spacing: 0.08em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.5);
}

.kg-retry {
  display: none;
  box-sizing: border-box;
  min-height: 44px;
  margin: 14px auto 0;
  padding: 10px 18px;
  border: 1px solid rgba(235, 198, 102, 0.55);
  border-radius: 999px;
  color: #edd078;
  background: rgba(18, 7, 39, 0.55);
  font: inherit;
  font-size: 13px;
  cursor: pointer;
}

#splash.kg-splash--retry .kg-retry {
  display: block;
}

@keyframes kg-progress-shimmer {
  0%,
  18% {
    left: -30%;
  }

  72%,
  100% {
    left: 112%;
  }
}

@media (max-height: 700px) {
  .kg-health-card {
    top: 9vh;
    top: clamp(54px, 9vh, 62px);
  }

  .kg-health-icon {
    width: 24vw;
    min-width: 84px;
    max-width: 90px;
    width: clamp(84px, 24vw, 90px);
    margin-bottom: 12px;
  }

  .kg-health-title {
    font-size: 26px;
  }

  .kg-health-rule {
    margin-top: 7px;
    margin-bottom: 11px;
  }

  .kg-copy-line {
    font-size: 15px;
    line-height: 1.45;
  }

  html[lang^="fr"] .kg-health-title {
    font-size: 22px;
  }

  html[lang^="fr"] .kg-copy-line {
    font-size: 13px;
    line-height: 1.36;
  }

  html[lang^="fr"] .kg-progress-label {
    font-size: 12px;
  }

  .kg-progress-shell {
    top: 80%;
  }
}

@media (orientation: landscape) and (max-height: 560px) {
  .kg-health-card {
    top: 46%;
    display: grid;
    grid-template-columns: 132px minmax(310px, 1fr);
    grid-template-rows: auto auto auto;
    align-items: center;
    width: 82vw;
    max-width: 720px;
    width: min(82vw, 720px);
    transform: translate(-50%, -50%);
    column-gap: 34px;
  }

  .kg-health-icon {
    grid-row: 1 / 4;
    width: 126px;
    margin: 0;
  }

  .kg-health-title,
  .kg-health-rule,
  .kg-copy-block {
    grid-column: 2;
  }

  .kg-health-title {
    font-size: 31px;
  }

  .kg-health-rule {
    margin: 8px auto 12px;
  }

  .kg-copy-line {
    font-size: 15px;
    line-height: 1.35;
  }

  .kg-progress-shell {
    top: auto;
    bottom: 8%;
    bottom: max(8%, env(safe-area-inset-bottom));
    width: 46vw;
    max-width: 390px;
    width: min(46vw, 390px);
  }
}

@media (prefers-reduced-motion: reduce) {
  #splash,
  .progress-bar span {
    transition-duration: 80ms;
  }

  .progress-bar::after {
    animation: none;
  }
}
