/* Lessonsmith's phone and tablet fixes for ByteShield (added by scripts/build-aistudio-game.mjs).
   The game itself is unchanged: this only tidies its controls on small and touch screens. */

/* The keyboard hint means nothing on a touchscreen, and it pushed the buttons off phone screens. */
@media (pointer: coarse), (max-width: 760px) {
  .pointer-events-none.absolute.inset-0 > div:last-child > p { display: none; }
  .pointer-events-none.absolute.inset-0 > div:last-child { justify-content: center; }
  .pointer-events-none.absolute.inset-0 > div:last-child > div { flex-wrap: wrap; justify-content: center; }
  /* Bigger touch buttons for Scan, Encrypt and Block. */
  .pointer-events-none.absolute.inset-0 > div:last-child button { min-height: 52px; font-size: 0.85rem; padding: 0 14px; }
}

@media (max-width: 560px) {
  .pointer-events-none.absolute.inset-0 { padding: 8px; }
  .pointer-events-none.absolute.inset-0 > div:first-child { gap: 6px; }
  .pointer-events-none.absolute.inset-0 > div:first-child > div { max-width: 100%; }
  .pointer-events-none.absolute.inset-0 > div:first-child .w-36 { width: 6rem; }
  /* Shield, score, sound and Pause wrap onto a second line rather than running off the screen. */
  .pointer-events-none.absolute.inset-0 > div:first-child > div:last-child { flex-wrap: wrap; justify-content: flex-end; gap: 6px; width: 100%; }
  .pointer-events-none.absolute.inset-0 > div:first-child > div:last-child > div { padding: 6px 10px; }
  .pointer-events-none.absolute.inset-0 > div:last-child button { flex: 1 1 0; justify-content: center; padding: 0 8px; min-width: 0; }
  .pointer-events-none.absolute.inset-0 > div:last-child > div { width: 100%; flex-wrap: nowrap; }
}

/* Upright phones: a short tip to turn sideways for a bigger view. It fades after a few seconds. */
@media (orientation: portrait) and (max-width: 600px) and (pointer: coarse) {
  body::after {
    content: "📱 Tip: turn your phone sideways for a bigger view";
    position: fixed; left: 50%; bottom: 84px; transform: translateX(-50%); z-index: 50;
    width: max-content; max-width: calc(100vw - 32px); padding: 8px 14px; border-radius: 12px;
    background: #0E4D3E; color: #ffffff; border: 2px solid #F4C842;
    font: 700 0.9rem/1.3 "Plus Jakarta Sans", system-ui, sans-serif; text-align: center;
    pointer-events: none; animation: ls-tip-hide 7s forwards;
  }
}
@keyframes ls-tip-hide { 0%, 85% { opacity: 1; } 100% { opacity: 0; visibility: hidden; } }
@media (prefers-reduced-motion: reduce) {
  body::after { animation-timing-function: steps(1, end); }
}

/* Phones held sideways: a smaller top bar on one line, so it doesn't cover the first lane. */
@media (max-height: 500px) and (orientation: landscape) {
  .pointer-events-none.absolute.inset-0 { padding: 6px 10px; }
  .pointer-events-none.absolute.inset-0 > div:first-child { flex-wrap: nowrap; transform: scale(0.74); transform-origin: top left; width: 135%; }
  .pointer-events-none.absolute.inset-0 > div:first-child > div:first-child span:nth-of-type(n+4) { display: none; }
  .pointer-events-none.absolute.inset-0 > div:last-child button { min-height: 44px; }
}
