.mobile-controls {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}

.mobile-controls__look {
  position: fixed;
  top: 0;
  right: 0;
  width: 50vw;
  height: 100vh;
  pointer-events: auto;
  touch-action: none;
}

@media (hover: hover) and (pointer: fine) {
  .mobile-controls__look {
    pointer-events: none;
  }
}

.mobile-controls__joystick {
  position: fixed;
  left: 18px;
  bottom: 18px;
  width: 132px;
  height: 132px;
  border: 2px solid rgba(16, 16, 16, 0.9);
  border-radius: 50%;
  background: rgba(255, 254, 248, 0.7);
  box-shadow: 3px 3px 0 rgba(16, 16, 16, 0.14);
  pointer-events: auto;
  touch-action: none;
}

.mobile-controls__stick {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 56px;
  height: 56px;
  border: 2px solid rgba(16, 16, 16, 0.92);
  border-radius: 50%;
  background: rgba(158, 213, 255, 0.88);
  box-shadow: 2px 2px 0 rgba(16, 16, 16, 0.18);
  transform: translate(-50%, -50%);
}

.mobile-controls__action {
  position: fixed;
  right: 18px;
  bottom: 22px;
  min-width: 92px;
  min-height: 92px;
  padding: 0 18px;
  border: 2px solid rgba(16, 16, 16, 0.94);
  border-radius: 999px;
  background: rgba(255, 233, 166, 0.9);
  color: #101010;
  font: 700 18px/1 "Trebuchet MS", "Segoe UI", sans-serif;
  letter-spacing: 0.06em;
  box-shadow: 3px 3px 0 rgba(16, 16, 16, 0.16);
  pointer-events: auto;
  touch-action: manipulation;
}

.mobile-controls__action:active,
.mobile-controls__action.is-active {
  transform: translateY(1px);
  background: rgba(255, 220, 122, 0.95);
}

@media (max-width: 640px) {
  .mobile-controls__joystick {
    width: 118px;
    height: 118px;
  }

  .mobile-controls__stick {
    width: 50px;
    height: 50px;
  }

  .mobile-controls__action {
    min-width: 84px;
    min-height: 84px;
    font-size: 16px;
  }
}

/* UI Overlays */
.game-ui {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 50;
}

.ui-button {
  position: absolute;
  top: 16px;
  min-width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 12px;
  border: 2px solid rgba(16, 16, 16, 0.9);
  border-radius: 8px;
  background: #fff8ca;
  color: #101010;
  font: 700 16px/1 "Trebuchet MS", "Segoe UI", sans-serif;
  cursor: pointer;
  box-shadow: 2px 2px 0 rgba(16, 16, 16, 0.2);
  pointer-events: auto;
  transition: transform 0.1s, box-shadow 0.1s;
}

.ui-button:active {
  transform: translate(2px, 2px);
  box-shadow: 0 0 0 rgba(16, 16, 16, 0.2);
}

.ui-button-left {
  left: 16px;
}

.ui-button-right {
  right: 16px;
}

.ui-popup {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: auto;
  z-index: 100;
}

.ui-popup[hidden] {
  display: none !important;
}

.ui-popup-content {
  background: #f7f4e8;
  border: 2px solid rgba(16, 16, 16, 0.9);
  border-radius: 12px;
  padding: 24px;
  min-width: 300px;
  box-shadow: 4px 4px 0 rgba(16, 16, 16, 0.2);
  text-align: center;
}

.ui-popup-content h2 {
  margin: 0 0 16px 0;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
}

.ui-settings-group {
  display: flex;
  flex-direction: column;
  gap: 16px;
  text-align: left;
  margin: 20px 0;
}

.ui-setting-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  font-family: "Trebuchet MS", "Segoe UI", sans-serif;
  font-weight: bold;
  color: #101010;
  gap: 32px;
}

.ui-switch {
  appearance: none;
  width: 44px;
  height: 24px;
  background: #e2e8f0;
  border-radius: 12px;
  position: relative;
  cursor: pointer;
  outline: none;
  border: 2px solid rgba(16, 16, 16, 0.9);
  transition: background 0.2s;
  margin: 0;
}

.ui-switch::after {
  content: '';
  position: absolute;
  top: 1px;
  left: 1px;
  width: 18px;
  height: 18px;
  background: #fff;
  border-radius: 50%;
  border: 2px solid rgba(16, 16, 16, 0.9);
  box-sizing: border-box;
  transition: left 0.2s;
}

.ui-switch:checked {
  background: #c4f050;
}

.ui-switch:checked::after {
  left: 21px;
}

.ui-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 12px;
  background: #e2e8f0;
  border-radius: 6px;
  outline: none;
  border: 2px solid rgba(16, 16, 16, 0.9);
  margin: 8px 0;
}

.ui-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #c4f050;
  border: 2px solid rgba(16, 16, 16, 0.9);
  cursor: pointer;
  box-shadow: 1px 1px 0 rgba(16, 16, 16, 0.2);
}

.ui-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: #c4f050;
  border: 2px solid rgba(16, 16, 16, 0.9);
  cursor: pointer;
  box-shadow: 1px 1px 0 rgba(16, 16, 16, 0.2);
}
