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

body {
  background: #0a0a12;
  overflow: hidden;
  font-family: 'Courier New', monospace;
  user-select: none;
  -webkit-user-select: none;
  touch-action: none;
}

#game-wrapper {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100vh;
  width: 100vw;
  background: radial-gradient(ellipse at center, #1a0a2e 0%, #0a0a12 70%);
}

#hud {
  display: flex;
  gap: 20px;
  padding: 8px 16px;
  background: linear-gradient(180deg, #2a1a3e 0%, #1a0a2e 100%);
  border: 2px solid #ff4444;
  border-top: none;
  border-radius: 0 0 12px 12px;
  color: #fff;
  font-size: 14px;
  font-weight: bold;
  z-index: 10;
  box-shadow: 0 4px 15px rgba(255, 68, 68, 0.3);
}

.hud-item {
  text-shadow: 1px 1px 2px #000;
  white-space: nowrap;
}

#gameCanvas {
  display: block;
  background: #0a0a12;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  border: 3px solid #ff4444;
  border-radius: 4px;
  box-shadow: 0 0 30px rgba(255, 68, 68, 0.3), inset 0 0 60px rgba(0, 0, 0, 0.5);
  max-width: 95vw;
  max-height: 75vh;
}

/* Start Screen */
#start-screen, #game-over-screen {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  background: rgba(10, 10, 18, 0.95);
  animation: fadeIn 0.5s ease;
}

#start-screen.hidden, #game-over-screen.hidden {
  display: none;
}

.start-content {
  text-align: center;
  color: #fff;
  max-width: 500px;
  padding: 20px;
}

.start-content h1 {
  font-size: 3rem;
  color: #ff4444;
  text-shadow: 3px 3px 0px #880000, 0 0 20px rgba(255, 68, 68, 0.5);
  margin-bottom: 5px;
}

.start-content h2 {
  font-size: 1.5rem;
  color: #ffaa00;
  text-shadow: 2px 2px 0px #664400;
  margin-bottom: 20px;
}

.castle-art {
  font-size: 5rem;
  margin: 20px 0;
  animation: float 2s ease-in-out infinite;
}

.start-content p {
  font-size: 1rem;
  color: #ccc;
  margin-bottom: 20px;
  line-height: 1.6;
}

.controls-info {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  padding: 15px;
  margin-bottom: 25px;
}

.controls-info div {
  padding: 4px 0;
  font-size: 0.9rem;
  color: #aaa;
}

button {
  background: linear-gradient(180deg, #ff4444 0%, #cc0000 100%);
  color: #fff;
  border: 3px solid #ff6666;
  border-radius: 12px;
  padding: 15px 40px;
  font-size: 1.3rem;
  font-weight: bold;
  font-family: 'Courier New', monospace;
  cursor: pointer;
  text-shadow: 2px 2px 0px #880000;
  box-shadow: 0 4px 15px rgba(255, 0, 0, 0.3);
  transition: transform 0.1s, box-shadow 0.1s;
}

button:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 25px rgba(255, 0, 0, 0.5);
}

button:active {
  transform: scale(0.95);
}

/* Mobile controls */
#mobile-controls {
  display: none;
  position: fixed;
  bottom: 10px;
  left: 10px;
  right: 10px;
  justify-content: space-between;
  z-index: 50;
  pointer-events: none;
}

.ctrl-group {
  display: flex;
  gap: 10px;
  pointer-events: auto;
}

.ctrl-btn {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  font-size: 1.8rem;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.15);
  border: 2px solid rgba(255, 255, 255, 0.3);
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.jump-btn {
  width: 80px;
  height: 80px;
  font-size: 2.2rem;
  background: rgba(255, 68, 68, 0.3);
  border-color: rgba(255, 68, 68, 0.5);
}

.fire-btn {
  width: 56px;
  height: 56px;
  font-size: 1.5rem;
  background: rgba(255, 170, 0, 0.3);
  border-color: rgba(255, 170, 0, 0.5);
}

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

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

@media (max-width: 768px) {
  #mobile-controls {
    display: flex;
  }
  
  .hud-item {
    font-size: 11px;
  }
  
  #hud {
    gap: 10px;
    padding: 6px 10px;
    flex-wrap: wrap;
    justify-content: center;
  }
}

@media (hover: none) and (pointer: coarse) {
  #mobile-controls {
    display: flex;
  }
}
