* { box-sizing: border-box; margin: 0; padding: 0; }
html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #0f0c1b;
  color: #fff;
  font-family: Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  user-select: none;
  -webkit-user-select: none;
  touch-action: manipulation;
}

body {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.game-container {
  position: relative;
  width: 100%;
  max-width: 600px;
  height: 100%;
  max-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 10px;
}

/* Header bar inside game */
.game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 14px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 14px;
  margin-bottom: 8px;
  flex-shrink: 0;
}

.game-title-group {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.game-title-icon {
  font-size: 22px;
  line-height: 1;
}

.game-title-text {
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 200px;
}

.game-stats {
  display: flex;
  align-items: center;
  gap: 12px;
}

.stat-item {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
}

.stat-label {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #9f9ab2;
}

.stat-value {
  font-size: 15px;
  font-weight: 900;
  color: #ffd154;
  font-variant-numeric: tabular-nums;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 14px;
  transition: background 0.2s;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* Play canvas arena */
.canvas-wrapper {
  position: relative;
  flex: 1;
  width: 100%;
  min-height: 0;
  background: #181427;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

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

/* Overlays (Start, Game Over, Pause) */
.arcade-overlay {
  position: absolute;
  inset: 0;
  z-index: 10;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(14, 11, 25, 0.88);
  backdrop-filter: blur(8px);
  text-align: center;
  transition: opacity 0.25s, visibility 0.25s;
}

.arcade-overlay[hidden] {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.overlay-icon {
  font-size: 56px;
  margin-bottom: 12px;
  filter: drop-shadow(0 8px 16px rgba(0, 0, 0, 0.4));
  animation: floatIcon 2s ease-in-out infinite alternate;
}

@keyframes floatIcon {
  from { transform: translateY(0); }
  to { transform: translateY(-8px); }
}

.overlay-title {
  font-size: 24px;
  font-weight: 900;
  margin-bottom: 8px;
  line-height: 1.2;
}

.overlay-desc {
  font-size: 13px;
  color: #bbb5cd;
  max-width: 320px;
  line-height: 1.5;
  margin-bottom: 20px;
}

.overlay-score-box {
  display: flex;
  gap: 20px;
  margin-bottom: 20px;
  padding: 10px 20px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

.score-box-col {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-box-col span:first-child {
  font-size: 10px;
  color: #8f8a9e;
  text-transform: uppercase;
}

.score-box-col span:last-child {
  font-size: 20px;
  font-weight: 900;
  color: #ffca36;
}

.play-button {
  padding: 12px 32px;
  font-size: 15px;
  font-weight: 900;
  color: #fff;
  background: var(--game-accent, #7057ff);
  border: none;
  border-radius: 14px;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(112, 87, 255, 0.4);
  transition: transform 0.15s, box-shadow 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.play-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(112, 87, 255, 0.5);
}

.play-button:active {
  transform: translateY(1px);
}

.controls-hint {
  margin-top: 14px;
  font-size: 11px;
  color: #7b758c;
}

/* Touch controls for mobile */
.touch-controls {
  display: none;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding-top: 8px;
  flex-shrink: 0;
  width: 100%;
}

.touch-dpad {
  display: grid;
  grid-template-columns: repeat(3, 46px);
  grid-template-rows: repeat(2, 42px);
  gap: 4px;
}

.dpad-btn, .action-touch-btn {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #fff;
  border-radius: 10px;
  font-size: 18px;
  font-weight: 900;
  display: grid;
  place-items: center;
  cursor: pointer;
  touch-action: manipulation;
  user-select: none;
}

.dpad-btn:active, .action-touch-btn:active {
  background: var(--game-accent, #7057ff);
  border-color: #fff;
}

.touch-actions {
  display: flex;
  gap: 8px;
}

.action-touch-btn {
  width: 58px;
  height: 58px;
  border-radius: 16px;
  font-size: 20px;
}

@media (max-width: 600px), (pointer: coarse) {
  .touch-controls.show-touch {
    display: flex;
  }
}
