html, body {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  overscroll-behavior: none !important;
  overscroll-behavior-x: none !important;
  overscroll-behavior-y: none !important;
  background-color: #060c14;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  touch-action: none !important;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}
#unity-container {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  overscroll-behavior: none !important;
  touch-action: none !important;
}
#unity-canvas {
  width: 100% !important;
  height: 100% !important;
  max-width: 100% !important;
  max-height: 100% !important;
  display: block;
  background: #000;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  touch-action: none !important;
}

/* Premium Dragon Boy Loading Screen */
#unity-loading-bar {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 99999;
  background: radial-gradient(circle at center, #10243e 0%, #060c14 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  overflow: hidden;
  pointer-events: all;
  transition: opacity 0.5s ease-out;
}

.loading-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 90%;
  max-width: 380px;
  animation: fadeInContent 0.8s ease-out;
}

@keyframes fadeInContent {
  from { opacity: 0; transform: scale(0.92); }
  to { opacity: 1; transform: scale(1); }
}

.loading-avatar-wrapper {
  position: relative;
  width: 100px;
  height: 100px;
  margin-bottom: 14px;
}

.loading-avatar {
  width: 100%;
  height: 100%;
  border-radius: 20px;
  object-fit: cover;
  box-shadow: 0 0 24px rgba(190, 90, 255, 0.7), 0 0 48px rgba(255, 170, 0, 0.35);
  border: 2px solid rgba(255, 224, 130, 0.9);
  position: relative;
  z-index: 2;
  animation: avatarFloat 3s ease-in-out infinite;
}

@keyframes avatarFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-5px); }
}

.avatar-glow {
  position: absolute;
  inset: -10px;
  border-radius: 28px;
  background: radial-gradient(circle, rgba(196, 86, 255, 0.55) 0%, rgba(255, 168, 0, 0.25) 45%, transparent 72%);
  z-index: 1;
  animation: pulseGlow 2s ease-in-out infinite;
}

@keyframes pulseGlow {
  0%, 100% { transform: scale(1); opacity: 0.6; }
  50% { transform: scale(1.15); opacity: 1; }
}

.loading-title {
  font-size: clamp(26px, 5vw, 34px);
  font-weight: 900;
  letter-spacing: 1.5px;
  line-height: 1.15;
  margin-bottom: 18px;
  text-align: center;
  background: linear-gradient(180deg, #fff6b3 0%, #ffc107 48%, #ff6d00 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  -webkit-text-stroke: 1px rgba(60, 20, 0, 0.55);
  filter: drop-shadow(0 3px 12px rgba(255, 136, 0, 0.75)) drop-shadow(0 2px 3px rgba(0, 0, 0, 0.9));
}

.loading-logo {
  width: 220px;
  max-width: 80vw;
  height: auto;
  margin-bottom: 20px;
  filter: drop-shadow(0 3px 12px rgba(255, 120, 0, 0.6));
  image-rendering: -webkit-optimize-contrast;
}

.loading-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  width: 100%;
  max-width: 320px;
  margin-bottom: 8px;
  padding: 0 4px;
}

.loading-status-text {
  font-size: 13px;
  font-weight: 500;
  color: #cfd8dc;
  letter-spacing: 0.3px;
}

.loading-pct-text {
  font-size: 14px;
  font-weight: 700;
  color: #00e5ff;
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.7);
  font-variant-numeric: tabular-nums;
}

.loading-bar-track {
  width: 100%;
  max-width: 320px;
  height: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.6), 0 2px 8px rgba(0, 0, 0, 0.4);
  position: relative;
}

.loading-bar-fill {
  width: 0%;
  height: 100%;
  border-radius: 10px;
  background: linear-gradient(90deg, #ff7a00 0%, #ffb300 50%, #00e5ff 100%);
  box-shadow: 0 0 16px rgba(255, 122, 0, 0.8), 0 0 24px rgba(0, 229, 255, 0.6);
  transition: width 0.2s ease-out;
  position: relative;
  overflow: hidden;
}

.loading-bar-fill::after {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.5), transparent);
  animation: barShine 1.5s linear infinite;
}

@keyframes barShine {
  0% { left: -100%; }
  100% { left: 100%; }
}

.loading-tip {
  margin-top: 14px;
  font-size: 12px;
  color: #78909c;
  letter-spacing: 0.2px;
}

#unity-footer {
  display: none !important;
}
#unity-fullscreen-button {
  display: none !important;
}
#unity-webgl-logo, #unity-build-title {
  display: none !important;
}
#unity-warning {
  position: absolute;
  left: 50%;
  top: 5%;
  transform: translate(-50%);
  background: white;
  padding: 10px;
  display: none;
}

/* Force Landscape Overlay */
#rotate-device-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 99999999;
  background: #060c14;
  color: #fff;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  padding: 24px;
}
.rotate-phone-box {
  margin-bottom: 24px;
}
.rotate-icon-svg {
  width: 64px;
  height: 64px;
  animation: rotatePhoneAnim 2s ease-in-out infinite;
}
.rotate-msg {
  font-size: 17px;
  font-weight: 600;
  max-width: 320px;
  line-height: 1.5;
  color: #f1f1f1;
}
@keyframes rotatePhoneAnim {
  0%, 15% { transform: rotate(0deg); }
  45%, 65% { transform: rotate(-90deg); }
  90%, 100% { transform: rotate(0deg); }
}
@media screen and (orientation: portrait) {
  #rotate-device-overlay {
    display: flex !important;
  }
}


