body {
    margin: 0;
    overflow: hidden;
    width: 100vw;
    height: 100vh;
}
canvas{
  display: block;
  position: fixed;
  top: 0; left: 0;
  width: 100vw;
  height: 100vh;
  pointer-events: auto;
  touch-action: none;
  z-index: 0;
}
#messageBox {
    position: fixed;
    left: 50%;
    top: 20%;
    transform: translate(-50%, -50%);
    z-index: 200;
    background: radial-gradient(circle at 30% 30%, rgba(100, 200, 255, 0.25), rgba(0, 0, 0, 0.85) 70%);
    color: #e0f7ff;
    font-family: sans-serif;
    font-size: 1rem;
    padding: 0.5em 1em;
    border-radius: 6px;
    border: 1px solid rgba(100, 200, 255, 0.4);
    box-shadow: 
        0 0 20px rgba(100, 200, 255, 0.5),     /* Outer glow */
        inset 0 0 15px rgba(100, 200, 255, 0.3); /* Inner glow */
    display: none;
    white-space: nowrap;
    pointer-events: auto;
  }
  #messageText {
    text-shadow: 0 0 10px rgba(100, 200, 255, 0.7);  /* Neon text glow */
    margin-right: 1em;  /* Space before button */
  }
  #startMissionBtn {
    margin-left: 0;  /* Reset, we use flex now */
    padding: 0.6em 1.4em;
    font-size: 1rem;
    font-weight: bold;
    color: white;
    background: linear-gradient(135deg, #00bfff, #1e90ff);
    border: none;
    border-radius: 12px;
    cursor: pointer;
    box-shadow: 0 0 15px rgba(0, 191, 255, 0.6);
    transition: all 0.3s ease;
  }
  #startMissionBtn:hover {
    transform: scale(1.08);
    box-shadow: 0 0 25px rgba(0, 191, 255, 0.9);
    background: linear-gradient(135deg, #1e90ff, #00bfff);
  }
  
  #coinDisplay {
    position: fixed;
    top: 15px;
    left: 15px;
    color: white;
    font-family: sans-serif;
    background: rgba(0, 0, 0, 0.6);
    padding: 6px 12px;
    border-radius: 4px;
    font-size: 16px;
    z-index: 100;
  }  

  /* MENU shit code [start] */
  #menuBtn {
    position: fixed;
    top: 15px;
    right: 15px;
    width: 30px;
    height: 30px;
    background: rgba(0, 0, 0, 0.6);
    color: white;
    font-size: 20px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 500;
    transition: all 0.2s ease;
    border: 2px solid rgba(255, 255, 255, 0.3);
  }
  #menuBtn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.05);
  }
  #menuBtn:active {
    transform: scale(0.95);
  }
  /* Menu Panel */
  #menuPanel {
    position: fixed;
    top: 0;
    right: -400px; /* Hidden off-screen */
    width: 380px;
    height: 100vh;
    background: rgba(255, 255, 255, 0);
    backdrop-filter: blur(15px);
    border-left: 2px solid rgba(255, 255, 255, 0.15);
    z-index: 600;
    transition: right 0.3s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    overflow-y: auto;
  }
  #menuPanel.open {
    right: 0; /* Slide in */
  }
  #menuContent {
    padding: 25px;
    color: white;
    height: 100%;
    display: flex;
    flex-direction: column;
  }
  #menuContent h3 {
    margin: 0 0 1px 0;
    font-size: 1.4rem;
    background: linear-gradient(135deg, #ffd1e6, #87CEEB);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
  }
  /* build mode [start]*/
  .build-mode-toggle {
    margin: 15px 0;
  }
  #buildModeBtn {
    width: 100%;
    padding: 12px;
    background: rgba(34, 197, 94, 0.2);
    border: 2px solid rgba(34, 197, 94, 0.5);
    color: white;
    border-radius: 10px;
    font-size: 1rem;
    cursor: pointer;
    transition: all 0.2s ease;
  }
  #buildModeBtn.active {
    background: rgba(239, 68, 68, 0.2);
    border-color: rgba(239, 68, 68, 0.5);
  }
  #buildModeBtn:hover {
    transform: translateY(-1px);
    box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
  }
  /* build mode [end]*/
  #groundOptions {
    padding: 20px 0;
    border-top: 1px solid rgba(172, 58, 242, 0.4);
  }
  #groundOptions h4 {
    margin: 0 0 20px 0;
    font-size: 1.1rem;
    color: #87CEEB;
  }
  .texture-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));  
    gap: 12px;  
  }
  
  .texture-btn {
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 8px 10px;
    min-height: 44px; /* nicer tap target */
  }
  
  .texture-btn:hover {
    background: rgba(135, 206, 235, 0.18);
    transform: translateY(-1px);
  }
  
  .texture-btn.active {
    border-color: rgba(135, 206, 235, 0.8);
    background: rgba(135, 206, 235, 0.22);
  }
  
  .texture-preview {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    object-fit: cover;
    flex: 0 0 auto;
    border: 1px solid rgba(255, 255, 255, 0.18);
  }
  
  .texture-btn span {
    font-size: 0.9rem;
    margin: 0;
    line-height: 1.1;
  }  

  /* Object buttons reuse texture-btn look */
  #objectOptions {
    margin-top: 20px;  
  }
  #objectOptions h4 {
    margin: 0 0 20px 0;
    font-size: 1.1rem;
    color: #87CEEB;
  }
  .object-btn {
    border: 2px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: white;
    border-radius: 10px;
    cursor: pointer;
    transition: transform 0.15s ease, background 0.15s ease, border-color 0.15s ease;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 10px;
    padding: 8px 10px;
    min-height: 44px;
  }

  .object-btn:hover {
    background: rgba(135, 206, 235, 0.18);
    transform: translateY(-1px);
  }

  .object-btn.active {
    border-color: rgba(135, 206, 235, 0.8);
    background: rgba(135, 206, 235, 0.22);
  }


  /* Close button inside panel */
  #menuPanel::before {
    content: "✕";
    position: absolute;
    top: 25px;
    right: 25px;
    width: 30px;
    height: 30px;
    background: transparent;
    color: #ffd1e6; /* 呼應你的漸層粉色 */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.2s ease;
    text-shadow: 0 0 8px rgba(255, 209, 230, 0.8);
  }
  /* MENU shit code [end] */

  /* Mobile joystick shit */
  #joystickShit {
    display: none;
    position: fixed;
    bottom: 20px;
    left: 20px;
    width: 120px;
    height: 120px;
    z-index: 300;
  }
  @media screen and (orientation: portrait) {
    body::before {
      content: "Please rotate your device 🔄";
      position: fixed;
      top: 0; left: 0;
      width: 100vw; height: 100vh;
      background: rgba(0,0,0,0.9);
      color: white;
      font-size: 1.5rem;
      display: flex;
      align-items: center;
      justify-content: center;
      z-index: 9999;
    }
  }
  
  @media (max-width: 500px) {
    #menuContent {
      padding: 16px;
    }
    #groundOptions,
    #objectOptions {
      padding: 12px 0;
    }
    #groundOptions h4,
    #objectOptions h4 {
      margin: 0 0 12px 0;
    }
  }
  