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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}

body {
  display: flex;
  justify-content: center;
  align-items: center;
  background: radial-gradient(ellipse at center, #0a0010 0%, #000 70%);
}

#display {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  box-shadow:
    0 0 30px rgba(255, 20, 147, 0.25),
    0 0 60px rgba(0, 255, 255, 0.08);
  border: 1px solid rgba(255, 20, 147, 0.25);
}

/* Menu Screen */
#menu-screen {
  display: flex;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 100;
  justify-content: center;
  align-items: center;
  background: radial-gradient(ellipse at center, #0a0018 0%, #000 70%);
}

#menu-content {
  text-align: center;
  max-width: 700px;
  width: 90%;
}

#menu-title {
  font-family: monospace;
  font-size: 48px;
  font-weight: bold;
  color: #ff1493;
  text-shadow:
    0 0 10px #ff1493,
    0 0 30px rgba(255, 20, 147, 0.5),
    0 0 60px rgba(255, 20, 147, 0.25);
  letter-spacing: 6px;
  margin-bottom: 4px;
}

#menu-subtitle {
  font-family: monospace;
  font-size: 16px;
  color: #0ff;
  text-shadow: 0 0 8px rgba(0, 255, 255, 0.6);
  letter-spacing: 4px;
  margin-bottom: 40px;
}

#map-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.map-card {
  width: 100%;
  max-width: 420px;
  padding: 14px 20px;
  background: rgba(10, 0, 20, 0.85);
  border: 1px solid rgba(255, 20, 147, 0.3);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
  text-align: left;
}

.map-card:hover {
  border-color: #0ff;
  box-shadow:
    0 0 12px rgba(0, 255, 255, 0.3),
    inset 0 0 12px rgba(0, 255, 255, 0.05);
}

.map-card-name {
  font-family: monospace;
  font-size: 16px;
  font-weight: bold;
  color: #fff;
  margin-bottom: 2px;
}

.map-card-desc {
  font-family: monospace;
  font-size: 11px;
  color: #888;
}

/* ── Touch Device ── */
body.touch-device {
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

/* ── Touch Controls Container ── */
#touch-controls {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 200;
  pointer-events: none;
}
body.touch-device.touch-playing #touch-controls { display: block; }

/* ── Move Zone (left 40%) ── */
#touch-move-zone {
  position: absolute;
  left: env(safe-area-inset-left, 0px);
  top: 54px;
  width: 40%;
  bottom: 0;
  pointer-events: auto;
}

/* ── Joystick ── */
#touch-move-base {
  display: none;
  position: absolute;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  border: 2px solid rgba(0, 255, 255, 0.4);
  background: rgba(0, 255, 255, 0.06);
  transform: translate(-50%, -50%);
  pointer-events: none;
}
#touch-move-knob {
  position: absolute;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(0, 255, 255, 0.3);
  border: 2px solid rgba(0, 255, 255, 0.7);
  left: 50%; top: 50%;
  transform: translate(-50%, -50%);
}

/* ── Look Zone (right 60%) ── */
#touch-look-zone {
  position: absolute;
  right: env(safe-area-inset-right, 0px);
  top: 54px;
  width: 60%;
  bottom: 80px;
  pointer-events: auto;
}

/* ── Shoot Button ── */
#touch-shoot-btn {
  position: absolute;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(16px + env(safe-area-inset-bottom, 0px));
  width: 70px;
  height: 70px;
  border-radius: 50%;
  border: 2px solid rgba(255, 20, 147, 0.6);
  background: rgba(255, 20, 147, 0.1);
  pointer-events: auto;
  display: flex;
  align-items: center;
  justify-content: center;
}
#touch-shoot-btn::before,
#touch-shoot-btn::after {
  content: '';
  position: absolute;
  background: rgba(255, 20, 147, 0.7);
}
#touch-shoot-btn::before {
  width: 20px; height: 2px;
}
#touch-shoot-btn::after {
  width: 2px; height: 20px;
}
#touch-shoot-btn:active {
  background: rgba(255, 20, 147, 0.3);
  border-color: #ff1493;
}

/* ── ESC Button ── */
#touch-esc-btn {
  display: none;
  position: fixed;
  top: calc(6px + env(safe-area-inset-top, 0px));
  right: calc(6px + env(safe-area-inset-right, 0px));
  width: 44px;
  height: 44px;
  z-index: 210;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(0, 0, 0, 0.4);
  color: #fff;
  font-family: monospace;
  font-size: 20px;
  text-align: center;
  line-height: 44px;
  pointer-events: auto;
  border-radius: 4px;
}
body.touch-device.touch-playing #touch-esc-btn { display: block; }

/* ── Settings Overlay ── */
#settings-overlay {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 300;
  background: rgba(0, 0, 0, 0.85);
  justify-content: center;
  align-items: center;
  flex-direction: column;
}
#settings-overlay.active { display: flex; }

#settings-overlay h2 {
  font-family: monospace;
  font-size: 28px;
  color: #0ff;
  text-shadow: 0 0 12px rgba(0, 255, 255, 0.5);
  margin-bottom: 28px;
  letter-spacing: 4px;
}

#settings-overlay label {
  font-family: monospace;
  font-size: 13px;
  color: #ccc;
  margin-bottom: 8px;
}

#settings-lang-group {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
}

.lang-btn {
  font-family: monospace;
  font-size: 13px;
  padding: 6px 14px;
  border: 1px solid rgba(0, 255, 255, 0.3);
  background: rgba(0, 255, 255, 0.05);
  color: #0ff;
  cursor: pointer;
  letter-spacing: 1px;
}
.lang-btn:active {
  background: rgba(0, 255, 255, 0.2);
}
.lang-btn.active {
  background: rgba(0, 255, 255, 0.2);
  border-color: #0ff;
  box-shadow: 0 0 8px rgba(0, 255, 255, 0.3);
}

#settings-sensitivity {
  -webkit-appearance: none;
  appearance: none;
  width: 200px;
  height: 6px;
  border-radius: 3px;
  background: rgba(255, 255, 255, 0.15);
  outline: none;
  margin-bottom: 28px;
}
#settings-sensitivity::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #0ff;
  cursor: pointer;
}
#settings-sensitivity::-moz-range-thumb {
  width: 18px; height: 18px;
  border-radius: 50%;
  background: #0ff;
  cursor: pointer;
  border: none;
}

.pause-btn {
  font-family: monospace;
  font-size: 15px;
  padding: 10px 36px;
  margin: 6px 0;
  border: 1px solid rgba(0, 255, 255, 0.4);
  background: rgba(0, 255, 255, 0.08);
  color: #0ff;
  cursor: pointer;
  letter-spacing: 2px;
  min-width: 200px;
}
.pause-btn:active {
  background: rgba(0, 255, 255, 0.2);
  border-color: #0ff;
}
.pause-btn.pink {
  border-color: rgba(255, 20, 147, 0.4);
  background: rgba(255, 20, 147, 0.08);
  color: #ff1493;
}
.pause-btn.pink:active {
  background: rgba(255, 20, 147, 0.2);
  border-color: #ff1493;
}

/* ── Rotate Prompt (portrait only on touch) ── */
#rotate-prompt {
  display: none;
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  z-index: 10000;
  background: #000;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  color: #0ff;
  font-family: monospace;
  font-size: 18px;
  text-align: center;
  letter-spacing: 2px;
}
#rotate-prompt span {
  font-size: 48px;
  margin-bottom: 16px;
}

@media (orientation: portrait) {
  body.touch-device #rotate-prompt { display: flex; }
}
