/* Defines universal CSS reset and base body styling */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  overflow: hidden;
  font-family:
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    Arial,
    sans-serif;
  background: #050508;
  color: #fff;
}
/* ---------Sets up the full-size 3D rendering canvas--------*/
#robloxCanvas {
  touch-action: none; /*fuck this, it's a must*/
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  display: block;
}

/* -------Positions and styles the on-screen touch D-pad controls------ */
.touch-dpad {
  position: fixed;
  bottom: 24px;
  left: 24px;
  z-index: 999;
  display: grid;
  grid-template-columns: 52px 52px 52px;
  grid-template-rows: 52px 52px 52px;
  gap: 6px;
  touch-action: none;
  user-select: none;
}

.dpad-btn {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(4px);
  color: #fff;
  font-size: 1.3rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s;
}

.dpad-btn:active,
.dpad-btn.active {
  background: rgba(255, 255, 255, 0.35);
}

/* Cross layout positioning */
.dpad-up {
  grid-column: 2;
  grid-row: 1;
}
.dpad-left {
  grid-column: 1;
  grid-row: 2;
}
.dpad-down {
  grid-column: 2;
  grid-row: 3;
}
.dpad-right {
  grid-column: 3;
  grid-row: 2;
}

/* Hide on desktop (mouse/keyboard users) */
@media (hover: hover) and (pointer: fine) {
  .touch-dpad {
    display: none;
  }
}

/* ------------- buddy character messagebox----------- */
.buddy-message-box {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 998;
  display: none;
  max-width: 280px;
  padding: 18px;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  color: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.4);
  box-shadow:
    0 8px 24px rgba(0, 0, 0, 0.15),
    0 2px 6px rgba(0, 0, 0, 0.1),
    inset 0 0 0 1px rgba(255, 255, 255, 0.3);
  font-family:
    "Gotham SSm",
    system-ui,
    -apple-system,
    "Segoe UI",
    Roboto,
    sans-serif;
  transform: translateY(-50%);
  pointer-events: auto;
  animation: float 3s ease-in-out infinite;
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

@keyframes float {
  0%,
  100% {
    transform: translateY(-52%);
  }
  50% {
    transform: translateY(-48%);
  }
}

.buddy-message-box::after {
  content: "";
  position: absolute;
  left: 24px;
  bottom: -13px;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
  border-top: 12px solid rgba(255, 255, 255, 0.85);
  filter: drop-shadow(0 2px 2px rgba(0, 0, 0, 0.1));
}

.buddy-message-text {
  margin: 0 0 16px;
  line-height: 1.5;
  font-size: 16px;
  font-weight: 500;
  color: #1a1a1a;
  text-shadow: 0 1px 1px rgba(255, 255, 255, 0.6);
}

.buddy-message-link {
  display: inline-block;
  padding: 8px 20px;
  border-radius: 6px;
  background: linear-gradient(135deg, #00a2ff 0%, #0088d6 100%);
  color: #fff;
  text-decoration: none;
  font-size: 14px;
  font-weight: 700;
  transition: all 0.2s ease;
  box-shadow: 0 4px 6px rgba(0, 162, 255, 0.25);
  border: none;
  cursor: pointer;
  text-align: center;
}

.buddy-message-link:hover {
  background: linear-gradient(135deg, #0088d6 0%, #0070b8 100%);
  transform: translateY(-2px);
  box-shadow: 0 6px 8px rgba(0, 162, 255, 0.3);
}

.buddy-message-link:active {
  transform: translateY(0);
  box-shadow: 0 2px 4px rgba(0, 162, 255, 0.25);
}

/* -----Styles the full-screen loading overlay and its animated progress bar ----- */
#buddyLoadingOverlay {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  background: #050508;
}

#buddyLoadingContent {
  width: min(90%, 320px);
  padding: 24px;
  text-align: center;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  backdrop-filter: blur(6px);
}

#buddyLoadingText {
  margin: 0 0 16px;
  font-size: 1rem;
  font-weight: 500;
  color: #d0d0d0;
}

#buddyLoadingBar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

#buddyLoadingBarFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4facfe, #00f2fe);
  border-radius: 999px;
  transition: width 0.2s ease;
}
