/* Hive Five - Daily 5-Letter Word Game Styles - OPTIMIZED FOR ELDERLY & CHILDREN */

.hive-five-container {
  max-width: 1200px; /* Increased for better desktop layout */
  margin: 0 auto;
  padding: 0.5rem;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Arial, sans-serif;
  display: flex;
  flex-direction: column;
  min-height: calc(100vh - 80px); /* Account for header */
}

/* Tablet layout - vertical stack but optimized */
@media (min-width: 768px) and (max-width: 899px) {
  .game-content {
    max-width: 500px;
    margin: 0 auto;
  }
  
  .game-board {
    margin: 0.3rem 0;
  }
  
  .keyboard {
    margin: 0.3rem 0;
  }
}

/* Desktop layout - side by side */
@media (min-width: 900px) {
  .game-content {
    display: flex;
    gap: 2rem;
    align-items: flex-start;
    justify-content: center;
    max-width: 1000px;
    margin: 0 auto;
    padding: 1rem;
  }
  
  .game-board-section {
    flex: 0 0 400px; /* Fixed width for game board */
    max-width: 400px;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  
  .keyboard-section {
    flex: 0 0 480px; /* Fixed width for keyboard */
    max-width: 480px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-height: 400px; /* Ensure adequate height for full keyboard visibility */
  }
  
  /* Ensure game board doesn't get too much space */
  .game-board {
    margin: 0.15rem 0;
  }
}

/* Game Controls - Positioned after keyboard */

.game-controls {
  display: flex;
  gap: 1rem;
  align-items: center;
  justify-content: center;
  margin: 0.3rem 0;
  padding: 0.15rem;
}

.how-to-play-button {
  background: linear-gradient(135deg, #ffeb3b 0%, #f9d71c 100%);
  color: #2c3e50;
  border: none;
  padding: 0.6rem 1.2rem;
  border-radius: 20px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(249, 215, 28, 0.2);
}

.how-to-play-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(249, 215, 28, 0.3);
  background: linear-gradient(135deg, #f9d71c 0%, #ffeb3b 100%);
}

.share-button {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid #d3d6da;
  background: white;
  color: #2c3e50;
  font-size: 1rem;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.help-button:hover, .share-button:hover {
  border-color: #2c3e50;
  background: #f8f9fa;
}

.share-button {
  background: #ffeb3b;
  border-color: #f9d71c;
  color: #2c3e50;
}

.share-button:hover {
  background: #f9d71c;
}

/* Game Board */
.game-board {
  display: grid;
  grid-template-rows: repeat(6, 1fr);
  gap: 4px;
  margin: 0.3rem 0;
  justify-content: center;
  flex-shrink: 0;
}

.word-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  justify-content: center;
}

.letter-box {
  width: 62px;
  height: 62px;
  border: 2px solid #d3d6da;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.8rem;
  font-weight: bold;
  text-transform: uppercase;
  background: white;
  color: #2c3e50;
  transition: all 0.2s ease;
  border-radius: 4px;
}

.letter-box.filled {
  border-color: #878a8c;
  background: #f8f9fa;
}

.letter-box.correct {
  background: #6aaa64;
  border-color: #6aaa64;
  color: white;
}

.letter-box.present {
  background: #c9b458;
  border-color: #c9b458;
  color: white;
}

.letter-box.absent {
  background: #787c7e;
  border-color: #787c7e;
  color: white;
}

.letter-box.flip {
  animation: flip 0.6s ease-in-out;
}

@keyframes flip {
  0% {
    transform: rotateX(0);
  }
  50% {
    transform: rotateX(-90deg);
  }
  100% {
    transform: rotateX(0);
  }
}

/* Game Messages */
.game-messages {
  text-align: center;
  margin: 0.15rem 0;
  height: 1.5rem;
  flex-shrink: 0;
}

/* Desktop message positioning */
@media (min-width: 900px) {
  .game-messages {
    margin: 0.3rem 0;
    height: 2rem; /* More space for desktop */
  }
}

.message {
  padding: 0.5rem 1rem;
  border-radius: 4px;
  font-weight: bold;
  display: inline-block;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.message.show {
  opacity: 1;
}

.message.success {
  background: #6aaa64;
  color: white;
}

.message.error {
  background: #e74c3c;
  color: white;
}

.message.info {
  background: #3498db;
  color: white;
}

/* Keyboard */
.keyboard {
  margin: 0.15rem 0 0.15rem 0;
  flex-shrink: 0;
  width: 100%;
}

/* Ensure keyboard is fully visible on desktop */
@media (min-width: 900px) {
  .keyboard {
    margin: 0;
    padding: 0.3rem 0;
  }
}

.keyboard-row {
  display: flex;
  justify-content: center;
  margin-bottom: 3px; /* Reduced space between rows */
  gap: 6px; /* More space between keys */
}

.key {
  min-width: 65px; /* Larger for easier tapping */
  height: 75px; /* Taller for better accessibility */
  border-radius: 8px;
  border: 2px solid #b0b3b6; /* Add border for better definition */
  background: #d3d6da;
  color: #2c3e50;
  font-size: 1.2rem; /* Larger font for better readability */
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  user-select: none;
  touch-action: manipulation;
  margin: 2px; /* Add margin for better separation */
}

.key:hover {
  background: #bbbfc2;
  transform: translateY(-1px);
}

.key:active {
  transform: translateY(0);
  background: #a8abae;
}

.key.key-large {
  min-width: 95px; /* Larger for important keys like ENTER and BACKSPACE */
  font-size: 1.1rem;
  font-weight: 800; /* Extra bold for important keys */
}

.key.correct {
  background: #6aaa64;
  color: white;
}

.key.present {
  background: #c9b458;
  color: white;
}

.key.absent {
  background: #787c7e;
  color: white;
}

.key:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Game Stats Modal */
.game-stats {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.stats-content {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  max-width: 400px;
  width: 90%;
  text-align: center;
}

.stats-content h3 {
  margin: 0 0 1.5rem;
  color: #2c3e50;
  font-size: 1.5rem;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-item {
  text-align: center;
}

.stat-number {
  font-size: 2rem;
  font-weight: bold;
  color: #2c3e50;
}

.stat-label {
  font-size: 0.8rem;
  color: #666;
  text-transform: uppercase;
}

.guess-distribution h4 {
  margin: 0 0 1rem;
  color: #2c3e50;
}

.distribution-chart {
  text-align: left;
}

.distribution-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.5rem;
}

.distribution-label {
  min-width: 20px;
  margin-right: 0.5rem;
  font-weight: bold;
}

.distribution-bar {
  background: #c9b458;
  height: 20px;
  min-width: 20px;
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  padding-right: 0.5rem;
  color: white;
  font-size: 0.8rem;
  font-weight: bold;
}

.distribution-bar.current {
  background: #6aaa64;
}

.stats-actions {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-top: 2rem;
}

.stats-button {
  padding: 0.8rem 1.5rem;
  border: none;
  border-radius: 4px;
  background: #ffeb3b;
  color: #2c3e50;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s ease;
}

.stats-button:hover {
  background: #f9d71c;
}

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

.modal-content {
  background: white;
  border-radius: 8px;
  max-width: 400px;
  width: 90%;
  overflow: hidden;
}

.modal-header {
  background: #ffeb3b;
  padding: 1rem 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.modal-header h3 {
  margin: 0;
  color: #2c3e50;
}

.close-modal {
  background: none;
  border: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #2c3e50;
}

.modal-body {
  padding: 1.5rem;
  text-align: center;
}

.word-reveal {
  font-size: 2rem;
  font-weight: bold;
  color: #2c3e50;
  margin: 1rem 0;
  letter-spacing: 0.2rem;
  text-transform: uppercase;
}

.modal-actions {
  padding: 1rem 1.5rem;
  display: flex;
  gap: 1rem;
  justify-content: center;
  background: #f8f9fa;
}

.modal-button {
  padding: 0.8rem 1.2rem;
  border: none;
  border-radius: 4px;
  background: #ffeb3b;
  color: #2c3e50;
  font-weight: bold;
  cursor: pointer;
  transition: background 0.2s ease;
}

.modal-button:hover {
  background: #f9d71c;
}


/* SEO Content Section */
.seo-content {
  background: #f8f9fa;
  padding: 3rem 0;
  margin-top: 2rem;
}

.content-wrapper {
  max-width: 800px;
  margin: 0 auto;
  padding: 0 2rem;
}

.about-wordle h2 {
  color: #2c3e50;
  font-size: 1.8rem;
  margin-bottom: 1rem;
  text-align: center;
}

.about-wordle h3 {
  color: #2c3e50;
  font-size: 1.3rem;
  margin: 2rem 0 1rem 0;
}

.about-wordle p {
  color: #555;
  line-height: 1.6;
  margin-bottom: 1rem;
  font-size: 1rem;
}

.about-wordle ul {
  margin: 1rem 0;
  padding-left: 2rem;
}

.about-wordle li {
  color: #555;
  line-height: 1.6;
  margin-bottom: 0.5rem;
}

.promo-content h3 {
  margin: 0 0 0.25rem;
  color: #2c3e50;
  font-size: 1.1rem;
}

.promo-content p {
  margin: 0 0 0.5rem;
  color: #666;
  font-size: 0.9rem;
}

.promo-button {
  display: inline-block;
  padding: 0.6rem 1.5rem;
  background: #ffeb3b;
  color: #2c3e50;
  text-decoration: none;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.9rem;
  transition: all 0.3s ease;
}

.promo-button:hover {
  background: #f9d71c;
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(249, 215, 28, 0.3);
}

/* Rules Modal */
.rules-modal {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1001;
}

.rules-content {
  background: white;
  border-radius: 12px;
  max-width: 500px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
}

.rules-header {
  background: #ffeb3b;
  padding: 1.5rem;
  text-align: center;
  border-radius: 12px 12px 0 0;
}

.rules-header h2 {
  margin: 0;
  color: #2c3e50;
  font-size: 1.8rem;
}

.rules-body {
  padding: 1rem 1.5rem;
}

.rules-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 1.5rem;
}

.rule-section h4 {
  color: #2c3e50;
  margin: 0 0 0.8rem 0;
  font-size: 1.1rem;
}

.rule-section ul {
  padding-left: 1rem;
  margin: 0;
}

.rule-section li {
  color: #555;
  line-height: 1.4;
  margin-bottom: 0.5rem;
  font-size: 0.95rem;
}

.compact-examples {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.compact-example {
  display: flex;
  align-items: center;
  gap: 0.8rem;
}

.compact-example .example-box {
  width: 28px;
  height: 28px;
  font-size: 0.9rem;
}

.compact-example span {
  color: #555;
  font-size: 0.9rem;
}

.quick-tips {
  background: #f8f9fa;
  padding: 1rem;
  border-radius: 8px;
  margin-top: 1rem;
}

.quick-tips h4 {
  color: #2c3e50;
  margin: 0 0 0.5rem 0;
  font-size: 1rem;
}

.quick-tips p {
  color: #555;
  line-height: 1.5;
  margin: 0;
  font-size: 0.95rem;
}

/* Mobile responsive for rules */
@media (max-width: 640px) {
  .rules-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
  
  .compact-examples {
    gap: 0.6rem;
  }
}

.example-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 3px;
  margin: 1rem 0;
  justify-content: center;
  max-width: 200px;
}

.example-box {
  width: 35px;
  height: 35px;
  border: 2px solid #d3d6da;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  font-weight: bold;
  text-transform: uppercase;
  background: white;
  color: #2c3e50;
}

.example-box.correct {
  background: #6aaa64;
  border-color: #6aaa64;
  color: white;
}

.example-box.present {
  background: #c9b458;
  border-color: #c9b458;
  color: white;
}

.example-box.absent {
  background: #787c7e;
  border-color: #787c7e;
  color: white;
}

.rules-actions {
  padding: 1.5rem;
  text-align: center;
  border-top: 1px solid #eee;
}

.rules-button {
  padding: 0.8rem 2rem;
  border: none;
  border-radius: 25px;
  background: #ffeb3b;
  color: #2c3e50;
  font-weight: bold;
  cursor: pointer;
  font-size: 1rem;
  transition: all 0.3s ease;
}

.rules-button:hover {
  background: #f9d71c;
  transform: translateY(-2px);
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .hive-five-container {
    padding: 0.25rem;
    min-height: calc(100vh - 60px);
  }
  
  
  .letter-box {
    width: 58px;
    height: 58px;
    font-size: 1.6rem;
    border-width: 2px;
  }
  
  .key {
    min-width: 58px; /* Larger for easier mobile tapping */
    height: 65px; /* Taller for better accessibility */
    font-size: 1.1rem; /* Maintain readable font size */
    margin: 1px; /* Reduce margin slightly on mobile */
  }
  
  .key.key-large {
    min-width: 80px; /* Larger for important keys on mobile */
    font-size: 1rem; /* Maintain readability */
  }
  
  .game-board {
    margin: 0.15rem 0;
    gap: 3px;
  }
  
  .word-row {
    gap: 3px;
  }
  
  .keyboard {
    margin: 0.15rem 0 0.07rem 0;
  }
  
  .keyboard-row {
    margin-bottom: 4px;
    gap: 3px;
  }
  
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1rem;
  }
  
  .modal-actions {
    flex-direction: column;
  }
  
  
  .rules-content {
    max-width: 95%;
  }
  
  .rules-header {
    padding: 1rem;
  }
  
  .rules-body {
    padding: 1rem;
  }
}

@media (max-width: 480px) {
  .hive-five-container {
    padding: 0.2rem;
    /* Optimize for very small screens while maintaining usability */
  }
  
  
  .letter-box {
    width: 52px;
    height: 52px;
    font-size: 1.4rem;
    border-width: 2px;
  }
  
  .game-board {
    gap: 3px; /* Slightly smaller gap to fit better */
    margin: 0.1rem 0;
  }
  
  .word-row {
    gap: 3px;
  }
  
  .key {
    min-width: 50px; /* Larger than previous 45px - meets accessibility guidelines */
    height: 60px; /* Maintain good height for tapping */
    font-size: 1rem; /* Readable font size */
    margin: 1px;
  }
  
  .key.key-large {
    min-width: 70px; /* Larger for important keys even on small screens */
    font-size: 0.9rem; /* Maintain readability */
  }
  
  .keyboard {
    margin: 0.15rem 0 0.06rem 0; /* Reduce margins to fit better */
  }
  
  .keyboard-row {
    margin-bottom: 6px; /* Reduce spacing between rows */
    gap: 4px; /* Reduce gap between keys */
  }
  
}
  
  .game-board {
    gap: 2px;
  }
  
  .word-row {
    gap: 2px;
  }
  
  .keyboard-row {
    gap: 2px;
  }
  
  .stats-content {
    padding: 1rem;
  }
  
  .modal-body {
    padding: 1rem;
  }
  
  
}