/* botões do topo: pausa, som, ecrã inteiro */
#ui {
  position: fixed; z-index: 6; left: 50%; transform: translateX(-50%);
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  display: none; gap: 8px;
}
body.playing #ui { display: flex; }
#ui button {
  width: 36px; height: 36px; border-radius: 50%; border: 1px solid var(--line);
  background: rgba(11, 14, 34, 0.55); color: var(--ink); display: grid; place-items: center; padding: 0; cursor: pointer;
}
#ui button:focus-visible, .btn:focus-visible, #bResume:focus-visible, #bInstall:focus-visible { outline: 2px solid var(--tram); outline-offset: 2px; }
#ui svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
#bSound .x { display: none; }
#bSound.off .x { display: inline; }
#bSound.off .w { display: none; }

/* pausa */
#pause {
  position: fixed; inset: 0; z-index: 10; background: rgba(11, 14, 34, 0.8);
  display: grid; place-items: center; text-align: center;
}
#pause .k { font: 400 44px/1 Bungee, Impact, sans-serif; color: var(--tram); margin: 0 0 20px; letter-spacing: 0.02em; }
#bResume, #bInstall {
  font: 400 14px/1 Bungee, Impact, sans-serif; letter-spacing: 0.04em;
  background: var(--tram); color: var(--bg); border: 0; border-radius: 999px; padding: 14px 26px; cursor: pointer;
  box-shadow: 0 4px 0 rgba(0, 0, 0, 0.45);
}

/* instalação (versão PWA) */
#bInstall {
  position: fixed; z-index: 7; font-size: 12px; padding: 11px 18px;
  top: calc(14px + env(safe-area-inset-top, 0px)); right: calc(16px + env(safe-area-inset-right, 0px));
}
body.playing #bInstall, body.playing #iosHint { display: none; }
#iosHint {
  position: fixed; z-index: 7; max-width: 260px; font-size: 13px; line-height: 1.4;
  top: calc(14px + env(safe-area-inset-top, 0px)); right: calc(16px + env(safe-area-inset-right, 0px));
  background: rgba(11, 14, 34, 0.85); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; color: var(--muted);
}
#iosHint b { color: var(--ink); }

/* pedir para rodar */
#rotate {
  position: fixed; inset: 0; z-index: 20; background: var(--bg); display: none;
  place-items: center; text-align: center; padding: 0 24px;
}
#rotate p { font: 400 16px/1.35 Bungee, Impact, sans-serif; color: var(--ink); max-width: 18ch; margin: 22px auto 0; letter-spacing: 0.02em; }
#rotate .phone {
  width: 54px; height: 92px; margin: 0 auto; border: 3px solid var(--tram); border-radius: 12px;
  animation: rodar 2.2s ease-in-out infinite;
}
@keyframes rodar { 0%, 30% { transform: rotate(0); } 60%, 100% { transform: rotate(-90deg); } }
#rotate small { display: block; font: 400 13px/1.4 Chivo, system-ui, sans-serif; color: var(--muted); margin: 26px auto 12px; max-width: 30ch; }
#bPortrait {
  font: 400 13px/1 Bungee, Impact, sans-serif; letter-spacing: 0.04em; background: var(--tram); color: var(--bg);
  border: 0; border-radius: 999px; padding: 13px 22px; box-shadow: 0 4px 0 rgba(0, 0, 0, 0.45); cursor: pointer;
}
@media (orientation: portrait) and (pointer: coarse) {
  body:not(.portrait-ok) #rotate { display: grid; }
  #game { bottom: 44%; }
  #stickZone { top: 56%; }
}
@media (prefers-reduced-motion: reduce) { #rotate .phone { animation: none; transform: rotate(-90deg); } }
[hidden] { display: none !important; }
