body { 
  padding: 0; 
  margin: 0;
  overflow: hidden;
  background: #000;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

#unity-container { 
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
}

#unity-container.unity-desktop { 
  left: 50%; 
  top: 50%; 
  transform: translate(-50%, -50%);
  padding: 20px;
}

#unity-container.unity-mobile { 
  position: fixed; 
  width: 100%; 
  height: 100%;
  top: 0;
  left: 0;
  /* Safe area support for notched devices */
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left);
  box-sizing: border-box;
  display: block;
}

/* iPhone 14-like Device Frame */
#device-frame {
  position: relative;
  background: linear-gradient(145deg, #1a1a1a, #2d2d2d);
  border-radius: 50px;
  padding: 8px;
  box-shadow: 
    0 0 0 2px #333,
    0 0 0 3px #1a1a1a,
    0 20px 40px rgba(0, 0, 0, 0.4),
    inset 0 2px 4px rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.unity-mobile #device-frame {
  display: none;
}

#device-notch {
  position: absolute;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  width: 120px;
  height: 30px;
  background: #1a1a1a;
  border-radius: 0 0 15px 15px;
  z-index: 10;
  box-shadow: inset 0 -2px 4px rgba(0, 0, 0, 0.3);
}

#device-notch::before {
  content: '';
  position: absolute;
  top: 6px;
  left: 20px;
  width: 6px;
  height: 6px;
  background: #333;
  border-radius: 50%;
}

#device-notch::after {
  content: '';
  position: absolute;
  top: 8px;
  right: 15px;
  width: 50px;
  height: 2px;
  background: #333;
  border-radius: 1px;
}

#device-screen {
  position: relative;
  background: #000;
  border-radius: 42px;
  overflow: hidden;
  box-shadow: 
    inset 0 0 0 2px rgba(255, 255, 255, 0.1),
    0 4px 20px rgba(0, 0, 0, 0.3);
}

#device-home-indicator {
  position: absolute;
  bottom: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: 134px;
  height: 5px;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 3px;
  z-index: 10;
}

#unity-canvas { 
  background: #231F20;
  touch-action: manipulation;
  display: block;
}

#unity-canvas.unity-desktop {
  border-radius: 42px;
  width: 100%;
  height: 100%;
}

.unity-mobile #unity-canvas { 
  width: 100% !important; 
  height: 100% !important;
  display: block;
  border-radius: 0;
  box-shadow: none;
  position: absolute;
  top: 0;
  left: 0;
}

/* Unity Loading Bar */
#unity-loading-bar { 
  position: absolute; 
  left: 50%; 
  top: 50%; 
  transform: translate(-50%, -50%); 
  display: none;
  z-index: 100;
}

#unity-logo { 
  width: 154px; 
  height: 130px; 
  background: url('unity-logo-dark.png') no-repeat center;
}

#unity-progress-bar-empty { 
  width: 141px; 
  height: 18px; 
  margin-top: 10px; 
  margin-left: 6.5px; 
  background: url('progress-bar-empty-dark.png') no-repeat center;
}

#unity-progress-bar-full { 
  width: 0%; 
  height: 18px; 
  margin-top: 10px; 
  background: url('progress-bar-full-dark.png') no-repeat center;
}

#unity-footer { 
  position: relative;
  background: rgba(0,0,0,0.6);
  backdrop-filter: blur(10px);
  border-radius: 8px;
  margin-top: 20px;
  min-height: 38px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 15px;
  box-sizing: border-box;
  max-width: 400px;
  width: 100%;
}

.unity-mobile #unity-footer { display: none }

#unity-build-title { 
  line-height: 38px; 
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif; 
  font-size: 16px;
  color: #fff;
  font-weight: 500;
  flex-grow: 1;
  text-align: left;
}

#unity-fullscreen-button { 
  cursor: pointer; 
  width: 38px; 
  height: 38px; 
  background: url('fullscreen-button.png') no-repeat center;
  background-size: 20px 20px;
  border-radius: 4px;
  transition: background-color 0.2s ease;
  flex-shrink: 0;
}

#unity-fullscreen-button:hover {
  background-color: rgba(255,255,255,0.1);
}

#unity-warning { 
  position: absolute; 
  left: 50%; 
  top: 5%; 
  transform: translate(-50%); 
  background: rgba(255,255,255,0.95); 
  backdrop-filter: blur(10px);
  padding: 15px 20px; 
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  display: none;
  max-width: 80%;
  text-align: center;
  font-size: 14px;
  z-index: 1000;
}

/* Mobile-specific optimizations */
@media (max-width: 768px) {
  #unity-warning {
    max-width: 90%;
    font-size: 12px;
    padding: 10px 15px;
  }
  
  #loading-text {
    font-size: 16px;
  }
  
  #unity-progress-bar-empty {
    width: 150px;
  }
}

/* Prevent text selection on mobile */
@media (pointer: coarse) {
  * {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
}
