:root {
  color-scheme: dark;
  --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);
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  height: 100%;
  margin: 0;
  overflow: hidden;
  background: #17133d;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  touch-action: none;
}

body {
  display: grid;
  place-items: center;
}

[lang="zh-Hans"] [lang="en"],
[lang="en"] [lang="zh-Hans"] { display: none; }

.shell-background {
  position: fixed;
  inset: 0;
  background:
    linear-gradient(rgba(11, 20, 57, 0.35), rgba(14, 21, 58, 0.62)),
    url("/assets/hero-backdrop.jpg") center / cover;
  filter: saturate(0.86);
  transform: scale(1.04);
}

#game-shell {
  position: relative;
  width: min(390px, calc(100dvh * 390 / 844), 100vw);
  height: min(844px, 100dvh, calc(100vw * 844 / 390));
  overflow: hidden;
  background: #17133d;
  box-shadow: 0 22px 80px rgba(3, 9, 31, 0.64);
}

#GameDiv,
#Cocos3dGameContainer,
#GameCanvas {
  width: 100%;
  height: 100%;
  outline: none;
  -webkit-tap-highlight-color: transparent;
}

#GameCanvas { display: block; background: transparent; }

.startup-panel,
.fallback-card {
  position: absolute;
  z-index: 4;
  inset: 0;
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 16px;
  padding: 36px;
  color: #fff7e2;
  background:
    radial-gradient(circle at 50% 38%, rgba(83, 222, 239, 0.22), transparent 32%),
    linear-gradient(170deg, #17133d, #132d62);
  text-align: center;
}

.startup-panel img,
.fallback-card img { border-radius: 22px; box-shadow: 0 15px 36px rgba(4, 10, 34, 0.42); }
.startup-panel p,
.fallback-card p { margin: 0; color: #c7dce7; line-height: 1.6; }
.fallback-card h1 { margin: 4px 0 0; font-size: 1.55rem; }
.fallback-card a,
.fallback-card button {
  min-width: 190px;
  padding: 13px 20px;
  border: 1px solid rgba(255, 229, 174, 0.75);
  border-radius: 999px;
  color: #152858;
  background: #fff0c9;
  font: inherit;
  font-weight: 800;
  text-decoration: none;
}

[hidden] { display: none !important; }

#rotate-device {
  position: fixed;
  z-index: 10;
  inset: 0;
  display: none;
  place-items: center;
  padding: 32px;
  color: #fff7e2;
  background: #17133d;
  text-align: center;
  font-weight: 800;
}

.web-toast {
  position: fixed;
  z-index: 12;
  top: max(18px, var(--safe-top));
  left: 50%;
  width: min(340px, calc(100% - 30px));
  padding: 12px 16px;
  border: 1px solid rgba(255, 229, 174, 0.55);
  border-radius: 16px;
  color: #fff7e2;
  background: rgba(16, 31, 72, 0.94);
  text-align: center;
  transform: translateX(-50%);
}

.web-share-toast { top: auto; bottom: max(18px, var(--safe-bottom)); }

@media (hover: none), (pointer: coarse) {
  #game-shell { width: 100vw; height: 100dvh; box-shadow: none; }
}

@media (orientation: landscape) and (hover: none),
       (orientation: landscape) and (pointer: coarse) {
  .landscape-game-blocked #rotate-device { display: grid; }
}
