:root {
  --bg-primary: #0a0b0d;
  --bg-card: #13161c;
  --bg-darker: #050608;
  --color-orange: #ff6600;
  --color-orange-glow: rgba(255, 102, 0, 0.4);
  --color-green: #10b981;
  --color-red: #ef4444;
  --color-yellow: #fbbf24;
  --color-blue: #38bdf8;
  --border-tactical: #272b36;
  --text-muted: #94a3b8;
  --text-bright: #f8fafc;
}

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

body {
  background-color: var(--bg-primary);
  color: var(--text-bright);
  font-family: 'Share Tech Mono', monospace;
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  background-image: 
    radial-gradient(circle at 50% 20%, rgba(255, 102, 0, 0.08) 0%, transparent 60%),
    linear-gradient(rgba(19, 22, 28, 0.7) 1px, transparent 1px),
    linear-gradient(90deg, rgba(19, 22, 28, 0.7) 1px, transparent 1px);
  background-size: 100% 100%, 20px 20px, 20px 20px;
}

.screen-container {
  width: 100%;
  max-width: 520px;
  padding: 12px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

/* HUD Header */
.hud-header {
  width: 100%;
  background: var(--bg-card);
  border: 1px solid var(--border-tactical);
  border-left: 4px solid var(--color-orange);
  padding: 10px 14px;
  border-radius: 4px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.5);
}

.hud-tag {
  font-size: 10px;
  color: var(--color-orange);
  letter-spacing: 2px;
  font-weight: bold;
}

.hud-title {
  font-family: 'Teko', sans-serif;
  font-size: 28px;
  letter-spacing: 1px;
  line-height: 1;
  color: #fff;
  text-shadow: 0 0 10px var(--color-orange-glow);
}

.hud-stats {
  display: grid;
  grid-template-columns: 1.2fr 1fr 0.8fr;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed var(--border-tactical);
}

.stat-box {
  display: flex;
  flex-direction: column;
}

.stat-label {
  font-size: 10px;
  color: var(--text-muted);
}

.stat-value {
  font-size: 16px;
  font-weight: bold;
}

.text-accent {
  color: var(--color-orange);
}

.lives-container {
  display: flex;
  gap: 4px;
  color: var(--color-red);
  font-size: 16px;
}

/* Canvas Wrapper */
.game-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  justify-content: center;
}

.canvas-border {
  position: relative;
  background: #000;
  border: 2px solid var(--color-orange);
  box-shadow: 0 0 20px rgba(255, 102, 0, 0.25), inset 0 0 15px rgba(0, 0, 0, 0.8);
  border-radius: 6px;
  overflow: hidden;
}

canvas {
  display: block;
  image-rendering: pixelated;
  max-width: 100%;
  height: auto;
}

/* Overlay Card */
.game-overlay {
  position: absolute;
  inset: 0;
  background: rgba(10, 11, 13, 0.88);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
}

.game-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.overlay-card {
  background: var(--bg-card);
  border: 1px solid var(--color-orange);
  padding: 20px;
  border-radius: 6px;
  text-align: center;
  max-width: 360px;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.8);
}

.overlay-title {
  font-family: 'Teko', sans-serif;
  font-size: 32px;
  color: var(--color-orange);
  letter-spacing: 1px;
}

.overlay-desc {
  font-size: 13px;
  color: var(--text-muted);
  margin: 10px 0 18px 0;
  line-height: 1.4;
}

/* Reward Box */
.reward-box {
  background: var(--bg-darker);
  border: 1px dashed var(--color-green);
  padding: 12px;
  margin-bottom: 16px;
  border-radius: 4px;
}

.reward-box.hidden {
  display: none;
}

.reward-tag {
  font-size: 11px;
  color: var(--color-green);
  font-weight: bold;
  letter-spacing: 1px;
  display: block;
  margin-bottom: 6px;
}

.code-wrapper {
  display: flex;
  gap: 6px;
}

.code-wrapper input {
  flex: 1;
  background: #111;
  border: 1px solid #333;
  color: #fff;
  padding: 6px 8px;
  font-family: monospace;
  font-size: 13px;
  text-align: center;
  border-radius: 3px;
}

.reward-hint {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 8px;
}

.reward-hint code {
  color: var(--color-orange);
  background: #1a1a1a;
  padding: 2px 4px;
  border-radius: 2px;
}

/* Buttons */
.hud-btn-main {
  width: 100%;
  background: var(--color-orange);
  color: #000;
  border: none;
  font-family: 'Teko', sans-serif;
  font-size: 24px;
  font-weight: bold;
  letter-spacing: 1px;
  padding: 8px 16px;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 4px 12px var(--color-orange-glow);
  transition: transform 0.1s, filter 0.1s;
}

.hud-btn-main:active {
  transform: scale(0.98);
}

.hud-btn-sm {
  background: #222;
  color: #fff;
  border: 1px solid #444;
  padding: 0 10px;
  font-size: 12px;
  cursor: pointer;
  border-radius: 3px;
}

.hud-btn-alt {
  background: transparent;
  border: 1px solid var(--border-tactical);
  color: var(--text-muted);
  font-size: 11px;
  padding: 4px 8px;
  border-radius: 3px;
  cursor: pointer;
}

/* Mobile Virtual D-Pad */
.mobile-controls {
  width: 100%;
  display: flex;
  justify-content: center;
  margin-top: 6px;
}

.dpad-grid {
  display: grid;
  grid-template-columns: repeat(3, 56px);
  grid-template-rows: repeat(3, 56px);
  gap: 6px;
}

.dpad-btn {
  background: var(--bg-card);
  border: 1px solid var(--border-tactical);
  color: var(--color-orange);
  font-size: 20px;
  display: flex;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  cursor: pointer;
  touch-action: none;
}

.dpad-btn:active {
  background: var(--color-orange);
  color: #000;
}

.dpad-center {
  background: var(--bg-darker);
  border-radius: 8px;
  opacity: 0.3;
}

/* Footer */
.hud-footer {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px;
}

@media (min-width: 768px) {
  .mobile-controls {
    display: none; /* Hide on desktop */
  }
}
