body { padding: 0; margin: 0 }
#unity-container { position: absolute }
#unity-container.unity-desktop { left: 50%; top: 50%; transform: translate(-50%, -50%) }
#unity-container.unity-mobile { position: fixed; width: 100%; height: 100% }
#unity-canvas { background: #231F20 }
.unity-mobile #unity-canvas { width: 100%; height: 100% }
#unity-loading-bar { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); display: none }
#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 }
.unity-mobile #unity-footer { display: none }
#unity-webgl-logo { float:left; width: 204px; height: 38px; background: url('webgl-logo.png') no-repeat center }
#unity-build-title { float: right; margin-right: 10px; line-height: 38px; font-family: arial; font-size: 18px }
#unity-fullscreen-button { cursor:pointer; float: right; width: 38px; height: 38px; background: url('fullscreen-button.png') no-repeat center }
#unity-warning { position: absolute; left: 50%; top: 5%; transform: translate(-50%); background: white; padding: 10px; display: none }

/* ==== FINAL OVERRIDE: center the WebGL canvas correctly ==== */

/* เต็มจอ, ไม่มีสกรอลล์ */
html, body { height: 100%; margin: 0; overflow: hidden; }

/* ล้างค่าจัดวางเดิมของ Unity template + จัดกลางด้วย Grid */
#unity-container,
#unity-container.unity-desktop,
#unity-container.unity-mobile {
  position: fixed !important;
  inset: 0 !important;           /* top/right/bottom/left = 0 */
  left: auto !important;         /* ล้างค่า 50% เดิม */
  top: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;    /* ล้าง translate(-50%, -50%) เดิม */
  display: grid !important;
  place-items: center !important;
  background: #0b2942;           /* เปลี่ยนได้ */
}

/* ให้ canvas แสดงผลเต็มจอและไม่ถูกขยับด้วย position/transform เก่า */
#unity-canvas {
  position: static !important;
  transform: none !important;
  margin: 0 auto !important;
  display: block !important;

  /* เลือกโหมดแสดงผล:
     - ถ้าต้องการเต็มหน้าจอทุกอัตราส่วน (ไม่ล็อก 16:9): */
  width: 100vw !important;
  height: 100vh !important;
  /* ถ้าอยากกันภาพเพี้ยน ให้ใส่เสริมได้:
     object-fit: contain;  */

  background: #231F20; /* optional */
}

/* โหลดดิ้งบาร์ให้อยู่กลาง */
#unity-loading-bar {
  position: absolute !important;
  left: 50% !important; top: 50% !important;
  transform: translate(-50%, -50%) !important;
}
