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

body {
  font-family: 'Overpass Mono', monospace;
  background: #e8dcc4;
  overflow: hidden;
  color: #3d2817;
}

.game-container {
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
}

.top-bar {
  background: #f5ead8;
  border-bottom: 3px solid #3d2817;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
  z-index: 100;
}

.game-title {
  font-size: 24px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: #3d2817;
}

.stage-info {
  font-size: 14px;
  color: #5d4e37;
}

.canvas-container {
  flex: 1;
  position: relative;
  background: #e8dcc4;
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  cursor: pointer;
}

.unit-info-panel {
  position: absolute;
  top: 20px;
  left: 20px;
  background: rgba(245, 234, 216, 0.95);
  border: 3px solid #3d2817;
  border-radius: 12px;
  padding: 16px;
  min-width: 200px;
  max-width: 250px;
  pointer-events: none;
  z-index: 50;
}

.unit-name {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.unit-hp {
  font-size: 14px;
  margin-bottom: 4px;
}

.hp-bar-bg {
  background: #3d2817;
  height: 8px;
  border-radius: 4px;
  overflow: hidden;
  margin-top: 8px;
}

.hp-bar {
  height: 100%;
  transition: width 0.3s;
}

.blue-hp {
  background: #4a7ba7;
}

.red-hp {
  background: #c85a54;
}

.unit-stats {
  margin-top: 12px;
  font-size: 12px;
  line-height: 1.6;
}

.joystick-container {
  position: absolute;
  bottom: 140px;
  right: 40px;
  width: 140px;
  height: 140px;
  z-index: 60;
  touch-action: none;
  user-select: none;
}

.joystick-base {
  width: 100%;
  height: 100%;
  background: rgba(245, 234, 216, 0.4);
  border: 4px solid rgba(61, 40, 23, 0.6);
  border-radius: 50%;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.joystick-stick {
  width: 50px;
  height: 50px;
  background: #4a7ba7;
  border: 3px solid #3d2817;
  border-radius: 50%;
  position: absolute;
  transition: transform 0.1s ease-out;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  cursor: pointer;
}

.game-log {
  position: absolute;
  bottom: 20px;
  left: 20px;
  right: 200px;
  background: rgba(245, 234, 216, 0.95);
  border: 3px solid #3d2817;
  border-radius: 12px;
  padding: 12px 16px;
  max-height: 120px;
  overflow-y: auto;
  font-size: 12px;
  line-height: 1.8;
  z-index: 50;
}

.log-entry {
  margin-bottom: 4px;
}

.game-over-overlay {
  position: fixed;
  inset: 0;
  background: rgba(61, 40, 23, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.game-over-panel {
  background: #f5ead8;
  border: 4px solid #3d2817;
  border-radius: 16px;
  padding: 40px;
  text-align: center;
  max-width: 400px;
}

.game-over-title {
  font-size: 32px;
  font-weight: 700;
  margin-bottom: 16px;
  letter-spacing: 3px;
}

.winner-text {
  font-size: 24px;
  font-weight: 700;
  margin-bottom: 24px;
  letter-spacing: 2px;
}

.blue-winner {
  color: #4a7ba7;
}

.red-winner {
  color: #c85a54;
}

.restart-btn {
  background: #3d2817;
  color: #f5ead8;
  border: none;
  padding: 14px 32px;
  font-family: 'Overpass Mono', monospace;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  border-radius: 8px;
  transition: all 0.2s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.restart-btn:hover {
  background: #5d4e37;
  transform: translateY(-2px);
}

.footer {
  position: absolute;
  bottom: 8px;
  right: 12px;
  font-size: 11px;
  opacity: 0.6;
  z-index: 60;
}

.footer a {
  color: #3d2817;
  text-decoration: none;
}

.footer a:hover {
  text-decoration: underline;
}

@media (max-width: 768px) {
  .top-bar {
    padding: 10px 12px;
  }

  .game-title {
    font-size: 16px;
  }

  .stage-info {
    font-size: 12px;
  }

  .unit-info-panel {
    top: 12px;
    left: 12px;
    padding: 12px;
    min-width: 160px;
  }

  .joystick-container {
    bottom: 100px;
    right: 20px;
    width: 120px;
    height: 120px;
  }

  .joystick-stick {
    width: 40px;
    height: 40px;
  }

  .game-log {
    bottom: 12px;
    left: 12px;
    right: 160px;
    max-height: 80px;
    font-size: 11px;
  }
}