/* Import Jazz fonts - ADD THIS AT THE VERY TOP */
@import url("https://fonts.googleapis.com/css2?family=Montserrat:wght@600;700;800;900&family=Roboto:wght@400;500;700&display=swap");
@import url("https://fonts.googleapis.com/css2?family=Noto+Nastaliq+Urdu&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

/* Override all existing fonts - ADD AFTER THE IMPORT */
body {
  font-family: "Roboto", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial,
    sans-serif !important;
}

.urdu-mode {
  direction: rtl;
}

.urdu-mode #gameContainer {
  direction: ltr; /* Keep game container LTR for gameplay */
}

.urdu-mode .game-title h1,
.urdu-mode .game-title .subtitle,
.urdu-mode .instruction-box .text,
.urdu-mode .congrats-title,
.urdu-mode .dialog-btn,
.urdu-mode .btn {
  direction: rtl;
  font-family: "Noto Nastaliq Urdu", "Nafees", Arial !important;
  line-height: 1.8;
}

/* Keep numbers and scores in LTR even in Urdu mode */
.urdu-mode .score-value,
.urdu-mode .otp-code,
.urdu-mode .final-score .score-value {
  direction: ltr;
  font-family: "Montserrat", Roboto, Arial, sans-serif !important;
}

/* Update language toggle button style */
.language-toggle {
  min-width: 80px;
  text-align: center;
  font-family: "Roboto", "Noto Nastaliq Urdu", Arial;
}

/* All headings use Montserrat */
h1,
h2,
h3,
h4,
h5,
h6,
.game-title h1,
.congrats-title,
.game-over-overlay h2,
.end-game-dialog h3 {
  font-family: "Montserrat", Arial, sans-serif !important;
}

/* All buttons use Montserrat */
button,
.btn,
.play-button,
.control-btn,
.dialog-btn,
.share-btn {
  font-family: "Montserrat", Arial, sans-serif !important;
}

/* Score displays use Montserrat */
.score-value,
.final-score .score-value,
.otp-code {
  font-family: "Montserrat", Arial, sans-serif !important;
}

/* Regular text uses Roboto */
p,
span,
div,
.score-label,
.instruction-box .text,
.game-over-overlay p,
.end-game-dialog p {
  font-family: "Roboto", Arial, sans-serif !important;
}

body {
  overflow: hidden;
  background: #1a1a1a;
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  min-height: 100dvh;
}

#gameContainer {
  width: 100%;
  max-width: 420px;
  height: 100vh;
  height: 100dvh;
  position: relative;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 0 40px rgba(0, 0, 0, 0.3);
}

/* Start Screen */
#startScreen {
  position: absolute;
  width: 100%;
  height: 100%;
  z-index: 100;
  padding: 60px 15px 15px 15px; /* Added top padding for the controls */
  display: flex;
  flex-direction: column;
  background: linear-gradient(180deg, #ffffff 0%, #f5f5f5 100%);
  justify-content: center;
  align-items: center;
}

.header-controls {
  position: absolute;
  top: 15px;
  left: 0;
  right: 0;
  width: 100%;
  display: flex;
  justify-content: space-between;
  padding: 0 15px;
  z-index: 10;
}

.language-toggle {
  padding: 6px 10px;
  background: #2d2d2d;
  border-radius: 20px;
  color: white;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s;
  border: 1px solid #3a3a3a;
}

.sound-toggle {
  padding: 6px 10px;
  background: #2d2d2d;
  border-radius: 20px;
  color: white;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s;
  border: 1px solid #3a3a3a;
}

.logo-container {
  width: 180px;
  height: 90px;
  margin: 15px auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.jazz-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.game-title {
  text-align: center;
  margin: 20px 0;
  animation: pulse 2s infinite;
}

.game-title h1 {
  font-size: 32px;
  font-weight: 900;
  color: #2d2d2d;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
  letter-spacing: -1px;
  margin-bottom: 8px;
}

.game-title .subtitle {
  color: #e60028;
  font-size: 16px;
  font-weight: 600;
}

@keyframes pulse {
  0%,
  100% {
    transform: scale(1);
  }

  50% {
    transform: scale(1.02);
  }
}

.play-button {
  width: 200px;
  height: 44px;
  padding: 15px 25px;
  background: #e60028;
  border: none;
  border-radius: 20px; /* Fully rounded like original */
  color: white;
  font-size: 14px;
  font-weight: 600;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
  letter-spacing: 1px;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(230, 0, 40, 0.2);
  transition: all 0.3s;
}

.play-button:hover {
  background: #c50020;
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(230, 0, 40, 0.3);
}

.play-button:active {
  transform: translateY(0);
  box-shadow: 0 2px 8px rgba(230, 0, 40, 0.2);
}

.play-button:disabled {
  cursor: not-allowed !important;
  opacity: 0.5 !important;
  background: #999 !important;
}

.play-button {
  transition: all 0.3s ease;
}

#loadingContainer {
  animation: fadeIn 0.5s ease-in;
}

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

