/* Simon Says Game Styles */
.container {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
  text-align: center;
  background: white;
  min-height: 100vh;
  color: #333;
}

.header {
  margin-bottom: 30px;
}

.title {
  font-size: 2.8rem;
  font-weight: bold;
  margin-bottom: 10px;
  background: linear-gradient(135deg, #9333EA, #7C3AED);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  text-shadow: none;
}

.subtitle {
  font-size: 1.3rem;
  color: #666;
  margin-bottom: 20px;
}

/* Game Setup */
.gameSetup {
  max-width: 700px;
  margin: 0 auto 3rem auto;
  padding: 2rem;
  background: #f8f9fa;
  border-radius: 16px;
  border: 2px solid #e2e8f0;
}

.setupTitle {
  font-size: 1.8rem;
  margin-bottom: 2rem;
  color: #333;
  text-align: center;
}

.setupSection {
  margin-bottom: 2rem;
  text-align: center;
}

.setupSection h3 {
  font-size: 1.2rem;
  margin-bottom: 1rem;
  color: #333;
}

.buttonGroup {
  display: flex;
  justify-content: center;
  gap: 15px;
  flex-wrap: wrap;
}

.setupButton {
  padding: 15px 25px;
  border: 2px solid #e2e8f0;
  border-radius: 12px;
  background: white;
  color: #333;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.3s ease;
  font-size: 1rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
  min-width: 120px;
}

.setupButton:hover {
  border-color: #9333EA;
  transform: translateY(-2px);
}

.setupButton.active {
  background: linear-gradient(135deg, #9333EA, #7C3AED);
  color: white;
  border-color: #9333EA;
}

.modeDescription {
  font-size: 0.8rem;
  opacity: 0.8;
}

.playButton {
  background: linear-gradient(135deg, #22C55E, #16A34A);
  color: white;
  border: none;
  padding: 18px 40px;
  font-size: 1.3rem;
  font-weight: bold;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
  margin-top: 1.5rem;
}

.playButton:hover {
  background: linear-gradient(135deg, #16A34A, #15803D);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

.soundControl {
  text-align: center;
}

.soundToggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  cursor: pointer;
  font-size: 1rem;
}

.soundToggle input[type="checkbox"] {
  transform: scale(1.2);
  cursor: pointer;
}

/* Game Stats */
.gameStats {
  display: flex;
  justify-content: center;
  gap: 30px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.stat {
  background: #f8f9fa;
  padding: 15px 25px;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  color: #2d3748;
  min-width: 100px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.statLabel {
  display: block;
  font-size: 0.9rem;
  color: #666;
  margin-bottom: 5px;
}

.statValue {
  display: block;
  font-size: 1.5rem;
  font-weight: bold;
  color: #9333EA;
}

/* Status Message */
.statusMessage {
  margin-bottom: 30px;
  padding: 15px;
  background: linear-gradient(135deg, #f3f4f6, #e5e7eb);
  border-radius: 12px;
  border-left: 4px solid #9333EA;
}

.statusMessage p {
  font-size: 1.1rem;
  font-weight: 500;
  margin: 0;
  color: #374151;
}

/* Game Board */
.gameBoard {
  display: grid;
  gap: 20px;
  margin: 30px auto;
  max-width: 600px;
  perspective: 1000px;
  padding: 20px;
}

.grid4 {
  grid-template-columns: repeat(2, 1fr);
  max-width: 400px;
}

.grid7 {
  grid-template-columns: repeat(3, 1fr);
  max-width: 500px;
}

.grid10 {
  grid-template-columns: repeat(4, 1fr);
  max-width: 600px;
}

.gameButton {
  aspect-ratio: 1;
  border: none;
  border-radius: 20px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  min-height: 100px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transform-style: preserve-3d;
}

.gameButton:hover:not(:disabled) {
  transform: translateY(-5px) scale(1.05);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3) !important;
}

.gameButton:active:not(:disabled) {
  transform: translateY(-2px) scale(0.98);
}

.gameButton:disabled {
  cursor: not-allowed;
  opacity: 0.8;
}

.gameButton.active {
  transform: translateY(-5px) scale(1.1);
  filter: brightness(1.3);
  animation: pulse 0.6s ease;
}

@keyframes pulse {
  0%, 100% { transform: translateY(-5px) scale(1.1); }
  50% { transform: translateY(-8px) scale(1.15); }
}

.buttonLabel {
  font-size: 1rem;
  font-weight: bold;
}



/* Action Buttons */
.actionButtons {
  margin: 30px 0;
}

.startButton {
  background: linear-gradient(135deg, #22C55E, #16A34A);
  color: white;
  border: none;
  padding: 15px 40px;
  font-size: 1.2rem;
  font-weight: bold;
  border-radius: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(34, 197, 94, 0.3);
}

.startButton:hover:not(:disabled) {
  background: linear-gradient(135deg, #16A34A, #15803D);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(34, 197, 94, 0.4);
}

.startButton:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

/* Keyboard Info */
.keyboardInfo {
  margin: 20px 0;
  padding: 15px;
  background: #f8f9fa;
  border-radius: 10px;
  border: 1px solid #e2e8f0;
}

.keyboardInfo h4 {
  margin: 0 0 8px 0;
  color: #333;
  font-size: 1rem;
}

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

/* Rules and Benefits */
.rulesContainer {
  max-width: 800px;
  margin: 3rem auto;
  padding: 0 1rem;
  font-family: system-ui, -apple-system, sans-serif;
  text-align: left;
}

.sectionTitle {
  font-size: 1.6rem;
  margin: 2rem 0 1.2rem 0;
  color: #111;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-align: center;
}

.rulesGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.ruleCard {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  text-align: center;
  transition: all 0.3s ease;
}

.ruleCard:hover {
  border-color: #9333EA;
  transform: translateY(-2px);
}

.ruleNumber {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #9333EA, #7C3AED);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  margin: 0 auto 1rem auto;
}

.ruleCard h4 {
  margin: 0 0 0.5rem 0;
  color: #333;
  font-size: 1.1rem;
}

.ruleCard p {
  margin: 0;
  color: #666;
  line-height: 1.5;
}



.algorithmText {
  line-height: 1.7;
  color: #333;
  background: #f8f9fa;
  padding: 1.5rem;
  border-radius: 10px;
  border-left: 4px solid #9333EA;
}

.rulesGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.ruleCard {
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
  text-align: center;
  transition: all 0.3s ease;
}

.ruleCard:hover {
  border-color: #9333EA;
  transform: translateY(-2px);
}

.ruleNumber {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, #9333EA, #7C3AED);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 1.2rem;
  margin: 0 auto 1rem auto;
}

.ruleCard h4 {
  margin: 0 0 0.5rem 0;
  color: #333;
  font-size: 1.1rem;
}

.ruleCard p {
  margin: 0;
  color: #666;
  line-height: 1.5;
}

.controlsInfo {
  margin: 2rem 0;
  background: white;
  padding: 1.5rem;
  border-radius: 12px;
  border: 2px solid #e2e8f0;
}

.controlsInfo h3 {
  margin: 0 0 1rem 0;
  color: #333;
  text-align: center;
}

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

.controlItem {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.8rem;
  background: #f8f9fa;
  border-radius: 8px;
}

.controlKey {
  font-weight: bold;
  color: #9333EA;
  background: #f3f0ff;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.9rem;
}

.rulesGrid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1rem;
  margin: 1rem auto;
  align-items: stretch;
  justify-items: center;
  width: 100%;
  max-width: 1000px;
  padding: 0;
}

.ruleCard {
  background: linear-gradient(145deg, #f8fafc, #e2e8f0);
  border: 1px solid #cbd5e1;
  border-radius: 12px;
  padding: 1rem;
  transition: all 0.3s ease;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  height: 100%;
}

.ruleCard:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1);
  border-color: #9333EA;
}

.ruleNumber {
  background: linear-gradient(135deg, #9333EA, #7c3aed);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  font-size: 0.875rem;
  flex-shrink: 0;
  margin-top: 2px;
}

.controlsInfo {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin: 1rem 0;
  padding: 1rem;
  background: linear-gradient(145deg, #f1f5f9, #e2e8f0);
  border-radius: 12px;
  border: 1px solid #cbd5e1;
}

.controlKey {
  background: linear-gradient(145deg, #ffffff, #f1f5f9);
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  padding: 0.5rem 0.75rem;
  font-family: 'Courier New', monospace;
  font-weight: bold;
  color: #475569;
  font-size: 0.875rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  transition: all 0.2s ease;
}

.controlKey:hover {
  background: linear-gradient(145deg, #f1f5f9, #e2e8f0);
  transform: translateY(-1px);
}

/* Responsive Design */
@media (max-width: 768px) {
  .container {
    padding: 15px;
  }
  
  .title {
    font-size: 2.2rem;
  }
  
  .subtitle {
    font-size: 1.1rem;
  }
  
  .gameControls {
    gap: 15px;
  }
  
  .buttonGroup {
    gap: 8px;
  }
  
  .gameSetup {
    padding: 1.5rem;
  }
  
  .setupTitle {
    font-size: 1.5rem;
  }
  
  .setupButton {
    padding: 12px 20px;
    font-size: 0.9rem;
    min-width: 100px;
  }
  
  .playButton {
    padding: 15px 30px;
    font-size: 1.1rem;
  }
  
  .rulesContainer {
    max-width: 500px;
    margin: 2rem auto;
    padding: 0 1rem;
    text-align: center;
  }
  
  .rulesGrid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1rem;
    justify-items: center;
    align-items: stretch;
    width: 100%;
  }
  
  .ruleCard {
    width: 100%;
    max-width: 100%;
    text-align: left;
    padding: 1rem;
    margin: 0;
    box-sizing: border-box;
    text-align: left;
  }
  
  .controlsInfo {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    align-items: center;
    width: 100%;
    max-width: 100%;
    margin: 1rem 0;
    padding: 1rem;
    box-sizing: border-box;
  }
  
  .ruleCard {
    padding: 1.2rem;
  }
  
  .controlsInfo,
  .tipsSection {
    padding: 1.2rem;
  }
  
  .gameStats {
    gap: 15px;
  }
  
  .stat {
    padding: 12px 20px;
    min-width: 80px;
  }
  
  .gameBoard {
    gap: 15px;
    padding: 15px;
    max-width: 350px;
  }
  
  .grid4 {
    max-width: 280px;
  }
  
  .grid7 {
    max-width: 320px;
  }
  
  .grid10 {
    max-width: 350px;
  }
  
  .gameButton {
    min-height: 80px;
    font-size: 0.9rem;
  }
  
  .buttonLabel {
    font-size: 0.9rem;
  }
  

  
  .startButton {
    padding: 12px 30px;
    font-size: 1.1rem;
  }
  
  .sectionTitle {
    font-size: 1.4rem;
  }
  

}

@media (max-width: 480px) {
  .gameBoard {
    gap: 10px;
    max-width: 300px;
  }
  
  .grid4 {
    max-width: 240px;
  }
  
  .grid7 {
    max-width: 280px;
  }
  
  .grid10 {
    max-width: 300px;
  }
  
  .gameButton {
    min-height: 70px;
    border-radius: 15px;
  }
  
  .buttonLabel {
    font-size: 0.8rem;
  }
  

  
  .container {
    padding: 10px;
  }
  
  .rulesContainer {
    padding: 0 0.25rem;
    text-align: center;
  }
  
  .sectionTitle {
    font-size: 1.1rem;
    margin-bottom: 0.75rem;
  }
  
  .rulesGrid {
    grid-template-columns: 1fr;
    gap: 0.75rem;
    justify-items: center;
    max-width: 100%;
    margin: 0 auto;
  }
  
  .ruleCard {
    padding: 0.75rem;
    gap: 0.5rem;
    width: 100%;
    max-width: 320px;
    margin: 0 auto;
    text-align: left;
  }
  
  .ruleNumber {
    width: 20px;
    height: 20px;
    font-size: 0.75rem;
    margin-top: 0;
    flex-shrink: 0;
  }
  
  .controlsInfo {
    gap: 0.5rem;
    padding: 0.75rem;
    flex-direction: column;
    align-items: center;
    max-width: 320px;
    margin: 1rem auto;
  }
  
  .controlKey {
    padding: 0.4rem 0.6rem;
    font-size: 0.75rem;
  }
  
  .gameSetup {
    padding: 1rem 0.75rem;
  }
  
  .setupSection {
    margin-bottom: 1rem;
  }

}

  /* ==== Alignment Overrides (Single Source of Truth) ==== */
  .rulesGrid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    width: 100%;
    max-width: 760px;
    margin: 0 auto 2rem auto;
    padding: 0 0.5rem;
  }

  .ruleCard {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
  }

  .ruleNumber {
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
  }

  .ruleText {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    text-align: left;
    flex: 1;
    min-width: 0;
  }

  .ruleText h4 {
    margin: 0;
    font-size: 1.15rem;
  }

  .ruleText p {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.3;
  }

  @media (max-width: 480px) {
    .rulesGrid {
      gap: 0.85rem;
      padding: 0 0.25rem;
    }
    .ruleCard {
      padding: 0.85rem 0.9rem;
      border-radius: 14px;
    }
    .ruleText h4 { font-size: 1.05rem; }
    .ruleText p { font-size: 0.85rem; }
    .ruleNumber { width: 32px; height: 32px; font-size: 0.85rem; }
  }