body {
  margin: 0;
  background: #111;
  color: #fff;
  font-family: 'Press Start 2P', monospace, Arial, sans-serif !important;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  position: relative;
  padding-top: 0;
}

canvas {
  display: block;
  margin: auto;
  width: 100vw;
  height: 100vh;
  max-width: 100vw;
  max-height: 100vh;
  box-sizing: border-box;
  background: #000;
}

html, body {
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: clip;
}

#branding-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  width: 100vw;
  height: 64px;
  background: #181818ee;
  color: #fff;
  display: flex;
  align-items: center;
  z-index: 100;
  box-shadow: 0 2px 12px #000a;
  padding: 0 32px;
  font-family: 'Press Start 2P', monospace, Arial, sans-serif;
}

#branding-logo {
  height: 48px;
  width: auto;
  margin-right: 24px;
  background: #222;
  border-radius: 8px;
  padding: 4px 8px;
  max-width: 180px;
  max-height: 48px;
  object-fit: contain;
}

#branding-title {
  font-size: 1.2em;
  font-weight: bold;
  letter-spacing: 2px;
  margin-right: 32px;
  white-space: nowrap;
}

#branding-menu {
  display: flex;
  gap: 24px;
  margin-left: auto;
}

#branding-menu a {
  color: #ffeb3b;
  text-decoration: none;
  font-size: 1em;
  opacity: 0.85;
  transition: opacity 0.2s;
  pointer-events: none; /* Demo only, remove to enable menu */
}

#branding-menu a:hover {
  opacity: 1;
}

/* Responsive and centered Canvas layout */
#game-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100vw;
  height: 100vh;
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  margin: 0;
  z-index: 1;
  background: #111;
}
#gameCanvas {
  display: block;
  max-width: 96vw;
  max-height: 92vh;
  width: 100%;
  height: auto;
  margin: 0 auto;
  background: #000;
  border-radius: 16px;
  box-shadow: 0 0 24px #000a;
}

#leaderboard {
  position: fixed;
  top: 32px;
  right: 48px;
  background: rgba(0, 0, 0, 0.8);
  padding: 28px 28px 20px 28px;
  border-radius: 14px;
  min-width: 260px;
  font-size: 1.25em;
  z-index: 20;
  box-shadow: 0 4px 24px #000a;
}

#leaderboard h2 {
  font-size: 1.3em;
  margin-bottom: 1em;
}

#leaderboard div {
  font-size: 1.1em;
  margin-bottom: 0.5em;
}

#qr-container {
  position: fixed;
  bottom: 48px;
  left: 48px;
  background: rgba(0, 0, 0, 0.8);
  padding: 20px 20px 12px 20px;
  border-radius: 12px;
  text-align: center;
  z-index: 10;
  max-width: 20vw;
  box-shadow: 0 4px 24px #000a;
  pointer-events: none;
  opacity: 0.92;
}

#qr-container div {
  font-size: 1.1em;
  margin-top: 10px;
}

#qr {
  display: block;
  margin: 0 auto;
  width: 14vw !important;
  height: 14vw !important;
  max-width: 180px;
  max-height: 180px;
  min-width: 100px;
  min-height: 100px;
  pointer-events: none;
  overflow: hidden;
  position: relative;
}
#qr canvas {
  width: 100% !important;
  height: 100% !important;
  display: block;
  margin: 0 auto;
}

#fullscreen-leaderboard {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0,0,0,0.96);
  z-index: 9999;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-family: 'Press Start 2P', monospace, Arial, sans-serif;
}
#fullscreen-leaderboard-content {
  color: #ffeb3b;
  text-align: center;
  font-size: 2.2vw;
  max-width: 90vw;
  background: rgba(20,20,20,0.98);
  border-radius: 24px;
  padding: 2.5em 2em 2em 2em;
  box-shadow: 0 8px 48px #000a;
}
#fullscreen-leaderboard-content h1 {
  color: #fff;
  font-size: 2.5em;
  margin-bottom: 1.2em;
}
#fullscreen-leaderboard-content .score-row {
  font-size: 1.5em;
  margin: 0.7em 0;
  display: flex;
  justify-content: center;
  gap: 2em;
}
#fullscreen-leaderboard-content .player-name {
  color: #fff;
  margin-right: 1.5em;
}
#fullscreen-leaderboard-content .player-score {
  color: #ffeb3b;
  font-weight: bold;
}

/* Pacman HTML/CSS grid-based visuals */
#maze {
  display: grid;
  justify-content: center;
  align-content: center;
  width: 90vw;
  height: 50vw;
  margin: 0 auto;
  background: #000;
  box-shadow: 0 0 24px #000a;
  border-radius: 16px;
  overflow: clip;
}
.maze-cell {
  width: 2vw;
  height: 2vw;
  min-width: 18px;
  min-height: 18px;
  max-width: 40px;
  max-height: 40px;
  box-sizing: border-box;
  position: relative;
  background: #111;
}
.wall {
  background: #444;
  border-radius: 6px;
}
.dot {
  background: #111;
}
.dot::after {
  content: '';
  display: block;
  width: 8px;
  height: 8px;
  background: #fff;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.power::after {
  content: '';
  display: block;
  width: 16px;
  height: 16px;
  background: #0ff;
  border-radius: 50%;
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px #0ffb;
}
.maze-cell.power {
  position: relative;
}
.maze-cell.power::after {
  content: '';
  display: block;
  position: absolute;
  left: 50%; top: 50%;
  width: 16px; height: 16px;
  background: #ff0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px 2px #ff0;
}

/* Custom power pellet styling */
.maze-cell.power-custom {
  position: relative;
}
.custom-power-pellet {
  animation: pulse 1.5s infinite alternate;
  filter: drop-shadow(0 0 5px rgba(255, 255, 0, 0.7));
}

@keyframes pulse {
  0% { transform: translate(-50%, -50%) scale(0.85); }
  100% { transform: translate(-50%, -50%) scale(1.15); }
}
.pacman {
  width: 80%;
  height: 80%;
  border-radius: 50%;
  position: absolute;
  top: 10%;
  left: 10%;
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1em;
  color: #111;
  font-weight: bold;
  box-shadow: 0 0 8px #fff8;
}
.pacman span {
  font-size: 0.9em;
  color: #111;
}
.ghost {
  width: 80%;
  height: 80%;
  border-radius: 40% 40% 50% 50%/50% 50% 60% 60%;
  position: absolute;
  top: 10%;
  left: 10%;
  z-index: 2;
  border: 2px solid #fff3;
  box-shadow: 0 0 8px #fff8;
}
#maze-timer {
  font-family: 'Press Start 2P', monospace, Arial, sans-serif;
  font-size: 1.2em;
  margin-bottom: 0.5em;
}
