/* Tower Blocks — full-screen 3D game */

html, body {
  overflow: hidden;
  height: 100%;
}

/* Float the site header above the Three.js canvas */
.site-header {
  position: relative;
  z-index: 100;
  background: rgba(250, 248, 239, 0.9);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}
body.dark .site-header {
  background: rgba(21, 17, 14, 0.9);
}

/* Full-viewport game layer */
#game-container {
  position: fixed;
  inset: 0;
  z-index: 1;
  font-family: inherit;
}

#game {
  position: absolute;
  inset: 0;
}

/* ── Score ── */
#score {
  position: absolute;
  top: 60px;
  width: 100%;
  text-align: center;
  font-size: clamp(32px, 8vh, 72px);
  font-weight: 700;
  color: #333344;
  pointer-events: none;
  z-index: 10;
  transition: transform 0.5s ease;
  transform: translateY(-220px);
}
body.dark #score { color: #e8e4da; }

#game-container.playing #score,
#game-container.resetting #score { transform: translateY(0); }

#game-container.ended #score { transform: translateY(6vh) scale(1.5); }

/* ── Best ── */
#best {
  position: absolute;
  top: 64px;
  right: 20px;
  font-size: 13px;
  font-weight: 600;
  color: #333344;
  opacity: 0.6;
  pointer-events: none;
  z-index: 10;
}
body.dark #best { color: #e8e4da; }

/* ── Instructions ── */
#instructions {
  position: absolute;
  top: calc(60px + 10vh + 8px);
  width: 100%;
  text-align: center;
  color: #333344;
  font-size: 14px;
  opacity: 0;
  pointer-events: none;
  z-index: 10;
  transition: opacity 0.5s ease;
}
body.dark #instructions { color: #e8e4da; }
#game-container.playing #instructions { opacity: 1; }
#instructions.hide { opacity: 0 !important; }

/* ── Game Over overlay ── */
.game-over {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}
.game-over * {
  opacity: 0;
  transform: translateY(-50px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  color: #333344;
  pointer-events: none;
}
body.dark .game-over * { color: #e8e4da; }
.game-over h2 {
  margin: 0;
  font-size: 40px;
  font-weight: 700;
}
.game-over p {
  margin: 8px 0 0;
  font-size: 16px;
  transition-delay: 0.25s;
}
#game-container.ended .game-over * {
  opacity: 1;
  transform: translateY(0);
}

/* ── Ready screen ── */
.game-ready {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  z-index: 10;
}
#start-button {
  opacity: 0;
  transform: translateY(-50px);
  transition: opacity 0.5s ease, transform 0.5s ease;
  border: 3px solid #333344;
  padding: 12px 32px;
  background: transparent;
  color: #333344;
  font-size: 28px;
  font-weight: 600;
  font-family: inherit;
  border-radius: 10px;
  cursor: pointer;
  pointer-events: auto;
}
body.dark #start-button { color: #e8e4da; border-color: #e8e4da; }
#game-container.ready #start-button {
  opacity: 1;
  transform: translateY(0);
}

/* ========== Reduced motion ========== */
@media (prefers-reduced-motion: reduce) {
  #score, .game-over *, #start-button { transition: none; }
}
