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

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #080826;
  font-family: 'Comic Sans MS', 'Trebuchet MS', system-ui, sans-serif;
  color: #fff;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#bg {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  z-index: 0;
}

#menu {
  position: relative;
  z-index: 1;
  height: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding:
    max(2rem, env(safe-area-inset-top))
    max(1.5rem, env(safe-area-inset-right))
    max(1.5rem, env(safe-area-inset-bottom))
    max(1.5rem, env(safe-area-inset-left));
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

header {
  text-align: center;
  margin-bottom: clamp(1.5rem, 4vh, 3rem);
}

header h1 {
  font-size: clamp(2.4rem, 7vw, 5rem);
  color: #ffe6f5;
  text-shadow:
    0 0 20px #ff8fcf,
    0 0 40px rgba(255, 143, 207, 0.6),
    0 0 80px rgba(255, 230, 168, 0.3);
  animation: float 4.5s ease-in-out infinite;
  letter-spacing: 0.02em;
}

header .subtitle {
  margin-top: 0.4rem;
  font-size: clamp(1rem, 2.2vw, 1.4rem);
  color: #ffe6a8;
  opacity: 0.85;
}

.games {
  list-style: none;
  display: grid;
  gap: clamp(1rem, 2.5vw, 1.6rem);
  width: 100%;
  max-width: 1100px;
  grid-template-columns: 1fr;
}

@media (min-width: 600px) {
  .games { grid-template-columns: repeat(2, 1fr); }
}
@media (min-width: 900px) {
  .games { grid-template-columns: repeat(3, 1fr); }
}

.tile {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(160deg, rgba(74, 58, 168, 0.55), rgba(31, 26, 106, 0.7));
  border: 2px solid rgba(255, 230, 168, 0.25);
  border-radius: 1.4rem;
  padding: clamp(1.2rem, 2.5vw, 1.8rem);
  aspect-ratio: 1 / 1;
  overflow: hidden;
  cursor: pointer;
  transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
  box-shadow:
    0 6px 24px rgba(0, 0, 0, 0.35),
    inset 0 0 40px rgba(255, 200, 230, 0.05);
  -webkit-tap-highlight-color: transparent;
}

.tile:not(.locked):hover,
.tile:not(.locked):focus-visible {
  transform: translateY(-6px) scale(1.03);
  border-color: rgba(255, 230, 168, 0.7);
  box-shadow:
    0 12px 32px rgba(255, 143, 207, 0.35),
    inset 0 0 60px rgba(255, 200, 230, 0.1);
  outline: none;
}

.tile:not(.locked):active {
  transform: translateY(-2px) scale(1.01);
}

.tile-glow {
  position: absolute;
  inset: -30%;
  background: radial-gradient(circle at 50% 30%, rgba(255, 230, 168, 0.18), transparent 60%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.4s ease;
}

.tile:not(.locked):hover .tile-glow,
.tile:not(.locked):focus-visible .tile-glow {
  opacity: 1;
}

.tile-icon {
  width: clamp(80px, 18vw, 130px);
  height: clamp(80px, 18vw, 130px);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 0.9rem;
  filter: drop-shadow(0 6px 14px rgba(255, 143, 207, 0.35));
  animation: bob 5s ease-in-out infinite;
}

.tile-icon img {
  width: 100%;
  height: 100%;
  border-radius: 22%;
}

.tile-icon .placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: clamp(2.4rem, 6vw, 4rem);
  font-weight: bold;
  color: rgba(255, 230, 168, 0.4);
  background: rgba(255, 255, 255, 0.04);
  border: 2px dashed rgba(255, 230, 168, 0.25);
  border-radius: 22%;
}

.tile-name {
  font-size: clamp(1.2rem, 2.4vw, 1.7rem);
  font-weight: bold;
  color: #ffe6f5;
  text-align: center;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.4);
}

.tile-tag {
  margin-top: 0.3rem;
  font-size: clamp(0.85rem, 1.6vw, 1rem);
  color: #ffe6a8;
  opacity: 0.8;
  text-align: center;
}

.tile.locked {
  cursor: not-allowed;
  opacity: 0.55;
  background: linear-gradient(160deg, rgba(40, 35, 90, 0.5), rgba(20, 15, 60, 0.6));
}

.tile.locked .tile-icon { animation: none; }

footer {
  margin-top: auto;
  padding-top: 2rem;
  text-align: center;
  color: rgba(255, 230, 168, 0.5);
  font-size: 0.9rem;
}

#install {
  position: fixed;
  bottom: max(1rem, env(safe-area-inset-bottom));
  right: max(1rem, env(safe-area-inset-right));
  background: linear-gradient(135deg, #ff8fcf, #c5a8ff);
  color: white;
  border: none;
  padding: 0.7rem 1.3rem;
  border-radius: 999px;
  font-family: inherit;
  font-size: 1rem;
  font-weight: bold;
  box-shadow: 0 4px 20px rgba(255, 143, 207, 0.4);
  cursor: pointer;
  z-index: 10;
  transition: transform 0.2s;
  -webkit-tap-highlight-color: transparent;
}

#install:hover { transform: scale(1.05); }
#install:active { transform: scale(0.96); }

@keyframes float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes bob {
  0%, 100% { transform: translateY(0) rotate(-2deg); }
  50% { transform: translateY(-6px) rotate(2deg); }
}
