:root {
  color-scheme: dark;
  font-family: "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
  overflow: hidden;
  width: 100%;
}

.game-viewport-host {
  background: #01060c;
  color: #f4fbff;
  inset: 0;
  overscroll-behavior: none;
  position: fixed;
  touch-action: manipulation;
}

.game-viewport {
  --game-scale: 1;
  --game-center-x: 50%;
  --game-center-y: 50%;
  background:
    radial-gradient(circle at 50% 45%, rgba(22, 73, 102, 0.18), transparent 46%),
    #01060c;
  contain: layout paint;
  height: 100%;
  left: 0;
  overflow: hidden;
  padding:
    env(safe-area-inset-top, 0px)
    env(safe-area-inset-right, 0px)
    env(safe-area-inset-bottom, 0px)
    env(safe-area-inset-left, 0px);
  position: fixed;
  top: 0;
  width: 100%;
}

.game-frame {
  background: #020914;
  border: 0;
  height: 900px;
  left: var(--game-center-x);
  opacity: 0;
  position: absolute;
  top: var(--game-center-y);
  transform: translate(-50%, -50%) scale(var(--game-scale));
  transform-origin: center;
  transition: opacity 0.12s ease;
  width: 1600px;
  z-index: 1;
}

.game-viewport.is-ready .game-frame {
  opacity: 1;
}

.viewport-fullscreen {
  -webkit-tap-highlight-color: transparent;
  align-items: center;
  backdrop-filter: blur(12px);
  background: rgba(3, 16, 28, 0.82);
  border: 1px solid rgba(108, 221, 255, 0.68);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.34), inset 0 0 18px rgba(68, 201, 255, 0.08);
  color: #eafaff;
  cursor: pointer;
  display: inline-flex;
  font: 800 14px/1 "Microsoft YaHei", "PingFang SC", Arial, sans-serif;
  gap: 6px;
  justify-content: center;
  min-height: 44px;
  min-width: 88px;
  padding: 0 13px;
  position: absolute;
  right: calc(env(safe-area-inset-right, 0px) + 12px);
  top: calc(env(safe-area-inset-top, 0px) + 12px);
  z-index: 4;
}

.viewport-fullscreen:hover,
.viewport-fullscreen:focus-visible {
  background: rgba(10, 45, 66, 0.94);
  border-color: rgba(191, 247, 255, 0.96);
  outline: none;
}

.viewport-fullscreen:active {
  transform: translateY(1px);
}

.viewport-fullscreen.is-unavailable {
  border-color: rgba(160, 181, 196, 0.5);
  color: rgba(232, 243, 250, 0.82);
}

.viewport-fullscreen-icon {
  font-size: 19px;
  line-height: 1;
}

.viewport-orientation-hint,
.viewport-notice {
  backdrop-filter: blur(10px);
  border: 1px solid rgba(104, 205, 244, 0.34);
  border-radius: 999px;
  bottom: calc(env(safe-area-inset-bottom, 0px) + 18px);
  left: 50%;
  margin: 0;
  opacity: 0;
  padding: 9px 16px;
  pointer-events: none;
  position: absolute;
  transform: translate(-50%, 10px);
  transition: opacity 0.18s ease, transform 0.18s ease;
  z-index: 4;
}

.viewport-orientation-hint {
  background: rgba(3, 16, 28, 0.72);
  color: rgba(220, 243, 252, 0.84);
  font-size: 13px;
}

.game-viewport.is-portrait .viewport-orientation-hint {
  opacity: 1;
  transform: translate(-50%, 0);
}

.viewport-notice {
  background: rgba(5, 24, 39, 0.94);
  bottom: calc(env(safe-area-inset-bottom, 0px) + 66px);
  color: #ffffff;
  font-size: 14px;
  max-width: calc(100% - 32px);
  text-align: center;
  white-space: nowrap;
}

.viewport-notice.is-visible {
  opacity: 1;
  transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
  .game-frame,
  .viewport-orientation-hint,
  .viewport-notice {
    transition: none;
  }
}
