/* * Global Styles for Mobile Experience 
 * touch-action: manipulation prevents accidental zoom/bounce on tapping elements.
 */
body {
  font-family: "Inter", ui-sans-serif, system-ui, -apple-system,
    BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans",
    sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol",
    "Noto Color Emoji";
  touch-action: manipulation; /* Optimizes touch interactions for interactive elements */
  background-color: #f9fafb; /* Tailwind gray-50 for overall background distinction */
}

/* --- NEW: Fullscreen Styles --- */
#game-container.is-fullscreen {
  /* Critical styles to take over the screen */
  width: 100vw !important;
  max-width: 100vw !important;
  height: 100vh !important;
  min-height: 100vh !important;
  margin: 0 !important;
  padding: 0 !important;
  background-color: #f9fafb; /* Maintain a consistent background */
  /* Center all content on the screen */
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

/* Ensure child elements inside fullscreen container don't get too large */
#game-container.is-fullscreen > div {
  max-width: 90%;
}

/* Adjustments for better mobile fit in full screen */
@media (orientation: landscape) and (max-width: 900px) {
  #game-container.is-fullscreen {
    justify-content: space-around; /* Better spacing for landscape mode */
    padding: 1rem 0;
  }
}
/* --- END NEW: Fullscreen Styles --- */

/* * Game Board Cell Styling
 * Darker, more pronounced border for better visual separation.
 */
.grid-cell {
  width: 45px;
  height: 45px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1.75rem;
  font-weight: bold;
  /* Using a darker grey border for better visibility */
  border: 2px solid #6b7280; /* Tailwind gray-500 */
  text-transform: uppercase;
  user-select: none;
  border-radius: 0.5rem; /* Slightly more rounded corners */
  transition: background-color 0.3s ease, border-color 0.3s ease,
    transform 0.1s ease;
}

/* Styles for guessed letters on the board */
.correct {
  background-color: #10b981; /* Tailwind green-500 */
  color: white;
  border-color: #10b981;
}
.present {
  background-color: #fbbf24; /* Tailwind yellow-400 */
  color: white;
  border-color: #fbbf24;
}
.absent {
  background-color: #6b7280; /* Tailwind gray-500 */
  color: white;
  border-color: #6b7280;
}

/* Key Button Base Styling (Common properties for all keys) */
.key-button {
  height: 50px;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 1rem;
  border-radius: 0.5rem;
  cursor: pointer;
  user-select: none;
  transition: background-color 0.2s ease, transform 0.1s ease;
  flex-grow: 1; /* Allow keys to grow in size */
  padding: 0;
  font-weight: bold;
  /* Removed default background/color to allow Enter/Del explicit colors to work */
}

/* Default styling applied only to letter keys */
.letter-key {
  background-color: #d1d5db; /* Tailwind gray-300 */
  color: #1f2937; /* Tailwind gray-800 */
}

/* Key Default Hover: Only apply to letter keys (that don't have a status color) */
.letter-key:not(.correct-key):not(.present-key):not(.absent-key):hover {
  background-color: #9ca3af; /* Tailwind gray-400 */
}

/* Keyboard Status Colors (Applied to letter-keys) */
.key-button.correct-key {
  background-color: #10b981; /* Green */
  color: white;
}
.key-button.present-key {
  background-color: #fbbf24; /* Yellow */
  color: white;
}
.key-button.absent-key {
  background-color: #4b5563; /* Darker Gray */
  color: white;
}

/* Mobile Responsiveness for Keyboard */
@media (max-width: 640px) {
  .grid-cell {
    width: 14vw;
    height: 14vw;
    max-width: 50px;
    max-height: 50px;
    font-size: 1.5rem;
  }
  .key-button {
    height: 48px;
    font-size: 0.8rem;
    min-width: 25px;
  }
  .key-enter-del {
    flex-grow: 1.5;
    min-width: unset;
    padding: 0 0.5rem;
  }
  #game-container {
    width: 95%;
    max-width: 400px;
  }
  /* Increase size in full screen on small screens */
  #game-container.is-fullscreen .grid-cell {
    width: 16vw;
    height: 16vw;
    max-width: 60px;
    max-height: 60px;
  }
  #game-container.is-fullscreen #keyboard {
    max-width: 90%;
  }
}

/* Animation Styles */
.current-cell {
  animation: bounce 0.2s ease-in-out;
}
.invalid-shake {
  animation: shake 0.5s ease-in-out;
  border-color: #ef4444;
}
.message-box {
  position: fixed;
  top: 15%;
  left: 50%;
  transform: translate(-50%, -50%);
  background-color: #333;
  color: white;
  padding: 1rem 2rem;
  border-radius: 0.5rem;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  display: none;
  text-align: center;
}
@keyframes bounce {
  0%,
  100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(-5px);
  }
}
@keyframes shake {
  0%,
  100% {
    transform: translateX(0);
  }
  20% {
    transform: translateX(-10px);
  }
  40% {
    transform: translateX(10px);
  }
  60% {
    transform: translateX(-7px);
  }
  80% {
    transform: translateX(7px);
  }
}

