* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #1a2f1a;
  font-family: 'Segoe UI', 'Noto Sans Devanagari', sans-serif;
}

html, body, #game-wrapper {
  width: 100%;
  height: 100%;
}

#game-wrapper {
  position: relative;
  background: linear-gradient(to bottom, #87CEEB 0%, #E0F6FF 42%, #3a9b3a 42%, #1a5c1a 100%);
}

canvas {
  display: block;
  width: 100%;
  height: 100%;
}

#ui-layer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  padding: 10px 14px;
  pointer-events: none;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  z-index: 15;
}

#scoreboard {
  display: flex;
  gap: 8px;
  font-size: 0.95rem;
  color: #fff;
  text-shadow: 1px 1px 3px rgba(0,0,0,0.7);
  flex-wrap: wrap;
}

#scoreboard span {
  background: rgba(0,0,0,0.4);
  padding: 7px 13px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.25);
}

#mute-btn {
  pointer-events: auto;
  background: rgba(0,0,0,0.4);
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 50%;
  width: 40px;
  height: 40px;
  font-size: 1.2rem;
  padding: 0;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
}

#mute-btn:active {
  transform: scale(0.92);
}

.overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.55);
  z-index: 20;
  transition: opacity 0.3s;
}

.overlay.hidden {
  display: none;
}

.panel {
  background: #fffbe7;
  border: 4px solid #d4a017;
  border-radius: 22px;
  padding: 30px 26px;
  text-align: center;
  max-width: 360px;
  width: 88%;
  box-shadow: 0 12px 35px rgba(0,0,0,0.45);
}

.panel h1 {
  font-size: 1.65rem;
  color: #b22222;
  margin-bottom: 12px;
  line-height: 1.3;
}

.panel h2 {
  font-size: 1.55rem;
  color: #b22222;
  margin-bottom: 12px;
}

.panel p {
  font-size: 1rem;
  color: #333;
  line-height: 1.65;
  margin-bottom: 18px;
}

button {
  background: #d62828;
  color: #fff;
  border: none;
  padding: 13px 32px;
  font-size: 1.15rem;
  border-radius: 30px;
  cursor: pointer;
  box-shadow: 0 5px 0 #8b0000;
  transition: transform 0.1s;
  font-weight: bold;
}

button:active {
  transform: translateY(4px);
  box-shadow: 0 0 0 #8b0000;
}

.controls-hint {
  margin-top: 18px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.key {
  font-size: 0.9rem;
  color: #444;
  background: #f3e5ab;
  padding: 7px 10px;
  border-radius: 8px;
}

#touch-controls {
  position: absolute;
  bottom: 14px;
  left: 0;
  width: 100%;
  height: 150px;
  pointer-events: auto;
  z-index: 10;
}

.touch-btn {
  position: absolute;
  width: 72px;
  height: 72px;
  background: rgba(255,255,255,0.32);
  border: 2px solid rgba(255,255,255,0.9);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  color: #fff;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.6);
  touch-action: manipulation;
  flex-direction: column;
  font-weight: bold;
  box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

.touch-btn span {
  font-size: 0.78rem;
  margin-top: 2px;
}

.touch-btn:active {
  background: rgba(255,255,255,0.6);
  transform: scale(0.95);
}

#btn-up    { bottom: 62px; right: 18px; }
#btn-down  { bottom: 0; right: 18px; }
#btn-left  { bottom: 8px; left: 18px; }
#btn-right { bottom: 8px; left: 100px; }

@media (min-width: 600px) {
  #touch-controls { display: none; }
}

@media (max-width: 360px) {
  #scoreboard { font-size: 0.8rem; }
  #scoreboard span { padding: 6px 10px; }
  .panel { padding: 22px 16px; }
  .panel h1 { font-size: 1.4rem; }
  .touch-btn { width: 66px; height: 66px; font-size: 0.8rem; }
  #btn-right { left: 90px; }
}
