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

body, html {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #070913;
  color: #ffffff;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

#game-container {
  position: relative;
  width: 100vw;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  background: radial-gradient(circle at 50% 50%, #11152e 0%, #060710 100%);
}

#game-canvas {
  width: 100%;
  height: 100%;
  display: block;
  image-rendering: auto;
}

/* start.ng Profile Card */
.startng-card {
  position: fixed;
  top: 16px;
  left: 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 16px 8px 8px;
  border-radius: 999px;
  background: rgba(20, 24, 42, 0.88);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(0, 243, 255, 0.3);
  color: #fffefa;
  z-index: 100;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 15px rgba(0, 243, 255, 0.2);
  transition: all 0.3s ease;
}

.startng-card img {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #18283f;
  border: 2px solid #00f3ff;
  object-fit: cover;
}

.startng-card b {
  display: block;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.3px;
}

.startng-card span {
  font-size: 11px;
  color: #00f3ff;
  opacity: 0.85;
}

.startng-card button {
  margin-left: 6px;
  border: 0;
  border-radius: 999px;
  padding: 6px 14px;
  background: #d8fd71;
  color: #111;
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
  box-shadow: 0 0 10px rgba(216, 253, 113, 0.4);
  transition: transform 0.15s, background 0.15s;
}

.startng-card button:hover {
  background: #f0ff90;
  transform: scale(1.05);
}

/* HUD Overlay */
#hud {
  position: fixed;
  top: 16px;
  right: 16px;
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 90;
  pointer-events: none;
}

.hud-pill {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: rgba(18, 22, 38, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 20px;
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

.hud-icon {
  font-size: 16px;
}

.hud-val {
  color: #00f3ff;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.5px;
}

.hud-btn {
  pointer-events: auto;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: rgba(18, 22, 38, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
}

.hud-btn:hover {
  background: rgba(30, 38, 66, 0.95);
  border-color: #00f3ff;
  transform: scale(1.08);
}

/* Modal and Screens */
.screen-overlay {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: rgba(6, 8, 16, 0.82);
  backdrop-filter: blur(12px);
  z-index: 120;
  padding: 20px;
  animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
  from { opacity: 0; transform: scale(0.98); }
  to { opacity: 1; transform: scale(1); }
}

.modal-box {
  background: linear-gradient(135deg, rgba(22, 27, 49, 0.95) 0%, rgba(13, 16, 31, 0.95) 100%);
  border: 1px solid rgba(0, 243, 255, 0.35);
  border-radius: 24px;
  padding: 32px;
  max-width: 480px;
  width: 90%;
  text-align: center;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.6), 0 0 30px rgba(0, 243, 255, 0.2);
}

.game-title {
  font-size: 38px;
  font-weight: 900;
  letter-spacing: 2px;
  background: linear-gradient(135deg, #00f3ff 0%, #d8fd71 60%, #ff0077 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 6px;
  text-transform: uppercase;
}

.game-subtitle {
  font-size: 14px;
  color: #a4b3d6;
  margin-bottom: 24px;
  letter-spacing: 0.5px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin: 20px 0;
}

.stat-item {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 12px 6px;
}

.stat-item .stat-title {
  font-size: 11px;
  text-transform: uppercase;
  color: #8391b5;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.stat-item .stat-num {
  font-size: 18px;
  font-weight: 800;
  color: #00f3ff;
}

.btn-primary {
  width: 100%;
  padding: 14px 24px;
  border-radius: 14px;
  border: none;
  background: linear-gradient(135deg, #00f3ff 0%, #00bbff 100%);
  color: #060914;
  font-size: 16px;
  font-weight: 800;
  letter-spacing: 0.8px;
  cursor: pointer;
  margin-top: 14px;
  box-shadow: 0 4px 18px rgba(0, 243, 255, 0.4);
  transition: all 0.2s ease;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 24px rgba(0, 243, 255, 0.6);
  background: linear-gradient(135deg, #33f7ff 0%, #1ac2ff 100%);
}

.btn-secondary {
  width: 100%;
  padding: 12px 20px;
  border-radius: 14px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: rgba(255, 255, 255, 0.05);
  color: #e0e8ff;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 10px;
  transition: all 0.2s ease;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: rgba(255, 255, 255, 0.35);
}

.controls-hint {
  margin-top: 18px;
  font-size: 12px;
  color: #8c9cc0;
  line-height: 1.6;
}

.controls-hint kbd {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  padding: 2px 6px;
  font-size: 11px;
  color: #fff;
}

/* Leaderboard Overlay */
.leaderboard-container {
  max-height: 240px;
  overflow-y: auto;
  margin: 16px 0;
  text-align: left;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(10, 13, 24, 0.6);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.leaderboard-table th {
  position: sticky;
  top: 0;
  background: #141829;
  padding: 8px 12px;
  font-size: 11px;
  text-transform: uppercase;
  color: #7d8ea8;
  letter-spacing: 0.5px;
}

.leaderboard-table td {
  padding: 8px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
}

.leaderboard-table tr.my-rank {
  background: rgba(0, 243, 255, 0.12);
  font-weight: 800;
}

.leaderboard-table tr.my-rank td {
  color: #00f3ff;
}

/* Mobile Touch Controls */
#touch-controls {
  position: fixed;
  bottom: 24px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 80;
  pointer-events: none;
}

.touch-btn {
  pointer-events: auto;
  width: 76px;
  height: 76px;
  border-radius: 50%;
  background: rgba(18, 24, 46, 0.7);
  backdrop-filter: blur(8px);
  border: 2px solid rgba(0, 243, 255, 0.4);
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 12px rgba(0, 243, 255, 0.2);
  touch-action: manipulation;
  user-select: none;
}

.touch-btn:active {
  background: rgba(0, 243, 255, 0.3);
  transform: scale(0.94);
}

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

@media (max-width: 600px) {
  .startng-card {
    top: 10px;
    left: 10px;
    padding: 6px 12px 6px 6px;
    gap: 8px;
  }
  .startng-card img {
    width: 36px;
    height: 36px;
  }
  .startng-card b {
    font-size: 12px;
  }
  .startng-card span {
    font-size: 10px;
  }
  #hud {
    top: 10px;
    right: 10px;
    gap: 8px;
  }
  .hud-pill {
    padding: 6px 10px;
    font-size: 12px;
  }
  .game-title {
    font-size: 28px;
  }
}
