/* ============================================================
   TIC-TAC-TOE — Dark Glassmorphism Theme
   ============================================================ */

:root {
    --bg: #0a0a0f;
    --bg-2: #111118;
    --glass: rgba(255, 255, 255, 0.04);
    --glass-border: rgba(255, 255, 255, 0.08);
    --text: #e8e8ed;
    --text-2: rgba(255, 255, 255, 0.55);
    --text-3: rgba(255, 255, 255, 0.3);
    --x-color: #6c63ff;
    --o-color: #00d4aa;
    --accent: #6c63ff;
    --gradient: linear-gradient(135deg, #6c63ff, #00d4aa);
    --font: 'Inter', sans-serif;
    --ease: cubic-bezier(0.16, 1, 0.3, 1);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

::selection {
    background: rgba(108, 99, 255, 0.3);
}

.game-container {
    text-align: center;
    max-width: 480px;
    width: 100%;
}

.game-header h1 {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 6px;
}

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

.subtitle {
    font-size: 14px;
    color: var(--text-3);
    margin-bottom: 28px;
}

/* Mode Selection */
.mode-selection {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 16px;
}

.mode-btn {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 12px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-2);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--ease);
}

.mode-btn:hover {
    border-color: rgba(108, 99, 255, 0.2);
    color: var(--text);
}

.mode-btn.active {
    background: rgba(108, 99, 255, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

/* Difficulty */
.difficulty-selection {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    margin-bottom: 24px;
}

.diff-label {
    font-size: 12px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.diff-btn {
    padding: 6px 16px;
    border-radius: 8px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-3);
    font-family: var(--font);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.diff-btn:hover {
    color: var(--text-2);
    border-color: rgba(108, 99, 255, 0.15);
}

.diff-btn.active {
    background: rgba(108, 99, 255, 0.1);
    border-color: var(--accent);
    color: var(--accent);
}

/* Scoreboard */
.scoreboard {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 28px;
}

.score-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    padding: 14px 24px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    min-width: 90px;
    transition: all 0.3s;
}

.score-icon {
    font-size: 20px;
    font-weight: 800;
}

.x-score .score-icon { color: var(--x-color); }
.o-score .score-icon { color: var(--o-color); }
.draw-score .score-icon { color: var(--text-3); }

.score-name {
    font-size: 11px;
    color: var(--text-3);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.score-value {
    font-size: 28px;
    font-weight: 800;
}

/* Board */
.board-wrapper {
    position: relative;
    display: inline-block;
    margin-bottom: 20px;
}

.board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 8px;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: 18px;
    backdrop-filter: blur(20px);
}

.cell {
    width: 110px;
    height: 110px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--glass-border);
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 44px;
    font-weight: 800;
    cursor: pointer;
    transition: all 0.3s var(--ease);
    user-select: none;
    position: relative;
    overflow: hidden;
}

.cell:hover:not(.taken) {
    background: rgba(108, 99, 255, 0.06);
    border-color: rgba(108, 99, 255, 0.15);
    transform: scale(1.02);
}

.cell.taken {
    cursor: not-allowed;
}

.cell.x {
    color: var(--x-color);
    text-shadow: 0 0 20px rgba(108, 99, 255, 0.3);
    animation: popIn 0.3s var(--ease);
}

.cell.o {
    color: var(--o-color);
    text-shadow: 0 0 20px rgba(0, 212, 170, 0.3);
    animation: popIn 0.3s var(--ease);
}

.cell.win-cell {
    background: rgba(108, 99, 255, 0.08);
    border-color: var(--accent);
    animation: winPulse 0.6s ease-in-out infinite alternate;
}

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

@keyframes winPulse {
    from { box-shadow: 0 0 0 0 rgba(108, 99, 255, 0.3); }
    to { box-shadow: 0 0 20px 4px rgba(108, 99, 255, 0.15); }
}

/* Win Line */
.win-line {
    position: absolute;
    background: var(--gradient);
    border-radius: 4px;
    opacity: 0;
    transition: opacity 0.3s;
    z-index: 10;
    pointer-events: none;
}

.win-line.show {
    opacity: 0.6;
}

/* Status */
.status {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-2);
    margin-bottom: 20px;
    min-height: 24px;
    transition: all 0.3s;
}

.status.win {
    background: var(--gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-size: 20px;
}

/* Buttons */
.actions {
    display: flex;
    gap: 12px;
    justify-content: center;
    margin-bottom: 20px;
}

.btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 10px 22px;
    border-radius: 12px;
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s var(--ease);
    border: none;
}

.btn-restart {
    background: var(--gradient);
    color: white;
}

.btn-restart:hover {
    box-shadow: 0 6px 20px rgba(108, 99, 255, 0.3);
    transform: translateY(-1px);
}

.btn-reset {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-2);
}

.btn-reset:hover {
    border-color: rgba(255, 107, 107, 0.3);
    color: #ff6b6b;
}

.back-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--text-3);
    text-decoration: none;
    font-size: 13px;
    transition: color 0.3s;
}

.back-link:hover {
    color: var(--accent);
}

/* Responsive */
@media (max-width: 500px) {
    .cell {
        width: 85px;
        height: 85px;
        font-size: 34px;
    }
    .game-header h1 { font-size: 28px; }
    .scoreboard { gap: 10px; }
    .score-item { padding: 10px 16px; min-width: 75px; }
    .score-value { font-size: 22px; }
    .mode-selection { flex-direction: column; align-items: center; }
}