/* ========================================
   EXTRACTED TAILWIND UTILITIES
   ======================================== */

/* Layout Utilities */
.flex {
  display: flex;
}
.grid {
  display: grid;
}
.min-h-screen {
  min-height: 100vh;
}

/* Flexbox Utilities */
.flex-col {
  flex-direction: column;
}
.items-center {
  align-items: center;
}
.justify-center {
  justify-content: center;
}
.justify-end {
  justify-content: flex-end;
}

/* Spacing Utilities */
.space-y-2 > :not([hidden]) ~ :not([hidden]) {
  --tw-space-y-reverse: 0;
  margin-top: calc(0.5rem * calc(1 - var(--tw-space-y-reverse)));
  margin-bottom: calc(0.5rem * var(--tw-space-y-reverse));
}
.gap-1 {
  gap: 0.25rem;
}
.gap-2 {
  gap: 0.5rem;
}
.p-2 {
  padding: 0.5rem;
}
.p-3 {
  padding: 0.75rem;
}
.p-6 {
  padding: 1.5rem;
}
.pt-4 {
  padding-top: 1rem;
}
.pb-4 {
  padding-bottom: 1rem;
}
.px-4 {
  padding-left: 1rem;
  padding-right: 1rem;
}
.mb-1 {
  margin-bottom: 0.25rem;
}
.mb-4 {
  margin-bottom: 1rem;
}
.mb-8 {
  margin-bottom: 2rem;
}
.mt-8 {
  margin-top: 2rem;
}

/* Grid Utilities */
.grid-cols-5 {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

/* Width Utilities */
.w-full {
  width: 100%;
}
.w-6 {
  width: 1.5rem;
}
.max-w-md {
  max-width: 28rem;
}
.max-w-lg {
  max-width: 32rem;
}

/* Height Utilities */
.h-6 {
  height: 1.5rem;
}

/* Container & Sizing */
.container {
  width: 100%;
}
@media (min-width: 640px) {
  .container {
    max-width: 640px;
  }
}
@media (min-width: 768px) {
  .container {
    max-width: 768px;
  }
}
@media (min-width: 1024px) {
  .container {
    max-width: 1024px;
  }
}
@media (min-width: 1280px) {
  .container {
    max-width: 1280px;
  }
}
@media (min-width: 1536px) {
  .container {
    max-width: 1536px;
  }
}
.mx-auto {
  margin-left: auto;
  margin-right: auto;
}

/* Background Colors */
.bg-white {
  background-color: rgb(255, 255, 255);
}
.bg-gray-200 {
  background-color: rgb(229, 231, 235);
}
.bg-gray-300 {
  background-color: rgb(209, 213, 219);
}
.bg-gray-400 {
  background-color: rgb(156, 163, 175);
}
.bg-blue-600 {
  background-color: rgb(37, 99, 235);
}
.bg-blue-700 {
  background-color: rgb(29, 78, 216);
}
.bg-red-600 {
  background-color: rgb(220, 38, 38);
}
.bg-red-700 {
  background-color: rgb(185, 28, 28);
}

/* Text Colors */
.text-white {
  color: rgb(255, 255, 255);
}
.text-gray-800 {
  color: rgb(31, 41, 55);
}

/* Border Radius */
.rounded-full {
  border-radius: 9999px;
}
.rounded-xl {
  border-radius: 0.75rem;
}
.rounded-2xl {
  border-radius: 1rem;
}

/* Shadow Utilities */
.shadow-md {
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
}
.shadow-lg {
  box-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}
.shadow-xl {
  box-shadow: 0 20px 25px -5px rgb(0 0 0 / 0.1),
    0 8px 10px -6px rgb(0 0 0 / 0.1);
}

/* Transition Utilities */
.transition-colors {
  transition-property: color, background-color, border-color,
    text-decoration-color, fill, stroke;
  transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1);
  transition-duration: 150ms;
}
.duration-150 {
  transition-duration: 150ms;
}

/* Hover States */
.hover\:bg-gray-400:hover {
  background-color: rgb(156, 163, 175);
}
.hover\:bg-blue-700:hover {
  background-color: rgb(29, 78, 216);
}
.hover\:bg-red-700:hover {
  background-color: rgb(185, 28, 28);
}

/* Responsive Design - MD breakpoint (768px) */
@media (min-width: 768px) {
  .md\:p-4 {
    padding: 1rem;
  }
  .md\:p-8 {
    padding: 2rem;
  }
}
