*,
html {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
    "Helvetica Neue", Arial, sans-serif;
  scrollbar-width: none;
  -moz-user-select: none; /* For Firefox */
  -webkit-user-select: none; /* Safari */
  -ms-user-select: none; /* IE 10 and IE 11 */
  user-select: none; /* Standard syntax */
}

body {
  background-color: #eaeaea;
}

.joystick-box {
  margin-top: 16vw;
  width: 100%;
  height: auto;
  padding: 0 16px;
}

#joystick-container {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto;
}

main {
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 8px;
  max-height: 100vh;
  margin: 16px 0;
  gap: 16px;
}

.navbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 16px;
  background-color: #007aff;
  color: #f7f7f7;
  z-index: 5;
}

.hw-info {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  border-radius: 16px;
}

.hw-info h3 {
  grid-column: span 3;
  font-size: 14px;
  margin-left: 4px;
  color: #333;
}

.info-items {
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background-color: #ffffff;
  border-radius: 16px;
  padding: 2px;
  min-height: 50px;
  transition: transform 0.2s ease-in-out;
}

.info-items:hover {
  transform: translateY(-5px);
}

.info-items label {
  font-size: 10px;
  color: #888;
  margin-bottom: 4px;
}

.info-items span {
  font-size: 12px;
  color: #333;
  font-weight: bold;
}

.title {
  font-size: 24px;
  font-weight: bold;
}

.mode-container {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  background-color: #f7f7f7;
  border-radius: 16px;
}

.mode-item {
  background-color: #ffffff;
  padding: 8px;
  border-radius: 12px;
  cursor: pointer;
  text-align: center;
  font-size: 12px;
  transition: background-color 0.3s ease, color 0.3s ease;
  border: transparent;
}

.mode-item:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.mode-item.loading {
  background-color: #d3d3d3;
  color: #999;
}

.mode-item.active {
  background-color: #007aff;
  color: #fff;
}

.open-sidebar-btn {
  background: none;
  border: none;
  color: #f7f7f7;
  font-size: 28px;
  cursor: pointer;
}

.sidebar {
  position: fixed;
  bottom: -100vh;
  width: 100%;
  min-height: 50%;
  background-color: #f0f4f8;
  padding: 16px;
  transition: bottom 0.5s ease;
  z-index: 100;
  box-shadow: 0 0 4px 1px rgba(0, 0, 0, 0.3);
  overflow-y: auto;
}

.sidebar.open {
  bottom: 0;
  background-color: #f7f7f7;
}

.sidebar-btn {
  background-color: #007aff;
  color: white;
  font-size: 16px;
  padding: 12px 8px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.3s ease;
  text-align: center;
}

.sidebar-menu {
  margin: 16px 0;
  display: grid;
  grid-template-columns: repeat(
    auto-fill,
    minmax(100px, 1fr)
  );
  gap: 12px;
}

.sidebar-bottom {
  position: absolute;
  bottom: 16px;
  left: 16px;
  cursor: pointer;
}

.close-sidebar-btn {
  font-size: 32px;
  border: none;
  background-color: transparent;
}

.sidebar-btn {
  background-color: #007aff;
  color: white;
  font-size: 16px;
  padding: 12px 8px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: background-color 0.3s ease, transform 0.3s ease;
  text-align: center;
}

.sidebar-btn:hover {
  background-color: #005bb5;
  transform: translateY(-2px);
}

.sidebar-btn:active {
  background-color: #003d80;
  transform: translateY(0);
}

#loadingOverlay {
  width: 50%;
  height: 100%;
  background-color: #f20267;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10;
  animation: fadeIn 0.5s ease-in-out;
}

#loadingOverlay p {
  font-size: 22px;
  color: white;
}

#error-message {
  color: #f20267;
  display: none;
  margin: 10px;
  font-size: 18px;
  text-align: center;
}

.speed {
  position: absolute;
  bottom: 40px;
  left: 0;
  display: flex;
  flex-direction: row;
  justify-content: space-around;
  justify-content: center;
  align-items: center;
  gap: 16px;
  width: 100%;
}

.turbo-gauge {
  width: 100%;
  height: 30px;
  background: #f7f7f7;
  border-radius: 8px;
  display: flex;
  overflow: hidden;
  position: relative;
  margin-bottom: 10px;
}

.turbo-fill {
  width: 0%;
  height: 100%;
  background: #f7f7f7;
  transition: width 0.5s ease-in-out, background 0.5s ease-in-out;
}

.notification {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background-color: #007aff;
  color: white;
  padding: 10px 20px;
  border-radius: 16px;
  font-size: 16px;
  z-index: 9999;
  animation: fadeIn 0.5s, fadeOut 0.5s 2.5s;
}

.notification.loading {
  background-color: #f0ad4e;
}

.notification.success {
  background-color: #5cb85c;
}

.notification.error {
  background-color: #d9534f;
}


/* Responsive Design */
@media (max-width: 768px) {
  .title {
    font-size: 22px;
  }
}

@media (max-width: 480px) {
  .slider:before {
    height: 22px;
    width: 22px;
  }

  input:checked + .slider:before {
    transform: translateX(22px);
  }

  .title {
    font-size: 20px;
  }

  .close-sidebar-btn {
    margin-bottom: 20px;
  }
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes fadeOut {
  from {
    opacity: 1;
  }
  to {
    opacity: 0;
  }
}
