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

@media (max-width: 320px) {
  .game-container {
    padding: 12px;
    max-width: 350px;  /*  max-width: 280px; */
  }
  .dark-mode .game-container {
    padding: 12px;
    max-width: 350px;  /*  max-width: 280px; */
  }
  .letter {
    font-size: 1.4rem;
  }

  .key {
    font-size: 0.85rem;
    padding: 8px 6px;
  }
}
/* On large screens: prevent wrap */
@media (min-width: 540px) {
  .key-row {
    flex-wrap: nowrap;
  }
  .keyboard {
    width: 100%;
    max-width: 420px; /* max-width: 500px; */
  }

  .letter {
    font-size: 1.8rem;
  }

  .key {
    font-size: 1rem;
  }
}


/* === SPLASH SCREEN === */
.splash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: white;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 200;
  flex-direction: column;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

.splash-content h1 {
  font-size: 2.5rem;
  color: #2d7dff;
  margin: 0;
}

.splash-content p {
  font-size: 1rem;
  color: #666;
  margin-top: 8px;
}

/* Fade out animation */
.splash.fade-out {
  animation: fadeOut 1s ease-out forwards;
}

@keyframes fadeOut {
  from { opacity: 1; }
  to { opacity: 0; visibility: hidden; }
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f5f8fa;
  color: #1a1a1a;
  line-height: 1.6;
  padding: 20px;
  max-width: 500px;
  margin: 0 auto;
}

.container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
  background: #f5f8fa;
  padding: 20px;
  margin: 0;
}


/* === RESPONSIVE GAME CONTAINER === */
.game-container {
  margin-top: 300px; /* ✅ Now works: pushes container down */
  width: 100%;
  max-width: 800px; /* Match banner width */
  background: white;
  border-radius: 20px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1);
  overflow: hidden;
  text-align: center;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0 auto;
  position: relative;
}
/* Update this selector to target the h1 directly */
.game-container h1 {
  margin-top: 150px;;
}


/* === TITLE & TAGLINE (scale up slightly) === */
h1 {
  font-size: 2.4rem;
  color: #2d7dff;
  margin-bottom: 10px;
}

.tagline {
  font-size: 1rem;
  color: #666;
  margin-bottom: 24px;
}


/* === CONTROLS (buttons scale up) === */
/* === CONTROLS === */
.controls {
  margin: 20px 0;
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.controls button {
  padding: 12px 20px;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  background: #2d7dff;
  color: white;
  font-weight: bold;
  min-width: 120px;
}

#hint-btn {
  background: #ff9500;
}


/* Help Button */
.help-btn {
  position: absolute;
  top: 180px;
  right: 10px;
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #2d7dff;
  color: white;
}

/* === GAMEBOARD (bigger letters for larger screens) === */

#gameboard {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 4px;
  margin: 20px auto;
  width: 95%;
  max-width: 300px;
  height: auto;
}

.row {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
}

.letter {
  width: 100%;
  aspect-ratio: 1 / 1;
  border: 2px solid #ddd;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
  font-weight: bold;
  text-transform: uppercase;
  min-width: 0;
}

.correct { background: #2d7dff; color: white; border: none; }
.present { background: #f9c543; color: white; border: none; }
.absent { background: #8c8c8c; color: white; border: none; }



/* === STREAK & LEGEND === */
.streak {
  margin-top: 20px;
  font-size: 1.2rem;
  font-weight: bold;
  color: #333;
}

.legend-container {
  margin: 24px auto 0;
  max-width: 300px;
  text-align: left;
  font-size: 0.9rem;
}

.legend-toggle {
  background: none;
  border: none;
  font-size: 0.95rem;
  color: #2d7dff;
  cursor: pointer;
  text-decoration: underline;
  margin-bottom: 8px;
  padding: 0;
}

.legend-content {
  font-size: 0.9rem;
  color: #555;
}

.legend-box {
  display: inline-block;
  width: 18px;
  height: 18px;
  margin-right: 6px;
  border-radius: 4px;
}

.legend .correct { background: #2d7dff; }
.legend .present { background: #f9c543; }
.legend .absent { background: #8c8c8c; }


/* === KEYBOARD (responsive) === */
.keyboard {
  display: grid;
  grid-template-rows: repeat(3, auto);
  gap: 6px;
  margin: 20px auto;
  width: calc(100% - 32px);
  max-width: 500px;
  padding: 0 16px;
  justify-content: center;
}

.key-row {
  display: flex;
  justify-content: center;
  gap: 6px;
  flex-wrap: wrap;
  width: 100%;
}


/* On large screens: prevent wrap */
@media (min-width: 540px) {
  .key-row {
    flex-wrap: nowrap;
  }

  /* Ensure full width on large screens */
  .keyboard {
    max-width: 500px;
    width: 100%;
  }
}

.key {
  padding: 10px 8px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 1rem;
  cursor: pointer;
  min-width: 32px;
  text-align: center;
  flex: 1;
  max-width: 50px;
  min-height: 0;
}

.enter,
.backspace {
  width: 70px;
  padding: 10px 0;
}

.enter {
  font-size: 0.9rem;
}

.backspace {
  font-size: 1.1rem;
}

.key[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 10;
}

.key[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #333;
}

.key:active {
  background: #eee;
}


#submit-btn {
  background: #4caf50;
}

#submit-btn:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Tooltips */
[data-tooltip] {
  position: relative;
}

[data-tooltip]:hover::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: 120%;
  left: 50%;
  transform: translateX(-50%);
  background: #333;
  color: white;
  font-size: 0.85rem;
  padding: 6px 10px;
  border-radius: 6px;
  white-space: nowrap;
  z-index: 10;
  min-width: 180px;
}

[data-tooltip]:hover::before {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: #333;
}

/* Modal (How to Play) */
.modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.6);
  justify-content: center;
  align-items: center;
  z-index: 100;
}

.modal-content {
  background: white;
  padding: 24px;
  border-radius: 12px;
  max-width: 90%;
  width: 400px;
  text-align: left;
  line-height: 1.6;
}

.modal-content h2 {
  margin-bottom: 16px;
  color: #2d7dff;
}

.modal-content ul, .modal-content ol {
  margin: 10px 0 10px 20px;
}

.close-btn {
  margin-top: 16px;
  padding: 10px 20px;
  background: #2d7dff;
  color: white;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 1rem;
}

/* Accessibility */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0,0,0,0);
  white-space: nowrap;
  border: 0;
}

