html {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
  box-sizing: border-box; /* Apply box-sizing globally */
}

*, *:before, *:after {
  box-sizing: inherit; /* Inherit box-sizing */
}

body {
  font-family: 'Inter', 'SF Pro Text', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background-color: #0f172a;
  color: #f0f0f0;
  margin: 0;
  padding: 20px 16px;
  width: 100%;
  min-height: 100%;
  overflow: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  position: relative;
}

/* Animated gradient orbs background — uses transform for GPU compositing */
body::before {
  content: '';
  position: fixed;
  top: -15%;
  left: -15%;
  width: 130%;
  height: 130%;
  background: 
    radial-gradient(ellipse 60% 50% at 50% 0%,   rgba(79, 70, 229, 0.10) 0%, transparent 60%),
    radial-gradient(ellipse 40% 40% at 20% 60%,  rgba(79, 70, 229, 0.07) 0%, transparent 55%),
    radial-gradient(ellipse 35% 35% at 80% 70%,  rgba(99, 102, 241, 0.06) 0%, transparent 50%),
    radial-gradient(ellipse 30% 30% at 60% 90%,  rgba(79, 70, 229, 0.04) 0%, transparent 50%);
  pointer-events: none;
  z-index: 0;
  will-change: transform;
  animation: gradientDrift 25s ease-in-out infinite;
}

/* Subtle grid pattern overlay */
body::after {
  content: '';
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: 
    linear-gradient(rgba(79, 70, 229, 0.03) 1px, transparent 1px),
    linear-gradient(90deg, rgba(79, 70, 229, 0.03) 1px, transparent 1px);
  background-size: 50px 50px;
  pointer-events: none;
  z-index: 0;
  opacity: 0.6;
}

@keyframes gradientDrift {
  0%, 100% { transform: translate(0, 0) scale(1); }
  25%      { transform: translate(3%, -2%) scale(1.02); }
  50%      { transform: translate(-2%, 3%) scale(0.98); }
  75%      { transform: translate(-3%, -1%) scale(1.01); }
}

#unity-container {
  position: relative;
  z-index: 1;
  background: #000;
  border-radius: 4px;
  overflow: hidden;
}

/* Desktop styles */
#unity-container.unity-desktop {
  /* Centering is handled by body flex. Canvas size is set by JS. */
}

/* Mobile styles */
#unity-container.unity-mobile {
  position: fixed;
  width: 100%;
  height: 100%;
  top: 0;
  left: 0;
  /* This ensures it fills the viewport, overriding body's flex for its own positioning */
}

#unity-canvas {
  background: #000000; /* Dark canvas background */
  /* width and height are set by Unity script or inline attributes */
}

.unity-mobile #unity-canvas {
  width: 100%;
  height: 100%;
}

#unity-loading-bar {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  display: none; /* Shown by script when loading starts */
  width: 250px;
  text-align: center;
}

#unity-logo {
  display: none; /* Hidden for a minimalist look */
}

#unity-progress-bar-empty {
  width: 100%;
  height: 12px;
  background-color: #333333;
  border-radius: 6px;
  margin-top: 15px;
  padding: 2px;
}

#unity-progress-bar-full {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, #4f46e5, #6366f1);
  border-radius: 4px;
}

/* Footer common styles (Desktop) */
#unity-footer {
  position: absolute;
  bottom: 10px;
  left: 10px;
  right: 10px;
  height: 38px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1; /* Ensure footer is above canvas if canvas has its own stacking context */
}

#unity-logo-title-footer {
  display: none; /* Hidden for minimalism */
}

#unity-build-title {
  line-height: 38px;
  font-size: 14px;
  color: #94a3b8;
  order: 1;
  /* Allow title to take space but truncate if too long */
  flex-grow: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 10px; /* Space between title and button */
}

