* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(circle at 20% 20%, #101622, #080a0f);
  color: #e8f0ff;
  font-family: "Segoe UI", Tahoma, sans-serif;
  overflow: hidden;
}

#game {
  display: block;
  margin: 0 auto;
  border: 2px solid #24304b;
  background: linear-gradient(180deg, #0f1522 0%, #0b101a 100%);
}

#ui {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  pointer-events: none;
}

#touch-toggle {
  position: fixed;
  right: 12px;
  bottom: 12px;
  z-index: 3;
  background: rgba(26, 38, 58, 0.8);
  border: 1px solid #2f3e5a;
  color: #d7e4ff;
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
  pointer-events: auto;
  font-size: 13px;
}

#hud {
  display: flex;
  gap: 12px;
  padding: 10px 14px;
  background: rgba(5, 7, 12, 0.65);
  border-bottom: 1px solid #1f2b44;
  box-shadow: 0 6px 16px rgba(0, 0, 0, 0.35);
}

.hud-item {
  padding: 6px 10px;
  background: rgba(26, 38, 58, 0.7);
  border: 1px solid #2f3e5a;
  border-radius: 6px;
  font-size: 14px;
  pointer-events: none;
}

.hud-button {
  pointer-events: auto;
  padding: 6px 10px;
  background: rgba(26, 38, 58, 0.9);
  color: #eaf2ff;
  border: 1px solid #2f3e5a;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
}

.hud-button:hover {
  filter: brightness(1.05);
}

#messages {
  position: fixed;
  right: 16px;
  top: 160px;
  width: 280px;
  min-height: 32px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.msg {
  background: rgba(17, 27, 42, 0.92);
  border: 1px solid #274164;
  padding: 8px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: #d7e4ff;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
}

#overlay {
  position: fixed;
  inset: 0;
  background: rgba(6, 8, 12, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
}

.panel {
  width: min(780px, 90vw);
  background: linear-gradient(145deg, #0f1726 0%, #0b101a 100%);
  border: 1px solid #243351;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
}

.panel h1 {
  margin-top: 0;
  letter-spacing: 1px;
}

.panel h3 {
  margin-bottom: 6px;
}

.panel ul {
  padding-left: 16px;
  margin-top: 6px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 18px;
}

#start-btn {
  margin-top: 16px;
  background: linear-gradient(90deg, #2aa3ff, #7a4dff);
  color: #f6fbff;
  border: none;
  padding: 12px 18px;
  border-radius: 8px;
  font-size: 15px;
  cursor: pointer;
  box-shadow: 0 10px 20px rgba(0, 0, 0, 0.35);
}

#start-btn:hover {
  filter: brightness(1.05);
}

#start-btn:active {
  transform: translateY(1px);
}

#touch-pad {
  position: fixed;
  bottom: 70px;
  right: 16px;
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 3;
  pointer-events: auto;
}

#touch-pad .pad-row {
  display: flex;
  gap: 4px;
  justify-content: center;
}

#touch-pad button {
  width: 56px;
  height: 56px;
  background: rgba(26, 38, 58, 0.9);
  border: 1px solid #2f3e5a;
  color: #eaf2ff;
  border-radius: 10px;
  font-size: 18px;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.35);
}
