/* Global Reset and Box Model */
body {
    font-family: 'Zen Dots', system-ui, sans-serif;
    margin: 0;
    padding: 15px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    /* Cosmic background image with color overlay for theme */
    background-image: url('img/stardust-galaxy.jpg'), linear-gradient(135deg, rgba(15,12,41,0.65) 0%, rgba(48,43,99,0.65) 50%, rgba(36,36,62,0.65) 100%);
    background-size: cover, cover;
    background-position: center center, center center;
    background-repeat: no-repeat, no-repeat;
    background-blend-mode: overlay;
    color: #ffffff;
}
.game-container {
    background: rgba(255, 255, 255, 0.1);
    padding: 25px;
    border-radius: 25px;
    box-shadow: 0 15px 35px rgba(0, 0, 0, 0.4);
    text-align: center;
    max-width: 580px;
    width: 100%;
    border: 1px solid rgba(99, 4, 78, 0.2);
}
h1 {
    color: #2c3e50;
    margin-bottom: 20px;
    font-size: 2rem;
    font-weight: normal;
    letter-spacing: -1px;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    background: linear-gradient(135deg, #8ab4ff 0%, #5867dd 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
/* Header with title icon */
.game-header {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin-bottom: 6px;
    flex-wrap: nowrap;
}
.title-emoji {
    width: 3.8rem;
    height: 3.8rem;
    object-fit: contain;
    filter: drop-shadow(0 6px 14px rgba(0,0,0,0.4));
}
@media (max-width: 600px) {
    .title-emoji {
        width: 3rem;
        height: 3rem;
    }
    .game-container {
        max-width: 92%;
        padding: 28px;
    }
}
/* Scoreboard - Game score and current turn display */
.scoreboard {
    background: linear-gradient(135deg, rgba(16, 24, 52, 0.8) 0%, rgba(28, 42, 86, 0.8) 100%);
    padding: 15px;
    border-radius: 12px;
    margin-bottom: 20px;
    border: 1px solid rgba(138, 180, 255, 0.2);
    box-shadow: 0 5px 15px rgba(88, 103, 221, 0.2);
    color: white;
    backdrop-filter: blur(10px);
}
.scores {
    display: flex;
    justify-content: space-around;
    margin-bottom: 10px;
}
.score {
    font-size: 1rem;
    font-weight: normal;
    color: #8ab4ff;
    text-shadow: 0 0 10px rgba(138, 180, 255, 0.5);
    letter-spacing: -0.5px;
}
.current-turn {
    font-size: 1.3rem;
    font-weight: normal;
    color: #ffffff;
    background: linear-gradient(135deg, rgba(88, 103, 221, 0.85) 0%, rgba(40, 48, 122, 0.85) 100%);
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(138, 180, 255, 0.3);
    box-shadow: 0 0 20px rgba(88, 103, 221, 0.35);
    backdrop-filter: blur(6px);
}
/* Play Options - against another Player or the Computer */
.play-options {
    font-size: 1.3rem;
    font-weight: normal;
    color: #ffffff;
    background: rgba(16, 24, 52, 0.6);
    padding: 10px 14px;
    border-radius: 8px;
    border: 1px solid rgba(138, 180, 255, 0.2);
    box-shadow: 0 0 20px rgba(88, 103, 221, 0.2);
    backdrop-filter: blur(8px);
}
.play-options {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 15px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    min-height: 40px;
}
.play-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 1rem;
}
.play-options label img.emoji {
    width: 2.6em;
    height: 2.6em;
    margin: 0;
}
.play-options select {
    background: rgba(16, 24, 52, 0.6);
    color: #ffffff;
    border: 1px solid rgba(138, 180, 255, 0.3);
    border-radius: 4px;
    padding: 4px 8px;
    font-family: 'Zen Dots', system-ui, sans-serif;
    font-size: 0.9rem;
}
.play-options input[type="radio"] {
    accent-color: #8ab4ff;
}
.game-message {
    margin: 15px 0;
    font-size: 1.1rem;
    font-weight: bold;
    min-height: 36px;
    text-align: center;
    padding: 10px;
    border-radius: 10px;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: rgba(16, 24, 52, 0.6);
    border: 1px solid rgba(138, 180, 255, 0.2);
    box-shadow: 0 0 20px rgba(88, 103, 221, 0.2);
    backdrop-filter: blur(8px);
}
.game-message.winner {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 5px 15px rgba(39, 174, 96, 0.3);
}
.game-message.draw {
    background: linear-gradient(135deg, #f39c12 0%, #f1c40f 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 5px 15px rgba(243, 156, 18, 0.3);
}
.game-message.error {
    background: linear-gradient(135deg, #e74c3c 0%, #c0392b 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 5px 15px rgba(231, 76, 60, 0.3);
}
.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 12px;
    margin: 20px auto;
    background: linear-gradient(135deg, rgba(16, 24, 52, 0.6) 0%, rgba(28, 42, 86, 0.6) 100%);
    padding: 15px;
    border-radius: 20px;
    box-shadow: 0 0 40px rgba(88, 103, 221, 0.32);
    aspect-ratio: 1 / 1;
    width: 100%;
    max-width: 420px;
    border: 1px solid rgba(138, 180, 255, 0.3);
    backdrop-filter: blur(10px);
}
.cell {
    background: linear-gradient(135deg, rgba(28, 42, 86, 0.45) 0%, rgba(16, 24, 52, 0.45) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: clamp(3rem, 8vw, 5rem);
    font-weight: bold;
    cursor: pointer;
    border: 1px solid rgba(138, 180, 255, 0.2);
    border-radius: 16px;
    transition: all 0.3s ease;
    box-shadow: 0 0 20px rgba(88, 103, 221, 0.22);
    min-height: 80px;
    color: #8ab4ff;
    text-shadow: 0 0 12px rgba(138, 180, 255, 0.55);
}
.cell:hover {
    background: linear-gradient(135deg, #ffffff 0%, #d5dbdb 100%);
    transform: scale(1.05);
    box-shadow: 0 6px 12px rgba(0, 0, 0, 0.3);
}
.cell:active {
    transform: scale(0.95);
}
/* Enhanced Controls - Game buttons and interactive elements */
.controls {
    display: flex;
    gap: 12px;
    margin-top: 25px;
    justify-content: center;
    flex-wrap: wrap;
}
button {
    padding: 14px 24px;
    font-size: 0.9rem;
    font-family: 'Zen Dots', system-ui, sans-serif;
    letter-spacing: -0.5px;
    cursor: pointer;
    border: none;
    border-radius: 10px;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    color: white;
    font-weight: bold;
    transition: all 0.3s ease;
    box-shadow: 0 5px 15px rgba(52, 152, 219, 0.3);
    min-width: 170px;
    position: relative;
    overflow: hidden;
}
button::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.5s;
}
button:hover::before {
    left: 100%;
}
button:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(44, 62, 80, 0.4);
}
button:active {
    transform: translateY(-1px);
}
button#reset-scoreboard {
    background: linear-gradient(135deg, rgba(88, 103, 221, 0.9) 0%, rgba(40, 48, 122, 0.9) 100%);
    box-shadow: 0 0 20px rgba(138, 180, 255, 0.4);
    border: 1px solid rgba(138, 180, 255, 0.3);
}
button#reset-scoreboard:hover {
    box-shadow: 0 8px 20px rgba(39, 174, 96, 0.4);
}
/* Player Marks - Styling for X and O markers */
.mark-x {
    color: #e74c3c;
    text-shadow: 2px 2px 4px rgba(231, 76, 60, 0.3);
    animation: fadeIn 0.4s ease;
}
.mark-o {
    color: #3498db;
    text-shadow: 2px 2px 4px rgba(52, 152, 219, 0.3);
    animation: fadeIn 0.4s ease;
}
@keyframes fadeIn {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    70% {
        transform: scale(1.1) rotate(10deg);
        opacity: 0.8;
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}
/* Emoji Images - Styling for animated game status indicators */
.emoji {
    width: 2.6em;
    height: 2.6em;
    vertical-align: middle;
    margin: 0 0.25em;
    display: inline-block;
    object-fit: contain;
}
/* Make reset buttons slightly larger and more prominent */
button#reset-game,
button#reset-scoreboard {
    font-size: 1.05rem;
    padding: 16px 26px;
}
/* Victory Effect - Animation and styling for winning combinations */
.winning-line {
    background: linear-gradient(135deg, #27ae60 0%, #2ecc71 100%) !important;
    color: white !important;
    animation: celebrar 0.6s ease infinite alternate;
    box-shadow: 0 0 20px rgba(39, 174, 96, 0.5);
}
@keyframes celebrar {
    0% {
        transform: scale(1);
        box-shadow: 0 0 20px rgba(39, 174, 96, 0.5);
    }
    100% {
        transform: scale(1.05);
        box-shadow: 0 0 30px rgba(39, 174, 96, 0.8);
    }
}
/* Responsive Design - Extra small screens (< 360px) */
@media (max-width: 359px) {
    body {
        padding: 8px;
    }
    .game-container {
        padding: 16px;
        border-radius: 16px;
    }
    .game-header {
        gap: 12px;
        margin-bottom: 8px;
    }
    .title-emoji {
        width: 3rem;
        height: 3rem;
    }
    h1 {
        font-size: 1.6rem;
    }
    .scoreboard {
        padding: 10px;
        margin-bottom: 12px;
    }
    .scores {
        flex-direction: column;
        gap: 6px;
        margin-bottom: 8px;
    }
    .score {
        font-size: 0.9rem;
    }
    .current-turn {
        font-size: 0.9rem;
        padding: 6px 8px;
    }
    .play-options {
        padding: 8px 12px;
        gap: 10px;
    }
    .play-options label {
        font-size: 0.9rem;
        gap: 6px;
    }
    .play-options label img.emoji {
        width: 2rem;
        height: 2rem;
    }
    .play-options select {
        padding: 3px 6px;
        font-size: 0.85rem;
    }
    .board {
        max-width: 240px;
        padding: 8px;
        gap: 8px;
    }
    .cell {
        font-size: clamp(1.6rem, 10vw, 2.5rem);
        min-height: 50px;
    }
    .game-message {
        margin: 10px 0;
        font-size: 0.95rem;
        min-height: 32px;
        padding: 8px;
    }
    .controls {
        flex-direction: column;
        align-items: center;
        gap: 8px;
        margin-top: 16px;
    }
    button {
        width: 100%;
        max-width: 200px;
        min-width: auto;
        padding: 10px 16px;
        font-size: 0.9rem;
        min-height: 40px;
    }
    .emoji {
        width: 1.4em;
        height: 1.4em;
    }
    footer {
        font-size: 13px;
        margin-top: 16px;
        text-shadow: 2px 2px 10px rgba(0, 0, 0, 0.5);
    }
}
/* Responsive Design - Small screens (360px - 400px) */
@media (min-width: 360px) and (max-width: 400px) {
    body {
        padding: 10px;
    }
    .game-container {
        padding: 20px;
    }
    h1 {
        font-size: 1.9rem;
    }
    .board {
        max-width: 280px;
        padding: 10px;
    }
    .cell {
        font-size: clamp(2rem, 10vw, 3.5rem);
        min-height: 60px;
    }
    .controls {
        flex-direction: column;
        align-items: center;
        gap: 10px;
    }
    button {
        width: 100%;
        max-width: 220px;
        min-width: auto;
        min-height: 44px;
    }
    /* Scale down emojis and reset buttons on small screens */
    .emoji {
        width: 1.6em;
        height: 1.6em;
    }
    button#reset-game,
    button#reset-scoreboard {
        font-size: 0.95rem;
        padding: 12px 18px;
    }
    /* Make current-turn smaller on very small screens to keep layout tidy */
    .current-turn {
        font-size: 1rem;
        padding: 8px 10px;
    }
    .scoreboard {
        padding: 12px;
    }
    .score {
        font-size: 1rem;
    }
    footer {
        font-size: 14px;
        text-shadow: 2px 2px 12px rgba(0, 0, 0, 0.5);
    }
}
    /* Responsive Design - Medium mobile screens (400px - 599px) */
    @media (min-width: 400px) and (max-width: 599px) {
        body {
            padding: 12px;
        }
        .game-container {
            padding: 22px;
            max-width: 500px;
        }
        .game-header {
            gap: 18px;
            margin-bottom: 10px;
        }
        .title-emoji {
            width: 3.4rem;
            height: 3.4rem;
        }
        h1 {
            font-size: 2rem;
        }
        .scoreboard {
            padding: 14px;
            margin-bottom: 16px;
        }
        .scores {
            flex-direction: row;
            justify-content: space-around;
            margin-bottom: 12px;
        }
        .score {
            font-size: 1.05rem;
        }
        .current-turn {
            font-size: 1.15rem;
            padding: 10px 14px;
        }
        .play-options {
            padding: 10px 16px;
            gap: 12px;
        }
        .play-options label {
            font-size: 1rem;
            gap: 8px;
        }
        .play-options label img.emoji {
            width: 2.4em;
            height: 2.4em;
        }
        .play-options select {
            padding: 5px 8px;
            font-size: 0.95rem;
        }
        .game-message {
            margin: 15px 0;
            font-size: 1.05rem;
            min-height: 36px;
            padding: 10px;
        }
        .board {
            max-width: 340px;
            padding: 12px;
            gap: 10px;
            margin: 18px auto;
        }
        .cell {
            font-size: clamp(2.2rem, 9vw, 3.8rem);
            min-height: 68px;
        }
        .controls {
            flex-direction: row;
            align-items: center;
            justify-content: center;
            gap: 12px;
            margin-top: 20px;
            flex-wrap: wrap;
        }
        button {
            padding: 12px 24px;
            font-size: 0.95rem;
            min-height: 44px;
            width: auto;
            max-width: none;
        }
        .emoji {
            width: 1.8em;
            height: 1.8em;
        }
        button#reset-game,
        button#reset-scoreboard {
            font-size: 1rem;
            padding: 12px 24px;
        }
        footer {
            font-size: 15px;
            margin-top: 20px;
            text-shadow: 2px 2px 12px rgba(0, 0, 0, 0.5);
        }
    }
