/* Shared mobile layer styles for animesh.net canvas games. Pairs with mobile.js
   (window.MobileLayer). Include on any game page that wants a phone-native
   layout: full-viewport canvas, safe-area padding, a rotate-orientation gate,
   and a compact overlay menu with >=44x44px tap targets. No text below 12px. */

:root {
  --safe-area-top: env(safe-area-inset-top, 0px);
  --safe-area-right: env(safe-area-inset-right, 0px);
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --safe-area-left: env(safe-area-inset-left, 0px);
}

/* Utilities: hide desktop-only or touch-only UI. Set by mobile.js on <html>. */
html.is-touch .touch-hide { display: none !important; }
html.is-pointer .pointer-hide { display: none !important; }

/* Full-viewport, no-scroll canvas shell for phones. Apply to the canvas
   container (not <body>) so desktop layout is untouched. */
html.is-touch body.mobile-noscroll {
  overflow: hidden;
  overscroll-behavior: none;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

/* !important: this class exists to force a full-bleed viewport regardless of
   the host page's own container styling (e.g. an #id rule with higher
   specificity than this class would otherwise win). */
.mobile-fullbleed {
  position: fixed !important;
  inset: 0 !important;
  width: 100dvw !important;
  height: 100dvh !important;
  margin: 0 !important;
  padding: var(--safe-area-top) var(--safe-area-right) var(--safe-area-bottom) var(--safe-area-left) !important;
  box-sizing: border-box !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: #000;
  border: none !important;
  box-shadow: none !important;
  z-index: 10;
  overflow: hidden !important;
}

.mobile-fullbleed canvas {
  display: block;
  max-width: 100%;
  max-height: 100%;
  touch-action: none;
}

/* Orientation gate ("rotate your phone") overlay */
.mobile-rotate-gate[hidden] { display: none !important; }

.mobile-rotate-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: calc(var(--safe-area-top) + 16px) calc(var(--safe-area-right) + 24px)
    calc(var(--safe-area-bottom) + 16px) calc(var(--safe-area-left) + 24px);
  /* follows the host page's theme tokens (--bg/--text); pages without them keep the navy card */
  background: var(--bg, #08111f);
  color: var(--text, #ddeeff);
  text-align: center;
  font-family: var(--font-mono, ui-monospace, monospace);
}

.mobile-rotate-gate-icon {
  color: var(--text, #e8a020);
  animation: mobile-rotate-gate-spin 1.8s ease-in-out infinite;
}

@keyframes mobile-rotate-gate-spin {
  0%, 20% { transform: rotate(0deg); }
  50%, 70% { transform: rotate(-90deg); }
  100% { transform: rotate(-90deg); }
}

.mobile-rotate-gate-title {
  font-family: var(--font-display, sans-serif);
  font-size: 22px;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.mobile-rotate-gate-message {
  font-size: 14px;
  color: var(--text, #8aaed0);
  max-width: 280px;
}

.mobile-rotate-gate-footer {
  margin-top: 8px;
  font-size: 12px;
}

.mobile-rotate-gate-footer a {
  color: var(--text, #e8a020);
  text-decoration: underline;
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 10px;
}

/* Compact overlay menu: one 44x44 toggle, a popover panel below it. */
.mobile-menu-toggle {
  position: fixed;
  top: calc(var(--safe-area-top) + 8px);
  right: calc(var(--safe-area-right) + 8px);
  z-index: 60;
  width: 44px;
  height: 44px;
  min-width: 44px;
  min-height: 44px;
  border-radius: 8px;
  border: 1px solid rgba(232, 160, 32, 0.5);
  background: rgba(8, 17, 31, 0.85);
  color: #e8a020;
  font-size: 18px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  cursor: pointer;
}

.mobile-menu-panel[hidden] { display: none !important; }

.mobile-menu-panel {
  position: fixed;
  top: calc(var(--safe-area-top) + 8px + 44px + 6px);
  right: calc(var(--safe-area-right) + 8px);
  z-index: 60;
  min-width: 200px;
  max-width: calc(100vw - 24px);
  max-height: calc(100dvh - var(--safe-area-top) - var(--safe-area-bottom) - 80px);
  overflow-y: auto;
  background: rgba(8, 17, 31, 0.95);
  border: 1px solid rgba(232, 160, 32, 0.4);
  border-radius: 8px;
  padding: 6px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-menu-item {
  min-height: 44px;
  display: flex;
  align-items: center;
}

.mobile-menu-item button,
.mobile-menu-item a {
  width: 100%;
  min-height: 44px;
  font-size: 13px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}

/* Baseline: no text under 12px anywhere this stylesheet's classes apply. */
.mobile-fullbleed, .mobile-rotate-gate, .mobile-menu-panel, .mobile-menu-toggle {
  font-size: max(12px, 1em);
}
