:root {
    --primary-bg: #0f172a;
    --accent-color: #38bdf8;
    --glass-bg: rgba(255, 255, 255, 0.05);
    --glass-border: rgba(255, 255, 255, 0.1);
    --text-primary: #f8fafc;
    --text-secondary: #94a3b8;
    --player-x: #38bdf8;
    --player-o: #f472b6;
    --draw-color: #94a3b8;
    --card-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    font-family: 'Outfit', sans-serif;
}

body {
    background-color: var(--primary-bg);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
    position: relative;
}

/* Background Animated Blobs */
.background-blobs {
    position: absolute;
    width: 100%;
    height: 100%;
    z-index: -1;
    overflow: hidden;
}

.blob {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.4;
    animation: blob-move 20s infinite alternate;
}

.blob-1 {
    width: 400px;
    height: 400px;
    background: var(--player-x);
    top: -100px;
    left: -100px;
}

.blob-2 {
    width: 350px;
    height: 350px;
    background: var(--player-o);
    bottom: -50px;
    right: -50px;
    animation-delay: -5s;
}

@keyframes blob-move {
    0% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(100px, 50px) scale(1.1); }
    66% { transform: translate(-50px, 100px) scale(0.9); }
    100% { transform: translate(0, 0) scale(1); }
}

/* Game Container */
.game-container {
    width: 90%;
    max-width: 500px;
    background: var(--glass-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid var(--glass-border);
    border-radius: 24px;
    padding: 2rem;
    box-shadow: var(--card-shadow);
    text-align: center;
    position: relative;
    z-index: 1;
}

header h1 {
    font-size: 2.5rem;
    font-weight: 700;
    margin-bottom: 1.5rem;
    letter-spacing: -1px;
}

.highlight {
    color: var(--accent-color);
}

.score-board {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 2rem;
}

.score-card {
    flex: 1;
    background: rgba(0, 0, 0, 0.2);
    padding: 0.75rem;
    border-radius: 12px;
    display: flex;
    flex-direction: column;
    border: 1px solid transparent;
    transition: all 0.3s ease;
}

.score-card .label {
    font-size: 0.75rem;
    text-transform: uppercase;
    font-weight: 600;
    color: var(--text-secondary);
}

.score-card .score {
    font-size: 1.5rem;
    font-weight: 700;
}

.score-card.player-x { border-bottom: 3px solid var(--player-x); }
.score-card.player-o { border-bottom: 3px solid var(--player-o); }
.score-card.draw { border-bottom: 3px solid var(--draw-color); }

.score-card.active {
    background: rgba(255, 255, 255, 0.05);
    transform: translateY(-5px);
}

/* Game Mode Selector */
.game-mode-selector {
    display: flex;
    background: rgba(0, 0, 0, 0.3);
    padding: 4px;
    border-radius: 100px;
    margin-bottom: 1.5rem;
}

.mode-btn {
    flex: 1;
    background: transparent;
    border: none;
    color: var(--text-secondary);
    padding: 0.5rem;
    border-radius: 100px;
    cursor: pointer;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.3s ease;
}

.mode-btn.active {
    background: var(--accent-color);
    color: var(--primary-bg);
}

/* Status Message */
.status-message {
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
    font-weight: 500;
    min-height: 1.5rem;
    color: var(--text-secondary);
}

/* Board */
.board-container {
    perspective: 1000px;
    margin-bottom: 2rem;
}

.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    gap: 10px;
    aspect-ratio: 1/1;
    max-width: 320px;
    margin: 0 auto;
    position: relative;
    padding: 5px;
}

.cell {
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    display: flex;
    justify-content: center;
    align-items: center;
    font-size: 3rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    position: relative;
    overflow: hidden;
}

.cell:hover {
    background: rgba(255, 255, 255, 0.08);
    transform: scale(1.02);
}

.cell.x { color: var(--player-x); }
.cell.o { color: var(--player-o); }

.cell.x::before, .cell.o::before {
    content: attr(data-mark);
    animation: mark-pop 0.3s forwards;
}

@keyframes mark-pop {
    0% { transform: scale(0) rotate(-45deg); opacity: 0; }
    70% { transform: scale(1.2) rotate(10deg); }
    100% { transform: scale(1) rotate(0); opacity: 1; }
}

/* Buttons */
.control-btn {
    background: transparent;
    border: 1px solid var(--accent-color);
    color: var(--accent-color);
    padding: 0.75rem 2rem;
    border-radius: 12px;
    cursor: pointer;
    font-weight: 600;
    font-size: 1rem;
    transition: all 0.3s ease;
    width: 100%;
}

.control-btn:hover {
    background: var(--accent-color);
    color: var(--primary-bg);
}

/* Modal */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    backdrop-filter: blur(4px);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 100;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s ease;
}

.modal.show {
    opacity: 1;
    pointer-events: all;
}

.modal-content {
    background: var(--primary-bg);
    border: 1px solid var(--glass-border);
    padding: 3rem;
    border-radius: 24px;
    max-width: 400px;
    width: 90%;
    transform: scale(0.8);
    transition: transform 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.modal.show .modal-content {
    transform: scale(1);
}

.modal-content h2 {
    font-size: 2.5rem;
    margin-bottom: 2rem;
}

/* Responsive Adjustments */
@media (max-width: 400px) {
    .game-container { padding: 1.5rem; }
    header h1 { font-size: 2rem; }
    .score-card .score { font-size: 1.25rem; }
    .cell { font-size: 2.5rem; }
}