.instructions {
  display: flex;
  flex-direction: row;
  gap: 10px;
  margin: 15px 0;
  flex: 1;
  justify-content: center;
  align-items: center;
  padding: 0 10px;
}

.instruction-box {
  padding: 15px 10px;
  text-align: center;
  color: #2d2d2d;
  animation: slideIn 0.5s ease-out forwards;
  opacity: 0;
  flex: 1;
  max-width: 120px;
  height: 140px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: white;
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.instruction-box:nth-child(1) {
  animation-delay: 0.1s;
}

.instruction-box:nth-child(2) {
  animation-delay: 0.2s;
}

.instruction-box:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes slideIn {
  from {
    transform: translateY(30px);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.instruction-box .emoji {
  font-size: 32px;
  margin-bottom: 8px;
}

.instruction-box .text {
  font-size: 11px;
  line-height: 1.3;
  color: #2d2d2d;
}

/* Game Screen */
#gameScreen {
  position: absolute;
  width: 100%;
  height: 100%;
  display: none;
  background: linear-gradient(180deg, #f0f0f0 0%, #fafafa 100%);
}

/* Game Controls Header */
.game-controls-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px;
  z-index: 10;
  background: transparent;
}

/* Game Controls Header */
.game-controls-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 50px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 15px; /* Added horizontal padding */
  z-index: 10;
  background: transparent;
}

.control-btn {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.3);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.3);
  font-family: -apple-system, Arial, sans-serif;
}

