*, *::before, *::after {
  margin: 0; padding: 0;
  box-sizing: border-box;
}

:root {
  --gold:    #FFD700;
  --dark:    #0d1b2a;
  --mid:     #1a2f45;
  --btn-bg:  rgba(10, 20, 35, 0.88);
  --btn-bdr: rgba(255, 215, 0, 0.55);
  --txt:     #e8e8e8;
  --radius:  12px;
}

body {
  overflow:  hidden;
  background: #1a1a1a;
  font-family: 'Segoe UI', 'Helvetica Neue', sans-serif;
  direction:  rtl;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select:   none;
  user-select: none;
}

#game-canvas {
  position: fixed;
  inset: 0;
  width:  100vw;
  height: 100vh;
  display: block;
  z-index: 1;
}

#loading-screen {
  position: fixed;
  inset: 0;
  background: var(--dark);
  display:    flex;
  flex-direction: column;
  align-items:    center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.5s ease;
}

.spinner {
  width:  52px;
  height: 52px;
  border: 5px solid rgba(255,255,255,0.15);
  border-top: 5px solid var(--gold);
  border-radius: 50%;
  animation: spin 0.85s linear infinite;
  margin-bottom: 18px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.loading-text {
  color: var(--txt);
  font-size: 17px;
  opacity: 0.85;
  letter-spacing: 0.03em;
}

#ui-overlay {
  position: fixed;
  inset: 0;
  z-index: 50;
  pointer-events: none;
}

#info-panel {
  position: fixed;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--btn-bg);
  color: var(--gold);
  font-size: 15px;
  font-weight: 600;
  padding: 8px 22px;
  border-radius: 30px;
  border: 1px solid var(--btn-bdr);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 60;
  pointer-events: none;
  white-space: nowrap;
  letter-spacing: 0.04em;
}

#action-panel {
  position: fixed;
  top: 14px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 7px;
  z-index: 60;
  pointer-events: all;
}

.action-btn {
  background: var(--btn-bg);
  color: var(--gold);
  border: 1px solid var(--btn-bdr);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  transition: background 0.15s, transform 0.1s;
  white-space: nowrap;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  min-width: 140px;
  text-align: center;
}
.action-btn:active {
  background: rgba(255, 215, 0, 0.2);
  transform: scale(0.96);
}

#dpad {
  position: fixed;
  bottom: 20px;
  left: 20px;
  display: grid;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows:    repeat(3, 56px);
  gap: 5px;
  z-index: 60;
  pointer-events: all;
}

.dpad-btn {
  background: var(--btn-bg);
  color: var(--txt);
  border: 1px solid var(--btn-bdr);
  border-radius: var(--radius);
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: none;
  -webkit-tap-highlight-color: transparent;
  transition: background 0.1s, transform 0.1s;
  user-select: none;
}
.dpad-btn:empty { pointer-events: none; background: transparent; border-color: transparent; }
.dpad-btn:active { background: rgba(255,215,0,0.25); transform: scale(0.92); }

#height-btns {
  position: fixed;
  bottom: 80px;
  right: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  z-index: 60;
  pointer-events: all;
}

#vr-btn-wrapper {
  position: fixed;
  bottom: 16px;
  right: 16px;
  z-index: 60;
  pointer-events: all;
}

.babylonVRicon {
  background: var(--btn-bg) !important;
  border: 2px solid var(--gold) !important;
  border-radius: 10px !important;
}

#ctrl-guide {
  position: fixed;
  bottom: 14px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--btn-bg);
  color: rgba(255,255,255,0.6);
  font-size: 12px;
  padding: 6px 18px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 55;
  pointer-events: none;
  white-space: nowrap;
}

#btn-get-pos {
  position: fixed;
  top: 14px;
  left: 14px;
  background: var(--btn-bg);
  color: rgba(255,255,255,0.7);
  border: 1px solid rgba(255,255,255,0.15);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: 13px;
  cursor: pointer;
  z-index: 60;
  pointer-events: all;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}
#btn-get-pos:active { opacity: 0.7; }
