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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f1a;
    color: #e0e0e0;
    line-height: 1.6;
    min-height: 100vh;
}

main {
    max-width: 800px;
    margin: 0 auto;
    padding: 1rem;
}

.breadcrumb {
    font-size: 0.85rem;
    color: #888;
    margin-bottom: 0.75rem;
}

.breadcrumb a {
    color: #4ecca3;
    text-decoration: none;
}

.breadcrumb a:hover {
    text-decoration: underline;
}

h1 {
    text-align: center;
    color: #4ecca3;
    font-size: 1.75rem;
    margin-bottom: 1rem;
}

.game-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    margin-bottom: 2rem;
    position: relative;
}

.mode-selector {
    display: flex;
    gap: 0.5rem;
}

.mode-btn {
    padding: 0.5rem 1rem;
    font-size: 0.9rem;
    background: #1a1a2e;
    color: #e0e0e0;
    border: 2px solid #4ecca3;
    border-radius: 4px;
    cursor: pointer;
    transition: all 0.2s;
}

.mode-btn:hover {
    background: #2a2a3e;
}

.mode-btn.active {
    background: #4ecca3;
    color: #0f0f1a;
    font-weight: 600;
}

.game-info {
    font-size: 1.1rem;
    font-weight: 600;
    min-height: 1.8rem;
}

.turn {
    padding: 0.2rem 0.75rem;
    border-radius: 4px;
}

.turn.x-turn {
    color: #4ecca3;
}

.turn.o-turn {
    color: #e94560;
}

.score-bar {
    display: flex;
    gap: 2rem;
    background: #1a1a2e;
    border: 1px solid #2a2a4e;
    border-radius: 8px;
    padding: 0.6rem 1.5rem;
}

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

.score-label {
    font-size: 0.75rem;
    color: #888;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.score-value {
    font-size: 1.4rem;
    font-weight: 700;
}

.x-color {
    color: #4ecca3;
}

.o-color {
    color: #e94560;
}

.muted {
    color: #888;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    padding: 12px;
    background: #1a1a2e;
    border: 2px solid #2a2a4e;
    border-radius: 12px;
    width: 240px;
    height: 240px;
}

.cell {
    background: #0f0f1a;
    border: 2px solid #2a2a4e;
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2.5rem;
    font-weight: 700;
    line-height: 1;
    transition: background-color 0.15s, border-color 0.15s;
    user-select: none;
}

.cell:hover:not(.taken) {
    background: #2a2a3e;
    border-color: #4ecca3;
}

.cell.taken {
    cursor: default;
}

.cell.x {
    color: #4ecca3;
}

.cell.o {
    color: #e94560;
}

.cell.winning {
    animation: pulse-win 0.5s ease-in-out infinite alternate;
    border-color: #4ecca3;
}

.cell.winning.o {
    border-color: #e94560;
    animation-name: pulse-win-o;
}

@keyframes pulse-win {
    from {
        background: #0f0f1a;
        box-shadow: 0 0 0 0 rgba(78, 204, 163, 0);
    }
    to {
        background: rgba(78, 204, 163, 0.15);
        box-shadow: 0 0 12px 2px rgba(78, 204, 163, 0.4);
    }
}

@keyframes pulse-win-o {
    from {
        background: #0f0f1a;
        box-shadow: 0 0 0 0 rgba(233, 69, 96, 0);
    }
    to {
        background: rgba(233, 69, 96, 0.15);
        box-shadow: 0 0 12px 2px rgba(233, 69, 96, 0.4);
    }
}

.overlay {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(15, 15, 26, 0.97);
    padding: 2rem 2.5rem;
    border-radius: 12px;
    border: 2px solid #4ecca3;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1rem;
    z-index: 10;
    text-align: center;
    min-width: 200px;
}

.overlay.hidden {
    display: none;
}

.overlay p {
    font-size: 1.5rem;
    font-weight: 700;
    color: #4ecca3;
}

.overlay p.loss-text {
    color: #e94560;
}

.overlay p.draw-text {
    color: #888;
}

.overlay button {
    padding: 0.75rem 2rem;
    font-size: 1rem;
    background: #4ecca3;
    color: #0f0f1a;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: background 0.2s;
}

.overlay button:hover {
    background: #3db892;
}

.new-game-btn {
    padding: 0.5rem 1.5rem;
    font-size: 0.9rem;
    background: #1a1a2e;
    color: #4ecca3;
    border: 2px solid #4ecca3;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.new-game-btn:hover {
    background: #4ecca3;
    color: #0f0f1a;
}

.instructions {
    font-size: 0.9rem;
    color: #888;
    text-align: center;
}

/* Article / SEO content */
.content {
    padding-top: 1.5rem;
    border-top: 1px solid #2a2a4e;
}

.last-updated {
    font-size: 0.8rem;
    color: #888;
    margin-bottom: 0.5rem;
}

.content h2 {
    color: #4ecca3;
    font-size: 1.25rem;
    margin: 1.5rem 0 0.75rem;
}

.content h2:first-of-type {
    margin-top: 1rem;
}

.content p {
    margin-bottom: 0.75rem;
    color: #c0c0c0;
}

.content ul {
    margin: 0.5rem 0 1rem 1.5rem;
    color: #c0c0c0;
}

.content li {
    margin-bottom: 0.5rem;
}

.faq {
    margin: 0.5rem 0 1rem;
}

.faq dt {
    font-weight: 600;
    color: #e0e0e0;
    margin-top: 1rem;
}

.faq dd {
    color: #c0c0c0;
    margin-left: 1rem;
    margin-top: 0.25rem;
}

.related-games {
    margin-top: 2rem;
    padding: 1rem;
    background: #1a1a2e;
    border: 1px solid #2a2a4e;
    border-radius: 8px;
}

.related-games h3 {
    color: #4ecca3;
    font-size: 1rem;
    margin-bottom: 0.75rem;
}

.game-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
}

.game-links a {
    display: inline-block;
    padding: 0.4rem 0.9rem;
    background: #0f0f1a;
    color: #4ecca3;
    border: 1px solid #2a2a4e;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.875rem;
    transition: all 0.2s;
}

.game-links a:hover {
    background: #4ecca3;
    color: #0f0f1a;
    border-color: #4ecca3;
}

/* Responsive */
@media (min-width: 600px) {
    main {
        padding: 2rem;
    }

    h1 {
        font-size: 2rem;
    }

    .game-board {
        width: 300px;
        height: 300px;
        gap: 10px;
        padding: 14px;
    }

    .cell {
        font-size: 3.5rem;
    }

    .instructions {
        font-size: 1rem;
    }
}

@media (max-width: 340px) {
    .game-board {
        width: 210px;
        height: 210px;
        gap: 6px;
        padding: 10px;
    }

    .cell {
        font-size: 2rem;
    }

    .score-bar {
        gap: 1rem;
        padding: 0.6rem 1rem;
    }
}

@media (orientation: landscape) and (max-height: 500px) {
    main { padding-top: 0.5rem; }
    h1 { font-size: 1.5rem; margin-bottom: 0.5rem; }
}
