/* Emotelings Escape Room - Styles */

/* Fredoka Font - loaded via Google Fonts in index.html */
/* Local fallback fonts for offline use */
@font-face {
  font-family: 'Fredoka-Local';
  src: url('../assets/Fredoka/Fredoka-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
}

@font-face {
  font-family: 'Fredoka-Local';
  src: url('../assets/Fredoka/Fredoka-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  width: 100%;
  height: 100%;
  background: #F9F4EA !important; /* Kids4Equity beige - covers letterbox areas */
}

body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #F9F4EA !important; /* Kids4Equity beige */
  font-family: 'Fredoka', 'Fredoka-Local', 'Nunito', 'Comic Sans MS', cursive, sans-serif;
  margin: 0;
  padding: 0;
}

#game-container {
  width: 100vw;
  height: 100vh;
  position: fixed;
  top: 0;
  left: 0;
  padding: 0;
  margin: 0;
  overflow: hidden;
  background: #F9F4EA; /* Match game background to eliminate visible borders */
  /* Safe area insets for notched devices (iPhone X+, etc.) */
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
}

#game-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
}

#game-container canvas {
  display: block;
  width: 100vw !important;
  height: auto !important;
  max-height: 100vh;
}

/* Embedded mode - auto-detected in iframes or via ?embed=true URL */
body.embed-mode {
  background: transparent !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: hidden !important;
  width: 100% !important;
  height: 100% !important;
}

body.embed-mode #rotate-prompt {
  display: none !important;
}

body.embed-mode #game-container {
  display: flex !important;
  padding: 0 !important;
  margin: 0 !important;
  width: 100% !important;
  height: 100% !important;
  position: absolute !important;
  top: 0 !important;
  left: 0 !important;
}

body.embed-mode #game-container canvas {
  border-radius: 0 !important;
  max-width: 100% !important;
  max-height: 100% !important;
  width: auto !important;
  height: auto !important;
}

/* Loading screen fallback */
.loading {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  background: #F9F4EA;
  color: #3A495E;
  font-size: 1.5rem;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 6px solid #F2692E;
  border-top-color: transparent;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Prevent text selection during gameplay */
#game-container {
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}

/* ===== MOBILE ROTATION PROMPT ===== */
#rotate-prompt {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #F9F4EA;
  z-index: 9999;
  justify-content: center;
  align-items: center;
}

.rotate-content {
  text-align: center;
  padding: 2rem;
  color: #3A495E;
}

.rotate-icon {
  font-size: 4rem;
  margin-bottom: 1rem;
  animation: rotate-hint 2s ease-in-out infinite;
}

@keyframes rotate-hint {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-15deg); }
  75% { transform: rotate(15deg); }
}

.rotate-content h2 {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.5rem;
  color: #F2692E;
  margin-bottom: 0.5rem;
}

.rotate-content p {
  font-family: 'Fredoka', sans-serif;
  font-size: 1rem;
  color: #3A495E;
}

/* Show rotate prompt on mobile devices in portrait mode */
@media screen and (max-width: 768px) and (orientation: portrait) {
  #rotate-prompt {
    display: flex;
  }

  #game-container {
    display: none;
  }
}

/* Hide rotate prompt in landscape or on larger screens */
@media screen and (min-width: 769px),
       screen and (orientation: landscape) {
  #rotate-prompt {
    display: none !important;
  }

  #game-container {
    display: flex !important;
  }
}

/* ===== FULLSCREEN MODE ===== */
html:fullscreen,
html:-webkit-full-screen,
html:-moz-full-screen,
html:-ms-fullscreen {
  width: 100% !important;
  height: 100% !important;
  background: #F9F4EA !important;
}

:fullscreen #game-container,
:-webkit-full-screen #game-container,
:-moz-full-screen #game-container,
:-ms-fullscreen #game-container {
  width: 100vw !important;
  height: 100vh !important;
  display: flex !important;
  justify-content: center !important;
  align-items: center !important;
  background: #F9F4EA !important;
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
}

:fullscreen #game-container canvas,
:-webkit-full-screen #game-container canvas,
:-moz-full-screen #game-container canvas,
:-ms-fullscreen #game-container canvas {
  max-width: 100vw !important;
  max-height: 100vh !important;
}

/* Hide rotate prompt in fullscreen */
:fullscreen #rotate-prompt,
:-webkit-full-screen #rotate-prompt {
  display: none !important;
}