/* Responsive Design - Short height screens */
@media (max-height: 700px) {
    .game-container {
        padding: 20px;
    }
    h1 {
        font-size: 1.8rem;
        margin-bottom: 15px;
    }
    .scoreboard {
        margin-bottom: 15px;
        padding: 10px;
    }
    .board {
        max-width: 260px;
        margin: 15px auto;
    }
    .cell {
        font-size: clamp(1.8rem, 8vw, 3rem);
        min-height: 55px;
    }
    .game-message {
        margin: 15px 0;
        font-size: 1.1rem;
        min-height: 35px;
        padding: 10px;
    }
    .controls {
        margin-top: 20px;
    }
    button {
        padding: 12px 20px;
        font-size: 0.95rem;
    }
}
/* Responsive Design - Large screens (desktop) */
@media (min-width: 1200px) {
    .game-containerLarge {
        max-width: 460px;
        padding: 30px;
    }
    .board {
        max-width: 340px;
    }
    .cell {
        font-size: clamp(2.5rem, 6vw, 4.2rem);
        min-height: 85px;
    }
    h1 {
        font-size: 2.5rem;
    }
}
/* Background Effects - Optional particle overlay effect */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background:
        radial-gradient(circle at 20% 80%, rgba(120, 119, 198, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 80% 20%, rgba(255, 255, 255, 0.1) 0%, transparent 50%),
        radial-gradient(circle at 40% 40%, rgba(120, 119, 198, 0.1) 0%, transparent 50%);
    pointer-events: none;
    z-index: -1;
}
/* Footer */
footer {
  width: 100%;
  font-size: 16px;
  margin-top: 22px;
  text-align: center;
  text-shadow: 4px 4px 20px darkblue;
}
footer a {
  text-decoration: none;
  background: linear-gradient(135deg, #8ab4ff 0%, #5867dd 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  font-weight: normal;
}
footer a:hover {
  text-shadow: 0 0 10px rgba(138, 180, 255, 0.5);
}
