* {
    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;
}

.back-link {
    display: inline-block;
    color: #4ecca3;
    text-decoration: none;
    margin-bottom: 0.5rem;
}

.back-link: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;
}

.game-info {
    display: flex;
    gap: 2rem;
    font-size: 1.1rem;
    align-items: center;
}

.game-info strong {
    color: #4ecca3;
}

.turn-indicator {
    font-weight: 600;
    padding: 0.25rem 0.75rem;
    border-radius: 4px;
}

.turn.red {
    color: #e94560;
}

.turn.yellow {
    color: #f0c000;
}

.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;
}

.game-board {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 6px;
    padding: 10px;
    background: #2040a0;
    border-radius: 8px;
    max-width: 350px;
}

.cell {
    width: 44px;
    height: 44px;
    background: #1a1a2e;
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.2s;
}

.cell:hover {
    background: #2a2a3e;
}

.cell.red {
    background: #e94560;
    cursor: default;
}

.cell.yellow {
    background: #f0c000;
    cursor: default;
}

.cell.winning {
    animation: pulse 0.5s ease-in-out infinite alternate;
}

@keyframes pulse {
    from { transform: scale(1); }
    to { transform: scale(1.1); }
}

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

.overlay.hidden {
    display: none;
}

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

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

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

.overlay .share-btn {
    background: #2a9d8f;
    margin-top: 0.5rem;
}

.overlay .share-btn:hover {
    background: #248c7f;
}

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

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

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

.content {
    padding-top: 1rem;
    border-top: 1px solid #2a2a3e;
}

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

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

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

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

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

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

    h1 {
        font-size: 2rem;
    }

    .cell {
        width: 50px;
        height: 50px;
    }

    .game-board {
        max-width: 400px;
    }

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

@media (max-width: 380px) {
    .cell {
        width: 38px;
        height: 38px;
    }

    .game-board {
        gap: 4px;
        padding: 8px;
    }
}
