:root {
  --deep: #041e2d;
  --deep-2: #0a3a52;
  --mint: #7ee0c3;
  --sun: #ffd166;
  --white: #ffffff;
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: var(--deep);
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  color: var(--white);
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  overscroll-behavior: none;
  touch-action: none;
}

#unity-container {
  position: fixed;
  inset: 0;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  background:
    radial-gradient(circle at 18% 8%, rgba(126, 224, 195, 0.18), transparent 42%),
    radial-gradient(circle at 82% 92%, rgba(0, 132, 168, 0.35), transparent 52%),
    linear-gradient(180deg, #0a4a68 0%, #062c42 55%, #031a28 100%);
}

#unity-canvas {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--deep);
  outline: none;
  touch-action: none;
}

#unity-loading-bar {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 10;
  background:
    radial-gradient(circle at 50% 38%, rgba(20, 110, 140, 0.55), transparent 60%),
    linear-gradient(180deg, #0a4a68 0%, #062c42 55%, #031a28 100%);
  opacity: 1;
  transition: opacity 0.4s ease;
}

#unity-loading-bar.loaded {
  opacity: 0;
  pointer-events: none;
}

.loading-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px;
  text-align: center;
}

.game-icon {
  width: 112px;
  height: 112px;
  border-radius: 26px;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45), 0 0 0 3px rgba(255, 255, 255, 0.16);
  margin-bottom: 20px;
  animation: icon-float 3.2s ease-in-out infinite;
}

@keyframes icon-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

#unity-loading-bar h1 {
  margin: 0;
  font-size: clamp(28px, 5vw, 44px);
  font-weight: 800;
  letter-spacing: 0.5px;
  text-shadow: 0 3px 14px rgba(0, 0, 0, 0.35);
}

#unity-loading-bar .subtitle {
  margin: 8px 0 26px;
  font-size: clamp(14px, 2vw, 18px);
  color: rgba(255, 255, 255, 0.78);
}

#unity-progress-bar-empty {
  width: min(260px, 62vw);
  height: 10px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.16);
  overflow: hidden;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.35);
}

#unity-progress-bar-full {
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--mint), var(--sun));
  box-shadow: 0 0 12px rgba(126, 224, 195, 0.55);
  transition: width 0.18s ease-out;
}

#loading-note {
  margin: 14px 0 0;
  min-height: 20px;
  font-size: 14px;
  color: rgba(255, 255, 255, 0.62);
}

#unity-warning {
  position: absolute;
  left: 50%;
  top: max(12px, env(safe-area-inset-top));
  transform: translateX(-50%);
  display: none;
  max-width: min(680px, 90vw);
  z-index: 30;
}

#unity-warning > div {
  margin-bottom: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: #ffffff;
  color: #1b2b36;
  font-size: 14px;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

#unity-warning > .banner-error {
  background: #ff5a5f;
  color: #ffffff;
}

#unity-warning > .banner-warning {
  background: #ffe28a;
  color: #3a2c00;
}

#fs-button {
  position: fixed;
  right: max(10px, env(safe-area-inset-right));
  bottom: max(10px, env(safe-area-inset-bottom));
  z-index: 40;
  width: 42px;
  height: 42px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 12px;
  background: rgba(4, 30, 45, 0.48);
  color: #ffffff;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 0.2s ease, background 0.2s ease;
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  -webkit-tap-highlight-color: transparent;
}

#fs-button.visible {
  display: flex;
}

#fs-button:hover,
#fs-button:active {
  opacity: 1;
  background: rgba(4, 30, 45, 0.75);
}

#fs-button svg {
  display: block;
  width: 22px;
  height: 22px;
}

#rotate-hint {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 50;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  background:
    radial-gradient(circle at 50% 40%, rgba(20, 110, 140, 0.6), transparent 60%),
    linear-gradient(180deg, #0a4a68 0%, #062c42 55%, #031a28 100%);
  text-align: center;
  padding: 24px;
}

.phone-icon {
  width: 46px;
  height: 76px;
  border: 4px solid var(--white);
  border-radius: 12px;
  transform: rotate(90deg);
  margin-bottom: 18px;
  position: relative;
  opacity: 0.9;
}

.phone-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: 5px;
  width: 18px;
  height: 3px;
  border-radius: 2px;
  background: var(--white);
  transform: translateX(-50%);
}

#rotate-hint p {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
}

#rotate-hint span {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.7);
}

@media (orientation: portrait) and (pointer: coarse) {
  #rotate-hint {
    display: flex;
  }
}

@media (max-height: 420px) {
  .game-icon {
    width: 76px;
    height: 76px;
    border-radius: 18px;
    margin-bottom: 12px;
  }

  #unity-loading-bar .subtitle {
    margin: 4px 0 14px;
  }

  #loading-note {
    margin-top: 8px;
  }
}
