* {
  -webkit-tap-highlight-color: transparent !important;
}

html,
body {
  overflow-x: hidden;
  width: 100%;
  max-width: 100vw;
}

/* Custom styles for the number input arrows */
.number-input-arrow {
  width: 0;
  height: 0;
  border-left: 0.5rem solid transparent;
  border-right: 0.5rem solid transparent;
  cursor: pointer;
  margin: 0.25rem 0;
}

.number-input-arrow.up {
  border-bottom: 0.5rem solid;
}

.number-input-arrow.down {
  border-top: 0.5rem solid;
}

.number-input-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin: 0 0.2rem;
  /* Changed from 1rem to 0.5rem */
}

.number-input {
  width: 2rem;
  text-align: center;
  font-size: 1.5rem;
  font-weight: 600;
  box-shadow: inset 0 1px 3px rgba(0, 0, 0, 0.25);
  border-radius: 0.375rem;
  margin: 0.25rem 0;
  padding: 0.25rem;
  -webkit-appearance: textfield;
  -moz-appearance: textfield;
  appearance: textfield;
  font-family: "Public Sans", sans-serif;
}

.number-input::-webkit-outer-spin-button,
.number-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.game-title {
  font-family: "Public Sans", sans-serif;
}

.instruction-text {
  font-family: "Public Sans", sans-serif;
}

.button {
  font-family: "Public Sans", sans-serif;
}

.clue-number,
.example-clue-number {
  cursor: pointer;
  padding: 0.125rem;
  border-radius: 0.375rem;
  font-size: 1.2rem;
  /* Increased font size */
}

@media (hover: hover) and (pointer: fine) {

  .clue-number:hover,
  .example-clue-number:hover {
    background-color: #f0f0f0;
  }

  body.dark .clue-number:hover,
  body.dark .example-clue-number:hover {
    background-color: #4b5563;
  }
}

.highlighted {
  background-color: #a7f3d0;
  color: #065f46;
}

/* Dark mode styles */
body.dark {
  background-color: #111827;
  color: #f9fafb;
}

body.dark .bg-white {
  background-color: #1f2937;
}

body.dark .text-gray-800 {
  color: #f9fafb;
}

body.dark .text-gray-600 {
  color: #d1d5db;
}

body.dark .border-gray-300 {
  border-color: #4b5563;
}

body.dark .lock-icon {
  background-color: #374151;
  color: #f9fafb;
  border-color: #6b7280;
}

body.dark .number-input {
  background-color: #374151;
  color: #f9fafb;
  border-color: #6b7280;
}

body.dark .number-input-arrow.up {
  border-bottom-color: #f9fafb;
}

body.dark .number-input-arrow.down {
  border-top-color: #f9fafb;
}

body.dark .bg-gray-50 {
  background-color: #374151;
}

body.dark .text-gray-700 {
  color: #d1d5db;
}

@media (hover: hover) and (pointer: fine) {

  body.dark .clue-number:hover,
  body.dark .example-clue-number:hover {
    background-color: #4b5563;
  }
}

body.dark .popup-content {
  background-color: #374151;
  color: #f9fafb;
}

body.dark .popup-header {
  border-bottom-color: #6b7280;
}

body.dark .popup-body {
  color: #d1d5db;
}

body.dark .text-green-600 {
  color: #4ade80;
}

/* Dark mode toggle icon button */
#dark-mode-toggle {
  transition: background-color 0.2s;
}

body.dark #dark-mode-toggle svg {
  color: #f3f4f6;
}

.tooltip {
  position: relative;
  display: inline-block;
}

.tooltip .tooltiptext {
  visibility: hidden;
  width: 120px;
  background-color: rgba(55, 65, 81, 1);
  /* #374151 */
  color: #fff;
  text-align: center;
  border-radius: 6px;
  padding: 5px 10px;
  position: absolute;
  z-index: 1;
  bottom: 125%;
  left: 50%;
  margin-left: -60px;
  opacity: 0;
  transition: opacity 0.3s;
}

@media (hover: hover) and (pointer: fine) {
  .tooltip:hover .tooltiptext {
    visibility: visible;
    opacity: 1;
  }
}

/* Popup styles */
.popup {
  display: none;
  position: fixed;
  z-index: 1000;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  overflow: auto;
  background-color: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 0.3s ease;
  align-items: center;
  justify-content: center;
}

.popup.active {
  display: flex;
  opacity: 1;
}

