* {
  box-sizing: border-box;
  /* sem seleção de texto / destaque de toque: toques rápidos no jogo
     não devem acionar o overlay de seleção do navegador */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-tap-highlight-color: transparent;
}

html, body { height: 100%; }

body {
  margin: 0;
  background: #06080f;
  font-family: -apple-system, system-ui, "Segoe UI", Roboto, sans-serif;
  color: #e8ecf6;
  touch-action: manipulation;
  display: flex;
}

/* celular: tela cheia; desktop: coluna retrato centralizada */
.wrap {
  position: relative;
  width: 100%;
  height: 100dvh;
  display: flex;
  flex-direction: column;
}
@media (min-width: 700px) {
  body { align-items: center; justify-content: center; }
  .wrap {
    width: min(430px, 100vw);
    height: min(100dvh, 932px);
    border-radius: 24px;
    overflow: hidden;
    border: 1px solid #232e4a;
    box-shadow: 0 24px 70px rgba(0, 0, 0, 0.6);
  }
}

.stage {
  position: relative;
  flex: 1;
  overflow: hidden;
  touch-action: none;
  cursor: pointer;
  background: #0b101d;
}

canvas {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  display: block;
}

.hud {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 2;
  display: flex;
  justify-content: space-between;
  padding: calc(12px + env(safe-area-inset-top)) 18px 0;
  font-weight: 700;
  font-size: 17px;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.8);
  pointer-events: none;
}
.hud .record {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.25;
}
.hud .record-label {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.65;
}

.lives { margin-left: 10px; }

.hud-right {
  display: flex;
  align-items: center;
  gap: 10px;
}

.mute {
  pointer-events: auto;
  width: 36px;
  height: 36px;
  font-size: 16px;
  line-height: 1;
  color: #fff;
  background: rgba(13, 18, 32, 0.55);
  border: 1px solid #2a3550;
  border-radius: 999px;
  cursor: pointer;
}
.mute:active { transform: translateY(1px); }

/* vinheta cinematográfica por cima do 3D */
.stage::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 40%, transparent 52%, rgba(0, 0, 0, 0.45));
}

.floater {
  position: absolute;
  z-index: 2;
  transform: translate(-50%, -50%);
  color: #ffce54;
  font-weight: 800;
  font-size: 17px;
  text-shadow: 0 1px 8px rgba(255, 140, 0, 0.65);
  pointer-events: none;
  animation: floatUp 0.8s ease-out forwards;
}
@keyframes floatUp {
  from { opacity: 1; margin-top: 0; }
  to { opacity: 0; margin-top: -52px; }
}

.overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  text-align: center;
  padding: 24px calc(20px + env(safe-area-inset-left)) calc(24px + env(safe-area-inset-bottom));
  background: rgba(8, 11, 20, 0.74);
  backdrop-filter: blur(4px);
}
.overlay.visible { display: flex; }

.overlay h1 {
  margin: 0 0 4px;
  font-size: clamp(30px, 9vw, 44px);
  letter-spacing: -0.5px;
}
.overlay h1 .accent { color: #ff8c1a; }
.overlay p { margin: 2px 0; line-height: 1.5; }
.overlay .big { font-size: 19px; }
.overlay .small { font-size: 14px; opacity: 0.7; }

.btn {
  margin-top: 10px;
  font-size: 18px;
  font-weight: 700;
  color: #1a0f05;
  background: linear-gradient(180deg, #ffb347, #ff7a1a);
  border: none;
  border-radius: 999px;
  padding: 15px 44px;
  cursor: pointer;
  box-shadow: 0 6px 20px rgba(255, 122, 26, 0.4);
}
.btn:active { transform: translateY(1px); }

a.btn {
  text-decoration: none;
  display: inline-block;
}

.btn-ghost {
  background: transparent;
  color: #e8ecf6;
  box-shadow: none;
  border: 1.5px solid #3a4666;
  font-size: 16px;
  padding: 12px 36px;
  margin-top: 2px;
}

.modes {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 12px;
  margin-top: 10px;
}

.mode-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  padding: 14px 24px;
  margin-top: 0;
}
.mode-btn span {
  font-size: 12px;
  font-weight: 600;
  opacity: 0.75;
}

.btn-relax {
  background: linear-gradient(180deg, #5fe3c0, #2fbfa0);
  box-shadow: 0 6px 20px rgba(47, 191, 160, 0.4);
}

.overlay .cta {
  font-size: 14px;
  opacity: 0.85;
  line-height: 1.5;
  margin-top: 12px;
  max-width: 300px;
}
