html,
body {
  margin: 0;
  padding: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #070b17;
  touch-action: none;
}

canvas {
  display: block;
}

#mobile-controls,
#rotate-hint {
  display: none;
}

@media (pointer: coarse) {
  #mobile-controls {
    position: fixed;
    inset: auto 0 max(10px, env(safe-area-inset-bottom));
    z-index: 20;
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    padding: 0 max(12px, env(safe-area-inset-right)) 0 max(12px, env(safe-area-inset-left));
    pointer-events: none;
  }

  .control-group {
    display: flex;
    gap: 10px;
  }

  #mobile-controls button {
    width: 58px;
    height: 58px;
    border: 2px solid rgba(255, 255, 255, 0.72);
    border-radius: 50%;
    background: rgba(12, 21, 42, 0.82);
    color: #fff;
    font: 700 27px/1 system-ui, sans-serif;
    box-shadow: 0 6px 18px rgba(0, 0, 0, 0.38);
    backdrop-filter: blur(5px);
    pointer-events: auto;
    user-select: none;
    -webkit-tap-highlight-color: transparent;
  }

  #mobile-controls button.is-pressed {
    background: #2f65d9;
    transform: translateY(2px);
  }

  .control-actions button:nth-child(2) {
    background: rgba(146, 47, 203, 0.88);
  }

  .control-actions button:last-child {
    width: 48px;
    height: 48px;
    font-size: 23px;
    opacity: 0.9;
  }
}

@media (pointer: coarse) and (orientation: portrait) {
  #rotate-hint {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 28px;
    background: rgba(7, 11, 23, 0.94);
    color: #fff;
    text-align: center;
    font-family: system-ui, sans-serif;
  }

  #rotate-hint strong {
    font-size: 22px;
  }

  #rotate-hint span {
    max-width: 310px;
    color: #b8c6e5;
    font-size: 14px;
    line-height: 1.5;
  }
}
