:root {
    --primary-color: #1e3a8a;
    --secondary-color: #3b82f6;
    --background-color: #e0f2fe;
    --text-color: #1e3a8a;
    --highlight-color: #60a5fa;
    --cell-color: #bfdbfe;
}

[data-color-scheme="dark"] {
    --primary-color: #60a5fa;
    --secondary-color: #3b82f6;
    --background-color: #1e3a8a;
    --text-color: #e0f2fe;
    --highlight-color: #93c5fd;
    --cell-color: #1e40af;
}

[data-color-scheme="light"] {
    --primary-color: #3b82f6;
    --secondary-color: #60a5fa;
    --background-color: #ffffff;
    --text-color: #1e3a8a;
    --highlight-color: #93c5fd;
    --cell-color: #e0f2fe;
}

[data-color-scheme="colorful"] {
    --primary-color: #f59e0b;
    --secondary-color: #10b981;
    --background-color: #fef3c7;
    --text-color: #b45309;
    --highlight-color: #34d399;
    --cell-color: #d1fae5;
}

body {
    font-family: 'Poppins', sans-serif;
    margin: 0;
    padding: 0;
    background-color: var(--background-color);
    color: var(--text-color);
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    overflow-x: hidden;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
    box-sizing: border-box;
}

@media (min-width: 1024px) {
    .game-container {
        flex-direction: row;
        justify-content: space-between;
        align-items: flex-start;
    }
}

.game-board {
    background-color: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    margin-bottom: 2rem;
    width: 100%;
    max-width: 500px;
}

@media (min-width: 1024px) {
    .game-board {
        margin-bottom: 0;
        margin-right: 2rem;
    }
}

.game-info {
    background-color: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 500px;
}

h1 {
    color: var(--primary-color);
    margin-bottom: 1rem;
    font-size: 2.5em;
    text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
    text-align: center;
}

.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-gap: 15px;
    margin: 2rem 0;
}

.cell {
    aspect-ratio: 1;
    background-color: var(--cell-color);
    border: none;
    border-radius: 15px;
    font-size: 2.5em;
    font-weight: bold;
    color: var(--primary-color);
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.cell:hover {
    background-color: var(--highlight-color);
    transform: scale(1.05);
}

.cell::before {
    content: attr(data-symbol);
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    transition: all 0.5s ease;
}

.cell.x::before, .cell.o::before {
    opacity: 1;
}

.cell.winner {
    background-color: var(--primary-color);
    color: white;
    animation: pulse 1s infinite;
}

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

#status {
    margin-top: 1rem;
    font-size: 1.2em;
    font-weight: bold;
    color: var(--primary-color);
    height: 1.5em;
    text-align: center;
}

.button-container {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

button {
    padding: 10px 20px;
    font-size: 1em;
    background-color: var(--primary-color);
    color: white;
    border: none;
    border-radius: 5px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: inherit;
}

button:hover {
    background-color: var(--highlight-color);
    transform: translateY(-2px);
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

#score {
    display: flex;
    justify-content: space-around;
    margin-top: 1rem;
    font-size: 1.2em;
    background-color: var(--cell-color);
    border-radius: 10px;
    padding: 1rem;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
}

.score-value {
    font-size: 1.5em;
    font-weight: bold;
    color: var(--primary-color);
}

#timer {
    font-size: 1.2em;
    margin-top: 1rem;
    color: var(--primary-color);
    text-align: center;
}

.confetti {
    position: absolute;
    width: 10px;
    height: 10px;
    background-color: #f0f;
    animation: confetti-fall 3s ease-out infinite;
}

@keyframes confetti-fall {
    0% { transform: translateY(-100vh) rotate(0deg); }
    100% { transform: translateY(100vh) rotate(720deg); }
}

.player-input {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.player-input input {
    padding: 5px;
    border: 1px solid var(--primary-color);
    border-radius: 5px;
    font-size: 1em;
    font-family: inherit;
    width: 45%;
}

.timer-controls {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 1rem;
    margin-top: 1rem;
}

/* Styles for landing screen and animations */
.landing-screen {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: var(--background-color);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 1000;
    transition: opacity 0.5s ease-in-out;
}

.landing-content {
    text-align: center;
    color: var(--primary-color);
    background-color: white;
    padding: 2rem;
    border-radius: 15px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

.landing-title {
    font-size: 3em;
    margin-bottom: 1rem;
    animation: fadeInUp 1s ease-out;
}

.start-game-btn {
    font-size: 1.2em;
    padding: 15px 30px;
    background-color: var(--highlight-color);
    border: none;
    border-radius: 5px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    animation: fadeInUp 1s ease-out 0.5s both;
    margin-bottom: 20px;
}

.start-game-btn:hover {
    background-color: var(--secondary-color);
    transform: translateY(-3px);
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

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

.loading-animation {
    width: 50px;
    height: 50px;
    border: 5px solid var(--highlight-color);
    border-top: 5px solid var(--primary-color);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    margin: 20px auto;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Background animations */
.background-animation {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.bubble {
    position: absolute;
    border-radius: 50%;
    background: rgba(96, 165, 250, 0.2);
    animation: float 15s infinite;
}

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0deg); }
    50% { transform: translateY(-100px) rotate(180deg); }
}

/* New styles for language and settings */
.settings-container {
    display: flex;
    justify-content: space-between;
    margin-bottom: 1rem;
}

.language-select, .color-scheme-select, .font-select {
    padding: 5px;
    border: 1px solid var(--primary-color);
    border-radius: 5px;
    font-size: 1em;
    font-family: inherit;
}

.settings-button {
    background-color: var(--secondary-color);
    color: white;
    border: none;
    border-radius: 5px;
    padding: 5px 10px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s ease;
}

.settings-button:hover {
    background-color: var(--highlight-color);
}

.settings-modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

.settings-modal-content {
    background-color: #fefefe;
    margin: 15% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 80%;
    max-width: 500px;
    border-radius: 10px;
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
}

.close:hover,
.close:focus {
    color: #000;
    text-decoration: none;
    cursor: pointer;
}

.color-scheme-label, .font-label {
    margin-bottom: 20px;
}