
html,
body
{
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden;
  font-family: sans-serif;
}

#gameContainer
{
  position: relative;
  width: 100%;
  height: 100%;
}

canvas
{
  position: absolute;
  top: 0;
  left: 0;
  display: block;
}

#overlayCanvas
{
  pointer-events: none;
  z-index: 3;
}

#gameCanvas
{
  z-index: 1;
}

#popupMessage
{
  position: absolute;
  z-index: 4;
  max-width: 300px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(255, 255, 255, 0.9);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 18px;
  font-weight: bold;
  display: none;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.3);
  word-wrap: break-word;
  white-space: normal;
}

@media (max-width: 400px)
{
  #popupMessage
  {
    max-width: 90vw;
    font-size: 16px;
  }
}

#orientationMessage {
  position: fixed;        /* fixed to viewport, not container */
  top: 0;
  left: 0;
  width: 100vw;           /* viewport width */
  height: 100vh;          /* viewport height */
  background: rgba(0,0,0,0.95);
  color: white;
  display: none;
  justify-content: center;
  align-items: center;
  text-align: center;
  font-size: 40px;        /* fixed base size */
  line-height: 1.4;
  font-weight: bold;
  z-index: 9999;
  padding: 40px;
  box-sizing: border-box;
}

@media (max-width: 600px) {
  #orientationMessage {
    font-size: 48px;      /* even bigger on phones */
    padding: 50px;
  }
}

#loadingScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #000;
  color: #fff;
  display: flex;
  justify-content: center;   /* center horizontally */
  align-items: center;       /* center vertically */
  z-index: 10000;
}

.loadingContent {
  display: flex;
  flex-direction: column;    /* stack spinner above text */
  align-items: center;
  text-align: center;
}

.spinner {
  border: 8px solid #444;
  border-top: 8px solid #fff;
  border-radius: 50%;
  width: 80px;
  height: 80px;
  margin-bottom: 20px;
  animation: spin 1.5s linear infinite;
}

#loadingScreen p {
  font-size: 20px;
  font-weight: bold;
}

@keyframes spin {
  0%   { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

#congrats
{
  position: absolute;
  z-index: 5;
  top: 30%;
  left: 50%;
  transform: translateX(-50%);
  background: white;
  padding: 20px 40px;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  text-align: center;
  display: none;
}

#timer
{
  display: none; /* hidden by request */
  position: absolute;
  top: 10px;
  left: 10px;
  z-index: 4;
  background: rgba(255, 255, 255, 0.7);
  padding: 6px 12px;
  border-radius: 5px;
  font-weight: bold;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

#leaderboard
{
  position: absolute;
  top: 10px;
  right: 10px;
  z-index: 4;
  background: rgba(255, 255, 255, 0.8);
  padding: 10px 15px;
  border-radius: 8px;
  font-size: 14px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.2);
}

#leaderboard h3
{
  margin: 0 0 5px;
  font-size: 16px;
  text-align: center;
}

#leaderboardList
{
  list-style: decimal inside;
  padding: 0;
  margin: 0;
}

#initialsPopup
{
  display: none;
  position: absolute;
  z-index: 6;
  top: 35%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 20px 30px;
  border-radius: 10px;
  box-shadow: 0 0 20px rgba(0, 0, 0, 0.2);
  text-align: center;
}

#initialsPopup input
{
  font-size: 20px;
  padding: 5px 10px;
  text-transform: uppercase;
  width: 100px;
  text-align: center;
}

#initialsPopup button
{
  font-size: 16px;
  padding: 6px 14px;
  margin-top: 10px;
}