.top-ad {
  position: sticky;
  top: 0;
  left: 0;
  width: 100%;
  height: 50px;
  background: white;
  border-bottom: 1px solid #eee;
  z-index: 100;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  border-top-left-radius: 20px;
  border-top-right-radius: 20px;
}

/* === RESPONSIVE AD BANNER === */
.ad-banner {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 280px; /* Default for smallest screens */
  height: auto;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 100;
  background: white;
  border-bottom: 1px solid #eee;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 10px;
  margin: 0 auto;
}

.ad-banner img {
  width: 100%;
  max-width: 280px;
  height: auto;
  border-radius: 8px;
}

/* On small screens (320px–539px) */
@media (min-width: 320px) and (max-width: 539px) {
  .ad-banner {
    max-width: 350px;
  }
  .ad-banner img {
    max-width: 350px;
  }
  .dark-mode .ad-banner {
    max-width: 350px;
  }
  .dark-mode .ad-banner img {
    max-width: 350px;
  }
}

/* On medium screens (540px–799px) */
@media (min-width: 540px) and (max-width: 799px) {
  .ad-banner {
    max-width: 420px;
  }
  .ad-banner img {
    max-width: 420px;
  }
  .dark-mode .ad-banner {
    max-width: 420px;
  }
  .dark-mode .ad-banner img {
    max-width: 420px;
  }
}

/* On large screens (800px+) */
@media (min-width: 800px) {
  .ad-banner {
    max-width: 420px;
  }
  .ad-banner img {
    max-width: 420px;
  }
  .dark-mode .ad-banner {
    max-width: 420px;
  }
  .dark-mode .ad-banner img {
    max-width: 420px;
  }
}

.ad-banner .logo {
  font-size: 1.2rem;
  color: #2d7dff;
}

.ad-banner .ad-label {
  font-size: 0.8rem;
  color: #666;
}


/* === TOP CONTROLS === */
.top-controls {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-bottom: 8px;
}

.theme-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f0f0f0;
  color: #333;
}

.mute-btn {
  background: none;
  border: none;
  font-size: 1.2rem;
  cursor: pointer;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f0f0f0;
  color: #333;
}

.restart-btn-container {
  margin: 16px auto;
  text-align: center;
}


/* === DARK MODE STYLES === */
body.dark-mode {
  background: #121212;
  color: #e0e0e0;
}

.dark-mode .game-container {
  background: #1e1e1e;
  box-shadow: 0 8px 24px rgba(0,0,0,0.3);
}

.dark-mode h1 {
  color: #4a9eff;
}

.dark-mode .tagline,
.dark-mode .streak,
.dark-mode .legend-content,
.dark-mode .legend-toggle {
  color: #bbb;
}

.dark-mode .letter {
  border-color: #444;
}

.dark-mode .correct { background: #0066cc; }
.dark-mode .present { background: #cc9500; }
.dark-mode .absent { background: #555; }

.dark-mode .keyboard .key {
  background: #2d2d2d;
  border-color: #444;
  color: white;
}

.dark-mode .controls button {
  background: #0066cc;
}

.dark-mode .controls #hint-btn {
  background: #cc9500;
}

.dark-mode .legend .correct { background: #0066cc; }
.dark-mode .legend .present { background: #cc9500; }
.dark-mode .legend .absent { background: #555; }

.dark-mode .ad-banner {
  background: #1e1e1e;
  border-color: #444;
  color: white;
}

.dark-mode .ad-banner .logo { color: #4a9eff; }
.dark-mode .ad-banner .ad-label { color: #aaa; }   


#custom-share-message {
  font-family: 'Courier New', monospace;
  font-size: 14px;
  line-height: 1.4;
  resize: vertical;
}


/* === SHARE MODAL DARK MODE === */
.dark-mode .share-modal .modal-content,
.dark-mode #share-modal > div {
  background: #1e1e1e !important;
  color: #e0e0e0 !important;
}

.dark-mode #share-modal h3,
.dark-mode #share-modal p {
  color: #e0e0e0 !important;
}

.dark-mode #custom-share-message {
  background: #2d2d2d !important;
  color: #e0e0e0 !important;
  border-color: #444 !important;
}

.dark-mode #custom-share-message::placeholder {
  color: #aaa !important;
}

/* Dark mode buttons */
.dark-mode #social-buttons button {
  background: #3a3a3a !important;
  color: white !important;
  border: none !important;
}

.dark-mode #social-buttons button:hover {
  opacity: 0.9 !important;
}

.dark-mode #share-modal button[onclick="closeShareModal()"] {
  background: #555 !important;
}