/* Basic Reset & Body Styles */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    display: flex;
    justify-content: center;
    align-items: center;
    min-height: 100vh;
    background: linear-gradient(135deg, #6e8efb, #a777e3);
    color: #fff;
    overflow: hidden; /* Prevents scrollbars during transitions */
}

/* Screen Management */
.screen {
    display: none;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    width: 90vw;
    max-width: 500px;
    padding: 30px;
    background-color: rgba(255, 255, 255, 0.1);
    border-radius: 20px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
    backdrop-filter: blur(10px);
    animation: fadeIn 0.5s ease-out;
}

.screen.active {
    display: flex;
}

@keyframes fadeIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

/* Welcome Screen Specifics */
#welcome-screen h1 {
    font-size: 2.5em;
    margin-bottom: 5px;
    color: #f0f0f0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

#welcome-screen h2 {
    font-size: 3em;
    font-weight: bold;
    margin-bottom: 30px;
    color: #fff;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.4);
    animation: pulse 2s infinite ease-in-out;
}

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

/* Button Styling */
.btn {
    background: linear-gradient(145deg, #fe8c00, #f83600);
    color: white;
    border: none;
    padding: 15px 30px;
    margin: 10px;
    border-radius: 50px;
    font-size: 1.1em;
    font-weight: bold;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.btn:hover {
    transform: translateY(-3px) scale(1.05);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.3);
    background: linear-gradient(145deg, #f83600, #fe8c00);
}

.btn:active {
    transform: translateY(-1px) scale(1.02);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

/* Selected Button Styling */
.btn.selected, .btn.selected-mode {
    background: linear-gradient(145deg, #56ab2f, #a8e063); /* Example selected color */
    color: white;
    transform: scale(1.05);
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
    border: 2px solid #a8e063; /* Add a border to make it stand out */
}

/* Options Screen */
#options-screen h2, #options-screen h3 {
    margin-bottom: 20px;
    color: #e0e0e0;
}

#bot-difficulty-selection, #symbol-selection {
    margin-top: 20px;
    animation: slideDownFadeIn 0.5s ease-out;
}

.hidden {
    display: none !important;
}

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

/* Game Screen */
#turn-indicator {
    font-size: 1.5em;
    margin-bottom: 25px;
    font-weight: bold;
    color: #fff;
    padding: 10px 20px;
    background-color: rgba(0,0,0,0.2);
    border-radius: 10px;
}

.tic-tac-toe-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 10px; /* Increased gap for a cleaner look */
    width: 300px; /* Adjust as needed */
    height: 300px; /* Adjust as needed */
    margin-bottom: 20px;
}

.cell {
    background-color: rgba(255, 255, 255, 0.2);
    border-radius: 10px; /* Rounded corners for cells */
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 4em; /* Larger symbols */
    font-weight: bold;
    cursor: pointer;
    transition: background-color 0.3s ease, transform 0.2s ease;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.cell:hover {
    background-color: rgba(255, 255, 255, 0.3);
    transform: scale(1.03);
}

.cell.X {
    color: #ff5252; /* Red for X */
}

.cell.O {
    color: #448aff; /* Blue for O */
}

.cell.win-cell { /* Highlight winning cells */
    animation: winPulse 0.8s infinite alternate;
}
.cell.win-cell.X { background-color: rgba(255, 82, 82, 0.5); }
.cell.win-cell.O { background-color: rgba(68, 138, 255, 0.5); }


@keyframes winPulse {
    from { transform: scale(1); box-shadow: 0 0 5px currentColor; }
    to   { transform: scale(1.1); box-shadow: 0 0 20px currentColor; }
}

/* Player Names in Friend Mode */
#player-names {
    margin-top: 15px;
    font-size: 1.1em;
}
#player-names p { margin: 5px 0; }

/* Result Pop-up */
.popup {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.6);
    display: none; /* Initially hidden */
    justify-content: center;
    align-items: center;
    z-index: 1000;
    animation: popupFadeIn 0.3s ease-out;
}

.popup.active {
    display: flex;
}

.popup-content {
    background: linear-gradient(135deg, #667eea, #764ba2);
    padding: 40px;
    border-radius: 15px;
    text-align: center;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    animation: popupScaleUp 0.4s cubic-bezier(0.68, -0.55, 0.27, 1.55); /* Bouncy effect */
    position: relative;
}

@keyframes popupFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes popupScaleUp {
    from { opacity: 0; transform: scale(0.7); }
    to { opacity: 1; transform: scale(1); }
}

#result-message {
    font-size: 2em;
    margin-bottom: 20px;
    color: #fff;
}

/* Animations for win/lose messages */
#winner-animation, #loser-animation {
    font-size: 3em; /* Adjust size as needed */
    margin-bottom: 20px;
    animation: bounceZoom 1s ease-in-out;
}

@keyframes bounceZoom {
    0%, 20%, 50%, 80%, 100% { transform: translateY(0) scale(1); }
    40% { transform: translateY(-30px) scale(1.1); }
    60% { transform: translateY(-15px) scale(1.05); }
}

#loser-animation {
    color: #ff6b6b; /* A sad red */
    animation: shake 0.8s cubic-bezier(.36,.07,.19,.97) both;
}

@keyframes shake {
  10%, 90% {
    transform: translate3d(-1px, 0, 0);
  }
  20%, 80% {
    transform: translate3d(2px, 0, 0);
  }
  30%, 50%, 70% {
    transform: translate3d(-4px, 0, 0);
  }
  40%, 60% {
    transform: translate3d(4px, 0, 0);
  }
}

/* Animation for invalid cell click */
@keyframes shakeInvalid {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  50% { transform: translateX(5px); }
  75% { transform: translateX(-5px); }
}

/* Utility Class */
.hidden {
    display: none !important;
}
/* Splash screen styles */
#logo-splash {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background-color: #000;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
  opacity: 1;
  transition: opacity 1s ease-out;
}
#logo-splash img {
  max-width: 70vw;
  max-height: 70vh;
  opacity: 0;
  transform: scale(0.3);
  transition: all 0.8s ease-out;
}
