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

body {
  overflow: hidden;
  background: #000;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
}

#gameCanvas {
  display: block;
  width: 100vw;
  height: 100vh;
}

.hidden {
  display: none !important;
}

/* Title Screen */
#title-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #87CEEB 0%, #98FB98 50%, #FFE4B5 100%);
  z-index: 100;
}

#title-screen h1 {
  font-size: 4rem;
  color: #2E7D32;
  text-shadow: 3px 3px 0 #fff;
  margin-bottom: 0.5rem;
}

#title-screen p {
  font-size: 1.2rem;
  color: #5D4037;
  margin-bottom: 2rem;
}

#title-screen button {
  padding: 12px 40px;
  font-size: 1.2rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin: 6px;
  font-weight: bold;
  transition: transform 0.1s;
}

#title-screen button:active {
  transform: scale(0.95);
}

#btn-play {
  background: #4CAF50;
  color: #fff;
}

#btn-continue {
  background: #2196F3;
  color: #fff;
}

/* HUD */
#hud {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10;
}

#hud > * {
  pointer-events: auto;
}

#crosshair {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 24px;
  font-weight: bold;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.8);
  pointer-events: none;
}

/* Hotbar */
#hotbar {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  gap: 4px;
  background: rgba(0,0,0,0.5);
  padding: 6px;
  border-radius: 8px;
}

.hotbar-slot {
  width: 48px;
  height: 48px;
  border: 2px solid rgba(255,255,255,0.3);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  cursor: pointer;
}

.hotbar-slot.selected {
  border-color: #FFD700;
  box-shadow: 0 0 8px rgba(255,215,0,0.6);
}

.hotbar-slot .block-preview {
  width: 32px;
  height: 32px;
  border-radius: 4px;
}

.hotbar-slot .count {
  position: absolute;
  bottom: 2px;
  right: 4px;
  color: #fff;
  font-size: 11px;
  font-weight: bold;
  text-shadow: 1px 1px 1px #000;
}

.hotbar-slot .key-hint {
  position: absolute;
  top: 1px;
  left: 4px;
  color: rgba(255,255,255,0.5);
  font-size: 9px;
}

/* XP Bar */
#xp-bar-container {
  position: absolute;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%);
  width: 400px;
  max-width: 80vw;
  height: 14px;
  background: rgba(0,0,0,0.5);
  border-radius: 7px;
  overflow: hidden;
}

#xp-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #7B1FA2, #E040FB);
  border-radius: 7px;
  transition: width 0.3s;
}

#xp-label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  color: #fff;
  font-size: 10px;
  font-weight: bold;
  text-shadow: 1px 1px 1px #000;
}

/* Quest Tracker */
#quest-tracker {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(0,0,0,0.5);
  color: #fff;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 13px;
  max-width: 220px;
}

#quest-tracker .quest-title {
  font-weight: bold;
  color: #FFD700;
  margin-bottom: 4px;
}

#quest-tracker .quest-progress {
  color: #ccc;
}

/* Character Switcher */
#character-switcher {
  position: absolute;
  top: 10px;
  left: 10px;
  display: flex;
  gap: 8px;
}

.char-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 3px solid rgba(255,255,255,0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 16px;
  color: #fff;
  cursor: pointer;
  transition: transform 0.1s;
}

.char-btn[data-char="charlotte"] {
  background: #E91E63;
}

.char-btn[data-char="oscar"] {
  background: #2196F3;
}

.char-btn.active {
  border-color: #FFD700;
  transform: scale(1.15);
}

/* Notification */
#notification {
  position: absolute;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0,0,0,0.7);
  color: #FFD700;
  padding: 12px 24px;
  border-radius: 10px;
  font-size: 1.2rem;
  font-weight: bold;
  opacity: 0;
  transition: opacity 0.3s;
  pointer-events: none;
  text-align: center;
}

#notification.show {
  opacity: 1;
}

/* Pause Screen */
#pause-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.7);
  z-index: 50;
}

#pause-screen h2 {
  color: #fff;
  font-size: 2.5rem;
  margin-bottom: 1.5rem;
}

#pause-screen button {
  padding: 10px 36px;
  font-size: 1.1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin: 6px;
  background: #4CAF50;
  color: #fff;
  font-weight: bold;
}

#pause-screen button:active {
  transform: scale(0.95);
}

/* Touch Controls */
#touch-controls {
  position: fixed;
  inset: 0;
  z-index: 20;
  pointer-events: none;
}

#joystick-zone {
  position: absolute;
  bottom: 20px;
  left: 20px;
  width: 140px;
  height: 140px;
  pointer-events: auto;
}

.touch-btn {
  position: absolute;
  pointer-events: auto;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.2);
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
}

#btn-jump {
  bottom: 40px;
  right: 30px;
  width: 70px;
  height: 70px;
  font-size: 16px;
}

#btn-interact {
  bottom: 120px;
  right: 40px;
}

#btn-switch {
  bottom: 120px;
  right: 110px;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  #title-screen h1 {
    font-size: 2.5rem;
  }

  .hotbar-slot {
    width: 40px;
    height: 40px;
  }

  .hotbar-slot .block-preview {
    width: 26px;
    height: 26px;
  }

  #xp-bar-container {
    bottom: 72px;
  }
}