.sound-btn {
  background: linear-gradient(135deg, #e60028, #ff4444);
  color: white;
}

.end-btn {
  background: linear-gradient(135deg, #666666, #999999);
  color: white;
}

.pause-btn {
  background: linear-gradient(135deg, #fbb040, #ffd700);
  color: #333;
}

.end-btn:hover {
  background: linear-gradient(135deg, #ff0000, #cc0000);
  transform: scale(1.05);
}

/* Game Score Footer */
.game-score-footer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(45, 45, 45, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 30px;
  z-index: 10;
  border-top: 2px solid #e60028;
}

.score-item {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.score-label {
  color: #999;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 1px;
}

.score-value {
  color: #fbb040;
  font-size: 24px;
  font-weight: bold;
}

.score-unit {
  color: #fff;
  font-size: 14px;
  font-weight: 600;
}

.score-divider {
  width: 1px;
  height: 30px;
  background: rgba(255, 255, 255, 0.2);
}

/* Update canvas positioning */
#gameCanvas {
  position: absolute;
  top: 50px;
  left: 0;
  width: 100%;
  height: calc(100% - 110px); /* Subtract header and footer */
}

.game-header {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 60px;
  background: rgba(45, 45, 45, 0.95);
  backdrop-filter: blur(10px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 15px;
  z-index: 10;
  border-bottom: 2px solid #e60028;
}

.score-display,
.missed-display {
  color: white;
  font-size: 14px;
  font-weight: bold;
}

.score-display span,
.missed-display span {
  color: #fbb040;
  font-size: 20px;
  font-weight: bold;
}

/* Reward Screen */
#rewardScreen {
  position: absolute;
  width: 100%;
  height: 100%;
  display: none;
  padding: 20px;
  background: linear-gradient(180deg, #ffffff 0%, #f5f5f5 100%);
  overflow-y: auto;
}

.reward-content {
  text-align: center;
  color: #2d2d2d;
}

.congrats-title {
  font-size: 28px;
  font-weight: 900;
  margin-bottom: 10px;
  animation: zoomIn 0.5s ease-out;
  color: #e60028;
}

@keyframes zoomIn {
  from {
    transform: scale(0);
    opacity: 0;
  }

  to {
    transform: scale(1);
    opacity: 1;
  }
}

.final-score {
  margin: 20px auto;
  padding: 20px;
  font-size: 16px;
  background: white;
  border: 2px solid #e60028;
  border-radius: 12px;
  color: #2d2d2d;
}

.final-score .score-value {
  font-size: 36px;
  font-weight: 900;
  color: #e60028;
  text-shadow: none;
  display: block;
  margin: 10px 0;
}

.otp-section {
  margin: 20px auto;
  padding: 15px;
  background: #2d2d2d;
  border-radius: 12px;
  color: white;
}

.otp-code {
  font-size: 32px;
  font-weight: 900;
  letter-spacing: 6px;
  color: #2d2d2d;
  background: #fbb040;
  padding: 12px;
  border-radius: 10px;
  margin: 12px 0;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.action-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.btn {
  padding: 14px 25px;
  border: none;
  border-radius: 25px;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-primary {
  background: #e60028;
  color: white;
}

.btn-secondary {
  background: #780109;
  color: white;
  border: none;
}

.btn-success {
  background: #25d366;
  color: white;
}

.btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.2);
}

/* Game Over Overlay */
.game-over-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: rgba(45, 45, 45, 0.98);
  padding: 25px;
  border-radius: 20px;
  color: white;
  text-align: center;
  display: none;
  z-index: 1000;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.5);
  width: 90%;
  max-width: 350px;
  border: 2px solid #e60028;
}

.game-over-overlay h2 {
  font-size: 24px;
  margin-bottom: 12px;
}

.game-over-overlay p {
  font-size: 16px;
  margin-bottom: 15px;
}

/* Social Sharing Options */
.share-section {
  margin: 15px auto;
  padding: 12px;
  background: rgba(251, 176, 64, 0.08);
  border-radius: 12px;
  border: 1px solid rgba(230, 0, 40, 0.1);
  max-width: 320px;
}

.share-buttons {
  display: flex;
  gap: 8px;
  justify-content: center;
  align-items: center;
  flex-wrap: nowrap;
}

.share-btn {
  width: 40px;
  height: 40px;
  min-width: 40px;
  padding: 8px;
  background: white;
  border: 1.5px solid #f0f0f0;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
  position: relative;
}

.share-btn img {
  width: 22px;
  height: 22px;
  object-fit: contain;
}

.share-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(230, 0, 40, 0.2);
  border-color: #e60028;
  background: #fff5f5;
}

.share-btn:active {
  transform: translateY(0);
}

/* Tooltip Styles */
.share-btn::before {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(5px);
  background: rgba(45, 45, 45, 0.95);
  color: white;
  font-size: 11px;
  padding: 5px 10px;
  border-radius: 6px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 100;
  font-weight: 500;
}

.share-btn::after {
  content: "";
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%) translateY(11px);
  border: 5px solid transparent;
  border-top-color: rgba(45, 45, 45, 0.95);
  opacity: 0;
  pointer-events: none;
  transition: all 0.2s ease;
  z-index: 100;
}

.share-btn:hover::before {
  opacity: 1;
  transform: translateX(-50%) translateY(-8px);
}

.share-btn:hover::after {
  opacity: 1;
  transform: translateX(-50%) translateY(-2px);
}

/* Copy notification */
.copy-notification {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: linear-gradient(135deg, #e60028, #fbb040);
  color: white;
  padding: 12px 24px;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  z-index: 2000;
  animation: fadeInOut 2s ease-in-out;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25);
}

@keyframes fadeInOut {
  0% {
    opacity: 0;
    transform: translate(-50%, -40%) scale(0.9);
  }
  20% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  80% {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
  }
  100% {
    opacity: 0;
    transform: translate(-50%, -60%) scale(0.9);
  }
}

/* Responsive adjustment for very small screens */
@media (max-width: 360px) {
  .share-btn {
    width: 36px;
    height: 36px;
    min-width: 36px;
    padding: 7px;
  }

  .share-btn img {
    width: 20px;
    height: 20px;
  }

  .share-buttons {
    gap: 6px;
  }
}

/* End Game Confirmation Dialog */
.end-game-dialog {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 25px;
  border-radius: 20px;
  text-align: center;
  display: none;
  z-index: 1001;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  width: 90%;
  max-width: 320px;
  border: 2px solid #e60028;
}

.end-game-dialog h3 {
  font-size: 20px;
  color: #e60028;
  margin-bottom: 15px;
  font-weight: 700;
}

.end-game-dialog p {
  font-size: 14px;
  color: #666;
  margin-bottom: 20px;
  line-height: 1.4;
}

.dialog-buttons {
  display: flex;
  gap: 10px;
  justify-content: center;
}

.dialog-btn {
  padding: 10px 20px;
  border: none;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 100px;
}

.dialog-btn-continue {
  background: #e60028;
  color: white;
}

.dialog-btn-end {
  background: #f0f0f0;
  color: #666;
}

.dialog-btn:hover {
  transform: scale(1.05);
}

/* Dark overlay when dialog is shown */
.dialog-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: none;
  z-index: 1000;
}