* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  height: 100%;
  height: 100dvh; /* Dynamic viewport height for mobile */
  overflow: hidden;
}

body {
  font-family: 'Arial', sans-serif;
  background: linear-gradient(135deg, #1a1f3a 0%, #202a51 100%);
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100%;
  min-height: 100dvh;
  color: #202a51;
  overflow: hidden;
  -webkit-overflow-scrolling: touch;
}

#game-container {
  position: relative;
  width: 100%;
  max-width: 400px;
  aspect-ratio: 9 / 16;
  max-height: 95vh;
  margin: 0 auto;
  touch-action: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  user-select: none;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

#gameCanvas {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(180deg, #E0F6FF 100%, #E0F6FF 0%);
  border-radius: 8px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
}

.screen {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: rgba(255, 255, 255, 0.8);
  backdrop-filter: blur(10px);
  padding: 40px;
  border-radius: 8px;
  z-index: 10;
  animation: fadeIn 0.1s ease-out;
}

.screen.hidden {
  display: none;
}

.logo-container {
  margin-bottom: 30px;
}

.logo {
  max-width: 280px;
  height: auto;
}

h1 {
  font-size: 3em;
  margin-bottom: 10px;
  color: #202a51;
}

p {
  font-size: 1.2em;
  margin-bottom: 20px;
  text-align: center;
}

.game-btn {
  background: #fece44;
  color: #202a51;
  border: none;
  padding: 15px 40px;
  font-size: 1.3em;
  font-weight: bold;
  border-radius: 50px;
  cursor: pointer;
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 4px 15px rgba(254, 206, 68, 0.4);
}

.game-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(254, 206, 68, 0.6);
}

.game-btn:active {
  transform: translateY(0);
}

.instructions {
  font-size: 0.9em;
  color: #202a51;
  margin-top: 20px;
}

.website-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 25px;
  padding: 10px 20px;
  background: #202a51;
  color: #fff;
  text-decoration: none;
  border-radius: 25px;
  font-size: 0.95em;
  font-weight: 500;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

.website-link:hover {
  background: #3a4a7a;
  transform: translateY(-2px);
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
}

.website-link:active {
  transform: translateY(0);
}

.link-icon {
  font-size: 1.1em;
}

.score-text {
  font-size: 1.5em;
  margin: 10px 0;
}

.score-text span {
  color: #202a51;
  font-weight: bold;
}

#hud {
  position: absolute;
  top: 20px;
  left: 20px;
  z-index: 5;
}

#hud.hidden {
  display: none;
}

.score {
  background: #fece44;
  padding: 5px 10px;
  border-radius: 10px;
  font-size: 1.1em;
  font-weight: bold;
  color: #000;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
}

.score span {
  color: #000;
}

/* Value popup notification */
.value-popup {
  position: absolute;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: linear-gradient(135deg, #fece44 0%, #d4a800 100%);
  color: #202a51;
  padding: 12px 24px;
  border-radius: 25px;
  font-size: 1.1em;
  font-weight: bold;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  z-index: 15;
  opacity: 0;
  transition: none;
}

.value-popup.hidden {
  display: none;
}

.value-popup.show {
  display: block;
  animation: bounceIn 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55) forwards;
}

.value-popup.hide {
  animation: slideOut 0.3s ease-in forwards;
}

@keyframes bounceIn {
  0% {
    opacity: 0;
    transform: translateX(-50%) translateY(100px);
  }
  50% {
    opacity: 1;
    transform: translateX(-50%) translateY(-10px);
  }
  70% {
    transform: translateX(-50%) translateY(5px);
  }
  100% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
}

@keyframes slideOut {
  0% {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
  }
  100% {
    opacity: 0;
    transform: translateX(-50%) translateY(100px);
  }
}

@media (max-width: 600px) {
  body {
    align-items: flex-start;
  }

  #game-container {
    max-width: 100%;
    width: 100%;
    height: 100%;
    height: 100dvh;
    max-height: 100%;
    max-height: 100dvh;
    margin: 0;
    aspect-ratio: unset;
  }

  #gameCanvas {
    border-radius: 0;
    height: 100%;
    height: 100dvh;
  }

  .screen {
    border-radius: 0;
    padding: 30px;
  }

  h1 {
    font-size: 2.5em;
  }

  .logo {
    max-width: 220px;
  }
}