.popup-content {
  background-color: #ffffff;
  padding: 2rem;
  width: 90%;
  max-width: 500px;
  max-height: 90vh;
  overflow-y: auto;
  border-radius: 0.5rem;
  position: relative;
  z-index: 1001;
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.popup.active .popup-content {
  transform: scale(1);
}

.popup-header {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #f3f4f6;
}

.popup-header h2 {
  margin: 0;
  font-family: "Public Sans", sans-serif;
}

.popup-body {
  font-size: 1rem;
  line-height: 1.6;
  /* margin-bottom: 1.5rem; */
  color: #4b5563;
}

.popup-body p {
  margin-bottom: 0.75rem;
}

.popup-footer {
  text-align: center;
  margin-top: 1rem;
}

@media (max-width: 640px) {
  .popup-content {
    padding: 1.5rem;
  }
}



.clue-container {
  display: flex;
  align-items: center;
  /* Vertically center items */
  margin-bottom: 0.5rem;
  /* Reduced spacing here */
  gap: 1rem;
  text-align: center;
  /* Center the text within the container */
}

.clue-numbers {
  font-family: "Public Sans", sans-serif;
  font-weight: 700;
  display: flex;
  gap: 0.5rem;
  min-width: fit-content;
  justify-content: center;
  /* Center the numbers horizontally */
}

.clue-text {
  font-family: "Public Sans", sans-serif;
  font-size: 0.875rem;
  line-height: 1.5;
  color: #6b7280;
  margin-top: 0.25rem;
  text-align: left;
  /* Re-align text to the left if needed */
  flex: 1;
  /* Allow the text to take up the remaining space */
}

body.dark .clue-text {
  color: #d1d5db;
}

.clue-number {
  display: inline-flex;
  padding: 0.125rem;
  border-radius: 0.375rem;
  min-width: 1.5rem;
  /* Ensure each number has some minimum width */
  justify-content: center;
  /* Center the number horizontally */
}

.timer {
  font-size: 1.5rem;
  /* Increased font size */
  color: #ff4500;
  /* Changed color to orange-red */
  font-weight: bold;
  /* Make it bold */
}

.shake {
  animation: shake 0.5s;
}

@keyframes shake {
  0% {
    transform: translateX(0);
  }

  25% {
    transform: translateX(-5px);
  }

  50% {
    transform: translateX(5px);
  }

  75% {
    transform: translateX(-5px);
  }

  100% {
    transform: translateX(0);
  }
}

@keyframes toast-in {
  from {
    transform: translateY(1rem);
    opacity: 0;
  }

  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.toast {
  background-color: rgba(31, 41, 55, 0.9);
  color: #fff;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 500;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  animation: toast-in 0.3s ease-out forwards;
  pointer-events: auto;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

body.dark .toast {
  background-color: rgba(55, 65, 81, 0.9);
  border-color: rgba(255, 255, 255, 0.05);
}

/* How to Play Popup Refinement */
.how-to-play-content {
  max-width: 600px;
  /* Wider to accommodate examples */
  width: 95%;
}

.how-to-play-content .section {
  text-align: left;
}

.clue-example .clue-numbers {
  min-width: 80px;
  /* Ensure alignment */
}

.example-clue-number {
  display: inline-flex;
  padding: 0.125rem;
  border-radius: 0.375rem;
  min-width: 1.5rem;
  justify-content: center;
}

/* Tutorial Animation */
.tutorial-animation-container {
  position: relative;
  overflow: hidden;
}

.ghost-cursor {
  position: absolute;
  top: 40%;
  left: 25%;
  font-size: 2rem;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%);
  animation: cursor-tap-sequence 4s infinite;
  z-index: 10;
}

.demo-target {
  transition: background-color 0.3s, color 0.3s, opacity 0.3s;
}

/* Animation Keyframes */
@keyframes cursor-tap-sequence {
  0% {
    opacity: 0;
    top: 120%;
    left: 80%;
    transform: scale(1) translate(-50%, -50%);
  }

  10% {
    opacity: 1;
    top: 80%;
    left: 60%;
  }

  30% {
    top: 40%;
    /* Move to target */
    left: 4.5%;
    /* Approximate position of the '1' in layout */
    transform: scale(1) translate(-50%, -50%);
  }

  35% {
    transform: scale(0.8) translate(-50%, -50%);
    /* Tap press */
  }

  40% {
    transform: scale(1) translate(-50%, -50%);
    /* Release */
  }

  80% {
    opacity: 1;
  }

  90% {
    opacity: 0;
  }

  100% {
    opacity: 0;
  }
}

/* Toggle effect simulation tied to animation timing */
.tutorial-animation-container .demo-target {
  animation: toggle-highlight-sequence 4s infinite;
}

@keyframes toggle-highlight-sequence {

  0%,
  35% {
    background-color: transparent;
    color: inherit;
    opacity: 1;
  }

  36%,
  90% {
    background-color: #a7f3d0;
    color: #065f46;
  }

  100% {
    background-color: transparent;
    color: inherit;
  }
}

/* Dark mode adjustments for new content */
body.dark .how-to-play-content .bg-gray-50 {
  background-color: #1f2937;
  border-color: #374151;
}

body.dark .how-to-play-content .text-gray-900 {
  color: #f3f4f6;
}

body.dark .how-to-play-content .bg-gray-100 {
  background-color: #374151;
  color: #f3f4f6;
}

body.dark .how-to-play-content hr {
  border-color: #374151;
}