/* Mobile Web Input Overlay */
#unity-input-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2147483647;
  background: rgba(8, 14, 24, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border-bottom: 2px solid #00d2ff;
  box-shadow: 0 4px 25px rgba(0, 0, 0, 0.75);
  box-sizing: border-box;
  padding: 8px 12px;
  padding-top: max(8px, env(safe-area-inset-top));
  padding-left: max(12px, env(safe-area-inset-left));
  padding-right: max(12px, env(safe-area-inset-right));
  display: none;
  animation: slideDownInput 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes slideDownInput {
  from {
    transform: translateY(-100%);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

#unity-input-overlay .input-bar-container {
  display: flex;
  align-items: center;
  gap: 8px;
  max-width: 600px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

#unity-direct-input {
  flex: 1;
  min-width: 0;
  height: 40px;
  -webkit-user-select: text !important;
  user-select: text !important;
  touch-action: auto !important;
  pointer-events: auto !important;
  cursor: text !important;
  background: rgba(0, 0, 0, 0.65);
  border: 1.5px solid #2a4060;
  border-radius: 8px;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  padding: 0 12px;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

#unity-direct-input:focus {
  border-color: #00d2ff !important;
  box-shadow: 0 0 12px rgba(0, 210, 255, 0.45) !important;
}

#unity-input-submit-btn {
  height: 40px;
  padding: 0 18px;
  background: linear-gradient(135deg, #00d2ff 0%, #0077ff 100%);
  border: none;
  border-radius: 8px;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 2px 10px rgba(0, 119, 255, 0.45);
  flex-shrink: 0;
  transition: transform 0.1s, opacity 0.1s;
}

#unity-input-submit-btn:active {
  transform: scale(0.96);
  opacity: 0.9;
}

#unity-input-close-btn {
  height: 40px;
  width: 40px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #cccccc;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background 0.1s, color 0.1s;
}

#unity-input-close-btn:active {
  background: rgba(255, 255, 255, 0.25);
  color: #ffffff;
}

/* iOS Add to Home Screen Smart Banner */
#ios-install-banner {
  position: fixed;
  left: 0;
  right: 0;
  bottom: max(12px, env(safe-area-inset-bottom));
  z-index: 2147483640;
  display: none;
  justify-content: center;
  padding: 0 max(12px, env(safe-area-inset-left)) 0 max(12px, env(safe-area-inset-right));
  pointer-events: none;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

.ios-banner-card {
  pointer-events: auto !important;
  touch-action: auto !important;
  width: 100%;
  max-width: 440px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border-radius: 14px;
  background: rgba(10, 20, 36, 0.94);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1.5px solid rgba(0, 229, 255, 0.5);
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.72), 0 0 18px rgba(0, 229, 255, 0.2);
  color: #f1f5f9;
  box-sizing: border-box;
  animation: iosBannerSlideUp 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes iosBannerSlideUp {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.ios-banner-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  object-fit: cover;
  border: 1.5px solid rgba(255, 213, 79, 0.85);
  flex-shrink: 0;
}

.ios-banner-body {
  flex: 1;
  min-width: 0;
  text-align: left;
}

.ios-banner-title {
  font-size: 13px;
  font-weight: 800;
  color: #ffd54f;
  margin-bottom: 3px;
  letter-spacing: 0.2px;
}

.ios-banner-desc {
  font-size: 12px;
  line-height: 1.45;
  color: #dbeafe;
}

.ios-banner-desc strong {
  color: #ffffff;
}

.ios-share-badge {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 1px 6px;
  border-radius: 6px;
  background: rgba(0, 229, 255, 0.16);
  border: 1px solid rgba(0, 229, 255, 0.45);
  color: #38bdf8;
  font-weight: 700;
  vertical-align: middle;
}

.ios-copy-btn {
  margin-left: 6px;
  padding: 3px 9px;
  border-radius: 6px;
  border: 1px solid rgba(0, 229, 255, 0.6);
  background: rgba(0, 229, 255, 0.18);
  color: #00e5ff;
  font-size: 11px;
  font-weight: 700;
  cursor: pointer;
  touch-action: auto !important;
}

.ios-banner-close {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  touch-action: auto !important;
}

.ios-banner-close:active {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

@media screen and (orientation: landscape) and (max-height: 450px) {
  #ios-install-banner {
    bottom: max(6px, env(safe-area-inset-bottom));
  }
  .ios-banner-card {
    padding: 7px 10px;
    gap: 9px;
  }
  .ios-banner-icon {
    width: 34px;
    height: 34px;
    border-radius: 8px;
  }
  .ios-banner-title {
    font-size: 12px;
    margin-bottom: 1px;
  }
  .ios-banner-desc {
    font-size: 11px;
  }
}
