/* style.css */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: linear-gradient(135deg, #1a2a6c, #1f9cb2, #1a2a6c);
    height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 15px;
}

.game-container {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
    width: 100%;
    max-width: 1000px;
    height: 90vh;
    gap: 20px;
}

.gameboard-container {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
    flex-direction: column;
}

.gameboard {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 8px;
    max-width: 90vh;
    max-height: 90vh;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 15px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
}

.square {
    background: linear-gradient(145deg, #f0f0f0, #d0d0d0);
    border-radius: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 6rem;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    aspect-ratio: 1;
    position: relative;
    overflow: hidden;
}

.square:hover {
    transform: translateY(-3px);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
    background: linear-gradient(145deg, #e0e0e0, #c0c0c0);
}

.square::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(45deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transform: translateX(-100%);
    transition: transform 0.5s ease;
}

.square:hover::before {
    transform: translateX(100%);
}

.info-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 150px;
    height: 90vh;
    background: rgba(255, 255, 255, 0.1);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    text-align: center;
}

.info-panel h2 {
    color: white;
    margin-bottom: 15px;
    font-size: 1.2rem;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
}

.player-indicator {
    width: 60px;
    height: 60px;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 2rem;
    font-weight: bold;
    margin: 10px 0;
    background: rgba(255, 255, 255, 0.2);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.player-indicator.active {
    background: linear-gradient(135deg, #9affab, #c4fac4);
    box-shadow: 0 0 15px rgba(154, 255, 159, 0.5);
    animation: pulse 2s infinite;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.info-panel p {
    color: white;
    font-size: 0.9rem;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3);
}

/* Responsive design */
@media (max-width: 768px) {
    .game-container {
        flex-direction: column;
        height: auto;
        gap: 15px;
    }
    
    .gameboard-container {
        width: 100%;
        height: 70vh;
    }
    
    .info-panel {
        width: 100%;
        height: 150px;
        flex-direction: row;
        gap: 20px;
    }
    
    .gameboard {
        max-width: 90vw;
        max-height: 90vw;
    }
    
    .square {
        font-size: 2.5rem;
    }
    
    .player-indicator {
        width: 50px;
        height: 50px;
        font-size: 1.5rem;
    }
}

@media (max-width: 480px) {
    body {
        padding: 10px;
    }
    
    .gameboard {
        gap: 4px;
        padding: 10px;
    }
    
    .square {
        font-size: 2rem;
    }
    
    .info-panel {
        height: 120px;
        padding: 15px;
    }
    
    .info-panel h2 {
        font-size: 1rem;
    }
    
    .player-indicator {
        width: 40px;
        height: 40px;
        font-size: 1.2rem;
    }
}

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

.modal-content {
  background: linear-gradient(135deg, #ffffff, #f0f0f0);
  padding: 30px;
  border-radius: 15px;
  width: 90%;
  max-width: 500px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5);
  position: relative;
  text-align: center;
  animation: modalSlide 0.3s ease;
}

@keyframes modalSlide {
  from { transform: translateY(-50px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.close-modal {
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  font-weight: bold;
  color: #333;
  cursor: pointer;
  transition: color 0.3s;
}

.close-modal:hover {
  color: #e74c3c;
}

#modalQuestion {
  color: #1a2a6c;
  margin-bottom: 25px;
  font-size: 1.3rem;
  line-height: 1.4;
}

.modal-buttons {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 20px;
}

.btn {
  padding: 12px 30px;
  font-size: 1.1rem;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: bold;
  min-width: 120px;
}

.btn-true {
  background: linear-gradient(135deg, #2ecc71, #27ae60);
  color: white;
}

.btn-true:hover {
  background: linear-gradient(135deg, #27ae60, #219a52);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(46, 204, 113, 0.4);
}

.btn-false {
  background: linear-gradient(135deg, #e74c3c, #c0392b);
  color: white;
}

.btn-false:hover {
  background: linear-gradient(135deg, #c0392b, #a93226);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.4);
}

.feedback {
  font-size: 1rem;
  font-weight: bold;
  min-height: 24px;
  margin-top: 15px;
}

.feedback.correct {
  color: #27ae60;
}

.feedback.incorrect {
  color: #e74c3c;
}

/* Winner Modal */
#winnerModal {
  display: none;
  position: fixed;
  z-index: 1001;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.8);
  justify-content: center;
  align-items: center;
}

#winnerContent {
  background: linear-gradient(135deg, #ffffff, #f9f9f9);
  padding: 40px;
  border-radius: 20px;
  text-align: center;
  max-width: 400px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.6);
  animation: modalSlide 0.4s ease;
}

#winnerIcon {
  font-size: 4rem;
  margin-bottom: 20px;
  animation: celebrate 1s infinite;
}

@keyframes celebrate {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.2) rotate(10deg); }
}

#winnerMessage {
  font-size: 1.5rem;
  color: #1a2a6c;
  margin-bottom: 25px;
  font-weight: bold;
}

#playAgainBtn {
  background: linear-gradient(135deg, #3498db, #2980b9);
  color: white;
  padding: 15px 40px;
  font-size: 1.2rem;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
  font-weight: bold;
}

#playAgainBtn:hover {
  background: linear-gradient(135deg, #2980b9, #2471a3);
  transform: translateY(-3px);
  box-shadow: 0 6px 15px rgba(52, 152, 219, 0.5);
}

/* --- INSTRUCTION PANEL STYLES --- */
.instruction-panel {
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    width: 100%; 
    height: 20vh;
    background: rgba(255, 255, 255, 0.15);
    border-radius: 15px;
    padding: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    backdrop-filter: blur(10px);
    border: 2px solid rgba(255, 255, 255, 0.2);
    text-align: left;
    color: white;
    font-size: 0.9rem;
    line-height: 1.4;
    margin-bottom: 10px;
}

.instruction-panel h3 {
    color: #fff;
    margin-bottom: 15px;
    font-size: 1.3rem;
    text-align: center;
    text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.3);
    padding-bottom: 10px;
}

.instruction-panel ul {
    list-style-type: none;
    padding: 0;
    margin: 0;
}

.instruction-panel li {
    margin-bottom: 12px;
}

.instruction-panel strong {
    color: #9affab; /* Light green highlight */
    font-weight: bold;
}

.instruction-panel ul ul {
    margin-left: 15px;
    margin-top: 5px;
    font-size: 0.85rem;
    color: #e0e0e0;
}

.instruction-panel ul ul li {
    margin-bottom: 5px;
}

/* Responsive Adjustments for Instruction Panel */
@media (max-width: 768px) {
    .instruction-panel {
        width: 100%;
        height: auto;
        flex-direction: row;
        flex-wrap: wrap;
        gap: 15px;
        padding: 15px;
        order: -1; /* Move to top on mobile if desired, or keep in flow */
    }

    .instruction-panel h3 {
        width: 100%;
        text-align: center;
        margin-bottom: 10px;
        border-bottom: none;
    }

    .instruction-panel ul {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }

    .instruction-panel li {
        margin-bottom: 0;
        background: rgba(0, 0, 0, 0.2);
        padding: 8px 12px;
        border-radius: 8px;
        font-size: 0.8rem;
    }
    
    .instruction-panel ul ul {
        display: block;
        margin-left: 0;
        margin-top: 5px;
    }
}

@media (max-width: 480px) {
    .instruction-panel {
        flex-direction: column;
        height: auto;
        padding: 10px;
    }
    
    .instruction-panel li {
        font-size: 0.75rem;
        padding: 5px 10px;
    }
}

/* --- STARTER MODAL STYLES --- */
#starterModal .modal-content {
  max-width: 400px;
}

.guess-input-group {
  margin: 15px 0;
  text-align: left;
}

.guess-input-group label {
  display: block;
  color: #1a2a6c;
  font-weight: bold;
  margin-bottom: 5px;
  font-size: 1rem;
}

.guess-input-group input {
  width: 100%;
  padding: 10px;
  font-size: 1.2rem;
  border: 2px solid rgba(26, 42, 108, 0.3);
  border-radius: 8px;
  text-align: center;
  outline: none;
  transition: border-color 0.3s;
}

.guess-input-group input:focus {
  border-color: #1f9cb2;
  box-shadow: 0 0 8px rgba(31, 156, 178, 0.4);
}

#startGameBtn {
  width: 100%;
  margin-top: 10px;
}

/* Ensure modal feedback works for starter too */
#starterFeedback {
  margin-top: 15px;
  font-weight: bold;
  min-height: 20px;
}