/* ============================================================================
   game.css — Core styles for Cyber Detective Game (RTL, Mobile-First)
   ============================================================================ */

@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;700;900&display=swap');

/* Yekan Bakh Webfont Definitions (Primary Font with Vazirmatn Backup) */
@font-face {
  font-family: 'Yekan Bakh';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: local('Yekan Bakh'), local('YekanBakh'), local('Yekan Bakh Regular'), local('Yekan-Regular'), local('Yekan'),
       url('https://cdn.jsdelivr.net/gh/rastikerdar/yekan-font@v5.0.1/dist/Yekan.woff2') format('woff2'),
       url('https://cdn.jsdelivr.net/gh/rastikerdar/yekan-font@v5.0.1/dist/Yekan.woff') format('woff');
}

@font-face {
  font-family: 'Yekan Bakh';
  font-style: normal;
  font-weight: 700;
  font-display: swap;
  src: local('Yekan Bakh Bold'), local('YekanBakh-Bold'), local('Yekan-Bold'), local('Yekan Bold'),
       url('https://cdn.jsdelivr.net/gh/rastikerdar/yekan-font@v5.0.1/dist/Yekan-Bold.woff2') format('woff2'),
       url('https://cdn.jsdelivr.net/gh/rastikerdar/yekan-font@v5.0.1/dist/Yekan-Bold.woff') format('woff');
}

/* --- Reset & Viewport Lock --- */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100dvh;
  overflow: hidden;
  background: #0F0F23;
  font-family: 'Yekan Bakh', 'YekanBakh', 'Yekan', 'Vazirmatn', sans-serif;
  direction: rtl;
  touch-action: none;
  -webkit-user-select: none;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
}

/* --- Game Container --- */
#game-root {
  position: fixed;
  inset: 0;
  width: 100dvw;
  height: 100dvh;
  overflow: hidden;
  background: #0F0F23;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

#canvas-container {
  position: relative;
  width: 100%;
  height: 100%;
  max-width: 100%;
  margin: 0;
  overflow: hidden;
}

@media (min-width: 768px) {
  #canvas-container {
    max-width: 100%;
    max-height: 100%;
    aspect-ratio: auto;
    border-radius: 0;
    box-shadow: none;
  }
}

#game-canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
  touch-action: none;
}

/* --- Title/Splash Screen --- */
#splash-screen {
  position: fixed;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: linear-gradient(180deg, #0F0F23 0%, #1A1A3E 50%, #0D1B2A 100%);
  z-index: 100;
  transition: opacity 0.5s ease;
}

#splash-screen.hidden {
  opacity: 0;
  pointer-events: none;
  display: none !important;
}

.splash-title {
  font-size: clamp(22px, 6vw, 36px);
  font-weight: 900;
  color: #FFD700;
  text-align: center;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.5);
  margin-bottom: 8px;
  animation: titlePulse 2s ease-in-out infinite;
}

.splash-subtitle {
  font-size: clamp(12px, 3vw, 16px);
  color: #A78BFA;
  text-align: center;
  margin-bottom: 40px;
}

.splash-icon {
  font-size: 80px;
  animation: iconFloat 3s ease-in-out infinite;
  margin-bottom: 24px;
}

.play-button {
  background: linear-gradient(135deg, #4ECDC4, #44B3AA);
  color: white;
  font-family: 'Yekan Bakh', 'YekanBakh', 'Yekan', 'Vazirmatn', sans-serif;
  font-size: 20px;
  font-weight: 700;
  padding: 16px 64px;
  border: none;
  border-radius: 50px;
  cursor: pointer;
  box-shadow: 0 6px 25px rgba(78, 205, 196, 0.4);
  transition: transform 0.2s, box-shadow 0.2s;
  min-width: 200px;
  min-height: 56px;
  touch-action: manipulation;
  position: relative;
  z-index: 102;
  pointer-events: auto;
}

.play-button:active {
  transform: scale(0.95);
  box-shadow: 0 3px 15px rgba(78, 205, 196, 0.3);
}

/* --- Floating Audio Toggle --- */
#audio-toggle {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 200;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 15, 35, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  backdrop-filter: blur(8px);
  transition: background 0.2s;
}

#audio-toggle:active {
  background: rgba(78, 205, 196, 0.4);
}

/* --- Pause Button --- */
#pause-btn {
  position: fixed;
  top: 12px;
  left: 62px;
  z-index: 200;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 15, 35, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  backdrop-filter: blur(8px);
}

/* --- Back Button (visible during stages) --- */
#back-btn {
  position: fixed;
  top: 12px;
  right: 12px;
  z-index: 200;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(15, 15, 35, 0.8);
  border: 2px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-size: 20px;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  touch-action: manipulation;
  backdrop-filter: blur(8px);
}

#back-btn.visible {
  display: flex;
}

/* --- Animations --- */
@keyframes titlePulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.03); }
}

@keyframes iconFloat {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-12px); }
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes slideUp {
  from { transform: translateY(100%); }
  to { transform: translateY(0); }
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

/* --- Loading spinner --- */
.loader {
  width: 32px;
  height: 32px;
  border: 3px solid rgba(255,255,255,0.2);
  border-top-color: #4ECDC4;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-top: 20px;
}

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

/* --- Desktop Sidebar Hints --- */
@media (min-width: 1024px) {
  #game-root {
    background: radial-gradient(ellipse at center, #1A1A3E 0%, #0F0F23 100%);
  }
  #canvas-container {
    border: 1px solid rgba(78, 205, 196, 0.1);
  }
}