#unity-fullscreen-button {
  cursor: pointer;
  width: 38px;
  height: 38px;
  padding: 0;
  border: none;
  background-color: transparent;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24'%3E%3Cpath fill='%23e2e8f0' d='M7 14H5v5h5v-2H7v-3zm-2-4h2V7h3V5H5v5zm12 7h-3v2h5v-5h-2v3zM14 5v2h3v3h2V5h-5z'/%3E%3C/svg%3E");
  background-position: center center;
  background-repeat: no-repeat;
  background-size: contain;
  order: 2;
  flex-shrink: 0;
  transition: background-color 0.2s ease;
  border-radius: 4px;
}

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

/* Mobile specific footer and fullscreen button */
.unity-mobile #unity-footer {
  display: flex;
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: auto;
  padding: 8px;
  background-color: rgba(10, 10, 15, 0.85);
  justify-content: space-between;
  align-items: center;
  z-index: 2; /* Ensure it's above canvas */
}

.unity-mobile #unity-build-title {
  font-size: 12px;
  color: #94a3b8;
  line-height: normal; /* Reset line height for mobile footer */
  margin-left: 5px;
  flex-grow: 1; /* Allow title to take space */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-right: 10px;
}

.unity-mobile #unity-fullscreen-button {
  width: 32px;
  height: 32px;
  background-size: contain;
  /* background-position, background-repeat, etc. are inherited or remain the same */
  margin-right: 5px;
  order: 2;
  flex-shrink: 0;
}

#unity-warning {
  position: absolute;
  left: 50%;
  top: 20px;
  transform: translate(-50%);
  background: #1e293b;
  color: #f1f5f9;
  padding: 10px 16px;
  display: none;
  border-radius: 6px;
  border: 1px solid rgba(99, 102, 241, 0.3);
  z-index: 100;
  font-size: 14px;
}

/* ── Demo wrapper & header ───────────────────────────────── */

.demo-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  position: relative;
  z-index: 1;
}

.demo-header {
  width: 1200px;
  max-width: calc(100vw - 32px);
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 16px;
  background: rgba(15, 23, 42, 0.82);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(99, 102, 241, 0.25);
  border-radius: 8px;
}

.back-link {
  color: #6366f1;
  text-decoration: none;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.01em;
  transition: color 0.2s ease;
  white-space: nowrap;
  flex-shrink: 0;
}

.back-link:hover {
  color: #818cf8;
}

.demo-sep {
  color: rgba(255, 255, 255, 0.15);
  font-size: 13px;
  flex-shrink: 0;
}

.demo-title {
  color: #f1f5f9;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  flex-grow: 1;
}

.demo-badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #818cf8;
  background: rgba(99, 102, 241, 0.12);
  border: 1px solid rgba(99, 102, 241, 0.3);
  border-radius: 4px;
  padding: 3px 8px;
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Player frame ─────────────────────────────────────────── */
.player-frame {
  position: relative;
  z-index: 1;
  padding: 2px;
  border-radius: 6px;
  background: linear-gradient(135deg,
    rgba(99, 102, 241, 0.65) 0%,
    rgba(139, 92, 246, 0.50) 50%,
    rgba(168, 85, 247, 0.40) 100%);
  box-shadow:
    0 0 40px rgba(99, 102, 241, 0.22),
    0 0 80px rgba(139, 92, 246, 0.12),
    0 24px 64px rgba(0, 0, 0, 0.55);
}

.frame-corner {
  position: absolute;
  width: 20px;
  height: 20px;
  z-index: 2;
  pointer-events: none;
}

.frame-corner::before,
.frame-corner::after {
  content: '';
  position: absolute;
  background: rgba(167, 139, 250, 0.9);
}

.frame-corner::before { width: 100%; height: 2px; top: 0; left: 0; }
.frame-corner::after  { width: 2px;  height: 100%; top: 0; left: 0; }

.frame-tl { top: -1px;    left: -1px;  }
.frame-tr { top: -1px;    right: -1px; transform: scaleX(-1); }
.frame-bl { bottom: -1px; left: -1px;  transform: scaleY(-1); }
.frame-br { bottom: -1px; right: -1px; transform: scale(-1);  }

canvas, body {
  -webkit-user-select: none; /* Safari */
  -moz-user-select: none;    /* Firefox */
  -ms-user-select: none;     /* IE 10+ */
  user-select: none;         /* Standard syntax */
}
